Finish shop and fldeff_escalator

This commit is contained in:
Diegoisawesome 2018-10-18 12:05:02 -05:00
parent e75f0b4f80
commit 6206acd2d2
13 changed files with 985 additions and 2192 deletions

1821
asm/shop.s

File diff suppressed because it is too large Load Diff

View File

@ -1,80 +0,0 @@
@ the third big chunk of data
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
gUnknown_08589A08:: @ 8589A08
.4byte BuyMenuTryMakePurchase
.4byte BuyMenuReturnToItemList
gUnknown_08589A10:: @ 8589A10
.4byte gUnknown_085E93C7
.4byte HandleShopMenuBuy
.4byte gUnknown_085E93CB
.4byte HandleShopMenuSell
.4byte gUnknown_085E93D0
.4byte HandleShopMenuQuit
gUnknown_08589A28:: @ 8589A28
.4byte gUnknown_085E93C7
.4byte HandleShopMenuBuy
.4byte gUnknown_085E93D0
.4byte HandleShopMenuQuit
gUnknown_08589A38:: @ 8589A38
window_template 0, 2, 1, 9, 6, 15, 8
window_template 0, 2, 1, 9, 4, 15, 8
gUnknown_08589A48:: @ 8589A48
.byte 0, 0, 0, 0
.4byte BuyMenuPrintItemDescriptionAndShowItemIcon
.4byte BuyMenuPrintPriceInList
.byte 0, 0, 0, 0, 1, 0, 8, 0, 33, 48, 0, 7
gUnknown_08589A60:: @ 8589A60
.4byte 0x1F8
.4byte 0x11E1
.4byte 0x21D2
.4byte 0x31C3
gUnknown_08589A70:: @ 8589A70
window_template 0, 1, 1, 10, 2, 15, 30
window_template 0, 14, 2, 15, 16, 15, 50
window_template 0, 0, 13, 14, 6, 15, 0x122
window_template 0, 1, 11, 12, 2, 15, 0x176
window_template 0, 18, 11, 10, 2, 15, 0x18E
window_template 0, 2, 15, 27, 4, 15, 0x1A2
null_window_template
gUnknown_08589AA8:: @ 8589AA8
window_template 0, 21, 9, 5, 4, 15, 0x20E
gUnknown_08589AB0:: @ 8589AB0
.byte 1, 2, 3
.byte 0, 2, 3
.byte 0, 3, 2
.align 1
gUnknown_08589ABA:: @ 8589ABA
.2byte 0x284, 0x282, 0x280
gUnknown_08589AC0:: @ 8589AC0
.2byte 0x285, 0x283, 0x281
gUnknown_08589AC6:: @ 8589AC6
.2byte 0x28C, 0x28A, 0x288
gUnknown_08589ACC:: @ 8589ACC
.2byte 0x28D, 0x28B, 0x289
gUnknown_08589AD2:: @ 8589AD2
.2byte 0x2A0, 0x2A2, 0x2A4
gUnknown_08589AD8:: @ 8589AD8
.2byte 0x2A1, 0x2A3, 0x2A5
gUnknown_08589ADE:: @ 8589ADE
.2byte 0x2A8, 0x2AA, 0x2AC

View File

@ -4029,4 +4029,8 @@ extern const u8 gUnknown_08D97CF4[];
extern const u8 gStatusGfx_Icons[];
extern const u8 gStatusPal_Icons[];
extern const u8 gBuyMenuFrame_Gfx[];
extern const u16 gBuyMenuFrame_Tilemap[];
extern const u16 gMenuMoneyPal[];
#endif //GUARD_GRAPHICS_H

View File

@ -59,5 +59,6 @@ void bag_menu_mail_related(void);
void CB2_BagMenuFromStartMenu(void);
u8 sub_81ABB2C(u8 pocketId);
bool8 UseRegisteredKeyItemOnField(void);
void CB2_GoToSellMenu(void);
#endif //GUARD_item_menu_H

View File

@ -70,6 +70,5 @@ extern void sub_81B67C8(u8, u16, TaskFunc);
extern void sub_81B79E8(u8, u16, TaskFunc);
extern void sub_81B6DC4(u8, u16, TaskFunc);
extern void sub_81B7C74(u8, u16, TaskFunc);
extern u16 ItemIdToBattleMoveId(u16);
#endif // GUARD_PARTY_MENU_H

View File

