Finish shop and fldeff_escalator
This commit is contained in:
132
src/fldeff_escalator.c
Normal file
132
src/fldeff_escalator.c
Normal file
@@ -0,0 +1,132 @@
|
||||
#include "global.h"
|
||||
#include "task.h"
|
||||
#include "fieldmap.h"
|
||||
#include "field_camera.h"
|
||||
#include "field_player_avatar.h"
|
||||
|
||||
static EWRAM_DATA u8 sEscalatorAnim_TaskId = 0;
|
||||
|
||||
void sub_80E12E8(u8 taskId, const s16 *list, u16 c)
|
||||
{
|
||||
s16 r5 = gTasks[taskId].data[4] - 1;
|
||||
s16 r3 = gTasks[taskId].data[5] - 1;
|
||||
s16 r4 = gTasks[taskId].data[1];
|
||||
s16 y;
|
||||
s16 x;
|
||||
|
||||
if (gTasks[taskId].data[2] == 0)
|
||||
{
|
||||
for (y = 0; y < 3; y++)
|
||||
{
|
||||
for (x = 0; x < 3; x++)
|
||||
{
|
||||
s16 metatileId = MapGridGetMetatileIdAt(r5 + x, r3 + y);
|
||||
|
||||
if (list[r4] == metatileId)
|
||||
{
|
||||
if (r4 != 2)
|
||||
MapGridSetMetatileIdAt(r5 + x, r3 + y, c | list[r4 + 1]);
|
||||
else
|
||||
MapGridSetMetatileIdAt(r5 + x, r3 + y, c | list[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (y = 0; y < 3; y++)
|
||||
{
|
||||
for (x = 0; x < 3; x++)
|
||||
{
|
||||
s16 metatileId = MapGridGetMetatileIdAt(r5 + x, r3 + y);
|
||||
|
||||
if (list[2 - r4] == metatileId)
|
||||
{
|
||||
if (r4 != 2)
|
||||
MapGridSetMetatileIdAt(r5 + x, r3 + y, c | list[1 - r4]);
|
||||
else
|
||||
MapGridSetMetatileIdAt(r5 + x, r3 + y, c | list[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const u16 gUnknown_08589ABA[] = {0x284, 0x282, 0x280};
|
||||
static const u16 gUnknown_08589AC0[] = {0x285, 0x283, 0x281};
|
||||
static const u16 gUnknown_08589AC6[] = {0x28C, 0x28A, 0x288};
|
||||
static const u16 gUnknown_08589ACC[] = {0x28D, 0x28B, 0x289};
|
||||
static const u16 gUnknown_08589AD2[] = {0x2A0, 0x2A2, 0x2A4};
|
||||
static const u16 gUnknown_08589AD8[] = {0x2A1, 0x2A3, 0x2A5};
|
||||
static const u16 gUnknown_08589ADE[] = {0x2A8, 0x2AA, 0x2AC};
|
||||
|
||||
void sub_80E1444(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
|
||||
data[3] = 1;
|
||||
|
||||
switch (data[0])
|
||||
{
|
||||
case 0:
|
||||
sub_80E12E8(taskId, gUnknown_08589ABA, 0);
|
||||
break;
|
||||
case 1:
|
||||
sub_80E12E8(taskId, gUnknown_08589AC0, 0);
|
||||
break;
|
||||
case 2:
|
||||
sub_80E12E8(taskId, gUnknown_08589AC6, 0xC00);
|
||||
break;
|
||||
case 3:
|
||||
sub_80E12E8(taskId, gUnknown_08589ACC, 0);
|
||||
break;
|
||||
case 4:
|
||||
sub_80E12E8(taskId, gUnknown_08589AD2, 0xC00);
|
||||
break;
|
||||
case 5:
|
||||
sub_80E12E8(taskId, gUnknown_08589AD8, 0);
|
||||
break;
|
||||
case 6:
|
||||
sub_80E12E8(taskId, gUnknown_08589ADE, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
data[0] = (data[0] + 1) & 7;
|
||||
if (!data[0])
|
||||
{
|
||||
DrawWholeMapView();
|
||||
data[1] = (data[1] + 1) % 3;
|
||||
data[3] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
u8 sub_80E150C(u16 var)
|
||||
{
|
||||
u8 taskId = CreateTask(sub_80E1444, 0);
|
||||
s16 *data = gTasks[taskId].data;
|
||||
|
||||
PlayerGetDestCoords(&data[4], &data[5]);
|
||||
data[0] = 0;
|
||||
data[1] = 0;
|
||||
data[2] = var;
|
||||
sub_80E1444(taskId);
|
||||
return taskId;
|
||||
}
|
||||
|
||||
void sub_80E1558(u8 var)
|
||||
{
|
||||
sEscalatorAnim_TaskId = sub_80E150C(var);
|
||||
}
|
||||
|
||||
void sub_80E1570(void)
|
||||
{
|
||||
DestroyTask(sEscalatorAnim_TaskId);
|
||||
}
|
||||
|
||||
bool8 sub_80E1584(void)
|
||||
{
|
||||
if (gTasks[sEscalatorAnim_TaskId].data[3] == 0 && gTasks[sEscalatorAnim_TaskId].data[1] == 2)
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
1031
src/shop.c
1031
src/shop.c
File diff suppressed because it is too large
Load Diff
@@ -349,9 +349,9 @@ const u8 gText_Var1ThrownAway[] = _("The {STR_VAR_1}\nwas thrown away.");
|
||||
const u8 gText_Var1AteTheVar2[] = _("{STR_VAR_1} ate the\n{STR_VAR_2}.{PAUSE_UNTIL_PRESS}");
|
||||
const u8 gText_Var1HappilyAteVar2[] = _("{STR_VAR_1} happily ate the\n{STR_VAR_2}.{PAUSE_UNTIL_PRESS}");
|
||||
const u8 gText_Var1DisdainfullyAteVar2[] = _("{STR_VAR_1} disdainfully ate the\n{STR_VAR_2}.{PAUSE_UNTIL_PRESS}");
|
||||
const u8 gUnknown_085E93C7[] = _("BUY");
|
||||
const u8 gUnknown_085E93CB[] = _("SELL");
|
||||
const u8 gUnknown_085E93D0[] = _("QUIT");
|
||||
const u8 gText_ShopBuy[] = _("BUY");
|
||||
const u8 gText_ShopSell[] = _("SELL");
|
||||
const u8 gText_ShopQuit[] = _("QUIT");
|
||||
const u8 gText_InBagVar1[] = _("IN BAG: {STR_VAR_1}");
|
||||
const u8 gText_QuitShopping[] = _("Quit shopping.");
|
||||
const u8 gText_Var1CertainlyHowMany[] = _("{STR_VAR_1}? Certainly.\nHow many would you like?");
|
||||
|
||||
20
src/tv.c
20
src/tv.c
@@ -1580,7 +1580,7 @@ void SaveRecordedItemPurchasesForTVShow(void)
|
||||
if (sCurTVShowSlot != -1 && HasMixableShowAlreadyBeenSpawnedWithPlayerID(TVSHOW_SMART_SHOPPER, FALSE) != TRUE)
|
||||
{
|
||||
TV_SortPurchasesByQuantity();
|
||||
if (gUnknown_02039F80[0].quantity >= 20)
|
||||
if (gMartPurchaseHistory[0].quantity >= 20)
|
||||
{
|
||||
show = &gSaveBlock1Ptr->tvShows[sCurTVShowSlot];
|
||||
show->smartshopperShow.kind = TVSHOW_SMART_SHOPPER;
|
||||
@@ -1588,8 +1588,8 @@ void SaveRecordedItemPurchasesForTVShow(void)
|
||||
show->smartshopperShow.shopLocation = gMapHeader.regionMapSectionId;
|
||||
for (i = 0; i < 3; i ++)
|
||||
{
|
||||
show->smartshopperShow.itemIds[i] = gUnknown_02039F80[i].itemId;
|
||||
show->smartshopperShow.itemAmounts[i] = gUnknown_02039F80[i].quantity;
|
||||
show->smartshopperShow.itemIds[i] = gMartPurchaseHistory[i].itemId;
|
||||
show->smartshopperShow.itemAmounts[i] = gMartPurchaseHistory[i].quantity;
|
||||
}
|
||||
show->smartshopperShow.priceReduced = GetPriceReduction(1);
|
||||
StringCopy(show->smartshopperShow.playerName, gSaveBlock2Ptr->playerName);
|
||||
@@ -2992,14 +2992,14 @@ void TV_SortPurchasesByQuantity(void)
|
||||
{
|
||||
for (j = i + 1; j < 3; j ++)
|
||||
{
|
||||
if (gUnknown_02039F80[i].quantity < gUnknown_02039F80[j].quantity)
|
||||
if (gMartPurchaseHistory[i].quantity < gMartPurchaseHistory[j].quantity)
|
||||
{
|
||||
tmpId = gUnknown_02039F80[i].itemId;
|
||||
tmpQn = gUnknown_02039F80[i].quantity;
|
||||
gUnknown_02039F80[i].itemId = gUnknown_02039F80[j].itemId;
|
||||
gUnknown_02039F80[i].quantity = gUnknown_02039F80[j].quantity;
|
||||
gUnknown_02039F80[j].itemId = tmpId;
|
||||
gUnknown_02039F80[j].quantity = tmpQn;
|
||||
tmpId = gMartPurchaseHistory[i].itemId;
|
||||
tmpQn = gMartPurchaseHistory[i].quantity;
|
||||
gMartPurchaseHistory[i].itemId = gMartPurchaseHistory[j].itemId;
|
||||
gMartPurchaseHistory[i].quantity = gMartPurchaseHistory[j].quantity;
|
||||
gMartPurchaseHistory[j].itemId = tmpId;
|
||||
gMartPurchaseHistory[j].quantity = tmpQn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user