diff --git a/asm/non_matching/fileScreen/sub_08050EF4.inc b/asm/non_matching/fileScreen/sub_08050EF4.inc index dbad9f1e..04388489 100644 --- a/asm/non_matching/fileScreen/sub_08050EF4.inc +++ b/asm/non_matching/fileScreen/sub_08050EF4.inc @@ -106,7 +106,7 @@ _08050FAC: bl SoundReq _08050FBA: adds r0, r5, #0 - bl sub_080A7114 + bl SetMenuType ldr r0, _08050FCC @ =gUnk_02019EE0 ldrb r0, [r0, #6] bl SetActiveSave diff --git a/asm/non_matching/fileScreen/sub_08051738.inc b/asm/non_matching/fileScreen/sub_08051738.inc index 16ca61e3..6b6c621c 100644 --- a/asm/non_matching/fileScreen/sub_08051738.inc +++ b/asm/non_matching/fileScreen/sub_08051738.inc @@ -45,13 +45,13 @@ _08051774: movs r1, #0 bl CreateDialogBox movs r0, #3 - bl sub_080A7114 + bl SetMenuType b _080517A2 .align 2, 0 _08051798: .4byte gMenu _0805179C: movs r0, #1 - bl sub_080A7114 + bl SetMenuType _080517A2: adds r4, #1 ldr r0, _080517B0 @ =gMenu diff --git a/asm/non_matching/fileScreen/sub_080610B8.inc b/asm/non_matching/fileScreen/sub_080610B8.inc index 037a8765..93548d8d 100644 --- a/asm/non_matching/fileScreen/sub_080610B8.inc +++ b/asm/non_matching/fileScreen/sub_080610B8.inc @@ -319,7 +319,7 @@ _08051316: movs r0, #0x6a bl sub_08051574 adds r0, r7, #0 - bl sub_080A7114 + bl SetMenuType _08051322: movs r0, #0x80 lsls r0, r0, #0x12 diff --git a/asm/non_matching/subtask/sub_080A4BA0.inc b/asm/non_matching/menu/figurine_menu/sub_080A4BA0.inc similarity index 100% rename from asm/non_matching/subtask/sub_080A4BA0.inc rename to asm/non_matching/menu/figurine_menu/sub_080A4BA0.inc diff --git a/asm/non_matching/subtask/KinstoneMenu_080A414C.inc b/asm/non_matching/menu/kinstone_menu/KinstoneMenu_080A414C.inc similarity index 100% rename from asm/non_matching/subtask/KinstoneMenu_080A414C.inc rename to asm/non_matching/menu/kinstone_menu/KinstoneMenu_080A414C.inc diff --git a/asm/non_matching/subtask/KinstoneMenu_Type1.inc b/asm/non_matching/menu/kinstone_menu/KinstoneMenu_Type1.inc similarity index 98% rename from asm/non_matching/subtask/KinstoneMenu_Type1.inc rename to asm/non_matching/menu/kinstone_menu/KinstoneMenu_Type1.inc index d55c1997..19ed0509 100644 --- a/asm/non_matching/subtask/KinstoneMenu_Type1.inc +++ b/asm/non_matching/menu/kinstone_menu/KinstoneMenu_Type1.inc @@ -84,7 +84,7 @@ _080A3CFE: cmp r0, #0 beq _080A3D30 movs r0, #2 - bl sub_080A7114 + bl SetMenuType movs r0, #0x6c bl SoundReq b _080A3DA8 @@ -144,7 +144,7 @@ _080A3D70: adds r0, #0x2a strb r1, [r0] movs r0, #3 - bl sub_080A7114 + bl SetMenuType _080A3D8A: bl sub_080A3B48 cmp r0, r4 diff --git a/asm/subtask2.s b/asm/subtask2.s index 58b34906..c1381564 100644 --- a/asm/subtask2.s +++ b/asm/subtask2.s @@ -134,7 +134,7 @@ _080A5688: movs r0, #1 strb r0, [r1, #0x14] strb r0, [r1, #0x15] - bl sub_080A7114 + bl SetMenuType pop {r4, r5, r6, r7, pc} .align 2, 0 _080A5698: .4byte gMenu @@ -815,7 +815,7 @@ sub_080A59AC: @ 0x080A59AC movs r1, #0 bl SetPopupState movs r0, #1 - bl sub_080A7114 + bl SetMenuType pop {pc} .align 2, 0 _080A59C4: .4byte gMenu @@ -870,13 +870,13 @@ _080A5A10: movs r1, #0 bl CreateDialogBox movs r0, #2 - bl sub_080A7114 + bl SetMenuType movs r0, #0x6a bl SoundReq b _080A5A52 _080A5A2E: movs r0, #3 - bl sub_080A7114 + bl SetMenuType movs r0, #0x6c bl SoundReq b _080A5A52 @@ -921,7 +921,7 @@ _080A5A76: strh r0, [r1, #8] _080A5A84: movs r0, #3 - bl sub_080A7114 + bl SetMenuType _080A5A8A: pop {pc} .align 2, 0 @@ -1019,7 +1019,7 @@ _080A5B24: .endif _080A5B28: movs r0, #1 - bl sub_080A7114 + bl SetMenuType .ifdef EU pop {pc} .else @@ -1091,7 +1091,7 @@ _080A5B8E: movs r0, #0x3c strh r0, [r6, #8] movs r0, #2 - bl sub_080A7114 + bl SetMenuType b _080A5BB6 _080A5BAA: movs r0, #0x6c @@ -1182,7 +1182,7 @@ sub_080A5C44: @ 0x080A5C44 movs r1, #1 bl sub_080A6FB4 movs r0, #1 - bl sub_080A7114 + bl SetMenuType ldrb r1, [r4, #3] lsls r1, r1, #1 ldr r0, _080A5C94 @ =gUnk_08128D43 @@ -1925,7 +1925,7 @@ sub_080A6024: @ 0x080A6024 bl sub_0801E738 bl sub_080A4398 movs r0, #1 - bl sub_080A7114 + bl SetMenuType pop {pc} .align 2, 0 _080A6040: .4byte gUnk_08128D60 @@ -2033,7 +2033,7 @@ sub_080A6108: @ 0x080A6108 ldr r0, _080A6128 @ =gUnk_08128DBC bl sub_080A70AC movs r0, #1 - bl sub_080A7114 + bl SetMenuType pop {pc} .align 2, 0 _080A6120: .4byte gMenu @@ -2893,7 +2893,7 @@ sub_080A6534: @ 0x080A6534 movs r0, #0x3c strh r0, [r1, #8] movs r0, #1 - bl sub_080A7114 + bl SetMenuType movs r0, #4 movs r1, #8 bl SetFade @@ -3000,7 +3000,7 @@ sub_080A6650: @ 0x080A6650 bl sub_080A67C4 bl sub_080A68D4 movs r0, #1 - bl sub_080A7114 + bl SetMenuType pop {pc} .align 2, 0 _080A6670: .4byte gUnk_08128E84 @@ -3917,7 +3917,7 @@ _080A6BD4: movs r0, #0x1e strh r0, [r1, #8] movs r0, #1 - bl sub_080A7114 + bl SetMenuType movs r0, #4 movs r1, #8 bl SetFade @@ -4020,7 +4020,7 @@ sub_080A6CA8: @ 0x080A6CA8 ldr r1, _080A6CD4 @ =gMenu strb r0, [r1, #3] movs r0, #1 - bl sub_080A7114 + bl SetMenuType movs r0, #4 movs r1, #8 bl SetFade @@ -4083,7 +4083,7 @@ _080A6D34: _080A6D38: movs r0, #2 strb r0, [r2] - bl sub_080A7114 + bl SetMenuType ldr r0, _080A6D48 @ =0x00000704 bl MessageFromTarget b _080A6D54 @@ -4092,7 +4092,7 @@ _080A6D48: .4byte 0x00000704 _080A6D4C: movs r0, #3 strb r0, [r1] - bl sub_080A7114 + bl SetMenuType _080A6D54: cmp r4, #0 beq _080A6D6E @@ -4188,7 +4188,7 @@ _080A65DC: cmp r0, #0 beq _080A65EA movs r0, #3 - bl sub_080A7114 + bl SetMenuType _080A65EA: pop {pc} .align 2, 0 @@ -4213,7 +4213,7 @@ _080A6DEC: .4byte gMenu _080A6DF0: movs r0, #1 _080A6DF2: - bl sub_080A7114 + bl SetMenuType _080A6DF6: pop {pc} .endif @@ -4226,7 +4226,7 @@ sub_080A6DF8: @ 0x080A6DF8 cmp r0, #2 bne _080A6E18 movs r0, #4 - bl sub_080A7114 + bl SetMenuType movs r0, #5 movs r1, #8 bl SetFade @@ -4666,8 +4666,8 @@ _080A70FC: .align 2, 0 _080A7110: .4byte gUnk_0200AF34 - thumb_func_start sub_080A7114 -sub_080A7114: @ 0x080A7114 + thumb_func_start SetMenuType +SetMenuType: @ 0x080A7114 ldr r1, _080A7120 @ =gMenu movs r2, #0 strb r0, [r1, #5] diff --git a/assets/assets.json b/assets/assets.json index 3a683b72..4b211987 100644 --- a/assets/assets.json +++ b/assets/assets.json @@ -47368,16 +47368,6 @@ "start": 1215192, "size": 88 }, - { - "path": "data_08127280/gUnk_08128B50.bin", - "start": 1215312, - "size": 20 - }, - { - "path": "data_08127280/gUnk_08128BF4.bin", - "start": 1215476, - "size": 4 - }, { "path": "data_08127280/gUnk_08128C00.bin", "start": 1215488, diff --git a/data/data_08128A38.s b/data/data_08128A38.s index aa7e88a2..932d8c47 100644 --- a/data/data_08128A38.s +++ b/data/data_08128A38.s @@ -6,13 +6,13 @@ gUnk_08128A38:: @ 08128A38 .incbin "data_08127280/gUnk_08128A38.bin" - .4byte sub_080A4F28 + .4byte PauseMenu_Variant0 .incbin "data_08127280/gUnk_08128A38_1.bin" - .4byte sub_080A5218 + .4byte PauseMenu_ItemMenu .incbin "data_08127280/gUnk_08128A38_2.bin" - .4byte sub_080A5574 + .4byte PauseMenu2 .incbin "data_08127280/gUnk_08128A38_3.bin" - .4byte sub_080A4F28 + .4byte PauseMenu_Variant0 .incbin "data_08127280/gUnk_08128A38_4.bin" .4byte sub_080A6270 .incbin "data_08127280/gUnk_08128A38_5.bin" @@ -30,21 +30,21 @@ gUnk_08128A38:: @ 08128A38 .incbin "data_08127280/gUnk_08128A38_11.bin" .4byte sub_080A5990 .incbin "data_08127280/gUnk_08128A38_12.bin" - .4byte sub_080A4F28 + .4byte PauseMenu_Variant0 .incbin "data_08127280/gUnk_08128A38_13.bin" - .4byte sub_080A4F28 + .4byte PauseMenu_Variant0 .incbin "data_08127280/gUnk_08128A38_14.bin" - .4byte sub_080A4F28 + .4byte PauseMenu_Variant0 .incbin "data_08127280/gUnk_08128A38_15.bin" - .4byte sub_080A4F28 + .4byte PauseMenu_Variant0 .incbin "data_08127280/gUnk_08128A38_16.bin" - .4byte sub_080A4F28 + .4byte PauseMenu_Variant0 .incbin "data_08127280/gUnk_08128A38_17.bin" - .4byte sub_080A4F28 + .4byte PauseMenu_Variant0 .incbin "data_08127280/gUnk_08128A38_18.bin" - .4byte sub_080A4F28 + .4byte PauseMenu_Variant0 .incbin "data_08127280/gUnk_08128A38_19.bin" - .4byte sub_080A4F28 + .4byte PauseMenu_Variant0 gUnk_08128AD8:: @ 08128AD8 .ifdef EU @@ -53,18 +53,3 @@ gUnk_08128AD8:: @ 08128AD8 .else .incbin "data_08127280/gUnk_08128AD8_1_USA-JP-DEMO_USA-DEMO_JP.bin" .endif - -gUnk_08128B30:: @ 08128B30 - .4byte sub_080A4F28 - .4byte sub_080A4FA0 - .4byte sub_080A4FB8 - .4byte sub_080A50B8 - .4byte sub_080A50E8 - .4byte sub_080A5108 - -gUnk_08128B48:: @ 08128B48 - .4byte sub_080A5238 - .4byte sub_080A529C - -gUnk_08128B50:: @ 08128B50 - .incbin "data_08127280/gUnk_08128B50.bin" diff --git a/data/data_08128BF4.s b/data/data_08128BF4.s index 90f0801d..d19f524e 100644 --- a/data/data_08128BF4.s +++ b/data/data_08128BF4.s @@ -4,13 +4,6 @@ .section .rodata .align 2 -gUnk_08128BF4:: @ 08128BF4 - .incbin "data_08127280/gUnk_08128BF4.bin" - -gUnk_08128BF8:: @ 08128BF8 - .4byte sub_080A5594 - .4byte sub_080A56A0 - gUnk_08128C00:: @ 08128C00 .incbin "data_08127280/gUnk_08128C00.bin" diff --git a/include/itemMenuTable.h b/include/itemMenuTable.h deleted file mode 100644 index f1d6aaa5..00000000 --- a/include/itemMenuTable.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef SUBTASK_ITEMMENUTABLE_H -#define SUBTASK_ITEMMENUTABLE_H - -#include "global.h" - -typedef enum { - MENU_SLOT_SWORD, - MENU_SLOT_GUST_JAR, - MENU_SLOT_CANE, - MENU_SLOT_BOOMERANG, - MENU_SLOT_SHIELD, - MENU_SLOT_MOLE_MITTS, - MENU_SLOT_LANTERN, - MENU_SLOT_BOMBS, - MENU_SLOT_PEGASUS_BOOTS, - MENU_SLOT_ROCS_CAPE, - MENU_SLOT_OCARINA, - MENU_SLOT_BOW, - MENU_SLOT_BOTTLE0, - MENU_SLOT_BOTTLE1, - MENU_SLOT_BOTTLE2, - MENU_SLOT_BOTTLE3, - MENU_SLOT_SAVE_BUTTON, -} ItemMenuTableSlot; - -typedef struct { - u8 up; - u8 down; - u8 left; - u8 right; - u8 type; - u8 unk0; - u8 x; - u8 y; -} ItemMenuTableEntry; - -extern const ItemMenuTableEntry gItemMenuTable[]; - -#endif // SUBTASK_ITEMMENUTABLE_H diff --git a/include/menu.h b/include/menu.h index 4402e192..f590e999 100644 --- a/include/menu.h +++ b/include/menu.h @@ -114,9 +114,15 @@ typedef struct { /*0x2e*/ u16 unk2e; } FigurineMenu; +typedef struct { + /*0x00*/ Menu base; + /*0x10*/ u8 items[17]; // unsure about size +} PauseMenu; + extern Menu gMenu; #define gGenericMenu (*(GenericMenu*)&gMenu) #define gKinstoneMenu (*(KinstoneMenu*)&gMenu) #define gFigurineMenu (*(FigurineMenu*)&gMenu) +#define gPauseMenu (*(PauseMenu*)&gMenu) #endif diff --git a/include/subtask.h b/include/subtask.h index efc0c757..46412946 100644 --- a/include/subtask.h +++ b/include/subtask.h @@ -39,7 +39,7 @@ Subtask Subtask_LocalMapHint; // todo: separate headers for each subtask? extern void sub_080A4398(void); -extern void sub_080A7114(u32); +extern void SetMenuType(u32); extern void sub_080A4D34(void); extern void sub_080A4E90(u8); extern void sub_080A4E84(u8); diff --git a/linker.ld b/linker.ld index 8a491f79..a2e6e685 100644 --- a/linker.ld +++ b/linker.ld @@ -856,8 +856,8 @@ SECTIONS { asm/staffroll.o(.text); src/menu/kinstone_menu.o(.text); src/menu/figurine_menu.o(.text); - src/subtask.o(.text); - asm/subtask2.o(.text); /* subtask.c */ + src/menu/pause_menu.o(.text); + asm/subtask2.o(.text); src/playerItem/playerItemSword.o(.text); src/playerItemUtils.o(.text); src/projectileUtils.o(.text); @@ -1602,10 +1602,9 @@ SECTIONS { data/data_08127280.o(.rodata); src/menu/kinstone_menu.o(.rodata); src/menu/figurine_menu.o(.rodata); - src/subtask.o(.rodata); data/gfx/figurines.o(.rodata); data/data_08128A38.o(.rodata); - src/itemMenuTable.o(.rodata); + src/menu/pause_menu.o(.rodata); data/data_08128BF4.o(.rodata); data/const/playerItem/playerItemSword.o(.rodata); data/projectile_functions.o(.rodata); diff --git a/src/fileselect.c b/src/fileselect.c index 724444f3..129bd6da 100644 --- a/src/fileselect.c +++ b/src/fileselect.c @@ -363,7 +363,7 @@ void sub_08050848(void) { sub_0805070C(); gUnk_02019EE0.unk7 = 0; sub_08050AFC(gUnk_02019EE0.unk6); - sub_080A7114(1); + SetMenuType(1); } void sub_0805086C(void) { @@ -404,7 +404,7 @@ void sub_080508E4(void) { void sub_08050910(void) { sub_08050384(); if (++gUnk_02019EE0.unk7 > 2) { - sub_080A7114(2); + SetMenuType(2); } else { gChooseFileState.subState = 0; } @@ -630,7 +630,7 @@ void sub_08050C54(void) { SoundReq(SONG_VOL_FADE_OUT); } gMenu.transitionTimer = 0xf; - sub_080A7114(1); + SetMenuType(1); SoundReq(SFX_TEXTBOX_SELECT); break; case B_BUTTON: @@ -686,7 +686,7 @@ void sub_08050DB8(void) { MemClear(&gBG2Buffer, sizeof(gBG2Buffer)); sub_080503A8(0xc); gMenu.field_0x4 = gSaveHeader->language; - sub_080A7114(1); + SetMenuType(1); } void sub_08050DE4(void) { @@ -707,7 +707,7 @@ void sub_08050DE4(void) { case START_BUTTON: SoundReq(SFX_TEXTBOX_SELECT); if (gMenu.field_0x4 != row_idx) { - sub_080A7114(2); + SetMenuType(2); CreateDialogBox(8, 0); } else { SetFileSelectState(STATE_NONE); @@ -751,7 +751,7 @@ void sub_08050EB8(void) { gUnk_02019EE0.unk5 = save->brightness; gMenu.column_idx = 0; gMenu.transitionTimer = 0xff; - sub_080A7114(1); + SetMenuType(1); } NONMATCH("asm/non_matching/fileScreen/sub_08050EF4.inc", void sub_08050EF4(void)) { @@ -804,7 +804,7 @@ NONMATCH("asm/non_matching/fileScreen/sub_08050EF4.inc", void sub_08050EF4(void) gUnk_02019EE0.saves[gUnk_02019EE0.unk6].msg_speed = gUnk_02019EE0.unk4; gUnk_02019EE0.saves[gUnk_02019EE0.unk6].brightness = gUnk_02019EE0.unk5; SoundReq(SFX_MENU_CANCEL); - sub_080A7114(mode); + SetMenuType(mode); SetActiveSave(gUnk_02019EE0.unk6); break; case 2: @@ -812,7 +812,7 @@ NONMATCH("asm/non_matching/fileScreen/sub_08050EF4.inc", void sub_08050EF4(void) SoundReq(SFX_TEXTBOX_SELECT); default: case 1: - sub_080A7114(mode); + SetMenuType(mode); SetActiveSave(gUnk_02019EE0.unk6); break; case 0: @@ -836,7 +836,7 @@ void sub_08050FFC(void) { sub_0805194C(gUnk_02019EE0.unk6); CreateDialogBox(9, 0); case SAVE_OK: - sub_080A7114(3); + SetMenuType(3); break; } } @@ -867,7 +867,7 @@ void sub_08051090(void) { sub_08051458(); gScreen.bg1.yOffset = 0xff; gScreen.bg2.yOffset = 0xff; - sub_080A7114(1); + SetMenuType(1); } NONMATCH("asm/non_matching/fileScreen/sub_080610B8.inc", void sub_080610B8(void)) { @@ -897,7 +897,7 @@ void sub_080513C0(void) { switch (HandleSave(0)) { case 1: gUnk_02019EE0.saveStatus[gUnk_02019EE0.unk6] = 1; - sub_080A7114(3); + SetMenuType(3); break; case 0: break; @@ -914,7 +914,7 @@ void sub_0805141C(void) { switch (gMenu.transitionTimer) { case 0: if (gInput.newKeys & (A_BUTTON | START_BUTTON)) { - sub_080A7114(3); + SetMenuType(3); } break; default: @@ -1039,7 +1039,7 @@ void HandleFileDelete(void) { } void sub_080515c8(void) { - sub_080A7114(1); + SetMenuType(1); } void sub_080515D4(void) { @@ -1058,7 +1058,7 @@ void sub_080515D4(void) { case START_BUTTON: if (column_idx == 1) { CreateDialogBox(4, 0); - sub_080A7114(2); + SetMenuType(2); SoundReq(SFX_TEXTBOX_SELECT); } else { SetFileSelectState(0); @@ -1113,9 +1113,9 @@ NONMATCH("asm/non_matching/fileScreen/sub_08051738.inc", void sub_08051738(void) if (uVar3 == 0) { gMenu.transitionTimer = 0x3c; CreateDialogBox(1, 0); - sub_080A7114(3); + SetMenuType(3); } else { - sub_080A7114(1); + SetMenuType(1); } uVar3++; gGenericMenu.unk16 = uVar3; @@ -1156,7 +1156,7 @@ void sub_080517EC(void) { case START_BUTTON: if (gUnk_02019EE0.unk7 < 3) { CreateDialogBox(2, 0); - sub_080A7114(2); + SetMenuType(2); SoundReq(SFX_TEXTBOX_SELECT); break; } @@ -1188,7 +1188,7 @@ void sub_08051874(void) { sub_0805194C(gUnk_02019EE0.unk7); CreateDialogBox(3, 0); gMenu.transitionTimer = 0x1e; - sub_080A7114(3); + SetMenuType(3); break; } } diff --git a/src/game.c b/src/game.c index afb0e3cf..009c9859 100644 --- a/src/game.c +++ b/src/game.c @@ -645,7 +645,7 @@ void GameOverTask(void) { static void switch_state(u32 idx) { gMain.state = idx; - sub_080A7114(0); + SetMenuType(0); } static void GameOver_Init(void) { @@ -706,7 +706,7 @@ static void GameOver_TextMove(void) { case 0: gMenu.transitionTimer = 30; gMenu.field_0x3 = 0; - sub_080A7114(1); + SetMenuType(1); SetPopupState(0, 0); gFadeControl.mask = 0xffffffff; return; @@ -728,7 +728,7 @@ static void GameOver_TextMove(void) { temp2 = 2; } gMenu.transitionTimer = 60; - sub_080A7114(temp2); + SetMenuType(temp2); SoundReq(SFX_TEXTBOX_SELECT); break; } @@ -746,12 +746,12 @@ static void GameOver_TextMove(void) { gMenu.field_0x0 = temp3; switch (temp3) { case 1: - sub_080A7114(4); + SetMenuType(4); break; case -1: gMenu.transitionTimer = 60; CreateDialogBox(9, 0); - sub_080A7114(3); + SetMenuType(3); break; } return; @@ -759,7 +759,7 @@ static void GameOver_TextMove(void) { if (gMenu.transitionTimer != 0) { gMenu.transitionTimer--; } else if (gInput.newKeys & (A_BUTTON | B_BUTTON | START_BUTTON)) { - sub_080A7114(0); + SetMenuType(0); } return; case 4: @@ -777,7 +777,7 @@ static void GameOver_Update(void) { case 0x0: gMenu.transitionTimer = 0x1e; gMenu.field_0x3 = 0; - sub_080A7114(1); + SetMenuType(1); SetPopupState(1, 0); return; case 0x1: @@ -795,7 +795,7 @@ static void GameOver_Update(void) { temp = 1; break; case A_BUTTON: - sub_080A7114(2); + SetMenuType(2); SoundReq(SFX_TEXTBOX_SELECT); if (temp == 0) { SetFade(5, 8); diff --git a/src/itemMenuTable.c b/src/itemMenuTable.c deleted file mode 100644 index 13c6e8b1..00000000 --- a/src/itemMenuTable.c +++ /dev/null @@ -1,39 +0,0 @@ -#include "itemMenuTable.h" - -const ItemMenuTableEntry gItemMenuTable[] = { - [MENU_SLOT_SWORD] = { MENU_SLOT_BOTTLE0, MENU_SLOT_SHIELD, MENU_SLOT_BOOMERANG, MENU_SLOT_GUST_JAR, 0x01, 0x0c, - 0x42, 0x33 }, - [MENU_SLOT_GUST_JAR] = { MENU_SLOT_BOTTLE1, MENU_SLOT_MOLE_MITTS, MENU_SLOT_SWORD, MENU_SLOT_CANE, 0x01, 0x10, 0x66, - 0x33 }, - [MENU_SLOT_CANE] = { MENU_SLOT_BOTTLE3, MENU_SLOT_LANTERN, MENU_SLOT_GUST_JAR, MENU_SLOT_BOOMERANG, 0x01, 0x14, - 0x8a, 0x33 }, - [MENU_SLOT_BOOMERANG] = { MENU_SLOT_SAVE_BUTTON, MENU_SLOT_BOMBS, MENU_SLOT_CANE, MENU_SLOT_SWORD, 0x01, 0x15, 0xae, - 0x33 }, - [MENU_SLOT_SHIELD] = { MENU_SLOT_SWORD, MENU_SLOT_PEGASUS_BOOTS, MENU_SLOT_BOMBS, MENU_SLOT_MOLE_MITTS, 0x01, 0x16, - 0x42, 0x4b }, - [MENU_SLOT_MOLE_MITTS] = { MENU_SLOT_GUST_JAR, MENU_SLOT_ROCS_CAPE, MENU_SLOT_SHIELD, MENU_SLOT_LANTERN, 0x01, 0x17, - 0x66, 0x4b }, - [MENU_SLOT_LANTERN] = { MENU_SLOT_CANE, MENU_SLOT_OCARINA, MENU_SLOT_MOLE_MITTS, MENU_SLOT_BOMBS, 0x01, 0x00, 0x8a, - 0x4b }, - [MENU_SLOT_BOMBS] = { MENU_SLOT_BOOMERANG, MENU_SLOT_BOW, MENU_SLOT_LANTERN, MENU_SLOT_SHIELD, 0x01, 0x00, 0xae, - 0x4b }, - [MENU_SLOT_PEGASUS_BOOTS] = { MENU_SLOT_SHIELD, MENU_SLOT_BOTTLE0, MENU_SLOT_BOW, MENU_SLOT_ROCS_CAPE, 0x01, 0x00, - 0x42, 0x63 }, - [MENU_SLOT_ROCS_CAPE] = { MENU_SLOT_MOLE_MITTS, MENU_SLOT_BOTTLE1, MENU_SLOT_PEGASUS_BOOTS, MENU_SLOT_OCARINA, 0x01, - 0x00, 0x66, 0x63 }, - [MENU_SLOT_OCARINA] = { MENU_SLOT_LANTERN, MENU_SLOT_BOTTLE3, MENU_SLOT_ROCS_CAPE, MENU_SLOT_BOW, 0x01, 0x00, 0x8a, - 0x63 }, - [MENU_SLOT_BOW] = { MENU_SLOT_BOMBS, MENU_SLOT_SAVE_BUTTON, MENU_SLOT_OCARINA, MENU_SLOT_PEGASUS_BOOTS, 0x01, 0x00, - 0xae, 0x63 }, - [MENU_SLOT_BOTTLE0] = { MENU_SLOT_PEGASUS_BOOTS, MENU_SLOT_SWORD, MENU_SLOT_SAVE_BUTTON, MENU_SLOT_BOTTLE1, 0x01, - 0x00, 0x42, 0x7b }, - [MENU_SLOT_BOTTLE1] = { MENU_SLOT_ROCS_CAPE, MENU_SLOT_GUST_JAR, MENU_SLOT_BOTTLE0, MENU_SLOT_BOTTLE2, 0x01, 0x00, - 0x5a, 0x7b }, - [MENU_SLOT_BOTTLE2] = { MENU_SLOT_ROCS_CAPE, MENU_SLOT_GUST_JAR, MENU_SLOT_BOTTLE1, MENU_SLOT_BOTTLE3, 0x01, 0x00, - 0x72, 0x7b }, - [MENU_SLOT_BOTTLE3] = { MENU_SLOT_OCARINA, MENU_SLOT_CANE, MENU_SLOT_BOTTLE2, MENU_SLOT_SAVE_BUTTON, 0x01, 0x00, - 0x8a, 0x7b }, - [MENU_SLOT_SAVE_BUTTON] = { MENU_SLOT_BOW, MENU_SLOT_BOOMERANG, MENU_SLOT_BOTTLE3, MENU_SLOT_BOTTLE0, 0x03, 0x00, - 0xb5, 0x75 }, - { MENU_SLOT_BOW, MENU_SLOT_BOOMERANG, MENU_SLOT_BOTTLE3, MENU_SLOT_BOTTLE0, 0x05, 0x00, 0xb5, 0x75 }, -}; diff --git a/src/menu/figurine_menu.c b/src/menu/figurine_menu.c index c6318a25..7405260e 100644 --- a/src/menu/figurine_menu.c +++ b/src/menu/figurine_menu.c @@ -55,22 +55,22 @@ typedef struct { } struct_08128AD8; extern const struct_08128AD8 gUnk_08128AD8[]; -void FigurineMenu0_Type0(void); -void FigurineMenu0_Type1(void); -void FigurineMenu0_Type2(void); -void FigurineMenu0_Type3(void); -void FigurineMenu1_Type0(void); -void FigurineMenu1_Type1(void); -void FigurineMenu1_Type2(void); -void FigurineMenu1_Type3(void); +Subtask FigurineMenu0_Type0; +Subtask FigurineMenu0_Type1; +Subtask FigurineMenu0_Type2; +Subtask FigurineMenu0_Type3; +Subtask FigurineMenu1_Type0; +Subtask FigurineMenu1_Type1; +Subtask FigurineMenu1_Type2; +Subtask FigurineMenu1_Type3; void Subtask_FigurineMenu(void) { - static void (*const figurineMenu1_Types[])(void) = { + static Subtask* const figurineMenu1_Types[] = { FigurineMenu0_Type0, FigurineMenu0_Type1, FigurineMenu0_Type2, FigurineMenu0_Type3, }; - static void (*const figurineMenu0_Types[])(void) = { + static Subtask* const figurineMenu0_Types[] = { FigurineMenu1_Type0, FigurineMenu1_Type1, FigurineMenu1_Type2, @@ -136,13 +136,13 @@ void FigurineMenu_080A46C0(void) { void FigurineMenu0_Type0(void) { FigurineMenu_080A4608(); - sub_080A7114(1); + SetMenuType(1); } void FigurineMenu0_Type1(void) { if (gFadeControl.active == 0) { CreateObject(OBJECT_A2, gUnk_080FC3E4[gFigurineMenu.unk1c].unk7, 0); - sub_080A7114(2); + SetMenuType(2); } } @@ -168,7 +168,7 @@ void FigurineMenu0_Type2(void) { gScreen.controls.layerBrightness = 0; gScreen.controls.layerFXControl = 0; gScreen.lcd.displayControl |= 0x2000; - sub_080A7114(3); + SetMenuType(3); sub_080A70AC((KeyButtonLayout*)&gUnk_0812813C); gMenu.column_idx = 0x15; if (gFigurineMenu.unk21 == 0) { @@ -215,7 +215,7 @@ void FigurineMenu1_Type0(void) { gScreen.lcd.displayControl |= 0x2000; sub_080A70AC(&gUnk_0812813C); gMenu.column_idx = 0xff; - sub_080A7114(1); + SetMenuType(1); } void FigurineMenu1_Type1(void) { @@ -229,7 +229,7 @@ void FigurineMenu1_Type1(void) { switch (gInput.unk4) { case 2: case 8: - sub_080A7114(3); + SetMenuType(3); break; case 0x200: r4 -= 5; @@ -263,7 +263,7 @@ void FigurineMenu1_Type1(void) { if (r0 != r4) { gFigurineMenu.unk1c = r4; SoundReq(SFX_TEXTBOX_CHOICE); - sub_080A7114(2); + SetMenuType(2); r5 = 0; } r0 = gFigurineMenu.unk1e; @@ -278,7 +278,7 @@ void FigurineMenu1_Type1(void) { } void FigurineMenu1_Type2(void) { - sub_080A7114(1); + SetMenuType(1); } void FigurineMenu1_Type3(void) { @@ -453,7 +453,7 @@ extern u8 gUnk_020227E8[]; extern void sub_08057044(u32, u8*, u8*); extern void sub_0805F46C(u32, const struct_0812816C*); -NONMATCH("asm/non_matching/subtask/sub_080A4BA0.inc", u32 sub_080A4BA0(u32 unk1, u32 unk2)) { +NONMATCH("asm/non_matching/menu/figurine_menu/sub_080A4BA0.inc", u32 sub_080A4BA0(u32 unk1, u32 unk2)) { int r0, r1, r2, r3, r4, r5, r6; struct_0812816C s0; diff --git a/src/menu/kinstone_menu.c b/src/menu/kinstone_menu.c index 10d2da5f..890ac05e 100644 --- a/src/menu/kinstone_menu.c +++ b/src/menu/kinstone_menu.c @@ -68,14 +68,14 @@ void KinstoneMenu_080A4080(void); u32 KinstoneMenu_080A4494(void); void KinstoneMenu_080A4528(void); -void KinstoneMenu_Type0(void); -void KinstoneMenu_Type1(void); -void KinstoneMenu_Type2(void); -void KinstoneMenu_Type3(void); -void KinstoneMenu_Type4(void); -void KinstoneMenu_Type5(void); +Subtask KinstoneMenu_Type0; +Subtask KinstoneMenu_Type1; +Subtask KinstoneMenu_Type2; +Subtask KinstoneMenu_Type3; +Subtask KinstoneMenu_Type4; +Subtask KinstoneMenu_Type5; void Subtask_KinstoneMenu(void) { - static void (*const kinstoneMenuTypes[])(void) = { + static Subtask* const kinstoneMenuTypes[] = { KinstoneMenu_Type0, KinstoneMenu_Type1, KinstoneMenu_Type2, KinstoneMenu_Type3, KinstoneMenu_Type4, KinstoneMenu_Type5, }; @@ -130,7 +130,7 @@ void KinstoneMenu_Type0(void) { sub_080A4398(); sub_0801E738(0); sub_080A70AC((void*)gUnk_081280DC); - sub_080A7114(1); + SetMenuType(1); SetFade(6, 8); } @@ -138,7 +138,7 @@ const u8 gUnk_081280EE[] = { 0x5u, 0x7u, 0xau, 0xeu, 0x13u, 0x1au, }; -NONMATCH("asm/non_matching/subtask/KinstoneMenu_Type1.inc", void KinstoneMenu_Type1(void)) { +NONMATCH("asm/non_matching/menu/kinstone_menu/KinstoneMenu_Type1.inc", void KinstoneMenu_Type1(void)) { s32 tmp1, tmp2, tmp3, tmp4, tmp5; u8* ptr; GenericMenu* menu; @@ -167,7 +167,7 @@ NONMATCH("asm/non_matching/subtask/KinstoneMenu_Type1.inc", void KinstoneMenu_Ty SoundReq(SFX_TEXTBOX_CHOICE); } if ((gInput.newKeys & 0x20a) != 0) { - sub_080A7114(2); + SetMenuType(2); SoundReq(SFX_MENU_CANCEL); return; } @@ -185,7 +185,7 @@ NONMATCH("asm/non_matching/subtask/KinstoneMenu_Type1.inc", void KinstoneMenu_Ty if (gMenu.column_idx == 2) { tmp3 = gGenericMenu.unk10.i / 0x10000; gGenericMenu.unk2a = gSave.unk118[tmp3]; - sub_080A7114(3); + SetMenuType(3); } break; } @@ -221,11 +221,11 @@ void KinstoneMenu_Type2(void) { } } -void KinstoneMenu_Type3_Overlay0(void); -void KinstoneMenu_Type3_Overlay1(void); -void KinstoneMenu_Type3_Overlay2(void); +Subtask KinstoneMenu_Type3_Overlay0; +Subtask KinstoneMenu_Type3_Overlay1; +Subtask KinstoneMenu_Type3_Overlay2; void KinstoneMenu_Type3(void) { - static void (*const kinstoneMenu_Type3_overlays[])(void) = { + static Subtask* const kinstoneMenu_Type3_overlays[] = { KinstoneMenu_Type3_Overlay0, KinstoneMenu_Type3_Overlay1, KinstoneMenu_Type3_Overlay2, @@ -247,7 +247,7 @@ void KinstoneMenu_Type3_Overlay1(void) { u32 temp = gUnk_080C9CBC[gKinstoneMenu.unk2a].unk5; if (temp != gUnk_080C9CBC[gFuseInfo._3].unk5) { SoundReq(SFX_ITEM_SHIELD_BOUNCE); - sub_080A7114(4); + SetMenuType(4); } else { gMenu.overlayType = 2; gMenu.transitionTimer = 0x14; @@ -266,7 +266,7 @@ void KinstoneMenu_Type3_Overlay2(void) { if (++gScreen.controls.layerBrightness > 14) { gScreen.controls.layerBrightness = 0; gScreen.lcd.displayControl &= 0xdfff; - sub_080A7114(5); + SetMenuType(5); } } @@ -277,17 +277,17 @@ void KinstoneMenu_Type4(void) { if (gKinstoneMenu.unk2c < 0) { gKinstoneMenu.unk18 = 0; gKinstoneMenu.unk2c = 0; - sub_080A7114(1); + SetMenuType(1); SoundReq(SFX_MENU_ERROR); } } -void KinstoneMenu_Type5_Overlay0(void); -void KinstoneMenu_Type5_Overlay1(void); -void KinstoneMenu_Type5_Overlay2(void); -void KinstoneMenu_Type5_Overlay3(void); +Subtask KinstoneMenu_Type5_Overlay0; +Subtask KinstoneMenu_Type5_Overlay1; +Subtask KinstoneMenu_Type5_Overlay2; +Subtask KinstoneMenu_Type5_Overlay3; void KinstoneMenu_Type5(void) { - static void (*const kinstoneMenu_Type5_Overlays[])(void) = { + static Subtask* const kinstoneMenu_Type5_Overlays[] = { KinstoneMenu_Type5_Overlay0, KinstoneMenu_Type5_Overlay1, KinstoneMenu_Type5_Overlay2, @@ -335,7 +335,7 @@ void KinstoneMenu_Type5_Overlay2(void) { void KinstoneMenu_Type5_Overlay3(void) { // TODO figure out why in some place s16 is needed and u16 in others if (--(s16)gMenu.transitionTimer < 0) { - sub_080A7114(2); + SetMenuType(2); } } @@ -414,7 +414,7 @@ void KinstoneMenu_080A4080(void) { } } -NONMATCH("asm/non_matching/subtask/KinstoneMenu_080A414C.inc", void KinstoneMenu_080A414C(void)) { +NONMATCH("asm/non_matching/menu/kinstone_menu/KinstoneMenu_080A414C.inc", void KinstoneMenu_080A414C(void)) { s32 uVar1; s32 iVar2; s32 uVar3; diff --git a/src/menu/pause_menu.c b/src/menu/pause_menu.c new file mode 100644 index 00000000..4213bc47 --- /dev/null +++ b/src/menu/pause_menu.c @@ -0,0 +1,598 @@ +#include "global.h" +#include "menu.h" +#include "sound.h" +#include "subtask.h" +#include "screen.h" +#include "item.h" +#include "common.h" +#include "game.h" +#include "main.h" +#include "save.h" +#include "structures.h" +#include "functions.h" + +extern void sub_080A4DB8(u32); + +void sub_080A5128(void); +void sub_080A51D4(void); +u32 sub_080A51F4(void); +void sub_080A5F48(u32, u32); + +extern const u8 gUnk_080FD5B4[]; + +Subtask PauseMenu_Variant0; +Subtask PauseMenu_Variant1; +Subtask PauseMenu_Variant2; +Subtask PauseMenu_Variant3; +Subtask PauseMenu_Variant4; +Subtask PauseMenu_Variant5; +void Subtask_PauseMenu(void) { + static Subtask* const pauseMenu_Variants[] = { + PauseMenu_Variant0, PauseMenu_Variant1, PauseMenu_Variant2, + PauseMenu_Variant3, PauseMenu_Variant4, PauseMenu_Variant5, + }; + + if (gUnk_02034490.unk11 == 6) { + SetBgmVolume(0x100); + Subtask_Exit(); + } else { + FlushSprites(); + pauseMenu_Variants[gUnk_02034490.unk11](); + sub_080A5128(); + sub_0801C1D4(); + DrawOAMCmd(); + if (gUnk_02034490.unk11 != 4) { + gUnk_08128A38[gUnk_02034490.unk1].func(); + } + CopyOAM(); + { + u32 t = gUnk_02034490.unk16; + u32 t2 = (t != 0) ? 0xe46 : 0; + gScreen.controls.layerFXControl = t2; + gScreen.controls.alphaBlend = (t << 8) | (0x10 - t); + } + } +} + +typedef struct { + u8 _0; + u8 _1; + u8 _2; + u8 _3; + u8 _4; + u16 _6; +} struct_08127F94; +struct_08127F94* sub_080A6A80(u32, u32); + +extern u8 gUnk_02034492[]; +void sub_0801E8D4(void); +u32 sub_0801DB94(void); +s32 sub_080A50A0(s32); + +void PauseMenu_Variant0(void) { + struct_08127F94* ptr; + int r0, r1; + + sub_0801E8D4(); + sub_080A4D34(); + r1 = 4; + do { + gUnk_02034492[r1] = 0; + r1++; + } while (r1 <= 0xd); + ptr = sub_080A6A80((u16)gRoomTransition.player_status.overworld_map_x, + (u16)gRoomTransition.player_status.overworld_map_y); + gUnk_02034490.unk2[4] = ptr->_4; + gUnk_02034490.unk2[5] = sub_0801DB94(); + if (IsItemEquipped(ITEM_LANTERN_ON) != 2) { + r1 = 0x10; + } else { + r1 = 0xf; + } + gUnk_02034490.unk15 = r1; + r0 = gUnk_08128A38[gUnk_02034490.unk1].unk1; + r0 = sub_080A50A0(r0); + gUnk_02034490.unk1 = r0; + gUnk_02034490.unk14 = r0; + sub_080A4DB8(r0); + SetFade(4, 0x20); + sub_080A4E90(1); +} + +void PauseMenu_Variant1(void) { + if (gFadeControl.active == 0) { + sub_080A4E90(2); + } +} + +void PauseMenu_Variant2(void) { + int iVar1; + u32 uVar2; + int iVar4; + s32 bVar5; + + if ((sub_080A51F4() != 0) && (gMenu.field_0xc != NULL)) { + iVar1 = -1; + switch (gInput.newKeys) { + case START_BUTTON: + iVar1 = 0; + break; + case L_BUTTON: + iVar1 = 1; + break; + case R_BUTTON: + iVar1 = 2; + break; + case B_BUTTON: + iVar1 = 3; + break; + } + if (iVar1 >= 0) { + switch (bVar5 = gMenu.field_0xc[iVar1]) { + case 0: + break; + case 4 ... 6: + case 0xf: + uVar2 = GetInventoryValue(ITEM_MAP); + if (uVar2 == 0) { + iVar4 = 1; + if (iVar1 == 1) { + iVar4 = 2; + } + bVar5 = gMenu.field_0xc[iVar4]; + } + default: + gUnk_02034490.unk14 = bVar5; + SoundReq(SFX_TEXTBOX_OPEN); + gMenu.field_0xc = NULL; + break; + } + } + } + bVar5 = sub_080A50A0(gUnk_02034490.unk14); + if (gUnk_02034490.unk1 != bVar5) { + gUnk_02034490.unk14 = bVar5; + sub_080A51D4(); + if (bVar5 == 0xe) { + sub_080A4E90(6); + } else { + sub_080A4E90(3); + MemClear(&gBG0Buffer, 0x800); + gScreen.bg0.updated = 1; + } + } +} + +s32 sub_080A50A0(s32 param_1) { + s32 iVar1; + + if (param_1 == 0xf) { + iVar1 = AreaHasMap(); + param_1 = 4; + if (iVar1 != 0) { + param_1 = 5; + } + } + return param_1; +} + +void PauseMenu_Variant3(void) { + s32 iVar1; + + iVar1 = gUnk_02034490.unk16 + 2; + if (0x10 < iVar1) { + gScreen.lcd.displayControl &= 0xf8ff; + sub_080A4E90(4); + iVar1 = 0x10; + } + gUnk_02034490.unk16 = iVar1; +} + +void PauseMenu_Variant4(void) { + u32 t; + gUnk_02034490.unk16 = 0x10; + gUnk_02034490.unk1 = t = gUnk_02034490.unk14; + sub_080A4DB8(t); + sub_080A4E90(5); +} + +void PauseMenu_Variant5(void) { + s32 iVar1; + + iVar1 = gUnk_02034490.unk16 - 2; + if (iVar1 < 0) { + sub_080A4E90(2); + iVar1 = 0; + } + gUnk_02034490.unk16 = iVar1; +} + +void sub_080A5128(void) { + int r5, t; + struct { + int x; + int y; + } p[3]; + + switch (gUnk_02034490.unk1) { + case 7: + case 8: + p[0].x = 0x60; + p[0].y = 0x18; + p[1].x = -0x10; + p[1].y = 0x48; + p[2].x = 0x100; + p[2].y = 0x48; + break; + case 9: + case 10: + case 11: + return; + default: + p[0].x = 0x40; + p[0].y = 0x10 - (gUnk_02034490.unk16 << 1); + t = (gUnk_02034490.unk16 / 3); + p[1].x = 0x10 - t; + p[1].y = 0x48; + p[2].x = 0xe0 + t; + p[2].y = 0x48; + break; + } + gOamCmd._4 = 0; + gOamCmd._6 = 0; + gOamCmd._8 = 0x400; + gOamCmd.x = p[0].x; + gOamCmd.y = p[0].y; +#ifdef EU + r5 = 0x1fa; +#else + r5 = 0x1fb; +#endif + DrawDirect(r5, 0); + gOamCmd.x = p[1].x; + gOamCmd.y = p[1].y; + DrawDirect(r5, 1); + gOamCmd.x = p[2].x; + gOamCmd.y = p[2].y; + DrawDirect(r5, 2); +} + +void sub_080A51D4(void) { + u32 i = gUnk_02034490.unk1; + if (i < 0xe) { + gUnk_02034490.unk2[i] = gMenu.field_0x3; + } +} + +u32 sub_080A51F4(void) { + u32 retval = 1; + if (gFadeControl.active != 0) + retval = 0; + if (gUnk_02034490.unk11 != 2) + retval = 0; + return retval; +} + +typedef enum { + MENU_SLOT_SWORD, + MENU_SLOT_GUST_JAR, + MENU_SLOT_CANE, + MENU_SLOT_BOOMERANG, + MENU_SLOT_SHIELD, + MENU_SLOT_MOLE_MITTS, + MENU_SLOT_LANTERN, + MENU_SLOT_BOMBS, + MENU_SLOT_PEGASUS_BOOTS, + MENU_SLOT_ROCS_CAPE, + MENU_SLOT_OCARINA, + MENU_SLOT_BOW, + MENU_SLOT_BOTTLE0, + MENU_SLOT_BOTTLE1, + MENU_SLOT_BOTTLE2, + MENU_SLOT_BOTTLE3, + MENU_SLOT_SAVE_BUTTON, + MENU_SLOT_SAVE_BUTTON_JP, + MENU_SLOT_COUNT = MENU_SLOT_SAVE_BUTTON_JP +} ItemMenuTableSlot; + +typedef struct { + u8 up; + u8 down; + u8 left; + u8 right; + u8 type; + u8 unk0; + u8 x; + u8 y; +} ItemMenuTableEntry; + +Subtask PauseMenu_ItemMenu_Draw; +Subtask PauseMenu_ItemMenu_Init; +Subtask PauseMenu_ItemMenu_Update; +void PauseMenu_ItemMenu(void) { + static Subtask* const pauseMenu_Types[] = { PauseMenu_ItemMenu_Init, PauseMenu_ItemMenu_Update }; + + pauseMenu_Types[gMenu.menuType](); + PauseMenu_ItemMenu_Draw(); +} + +void PauseMenu_ItemMenu_Init(void) { + static const KeyButtonLayout gUnk_08128B50 = { + 0xd0u, + 0x10u, + 0u, + 0xb8u, + 0x10u, + 0u, + 0xffu, + 0xd8u, + 0u, + { + 0x3u, + 0u, + 0x4u, + 0u, + 0u, + 0u, + 0x1u, + 0u, + 0xffu, + 0u, + 0u, + }, + }; + + u32 uVar1; + u32 i; + u32 item; + + gMenu.field_0xc = NULL; + sub_080A70AC((KeyButtonLayout*)&gUnk_08128B50); + for (item = ITEM_SMITH_SWORD; item < ITEM_BOTTLE_EMPTY; item++) { + uVar1 = GetInventoryValue(item); + if ((uVar1 == 1) && (i = gUnk_080FD5B4[item * 8], i <= MENU_SLOT_SAVE_BUTTON_JP)) { + switch (item) { + case ITEM_LANTERN_OFF: + case ITEM_LANTERN_ON: + item = gUnk_02034490.unk15; + break; + default: + break; + } + gPauseMenu.items[i] = item; + sub_080A5F48(item, i * 8 + 0x360); + } + } + SetMenuType(1); +} + +const ItemMenuTableEntry gItemMenuTable[] = { + [MENU_SLOT_SWORD] = { MENU_SLOT_BOTTLE0, MENU_SLOT_SHIELD, MENU_SLOT_BOOMERANG, MENU_SLOT_GUST_JAR, 0x01, 0x0c, + 0x42, 0x33 }, + [MENU_SLOT_GUST_JAR] = { MENU_SLOT_BOTTLE1, MENU_SLOT_MOLE_MITTS, MENU_SLOT_SWORD, MENU_SLOT_CANE, 0x01, 0x10, 0x66, + 0x33 }, + [MENU_SLOT_CANE] = { MENU_SLOT_BOTTLE3, MENU_SLOT_LANTERN, MENU_SLOT_GUST_JAR, MENU_SLOT_BOOMERANG, 0x01, 0x14, + 0x8a, 0x33 }, + [MENU_SLOT_BOOMERANG] = { MENU_SLOT_SAVE_BUTTON, MENU_SLOT_BOMBS, MENU_SLOT_CANE, MENU_SLOT_SWORD, 0x01, 0x15, 0xae, + 0x33 }, + [MENU_SLOT_SHIELD] = { MENU_SLOT_SWORD, MENU_SLOT_PEGASUS_BOOTS, MENU_SLOT_BOMBS, MENU_SLOT_MOLE_MITTS, 0x01, 0x16, + 0x42, 0x4b }, + [MENU_SLOT_MOLE_MITTS] = { MENU_SLOT_GUST_JAR, MENU_SLOT_ROCS_CAPE, MENU_SLOT_SHIELD, MENU_SLOT_LANTERN, 0x01, 0x17, + 0x66, 0x4b }, + [MENU_SLOT_LANTERN] = { MENU_SLOT_CANE, MENU_SLOT_OCARINA, MENU_SLOT_MOLE_MITTS, MENU_SLOT_BOMBS, 0x01, 0x00, 0x8a, + 0x4b }, + [MENU_SLOT_BOMBS] = { MENU_SLOT_BOOMERANG, MENU_SLOT_BOW, MENU_SLOT_LANTERN, MENU_SLOT_SHIELD, 0x01, 0x00, 0xae, + 0x4b }, + [MENU_SLOT_PEGASUS_BOOTS] = { MENU_SLOT_SHIELD, MENU_SLOT_BOTTLE0, MENU_SLOT_BOW, MENU_SLOT_ROCS_CAPE, 0x01, 0x00, + 0x42, 0x63 }, + [MENU_SLOT_ROCS_CAPE] = { MENU_SLOT_MOLE_MITTS, MENU_SLOT_BOTTLE1, MENU_SLOT_PEGASUS_BOOTS, MENU_SLOT_OCARINA, 0x01, + 0x00, 0x66, 0x63 }, + [MENU_SLOT_OCARINA] = { MENU_SLOT_LANTERN, MENU_SLOT_BOTTLE3, MENU_SLOT_ROCS_CAPE, MENU_SLOT_BOW, 0x01, 0x00, 0x8a, + 0x63 }, + [MENU_SLOT_BOW] = { MENU_SLOT_BOMBS, MENU_SLOT_SAVE_BUTTON, MENU_SLOT_OCARINA, MENU_SLOT_PEGASUS_BOOTS, 0x01, 0x00, + 0xae, 0x63 }, + [MENU_SLOT_BOTTLE0] = { MENU_SLOT_PEGASUS_BOOTS, MENU_SLOT_SWORD, MENU_SLOT_SAVE_BUTTON, MENU_SLOT_BOTTLE1, 0x01, + 0x00, 0x42, 0x7b }, + [MENU_SLOT_BOTTLE1] = { MENU_SLOT_ROCS_CAPE, MENU_SLOT_GUST_JAR, MENU_SLOT_BOTTLE0, MENU_SLOT_BOTTLE2, 0x01, 0x00, + 0x5a, 0x7b }, + [MENU_SLOT_BOTTLE2] = { MENU_SLOT_ROCS_CAPE, MENU_SLOT_GUST_JAR, MENU_SLOT_BOTTLE1, MENU_SLOT_BOTTLE3, 0x01, 0x00, + 0x72, 0x7b }, + [MENU_SLOT_BOTTLE3] = { MENU_SLOT_OCARINA, MENU_SLOT_CANE, MENU_SLOT_BOTTLE2, MENU_SLOT_SAVE_BUTTON, 0x01, 0x00, + 0x8a, 0x7b }, + [MENU_SLOT_SAVE_BUTTON] = { MENU_SLOT_BOW, MENU_SLOT_BOOMERANG, MENU_SLOT_BOTTLE3, MENU_SLOT_BOTTLE0, 0x03, 0x00, + 0xb5, 0x75 }, + [MENU_SLOT_SAVE_BUTTON_JP] = { MENU_SLOT_BOW, MENU_SLOT_BOOMERANG, MENU_SLOT_BOTTLE3, MENU_SLOT_BOTTLE0, 0x05, 0x00, + 0xb5, 0x75 }, +}; + +void sub_080A6F6C(u32); +void PauseMenu_ItemMenu_Update(void) { + static const u8 gUnk_08128BF4[] = { 14, 15, 2, 0 }; + u32 item; + u32 menuSlot; + const ItemMenuTableEntry* entry; + + if (sub_080A51F4()) { + gMenu.field_0xc = (u8*)gUnk_08128BF4; + menuSlot = gMenu.field_0x3; + + entry = &gItemMenuTable[menuSlot]; + switch (gInput.newKeys) { + case A_BUTTON: + if (menuSlot == MENU_SLOT_SAVE_BUTTON) { +#if defined(DEMO_USA) || defined(DEMO_JP) + SoundReq(SFX_MENU_ERROR); +#else + sub_080A4E84(0xb); + SoundReq(SFX_TEXTBOX_SELECT); +#endif + break; + } + case B_BUTTON: + if (gPauseMenu.items[menuSlot] != 0) { + u32 t = !!(gInput.newKeys ^ 1); + ForceEquipItem(gPauseMenu.items[menuSlot], t); + SoundReq(SFX_TEXTBOX_SELECT); + } + break; + default: + switch (gInput.unk4) { + case DPAD_UP: + menuSlot = entry->up; + break; + case DPAD_DOWN: + menuSlot = entry->down; + break; + case DPAD_LEFT: + menuSlot = entry->left; + break; + case DPAD_RIGHT: + menuSlot = entry->right; + break; + } + break; + } + if (gMenu.field_0x3 != menuSlot) { + gMenu.field_0x3 = menuSlot; + SoundReq(SFX_TEXTBOX_CHOICE); + } + item = gPauseMenu.items[menuSlot]; + switch (menuSlot) { + case MENU_SLOT_BOTTLE0: + case MENU_SLOT_BOTTLE1: + case MENU_SLOT_BOTTLE2: + case MENU_SLOT_BOTTLE3: + if (item != 0) { + item = gSave.saved_status.field_0x24[item - 6]; + } + break; + case MENU_SLOT_SAVE_BUTTON: + // ITEM_SKILL_FAST_SPIN, but that does not make any sense at all + item = 0x73; + break; + default: + break; + } + sub_080A6F6C(item + 0x400); + } +} + +u32 GetMenuSlotForItem(u32 item); +extern u8* gSpriteAnimations_322[]; +#ifdef EU +#define sub_080A5384_draw_constant0 0x1fa +#define sub_080A5384_draw_constant1 0x141 +#else +#define sub_080A5384_draw_constant0 0x1fb +#define sub_080A5384_draw_constant1 0x142 +#endif +void PauseMenu_ItemMenu_Draw(void) { + u32 tmp; + u32 i; + s32 color; + const ItemMenuTableEntry* entry; + + gOamCmd._4 = 0x400; + gOamCmd._6 = 0; + gOamCmd._8 = 0; + for (i = 0; i < MENU_SLOT_COUNT; i++) { + u32 item; + if (gPauseMenu.items[i] != 0) { + entry = &gItemMenuTable[i]; + gOamCmd.x = entry->x; + gOamCmd.y = entry->y; + item = gPauseMenu.items[i]; + switch (item) { + case ITEM_BOTTLE1: + case ITEM_BOTTLE2: + case ITEM_BOTTLE3: + case ITEM_BOTTLE4: + item = gSave.stats.bottles[item - ITEM_BOTTLE1]; + break; + default: + break; + } + color = 3; + switch (item) { + case ITEM_BOMBS: + case ITEM_REMOTE_BOMBS: + if (gBombBagSizes[gSave.stats.bombBagType] <= gSave.stats.bombCount) { + color = 4; + } + break; + case ITEM_BOW: + case ITEM_LIGHT_ARROW: + if (gQuiverSizes[gSave.stats.quiverType] <= gSave.stats.arrowCount) { + color = 4; + } + break; + default: + break; + } + gOamCmd._8 = 0x800 | color << 0xc | ((i * 8) + 0x360); + DrawDirect(sub_080A5384_draw_constant1, *gSpriteAnimations_322[item]); + } + } + gOamCmd._8 = 0x800; + { + u32 slot = gMenu.field_0x3; + if ((slot == MENU_SLOT_SAVE_BUTTON) && (gSaveHeader->language != 0)) { + slot = MENU_SLOT_SAVE_BUTTON_JP; + } + entry = &gItemMenuTable[slot]; + gOamCmd.x = entry->x; + gOamCmd.y = entry->y; + tmp = entry->type + ((gMain.ticks.HWORD & 0x10) != 0 ? 3 : 4); + DrawDirect(sub_080A5384_draw_constant0, tmp); + } + { + u32 slot; + if (gSaveHeader->language != 0) { + slot = MENU_SLOT_SAVE_BUTTON; + } else { + slot = MENU_SLOT_SAVE_BUTTON_JP; + } + entry = &gItemMenuTable[slot]; + gOamCmd.x = entry->x; + gOamCmd.y = entry->y; + gOamCmd._8 = 0x800; + DrawDirect(sub_080A5384_draw_constant0, 0x22); + } + i = GetMenuSlotForItem(gSave.stats.itemButtons[0]); + if (i < MENU_SLOT_COUNT) { + entry = &gItemMenuTable[i]; + gOamCmd.x = entry->x; + gOamCmd.y = entry->y; + DrawDirect(sub_080A5384_draw_constant0, 3); + } + i = GetMenuSlotForItem(gSave.stats.itemButtons[1]); + if (i < MENU_SLOT_COUNT) { + entry = &gItemMenuTable[i]; + gOamCmd.x = entry->x; + gOamCmd.y = entry->y; + DrawDirect(sub_080A5384_draw_constant0, 3); + } +} + +u32 GetMenuSlotForItem(u32 item) { + u32 i; + + if (item != 0) { + for (i = 0; i < MENU_SLOT_COUNT; i++) { + if (item == gPauseMenu.items[i]) + return i; + } + } + return MENU_SLOT_SAVE_BUTTON_JP; +} + +Subtask sub_080A5594; +Subtask sub_080A56A0; +void PauseMenu2(void) { + static Subtask* const pauseMenu2_Types[] = { + sub_080A5594, + sub_080A56A0, + }; + pauseMenu2_Types[gMenu.menuType](); + sub_080A57F4(); +} diff --git a/src/subtask.c b/src/subtask.c deleted file mode 100644 index 4b2fad5a..00000000 --- a/src/subtask.c +++ /dev/null @@ -1,518 +0,0 @@ -#include "global.h" -#include "menu.h" -#include "screen.h" -#include "common.h" -#include "subtask.h" -#include "sound.h" -#include "save.h" -#include "kinstone.h" -#include "game.h" -#include "message.h" -#include "object.h" -#include "main.h" -#include "npc.h" -#include "enemy.h" -#include "item.h" -#include "itemMenuTable.h" -#include "functions.h" -#include "structures.h" - -extern const u8 gGlobalGfxAndPalettes[]; -typedef struct { - u8 filler0[0x1]; - u8 unk1; - u8 charColor; - u8 bgColor; - u16 unk4; - u16 unk6; - u8* unk8; -} struct_02036540; - -void sub_080A42E0(u32, u32); -void sub_0805ECEC(u32, u32, u32, u32); -u32 sub_080A43A8(u32); -u32 sub_080A4418(u32, u32); -u32 sub_080A43DC(u32); -u32 sub_080A44E0(struct_02036540*, u8*, u32); -struct_02036540* sub_0805F2C8(void); -void FigurineMenu_080A4978(void); -void sub_080A4B44(void); -void sub_080A4DA8(u32); -u32 sub_080A4CBC(u32); -void sub_080A4DB8(u32); -void sub_08056250(void); -void sub_080A5128(void); -u32 sub_080A51F4(void); -void sub_080A51D4(void); -void sub_080A5F48(u32, u32); - -extern u8 gUnk_02002C81[]; - -extern u8 gTextGfxBuffer[]; - -extern const KeyButtonLayout gUnk_08128B50; -extern const u8 gUnk_080FD5B4[]; - -void Subtask_PauseMenu(void) { - extern const void (*const gUnk_08128B30[])(void); - - if (gUnk_02034490.unk11 == 6) { - SetBgmVolume(0x100); - Subtask_Exit(); - } else { - FlushSprites(); - gUnk_08128B30[gUnk_02034490.unk11](); - sub_080A5128(); - sub_0801C1D4(); - DrawOAMCmd(); - if (gUnk_02034490.unk11 != 4) { - gUnk_08128A38[gUnk_02034490.unk1].func(); - } - CopyOAM(); - { - u32 t = gUnk_02034490.unk16; - u32 t2 = (t != 0) ? 0xe46 : 0; - gScreen.controls.layerFXControl = t2; - gScreen.controls.alphaBlend = (t << 8) | (0x10 - t); - } - } -} - -typedef struct { - u8 _0; - u8 _1; - u8 _2; - u8 _3; - u8 _4; - u16 _6; -} struct_08127F94; -struct_08127F94* sub_080A6A80(u32, u32); - -extern u8 gUnk_02034492[]; -void sub_0801E8D4(void); -u32 sub_0801DB94(void); -s32 sub_080A50A0(s32); - -void sub_080A4F28(void) { - struct_08127F94* ptr; - int r0, r1; - - sub_0801E8D4(); - sub_080A4D34(); - r1 = 4; - do { - gUnk_02034492[r1] = 0; - r1++; - } while (r1 <= 0xd); - ptr = sub_080A6A80((u16)gRoomTransition.player_status.overworld_map_x, - (u16)gRoomTransition.player_status.overworld_map_y); - gUnk_02034490.unk2[4] = ptr->_4; - gUnk_02034490.unk2[5] = sub_0801DB94(); - if (IsItemEquipped(ITEM_LANTERN_ON) != 2) { - r1 = 0x10; - } else { - r1 = 0xf; - } - gUnk_02034490.unk15 = r1; - r0 = gUnk_08128A38[gUnk_02034490.unk1].unk1; - r0 = sub_080A50A0(r0); - gUnk_02034490.unk1 = r0; - gUnk_02034490.unk14 = r0; - sub_080A4DB8(r0); - SetFade(4, 0x20); - sub_080A4E90(1); -} - -void sub_080A4FA0(void) { - if (gFadeControl.active == 0) { - sub_080A4E90(2); - } -} - -void sub_080A4FB8(void) { - int iVar1; - u32 uVar2; - int iVar4; - s32 bVar5; - - if ((sub_080A51F4() != 0) && (gMenu.field_0xc != NULL)) { - iVar1 = -1; - switch (gInput.newKeys) { - case 8: - iVar1 = 0; - break; - case 0x200: - iVar1 = 1; - break; - case 0x100: - iVar1 = 2; - break; - case 0x2: - iVar1 = 3; - break; - } - if (iVar1 >= 0) { - switch (bVar5 = gMenu.field_0xc[iVar1]) { - case 0: - break; - case 4 ... 6: - case 0xf: - uVar2 = GetInventoryValue(0x47); - if (uVar2 == 0) { - iVar4 = 1; - if (iVar1 == 1) { - iVar4 = 2; - } - bVar5 = gMenu.field_0xc[iVar4]; - } - default: - gUnk_02034490.unk14 = bVar5; - SoundReq(SFX_TEXTBOX_OPEN); - gMenu.field_0xc = NULL; - break; - } - } - } - bVar5 = sub_080A50A0(gUnk_02034490.unk14); - if (gUnk_02034490.unk1 != bVar5) { - gUnk_02034490.unk14 = bVar5; - sub_080A51D4(); - if (bVar5 == 0xe) { - sub_080A4E90(6); - } else { - sub_080A4E90(3); - MemClear(&gBG0Buffer, 0x800); - gScreen.bg0.updated = 1; - } - } -} - -s32 sub_080A50A0(s32 param_1) { - s32 iVar1; - - if (param_1 == 0xf) { - iVar1 = AreaHasMap(); - param_1 = 4; - if (iVar1 != 0) { - param_1 = 5; - } - } - return param_1; -} - -void sub_080A50B8(void) { - s32 iVar1; - - iVar1 = gUnk_02034490.unk16 + 2; - if (0x10 < iVar1) { - gScreen.lcd.displayControl &= 0xf8ff; - sub_080A4E90(4); - iVar1 = 0x10; - } - gUnk_02034490.unk16 = iVar1; -} - -void sub_080A50E8(void) { - u32 t; - gUnk_02034490.unk16 = 0x10; - gUnk_02034490.unk1 = t = gUnk_02034490.unk14; - sub_080A4DB8(t); - sub_080A4E90(5); -} - -void sub_080A5108(void) { - s32 iVar1; - - iVar1 = gUnk_02034490.unk16 - 2; - if (iVar1 < 0) { - sub_080A4E90(2); - iVar1 = 0; - } - gUnk_02034490.unk16 = iVar1; -} - -void sub_080A5128(void) { - int r5, t; - struct { - int x; - int y; - } p[3]; - - switch (gUnk_02034490.unk1) { - case 7: - case 8: - p[0].x = 0x60; - p[0].y = 0x18; - p[1].x = -0x10; - p[1].y = 0x48; - p[2].x = 0x100; - p[2].y = 0x48; - break; - case 9: - case 10: - case 11: - return; - default: - p[0].x = 0x40; - p[0].y = 0x10 - (gUnk_02034490.unk16 << 1); - t = (gUnk_02034490.unk16 / 3); - p[1].x = 0x10 - t; - p[1].y = 0x48; - p[2].x = 0xe0 + t; - p[2].y = 0x48; - break; - } - gOamCmd._4 = 0; - gOamCmd._6 = 0; - gOamCmd._8 = 0x400; - gOamCmd.x = p[0].x; - gOamCmd.y = p[0].y; -#ifdef EU - r5 = 0xfd << 1; -#else - r5 = 0x1fb; -#endif - DrawDirect(r5, 0); - gOamCmd.x = p[1].x; - gOamCmd.y = p[1].y; - DrawDirect(r5, 1); - gOamCmd.x = p[2].x; - gOamCmd.y = p[2].y; - DrawDirect(r5, 2); -} - -void sub_080A51D4(void) { - u32 i = gUnk_02034490.unk1; - if (i < 0xe) { - gUnk_02034490.unk2[i] = gMenu.field_0x3; - } -} - -u32 sub_080A51F4(void) { - u32 retval = 1; - if (gFadeControl.active != 0) - retval = 0; - if (gUnk_02034490.unk11 != 2) - retval = 0; - return retval; -} - -void sub_080A5384(void); -void sub_080A5218(void) { - extern void (*const gUnk_08128B48[])(void); - - gUnk_08128B48[gMenu.menuType](); - sub_080A5384(); -} - -void sub_080A5238(void) { - u32 uVar1; - u32 uVar2; - u32 uVar3; - - gMenu.field_0xc = NULL; - sub_080A70AC((KeyButtonLayout*)&gUnk_08128B50); - for (uVar3 = 1; uVar3 < 0x20; uVar3++) { - uVar1 = GetInventoryValue(uVar3); - if ((uVar1 == 1) && (uVar2 = gUnk_080FD5B4[uVar3 * 8], uVar2 < 0x12)) { - switch (uVar3) { - case 0xf: - case 0x10: - uVar3 = gUnk_02034490.unk15; - break; - default: - break; - } - gGenericMenu.unk10.a[uVar2] = uVar3; - sub_080A5F48(uVar3, uVar2 * 8 + 0x360); - } - } - sub_080A7114(1); -} - -extern const u8 gUnk_08128BF4[]; -void sub_080A6F6C(u32); -void sub_080A529C(void) { - s32 iVar1; - u32 uVar2; - u32 uVar3; - const ItemMenuTableEntry* entry; - - if (sub_080A51F4()) { - gMenu.field_0xc = (u8*)gUnk_08128BF4; - uVar3 = gMenu.field_0x3; - - entry = &gItemMenuTable[uVar3]; - switch (gInput.newKeys) { - case 1: - if (uVar3 == 0x10) { -#if defined(DEMO_USA) || defined(DEMO_JP) - SoundReq(SFX_MENU_ERROR); -#else - sub_080A4E84(0xb); - SoundReq(SFX_TEXTBOX_SELECT); -#endif - break; - } - case 2: - if (gGenericMenu.unk10.a[uVar3] != 0) { - u32 t = !!(gInput.newKeys ^ 1); - ForceEquipItem(gGenericMenu.unk10.a[uVar3], t); - SoundReq(SFX_TEXTBOX_SELECT); - } - break; - default: - switch (gInput.unk4) { - case DPAD_UP: - uVar3 = entry->up; - break; - case DPAD_DOWN: - uVar3 = entry->down; - break; - case DPAD_LEFT: - uVar3 = entry->left; - break; - case DPAD_RIGHT: - uVar3 = entry->right; - break; - } - break; - } - if (gMenu.field_0x3 != uVar3) { - gMenu.field_0x3 = uVar3; - SoundReq(SFX_TEXTBOX_CHOICE); - } - uVar2 = gGenericMenu.unk10.a[uVar3]; - switch (uVar3) { - case 0xc: - case 0xd: - case 0xe: - case 0xf: - if (uVar2 != 0) { - uVar2 = gSave.saved_status.field_0x24[uVar2 - 6]; - } - break; - case 0x10: - uVar2 = 0x73; - break; - default: - break; - } - sub_080A6F6C(uVar2 + 0x400); - } -} - -u32 sub_080A554C(u32); -extern u8* gSpriteAnimations_322[]; -#ifdef EU -#define sub_080A5384_draw_constant0 0x1fa -#define sub_080A5384_draw_constant1 0x141 -#else -#define sub_080A5384_draw_constant0 0x1fb -#define sub_080A5384_draw_constant1 0x142 -#endif -void sub_080A5384(void) { - u32 tmp; - u32 uVar3; - s32 iVar2; - const ItemMenuTableEntry* entry; - - gOamCmd._4 = 0x400; - gOamCmd._6 = 0; - gOamCmd._8 = 0; - for (uVar3 = 0; uVar3 < 0x11; uVar3++) { - u32 item; - if (gGenericMenu.unk10.a[uVar3] != 0) { - entry = &gItemMenuTable[uVar3]; - gOamCmd.x = entry->x; - gOamCmd.y = entry->y; - item = gGenericMenu.unk10.a[uVar3]; - switch (item) { - case 0x1c ... 0x1f: - item = gSave.stats.bottles[item - 0x1c]; - break; - } - iVar2 = 3; - switch (item) { - case 7: - case 8: - if (gBombBagSizes[gSave.stats.bombBagType] <= gSave.stats.bombCount) { - iVar2 = 4; - } - break; - case 9: - case 10: - if (gQuiverSizes[gSave.stats.quiverType] <= gSave.stats.arrowCount) { - iVar2 = 4; - } - break; - } - gOamCmd._8 = 0x800 | iVar2 << 0xc | ((uVar3 * 8) + 0x360); - DrawDirect(sub_080A5384_draw_constant1, *gSpriteAnimations_322[item]); - } - } - gOamCmd._8 = 0x800; - { - u32 uVar3 = gMenu.field_0x3; - if ((uVar3 == 0x10) && (gSaveHeader->language != 0)) { - uVar3 = 0x11; - } - entry = &gItemMenuTable[uVar3]; - } - gOamCmd.x = entry->x; - gOamCmd.y = entry->y; - tmp = entry->type + ((gMain.ticks.HWORD & 0x10) != 0 ? 3 : 4); - DrawDirect(sub_080A5384_draw_constant0, tmp); - { - u32 uVar3; - if (gSaveHeader->language != 0) { - uVar3 = 0x10; - } else { - uVar3 = 0x11; - } - entry = &gItemMenuTable[uVar3]; - } - gOamCmd.x = entry->x; - gOamCmd.y = entry->y; - gOamCmd._8 = 0x800; - DrawDirect(sub_080A5384_draw_constant0, 0x22); - { - uVar3 = sub_080A554C(gSave.stats.itemButtons[0]); - if (uVar3 < 0x11) { - entry = &gItemMenuTable[uVar3]; - gOamCmd.x = entry->x; - gOamCmd.y = entry->y; - DrawDirect(sub_080A5384_draw_constant0, 3); - } - } - { - uVar3 = sub_080A554C(gSave.stats.itemButtons[1]); - if (uVar3 < 0x11) { - entry = &gItemMenuTable[uVar3]; - gOamCmd.x = entry->x; - gOamCmd.y = entry->y; - DrawDirect(sub_080A5384_draw_constant0, 3); - } - } -} - -extern void (*const gUnk_08128BF8[])(void); - -extern u8 gUnk_02000090; - -u32 sub_080A554C(u32 arg0) { - u32 i; - - if (arg0 != 0) { - for (i = 0; i < 17; i++) { - if (arg0 == gGenericMenu.unk10.a[i]) - return i; - } - } - return 17; -} - -void sub_080A5574(void) { - gUnk_08128BF8[gMenu.menuType](); - sub_080A57F4(); -}