@ -1,7 +1,7 @@
#ifndef GUARD_SHOP_H
#define GUARD_SHOP_H
extern EWRAM_DATA struct ItemSlot gUnknown_02039F80[3];
extern EWRAM_DATA struct ItemSlot gMartPurchaseHistory[3];
enum
{
@ -10,9 +10,19 @@ enum
MART_TYPE_2,
};
// shop view window NPC info enum
enum
{
EVENT_OBJ_ID,
X_COORD,
Y_COORD,
ANIM_NUM,
LAYER_TYPE
};
struct MartInfo
{
/*0x0*/ void (* callback) (void);
/*0x0*/ void (*callback)(void);
/*0x4*/ const struct MenuAction *menuActions;
/*0x8*/ const u16 *itemList;
/*0xC*/ u16 itemCount;
@ -20,23 +30,18 @@ struct MartInfo
/*0xF*/ u8 martType;
};
struct BuyMenuLabel
{
u8 label[16];
};
struct ShopData
{
/*0x0000*/ u8 tilemapBuffers[4][0x800];
/*0x2000*/ u8 filler2000[0x4];
/*0x2004*/ u16 unk2004;
/*0x2006*/ u8 filler2006[0x2];
/*0x2008*/ u16 unk2008;
/*0x200A*/ u8 filler200A;
/*0x0000*/ u16 tilemapBuffers[4][0x400];
/*0x2000*/ u32 totalCost;
/*0x2004*/ u16 itemsShowed;
/*0x2006*/ u16 selectedRow;
/*0x2008*/ u16 scrollOffset;
/*0x200A*/ u8 maxQuantity;
/*0x200B*/ u8 scrollIndicatorsTaskId;
/*0x200C*/ u8 unk200C;
/*0x200D*/ u8 unk200D[2];
/*0x200F*/ u8 filler200F[0xA1];
/*0x200C*/ u8 iconSlot;
/*0x200D*/ u8 itemSpriteIds[2];
/*0x2010*/ s16 viewportObjects[16][5];
};
void CreatePokemartMenu(const u16 *);

View File

@ -855,5 +855,21 @@ extern const u8 gText_CanIHelpWithAnythingElse[];
extern const u8 gText_AnythingElseICanHelp[];
extern const u8 gText_QuitShopping[];
extern const u8 gText_PokedollarVar1[];
extern const u8 gText_YouDontHaveMoney[];
extern const u8 gText_Var1CertainlyHowMany2[];
extern const u8 gText_Var1CertainlyHowMany[];
extern const u8 gText_Var1IsItThatllBeVar2[];
extern const u8 gText_YouWantedVar1ThatllBeVar2[];
extern const u8 gText_InBagVar1[];
extern const u8 gText_Var1AndYouWantedVar2[];
extern const u8 gText_HereYouGoThankYou[];
extern const u8 gText_NoMoreRoomForThis[];
extern const u8 gText_ThankYouIllSendItHome[];
extern const u8 gText_ThanksIllSendItHome[];
extern const u8 gText_SpaceForVar1Full[];
extern const u8 gText_ThrowInPremierBall[];
extern const u8 gText_ShopBuy[];
extern const u8 gText_ShopSell[];
extern const u8 gText_ShopQuit[];
#endif //GUARD_STRINGS_H

View File

@ -138,7 +138,7 @@ SECTIONS {
src/contest.o(.text);
asm/contest.o(.text);
src/shop.o(.text);
asm/shop.o(.text);
src/fldeff_escalator.o(.text);
src/berry.o(.text);
asm/script_menu.o(.text);
src/naming_screen.o(.text);
@ -443,7 +443,8 @@ SECTIONS {
src/map_name_popup.o(.rodata);
src/item_menu_icons.o(.rodata);
data/contest.o(.rodata);
data/shop.o(.rodata);
src/shop.o(.rodata);
src/fldeff_escalator.o(.rodata);
src/berry.o(.rodata);
data/script_menu.o(.rodata);
src/naming_screen.o(.rodata);

132
src/fldeff_escalator.c Normal file
View 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

File diff suppressed because it is too large Load Diff

View File

@ -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?");

View File

@ -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;
}
}
}

View File

@ -373,27 +373,10 @@ gUnknown_02039F5C: @ 2039F5C
gUnknown_02039F5D: @ 2039F5D
.space 0x3
gMartInfo: @ 2039F60
.space 0x10
gShopDataPtr: @ 2039F70
.space 0x4
gUnknown_02039F74: @ 2039F74
.space 0x4
gUnknown_02039F78: @ 2039F78
.space 0x4
gUnknown_02039F7C: @ 2039F7C
.space 0x4
gUnknown_02039F80: @ 2039F80
.space 0xC
gUnknown_02039F8C: @ 2039F8C
.space 0x4
.include "src/shop.o"
.include "src/fldeff_escalator.o"
.align 2
gUnknown_02039F90: @ 2039F90
.space 0x4