mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
Document some of item_menu.c
This commit is contained in:
parent
5e92481f51
commit
2fa0555ed5
@ -32,10 +32,10 @@ extern struct BagStruct gUnknown_0203CE58;
|
||||
|
||||
struct UnkBagStruct
|
||||
{
|
||||
void (*unk0)(void);
|
||||
u8 unk4[0x800];
|
||||
u8 unk804[12];
|
||||
u8 unk810[7];
|
||||
void (*mainCallback2)(void);
|
||||
u8 tilemapBuffer[0x800];
|
||||
u8 spriteId[12];
|
||||
u8 windowPointers[7];
|
||||
u8 unk817;
|
||||
u8 unk818;
|
||||
u8 unk819;
|
||||
@ -43,7 +43,7 @@ struct UnkBagStruct
|
||||
u8 unk81B:4;
|
||||
u8 unk81B_1:2;
|
||||
u8 unk81B_3:1;
|
||||
u8 unk81B_2:1;
|
||||
u8 hideCloseBagText:1;
|
||||
u8 filler3[2];
|
||||
u8 unk81E;
|
||||
u8 unk81F;
|
||||
@ -52,11 +52,11 @@ struct UnkBagStruct
|
||||
u8 unk825;
|
||||
u8 filler[2];
|
||||
u8 unk828;
|
||||
u8 unk829[POCKETS_COUNT];
|
||||
u8 unk82E[6];
|
||||
u8 numItemStacks[POCKETS_COUNT];
|
||||
u8 numShownItems[6];
|
||||
s16 unk834;
|
||||
u8 filler4[0xE];
|
||||
u8 unk844[32][32];
|
||||
u8 pocketNameBuffer[32][32];
|
||||
u8 filler2[4];
|
||||
};
|
||||
|
||||
@ -71,9 +71,10 @@ void sub_81AAC14(void);
|
||||
void sub_81AAC50(void);
|
||||
void sub_81AAC70(void);
|
||||
void sub_81AAC28(void);
|
||||
void SetInitialScrollAndCursorPositions(u8 pocketId);
|
||||
void bag_menu_mail_related(void);
|
||||
void CB2_BagMenuFromStartMenu(void);
|
||||
u8 sub_81ABB2C(u8 pocketId);
|
||||
u8 GetItemListPosition(u8 pocketId);
|
||||
bool8 UseRegisteredKeyItemOnField(void);
|
||||
void CB2_GoToSellMenu(void);
|
||||
|
||||
|
@ -543,7 +543,7 @@ bool8 RemoveBagItem(u16 itemId, u16 count)
|
||||
VarSet(VAR_0x40ED, itemId);
|
||||
}
|
||||
|
||||
var = sub_81ABB2C(pocket);
|
||||
var = GetItemListPosition(pocket);
|
||||
if (itemPocket->capacity > var
|
||||
&& itemPocket->itemSlots[var].itemId == itemId)
|
||||
{
|
||||
|
172
src/item_menu.c
172
src/item_menu.c
@ -57,7 +57,7 @@ bool8 load_bag_menu_graphics(void);
|
||||
void setup_bag_menu_textboxes(void);
|
||||
void allocate_bag_item_list_buffers(void);
|
||||
void load_bag_item_list_buffers(u8);
|
||||
void bag_menu_print_pocket_names(u8*, u8*);
|
||||
void bag_menu_print_pocket_names(const u8*, const u8*);
|
||||
void bag_menu_copy_pocket_name_to_window(u32);
|
||||
void bag_menu_draw_pocket_indicator_square(u8, u8);
|
||||
void bag_menu_add_pocket_scroll_arrow_indicators_maybe(void);
|
||||
@ -69,7 +69,6 @@ void Task_BagMenu(u8);
|
||||
void get_name(s8*, u16);
|
||||
u16 ItemIdToBattleMoveId(u16);
|
||||
u16 BagGetItemIdByPocketPosition(u8, u16);
|
||||
void AddBagItemIconSprite(u16, u8);
|
||||
void bag_menu_print_description_box_text(int);
|
||||
void bag_menu_print_cursor(u8, u8);
|
||||
void bag_menu_print(u8, u8, const u8*, u8, u8, u8, u8, u8, u8);
|
||||
@ -121,7 +120,7 @@ void bag_menu_leave_maybe_3(void);
|
||||
void bag_menu_leave_maybe_2(void);
|
||||
void bag_menu_leave_maybe(void);
|
||||
void sub_81ABA6C(void);
|
||||
void sub_81ABAC4(void);
|
||||
static void SetPocketListPositions(void);
|
||||
void sub_81ABAE0(void);
|
||||
u8 sub_81AB1F0(u8);
|
||||
void sub_81AC23C(u8);
|
||||
@ -151,7 +150,7 @@ void sub_81AD6FC(u8 taskId);
|
||||
|
||||
// .rodata
|
||||
|
||||
const struct BgTemplate gUnknown_08613F90[3] =
|
||||
static const struct BgTemplate sBgTemplates_ItemMenu[3] =
|
||||
{
|
||||
{
|
||||
.bg = 0,
|
||||
@ -182,7 +181,7 @@ const struct BgTemplate gUnknown_08613F90[3] =
|
||||
},
|
||||
};
|
||||
|
||||
const struct ListMenuTemplate gUnknown_08613F9C =
|
||||
static const struct ListMenuTemplate sItemListMenu =
|
||||
{
|
||||
.items = NULL,
|
||||
.moveCursorFunc = bag_menu_change_item_callback,
|
||||
@ -258,7 +257,8 @@ const struct ScrollArrowsTemplate gUnknown_08614094 = {SCROLL_ARROW_LEFT, 0x1C,
|
||||
|
||||
const u8 gUnknown_086140A4[] = INCBIN_U8("graphics/interface/select_button.4bpp");
|
||||
|
||||
const u8 gUnknown_08614164[][3] = {
|
||||
static const u8 sFontColorTable[][3] = {
|
||||
// bgColor, textColor, shadowColor
|
||||
{0, 1, 3},
|
||||
{0, 1, 4},
|
||||
{0, 3, 6},
|
||||
@ -268,7 +268,7 @@ const u8 gUnknown_08614164[][3] = {
|
||||
|
||||
const struct WindowTemplate gUnknown_08614174[] =
|
||||
{
|
||||
{
|
||||
{ // Item names
|
||||
.bg = 0,
|
||||
.tilemapLeft = 14,
|
||||
.tilemapTop = 2,
|
||||
@ -277,7 +277,7 @@ const struct WindowTemplate gUnknown_08614174[] =
|
||||
.paletteNum = 1,
|
||||
.baseBlock = 0x27,
|
||||
},
|
||||
{
|
||||
{ // Description
|
||||
.bg = 0,
|
||||
.tilemapLeft = 0,
|
||||
.tilemapTop = 13,
|
||||
@ -286,7 +286,7 @@ const struct WindowTemplate gUnknown_08614174[] =
|
||||
.paletteNum = 1,
|
||||
.baseBlock = 0x117,
|
||||
},
|
||||
{
|
||||
{ // Pocket name
|
||||
.bg = 0,
|
||||
.tilemapLeft = 4,
|
||||
.tilemapTop = 1,
|
||||
@ -295,7 +295,7 @@ const struct WindowTemplate gUnknown_08614174[] =
|
||||
.paletteNum = 1,
|
||||
.baseBlock = 0x1A1,
|
||||
},
|
||||
{
|
||||
{ // TM/HM info icons
|
||||
.bg = 0,
|
||||
.tilemapLeft = 1,
|
||||
.tilemapTop = 13,
|
||||
@ -304,7 +304,7 @@ const struct WindowTemplate gUnknown_08614174[] =
|
||||
.paletteNum = 12,
|
||||
.baseBlock = 0x16B,
|
||||
},
|
||||
{
|
||||
{// TM/HM info
|
||||
.bg = 0,
|
||||
.tilemapLeft = 7,
|
||||
.tilemapTop = 13,
|
||||
@ -313,7 +313,7 @@ const struct WindowTemplate gUnknown_08614174[] =
|
||||
.paletteNum = 12,
|
||||
.baseBlock = 0x189,
|
||||
},
|
||||
{
|
||||
{ // Field message box
|
||||
.bg = 1,
|
||||
.tilemapLeft = 2,
|
||||
.tilemapTop = 15,
|
||||
@ -440,16 +440,14 @@ struct TempWallyStruct {
|
||||
|
||||
EWRAM_DATA struct UnkBagStruct *gUnknown_0203CE54 = 0;
|
||||
EWRAM_DATA struct BagStruct gUnknown_0203CE58 = {0};
|
||||
EWRAM_DATA struct ListBuffer1 *gUnknown_0203CE74 = 0;
|
||||
EWRAM_DATA struct ListBuffer2 *gUnknown_0203CE78 = 0;
|
||||
static EWRAM_DATA struct ListBuffer1 *sListBuffer1 = 0;
|
||||
static EWRAM_DATA struct ListBuffer2 *sListBuffer2 = 0;
|
||||
EWRAM_DATA u16 gSpecialVar_ItemId = 0;
|
||||
EWRAM_DATA struct TempWallyStruct *gUnknown_0203CE80 = 0;
|
||||
static EWRAM_DATA struct TempWallyStruct *gUnknown_0203CE80 = 0;
|
||||
|
||||
extern u8 *gPocketNamesStringsTable[];
|
||||
extern struct ListMenuTemplate gUnknown_08613F9C;
|
||||
extern u8 *const gPocketNamesStringsTable[];
|
||||
extern const u8 gMoveNames[][0xD];
|
||||
extern u8* gReturnToXStringsTable[];
|
||||
extern u32 gUnknown_0203CE5E[];
|
||||
extern const u8 EventScript_2736B3[];
|
||||
extern const u16 gUnknown_0860F074[];
|
||||
|
||||
@ -531,12 +529,12 @@ void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2)
|
||||
temp = gUnknown_0203CE58.location - (POCKETS_COUNT - 1);
|
||||
if (temp <= 1)
|
||||
gUnknown_0203CE54->unk81B = 1;
|
||||
gUnknown_0203CE54->unk0 = 0;
|
||||
gUnknown_0203CE54->mainCallback2 = 0;
|
||||
gUnknown_0203CE54->unk81A = 0xFF;
|
||||
gUnknown_0203CE54->unk81E = -1;
|
||||
gUnknown_0203CE54->unk81F = -1;
|
||||
memset(gUnknown_0203CE54->unk804, 0xFF, sizeof(gUnknown_0203CE54->unk804));
|
||||
memset(gUnknown_0203CE54->unk810, 0xFF, 10);
|
||||
memset(gUnknown_0203CE54->spriteId, 0xFF, sizeof(gUnknown_0203CE54->spriteId));
|
||||
memset(gUnknown_0203CE54->windowPointers, 0xFF, 10);
|
||||
SetMainCallback2(CB2_Bag);
|
||||
}
|
||||
}
|
||||
@ -615,7 +613,7 @@ bool8 setup_bag_menu(void)
|
||||
break;
|
||||
case 10:
|
||||
sub_81ABA6C();
|
||||
sub_81ABAC4();
|
||||
SetPocketListPositions();
|
||||
sub_81ABAE0();
|
||||
gMain.state++;
|
||||
break;
|
||||
@ -677,10 +675,10 @@ bool8 setup_bag_menu(void)
|
||||
void bag_menu_init_bgs(void)
|
||||
{
|
||||
ResetVramOamAndBgCntRegs();
|
||||
memset(gUnknown_0203CE54->unk4, 0, 0x800);
|
||||
memset(gUnknown_0203CE54->tilemapBuffer, 0, 0x800);
|
||||
ResetBgsAndClearDma3BusyFlags(0);
|
||||
InitBgsFromTemplates(0, gUnknown_08613F90, 3);
|
||||
SetBgTilemapBuffer(2, gUnknown_0203CE54->unk4);
|
||||
InitBgsFromTemplates(0, sBgTemplates_ItemMenu, 3);
|
||||
SetBgTilemapBuffer(2, gUnknown_0203CE54->tilemapBuffer);
|
||||
ResetAllBgsCoordinates();
|
||||
schedule_bg_copy_tilemap_to_vram(2);
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
|
||||
@ -702,7 +700,7 @@ bool8 load_bag_menu_graphics(void)
|
||||
case 1:
|
||||
if (free_temp_tile_data_buffers_if_possible() != TRUE)
|
||||
{
|
||||
LZDecompressWram(gUnknown_08D9A88C, gUnknown_0203CE54->unk4);
|
||||
LZDecompressWram(gUnknown_08D9A88C, gUnknown_0203CE54->tilemapBuffer);
|
||||
gUnknown_0203CE54->unk834++;
|
||||
}
|
||||
break;
|
||||
@ -744,8 +742,8 @@ u8 sub_81AB1F0(u8 a)
|
||||
|
||||
void allocate_bag_item_list_buffers(void)
|
||||
{
|
||||
gUnknown_0203CE74 = Alloc(sizeof(struct ListBuffer1));
|
||||
gUnknown_0203CE78 = Alloc(sizeof(struct ListBuffer2));
|
||||
sListBuffer1 = Alloc(sizeof(struct ListBuffer1));
|
||||
sListBuffer2 = Alloc(sizeof(struct ListBuffer2));
|
||||
}
|
||||
|
||||
void load_bag_item_list_buffers(u8 pocketId)
|
||||
@ -754,34 +752,34 @@ void load_bag_item_list_buffers(u8 pocketId)
|
||||
struct BagPocket *pocket = &gBagPockets[pocketId];
|
||||
struct ListMenuItem *subBuffer;
|
||||
|
||||
if (!gUnknown_0203CE54->unk81B_2)
|
||||
if (!gUnknown_0203CE54->hideCloseBagText)
|
||||
{
|
||||
for (i = 0; i < gUnknown_0203CE54->unk829[pocketId] - 1; i++)
|
||||
for (i = 0; i < gUnknown_0203CE54->numItemStacks[pocketId] - 1; i++)
|
||||
{
|
||||
get_name(gUnknown_0203CE78->name[i], pocket->itemSlots[i].itemId);
|
||||
subBuffer = gUnknown_0203CE74->subBuffers;
|
||||
subBuffer[i].name = gUnknown_0203CE78->name[i];
|
||||
get_name(sListBuffer2->name[i], pocket->itemSlots[i].itemId);
|
||||
subBuffer = sListBuffer1->subBuffers;
|
||||
subBuffer[i].name = sListBuffer2->name[i];
|
||||
subBuffer[i].id = i;
|
||||
}
|
||||
StringCopy(gUnknown_0203CE78->name[i], gText_CloseBag);
|
||||
subBuffer = gUnknown_0203CE74->subBuffers;
|
||||
subBuffer[i].name = gUnknown_0203CE78->name[i];
|
||||
StringCopy(sListBuffer2->name[i], gText_CloseBag);
|
||||
subBuffer = sListBuffer1->subBuffers;
|
||||
subBuffer[i].name = sListBuffer2->name[i];
|
||||
subBuffer[i].id = -2;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < gUnknown_0203CE54->unk829[pocketId]; i++)
|
||||
for (i = 0; i < gUnknown_0203CE54->numItemStacks[pocketId]; i++)
|
||||
{
|
||||
get_name(gUnknown_0203CE78->name[i], pocket->itemSlots[i].itemId);
|
||||
subBuffer = gUnknown_0203CE74->subBuffers;
|
||||
subBuffer[i].name = gUnknown_0203CE78->name[i];
|
||||
get_name(sListBuffer2->name[i], pocket->itemSlots[i].itemId);
|
||||
subBuffer = sListBuffer1->subBuffers;
|
||||
subBuffer[i].name = sListBuffer2->name[i];
|
||||
subBuffer[i].id = i;
|
||||
}
|
||||
}
|
||||
gMultiuseListMenuTemplate = gUnknown_08613F9C;
|
||||
gMultiuseListMenuTemplate.totalItems = gUnknown_0203CE54->unk829[pocketId];
|
||||
gMultiuseListMenuTemplate.items = gUnknown_0203CE74->subBuffers;
|
||||
gMultiuseListMenuTemplate.maxShowed = gUnknown_0203CE54->unk82E[pocketId];
|
||||
gMultiuseListMenuTemplate = sItemListMenu;
|
||||
gMultiuseListMenuTemplate.totalItems = gUnknown_0203CE54->numItemStacks[pocketId];
|
||||
gMultiuseListMenuTemplate.items = sListBuffer1->subBuffers;
|
||||
gMultiuseListMenuTemplate.maxShowed = gUnknown_0203CE54->numShownItems[pocketId];
|
||||
}
|
||||
|
||||
void get_name(s8 *dest, u16 itemId)
|
||||
@ -907,7 +905,7 @@ void bag_menu_print_cursor(u8 a, u8 b)
|
||||
void bag_menu_add_pocket_scroll_arrow_indicators_maybe(void)
|
||||
{
|
||||
if (gUnknown_0203CE54->unk81E == 0xFF)
|
||||
gUnknown_0203CE54->unk81E = AddScrollIndicatorArrowPairParameterized(SCROLL_ARROW_UP, 0xAC, 12, 0x94, gUnknown_0203CE54->unk829[gUnknown_0203CE58.pocket] - gUnknown_0203CE54->unk82E[gUnknown_0203CE58.pocket], 0x6E, 0x6E, &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket]);
|
||||
gUnknown_0203CE54->unk81E = AddScrollIndicatorArrowPairParameterized(SCROLL_ARROW_UP, 0xAC, 12, 0x94, gUnknown_0203CE54->numItemStacks[gUnknown_0203CE58.pocket] - gUnknown_0203CE54->numShownItems[gUnknown_0203CE58.pocket], 0x6E, 0x6E, &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket]);
|
||||
}
|
||||
|
||||
void sub_81AB824(void)
|
||||
@ -937,8 +935,8 @@ void sub_81AB89C(void)
|
||||
|
||||
void free_bag_item_list_buffers(void)
|
||||
{
|
||||
Free(gUnknown_0203CE78);
|
||||
Free(gUnknown_0203CE74);
|
||||
Free(sListBuffer2);
|
||||
Free(sListBuffer1);
|
||||
FreeAllWindowBuffers();
|
||||
Free(gUnknown_0203CE54);
|
||||
}
|
||||
@ -955,8 +953,8 @@ void task_close_bag_menu_2(u8 taskId)
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
DestroyListMenuTask(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]);
|
||||
if (gUnknown_0203CE54->unk0 != 0)
|
||||
SetMainCallback2(gUnknown_0203CE54->unk0);
|
||||
if (gUnknown_0203CE54->mainCallback2 != 0)
|
||||
SetMainCallback2(gUnknown_0203CE54->mainCallback2);
|
||||
else
|
||||
SetMainCallback2(gUnknown_0203CE58.bagCallback);
|
||||
sub_81AB824();
|
||||
@ -981,15 +979,17 @@ void sub_81AB9A8(u8 pocketId)
|
||||
CompactItemsInBagPocket(pocket);
|
||||
break;
|
||||
}
|
||||
gUnknown_0203CE54->unk829[pocketId] = 0;
|
||||
gUnknown_0203CE54->numItemStacks[pocketId] = 0;
|
||||
for (i = 0; i < pocket->capacity && pocket->itemSlots[i].itemId; i++)
|
||||
gUnknown_0203CE54->unk829[pocketId]++;
|
||||
if (!gUnknown_0203CE54->unk81B_2)
|
||||
gUnknown_0203CE54->unk829[pocketId]++;
|
||||
if (gUnknown_0203CE54->unk829[pocketId] > 8)
|
||||
gUnknown_0203CE54->unk82E[pocketId] = 8;
|
||||
gUnknown_0203CE54->numItemStacks[pocketId]++;
|
||||
|
||||
if (!gUnknown_0203CE54->hideCloseBagText)
|
||||
gUnknown_0203CE54->numItemStacks[pocketId]++;
|
||||
|
||||
if (gUnknown_0203CE54->numItemStacks[pocketId] > 8)
|
||||
gUnknown_0203CE54->numShownItems[pocketId] = 8;
|
||||
else
|
||||
gUnknown_0203CE54->unk82E[pocketId] = gUnknown_0203CE54->unk829[pocketId];
|
||||
gUnknown_0203CE54->numShownItems[pocketId] = gUnknown_0203CE54->numItemStacks[pocketId];
|
||||
}
|
||||
|
||||
void sub_81ABA6C(void)
|
||||
@ -999,26 +999,26 @@ void sub_81ABA6C(void)
|
||||
sub_81AB9A8(i);
|
||||
}
|
||||
|
||||
void sub_81ABA88(u8 a)
|
||||
void SetInitialScrollAndCursorPositions(u8 pocketId)
|
||||
{
|
||||
sub_812225C(&gUnknown_0203CE58.scrollPosition[a], &gUnknown_0203CE58.cursorPosition[a], gUnknown_0203CE54->unk82E[a], gUnknown_0203CE54->unk829[a]);
|
||||
sub_812225C(&gUnknown_0203CE58.scrollPosition[pocketId], &gUnknown_0203CE58.cursorPosition[pocketId], gUnknown_0203CE54->numShownItems[pocketId], gUnknown_0203CE54->numItemStacks[pocketId]);
|
||||
}
|
||||
|
||||
void sub_81ABAC4(void)
|
||||
static void SetPocketListPositions(void)
|
||||
{
|
||||
u8 i;
|
||||
for (i = 0; i < POCKETS_COUNT; i++)
|
||||
sub_81ABA88(i);
|
||||
SetInitialScrollAndCursorPositions(i);
|
||||
}
|
||||
|
||||
void sub_81ABAE0(void)
|
||||
{
|
||||
u8 i;
|
||||
for (i = 0; i < POCKETS_COUNT; i++)
|
||||
sub_8122298(&gUnknown_0203CE58.scrollPosition[i], &gUnknown_0203CE58.cursorPosition[i], gUnknown_0203CE54->unk82E[i], gUnknown_0203CE54->unk829[i], 8);
|
||||
sub_8122298(&gUnknown_0203CE58.scrollPosition[i], &gUnknown_0203CE58.cursorPosition[i], gUnknown_0203CE54->numShownItems[i], gUnknown_0203CE54->numItemStacks[i], 8);
|
||||
}
|
||||
|
||||
u8 sub_81ABB2C(u8 pocketId)
|
||||
u8 GetItemListPosition(u8 pocketId)
|
||||
{
|
||||
return gUnknown_0203CE58.scrollPosition[pocketId] + gUnknown_0203CE58.cursorPosition[pocketId];
|
||||
}
|
||||
@ -1041,7 +1041,7 @@ void bag_menu_inits_lists_menu(u8 taskId)
|
||||
bag_menu_RemoveBagItem_message_window(4);
|
||||
DestroyListMenuTask(data[0], scrollPos, cursorPos);
|
||||
sub_81AB9A8(gUnknown_0203CE58.pocket);
|
||||
sub_81ABA88(gUnknown_0203CE58.pocket);
|
||||
SetInitialScrollAndCursorPositions(gUnknown_0203CE58.pocket);
|
||||
load_bag_item_list_buffers(gUnknown_0203CE58.pocket);
|
||||
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos);
|
||||
schedule_bg_copy_tilemap_to_vram(0);
|
||||
@ -1092,7 +1092,7 @@ void Task_BagMenu(u8 taskId)
|
||||
if (sub_81AC2C0() == 1)
|
||||
{
|
||||
ListMenuGetScrollAndRow(data[0], scrollPos, cursorPos);
|
||||
if ((*scrollPos + *cursorPos) != gUnknown_0203CE54->unk829[gUnknown_0203CE58.pocket] - 1)
|
||||
if ((*scrollPos + *cursorPos) != gUnknown_0203CE54->numItemStacks[gUnknown_0203CE58.pocket] - 1)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
bag_menu_swap_items(taskId);
|
||||
@ -1102,13 +1102,13 @@ void Task_BagMenu(u8 taskId)
|
||||
}
|
||||
else
|
||||
{
|
||||
int r4 = ListMenuHandleInputGetItemId(data[0]);
|
||||
int listPosition = ListMenuHandleInputGetItemId(data[0]);
|
||||
ListMenuGetScrollAndRow(data[0], scrollPos, cursorPos);
|
||||
switch (r4)
|
||||
switch (listPosition)
|
||||
{
|
||||
case -1:
|
||||
case LIST_NOTHING_CHOSEN:
|
||||
break;
|
||||
case -2:
|
||||
case LIST_B_PRESSED:
|
||||
if (gUnknown_0203CE58.location == 5)
|
||||
{
|
||||
PlaySE(SE_HAZURE);
|
||||
@ -1118,13 +1118,13 @@ void Task_BagMenu(u8 taskId)
|
||||
gSpecialVar_ItemId = select;
|
||||
gTasks[taskId].func = unknown_ItemMenu_Confirm;
|
||||
break;
|
||||
default:
|
||||
default: // A_BUTTON
|
||||
PlaySE(SE_SELECT);
|
||||
sub_81AB824();
|
||||
bag_menu_print_cursor_(data[0], 2);
|
||||
data[1] = r4;
|
||||
data[2] = BagGetQuantityByPocketPosition(gUnknown_0203CE58.pocket + 1, r4);
|
||||
gSpecialVar_ItemId = BagGetItemIdByPocketPosition(gUnknown_0203CE58.pocket + 1, r4);
|
||||
data[1] = listPosition;
|
||||
data[2] = BagGetQuantityByPocketPosition(gUnknown_0203CE58.pocket + 1, listPosition);
|
||||
gSpecialVar_ItemId = BagGetItemIdByPocketPosition(gUnknown_0203CE58.pocket + 1, listPosition);
|
||||
gUnknown_08614054[gUnknown_0203CE58.location](taskId);
|
||||
break;
|
||||
}
|
||||
@ -1186,7 +1186,7 @@ void SwitchBagPocket(u8 taskId, s16 deltaBagPocketId, u16 a3)
|
||||
ClearWindowTilemap(1);
|
||||
DestroyListMenuTask(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]);
|
||||
schedule_bg_copy_tilemap_to_vram(0);
|
||||
gSprites[gUnknown_0203CE54->unk804[2 + (gUnknown_0203CE54->unk81B_1 ^ 1)]].invisible = TRUE;
|
||||
gSprites[gUnknown_0203CE54->spriteId[2 + (gUnknown_0203CE54->unk81B_1 ^ 1)]].invisible = TRUE;
|
||||
sub_81AB824();
|
||||
}
|
||||
pocketId = gUnknown_0203CE58.pocket;
|
||||
@ -1744,7 +1744,7 @@ void Task_ActuallyToss(u8 taskId)
|
||||
RemoveBagItem(gSpecialVar_ItemId, data[8]);
|
||||
DestroyListMenuTask(data[0], scrollPos, cursorPos);
|
||||
sub_81AB9A8(gUnknown_0203CE58.pocket);
|
||||
sub_81ABA88(gUnknown_0203CE58.pocket);
|
||||
SetInitialScrollAndCursorPositions(gUnknown_0203CE58.pocket);
|
||||
load_bag_item_list_buffers(gUnknown_0203CE58.pocket);
|
||||
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos);
|
||||
schedule_bg_copy_tilemap_to_vram(0);
|
||||
@ -1782,7 +1782,7 @@ void ItemMenu_Give(u8 taskId)
|
||||
bag_menu_print_there_is_no_pokemon(taskId);
|
||||
else
|
||||
{
|
||||
gUnknown_0203CE54->unk0 = sub_81B7F60;
|
||||
gUnknown_0203CE54->mainCallback2 = sub_81B7F60;
|
||||
unknown_ItemMenu_Confirm(taskId);
|
||||
}
|
||||
}
|
||||
@ -1815,7 +1815,7 @@ void sub_81AD350(u8 taskId)
|
||||
|
||||
void ItemMenu_CheckTag(u8 taskId)
|
||||
{
|
||||
gUnknown_0203CE54->unk0 = DoBerryTagScreen;
|
||||
gUnknown_0203CE54->mainCallback2 = DoBerryTagScreen;
|
||||
unknown_ItemMenu_Confirm(taskId);
|
||||
}
|
||||
|
||||
@ -2012,7 +2012,7 @@ void sub_81AD8C8(u8 taskId)
|
||||
AddMoney(&gSaveBlock1Ptr->money, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * data[8]);
|
||||
DestroyListMenuTask(data[0], scrollPos, cursorPos);
|
||||
sub_81AB9A8(gUnknown_0203CE58.pocket);
|
||||
sub_81ABA88(gUnknown_0203CE58.pocket);
|
||||
SetInitialScrollAndCursorPositions(gUnknown_0203CE58.pocket);
|
||||
load_bag_item_list_buffers(gUnknown_0203CE58.pocket);
|
||||
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos);
|
||||
bag_menu_print_cursor_(data[0], 2);
|
||||
@ -2235,7 +2235,7 @@ void bag_menu_leave_maybe(void)
|
||||
SetMainCallback2(CB2_ReturnToField);
|
||||
}
|
||||
|
||||
void bag_menu_print_pocket_names(u8 *pocketName1, u8 *pocketName2)
|
||||
void bag_menu_print_pocket_names(const u8 *pocketName1, const u8 *pocketName2)
|
||||
{
|
||||
struct WindowTemplate window = {0, 0, 0, 0, 0, 0, 0};
|
||||
u16 windowId;
|
||||
@ -2252,7 +2252,7 @@ void bag_menu_print_pocket_names(u8 *pocketName1, u8 *pocketName2)
|
||||
offset = GetStringCenterAlignXOffset(1, pocketName2, 0x40);
|
||||
bag_menu_print(windowId, 1, pocketName2, offset + 0x40, 1, 0, 0, -1, 1);
|
||||
}
|
||||
CpuCopy32((u8*)GetWindowAttribute(windowId, WINDOW_TILE_DATA), gUnknown_0203CE54->unk844, 0x400);
|
||||
CpuCopy32((u8*)GetWindowAttribute(windowId, WINDOW_TILE_DATA), gUnknown_0203CE54->pocketNameBuffer, 0x400);
|
||||
RemoveWindow(windowId);
|
||||
}
|
||||
|
||||
@ -2263,7 +2263,7 @@ void bag_menu_copy_pocket_name_to_window(u32 a)
|
||||
int b;
|
||||
if (a > 8)
|
||||
a = 8;
|
||||
r4 = &gUnknown_0203CE54->unk844;
|
||||
r4 = &gUnknown_0203CE54->pocketNameBuffer;
|
||||
windowAttribute = (u8*)GetWindowAttribute(2, WINDOW_TILE_DATA);
|
||||
CpuCopy32(r4[0][a], windowAttribute, 0x100);
|
||||
b = a + 16;
|
||||
@ -2292,17 +2292,17 @@ void setup_bag_menu_textboxes(void)
|
||||
|
||||
void bag_menu_print(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 letterSpacing, u8 lineSpacing, u8 speed, u8 h)
|
||||
{
|
||||
AddTextPrinterParameterized4(windowId, fontId, left, top, letterSpacing, lineSpacing, gUnknown_08614164[h], speed, str);
|
||||
AddTextPrinterParameterized4(windowId, fontId, left, top, letterSpacing, lineSpacing, sFontColorTable[h], speed, str);
|
||||
}
|
||||
|
||||
u8 sub_81AE124(u8 a)
|
||||
{
|
||||
return gUnknown_0203CE54->unk810[a];
|
||||
return gUnknown_0203CE54->windowPointers[a];
|
||||
}
|
||||
|
||||
u8 bag_menu_add_window(u8 a)
|
||||
{
|
||||
u8 *ptr = &gUnknown_0203CE54->unk810[a];
|
||||
u8 *ptr = &gUnknown_0203CE54->windowPointers[a];
|
||||
if (*ptr == 0xFF)
|
||||
{
|
||||
*ptr = AddWindow(&gUnknown_086141AC[a]);
|
||||
@ -2314,7 +2314,7 @@ u8 bag_menu_add_window(u8 a)
|
||||
|
||||
void bag_menu_remove_window(u8 a)
|
||||
{
|
||||
u8 *ptr = &gUnknown_0203CE54->unk810[a];
|
||||
u8 *ptr = &gUnknown_0203CE54->windowPointers[a];
|
||||
if (*ptr != 0xFF)
|
||||
{
|
||||
sub_8198070(*ptr, 0);
|
||||
@ -2327,7 +2327,7 @@ void bag_menu_remove_window(u8 a)
|
||||
|
||||
u8 AddItemMessageWindow(u8 a)
|
||||
{
|
||||
u8 *ptr = &gUnknown_0203CE54->unk810[a];
|
||||
u8 *ptr = &gUnknown_0203CE54->windowPointers[a];
|
||||
if (*ptr == 0xFF)
|
||||
*ptr = AddWindow(&gUnknown_086141AC[a]);
|
||||
return *ptr;
|
||||
@ -2335,7 +2335,7 @@ u8 AddItemMessageWindow(u8 a)
|
||||
|
||||
void bag_menu_RemoveBagItem_message_window(u8 a)
|
||||
{
|
||||
u8 *ptr = &gUnknown_0203CE54->unk810[a];
|
||||
u8 *ptr = &gUnknown_0203CE54->windowPointers[a];
|
||||
if (*ptr != 0xFF)
|
||||
{
|
||||
sub_8197DF8(*ptr, 0);
|
||||
|
@ -1,14 +1,14 @@
|
||||
#include "global.h"
|
||||
#include "sprite.h"
|
||||
#include "berry.h"
|
||||
#include "decompress.h"
|
||||
#include "graphics.h"
|
||||
#include "item.h"
|
||||
#include "item_menu.h"
|
||||
#include "item_icon.h"
|
||||
#include "item_menu_icons.h"
|
||||
#include "window.h"
|
||||
#include "menu_helpers.h"
|
||||
#include "berry.h"
|
||||
#include "graphics.h"
|
||||
#include "item.h"
|
||||
#include "sprite.h"
|
||||
#include "window.h"
|
||||
#include "constants/items.h"
|
||||
|
||||
struct CompressedTilesPal
|
||||
@ -199,7 +199,7 @@ static const struct SpritePalette gUnknown_0857FBA8 =
|
||||
gUnknown_0857F564, 101
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate gUnknown_0857FBB0 =
|
||||
static const struct SpriteTemplate gSpriteTemplate_RotatingBall =
|
||||
{
|
||||
.tileTag = 101,
|
||||
.paletteTag = 101,
|
||||
@ -409,7 +409,7 @@ static const struct SpriteTemplate gUnknown_0857FE10 =
|
||||
// code
|
||||
void RemoveBagSprite(u8 id)
|
||||
{
|
||||
u8 *spriteId = &gUnknown_0203CE54->unk804[id];
|
||||
u8 *spriteId = &gUnknown_0203CE54->spriteId[id];
|
||||
if (*spriteId != 0xFF)
|
||||
{
|
||||
FreeSpriteTilesByTag(id + 100);
|
||||
@ -422,14 +422,14 @@ void RemoveBagSprite(u8 id)
|
||||
|
||||
void AddBagVisualSprite(u8 bagPocketId)
|
||||
{
|
||||
u8 *spriteId = &gUnknown_0203CE54->unk804[0];
|
||||
u8 *spriteId = &gUnknown_0203CE54->spriteId[0];
|
||||
*spriteId = CreateSprite(&gUnknown_0857FB4C, 68, 66, 0);
|
||||
SetBagVisualPocketId(bagPocketId, FALSE);
|
||||
}
|
||||
|
||||
void SetBagVisualPocketId(u8 bagPocketId, bool8 isSwitchingPockets)
|
||||
{
|
||||
struct Sprite *sprite = &gSprites[gUnknown_0203CE54->unk804[0]];
|
||||
struct Sprite *sprite = &gSprites[gUnknown_0203CE54->spriteId[0]];
|
||||
if (isSwitchingPockets)
|
||||
{
|
||||
sprite->pos2.y = -5;
|
||||
@ -458,7 +458,7 @@ static void SpriteCB_BagVisualSwitchingPockets(struct Sprite *sprite)
|
||||
|
||||
void ShakeBagVisual(void)
|
||||
{
|
||||
struct Sprite *sprite = &gSprites[gUnknown_0203CE54->unk804[0]];
|
||||
struct Sprite *sprite = &gSprites[gUnknown_0203CE54->spriteId[0]];
|
||||
if (sprite->affineAnimEnded)
|
||||
{
|
||||
StartSpriteAffineAnim(sprite, 1);
|
||||
@ -477,10 +477,10 @@ static void SpriteCB_ShakeBagVisual(struct Sprite *sprite)
|
||||
|
||||
void AddSwitchPocketRotatingBallSprite(s16 rotationDirection)
|
||||
{
|
||||
u8 *spriteId = &gUnknown_0203CE54->unk804[1];
|
||||
u8 *spriteId = &gUnknown_0203CE54->spriteId[1];
|
||||
LoadSpriteSheet(&gUnknown_0857FBA0);
|
||||
LoadSpritePalette(&gUnknown_0857FBA8);
|
||||
*spriteId = CreateSprite(&gUnknown_0857FBB0, 16, 16, 0);
|
||||
*spriteId = CreateSprite(&gSpriteTemplate_RotatingBall, 16, 16, 0);
|
||||
gSprites[*spriteId].data[0] = rotationDirection;
|
||||
}
|
||||
|
||||
@ -515,7 +515,7 @@ static void SpriteCB_SwitchPocketRotatingBallContinue(struct Sprite *sprite)
|
||||
|
||||
void AddBagItemIconSprite(u16 itemId, u8 id)
|
||||
{
|
||||
u8 *spriteId = &gUnknown_0203CE54->unk804[id + 2];
|
||||
u8 *spriteId = &gUnknown_0203CE54->spriteId[id + 2];
|
||||
if (*spriteId == 0xFF)
|
||||
{
|
||||
u8 iconSpriteId;
|
||||
@ -539,17 +539,17 @@ void RemoveBagItemIconSprite(u8 id)
|
||||
|
||||
void sub_80D4FAC(void)
|
||||
{
|
||||
sub_8122344(&gUnknown_0203CE54->unk804[4], 8);
|
||||
sub_8122344(&gUnknown_0203CE54->spriteId[4], 8);
|
||||
}
|
||||
|
||||
void sub_80D4FC8(u8 arg0)
|
||||
{
|
||||
sub_81223FC(&gUnknown_0203CE54->unk804[4], 8, arg0);
|
||||
sub_81223FC(&gUnknown_0203CE54->spriteId[4], 8, arg0);
|
||||
}
|
||||
|
||||
void sub_80D4FEC(u8 arg0)
|
||||
{
|
||||
sub_8122448(&gUnknown_0203CE54->unk804[4], 136, 120, (arg0 + 1) * 16);
|
||||
sub_8122448(&gUnknown_0203CE54->spriteId[4], 136, 120, (arg0 + 1) * 16);
|
||||
}
|
||||
|
||||
static void sub_80D5018(void *mem0, void *mem1)
|
||||
|
@ -57,7 +57,6 @@ extern void bag_menu_yes_no(u8, u8, const struct YesNoFuncTable*);
|
||||
extern void sub_81C5924(void);
|
||||
extern void sub_81C59BC(void);
|
||||
extern void sub_81AB9A8(u8);
|
||||
extern void sub_81ABA88(u8);
|
||||
extern void StartEscapeRopeFieldEffect(void);
|
||||
extern u8* sub_806CF78(u16);
|
||||
extern void sub_81B89F0(void);
|
||||
@ -128,7 +127,7 @@ void SetUpItemUseCallback(u8 taskId)
|
||||
type = ItemId_GetType(gSpecialVar_ItemId) - 1;
|
||||
if (!InBattlePyramid())
|
||||
{
|
||||
gUnknown_0203CE54->unk0 = gUnknown_085920D8[type];
|
||||
gUnknown_0203CE54->mainCallback2 = gUnknown_085920D8[type];
|
||||
unknown_ItemMenu_Confirm(taskId);
|
||||
}
|
||||
else
|
||||
@ -212,7 +211,7 @@ void sub_80FD254(void)
|
||||
|
||||
void ItemUseOutOfBattle_Mail(u8 taskId)
|
||||
{
|
||||
gUnknown_0203CE54->unk0 = sub_80FD254;
|
||||
gUnknown_0203CE54->mainCallback2 = sub_80FD254;
|
||||
unknown_ItemMenu_Confirm(taskId);
|
||||
}
|
||||
|
||||
@ -608,7 +607,7 @@ void ItemUseOutOfBattle_PokeblockCase(u8 taskId)
|
||||
}
|
||||
else if (gTasks[taskId].data[3] != TRUE)
|
||||
{
|
||||
gUnknown_0203CE54->unk0 = sub_80FDBEC;
|
||||
gUnknown_0203CE54->mainCallback2 = sub_80FDBEC;
|
||||
unknown_ItemMenu_Confirm(taskId);
|
||||
}
|
||||
else
|
||||
@ -670,7 +669,7 @@ void sub_80FDD10(u8 taskId)
|
||||
{
|
||||
gUnknown_0203A0F4 = sub_80FDD74;
|
||||
gFieldCallback = MapPostLoadHook_UseItem;
|
||||
gUnknown_0203CE54->unk0 = CB2_ReturnToField;
|
||||
gUnknown_0203CE54->mainCallback2 = CB2_ReturnToField;
|
||||
unknown_ItemMenu_Confirm(taskId);
|
||||
}
|
||||
else
|
||||
@ -812,7 +811,7 @@ void sub_80FE058(void)
|
||||
if (!InBattlePyramid())
|
||||
{
|
||||
sub_81AB9A8(ItemId_GetPocket(gSpecialVar_ItemId));
|
||||
sub_81ABA88(ItemId_GetPocket(gSpecialVar_ItemId));
|
||||
SetInitialScrollAndCursorPositions(ItemId_GetPocket(gSpecialVar_ItemId));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -993,7 +992,7 @@ void sub_80FE54C(u8 taskId)
|
||||
{
|
||||
if (!InBattlePyramid())
|
||||
{
|
||||
gUnknown_0203CE54->unk0 = sub_81B89F0;
|
||||
gUnknown_0203CE54->mainCallback2 = sub_81B89F0;
|
||||
unknown_ItemMenu_Confirm(taskId);
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user