diff --git a/include/bg_window.h b/include/bg_window.h index 6ef1e3eb84..d40bd8eedd 100644 --- a/include/bg_window.h +++ b/include/bg_window.h @@ -13,6 +13,8 @@ #define TILEMAP_FILL_VAL_KEEP_PALETTE 16 // do not replace the selected palette index #define TILEMAP_FILL_VAL_INCLUDES_PALETTE 17 +#define PIXEL_FILL(color) (((color) << 4) | (color)) + enum DSScreen { DS_SCREEN_MAIN = 0, DS_SCREEN_SUB, diff --git a/include/core_sys.h b/include/core_sys.h index 621193fa70..32ed51146f 100644 --- a/include/core_sys.h +++ b/include/core_sys.h @@ -14,9 +14,10 @@ enum ButtonMode { BUTTON_MODE_L_IS_A = 3, }; -#define PAD_KEY (PAD_KEY_UP | PAD_KEY_DOWN | PAD_KEY_LEFT | PAD_KEY_RIGHT) -#define JOY_NEW(buttons) (gCoreSys.pressedKeys & (buttons)) -#define JOY_HELD(buttons) (gCoreSys.heldKeys & (buttons)) +#define PAD_KEY (PAD_KEY_UP | PAD_KEY_DOWN | PAD_KEY_LEFT | PAD_KEY_RIGHT) +#define JOY_NEW(buttons) (gCoreSys.pressedKeys & (buttons)) +#define JOY_HELD(buttons) (gCoreSys.heldKeys & (buttons)) +#define JOY_REPEAT(buttons) (gCoreSys.pressedKeysRepeatable & (buttons)) typedef struct CoreSys { Callback mainCallback; diff --git a/include/list_menu.h b/include/list_menu.h new file mode 100644 index 0000000000..b2b90f996a --- /dev/null +++ b/include/list_menu.h @@ -0,0 +1,111 @@ +#ifndef POKEPLATINUM_LIST_MENU_H +#define POKEPLATINUM_LIST_MENU_H + +#include "bg_window.h" +#include "colored_arrow.h" +#include "string_list.h" + +#define LIST_NOTHING_CHOSEN -1 +#define LIST_CANCEL -2 +#define LIST_HEADER -3 + +enum ListMenuPagerMode { + PAGER_MODE_NONE = 0, + PAGER_MODE_LEFT_RIGHT_PAD, + PAGER_MODE_SHOULDER_BUTTONS, +}; + +enum ListMenuAction { + LIST_MENU_ACTION_NONE = 0, + LIST_MENU_ACTION_MOVE_UP, + LIST_MENU_ACTION_MOVE_DOWN, + LIST_MENU_ACTION_PAGE_UP, + LIST_MENU_ACTION_PAGE_DOWN, +}; + +enum ListMenuAttribute { + LIST_MENU_CURSOR_CALLBACK = 0, + LIST_MENU_PRINT_CALLBACK, + LIST_MENU_COUNT, + LIST_MENU_MAX_DISPLAY, + LIST_MENU_UNUSED_4, + LIST_MENU_HEADER_X_OFFSET, + LIST_MENU_TEXT_X_OFFSET, + LIST_MENU_CURSOR_X_OFFSET, + LIST_MENU_Y_OFFSET, + LIST_MENU_LINE_HEIGHT, + LIST_MENU_TEXT_COLOR_FG, + LIST_MENU_TEXT_COLOR_BG, + LIST_MENU_TEXT_COLOR_SHADOW, + LIST_MENU_LETTER_SPACING, + LIST_MENU_LINE_SPACING, + LIST_MENU_PAGER_MODE, + LIST_MENU_FONT_ID, + LIST_MENU_CURSOR_TYPE, + LIST_MENU_WINDOW, + LIST_MENU_TMP, +}; + +typedef struct ListMenu ListMenu; + +typedef void (*CursorCallback)(ListMenu *menu, u32 index, u8 onInit); +typedef void (*PrintCallback)(ListMenu *menu, u32 index, u8 yOffset); + +typedef struct ListMenuTemplate { + const StringList *choices; + CursorCallback cursorCallback; + PrintCallback printCallback; + Window *window; + u16 count; + u16 maxDisplay; + u8 headerXOffset; + u8 textXOffset; + u8 cursorXOffset; + u8 yOffset : 4; + u8 textColorFg : 4; + u8 textColorBg : 4; + u8 textColorShadow : 4; + u16 letterSpacing : 3; + u16 lineSpacing : 4; + u16 pagerMode : 2; + u16 fontID : 6; + u16 cursorType : 1; + void *tmp; +} ListMenuTemplate; + +struct ListMenu { + ListMenuTemplate template; + struct { + u8 textColorFg : 4; + u8 textColorBg : 4; + u8 textColorShadow : 4; + u8 letterSpacing : 6; + u8 dummy : 6; + u8 fontID : 7; + u8 prefer : 1; + } altFont; + ColoredArrow *cursor; + u16 listPos; + u16 cursorPos; + u8 dummy2C; + u8 dummy2D; + u8 dummy2E; + u8 lastAction; + u8 heapID; +}; + +ListMenu *ListMenu_New(const ListMenuTemplate *template, u16 startListPos, u16 startCursorPos, u8 heapID); +u32 ListMenu_ProcessInput(ListMenu *menu); +void ListMenu_Free(ListMenu *menu, u16 *outListPos, u16 *outCursorPos); +void ListMenu_Draw(ListMenu *menu); +void ListMenu_SetTextColors(ListMenu *menu, u8 fg, u8 bg, u8 shadow); +u32 ListMenu_TestInput(ListMenu *menu, ListMenuTemplate *template, u16 listPos, u16 cursorPos, u16 updateCursor, u16 input, u16 *outListPos, u16 *outCursorPos); +void ListMenu_SetAltTextColors(ListMenu *menu, u8 fg, u8 bg, u8 shadow); +void ListMenu_CalcTrueCursorPos(ListMenu *menu, u16 *outPos); +void ListMenu_GetListAndCursorPos(ListMenu *menu, u16 *outListPos, u16 *outCursorPos); +u8 ListMenu_GetLastAction(ListMenu *menu); +u32 ListMenu_GetIndexOfChoice(ListMenu *menu, u16 choice); +u32 ListMenu_GetAttribute(ListMenu *menu, u8 attribute); +void ListMenu_SetChoices(ListMenu *menu, StringList *choices); + +#endif // POKEPLATINUM_LIST_MENU_H diff --git a/include/menu.h b/include/menu.h new file mode 100644 index 0000000000..44dfa751e2 --- /dev/null +++ b/include/menu.h @@ -0,0 +1,71 @@ +#ifndef POKEPLATINUM_MENU_H +#define POKEPLATINUM_MENU_H + +#include "bg_window.h" +#include "colored_arrow.h" +#include "string_list.h" + +#define MENU_NOTHING_CHOSEN -1 +#define MENU_CANCELED -2 +#define MENU_DUMMY -3 + +enum MenuAction { + MENU_ACTION_NONE = 0, + MENU_ACTION_MOVE_UP, + MENU_ACTION_MOVE_DOWN, + MENU_ACTION_MOVE_LEFT, + MENU_ACTION_MOVE_RIGHT, +}; + +enum MenuExternalInput { + MENU_INPUT_CONFIRM = 0, + MENU_INPUT_CANCEL, + MENU_INPUT_MOVE_UP, + MENU_INPUT_MOVE_DOWN, + MENU_INPUT_MOVE_LEFT, + MENU_INPUT_MOVE_RIGHT, +}; + +typedef struct MenuTemplate { + StringList *choices; + Window *window; + u8 fontID; + u8 xSize; + u8 ySize; + u8 lineSpacing : 4; + u8 suppressCursor : 2; + u8 loopAround : 2; +} MenuTemplate; + +typedef struct Menu { + MenuTemplate template; + ColoredArrow *cursor; + u32 cancelKeys; + u8 dummy14; + u8 cursorPos; + u8 width; + u8 xOffset; + u8 yOffset; + u8 letterWidth; + u8 lineHeight; + u8 lastAction; + u8 heapID; +} Menu; + +Menu *Menu_New(const MenuTemplate *template, u8 xOffset, u8 yOffset, u8 cursorStart, u8 heapID, u32 cancelKeys); +Menu *Menu_NewAndCopyToVRAM(const MenuTemplate *template, u8 xOffset, u8 yOffset, u8 cursorStart, u8 heapID, u32 cancelKeys); +Menu *Menu_NewSimple(const MenuTemplate *template, u8 cursorStart, u8 heapID); +void Menu_Free(Menu *menu, u8 *outCursorPos); +u32 Menu_ProcessInput(Menu *menu); +u32 Menu_ProcessInputWithSound(Menu *menu, u16 sdatID); +u32 Menu_ProcessExternalInput(Menu *menu, u8 input); +u8 Menu_GetCursorPos(Menu *menu); +u8 Menu_GetLastAction(Menu *menu); +Menu *Menu_MakeYesNoChoiceWithCursorAt(BgConfig *bgConfig, const WindowTemplate *winTemplate, u16 borderTileStart, u8 borderPalette, u8 cursorStart, u32 heapID); +Menu *Menu_MakeYesNoChoice(BgConfig *bgConfig, const WindowTemplate *winTemplate, u16 borderTileStart, u8 borderPalette, u32 heapID); +u32 Menu_ProcessInputAndHandleExit(Menu *menu, u32 heapID); +u32 Menu_ProcessExternalInputAndHandleExit(Menu *menu, u8 input, u32 heapID); +void Menu_DestroyForExit(Menu *menu, u32 heapID); +void Window_DrawMenuCursor(Window *window, u32 x, u32 y); + +#endif // POKEPLATINUM_MENU_H diff --git a/include/overlay007/struct_ov7_0224D008.h b/include/overlay007/struct_ov7_0224D008.h index 33b2738d7c..d89e0b7ccc 100644 --- a/include/overlay007/struct_ov7_0224D008.h +++ b/include/overlay007/struct_ov7_0224D008.h @@ -1,10 +1,7 @@ #ifndef POKEPLATINUM_STRUCT_OV7_0224D008_H #define POKEPLATINUM_STRUCT_OV7_0224D008_H -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_0200C440_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "overlay005/struct_ov5_021D30A8.h" @@ -14,9 +11,12 @@ #include "game_options.h" #include "game_records.h" #include "journal.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "savedata.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "trainer_info.h" #include "vars_flags.h" @@ -26,10 +26,10 @@ typedef struct { void *unk_04; Window unk_08[6]; Window unk_68; - BmpList *unk_78; - ResourceMetadata *unk_7C; - UIControlData *unk_80; - ResourceMetadata *unk_84; + ListMenu *unk_78; + StringList *unk_7C; + Menu *unk_80; + StringList *unk_84; MessageLoader *unk_88; StringTemplate *unk_8C; Camera *camera; diff --git a/include/overlay023/funcptr_ov23_022515D8.h b/include/overlay023/funcptr_ov23_022515D8.h index 60675182d7..024e4ce6af 100644 --- a/include/overlay023/funcptr_ov23_022515D8.h +++ b/include/overlay023/funcptr_ov23_022515D8.h @@ -1,8 +1,8 @@ #ifndef POKEPLATINUM_FUNCPTR_OV23_022515D8_H #define POKEPLATINUM_FUNCPTR_OV23_022515D8_H -#include "struct_decls/struct_0200112C_decl.h" +#include "list_menu.h" -typedef void (*UnkFuncPtr_ov23_022515D8)(BmpList *, u32, u8); +typedef void (*UnkFuncPtr_ov23_022515D8)(ListMenu *, u32, u8); #endif // POKEPLATINUM_FUNCPTR_OV23_022515D8_H diff --git a/include/overlay023/ov23_02248C08.h b/include/overlay023/ov23_02248C08.h index 964bf27044..7fcbd81a61 100644 --- a/include/overlay023/ov23_02248C08.h +++ b/include/overlay023/ov23_02248C08.h @@ -5,9 +5,10 @@ #include "overlay023/funcptr_ov23_02248D20.h" #include "overlay023/struct_ov23_02248D20.h" -#include "overlay084/struct_ov84_02240FA8.h" -UnkStruct_ov23_02248D20 *ov23_02248C08(UnkStruct_ov84_02240FA8 *param0, u16 param1, u16 param2, u8 param3, UnkFuncPtr_ov23_02248D20 param4, UndergroundData *param5, BOOL param6); +#include "list_menu.h" + +UnkStruct_ov23_02248D20 *ov23_02248C08(ListMenuTemplate *param0, u16 param1, u16 param2, u8 param3, UnkFuncPtr_ov23_02248D20 param4, UndergroundData *param5, BOOL param6); u32 ov23_02248D20(UnkStruct_ov23_02248D20 *param0); void ov23_02248EF8(UnkStruct_ov23_02248D20 *param0, u16 *param1, u16 *param2); diff --git a/include/overlay023/ov23_0224F294.h b/include/overlay023/ov23_0224F294.h index 8c6033af69..a90c0845fd 100644 --- a/include/overlay023/ov23_0224F294.h +++ b/include/overlay023/ov23_0224F294.h @@ -1,13 +1,13 @@ #ifndef POKEPLATINUM_OV23_0224F294_H #define POKEPLATINUM_OV23_0224F294_H -#include "struct_decls/struct_0200112C_decl.h" #include "struct_decls/struct_020298B0_decl.h" #include "field/field_system_decl.h" #include "overlay023/funcptr_ov23_0224F758.h" #include "overlay023/struct_ov23_02250CD4.h" +#include "list_menu.h" #include "sys_task_manager.h" void ov23_0224F588(UndergroundData *param0); @@ -26,16 +26,16 @@ BOOL ov23_0224F744(int param0); void ov23_0224F758(UnkFuncPtr_ov23_0224F758 param0, FieldSystem *fieldSystem); void ov23_0224FB7C(UnkStruct_ov23_02250CD4 *param0); void ov23_0224FD68(int param0); -void ov23_0224FD84(BmpList *param0, u32 param1, u8 param2); +void ov23_0224FD84(ListMenu *param0, u32 param1, u8 param2); void ov23_0224FDBC(UnkStruct_ov23_02250CD4 *param0); void ov23_0224FDE0(UnkStruct_ov23_02250CD4 *param0); void ov23_02250128(int param0); void ov23_02250184(UnkStruct_ov23_02250CD4 *param0); -void ov23_02250540(BmpList *param0, u32 param1, u8 param2); +void ov23_02250540(ListMenu *param0, u32 param1, u8 param2); void ov23_02250578(UnkStruct_ov23_02250CD4 *param0); void ov23_02250598(UnkStruct_ov23_02250CD4 *param0); void ov23_02250A50(UnkFuncPtr_ov23_0224F758 param0, FieldSystem *fieldSystem); -void ov23_02250C3C(BmpList *param0, u32 param1, u8 param2); +void ov23_02250C3C(ListMenu *param0, u32 param1, u8 param2); void ov23_02250CB0(UnkStruct_ov23_02250CD4 *param0); void ov23_02250CD4(UnkStruct_ov23_02250CD4 *param0); void ov23_02250D2C(UnkStruct_ov23_02250CD4 *param0); diff --git a/include/overlay023/ov23_02253D40.h b/include/overlay023/ov23_02253D40.h index be8b219834..6bcdde13c4 100644 --- a/include/overlay023/ov23_02253D40.h +++ b/include/overlay023/ov23_02253D40.h @@ -3,13 +3,13 @@ #include "overlay023/struct_ov23_02253E2C_decl.h" #include "overlay023/struct_ov23_02253F60.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "bg_window.h" +#include "list_menu.h" #include "message.h" #include "trainer_info.h" -const UnkStruct_ov84_02240FA8 *ov23_02253D40(void); +const ListMenuTemplate *ov23_02253D40(void); UnkStruct_ov23_02253E2C *ov23_02253D48(int param0, int param1, BgConfig *param2, int param3, int param4); void ov23_02253DD8(UnkStruct_ov23_02253E2C *param0); void ov23_02253DFC(UnkStruct_ov23_02253E2C *param0, int param1, int param2); diff --git a/include/overlay023/struct_ov23_02248D20.h b/include/overlay023/struct_ov23_02248D20.h index 557f3d020e..38850876f3 100644 --- a/include/overlay023/struct_ov23_02248D20.h +++ b/include/overlay023/struct_ov23_02248D20.h @@ -1,19 +1,19 @@ #ifndef POKEPLATINUM_STRUCT_OV23_02248D20_H #define POKEPLATINUM_STRUCT_OV23_02248D20_H -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_020298B0_decl.h" #include "overlay023/funcptr_ov23_02248D20.h" #include "colored_arrow.h" +#include "list_menu.h" +#include "string_list.h" typedef struct { UnkFuncPtr_ov23_02248D20 unk_00; UndergroundData *unk_04; - ResourceMetadata *unk_08; - BmpList *unk_0C; + StringList *unk_08; + ListMenu *unk_0C; ColoredArrow *unk_10; u16 unk_14; u16 unk_16; diff --git a/include/overlay023/struct_ov23_02250CD4.h b/include/overlay023/struct_ov23_02250CD4.h index d4695f4f2e..0200093de0 100644 --- a/include/overlay023/struct_ov23_02250CD4.h +++ b/include/overlay023/struct_ov23_02250CD4.h @@ -2,9 +2,6 @@ #define POKEPLATINUM_STRUCT_OV23_02250CD4_H #include "struct_decls/cell_actor_data.h" -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_defs/struct_0206A844.h" #include "field/field_system_decl.h" @@ -17,7 +14,10 @@ #include "overlay023/struct_ov23_02248D20.h" #include "bg_window.h" +#include "list_menu.h" +#include "menu.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "sys_task_manager.h" @@ -29,14 +29,14 @@ typedef struct { Window unk_10; Window unk_20; Window unk_30; - ResourceMetadata *unk_40; - ResourceMetadata *unk_44; - BmpList *unk_48; + StringList *unk_40; + StringList *unk_44; + ListMenu *unk_48; UnkStruct_ov23_02248D20 *unk_4C; - BmpList *unk_50; - UIControlData *unk_54; - ResourceMetadata *unk_58; - UIControlData *unk_5C; + ListMenu *unk_50; + Menu *unk_54; + StringList *unk_58; + Menu *unk_5C; UnkFuncPtr_ov23_022515D8 unk_60; UnkFuncPtr_ov23_022515D8 unk_64; Strbuf *unk_68; diff --git a/include/overlay065/struct_ov65_0222EBE0_t.h b/include/overlay065/struct_ov65_0222EBE0_t.h index 25db2c5f9e..053985bb13 100644 --- a/include/overlay065/struct_ov65_0222EBE0_t.h +++ b/include/overlay065/struct_ov65_0222EBE0_t.h @@ -1,10 +1,7 @@ #ifndef POKEPLATINUM_STRUCT_OV65_0222EBE0_T_H #define POKEPLATINUM_STRUCT_OV65_0222EBE0_T_H -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_02012744_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_0202B370_decl.h" #include "struct_defs/struct_0200C738.h" #include "struct_defs/struct_0207DFAC.h" @@ -17,11 +14,14 @@ #include "bg_window.h" #include "cell_actor.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "overlay_manager.h" #include "savedata.h" #include "sprite_resource.h" #include "strbuf.h" +#include "string_list.h" #include "trainer_info.h" struct UnkStruct_ov65_0222EBE0_t { @@ -32,10 +32,10 @@ struct UnkStruct_ov65_0222EBE0_t { u8 unk_2C[32]; int unk_4C[32]; int unk_CC[32]; - ResourceMetadata *unk_14C; - BmpList *unk_150; - ResourceMetadata *unk_154; - BmpList *unk_158; + StringList *unk_14C; + ListMenu *unk_150; + StringList *unk_154; + ListMenu *unk_158; BgConfig *unk_15C; SaveData *unk_160; StringTemplate *unk_164; @@ -46,7 +46,7 @@ struct UnkStruct_ov65_0222EBE0_t { Strbuf *unk_178; Strbuf *unk_17C; int unk_180; - UIControlData *unk_184; + Menu *unk_184; void *unk_188; CellActorCollection *unk_18C; UnkStruct_0200C738 unk_190; diff --git a/include/overlay070/ov70_0225D9A4.h b/include/overlay070/ov70_0225D9A4.h index 7eb56fc060..7f844c6a38 100644 --- a/include/overlay070/ov70_0225D9A4.h +++ b/include/overlay070/ov70_0225D9A4.h @@ -1,8 +1,6 @@ #ifndef POKEPLATINUM_OV70_0225D9A4_H #define POKEPLATINUM_OV70_0225D9A4_H -#include "struct_decls/struct_02013A04_decl.h" - #include "overlay066/struct_ov66_0222DFF8_decl.h" #include "overlay070/struct_ov70_0225C894_decl.h" #include "overlay070/struct_ov70_0225CA20_decl.h" @@ -11,11 +9,12 @@ #include "overlay070/struct_ov70_02261E10_decl.h" #include "overlay070/struct_ov70_022630A4_decl.h" #include "overlay070/struct_ov70_02263910.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "enums.h" +#include "list_menu.h" #include "overlay_manager.h" #include "strbuf.h" +#include "string_list.h" int ov70_0225D9A4(OverlayManager *param0, int *param1); int ov70_0225DB90(OverlayManager *param0, int *param1); @@ -51,10 +50,10 @@ void ov70_0225E00C(UnkStruct_ov70_0225DEE8 *param0, u32 param1); void ov70_0225E020(UnkStruct_ov70_0225DEE8 *param0, u32 param1, u32 param2); void ov70_0225E034(UnkStruct_ov70_0225DEE8 *param0); void ov70_0225E044(UnkStruct_ov70_0225DEE8 *param0, const Strbuf *param1, u32 param2); -const ResourceMetadata *ov70_0225E054(const UnkStruct_ov70_0225DEE8 *param0); +const StringList *ov70_0225E054(const UnkStruct_ov70_0225DEE8 *param0); BOOL ov70_0225E064(const UnkStruct_ov70_0225DEE8 *param0, u32 param1); -void ov70_0225E074(UnkStruct_ov70_0225DEE8 *param0, const UnkStruct_ov84_02240FA8 *param1, u16 param2, u16 param3); -void ov70_0225E0A4(UnkStruct_ov70_0225DEE8 *param0, const UnkStruct_ov84_02240FA8 *param1, u16 param2, u16 param3, u8 param4, u8 param5, u8 param6); +void ov70_0225E074(UnkStruct_ov70_0225DEE8 *param0, const ListMenuTemplate *param1, u16 param2, u16 param3); +void ov70_0225E0A4(UnkStruct_ov70_0225DEE8 *param0, const ListMenuTemplate *param1, u16 param2, u16 param3, u8 param4, u8 param5, u8 param6); u32 ov70_0225E0D4(UnkStruct_ov70_0225DEE8 *param0); void ov70_0225E0E4(UnkStruct_ov70_0225DEE8 *param0, u16 *param1, u16 *param2); void ov70_0225E0F4(UnkStruct_ov70_0225DEE8 *param0, BOOL param1); diff --git a/include/overlay076/struct_ov76_0223C398.h b/include/overlay076/struct_ov76_0223C398.h index a47c5c62e4..b17a75c126 100644 --- a/include/overlay076/struct_ov76_0223C398.h +++ b/include/overlay076/struct_ov76_0223C398.h @@ -4,12 +4,10 @@ #include "struct_decls/font_oam.h" #include "struct_decls/pokemon_animation_sys_decl.h" #include "struct_decls/sprite_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_02007768_decl.h" #include "struct_decls/struct_0200C6E4_decl.h" #include "struct_decls/struct_0200C704_decl.h" #include "struct_decls/struct_02012744_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_02015920_decl.h" #include "struct_decls/struct_02023FCC_decl.h" #include "struct_defs/sprite_manager_allocation.h" @@ -20,7 +18,9 @@ #include "overlay022/struct_ov22_02258A48.h" #include "bg_window.h" +#include "menu.h" #include "palette.h" +#include "string_list.h" #include "touch_screen.h" typedef struct { @@ -31,8 +31,8 @@ typedef struct { BgConfig *unk_10; PaletteData *unk_14; Window unk_18[11]; - ResourceMetadata *unk_C8; - UIControlData *unk_CC; + StringList *unk_C8; + Menu *unk_CC; UnkStruct_02007768 *unk_D0; Sprite *unk_D4; int unk_D8; diff --git a/include/overlay079/struct_ov79_021D0E1C.h b/include/overlay079/struct_ov79_021D0E1C.h index ae03055ca2..b154865e34 100644 --- a/include/overlay079/struct_ov79_021D0E1C.h +++ b/include/overlay079/struct_ov79_021D0E1C.h @@ -3,22 +3,21 @@ #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_0200C6E4_decl.h" #include "struct_decls/struct_0200C704_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_defs/struct_020158A8.h" #include "struct_defs/struct_0203D9B8.h" #include "struct_defs/struct_0209903C.h" #include "struct_defs/struct_0209916C.h" #include "overlay079/struct_ov79_021D0E1C_sub1.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "bg_window.h" #include "cell_actor.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" +#include "string_list.h" typedef struct UnkStruct_ov79_021D0E1C_t { int unk_00; @@ -42,13 +41,13 @@ typedef struct UnkStruct_ov79_021D0E1C_t { UnkStruct_ov79_021D0E1C_sub1 unk_30; u16 unk_80; u16 unk_82; - UnkStruct_ov84_02240FA8 unk_84; - UnkStruct_ov84_02240FA8 unk_A4; - BmpList *unk_C4; - BmpList *unk_C8; - ResourceMetadata *unk_CC; - ResourceMetadata *unk_D0; - UIControlData *unk_D4; + ListMenuTemplate unk_84; + ListMenuTemplate unk_A4; + ListMenu *unk_C4; + ListMenu *unk_C8; + StringList *unk_CC; + StringList *unk_D0; + Menu *unk_D4; void *unk_D8; void *unk_DC; NNSG2dScreenData *unk_E0; diff --git a/include/overlay084/struct_ov84_0223B5A0.h b/include/overlay084/struct_ov84_0223B5A0.h index 50f3b638dd..5ff0113586 100644 --- a/include/overlay084/struct_ov84_0223B5A0.h +++ b/include/overlay084/struct_ov84_0223B5A0.h @@ -2,12 +2,9 @@ #define POKEPLATINUM_STRUCT_OV84_0223B5A0_H #include "struct_decls/cell_actor_data.h" -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_0200C440_decl.h" #include "struct_decls/struct_0200C6E4_decl.h" #include "struct_decls/struct_0200C704_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_0207CB08_decl.h" #include "overlay084/struct_ov84_0223B5A0_sub1.h" @@ -16,9 +13,12 @@ #include "bag.h" #include "bg_window.h" #include "game_options.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "trainer_info.h" @@ -40,10 +40,10 @@ typedef struct { MessageLoader *unk_11C; MessageLoader *unk_120; Strbuf *unk_124[12]; - ResourceMetadata *unk_154; - UIControlData *unk_158; - BmpList *unk_15C; - ResourceMetadata *unk_160; + StringList *unk_154; + Menu *unk_158; + ListMenu *unk_15C; + StringList *unk_160; Strbuf *unk_164[165]; Strbuf *unk_3F8; Strbuf *unk_3FC; diff --git a/include/overlay084/struct_ov84_02240FA8.h b/include/overlay084/struct_ov84_02240FA8.h deleted file mode 100644 index 12ea9599ce..0000000000 --- a/include/overlay084/struct_ov84_02240FA8.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_OV84_02240FA8_H -#define POKEPLATINUM_STRUCT_OV84_02240FA8_H - -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02013A04_decl.h" - -#include "bg_window.h" - -typedef struct { - const ResourceMetadata *unk_00; - void (*unk_04)(BmpList *, u32, u8); - void (*unk_08)(BmpList *, u32, u8); - Window *unk_0C; - u16 unk_10; - u16 unk_12; - u8 unk_14; - u8 unk_15; - u8 unk_16; - u8 unk_17_0 : 4; - u8 unk_17_4 : 4; - u8 unk_18_0 : 4; - u8 unk_18_4 : 4; - u16 unk_1A_0 : 3; - u16 unk_1A_3 : 4; - u16 unk_1A_7 : 2; - u16 unk_1A_9 : 6; - u16 unk_1A_15 : 1; - void *unk_1C; -} UnkStruct_ov84_02240FA8; - -#endif // POKEPLATINUM_STRUCT_OV84_02240FA8_H diff --git a/include/overlay088/ov88_0223E9C4.h b/include/overlay088/ov88_0223E9C4.h index 873e1312d8..c40b96a1f1 100644 --- a/include/overlay088/ov88_0223E9C4.h +++ b/include/overlay088/ov88_0223E9C4.h @@ -1,22 +1,21 @@ #ifndef POKEPLATINUM_OV88_0223E9C4_H #define POKEPLATINUM_OV88_0223E9C4_H -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" -#include "struct_decls/struct_02013A04_decl.h" - #include "bg_window.h" #include "game_options.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" void ov88_0223E9C4(BgConfig *param0, Window *param1, Options *param2); void ov88_0223EC04(Window *param0); void ov88_0223EC78(Window *param0, Strbuf *param1, int param2, u32 param3, int param4, int param5); int ov88_0223ECBC(Window *param0, int param1, int param2, MessageLoader *param3, StringTemplate *param4); -u32 ov88_0223ED2C(BgConfig *param0, UIControlData **param1, int *param2); +u32 ov88_0223ED2C(BgConfig *param0, Menu **param1, int *param2); void ov88_0223ED80(Window *param0); -BmpList *ov88_0223ED94(ResourceMetadata *param0, int param1, Window *param2, BgConfig *param3); +ListMenu *ov88_0223ED94(StringList *param0, int param1, Window *param2, BgConfig *param3); #endif // POKEPLATINUM_OV88_0223E9C4_H diff --git a/include/overlay094/ov94_0223BCB0.h b/include/overlay094/ov94_0223BCB0.h index a3857cd2f5..ee8e66c7df 100644 --- a/include/overlay094/ov94_0223BCB0.h +++ b/include/overlay094/ov94_0223BCB0.h @@ -1,19 +1,18 @@ #ifndef POKEPLATINUM_OV94_0223BCB0_H #define POKEPLATINUM_OV94_0223BCB0_H -#include "struct_decls/struct_02001AF4_decl.h" - #include "overlay094/struct_ov94_0223FD4C_decl.h" #include "bg_window.h" #include "cell_actor.h" +#include "menu.h" #include "overlay_manager.h" int ov94_0223BCB0(OverlayManager *param0, int *param1); int ov94_0223BE2C(OverlayManager *param0, int *param1); int ov94_0223BF54(OverlayManager *param0, int *param1); void ov94_0223C300(CellActorInitParamsEx *param0, UnkStruct_ov94_0223FD4C *param1, CellActorResourceData *param2, int param3); -UIControlData *ov94_0223C3C0(BgConfig *param0, int param1, int param2); +Menu *ov94_0223C3C0(BgConfig *param0, int param1, int param2); void ov94_0223C3F4(UnkStruct_ov94_0223FD4C *param0, int param1, int param2); void ov94_0223C3FC(CellActor *param0, int param1, int param2); int ov94_0223C4B4(void); diff --git a/include/overlay094/ov94_022414B8.h b/include/overlay094/ov94_022414B8.h index 5625f80d55..6d72f03625 100644 --- a/include/overlay094/ov94_022414B8.h +++ b/include/overlay094/ov94_022414B8.h @@ -2,8 +2,6 @@ #define POKEPLATINUM_OV94_022414B8_H #include "struct_decls/pokedexdata_decl.h" -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "overlay094/struct_ov94_0223BA88.h" #include "overlay094/struct_ov94_0223BA88_sub3.h" @@ -12,7 +10,9 @@ #include "overlay094/struct_ov94_02242AAC.h" #include "bg_window.h" +#include "list_menu.h" #include "message.h" +#include "string_list.h" #include "string_template.h" #include "text.h" @@ -30,15 +30,15 @@ void ov94_02242368(MessageLoader *param0, MessageLoader *param1, StringTemplate u16 *ov94_Pokedex_Alphabetical(int heapID, int unused, int *pokedexLength); u8 *ov94_02242548(int param0); void ov94_022425A8(UnkStruct_ov94_0223BA88 *param0, UnkStruct_ov94_0223FD4C *param1); -BmpList *ov94_022426A8(UnkStruct_ov94_0223FD4C *param0, ResourceMetadata **param1, Window *param2, MessageLoader *param3); -BmpList *ov94_022427C0(UnkStruct_ov94_0223FD4C *param0, ResourceMetadata **param1, Window *param2, MessageLoader *param3, MessageLoader *param4, UnkStruct_ov94_0223FD4C_sub3 *param5, PokedexData *param6); -BmpList *ov94_02242840(ResourceMetadata **param0, Window *param1, MessageLoader *param2); -BmpList *ov94_022428B0(ResourceMetadata **param0, Window *param1, MessageLoader *param2, int param3); +ListMenu *ov94_022426A8(UnkStruct_ov94_0223FD4C *param0, StringList **param1, Window *param2, MessageLoader *param3); +ListMenu *ov94_022427C0(UnkStruct_ov94_0223FD4C *param0, StringList **param1, Window *param2, MessageLoader *param3, MessageLoader *param4, UnkStruct_ov94_0223FD4C_sub3 *param5, PokedexData *param6); +ListMenu *ov94_02242840(StringList **param0, Window *param1, MessageLoader *param2); +ListMenu *ov94_022428B0(StringList **param0, Window *param1, MessageLoader *param2, int param3); void ov94_02242934(UnkStruct_ov94_0223BA88_sub3 *param0, int param1, int param2); int ov94_02242970(int param0, int param1, int param2); -BmpList *ov94_022429B4(ResourceMetadata **param0, Window *param1, MessageLoader *param2, MessageLoader *param3); +ListMenu *ov94_022429B4(StringList **param0, Window *param1, MessageLoader *param2, MessageLoader *param3); void ov94_02242A44(UnkStruct_ov94_0223FD4C *param0, int param1); -u32 ov94_02242A6C(BmpList *param0, u16 *param1); +u32 ov94_02242A6C(ListMenu *param0, u16 *param1); void ov94_02242AAC(UnkStruct_ov94_02242AAC *param0); void ov94_02242AC4(UnkStruct_ov94_02242AAC *param0, int param1, int param2, int param3); diff --git a/include/overlay094/struct_ov94_0223FD4C.h b/include/overlay094/struct_ov94_0223FD4C.h index 88c4256ebd..fd49b44efe 100644 --- a/include/overlay094/struct_ov94_0223FD4C.h +++ b/include/overlay094/struct_ov94_0223FD4C.h @@ -4,9 +4,6 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_0202B370_decl.h" #include "struct_decls/struct_0207AE68_decl.h" #include "struct_defs/pokemon_summary.h" @@ -27,11 +24,14 @@ #include "bg_window.h" #include "cell_actor.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "overlay_manager.h" #include "pokemon.h" #include "sprite_resource.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "sys_task_manager.h" #include "trainer_info.h" @@ -121,10 +121,10 @@ typedef struct UnkStruct_ov94_0223FD4C_t { Window unk_FCC[13]; Window unk_109C; Window unk_10AC[2]; - ResourceMetadata *unk_10CC; - UIControlData *unk_10D0; - UIControlData *unk_10D4; - BmpList *unk_10D8; + StringList *unk_10CC; + Menu *unk_10D0; + Menu *unk_10D4; + ListMenu *unk_10D8; void *unk_10DC; int unk_10E0; UnkStruct_ov94_0223FD4C_sub3 *unk_10E4; diff --git a/include/overlay096/ov96_0223B6A0.h b/include/overlay096/ov96_0223B6A0.h index 0e13ad6279..c34b66b7e2 100644 --- a/include/overlay096/ov96_0223B6A0.h +++ b/include/overlay096/ov96_0223B6A0.h @@ -1,19 +1,18 @@ #ifndef POKEPLATINUM_OV96_0223B6A0_H #define POKEPLATINUM_OV96_0223B6A0_H -#include "struct_decls/struct_02001AF4_decl.h" - #include "overlay096/struct_ov96_0223BF40_decl.h" #include "bg_window.h" #include "cell_actor.h" +#include "menu.h" #include "overlay_manager.h" int ov96_0223B6A0(OverlayManager *param0, int *param1); int ov96_0223B7F8(OverlayManager *param0, int *param1); int ov96_0223B8CC(OverlayManager *param0, int *param1); void ov96_0223BAE0(CellActorInitParamsEx *param0, UnkStruct_ov96_0223BF40 *param1, CellActorResourceData *param2, int param3); -UIControlData *ov96_0223BBC8(BgConfig *param0, int param1, int param2); +Menu *ov96_0223BBC8(BgConfig *param0, int param1, int param2); void ov96_0223BBFC(UnkStruct_ov96_0223BF40 *param0, int param1, int param2); int ov96_0223BC50(void); void ov96_0223BC5C(UnkStruct_ov96_0223BF40 *param0, int param1, int param2); diff --git a/include/overlay096/struct_ov96_0223BF40_t.h b/include/overlay096/struct_ov96_0223BF40_t.h index aef4b72b93..0fe8c7bdc3 100644 --- a/include/overlay096/struct_ov96_0223BF40_t.h +++ b/include/overlay096/struct_ov96_0223BF40_t.h @@ -4,7 +4,6 @@ #include #include -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_defs/struct_0200C738.h" #include "struct_defs/struct_0206BC70.h" @@ -16,6 +15,7 @@ #include "bg_window.h" #include "cell_actor.h" +#include "menu.h" #include "message.h" #include "pokemon.h" #include "sprite_resource.h" @@ -73,7 +73,7 @@ struct UnkStruct_ov96_0223BF40_t { Window unk_E78; Window unk_E88[3]; Window unk_EB8[11]; - UIControlData *unk_F68; + Menu *unk_F68; void *unk_F6C; int unk_F70; int unk_F74; diff --git a/include/overlay097/ov97_02237694.h b/include/overlay097/ov97_02237694.h index 5d4b6c55d8..cc756d09e8 100644 --- a/include/overlay097/ov97_02237694.h +++ b/include/overlay097/ov97_02237694.h @@ -1,7 +1,6 @@ #ifndef POKEPLATINUM_OV97_02237694_H #define POKEPLATINUM_OV97_02237694_H -#include "struct_decls/struct_0200112C_decl.h" #include "struct_defs/struct_0202DF40.h" #include "overlay097/struct_ov97_02237808.h" @@ -11,6 +10,7 @@ #include "bg_window.h" #include "cell_actor.h" +#include "list_menu.h" #include "overlay_manager.h" #include "savedata.h" @@ -40,7 +40,7 @@ u32 ov97_02237E4C(int param0); void ov97_02238194(BgConfig *param0, UnkStruct_0202DF40 *param1); void ov97_0223829C(UnkStruct_ov97_0223829C *param0, UnkUnion_ov97_0222D2B0 *param1, int param2); void ov97_02238324(UnkStruct_ov97_0223829C *param0, UnkUnion_ov97_0222D2B0 *param1, int param2); -void ov97_022383C4(BmpList *param0, u32 param1, u8 param2); +void ov97_022383C4(ListMenu *param0, u32 param1, u8 param2); void ov97_02238400(BOOL param0); void ov97_02238440(void); void ov97_0223846C(SaveData *param0); diff --git a/include/overlay097/struct_ov97_0222D04C.h b/include/overlay097/struct_ov97_0222D04C.h index 1b642394ea..9a6509e206 100644 --- a/include/overlay097/struct_ov97_0222D04C.h +++ b/include/overlay097/struct_ov97_0222D04C.h @@ -3,8 +3,6 @@ #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_defs/struct_0200C738.h" #include "overlay097/struct_ov97_0223829C.h" @@ -13,10 +11,12 @@ #include "bg_window.h" #include "cell_actor.h" #include "game_options.h" +#include "list_menu.h" #include "message.h" #include "savedata.h" #include "sprite_resource.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" typedef struct { @@ -33,8 +33,8 @@ typedef struct { int unk_6C; int unk_70; int unk_74; - BmpList *unk_78; - ResourceMetadata *unk_7C; + ListMenu *unk_78; + StringList *unk_7C; int unk_80; int unk_84; int unk_88; diff --git a/include/overlay104/struct_ov104_022320B4_t.h b/include/overlay104/struct_ov104_022320B4_t.h index e792f94b4a..2a26d1fc24 100644 --- a/include/overlay104/struct_ov104_022320B4_t.h +++ b/include/overlay104/struct_ov104_022320B4_t.h @@ -1,7 +1,6 @@ #ifndef POKEPLATINUM_STRUCT_OV104_022320B4_T_H #define POKEPLATINUM_STRUCT_OV104_022320B4_T_H -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_0209B75C_decl.h" #include "overlay104/struct_ov104_0222E8C8.h" @@ -9,6 +8,7 @@ #include "overlay104/struct_ov104_02232B5C_decl.h" #include "bg_window.h" +#include "menu.h" #include "message.h" #include "strbuf.h" #include "string_template.h" @@ -34,7 +34,7 @@ struct UnkStruct_ov104_022320B4_t { BOOL unk_5C; UnkStruct_ov104_02232B5C *unk_60; Window unk_64; - UIControlData *unk_74; + Menu *unk_74; u16 *unk_78; void *unk_7C; void *unk_80; diff --git a/include/overlay109/struct_ov109_021D5140.h b/include/overlay109/struct_ov109_021D5140.h index 1e794bd49f..e2670778f3 100644 --- a/include/overlay109/struct_ov109_021D5140.h +++ b/include/overlay109/struct_ov109_021D5140.h @@ -3,7 +3,6 @@ #include -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_0209C194_decl.h" #include "struct_defs/struct_0200C738.h" #include "struct_defs/struct_0209BDF8.h" @@ -14,6 +13,7 @@ #include "bg_window.h" #include "cell_actor.h" +#include "menu.h" #include "message.h" #include "sprite_resource.h" #include "strbuf.h" @@ -52,7 +52,7 @@ typedef struct UnkStruct_ov109_021D5140_t { Window unk_36C; Window unk_37C; Window *unk_38C[2]; - UIControlData *unk_394; + Menu *unk_394; void *unk_398[2]; NNSG2dCharacterData *unk_3A0[2]; void *unk_3A8[2]; diff --git a/include/overlay119/struct_ov119_021D17B8.h b/include/overlay119/struct_ov119_021D17B8.h index 8e7fdea9e5..2b6c839f08 100644 --- a/include/overlay119/struct_ov119_021D17B8.h +++ b/include/overlay119/struct_ov119_021D17B8.h @@ -2,18 +2,18 @@ #define POKEPLATINUM_STRUCT_OV119_021D17B8_H #include "struct_decls/pokemon_animation_sys_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_02007768_decl.h" #include "struct_decls/struct_0200C6E4_decl.h" #include "struct_decls/struct_0200C704_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_defs/struct_0207C690.h" #include "overlay119/struct_ov119_021D14DC.h" #include "bg_window.h" +#include "menu.h" #include "narc.h" #include "palette.h" +#include "string_list.h" typedef struct { BgConfig *unk_00; @@ -26,8 +26,8 @@ typedef struct { UnkStruct_02007768 *unk_38; NARC *unk_3C; UnkStruct_ov119_021D14DC *unk_40; - ResourceMetadata *unk_44; - UIControlData *unk_48; + StringList *unk_44; + Menu *unk_48; SpriteGfxHandler *unk_4C; SpriteRenderer *unk_50; PokemonAnimationSys *unk_54; diff --git a/include/script_manager.h b/include/script_manager.h index 4e553c13e0..8b0ba53523 100644 --- a/include/script_manager.h +++ b/include/script_manager.h @@ -1,7 +1,6 @@ #ifndef POKEPLATINUM_SCRIPT_MANAGER_H #define POKEPLATINUM_SCRIPT_MANAGER_H -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_020508D4_decl.h" #include "struct_decls/struct_02061AB4_decl.h" #include "struct_defs/struct_0203F478.h" @@ -13,6 +12,7 @@ #include "bg_window.h" #include "field_script_context.h" +#include "menu.h" #include "string_template.h" #include "sys_task_manager.h" @@ -117,7 +117,7 @@ typedef struct ScriptManager { BOOL battleResult; UnkStruct_ov5_021DC1A4 *unk_10; // appears to be used for multichoice windows Window window; - UIControlData *ctrlUI; + Menu *ctrlUI; int playerDir; MapObject *targetObject; MapObject *cameraObject; diff --git a/include/string_list.h b/include/string_list.h new file mode 100644 index 0000000000..adbc29a26a --- /dev/null +++ b/include/string_list.h @@ -0,0 +1,20 @@ +#ifndef POKEPLATINUM_STRING_LIST_H +#define POKEPLATINUM_STRING_LIST_H + +#include "message.h" +#include "strbuf.h" + +#define STRING_LIST_TERMINATOR ((void *)0xFFFFFFFF) + +typedef struct StringList { + void *entry; + u32 index; +} StringList; + +StringList *StringList_New(u32 capacity, u32 heapID); +void StringList_Free(StringList *list); +void StringList_AddFromMessageBank(StringList *list, const MessageLoader *loader, u32 bankEntry, u32 index); +void StringList_AddFromStrbuf(StringList *list, const Strbuf *strbuf, u32 index); +void StringList_AddFromEntry(StringList *list, const StringList *entry); + +#endif // POKEPLATINUM_STRING_LIST_H diff --git a/include/struct_decls/struct_0200112C_decl.h b/include/struct_decls/struct_0200112C_decl.h deleted file mode 100644 index bac2ba9497..0000000000 --- a/include/struct_decls/struct_0200112C_decl.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0200112C_DECL_H -#define POKEPLATINUM_STRUCT_0200112C_DECL_H - -typedef struct UnkStruct_0200112C_t BmpList; - -#endif // POKEPLATINUM_STRUCT_0200112C_DECL_H diff --git a/include/struct_decls/struct_02001AF4_decl.h b/include/struct_decls/struct_02001AF4_decl.h deleted file mode 100644 index aed2194813..0000000000 --- a/include/struct_decls/struct_02001AF4_decl.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_02001AF4_DECL_H -#define POKEPLATINUM_STRUCT_02001AF4_DECL_H - -typedef struct UIControlData_t UIControlData; - -#endif // POKEPLATINUM_STRUCT_02001AF4_DECL_H diff --git a/include/struct_decls/struct_02013A04_decl.h b/include/struct_decls/struct_02013A04_decl.h deleted file mode 100644 index 90fa4c17f0..0000000000 --- a/include/struct_decls/struct_02013A04_decl.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_02013A04_DECL_H -#define POKEPLATINUM_STRUCT_02013A04_DECL_H -#include "struct_defs/struct_02013A04_t.h" - -typedef struct ResourceMetadata_t ResourceMetadata; - -#endif // POKEPLATINUM_STRUCT_02013A04_DECL_H diff --git a/include/struct_defs/struct_02013A04_t.h b/include/struct_defs/struct_02013A04_t.h deleted file mode 100644 index c777835b5b..0000000000 --- a/include/struct_defs/struct_02013A04_t.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_02013A04_T_H -#define POKEPLATINUM_STRUCT_02013A04_T_H - -struct ResourceMetadata_t { - const void *unk_00; - u32 unk_04; -}; - -#endif // POKEPLATINUM_STRUCT_02013A04_T_H diff --git a/include/struct_defs/struct_020708E0.h b/include/struct_defs/struct_020708E0.h index f4fecb32bd..1e655dd7c0 100644 --- a/include/struct_defs/struct_020708E0.h +++ b/include/struct_defs/struct_020708E0.h @@ -2,8 +2,6 @@ #define POKEPLATINUM_STRUCT_020708E0_H #include "struct_decls/cell_actor_data.h" -#include "struct_decls/struct_02001AF4_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_defs/struct_020684D0.h" #include "struct_defs/struct_02070950.h" @@ -11,12 +9,14 @@ #include "overlay005/struct_ov5_021D30A8.h" #include "bg_window.h" +#include "menu.h" +#include "string_list.h" typedef struct { Window unk_00; Window unk_10; - UIControlData *unk_20; - ResourceMetadata *unk_24; + Menu *unk_20; + StringList *unk_24; u16 unk_28; u16 state; u32 unk_2C; diff --git a/include/struct_defs/struct_0207F248.h b/include/struct_defs/struct_0207F248.h index 1853ad1785..69a24cf8b0 100644 --- a/include/struct_defs/struct_0207F248.h +++ b/include/struct_defs/struct_0207F248.h @@ -2,11 +2,9 @@ #define POKEPLATINUM_STRUCT_0207F248_H #include "struct_decls/cell_actor_data.h" -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_0200C440_decl.h" #include "struct_decls/struct_0200C6E4_decl.h" #include "struct_decls/struct_0200C704_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_02098700_decl.h" #include "struct_defs/funcptr_0207F248_sub1.h" #include "struct_defs/struct_0207C690.h" @@ -20,8 +18,10 @@ #include "bg_window.h" #include "cell_actor.h" +#include "menu.h" #include "message.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" typedef struct { @@ -43,8 +43,8 @@ typedef struct { Strbuf *unk_6A4; Strbuf *unk_6A8; Strbuf *unk_6AC[20]; - ResourceMetadata *unk_6FC; - UIControlData *unk_700; + StringList *unk_6FC; + Menu *unk_700; StrBufWrapper unk_704[6]; const ByteFlagSet *unk_7F4; DualArrayShortData unk_7F8; diff --git a/include/struct_defs/struct_02081CF4.h b/include/struct_defs/struct_02081CF4.h deleted file mode 100644 index d60fb98057..0000000000 --- a/include/struct_defs/struct_02081CF4.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_02081CF4_H -#define POKEPLATINUM_STRUCT_02081CF4_H - -#include "struct_decls/struct_02013A04_decl.h" - -#include "bg_window.h" - -typedef struct { - const ResourceMetadata *unk_00; - Window *unk_04; - u8 unk_08; - u8 unk_09; - u8 unk_0A; - u8 unk_0B_0 : 4; - u8 unk_0B_4 : 2; - u8 unk_0B_6 : 2; -} UnkStruct_02081CF4; - -#endif // POKEPLATINUM_STRUCT_02081CF4_H diff --git a/include/struct_defs/struct_02095E80_t.h b/include/struct_defs/struct_02095E80_t.h index d9b441756b..ee789c2b2d 100644 --- a/include/struct_defs/struct_02095E80_t.h +++ b/include/struct_defs/struct_02095E80_t.h @@ -4,9 +4,6 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_02027F8C_decl.h" #include "struct_decls/struct_0202B370_decl.h" #include "struct_decls/struct_02095E80_decl.h" @@ -24,11 +21,14 @@ #include "bg_window.h" #include "cell_actor.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "overlay_manager.h" #include "savedata.h" #include "sprite_resource.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "sys_task_manager.h" @@ -83,9 +83,9 @@ struct UnkStruct_02095E80_t { CellActor *unk_47C; SysTask *unk_480[7]; Window unk_49C[34]; - UIControlData *unk_6BC; - ResourceMetadata *unk_6C0; - UIControlData *unk_6C4; + Menu *unk_6BC; + StringList *unk_6C0; + Menu *unk_6C4; int unk_6C8; int unk_6CC; int unk_6D0; @@ -125,8 +125,8 @@ struct UnkStruct_02095E80_t { int unk_36C8; StringTemplate *unk_36CC; MessageLoader *unk_36D0; - ResourceMetadata *unk_36D4; - BmpList *unk_36D8; + StringList *unk_36D4; + ListMenu *unk_36D8; Window unk_36DC; UnkStruct_0202B370 *unk_36EC; int unk_36F0; diff --git a/include/struct_defs/struct_020961E8_t.h b/include/struct_defs/struct_020961E8_t.h index 436981c75c..094854156e 100644 --- a/include/struct_defs/struct_020961E8_t.h +++ b/include/struct_defs/struct_020961E8_t.h @@ -3,7 +3,6 @@ #include -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_defs/struct_0200C738.h" #include "struct_defs/struct_0203DE34.h" #include "struct_defs/struct_020961E8_sub1.h" @@ -13,6 +12,7 @@ #include "bg_window.h" #include "cell_actor.h" +#include "menu.h" #include "message.h" #include "savedata.h" #include "sprite_resource.h" @@ -48,7 +48,7 @@ struct UnkStruct_020961E8_t { Window unk_35C; Window unk_36C; Window *unk_37C[2]; - UIControlData *unk_384; + Menu *unk_384; void *unk_388[2]; NNSG2dCharacterData *unk_390[2]; void *unk_398[2]; diff --git a/include/unk_0200112C.h b/include/unk_0200112C.h deleted file mode 100644 index dae895b405..0000000000 --- a/include/unk_0200112C.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef POKEPLATINUM_UNK_0200112C_H -#define POKEPLATINUM_UNK_0200112C_H - -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02013A04_decl.h" - -#include "overlay084/struct_ov84_02240FA8.h" - -BmpList *sub_0200112C(const UnkStruct_ov84_02240FA8 *param0, u16 param1, u16 param2, u8 param3); -u32 sub_02001288(BmpList *param0); -void sub_02001384(BmpList *param0, u16 *param1, u16 *param2); -void sub_020013AC(BmpList *param0); -void sub_020013D8(BmpList *param0, u8 param1, u8 param2, u8 param3); -u32 sub_02001408(BmpList *param0, UnkStruct_ov84_02240FA8 *param1, u16 param2, u16 param3, u16 param4, u16 param5, u16 *param6, u16 *param7); -void sub_0200147C(BmpList *param0, u8 param1, u8 param2, u8 param3); -void sub_020014D0(BmpList *param0, u16 *param1); -void sub_020014DC(BmpList *param0, u16 *param1, u16 *param2); -u8 sub_020014F0(BmpList *param0); -u32 sub_020014F8(BmpList *param0, u16 param1); -u32 sub_02001504(BmpList *param0, u8 param1); -void sub_020015CC(BmpList *param0, ResourceMetadata *param1); - -#endif // POKEPLATINUM_UNK_0200112C_H diff --git a/include/unk_02001AF4.h b/include/unk_02001AF4.h deleted file mode 100644 index b693a6e2d3..0000000000 --- a/include/unk_02001AF4.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef POKEPLATINUM_UNK_02001AF4_H -#define POKEPLATINUM_UNK_02001AF4_H - -#include "struct_decls/struct_02001AF4_decl.h" -#include "struct_defs/struct_02081CF4.h" - -#include "bg_window.h" - -UIControlData *sub_02001AF4(const UnkStruct_02081CF4 *param0, u8 param1, u8 param2, u8 param3, u8 param4, u32 param5); -UIControlData *sub_02001B7C(const UnkStruct_02081CF4 *param0, u8 param1, u8 param2, u8 param3, u8 param4, u32 param5); -UIControlData *sub_02001B9C(const UnkStruct_02081CF4 *param0, u8 param1, u8 param2); -void sub_02001BC4(UIControlData *param0, u8 *param1); -u32 sub_02001BE0(UIControlData *param0); -u32 sub_02001C94(UIControlData *param0, u16 param1); -u32 sub_02001D44(UIControlData *param0, u8 param1); -u8 sub_02001DC4(UIControlData *param0); -u8 sub_02001DC8(UIControlData *param0); -UIControlData *sub_02002054(BgConfig *param0, const WindowTemplate *param1, u16 param2, u8 param3, u8 param4, u32 param5); -UIControlData *sub_02002100(BgConfig *param0, const WindowTemplate *param1, u16 param2, u8 param3, u32 param4); -u32 sub_02002114(UIControlData *param0, u32 param1); -u32 sub_02002134(UIControlData *param0, u8 param1, u32 param2); -void sub_02002154(UIControlData *param0, u32 param1); -void sub_02002180(Window *param0, u32 param1, u32 param2); - -#endif // POKEPLATINUM_UNK_02001AF4_H diff --git a/include/unk_02013A04.h b/include/unk_02013A04.h deleted file mode 100644 index e76b1d416b..0000000000 --- a/include/unk_02013A04.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_UNK_02013A04_H -#define POKEPLATINUM_UNK_02013A04_H - -#include "struct_decls/struct_02013A04_decl.h" - -#include "message.h" -#include "strbuf.h" - -ResourceMetadata *sub_02013A04(u32 param0, u32 param1); -void sub_02013A3C(ResourceMetadata *param0); -void sub_02013A4C(ResourceMetadata *param0, const MessageLoader *param1, u32 param2, u32 param3); -void sub_02013A6C(ResourceMetadata *param0, const Strbuf *param1, u32 param2); -void sub_02013A90(ResourceMetadata *param0, const ResourceMetadata *param1); -void sub_02013AE8(ResourceMetadata *param0); - -#endif // POKEPLATINUM_UNK_02013A04_H diff --git a/platinum.us/main.lsf b/platinum.us/main.lsf index 0b31872d59..a80c1240a9 100644 --- a/platinum.us/main.lsf +++ b/platinum.us/main.lsf @@ -16,9 +16,9 @@ Static main Library libcps.a (.version) Library libssl.a (.version) Object main.nef.p/src_main.c.o - Object main.nef.p/src_unk_0200112C.c.o + Object main.nef.p/src_list_menu.c.o Object main.nef.p/src_game_version.c.o - Object main.nef.p/src_unk_02001AF4.c.o + Object main.nef.p/src_menu.c.o Object main.nef.p/src_charcode_util.c.o Object main.nef.p/src_render_text.c.o Object main.nef.p/src_font.c.o @@ -51,7 +51,7 @@ Static main Object main.nef.p/src_unk_02012744.c.o Object main.nef.p/src_unk_020131EC.c.o Object main.nef.p/src_rtc.c.o - Object main.nef.p/src_unk_02013A04.c.o + Object main.nef.p/src_string_list.c.o Object main.nef.p/src_screen_scroll_manager.c.o Object main.nef.p/src_unk_02014000.c.o Object main.nef.p/src_colored_arrow.c.o diff --git a/src/choose_starter/choose_starter_app.c b/src/choose_starter/choose_starter_app.c index ad665bf923..917d264cff 100644 --- a/src/choose_starter/choose_starter_app.c +++ b/src/choose_starter/choose_starter_app.c @@ -9,7 +9,6 @@ #include "constants/species.h" #include "struct_decls/sprite_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_02007768_decl.h" #include "struct_decls/struct_02015064_decl.h" #include "struct_decls/struct_02015128_decl.h" @@ -37,6 +36,7 @@ #include "graphics.h" #include "gx_layers.h" #include "heap.h" +#include "menu.h" #include "message.h" #include "overlay_manager.h" #include "pokemon.h" @@ -46,7 +46,6 @@ #include "sys_task.h" #include "sys_task_manager.h" #include "text.h" -#include "unk_02001AF4.h" #include "unk_020041CC.h" #include "unk_02005474.h" #include "unk_0200762C.h" @@ -208,7 +207,7 @@ typedef struct ChooseStarterApp { int unk_A8; Strbuf *unk_AC; WindowTemplate unk_B0; - UIControlData *unk_B8; + Menu *unk_B8; UnkStruct_0200C738 unk_BC; CellActorCollection *unk_248; SpriteResourceCollection *unk_24C[6]; @@ -1254,12 +1253,12 @@ static void ov78_021D1E44(ChooseStarterApp *param0, int param1) break; case 2: ov78_021D1FB4(param0->messageWindow, param1, 360, 1 + param0->cursorPosition, TEXT_COLOR(1, 2, 15), TEXT_SPEED_NO_TRANSFER); - param0->unk_B8 = sub_02002100(param0->bgl, ¶m0->unk_B0, (512 + (18 + 12) + 128), 1, param1); + param0->unk_B8 = Menu_MakeYesNoChoice(param0->bgl, ¶m0->unk_B0, (512 + (18 + 12) + 128), 1, param1); param0->unk_08 = 0; param0->unk_04++; break; case 3: - v0 = sub_02002114(param0->unk_B8, param1); + v0 = Menu_ProcessInputAndHandleExit(param0->unk_B8, param1); switch (v0) { case 0xffffffff: diff --git a/src/field_map_change.c b/src/field_map_change.c index 7f4db48cc1..596175f9fd 100644 --- a/src/field_map_change.c +++ b/src/field_map_change.c @@ -7,7 +7,6 @@ #include "constants/overworld_weather.h" #include "consts/map.h" -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_0203A790_decl.h" #include "struct_decls/struct_020508D4_decl.h" #include "struct_defs/map_load_mode.h" @@ -38,6 +37,7 @@ #include "map_header.h" #include "map_header_data.h" #include "map_object.h" +#include "menu.h" #include "message.h" #include "player_avatar.h" #include "pokeradar.h" @@ -48,7 +48,6 @@ #include "strbuf.h" #include "sys_task_manager.h" #include "trainer_info.h" -#include "unk_02001AF4.h" #include "unk_020041CC.h" #include "unk_02005474.h" #include "unk_0200A9DC.h" @@ -126,7 +125,7 @@ typedef struct MapChangeUndergroundData { Window unk_24; Strbuf *unk_34; u8 unk_38; - UIControlData *unk_3C; + Menu *unk_3C; } MapChangeUndergroundData; typedef struct MapChangeUnionData { @@ -1153,12 +1152,12 @@ BOOL FieldTask_MapChangeToUnderground(TaskManager *taskMan) if (FieldMessage_FinishedPrinting(mapChangeUndergroundData->unk_38) == 1) { Strbuf_Free(mapChangeUndergroundData->unk_34); sub_0200DAA4(fieldSystem->unk_08, 3, 1024 - (18 + 12) - 9, 11, 0, 11); - mapChangeUndergroundData->unk_3C = sub_02002100(fieldSystem->unk_08, &Unk_020EC3A0, 1024 - (18 + 12) - 9, 11, 11); + mapChangeUndergroundData->unk_3C = Menu_MakeYesNoChoice(fieldSystem->unk_08, &Unk_020EC3A0, 1024 - (18 + 12) - 9, 11, 11); mapChangeUndergroundData->state = 2; } break; case 2: - switch (sub_02002114(mapChangeUndergroundData->unk_3C, 11)) { + switch (Menu_ProcessInputAndHandleExit(mapChangeUndergroundData->unk_3C, 11)) { case 0: sub_0200E084(&mapChangeUndergroundData->unk_24, 0); Window_Remove(&mapChangeUndergroundData->unk_24); diff --git a/src/field_menu.c b/src/field_menu.c index 3da66fff62..52c018cbed 100644 --- a/src/field_menu.c +++ b/src/field_menu.c @@ -20,7 +20,6 @@ #include "struct_defs/struct_020708E0.h" #include "struct_defs/struct_020709CC.h" #include "struct_defs/struct_02072014.h" -#include "struct_defs/struct_02081CF4.h" #include "struct_defs/struct_02097728.h" #include "struct_defs/struct_02098C44.h" @@ -40,6 +39,7 @@ #include "cell_actor.h" #include "field_overworld_state.h" #include "field_system.h" +#include "font.h" #include "game_records.h" #include "gx_layers.h" #include "heap.h" @@ -47,6 +47,7 @@ #include "journal.h" #include "map_header.h" #include "map_object.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "party.h" @@ -58,16 +59,15 @@ #include "savedata.h" #include "script_manager.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" #include "trainer_info.h" -#include "unk_02001AF4.h" #include "unk_020041CC.h" #include "unk_02005474.h" #include "unk_0200C6E4.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" -#include "unk_02013A04.h" #include "unk_02014A84.h" #include "unk_0202631C.h" #include "unk_02028124.h" @@ -520,7 +520,7 @@ static void sub_0203ADFC(TaskManager *taskMan) FieldSystem *fieldSystem; FieldMenu *menu; MessageLoader *v2; - UnkStruct_02081CF4 v3; + MenuTemplate v3; u32 v4, v5; fieldSystem = TaskManager_FieldSystem(taskMan); @@ -533,7 +533,7 @@ static void sub_0203ADFC(TaskManager *taskMan) v2 = MessageLoader_Init(0, 26, 367, 11); - menu->unk_24 = sub_02013A04(v5, 11); + menu->unk_24 = StringList_New(v5, 11); menu->unk_28 = 0; for (v4 = 0; v4 < v5; v4++) { @@ -548,13 +548,13 @@ static void sub_0203ADFC(TaskManager *taskMan) StringTemplate_SetPlayerName(v6, 0, SaveData_GetTrainerInfo(fieldSystem->saveData)); StringTemplate_Format(v6, v7, v8); - sub_02013A6C(menu->unk_24, v7, menu->unk_30[v4]); + StringList_AddFromStrbuf(menu->unk_24, v7, menu->unk_30[v4]); Strbuf_Free(v8); Strbuf_Free(v7); StringTemplate_Free(v6); } else { - sub_02013A4C( + StringList_AddFromMessageBank( menu->unk_24, v2, Unk_020EA05C[menu->unk_30[v4]][0], menu->unk_30[v4]); } @@ -566,21 +566,21 @@ static void sub_0203ADFC(TaskManager *taskMan) fieldSystem->unk_90 = menu->unk_30[menu->unk_28]; MessageLoader_Free(v2); - v3.unk_00 = menu->unk_24; - v3.unk_04 = &menu->unk_00; - v3.unk_08 = 1; - v3.unk_09 = 1; - v3.unk_0A = v5; - v3.unk_0B_0 = 8; - v3.unk_0B_4 = 1; + v3.choices = menu->unk_24; + v3.window = &menu->unk_00; + v3.fontID = FONT_MESSAGE; + v3.xSize = 1; + v3.ySize = v5; + v3.lineSpacing = 8; + v3.suppressCursor = TRUE; if (v5 >= 4) { - v3.unk_0B_6 = 1; + v3.loopAround = TRUE; } else { - v3.unk_0B_6 = 0; + v3.loopAround = FALSE; } - menu->unk_20 = sub_02001AF4(&v3, 28, 4, menu->unk_28, 11, PAD_BUTTON_B | PAD_BUTTON_X); + menu->unk_20 = Menu_New(&v3, 28, 4, menu->unk_28, 11, PAD_BUTTON_B | PAD_BUTTON_X); Window_ScheduleCopyToVRAM(&menu->unk_00); sub_0203B318(menu, menu->unk_30, v5, TrainerInfo_Gender(SaveData_GetTrainerInfo(fieldSystem->saveData))); @@ -641,8 +641,8 @@ static u32 FieldMenu_MakeList(FieldMenu *menu, u8 *ret) static void FieldMenu_Close(FieldMenu *menu) { sub_0203B4E8(menu); - sub_02001BC4(menu->unk_20, NULL); - sub_02013A3C(menu->unk_24); + Menu_Free(menu->unk_20, NULL); + StringList_Free(menu->unk_24); menu->unk_20 = NULL; } @@ -732,10 +732,10 @@ static BOOL FieldMenu_Select(TaskManager *taskMan) fieldSystem = TaskManager_FieldSystem(taskMan); menu = TaskManager_Environment(taskMan); - v2 = sub_02001DC4(menu->unk_20); + v2 = Menu_GetCursorPos(menu->unk_20); - menu->unk_2C = sub_02001C94(menu->unk_20, 1504); - menu->unk_28 = sub_02001DC4(menu->unk_20); + menu->unk_2C = Menu_ProcessInputWithSound(menu->unk_20, 1504); + menu->unk_28 = Menu_GetCursorPos(menu->unk_20); if (v2 != menu->unk_28) { sub_0203B558(menu->unk_200[0]->unk_00, menu->unk_28); diff --git a/src/list_menu.c b/src/list_menu.c new file mode 100644 index 0000000000..c5caa7739f --- /dev/null +++ b/src/list_menu.c @@ -0,0 +1,563 @@ +#include "list_menu.h" + +#include +#include +#include + +#include "bg_window.h" +#include "colored_arrow.h" +#include "core_sys.h" +#include "font.h" +#include "heap.h" +#include "string_list.h" +#include "text.h" + +static void PrintEntry(ListMenu *menu, void *strbuf, u8 xOffset, u8 yOffset); +static void PrintEntries(ListMenu *menu, u16 startIndex, u16 lineOffset, u16 lineCount); +static void PrintCursor(ListMenu *menu); +static void EraseCursor(ListMenu *menu, u16 atLine); +static u8 UpdateOffsetsForScroll(ListMenu *menu, u8 movingDown); +static void ScrollList(ListMenu *menu, u8 lineCount, u8 isUpward); +static u8 UpdateSelectedRow(ListMenu *menu, u8 updateCursor, u8 scrollCount, u8 movingDown); +static void InvokeCursorCallback(ListMenu *menu, u8 onInit); + +ListMenu *ListMenu_New(const ListMenuTemplate *template, u16 startListPos, u16 startCursorPos, u8 heapID) +{ + ListMenu *menu = Heap_AllocFromHeap(heapID, sizeof(ListMenu)); + + menu->template = *template; + menu->cursor = ColoredArrow_New(heapID); + menu->listPos = startListPos; + menu->cursorPos = startCursorPos; + menu->dummy2C = 0; + menu->dummy2D = 0; + menu->dummy2E = 0xFF; + menu->lastAction = 0; + menu->heapID = heapID; + + menu->altFont.textColorFg = menu->template.textColorFg; + menu->altFont.textColorBg = menu->template.textColorBg; + menu->altFont.textColorShadow = menu->template.textColorShadow; + menu->altFont.letterSpacing = menu->template.letterSpacing; + menu->altFont.fontID = menu->template.fontID; + menu->altFont.prefer = 0; + + if (menu->template.count < menu->template.maxDisplay) { + menu->template.maxDisplay = menu->template.count; + } + + ColoredArrow_SetColor(menu->cursor, TEXT_COLOR(menu->template.textColorFg, menu->template.textColorShadow, menu->template.textColorBg)); + Window_FillTilemap(menu->template.window, menu->template.textColorBg); + PrintEntries(menu, menu->listPos, 0, menu->template.maxDisplay); + PrintCursor(menu); + InvokeCursorCallback(menu, TRUE); + Window_CopyToVRAM(template->window); + + return menu; +} + +u32 ListMenu_ProcessInput(ListMenu *menu) +{ + menu->lastAction = LIST_MENU_ACTION_NONE; + + if (JOY_NEW(PAD_BUTTON_A)) { + return menu->template.choices[menu->listPos + menu->cursorPos].index; + } + + if (JOY_NEW(PAD_BUTTON_B)) { + return LIST_CANCEL; + } + + if (JOY_REPEAT(PAD_KEY_UP)) { + if (UpdateSelectedRow(menu, TRUE, 1, FALSE) == 0) { + menu->lastAction = LIST_MENU_ACTION_MOVE_UP; + } + + return LIST_NOTHING_CHOSEN; + } + + if (JOY_REPEAT(PAD_KEY_DOWN)) { + if (UpdateSelectedRow(menu, TRUE, 1, TRUE) == 0) { + menu->lastAction = LIST_MENU_ACTION_MOVE_DOWN; + } + + return LIST_NOTHING_CHOSEN; + } + + u16 pageUp, pageDown; + switch (menu->template.pagerMode) { + default: + case PAGER_MODE_NONE: + pageUp = FALSE; + pageDown = FALSE; + break; + + case PAGER_MODE_LEFT_RIGHT_PAD: + pageUp = JOY_REPEAT(PAD_KEY_LEFT); + pageDown = JOY_REPEAT(PAD_KEY_RIGHT); + break; + + case PAGER_MODE_SHOULDER_BUTTONS: + pageUp = JOY_REPEAT(PAD_BUTTON_L); + pageDown = JOY_REPEAT(PAD_BUTTON_R); + break; + } + + if (pageUp) { + if (UpdateSelectedRow(menu, TRUE, menu->template.maxDisplay, FALSE) == 0) { + menu->lastAction = LIST_MENU_ACTION_PAGE_UP; + } + + return LIST_NOTHING_CHOSEN; + } + + if (pageDown) { + if (UpdateSelectedRow(menu, TRUE, menu->template.maxDisplay, TRUE) == 0) { + menu->lastAction = LIST_MENU_ACTION_PAGE_DOWN; + } + + return LIST_NOTHING_CHOSEN; + } + + return LIST_NOTHING_CHOSEN; +} + +void ListMenu_Free(ListMenu *menu, u16 *outListPos, u16 *outCursorPos) +{ + if (outListPos != NULL) { + *outListPos = menu->listPos; + } + + if (outCursorPos != NULL) { + *outCursorPos = menu->cursorPos; + } + + ColoredArrow_Free(menu->cursor); + Heap_FreeToHeapExplicit(menu->heapID, menu); +} + +void ListMenu_Draw(ListMenu *menu) +{ + Window_FillTilemap(menu->template.window, menu->template.textColorBg); + PrintEntries(menu, menu->listPos, 0, menu->template.maxDisplay); + PrintCursor(menu); + Window_CopyToVRAM(menu->template.window); +} + +void ListMenu_SetTextColors(ListMenu *menu, u8 fg, u8 bg, u8 shadow) +{ + menu->template.textColorFg = fg; + menu->template.textColorBg = bg; + menu->template.textColorShadow = shadow; +} + +u32 ListMenu_TestInput(ListMenu *menu, ListMenuTemplate *template, u16 listPos, u16 cursorPos, u16 updateCursor, u16 input, u16 *outListPos, u16 *outCursorPos) +{ + if (template) { + menu->template = *template; + } + + menu->listPos = listPos; + menu->cursorPos = cursorPos; + menu->dummy2C = 0; + menu->dummy2D = 0; + + if (input == PAD_KEY_UP) { + UpdateSelectedRow(menu, updateCursor, 1, 0); + } else if (input == PAD_KEY_DOWN) { + UpdateSelectedRow(menu, updateCursor, 1, 1); + } + + if (outListPos != NULL) { + *outListPos = menu->listPos; + } + + if (outCursorPos != NULL) { + *outCursorPos = menu->cursorPos; + } + + return LIST_NOTHING_CHOSEN; +} + +void ListMenu_SetAltTextColors(ListMenu *menu, u8 fg, u8 bg, u8 shadow) +{ + menu->altFont.textColorFg = fg; + menu->altFont.textColorBg = bg; + menu->altFont.textColorShadow = shadow; + menu->altFont.prefer = TRUE; +} + +void ListMenu_CalcTrueCursorPos(ListMenu *menu, u16 *outPos) +{ + *outPos = menu->listPos + menu->cursorPos; +} + +void ListMenu_GetListAndCursorPos(ListMenu *menu, u16 *outListPos, u16 *outCursorPos) +{ + if (outListPos != NULL) { + *outListPos = menu->listPos; + } + + if (outCursorPos != NULL) { + *outCursorPos = menu->cursorPos; + } +} + +u8 ListMenu_GetLastAction(ListMenu *menu) +{ + return menu->lastAction; +} + +u32 ListMenu_GetIndexOfChoice(ListMenu *menu, u16 choice) +{ + return menu->template.choices[choice].index; +} + +u32 ListMenu_GetAttribute(ListMenu *menu, u8 attribute) +{ + u32 result; + + switch (attribute) { + case LIST_MENU_CURSOR_CALLBACK: + result = (u32)menu->template.cursorCallback; + break; + + case LIST_MENU_PRINT_CALLBACK: + result = (u32)menu->template.printCallback; + break; + + case LIST_MENU_COUNT: + result = menu->template.count; + break; + + case LIST_MENU_MAX_DISPLAY: + result = menu->template.maxDisplay; + break; + + case LIST_MENU_HEADER_X_OFFSET: + result = menu->template.headerXOffset; + break; + + case LIST_MENU_TEXT_X_OFFSET: + result = menu->template.textXOffset; + break; + + case LIST_MENU_CURSOR_X_OFFSET: + result = menu->template.cursorXOffset; + break; + + case LIST_MENU_Y_OFFSET: + result = menu->template.yOffset; + break; + + case LIST_MENU_LINE_HEIGHT: + result = Font_GetAttribute(menu->template.fontID, FONTATTR_MAX_LETTER_HEIGHT) + menu->template.lineSpacing; + break; + + case LIST_MENU_TEXT_COLOR_FG: + result = menu->template.textColorFg; + break; + + case LIST_MENU_TEXT_COLOR_BG: + result = menu->template.textColorBg; + break; + + case LIST_MENU_TEXT_COLOR_SHADOW: + result = menu->template.textColorShadow; + break; + + case LIST_MENU_LETTER_SPACING: + result = menu->template.letterSpacing; + break; + + case LIST_MENU_LINE_SPACING: + result = menu->template.lineSpacing; + break; + + case LIST_MENU_PAGER_MODE: + result = menu->template.pagerMode; + break; + + case LIST_MENU_FONT_ID: + result = menu->template.fontID; + break; + + case LIST_MENU_CURSOR_TYPE: + result = menu->template.cursorType; + break; + + case LIST_MENU_WINDOW: + result = (u32)menu->template.window; + break; + + case LIST_MENU_TMP: + result = (u32)menu->template.tmp; + break; + + default: + result = LIST_NOTHING_CHOSEN; + } + + return result; +} + +void ListMenu_SetChoices(ListMenu *menu, StringList *choices) +{ + menu->template.choices = choices; +} + +static void PrintEntry(ListMenu *menu, void *strbuf, u8 xOffset, u8 yOffset) +{ + if (strbuf == NULL) { + return; + } + + if (menu->altFont.prefer) { + Text_AddPrinterWithParamsColorAndSpacing(menu->template.window, + menu->altFont.fontID, + strbuf, + xOffset, + yOffset, + TEXT_SPEED_NO_TRANSFER, + TEXT_COLOR(menu->altFont.textColorFg, menu->altFont.textColorShadow, menu->altFont.textColorBg), + menu->altFont.letterSpacing, + 0, + NULL); + } else { + Text_AddPrinterWithParamsColorAndSpacing(menu->template.window, + menu->template.fontID, + strbuf, + xOffset, + yOffset, + TEXT_SPEED_NO_TRANSFER, + TEXT_COLOR(menu->template.textColorFg, menu->template.textColorShadow, menu->template.textColorBg), + menu->template.letterSpacing, + 0, + NULL); + } +} + +static void PrintEntries(ListMenu *menu, u16 startIndex, u16 lineOffset, u16 lineCount) +{ + u8 lineHeight = Font_GetAttribute(menu->template.fontID, FONTATTR_MAX_LETTER_HEIGHT) + menu->template.lineSpacing; + + for (int line = 0; line < lineCount; line++) { + u8 xOffset; + if (menu->template.choices[startIndex].index != LIST_HEADER) { + xOffset = menu->template.textXOffset; + } else { + xOffset = menu->template.headerXOffset; + } + + u8 yOffset = ((line + lineOffset) * lineHeight) + menu->template.yOffset; + + if (menu->template.printCallback != NULL) { + menu->template.printCallback(menu, menu->template.choices[startIndex].index, yOffset); + } + + PrintEntry(menu, (void *)menu->template.choices[startIndex].entry, xOffset, yOffset); + startIndex++; + } +} + +static void PrintCursor(ListMenu *menu) +{ + u8 lineHeight = Font_GetAttribute(menu->template.fontID, FONTATTR_MAX_LETTER_HEIGHT) + menu->template.lineSpacing; + u8 x = menu->template.cursorXOffset; + u8 y = (menu->cursorPos * lineHeight) + menu->template.yOffset; + + // This does not match as a basic if-check. + switch (menu->template.cursorType) { + case 0: + ColoredArrow_Print(menu->cursor, menu->template.window, x, y); + break; + + case 1: + case 2: + case 3: + break; + } +} + +static void EraseCursor(ListMenu *menu, u16 atLine) +{ + u8 lineHeight; + switch (menu->template.cursorType) { + case 0: + lineHeight = Font_GetAttribute(menu->template.fontID, FONTATTR_MAX_LETTER_HEIGHT) + menu->template.lineSpacing; + Window_FillRectWithColor(menu->template.window, + menu->template.textColorBg, + menu->template.cursorXOffset, + atLine * lineHeight + menu->template.yOffset, + 8, + 16); + break; + + case 1: + case 2: + case 3: + break; + } +} + +static u8 UpdateOffsetsForScroll(ListMenu *menu, u8 movingDown) +{ + u16 listPos, cursorPos, newListPos; + cursorPos = menu->cursorPos; + listPos = menu->listPos; + + if (!movingDown) { + if (menu->template.maxDisplay == 1) { + newListPos = 0; + } else { + newListPos = menu->template.maxDisplay - ((menu->template.maxDisplay / 2) + (menu->template.maxDisplay % 2)) - 1; + } + + if (listPos == 0) { + while (cursorPos > 0) { + cursorPos--; + if (menu->template.choices[listPos + cursorPos].index != LIST_HEADER) { + menu->cursorPos = cursorPos; + return 1; + } + } + + return 0; + } + + while (cursorPos > newListPos) { + cursorPos--; + if (menu->template.choices[listPos + cursorPos].index != LIST_HEADER) { + menu->cursorPos = cursorPos; + return 1; + } + } + + listPos--; + + menu->cursorPos = newListPos; + menu->listPos = listPos; + } else { + if (menu->template.maxDisplay == 1) { + newListPos = 0; + } else { + newListPos = (u16)((menu->template.maxDisplay / 2) + (menu->template.maxDisplay % 2)); + } + + if (listPos == (menu->template.count - menu->template.maxDisplay)) { + while (cursorPos < (menu->template.maxDisplay - 1)) { + cursorPos++; + + if (menu->template.choices[listPos + cursorPos].index != LIST_HEADER) { + menu->cursorPos = cursorPos; + return 1; + } + } + + return 0; + } + + while (cursorPos < newListPos) { + cursorPos++; + + if (menu->template.choices[listPos + cursorPos].index != LIST_HEADER) { + menu->cursorPos = cursorPos; + return 1; + } + } + + listPos++; + + menu->cursorPos = newListPos; + menu->listPos = listPos; + } + + return 2; +} + +static void ScrollList(ListMenu *menu, u8 lineCount, u8 movingDown) +{ + if (lineCount >= menu->template.maxDisplay) { + Window_FillTilemap(menu->template.window, menu->template.textColorBg); + PrintEntries(menu, menu->listPos, 0, menu->template.maxDisplay); + return; + } + + u8 lineHeight = Font_GetAttribute(menu->template.fontID, FONTATTR_MAX_LETTER_HEIGHT) + menu->template.lineSpacing; + + if (!movingDown) { + Window_Scroll(menu->template.window, SCROLL_DIRECTION_DOWN, lineCount * lineHeight, PIXEL_FILL(menu->template.textColorBg)); + PrintEntries(menu, menu->listPos, 0, lineCount); + + u16 y = (u16)(menu->template.maxDisplay * lineHeight + menu->template.yOffset); + Window_FillRectWithColor(menu->template.window, + menu->template.textColorBg, + 0, + y, + Window_GetWidth(menu->template.window) * 8, + Window_GetHeight(menu->template.window) * 8 - y); + } else { + Window_Scroll(menu->template.window, SCROLL_DIRECTION_UP, lineCount * lineHeight, PIXEL_FILL(menu->template.textColorBg)); + PrintEntries(menu, menu->listPos + (menu->template.maxDisplay - lineCount), menu->template.maxDisplay - lineCount, lineCount); + Window_FillRectWithColor(menu->template.window, + menu->template.textColorBg, + 0, + 0, + Window_GetWidth(menu->template.window) * 8, + menu->template.yOffset); + } +} + +static u8 UpdateSelectedRow(ListMenu *menu, u8 updateCursor, u8 scrollCount, u8 movingDown) +{ + u8 i, ret; + u16 cursorPos = menu->cursorPos; + u8 linesScrolled = 0; + u8 selectionChange = 0; + + for (i = 0; i < scrollCount; i++) { + do { + ret = UpdateOffsetsForScroll(menu, movingDown); + selectionChange |= ret; + if (ret != 2) { + break; + } + + linesScrolled++; + } while (menu->template.choices[menu->listPos + menu->cursorPos].index == LIST_HEADER); + } + + if (updateCursor) { + switch (selectionChange) { + default: + case 0: + return TRUE; + break; + + case 1: + EraseCursor(menu, cursorPos); + PrintCursor(menu); + InvokeCursorCallback(menu, FALSE); + Window_CopyToVRAM(menu->template.window); + break; + + case 2: + case 3: + EraseCursor(menu, cursorPos); + ScrollList(menu, linesScrolled, movingDown); + PrintCursor(menu); + InvokeCursorCallback(menu, FALSE); + Window_CopyToVRAM(menu->template.window); + break; + } + } + + return FALSE; +} + +static void InvokeCursorCallback(ListMenu *menu, u8 onInit) +{ + if (menu->template.cursorCallback != NULL) { + menu->template.cursorCallback(menu, menu->template.choices[menu->listPos + menu->cursorPos].index, onInit); + } +} diff --git a/src/menu.c b/src/menu.c new file mode 100644 index 0000000000..6f2571425e --- /dev/null +++ b/src/menu.c @@ -0,0 +1,489 @@ +#include "menu.h" + +#include +#include + +#include "consts/sdat.h" + +#include "gmm/message_bank_common_strings_2.h" +#include "text/pl_msg.naix" + +#include "bg_window.h" +#include "colored_arrow.h" +#include "core_sys.h" +#include "font.h" +#include "heap.h" +#include "message.h" +#include "string_list.h" +#include "text.h" +#include "unk_02005474.h" +#include "unk_0200DA60.h" + +static BOOL TryMovingCursorAndPlaySound(Menu *menu, u8 direction, u16 sound); +static u8 TryMovingCursor(Menu *menu, u8 direction); +static u8 CalcMaxEntryWidth(Menu *menu); +static void DrawWholeMenu(Menu *menu); +static void DrawCursor(Menu *menu); +static void CalcCursorDrawCoords(Menu *menu, u8 *outX, u8 *outY, u8 cursorPos); + +Menu *Menu_New(const MenuTemplate *template, u8 xOffset, u8 yOffset, u8 cursorStart, u8 heapID, u32 cancelKeys) +{ + Menu *menu = Heap_AllocFromHeap(heapID, sizeof(Menu)); + + menu->template = *template; + menu->cursor = ColoredArrow_New(heapID); + menu->cancelKeys = cancelKeys; + menu->cursorPos = cursorStart; + menu->width = CalcMaxEntryWidth(menu); + menu->heapID = heapID; + menu->xOffset = xOffset; + menu->yOffset = yOffset; + menu->letterWidth = Font_GetAttribute(template->fontID, FONTATTR_MAX_LETTER_WIDTH) + Font_GetAttribute(template->fontID, FONTATTR_LETTER_SPACING); + menu->lineHeight = Font_GetAttribute(template->fontID, FONTATTR_MAX_LETTER_HEIGHT) + Font_GetAttribute(template->fontID, FONTATTR_LINE_SPACING); + + DrawWholeMenu(menu); + DrawCursor(menu); + + return menu; +} + +Menu *Menu_NewAndCopyToVRAM(const MenuTemplate *template, u8 xOffset, u8 yOffset, u8 cursorStart, u8 heapID, u32 cancelKeys) +{ + Menu *menu = Menu_New(template, xOffset, yOffset, cursorStart, heapID, cancelKeys); + Window_CopyToVRAM(menu->template.window); + + return menu; +} + +Menu *Menu_NewSimple(const MenuTemplate *template, u8 cursorStart, u8 heapID) +{ + return Menu_NewAndCopyToVRAM(template, Font_GetAttribute(template->fontID, FONTATTR_MAX_LETTER_WIDTH), 0, cursorStart, heapID, PAD_BUTTON_B); +} + +void Menu_Free(Menu *menu, u8 *outCursorPos) +{ + if (outCursorPos != NULL) { + *outCursorPos = menu->cursorPos; + } + + ColoredArrow_Free(menu->cursor); + Heap_FreeToHeapExplicit(menu->heapID, menu); +} + +u32 Menu_ProcessInput(Menu *menu) +{ + menu->lastAction = MENU_ACTION_NONE; + + if (JOY_NEW(PAD_BUTTON_A)) { + Sound_PlayEffect(SEQ_SE_CONFIRM); + return menu->template.choices[menu->cursorPos].index; + } + + if (JOY_NEW(menu->cancelKeys)) { + Sound_PlayEffect(SEQ_SE_CONFIRM); + return MENU_CANCELED; + } + + if (JOY_NEW(PAD_KEY_UP)) { + if (TryMovingCursorAndPlaySound(menu, SCROLL_DIRECTION_UP, SEQ_SE_CONFIRM) == TRUE) { + menu->lastAction = MENU_ACTION_MOVE_UP; + } + + return MENU_NOTHING_CHOSEN; + } + + if (JOY_NEW(PAD_KEY_DOWN)) { + if (TryMovingCursorAndPlaySound(menu, SCROLL_DIRECTION_DOWN, SEQ_SE_CONFIRM) == TRUE) { + menu->lastAction = MENU_ACTION_MOVE_DOWN; + } + + return MENU_NOTHING_CHOSEN; + } + + if (JOY_NEW(PAD_KEY_LEFT)) { + if (TryMovingCursorAndPlaySound(menu, SCROLL_DIRECTION_LEFT, SEQ_SE_CONFIRM) == TRUE) { + menu->lastAction = MENU_ACTION_MOVE_LEFT; + } + + return MENU_NOTHING_CHOSEN; + } + + if (JOY_NEW(PAD_KEY_RIGHT)) { + if (TryMovingCursorAndPlaySound(menu, SCROLL_DIRECTION_RIGHT, SEQ_SE_CONFIRM) == TRUE) { + menu->lastAction = MENU_ACTION_MOVE_RIGHT; + } + + return MENU_NOTHING_CHOSEN; + } + + return MENU_NOTHING_CHOSEN; +} + +u32 Menu_ProcessInputWithSound(Menu *menu, u16 sdatID) +{ + menu->lastAction = MENU_ACTION_NONE; + + if (JOY_NEW(PAD_BUTTON_A)) { + Sound_PlayEffect(SEQ_SE_CONFIRM); + return menu->template.choices[menu->cursorPos].index; + } + + if (JOY_NEW(menu->cancelKeys)) { + Sound_PlayEffect(SEQ_SE_CONFIRM); + return MENU_CANCELED; + } + + if (JOY_NEW(PAD_KEY_UP)) { + if (TryMovingCursorAndPlaySound(menu, SCROLL_DIRECTION_UP, sdatID) == TRUE) { + menu->lastAction = MENU_ACTION_MOVE_UP; + } + + return MENU_NOTHING_CHOSEN; + } + + if (JOY_NEW(PAD_KEY_DOWN)) { + if (TryMovingCursorAndPlaySound(menu, SCROLL_DIRECTION_DOWN, sdatID) == TRUE) { + menu->lastAction = MENU_ACTION_MOVE_DOWN; + } + + return MENU_NOTHING_CHOSEN; + } + + if (JOY_NEW(PAD_KEY_LEFT)) { + if (TryMovingCursorAndPlaySound(menu, SCROLL_DIRECTION_LEFT, sdatID) == TRUE) { + menu->lastAction = MENU_ACTION_MOVE_LEFT; + } + + return MENU_NOTHING_CHOSEN; + } + + if (JOY_NEW(PAD_KEY_RIGHT)) { + if (TryMovingCursorAndPlaySound(menu, SCROLL_DIRECTION_RIGHT, sdatID) == TRUE) { + menu->lastAction = MENU_ACTION_MOVE_RIGHT; + } + + return MENU_NOTHING_CHOSEN; + } + + return MENU_NOTHING_CHOSEN; +} + +u32 Menu_ProcessExternalInput(Menu *menu, u8 input) +{ + switch (input) { + case MENU_INPUT_CONFIRM: + Sound_PlayEffect(SEQ_SE_CONFIRM); + return menu->template.choices[menu->cursorPos].index; + + case MENU_INPUT_CANCEL: + Sound_PlayEffect(SEQ_SE_CONFIRM); + return 0xfffffffe; + + case MENU_INPUT_MOVE_UP: + TryMovingCursorAndPlaySound(menu, SCROLL_DIRECTION_UP, SEQ_SE_CONFIRM); + return MENU_NOTHING_CHOSEN; + + case MENU_INPUT_MOVE_DOWN: + TryMovingCursorAndPlaySound(menu, SCROLL_DIRECTION_DOWN, SEQ_SE_CONFIRM); + return MENU_NOTHING_CHOSEN; + + case MENU_INPUT_MOVE_LEFT: + TryMovingCursorAndPlaySound(menu, SCROLL_DIRECTION_LEFT, SEQ_SE_CONFIRM); + return MENU_NOTHING_CHOSEN; + + case MENU_INPUT_MOVE_RIGHT: + TryMovingCursorAndPlaySound(menu, SCROLL_DIRECTION_RIGHT, SEQ_SE_CONFIRM); + return MENU_NOTHING_CHOSEN; + } + + return MENU_NOTHING_CHOSEN; +} + +u8 Menu_GetCursorPos(Menu *menu) +{ + return menu->cursorPos; +} + +u8 Menu_GetLastAction(Menu *menu) +{ + return menu->lastAction; +} + +static BOOL TryMovingCursorAndPlaySound(Menu *menu, u8 direction, u16 sound) +{ + u8 oldCursorPos = menu->cursorPos; + if (TryMovingCursor(menu, direction) == FALSE) { + return FALSE; + } + + u8 bgColor = Font_GetAttribute(menu->template.fontID, FONTATTR_BG_COLOR); + + u8 x, y; + CalcCursorDrawCoords(menu, &x, &y, oldCursorPos); + Window_FillRectWithColor(menu->template.window, bgColor, x, y, 8, menu->lineHeight); + + DrawCursor(menu); + Sound_PlayEffect(sound); + + return TRUE; +} + +static u8 TryMovingCursor(Menu *menu, u8 direction) +{ + s8 newCursorPos; + + if (direction == SCROLL_DIRECTION_UP) { + if (menu->template.ySize <= 1) { + return FALSE; + } + + if (menu->cursorPos % menu->template.ySize == 0) { + if (menu->template.loopAround == FALSE) { + return FALSE; + } + + newCursorPos = menu->cursorPos + (menu->template.ySize - 1); + } else { + newCursorPos = menu->cursorPos - 1; + } + } else if (direction == SCROLL_DIRECTION_DOWN) { + if (menu->template.ySize <= 1) { + return FALSE; + } + + if (menu->cursorPos % menu->template.ySize == menu->template.ySize - 1) { + if (menu->template.loopAround == FALSE) { + return FALSE; + } + + newCursorPos = menu->cursorPos - (menu->template.ySize - 1); + } else { + newCursorPos = menu->cursorPos + 1; + } + } else if (direction == SCROLL_DIRECTION_LEFT) { + if (menu->template.xSize <= 1) { + return FALSE; + } + + if (menu->cursorPos < menu->template.ySize) { + if (menu->template.loopAround == FALSE) { + return FALSE; + } + + newCursorPos = menu->cursorPos + (menu->template.ySize * (menu->template.xSize - 1)); + } else { + newCursorPos = menu->cursorPos - menu->template.ySize; + } + } else { + if (menu->template.xSize <= 1) { + return FALSE; + } + + if (menu->cursorPos >= menu->template.ySize * (menu->template.xSize - 1)) { + if (menu->template.loopAround == FALSE) { + return FALSE; + } + + newCursorPos = menu->cursorPos % menu->template.ySize; + } else { + newCursorPos = menu->cursorPos + menu->template.ySize; + } + } + + if (menu->template.choices[newCursorPos].index == MENU_DUMMY) { + return FALSE; + } + + menu->cursorPos = newCursorPos; + return TRUE; +} + +static u8 CalcMaxEntryWidth(Menu *menu) +{ + u8 maxWidth = 0; + + u8 width; + for (u8 i = 0; i < menu->template.xSize * menu->template.ySize; i++) { + width = Font_CalcStrbufWidth(menu->template.fontID, menu->template.choices[i].entry, 0); + + if (maxWidth < width) { + maxWidth = width; + } + } + + return maxWidth; +} + +static void DrawWholeMenu(Menu *menu) +{ + const void *entry; + u8 x, y, dx; + u8 i, j; + + Window_FillTilemap(menu->template.window, Font_GetAttribute(menu->template.fontID, FONTATTR_BG_COLOR)); + + x = menu->xOffset; + dx = menu->width + menu->letterWidth * 2; + + for (i = 0; i < menu->template.xSize; i++) { + for (j = 0; j < menu->template.ySize; j++) { + entry = menu->template.choices[i * menu->template.ySize + j].entry; + y = (menu->lineHeight + menu->template.lineSpacing) * j + menu->yOffset; + + Text_AddPrinterWithParams(menu->template.window, menu->template.fontID, entry, x, y, TEXT_SPEED_NO_TRANSFER, NULL); + } + + x += dx; + } +} + +static void DrawCursor(Menu *menu) +{ + if (menu->template.suppressCursor == TRUE) { + return; + } + + u8 x, y; + CalcCursorDrawCoords(menu, &x, &y, menu->cursorPos); + ColoredArrow_Print(menu->cursor, menu->template.window, x, y); +} + +static void CalcCursorDrawCoords(Menu *menu, u8 *outX, u8 *outY, u8 cursorPos) +{ + *outX = (cursorPos / menu->template.ySize) * (menu->width + menu->letterWidth * 2); + *outY = (cursorPos % menu->template.ySize) * (menu->lineHeight + menu->template.lineSpacing) + menu->yOffset; +} + +Menu *Menu_MakeYesNoChoiceWithCursorAt(BgConfig *bgConfig, const WindowTemplate *winTemplate, u16 borderTileStart, u8 borderPalette, u8 cursorStart, u32 heapID) +{ + MenuTemplate menuTemplate; + MessageLoader *msgLoader; + StringList *choices; + + msgLoader = MessageLoader_Init(MESSAGE_LOADER_NARC_HANDLE, NARC_INDEX_MSGDATA__PL_MSG, message_bank_common_strings_2, heapID); + choices = StringList_New(2, heapID); + + StringList_AddFromMessageBank(choices, msgLoader, pl_msg_00000361_00041, 0); + StringList_AddFromMessageBank(choices, msgLoader, pl_msg_00000361_00042, MENU_CANCELED); + MessageLoader_Free(msgLoader); + + menuTemplate.choices = choices; + menuTemplate.window = Window_New(heapID, 1); + menuTemplate.fontID = FONT_SYSTEM; + menuTemplate.xSize = 1; + menuTemplate.ySize = 2; + menuTemplate.lineSpacing = 0; + menuTemplate.suppressCursor = FALSE; + menuTemplate.loopAround = FALSE; + + Window_AddFromTemplate(bgConfig, menuTemplate.window, winTemplate); + Window_Show(menuTemplate.window, 1, borderTileStart, borderPalette); + + return Menu_NewAndCopyToVRAM(&menuTemplate, 8, 0, cursorStart, heapID, PAD_BUTTON_B); +} + +Menu *Menu_MakeYesNoChoice(BgConfig *bgConfig, const WindowTemplate *winTemplate, u16 borderTileStart, u8 borderPalette, u32 heapID) +{ + return Menu_MakeYesNoChoiceWithCursorAt(bgConfig, winTemplate, borderTileStart, borderPalette, 0, heapID); +} + +u32 Menu_ProcessInputAndHandleExit(Menu *menu, u32 heapID) +{ + u32 result = Menu_ProcessInput(menu); + if (result != MENU_NOTHING_CHOSEN) { + Menu_DestroyForExit(menu, heapID); + } + + return result; +} + +u32 Menu_ProcessExternalInputAndHandleExit(Menu *menu, u8 input, u32 heapID) +{ + u32 result = Menu_ProcessExternalInput(menu, input); + if (result != MENU_NOTHING_CHOSEN) { + Menu_DestroyForExit(menu, heapID); + } + + return result; +} + +void Menu_DestroyForExit(Menu *menu, u32 heapID) +{ + Window_Clear(menu->template.window, 0); + Window_Remove(menu->template.window); + Heap_FreeToHeapExplicit(heapID, menu->template.window); + StringList_Free(menu->template.choices); + Menu_Free(menu, NULL); +} + +static const u8 sArrowCursorBitmap[] = { + 0xff, + 0xff, + 0xff, + 0x0, + 0xff, + 0xff, + 0xff, + 0x0, + 0x21, + 0xff, + 0xff, + 0x0, + 0x11, + 0xf2, + 0xff, + 0x0, + 0x11, + 0x21, + 0xff, + 0x0, + 0x11, + 0x11, + 0xf2, + 0x0, + 0x11, + 0x11, + 0x21, + 0x0, + 0x11, + 0x11, + 0x22, + 0x0, + 0x11, + 0x21, + 0xf2, + 0x0, + 0x11, + 0x22, + 0xff, + 0x0, + 0x21, + 0xf2, + 0xff, + 0x0, + 0x22, + 0xff, + 0xff, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0 +}; + +void Window_DrawMenuCursor(Window *window, u32 x, u32 y) +{ + Window_BlitBitmapRect(window, (void *)sArrowCursorBitmap, 0, 0, 8, 16, x, y, 8, 16); +} diff --git a/src/meson.build b/src/meson.build index 764ff7f956..003e23cf0b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -15,8 +15,8 @@ pokeplatinum_c = files( 'party.c', 'poffin.c', 'strbuf.c', - 'unk_0200112C.c', - 'unk_02001AF4.c', + 'list_menu.c', + 'menu.c', 'charcode_util.c', 'render_text.c', 'font.c', @@ -47,7 +47,7 @@ pokeplatinum_c = files( 'unk_02012744.c', 'unk_020131EC.c', 'rtc.c', - 'unk_02013A04.c', + 'string_list.c', 'screen_scroll_manager.c', 'unk_02014000.c', 'colored_arrow.c', diff --git a/src/overlay005/ov5_021DC018.c b/src/overlay005/ov5_021DC018.c index e1e183ed0a..7e8994caa1 100644 --- a/src/overlay005/ov5_021DC018.c +++ b/src/overlay005/ov5_021DC018.c @@ -3,31 +3,25 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" -#include "struct_decls/struct_02013A04_decl.h" -#include "struct_defs/struct_02013A04_t.h" -#include "struct_defs/struct_02081CF4.h" - #include "field/field_system.h" #include "overlay005/struct_ov5_021DC1A4_decl.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "bg_window.h" #include "coins.h" #include "core_sys.h" #include "font.h" #include "heap.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "save_player.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "sys_task.h" #include "sys_task_manager.h" #include "text.h" #include "trainer_info.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" @@ -57,14 +51,14 @@ struct UnkStruct_ov5_021DC1A4_t { u16 *unk_A0; u16 *unk_A4; u16 *unk_A8; - UnkStruct_02081CF4 unk_AC; - UIControlData *unk_B8; - ResourceMetadata unk_BC[28]; - UnkStruct_ov84_02240FA8 unk_19C; - BmpList *unk_1BC; + MenuTemplate unk_AC; + Menu *unk_B8; + StringList unk_BC[28]; + ListMenuTemplate unk_19C; + ListMenu *unk_1BC; u16 unk_1C0; u16 unk_1C2; - ResourceMetadata unk_1C4[28]; + StringList unk_1C4[28]; u16 unk_2A4[28]; u16 unk_2DC; }; @@ -87,8 +81,8 @@ static void ov5_021DC530(UnkStruct_ov5_021DC1A4 *param0, u32 param1); static void ov5_021DC708(UnkStruct_ov5_021DC1A4 *param0, u32 param1, u32 param2, u32 param3); static u32 ov5_021DC7A8(UnkStruct_ov5_021DC1A4 *param0); static void ov5_021DC7E4(UnkStruct_ov5_021DC1A4 *param0); -static void ov5_021DC8F4(BmpList *param0, u32 param1, u8 param2); -static void ov5_021DC918(BmpList *param0, u32 param1, u8 param2); +static void ov5_021DC8F4(ListMenu *param0, u32 param1, u8 param2); +static void ov5_021DC918(ListMenu *param0, u32 param1, u8 param2); static void ov5_021DC95C(SysTask *param0, void *param1); static void ov5_021DCA28(UnkStruct_ov5_021DC1A4 *param0); static void ov5_021DCA90(UnkStruct_ov5_021DC1A4 *param0, u16 param1, u32 param2); @@ -132,13 +126,13 @@ static void ov5_021DC018(FieldSystem *fieldSystem, UnkStruct_ov5_021DC1A4 *param param1->unk_2DC = param4; for (v0 = 0; v0 < 28; v0++) { - param1->unk_BC[v0].unk_00 = NULL; - param1->unk_BC[v0].unk_04 = 0; + param1->unk_BC[v0].entry = NULL; + param1->unk_BC[v0].index = 0; } for (v0 = 0; v0 < 28; v0++) { - param1->unk_1C4[v0].unk_00 = NULL; - param1->unk_1C4[v0].unk_04 = 0; + param1->unk_1C4[v0].entry = NULL; + param1->unk_1C4[v0].index = 0; param1->unk_2A4[v0] = 0xff; } @@ -200,7 +194,7 @@ void ov5_021DC1AC(UnkStruct_ov5_021DC1A4 *param0) ov5_021DC33C(param0); - param0->unk_B8 = sub_02001B9C(¶m0->unk_AC, param0->unk_96, 4); + param0->unk_B8 = Menu_NewSimple(¶m0->unk_AC, param0->unk_96, 4); param0->unk_04 = SysTask_Start(ov5_021DC3B0, param0, 0); return; @@ -216,11 +210,11 @@ static void ov5_021DC290(UnkStruct_ov5_021DC1A4 *param0, u32 param1, u32 param2) MessageLoader_GetStrbuf(param0->unk_8C, param1, v2); StringTemplate_Format(param0->unk_90, param0->unk_1C[param0->unk_9B], v2); - param0->unk_BC[param0->unk_9B].unk_00 = (const void *)param0->unk_1C[param0->unk_9B]; + param0->unk_BC[param0->unk_9B].entry = (const void *)param0->unk_1C[param0->unk_9B]; Strbuf_Free(v2); } - param0->unk_BC[param0->unk_9B].unk_04 = param2; + param0->unk_BC[param0->unk_9B].index = param2; param0->unk_9B++; return; @@ -235,11 +229,11 @@ static u32 ov5_021DC300(UnkStruct_ov5_021DC1A4 *param0) v2 = 0; for (v0 = 0; v0 < param0->unk_9B; v0++) { - if (param0->unk_BC[v0].unk_00 == NULL) { + if (param0->unk_BC[v0].entry == NULL) { break; } - v1 = Font_CalcStringWidthWithCursorControl(FONT_SYSTEM, (Strbuf *)param0->unk_BC[v0].unk_00); + v1 = Font_CalcStringWidthWithCursorControl(FONT_SYSTEM, (Strbuf *)param0->unk_BC[v0].entry); if (v2 < v1) { v2 = v1; @@ -251,18 +245,18 @@ static u32 ov5_021DC300(UnkStruct_ov5_021DC1A4 *param0) static void ov5_021DC33C(UnkStruct_ov5_021DC1A4 *param0) { - param0->unk_AC.unk_00 = param0->unk_BC; - param0->unk_AC.unk_04 = ¶m0->unk_08; - param0->unk_AC.unk_08 = 0; - param0->unk_AC.unk_09 = 1; - param0->unk_AC.unk_0A = param0->unk_9B; - param0->unk_AC.unk_0B_0 = 0; - param0->unk_AC.unk_0B_4 = 0; + param0->unk_AC.choices = param0->unk_BC; + param0->unk_AC.window = ¶m0->unk_08; + param0->unk_AC.fontID = FONT_SYSTEM; + param0->unk_AC.xSize = 1; + param0->unk_AC.ySize = param0->unk_9B; + param0->unk_AC.lineSpacing = 0; + param0->unk_AC.suppressCursor = FALSE; if (param0->unk_9B >= 4) { - param0->unk_AC.unk_0B_6 = 1; + param0->unk_AC.loopAround = TRUE; } else { - param0->unk_AC.unk_0B_6 = 0; + param0->unk_AC.loopAround = FALSE; } return; @@ -284,7 +278,7 @@ static void ov5_021DC3B0(SysTask *param0, void *param1) return; } - v0 = sub_02001BE0(v1->unk_B8); + v0 = Menu_ProcessInput(v1->unk_B8); switch (v0) { case 0xffffffff: @@ -309,9 +303,9 @@ void ov5_021DC424(UnkStruct_ov5_021DC1A4 *param0) int v0; Sound_PlayEffect(1500); - sub_02001BC4(param0->unk_B8, NULL); - Window_Clear(param0->unk_AC.unk_04, 0); - Window_Remove(param0->unk_AC.unk_04); + Menu_Free(param0->unk_B8, NULL); + Window_Clear(param0->unk_AC.window, 0); + Window_Remove(param0->unk_AC.window); for (v0 = 0; v0 < 28; v0++) { Strbuf_Free(param0->unk_1C[v0]); @@ -388,7 +382,7 @@ static void ov5_021DC530(UnkStruct_ov5_021DC1A4 *param0, u32 param1) Window_Show(¶m0->unk_08, 1, 1024 - (18 + 12) - 9, 11); ov5_021DC7E4(param0); - param0->unk_1BC = sub_0200112C((const UnkStruct_ov84_02240FA8 *)¶m0->unk_19C, 0, param0->unk_96, 4); + param0->unk_1BC = ListMenu_New((const ListMenuTemplate *)¶m0->unk_19C, 0, param0->unk_96, 4); ov5_021DCAF4(param0); param0->unk_04 = SysTask_Start(ov5_021DC95C, param0, 0); @@ -422,7 +416,7 @@ void ov5_021DC600(UnkStruct_ov5_021DC1A4 *param0, u16 *param1, u16 *param2) param0->unk_A4 = param1; param0->unk_A8 = param2; param0->unk_2DC = ((*param0->unk_A4) + (*param0->unk_A8)); - param0->unk_1BC = sub_0200112C((const UnkStruct_ov84_02240FA8 *)¶m0->unk_19C, *param1, *param2, 4); + param0->unk_1BC = ListMenu_New((const ListMenuTemplate *)¶m0->unk_19C, *param1, *param2, 4); ov5_021DCAF4(param0); @@ -440,14 +434,14 @@ static void ov5_021DC708(UnkStruct_ov5_021DC1A4 *param0, u32 param1, u32 param2, MessageLoader_GetStrbuf(param0->unk_8C, param1, v2); StringTemplate_Format(param0->unk_90, param0->unk_1C[param0->unk_9B], v2); - param0->unk_1C4[param0->unk_9B].unk_00 = (const void *)param0->unk_1C[param0->unk_9B]; + param0->unk_1C4[param0->unk_9B].entry = (const void *)param0->unk_1C[param0->unk_9B]; Strbuf_Free(v2); } if (param3 == 0xfa) { - param0->unk_1C4[param0->unk_9B].unk_04 = 0xfffffffd; + param0->unk_1C4[param0->unk_9B].index = 0xfffffffd; } else { - param0->unk_1C4[param0->unk_9B].unk_04 = param3; + param0->unk_1C4[param0->unk_9B].index = param3; } param0->unk_2A4[param0->unk_9B] = param2; @@ -465,11 +459,11 @@ static u32 ov5_021DC7A8(UnkStruct_ov5_021DC1A4 *param0) v2 = 0; for (v0 = 0; v0 < param0->unk_9B; v0++) { - if (param0->unk_1C4[v0].unk_00 == NULL) { + if (param0->unk_1C4[v0].entry == NULL) { break; } - v1 = Font_CalcStringWidthWithCursorControl(FONT_SYSTEM, (Strbuf *)param0->unk_1C4[v0].unk_00); + v1 = Font_CalcStringWidthWithCursorControl(FONT_SYSTEM, (Strbuf *)param0->unk_1C4[v0].entry); if (v2 < v1) { v2 = v1; @@ -481,46 +475,46 @@ static u32 ov5_021DC7A8(UnkStruct_ov5_021DC1A4 *param0) static void ov5_021DC7E4(UnkStruct_ov5_021DC1A4 *param0) { - param0->unk_19C.unk_00 = param0->unk_1C4; - param0->unk_19C.unk_04 = ov5_021DC918; - param0->unk_19C.unk_08 = ov5_021DC8F4; - param0->unk_19C.unk_0C = ¶m0->unk_08; - param0->unk_19C.unk_10 = param0->unk_9B; - param0->unk_19C.unk_12 = 8; - param0->unk_19C.unk_14 = 1; - param0->unk_19C.unk_15 = 12; - param0->unk_19C.unk_16 = 2; - param0->unk_19C.unk_17_0 = 1; - param0->unk_19C.unk_17_4 = 1; - param0->unk_19C.unk_18_0 = 15; - param0->unk_19C.unk_18_4 = 2; - param0->unk_19C.unk_1A_0 = 0; - param0->unk_19C.unk_1A_3 = 16; - param0->unk_19C.unk_1A_7 = 1; - param0->unk_19C.unk_1A_9 = 0; - param0->unk_19C.unk_1A_15 = 0; - param0->unk_19C.unk_1C = (void *)param0; + param0->unk_19C.choices = param0->unk_1C4; + param0->unk_19C.cursorCallback = ov5_021DC918; + param0->unk_19C.printCallback = ov5_021DC8F4; + param0->unk_19C.window = ¶m0->unk_08; + param0->unk_19C.count = param0->unk_9B; + param0->unk_19C.maxDisplay = 8; + param0->unk_19C.headerXOffset = 1; + param0->unk_19C.textXOffset = 12; + param0->unk_19C.cursorXOffset = 2; + param0->unk_19C.yOffset = 1; + param0->unk_19C.textColorFg = 1; + param0->unk_19C.textColorBg = 15; + param0->unk_19C.textColorShadow = 2; + param0->unk_19C.letterSpacing = 0; + param0->unk_19C.lineSpacing = 0; + param0->unk_19C.pagerMode = PAGER_MODE_LEFT_RIGHT_PAD; + param0->unk_19C.fontID = FONT_SYSTEM; + param0->unk_19C.cursorType = 0; + param0->unk_19C.tmp = (void *)param0; return; } -static void ov5_021DC8F4(BmpList *param0, u32 param1, u8 param2) +static void ov5_021DC8F4(ListMenu *param0, u32 param1, u8 param2) { if (param1 == 0xfffffffd) { - sub_0200147C(param0, 3, 15, 4); + ListMenu_SetAltTextColors(param0, 3, 15, 4); } else { - sub_0200147C(param0, 1, 15, 2); + ListMenu_SetAltTextColors(param0, 1, 15, 2); } } -static void ov5_021DC918(BmpList *param0, u32 param1, u8 param2) +static void ov5_021DC918(ListMenu *param0, u32 param1, u8 param2) { u32 v0, v1; u16 v2 = 0; u16 v3 = 0; - UnkStruct_ov5_021DC1A4 *v4 = (UnkStruct_ov5_021DC1A4 *)sub_02001504(param0, 19); + UnkStruct_ov5_021DC1A4 *v4 = (UnkStruct_ov5_021DC1A4 *)ListMenu_GetAttribute(param0, 19); - sub_020014DC(param0, &v2, &v3); + ListMenu_GetListAndCursorPos(param0, &v2, &v3); if ((v4->unk_A4 != NULL) && (v4->unk_A8 != NULL)) { *v4->unk_A4 = v2; @@ -547,10 +541,10 @@ static void ov5_021DC95C(SysTask *param0, void *param1) return; } - v1 = sub_02001288(v2->unk_1BC); + v1 = ListMenu_ProcessInput(v2->unk_1BC); v0 = v2->unk_2DC; - sub_020014D0(v2->unk_1BC, &v2->unk_2DC); + ListMenu_CalcTrueCursorPos(v2->unk_1BC, &v2->unk_2DC); if (v0 != v2->unk_2DC) { Sound_PlayEffect(1500); @@ -585,8 +579,8 @@ static void ov5_021DCA28(UnkStruct_ov5_021DC1A4 *param0) int v0; Sound_PlayEffect(1500); - sub_02001384(param0->unk_1BC, NULL, NULL); - Window_Clear(param0->unk_19C.unk_0C, 0); + ListMenu_Free(param0->unk_1BC, NULL, NULL); + Window_Clear(param0->unk_19C.window, 0); Window_Remove(¶m0->unk_08); for (v0 = 0; v0 < 28; v0++) { @@ -620,7 +614,7 @@ static void ov5_021DCA90(UnkStruct_ov5_021DC1A4 *param0, u16 param1, u32 param2) static void ov5_021DCAF4(UnkStruct_ov5_021DC1A4 *param0) { - sub_020014D0(param0->unk_1BC, ¶m0->unk_1C2); + ListMenu_CalcTrueCursorPos(param0->unk_1BC, ¶m0->unk_1C2); if (param0->unk_2A4[param0->unk_1C2] != 0xff) { ov5_021DCA90(param0, param0->unk_2A4[param0->unk_1C2], 0); @@ -652,7 +646,7 @@ void ov5_021DCB24(FieldSystem *fieldSystem, u8 param1, u8 param2, u16 *param3, S ov5_021DCC00(v3, 15, 0, 0); ov5_021DCC00(v3, 16, (8 * 4), 16); - v3->unk_AC.unk_04 = &v3->unk_08; + v3->unk_AC.window = &v3->unk_08; Window_CopyToVRAM(&v3->unk_08); v3->unk_04 = SysTask_Start(ov5_021DCC64, v3, 0); @@ -681,8 +675,8 @@ static void ov5_021DCC64(SysTask *param0, void *param1) v1 = (UnkStruct_ov5_021DC1A4 *)param1; if (*v1->unk_A0 == 0xffff) { - Window_Clear(v1->unk_AC.unk_04, 0); - Window_Remove(v1->unk_AC.unk_04); + Window_Clear(v1->unk_AC.window, 0); + Window_Remove(v1->unk_AC.window); for (v0 = 0; v0 < 28; v0++) { Strbuf_Free(v1->unk_1C[v0]); @@ -790,7 +784,7 @@ void ov5_021DCD94(UnkStruct_ov5_021DC1A4 *param0, u8 param1) ov5_021DCE64(param0, param1, v1); - param0->unk_B8 = sub_02001B9C(¶m0->unk_AC, param0->unk_96, 4); + param0->unk_B8 = Menu_NewSimple(¶m0->unk_AC, param0->unk_96, 4); param0->unk_04 = SysTask_Start(ov5_021DC3B0, param0, 0); return; @@ -798,13 +792,13 @@ void ov5_021DCD94(UnkStruct_ov5_021DC1A4 *param0, u8 param1) static void ov5_021DCE64(UnkStruct_ov5_021DC1A4 *param0, u8 param1, u8 param2) { - param0->unk_AC.unk_00 = param0->unk_BC; - param0->unk_AC.unk_04 = ¶m0->unk_08; - param0->unk_AC.unk_08 = 0; - param0->unk_AC.unk_09 = param1; - param0->unk_AC.unk_0A = param2; - param0->unk_AC.unk_0B_0 = 0; - param0->unk_AC.unk_0B_4 = 0; + param0->unk_AC.choices = param0->unk_BC; + param0->unk_AC.window = ¶m0->unk_08; + param0->unk_AC.fontID = FONT_SYSTEM; + param0->unk_AC.xSize = param1; + param0->unk_AC.ySize = param2; + param0->unk_AC.lineSpacing = 0; + param0->unk_AC.suppressCursor = FALSE; return; } @@ -990,7 +984,7 @@ UnkStruct_ov5_021DC1A4 *ov5_021DD250(FieldSystem *fieldSystem, u8 param1, u8 par StringTemplate_SetNumber(param4, 0, param8, 3, 1, 1); ov5_021DCC00(v0, 277, 0, (96 + 16)); - v0->unk_AC.unk_04 = &v0->unk_08; + v0->unk_AC.window = &v0->unk_08; Window_CopyToVRAM(&v0->unk_08); return v0; @@ -1000,8 +994,8 @@ void ov5_021DD3A8(UnkStruct_ov5_021DC1A4 *param0) { int v0; - Window_Clear(param0->unk_AC.unk_04, 0); - Window_Remove(param0->unk_AC.unk_04); + Window_Clear(param0->unk_AC.window, 0); + Window_Remove(param0->unk_AC.window); for (v0 = 0; v0 < 28; v0++) { Strbuf_Free(param0->unk_1C[v0]); diff --git a/src/overlay005/ov5_021EA874.c b/src/overlay005/ov5_021EA874.c index f9573259df..723c18d60f 100644 --- a/src/overlay005/ov5_021EA874.c +++ b/src/overlay005/ov5_021EA874.c @@ -3,15 +3,10 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_0202B370_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/struct_02013A04_t.h" #include "field/field_system.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "bag.h" #include "bg_window.h" @@ -20,18 +15,18 @@ #include "field_system.h" #include "game_options.h" #include "heap.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "save_player.h" #include "savedata.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" #include "trainer_info.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200DA60.h" -#include "unk_02013A04.h" #include "unk_0202ACE0.h" #include "unk_0203061C.h" #include "unk_0203909C.h" @@ -39,8 +34,8 @@ #include "unk_0205D8CC.h" typedef struct { - ResourceMetadata *unk_00; - BmpList *unk_04; + StringList *unk_00; + ListMenu *unk_04; Strbuf *unk_08; Strbuf *unk_0C; Window unk_10; @@ -50,7 +45,7 @@ typedef struct { StringTemplate *unk_38; MessageLoader *unk_3C; int unk_40; - UIControlData *unk_44; + Menu *unk_44; int unk_48; int unk_4C[8]; int unk_6C[8]; @@ -60,7 +55,7 @@ typedef struct { static void ov5_021EAE78(UnkStruct_ov5_021EAE78 *param0, int param1); static void ov5_021EAF1C(UnkStruct_ov5_021EAE78 *param0); -static void ov5_021EAF90(BmpList *param0, u32 param1, u8 param2); +static void ov5_021EAF90(ListMenu *param0, u32 param1, u8 param2); static BOOL ov5_021EA874(UnkStruct_ov5_021EAE78 *param0) { @@ -135,7 +130,7 @@ static const WindowTemplate Unk_ov5_021FAF00 = { static BOOL ov5_021EA9BC(UnkStruct_ov5_021EAE78 *param0) { if (Text_IsPrinterActive(param0->unk_40) == 0) { - param0->unk_44 = sub_02002100(param0->fieldSystem->unk_08, &Unk_ov5_021FAF00, 1024 - (18 + 12) - 9, 11, 4); + param0->unk_44 = Menu_MakeYesNoChoice(param0->fieldSystem->unk_08, &Unk_ov5_021FAF00, 1024 - (18 + 12) - 9, 11, 4); param0->unk_48 = 3; } @@ -147,7 +142,7 @@ static BOOL ov5_021EA9F8(UnkStruct_ov5_021EAE78 *param0) DWCFriendData *v0; Strbuf *v1; int v2; - int v3 = sub_02002114(param0->unk_44, 4); + int v3 = Menu_ProcessInputAndHandleExit(param0->unk_44, 4); if (v3 == 0xffffffff) { return 0; @@ -175,7 +170,7 @@ static BOOL ov5_021EA9F8(UnkStruct_ov5_021EAE78 *param0) static BOOL ov5_021EAA6C(UnkStruct_ov5_021EAE78 *param0) { if (Text_IsPrinterActive(param0->unk_40) == 0) { - param0->unk_44 = sub_02002100(param0->fieldSystem->unk_08, &Unk_ov5_021FAF00, 1024 - (18 + 12) - 9, 11, 4); + param0->unk_44 = Menu_MakeYesNoChoice(param0->fieldSystem->unk_08, &Unk_ov5_021FAF00, 1024 - (18 + 12) - 9, 11, 4); param0->unk_48 = 5; } @@ -188,7 +183,7 @@ static BOOL ov5_021EAAA8(UnkStruct_ov5_021EAE78 *param0) DWCFriendData *v1; Strbuf *v2; int v3; - int v4 = sub_02002114(param0->unk_44, 4); + int v4 = Menu_ProcessInputAndHandleExit(param0->unk_44, 4); if (v4 == 0xffffffff) { return 0; @@ -207,7 +202,7 @@ static BOOL ov5_021EAAA8(UnkStruct_ov5_021EAE78 *param0) static BOOL ov5_021EAAEC(UnkStruct_ov5_021EAE78 *param0) { if (Text_IsPrinterActive(param0->unk_40) == 0) { - param0->unk_44 = sub_02002100(param0->fieldSystem->unk_08, &Unk_ov5_021FAF00, 1024 - (18 + 12) - 9, 11, 4); + param0->unk_44 = Menu_MakeYesNoChoice(param0->fieldSystem->unk_08, &Unk_ov5_021FAF00, 1024 - (18 + 12) - 9, 11, 4); param0->unk_48 = 7; } @@ -220,7 +215,7 @@ static BOOL ov5_021EAB28(UnkStruct_ov5_021EAE78 *param0) DWCFriendData *v1; Strbuf *v2; int v3; - int v4 = sub_02002114(param0->unk_44, 4); + int v4 = Menu_ProcessInputAndHandleExit(param0->unk_44, 4); if (v4 == 0xffffffff) { return 0; @@ -234,7 +229,7 @@ static BOOL ov5_021EAB28(UnkStruct_ov5_021EAE78 *param0) return 0; } -static const UnkStruct_ov84_02240FA8 Unk_ov5_021FAF08 = { +static const ListMenuTemplate Unk_ov5_021FAF08 = { NULL, NULL, NULL, @@ -259,11 +254,11 @@ static const UnkStruct_ov84_02240FA8 Unk_ov5_021FAF08 = { static BOOL ov5_021EAB58(UnkStruct_ov5_021EAE78 *param0) { UnkStruct_0202B370 *v0 = sub_0202B370(param0->unk_34); - UnkStruct_ov84_02240FA8 v1; + ListMenuTemplate v1; int v2 = sub_0202AF94(v0); int v3 = 5; - param0->unk_00 = sub_02013A04(v2 + 1, 4); + param0->unk_00 = StringList_New(v2 + 1, 4); Window_Add(param0->fieldSystem->unk_08, ¶m0->unk_20, 3, 19, 1, 12, v3 * 2, 13, (((1024 - (18 + 12) - 9 - (32 * 8)) - (18 + 12 + 24)) - (27 * 4)) - (10 * (v3 + 2) * 2)); Window_Show(¶m0->unk_20, 1, 1024 - (18 + 12) - 9, 11); @@ -275,23 +270,23 @@ static BOOL ov5_021EAB58(UnkStruct_ov5_021EAE78 *param0) for (v5 = 0; v5 < 32; v5++) { if (sub_0202AF78(v0, v5)) { Strbuf_CopyChars(param0->unk_08, sub_0202AEF0(v0, v5)); - sub_02013A6C(param0->unk_00, param0->unk_08, v5); + StringList_AddFromStrbuf(param0->unk_00, param0->unk_08, v5); } } - sub_02013A4C(param0->unk_00, param0->unk_3C, 11, 0xfffffffe); + StringList_AddFromMessageBank(param0->unk_00, param0->unk_3C, 11, 0xfffffffe); } v1 = Unk_ov5_021FAF08; - v1.unk_10 = v2 + 1; - v1.unk_12 = v3; - v1.unk_00 = param0->unk_00; - v1.unk_0C = ¶m0->unk_20; - v1.unk_04 = ov5_021EAF90; - v1.unk_1C = param0; + v1.count = v2 + 1; + v1.maxDisplay = v3; + v1.choices = param0->unk_00; + v1.window = ¶m0->unk_20; + v1.cursorCallback = ov5_021EAF90; + v1.tmp = param0; - param0->unk_04 = sub_0200112C(&v1, 0, 0, 4); + param0->unk_04 = ListMenu_New(&v1, 0, 0, 4); Window_CopyToVRAM(¶m0->unk_20); param0->unk_48 = 9; @@ -303,7 +298,7 @@ static BOOL ov5_021EAC44(UnkStruct_ov5_021EAE78 *param0) TrainerInfo *v0; int v1; - v1 = sub_02001288(param0->unk_04); + v1 = ListMenu_ProcessInput(param0->unk_04); switch (v1) { case 0xffffffff: @@ -335,8 +330,8 @@ static BOOL ov5_021EAC44(UnkStruct_ov5_021EAE78 *param0) Window_Clear(¶m0->unk_20, 0); Window_Remove(¶m0->unk_20); - sub_02001384(param0->unk_04, NULL, NULL); - sub_02013A3C(param0->unk_00); + ListMenu_Free(param0->unk_04, NULL, NULL); + StringList_Free(param0->unk_00); return 0; } @@ -344,7 +339,7 @@ static BOOL ov5_021EAC44(UnkStruct_ov5_021EAE78 *param0) static BOOL ov5_021EACFC(UnkStruct_ov5_021EAE78 *param0) { if (Text_IsPrinterActive(param0->unk_40) == 0) { - param0->unk_44 = sub_02002100(param0->fieldSystem->unk_08, &Unk_ov5_021FAF00, 1024 - (18 + 12) - 9, 11, 4); + param0->unk_44 = Menu_MakeYesNoChoice(param0->fieldSystem->unk_08, &Unk_ov5_021FAF00, 1024 - (18 + 12) - 9, 11, 4); param0->unk_48 = 11; } @@ -357,7 +352,7 @@ static BOOL ov5_021EAD38(UnkStruct_ov5_021EAE78 *param0) TrainerInfo *v1; DWCFriendData *v2; Strbuf *v3; - int v4 = sub_02002114(param0->unk_44, 4); + int v4 = Menu_ProcessInputAndHandleExit(param0->unk_44, 4); if (v4 == 0xffffffff) { return 0; @@ -487,7 +482,7 @@ void ov5_021EAF50(FieldSystem *fieldSystem) } } -static void ov5_021EAF90(BmpList *param0, u32 param1, u8 param2) +static void ov5_021EAF90(ListMenu *param0, u32 param1, u8 param2) { if (param2 == 0) { Sound_PlayEffect(1500); diff --git a/src/overlay005/ov5_021F6454.c b/src/overlay005/ov5_021F6454.c index 6dc266e992..37f7146fbd 100644 --- a/src/overlay005/ov5_021F6454.c +++ b/src/overlay005/ov5_021F6454.c @@ -5,29 +5,27 @@ #include "consts/game_records.h" -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_020216E0_decl.h" #include "struct_decls/struct_0202C878_decl.h" #include "struct_decls/struct_020308A0_decl.h" #include "struct_decls/struct_02061830_decl.h" #include "struct_decls/struct_02061AB4_decl.h" #include "struct_decls/struct_party_decl.h" -#include "struct_defs/struct_02013A04_t.h" #include "field/field_system.h" #include "overlay005/ov5_021EB1A0.h" #include "overlay005/ov5_021ECE40.h" #include "overlay005/struct_ov5_021F6704_decl.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "bag.h" #include "bg_window.h" #include "field_script_context.h" +#include "font.h" #include "game_records.h" #include "graphics.h" #include "heap.h" #include "inlines.h" +#include "list_menu.h" #include "map_object.h" #include "message.h" #include "narc.h" @@ -37,10 +35,10 @@ #include "savedata_misc.h" #include "script_manager.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "sys_task.h" #include "sys_task_manager.h" -#include "unk_0200112C.h" #include "unk_020041CC.h" #include "unk_02005474.h" #include "unk_0200DA60.h" @@ -83,11 +81,11 @@ struct UnkStruct_ov5_021F6704_t { u16 *unk_210; u16 *unk_214; u16 *unk_218; - UnkStruct_ov84_02240FA8 unk_21C; - BmpList *unk_23C; + ListMenuTemplate unk_21C; + ListMenu *unk_23C; u16 unk_240; u16 unk_242; - ResourceMetadata unk_244[120]; + StringList unk_244[120]; u16 unk_604[120]; u16 unk_6F4; }; @@ -108,8 +106,8 @@ void ov5_021F6760(UnkStruct_ov5_021F6704 *param0, u32 param1, u32 param2, u32 pa static void ov5_021F6768(UnkStruct_ov5_021F6704 *param0); static void ov5_021F6830(UnkStruct_ov5_021F6704 *param0, u32 param1, u32 param2, u32 param3); static void ov5_021F68BC(UnkStruct_ov5_021F6704 *param0); -static void ov5_021F69CC(BmpList *param0, u32 param1, u8 param2); -static void ov5_021F69F0(BmpList *param0, u32 param1, u8 param2); +static void ov5_021F69CC(ListMenu *param0, u32 param1, u8 param2); +static void ov5_021F69F0(ListMenu *param0, u32 param1, u8 param2); static void ov5_021F6A34(SysTask *param0, void *param1); static void ov5_021F6AD4(UnkStruct_ov5_021F6704 *param0); @@ -236,8 +234,8 @@ static void ov5_021F6624(FieldSystem *fieldSystem, UnkStruct_ov5_021F6704 *param param1->unk_6F4 = param4; for (v0 = 0; v0 < 120; v0++) { - param1->unk_244[v0].unk_00 = NULL; - param1->unk_244[v0].unk_04 = 0; + param1->unk_244[v0].entry = NULL; + param1->unk_244[v0].index = 0; param1->unk_604[v0] = 0xff; } @@ -284,7 +282,7 @@ static void ov5_021F6768(UnkStruct_ov5_021F6704 *param0) Window_Show(¶m0->unk_08, 1, 1024 - (18 + 12) - 9, 11); ov5_021F68BC(param0); - param0->unk_23C = sub_0200112C((const UnkStruct_ov84_02240FA8 *)¶m0->unk_21C, *param0->unk_214, *param0->unk_218, 4); + param0->unk_23C = ListMenu_New((const ListMenuTemplate *)¶m0->unk_21C, *param0->unk_214, *param0->unk_218, 4); param0->unk_04 = SysTask_Start(ov5_021F6A34, param0, 0); return; @@ -300,14 +298,14 @@ static void ov5_021F6830(UnkStruct_ov5_021F6704 *param0, u32 param1, u32 param2, MessageLoader_GetStrbuf(param0->unk_1FC, param1, v2); StringTemplate_Format(param0->unk_200, param0->unk_1C[param0->unk_20B], v2); - param0->unk_244[param0->unk_20B].unk_00 = (const void *)param0->unk_1C[param0->unk_20B]; + param0->unk_244[param0->unk_20B].entry = (const void *)param0->unk_1C[param0->unk_20B]; Strbuf_Free(v2); } if (param3 == 0xfa) { - param0->unk_244[param0->unk_20B].unk_04 = 0xfffffffd; + param0->unk_244[param0->unk_20B].index = 0xfffffffd; } else { - param0->unk_244[param0->unk_20B].unk_04 = param3; + param0->unk_244[param0->unk_20B].index = param3; } param0->unk_604[param0->unk_20B] = param2; @@ -318,46 +316,46 @@ static void ov5_021F6830(UnkStruct_ov5_021F6704 *param0, u32 param1, u32 param2, static void ov5_021F68BC(UnkStruct_ov5_021F6704 *param0) { - param0->unk_21C.unk_00 = param0->unk_244; - param0->unk_21C.unk_04 = ov5_021F69F0; - param0->unk_21C.unk_08 = ov5_021F69CC; - param0->unk_21C.unk_0C = ¶m0->unk_08; - param0->unk_21C.unk_10 = param0->unk_20B; - param0->unk_21C.unk_12 = 8; - param0->unk_21C.unk_14 = 1; - param0->unk_21C.unk_15 = 12; - param0->unk_21C.unk_16 = 2; - param0->unk_21C.unk_17_0 = 1; - param0->unk_21C.unk_17_4 = 1; - param0->unk_21C.unk_18_0 = 15; - param0->unk_21C.unk_18_4 = 2; - param0->unk_21C.unk_1A_0 = 0; - param0->unk_21C.unk_1A_3 = 16; - param0->unk_21C.unk_1A_7 = 1; - param0->unk_21C.unk_1A_9 = 0; - param0->unk_21C.unk_1A_15 = 0; - param0->unk_21C.unk_1C = (void *)param0; + param0->unk_21C.choices = param0->unk_244; + param0->unk_21C.cursorCallback = ov5_021F69F0; + param0->unk_21C.printCallback = ov5_021F69CC; + param0->unk_21C.window = ¶m0->unk_08; + param0->unk_21C.count = param0->unk_20B; + param0->unk_21C.maxDisplay = 8; + param0->unk_21C.headerXOffset = 1; + param0->unk_21C.textXOffset = 12; + param0->unk_21C.cursorXOffset = 2; + param0->unk_21C.yOffset = 1; + param0->unk_21C.textColorFg = 1; + param0->unk_21C.textColorBg = 15; + param0->unk_21C.textColorShadow = 2; + param0->unk_21C.letterSpacing = 0; + param0->unk_21C.lineSpacing = 0; + param0->unk_21C.pagerMode = PAGER_MODE_LEFT_RIGHT_PAD; + param0->unk_21C.fontID = FONT_SYSTEM; + param0->unk_21C.cursorType = 0; + param0->unk_21C.tmp = (void *)param0; return; } -static void ov5_021F69CC(BmpList *param0, u32 param1, u8 param2) +static void ov5_021F69CC(ListMenu *param0, u32 param1, u8 param2) { if (param1 == 0xfffffffd) { - sub_0200147C(param0, 3, 15, 4); + ListMenu_SetAltTextColors(param0, 3, 15, 4); } else { - sub_0200147C(param0, 1, 15, 2); + ListMenu_SetAltTextColors(param0, 1, 15, 2); } } -static void ov5_021F69F0(BmpList *param0, u32 param1, u8 param2) +static void ov5_021F69F0(ListMenu *param0, u32 param1, u8 param2) { u32 v0, v1; u16 v2 = 0; u16 v3 = 0; - UnkStruct_ov5_021F6704 *v4 = (UnkStruct_ov5_021F6704 *)sub_02001504(param0, 19); + UnkStruct_ov5_021F6704 *v4 = (UnkStruct_ov5_021F6704 *)ListMenu_GetAttribute(param0, 19); - sub_020014DC(param0, &v2, &v3); + ListMenu_GetListAndCursorPos(param0, &v2, &v3); if ((v4->unk_214 != NULL) && (v4->unk_218 != NULL)) { *v4->unk_214 = v2; @@ -384,10 +382,10 @@ static void ov5_021F6A34(SysTask *param0, void *param1) return; } - v1 = sub_02001288(v2->unk_23C); + v1 = ListMenu_ProcessInput(v2->unk_23C); v0 = v2->unk_6F4; - sub_020014D0(v2->unk_23C, &v2->unk_6F4); + ListMenu_CalcTrueCursorPos(v2->unk_23C, &v2->unk_6F4); if (v0 != v2->unk_6F4) { Sound_PlayEffect(1500); @@ -418,8 +416,8 @@ static void ov5_021F6AD4(UnkStruct_ov5_021F6704 *param0) int v0; Sound_PlayEffect(1500); - sub_02001384(param0->unk_23C, NULL, NULL); - Window_Clear(param0->unk_21C.unk_0C, 0); + ListMenu_Free(param0->unk_23C, NULL, NULL); + Window_Clear(param0->unk_21C.window, 0); Window_Remove(¶m0->unk_08); for (v0 = 0; v0 < 120; v0++) { diff --git a/src/overlay005/ov5_021F77A8.c b/src/overlay005/ov5_021F77A8.c index 01fe548b24..451f1af9c2 100644 --- a/src/overlay005/ov5_021F77A8.c +++ b/src/overlay005/ov5_021F77A8.c @@ -6,31 +6,28 @@ #include "constants/forms.h" #include "constants/species.h" -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02013A04_decl.h" -#include "struct_defs/struct_02013A04_t.h" - #include "field/field_system.h" #include "overlay005/ov5_021DC018.h" #include "overlay005/struct_ov5_021DC1A4_decl.h" #include "overlay005/struct_ov5_021F7ED8_decl.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "bag.h" #include "bg_window.h" #include "field_script_context.h" +#include "font.h" #include "heap.h" #include "inlines.h" +#include "list_menu.h" #include "message.h" #include "party.h" #include "pokemon.h" #include "script_manager.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "sys_task.h" #include "sys_task_manager.h" #include "tutor_movesets.h" -#include "unk_0200112C.h" #include "unk_02005474.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" @@ -59,11 +56,11 @@ struct UnkStruct_ov5_021F7ED8_t { u8 unk_C7; u16 *unk_C8; u16 *unk_CC; - UnkStruct_ov84_02240FA8 unk_D0; - BmpList *unk_F0; + ListMenuTemplate unk_D0; + ListMenu *unk_F0; u16 unk_F4; u16 unk_F6; - ResourceMetadata unk_F8[39]; + StringList unk_F8[39]; u16 unk_230[39]; u16 unk_27E; }; @@ -85,7 +82,7 @@ void ov5_021F7F2C(UnkStruct_ov5_021F7ED8 *param0, u32 param1, u32 param2, u32 pa static void ov5_021F7F34(UnkStruct_ov5_021F7ED8 *param0); static void ov5_021F7FF8(UnkStruct_ov5_021F7ED8 *param0, u32 param1, u32 param2, u32 param3); static void ov5_021F8090(UnkStruct_ov5_021F7ED8 *param0); -static void ov5_021F819C(BmpList *param0, u32 param1, u8 param2); +static void ov5_021F819C(ListMenu *param0, u32 param1, u8 param2); static void ov5_021F81A8(SysTask *param0, void *param1); static void ov5_021F8250(UnkStruct_ov5_021F7ED8 *param0); @@ -434,8 +431,8 @@ static void ov5_021F7E18(FieldSystem *fieldSystem, UnkStruct_ov5_021F7ED8 *param param1->unk_27E = param4; for (v0 = 0; v0 < ((NELEMS(sTeachableMoves)) + 1); v0++) { - param1->unk_F8[v0].unk_00 = NULL; - param1->unk_F8[v0].unk_04 = 0; + param1->unk_F8[v0].entry = NULL; + param1->unk_F8[v0].index = 0; param1->unk_230[v0] = 0xff; } @@ -483,7 +480,7 @@ static void ov5_021F7F34(UnkStruct_ov5_021F7ED8 *param0) Window_Show(¶m0->unk_08, 1, 1024 - (18 + 12) - 9, 11); ov5_021F8090(param0); - param0->unk_F0 = sub_0200112C((const UnkStruct_ov84_02240FA8 *)¶m0->unk_D0, 0, param0->unk_C2, 4); + param0->unk_F0 = ListMenu_New((const ListMenuTemplate *)¶m0->unk_D0, 0, param0->unk_C2, 4); param0->unk_04 = SysTask_Start(ov5_021F81A8, param0, 0); return; @@ -499,14 +496,14 @@ static void ov5_021F7FF8(UnkStruct_ov5_021F7ED8 *param0, u32 param1, u32 param2, MessageLoader_GetStrbuf(param0->unk_B8, param1, v2); StringTemplate_Format(param0->unk_BC, param0->unk_1C[param0->unk_C7], v2); - param0->unk_F8[param0->unk_C7].unk_00 = (const void *)param0->unk_1C[param0->unk_C7]; + param0->unk_F8[param0->unk_C7].entry = (const void *)param0->unk_1C[param0->unk_C7]; Strbuf_Free(v2); } if (param3 == 0xfa) { - param0->unk_F8[param0->unk_C7].unk_04 = 0xfffffffd; + param0->unk_F8[param0->unk_C7].index = 0xfffffffd; } else { - param0->unk_F8[param0->unk_C7].unk_04 = param3; + param0->unk_F8[param0->unk_C7].index = param3; } param0->unk_230[param0->unk_C7] = param2; @@ -517,35 +514,35 @@ static void ov5_021F7FF8(UnkStruct_ov5_021F7ED8 *param0, u32 param1, u32 param2, static void ov5_021F8090(UnkStruct_ov5_021F7ED8 *param0) { - param0->unk_D0.unk_00 = param0->unk_F8; - param0->unk_D0.unk_04 = ov5_021F819C; - param0->unk_D0.unk_08 = NULL; - param0->unk_D0.unk_0C = ¶m0->unk_08; - param0->unk_D0.unk_10 = param0->unk_C7; - param0->unk_D0.unk_12 = 8; - param0->unk_D0.unk_14 = 1; - param0->unk_D0.unk_15 = 12; - param0->unk_D0.unk_16 = 2; - param0->unk_D0.unk_17_0 = 1; - param0->unk_D0.unk_17_4 = 1; - param0->unk_D0.unk_18_0 = 15; - param0->unk_D0.unk_18_4 = 2; - param0->unk_D0.unk_1A_0 = 0; - param0->unk_D0.unk_1A_3 = 16; - param0->unk_D0.unk_1A_7 = 1; - param0->unk_D0.unk_1A_9 = 0; - param0->unk_D0.unk_1A_15 = 0; - param0->unk_D0.unk_1C = (void *)param0; + param0->unk_D0.choices = param0->unk_F8; + param0->unk_D0.cursorCallback = ov5_021F819C; + param0->unk_D0.printCallback = NULL; + param0->unk_D0.window = ¶m0->unk_08; + param0->unk_D0.count = param0->unk_C7; + param0->unk_D0.maxDisplay = 8; + param0->unk_D0.headerXOffset = 1; + param0->unk_D0.textXOffset = 12; + param0->unk_D0.cursorXOffset = 2; + param0->unk_D0.yOffset = 1; + param0->unk_D0.textColorFg = 1; + param0->unk_D0.textColorBg = 15; + param0->unk_D0.textColorShadow = 2; + param0->unk_D0.letterSpacing = 0; + param0->unk_D0.lineSpacing = 0; + param0->unk_D0.pagerMode = PAGER_MODE_LEFT_RIGHT_PAD; + param0->unk_D0.fontID = FONT_SYSTEM; + param0->unk_D0.cursorType = 0; + param0->unk_D0.tmp = (void *)param0; return; } -static void ov5_021F819C(BmpList *param0, u32 param1, u8 param2) +static void ov5_021F819C(ListMenu *param0, u32 param1, u8 param2) { u32 v0, v1; u16 v2 = 0; u16 v3 = 0; - UnkStruct_ov5_021F7ED8 *v4 = (UnkStruct_ov5_021F7ED8 *)sub_02001504(param0, 19); + UnkStruct_ov5_021F7ED8 *v4 = (UnkStruct_ov5_021F7ED8 *)ListMenu_GetAttribute(param0, 19); return; } @@ -567,10 +564,10 @@ static void ov5_021F81A8(SysTask *param0, void *param1) return; } - v1 = sub_02001288(v2->unk_F0); + v1 = ListMenu_ProcessInput(v2->unk_F0); v0 = v2->unk_27E; - sub_020014D0(v2->unk_F0, &v2->unk_27E); + ListMenu_CalcTrueCursorPos(v2->unk_F0, &v2->unk_27E); if (v0 != v2->unk_27E) { Sound_PlayEffect(1500); @@ -602,8 +599,8 @@ static void ov5_021F8250(UnkStruct_ov5_021F7ED8 *param0) int v0; Sound_PlayEffect(1500); - sub_02001384(param0->unk_F0, NULL, NULL); - Window_Clear(param0->unk_D0.unk_0C, 0); + ListMenu_Free(param0->unk_F0, NULL, NULL); + Window_Clear(param0->unk_D0.window, 0); Window_Remove(¶m0->unk_08); for (v0 = 0; v0 < ((NELEMS(sTeachableMoves)) + 1); v0++) { diff --git a/src/overlay007/communication_club.c b/src/overlay007/communication_club.c index f32503a6a8..8c60a7877c 100644 --- a/src/overlay007/communication_club.c +++ b/src/overlay007/communication_club.c @@ -6,14 +6,8 @@ #include "constants/communication/comm_type.h" #include "consts/sdat.h" -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" -#include "struct_decls/struct_02013A04_decl.h" -#include "struct_defs/struct_02013A04_t.h" - #include "field/field_system.h" #include "gmm/message_bank_unk_0353.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "bg_window.h" #include "communication_information.h" @@ -22,20 +16,20 @@ #include "field_comm_manager.h" #include "field_system.h" #include "heap.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "render_text.h" #include "save_player.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "sys_task.h" #include "sys_task_manager.h" #include "text.h" #include "trainer_info.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200DA60.h" -#include "unk_02013A04.h" #include "unk_02033200.h" #include "unk_020363E8.h" #include "unk_020366A0.h" @@ -53,9 +47,9 @@ typedef struct CommClubManager { StringTemplate *unk_50; StringTemplate *unk_54; StringTemplate *strTempMsg; - BmpList *unk_5C; - UIControlData *unk_60; - ResourceMetadata *unk_64; + ListMenu *unk_5C; + Menu *unk_60; + StringList *unk_64; FieldSystem *fieldSystem; CommClubManTaskFunc commClubTask; UnkFuncPtr_ov7_02249C2C_1 unk_70; @@ -90,9 +84,9 @@ static void CommClubMan_SetTask(CommClubManTaskFunc param0); static void CommClubMan_PrintMessage(int param0, BOOL param1); static void CommClubMan_StartBattleClient(CommClubManager *param0); static void ov7_0224A510(CommClubManager *param0); -static void ov7_02249C44(BmpList *param0, u32 param1, u8 param2); -static void ov7_02249C64(BmpList *param0, u32 param1, u8 param2); -static void ov7_02249C94(BmpList *param0, u32 param1, u8 param2); +static void ov7_02249C44(ListMenu *param0, u32 param1, u8 param2); +static void ov7_02249C64(ListMenu *param0, u32 param1, u8 param2); +static void ov7_02249C94(ListMenu *param0, u32 param1, u8 param2); static void CommClubMan_PrintChooseJoinMsg(CommClubManager *param0); static void CommClubMan_DisplayPersonalTrainerInfo(CommClubManager *param0); static void ov7_02249F54(SysTask *param0, void *param1); @@ -106,7 +100,7 @@ static void CommClubMan_Disconnect(void); static void ov7_0224A53C(CommClubManager *param0); static void ov7_0224A5D0(void); static void ov7_0224A64C(CommClubManager *param0); -static void ov7_0224A438(BmpList *param0, u32 param1, u8 param2); +static void ov7_0224A438(ListMenu *param0, u32 param1, u8 param2); static void ov7_0224A72C(SysTask *param0, void *param1); static void ov7_0224A7D0(SysTask *param0, void *param1); static void ov7_0224A97C(SysTask *param0, void *param1); @@ -197,7 +191,7 @@ static inline void CommClubMan_PrintMessageFastSpeed(int msgId, BOOL format) sCommClubMan->printMsgIndex = Text_AddPrinterWithParams(&sCommClubMan->msgWindow, FONT_MESSAGE, sCommClubMan->strBuff[5], 0, 0, TEXT_SPEED_FAST, NULL); } -static void CommClubMan_CreateList(UnkStruct_ov84_02240FA8 param0, u8 param1, u8 param2, u8 param3, u8 param4, u16 param5) +static void CommClubMan_CreateList(ListMenuTemplate param0, u8 param1, u8 param2, u8 param3, u8 param4, u16 param5) { if (!Window_IsInUse(&sCommClubMan->unk_20)) { Window_Add(sCommClubMan->fieldSystem->unk_08, &sCommClubMan->unk_20, 3, param1, param2, param3, param4, 13, param5); @@ -205,11 +199,11 @@ static void CommClubMan_CreateList(UnkStruct_ov84_02240FA8 param0, u8 param1, u8 Window_Show(&sCommClubMan->unk_20, 1, 1024 - (18 + 12) - 9, 11); - UnkStruct_ov84_02240FA8 v0 = param0; - v0.unk_00 = sCommClubMan->unk_64; - v0.unk_0C = &sCommClubMan->unk_20; + ListMenuTemplate v0 = param0; + v0.choices = sCommClubMan->unk_64; + v0.window = &sCommClubMan->unk_20; - sCommClubMan->unk_5C = sub_0200112C(&v0, 0, 0, 4); + sCommClubMan->unk_5C = ListMenu_New(&v0, 0, 0, 4); Window_CopyToVRAM(&sCommClubMan->unk_20); } @@ -285,7 +279,7 @@ static void CommClubMan_StartBattleClient(CommClubManager *man) FieldCommMan_StartBattleClient(man->fieldSystem, man->commType, CommClubMan_Regulation()); } -static const UnkStruct_ov84_02240FA8 Unk_ov7_0224ED34 = { +static const ListMenuTemplate Unk_ov7_0224ED34 = { NULL, ov7_02249C44, ov7_02249C64, @@ -307,7 +301,7 @@ static const UnkStruct_ov84_02240FA8 Unk_ov7_0224ED34 = { NULL }; -static void ov7_02249C44(BmpList *param0, u32 param1, u8 param2) +static void ov7_02249C44(ListMenu *param0, u32 param1, u8 param2) { sCommClubMan->unk_98 = 1; @@ -316,20 +310,20 @@ static void ov7_02249C44(BmpList *param0, u32 param1, u8 param2) } } -static void ov7_02249C64(BmpList *param0, u32 param1, u8 param2) +static void ov7_02249C64(ListMenu *param0, u32 param1, u8 param2) { - for (int v0 = 0; v0 < sub_02001504(param0, 3); v0++) { + for (int v0 = 0; v0 < ListMenu_GetAttribute(param0, 3); v0++) { ov7_02249C94(param0, 0, v0); } } -static void ov7_02249C94(BmpList *param0, u32 param1, u8 param2) +static void ov7_02249C94(ListMenu *param0, u32 param1, u8 param2) { int v0 = sub_02033808(); u16 cnt = 0; if (sCommClubMan->unk_5C) { - sub_020014DC(sCommClubMan->unk_5C, &cnt, NULL); + ListMenu_GetListAndCursorPos(sCommClubMan->unk_5C, &cnt, NULL); } cnt += param2; @@ -436,13 +430,13 @@ static void ov7_02249F54(SysTask *task, void *data) if (FieldMessage_FinishedPrinting(sCommClubMan->printMsgIndex)) { int v2; - sCommClubMan->unk_64 = sub_02013A04(16, 4); + sCommClubMan->unk_64 = StringList_New(16, 4); for (v2 = 0; v2 < 16; v2++) { StringTemplate_SetNumber(sCommClubMan->unk_50, 0, v2 + 1, 2, 2, 1); MessageLoader_GetStrbuf(sCommClubMan->msgLoader, pl_msg_00000353_00064, sCommClubMan->strBuff[1]); StringTemplate_Format(sCommClubMan->unk_50, sCommClubMan->strBuff[0], sCommClubMan->strBuff[1]); - sub_02013A6C(sCommClubMan->unk_64, sCommClubMan->strBuff[0], 0); + StringList_AddFromStrbuf(sCommClubMan->unk_64, sCommClubMan->strBuff[0], 0); } CommClubMan_CreateList(Unk_ov7_0224ED34, 1, 2, 20, 5 * 2, 1); @@ -464,7 +458,7 @@ static void ov7_02249FFC(SysTask *task, void *param1) CommClubMan_DestroyList(task, commClubMan); } else { if (!sub_02033870()) { - v0 = sub_02001288(sCommClubMan->unk_5C); + v0 = ListMenu_ProcessInput(sCommClubMan->unk_5C); } else { v0 = 0xffffffff; } @@ -481,7 +475,7 @@ static void ov7_02249FFC(SysTask *task, void *param1) break; default: Sound_PlayEffect(1500); - sub_020014D0(commClubMan->unk_5C, &commClubMan->connectIndex); + ListMenu_CalcTrueCursorPos(commClubMan->unk_5C, &commClubMan->connectIndex); if (sub_02033808() > commClubMan->connectIndex) { ov7_0224A0C8(commClubMan); @@ -598,7 +592,7 @@ static void CommClubTask_WaitConfirmLeaveGroup(SysTask *task, void *data) } if (FieldMessage_FinishedPrinting(sCommClubMan->printMsgIndex)) { - commClubMan->unk_60 = sub_02002100(sCommClubMan->fieldSystem->unk_08, &Unk_ov7_0224ED0C, 1024 - (18 + 12) - 9, 11, 4); + commClubMan->unk_60 = Menu_MakeYesNoChoice(sCommClubMan->fieldSystem->unk_08, &Unk_ov7_0224ED0C, 1024 - (18 + 12) - 9, 11, 4); CommClubMan_SetTask(CommClubTask_LeaveGroup); } } @@ -609,12 +603,12 @@ static void CommClubTask_LeaveGroup(SysTask *task, void *data) u32 v1; if (ov7_0224A244(task, data)) { - sub_02002154(v0->unk_60, 4); + Menu_DestroyForExit(v0->unk_60, 4); v0->unk_60 = NULL; return; } - v1 = sub_02002114(v0->unk_60, 4); + v1 = Menu_ProcessInputAndHandleExit(v0->unk_60, 4); if (v1 == 0) { CommClubMan_DestroyList(task, v0); @@ -625,7 +619,7 @@ static void CommClubTask_LeaveGroup(SysTask *task, void *data) } } -static const UnkStruct_ov84_02240FA8 Unk_ov7_0224ED14 = { +static const ListMenuTemplate Unk_ov7_0224ED14 = { NULL, NULL, NULL, @@ -647,12 +641,12 @@ static const UnkStruct_ov84_02240FA8 Unk_ov7_0224ED14 = { NULL }; -static void ov7_0224A438(BmpList *param0, u32 param1, u8 param2) +static void ov7_0224A438(ListMenu *param0, u32 param1, u8 param2) { u16 v0 = 0; if (sCommClubMan->unk_5C) { - sub_020014DC(sCommClubMan->unk_5C, &v0, NULL); + ListMenu_GetListAndCursorPos(sCommClubMan->unk_5C, &v0, NULL); } v0 += param2; @@ -848,10 +842,10 @@ static void ov7_0224A72C(SysTask *task, void *param1) if (FieldMessage_FinishedPrinting(sCommClubMan->printMsgIndex)) { int netId; - sCommClubMan->unk_64 = sub_02013A04(5, 4); + sCommClubMan->unk_64 = StringList_New(5, 4); for (netId = 0; netId < 5; netId++) { - sub_02013A4C(sCommClubMan->unk_64, sCommClubMan->msgLoader, pl_msg_00000353_00069, 0); + StringList_AddFromMessageBank(sCommClubMan->unk_64, sCommClubMan->msgLoader, pl_msg_00000353_00069, 0); } sCommClubMan->unk_98 = 1; @@ -888,14 +882,14 @@ static void ov7_0224A7D0(SysTask *task, void *param1) if (sCommClubMan->unk_98) { sCommClubMan->unk_98 = 0; - sub_020013AC(sCommClubMan->unk_5C); + ListMenu_Draw(sCommClubMan->unk_5C); - for (v2 = 0; v2 < sub_02001504(sCommClubMan->unk_5C, 3); v2++) { + for (v2 = 0; v2 < ListMenu_GetAttribute(sCommClubMan->unk_5C, 3); v2++) { ov7_0224A438(sCommClubMan->unk_5C, 0, v2); } } - v1 = sub_02001288(commClubMan->unk_5C); + v1 = ListMenu_ProcessInput(commClubMan->unk_5C); if (CommInfo_NewNetworkId() != 0xff) { commClubMan->unk_95 = CommInfo_NewNetworkId(); @@ -972,13 +966,13 @@ static void ov7_0224A97C(SysTask *task, void *param1) int v2; ov7_0224A64C(commClubMan); - sub_02001288(commClubMan->unk_5C); + ListMenu_ProcessInput(commClubMan->unk_5C); - v1 = sub_02002114(commClubMan->unk_60, 4); + v1 = Menu_ProcessInputAndHandleExit(commClubMan->unk_60, 4); if (!CommSys_IsPlayerConnected(commClubMan->unk_95)) { if (v1 == 0xffffffff) { - sub_02002154(commClubMan->unk_60, 4); + Menu_DestroyForExit(commClubMan->unk_60, 4); } if (commClubMan->commType == COMM_TYPE_CONTEST) { @@ -998,7 +992,7 @@ static void ov7_0224A97C(SysTask *task, void *param1) } } else if (CommSys_CheckError() || ov7_0224B4E4()) { if (v1 == 0xffffffff) { - sub_02002154(commClubMan->unk_60, 4); + Menu_DestroyForExit(commClubMan->unk_60, 4); } CommInfo_InitPlayer(commClubMan->unk_95); @@ -1143,10 +1137,10 @@ static void ov7_0224AC48(SysTask *task, void *param1) ov7_0224A64C(commClubMan); sub_02036994(0); - sub_02001288(commClubMan->unk_5C); + ListMenu_ProcessInput(commClubMan->unk_5C); if (FieldMessage_FinishedPrinting(sCommClubMan->printMsgIndex)) { - commClubMan->unk_60 = sub_02002100(sCommClubMan->fieldSystem->unk_08, &Unk_ov7_0224ED0C, 1024 - (18 + 12) - 9, 11, 4); + commClubMan->unk_60 = Menu_MakeYesNoChoice(sCommClubMan->fieldSystem->unk_08, &Unk_ov7_0224ED0C, 1024 - (18 + 12) - 9, 11, 4); CommClubMan_SetTask(ov7_0224ACA4); } } @@ -1158,13 +1152,13 @@ static void ov7_0224ACA4(SysTask *task, void *param1) int v2; ov7_0224A64C(commClubMan); - sub_02001288(commClubMan->unk_5C); + ListMenu_ProcessInput(commClubMan->unk_5C); - v1 = sub_02002114(commClubMan->unk_60, 4); + v1 = Menu_ProcessInputAndHandleExit(commClubMan->unk_60, 4); if (CommSys_CheckError() || (CommSys_ConnectedCount() != commClubMan->connectedCnt)) { if (v1 == 0xffffffff) { - sub_02002154(commClubMan->unk_60, 4); + Menu_DestroyForExit(commClubMan->unk_60, 4); } commClubMan->unk_60 = NULL; @@ -1308,10 +1302,10 @@ static void ov7_0224AE78(SysTask *task, void *param1) CommClubManager *commClubMan = (CommClubManager *)param1; ov7_0224A64C(commClubMan); - sub_02001288(commClubMan->unk_5C); + ListMenu_ProcessInput(commClubMan->unk_5C); if (FieldMessage_FinishedPrinting(sCommClubMan->printMsgIndex)) { - commClubMan->unk_60 = sub_02002100(sCommClubMan->fieldSystem->unk_08, &Unk_ov7_0224ED0C, 1024 - (18 + 12) - 9, 11, 4); + commClubMan->unk_60 = Menu_MakeYesNoChoice(sCommClubMan->fieldSystem->unk_08, &Unk_ov7_0224ED0C, 1024 - (18 + 12) - 9, 11, 4); CommClubMan_SetTask(ov7_0224AECC); } } @@ -1323,8 +1317,8 @@ static void ov7_0224AECC(SysTask *task, void *param1) ov7_0224A64C(commClubMan); - sub_02001288(commClubMan->unk_5C); - v1 = sub_02002114(commClubMan->unk_60, 4); + ListMenu_ProcessInput(commClubMan->unk_5C); + v1 = Menu_ProcessInputAndHandleExit(commClubMan->unk_60, 4); if (CommSys_CheckError()) { v1 = 0xfffffffe; @@ -1349,7 +1343,7 @@ static void ov7_0224AF2C(SysTask *task, void *param1) CommClubMan_SetTask(ov7_0224AD68); } else { ov7_0224A64C(commClubMan); - sub_02001288(commClubMan->unk_5C); + ListMenu_ProcessInput(commClubMan->unk_5C); if (CommTiming_IsSyncState(10) && CommTool_IsInitialized()) { CommClubMan_DestroyList(task, commClubMan); @@ -1364,10 +1358,10 @@ static void ov7_0224AF84(SysTask *task, void *param1) u32 v1 = 0xffffffff; ov7_0224A64C(commClubMan); - sub_02001288(commClubMan->unk_5C); + ListMenu_ProcessInput(commClubMan->unk_5C); if (FieldMessage_FinishedPrinting(sCommClubMan->printMsgIndex)) { - commClubMan->unk_60 = sub_02002100(sCommClubMan->fieldSystem->unk_08, &Unk_ov7_0224ED0C, 1024 - (18 + 12) - 9, 11, 4); + commClubMan->unk_60 = Menu_MakeYesNoChoice(sCommClubMan->fieldSystem->unk_08, &Unk_ov7_0224ED0C, 1024 - (18 + 12) - 9, 11, 4); CommClubMan_SetTask(ov7_0224A97C); } } @@ -1376,8 +1370,8 @@ static void CommClubMan_DestroyList(SysTask *task, CommClubManager *param1) { Window_FillTilemap(&sCommClubMan->msgWindow, 15); Window_Clear(¶m1->unk_20, 0); - sub_02013A3C(param1->unk_64); - sub_02001384(param1->unk_5C, NULL, NULL); + StringList_Free(param1->unk_64); + ListMenu_Free(param1->unk_5C, NULL, NULL); Window_ClearAndCopyToVRAM(¶m1->unk_20); Window_Remove(¶m1->unk_20); diff --git a/src/overlay007/ov7_0224B4E8.c b/src/overlay007/ov7_0224B4E8.c index 65c4e9e821..43709e35fe 100644 --- a/src/overlay007/ov7_0224B4E8.c +++ b/src/overlay007/ov7_0224B4E8.c @@ -3,31 +3,27 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_020508D4_decl.h" #include "struct_decls/struct_02098700_decl.h" #include "struct_decls/struct_party_decl.h" -#include "struct_defs/struct_02013A04_t.h" #include "struct_defs/struct_0202610C.h" #include "field/field_system.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "bg_window.h" #include "core_sys.h" #include "font.h" #include "heap.h" +#include "list_menu.h" #include "message.h" #include "party.h" #include "save_player.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" -#include "unk_0200112C.h" #include "unk_02005474.h" #include "unk_0200DA60.h" -#include "unk_02013A04.h" #include "unk_0202602C.h" #include "unk_02026150.h" #include "unk_020508D4.h" @@ -35,10 +31,10 @@ #include "unk_0207A2A8.h" typedef struct { - BmpList *unk_00; - BmpList *unk_04; - ResourceMetadata *unk_08; - ResourceMetadata *unk_0C; + ListMenu *unk_00; + ListMenu *unk_04; + StringList *unk_08; + StringList *unk_0C; FieldSystem *fieldSystem; Strbuf *unk_14; Strbuf *unk_18; @@ -65,7 +61,7 @@ typedef struct { u32 unk_04; } UnkStruct_ov7_0224F4D8; -static const UnkStruct_ov84_02240FA8 Unk_ov7_0224F188 = { +static const ListMenuTemplate Unk_ov7_0224F188 = { NULL, NULL, NULL, @@ -121,7 +117,7 @@ static void ov7_0224B57C(UnkStruct_ov7_0224B4E8 *param0, int param1) static void ov7_0224B5A8(UnkStruct_ov7_0224B4E8 *param0) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; Window *v1 = &(param0->unk_34); BattleRegulation *v2 = sub_0202610C(param0->fieldSystem->saveData, 0); int v3 = 5; @@ -133,42 +129,42 @@ static void ov7_0224B5A8(UnkStruct_ov7_0224B4E8 *param0) if (Window_IsInUse(v1) == 0) { int v4; - param0->unk_08 = sub_02013A04(v3 + 2, 4); + param0->unk_08 = StringList_New(v3 + 2, 4); Window_Add(param0->fieldSystem->unk_08, v1, 3, 1, 1, 16, (v3 + 2) * 2, 13, 1); Window_Show(¶m0->unk_34, 1, 1024 - (18 + 12) - 9, 11); - sub_02013A4C(param0->unk_08, param0->unk_68, 123, 12); + StringList_AddFromMessageBank(param0->unk_08, param0->unk_68, 123, 12); for (v4 = 0; v4 < v3; v4++) { ov7_0224B57C(param0, v4); MessageLoader_GetStrbuf(param0->unk_68, 113, param0->unk_1C); StringTemplate_Format(param0->unk_64, param0->unk_20, param0->unk_1C); - sub_02013A6C(param0->unk_08, param0->unk_20, v4); + StringList_AddFromStrbuf(param0->unk_08, param0->unk_20, v4); } - sub_02013A4C(param0->unk_08, param0->unk_68, 114, 0xfffffffe); + StringList_AddFromMessageBank(param0->unk_08, param0->unk_68, 114, 0xfffffffe); } v0 = Unk_ov7_0224F188; - v0.unk_10 = v3 + 2; - v0.unk_12 = v3 + 2; - v0.unk_00 = param0->unk_08; - v0.unk_0C = ¶m0->unk_34; - v0.unk_1C = param0; + v0.count = v3 + 2; + v0.maxDisplay = v3 + 2; + v0.choices = param0->unk_08; + v0.window = ¶m0->unk_34; + v0.tmp = param0; - param0->unk_00 = sub_0200112C(&v0, 0, param0->unk_78, 4); + param0->unk_00 = ListMenu_New(&v0, 0, param0->unk_78, 4); Window_CopyToVRAM(¶m0->unk_34); } static void ov7_0224B6AC(UnkStruct_ov7_0224B4E8 *param0) { if (param0->unk_00) { - sub_02001384(param0->unk_00, NULL, NULL); + ListMenu_Free(param0->unk_00, NULL, NULL); Window_Clear(¶m0->unk_34, 1); Bg_ScheduleTilemapTransfer(param0->unk_34.bgConfig, param0->unk_34.bgLayer); Window_Remove(¶m0->unk_34); - sub_02013A3C(param0->unk_08); + StringList_Free(param0->unk_08); param0->unk_00 = NULL; } @@ -179,11 +175,11 @@ static int ov7_0224B6E8(UnkStruct_ov7_0224B4E8 *param0) int v0; u16 v1; - v0 = sub_02001288(param0->unk_00); - sub_020014DC(param0->unk_00, NULL, ¶m0->unk_78); + v0 = ListMenu_ProcessInput(param0->unk_00); + ListMenu_GetListAndCursorPos(param0->unk_00, NULL, ¶m0->unk_78); v1 = param0->unk_80; - sub_020014D0(param0->unk_00, ¶m0->unk_80); + ListMenu_CalcTrueCursorPos(param0->unk_00, ¶m0->unk_80); if (v1 != param0->unk_80) { Sound_PlayEffect(1500); @@ -219,14 +215,14 @@ static UnkStruct_ov7_0224F4D8 Unk_ov7_0224F4D8[] = { static void ov7_0224B788(UnkStruct_ov7_0224B4E8 *param0) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; int v1 = 3, v2; int v3 = 10; int v4 = 9; int v5 = 22; UnkStruct_ov7_0224F4D8 *v6 = Unk_ov7_0224F4D8; - param0->unk_0C = sub_02013A04(v1, 4); + param0->unk_0C = StringList_New(v1, 4); Window_Add(param0->fieldSystem->unk_08, ¶m0->unk_44, 3, v5, v3, v4, v1 * 2, 13, (((1024 - (18 + 12) - 9 - (32 * 8)) - (18 + 12 + 24)) - (27 * 4)) - v4 * v1 * 2); Window_Show(¶m0->unk_44, 1, 1024 - (18 + 12) - 9, 11); @@ -235,19 +231,19 @@ static void ov7_0224B788(UnkStruct_ov7_0224B4E8 *param0) int v7; for (v7 = 0; v7 < v1; v7++) { - sub_02013A4C(param0->unk_0C, param0->unk_68, v6->unk_00, v6->unk_04); + StringList_AddFromMessageBank(param0->unk_0C, param0->unk_68, v6->unk_00, v6->unk_04); v6++; } } v0 = Unk_ov7_0224F188; - v0.unk_10 = v1; - v0.unk_12 = v1; - v0.unk_00 = param0->unk_0C; - v0.unk_0C = ¶m0->unk_44; - v0.unk_1C = param0; + v0.count = v1; + v0.maxDisplay = v1; + v0.choices = param0->unk_0C; + v0.window = ¶m0->unk_44; + v0.tmp = param0; - param0->unk_04 = sub_0200112C(&v0, 0, param0->unk_7A, 4); + param0->unk_04 = ListMenu_New(&v0, 0, param0->unk_7A, 4); Window_CopyToVRAM(¶m0->unk_44); } @@ -256,11 +252,11 @@ static int ov7_0224B83C(UnkStruct_ov7_0224B4E8 *param0) int v0; u16 v1; - v0 = sub_02001288(param0->unk_04); - sub_020014DC(param0->unk_04, NULL, ¶m0->unk_7A); + v0 = ListMenu_ProcessInput(param0->unk_04); + ListMenu_GetListAndCursorPos(param0->unk_04, NULL, ¶m0->unk_7A); v1 = param0->unk_82; - sub_020014D0(param0->unk_04, ¶m0->unk_82); + ListMenu_CalcTrueCursorPos(param0->unk_04, ¶m0->unk_82); if (v1 != param0->unk_82) { Sound_PlayEffect(1500); @@ -280,11 +276,11 @@ static int ov7_0224B83C(UnkStruct_ov7_0224B4E8 *param0) } if (param0->unk_04) { - sub_02001384(param0->unk_04, NULL, NULL); + ListMenu_Free(param0->unk_04, NULL, NULL); Window_Clear(¶m0->unk_44, 1); Bg_ScheduleTilemapTransfer(param0->unk_44.bgConfig, param0->unk_44.bgLayer); Window_Remove(¶m0->unk_44); - sub_02013A3C(param0->unk_0C); + StringList_Free(param0->unk_0C); param0->unk_04 = NULL; } diff --git a/src/overlay007/ov7_0224BE9C.c b/src/overlay007/ov7_0224BE9C.c index d5414667db..1a8bb2e411 100644 --- a/src/overlay007/ov7_0224BE9C.c +++ b/src/overlay007/ov7_0224BE9C.c @@ -3,15 +3,10 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_02029D04_decl.h" #include "struct_defs/struct_0200C738.h" -#include "struct_defs/struct_02013A04_t.h" #include "overlay007/struct_ov7_0224BEFC_decl.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "bag.h" #include "bg_window.h" @@ -20,16 +15,17 @@ #include "font.h" #include "game_options.h" #include "heap.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "save_player.h" #include "savedata.h" #include "sprite_resource.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_020093B4.h" #include "unk_0200A328.h" @@ -87,8 +83,8 @@ typedef struct { typedef struct { u32 unk_00; Window *unk_04; - BmpList *unk_08; - ResourceMetadata unk_0C[23]; + ListMenu *unk_08; + StringList unk_0C[23]; Strbuf *unk_C4[23]; s32 unk_120; StringTemplate *unk_124; @@ -106,7 +102,7 @@ typedef void (*UnkFuncPtr_ov7_0224C768)(void *, u32); typedef struct { u32 unk_00; - UIControlData *unk_04; + Menu *unk_04; u32 unk_08; } UnkStruct_ov7_0224CC44; @@ -564,7 +560,7 @@ static void ov7_0224C768(UnkStruct_ov7_0224C768 *param0, BgConfig *param1, u32 p static const u8 v4[2] = { 8, 136 }; - static UnkStruct_ov84_02240FA8 v5 = { + static ListMenuTemplate v5 = { NULL, NULL, NULL, @@ -608,23 +604,23 @@ static void ov7_0224C768(UnkStruct_ov7_0224C768 *param0, BgConfig *param1, u32 p StringTemplate_Format(param0->unk_124, param0->unk_128, v1); param0->unk_C4[v0] = Strbuf_Clone(param0->unk_128, param2); - param0->unk_0C[v0].unk_00 = param0->unk_C4[v0]; - param0->unk_0C[v0].unk_04 = v0; + param0->unk_0C[v0].entry = param0->unk_C4[v0]; + param0->unk_0C[v0].index = v0; } param0->unk_C4[param4] = MessageLoader_GetNewStrbuf(param5, 19); - param0->unk_0C[param4].unk_00 = param0->unk_C4[param4]; - param0->unk_0C[param4].unk_04 = param4; + param0->unk_0C[param4].entry = param0->unk_C4[param4]; + param0->unk_0C[param4].index = param4; StringTemplate_Free(param0->unk_124); Strbuf_Free(param0->unk_128); Strbuf_Free(v1); - v5.unk_0C = param0->unk_04; - v5.unk_10 = param0->unk_120; - v5.unk_00 = param0->unk_0C; + v5.window = param0->unk_04; + v5.count = param0->unk_120; + v5.choices = param0->unk_0C; - param0->unk_08 = sub_0200112C(&v5, 0, 0, param2); + param0->unk_08 = ListMenu_New(&v5, 0, 0, param2); Window_Show(param0->unk_04, 0, (1 + (18 + 12)), 11); @@ -668,7 +664,7 @@ static void ov7_0224C934(UnkStruct_ov7_0224C768 *param0) Strbuf_Free(param0->unk_C4[v0]); } - sub_02001384(param0->unk_08, NULL, NULL); + ListMenu_Free(param0->unk_08, NULL, NULL); Window_ClearAndCopyToVRAM(param0->unk_04); Window_Remove(param0->unk_04); Windows_Delete(param0->unk_04, 1); @@ -681,10 +677,10 @@ static u32 ov7_0224C9A4(UnkStruct_ov7_0224C768 *param0) u32 v0; u16 v1; - v0 = sub_02001288(param0->unk_08); + v0 = ListMenu_ProcessInput(param0->unk_08); if (v0 == 0xffffffff) { - sub_020014D0(param0->unk_08, &v1); + ListMenu_CalcTrueCursorPos(param0->unk_08, &v1); if (param0->unk_12C != v1) { param0->unk_12C = v1; @@ -747,7 +743,7 @@ static void ov7_0224CB70(UnkStruct_ov7_0224C768 *param0) { u16 v0; - sub_020014DC(param0->unk_08, &v0, NULL); + ListMenu_GetListAndCursorPos(param0->unk_08, &v0, NULL); if (v0 <= 0) { CellActor_SetDrawFlag(param0->unk_158[0], 0); @@ -801,7 +797,7 @@ static void ov7_0224CC44(UnkStruct_ov7_0224CC44 *param0, BgConfig *param1, u32 p return; } - param0->unk_04 = sub_02002100(param1, &v0, (1 + (18 + 12)), 11, param2); + param0->unk_04 = Menu_MakeYesNoChoice(param1, &v0, (1 + (18 + 12)), 11, param2); param0->unk_08 = param2; param0->unk_00 = 1; } @@ -819,7 +815,7 @@ static u32 ov7_0224CC78(UnkStruct_ov7_0224CC44 *param0) { u32 v0; - v0 = sub_02002114(param0->unk_04, param0->unk_08); + v0 = Menu_ProcessInputAndHandleExit(param0->unk_04, param0->unk_08); return v0; } diff --git a/src/overlay007/ov7_0224CD28.c b/src/overlay007/ov7_0224CD28.c index 41786b85d9..5c8c946af2 100644 --- a/src/overlay007/ov7_0224CD28.c +++ b/src/overlay007/ov7_0224CD28.c @@ -5,9 +5,7 @@ #include "consts/game_records.h" -#include "struct_decls/struct_0200112C_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/struct_02081CF4.h" #include "field/field_system.h" #include "overlay005/ov5_021D0D80.h" @@ -15,7 +13,6 @@ #include "overlay007/struct_ov7_0224D008.h" #include "overlay007/struct_ov7_0224F2EC.h" #include "overlay007/struct_ov7_0224F358.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "bag.h" #include "bg_window.h" @@ -30,25 +27,25 @@ #include "heap.h" #include "item.h" #include "journal.h" +#include "list_menu.h" #include "map_header.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "player_avatar.h" #include "save_player.h" #include "sprite_resource.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" #include "trainer_info.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200A328.h" #include "unk_0200C440.h" #include "unk_0200C6E4.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" -#include "unk_02013A04.h" #include "unk_0202854C.h" #include "unk_0202C9F4.h" #include "unk_0202D05C.h" @@ -78,8 +75,8 @@ static u8 ov7_0224D620(UnkStruct_ov7_0224D008 *param0); static u8 ov7_0224DC84(UnkStruct_ov7_0224D008 *param0); static u8 ov7_0224E950(FieldSystem *fieldSystem, UnkStruct_ov7_0224D008 *param1); static void ov7_0224D6BC(UnkStruct_ov7_0224D008 *param0); -static void ov7_0224D85C(BmpList *param0, u32 param1, u8 param2); -static void ov7_0224D9B8(BmpList *param0, u32 param1, u8 param2); +static void ov7_0224D85C(ListMenu *param0, u32 param1, u8 param2); +static void ov7_0224D9B8(ListMenu *param0, u32 param1, u8 param2); static void ov7_0224DAF8(UnkStruct_ov7_0224D008 *param0, u8 param1); static u8 ov7_0224DE94(UnkStruct_ov7_0224D008 *param0); static u8 ov7_0224DFB0(UnkStruct_ov7_0224D008 *param0); @@ -323,51 +320,51 @@ static void ov7_0224D018(UnkStruct_ov7_0224D008 *param0) static void ov7_0224D040(UnkStruct_ov7_0224D008 *param0) { - UnkStruct_02081CF4 v0; + MenuTemplate v0; u8 v1; if (param0->unk_2A9 == 0) { v1 = 3; - param0->unk_84 = sub_02013A04(v1, 11); + param0->unk_84 = StringList_New(v1, 11); - sub_02013A4C(param0->unk_84, param0->unk_88, 15, 2); - sub_02013A4C(param0->unk_84, param0->unk_88, 16, 14); - sub_02013A4C(param0->unk_84, param0->unk_88, 17, 0xfffffffe); + StringList_AddFromMessageBank(param0->unk_84, param0->unk_88, 15, 2); + StringList_AddFromMessageBank(param0->unk_84, param0->unk_88, 16, 14); + StringList_AddFromMessageBank(param0->unk_84, param0->unk_88, 17, 0xfffffffe); Window_Add(param0->unk_00, ¶m0->unk_08[0], 3, 1, 1, 13, 6, 13, ((((1024 - (18 + 12) - 9 - (32 * 8)) - (18 + 12 + 24)) - (27 * 4)) - (13 * 6))); } else if (param0->unk_2A9 == 3) { v1 = 2; - param0->unk_84 = sub_02013A04(v1, 11); + param0->unk_84 = StringList_New(v1, 11); - sub_02013A4C(param0->unk_84, param0->unk_88, 29, 2); - sub_02013A4C(param0->unk_84, param0->unk_88, 30, 0xfffffffe); + StringList_AddFromMessageBank(param0->unk_84, param0->unk_88, 29, 2); + StringList_AddFromMessageBank(param0->unk_84, param0->unk_88, 30, 0xfffffffe); Window_Add(param0->unk_00, ¶m0->unk_08[0], 3, 23, 13, 7, 4, 13, ((((1024 - (18 + 12) - 9 - (32 * 8)) - (18 + 12 + 24)) - (27 * 4)) - (13 * 6))); } else { v1 = 2; - param0->unk_84 = sub_02013A04(v1, 11); + param0->unk_84 = StringList_New(v1, 11); - sub_02013A4C(param0->unk_84, param0->unk_88, 15, 2); - sub_02013A4C(param0->unk_84, param0->unk_88, 17, 0xfffffffe); + StringList_AddFromMessageBank(param0->unk_84, param0->unk_88, 15, 2); + StringList_AddFromMessageBank(param0->unk_84, param0->unk_88, 17, 0xfffffffe); Window_Add(param0->unk_00, ¶m0->unk_08[0], 3, 1, 1, 13, 4, 13, ((((1024 - (18 + 12) - 9 - (32 * 8)) - (18 + 12 + 24)) - (27 * 4)) - (13 * 6))); } - v0.unk_00 = param0->unk_84; - v0.unk_04 = ¶m0->unk_08[0]; - v0.unk_08 = 0; - v0.unk_09 = 1; - v0.unk_0A = v1; - v0.unk_0B_0 = 0; - v0.unk_0B_4 = 0; - v0.unk_0B_6 = 0; + v0.choices = param0->unk_84; + v0.window = ¶m0->unk_08[0]; + v0.fontID = FONT_SYSTEM; + v0.xSize = 1; + v0.ySize = v1; + v0.lineSpacing = 0; + v0.suppressCursor = FALSE; + v0.loopAround = FALSE; sub_0200DAA4(param0->unk_00, 3, 1024 - (18 + 12) - 9, 11, 0, 11); Window_Show(¶m0->unk_08[0], 1, 1024 - (18 + 12) - 9, 11); - param0->unk_80 = sub_02001B7C(&v0, 8, 0, 0, 11, PAD_BUTTON_B); + param0->unk_80 = Menu_NewAndCopyToVRAM(&v0, 8, 0, 0, 11, PAD_BUTTON_B); } static u8 ov7_0224D1EC(UnkStruct_ov7_0224D008 *param0) { - u32 v0 = sub_02001BE0(param0->unk_80); + u32 v0 = Menu_ProcessInput(param0->unk_80); switch (v0) { case 0xffffffff: @@ -386,8 +383,8 @@ static void ov7_0224D21C(UnkStruct_ov7_0224D008 *param0) { Window_Clear(¶m0->unk_08[0], 1); Window_ClearAndCopyToVRAM(¶m0->unk_08[0]); - sub_02001BC4(param0->unk_80, NULL); - sub_02013A3C(param0->unk_84); + Menu_Free(param0->unk_80, NULL); + StringList_Free(param0->unk_84); Window_Remove(¶m0->unk_08[0]); } @@ -554,7 +551,7 @@ static u8 ov7_0224D620(UnkStruct_ov7_0224D008 *param0) return 4; } -static const UnkStruct_ov84_02240FA8 Unk_ov7_0224F308 = { +static const ListMenuTemplate Unk_ov7_0224F308 = { NULL, ov7_0224D85C, ov7_0224D9B8, @@ -591,7 +588,7 @@ static void ov7_0224D6BC(UnkStruct_ov7_0224D008 *param0) { MessageLoader *v0; Strbuf *v1; - UnkStruct_ov84_02240FA8 v2; + ListMenuTemplate v2; u32 v3; u32 v4; MessageLoader *v5; @@ -606,28 +603,28 @@ static void ov7_0224D6BC(UnkStruct_ov7_0224D008 *param0) v0 = MessageLoader_Init(0, 26, 12, 11); } - param0->unk_7C = sub_02013A04(param0->unk_294 + 1, 11); + param0->unk_7C = StringList_New(param0->unk_294 + 1, 11); for (v3 = 0; v3 < param0->unk_294; v3++) { v4 = ov7_0224D698(param0, param0->unk_290[v3]); if ((v4 <= 420) && (v4 >= 328)) { v1 = MessageLoader_GetNewStrbuf(v5, Item_MoveForTMHM(v4)); - sub_02013A6C(param0->unk_7C, v1, param0->unk_290[v3]); + StringList_AddFromStrbuf(param0->unk_7C, v1, param0->unk_290[v3]); Strbuf_Free(v1); v6 = 1; } else { v1 = MessageLoader_GetNewStrbuf(v0, v4); - sub_02013A6C(param0->unk_7C, v1, param0->unk_290[v3]); + StringList_AddFromStrbuf(param0->unk_7C, v1, param0->unk_290[v3]); Strbuf_Free(v1); } } if (v6) { - sub_02013A4C(param0->unk_7C, param0->unk_88, 26, 0xfffffffe); + StringList_AddFromMessageBank(param0->unk_7C, param0->unk_88, 26, 0xfffffffe); } else { - sub_02013A4C(param0->unk_7C, param0->unk_88, 8, 0xfffffffe); + StringList_AddFromMessageBank(param0->unk_7C, param0->unk_88, 8, 0xfffffffe); } MessageLoader_Free(v0); @@ -639,22 +636,22 @@ static void ov7_0224D6BC(UnkStruct_ov7_0224D008 *param0) v2 = Unk_ov7_0224F308; if ((v4 <= 420) && (v4 >= 328)) { - v2.unk_15 = 35; + v2.textXOffset = 35; } else { - v2.unk_15 = 0; + v2.textXOffset = 0; } - v2.unk_00 = param0->unk_7C; - v2.unk_0C = ¶m0->unk_08[0]; - v2.unk_10 = param0->unk_294 + 1; - v2.unk_1C = (void *)param0; + v2.choices = param0->unk_7C; + v2.window = ¶m0->unk_08[0]; + v2.count = param0->unk_294 + 1; + v2.tmp = (void *)param0; - param0->unk_78 = sub_0200112C(&v2, 0, 0, 11); + param0->unk_78 = ListMenu_New(&v2, 0, 0, 11); } -static void ov7_0224D85C(BmpList *param0, u32 param1, u8 param2) +static void ov7_0224D85C(ListMenu *param0, u32 param1, u8 param2) { - UnkStruct_ov7_0224D008 *v0 = (UnkStruct_ov7_0224D008 *)sub_02001504(param0, 19); + UnkStruct_ov7_0224D008 *v0 = (UnkStruct_ov7_0224D008 *)ListMenu_GetAttribute(param0, 19); if (param2 != 1) { Sound_PlayEffect(1592); @@ -698,7 +695,7 @@ static void ov7_0224D85C(BmpList *param0, u32 param1, u8 param2) u32 v4; u16 v5, v6; - sub_020014DC(param0, &v5, &v6); + ListMenu_GetListAndCursorPos(param0, &v5, &v6); if (v5 == 0) { CellActor_SetDrawFlag(v0->unk_25C[0], 0); @@ -706,7 +703,7 @@ static void ov7_0224D85C(BmpList *param0, u32 param1, u8 param2) CellActor_SetDrawFlag(v0->unk_25C[0], 1); } - v4 = sub_02001504(param0, 2); + v4 = ListMenu_GetAttribute(param0, 2); if ((v4 > 7) && (v4 > v5 + 7)) { CellActor_SetDrawFlag(v0->unk_25C[1], 1); @@ -717,9 +714,9 @@ static void ov7_0224D85C(BmpList *param0, u32 param1, u8 param2) Window_ScheduleCopyToVRAM(&v0->unk_08[1]); } -static void ov7_0224D9B8(BmpList *param0, u32 param1, u8 param2) +static void ov7_0224D9B8(ListMenu *param0, u32 param1, u8 param2) { - UnkStruct_ov7_0224D008 *v0 = (UnkStruct_ov7_0224D008 *)sub_02001504(param0, 19); + UnkStruct_ov7_0224D008 *v0 = (UnkStruct_ov7_0224D008 *)ListMenu_GetAttribute(param0, 19); if (param1 != 0xfffffffe) { Strbuf *v1; @@ -823,9 +820,9 @@ static u8 ov7_0224DC84(UnkStruct_ov7_0224D008 *param0) u32 v0; u16 v1, v2; - sub_020014DC(param0->unk_78, NULL, &v1); - v0 = sub_02001288(param0->unk_78); - sub_020014DC(param0->unk_78, NULL, &v2); + ListMenu_GetListAndCursorPos(param0->unk_78, NULL, &v1); + v0 = ListMenu_ProcessInput(param0->unk_78); + ListMenu_GetListAndCursorPos(param0->unk_78, NULL, &v2); if (v1 != v2) { SpriteActor_SetPositionXY(param0->unk_25C[2], (176 - 4), 24 + v2 * 16); @@ -835,8 +832,8 @@ static u8 ov7_0224DC84(UnkStruct_ov7_0224D008 *param0) case 0xffffffff: break; case 0xfffffffe: - sub_02001384(param0->unk_78, NULL, NULL); - sub_02013A3C(param0->unk_7C); + ListMenu_Free(param0->unk_78, NULL, NULL); + StringList_Free(param0->unk_7C); ov7_0224D44C(param0); ov7_0224D5D8(param0); Bg_ClearTilemap(param0->unk_00, 1); @@ -1111,13 +1108,13 @@ static u8 ov7_0224E3A0(UnkStruct_ov7_0224D008 *param0) return 7; } - param0->unk_80 = sub_02002100(param0->unk_00, &Unk_ov7_0224F2CC, (1 + (18 + 12)), 11, 11); + param0->unk_80 = Menu_MakeYesNoChoice(param0->unk_00, &Unk_ov7_0224F2CC, (1 + (18 + 12)), 11, 11); return 8; } static u8 ov7_0224E3D8(UnkStruct_ov7_0224D008 *param0) { - switch (sub_02002114(param0->unk_80, 11)) { + switch (Menu_ProcessInputAndHandleExit(param0->unk_80, 11)) { case 0: { Strbuf *v0; diff --git a/src/overlay010/ov10_0221F800.c b/src/overlay010/ov10_0221F800.c index d2192c772c..e560782002 100644 --- a/src/overlay010/ov10_0221F800.c +++ b/src/overlay010/ov10_0221F800.c @@ -4,7 +4,6 @@ #include #include "struct_decls/font_oam.h" -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_0200C440_decl.h" #include "struct_decls/struct_0200C6E4_decl.h" #include "struct_decls/struct_0200C704_decl.h" @@ -37,6 +36,7 @@ #include "item.h" #include "journal.h" #include "map_header.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "palette.h" @@ -50,7 +50,6 @@ #include "text.h" #include "trainer_data.h" #include "trainer_info.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200679C.h" #include "unk_0200C440.h" @@ -134,7 +133,7 @@ typedef struct UnkStruct_ov10_0221FB28_t { Strbuf *unk_BA8; int unk_BAC; int unk_BB0; - UIControlData *unk_BB4; + Menu *unk_BB4; void *unk_BB8; int unk_BBC; int unk_BC0; @@ -498,13 +497,13 @@ static void ov10_0221F930(UnkStruct_ov10_0221FB28 *param0) sub_0200E060(¶m0->unk_B8C, 0, 1, 15); param0->unk_BAC = Text_AddPrinterWithParams(¶m0->unk_B8C, FONT_MESSAGE, param0->unk_BA8, 0, 0, TEXT_SPEED_INSTANT, NULL); - param0->unk_BB4 = sub_02002054(param0->unk_0C, &Unk_ov10_02222A68, (1 + (18 + 12)), 14, 1, param0->unk_00->unk_24); + param0->unk_BB4 = Menu_MakeYesNoChoiceWithCursorAt(param0->unk_0C, &Unk_ov10_02222A68, (1 + (18 + 12)), 14, 1, param0->unk_00->unk_24); Bg_ScheduleTilemapTransfer(param0->unk_0C, 0); param0->unk_BB0 = 4; break; case 4: { - u32 v0 = sub_02002114(param0->unk_BB4, param0->unk_00->unk_24); + u32 v0 = Menu_ProcessInputAndHandleExit(param0->unk_BB4, param0->unk_00->unk_24); switch (v0) { case 0: @@ -528,7 +527,7 @@ static void ov10_0221F930(UnkStruct_ov10_0221FB28 *param0) break; case 7: if (param0->unk_BB4 != NULL) { - sub_02002154(param0->unk_BB4, param0->unk_00->unk_24); + Menu_DestroyForExit(param0->unk_BB4, param0->unk_00->unk_24); param0->unk_BB4 = NULL; } diff --git a/src/overlay019/ov19_021DB2FC.c b/src/overlay019/ov19_021DB2FC.c index ae13143aca..5214dc6ebb 100644 --- a/src/overlay019/ov19_021DB2FC.c +++ b/src/overlay019/ov19_021DB2FC.c @@ -13,12 +13,12 @@ #include "enums.h" #include "graphics.h" #include "heap.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "strbuf.h" #include "string_template.h" #include "text.h" -#include "unk_02001AF4.h" #include "unk_0200DA60.h" static void ov19_021DB4B4(BgConfig *param0, u32 param1, u32 param2, u32 param3, u32 param4, u32 param5); @@ -255,7 +255,7 @@ void ov19_021DB748(UnkStruct_ov19_021DB6F0 *param0, const UnkStruct_ov19_021DF96 v1 = (8 - param1->unk_21) * 16; Window_FillRectWithColor(v0, 15, 0, v1, 10, param1->unk_21 * 16); - sub_02002180(v0, 0, v1 + (param1->unk_20 * 16)); + Window_DrawMenuCursor(v0, 0, v1 + (param1->unk_20 * 16)); Window_LoadTiles(v0); } diff --git a/src/overlay023/ov23_0223E140.c b/src/overlay023/ov23_0223E140.c index 8f52081386..fdfbdc1c27 100644 --- a/src/overlay023/ov23_0223E140.c +++ b/src/overlay023/ov23_0223E140.c @@ -5,7 +5,6 @@ #include "consts/game_records.h" -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_0202855C_decl.h" #include "struct_decls/struct_020298B0_decl.h" #include "struct_defs/struct_0200C738.h" @@ -38,6 +37,7 @@ #include "gx_layers.h" #include "heap.h" #include "journal.h" +#include "menu.h" #include "narc.h" #include "save_player.h" #include "savedata.h" @@ -47,7 +47,6 @@ #include "sys_task_manager.h" #include "text.h" #include "trainer_info.h" -#include "unk_02001AF4.h" #include "unk_020041CC.h" #include "unk_02005474.h" #include "unk_020093B4.h" @@ -147,7 +146,7 @@ typedef struct { CellActorResourceData unk_204[2]; CellActor *unk_24C[8]; UnkStruct_ov23_0223E6F8 unk_26C[250]; - UIControlData *unk_848; + Menu *unk_848; UnkStruct_ov23_0223E6F8 *unk_84C[8]; u8 unk_86C[8]; UnkStruct_ov23_0223FC9C unk_874[8]; @@ -685,7 +684,7 @@ void ov23_0223E2F8(void) ov23_02254044(ov23_0224219C()); if (Unk_ov23_02257740->unk_848) { - sub_02002154(Unk_ov23_02257740->unk_848, 4); + Menu_DestroyForExit(Unk_ov23_02257740->unk_848, 4); } sub_02059514(); @@ -994,7 +993,7 @@ static int ov23_0223E8CC(u16 param0, u16 param1) static void ov23_0223E99C(SysTask *param0, void *param1) { if (Unk_ov23_02257740->unk_848) { - sub_02002154(Unk_ov23_02257740->unk_848, 4); + Menu_DestroyForExit(Unk_ov23_02257740->unk_848, 4); } Unk_ov23_02257740->unk_848 = NULL; @@ -1022,11 +1021,11 @@ static void ov23_0223EA38(SysTask *param0, void *param1) if (Unk_ov23_02257740->unk_A24 != -1) { if (Text_IsPrinterActive(Unk_ov23_02257740->unk_A24) == 0) { - Unk_ov23_02257740->unk_848 = sub_02002100(Unk_ov23_02257740->fieldSystem->unk_08, &Unk_ov23_0225630E, 1024 - (18 + 12) - 9, 11, 4); + Unk_ov23_02257740->unk_848 = Menu_MakeYesNoChoice(Unk_ov23_02257740->fieldSystem->unk_08, &Unk_ov23_0225630E, 1024 - (18 + 12) - 9, 11, 4); Unk_ov23_02257740->unk_A24 = -1; } } else { - int v1 = sub_02002114(Unk_ov23_02257740->unk_848, 4); + int v1 = Menu_ProcessInputAndHandleExit(Unk_ov23_02257740->unk_848, 4); if (v1 == 0xffffffff) { return; diff --git a/src/overlay023/ov23_02248C08.c b/src/overlay023/ov23_02248C08.c index 4fd53ff71e..60ace9a5ea 100644 --- a/src/overlay023/ov23_02248C08.c +++ b/src/overlay023/ov23_02248C08.c @@ -3,25 +3,21 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_020298B0_decl.h" -#include "struct_defs/struct_02013A04_t.h" #include "overlay023/funcptr_ov23_02248D20.h" #include "overlay023/struct_ov23_02248D20.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "bg_window.h" #include "colored_arrow.h" #include "core_sys.h" #include "heap.h" -#include "unk_0200112C.h" +#include "list_menu.h" +#include "string_list.h" #include "unk_02005474.h" -#include "unk_02013A04.h" #include "unk_0202854C.h" -UnkStruct_ov23_02248D20 *ov23_02248C08(UnkStruct_ov84_02240FA8 *param0, u16 param1, u16 param2, u8 param3, UnkFuncPtr_ov23_02248D20 param4, UndergroundData *param5, BOOL param6) +UnkStruct_ov23_02248D20 *ov23_02248C08(ListMenuTemplate *param0, u16 param1, u16 param2, u8 param3, UnkFuncPtr_ov23_02248D20 param4, UndergroundData *param5, BOOL param6) { UnkStruct_ov23_02248D20 *v0 = (UnkStruct_ov23_02248D20 *)Heap_AllocFromHeap(param3, sizeof(UnkStruct_ov23_02248D20)); @@ -39,20 +35,20 @@ UnkStruct_ov23_02248D20 *ov23_02248C08(UnkStruct_ov84_02240FA8 *param0, u16 para v0->unk_1D = param3; { - ResourceMetadata *v1 = sub_02013A04(param0->unk_10, v0->unk_1D); + StringList *v1 = StringList_New(param0->count, v0->unk_1D); int v2; - for (v2 = 0; v2 < param0->unk_10; v2++) { - sub_02013A90(v1, ¶m0->unk_00[v2]); + for (v2 = 0; v2 < param0->count; v2++) { + StringList_AddFromEntry(v1, ¶m0->choices[v2]); } - param0->unk_00 = v1; + param0->choices = v1; v0->unk_08 = v1; } } v0->unk_20 = (param1 + param2); - v0->unk_0C = sub_0200112C(param0, param1, param2, param3); + v0->unk_0C = ListMenu_New(param0, param1, param2, param3); return v0; } @@ -60,7 +56,7 @@ UnkStruct_ov23_02248D20 *ov23_02248C08(UnkStruct_ov84_02240FA8 *param0, u16 para static void ov23_02248CA4(u16 param0, u16 param1, UnkStruct_ov23_02248D20 *param2) { u16 v0 = param2->unk_14 + param2->unk_16; - u16 v1 = sub_02001504(param2->unk_0C, 3); + u16 v1 = ListMenu_GetAttribute(param2->unk_0C, 3); if ((param2->unk_18 != param0) || (param2->unk_1A != param1)) { param2->unk_18 = param0; @@ -74,10 +70,10 @@ static void ov23_02248CA4(u16 param0, u16 param1, UnkStruct_ov23_02248D20 *param } { - int v2 = sub_02001504(param2->unk_0C, 7); - u8 v3 = sub_02001504(param2->unk_0C, 9); - int v4 = (v0 - param0) * v3 + sub_02001504(param2->unk_0C, 8); - Window *v5 = (Window *)sub_02001504(param2->unk_0C, 18); + int v2 = ListMenu_GetAttribute(param2->unk_0C, 7); + u8 v3 = ListMenu_GetAttribute(param2->unk_0C, 9); + int v4 = (v0 - param0) * v3 + ListMenu_GetAttribute(param2->unk_0C, 8); + Window *v5 = (Window *)ListMenu_GetAttribute(param2->unk_0C, 18); ColoredArrow_Print(param2->unk_10, v5, v2, v4); } @@ -85,16 +81,16 @@ static void ov23_02248CA4(u16 param0, u16 param1, UnkStruct_ov23_02248D20 *param u32 ov23_02248D20(UnkStruct_ov23_02248D20 *param0) { - BmpList *v0 = param0->unk_0C; + ListMenu *v0 = param0->unk_0C; u16 v1, v2, v3; int v4, v5; u32 v6; - ResourceMetadata *v7; + StringList *v7; if (param0->unk_00) { - int v8 = sub_02001504(v0, 2); + int v8 = ListMenu_GetAttribute(v0, 2); - sub_020014DC(v0, &v1, &v2); + ListMenu_GetListAndCursorPos(v0, &v1, &v2); if (param0->unk_1C) { ov23_02248CA4(v1, v2, param0); @@ -112,19 +108,19 @@ u32 ov23_02248D20(UnkStruct_ov23_02248D20 *param0) param0->unk_00(param0->unk_04, param0->unk_14 + param0->unk_16, v1 + v2); - v7 = sub_02013A04(v8, param0->unk_1D); + v7 = StringList_New(v8, param0->unk_1D); v5 = 0; for (v4 = 0; v4 < v8; v4++) { if (v4 == (param0->unk_14 + param0->unk_16)) { v5++; } else { - sub_02013A90(v7, ¶m0->unk_08[v5]); + StringList_AddFromEntry(v7, ¶m0->unk_08[v5]); v5++; } if ((v4) == (v1 + v2)) { - sub_02013A90(v7, ¶m0->unk_08[param0->unk_14 + param0->unk_16]); + StringList_AddFromEntry(v7, ¶m0->unk_08[param0->unk_14 + param0->unk_16]); } } @@ -142,24 +138,24 @@ u32 ov23_02248D20(UnkStruct_ov23_02248D20 *param0) } v9 = (v4 << 1) + v10; - v7[v4].unk_04 = v9; + v7[v4].index = v9; } v9 = (v4 << 1) + 1; - v7[v4].unk_04 = v9; + v7[v4].index = v9; } else { for (v4 = 0; v4 < v8 - 1; v4++) { - v7[v4].unk_04 = v4; + v7[v4].index = v4; } } Heap_FreeToHeap(param0->unk_08); param0->unk_08 = v7; - sub_020015CC(v0, v7); + ListMenu_SetChoices(v0, v7); param0->unk_1C = 0; - sub_020013AC(v0); + ListMenu_Draw(v0); return 0xffffffff; } } else { @@ -181,10 +177,10 @@ u32 ov23_02248D20(UnkStruct_ov23_02248D20 *param0) } } - v6 = sub_02001288(v0); + v6 = ListMenu_ProcessInput(v0); v3 = param0->unk_20; - sub_020014D0(v0, ¶m0->unk_20); + ListMenu_CalcTrueCursorPos(v0, ¶m0->unk_20); if (v3 != param0->unk_20) { Sound_PlayEffect(1500); @@ -206,9 +202,9 @@ u32 ov23_02248D20(UnkStruct_ov23_02248D20 *param0) void ov23_02248EF8(UnkStruct_ov23_02248D20 *param0, u16 *param1, u16 *param2) { - BmpList *v0 = param0->unk_0C; + ListMenu *v0 = param0->unk_0C; - sub_02001384(v0, param1, param2); + ListMenu_Free(v0, param1, param2); if (param0->unk_00) { ColoredArrow_Free(param0->unk_10); diff --git a/src/overlay023/ov23_0224B05C.c b/src/overlay023/ov23_0224B05C.c index 465cb816bc..81399e50bd 100644 --- a/src/overlay023/ov23_0224B05C.c +++ b/src/overlay023/ov23_0224B05C.c @@ -5,15 +5,11 @@ #include "consts/game_records.h" -#include "struct_decls/struct_02001AF4_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_0202855C_decl.h" #include "struct_decls/struct_02029894_decl.h" #include "struct_decls/struct_020298B0_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/struct_02013A04_t.h" #include "struct_defs/struct_02049FA8.h" -#include "struct_defs/struct_02081CF4.h" #include "field/field_system.h" #include "overlay005/ov5_021E15F4.h" @@ -39,23 +35,24 @@ #include "core_sys.h" #include "field_map_change.h" #include "field_system.h" +#include "font.h" #include "game_records.h" #include "graphics.h" #include "heap.h" #include "journal.h" #include "map_object_move.h" +#include "menu.h" #include "message.h" #include "player_avatar.h" #include "savedata.h" #include "strbuf.h" +#include "string_list.h" #include "sys_task.h" #include "sys_task_manager.h" #include "trainer_info.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" -#include "unk_02013A04.h" #include "unk_0202854C.h" #include "unk_02030EE0.h" #include "unk_02033200.h" @@ -126,7 +123,7 @@ typedef struct { typedef struct { FieldSystem *fieldSystem; - UIControlData *unk_04; + Menu *unk_04; SysTask *unk_08; int unk_0C; int unk_10; @@ -147,7 +144,7 @@ typedef struct { typedef struct { FieldSystem *fieldSystem; SysTask *unk_04; - UIControlData *unk_08; + Menu *unk_08; int unk_0C; u8 unk_10; u8 unk_11; @@ -809,7 +806,7 @@ static void ov23_0224BA48(SysTask *param0, void *param1) UnkStruct_ov23_0224BA48 *v0 = param1; if (v0->unk_04) { - sub_02002154(v0->unk_04, 4); + Menu_DestroyForExit(v0->unk_04, 4); } SysTask_Done(param0); @@ -824,7 +821,7 @@ static void ov23_0224BA6C(SysTask *param0, void *param1) UnkStruct_ov23_0224B730 v1; if (v0->unk_04) { - sub_02002154(v0->unk_04, 4); + Menu_DestroyForExit(v0->unk_04, 4); } v1.unk_01 = 0; @@ -861,12 +858,12 @@ static void ov23_0224BAAC(SysTask *param0, void *param1) break; case 1: if (ov23_02254238(ov23_0224219C()) == 0) { - v0->unk_04 = sub_02002100(fieldSystem->unk_08, &Unk_ov23_02256864, 1024 - (18 + 12) - 9, 11, 4); + v0->unk_04 = Menu_MakeYesNoChoice(fieldSystem->unk_08, &Unk_ov23_02256864, 1024 - (18 + 12) - 9, 11, 4); v0->unk_0C = 2; } break; case 2: - v6 = sub_02002114(v0->unk_04, 4); + v6 = Menu_ProcessInputAndHandleExit(v0->unk_04, 4); if (v6 == 0) { v0->unk_04 = NULL; @@ -878,12 +875,12 @@ static void ov23_0224BAAC(SysTask *param0, void *param1) break; case 3: if (ov23_02254238(ov23_0224219C()) == 0) { - v0->unk_04 = sub_02002100(fieldSystem->unk_08, &Unk_ov23_02256864, 1024 - (18 + 12) - 9, 11, 4); + v0->unk_04 = Menu_MakeYesNoChoice(fieldSystem->unk_08, &Unk_ov23_02256864, 1024 - (18 + 12) - 9, 11, 4); v0->unk_0C = 4; } break; case 4: - v6 = sub_02002114(v0->unk_04, 4); + v6 = Menu_ProcessInputAndHandleExit(v0->unk_04, 4); if (v6 == 0) { v0->unk_04 = NULL; @@ -896,12 +893,12 @@ static void ov23_0224BAAC(SysTask *param0, void *param1) break; case 5: if (ov23_02254238(ov23_0224219C()) == 0) { - v0->unk_04 = sub_02002100(fieldSystem->unk_08, &Unk_ov23_02256864, 1024 - (18 + 12) - 9, 11, 4); + v0->unk_04 = Menu_MakeYesNoChoice(fieldSystem->unk_08, &Unk_ov23_02256864, 1024 - (18 + 12) - 9, 11, 4); v0->unk_0C = 6; } break; case 6: - v6 = sub_02002114(v0->unk_04, 4); + v6 = Menu_ProcessInputAndHandleExit(v0->unk_04, 4); if (v6 == 0) { v0->unk_04 = NULL; @@ -1013,30 +1010,30 @@ static int ov23_0224BD1C(int param0, BOOL param1) return v1; } -static UIControlData *ov23_0224BD90(BgConfig *param0, const WindowTemplate *param1, u16 param2, u8 param3, u32 param4) +static Menu *ov23_0224BD90(BgConfig *param0, const WindowTemplate *param1, u16 param2, u8 param3, u32 param4) { - UnkStruct_02081CF4 v0; + MenuTemplate v0; MessageLoader *v1 = ov23_02253E3C(ov23_0224219C()); - ResourceMetadata *v2; + StringList *v2; - v2 = sub_02013A04(2, param4); + v2 = StringList_New(2, param4); - sub_02013A4C(v2, v1, 38, 0); - sub_02013A4C(v2, v1, 39, 1); + StringList_AddFromMessageBank(v2, v1, 38, 0); + StringList_AddFromMessageBank(v2, v1, 39, 1); - v0.unk_00 = v2; - v0.unk_04 = Window_New(param4, 1); - v0.unk_08 = 0; - v0.unk_09 = 1; - v0.unk_0A = 2; - v0.unk_0B_0 = 0; - v0.unk_0B_4 = 0; - v0.unk_0B_0 = 0; + v0.choices = v2; + v0.window = Window_New(param4, 1); + v0.fontID = FONT_SYSTEM; + v0.xSize = 1; + v0.ySize = 2; + v0.lineSpacing = 0; + v0.suppressCursor = FALSE; + v0.lineSpacing = 0; - Window_AddFromTemplate(param0, v0.unk_04, param1); - Window_Show(v0.unk_04, 1, param2, param3); + Window_AddFromTemplate(param0, v0.window, param1); + Window_Show(v0.window, 1, param2, param3); - return sub_02001B7C(&v0, 8, 0, 0, param4, PAD_BUTTON_B); + return Menu_NewAndCopyToVRAM(&v0, 8, 0, 0, param4, PAD_BUTTON_B); } static void ov23_0224BE28(SysTask *param0, void *param1) @@ -1061,12 +1058,12 @@ static void ov23_0224BE28(SysTask *param0, void *param1) break; case 1: if (ov23_02254238(ov23_0224219C()) == 0) { - v0->unk_04 = sub_02002100(fieldSystem->unk_08, &Unk_ov23_02256864, 1024 - (18 + 12) - 9, 11, 4); + v0->unk_04 = Menu_MakeYesNoChoice(fieldSystem->unk_08, &Unk_ov23_02256864, 1024 - (18 + 12) - 9, 11, 4); v0->unk_0C = 2; } break; case 2: - v6 = sub_02002114(v0->unk_04, 4); + v6 = Menu_ProcessInputAndHandleExit(v0->unk_04, 4); if (v6 == 0) { v0->unk_04 = NULL; @@ -1083,12 +1080,12 @@ static void ov23_0224BE28(SysTask *param0, void *param1) break; case 4: if (ov23_02254238(ov23_0224219C()) == 0) { - v0->unk_04 = sub_02002100(fieldSystem->unk_08, &Unk_ov23_02256864, 1024 - (18 + 12) - 9, 11, 4); + v0->unk_04 = Menu_MakeYesNoChoice(fieldSystem->unk_08, &Unk_ov23_02256864, 1024 - (18 + 12) - 9, 11, 4); v0->unk_0C = 5; } break; case 5: - v6 = sub_02002114(v0->unk_04, 4); + v6 = Menu_ProcessInputAndHandleExit(v0->unk_04, 4); if (v6 == 0) { v0->unk_04 = NULL; @@ -1112,7 +1109,7 @@ static void ov23_0224BE28(SysTask *param0, void *param1) } break; case 7: - v6 = sub_02002114(v0->unk_04, 4); + v6 = Menu_ProcessInputAndHandleExit(v0->unk_04, 4); if (v6 == 0) { v0->unk_04 = NULL; @@ -1814,12 +1811,12 @@ static void ov23_0224CB1C(SysTask *param0, void *param1) break; case 5: if (ov23_02254238(ov23_0224219C()) == 0) { - v0->unk_08 = sub_02002100(fieldSystem->unk_08, &Unk_ov23_02256864, 1024 - (18 + 12) - 9, 11, 4); + v0->unk_08 = Menu_MakeYesNoChoice(fieldSystem->unk_08, &Unk_ov23_02256864, 1024 - (18 + 12) - 9, 11, 4); v0->unk_0C = 6; } break; case 6: - v3 = sub_02002114(v0->unk_08, 4); + v3 = Menu_ProcessInputAndHandleExit(v0->unk_08, 4); if (v3 == 0) { v0->unk_0C = 9; @@ -1954,7 +1951,7 @@ static void ov23_0224CE94(SysTask *param0, void *param1) ov23_0224C6AC(16); if (v0->unk_08) { - sub_02002154(v0->unk_08, 4); + Menu_DestroyForExit(v0->unk_08, 4); } SysTask_Done(param0); diff --git a/src/overlay023/ov23_0224DC40.c b/src/overlay023/ov23_0224DC40.c index b89e332d1d..1a9c800db5 100644 --- a/src/overlay023/ov23_0224DC40.c +++ b/src/overlay023/ov23_0224DC40.c @@ -5,11 +5,6 @@ #include "consts/game_records.h" -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" -#include "struct_decls/struct_02013A04_decl.h" -#include "struct_defs/struct_02013A04_t.h" - #include "field/field_system.h" #include "overlay023/funcptr_ov23_0224DCB8.h" #include "overlay023/ov23_02241F74.h" @@ -17,7 +12,6 @@ #include "overlay023/ov23_02253598.h" #include "overlay023/ov23_02253D40.h" #include "overlay023/struct_ov23_02250CD4.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "bg_window.h" #include "comm_player_manager.h" @@ -27,15 +21,15 @@ #include "field_system.h" #include "game_records.h" #include "heap.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" +#include "string_list.h" #include "sys_task.h" #include "sys_task_manager.h" #include "trainer_info.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200DA60.h" -#include "unk_02013A04.h" #include "unk_0201D15C.h" #include "unk_0202854C.h" #include "unk_020573FC.h" @@ -64,9 +58,9 @@ typedef struct { UnkStruct_ov23_02250CD4 *unk_04; FieldSystem *fieldSystem; Window unk_0C; - ResourceMetadata *unk_1C; - BmpList *unk_20; - UIControlData *unk_24; + StringList *unk_1C; + ListMenu *unk_20; + Menu *unk_24; UnkStruct_ov23_0224F184 unk_28; UnkFuncPtr_ov23_0224DCB8 unk_2C; u16 unk_30; @@ -86,9 +80,9 @@ typedef struct { SysTask *unk_00; FieldSystem *fieldSystem; Window unk_08; - ResourceMetadata *unk_18; - BmpList *unk_1C; - UIControlData *unk_20; + StringList *unk_18; + ListMenu *unk_1C; + Menu *unk_20; UnkStruct_ov23_0224F184 unk_24; UnkFuncPtr_ov23_0224DCB8 unk_28; u16 unk_2C; @@ -126,7 +120,7 @@ static const struct { { 0x6, (u32)ov23_0224E8E0 } }; -static const UnkStruct_ov84_02240FA8 Unk_ov23_02256894 = { +static const ListMenuTemplate Unk_ov23_02256894 = { NULL, NULL, NULL, @@ -211,7 +205,7 @@ static void ov23_0224DC90(UnkStruct_ov23_022577B0 *param0, int param1) void ov23_0224DCB8(int param0, UnkFuncPtr_ov23_0224DCB8 param1, FieldSystem *fieldSystem) { UnkStruct_ov23_0224E280 *v0; - UnkStruct_ov84_02240FA8 v1; + ListMenuTemplate v1; v0 = Heap_AllocFromHeap(33, sizeof(UnkStruct_ov23_0224E280)); MI_CpuFill8(v0, 0, sizeof(UnkStruct_ov23_0224E280)); @@ -235,9 +229,9 @@ void ov23_0224DCB8(int param0, UnkFuncPtr_ov23_0224DCB8 param1, FieldSystem *fie static void ov23_0224DD2C(UnkStruct_ov23_0224E280 *param0) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; - param0->unk_1C = sub_02013A04(NELEMS(Unk_ov23_022568B4), 4); + param0->unk_1C = StringList_New(NELEMS(Unk_ov23_022568B4), 4); Window_Add(param0->fieldSystem->unk_08, ¶m0->unk_0C, 3, 1, 1, 10, NELEMS(Unk_ov23_022568B4) * 2, 13, (((1024 - (18 + 12) - 9 - (32 * 8)) - (18 + 12 + 24)) - (27 * 4)) - (10 * NELEMS(Unk_ov23_022568B4) * 2)); Window_Show(¶m0->unk_0C, 1, 1024 - (18 + 12) - 9, 11); @@ -249,21 +243,21 @@ static void ov23_0224DD2C(UnkStruct_ov23_0224E280 *param0) v1 = MessageLoader_Init(0, 26, 634, 4); for (v2 = 0; v2 < NELEMS(Unk_ov23_022568B4); v2++) { - sub_02013A4C(param0->unk_1C, v1, Unk_ov23_022568B4[v2].unk_00, Unk_ov23_022568B4[v2].unk_04); + StringList_AddFromMessageBank(param0->unk_1C, v1, Unk_ov23_022568B4[v2].unk_00, Unk_ov23_022568B4[v2].unk_04); } MessageLoader_Free(v1); } - MI_CpuCopy8(ov23_02253D40(), &v0, sizeof(UnkStruct_ov84_02240FA8)); + MI_CpuCopy8(ov23_02253D40(), &v0, sizeof(ListMenuTemplate)); - v0.unk_00 = param0->unk_1C; - v0.unk_0C = ¶m0->unk_0C; - v0.unk_10 = NELEMS(Unk_ov23_022568B4); - v0.unk_12 = NELEMS(Unk_ov23_022568B4); + v0.choices = param0->unk_1C; + v0.window = ¶m0->unk_0C; + v0.count = NELEMS(Unk_ov23_022568B4); + v0.maxDisplay = NELEMS(Unk_ov23_022568B4); param0->unk_3A = 0; - param0->unk_20 = sub_0200112C(&v0, 0, 0, 4); + param0->unk_20 = ListMenu_New(&v0, 0, 0, 4); Window_CopyToVRAM(¶m0->unk_0C); sub_020594FC(); @@ -272,7 +266,7 @@ static void ov23_0224DD2C(UnkStruct_ov23_0224E280 *param0) static void ov23_0224DDE4(SysTask *param0, UnkStruct_ov23_0224E280 *param1) { if (param1->unk_24) { - sub_02002154(param1->unk_24, 4); + Menu_DestroyForExit(param1->unk_24, 4); param1->unk_24 = NULL; } @@ -296,9 +290,9 @@ static void ov23_0224DDE4(SysTask *param0, UnkStruct_ov23_0224E280 *param1) static void ov23_0224DE3C(UnkStruct_ov23_0224E280 *param0) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; - param0->unk_1C = sub_02013A04(4, 4); + param0->unk_1C = StringList_New(4, 4); Window_Add(param0->fieldSystem->unk_08, ¶m0->unk_0C, 3, 1, 1, 16, 4 * 2, 13, (((1024 - (18 + 12) - 9 - (32 * 8)) - (18 + 12 + 24)) - (27 * 4)) - (16 * 4 * 2)); Window_Show(¶m0->unk_0C, 1, 1024 - (18 + 12) - 9, 11); @@ -321,7 +315,7 @@ static void ov23_0224DE3C(UnkStruct_ov23_0224E280 *param0) if (v3 == v2) { v4[v2] = v5; - sub_02013A4C(param0->unk_1C, v1, 0 + v5, v5); + StringList_AddFromMessageBank(param0->unk_1C, v1, 0 + v5, v5); } else { v2--; } @@ -331,11 +325,11 @@ static void ov23_0224DE3C(UnkStruct_ov23_0224E280 *param0) } v0 = Unk_ov23_02256894; - v0.unk_00 = param0->unk_1C; - v0.unk_0C = ¶m0->unk_0C; + v0.choices = param0->unk_1C; + v0.window = ¶m0->unk_0C; param0->unk_3A = 0; - param0->unk_20 = sub_0200112C(&v0, 0, 0, 4); + param0->unk_20 = ListMenu_New(&v0, 0, 0, 4); Window_CopyToVRAM(¶m0->unk_0C); } @@ -346,7 +340,7 @@ static BOOL ov23_0224DF1C(SysTask *param0, void *param1) u32 v1; u16 v2; - v1 = sub_02001288(v0->unk_20); + v1 = ListMenu_ProcessInput(v0->unk_20); ov23_0224F270(v0); if (CommSys_CheckError()) { @@ -384,9 +378,9 @@ static BOOL ov23_0224DF1C(SysTask *param0, void *param1) static void ov23_0224DFA0(UnkStruct_ov23_0224E280 *param0) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; - param0->unk_1C = sub_02013A04(4, 4); + param0->unk_1C = StringList_New(4, 4); Window_Add(param0->fieldSystem->unk_08, ¶m0->unk_0C, 3, 1, 1, 16, 4 * 2, 13, (((1024 - (18 + 12) - 9 - (32 * 8)) - (18 + 12 + 24)) - (27 * 4)) - (16 * 4 * 2)); Window_Show(¶m0->unk_0C, 1, 1024 - (18 + 12) - 9, 11); @@ -400,18 +394,18 @@ static void ov23_0224DFA0(UnkStruct_ov23_0224E280 *param0) for (v2 = 0; v2 < 4; v2++) { u32 v3 = 4 * param0->unk_32 + v2; - sub_02013A4C(param0->unk_1C, v1, 0 + v3, v2); + StringList_AddFromMessageBank(param0->unk_1C, v1, 0 + v3, v2); } MessageLoader_Free(v1); } v0 = Unk_ov23_02256894; - v0.unk_00 = param0->unk_1C; - v0.unk_0C = ¶m0->unk_0C; + v0.choices = param0->unk_1C; + v0.window = ¶m0->unk_0C; param0->unk_3A = 0; - param0->unk_20 = sub_0200112C(&v0, 0, 0, 4); + param0->unk_20 = ListMenu_New(&v0, 0, 0, 4); Window_CopyToVRAM(¶m0->unk_0C); } @@ -422,7 +416,7 @@ static BOOL ov23_0224E05C(SysTask *param0, void *param1) u32 v1; UnkStruct_ov23_0224DF1C v2; - v1 = sub_02001288(v0->unk_20); + v1 = ListMenu_ProcessInput(v0->unk_20); ov23_0224F270(v0); if (CommSys_CheckError()) { @@ -480,7 +474,7 @@ static void ov23_0224E19C(SysTask *param0, UnkStruct_ov23_0224E280 *param1) { u32 v0; - v0 = sub_02002114(param1->unk_24, 4); + v0 = Menu_ProcessInputAndHandleExit(param1->unk_24, 4); if (v0 == 0xffffffff) { return; @@ -503,7 +497,7 @@ static BOOL ov23_0224E1E0(SysTask *param0, void *param1) UnkStruct_ov23_0224E280 *v0 = param1; u32 v1; - v1 = sub_02001288(v0->unk_20); + v1 = ListMenu_ProcessInput(v0->unk_20); ov23_0224F270(v0); if (CommSys_CheckError()) { @@ -536,10 +530,10 @@ static void ov23_0224E244(SysTask *param0, UnkStruct_ov23_0224E280 *param1) { if (param1->unk_1C) { Window_Clear(¶m1->unk_0C, 1); - sub_02001384(param1->unk_20, NULL, NULL); + ListMenu_Free(param1->unk_20, NULL, NULL); Window_ClearAndCopyToVRAM(¶m1->unk_0C); Window_Remove(¶m1->unk_0C); - sub_02013A3C(param1->unk_1C); + StringList_Free(param1->unk_1C); param1->unk_1C = NULL; } } @@ -696,7 +690,7 @@ static void ov23_0224E2D8(SysTask *param0, void *param1) break; case 19: if (ov23_02254238(ov23_0224219C()) == 0) { - v0->unk_24 = sub_02002100(v0->fieldSystem->unk_08, &Unk_ov23_0225688C, 1024 - (18 + 12) - 9, 11, 4); + v0->unk_24 = Menu_MakeYesNoChoice(v0->fieldSystem->unk_08, &Unk_ov23_0225688C, 1024 - (18 + 12) - 9, 11, 4); v0->unk_37 = 20; if (v0->unk_38 != 8) { @@ -848,7 +842,7 @@ static void ov23_0224E2D8(SysTask *param0, void *param1) } if (v0->unk_24) { - sub_02002154(v0->unk_24, 4); + Menu_DestroyForExit(v0->unk_24, 4); v0->unk_24 = NULL; } @@ -878,7 +872,7 @@ static void ov23_0224E8FC(SysTask *param0, UnkStruct_ov23_022577B0 *param1) { u32 v0; - v0 = sub_02002114(param1->unk_20, 4); + v0 = Menu_ProcessInputAndHandleExit(param1->unk_20, 4); if (v0 == 0xffffffff) { return; @@ -900,7 +894,7 @@ static void ov23_0224E93C(SysTask *param0, UnkStruct_ov23_022577B0 *param1) { u32 v0; - v0 = sub_02002114(param1->unk_20, 4); + v0 = Menu_ProcessInputAndHandleExit(param1->unk_20, 4); if (v0 == 0xffffffff) { return; @@ -932,7 +926,7 @@ static void ov23_0224E93C(SysTask *param0, UnkStruct_ov23_022577B0 *param1) static void ov23_0224E9C4(SysTask *param0, UnkStruct_ov23_022577B0 *param1) { if (param1->unk_20) { - sub_02002154(param1->unk_20, 4); + Menu_DestroyForExit(param1->unk_20, 4); param1->unk_20 = NULL; } @@ -953,10 +947,10 @@ static void ov23_0224EA08(SysTask *param0, UnkStruct_ov23_022577B0 *param1) { if (param1->unk_18) { Window_Clear(¶m1->unk_08, 1); - sub_02001384(param1->unk_1C, NULL, NULL); + ListMenu_Free(param1->unk_1C, NULL, NULL); Window_ClearAndCopyToVRAM(¶m1->unk_08); Window_Remove(¶m1->unk_08); - sub_02013A3C(param1->unk_18); + StringList_Free(param1->unk_18); param1->unk_18 = NULL; } @@ -977,10 +971,10 @@ static void ov23_0224EA70(UnkStruct_ov23_022577B0 *param0) static void ov23_0224EAA4(UnkStruct_ov23_022577B0 *param0) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; const int v1 = 4 + 1; - param0->unk_18 = sub_02013A04(v1, 4); + param0->unk_18 = StringList_New(v1, 4); Window_Add(param0->fieldSystem->unk_08, ¶m0->unk_08, 3, 1, 1, 16, v1 * 2, 13, (((1024 - (18 + 12) - 9 - (32 * 8)) - (18 + 12 + 24)) - (27 * 4)) - (16 * v1 * 2)); Window_Show(¶m0->unk_08, 1, 1024 - (18 + 12) - 9, 11); @@ -993,21 +987,21 @@ static void ov23_0224EAA4(UnkStruct_ov23_022577B0 *param0) for (v3 = 0; v3 < 4; v3++) { u32 v4 = 4 * param0->unk_2E + v3; - sub_02013A4C(param0->unk_18, v2, 0 + v4, v3); + StringList_AddFromMessageBank(param0->unk_18, v2, 0 + v4, v3); } - sub_02013A4C(param0->unk_18, v2, 48, 51); + StringList_AddFromMessageBank(param0->unk_18, v2, 48, 51); MessageLoader_Free(v2); } v0 = Unk_ov23_02256894; - v0.unk_00 = param0->unk_18; - v0.unk_0C = ¶m0->unk_08; - v0.unk_10 = v1; - v0.unk_12 = v1; + v0.choices = param0->unk_18; + v0.window = ¶m0->unk_08; + v0.count = v1; + v0.maxDisplay = v1; param0->unk_36 = 0; - param0->unk_1C = sub_0200112C(&v0, 0, 0, 4); + param0->unk_1C = ListMenu_New(&v0, 0, 0, 4); Window_CopyToVRAM(¶m0->unk_08); } @@ -1019,10 +1013,10 @@ static BOOL ov23_0224EB74(SysTask *param0, void *param1) UnkStruct_ov23_0224DF1C v2; u16 v3; - v1 = sub_02001288(v0->unk_1C); + v1 = ListMenu_ProcessInput(v0->unk_1C); v3 = v0->unk_36; - sub_020014D0(v0->unk_1C, &v0->unk_36); + ListMenu_CalcTrueCursorPos(v0->unk_1C, &v0->unk_36); if (v3 != v0->unk_36) { Sound_PlayEffect(1500); @@ -1106,7 +1100,7 @@ static void ov23_0224EC50(SysTask *param0, void *param1) case 6: if (ov23_02254238(ov23_0224219C()) == 0) { v0->unk_34 = 7; - v0->unk_20 = sub_02002100(v0->fieldSystem->unk_08, &Unk_ov23_0225688C, 1024 - (18 + 12) - 9, 11, 4); + v0->unk_20 = Menu_MakeYesNoChoice(v0->fieldSystem->unk_08, &Unk_ov23_0225688C, 1024 - (18 + 12) - 9, 11, 4); } break; case 7: @@ -1161,7 +1155,7 @@ static void ov23_0224EC50(SysTask *param0, void *param1) case 17: if (ov23_02254238(ov23_0224219C()) == 0) { v0->unk_34 = 18; - v0->unk_20 = sub_02002100(v0->fieldSystem->unk_08, &Unk_ov23_0225688C, 1024 - (18 + 12) - 9, 11, 4); + v0->unk_20 = Menu_MakeYesNoChoice(v0->fieldSystem->unk_08, &Unk_ov23_0225688C, 1024 - (18 + 12) - 9, 11, 4); } break; case 18: @@ -1261,7 +1255,7 @@ static void ov23_0224EC50(SysTask *param0, void *param1) } if (v0->unk_20) { - sub_02002154(v0->unk_20, 4); + Menu_DestroyForExit(v0->unk_20, 4); v0->unk_20 = NULL; } @@ -1418,7 +1412,7 @@ static void ov23_0224F270(UnkStruct_ov23_0224E280 *param0) u16 v0; v0 = param0->unk_3A; - sub_020014D0(param0->unk_20, ¶m0->unk_3A); + ListMenu_CalcTrueCursorPos(param0->unk_20, ¶m0->unk_3A); if (v0 != param0->unk_3A) { Sound_PlayEffect(1500); diff --git a/src/overlay023/ov23_0224F294.c b/src/overlay023/ov23_0224F294.c index 2acc6f03b6..12ae16278b 100644 --- a/src/overlay023/ov23_0224F294.c +++ b/src/overlay023/ov23_0224F294.c @@ -3,10 +3,8 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" #include "struct_decls/struct_020298B0_decl.h" #include "struct_defs/sprite_template.h" -#include "struct_defs/struct_02081CF4.h" #include "field/field_system.h" #include "overlay005/ov5_021D2F14.h" @@ -28,7 +26,6 @@ #include "overlay023/ov23_02253598.h" #include "overlay023/ov23_02253D40.h" #include "overlay023/struct_ov23_02250CD4.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "overlay104/struct_ov104_02241308.h" #include "bag.h" @@ -39,24 +36,25 @@ #include "core_sys.h" #include "field_map_change.h" #include "field_system.h" +#include "font.h" #include "gx_layers.h" #include "heap.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "player_avatar.h" #include "save_player.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "sys_task.h" #include "sys_task_manager.h" #include "trainer_info.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200A9DC.h" #include "unk_0200C6E4.h" #include "unk_0200DA60.h" -#include "unk_02013A04.h" #include "unk_0202854C.h" #include "unk_0206A780.h" @@ -128,7 +126,7 @@ static const struct { { 0x7F, (u32)ov23_02250930 } }; -static const UnkStruct_ov84_02240FA8 Unk_ov23_02256904 = { +static const ListMenuTemplate Unk_ov23_02256904 = { NULL, NULL, NULL, @@ -422,7 +420,7 @@ BOOL ov23_0224F744(int param0) void ov23_0224F758(UnkFuncPtr_ov23_0224F758 param0, FieldSystem *fieldSystem) { UnkStruct_ov23_02250CD4 *v0; - UnkStruct_ov84_02240FA8 v1; + ListMenuTemplate v1; Sound_PlayEffect(1533); ov23_022430D0(2); @@ -472,13 +470,13 @@ static u32 ov23_0224F7D4(u8 *param0) static void ov23_0224F7F4(UnkStruct_ov23_02250CD4 *param0) { - UnkStruct_02081CF4 v0; + MenuTemplate v0; const int v1 = 4; u8 v2[7]; int v3; v3 = ov23_0224F7D4(v2); - param0->unk_40 = sub_02013A04(NELEMS(Unk_ov23_02256924), 4); + param0->unk_40 = StringList_New(NELEMS(Unk_ov23_02256924), 4); Window_Add(param0->fieldSystem->unk_08, ¶m0->unk_10, 3, 20, 1, 11, NELEMS(Unk_ov23_02256924) * 3, 13, (1024 - (18 + 12) - 9 - 11 * 22)); Window_Show(¶m0->unk_10, 1, 1024 - (18 + 12) - 9, 11); @@ -494,31 +492,31 @@ static void ov23_0224F7F4(UnkStruct_ov23_02250CD4 *param0) const TrainerInfo *v5 = SaveData_GetTrainerInfo(FieldSystem_SaveData(param0->fieldSystem)); Strbuf *v6 = TrainerInfo_NameNewStrbuf(v5, 4); - sub_02013A6C(param0->unk_40, v6, Unk_ov23_02256924[v4].unk_04); + StringList_AddFromStrbuf(param0->unk_40, v6, Unk_ov23_02256924[v4].unk_04); Strbuf_Free(v6); } else { - sub_02013A4C(param0->unk_40, v3, Unk_ov23_02256924[v4].unk_00, Unk_ov23_02256924[v4].unk_04); + StringList_AddFromMessageBank(param0->unk_40, v3, Unk_ov23_02256924[v4].unk_00, Unk_ov23_02256924[v4].unk_04); } } } param0->unk_29C = param0->fieldSystem->unk_90; - v0.unk_00 = param0->unk_40; - v0.unk_04 = ¶m0->unk_10; - v0.unk_08 = 1; - v0.unk_09 = 1; - v0.unk_0A = NELEMS(Unk_ov23_02256924); - v0.unk_0B_0 = 8; - v0.unk_0B_4 = 1; + v0.choices = param0->unk_40; + v0.window = ¶m0->unk_10; + v0.fontID = FONT_MESSAGE; + v0.xSize = 1; + v0.ySize = NELEMS(Unk_ov23_02256924); + v0.lineSpacing = 8; + v0.suppressCursor = TRUE; if (NELEMS(Unk_ov23_02256924) >= 4) { - v0.unk_0B_6 = 1; + v0.loopAround = TRUE; } else { - v0.unk_0B_6 = 0; + v0.loopAround = FALSE; } - param0->unk_54 = sub_02001AF4(&v0, 28, 4, param0->unk_29C, 11, PAD_BUTTON_B | PAD_BUTTON_X); + param0->unk_54 = Menu_New(&v0, 28, 4, param0->unk_29C, 11, PAD_BUTTON_B | PAD_BUTTON_X); param0->unk_48 = NULL; Window_ScheduleCopyToVRAM(¶m0->unk_10); @@ -618,9 +616,9 @@ static BOOL ov23_0224FA58(SysTask *param0, void *param1) UnkStruct_ov23_02250CD4 *v0 = param1; u16 v1; - v1 = sub_02001DC4(v0->unk_54); - v0->unk_2A0 = sub_02001C94(v0->unk_54, 1504); - v0->unk_29C = sub_02001DC4(v0->unk_54); + v1 = Menu_GetCursorPos(v0->unk_54); + v0->unk_2A0 = Menu_ProcessInputWithSound(v0->unk_54, 1504); + v0->unk_29C = Menu_GetCursorPos(v0->unk_54); if (v1 != v0->unk_29C) { ov23_0224F4D0(v0->unk_23C[0]->unk_00, v0->unk_29C); @@ -652,7 +650,7 @@ static BOOL ov23_0224FA58(SysTask *param0, void *param1) if (v0->unk_25C) { ov23_0224F460(v0); - sub_02001BC4(v0->unk_54, NULL); + Menu_Free(v0->unk_54, NULL); v0->unk_25C = 0; } @@ -674,11 +672,11 @@ void ov23_0224FB7C(UnkStruct_ov23_02250CD4 *param0) } if (param0->unk_48) { - sub_02001384(param0->unk_48, NULL, NULL); + ListMenu_Free(param0->unk_48, NULL, NULL); param0->unk_48 = NULL; } else if (param0->unk_25C) { ov23_0224F460(param0); - sub_02001BC4(param0->unk_54, NULL); + Menu_Free(param0->unk_54, NULL); param0->unk_25C = 0; } @@ -686,7 +684,7 @@ void ov23_0224FB7C(UnkStruct_ov23_02250CD4 *param0) Window_Clear(¶m0->unk_10, 1); Bg_ScheduleTilemapTransfer(param0->unk_10.bgConfig, param0->unk_10.bgLayer); Window_Remove(¶m0->unk_10); - sub_02013A3C(param0->unk_40); + StringList_Free(param0->unk_40); ov23_02252DF4(param0); } } @@ -710,7 +708,7 @@ static UnkStruct_ov23_02257644 Unk_ov23_0225765C[] = { static void ov23_0224FBFC(UnkStruct_ov23_02250CD4 *param0, int param1) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; int v1, v2; int v3 = 11; int v4 = 6; @@ -735,7 +733,7 @@ static void ov23_0224FBFC(UnkStruct_ov23_02250CD4 *param0, int param1) break; } - param0->unk_44 = sub_02013A04(v1, 4); + param0->unk_44 = StringList_New(v1, 4); Window_Add(param0->fieldSystem->unk_08, ¶m0->unk_20, 3, v5, v3, v4, v1 * 2, 13, (1024 - (18 + 12) - 9 - 11 * 22)); Window_Show(¶m0->unk_20, 1, 1024 - (18 + 12) - 9, 11); @@ -747,27 +745,27 @@ static void ov23_0224FBFC(UnkStruct_ov23_02250CD4 *param0, int param1) v7 = ov23_02253E3C(ov23_0224219C()); for (v8 = 0; v8 < v1; v8++) { - sub_02013A4C(param0->unk_44, v7, v6->unk_00, v6->unk_04); + StringList_AddFromMessageBank(param0->unk_44, v7, v6->unk_00, v6->unk_04); v6++; } } v0 = Unk_ov23_02256904; - v0.unk_10 = v1; - v0.unk_12 = v1; - v0.unk_00 = param0->unk_44; - v0.unk_0C = ¶m0->unk_20; - v0.unk_1C = param0; + v0.count = v1; + v0.maxDisplay = v1; + v0.choices = param0->unk_44; + v0.window = ¶m0->unk_20; + v0.tmp = param0; - param0->unk_50 = sub_0200112C(&v0, 0, 0, 4); + param0->unk_50 = ListMenu_New(&v0, 0, 0, 4); } static void ov23_0224FCF4(UnkStruct_ov23_02250CD4 *param0) { if (param0->unk_50) { - sub_02001384(param0->unk_50, NULL, NULL); + ListMenu_Free(param0->unk_50, NULL, NULL); Bg_ScheduleTilemapTransfer(param0->unk_20.bgConfig, param0->unk_20.bgLayer); - sub_02013A3C(param0->unk_44); + StringList_Free(param0->unk_44); param0->unk_50 = NULL; } @@ -798,9 +796,9 @@ void ov23_0224FD68(int param0) } } -void ov23_0224FD84(BmpList *param0, u32 param1, u8 param2) +void ov23_0224FD84(ListMenu *param0, u32 param1, u8 param2) { - UnkStruct_ov23_02250CD4 *v0 = (UnkStruct_ov23_02250CD4 *)sub_02001504(param0, 19); + UnkStruct_ov23_02250CD4 *v0 = (UnkStruct_ov23_02250CD4 *)ListMenu_GetAttribute(param0, 19); UnkFuncPtr_ov23_0224FD84 v1 = v0->unk_268; int v2 = param1; int v3 = v1(v2, v0); @@ -840,14 +838,14 @@ static void ov23_0224FE38(UnkStruct_ov23_02250CD4 *param0, UnkFuncPtr_ov23_02248 { UnkFuncPtr_ov23_0224FE38 v0 = param0->unk_264; UnkFuncPtr_ov23_0224FD84 v1 = param0->unk_268; - UnkStruct_ov84_02240FA8 v2; + ListMenuTemplate v2; int v3 = v0(param0); int v4 = 6; ov23_0224FB7C(param0); ov23_02253DFC(ov23_022421DC(), 630, 0); - param0->unk_40 = sub_02013A04(v3 + 1, 4); + param0->unk_40 = StringList_New(v3 + 1, 4); Window_Add(param0->fieldSystem->unk_08, ¶m0->unk_10, 3, 19, 3, 12, (6 * 2), 13, ((1024 - (18 + 12) - 9 - 11 * 22) - 12 * (6 * 2))); Window_Show(¶m0->unk_10, 1, 1024 - (18 + 12) - 9, 11); @@ -859,22 +857,22 @@ static void ov23_0224FE38(UnkStruct_ov23_02250CD4 *param0, UnkFuncPtr_ov23_02248 v5 = ov23_02253E3C(ov23_022421DC()); for (v6 = 0; v6 < v3; v6++) { - sub_02013A4C(param0->unk_40, v5, v1(v6, param0), v6); + StringList_AddFromMessageBank(param0->unk_40, v5, v1(v6, param0), v6); } - sub_02013A4C(param0->unk_40, v5, 34, 0xfffffffe); + StringList_AddFromMessageBank(param0->unk_40, v5, 34, 0xfffffffe); } v2 = Unk_ov23_02256904; - v2.unk_10 = v3 + 1; - v2.unk_12 = v4; - v2.unk_00 = param0->unk_40; - v2.unk_0C = ¶m0->unk_10; - v2.unk_04 = param0->unk_60; - v2.unk_08 = param0->unk_64; - v2.unk_1C = param0; + v2.count = v3 + 1; + v2.maxDisplay = v4; + v2.choices = param0->unk_40; + v2.window = ¶m0->unk_10; + v2.cursorCallback = param0->unk_60; + v2.printCallback = param0->unk_64; + v2.tmp = param0; - ov23_02251238(param0, v4, v2.unk_10); + ov23_02251238(param0, v4, v2.count); param0->unk_4C = ov23_02248C08(&v2, param0->unk_294, param0->unk_290, 4, param1, Unk_ov23_022577B8->unk_00, 0); param0->unk_2AA = 5; @@ -888,7 +886,7 @@ static BOOL ov23_0224FF58(SysTask *param0, void *param1) v1 = ov23_02248D20(v0->unk_4C); - sub_020014DC(v0->unk_4C->unk_0C, &v2, &v3); + ListMenu_GetListAndCursorPos(v0->unk_4C->unk_0C, &v2, &v3); ov23_022430E0(8, v3, v2); if (CommSys_CheckError()) { @@ -901,7 +899,7 @@ static BOOL ov23_0224FF58(SysTask *param0, void *param1) switch (v1) { case 0xffffffff: - ov23_0225128C(v0, v2, sub_02001504(v0->unk_4C->unk_0C, 2), 6); + ov23_0225128C(v0, v2, ListMenu_GetAttribute(v0->unk_4C->unk_0C, 2), 6); return 0; case 0xfffffffe: ov23_0224FD3C(v0); @@ -939,10 +937,10 @@ static BOOL ov23_02250048(SysTask *param0, void *param1) u32 v1; u16 v2; - v1 = sub_02001288(v0->unk_50); + v1 = ListMenu_ProcessInput(v0->unk_50); v2 = v0->unk_2B0; - sub_020014D0(v0->unk_50, &v0->unk_2B0); + ListMenu_CalcTrueCursorPos(v0->unk_50, &v0->unk_2B0); if (v2 != v0->unk_2B0) { Sound_PlayEffect(1500); @@ -987,9 +985,9 @@ void ov23_02250128(int param0) sub_02028C6C(Unk_ov23_022577B8->unk_00, Unk_ov23_022577B8->unk_04); } -static void ov23_0225014C(BmpList *param0, u32 param1, u8 param2) +static void ov23_0225014C(ListMenu *param0, u32 param1, u8 param2) { - UnkStruct_ov23_02250CD4 *v0 = (UnkStruct_ov23_02250CD4 *)sub_02001504(param0, 19); + UnkStruct_ov23_02250CD4 *v0 = (UnkStruct_ov23_02250CD4 *)ListMenu_GetAttribute(param0, 19); UnkFuncPtr_ov23_0224FD84 v1 = v0->unk_268; int v2 = param1; int v3 = v1(v2, v0); @@ -1031,14 +1029,14 @@ static void ov23_0225021C(UnkStruct_ov23_02250CD4 *param0, UnkFuncPtr_ov23_02248 UnkFuncPtr_ov23_0224FE38 v0 = param0->unk_264; UnkFuncPtr_ov23_0224FD84 v1 = param0->unk_268; UnkFuncPtr_ov23_0225021C v2 = param0->unk_26C; - UnkStruct_ov84_02240FA8 v3; + ListMenuTemplate v3; int v4 = v0(param0); int v5 = 6; ov23_0224FB7C(param0); ov23_02253DFC(ov23_022421DC(), 628, 0); - param0->unk_40 = sub_02013A04(v4 + 1, 4); + param0->unk_40 = StringList_New(v4 + 1, 4); Window_Add(param0->fieldSystem->unk_08, ¶m0->unk_10, 3, 19, 3, 12, (6 * 2), 13, ((1024 - (18 + 12) - 9 - 11 * 22) - 12 * (6 * 2))); Window_Show(¶m0->unk_10, 1, 1024 - (18 + 12) - 9, 11); @@ -1054,21 +1052,21 @@ static void ov23_0225021C(UnkStruct_ov23_02250CD4 *param0, UnkFuncPtr_ov23_02248 StringTemplate_SetNumber(param0->unk_70, 6, v2(v7, param0), 2, 2, 1); MessageLoader_GetStrbuf(ov23_02253E3C(ov23_0224219C()), 128, param0->unk_6C); StringTemplate_Format(param0->unk_70, param0->unk_68, param0->unk_6C); - sub_02013A6C(param0->unk_40, param0->unk_68, v7); + StringList_AddFromStrbuf(param0->unk_40, param0->unk_68, v7); } - sub_02013A4C(param0->unk_40, v6, 60, 0xfffffffe); + StringList_AddFromMessageBank(param0->unk_40, v6, 60, 0xfffffffe); } v3 = Unk_ov23_02256904; - v3.unk_10 = v4 + 1; - v3.unk_12 = v5; - v3.unk_00 = param0->unk_40; - v3.unk_0C = ¶m0->unk_10; - v3.unk_04 = param0->unk_60; - v3.unk_1C = param0; + v3.count = v4 + 1; + v3.maxDisplay = v5; + v3.choices = param0->unk_40; + v3.window = ¶m0->unk_10; + v3.cursorCallback = param0->unk_60; + v3.tmp = param0; - ov23_02251238(param0, v5, v3.unk_10); + ov23_02251238(param0, v5, v3.count); param0->unk_4C = ov23_02248C08(&v3, param0->unk_294, param0->unk_290, 4, param1, Unk_ov23_022577B8->unk_00, 0); param0->unk_2AA = 6; @@ -1082,7 +1080,7 @@ static BOOL ov23_02250378(SysTask *param0, void *param1) v1 = ov23_02248D20(v0->unk_4C); - sub_020014DC(v0->unk_4C->unk_0C, &v2, &v3); + ListMenu_GetListAndCursorPos(v0->unk_4C->unk_0C, &v2, &v3); ov23_022430E0(9, v3, v2); if (CommSys_CheckError()) { @@ -1095,7 +1093,7 @@ static BOOL ov23_02250378(SysTask *param0, void *param1) switch (v1) { case 0xffffffff: - ov23_0225128C(v0, v2, sub_02001504(v0->unk_4C->unk_0C, 2), 6); + ov23_0225128C(v0, v2, ListMenu_GetAttribute(v0->unk_4C->unk_0C, 2), 6); return 0; case 0xfffffffe: ov23_0224FD3C(v0); @@ -1122,10 +1120,10 @@ static BOOL ov23_0225044C(SysTask *param0, void *param1) u32 v1; u16 v2; - v1 = sub_02001288(v0->unk_50); + v1 = ListMenu_ProcessInput(v0->unk_50); v2 = v0->unk_2B0; - sub_020014D0(v0->unk_50, &v0->unk_2B0); + ListMenu_CalcTrueCursorPos(v0->unk_50, &v0->unk_2B0); if (v2 != v0->unk_2B0) { Sound_PlayEffect(1500); @@ -1167,9 +1165,9 @@ static BOOL ov23_0225044C(SysTask *param0, void *param1) return 1; } -void ov23_02250540(BmpList *param0, u32 param1, u8 param2) +void ov23_02250540(ListMenu *param0, u32 param1, u8 param2) { - UnkStruct_ov23_02250CD4 *v0 = (UnkStruct_ov23_02250CD4 *)sub_02001504(param0, 19); + UnkStruct_ov23_02250CD4 *v0 = (UnkStruct_ov23_02250CD4 *)ListMenu_GetAttribute(param0, 19); UnkFuncPtr_ov23_0224FD84 v1 = v0->unk_268; int v2 = param1; int v3 = v1(v2, v0); @@ -1207,14 +1205,14 @@ static void ov23_022505EC(UnkStruct_ov23_02250CD4 *param0, UnkFuncPtr_ov23_02248 { UnkFuncPtr_ov23_0224FE38 v0 = param0->unk_264; UnkFuncPtr_ov23_0224FD84 v1 = param0->unk_268; - UnkStruct_ov84_02240FA8 v2; + ListMenuTemplate v2; int v3 = v0(param0); int v4 = 6; ov23_0224FB7C(param0); ov23_02253DFC(ov23_022421DC(), 628, 0); - param0->unk_40 = sub_02013A04(v3 + 1, 4); + param0->unk_40 = StringList_New(v3 + 1, 4); Window_Add(param0->fieldSystem->unk_08, ¶m0->unk_10, 3, 19, 3, 12, (6 * 2), 13, ((1024 - (18 + 12) - 9 - 11 * 22) - 12 * (6 * 2))); Window_Show(¶m0->unk_10, 1, 1024 - (18 + 12) - 9, 11); @@ -1226,21 +1224,21 @@ static void ov23_022505EC(UnkStruct_ov23_02250CD4 *param0, UnkFuncPtr_ov23_02248 v5 = ov23_02253E3C(ov23_022421DC()); for (v6 = 0; v6 < v3; v6++) { - sub_02013A4C(param0->unk_40, v5, v1(v6, param0), v6); + StringList_AddFromMessageBank(param0->unk_40, v5, v1(v6, param0), v6); } - sub_02013A4C(param0->unk_40, v5, 60, 0xfffffffe); + StringList_AddFromMessageBank(param0->unk_40, v5, 60, 0xfffffffe); } v2 = Unk_ov23_02256904; - v2.unk_10 = v3 + 1; - v2.unk_12 = v4; - v2.unk_00 = param0->unk_40; - v2.unk_0C = ¶m0->unk_10; - v2.unk_04 = param0->unk_60; - v2.unk_1C = param0; + v2.count = v3 + 1; + v2.maxDisplay = v4; + v2.choices = param0->unk_40; + v2.window = ¶m0->unk_10; + v2.cursorCallback = param0->unk_60; + v2.tmp = param0; - ov23_02251238(param0, v4, v2.unk_10); + ov23_02251238(param0, v4, v2.count); param0->unk_4C = ov23_02248C08(&v2, param0->unk_294, param0->unk_290, 4, param1, Unk_ov23_022577B8->unk_00, 0); param0->unk_2AA = 7; @@ -1254,7 +1252,7 @@ static BOOL ov23_02250704(SysTask *param0, void *param1) v1 = ov23_02248D20(v0->unk_4C); - sub_020014DC(v0->unk_4C->unk_0C, &v2, &v3); + ListMenu_GetListAndCursorPos(v0->unk_4C->unk_0C, &v2, &v3); ov23_022430E0(11, v3, v2); if (CommSys_CheckError()) { @@ -1267,7 +1265,7 @@ static BOOL ov23_02250704(SysTask *param0, void *param1) switch (v1) { case 0xffffffff: - ov23_0225128C(v0, v2, sub_02001504(v0->unk_4C->unk_0C, 2), 6); + ov23_0225128C(v0, v2, ListMenu_GetAttribute(v0->unk_4C->unk_0C, 2), 6); return 0; case 0xfffffffe: ov23_0224FD3C(v0); @@ -1298,10 +1296,10 @@ static BOOL ov23_022507D8(SysTask *param0, void *param1) u32 v1; u16 v2; - v1 = sub_02001288(v0->unk_50); + v1 = ListMenu_ProcessInput(v0->unk_50); v2 = v0->unk_2B0; - sub_020014D0(v0->unk_50, &v0->unk_2B0); + ListMenu_CalcTrueCursorPos(v0->unk_50, &v0->unk_2B0); if (v2 != v0->unk_2B0) { Sound_PlayEffect(1500); @@ -1379,7 +1377,7 @@ static void ov23_02250998(SysTask *param0, void *param1) UnkStruct_ov23_02250CD4 *v0 = param1; if (ov23_02254238(ov23_0224219C()) == 0) { - v0->unk_5C = sub_02002100(v0->fieldSystem->unk_08, &Unk_ov23_022568D8, 1024 - (18 + 12) - 9, 11, 4); + v0->unk_5C = Menu_MakeYesNoChoice(v0->fieldSystem->unk_08, &Unk_ov23_022568D8, 1024 - (18 + 12) - 9, 11, 4); v0->unk_2AA = 12; } } @@ -1387,7 +1385,7 @@ static void ov23_02250998(SysTask *param0, void *param1) static void ov23_022509D4(SysTask *param0, void *param1) { UnkStruct_ov23_02250CD4 *v0 = param1; - int v1 = sub_02002114(v0->unk_5C, 4); + int v1 = Menu_ProcessInputAndHandleExit(v0->unk_5C, 4); if (v1 == 0xffffffff) { return; @@ -1418,7 +1416,7 @@ static void ov23_02250A14(UnkStruct_ov23_02250CD4 *param0) void ov23_02250A50(UnkFuncPtr_ov23_0224F758 param0, FieldSystem *fieldSystem) { UnkStruct_ov23_02250CD4 *v0; - UnkStruct_ov84_02240FA8 v1; + ListMenuTemplate v1; v0 = Heap_AllocFromHeap(4, sizeof(UnkStruct_ov23_02250CD4)); @@ -1441,14 +1439,14 @@ void ov23_02250A50(UnkFuncPtr_ov23_0224F758 param0, FieldSystem *fieldSystem) static void ov23_02250ACC(UnkStruct_ov23_02250CD4 *param0) { if (ov23_02254238(ov23_022421AC()) == 0) { - param0->unk_5C = sub_02002100(param0->fieldSystem->unk_08, &Unk_ov23_022568D8, 1024 - (18 + 12) - 9, 11, 4); + param0->unk_5C = Menu_MakeYesNoChoice(param0->fieldSystem->unk_08, &Unk_ov23_022568D8, 1024 - (18 + 12) - 9, 11, 4); param0->unk_2AA = 1; } } static void ov23_02250B08(UnkStruct_ov23_02250CD4 *param0) { - int v0 = sub_02002114(param0->unk_5C, 4); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_5C, 4); if (v0 == 0xffffffff) { return; @@ -1464,7 +1462,7 @@ static void ov23_02250B08(UnkStruct_ov23_02250CD4 *param0) static void ov23_02250B34(SysTask *param0, UnkStruct_ov23_02250CD4 *param1, BOOL param2) { if (param1->unk_5C) { - sub_02002154(param1->unk_5C, 4); + Menu_DestroyForExit(param1->unk_5C, 4); } Strbuf_Free(param1->unk_68); @@ -1533,9 +1531,9 @@ static void ov23_02250B9C(SysTask *param0, void *param1) } } -void ov23_02250C3C(BmpList *param0, u32 param1, u8 param2) +void ov23_02250C3C(ListMenu *param0, u32 param1, u8 param2) { - UnkStruct_ov23_02250CD4 *v0 = (UnkStruct_ov23_02250CD4 *)sub_02001504(param0, 19); + UnkStruct_ov23_02250CD4 *v0 = (UnkStruct_ov23_02250CD4 *)ListMenu_GetAttribute(param0, 19); UnkFuncPtr_ov23_0224FD84 v1 = v0->unk_268; int v2 = param1; int v3 = v1(v2, v0); @@ -1549,16 +1547,16 @@ void ov23_02250C3C(BmpList *param0, u32 param1, u8 param2) ov23_02253F60(ov23_022421DC(), v2, 0, NULL); } -static void ov23_02250C74(BmpList *param0, u32 param1, u8 param2) +static void ov23_02250C74(ListMenu *param0, u32 param1, u8 param2) { - UnkStruct_ov23_02250CD4 *v0 = (UnkStruct_ov23_02250CD4 *)sub_02001504(param0, 19); + UnkStruct_ov23_02250CD4 *v0 = (UnkStruct_ov23_02250CD4 *)ListMenu_GetAttribute(param0, 19); int v1 = param1; UndergroundData *v2 = sub_020298B0(FieldSystem_SaveData(v0->fieldSystem)); if (!sub_02028AFC(v2, v1)) { - sub_0200147C(param0, 1, 15, 2); + ListMenu_SetAltTextColors(param0, 1, 15, 2); } else { - sub_0200147C(param0, 2, 15, 2); + ListMenu_SetAltTextColors(param0, 2, 15, 2); } } @@ -1608,14 +1606,14 @@ static void ov23_02250D90(UnkStruct_ov23_02250CD4 *param0, UnkFuncPtr_ov23_02248 { UnkFuncPtr_ov23_0224FE38 v0 = param0->unk_264; UnkFuncPtr_ov23_0224FD84 v1 = param0->unk_268; - UnkStruct_ov84_02240FA8 v2; + ListMenuTemplate v2; int v3 = v0(param0); int v4 = 6; ov23_0224FB7C(param0); ov23_02253DFC(ov23_022421DC(), 626, 0); - param0->unk_40 = sub_02013A04(v3 + 1, 4); + param0->unk_40 = StringList_New(v3 + 1, 4); Window_Add(param0->fieldSystem->unk_08, ¶m0->unk_10, 3, 19, 3, 12, (6 * 2), 13, ((1024 - (18 + 12) - 9 - 11 * 22) - 12 * (6 * 2))); Window_Show(¶m0->unk_10, 1, 1024 - (18 + 12) - 9, 11); @@ -1627,22 +1625,22 @@ static void ov23_02250D90(UnkStruct_ov23_02250CD4 *param0, UnkFuncPtr_ov23_02248 v5 = ov23_02253E3C(ov23_022421DC()); for (v6 = 0; v6 < v3; v6++) { - sub_02013A4C(param0->unk_40, v5, v1(v6, param0), v6); + StringList_AddFromMessageBank(param0->unk_40, v5, v1(v6, param0), v6); } - sub_02013A4C(param0->unk_40, v5, 0, 0xfffffffe); + StringList_AddFromMessageBank(param0->unk_40, v5, 0, 0xfffffffe); } v2 = Unk_ov23_02256904; - v2.unk_10 = v3 + 1; - v2.unk_12 = v4; - v2.unk_08 = param0->unk_64; - v2.unk_00 = param0->unk_40; - v2.unk_0C = ¶m0->unk_10; - v2.unk_04 = param0->unk_60; - v2.unk_1C = param0; + v2.count = v3 + 1; + v2.maxDisplay = v4; + v2.printCallback = param0->unk_64; + v2.choices = param0->unk_40; + v2.window = ¶m0->unk_10; + v2.cursorCallback = param0->unk_60; + v2.tmp = param0; - ov23_02251238(param0, v4, v2.unk_10); + ov23_02251238(param0, v4, v2.count); param0->unk_4C = ov23_02248C08(&v2, param0->unk_294, param0->unk_290, 4, param1, Unk_ov23_022577B8->unk_00, 0); param0->unk_2AA = 8; @@ -1656,7 +1654,7 @@ static BOOL ov23_02250EAC(SysTask *param0, void *param1) v1 = ov23_02248D20(v0->unk_4C); - sub_020014DC(v0->unk_4C->unk_0C, &v2, &v3); + ListMenu_GetListAndCursorPos(v0->unk_4C->unk_0C, &v2, &v3); ov23_022430E0(10, v3, v2); if (CommSys_CheckError()) { @@ -1669,7 +1667,7 @@ static BOOL ov23_02250EAC(SysTask *param0, void *param1) switch (v1) { case 0xffffffff: - ov23_0225128C(v0, v2, sub_02001504(v0->unk_4C->unk_0C, 2), 6); + ov23_0225128C(v0, v2, ListMenu_GetAttribute(v0->unk_4C->unk_0C, 2), 6); return 0; case 0xfffffffe: Sound_PlayEffect(1500); @@ -1701,10 +1699,10 @@ static BOOL ov23_02250F8C(SysTask *param0, void *param1) u32 v1; u16 v2; - v1 = sub_02001288(v0->unk_50); + v1 = ListMenu_ProcessInput(v0->unk_50); v2 = v0->unk_2B0; - sub_020014D0(v0->unk_50, &v0->unk_2B0); + ListMenu_CalcTrueCursorPos(v0->unk_50, &v0->unk_2B0); if (v2 != v0->unk_2B0) { Sound_PlayEffect(1500); @@ -1755,7 +1753,7 @@ void ov23_02251044(void *param0, u32 param1) } if (v0->unk_5C) { - sub_02002154(v0->unk_5C, 4); + Menu_DestroyForExit(v0->unk_5C, 4); } ov23_0224FCF4(v0); @@ -1842,7 +1840,7 @@ static BOOL ov23_022510F0(SysTask *param0, void *param1) void *ov23_022511B0(UnkFuncPtr_ov23_0224F758 param0, FieldSystem *fieldSystem) { UnkStruct_ov23_02250CD4 *v0; - UnkStruct_ov84_02240FA8 v1; + ListMenuTemplate v1; v0 = Heap_AllocFromHeap(4, sizeof(UnkStruct_ov23_02250CD4)); diff --git a/src/overlay023/ov23_0225128C.c b/src/overlay023/ov23_0225128C.c index f61215ef58..5405c143d5 100644 --- a/src/overlay023/ov23_0225128C.c +++ b/src/overlay023/ov23_0225128C.c @@ -3,8 +3,6 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_020298B0_decl.h" #include "struct_decls/struct_020508D4_decl.h" #include "struct_defs/struct_02049FA8.h" @@ -25,7 +23,6 @@ #include "overlay023/ov23_02254A14.h" #include "overlay023/struct_ov23_0224271C.h" #include "overlay023/struct_ov23_02250CD4.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "bg_window.h" #include "camera.h" @@ -35,20 +32,20 @@ #include "core_sys.h" #include "field_system.h" #include "heap.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "player_avatar.h" #include "save_player.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "sys_task.h" #include "sys_task_manager.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200A9DC.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" -#include "unk_02013A04.h" #include "unk_0202854C.h" #include "unk_02033200.h" #include "unk_020508D4.h" @@ -71,7 +68,7 @@ typedef struct { typedef struct { int unk_00; FieldSystem *fieldSystem; - UIControlData *unk_08; + Menu *unk_08; UnkStruct_ov23_022513B0 unk_0C; SysTask *unk_10; } UnkStruct_ov23_02252038; @@ -263,9 +260,9 @@ static int ov23_0225144C(int param0, UnkStruct_ov23_02250CD4 *param1) return 0; } -static void ov23_0225148C(BmpList *param0, u32 param1, u8 param2) +static void ov23_0225148C(ListMenu *param0, u32 param1, u8 param2) { - UnkStruct_ov23_02250CD4 *v0 = (UnkStruct_ov23_02250CD4 *)sub_02001504(param0, 19); + UnkStruct_ov23_02250CD4 *v0 = (UnkStruct_ov23_02250CD4 *)ListMenu_GetAttribute(param0, 19); int v1 = param1; if (param1 == 0xfffffffe) { @@ -275,9 +272,9 @@ static void ov23_0225148C(BmpList *param0, u32 param1, u8 param2) ov23_02253F60(ov23_022421BC(), 6 + v1, 0, NULL); } -static void ov23_022514B0(BmpList *param0, u32 param1, u8 param2) +static void ov23_022514B0(ListMenu *param0, u32 param1, u8 param2) { - UnkStruct_ov23_02250CD4 *v0 = (UnkStruct_ov23_02250CD4 *)sub_02001504(param0, 19); + UnkStruct_ov23_02250CD4 *v0 = (UnkStruct_ov23_02250CD4 *)ListMenu_GetAttribute(param0, 19); int v1 = param1; if (param1 == 0xfffffffe) { @@ -293,8 +290,8 @@ static BOOL ov23_022514D8(SysTask *param0, void *param1) u32 v1; u16 v2, v3; - v1 = sub_02001288(v0->unk_48); - sub_020014DC(v0->unk_48, &v2, &v3); + v1 = ListMenu_ProcessInput(v0->unk_48); + ListMenu_GetListAndCursorPos(v0->unk_48, &v2, &v3); ov23_022430E0(23, v3, v2); ov23_022521C8(v0); @@ -345,7 +342,7 @@ static BOOL ov23_022514D8(SysTask *param0, void *param1) static void ov23_022515D8(UnkStruct_ov23_02250CD4 *param0, int param1, int param2, UnkFuncPtr_ov23_022515D8 param3, int param4) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; int v1 = param2 + 1; BOOL v2 = 1; @@ -356,7 +353,7 @@ static void ov23_022515D8(UnkStruct_ov23_02250CD4 *param0, int param1, int param ov23_0224FB7C(param0); - param0->unk_40 = sub_02013A04(v1, 4); + param0->unk_40 = StringList_New(v1, 4); Window_Add(param0->fieldSystem->unk_08, ¶m0->unk_10, 3, 17, 3, 14, v1 * 2, 13, 2); Window_Show(¶m0->unk_10, 1, 1024 - (18 + 12) - 9, 11); @@ -369,40 +366,40 @@ static void ov23_022515D8(UnkStruct_ov23_02250CD4 *param0, int param1, int param for (v4 = 0; v4 < v1; v4++) { if (v4 == (v1 - 1)) { - sub_02013A4C(param0->unk_40, v3, param1 + 5, 0xfffffffe); + StringList_AddFromMessageBank(param0->unk_40, v3, param1 + 5, 0xfffffffe); } else { - sub_02013A4C(param0->unk_40, v3, param1 + v4, v4); + StringList_AddFromMessageBank(param0->unk_40, v3, param1 + v4, v4); } } MessageLoader_Free(v3); } - MI_CpuCopy8(ov23_02253D40(), &v0, sizeof(UnkStruct_ov84_02240FA8)); + MI_CpuCopy8(ov23_02253D40(), &v0, sizeof(ListMenuTemplate)); - v0.unk_10 = v1; - v0.unk_12 = v1; - v0.unk_00 = param0->unk_40; - v0.unk_0C = ¶m0->unk_10; + v0.count = v1; + v0.maxDisplay = v1; + v0.choices = param0->unk_40; + v0.window = ¶m0->unk_10; if (param3) { - v0.unk_04 = param3; + v0.cursorCallback = param3; } - v0.unk_1C = param0; - ov23_02251238(param0, v1, v0.unk_10); - param0->unk_48 = sub_0200112C(&v0, param0->unk_294, param0->unk_290, 4); + v0.tmp = param0; + ov23_02251238(param0, v1, v0.count); + param0->unk_48 = ListMenu_New(&v0, param0->unk_294, param0->unk_290, 4); } static void ov23_022516E8(UnkStruct_ov23_02250CD4 *param0, int param1, int param2, UnkFuncPtr_ov23_022515D8 param3, int param4) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; int v1 = param2 + 1; BOOL v2 = 1; ov23_0224FB7C(param0); - param0->unk_40 = sub_02013A04(v1, 4); + param0->unk_40 = StringList_New(v1, 4); Window_Add(param0->fieldSystem->unk_08, ¶m0->unk_10, 3, 17, 3, 14, v1 * 2, 13, (2 + 14 * 16)); Window_Show(¶m0->unk_10, 1, 1024 - (18 + 12) - 9, 11); @@ -415,29 +412,29 @@ static void ov23_022516E8(UnkStruct_ov23_02250CD4 *param0, int param1, int param for (v4 = 0; v4 < v1; v4++) { if (v4 == param2) { - sub_02013A4C(param0->unk_40, v3, param1 + v4, 0xfffffffe); + StringList_AddFromMessageBank(param0->unk_40, v3, param1 + v4, 0xfffffffe); } else { - sub_02013A4C(param0->unk_40, v3, param1 + v4, v4); + StringList_AddFromMessageBank(param0->unk_40, v3, param1 + v4, v4); } } MessageLoader_Free(v3); } - MI_CpuCopy8(ov23_02253D40(), &v0, sizeof(UnkStruct_ov84_02240FA8)); + MI_CpuCopy8(ov23_02253D40(), &v0, sizeof(ListMenuTemplate)); - v0.unk_10 = param2 + 1; - v0.unk_12 = v1; - v0.unk_00 = param0->unk_40; - v0.unk_0C = ¶m0->unk_10; + v0.count = param2 + 1; + v0.maxDisplay = v1; + v0.choices = param0->unk_40; + v0.window = ¶m0->unk_10; if (param3) { - v0.unk_04 = param3; + v0.cursorCallback = param3; } - v0.unk_1C = param0; - ov23_02251238(param0, v1, v0.unk_10); - param0->unk_48 = sub_0200112C(&v0, param0->unk_294, param0->unk_290, 4); + v0.tmp = param0; + ov23_02251238(param0, v1, v0.count); + param0->unk_48 = ListMenu_New(&v0, param0->unk_294, param0->unk_290, 4); } static BOOL ov23_022517E0(SysTask *param0, void *param1) @@ -446,8 +443,8 @@ static BOOL ov23_022517E0(SysTask *param0, void *param1) u32 v1; u16 v2, v3; - v1 = sub_02001288(v0->unk_48); - sub_020014DC(v0->unk_48, &v2, &v3); + v1 = ListMenu_ProcessInput(v0->unk_48); + ListMenu_GetListAndCursorPos(v0->unk_48, &v2, &v3); ov23_022430E0(22, v3, v2); ov23_022521C8(v0); @@ -496,7 +493,7 @@ static BOOL ov23_02251894(SysTask *param0, void *param1) v1 = ov23_02248D20(v0->unk_4C); - sub_020014DC(v0->unk_4C->unk_0C, &v3, &v4); + ListMenu_GetListAndCursorPos(v0->unk_4C->unk_0C, &v3, &v4); ov23_022430E0(2, v4, v3); if (v1 == 0xfffffffe) { @@ -505,7 +502,7 @@ static BOOL ov23_02251894(SysTask *param0, void *param1) switch (v1) { case 0xffffffff: - ov23_0225128C(v0, v3, sub_02001504(v0->unk_4C->unk_0C, 2), 6); + ov23_0225128C(v0, v3, ListMenu_GetAttribute(v0->unk_4C->unk_0C, 2), 6); return 0; case 0xfffffffe: ov23_02254044(ov23_022421DC()); @@ -539,7 +536,7 @@ static BOOL ov23_02251960(SysTask *param0, void *param1) v1 = ov23_02248D20(v0->unk_4C); - sub_020014DC(v0->unk_4C->unk_0C, &v3, &v4); + ListMenu_GetListAndCursorPos(v0->unk_4C->unk_0C, &v3, &v4); ov23_022430E0(6, v4, v3); if (v1 == 0xfffffffe) { @@ -548,7 +545,7 @@ static BOOL ov23_02251960(SysTask *param0, void *param1) switch (v1) { case 0xffffffff: - ov23_0225128C(v0, v3, sub_02001504(v0->unk_4C->unk_0C, 2), 6); + ov23_0225128C(v0, v3, ListMenu_GetAttribute(v0->unk_4C->unk_0C, 2), 6); return 0; case 0xfffffffe: ov23_02254044(ov23_022421DC()); @@ -836,7 +833,7 @@ static void ov23_02251C04(SysTask *param0, void *param1) static void ov23_02251F94(FieldSystem *fieldSystem) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; UnkStruct_ov23_02250CD4 *v1; const int v2 = 6; @@ -871,12 +868,12 @@ static void ov23_02252038(SysTask *param0, void *param1) switch (v0->unk_00) { case 0: if (ov23_02254238(ov23_0224219C()) == 0) { - v0->unk_08 = sub_02002100(v0->fieldSystem->unk_08, &Unk_ov23_022569C8, 1024 - (18 + 12) - 9, 11, 4); + v0->unk_08 = Menu_MakeYesNoChoice(v0->fieldSystem->unk_08, &Unk_ov23_022569C8, 1024 - (18 + 12) - 9, 11, 4); v0->unk_00 = 1; } break; case 1: - v1 = sub_02002114(v0->unk_08, 4); + v1 = Menu_ProcessInputAndHandleExit(v0->unk_08, 4); if (v1 == 0xffffffff) { return; @@ -903,7 +900,7 @@ static void ov23_022520C8(SysTask *param0, void *param1) UnkStruct_ov23_02252038 *v0 = param1; if (v0->unk_08) { - sub_02002154(v0->unk_08, 4); + Menu_DestroyForExit(v0->unk_08, 4); } Heap_FreeToHeap(v0); @@ -959,7 +956,7 @@ static void ov23_022521C8(UnkStruct_ov23_02250CD4 *param0) u16 v0; v0 = param0->unk_2AE; - sub_020014D0(param0->unk_48, ¶m0->unk_2AE); + ListMenu_CalcTrueCursorPos(param0->unk_48, ¶m0->unk_2AE); if (v0 != param0->unk_2AE) { Sound_PlayEffect(1500); diff --git a/src/overlay023/ov23_022521F0.c b/src/overlay023/ov23_022521F0.c index 695281f7fe..dd42c41363 100644 --- a/src/overlay023/ov23_022521F0.c +++ b/src/overlay023/ov23_022521F0.c @@ -3,7 +3,6 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" #include "struct_decls/struct_020298B0_decl.h" #include "struct_decls/struct_02061AB4_decl.h" @@ -15,7 +14,6 @@ #include "overlay023/ov23_0225426C.h" #include "overlay023/ov23_0225429C.h" #include "overlay023/struct_ov23_02250CD4.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "bg_window.h" #include "comm_player_manager.h" @@ -24,20 +22,20 @@ #include "core_sys.h" #include "field_system.h" #include "heap.h" +#include "list_menu.h" #include "map_header_data.h" #include "map_object.h" +#include "menu.h" #include "message.h" #include "savedata.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "sys_task.h" #include "sys_task_manager.h" #include "text.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200DA60.h" -#include "unk_02013A04.h" #include "unk_0202631C.h" #include "unk_0202854C.h" #include "unk_020573FC.h" @@ -207,7 +205,7 @@ static int ov23_02252404(UnkStruct_ov23_02250CD4 *param0, int param1, int param2 static void *ov23_022524B8(UnkStruct_ov23_02250CD4 *param0) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; int v1 = 3; if (param0->unk_2AC == 2) { @@ -216,7 +214,7 @@ static void *ov23_022524B8(UnkStruct_ov23_02250CD4 *param0) ov23_0224FB7C(param0); - param0->unk_40 = sub_02013A04(v1, 4); + param0->unk_40 = StringList_New(v1, 4); Window_Add(param0->fieldSystem->unk_08, ¶m0->unk_10, 3, 19, 3, 12, v1 * 2, 13, ((((1024 - (18 + 12) - 9 - (32 * 8)) - (18 + 12 + 24)) - (27 * 4)) - 12 * 6)); Window_Show(¶m0->unk_10, 1, 1024 - (18 + 12) - 9, 11); @@ -227,35 +225,35 @@ static void *ov23_022524B8(UnkStruct_ov23_02250CD4 *param0) if (param0->unk_2AC == 1) { v3 = 13; ov23_022521F0(param0, param0->unk_288); - sub_02013A4C(param0->unk_40, ov23_02253E3C(ov23_022421BC()), v3, 0); - sub_02013A4C(param0->unk_40, ov23_02253E3C(ov23_022421BC()), v3 + 1, 1); - sub_02013A4C(param0->unk_40, ov23_02253E3C(ov23_022421BC()), v3 + 2, 0xfffffffe); + StringList_AddFromMessageBank(param0->unk_40, ov23_02253E3C(ov23_022421BC()), v3, 0); + StringList_AddFromMessageBank(param0->unk_40, ov23_02253E3C(ov23_022421BC()), v3 + 1, 1); + StringList_AddFromMessageBank(param0->unk_40, ov23_02253E3C(ov23_022421BC()), v3 + 2, 0xfffffffe); } else if (param0->unk_2AC == 0) { v3 = 16; ov23_022522F0(param0, param0->unk_288); - sub_02013A4C(param0->unk_40, ov23_02253E3C(ov23_022421BC()), v3, 0); - sub_02013A4C(param0->unk_40, ov23_02253E3C(ov23_022421BC()), v3 + 1, 1); - sub_02013A4C(param0->unk_40, ov23_02253E3C(ov23_022421BC()), v3 + 2, 0xfffffffe); + StringList_AddFromMessageBank(param0->unk_40, ov23_02253E3C(ov23_022421BC()), v3, 0); + StringList_AddFromMessageBank(param0->unk_40, ov23_02253E3C(ov23_022421BC()), v3 + 1, 1); + StringList_AddFromMessageBank(param0->unk_40, ov23_02253E3C(ov23_022421BC()), v3 + 2, 0xfffffffe); } else { v3 = 28; - sub_02013A4C(param0->unk_40, ov23_02253E3C(ov23_022421BC()), 28, 0); - sub_02013A4C(param0->unk_40, ov23_02253E3C(ov23_022421BC()), 22, 0xfffffffe); + StringList_AddFromMessageBank(param0->unk_40, ov23_02253E3C(ov23_022421BC()), 28, 0); + StringList_AddFromMessageBank(param0->unk_40, ov23_02253E3C(ov23_022421BC()), 22, 0xfffffffe); } } - MI_CpuCopy8(ov23_02253D40(), &v0, sizeof(UnkStruct_ov84_02240FA8)); + MI_CpuCopy8(ov23_02253D40(), &v0, sizeof(ListMenuTemplate)); - v0.unk_00 = param0->unk_40; - v0.unk_0C = ¶m0->unk_10; - v0.unk_10 = v1; - v0.unk_12 = v1; + v0.choices = param0->unk_40; + v0.window = ¶m0->unk_10; + v0.count = v1; + v0.maxDisplay = v1; param0->unk_294 = ov23_02243154(19); param0->unk_290 = ov23_0224318C(19); - ov23_02251238(param0, v0.unk_12, v0.unk_10); + ov23_02251238(param0, v0.maxDisplay, v0.count); - param0->unk_48 = sub_0200112C(&v0, param0->unk_294, param0->unk_290, 4); + param0->unk_48 = ListMenu_New(&v0, param0->unk_294, param0->unk_290, 4); param0->unk_2AE = param0->unk_290; Window_CopyToVRAM(¶m0->unk_10); @@ -263,9 +261,9 @@ static void *ov23_022524B8(UnkStruct_ov23_02250CD4 *param0) return param0; } -static void ov23_0225265C(BmpList *param0, u32 param1, u8 param2) +static void ov23_0225265C(ListMenu *param0, u32 param1, u8 param2) { - UnkStruct_ov23_02250CD4 *v0 = (UnkStruct_ov23_02250CD4 *)sub_02001504(param0, 19); + UnkStruct_ov23_02250CD4 *v0 = (UnkStruct_ov23_02250CD4 *)ListMenu_GetAttribute(param0, 19); u32 v1 = param1; Window_FillTilemap(&v0->unk_20, 15); @@ -297,10 +295,10 @@ static void ov23_0225265C(BmpList *param0, u32 param1, u8 param2) } } -static void ov23_02252754(BmpList *param0, u32 param1, u8 param2) +static void ov23_02252754(ListMenu *param0, u32 param1, u8 param2) { MATHRandContext16 v0; - UnkStruct_ov23_02250CD4 *v1 = (UnkStruct_ov23_02250CD4 *)sub_02001504(param0, 19); + UnkStruct_ov23_02250CD4 *v1 = (UnkStruct_ov23_02250CD4 *)ListMenu_GetAttribute(param0, 19); UndergroundData *v2 = sub_020298B0(FieldSystem_SaveData(v1->fieldSystem)); int v3 = param1, v4, v5; int v6, v7 = 0, v8; @@ -394,11 +392,11 @@ static int ov23_02252A04(int param0, void *param1) static void ov23_02252A18(UnkStruct_ov23_02250CD4 *param0) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; const int v1 = 5 + 1; ov23_0224FB7C(param0); - param0->unk_40 = sub_02013A04(v1, 4); + param0->unk_40 = StringList_New(v1, 4); Window_Add(param0->fieldSystem->unk_08, ¶m0->unk_10, 3, 19, 3, 12, v1 * 2, 13, (((((1024 - (18 + 12) - 9 - (32 * 8)) - (18 + 12 + 24)) - (27 * 4)) - 12 * 6) - 12 * 12)); Window_Show(¶m0->unk_10, 1, 1024 - (18 + 12) - 9, 11); @@ -419,29 +417,29 @@ static void ov23_02252A18(UnkStruct_ov23_02250CD4 *param0) } for (v3 = 0; v3 < v1 - 1; v3++) { - sub_02013A4C(param0->unk_40, v2, param0->unk_274[v3], v3); + StringList_AddFromMessageBank(param0->unk_40, v2, param0->unk_274[v3], v3); } - sub_02013A4C(param0->unk_40, v2, 0, 0xfffffffe); + StringList_AddFromMessageBank(param0->unk_40, v2, 0, 0xfffffffe); MessageLoader_Free(v2); } - MI_CpuCopy8(ov23_02253D40(), &v0, sizeof(UnkStruct_ov84_02240FA8)); + MI_CpuCopy8(ov23_02253D40(), &v0, sizeof(ListMenuTemplate)); - v0.unk_00 = param0->unk_40; - v0.unk_0C = ¶m0->unk_10; - v0.unk_10 = v1; - v0.unk_12 = v1; - v0.unk_04 = ov23_0225265C; - v0.unk_1C = param0; + v0.choices = param0->unk_40; + v0.window = ¶m0->unk_10; + v0.count = v1; + v0.maxDisplay = v1; + v0.cursorCallback = ov23_0225265C; + v0.tmp = param0; param0->unk_268 = ov23_02252A04; param0->unk_294 = ov23_02243154(13 + param0->unk_2AC); param0->unk_290 = ov23_0224318C(13 + param0->unk_2AC); param0->unk_2AE = param0->unk_290; - ov23_02251238(param0, v0.unk_12, v0.unk_10); - param0->unk_48 = sub_0200112C(&v0, param0->unk_294, param0->unk_290, 4); + ov23_02251238(param0, v0.maxDisplay, v0.count); + param0->unk_48 = ListMenu_New(&v0, param0->unk_294, param0->unk_290, 4); Window_CopyToVRAM(¶m0->unk_10); } @@ -627,12 +625,12 @@ static void ov23_02252E70(SysTask *param0, void *param1) v0->unk_2AA = 3; break; case 3: - v1 = sub_02001288(v0->unk_48); - sub_020014DC(v0->unk_48, &v3, &v4); + v1 = ListMenu_ProcessInput(v0->unk_48); + ListMenu_GetListAndCursorPos(v0->unk_48, &v3, &v4); ov23_022430E0(19, v4, v3); v5 = v0->unk_2AE; - sub_020014D0(v0->unk_48, &v0->unk_2AE); + ListMenu_CalcTrueCursorPos(v0->unk_48, &v0->unk_2AE); if (v5 != v0->unk_2AE) { Sound_PlayEffect(1500); @@ -670,12 +668,12 @@ static void ov23_02252E70(SysTask *param0, void *param1) v0->unk_2AA = 5; break; case 5: - v1 = sub_02001288(v0->unk_48); - sub_020014DC(v0->unk_48, &v3, &v4); + v1 = ListMenu_ProcessInput(v0->unk_48); + ListMenu_GetListAndCursorPos(v0->unk_48, &v3, &v4); ov23_022430E0(13 + v0->unk_2AC, v4, v3); v5 = v0->unk_2AE; - sub_020014D0(v0->unk_48, &v0->unk_2AE); + ListMenu_CalcTrueCursorPos(v0->unk_48, &v0->unk_2AE); if (v5 != v0->unk_2AE) { Sound_PlayEffect(1500); @@ -739,7 +737,7 @@ static void ov23_02252E70(SysTask *param0, void *param1) case 8: if (ov23_02254238(ov23_022421BC()) == 0) { v1 = ov23_02248D20(v0->unk_4C); - sub_020014DC(v0->unk_4C->unk_0C, &v3, &v4); + ListMenu_GetListAndCursorPos(v0->unk_4C->unk_0C, &v3, &v4); ov23_022430E0(12, v4, v3); if (v1 != 0xffffffff) { @@ -826,7 +824,7 @@ static void ov23_02252E70(SysTask *param0, void *param1) break; case 13: v1 = ov23_02248D20(v0->unk_4C); - sub_020014DC(v0->unk_4C->unk_0C, &v3, &v4); + ListMenu_GetListAndCursorPos(v0->unk_4C->unk_0C, &v3, &v4); ov23_022430E0(16 + v0->unk_2AC, v4, v3); switch (v1) { @@ -852,12 +850,12 @@ static void ov23_02252E70(SysTask *param0, void *param1) break; case 14: if (ov23_02254238(ov23_022421BC()) == 0) { - v0->unk_5C = sub_02002100(v0->fieldSystem->unk_08, &Unk_ov23_022569D8, 1024 - (18 + 12) - 9, 11, 4); + v0->unk_5C = Menu_MakeYesNoChoice(v0->fieldSystem->unk_08, &Unk_ov23_022569D8, 1024 - (18 + 12) - 9, 11, 4); v0->unk_2AA = 15; } break; case 15: - v1 = sub_02002114(v0->unk_5C, 4); + v1 = Menu_ProcessInputAndHandleExit(v0->unk_5C, 4); if (v1 == 0xffffffff) { return; @@ -912,7 +910,7 @@ static void ov23_02252E70(SysTask *param0, void *param1) void ov23_022534A0(FieldSystem *fieldSystem) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; int v1 = sub_02058D88(CommSys_CurNetId()); int v2 = sub_02058DC0(CommSys_CurNetId()); int v3 = CommPlayer_GetOppositeDir(CommPlayer_Dir(CommSys_CurNetId())); diff --git a/src/overlay023/ov23_02253598.c b/src/overlay023/ov23_02253598.c index 9dd3dbf92a..bad7586277 100644 --- a/src/overlay023/ov23_02253598.c +++ b/src/overlay023/ov23_02253598.c @@ -5,18 +5,14 @@ #include "constants/heap.h" -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_0202855C_decl.h" #include "struct_decls/struct_020298B0_decl.h" -#include "struct_defs/struct_02013A04_t.h" #include "overlay023/funcptr_ov23_0224DCB8.h" #include "overlay023/funcptr_ov23_02253834.h" #include "overlay023/ov23_02241F74.h" #include "overlay023/ov23_02253D40.h" #include "overlay023/struct_ov23_02253598_decl.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "bg_window.h" #include "comm_player_manager.h" @@ -24,9 +20,11 @@ #include "core_sys.h" #include "game_records.h" #include "heap.h" +#include "list_menu.h" #include "message.h" #include "savedata.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "sys_task.h" #include "sys_task_manager.h" @@ -42,8 +40,8 @@ typedef struct { UnkFuncPtr_ov23_02253834 unk_00; void *unk_04; Window unk_08; - ResourceMetadata *unk_18; - BmpList *unk_1C; + StringList *unk_18; + ListMenu *unk_1C; UnkFuncPtr_ov23_0224DCB8 unk_20; u16 unk_24; int unk_28; @@ -214,7 +212,7 @@ void ov23_02253834(BgConfig *param0, TrainerInfo *param1, UnkFuncPtr_ov23_022538 { SecretBaseRecord *v0; MessageLoader *v1; - UnkStruct_ov84_02240FA8 v2; + ListMenuTemplate v2; int v3 = 10; UnkStruct_ov23_022537D4 *v4 = Heap_AllocFromHeap(4, sizeof(UnkStruct_ov23_022537D4)); @@ -397,7 +395,7 @@ void *ov23_02253C64(BgConfig *param0, TrainerInfo *param1, UndergroundData *para { SecretBaseRecord *v0; MessageLoader *v1; - UnkStruct_ov84_02240FA8 v2; + ListMenuTemplate v2; int v3 = 10; UnkStruct_ov23_022537D4 *v4 = Heap_AllocFromHeap(4, sizeof(UnkStruct_ov23_022537D4)); diff --git a/src/overlay023/ov23_02253D40.c b/src/overlay023/ov23_02253D40.c index 94ad21f0d9..10ffbcf713 100644 --- a/src/overlay023/ov23_02253D40.c +++ b/src/overlay023/ov23_02253D40.c @@ -5,11 +5,11 @@ #include "overlay023/struct_ov23_02253E2C_decl.h" #include "overlay023/struct_ov23_02253F60.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "bg_window.h" #include "core_sys.h" #include "heap.h" +#include "list_menu.h" #include "message.h" #include "strbuf.h" #include "string_template.h" @@ -43,7 +43,7 @@ typedef struct UnkStruct_ov23_02253E2C_t { void ov23_022421EC(void); static void ov23_02253FA4(UnkStruct_ov23_02253E2C *param0, BOOL param1); -static const UnkStruct_ov84_02240FA8 Unk_ov23_022569E0 = { +static const ListMenuTemplate Unk_ov23_022569E0 = { NULL, NULL, NULL, @@ -65,7 +65,7 @@ static const UnkStruct_ov84_02240FA8 Unk_ov23_022569E0 = { NULL }; -const UnkStruct_ov84_02240FA8 *ov23_02253D40(void) +const ListMenuTemplate *ov23_02253D40(void) { return &Unk_ov23_022569E0; } diff --git a/src/overlay023/ov23_022542CC.c b/src/overlay023/ov23_022542CC.c index ccd1662da5..0f92badf61 100644 --- a/src/overlay023/ov23_022542CC.c +++ b/src/overlay023/ov23_022542CC.c @@ -3,10 +3,7 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_020298B0_decl.h" -#include "struct_defs/struct_02013A04_t.h" #include "struct_defs/struct_0206A844.h" #include "field/field_system.h" @@ -16,18 +13,17 @@ #include "overlay023/struct_ov23_02248D20.h" #include "overlay023/struct_ov23_022542D8_decl.h" #include "overlay023/struct_ov23_02254594_decl.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "bg_window.h" #include "heap.h" +#include "list_menu.h" #include "message.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" -#include "unk_0200112C.h" #include "unk_02005474.h" #include "unk_0200DA60.h" -#include "unk_02013A04.h" #include "unk_0202854C.h" #include "unk_0206A780.h" @@ -35,8 +31,8 @@ typedef struct UnkStruct_ov23_022542D8_t { FieldSystem *fieldSystem; Window unk_04; Window unk_14; - ResourceMetadata *unk_24; - BmpList *unk_28; + StringList *unk_24; + ListMenu *unk_28; Strbuf *unk_2C; u16 *unk_30; u16 *unk_34; @@ -50,9 +46,9 @@ typedef struct UnkStruct_ov23_02254594_t { UnkStruct_0206A844 *unk_04; Window unk_08; Window unk_18; - ResourceMetadata *unk_28; + StringList *unk_28; UnkStruct_ov23_02248D20 *unk_2C; - BmpList *unk_30; + ListMenu *unk_30; Strbuf *unk_34; u16 *unk_38; u16 *unk_3C; @@ -72,7 +68,7 @@ static void ov23_02254958(UnkStruct_ov23_02254594 *param0); static void ov23_022549A8(UnkStruct_0206A844 *param0, const u16 param1, const u16 param2, const u16 param3); static void ov23_022549EC(UnkStruct_ov23_022542D8 *param0); -static const UnkStruct_ov84_02240FA8 Unk_ov23_02256B3C = { +static const ListMenuTemplate Unk_ov23_02256B3C = { NULL, NULL, NULL, @@ -142,7 +138,7 @@ BOOL ov23_02254318(UnkStruct_ov23_022542D8 *param0) return 0; } -static void ov23_02254350(BmpList *param0, u32 param1, u8 param2) +static void ov23_02254350(ListMenu *param0, u32 param1, u8 param2) { const int v0[4] = { 5, @@ -156,12 +152,12 @@ static void ov23_02254350(BmpList *param0, u32 param1, u8 param2) static void ov23_0225437C(UnkStruct_ov23_022542D8 *param0) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; int v1, v2; int v3 = 3; int v4 = 4; - param0->unk_24 = sub_02013A04(v3 + 1, 4); + param0->unk_24 = StringList_New(v3 + 1, 4); v1 = 12 * v4 * 2; v2 = 7 * (1 * 2); @@ -194,20 +190,20 @@ static void ov23_0225437C(UnkStruct_ov23_022542D8 *param0) } for (v6 = 0; v6 < v3 + 1; v6++) { - sub_02013A4C(param0->unk_24, v5, v7[v6], v6); + StringList_AddFromMessageBank(param0->unk_24, v5, v7[v6], v6); } MessageLoader_Free(v5); } v0 = Unk_ov23_02256B3C; - v0.unk_10 = v3 + 1; - v0.unk_12 = v4; - v0.unk_00 = param0->unk_24; - v0.unk_0C = ¶m0->unk_04; - v0.unk_04 = ov23_02254350; + v0.count = v3 + 1; + v0.maxDisplay = v4; + v0.choices = param0->unk_24; + v0.window = ¶m0->unk_04; + v0.cursorCallback = ov23_02254350; - param0->unk_28 = sub_0200112C(&v0, *(param0->unk_30), *(param0->unk_34), 4); + param0->unk_28 = ListMenu_New(&v0, *(param0->unk_30), *(param0->unk_34), 4); Window_CopyToVRAM(¶m0->unk_04); Window_CopyToVRAM(¶m0->unk_14); param0->unk_38 = 1; @@ -217,7 +213,7 @@ static void ov23_022544C0(UnkStruct_ov23_022542D8 *param0) { u32 v0; - v0 = sub_02001288(param0->unk_28); + v0 = ListMenu_ProcessInput(param0->unk_28); ov23_022549EC(param0); @@ -250,24 +246,24 @@ static void ov23_0225451C(UnkStruct_ov23_022542D8 *param0) ov23_02254044(ov23_022421CC()); Window_Clear(¶m0->unk_14, 1); - sub_02001384(param0->unk_28, param0->unk_30, param0->unk_34); + ListMenu_Free(param0->unk_28, param0->unk_30, param0->unk_34); Window_Clear(¶m0->unk_04, 1); Bg_ScheduleTilemapTransfer(param0->unk_04.bgConfig, param0->unk_04.bgLayer); Window_Remove(¶m0->unk_04); Window_Remove(¶m0->unk_14); - sub_02013A3C(param0->unk_24); + StringList_Free(param0->unk_24); } -static void ov23_02254564(BmpList *param0, u32 param1, u8 param2) +static void ov23_02254564(ListMenu *param0, u32 param1, u8 param2) { u8 v0; v0 = param1 & 0x1; if (v0) { - sub_0200147C(param0, 1, 15, 2); + ListMenu_SetAltTextColors(param0, 1, 15, 2); } else { - sub_0200147C(param0, 2, 15, 2); + ListMenu_SetAltTextColors(param0, 2, 15, 2); } } @@ -342,8 +338,8 @@ static void ov23_0225461C(UnkStruct_ov23_02254594 *param0) } { - sub_020014DC(param0->unk_2C->unk_0C, &v2, &v3); - ov23_022549A8(param0->unk_04, v2, sub_02001504(param0->unk_2C->unk_0C, 2), sub_02001504(param0->unk_2C->unk_0C, 3)); + ListMenu_GetListAndCursorPos(param0->unk_2C->unk_0C, &v2, &v3); + ov23_022549A8(param0->unk_04, v2, ListMenu_GetAttribute(param0->unk_2C->unk_0C, 2), ListMenu_GetAttribute(param0->unk_2C->unk_0C, 3)); } switch (v0) { @@ -364,15 +360,15 @@ static void ov23_0225461C(UnkStruct_ov23_02254594 *param0) return; } -static void ov23_022546A0(BmpList *param0, u32 param1, u8 param2) +static void ov23_022546A0(ListMenu *param0, u32 param1, u8 param2) { int v0; UndergroundData *v1; u32 v2; u32 v3; - v1 = (UndergroundData *)sub_02001504(param0, 19); - v3 = sub_02001504(param0, 2); + v1 = (UndergroundData *)ListMenu_GetAttribute(param0, 19); + v3 = ListMenu_GetAttribute(param0, 2); v2 = (param1 >> 1); if (v2 == v3 - 1) { @@ -388,7 +384,7 @@ static void ov23_022546A0(BmpList *param0, u32 param1, u8 param2) static void ov23_022546E0(UnkStruct_ov23_02254594 *param0) { UndergroundData *v0; - UnkStruct_ov84_02240FA8 v1; + ListMenuTemplate v1; int v2, v3; int v4; int v5; @@ -402,7 +398,7 @@ static void ov23_022546E0(UnkStruct_ov23_02254594 *param0) v5 = 7; } - param0->unk_28 = sub_02013A04(v4 + 1, 4); + param0->unk_28 = StringList_New(v4 + 1, 4); v2 = 12 * 7 * 2; v3 = 8 * (2 * 2); @@ -464,25 +460,25 @@ static void ov23_022546E0(UnkStruct_ov23_02254594 *param0) } v10 = (v7 << 1) + v11; - sub_02013A4C(param0->unk_28, v6, v8, v10); + StringList_AddFromMessageBank(param0->unk_28, v6, v8, v10); } v10 = (v7 << 1) + 1; - sub_02013A4C(param0->unk_28, v6, 277, v10); + StringList_AddFromMessageBank(param0->unk_28, v6, 277, v10); MessageLoader_Free(v6); } ov23_02253DFC(ov23_022421DC(), 626, 0); v1 = Unk_ov23_02256B3C; - v1.unk_08 = ov23_02254564; - v1.unk_10 = v4 + 1; - v1.unk_12 = v5; - v1.unk_00 = param0->unk_28; - v1.unk_0C = ¶m0->unk_08; - v1.unk_04 = ov23_022546A0; - v1.unk_1C = v0; + v1.printCallback = ov23_02254564; + v1.count = v4 + 1; + v1.maxDisplay = v5; + v1.choices = param0->unk_28; + v1.window = ¶m0->unk_08; + v1.cursorCallback = ov23_022546A0; + v1.tmp = v0; param0->unk_2C = ov23_02248C08(&v1, *(param0->unk_38), *(param0->unk_3C), 4, sub_02028A10, v0, 1); @@ -508,7 +504,7 @@ static void ov23_02254958(UnkStruct_ov23_02254594 *param0) Bg_ScheduleTilemapTransfer(param0->unk_08.bgConfig, param0->unk_08.bgLayer); Window_Remove(¶m0->unk_08); Window_Remove(¶m0->unk_18); - sub_02013A3C(param0->unk_28); + StringList_Free(param0->unk_28); sub_0206A844(param0->unk_04); } @@ -536,7 +532,7 @@ static void ov23_022549EC(UnkStruct_ov23_022542D8 *param0) u16 v0; v0 = param0->unk_40; - sub_020014D0(param0->unk_28, ¶m0->unk_40); + ListMenu_CalcTrueCursorPos(param0->unk_28, ¶m0->unk_40); if (v0 != param0->unk_40) { Sound_PlayEffect(1500); diff --git a/src/overlay059/ov59_021D0D80.c b/src/overlay059/ov59_021D0D80.c index 12c9a527d0..9e290a7566 100644 --- a/src/overlay059/ov59_021D0D80.c +++ b/src/overlay059/ov59_021D0D80.c @@ -27,6 +27,7 @@ #include "gx_layers.h" #include "heap.h" #include "journal.h" +#include "menu.h" #include "message.h" #include "message_util.h" #include "narc.h" @@ -38,7 +39,6 @@ #include "sys_task_manager.h" #include "text.h" #include "trainer_info.h" -#include "unk_02001AF4.h" #include "unk_020041CC.h" #include "unk_02005474.h" #include "unk_020093B4.h" @@ -853,7 +853,7 @@ static const WindowTemplate Unk_ov59_021D3288 = { static int ov59_021D1A14(UnkStruct_020961E8 *param0, int param1) { - param0->unk_384 = sub_02002100(param0->unk_00, &Unk_ov59_021D3288, (1 + (18 + 12)), 11, 51); + param0->unk_384 = Menu_MakeYesNoChoice(param0->unk_00, &Unk_ov59_021D3288, (1 + (18 + 12)), 11, 51); param0->unk_3A8 = 5; ov59_021D1994(param0); @@ -891,7 +891,7 @@ static int ov59_021D1A44(UnkStruct_020961E8 *param0, int param1) return param1; } - v1 = sub_02002114(param0->unk_384, 51); + v1 = Menu_ProcessInputAndHandleExit(param0->unk_384, 51); if (v1 != 0xffffffff) { if (v1 == 0xfffffffe) { @@ -980,7 +980,7 @@ static int ov59_021D1C14(UnkStruct_020961E8 *param0, int param1) static int ov59_021D1C34(UnkStruct_020961E8 *param0, int param1) { - param0->unk_384 = sub_02002100(param0->unk_00, &Unk_ov59_021D3288, (1 + (18 + 12)), 11, 51); + param0->unk_384 = Menu_MakeYesNoChoice(param0->unk_00, &Unk_ov59_021D3288, (1 + (18 + 12)), 11, 51); param0->unk_3A8 = 23; ov59_021D1994(param0); @@ -1002,7 +1002,7 @@ static int ov59_021D1C64(UnkStruct_020961E8 *param0, int param1) return param1; } - v1 = sub_02002114(param0->unk_384, 51); + v1 = Menu_ProcessInputAndHandleExit(param0->unk_384, 51); if (v1 != 0xffffffff) { if (v1 == 0xfffffffe) { @@ -1150,7 +1150,7 @@ static int ov59_021D1EB8(UnkStruct_020961E8 *param0, int param1) static int ov59_021D1EF4(UnkStruct_020961E8 *param0, int param1) { - param0->unk_384 = sub_02002100(param0->unk_00, &Unk_ov59_021D3288, (1 + (18 + 12)), 11, 51); + param0->unk_384 = Menu_MakeYesNoChoice(param0->unk_00, &Unk_ov59_021D3288, (1 + (18 + 12)), 11, 51); param0->unk_3A8 = 12; ov59_021D1994(param0); @@ -1171,7 +1171,7 @@ static int ov59_021D1F24(UnkStruct_020961E8 *param0, int param1) return param1; } - v0 = sub_02002114(param0->unk_384, 51); + v0 = Menu_ProcessInputAndHandleExit(param0->unk_384, 51); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { @@ -1333,7 +1333,7 @@ void ov59_021D2204(UnkStruct_020961E8 *param0, int param1, u8 param2) break; case 13: if (param0->unk_384 != NULL) { - sub_02002154(param0->unk_384, 51); + Menu_DestroyForExit(param0->unk_384, 51); param0->unk_384 = NULL; } break; @@ -1345,7 +1345,7 @@ void ov59_021D2204(UnkStruct_020961E8 *param0, int param1, u8 param2) ov59_021D2628(param0, 12, 0); if (param0->unk_384 != NULL) { - sub_02002154(param0->unk_384, 51); + Menu_DestroyForExit(param0->unk_384, 51); param0->unk_384 = NULL; } break; @@ -1361,7 +1361,7 @@ void ov59_021D2204(UnkStruct_020961E8 *param0, int param1, u8 param2) } if (param0->unk_384 != NULL) { - sub_02002154(param0->unk_384, 51); + Menu_DestroyForExit(param0->unk_384, 51); param0->unk_384 = NULL; } @@ -1745,7 +1745,7 @@ static int ov59_021D292C(UnkStruct_020961E8 *param0, int param1) ov59_021D28D8(param0, -1); if (param0->unk_384 != NULL) { - sub_02002154(param0->unk_384, 51); + Menu_DestroyForExit(param0->unk_384, 51); param0->unk_384 = NULL; } diff --git a/src/overlay061/ov61_0222BF44.c b/src/overlay061/ov61_0222BF44.c index f528c21c61..b8ec8f003a 100644 --- a/src/overlay061/ov61_0222BF44.c +++ b/src/overlay061/ov61_0222BF44.c @@ -4,12 +4,8 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_02025CCC_decl.h" #include "struct_decls/struct_0202B370_decl.h" -#include "struct_defs/struct_02013A04_t.h" #include "struct_defs/struct_02017498.h" #include "struct_defs/struct_02099F80.h" @@ -24,15 +20,17 @@ #include "gx_layers.h" #include "heap.h" #include "inlines.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "overlay_manager.h" #include "render_text.h" #include "save_player.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" -#include "unk_02001AF4.h" #include "unk_0200A784.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" @@ -67,14 +65,14 @@ typedef struct { Window unk_54; Window unk_64; Window unk_74; - UIControlData *unk_84; + Menu *unk_84; void *unk_88; int unk_8C; int unk_90; int unk_94; int unk_98; - ResourceMetadata *unk_9C; - BmpList *unk_A0; + StringList *unk_9C; + ListMenu *unk_A0; UnkStruct_ov61_0222C3B0 unk_A4; } UnkStruct_ov61_0222C664; @@ -94,7 +92,7 @@ static void ov61_0222C7F8(UnkStruct_ov61_0222C664 *param0, int param1, int param static int ov61_0222C834(int param0); static void ov61_0222C850(UnkStruct_ov61_0222C664 *param0); static void ov61_0222C86C(UnkStruct_ov61_0222C664 *param0); -static UIControlData *ov61_0222C884(BgConfig *param0, int param1, int param2); +static Menu *ov61_0222C884(BgConfig *param0, int param1, int param2); static void ov61_0222C8B8(UnkStruct_ov61_0222C664 *param0, MessageLoader *param1, int param2, int param3, u16 param4); static void ov61_0222C920(UnkStruct_ov61_0222C664 *param0, int param1, int param2); static BOOL ov61_0222C928(int param0, int param1); @@ -550,7 +548,7 @@ static void ov61_0222C86C(UnkStruct_ov61_0222C664 *param0) } } -static UIControlData *ov61_0222C884(BgConfig *param0, int param1, int param2) +static Menu *ov61_0222C884(BgConfig *param0, int param1, int param2) { WindowTemplate v0; @@ -558,7 +556,7 @@ static UIControlData *ov61_0222C884(BgConfig *param0, int param1, int param2) v0.tilemapTop = param1; v0.baseTile = param2; - return sub_02002100(param0, &v0, (1 + (18 + 12)), 11, 117); + return Menu_MakeYesNoChoice(param0, &v0, (1 + (18 + 12)), 11, 117); } static void ov61_0222C8B8(UnkStruct_ov61_0222C664 *param0, MessageLoader *param1, int param2, int param3, u16 param4) @@ -635,7 +633,7 @@ static int ov61_0222C960(UnkStruct_ov61_0222C664 *param0) param0->unk_90++; break; case 3: { - int v0 = sub_02002114(param0->unk_84, 117); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_84, 117); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { diff --git a/src/overlay064/ov64_0222DCE0.c b/src/overlay064/ov64_0222DCE0.c index 8d606d941a..fb08128282 100644 --- a/src/overlay064/ov64_0222DCE0.c +++ b/src/overlay064/ov64_0222DCE0.c @@ -4,13 +4,9 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_0202B370_decl.h" #include "struct_decls/struct_0203068C_decl.h" #include "struct_defs/struct_0200C738.h" -#include "struct_defs/struct_02013A04_t.h" #include "struct_defs/struct_0208737C.h" #include "struct_defs/struct_02089438.h" #include "struct_defs/struct_02099F80.h" @@ -20,7 +16,6 @@ #include "overlay063/struct_ov63_0222AE60_decl.h" #include "overlay063/struct_ov63_0222BB38_decl.h" #include "overlay064/struct_ov64_022302EC.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "ascii_util.h" #include "bag.h" @@ -35,6 +30,8 @@ #include "gx_layers.h" #include "heap.h" #include "inlines.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "message_util.h" #include "narc.h" @@ -45,11 +42,10 @@ #include "savedata.h" #include "sprite_resource.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" #include "trainer_info.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_020093B4.h" #include "unk_0200A328.h" @@ -57,7 +53,6 @@ #include "unk_0200DA60.h" #include "unk_0200F174.h" #include "unk_020131EC.h" -#include "unk_02013A04.h" #include "unk_02017728.h" #include "unk_0201DBEC.h" #include "unk_0201E86C.h" @@ -145,7 +140,7 @@ typedef struct { void * unk_14; NNSG2dScreenData * unk_18; Window unk_1C; - UIControlData * unk_2C; + Menu *unk_2C; u32 unk_30; u32 unk_34; Strbuf* unk_38; @@ -177,9 +172,9 @@ typedef struct { u32 unk_D8; u32 unk_DC; Window unk_E0; - ResourceMetadata * unk_F0[2]; - BmpList * unk_F8; - UIControlData * unk_FC; + StringList *unk_F0[2]; + ListMenu *unk_F8; + Menu *unk_FC; s32 unk_100; CellActor * unk_104; u32 unk_108; @@ -317,7 +312,7 @@ static void ov64_0222FE70(UnkStruct_ov64_0222F0C4 * param0, UnkStruct_ov64_0222E static BOOL ov64_0222FEFC(const UnkStruct_ov64_0222F0C4 * param0); static void ov64_0222FF18(UnkStruct_ov64_0222F0C4 * param0); static u32 ov64_0222FF38(const UnkStruct_ov64_0222F0C4 * param0); -static void ov64_0222FF48(BmpList * param0, u32 param1, u8 param2); +static void ov64_0222FF48(ListMenu *param0, u32 param1, u8 param2); static void ov64_0222FF5C(UnkStruct_ov64_0222F0C4 * param0); static BOOL ov64_02230008(UnkStruct_ov64_0222F0C4 * param0); static void ov64_02230044(UnkStruct_ov64_0222F0C4 * param0); @@ -538,7 +533,7 @@ static const UnkStruct_ov64_022322E4 Unk_ov64_022322E4[2][4] = { } }; -static const UnkStruct_ov84_02240FA8 Unk_ov64_0223226C = { +static const ListMenuTemplate Unk_ov64_0223226C = { NULL, ov64_0222FF48, NULL, @@ -1336,7 +1331,7 @@ static int ov64_0222EA70 (UnkStruct_ov64_0222F038 * param0, UnkStruct_ov64_0222E break; } - param0->unk_2C = sub_02002100(param2->unk_00, &Unk_ov64_022321CA, 1, 9, param3); + param0->unk_2C = Menu_MakeYesNoChoice(param2->unk_00, &Unk_ov64_022321CA, 1, 9, param3); param1->unk_04 = 9; break; case 9: @@ -1347,7 +1342,7 @@ static int ov64_0222EA70 (UnkStruct_ov64_0222F038 * param0, UnkStruct_ov64_0222E 0, 50, 54, }; - v3 = sub_02002114(param0->unk_2C, param3); + v3 = Menu_ProcessInputAndHandleExit(param0->unk_2C, param3); switch (v3) { case 0xffffffff: @@ -1856,7 +1851,7 @@ static int ov64_0222F0C4 (UnkStruct_ov64_0222F0C4 * param0, UnkStruct_ov64_0222E } break; case 17: - v0 = sub_02002114(param0->unk_FC, param3); + v0 = Menu_ProcessInputAndHandleExit(param0->unk_FC, param3); switch (v0) { case 0xffffffff: @@ -2081,7 +2076,7 @@ asm static void ov64_0222F414 (UnkStruct_ov64_0222F0C4 * param0, UnkStruct_ov64_ _0222F530: ldr r1, [sp, #0x18] mov r0, #4 - bl sub_02013A04 + bl StringList_New add r1, r6, #0 add r1, #0xf4 ldr r5, [sp, #0x20] @@ -2096,7 +2091,7 @@ asm static void ov64_0222F414 (UnkStruct_ov64_0222F0C4 * param0, UnkStruct_ov64_ ldr r1, [r7, r1] ldr r2, [r5, #0] ldr r3, [r5, #4] - bl sub_02013A4C + bl StringList_AddFromMessageBank add r4, r4, #1 add r5, #8 cmp r4, #4 @@ -2172,7 +2167,7 @@ static void ov64_0222F5F4 (UnkStruct_ov64_0222F0C4 * param0, UnkStruct_ov64_0222 Strbuf_Free(param0->unk_D4); for (v0 = 0; v0 < 2; v0++) { - sub_02013A3C(param0->unk_F0[v0]); + StringList_Free(param0->unk_F0[v0]); } Window_Remove(¶m0->unk_E0); @@ -2404,7 +2399,7 @@ static BOOL ov64_0222F948 (UnkStruct_ov64_0222F0C4 * param0, UnkStruct_ov64_0222 static void ov64_0222FA70 (UnkStruct_ov64_0222F0C4 * param0, UnkStruct_ov64_0222E060 * param1, UnkStruct_ov64_0222E21C * param2, u32 param3) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; UnkStruct_0202B370 * v1; u32 v2; u32 v3; @@ -2415,13 +2410,13 @@ static void ov64_0222FA70 (UnkStruct_ov64_0222F0C4 * param0, UnkStruct_ov64_0222 v0 = Unk_ov64_0223226C; if (v2 == 2) { - v0.unk_00 = param0->unk_F0[1]; + v0.choices = param0->unk_F0[1]; } else { - v0.unk_00 = param0->unk_F0[0]; + v0.choices = param0->unk_F0[0]; } - v0.unk_0C = ¶m0->unk_E0; - param0->unk_F8 = sub_0200112C(&v0, 0, 0, param3); + v0.window = ¶m0->unk_E0; + param0->unk_F8 = ListMenu_New(&v0, 0, 0, param3); Window_Show(¶m0->unk_E0, 1, 1, 9); Window_ScheduleCopyToVRAM(¶m0->unk_E0); @@ -2440,7 +2435,7 @@ static u32 ov64_0222FB24 (UnkStruct_ov64_0222F0C4 * param0, UnkStruct_ov64_0222E return v1; } - v0 = sub_02001288(param0->unk_F8); + v0 = ListMenu_ProcessInput(param0->unk_F8); switch (v0) { case 0xffffffff: @@ -2460,7 +2455,7 @@ static u32 ov64_0222FB24 (UnkStruct_ov64_0222F0C4 * param0, UnkStruct_ov64_0222E Window_Clear(¶m0->unk_E0, 1); Window_ClearAndScheduleCopyToVRAM(¶m0->unk_E0); - sub_02001384(param0->unk_F8, NULL, NULL); + ListMenu_Free(param0->unk_F8, NULL, NULL); if (v1 == 2) { ov64_0222EA28(param2, 1); @@ -2508,7 +2503,7 @@ static BOOL ov64_0222FC48 (UnkStruct_ov64_0222F0C4 * param0, UnkStruct_ov64_0222 return 0; } - param0->unk_FC = sub_02002100(param2->unk_00, &Unk_ov64_022321CA, 1, 9, param3); + param0->unk_FC = Menu_MakeYesNoChoice(param2->unk_00, &Unk_ov64_022321CA, 1, 9, param3); return 1; } @@ -2611,7 +2606,7 @@ static u32 ov64_0222FF38 (const UnkStruct_ov64_0222F0C4 * param0) return v0; } -static void ov64_0222FF48 (BmpList * param0, u32 param1, u8 param2) +static void ov64_0222FF48 (ListMenu * param0, u32 param1, u8 param2) { if (param2 == 0) { Sound_PlayEffect(1500); diff --git a/src/overlay065/ov65_0222DCE0.c b/src/overlay065/ov65_0222DCE0.c index f8ae5eca5c..b5ccc58c21 100644 --- a/src/overlay065/ov65_0222DCE0.c +++ b/src/overlay065/ov65_0222DCE0.c @@ -5,7 +5,6 @@ #include #include "struct_decls/pokedexdata_decl.h" -#include "struct_decls/struct_0200112C_decl.h" #include "struct_decls/struct_02012B20_decl.h" #include "struct_decls/struct_0202B370_decl.h" #include "struct_decls/struct_0202C878_decl.h" @@ -25,7 +24,6 @@ #include "overlay065/struct_ov65_0222F6EC.h" #include "overlay065/struct_ov65_02234E50.h" #include "overlay065/struct_ov65_022354D8.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "overlay098/struct_ov98_02247168.h" #include "assert.h" @@ -45,6 +43,8 @@ #include "heap.h" #include "inlines.h" #include "journal.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "message_util.h" #include "narc.h" @@ -58,12 +58,11 @@ #include "savedata.h" #include "sprite_resource.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" #include "touch_screen.h" #include "trainer_info.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_020041CC.h" #include "unk_02005474.h" #include "unk_020093B4.h" @@ -72,7 +71,6 @@ #include "unk_0200DA60.h" #include "unk_0200F174.h" #include "unk_02012744.h" -#include "unk_02013A04.h" #include "unk_02017728.h" #include "unk_0201DBEC.h" #include "unk_0201E3D8.h" @@ -1562,11 +1560,11 @@ static void ov65_0222EF4C (UnkStruct_ov65_0222EBE0 * param0) } if (param0->unk_150) { - sub_02001384(param0->unk_150, NULL, NULL); + ListMenu_Free(param0->unk_150, NULL, NULL); } if (param0->unk_14C) { - sub_02013A3C(param0->unk_14C); + StringList_Free(param0->unk_14C); param0->unk_14C = NULL; } @@ -1633,7 +1631,7 @@ static int ov65_0222F010 (UnkStruct_ov65_0222EBE0 * param0, int param1) ov65_02232CA8(param0, 18); - param0->unk_184 = sub_02002100(param0->unk_15C, &Unk_ov65_02238954, ((512 - (18 + 12)) - 9), 11, 54); + param0->unk_184 = Menu_MakeYesNoChoice(param0->unk_15C, &Unk_ov65_02238954, ((512 - (18 + 12)) - 9), 11, 54); param0->unk_3A8 = 6; } else if (!DWC_CheckValidConsole(sub_0202AD28(param0->unk_00))) { ov65_02232CA8(param0, 20); @@ -1650,7 +1648,7 @@ static int ov65_0222F010 (UnkStruct_ov65_0222EBE0 * param0, int param1) static int ov65_0222F164 (UnkStruct_ov65_0222EBE0 * param0, int param1) { if (Text_IsPrinterActive(param0->unk_180) == 0) { - param0->unk_184 = sub_02002100(param0->unk_15C, &Unk_ov65_02238944, ((512 - (18 + 12)) - 9), 11, 54); + param0->unk_184 = Menu_MakeYesNoChoice(param0->unk_15C, &Unk_ov65_02238944, ((512 - (18 + 12)) - 9), 11, 54); param0->unk_3A8 = 2; } @@ -1660,7 +1658,7 @@ static int ov65_0222F164 (UnkStruct_ov65_0222EBE0 * param0, int param1) static int ov65_0222F1A8 (UnkStruct_ov65_0222EBE0 * param0, int param1) { int v0; - int v1 = sub_02002114(param0->unk_184, 54); + int v1 = Menu_ProcessInputAndHandleExit(param0->unk_184, 54); if (v1 == 0xffffffff) { return param1; @@ -1688,7 +1686,7 @@ static int ov65_0222F21C (UnkStruct_ov65_0222EBE0 * param0, int param1) Bg_SetPriority(1, 0); Bg_SetPriority(0, 3); - param0->unk_184 = sub_02002054(param0->unk_15C, &Unk_ov65_02238954, ((512 - (18 + 12)) - 9), 11, 1, 54); + param0->unk_184 = Menu_MakeYesNoChoiceWithCursorAt(param0->unk_15C, &Unk_ov65_02238954, ((512 - (18 + 12)) - 9), 11, 1, 54); param0->unk_3A8 = 4; } @@ -1698,7 +1696,7 @@ static int ov65_0222F21C (UnkStruct_ov65_0222EBE0 * param0, int param1) static int ov65_0222F288 (UnkStruct_ov65_0222EBE0 * param0, int param1) { int v0; - int v1 = sub_02002114(param0->unk_184, 54); + int v1 = Menu_ProcessInputAndHandleExit(param0->unk_184, 54); if (v1 == 0xffffffff) { return param1; @@ -1708,7 +1706,7 @@ static int ov65_0222F288 (UnkStruct_ov65_0222EBE0 * param0, int param1) if (v1 == 0) { ov65_02232CA8(param0, 22); - param0->unk_184 = sub_02002054(param0->unk_15C, &Unk_ov65_02238954, ((512 - (18 + 12)) - 9), 11, 1, 54); + param0->unk_184 = Menu_MakeYesNoChoiceWithCursorAt(param0->unk_15C, &Unk_ov65_02238954, ((512 - (18 + 12)) - 9), 11, 1, 54); param0->unk_3A8 = 5; } else { param0->unk_3A8 = 34; @@ -1721,7 +1719,7 @@ static int ov65_0222F288 (UnkStruct_ov65_0222EBE0 * param0, int param1) static int ov65_0222F304 (UnkStruct_ov65_0222EBE0 * param0, int param1) { int v0; - int v1 = sub_02002114(param0->unk_184, 54); + int v1 = Menu_ProcessInputAndHandleExit(param0->unk_184, 54); if (v1 == 0xffffffff) { return param1; @@ -1754,7 +1752,7 @@ static int ov65_0222F304 (UnkStruct_ov65_0222EBE0 * param0, int param1) static int ov65_0222F3DC (UnkStruct_ov65_0222EBE0 * param0, int param1) { int v0; - int v1 = sub_02002114(param0->unk_184, 54); + int v1 = Menu_ProcessInputAndHandleExit(param0->unk_184, 54); if (v1 == 0xffffffff) { return param1; @@ -2000,7 +1998,7 @@ static int ov65_0222F808 (UnkStruct_ov65_0222EBE0 * param0, int param1) static int ov65_0222F868 (UnkStruct_ov65_0222EBE0 * param0, int param1) { if (Text_IsPrinterActive(param0->unk_180) == 0) { - param0->unk_184 = sub_02002100(param0->unk_15C, &Unk_ov65_0223894C, ((512 - (18 + 12)) - 9), 11, 54); + param0->unk_184 = Menu_MakeYesNoChoice(param0->unk_15C, &Unk_ov65_0223894C, ((512 - (18 + 12)) - 9), 11, 54); param0->unk_3A8 = 12; } @@ -2010,7 +2008,7 @@ static int ov65_0222F868 (UnkStruct_ov65_0222EBE0 * param0, int param1) static int ov65_0222F8AC (UnkStruct_ov65_0222EBE0 * param0, int param1) { int v0; - int v1 = sub_02002114(param0->unk_184, 54); + int v1 = Menu_ProcessInputAndHandleExit(param0->unk_184, 54); if (v1 == 0xffffffff) { return param1; @@ -2074,9 +2072,9 @@ static int ov65_0222F90C (UnkStruct_ov65_0222EBE0 * param0, int param1) if (param0->unk_14C) { Window_Remove(¶m0->unk_370); - sub_02001384(param0->unk_150, NULL, NULL); + ListMenu_Free(param0->unk_150, NULL, NULL); param0->unk_150 = NULL; - sub_02013A3C(param0->unk_14C); + StringList_Free(param0->unk_14C); param0->unk_14C = NULL; } @@ -2352,7 +2350,7 @@ static void ov65_0222FD70 (UnkStruct_ov65_0222EBE0 * param0) Window_ScheduleCopyToVRAM(¶m0->unk_340); } -static void ov65_0222FED8 (BmpList * param0, u32 param1, u8 param2) +static void ov65_0222FED8(ListMenu *param0, u32 param1, u8 param2) { if (param2 == 0) { Sound_PlayEffect(1500); @@ -2409,9 +2407,9 @@ static int ov65_0222FFAC (UnkStruct_ov65_0222EBE0 * param0, int param1) if (param0->unk_14C) { Window_Remove(¶m0->unk_370); - sub_02001384(param0->unk_150, NULL, NULL); + ListMenu_Free(param0->unk_150, NULL, NULL); param0->unk_150 = NULL; - sub_02013A3C(param0->unk_14C); + StringList_Free(param0->unk_14C); param0->unk_14C = NULL; } @@ -2896,7 +2894,7 @@ static int ov65_022309D0 (UnkStruct_ov65_0222EBE0 * param0, int param1) if (Text_IsPrinterActive(param0->unk_180) == 0) { sub_0202B13C(param0->unk_00, ov4_021D2388()); - param0->unk_184 = sub_02002100(param0->unk_15C, &Unk_ov65_0223894C, ((512 - (18 + 12)) - 9), 11, 54); + param0->unk_184 = Menu_MakeYesNoChoice(param0->unk_15C, &Unk_ov65_0223894C, ((512 - (18 + 12)) - 9), 11, 54); param0->unk_3A8 = 26; } @@ -2906,14 +2904,14 @@ static int ov65_022309D0 (UnkStruct_ov65_0222EBE0 * param0, int param1) static int ov65_02230A30 (UnkStruct_ov65_0222EBE0 * param0, int param1) { int v0; - int v1 = sub_02002114(param0->unk_184, 54); + int v1 = Menu_ProcessInputAndHandleExit(param0->unk_184, 54); if (v1 == 0xffffffff) { if ((sub_020380E4() >= 4) || sub_02038284() || !CommSys_IsPlayerConnected(0)) { ov65_02232DFC(param0); ov65_02232E58(param0, 16); - sub_02002154(param0->unk_184, 54); + Menu_DestroyForExit(param0->unk_184, 54); param0->unk_3D0 = -1; param0->unk_3BC = 20; param0->unk_3A8 = 65; @@ -3083,7 +3081,7 @@ static int ov65_02230D20 (UnkStruct_ov65_0222EBE0 * param0, int param1) ov65_022355FC(¶m0->unk_3EC); if (Text_IsPrinterActive(param0->unk_180) == 0) { - param0->unk_184 = sub_02002100(param0->unk_15C, &Unk_ov65_0223894C, ((512 - (18 + 12)) - 9), 11, 54); + param0->unk_184 = Menu_MakeYesNoChoice(param0->unk_15C, &Unk_ov65_0223894C, ((512 - (18 + 12)) - 9), 11, 54); param0->unk_3A8 = 41; } @@ -3093,7 +3091,7 @@ static int ov65_02230D20 (UnkStruct_ov65_0222EBE0 * param0, int param1) static int ov65_02230D6C (UnkStruct_ov65_0222EBE0 * param0, int param1) { int v0; - int v1 = sub_02002114(param0->unk_184, 54); + int v1 = Menu_ProcessInputAndHandleExit(param0->unk_184, 54); ov65_022355FC(¶m0->unk_3EC); @@ -3101,7 +3099,7 @@ static int ov65_02230D6C (UnkStruct_ov65_0222EBE0 * param0, int param1) ov4_021D2584(param0->unk_04->unk_00.unk_21); if (v1 == 0xffffffff) { - sub_02002154(param0->unk_184, 54); + Menu_DestroyForExit(param0->unk_184, 54); } v1 = 1; @@ -3170,7 +3168,7 @@ UnkStruct_ov65_02239CDC Unk_ov65_02239C9C[] = { {0x29, (u32)0xfffffffe} }; -static UnkStruct_ov84_02240FA8 Unk_ov65_02239CBC = { +static ListMenuTemplate Unk_ov65_02239CBC = { NULL, ov65_0222FED8, NULL, @@ -3192,7 +3190,7 @@ static UnkStruct_ov84_02240FA8 Unk_ov65_02239CBC = { NULL }; -static const UnkStruct_ov84_02240FA8 Unk_ov65_02238AD0 = { +static const ListMenuTemplate Unk_ov65_02238AD0 = { NULL, ov65_0222FED8, NULL, @@ -3214,7 +3212,7 @@ static const UnkStruct_ov84_02240FA8 Unk_ov65_02238AD0 = { NULL }; -static const UnkStruct_ov84_02240FA8 Unk_ov65_02238AF0 = { +static const ListMenuTemplate Unk_ov65_02238AF0 = { NULL, ov65_0222FED8, NULL, @@ -3239,7 +3237,7 @@ static const UnkStruct_ov84_02240FA8 Unk_ov65_02238AF0 = { static int ov65_02230E04 (UnkStruct_ov65_0222EBE0 * param0, int param1) { int v0, v1; - UnkStruct_ov84_02240FA8 v2; + ListMenuTemplate v2; UnkStruct_ov65_02239CDC * v3; v1 = 3; @@ -3248,37 +3246,37 @@ static int ov65_02230E04 (UnkStruct_ov65_0222EBE0 * param0, int param1) if (ov65_0222DCF8(param0) == 1) { v1++; - v2.unk_10++; - v2.unk_12++; + v2.count++; + v2.maxDisplay++; v3[v1 - 1] = Unk_ov65_02239C28; } if (ov65_0222DCE0(param0) == 1) { v1++; - v2.unk_10++; - v2.unk_12++; + v2.count++; + v2.maxDisplay++; v3[v1 - 1] = Unk_ov65_02239C30; } if (ov65_0222DD1C(param0) == 1) { v1++; - v2.unk_10++; - v2.unk_12++; + v2.count++; + v2.maxDisplay++; v3[v1 - 1] = Unk_ov65_02239C38; } { v1++; - v2.unk_10++; - v2.unk_12++; + v2.count++; + v2.maxDisplay++; v3[v1 - 1] = Unk_ov65_02239C20; } - param0->unk_154 = sub_02013A04(v1, 54); + param0->unk_154 = StringList_New(v1, 54); for (v0 = 0; v0 < v1; v0++) { - sub_02013A4C(param0->unk_154, param0->unk_168, v3[v0].unk_00, v3[v0].unk_04); + StringList_AddFromMessageBank(param0->unk_154, param0->unk_168, v3[v0].unk_00, v3[v0].unk_04); } if (Window_IsInUse(¶m0->unk_380)) { @@ -3289,10 +3287,10 @@ static int ov65_02230E04 (UnkStruct_ov65_0222EBE0 * param0, int param1) Window_Add(param0->unk_15C, ¶m0->unk_380, 2, 16, 3, 15, v1 * 2, 13, ((((((512 - (18 + 12)) - 9) - 10) - (18 + 12 + 24)) - (27 * 4)) - (11 * 22)) - v1 * 2); Window_Show(¶m0->unk_380, 1, ((512 - (18 + 12)) - 9), 11); - v2.unk_00 = param0->unk_154; - v2.unk_0C = ¶m0->unk_380; + v2.choices = param0->unk_154; + v2.window = ¶m0->unk_380; - param0->unk_158 = sub_0200112C(&v2, 0, param0->unk_3D4, 54); + param0->unk_158 = ListMenu_New(&v2, 0, param0->unk_3D4, 54); Window_ScheduleCopyToVRAM(¶m0->unk_380); ov65_02232B58(param0, 8, 0); @@ -3315,15 +3313,15 @@ static int ov65_02230FBC (UnkStruct_ov65_0222EBE0 * param0, int param1) param0->unk_3A8 = 19; Window_Clear(¶m0->unk_380, 0); Window_Remove(¶m0->unk_380); - sub_02001384(param0->unk_158, NULL, ¶m0->unk_3D4); - sub_02013A3C(param0->unk_154); + ListMenu_Free(param0->unk_158, NULL, ¶m0->unk_3D4); + StringList_Free(param0->unk_154); ov65_02232DFC(param0); } return param1; } - v0 = sub_02001288(param0->unk_158); + v0 = ListMenu_ProcessInput(param0->unk_158); if (0 != ov65_02230140(param0)) { v0 = 0xfffffffe; @@ -3359,8 +3357,8 @@ static int ov65_02230FBC (UnkStruct_ov65_0222EBE0 * param0, int param1) } else if ((v0 == 0) || (v0 == 1) || (v0 == 29)) { Window_Clear(¶m0->unk_380, 0); Window_Remove(¶m0->unk_380); - sub_02001384(param0->unk_158, NULL, ¶m0->unk_3D4); - sub_02013A3C(param0->unk_154); + ListMenu_Free(param0->unk_158, NULL, ¶m0->unk_3D4); + StringList_Free(param0->unk_154); ov65_0223128C(param0, v0); param0->unk_3A8 = 38; return param1; @@ -3394,8 +3392,8 @@ static int ov65_02230FBC (UnkStruct_ov65_0222EBE0 * param0, int param1) Window_Clear(¶m0->unk_380, 0); Window_Remove(¶m0->unk_380); - sub_02001384(param0->unk_158, NULL, ¶m0->unk_3D4); - sub_02013A3C(param0->unk_154); + ListMenu_Free(param0->unk_158, NULL, ¶m0->unk_3D4); + StringList_Free(param0->unk_154); return param1; } @@ -3437,7 +3435,7 @@ static int ov65_02231200 (UnkStruct_ov65_0222EBE0 * param0, int param1) static int ov65_0223128C (UnkStruct_ov65_0222EBE0 * param0, int param1) { int v0, v1; - UnkStruct_ov84_02240FA8 v2; + ListMenuTemplate v2; UnkStruct_ov65_02239CDC * v3; switch (param1) { @@ -3461,16 +3459,16 @@ static int ov65_0223128C (UnkStruct_ov65_0222EBE0 * param0, int param1) break; } - param0->unk_154 = sub_02013A04(v1, 54); + param0->unk_154 = StringList_New(v1, 54); for (v0 = 0; v0 < v1; v0++) { if (v3[v0].unk_00 != 71) { - sub_02013A4C(param0->unk_154, param0->unk_168, v3[v0].unk_00, v3[v0].unk_04); + StringList_AddFromMessageBank(param0->unk_154, param0->unk_168, v3[v0].unk_00, v3[v0].unk_04); } else { StringTemplate_SetPlazaMinigameName(param0->unk_164, 0, v0); MessageLoader_GetStrbuf(param0->unk_168, v3[v0].unk_00, param0->unk_170); StringTemplate_Format(param0->unk_164, param0->unk_178, param0->unk_170); - sub_02013A6C(param0->unk_154, param0->unk_178, v3[v0].unk_04); + StringList_AddFromStrbuf(param0->unk_154, param0->unk_178, v3[v0].unk_04); } } @@ -3482,10 +3480,10 @@ static int ov65_0223128C (UnkStruct_ov65_0222EBE0 * param0, int param1) Window_Add(param0->unk_15C, ¶m0->unk_380, 2, 16, 9, 15, v1 * 2, 13, ((((((512 - (18 + 12)) - 9) - 10) - (18 + 12 + 24)) - (27 * 4)) - (11 * 22)) - v1 * 2); Window_Show(¶m0->unk_380, 1, ((512 - (18 + 12)) - 9), 11); - v2.unk_00 = param0->unk_154; - v2.unk_0C = ¶m0->unk_380; + v2.choices = param0->unk_154; + v2.window = ¶m0->unk_380; - param0->unk_158 = sub_0200112C(&v2, 0, param0->unk_3D6[param0->unk_3DC], 54); + param0->unk_158 = ListMenu_New(&v2, 0, param0->unk_3D6[param0->unk_3DC], 54); Window_ScheduleCopyToVRAM(¶m0->unk_380); @@ -3502,8 +3500,8 @@ static int ov65_02231440 (UnkStruct_ov65_0222EBE0 * param0, int param1) param0->unk_3A8 = 19; Window_Clear(¶m0->unk_380, 0); Window_Remove(¶m0->unk_380); - sub_02001384(param0->unk_158, NULL, ¶m0->unk_3D6[param0->unk_3DC]); - sub_02013A3C(param0->unk_154); + ListMenu_Free(param0->unk_158, NULL, ¶m0->unk_3D6[param0->unk_3DC]); + StringList_Free(param0->unk_154); ov65_02232DFC(param0); return param1; } @@ -3512,7 +3510,7 @@ static int ov65_02231440 (UnkStruct_ov65_0222EBE0 * param0, int param1) return param1; } - v0 = sub_02001288(param0->unk_158); + v0 = ListMenu_ProcessInput(param0->unk_158); switch (v0) { case 0xffffffff: @@ -3549,8 +3547,8 @@ static int ov65_02231440 (UnkStruct_ov65_0222EBE0 * param0, int param1) Window_Clear(¶m0->unk_380, 0); Window_Remove(¶m0->unk_380); - sub_02001384(param0->unk_158, NULL, ¶m0->unk_3D6[param0->unk_3DC]); - sub_02013A3C(param0->unk_154); + ListMenu_Free(param0->unk_158, NULL, ¶m0->unk_3D6[param0->unk_3DC]); + StringList_Free(param0->unk_154); return param1; } @@ -3563,7 +3561,7 @@ static const struct { {0x29, (u32)0xfffffffe} }; -static const UnkStruct_ov84_02240FA8 Unk_ov65_02238A90 = { +static const ListMenuTemplate Unk_ov65_02238A90 = { NULL, ov65_0222FED8, NULL, @@ -3687,7 +3685,7 @@ static int ov65_022316F0 (UnkStruct_ov65_0222EBE0 * param0, int param1) if (v0 == NULL) { ov65_0223556C(¶m0->unk_3EC, v0); - sub_02001384(param0->unk_158, NULL, NULL); + ListMenu_Free(param0->unk_158, NULL, NULL); ov65_02232DC0(param0, v2 - 1); ov65_02232B58(param0, 16, 0); param0->unk_3A8 = 29; @@ -3711,7 +3709,7 @@ static int ov65_022316F0 (UnkStruct_ov65_0222EBE0 * param0, int param1) { int v5, v6; - UnkStruct_ov84_02240FA8 v7; + ListMenuTemplate v7; u16 v8, v9, v10; UnkStruct_0207E060 * v11; @@ -3725,38 +3723,38 @@ static int ov65_022316F0 (UnkStruct_ov65_0222EBE0 * param0, int param1) param0->unk_3E0 = v10; v10 += param0->unk_04->unk_00.unk_21; - param0->unk_154 = sub_02013A04(v6, 54); + param0->unk_154 = StringList_New(v6, 54); v5 = 0; for (v5 = 0; v5 < NELEMS(Unk_ov65_02238968); v5++) { if (v5 == 0) { if (ov65_0222DE68(v9) || (v9 == 0) || (v9 == 28) || (v9 >= 29)) { - v7.unk_12 -= 1; - v7.unk_10 -= 1; + v7.maxDisplay -= 1; + v7.count -= 1; v6 -= 1; } else if (v9 == 16) { if (v10 == 2) { - sub_02013A4C(param0->unk_154, param0->unk_168, 36, Unk_ov65_02238968[v5].unk_04); + StringList_AddFromMessageBank(param0->unk_154, param0->unk_168, 36, Unk_ov65_02238968[v5].unk_04); } else { - v7.unk_12 -= 1; - v7.unk_10 -= 1; + v7.maxDisplay -= 1; + v7.count -= 1; v6 -= 1; } } else { - sub_02013A4C(param0->unk_154, param0->unk_168, Unk_ov65_02238968[v5].unk_00, Unk_ov65_02238968[v5].unk_04); + StringList_AddFromMessageBank(param0->unk_154, param0->unk_168, Unk_ov65_02238968[v5].unk_00, Unk_ov65_02238968[v5].unk_04); } } else { - sub_02013A4C(param0->unk_154, param0->unk_168, Unk_ov65_02238968[v5].unk_00, Unk_ov65_02238968[v5].unk_04); + StringList_AddFromMessageBank(param0->unk_154, param0->unk_168, Unk_ov65_02238968[v5].unk_00, Unk_ov65_02238968[v5].unk_04); } } Window_Add(param0->unk_15C, ¶m0->unk_380, 2, 16, 11 + ((3 - v6) * 2), 15, v6 * 2, 13, ((((((512 - (18 + 12)) - 9) - 10) - (18 + 12 + 24)) - (27 * 4)) - (11 * 22))); Window_Show(¶m0->unk_380, 1, ((512 - (18 + 12)) - 9), 11); - v7.unk_00 = param0->unk_154; - v7.unk_0C = ¶m0->unk_380; + v7.choices = param0->unk_154; + v7.window = ¶m0->unk_380; - param0->unk_158 = sub_0200112C(&v7, 0, 0, 54); + param0->unk_158 = ListMenu_New(&v7, 0, 0, 54); Window_ScheduleCopyToVRAM(¶m0->unk_380); } @@ -3856,7 +3854,7 @@ static int ov65_02231A98 (UnkStruct_ov65_0222EBE0 * param0, int param1) UnkStruct_ov65_022354D8 * v7; UnkStruct_0207E060 * v8; - v0 = sub_02001288(param0->unk_158); + v0 = ListMenu_ProcessInput(param0->unk_158); v6 = ov65_02230140(param0); if (0 != v6) { @@ -3869,8 +3867,8 @@ static int ov65_02231A98 (UnkStruct_ov65_0222EBE0 * param0, int param1) if (sub_020383E8()) { Window_Clear(¶m0->unk_380, 0); Window_Remove(¶m0->unk_380); - sub_02001384(param0->unk_158, NULL, NULL); - sub_02013A3C(param0->unk_154); + ListMenu_Free(param0->unk_158, NULL, NULL); + StringList_Free(param0->unk_154); if (v7 != NULL) { ov65_0223556C(¶m0->unk_3EC, v7); @@ -3883,7 +3881,7 @@ static int ov65_02231A98 (UnkStruct_ov65_0222EBE0 * param0, int param1) switch (v0) { case 0xffffffff: if (v7 == NULL) { - sub_02001384(param0->unk_158, NULL, NULL); + ListMenu_Free(param0->unk_158, NULL, NULL); ov65_02232DC0(param0, v2 - 1); ov65_02232B58(param0, 16, 0); param0->unk_3A8 = 29; @@ -4033,8 +4031,8 @@ static int ov65_02231A98 (UnkStruct_ov65_0222EBE0 * param0, int param1) Window_Clear(¶m0->unk_380, 0); Window_Remove(¶m0->unk_380); - sub_02001384(param0->unk_158, NULL, NULL); - sub_02013A3C(param0->unk_154); + ListMenu_Free(param0->unk_158, NULL, NULL); + StringList_Free(param0->unk_154); if (v7 != NULL) { ov65_0223556C(¶m0->unk_3EC, v7); @@ -4445,7 +4443,7 @@ static int ov65_022325AC (UnkStruct_ov65_0222EBE0 * param0, int param1) static int ov65_022325C4 (UnkStruct_ov65_0222EBE0 * param0, int param1) { if (Text_IsPrinterActive(param0->unk_180) == 0) { - param0->unk_184 = sub_02002100(param0->unk_15C, &Unk_ov65_0223894C, ((512 - (18 + 12)) - 9), 11, 54); + param0->unk_184 = Menu_MakeYesNoChoice(param0->unk_15C, &Unk_ov65_0223894C, ((512 - (18 + 12)) - 9), 11, 54); param0->unk_3A8 = 58; } @@ -4455,7 +4453,7 @@ static int ov65_022325C4 (UnkStruct_ov65_0222EBE0 * param0, int param1) static int ov65_02232608 (UnkStruct_ov65_0222EBE0 * param0, int param1) { int v0; - int v1 = sub_02002114(param0->unk_184, 54); + int v1 = Menu_ProcessInputAndHandleExit(param0->unk_184, 54); if (Text_IsPrinterActive(param0->unk_180) != 0) { return param1; @@ -4463,7 +4461,7 @@ static int ov65_02232608 (UnkStruct_ov65_0222EBE0 * param0, int param1) if (0 != ov65_02230140(param0)) { if (v1 == 0xffffffff) { - sub_02002154(param0->unk_184, 54); + Menu_DestroyForExit(param0->unk_184, 54); } v1 = 0xfffffffe; @@ -4532,7 +4530,7 @@ static int ov65_02232734 (UnkStruct_ov65_0222EBE0 * param0, int param1) CommMan_SetErrorHandling(0, 1); if (Text_IsPrinterActive(param0->unk_180) == 0) { - param0->unk_184 = sub_02002100(param0->unk_15C, &Unk_ov65_0223894C, ((512 - (18 + 12)) - 9), 11, 54); + param0->unk_184 = Menu_MakeYesNoChoice(param0->unk_15C, &Unk_ov65_0223894C, ((512 - (18 + 12)) - 9), 11, 54); param0->unk_3A8 = 62; } @@ -4549,14 +4547,14 @@ static int ov65_0223278C (UnkStruct_ov65_0222EBE0 * param0, int param1) } if (sub_02038294() || sub_02038284() || (sub_020380E4() >= 3)) { - sub_02002154(param0->unk_184, 54); + Menu_DestroyForExit(param0->unk_184, 54); ov65_02232B58(param0, 101, 0); param0->unk_3A8 = 28; } else if (sub_020383E8()) { - sub_02002154(param0->unk_184, 54); + Menu_DestroyForExit(param0->unk_184, 54); ov65_0222F6EC(param0); } else { - v1 = sub_02002114(param0->unk_184, 54); + v1 = Menu_ProcessInputAndHandleExit(param0->unk_184, 54); if (v1 == 0xffffffff) { return param1; @@ -4612,7 +4610,7 @@ static int ov65_0223288C (UnkStruct_ov65_0222EBE0 * param0, int param1) } if (Text_IsPrinterActive(param0->unk_180) == 0) { - param0->unk_184 = sub_02002100(param0->unk_15C, &Unk_ov65_0223894C, ((512 - (18 + 12)) - 9), 11, 54); + param0->unk_184 = Menu_MakeYesNoChoice(param0->unk_15C, &Unk_ov65_0223894C, ((512 - (18 + 12)) - 9), 11, 54); param0->unk_3A8 = 64; } @@ -4633,7 +4631,7 @@ static int ov65_0223294C (UnkStruct_ov65_0222EBE0 * param0, int param1) v5 = ov65_0222E8D4(param0, v3); if (v5 == NULL) { - sub_02002154(param0->unk_184, 54); + Menu_DestroyForExit(param0->unk_184, 54); ov65_02232DC0(param0, v3 - 1); ov65_02232B58(param0, 16, 0); param0->unk_3A8 = 29; @@ -4644,7 +4642,7 @@ static int ov65_0223294C (UnkStruct_ov65_0222EBE0 * param0, int param1) v4 = v6->unk_21; if ((param0->unk_3DE != v2) || (param0->unk_3E0 != v4)) { - sub_02002154(param0->unk_184, 54); + Menu_DestroyForExit(param0->unk_184, 54); ov65_02232DC0(param0, v3 - 1); ov65_02232B58(param0, 16, 0); param0->unk_3A8 = 29; @@ -4654,16 +4652,16 @@ static int ov65_0223294C (UnkStruct_ov65_0222EBE0 * param0, int param1) } if (sub_020380E4() >= 3) { - sub_02002154(param0->unk_184, 54); + Menu_DestroyForExit(param0->unk_184, 54); ov65_02232B58(param0, 18, 0); sub_02038378(); param0->unk_3A8 = 29; return param1; } else if (sub_020383E8()) { - sub_02002154(param0->unk_184, 54); + Menu_DestroyForExit(param0->unk_184, 54); ov65_0222F6EC(param0); } else { - v1 = sub_02002114(param0->unk_184, 54); + v1 = Menu_ProcessInputAndHandleExit(param0->unk_184, 54); if (v1 == 0xffffffff) { return param1; diff --git a/src/overlay065/ov65_0223648C.c b/src/overlay065/ov65_0223648C.c index 5c871683a2..2229c18307 100644 --- a/src/overlay065/ov65_0223648C.c +++ b/src/overlay065/ov65_0223648C.c @@ -3,7 +3,6 @@ #include #include -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_defs/struct_0200C738.h" #include "struct_defs/struct_0207DE04.h" #include "struct_defs/struct_0207DFAC.h" @@ -36,6 +35,7 @@ #include "gx_layers.h" #include "heap.h" #include "journal.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "overlay_manager.h" @@ -45,7 +45,6 @@ #include "string_template.h" #include "text.h" #include "trainer_info.h" -#include "unk_02001AF4.h" #include "unk_020041CC.h" #include "unk_02005474.h" #include "unk_020093B4.h" @@ -115,7 +114,7 @@ typedef struct { Window unk_210; Window unk_220; Window unk_230; - UIControlData *unk_240; + Menu *unk_240; void *unk_244; NNSG2dScreenData *unk_248; void *unk_24C; @@ -781,7 +780,7 @@ static void ov65_02236B90(UnkStruct_ov65_02236840 *param0, u32 param1) Window_Remove(¶m0->unk_230); if (param0->unk_240 != NULL) { - sub_02002154(param0->unk_240, param1); + Menu_DestroyForExit(param0->unk_240, param1); } } @@ -1752,7 +1751,7 @@ static BOOL ov65_02237BC4(UnkStruct_ov65_022367A8 *param0, UnkStruct_0207DE04 *p return 0; } - param0->unk_30.unk_240 = sub_02002100(param0->unk_30.unk_00, &Unk_ov65_02239A24, (0 + (24 * 2)), 4, param2); + param0->unk_30.unk_240 = Menu_MakeYesNoChoice(param0->unk_30.unk_00, &Unk_ov65_02239A24, (0 + (24 * 2)), 4, param2); param0->unk_00.unk_05 = 5; return 0; @@ -1764,7 +1763,7 @@ static BOOL ov65_02237BF8(UnkStruct_ov65_022367A8 *param0, UnkStruct_0207DE04 *p UnkStruct_ov65_022366E4 v1; BOOL v2; - v0 = sub_02002114(param0->unk_30.unk_240, param2); + v0 = Menu_ProcessInputAndHandleExit(param0->unk_30.unk_240, param2); if (v0 != 0xffffffff) { v1.unk_00 = param0->unk_00.unk_06; @@ -1843,7 +1842,7 @@ static BOOL ov65_02237CE4(UnkStruct_ov65_022367A8 *param0, UnkStruct_0207DE04 *p return 0; } - param0->unk_30.unk_240 = sub_02002100(param0->unk_30.unk_00, &Unk_ov65_02239A24, (0 + (24 * 2)), 4, param2); + param0->unk_30.unk_240 = Menu_MakeYesNoChoice(param0->unk_30.unk_00, &Unk_ov65_02239A24, (0 + (24 * 2)), 4, param2); param0->unk_00.unk_05 = 10; return 0; @@ -1853,7 +1852,7 @@ static BOOL ov65_02237D18(UnkStruct_ov65_022367A8 *param0, UnkStruct_0207DE04 *p { int v0; - v0 = sub_02002114(param0->unk_30.unk_240, param2); + v0 = Menu_ProcessInputAndHandleExit(param0->unk_30.unk_240, param2); if (v0 != 0xffffffff) { if (v0 == 0) { @@ -2031,7 +2030,7 @@ static BOOL ov65_02237F08(UnkStruct_ov65_022367A8 *param0, UnkStruct_0207DE04 *p return 0; } - param0->unk_30.unk_240 = sub_02002054(param0->unk_30.unk_00, &Unk_ov65_02239A24, (0 + (24 * 2)), 4, 1, param2); + param0->unk_30.unk_240 = Menu_MakeYesNoChoiceWithCursorAt(param0->unk_30.unk_00, &Unk_ov65_02239A24, (0 + (24 * 2)), 4, 1, param2); param0->unk_00.unk_05 = 21; return 0; @@ -2041,7 +2040,7 @@ static BOOL ov65_02237F48(UnkStruct_ov65_022367A8 *param0, UnkStruct_0207DE04 *p { int v0; - v0 = sub_02002114(param0->unk_30.unk_240, param2); + v0 = Menu_ProcessInputAndHandleExit(param0->unk_30.unk_240, param2); if (v0 != 0xffffffff) { if (v0 == 0) { @@ -2082,7 +2081,7 @@ static BOOL ov65_02237FB8(UnkStruct_ov65_022367A8 *param0, UnkStruct_0207DE04 *p return 0; } - param0->unk_30.unk_240 = sub_02002054(param0->unk_30.unk_00, &Unk_ov65_02239A24, (0 + (24 * 2)), 4, 1, param2); + param0->unk_30.unk_240 = Menu_MakeYesNoChoiceWithCursorAt(param0->unk_30.unk_00, &Unk_ov65_02239A24, (0 + (24 * 2)), 4, 1, param2); param0->unk_00.unk_05 = 24; return 0; @@ -2092,7 +2091,7 @@ static BOOL ov65_02237FF8(UnkStruct_ov65_022367A8 *param0, UnkStruct_0207DE04 *p { int v0; - v0 = sub_02002114(param0->unk_30.unk_240, param2); + v0 = Menu_ProcessInputAndHandleExit(param0->unk_30.unk_240, param2); if (v0 != 0xffffffff) { if (v0 == 0) { @@ -2154,7 +2153,7 @@ static BOOL ov65_0223806C(UnkStruct_ov65_022367A8 *param0, UnkStruct_0207DE04 *p static BOOL ov65_022380AC(UnkStruct_ov65_022367A8 *param0, UnkStruct_0207DE04 *param1, u32 param2) { if (param0->unk_30.unk_240 != NULL) { - sub_02002154(param0->unk_30.unk_240, param2); + Menu_DestroyForExit(param0->unk_30.unk_240, param2); param0->unk_30.unk_240 = NULL; } @@ -2219,7 +2218,7 @@ static BOOL ov65_0223815C(UnkStruct_ov65_022367A8 *param0, UnkStruct_0207DE04 *p return 0; } - param0->unk_30.unk_240 = sub_02002100(param0->unk_30.unk_00, &Unk_ov65_02239A24, (0 + (24 * 2)), 4, param2); + param0->unk_30.unk_240 = Menu_MakeYesNoChoice(param0->unk_30.unk_00, &Unk_ov65_02239A24, (0 + (24 * 2)), 4, param2); param0->unk_00.unk_05 = 32; return 0; @@ -2229,7 +2228,7 @@ static BOOL ov65_02238190(UnkStruct_ov65_022367A8 *param0, UnkStruct_0207DE04 *p { int v0; - v0 = sub_02002114(param0->unk_30.unk_240, param2); + v0 = Menu_ProcessInputAndHandleExit(param0->unk_30.unk_240, param2); if (v0 != 0xffffffff) { if (v0 == 0) { @@ -2528,7 +2527,7 @@ static BOOL ov65_02238528(UnkStruct_ov65_022367A8 *param0, UnkStruct_0207DE04 *p static BOOL ov65_02238558(UnkStruct_ov65_022367A8 *param0, UnkStruct_0207DE04 *param1, u32 param2) { if (param0->unk_30.unk_240 != NULL) { - sub_02002154(param0->unk_30.unk_240, param2); + Menu_DestroyForExit(param0->unk_30.unk_240, param2); param0->unk_30.unk_240 = NULL; } @@ -2605,7 +2604,7 @@ static BOOL ov65_02238608(UnkStruct_ov65_022367A8 *param0, UnkStruct_0207DE04 *p return 0; } - param0->unk_30.unk_240 = sub_02002100(param0->unk_30.unk_00, &Unk_ov65_02239A24, (0 + (24 * 2)), 4, param2); + param0->unk_30.unk_240 = Menu_MakeYesNoChoice(param0->unk_30.unk_00, &Unk_ov65_02239A24, (0 + (24 * 2)), 4, param2); param0->unk_00.unk_05 = 20; return 0; @@ -2620,12 +2619,12 @@ static BOOL ov65_02238660(UnkStruct_ov65_022367A8 *param0, UnkStruct_0207DE04 *p if (ov65_02237A10(param0) == 1) { param0->unk_00.unk_05 = 10; ov65_02236F38(¶m0->unk_30); - sub_02002154(param0->unk_30.unk_240, param2); + Menu_DestroyForExit(param0->unk_30.unk_240, param2); param0->unk_30.unk_240 = NULL; return 0; } - v0 = sub_02002114(param0->unk_30.unk_240, param2); + v0 = Menu_ProcessInputAndHandleExit(param0->unk_30.unk_240, param2); if (v0 != 0xffffffff) { if (v0 == 0) { @@ -2667,7 +2666,7 @@ static BOOL ov65_02238728(UnkStruct_ov65_022367A8 *param0, UnkStruct_0207DE04 *p return 0; } - param0->unk_30.unk_240 = sub_02002100(param0->unk_30.unk_00, &Unk_ov65_02239A24, (0 + (24 * 2)), 4, param2); + param0->unk_30.unk_240 = Menu_MakeYesNoChoice(param0->unk_30.unk_00, &Unk_ov65_02239A24, (0 + (24 * 2)), 4, param2); param0->unk_00.unk_05 = 23; return 0; @@ -2677,7 +2676,7 @@ static BOOL ov65_0223875C(UnkStruct_ov65_022367A8 *param0, UnkStruct_0207DE04 *p { int v0; - v0 = sub_02002114(param0->unk_30.unk_240, param2); + v0 = Menu_ProcessInputAndHandleExit(param0->unk_30.unk_240, param2); if (v0 != 0xffffffff) { if (v0 == 0) { diff --git a/src/overlay067/ov67_0225C700.c b/src/overlay067/ov67_0225C700.c index 26881b9378..e3e9e603e5 100644 --- a/src/overlay067/ov67_0225C700.c +++ b/src/overlay067/ov67_0225C700.c @@ -5,7 +5,6 @@ #include "consts/game_records.h" -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_defs/struct_02099F80.h" #include "overlay061/struct_ov61_0222C3B0.h" @@ -26,6 +25,7 @@ #include "gx_layers.h" #include "heap.h" #include "inlines.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "overlay_manager.h" @@ -35,7 +35,6 @@ #include "strbuf.h" #include "string_template.h" #include "text.h" -#include "unk_02001AF4.h" #include "unk_020041CC.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" @@ -64,7 +63,7 @@ typedef struct { UnkStruct_ov67_0225D210 unk_40; UnkStruct_ov67_0225D210 unk_70; UnkStruct_ov67_0225D210 unk_A0; - UIControlData *unk_D0; + Menu *unk_D0; UnkStruct_ov61_0222C3B0 unk_D4; } UnkStruct_ov67_0225D154; @@ -214,7 +213,7 @@ int ov67_0225C820(OverlayManager *param0, int *param1) case 2: if (v1->unk_08 == 0) { ov67_0225D210(&v0->unk_70, 17); - v0->unk_D0 = sub_02002100(v0->unk_0C, &Unk_ov67_0225D3EC, (1 + (18 + 12)), 14, 112); + v0->unk_D0 = Menu_MakeYesNoChoice(v0->unk_0C, &Unk_ov67_0225D3EC, (1 + (18 + 12)), 14, 112); (*param1)++; } else { (*param1) = 4; @@ -222,7 +221,7 @@ int ov67_0225C820(OverlayManager *param0, int *param1) break; case 3: { u32 v2; - v2 = sub_02002114(v0->unk_D0, 112); + v2 = Menu_ProcessInputAndHandleExit(v0->unk_D0, 112); switch (v2) { case 0: @@ -325,12 +324,12 @@ int ov67_0225C820(OverlayManager *param0, int *param1) case 11: ov67_0225D294(&v0->unk_A0); ov67_0225D210(&v0->unk_40, 88); - v0->unk_D0 = sub_02002100(v0->unk_0C, &Unk_ov67_0225D3EC, (1 + (18 + 12)), 14, 112); + v0->unk_D0 = Menu_MakeYesNoChoice(v0->unk_0C, &Unk_ov67_0225D3EC, (1 + (18 + 12)), 14, 112); (*param1)++; break; case 12: { u32 v11; - v11 = sub_02002114(v0->unk_D0, 112); + v11 = Menu_ProcessInputAndHandleExit(v0->unk_D0, 112); switch (v11) { case 0: diff --git a/src/overlay068/ov68_0225C700.c b/src/overlay068/ov68_0225C700.c index f688c9d375..835c58302f 100644 --- a/src/overlay068/ov68_0225C700.c +++ b/src/overlay068/ov68_0225C700.c @@ -5,7 +5,6 @@ #include #include -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_02030EC4_decl.h" #include "struct_defs/struct_0200C738.h" #include "struct_defs/struct_02099F80.h" @@ -28,6 +27,7 @@ #include "graphics.h" #include "gx_layers.h" #include "heap.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "overlay_manager.h" @@ -38,7 +38,6 @@ #include "string_template.h" #include "text.h" #include "trainer_info.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_020093B4.h" #include "unk_0200A328.h" @@ -97,7 +96,7 @@ typedef struct { Window unk_08; Strbuf *unk_18; void *unk_1C; - UIControlData *unk_20; + Menu *unk_20; } UnkStruct_ov68_0225D128; typedef struct { @@ -991,14 +990,14 @@ static void ov68_0225D2CC(UnkStruct_ov68_0225D128 *param0) static void ov68_0225D304(UnkStruct_ov68_0225D128 *param0, UnkStruct_ov68_0225C91C *param1, u32 param2) { GF_ASSERT(param0->unk_20 == NULL); - param0->unk_20 = sub_02002100(param1->unk_00, &Unk_ov68_0225DD38, (1 + (18 + 12)), 6, param2); + param0->unk_20 = Menu_MakeYesNoChoice(param1->unk_00, &Unk_ov68_0225DD38, (1 + (18 + 12)), 6, param2); } static u32 ov68_0225D330(UnkStruct_ov68_0225D128 *param0, u32 param1) { u32 v0; - v0 = sub_02002114(param0->unk_20, param1); + v0 = Menu_ProcessInputAndHandleExit(param0->unk_20, param1); if (v0 != 0xffffffff) { param0->unk_20 = NULL; @@ -1010,7 +1009,7 @@ static u32 ov68_0225D330(UnkStruct_ov68_0225D128 *param0, u32 param1) static void ov68_0225D348(UnkStruct_ov68_0225D128 *param0, u32 param1) { if (param0->unk_20 != NULL) { - sub_02002154(param0->unk_20, param1); + Menu_DestroyForExit(param0->unk_20, param1); param0->unk_20 = NULL; } } diff --git a/src/overlay070/ov70_0225D9A4.c b/src/overlay070/ov70_0225D9A4.c index e6ec6e3942..05a1788e7f 100644 --- a/src/overlay070/ov70_0225D9A4.c +++ b/src/overlay070/ov70_0225D9A4.c @@ -4,11 +4,8 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_02023FCC_decl.h" #include "struct_defs/struct_0200C738.h" -#include "struct_defs/struct_02013A04_t.h" #include "struct_defs/struct_0207C690.h" #include "struct_defs/struct_02099F80.h" @@ -38,7 +35,6 @@ #include "overlay070/struct_ov70_02263910.h" #include "overlay070/struct_ov70_02269204_decl.h" #include "overlay070/struct_ov70_0226C6F8_decl.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "bg_window.h" #include "cell_actor.h" @@ -50,6 +46,7 @@ #include "graphics.h" #include "gx_layers.h" #include "heap.h" +#include "list_menu.h" #include "message.h" #include "narc.h" #include "overlay_manager.h" @@ -59,20 +56,19 @@ #include "savedata.h" #include "sprite_resource.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "sys_task.h" #include "sys_task_manager.h" #include "text.h" #include "touch_screen.h" #include "trainer_info.h" -#include "unk_0200112C.h" #include "unk_02005474.h" #include "unk_020093B4.h" #include "unk_0200A328.h" #include "unk_0200A784.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" -#include "unk_02013A04.h" #include "unk_02017728.h" #include "unk_0201DBEC.h" #include "unk_0201E86C.h" @@ -117,10 +113,10 @@ typedef struct { } UnkStruct_ov70_0225E9C8; typedef struct { - UnkStruct_ov84_02240FA8 unk_00; + ListMenuTemplate unk_00; Window unk_20; - BmpList *unk_30; - ResourceMetadata *unk_34; + ListMenu *unk_30; + StringList *unk_34; u16 unk_38; u16 unk_3A; BOOL unk_3C; @@ -129,8 +125,8 @@ typedef struct { } UnkStruct_ov70_0225EC20; typedef struct { - ResourceMetadata *unk_00; - UnkStruct_ov84_02240FA8 unk_04; + StringList *unk_00; + ListMenuTemplate unk_04; } UnkStruct_ov70_0225F098; typedef struct { @@ -259,12 +255,12 @@ static void ov70_0225ED4C(UnkStruct_ov70_0225EC20 *param0, UnkStruct_ov70_0225E4 static void ov70_0225EDA8(UnkStruct_ov70_0225EC20 *param0, u32 param1, u32 param2, u32 param3); static void ov70_0225EDE0(UnkStruct_ov70_0225EC20 *param0); static void ov70_0225EDF8(UnkStruct_ov70_0225EC20 *param0, const Strbuf *param1, u32 param2); -static const ResourceMetadata *ov70_0225EE04(const UnkStruct_ov70_0225EC20 *param0); +static const StringList *ov70_0225EE04(const UnkStruct_ov70_0225EC20 *param0); static BOOL ov70_0225EE08(const UnkStruct_ov70_0225EC20 *param0, u32 param1); -static void ov70_0225EE30(UnkStruct_ov70_0225EC20 *param0, const UnkStruct_ov84_02240FA8 *param1, UnkStruct_ov70_0225E4EC *param2, u16 param3, u16 param4, u32 param5, u8 param6, u8 param7, u8 param8); +static void ov70_0225EE30(UnkStruct_ov70_0225EC20 *param0, const ListMenuTemplate *param1, UnkStruct_ov70_0225E4EC *param2, u16 param3, u16 param4, u32 param5, u8 param6, u8 param7, u8 param8); static u32 ov70_0225EED8(UnkStruct_ov70_0225EC20 *param0); static void ov70_0225EF14(UnkStruct_ov70_0225EC20 *param0, u16 *param1, u16 *param2); -static void ov70_0225EF58(BmpList *param0, u32 param1, u8 param2); +static void ov70_0225EF58(ListMenu *param0, u32 param1, u8 param2); static void ov70_0225EF6C(UnkStruct_ov70_0225EC20 *param0, BOOL param1); static void ov70_0225EF70(UnkStruct_ov70_0225EC20 *param0); static void ov70_0225EFD4(UnkStruct_ov70_0225EFD4 *param0, UnkStruct_ov70_0225E4EC *param1, u32 param2); @@ -566,7 +562,7 @@ static const UnkStruct_ov22_022559F8 Unk_ov70_0226D5DC = { 0x70, }; -static const UnkStruct_ov84_02240FA8 Unk_ov70_0226D644 = { +static const ListMenuTemplate Unk_ov70_0226D644 = { NULL, NULL, NULL, @@ -976,7 +972,7 @@ void ov70_0225E044(UnkStruct_ov70_0225DEE8 *param0, const Strbuf *param1, u32 pa ov70_0225EDF8(¶m0->unk_39C, param1, param2); } -const ResourceMetadata *ov70_0225E054(const UnkStruct_ov70_0225DEE8 *param0) +const StringList *ov70_0225E054(const UnkStruct_ov70_0225DEE8 *param0) { return ov70_0225EE04(¶m0->unk_39C); } @@ -986,12 +982,12 @@ BOOL ov70_0225E064(const UnkStruct_ov70_0225DEE8 *param0, u32 param1) return ov70_0225EE08(¶m0->unk_39C, param1); } -void ov70_0225E074(UnkStruct_ov70_0225DEE8 *param0, const UnkStruct_ov84_02240FA8 *param1, u16 param2, u16 param3) +void ov70_0225E074(UnkStruct_ov70_0225DEE8 *param0, const ListMenuTemplate *param1, u16 param2, u16 param3) { ov70_0225EE30(¶m0->unk_39C, param1, ¶m0->unk_3C, param2, param3, 112, 16, 3, 15); } -extern void ov70_0225E0A4(UnkStruct_ov70_0225DEE8 *param0, const UnkStruct_ov84_02240FA8 *param1, u16 param2, u16 param3, u8 param4, u8 param5, u8 param6) +extern void ov70_0225E0A4(UnkStruct_ov70_0225DEE8 *param0, const ListMenuTemplate *param1, u16 param2, u16 param3, u8 param4, u8 param5, u8 param6) { ov70_0225EE30(¶m0->unk_39C, param1, ¶m0->unk_3C, param2, param3, 112, param4, param5, param6); } @@ -1712,18 +1708,18 @@ static void ov70_0225EDA8(UnkStruct_ov70_0225EC20 *param0, u32 param1, u32 param { int v0; GF_ASSERT(param0->unk_34 == NULL); - param0->unk_34 = sub_02013A04(param1, param2); + param0->unk_34 = StringList_New(param1, param2); param0->unk_38 = param1; for (v0 = 0; v0 < param1; v0++) { - param0->unk_34[v0].unk_04 = param3; + param0->unk_34[v0].index = param3; } } static void ov70_0225EDE0(UnkStruct_ov70_0225EC20 *param0) { if (param0->unk_34 != NULL) { - sub_02013A3C(param0->unk_34); + StringList_Free(param0->unk_34); param0->unk_34 = NULL; param0->unk_38 = 0; } @@ -1731,10 +1727,10 @@ static void ov70_0225EDE0(UnkStruct_ov70_0225EC20 *param0) static void ov70_0225EDF8(UnkStruct_ov70_0225EC20 *param0, const Strbuf *param1, u32 param2) { - sub_02013A6C(param0->unk_34, param1, param2); + StringList_AddFromStrbuf(param0->unk_34, param1, param2); } -static const ResourceMetadata *ov70_0225EE04(const UnkStruct_ov70_0225EC20 *param0) +static const StringList *ov70_0225EE04(const UnkStruct_ov70_0225EC20 *param0) { return param0->unk_34; } @@ -1744,7 +1740,7 @@ static BOOL ov70_0225EE08(const UnkStruct_ov70_0225EC20 *param0, u32 param1) int v0; for (v0 = 0; v0 < param0->unk_38; v0++) { - if (param0->unk_34[v0].unk_04 == param1) { + if (param0->unk_34[v0].index == param1) { return 1; } } @@ -1752,21 +1748,21 @@ static BOOL ov70_0225EE08(const UnkStruct_ov70_0225EC20 *param0, u32 param1) return 0; } -static void ov70_0225EE30(UnkStruct_ov70_0225EC20 *param0, const UnkStruct_ov84_02240FA8 *param1, UnkStruct_ov70_0225E4EC *param2, u16 param3, u16 param4, u32 param5, u8 param6, u8 param7, u8 param8) +static void ov70_0225EE30(UnkStruct_ov70_0225EC20 *param0, const ListMenuTemplate *param1, UnkStruct_ov70_0225E4EC *param2, u16 param3, u16 param4, u32 param5, u8 param6, u8 param7, u8 param8) { GF_ASSERT(param0->unk_30 == NULL); - GF_ASSERT((param1->unk_12 * 2) < 18); + GF_ASSERT((param1->maxDisplay * 2) < 18); param0->unk_00 = *param1; - param0->unk_00.unk_0C = ¶m0->unk_20; - param0->unk_3A = param1->unk_10; - param0->unk_00.unk_04 = ov70_0225EF58; + param0->unk_00.window = ¶m0->unk_20; + param0->unk_3A = param1->count; + param0->unk_00.cursorCallback = ov70_0225EF58; - Window_Add(param2->unk_00, ¶m0->unk_20, Unk_ov70_0226D5CC[0], param6, param7, param8, param1->unk_12 * 2, 5, ((((1 + (18 + 12)) + ((18 + 12) + 24)) + 9) + (27 * 4))); + Window_Add(param2->unk_00, ¶m0->unk_20, Unk_ov70_0226D5CC[0], param6, param7, param8, param1->maxDisplay * 2, 5, ((((1 + (18 + 12)) + ((18 + 12) + 24)) + 9) + (27 * 4))); Window_FillTilemap(¶m0->unk_20, 15); Window_Show(¶m0->unk_20, 1, ((1 + (18 + 12)) + ((18 + 12) + 24)), 3); - param0->unk_30 = sub_0200112C(¶m0->unk_00, param3, param4, param5); + param0->unk_30 = ListMenu_New(¶m0->unk_00, param3, param4, param5); Window_ScheduleCopyToVRAM(¶m0->unk_20); } @@ -1779,7 +1775,7 @@ static u32 ov70_0225EED8(UnkStruct_ov70_0225EC20 *param0) return 0xfffffffe; } - v0 = sub_02001288(param0->unk_30); + v0 = ListMenu_ProcessInput(param0->unk_30); switch (v0) { case 0xffffffff: @@ -1802,7 +1798,7 @@ static void ov70_0225EF14(UnkStruct_ov70_0225EC20 *param0, u16 *param1, u16 *par return; } - sub_02001384(param0->unk_30, param1, param2); + ListMenu_Free(param0->unk_30, param1, param2); param0->unk_30 = NULL; @@ -1817,7 +1813,7 @@ static void ov70_0225EF14(UnkStruct_ov70_0225EC20 *param0, u16 *param1, u16 *par } } -static void ov70_0225EF58(BmpList *param0, u32 param1, u8 param2) +static void ov70_0225EF58(ListMenu *param0, u32 param1, u8 param2) { if (param2 == 0) { Sound_PlayEffect(1500); @@ -1839,7 +1835,7 @@ static void ov70_0225EF70(UnkStruct_ov70_0225EC20 *param0) return; } - sub_020014DC(param0->unk_30, &v0, NULL); + ListMenu_GetListAndCursorPos(param0->unk_30, &v0, NULL); if (v0 <= 0) { CellActor_SetDrawFlag(param0->unk_50[0], 0); @@ -1897,22 +1893,22 @@ static void ov70_0225F098(UnkStruct_ov70_0225F098 *param0, UnkStruct_ov70_0225F2 Strbuf *v0; GF_ASSERT(param0->unk_00 == NULL); - param0->unk_00 = sub_02013A04(2, param2); + param0->unk_00 = StringList_New(2, param2); v0 = ov70_0225F288(param1, 1, 67); - sub_02013A6C(param0->unk_00, v0, 0); + StringList_AddFromStrbuf(param0->unk_00, v0, 0); v0 = ov70_0225F288(param1, 1, 66); - sub_02013A6C(param0->unk_00, v0, 1); + StringList_AddFromStrbuf(param0->unk_00, v0, 1); param0->unk_04 = Unk_ov70_0226D644; - param0->unk_04.unk_10 = 2; - param0->unk_04.unk_00 = param0->unk_00; + param0->unk_04.count = 2; + param0->unk_04.choices = param0->unk_00; } static void ov70_0225F100(UnkStruct_ov70_0225F098 *param0) { if (param0->unk_00 != NULL) { - sub_02013A3C(param0->unk_00); + StringList_Free(param0->unk_00); param0->unk_00 = NULL; } } diff --git a/src/overlay070/ov70_022630A4.c b/src/overlay070/ov70_022630A4.c index 13a9e359a4..fdfc87a039 100644 --- a/src/overlay070/ov70_022630A4.c +++ b/src/overlay070/ov70_022630A4.c @@ -32,10 +32,10 @@ #include "overlay070/struct_ov70_02263910.h" #include "overlay070/struct_ov70_02265F38.h" #include "overlay070/struct_ov70_0226DA18.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "core_sys.h" #include "enums.h" +#include "list_menu.h" #include "strbuf.h" #include "unk_02005474.h" #include "unk_0201D15C.h" @@ -52,7 +52,7 @@ typedef struct { u16 unk_00; u16 unk_02; s32 unk_04; - UnkStruct_ov84_02240FA8 unk_08; + ListMenuTemplate unk_08; u16 unk_28; u16 unk_2A; } UnkStruct_ov70_022653DC; @@ -160,7 +160,7 @@ static BOOL ov70_02265A84(UnkStruct_ov70_02263344 *param0, UnkStruct_ov70_0225DE static BOOL ov70_02265CCC(UnkStruct_ov70_02265CCC *param0, UnkStruct_ov66_0222DFF8 *param1, UnkStruct_ov70_0225DEE8 *param2, UnkStruct_ov70_0225CC54 *param3, u8 param4, int param5); static BOOL ov70_02265ED0(const UnkStruct_ov70_0225C894 *param0, const UnkStruct_ov70_0225CA20 *param1, const u32 *param2, u32 param3, UnkStruct_ov63_0222CC3C *param4); -static const UnkStruct_ov84_02240FA8 Unk_ov70_0226DA98 = { +static const ListMenuTemplate Unk_ov70_0226DA98 = { NULL, NULL, NULL, @@ -2698,7 +2698,7 @@ static void ov70_022653DC(UnkStruct_ov70_022653DC *param0, UnkStruct_ov70_0225DE ov70_0225E044(param1, v1, 0); param0->unk_08 = Unk_ov70_0226DA98; - param0->unk_08.unk_00 = ov70_0225E054(param1); + param0->unk_08.choices = ov70_0225E054(param1); } static void ov70_02265450(UnkStruct_ov70_022653DC *param0, UnkStruct_ov70_0225DEE8 *param1) diff --git a/src/overlay070/ov70_02265F38.c b/src/overlay070/ov70_02265F38.c index 1a30fbb1d4..3f857acb99 100644 --- a/src/overlay070/ov70_02265F38.c +++ b/src/overlay070/ov70_02265F38.c @@ -16,12 +16,12 @@ #include "overlay070/struct_ov70_0225DEE8_decl.h" #include "overlay070/struct_ov70_02263344_decl.h" #include "overlay070/struct_ov70_02265F38.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "communication_information.h" #include "communication_system.h" #include "core_sys.h" #include "enums.h" +#include "list_menu.h" #include "strbuf.h" #include "unk_02005474.h" #include "unk_020363E8.h" @@ -49,7 +49,7 @@ typedef struct { s32 unk_0C; s32 unk_10; BOOL unk_14; - UnkStruct_ov84_02240FA8 unk_18; + ListMenuTemplate unk_18; u32 unk_38; UnkStruct_ov70_02266C68 unk_3C; } UnkStruct_ov70_02266AF0; @@ -70,7 +70,7 @@ static void ov70_02266CFC(UnkStruct_ov70_02266C68 *param0, UnkStruct_ov70_0225DE static void ov70_02266CF0(UnkStruct_ov70_02266C68 *param0, UnkStruct_ov70_0225DEE8 *param1, BOOL param2); static void ov70_02266D08(UnkStruct_ov70_02266C68 *param0, UnkStruct_ov70_0225DEE8 *param1, BOOL param2, BOOL param3); -static const UnkStruct_ov84_02240FA8 Unk_ov70_0226DC94 = { +static const ListMenuTemplate Unk_ov70_0226DC94 = { NULL, NULL, NULL, @@ -865,13 +865,13 @@ static void ov70_02266B30(UnkStruct_ov70_02266AF0 *param0, UnkStruct_ov70_0225DE } param0->unk_18 = Unk_ov70_0226DC94; - param0->unk_18.unk_10 = param0->unk_38; + param0->unk_18.count = param0->unk_38; - if (param0->unk_18.unk_12 > param0->unk_38) { - param0->unk_18.unk_12 = param0->unk_38; + if (param0->unk_18.maxDisplay > param0->unk_38) { + param0->unk_18.maxDisplay = param0->unk_38; } - param0->unk_18.unk_00 = ov70_0225E054(param1); + param0->unk_18.choices = ov70_0225E054(param1); } static void ov70_02266BA0(UnkStruct_ov70_02266AF0 *param0, UnkStruct_ov70_0225DEE8 *param1) diff --git a/src/overlay070/ov70_02266E9C.c b/src/overlay070/ov70_02266E9C.c index c955218fdc..b9a9f32cc1 100644 --- a/src/overlay070/ov70_02266E9C.c +++ b/src/overlay070/ov70_02266E9C.c @@ -17,15 +17,15 @@ #include "overlay070/struct_ov70_0225DEE8_decl.h" #include "overlay070/struct_ov70_022630A4_decl.h" #include "overlay070/struct_ov70_02263344_decl.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "enums.h" +#include "list_menu.h" #include "strbuf.h" #include "unk_02005474.h" #include "unk_0201D15C.h" typedef struct { - UnkStruct_ov84_02240FA8 unk_00; + ListMenuTemplate unk_00; u32 unk_20; } UnkStruct_ov70_02268E44; @@ -100,7 +100,7 @@ static void ov70_02269144(UnkStruct_ov70_02269114 *param0, UnkStruct_ov66_0222DF static BOOL ov70_02269178(const UnkStruct_ov70_02269114 *param0); static u16 ov70_02269188(const UnkStruct_ov70_02269114 *param0); -static const UnkStruct_ov84_02240FA8 Unk_ov70_0226DCBC = { +static const ListMenuTemplate Unk_ov70_0226DCBC = { NULL, NULL, NULL, @@ -2279,13 +2279,13 @@ static void ov70_02268E44(UnkStruct_ov70_02268E44 *param0, UnkStruct_ov70_0225DE } param0->unk_00 = Unk_ov70_0226DCBC; - param0->unk_00.unk_10 = param0->unk_20; + param0->unk_00.count = param0->unk_20; - if (param0->unk_00.unk_12 > param0->unk_20) { - param0->unk_00.unk_12 = param0->unk_20; + if (param0->unk_00.maxDisplay > param0->unk_20) { + param0->unk_00.maxDisplay = param0->unk_20; } - param0->unk_00.unk_00 = ov70_0225E054(param1); + param0->unk_00.choices = ov70_0225E054(param1); } static void ov70_02268EEC(UnkStruct_ov70_02268E44 *param0, UnkStruct_ov70_0225DEE8 *param1, u32 param2, u32 param3, u32 param4, u32 param5) @@ -2322,13 +2322,13 @@ static void ov70_02268EEC(UnkStruct_ov70_02268E44 *param0, UnkStruct_ov70_0225DE } param0->unk_00 = Unk_ov70_0226DCBC; - param0->unk_00.unk_10 = param0->unk_20; + param0->unk_00.count = param0->unk_20; - if (param0->unk_00.unk_12 > param0->unk_20) { - param0->unk_00.unk_12 = param0->unk_20; + if (param0->unk_00.maxDisplay > param0->unk_20) { + param0->unk_00.maxDisplay = param0->unk_20; } - param0->unk_00.unk_00 = ov70_0225E054(param1); + param0->unk_00.choices = ov70_0225E054(param1); } static void ov70_02268FB8(UnkStruct_ov70_02268E44 *param0, UnkStruct_ov70_0225DEE8 *param1) @@ -2355,9 +2355,9 @@ static void ov70_02268FB8(UnkStruct_ov70_02268E44 *param0, UnkStruct_ov70_0225DE } param0->unk_00 = Unk_ov70_0226DCBC; - param0->unk_00.unk_10 = param0->unk_20; - param0->unk_00.unk_12 = param0->unk_20; - param0->unk_00.unk_00 = ov70_0225E054(param1); + param0->unk_00.count = param0->unk_20; + param0->unk_00.maxDisplay = param0->unk_20; + param0->unk_00.choices = ov70_0225E054(param1); } static void ov70_02269018(UnkStruct_ov70_02268E44 *param0, UnkStruct_ov70_0225DEE8 *param1) @@ -2379,9 +2379,9 @@ static void ov70_02269018(UnkStruct_ov70_02268E44 *param0, UnkStruct_ov70_0225DE ov70_0225E044(param1, v1, 4 - 1); param0->unk_00 = Unk_ov70_0226DCBC; - param0->unk_00.unk_10 = param0->unk_20; - param0->unk_00.unk_12 = param0->unk_20; - param0->unk_00.unk_00 = ov70_0225E054(param1); + param0->unk_00.count = param0->unk_20; + param0->unk_00.maxDisplay = param0->unk_20; + param0->unk_00.choices = ov70_0225E054(param1); } static void ov70_02269090(UnkStruct_ov70_02268E44 *param0, UnkStruct_ov70_0225DEE8 *param1) @@ -2403,9 +2403,9 @@ static void ov70_02269090(UnkStruct_ov70_02268E44 *param0, UnkStruct_ov70_0225DE ov70_0225E044(param1, v1, 4 - 1); param0->unk_00 = Unk_ov70_0226DCBC; - param0->unk_00.unk_10 = param0->unk_20; - param0->unk_00.unk_12 = param0->unk_20; - param0->unk_00.unk_00 = ov70_0225E054(param1); + param0->unk_00.count = param0->unk_20; + param0->unk_00.maxDisplay = param0->unk_20; + param0->unk_00.choices = ov70_0225E054(param1); } static void ov70_02269108(UnkStruct_ov70_02268E44 *param0, UnkStruct_ov70_0225DEE8 *param1) diff --git a/src/overlay073/ov73_021D0D80.c b/src/overlay073/ov73_021D0D80.c index 047f20876b..2630407dd5 100644 --- a/src/overlay073/ov73_021D0D80.c +++ b/src/overlay073/ov73_021D0D80.c @@ -1,18 +1,14 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_02015920_decl.h" #include "struct_defs/archived_sprite.h" -#include "struct_defs/struct_02013A04_t.h" #include "struct_defs/struct_02015958.h" #include "struct_defs/struct_0203CC84.h" #include "struct_defs/struct_0208737C.h" #include "struct_defs/struct_02099F80.h" #include "overlay057/const_ov57_021D0F80.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "bg_window.h" #include "core_sys.h" @@ -21,6 +17,7 @@ #include "graphics.h" #include "gx_layers.h" #include "heap.h" +#include "list_menu.h" #include "message.h" #include "overlay_manager.h" #include "palette.h" @@ -30,19 +27,18 @@ #include "savedata.h" #include "savedata_misc.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "sys_task_manager.h" #include "text.h" #include "trainer_info.h" #include "unk_02000C88.h" -#include "unk_0200112C.h" #include "unk_020041CC.h" #include "unk_02005474.h" #include "unk_0200A9DC.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" #include "unk_020131EC.h" -#include "unk_02013A04.h" #include "unk_0201567C.h" #include "unk_02015920.h" #include "unk_02017728.h" @@ -63,8 +59,8 @@ typedef struct { Window unk_1C; int unk_2C; Window unk_30; - BmpList *unk_40; - ResourceMetadata *unk_44; + ListMenu *unk_40; + StringList *unk_44; int unk_48; MessageLoader *unk_4C; int unk_50; @@ -646,7 +642,7 @@ const WindowTemplate Unk_ov72_021D37D4 = { 0x12D }; -static const UnkStruct_ov84_02240FA8 Unk_ov72_021D390C = { +static const ListMenuTemplate Unk_ov72_021D390C = { NULL, NULL, NULL, @@ -738,7 +734,7 @@ static BOOL ov73_021D1510(UnkStruct_ov73_021D1058 *param0, u32 param1, int param return v0; } -static void ov73_021D1634(BmpList *param0, u32 param1, u8 param2) +static void ov73_021D1634(ListMenu *param0, u32 param1, u8 param2) { if (param2 == 0) { Sound_PlayEffect(1500); @@ -748,7 +744,7 @@ static void ov73_021D1634(BmpList *param0, u32 param1, u8 param2) static BOOL ov73_021D1648(UnkStruct_ov73_021D1058 *param0, int param1, int param2) { BOOL v0 = 0; - UnkStruct_ov84_02240FA8 v1; + ListMenuTemplate v1; const WindowTemplate *v2; const UnkStruct_ov72_021D3840 *v3; int v4, v5; @@ -782,28 +778,28 @@ static BOOL ov73_021D1648(UnkStruct_ov73_021D1058 *param0, int param1, int param Window_AddFromTemplate(param0->unk_18, ¶m0->unk_30, v2); - param0->unk_44 = sub_02013A04(v5, param0->unk_00); + param0->unk_44 = StringList_New(v5, param0->unk_00); for (v4 = 0; v4 < v5; v4++) { - sub_02013A4C(param0->unk_44, param0->unk_4C, v3[v4].unk_00, v3[v4].unk_04); + StringList_AddFromMessageBank(param0->unk_44, param0->unk_4C, v3[v4].unk_00, v3[v4].unk_04); } v1 = Unk_ov72_021D390C; - v1.unk_00 = param0->unk_44; - v1.unk_10 = v5; - v1.unk_12 = v5; - v1.unk_04 = ov73_021D1634; - v1.unk_0C = ¶m0->unk_30; + v1.choices = param0->unk_44; + v1.count = v5; + v1.maxDisplay = v5; + v1.cursorCallback = ov73_021D1634; + v1.window = ¶m0->unk_30; - param0->unk_40 = sub_0200112C(&v1, 0, 0, param0->unk_00); + param0->unk_40 = ListMenu_New(&v1, 0, 0, param0->unk_00); - Window_Show(v1.unk_0C, 1, ((0x400 - (18 + 12)) - 9), 3); + Window_Show(v1.window, 1, ((0x400 - (18 + 12)) - 9), 3); Window_CopyToVRAM(¶m0->unk_30); param0->unk_2C = 1; break; case 1: - param0->unk_48 = sub_02001288(param0->unk_40); + param0->unk_48 = ListMenu_ProcessInput(param0->unk_40); if (param0->unk_48 == 0xffffffff) { break; @@ -815,8 +811,8 @@ static BOOL ov73_021D1648(UnkStruct_ov73_021D1058 *param0, int param1, int param Window_Clear(¶m0->unk_30, 0); Window_Remove(¶m0->unk_30); - sub_02001384(param0->unk_40, NULL, NULL); - sub_02013A3C(param0->unk_44); + ListMenu_Free(param0->unk_40, NULL, NULL); + StringList_Free(param0->unk_44); Sound_PlayEffect(1500); param0->unk_2C = 0; diff --git a/src/overlay074/ov74_021D0D80.c b/src/overlay074/ov74_021D0D80.c index 403a5f2da8..1658b42e4e 100644 --- a/src/overlay074/ov74_021D0D80.c +++ b/src/overlay074/ov74_021D0D80.c @@ -3,7 +3,6 @@ #include #include -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_0200C6E4_decl.h" #include "struct_decls/struct_0200C704_decl.h" #include "struct_defs/struct_0200D0F4.h" @@ -16,13 +15,13 @@ #include "game_options.h" #include "gx_layers.h" #include "heap.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "overlay_manager.h" #include "render_text.h" #include "strbuf.h" #include "text.h" -#include "unk_02001AF4.h" #include "unk_020041CC.h" #include "unk_02005474.h" #include "unk_0200C6E4.h" @@ -58,7 +57,7 @@ typedef struct UnkStruct_ov74_021D0D80_t { NNSG2dScreenData *unk_28; Window unk_2C[3]; UnkStruct_ov74_021D1720 unk_5C[7]; - UIControlData *unk_2A8; + Menu *unk_2A8; u32 unk_2AC; SpriteRenderer *unk_2B0; SpriteGfxHandler *unk_2B4; @@ -751,12 +750,12 @@ static void ov74_021D1BA8(UnkStruct_ov74_021D0D80 *param0) 3, 25, 13, 6, 4, 13, (((((10 + 12 * 2) + 30 * 14) + 27 * 4) + 9) + (18 + 12)) }; - param0->unk_2A8 = sub_02002100(param0->unk_14, &v0, (((10 + 12 * 2) + 30 * 14) + 27 * 4), 14, param0->unk_00); + param0->unk_2A8 = Menu_MakeYesNoChoice(param0->unk_14, &v0, (((10 + 12 * 2) + 30 * 14) + 27 * 4), 14, param0->unk_00); } static u32 ov74_021D1BD0(UnkStruct_ov74_021D0D80 *param0) { - return sub_02002114(param0->unk_2A8, param0->unk_00); + return Menu_ProcessInputAndHandleExit(param0->unk_2A8, param0->unk_00); } static void ov74_021D1BE4(UnkStruct_ov74_021D0D80 *param0, u16 param1, BOOL param2) diff --git a/src/overlay075/ov75_021D0D80.c b/src/overlay075/ov75_021D0D80.c index 750b1d767b..76f6726426 100644 --- a/src/overlay075/ov75_021D0D80.c +++ b/src/overlay075/ov75_021D0D80.c @@ -3,7 +3,6 @@ #include #include -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_0200C6E4_decl.h" #include "struct_decls/struct_0200C704_decl.h" #include "struct_defs/sprite_template.h" @@ -22,6 +21,7 @@ #include "game_options.h" #include "gx_layers.h" #include "heap.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "overlay_manager.h" @@ -32,7 +32,6 @@ #include "sys_task.h" #include "sys_task_manager.h" #include "text.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200A784.h" #include "unk_0200C6E4.h" @@ -88,7 +87,7 @@ typedef struct { NNSG2dScreenData *unk_3C; NNSG2dScreenData *unk_40; Window unk_44[6]; - UIControlData *unk_A4; + Menu *unk_A4; SpriteRenderer *unk_A8; SpriteGfxHandler *unk_AC; CellActorData *unk_B0[3]; @@ -300,12 +299,12 @@ static void ov75_021D1040(UnkStruct_ov75_021D1184 *param0) 0, 25, 13, 6, 4, UnkEnum_ov75_021D1598_03, 555 }; - param0->unk_A4 = sub_02002100(param0->unk_18, &v0, 1, UnkEnum_ov75_021D1598_05, param0->unk_00); + param0->unk_A4 = Menu_MakeYesNoChoice(param0->unk_18, &v0, 1, UnkEnum_ov75_021D1598_05, param0->unk_00); } static int ov75_021D1064(UnkStruct_ov75_021D1184 *param0) { - switch (sub_02002114(param0->unk_A4, param0->unk_00)) { + switch (Menu_ProcessInputAndHandleExit(param0->unk_A4, param0->unk_00)) { case 0: return 1; case 0xfffffffe: diff --git a/src/overlay076/ov76_0223B870.c b/src/overlay076/ov76_0223B870.c index 4eb34f5e68..089442b88b 100644 --- a/src/overlay076/ov76_0223B870.c +++ b/src/overlay076/ov76_0223B870.c @@ -10,7 +10,6 @@ #include "struct_defs/struct_020127E8.h" #include "struct_defs/struct_0202CA28.h" #include "struct_defs/struct_0207C690.h" -#include "struct_defs/struct_02081CF4.h" #include "overlay012/ov12_02225864.h" #include "overlay012/struct_ov12_02225F6C.h" @@ -29,22 +28,22 @@ #include "graphics.h" #include "gx_layers.h" #include "heap.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "palette.h" #include "pokemon.h" #include "pokemon_icon.h" #include "strbuf.h" +#include "string_list.h" #include "sys_task.h" #include "sys_task_manager.h" #include "text.h" #include "touch_screen.h" -#include "unk_02001AF4.h" #include "unk_0200C6E4.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" #include "unk_02012744.h" -#include "unk_02013A04.h" #include "unk_02014000.h" #include "unk_0201E86C.h" #include "unk_0202419C.h" @@ -444,7 +443,7 @@ void ov76_0223BF50(void) void ov76_0223BF74(BgConfig *param0, Window *param1, int param2, UnkStruct_ov76_0223DE00 *param3, int param4) { - UnkStruct_02081CF4 v0; + MenuTemplate v0; int v1; int v2, v3, v4, v5, v6, v7; int v8[4]; @@ -493,7 +492,7 @@ void ov76_0223BF74(BgConfig *param0, Window *param1, int param2, UnkStruct_ov76_ Window_Init(param1); Window_Add(param0, param1, param2, v2, v3, v4, v5, 14, v6); - param3->unk_D4.unk_C8 = sub_02013A04(v7, 53); + param3->unk_D4.unk_C8 = StringList_New(v7, 53); { int v9; @@ -503,24 +502,24 @@ void ov76_0223BF74(BgConfig *param0, Window *param1, int param2, UnkStruct_ov76_ for (v9 = 0; v9 < v7; v9++) { v10 = MessageLoader_GetNewStrbuf(v11, Unk_ov76_0223EF3C[v8[v9]].unk_00); - sub_02013A6C(param3->unk_D4.unk_C8, v10, Unk_ov76_0223EF3C[v8[v9]].unk_04); + StringList_AddFromStrbuf(param3->unk_D4.unk_C8, v10, Unk_ov76_0223EF3C[v8[v9]].unk_04); Strbuf_Free(v10); } MessageLoader_Free(v11); } - v0.unk_00 = param3->unk_D4.unk_C8; - v0.unk_08 = 0; - v0.unk_04 = param1; - v0.unk_09 = 1; - v0.unk_0A = v7; - v0.unk_0B_0 = 0; - v0.unk_0B_4 = 0; - v0.unk_0B_6 = 1; + v0.choices = param3->unk_D4.unk_C8; + v0.fontID = FONT_SYSTEM; + v0.window = param1; + v0.xSize = 1; + v0.ySize = v7; + v0.lineSpacing = 0; + v0.suppressCursor = FALSE; + v0.loopAround = TRUE; Window_Show(param1, 1, (1 + (18 + 12)), 13); - param3->unk_D4.unk_CC = sub_02001B7C(&v0, 8, 0, 0, 53, PAD_BUTTON_B); + param3->unk_D4.unk_CC = Menu_NewAndCopyToVRAM(&v0, 8, 0, 0, 53, PAD_BUTTON_B); } void ov76_0223C0EC(int param0, s16 *param1, s16 *param2) diff --git a/src/overlay076/ov76_0223D338.c b/src/overlay076/ov76_0223D338.c index a2a8519087..72b2f4b243 100644 --- a/src/overlay076/ov76_0223D338.c +++ b/src/overlay076/ov76_0223D338.c @@ -29,20 +29,20 @@ #include "game_records.h" #include "gx_layers.h" #include "heap.h" +#include "menu.h" #include "narc.h" #include "palette.h" #include "pokemon.h" +#include "string_list.h" #include "sys_task.h" #include "sys_task_manager.h" #include "touch_screen.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200762C.h" #include "unk_0200C6E4.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" #include "unk_02012744.h" -#include "unk_02013A04.h" #include "unk_02015920.h" #include "unk_02015F84.h" #include "unk_02017728.h" @@ -187,8 +187,8 @@ static int ov76_0223D4C4(UnkStruct_ov76_0223DE00 *param0) { Window_Clear(¶m0->unk_D4.unk_18[1], 1); Window_ClearAndCopyToVRAM(¶m0->unk_D4.unk_18[1]); - sub_02001BC4(param0->unk_D4.unk_CC, NULL); - sub_02013A3C(param0->unk_D4.unk_C8); + Menu_Free(param0->unk_D4.unk_CC, NULL); + StringList_Free(param0->unk_D4.unk_C8); Window_Remove(¶m0->unk_D4.unk_18[1]); return 1; @@ -397,7 +397,7 @@ static BOOL ov76_0223D674(UnkStruct_ov76_0223DE00 *param0) } break; case 4: { UnkFuncPtr_ov76_0223D674 v4; - u32 v5 = sub_02001BE0(param0->unk_D4.unk_CC); + u32 v5 = Menu_ProcessInput(param0->unk_D4.unk_CC); switch (v5) { case 0xfffffffe: diff --git a/src/overlay079/ov79_021D0D80.c b/src/overlay079/ov79_021D0D80.c index 52d6cc5b44..e5bef07580 100644 --- a/src/overlay079/ov79_021D0D80.c +++ b/src/overlay079/ov79_021D0D80.c @@ -18,6 +18,8 @@ #include "game_options.h" #include "gx_layers.h" #include "heap.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "overlay_manager.h" @@ -25,8 +27,6 @@ #include "string_template.h" #include "text.h" #include "touch_screen.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200C6E4.h" #include "unk_0200DA60.h" @@ -251,7 +251,7 @@ static int ov79_021D0FEC(UnkStruct_ov79_021D0E1C *param0) if (gCoreSys.heldKeys != 0) { if (param0->unk_14 == 0) { - v0 = sub_02001288(param0->unk_C4); + v0 = ListMenu_ProcessInput(param0->unk_C4); } } else { if (v1 >= 0) { @@ -307,7 +307,7 @@ static int ov79_021D10B8(UnkStruct_ov79_021D0E1C *param0) { u32 v0; - v0 = sub_02001288(param0->unk_C8); + v0 = ListMenu_ProcessInput(param0->unk_C8); if (gCoreSys.pressedKeys & PAD_BUTTON_B) { Sound_PlayEffect(1500); @@ -355,7 +355,7 @@ static int ov79_021D114C(UnkStruct_ov79_021D0E1C *param0) static int ov79_021D116C(UnkStruct_ov79_021D0E1C *param0) { - switch (sub_02002114(param0->unk_D4, param0->unk_00)) { + switch (Menu_ProcessInputAndHandleExit(param0->unk_D4, param0->unk_00)) { case 0: Sound_PlayEffect(1500); ov79_021D2008(param0); diff --git a/src/overlay079/ov79_021D183C.c b/src/overlay079/ov79_021D183C.c index 463dcc2721..b1cc640630 100644 --- a/src/overlay079/ov79_021D183C.c +++ b/src/overlay079/ov79_021D183C.c @@ -3,34 +3,32 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" #include "struct_defs/struct_0203D9B8.h" #include "struct_defs/struct_020989DC.h" #include "overlay079/struct_ov79_021D0E1C.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "bg_window.h" #include "cell_actor.h" #include "font.h" +#include "list_menu.h" +#include "menu.h" #include "render_text.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200C6E4.h" #include "unk_0200DA60.h" -#include "unk_02013A04.h" #include "unk_020158A8.h" #include "unk_02098FFC.h" -static void ov79_021D1D88(BmpList *param0, u32 param1, u8 param2); -static void ov79_021D1D94(BmpList *param0, u32 param1, u8 param2); -static void ov79_021D1FA8(BmpList *param0, u32 param1, u8 param2); +static void ov79_021D1D88(ListMenu *param0, u32 param1, u8 param2); +static void ov79_021D1D94(ListMenu *param0, u32 param1, u8 param2); +static void ov79_021D1FA8(ListMenu *param0, u32 param1, u8 param2); -static const UnkStruct_ov84_02240FA8 Unk_ov79_021D3BB0 = { +static const ListMenuTemplate Unk_ov79_021D3BB0 = { NULL, ov79_021D1D94, ov79_021D1D88, @@ -52,7 +50,7 @@ static const UnkStruct_ov84_02240FA8 Unk_ov79_021D3BB0 = { NULL }; -static const UnkStruct_ov84_02240FA8 Unk_ov79_021D3B90 = { +static const ListMenuTemplate Unk_ov79_021D3B90 = { NULL, ov79_021D1FA8, NULL, @@ -151,7 +149,7 @@ void ov79_021D196C(UnkStruct_ov79_021D0E1C *param0) UnkStruct_020989DC *v2; param0->unk_1C = ov79_021D18B4(param0->unk_20, param0); - param0->unk_CC = sub_02013A04(param0->unk_1C, param0->unk_00); + param0->unk_CC = StringList_New(param0->unk_1C, param0->unk_00); for (v0 = param0->unk_1E; v0 != 0xFF; v0 = v1) { v2 = &(param0->unk_20->unk_1C[v0]); @@ -160,11 +158,11 @@ void ov79_021D196C(UnkStruct_ov79_021D0E1C *param0) StringTemplate_SetStrbuf(param0->unk_30.unk_00, 0, sub_02015918(param0->unk_28, v2->unk_02), 0, 0, GAME_LANGUAGE); StringTemplate_SetNumber(param0->unk_30.unk_00, 1, v2->unk_01, 2, 2, 1); StringTemplate_Format(param0->unk_30.unk_00, param0->unk_30.unk_04, param0->unk_30.unk_0C); - sub_02013A6C(param0->unk_CC, param0->unk_30.unk_04, v2->unk_05); + StringList_AddFromStrbuf(param0->unk_CC, param0->unk_30.unk_04, v2->unk_05); } - sub_02013A6C(param0->unk_CC, param0->unk_30.unk_08, 0xFF); - MI_CpuCopy8(&Unk_ov79_021D3BB0, ¶m0->unk_84, sizeof(UnkStruct_ov84_02240FA8)); + StringList_AddFromStrbuf(param0->unk_CC, param0->unk_30.unk_08, 0xFF); + MI_CpuCopy8(&Unk_ov79_021D3BB0, ¶m0->unk_84, sizeof(ListMenuTemplate)); param0->unk_82 = param0->unk_20->unk_06; param0->unk_80 = param0->unk_20->unk_04; @@ -183,12 +181,12 @@ void ov79_021D196C(UnkStruct_ov79_021D0E1C *param0) param0->unk_20->unk_02 = 0; } - param0->unk_84.unk_0C = &(param0->unk_E8[0]); - param0->unk_84.unk_00 = param0->unk_CC; - param0->unk_84.unk_1C = (void *)param0; - param0->unk_84.unk_10 = param0->unk_1C; + param0->unk_84.window = &(param0->unk_E8[0]); + param0->unk_84.choices = param0->unk_CC; + param0->unk_84.tmp = (void *)param0; + param0->unk_84.count = param0->unk_1C; param0->unk_16 = 0; - param0->unk_C4 = sub_0200112C(¶m0->unk_84, param0->unk_80, param0->unk_82, param0->unk_00); + param0->unk_C4 = ListMenu_New(¶m0->unk_84, param0->unk_80, param0->unk_82, param0->unk_00); param0->unk_16 = 1; } @@ -200,8 +198,8 @@ void ov79_021D1AB8(UnkStruct_ov79_021D0E1C *param0, BOOL param1) Window_ClearAndCopyToVRAM(¶m0->unk_E8[0]); } - sub_02001384(param0->unk_C4, &(param0->unk_80), &(param0->unk_82)); - sub_02013A3C(param0->unk_CC); + ListMenu_Free(param0->unk_C4, &(param0->unk_80), &(param0->unk_82)); + StringList_Free(param0->unk_CC); param0->unk_20->unk_04 = param0->unk_80; param0->unk_20->unk_06 = param0->unk_82; @@ -304,17 +302,17 @@ static void ov79_021D1D20(UnkStruct_ov79_021D0E1C *param0, UnkStruct_020989DC *p } } -static void ov79_021D1D88(BmpList *param0, u32 param1, u8 param2) +static void ov79_021D1D88(ListMenu *param0, u32 param1, u8 param2) { - UnkStruct_ov79_021D0E1C *v0 = (UnkStruct_ov79_021D0E1C *)sub_02001504(param0, 19); + UnkStruct_ov79_021D0E1C *v0 = (UnkStruct_ov79_021D0E1C *)ListMenu_GetAttribute(param0, 19); TextColor v1; v1 = TEXT_COLOR(1, 2, 0); } -static void ov79_021D1D94(BmpList *param0, u32 param1, u8 param2) +static void ov79_021D1D94(ListMenu *param0, u32 param1, u8 param2) { - UnkStruct_ov79_021D0E1C *v0 = (UnkStruct_ov79_021D0E1C *)sub_02001504(param0, 19); + UnkStruct_ov79_021D0E1C *v0 = (UnkStruct_ov79_021D0E1C *)ListMenu_GetAttribute(param0, 19); TextColor v1; u16 v2, v3; u8 v4 = 0; @@ -325,7 +323,7 @@ static void ov79_021D1D94(BmpList *param0, u32 param1, u8 param2) Sound_PlayEffect(1500); } - sub_020014DC(param0, &v2, &v3); + ListMenu_GetListAndCursorPos(param0, &v2, &v3); SpriteActor_SetPositionXY(v0->unk_1C0[0], 105, v3 * 16 + 40); if (v2 == 0) { @@ -369,22 +367,22 @@ void ov79_021D1ED8(UnkStruct_ov79_021D0E1C *param0) { u8 v0 = 0; - param0->unk_D0 = sub_02013A04(3, param0->unk_00); + param0->unk_D0 = StringList_New(3, param0->unk_00); for (v0 = 0; v0 < 3; v0++) { - sub_02013A4C(param0->unk_D0, param0->unk_2C, 1 + v0, v0); + StringList_AddFromMessageBank(param0->unk_D0, param0->unk_2C, 1 + v0, v0); } - MI_CpuCopy8(&Unk_ov79_021D3B90, ¶m0->unk_A4, sizeof(UnkStruct_ov84_02240FA8)); + MI_CpuCopy8(&Unk_ov79_021D3B90, ¶m0->unk_A4, sizeof(ListMenuTemplate)); - param0->unk_A4.unk_0C = &(param0->unk_E8[3]); - param0->unk_A4.unk_00 = param0->unk_D0; - param0->unk_A4.unk_1C = (void *)param0; - param0->unk_A4.unk_10 = 3; + param0->unk_A4.window = &(param0->unk_E8[3]); + param0->unk_A4.choices = param0->unk_D0; + param0->unk_A4.tmp = (void *)param0; + param0->unk_A4.count = 3; Window_Show(¶m0->unk_E8[3], 1, 1 + 18 + 12, 15); - param0->unk_C8 = sub_0200112C(¶m0->unk_A4, 0, 0, param0->unk_00); + param0->unk_C8 = ListMenu_New(¶m0->unk_A4, 0, 0, param0->unk_00); } void ov79_021D1F60(UnkStruct_ov79_021D0E1C *param0) @@ -394,14 +392,14 @@ void ov79_021D1F60(UnkStruct_ov79_021D0E1C *param0) Window_Clear(&(param0->unk_E8[3]), 0); Window_ClearAndCopyToVRAM(¶m0->unk_E8[3]); - sub_02001384(param0->unk_C8, &v1, &v0); - sub_02013A3C(param0->unk_D0); + ListMenu_Free(param0->unk_C8, &v1, &v0); + StringList_Free(param0->unk_D0); param0->unk_C8 = NULL; param0->unk_D0 = NULL; } -static void ov79_021D1FA8(BmpList *param0, u32 param1, u8 param2) +static void ov79_021D1FA8(ListMenu *param0, u32 param1, u8 param2) { if (!param2) { Sound_PlayEffect(1500); @@ -432,7 +430,7 @@ void ov79_021D2054(UnkStruct_ov79_021D0E1C *param0) 1, 26, 13, 5, 4, 13, 463 }; - param0->unk_D4 = sub_02002100(param0->unk_24, &v0, 1 + 18 + 12, 15, param0->unk_00); + param0->unk_D4 = Menu_MakeYesNoChoice(param0->unk_24, &v0, 1 + 18 + 12, 15, param0->unk_00); } void ov79_021D2078(UnkStruct_ov79_021D0E1C *param0) diff --git a/src/overlay084/ov84_0223B5A0.c b/src/overlay084/ov84_0223B5A0.c index db1425ae4c..35f2a6d633 100644 --- a/src/overlay084/ov84_0223B5A0.c +++ b/src/overlay084/ov84_0223B5A0.c @@ -5,7 +5,6 @@ #include "constants/field/map_load.h" -#include "struct_decls/struct_0200112C_decl.h" #include "struct_defs/struct_0202D7B0.h" #include "struct_defs/struct_0207CB08.h" #include "struct_defs/struct_02099F80.h" @@ -18,7 +17,6 @@ #include "overlay084/struct_ov84_0223B5A0.h" #include "overlay084/struct_ov84_0223BE5C.h" #include "overlay084/struct_ov84_0223C920.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "bag.h" #include "bg_window.h" @@ -29,25 +27,25 @@ #include "gx_layers.h" #include "heap.h" #include "item.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "overlay_manager.h" #include "render_text.h" #include "save_player.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" #include "touch_screen.h" #include "trainer_info.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_020041CC.h" #include "unk_02005474.h" #include "unk_0200C440.h" #include "unk_0200C6E4.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" -#include "unk_02013A04.h" #include "unk_02017728.h" #include "unk_0201D15C.h" #include "unk_0201DBEC.h" @@ -78,8 +76,8 @@ static void ov84_0223BFBC(UnkStruct_ov84_0223B5A0 *param0); static void ov84_0223C194(u16 *param0, u16 *param1, u8 param2); static void ov84_0223C1D0(u16 *param0, u16 *param1, u8 param2, u8 param3); static void ov84_0223C224(UnkStruct_ov84_0223B5A0 *param0, u16 param1, u16 param2); -static void ov84_0223C2AC(BmpList *param0, u32 param1, u8 param2); -static void ov84_0223C3B8(BmpList *param0, u32 param1, u8 param2); +static void ov84_0223C2AC(ListMenu *param0, u32 param1, u8 param2); +static void ov84_0223C3B8(ListMenu *param0, u32 param1, u8 param2); static void ov84_0223C4E0(UnkStruct_ov84_0223B5A0 *param0); static void ov84_0223BE24(UnkStruct_ov84_0223B5A0 *param0); static u8 ov84_02240C30(UnkStruct_ov84_0223B5A0 *param0, u8 param1); @@ -164,7 +162,7 @@ const OverlayManagerTemplate Unk_ov84_02241130 = { 0xFFFFFFFF }; -static const UnkStruct_ov84_02240FA8 Unk_ov84_02240FA8 = { +static const ListMenuTemplate Unk_ov84_02240FA8 = { NULL, ov84_0223C2AC, ov84_0223C3B8, @@ -956,9 +954,9 @@ static void ov84_0223BFBC(UnkStruct_ov84_0223B5A0 *param0) u32 v1; v0 = ¶m0->unk_C4->unk_04[param0->unk_C4->unk_64]; - param0->unk_160 = sub_02013A04(Unk_ov84_02241118[v0->unk_08] + 3, 6); + param0->unk_160 = StringList_New(Unk_ov84_02241118[v0->unk_08] + 3, 6); - sub_02013A4C(param0->unk_160, param0->unk_114, 32, 0xfffffffd); + StringList_AddFromMessageBank(param0->unk_160, param0->unk_114, 32, 0xfffffffd); if (v0->unk_08 == 3) { for (v1 = 0; v1 < Unk_ov84_02241118[v0->unk_08]; v1++) { @@ -967,11 +965,11 @@ static void ov84_0223BFBC(UnkStruct_ov84_0223B5A0 *param0) } ov84_0223BE94(param0->unk_120, param0->unk_164[v1], v0->unk_00[v1].item, 6); - sub_02013A6C(param0->unk_160, param0->unk_164[v1], v1); + StringList_AddFromStrbuf(param0->unk_160, param0->unk_164[v1], v1); } - sub_02013A4C(param0->unk_160, param0->unk_114, 32, 0xfffffffe); - sub_02013A4C(param0->unk_160, param0->unk_114, 32, 0xfffffffd); + StringList_AddFromMessageBank(param0->unk_160, param0->unk_114, 32, 0xfffffffe); + StringList_AddFromMessageBank(param0->unk_160, param0->unk_114, 32, 0xfffffffd); v0->unk_09 = v1 + 3; } else { @@ -981,20 +979,20 @@ static void ov84_0223BFBC(UnkStruct_ov84_0223B5A0 *param0) } ov84_0223BE84(param0->unk_11C, param0->unk_164[v1], v0->unk_00[v1].item, 6); - sub_02013A6C(param0->unk_160, param0->unk_164[v1], v1); + StringList_AddFromStrbuf(param0->unk_160, param0->unk_164[v1], v1); } if (param0->unk_C4->unk_65 != 5) { if (v0->unk_08 == 4) { - sub_02013A4C(param0->unk_160, param0->unk_114, 32, 0xfffffffe); + StringList_AddFromMessageBank(param0->unk_160, param0->unk_114, 32, 0xfffffffe); } else { - sub_02013A4C(param0->unk_160, param0->unk_114, 41, 0xfffffffe); + StringList_AddFromMessageBank(param0->unk_160, param0->unk_114, 41, 0xfffffffe); } - sub_02013A4C(param0->unk_160, param0->unk_114, 32, 0xfffffffd); + StringList_AddFromMessageBank(param0->unk_160, param0->unk_114, 32, 0xfffffffd); v0->unk_09 = v1 + 3; } else { - sub_02013A4C(param0->unk_160, param0->unk_114, 32, 0xfffffffd); + StringList_AddFromMessageBank(param0->unk_160, param0->unk_114, 32, 0xfffffffd); v0->unk_09 = v1 + 2; } } @@ -1069,27 +1067,27 @@ static void ov84_0223C1D0(u16 *param0, u16 *param1, u8 param2, u8 param3) static void ov84_0223C224(UnkStruct_ov84_0223B5A0 *param0, u16 param1, u16 param2) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; v0 = Unk_ov84_02240FA8; - v0.unk_00 = param0->unk_160; - v0.unk_0C = ¶m0->unk_04[0]; - v0.unk_10 = param0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_09; - v0.unk_1C = (void *)param0; + v0.choices = param0->unk_160; + v0.window = ¶m0->unk_04[0]; + v0.count = param0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_09; + v0.tmp = (void *)param0; if ((param0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_08 == 3) || (param0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_08 == 4)) { - v0.unk_15 = (32 + 3); + v0.textXOffset = (32 + 3); } else { - v0.unk_15 = 0; + v0.textXOffset = 0; } - param0->unk_15C = sub_0200112C(&v0, param1, param2, 6); + param0->unk_15C = ListMenu_New(&v0, param1, param2, 6); Window_ScheduleCopyToVRAM(¶m0->unk_04[0]); } -static void ov84_0223C2AC(BmpList *param0, u32 param1, u8 param2) +static void ov84_0223C2AC(ListMenu *param0, u32 param1, u8 param2) { - UnkStruct_ov84_0223B5A0 *v0 = (UnkStruct_ov84_0223B5A0 *)sub_02001504(param0, 19); + UnkStruct_ov84_0223B5A0 *v0 = (UnkStruct_ov84_0223B5A0 *)ListMenu_GetAttribute(param0, 19); if (param2 != 1) { switch (v0->unk_482) { @@ -1134,15 +1132,15 @@ static void ov84_0223C2AC(BmpList *param0, u32 param1, u8 param2) } } -static void ov84_0223C3B8(BmpList *param0, u32 param1, u8 param2) +static void ov84_0223C3B8(ListMenu *param0, u32 param1, u8 param2) { - UnkStruct_ov84_0223B5A0 *v0 = (UnkStruct_ov84_0223B5A0 *)sub_02001504(param0, 19); + UnkStruct_ov84_0223B5A0 *v0 = (UnkStruct_ov84_0223B5A0 *)ListMenu_GetAttribute(param0, 19); UnkStruct_ov84_0223BE5C *v1 = &v0->unk_C4->unk_04[v0->unk_C4->unk_64]; if ((v0->unk_47A == 1) && (v0->unk_47C == param1)) { - sub_0200147C(param0, 8, 0, 9); + ListMenu_SetAltTextColors(param0, 8, 0, 9); } else { - sub_0200147C(param0, 1, 0, 2); + ListMenu_SetAltTextColors(param0, 1, 0, 2); } if (v1->unk_08 == 7) { @@ -1176,8 +1174,8 @@ static void ov84_0223C3B8(BmpList *param0, u32 param1, u8 param2) static void ov84_0223C4E0(UnkStruct_ov84_0223B5A0 *param0) { - sub_02001384(param0->unk_15C, ¶m0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_06, ¶m0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_04); - sub_02013A3C(param0->unk_160); + ListMenu_Free(param0->unk_15C, ¶m0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_06, ¶m0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_04); + StringList_Free(param0->unk_160); param0->unk_15C = NULL; } @@ -1229,7 +1227,7 @@ static u8 ov84_0223C5B8(UnkStruct_ov84_0223B5A0 *param0) u16 v2, v3; v0 = ¶m0->unk_C4->unk_04[param0->unk_C4->unk_64]; - sub_020014DC(param0->unk_15C, &v0->unk_06, &v0->unk_04); + ListMenu_GetListAndCursorPos(param0->unk_15C, &v0->unk_06, &v0->unk_04); if (gCoreSys.pressedKeys & PAD_BUTTON_SELECT) { if (ov84_0223D244(param0) == 1) { @@ -1238,8 +1236,8 @@ static u8 ov84_0223C5B8(UnkStruct_ov84_0223B5A0 *param0) } } - v1 = sub_02001288(param0->unk_15C); - sub_020014DC(param0->unk_15C, &v2, &v3); + v1 = ListMenu_ProcessInput(param0->unk_15C); + ListMenu_GetListAndCursorPos(param0->unk_15C, &v2, &v3); if (v0->unk_04 != v3) { SpriteActor_SetSpritePositionXY( @@ -1251,18 +1249,18 @@ static u8 ov84_0223C5B8(UnkStruct_ov84_0223B5A0 *param0) if (v1 == 0xffffffff) { if (ov84_0223D1F4(param0) == 1) { - v1 = sub_020014F8(param0->unk_15C, v2 + v3); + v1 = ListMenu_GetIndexOfChoice(param0->unk_15C, v2 + v3); param0->unk_490 = 1; } } switch (v1) { case 0xffffffff: { - u8 v4 = sub_020014F0(param0->unk_15C); + u8 v4 = ListMenu_GetLastAction(param0->unk_15C); - if (v4 == 1) { + if (v4 == LIST_MENU_ACTION_MOVE_UP) { ov84_0223EB08(param0, 36); - } else if (v4 == 2) { + } else if (v4 == LIST_MENU_ACTION_MOVE_DOWN) { ov84_0223EB08(param0, -36); } } break; @@ -1536,8 +1534,8 @@ static u8 ov84_0223CBD8(UnkStruct_ov84_0223B5A0 *param0) ov84_0223F2FC(param0); } else { if (param0->unk_15C != NULL) { - sub_02001384(param0->unk_15C, ¶m0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_06, ¶m0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_04); - sub_02013A3C(param0->unk_160); + ListMenu_Free(param0->unk_15C, ¶m0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_06, ¶m0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_04); + StringList_Free(param0->unk_160); } param0->unk_C4->unk_64 = v0->unk_00; @@ -1811,7 +1809,7 @@ static u8 ov84_0223D244(UnkStruct_ov84_0223B5A0 *param0) { UnkStruct_ov84_0223BE5C *v0 = ¶m0->unk_C4->unk_04[param0->unk_C4->unk_64]; - if (sub_020014F8(param0->unk_15C, v0->unk_06 + v0->unk_04) == 0xfffffffe) { + if (ListMenu_GetIndexOfChoice(param0->unk_15C, v0->unk_06 + v0->unk_04) == 0xfffffffe) { return 0; } @@ -1832,10 +1830,10 @@ static void ov84_0223D2A0(UnkStruct_ov84_0223B5A0 *param0) param0->unk_47A = 1; param0->unk_47B = v0->unk_06 + v0->unk_04; - param0->unk_47C = sub_020014F8(param0->unk_15C, param0->unk_47B); + param0->unk_47C = ListMenu_GetIndexOfChoice(param0->unk_15C, param0->unk_47B); ov84_0223FE18(param0); - sub_020013AC(param0->unk_15C); + ListMenu_Draw(param0->unk_15C); ov84_0223D4E8(param0); } @@ -1850,7 +1848,7 @@ static u8 ov84_0223D2F8(UnkStruct_ov84_0223B5A0 *param0) } v0 = ¶m0->unk_C4->unk_04[param0->unk_C4->unk_64]; - sub_020014DC(param0->unk_15C, &v0->unk_06, &v0->unk_04); + ListMenu_GetListAndCursorPos(param0->unk_15C, &v0->unk_06, &v0->unk_04); if (ov84_0223D1F4(param0) == 1) { Sound_PlayEffect(1500); @@ -1866,8 +1864,8 @@ static u8 ov84_0223D2F8(UnkStruct_ov84_0223B5A0 *param0) return 1; } - v1 = sub_02001288(param0->unk_15C); - sub_020014DC(param0->unk_15C, &v2, &v3); + v1 = ListMenu_ProcessInput(param0->unk_15C); + ListMenu_GetListAndCursorPos(param0->unk_15C, &v2, &v3); if (v0->unk_04 != v3) { SpriteActor_SetSpritePositionXY(param0->unk_E0[5], 177, 24 + (v3 - 1) * 16 - 8); @@ -1878,11 +1876,11 @@ static u8 ov84_0223D2F8(UnkStruct_ov84_0223B5A0 *param0) switch (v1) { case 0xffffffff: { - u8 v4 = sub_020014F0(param0->unk_15C); + u8 v4 = ListMenu_GetLastAction(param0->unk_15C); - if (v4 == 1) { + if (v4 == LIST_MENU_ACTION_MOVE_UP) { ov84_0223EB08(param0, 36); - } else if (v4 == 2) { + } else if (v4 == LIST_MENU_ACTION_MOVE_DOWN) { ov84_0223EB08(param0, -36); } } break; @@ -1912,7 +1910,7 @@ static void ov84_0223D42C(UnkStruct_ov84_0223B5A0 *param0) if (!((param0->unk_47B == v1) || (param0->unk_47B == (v1 - 1)))) { Item_MoveInPocket(v0->unk_00, param0->unk_47B - 1, v1 - 1); - sub_02013A3C(param0->unk_160); + StringList_Free(param0->unk_160); ov84_0223BFBC(param0); } @@ -1923,7 +1921,7 @@ static void ov84_0223D484(UnkStruct_ov84_0223B5A0 *param0) { UnkStruct_ov84_0223BE5C *v0 = ¶m0->unk_C4->unk_04[param0->unk_C4->unk_64]; - sub_02001384(param0->unk_15C, &v0->unk_06, &v0->unk_04); + ListMenu_Free(param0->unk_15C, &v0->unk_06, &v0->unk_04); param0->unk_15C = NULL; if (param0->unk_47B < (v0->unk_06 + v0->unk_04)) { @@ -2041,22 +2039,22 @@ static int ov84_0223D730(UnkStruct_ov84_0223B5A0 *param0) return 4; } - v0 = sub_02001BE0(param0->unk_158); + v0 = Menu_ProcessInput(param0->unk_158); if (v0 == 0xffffffff) { if (ov84_0223D1F4(param0) == 1) { - v0 = sub_02001D44(param0->unk_158, 0); + v0 = Menu_ProcessExternalInput(param0->unk_158, 0); param0->unk_490 = 1; } } switch (v0) { case 0xffffffff: { - u8 v1 = sub_02001DC8(param0->unk_158); + u8 v1 = Menu_GetLastAction(param0->unk_158); - if (v1 == 1) { + if (v1 == MENU_ACTION_MOVE_UP) { ov84_0223EB08(param0, 18); - } else if (v1 == 2) { + } else if (v1 == MENU_ACTION_MOVE_DOWN) { ov84_0223EB08(param0, -18); } } break; @@ -2228,10 +2226,10 @@ static int ov84_0223DA14(UnkStruct_ov84_0223B5A0 *param0) } if (ov84_0223D1F4(param0) == 1) { - v2 = sub_02002134(param0->unk_158, 0, 6); + v2 = Menu_ProcessExternalInputAndHandleExit(param0->unk_158, 0, 6); param0->unk_490 = 1; } else { - v2 = sub_02002114(param0->unk_158, 6); + v2 = Menu_ProcessInputAndHandleExit(param0->unk_158, 6); } switch (v2) { @@ -2241,11 +2239,11 @@ static int ov84_0223DA14(UnkStruct_ov84_0223B5A0 *param0) param0->unk_C4->unk_68 = 0; return 24; case 0xffffffff: { - u8 v3 = sub_02001DC8(param0->unk_158); + u8 v3 = Menu_GetLastAction(param0->unk_158); - if (v3 == 1) { + if (v3 == MENU_ACTION_MOVE_UP) { ov84_0223EB08(param0, 18); - } else if (v3 == 2) { + } else if (v3 == MENU_ACTION_MOVE_DOWN) { ov84_0223EB08(param0, -18); } } break; @@ -2309,8 +2307,8 @@ static Strbuf *ov84_0223DC9C(UnkStruct_ov84_0223B5A0 *param0, u16 param1) static void ov84_0223DCF8(UnkStruct_ov84_0223B5A0 *param0) { Pocket_TryRemoveItem(param0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_00, param0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_09 - 3, param0->unk_C4->unk_66, param0->unk_488, 6); - sub_02001384(param0->unk_15C, ¶m0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_06, ¶m0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_04); - sub_02013A3C(param0->unk_160); + ListMenu_Free(param0->unk_15C, ¶m0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_06, ¶m0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_04); + StringList_Free(param0->unk_160); ov84_0223BFBC(param0); ov84_0223C194(¶m0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_06, ¶m0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_04, param0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_09); @@ -2450,10 +2448,10 @@ static int ov84_0223E01C(UnkStruct_ov84_0223B5A0 *param0) } if (ov84_0223D1F4(param0) == 1) { - v0 = sub_02002134(param0->unk_158, 0, 6); + v0 = Menu_ProcessExternalInputAndHandleExit(param0->unk_158, 0, 6); param0->unk_490 = 1; } else { - v0 = sub_02002114(param0->unk_158, 6); + v0 = Menu_ProcessInputAndHandleExit(param0->unk_158, 6); } switch (v0) { @@ -2475,11 +2473,11 @@ static int ov84_0223E01C(UnkStruct_ov84_0223B5A0 *param0) return 10; case 0xffffffff: { - u8 v2 = sub_02001DC8(param0->unk_158); + u8 v2 = Menu_GetLastAction(param0->unk_158); - if (v2 == 1) { + if (v2 == MENU_ACTION_MOVE_UP) { ov84_0223EB08(param0, 18); - } else if (v2 == 2) { + } else if (v2 == MENU_ACTION_MOVE_DOWN) { ov84_0223EB08(param0, -18); } } break; @@ -2525,7 +2523,7 @@ static int ov84_0223E18C(UnkStruct_ov84_0223B5A0 *param0) static int ov84_0223E1E4(UnkStruct_ov84_0223B5A0 *param0) { Bag_RegisterItem(param0->unk_C8, param0->unk_C4->unk_66); - sub_020013AC(param0->unk_15C); + ListMenu_Draw(param0->unk_15C); ov84_0223FD84(param0); Window_ScheduleCopyToVRAM(¶m0->unk_04[1]); ov84_02240B34(param0, 1); @@ -2536,7 +2534,7 @@ static int ov84_0223E1E4(UnkStruct_ov84_0223B5A0 *param0) static int ov84_0223E220(UnkStruct_ov84_0223B5A0 *param0) { Bag_RegisterItem(param0->unk_C8, 0); - sub_020013AC(param0->unk_15C); + ListMenu_Draw(param0->unk_15C); ov84_0223FD84(param0); Window_ScheduleCopyToVRAM(¶m0->unk_04[1]); ov84_02240B34(param0, 1); @@ -2787,10 +2785,10 @@ static int ov84_0223E7CC(UnkStruct_ov84_0223B5A0 *param0) } if (ov84_0223D1F4(param0) == 1) { - v0 = sub_02002134(param0->unk_158, 0, 6); + v0 = Menu_ProcessExternalInputAndHandleExit(param0->unk_158, 0, 6); param0->unk_490 = 1; } else { - v0 = sub_02002114(param0->unk_158, 6); + v0 = Menu_ProcessInputAndHandleExit(param0->unk_158, 6); } switch (v0) { @@ -2811,11 +2809,11 @@ static int ov84_0223E7CC(UnkStruct_ov84_0223B5A0 *param0) param0->unk_426 = ov84_022400A0(param0); return 21; case 0xffffffff: { - u8 v2 = sub_02001DC8(param0->unk_158); + u8 v2 = Menu_GetLastAction(param0->unk_158); - if (v2 == 1) { + if (v2 == MENU_ACTION_MOVE_UP) { ov84_0223EB08(param0, 18); - } else if (v2 == 2) { + } else if (v2 == MENU_ACTION_MOVE_DOWN) { ov84_0223EB08(param0, -18); } } break; @@ -3051,7 +3049,7 @@ static BOOL ov84_0223ED64(UnkStruct_ov84_0223B5A0 *param0, u16 param1) v0 = param0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_06; v1 = param0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_04; - sub_02001408(param0->unk_15C, NULL, v0, v1, 1, param1, &v0, &v1); + ListMenu_TestInput(param0->unk_15C, NULL, v0, v1, 1, param1, &v0, &v1); if ((v0 == param0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_06) && (v1 == param0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_04)) { return 0; @@ -3097,7 +3095,7 @@ static BOOL ov84_0223EE80(UnkStruct_ov84_0223B5A0 *param0, u16 param1) v0 = param0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_06; v1 = param0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_04; - sub_02001408(param0->unk_15C, NULL, v0, v1, 1, param1, &v0, &v1); + ListMenu_TestInput(param0->unk_15C, NULL, v0, v1, 1, param1, &v0, &v1); if ((v0 == param0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_06) && (v1 == param0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_04)) { return 0; @@ -3138,11 +3136,11 @@ static BOOL ov84_0223EF4C(UnkStruct_ov84_0223B5A0 *param0) static BOOL ov84_0223EF9C(UnkStruct_ov84_0223B5A0 *param0, u8 param1) { - u8 v0 = sub_02001DC4(param0->unk_158); + u8 v0 = Menu_GetCursorPos(param0->unk_158); - sub_02001D44(param0->unk_158, param1); + Menu_ProcessExternalInput(param0->unk_158, param1); - if (v0 == sub_02001DC4(param0->unk_158)) { + if (v0 == Menu_GetCursorPos(param0->unk_158)) { return 0; } diff --git a/src/overlay084/ov84_0223F040.c b/src/overlay084/ov84_0223F040.c index b3157e6ac9..b52b32c6c3 100644 --- a/src/overlay084/ov84_0223F040.c +++ b/src/overlay084/ov84_0223F040.c @@ -4,7 +4,6 @@ #include #include "struct_defs/struct_0207CB08.h" -#include "struct_defs/struct_02081CF4.h" #include "overlay084/ov84_0223B5A0.h" #include "overlay084/ov84_022403F4.h" @@ -18,20 +17,20 @@ #include "game_options.h" #include "heap.h" #include "item.h" +#include "menu.h" #include "message.h" #include "move_table.h" #include "narc.h" #include "poffin.h" #include "render_text.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" #include "trainer_info.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200C440.h" #include "unk_0200DA60.h" -#include "unk_02013A04.h" static void ov84_0223F9B0(UnkStruct_ov84_0223B5A0 *param0, u32 param1); static BOOL ov84_022400E0(TextPrinterTemplate *param0, u16 param1); @@ -400,7 +399,7 @@ void ov84_0223FB50(UnkStruct_ov84_0223B5A0 *param0) void ov84_0223FB70(UnkStruct_ov84_0223B5A0 *param0, u8 *param1, u8 param2) { - UnkStruct_02081CF4 v0; + MenuTemplate v0; UnkStruct_ov84_0223BE5C *v1; Strbuf *v2; Strbuf *v3; @@ -415,27 +414,27 @@ void ov84_0223FB70(UnkStruct_ov84_0223B5A0 *param0, u8 *param1, u8 param2) v5 = 3; } - param0->unk_154 = sub_02013A04(param2, 6); + param0->unk_154 = StringList_New(param2, 6); for (v4 = 0; v4 < param2; v4++) { - sub_02013A6C(param0->unk_154, param0->unk_124[param1[v4]], ov84_0223D84C(param1[v4])); + StringList_AddFromStrbuf(param0->unk_154, param0->unk_124[param1[v4]], ov84_0223D84C(param1[v4])); } - v0.unk_00 = param0->unk_154; - v0.unk_04 = ¶m0->unk_B4[0]; - v0.unk_08 = 0; - v0.unk_09 = 1; - v0.unk_0A = param2; - v0.unk_0B_0 = 0; - v0.unk_0B_4 = 0; + v0.choices = param0->unk_154; + v0.window = ¶m0->unk_B4[0]; + v0.fontID = FONT_SYSTEM; + v0.xSize = 1; + v0.ySize = param2; + v0.lineSpacing = 0; + v0.suppressCursor = FALSE; if (param2 >= 4) { - v0.unk_0B_6 = 1; + v0.loopAround = TRUE; } else { - v0.unk_0B_6 = 0; + v0.loopAround = FALSE; } - param0->unk_158 = sub_02001AF4(&v0, 8, 0, 0, 6, PAD_BUTTON_B); + param0->unk_158 = Menu_New(&v0, 8, 0, 0, 6, PAD_BUTTON_B); if (param0->unk_C4->unk_04[param0->unk_C4->unk_64].unk_08 == 3) { Window_FillTilemap(¶m0->unk_04[1], 0); @@ -479,8 +478,8 @@ void ov84_0223FD84(UnkStruct_ov84_0223B5A0 *param0) Window_Clear(¶m0->unk_B4[0], 1); Window_ClearAndScheduleCopyToVRAM(¶m0->unk_B4[0]); - sub_02001BC4(param0->unk_158, NULL); - sub_02013A3C(param0->unk_154); + Menu_Free(param0->unk_158, NULL); + StringList_Free(param0->unk_154); Window_Remove(¶m0->unk_B4[0]); Window_FillTilemap(¶m0->unk_04[1], 0); ov84_0223F528(param0, param0->unk_C4->unk_66); @@ -613,7 +612,7 @@ static BOOL ov84_022400E0(TextPrinterTemplate *param0, u16 param1) void ov84_02240120(UnkStruct_ov84_0223B5A0 *param0) { - param0->unk_158 = sub_02002100(param0->unk_00, &Unk_ov84_02241150, 1024 - 9, 14, 6); + param0->unk_158 = Menu_MakeYesNoChoice(param0->unk_00, &Unk_ov84_02241150, 1024 - 9, 14, 6); } void ov84_02240148(UnkStruct_ov84_0223B5A0 *param0, u8 param1) diff --git a/src/overlay088/ov88_0223B140.c b/src/overlay088/ov88_0223B140.c index 1dc14a3a6d..706c5daeae 100644 --- a/src/overlay088/ov88_0223B140.c +++ b/src/overlay088/ov88_0223B140.c @@ -12,12 +12,10 @@ #include "struct_defs/archived_sprite.h" #include "struct_defs/chatot_cry.h" #include "struct_defs/struct_02027F8C.h" -#include "struct_defs/struct_02081CF4.h" #include "struct_defs/struct_02095E80_t.h" #include "struct_defs/struct_02099F80.h" #include "overlay022/struct_ov22_022559F8.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "overlay088/ov88_0223E9C4.h" #include "overlay088/struct_ov88_0223C370.h" #include "overlay088/struct_ov88_0223C8AC.h" @@ -38,6 +36,8 @@ #include "inlines.h" #include "item.h" #include "journal.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "message_util.h" #include "narc.h" @@ -50,12 +50,11 @@ #include "savedata.h" #include "sprite_resource.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" #include "touch_screen.h" #include "trainer_info.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_020041CC.h" #include "unk_02005474.h" #include "unk_02006224.h" @@ -66,7 +65,6 @@ #include "unk_0200DA60.h" #include "unk_0200F174.h" #include "unk_020131EC.h" -#include "unk_02013A04.h" #include "unk_02017728.h" #include "unk_0201D15C.h" #include "unk_0201DBEC.h" @@ -1864,7 +1862,7 @@ static int ov88_0223D5B8(UnkStruct_02095E80 *param0) int v0; TrainerInfo *v1; - v0 = sub_02001288(param0->unk_36D8); + v0 = ListMenu_ProcessInput(param0->unk_36D8); switch (v0) { case 0xffffffff: @@ -1895,19 +1893,19 @@ static int ov88_0223D5B8(UnkStruct_02095E80 *param0) Window_Clear(¶m0->unk_36DC, 0); Window_Remove(¶m0->unk_36DC); - sub_02001384(param0->unk_36D8, NULL, NULL); - sub_02013A3C(param0->unk_36D4); + ListMenu_Free(param0->unk_36D8, NULL, NULL); + StringList_Free(param0->unk_36D4); return 0; } static int ov88_0223D69C(UnkStruct_02095E80 *param0) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; int v1 = sub_0202AF94(param0->unk_36EC); int v2 = 5; - param0->unk_36D4 = sub_02013A04(v1 + 1, 26); + param0->unk_36D4 = StringList_New(v1 + 1, 26); { MessageLoader *v3; @@ -1917,11 +1915,11 @@ static int ov88_0223D69C(UnkStruct_02095E80 *param0) for (v5 = 0; v5 < 32; v5++) { if (sub_0202AF78(param0->unk_36EC, v5)) { Strbuf_CopyChars(v4, sub_0202AEF0(param0->unk_36EC, v5)); - sub_02013A6C(param0->unk_36D4, v4, v5); + StringList_AddFromStrbuf(param0->unk_36D4, v4, v5); } } - sub_02013A4C(param0->unk_36D4, param0->unk_36D0, 11, 0xfffffffe); + StringList_AddFromMessageBank(param0->unk_36D4, param0->unk_36D0, 11, 0xfffffffe); Strbuf_Free(v4); } @@ -2077,31 +2075,31 @@ static int ov88_0223DA00(UnkStruct_02095E80 *param0) static int ov88_0223DA3C(UnkStruct_02095E80 *param0) { - UnkStruct_02081CF4 v0; + MenuTemplate v0; - v0.unk_08 = 0; - v0.unk_09 = 1; - v0.unk_0A = 3; - v0.unk_0B_0 = 0; - v0.unk_0B_4 = 0; - v0.unk_0B_6 = 0; + v0.fontID = FONT_SYSTEM; + v0.xSize = 1; + v0.ySize = 3; + v0.lineSpacing = 0; + v0.suppressCursor = FALSE; + v0.loopAround = FALSE; StringTemplate_SetNickname(param0->unk_17C, 0, Pokemon_GetBoxPokemon(Party_GetPokemonBySlotIndex(param0->unk_2270, param0->unk_88[0]))); Bg_FillTilemapRect(param0->unk_174, 0, 0, 0, 0, 32, 24, 0); ov88_0223ECBC(¶m0->unk_49C[22], 16, FONT_MESSAGE, param0->unk_184, param0->unk_17C); - param0->unk_6C0 = sub_02013A04(3, 26); + param0->unk_6C0 = StringList_New(3, 26); - sub_02013A4C(param0->unk_6C0, param0->unk_184, 17, 0); - sub_02013A4C(param0->unk_6C0, param0->unk_184, 18, 1); - sub_02013A4C(param0->unk_6C0, param0->unk_184, 19, 2); + StringList_AddFromMessageBank(param0->unk_6C0, param0->unk_184, 17, 0); + StringList_AddFromMessageBank(param0->unk_6C0, param0->unk_184, 18, 1); + StringList_AddFromMessageBank(param0->unk_6C0, param0->unk_184, 19, 2); - v0.unk_00 = param0->unk_6C0; - v0.unk_04 = ¶m0->unk_49C[24]; + v0.choices = param0->unk_6C0; + v0.window = ¶m0->unk_49C[24]; ov88_0223ED80(¶m0->unk_49C[24]); - param0->unk_6C4 = sub_02001B7C(&v0, 8, 0, 0, 26, PAD_BUTTON_B); + param0->unk_6C4 = Menu_NewAndCopyToVRAM(&v0, 8, 0, 0, 26, PAD_BUTTON_B); param0->unk_226C = ov88_0223DB48; return 0; @@ -2109,28 +2107,28 @@ static int ov88_0223DA3C(UnkStruct_02095E80 *param0) static int ov88_0223DB48(UnkStruct_02095E80 *param0) { - switch (sub_02001BE0(param0->unk_6C4)) { + switch (Menu_ProcessInput(param0->unk_6C4)) { case 0: Bg_FillTilemapRect(param0->unk_174, 0, 0, 0, 0, 32, 24, 0); ov88_0223ECBC(¶m0->unk_49C[21], 15, FONT_MESSAGE, param0->unk_184, param0->unk_178); - sub_02001BC4(param0->unk_6C4, NULL); - sub_02013A3C(param0->unk_6C0); + Menu_Free(param0->unk_6C4, NULL); + StringList_Free(param0->unk_6C0); param0->unk_226C = ov88_0223D150; return 3; break; case 1: Bg_FillTilemapRect(param0->unk_174, 0, 0, 0, 0, 32, 24, 0); ov88_0223ECBC(¶m0->unk_49C[23], 20, FONT_MESSAGE, param0->unk_184, param0->unk_178); - sub_02001BC4(param0->unk_6C4, NULL); - sub_02013A3C(param0->unk_6C0); + Menu_Free(param0->unk_6C4, NULL); + StringList_Free(param0->unk_6C0); param0->unk_226C = ov88_0223DC84; break; case 2: case 0xfffffffe: Bg_FillTilemapRect(param0->unk_174, 0, 0, 0, 0, 32, 24, 0); ov88_0223ECBC(¶m0->unk_49C[21], 15, FONT_MESSAGE, param0->unk_184, param0->unk_178); - sub_02001BC4(param0->unk_6C4, NULL); - sub_02013A3C(param0->unk_6C0); + Menu_Free(param0->unk_6C4, NULL); + StringList_Free(param0->unk_6C0); param0->unk_226C = ov88_0223D150; break; } @@ -2426,30 +2424,30 @@ static int ov88_0223E478(UnkStruct_02095E80 *param0) static int ov88_0223E4BC(UnkStruct_02095E80 *param0) { - UnkStruct_02081CF4 v0; + MenuTemplate v0; - v0.unk_08 = 0; - v0.unk_09 = 1; - v0.unk_0A = 2; - v0.unk_0B_0 = 0; - v0.unk_0B_4 = 0; - v0.unk_0B_6 = 0; + v0.fontID = FONT_SYSTEM; + v0.xSize = 1; + v0.ySize = 2; + v0.lineSpacing = 0; + v0.suppressCursor = FALSE; + v0.loopAround = FALSE; StringTemplate_SetNickname(param0->unk_17C, 0, Pokemon_GetBoxPokemon(Party_GetPokemonBySlotIndex(param0->unk_2274, param0->unk_88[0] - 6))); Bg_FillTilemapRect(param0->unk_174, 0, 0, 0, 0, 32, 24, 0); ov88_0223ECBC(¶m0->unk_49C[22], 16, FONT_MESSAGE, param0->unk_184, param0->unk_17C); - param0->unk_6C0 = sub_02013A04(2, 26); + param0->unk_6C0 = StringList_New(2, 26); - sub_02013A4C(param0->unk_6C0, param0->unk_184, 17, 0); - sub_02013A4C(param0->unk_6C0, param0->unk_184, 19, 1); + StringList_AddFromMessageBank(param0->unk_6C0, param0->unk_184, 17, 0); + StringList_AddFromMessageBank(param0->unk_6C0, param0->unk_184, 19, 1); - v0.unk_00 = param0->unk_6C0; - v0.unk_04 = ¶m0->unk_49C[25]; + v0.choices = param0->unk_6C0; + v0.window = ¶m0->unk_49C[25]; ov88_0223ED80(¶m0->unk_49C[25]); - param0->unk_6C4 = sub_02001B7C(&v0, 8, 0, 0, 26, PAD_BUTTON_B); + param0->unk_6C4 = Menu_NewAndCopyToVRAM(&v0, 8, 0, 0, 26, PAD_BUTTON_B); param0->unk_226C = ov88_0223E5B8; return 0; @@ -2457,13 +2455,13 @@ static int ov88_0223E4BC(UnkStruct_02095E80 *param0) static int ov88_0223E5B8(UnkStruct_02095E80 *param0) { - switch (sub_02001BE0(param0->unk_6C4)) { + switch (Menu_ProcessInput(param0->unk_6C4)) { case 0: Bg_FillTilemapRect(param0->unk_174, 0, 0, 0, 0, 32, 24, 0); ov88_0223ECBC(¶m0->unk_49C[21], 15, FONT_MESSAGE, param0->unk_184, param0->unk_178); param0->unk_226C = ov88_0223D150; - sub_02001BC4(param0->unk_6C4, NULL); - sub_02013A3C(param0->unk_6C0); + Menu_Free(param0->unk_6C4, NULL); + StringList_Free(param0->unk_6C0); return 3; break; @@ -2471,8 +2469,8 @@ static int ov88_0223E5B8(UnkStruct_02095E80 *param0) case 0xfffffffe: Bg_FillTilemapRect(param0->unk_174, 0, 0, 0, 0, 32, 24, 0); ov88_0223ECBC(¶m0->unk_49C[21], 15, FONT_MESSAGE, param0->unk_184, param0->unk_178); - sub_02001BC4(param0->unk_6C4, NULL); - sub_02013A3C(param0->unk_6C0); + Menu_Free(param0->unk_6C4, NULL); + StringList_Free(param0->unk_6C0); param0->unk_226C = ov88_0223D150; break; } diff --git a/src/overlay088/ov88_0223E9C4.c b/src/overlay088/ov88_0223E9C4.c index 80242916ca..4720878119 100644 --- a/src/overlay088/ov88_0223E9C4.c +++ b/src/overlay088/ov88_0223E9C4.c @@ -3,26 +3,20 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" -#include "struct_decls/struct_02013A04_decl.h" -#include "struct_defs/struct_02013A04_t.h" - -#include "overlay084/struct_ov84_02240FA8.h" - #include "bg_window.h" #include "font.h" #include "game_options.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "message_util.h" #include "strbuf.h" +#include "string_list.h" #include "text.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200DA60.h" -static void ov88_0223EE14(BmpList *param0, u32 param1, u8 param2); +static void ov88_0223EE14(ListMenu *param0, u32 param1, u8 param2); static const u16 Unk_ov88_0223F1A8[][5] = { { 0x4, 0x1, 0x9, 0x2, 0x1 }, @@ -160,17 +154,17 @@ static const WindowTemplate Unk_ov88_0223F148 = { 0x112 }; -u32 ov88_0223ED2C(BgConfig *param0, UIControlData **param1, int *param2) +u32 ov88_0223ED2C(BgConfig *param0, Menu **param1, int *param2) { u32 v0 = 0xffffffff; switch (*param2) { case 0: - *param1 = sub_02002100(param0, &Unk_ov88_0223F148, (512 - 9), 11, 26); + *param1 = Menu_MakeYesNoChoice(param0, &Unk_ov88_0223F148, (512 - 9), 11, 26); (*param2)++; break; case 1: - v0 = sub_02002114(*param1, 26); + v0 = Menu_ProcessInputAndHandleExit(*param1, 26); if (v0 != 0xffffffff) { (*param2) = 0; @@ -185,7 +179,7 @@ void ov88_0223ED80(Window *param0) Window_Show(param0, 0, (512 - 9), 11); } -static const UnkStruct_ov84_02240FA8 Unk_ov88_0223F150 = { +static const ListMenuTemplate Unk_ov88_0223F150 = { NULL, NULL, NULL, @@ -207,27 +201,27 @@ static const UnkStruct_ov84_02240FA8 Unk_ov88_0223F150 = { NULL }; -BmpList *ov88_0223ED94(ResourceMetadata *param0, int param1, Window *param2, BgConfig *param3) +ListMenu *ov88_0223ED94(StringList *param0, int param1, Window *param2, BgConfig *param3) { - BmpList *v0; - UnkStruct_ov84_02240FA8 v1; + ListMenu *v0; + ListMenuTemplate v1; int v2 = 5; Window_Add(param3, param2, 0, 19, 1, 12, v2 * 2, 13, (512 - (9 + (18 + 12))) - (10 * (v2 + 2) * 2)); Window_Show(param2, 0, (512 - 9), 11); v1 = Unk_ov88_0223F150; - v1.unk_10 = param1 + 1; - v1.unk_12 = v2; - v1.unk_00 = param0; - v1.unk_0C = param2; - v1.unk_04 = ov88_0223EE14; - v0 = sub_0200112C(&v1, 0, 0, 26); + v1.count = param1 + 1; + v1.maxDisplay = v2; + v1.choices = param0; + v1.window = param2; + v1.cursorCallback = ov88_0223EE14; + v0 = ListMenu_New(&v1, 0, 0, 26); return v0; } -static void ov88_0223EE14(BmpList *param0, u32 param1, u8 param2) +static void ov88_0223EE14(ListMenu *param0, u32 param1, u8 param2) { if (param2 == 0) { Sound_PlayEffect(1500); diff --git a/src/overlay091/ov91_021D0D80.c b/src/overlay091/ov91_021D0D80.c index 63bdb619e3..b950bc9c5c 100644 --- a/src/overlay091/ov91_021D0D80.c +++ b/src/overlay091/ov91_021D0D80.c @@ -3,19 +3,14 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_0200C6E4_decl.h" #include "struct_decls/struct_0200C704_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_defs/pokemon_summary.h" #include "struct_defs/sprite_template.h" #include "struct_defs/struct_0200D0F4.h" -#include "struct_defs/struct_02013A04_t.h" #include "struct_defs/struct_020997B8.h" #include "struct_defs/struct_02099F80.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "overlay104/struct_ov104_022412F4.h" #include "overlay104/struct_ov104_02241308.h" #include "overlay104/struct_ov104_0224133C.h" @@ -28,6 +23,8 @@ #include "graphics.h" #include "gx_layers.h" #include "heap.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "move_table.h" #include "narc.h" @@ -36,15 +33,13 @@ #include "pokemon_summary_app.h" #include "render_text.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200C6E4.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" -#include "unk_02013A04.h" #include "unk_02017728.h" #include "unk_0201DBEC.h" #include "unk_0207C908.h" @@ -60,9 +55,9 @@ typedef struct { MessageLoader *unk_F8; StringTemplate *unk_FC; Strbuf *unk_100; - BmpList *unk_104; - ResourceMetadata *unk_108; - UIControlData *unk_10C; + ListMenu *unk_104; + StringList *unk_108; + Menu *unk_10C; SpriteRenderer *unk_110; SpriteGfxHandler *unk_114; CellActorData *unk_118[13]; @@ -109,8 +104,8 @@ static void ov91_021D1498(UnkStruct_ov91_021D0ED8 *param0); static void ov91_021D1664(UnkStruct_ov91_021D0ED8 *param0); static void ov91_021D1784(UnkStruct_ov91_021D0ED8 *param0); static void ov91_021D1868(UnkStruct_ov91_021D0ED8 *param0); -static void ov91_021D188C(BmpList *param0, u32 param1, u8 param2); -static void ov91_021D18C4(BmpList *param0, u32 param1, u8 param2); +static void ov91_021D188C(ListMenu *param0, u32 param1, u8 param2); +static void ov91_021D18C4(ListMenu *param0, u32 param1, u8 param2); static void ov91_021D18C8(UnkStruct_ov91_021D0ED8 *param0, u32 param1); static void ov91_021D1A68(UnkStruct_ov91_021D0ED8 *param0, u32 param1); static void ov91_021D1BBC(UnkStruct_ov91_021D0ED8 *param0, u16 param1); @@ -159,7 +154,7 @@ static const WindowTemplate Unk_ov91_021D2884[] = { { 0x0, 0x17, 0xD, 0x7, 0x4, 0xE, 0x2A6 } }; -static const UnkStruct_ov84_02240FA8 Unk_ov91_021D27BC = { +static const ListMenuTemplate Unk_ov91_021D27BC = { NULL, ov91_021D188C, ov91_021D18C4, @@ -670,9 +665,9 @@ static int ov91_021D122C(UnkStruct_ov91_021D0ED8 *param0) return 1; } - sub_020014DC(param0->unk_104, &v1, &v2); - v0 = sub_02001288(param0->unk_104); - sub_020014DC(param0->unk_104, ¶m0->unk_00->unk_12, ¶m0->unk_00->unk_10); + ListMenu_GetListAndCursorPos(param0->unk_104, &v1, &v2); + v0 = ListMenu_ProcessInput(param0->unk_104); + ListMenu_GetListAndCursorPos(param0->unk_104, ¶m0->unk_00->unk_12, ¶m0->unk_00->unk_10); ov91_021D237C(param0, v1, param0->unk_00->unk_12); if (param0->unk_00->unk_10 != v2) { @@ -724,13 +719,13 @@ static int ov91_021D134C(UnkStruct_ov91_021D0ED8 *param0) static int ov91_021D136C(UnkStruct_ov91_021D0ED8 *param0) { - param0->unk_10C = sub_02002100(param0->unk_04, &Unk_ov91_021D2884[14], 1, 12, 67); + param0->unk_10C = Menu_MakeYesNoChoice(param0->unk_04, &Unk_ov91_021D2884[14], 1, 12, 67); return 4; } static int ov91_021D1394(UnkStruct_ov91_021D0ED8 *param0) { - switch (sub_02002114(param0->unk_10C, 67)) { + switch (Menu_ProcessInputAndHandleExit(param0->unk_10C, 67)) { case 0: return Unk_ov91_021D27DC[param0->unk_186].unk_00(param0); case 0xfffffffe: @@ -907,21 +902,21 @@ static u32 ov91_021D175C(UnkStruct_ov91_021D0ED8 *param0) static void ov91_021D1784(UnkStruct_ov91_021D0ED8 *param0) { MessageLoader *v0; - UnkStruct_ov84_02240FA8 v1; + ListMenuTemplate v1; u32 v2; param0->unk_184 = (u8)ov91_021D175C(param0) + 1; - param0->unk_108 = sub_02013A04(param0->unk_184, 67); + param0->unk_108 = StringList_New(param0->unk_184, 67); v0 = MessageLoader_Init( 0, 26, 647, 67); for (v2 = 0; v2 < param0->unk_184; v2++) { if (param0->unk_00->unk_0C[v2] != 0xffff) { - sub_02013A4C( + StringList_AddFromMessageBank( param0->unk_108, v0, param0->unk_00->unk_0C[v2], param0->unk_00->unk_0C[v2]); } else { - sub_02013A4C( + StringList_AddFromMessageBank( param0->unk_108, param0->unk_F8, 32, 0xfffffffe); break; } @@ -930,25 +925,25 @@ static void ov91_021D1784(UnkStruct_ov91_021D0ED8 *param0) MessageLoader_Free(v0); v1 = Unk_ov91_021D27BC; - v1.unk_00 = param0->unk_108; - v1.unk_0C = ¶m0->unk_08[13]; - v1.unk_10 = param0->unk_184; - v1.unk_1C = (void *)param0; + v1.choices = param0->unk_108; + v1.window = ¶m0->unk_08[13]; + v1.count = param0->unk_184; + v1.tmp = (void *)param0; - param0->unk_104 = sub_0200112C(&v1, param0->unk_00->unk_12, param0->unk_00->unk_10, 67); + param0->unk_104 = ListMenu_New(&v1, param0->unk_00->unk_12, param0->unk_00->unk_10, 67); Window_ScheduleCopyToVRAM(¶m0->unk_08[13]); } static void ov91_021D1868(UnkStruct_ov91_021D0ED8 *param0) { - sub_02001384(param0->unk_104, ¶m0->unk_00->unk_12, ¶m0->unk_00->unk_10); - sub_02013A3C(param0->unk_108); + ListMenu_Free(param0->unk_104, ¶m0->unk_00->unk_12, ¶m0->unk_00->unk_10); + StringList_Free(param0->unk_108); } -static void ov91_021D188C(BmpList *param0, u32 param1, u8 param2) +static void ov91_021D188C(ListMenu *param0, u32 param1, u8 param2) { - UnkStruct_ov91_021D0ED8 *v0 = (UnkStruct_ov91_021D0ED8 *)sub_02001504(param0, 19); + UnkStruct_ov91_021D0ED8 *v0 = (UnkStruct_ov91_021D0ED8 *)ListMenu_GetAttribute(param0, 19); if (param2 != 1) { Sound_PlayEffect(1501); @@ -961,7 +956,7 @@ static void ov91_021D188C(BmpList *param0, u32 param1, u8 param2) } } -static void ov91_021D18C4(BmpList *param0, u32 param1, u8 param2) +static void ov91_021D18C4(ListMenu *param0, u32 param1, u8 param2) { return; } diff --git a/src/overlay092/ov92_021D0D80.c b/src/overlay092/ov92_021D0D80.c index 2e0c2c7716..7d555fa43f 100644 --- a/src/overlay092/ov92_021D0D80.c +++ b/src/overlay092/ov92_021D0D80.c @@ -3,14 +3,9 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_0202C878_decl.h" -#include "struct_defs/struct_02013A04_t.h" #include "struct_defs/struct_02099F80.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "overlay092/struct_ov92_021D28C0.h" #include "overlay115/camera_angle.h" @@ -23,6 +18,8 @@ #include "graphics.h" #include "gx_layers.h" #include "heap.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "overlay_manager.h" @@ -30,14 +27,12 @@ #include "save_player.h" #include "savedata.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" -#include "unk_02013A04.h" #include "unk_02017728.h" #include "unk_0201D15C.h" #include "unk_0202419C.h" @@ -79,9 +74,9 @@ typedef struct { Window unk_B824; Window unk_B834; Window unk_B844; - BmpList *unk_B854; - ResourceMetadata *unk_B858; - UIControlData *unk_B85C; + ListMenu *unk_B854; + StringList *unk_B858; + Menu *unk_B85C; MessageLoader *unk_B860; int unk_B864; int unk_B868; @@ -142,8 +137,8 @@ static int ov92_021D16F8(int param0); static void ov92_021D1700(UnkStruct_ov92_021D1B24 *param0); static void ov92_021D1818(int param0, int param1, int *param2, int *param3, int *param4, int *param5); static BOOL ov92_021D1B70(UnkStruct_ov92_021D1B24 *param0, u32 param1, int param2); -static void ov92_021D1C4C(UnkStruct_ov92_021D1B24 *param0, Window *param1, const WindowTemplate *param2, const UnkStruct_ov84_02240FA8 *param3, const UnkStruct_ov92_021D2958 *param4); -static void ov92_021D1CF4(UnkStruct_ov92_021D1B24 *param0, Window *param1, const WindowTemplate *param2, const UnkStruct_ov84_02240FA8 *param3, u32 param4, const u8 *param5, u32 param6); +static void ov92_021D1C4C(UnkStruct_ov92_021D1B24 *param0, Window *param1, const WindowTemplate *param2, const ListMenuTemplate *param3, const UnkStruct_ov92_021D2958 *param4); +static void ov92_021D1CF4(UnkStruct_ov92_021D1B24 *param0, Window *param1, const WindowTemplate *param2, const ListMenuTemplate *param3, u32 param4, const u8 *param5, u32 param6); static void ov92_021D1DB4(UnkStruct_ov92_021D1B24 *param0); static void ov92_021D1DEC(UnkStruct_ov92_021D1B24 *param0); static void ov92_021D1EBC(UnkStruct_ov92_021D1B24 *param0, int param1, int param2); @@ -261,7 +256,7 @@ static const UnkStruct_ov92_021D2958 Unk_ov92_021D2958[] = { { 0xC, 0x2 } }; -static const UnkStruct_ov84_02240FA8 Unk_ov92_021D29A8 = { +static const ListMenuTemplate Unk_ov92_021D29A8 = { NULL, NULL, NULL, @@ -282,7 +277,7 @@ static const UnkStruct_ov84_02240FA8 Unk_ov92_021D29A8 = { 0x0 }; -static const UnkStruct_ov84_02240FA8 Unk_ov92_021D29C8 = { +static const ListMenuTemplate Unk_ov92_021D29C8 = { NULL, NULL, NULL, @@ -409,7 +404,7 @@ int ov92_021D0EB8(OverlayManager *param0, int *param1) } break; case 4: { - int v3 = sub_02001288(v0->unk_B854); + int v3 = ListMenu_ProcessInput(v0->unk_B854); if (v3 == 0xffffffff) { break; @@ -434,12 +429,12 @@ int ov92_021D0EB8(OverlayManager *param0, int *param1) } break; case 5: if (ov92_021D1B70(v0, 2, 1) == 1) { - v0->unk_B85C = sub_02002100(v0->unk_B810, &Unk_ov92_021D292C, ((512 - (18 + 12)) - 9), 7, v0->unk_00); + v0->unk_B85C = Menu_MakeYesNoChoice(v0->unk_B810, &Unk_ov92_021D292C, ((512 - (18 + 12)) - 9), 7, v0->unk_00); *param1 = 6; } break; case 6: { - u32 v4 = sub_02002114(v0->unk_B85C, v0->unk_00); + u32 v4 = Menu_ProcessInputAndHandleExit(v0->unk_B85C, v0->unk_00); switch (v4) { case 0: @@ -464,7 +459,7 @@ int ov92_021D0EB8(OverlayManager *param0, int *param1) } break; case 8: { - int v5 = sub_02001288(v0->unk_B854); + int v5 = ListMenu_ProcessInput(v0->unk_B854); if (v5 == 0xffffffff) { break; @@ -506,7 +501,7 @@ int ov92_021D0EB8(OverlayManager *param0, int *param1) } break; case 10: { - int v7 = sub_02001288(v0->unk_B854); + int v7 = ListMenu_ProcessInput(v0->unk_B854); if (v7 == 0xffffffff) { break; @@ -539,12 +534,12 @@ int ov92_021D0EB8(OverlayManager *param0, int *param1) break; case 12: if (ov92_021D1B70(v0, 5, 1) == 1) { - v0->unk_B85C = sub_02002100(v0->unk_B810, &Unk_ov92_021D292C, ((512 - (18 + 12)) - 9), 7, v0->unk_00); + v0->unk_B85C = Menu_MakeYesNoChoice(v0->unk_B810, &Unk_ov92_021D292C, ((512 - (18 + 12)) - 9), 7, v0->unk_00); *param1 = 13; } break; case 13: { - u32 v9 = sub_02002114(v0->unk_B85C, v0->unk_00); + u32 v9 = Menu_ProcessInputAndHandleExit(v0->unk_B85C, v0->unk_00); switch (v9) { case 0: @@ -1014,60 +1009,60 @@ static BOOL ov92_021D1B70(UnkStruct_ov92_021D1B24 *param0, u32 param1, int param return v0; } -static void ov92_021D1C38(BmpList *param0, u32 param1, u8 param2) +static void ov92_021D1C38(ListMenu *param0, u32 param1, u8 param2) { if (param2 == 0) { Sound_PlayEffect(1500); } } -static void ov92_021D1C4C(UnkStruct_ov92_021D1B24 *param0, Window *param1, const WindowTemplate *param2, const UnkStruct_ov84_02240FA8 *param3, const UnkStruct_ov92_021D2958 *param4) +static void ov92_021D1C4C(UnkStruct_ov92_021D1B24 *param0, Window *param1, const WindowTemplate *param2, const ListMenuTemplate *param3, const UnkStruct_ov92_021D2958 *param4) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; int v1; Window_AddFromTemplate(param0->unk_B810, param1, param2); - param0->unk_B858 = sub_02013A04(param3->unk_10, param0->unk_00); + param0->unk_B858 = StringList_New(param3->count, param0->unk_00); - for (v1 = 0; v1 < param3->unk_10; v1++) { - sub_02013A4C(param0->unk_B858, param0->unk_B860, param4[v1].unk_00, param4[v1].unk_04); + for (v1 = 0; v1 < param3->count; v1++) { + StringList_AddFromMessageBank(param0->unk_B858, param0->unk_B860, param4[v1].unk_00, param4[v1].unk_04); } v0 = *param3; - v0.unk_00 = param0->unk_B858; - v0.unk_0C = param1; - v0.unk_04 = ov92_021D1C38; - param0->unk_B854 = sub_0200112C(&v0, 0, 0, param0->unk_00); + v0.choices = param0->unk_B858; + v0.window = param1; + v0.cursorCallback = ov92_021D1C38; + param0->unk_B854 = ListMenu_New(&v0, 0, 0, param0->unk_00); - Window_Show(v0.unk_0C, 1, ((512 - (18 + 12)) - 9), 7); + Window_Show(v0.window, 1, ((512 - (18 + 12)) - 9), 7); Window_CopyToVRAM(param1); } -static void ov92_021D1CF4(UnkStruct_ov92_021D1B24 *param0, Window *param1, const WindowTemplate *param2, const UnkStruct_ov84_02240FA8 *param3, u32 param4, const u8 *param5, u32 param6) +static void ov92_021D1CF4(UnkStruct_ov92_021D1B24 *param0, Window *param1, const WindowTemplate *param2, const ListMenuTemplate *param3, u32 param4, const u8 *param5, u32 param6) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; MessageLoader *v1; int v2; Window_AddFromTemplate(param0->unk_B810, param1, param2); v1 = MessageLoader_Init(0, 26, param4, param0->unk_00); - param0->unk_B858 = sub_02013A04(param6, param0->unk_00); + param0->unk_B858 = StringList_New(param6, param0->unk_00); for (v2 = 0; v2 < param6; v2++) { - sub_02013A4C(param0->unk_B858, v1, param5[v2], v2); + StringList_AddFromMessageBank(param0->unk_B858, v1, param5[v2], v2); } MessageLoader_Free(v1); v0 = *param3; - v0.unk_00 = param0->unk_B858; - v0.unk_10 = param6; - v0.unk_0C = param1; - v0.unk_04 = ov92_021D1C38; + v0.choices = param0->unk_B858; + v0.count = param6; + v0.window = param1; + v0.cursorCallback = ov92_021D1C38; - param0->unk_B854 = sub_0200112C(&v0, 0, 0, param0->unk_00); + param0->unk_B854 = ListMenu_New(&v0, 0, 0, param0->unk_00); - Window_Show(v0.unk_0C, 1, ((512 - (18 + 12)) - 9), 7); + Window_Show(v0.window, 1, ((512 - (18 + 12)) - 9), 7); Window_CopyToVRAM(param1); } @@ -1075,8 +1070,8 @@ static void ov92_021D1DB4(UnkStruct_ov92_021D1B24 *param0) { Window_Clear(¶m0->unk_B824, 0); Window_Remove(¶m0->unk_B824); - sub_02001384(param0->unk_B854, NULL, NULL); - sub_02013A3C(param0->unk_B858); + ListMenu_Free(param0->unk_B854, NULL, NULL); + StringList_Free(param0->unk_B858); } static void ov92_021D1DEC(UnkStruct_ov92_021D1B24 *param0) diff --git a/src/overlay094/ov94_0223BCB0.c b/src/overlay094/ov94_0223BCB0.c index 979696b2d8..8b87b8c765 100644 --- a/src/overlay094/ov94_0223BCB0.c +++ b/src/overlay094/ov94_0223BCB0.c @@ -4,7 +4,6 @@ #include #include -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_defs/struct_0203E0FC.h" #include "struct_defs/struct_02099F80.h" @@ -30,6 +29,7 @@ #include "gx_layers.h" #include "heap.h" #include "inlines.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "overlay_manager.h" @@ -37,7 +37,6 @@ #include "sprite_resource.h" #include "string_template.h" #include "trainer_info.h" -#include "unk_02001AF4.h" #include "unk_020041CC.h" #include "unk_020093B4.h" #include "unk_0200A328.h" @@ -407,7 +406,7 @@ static const WindowTemplate Unk_ov94_022459F8 = { 0x0 }; -UIControlData *ov94_0223C3C0(BgConfig *param0, int param1, int param2) +Menu *ov94_0223C3C0(BgConfig *param0, int param1, int param2) { WindowTemplate v0; @@ -415,7 +414,7 @@ UIControlData *ov94_0223C3C0(BgConfig *param0, int param1, int param2) v0.tilemapTop = param1; v0.baseTile = param2; - return sub_02002100(param0, &v0, (1 + (18 + 12)), 11, 62); + return Menu_MakeYesNoChoice(param0, &v0, (1 + (18 + 12)), 11, 62); } void ov94_0223C3F4(UnkStruct_ov94_0223FD4C *param0, int param1, int param2) diff --git a/src/overlay094/ov94_0223C610.c b/src/overlay094/ov94_0223C610.c index 7246876028..b4d7660bcc 100644 --- a/src/overlay094/ov94_0223C610.c +++ b/src/overlay094/ov94_0223C610.c @@ -16,12 +16,12 @@ #include "game_options.h" #include "graphics.h" #include "gx_layers.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "strbuf.h" #include "text.h" #include "trainer_info.h" -#include "unk_02001AF4.h" #include "unk_020041CC.h" #include "unk_02005474.h" #include "unk_0200DA60.h" @@ -520,7 +520,7 @@ static int ov94_0223CE5C(UnkStruct_ov94_0223FD4C *param0) static int ov94_0223CE7C(UnkStruct_ov94_0223FD4C *param0) { - int v0 = sub_02002114(param0->unk_10D0, 62); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_10D0, 62); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { diff --git a/src/overlay094/ov94_0223D0C4.c b/src/overlay094/ov94_0223D0C4.c index 5e3b01ae85..02f05fd028 100644 --- a/src/overlay094/ov94_0223D0C4.c +++ b/src/overlay094/ov94_0223D0C4.c @@ -5,7 +5,6 @@ #include #include "struct_defs/archived_sprite.h" -#include "struct_defs/struct_02081CF4.h" #include "overlay094/const_ov94_02245FD8.h" #include "overlay094/ov94_0223BCB0.h" @@ -23,20 +22,20 @@ #include "graphics.h" #include "heap.h" #include "item.h" +#include "menu.h" #include "message.h" #include "message_util.h" #include "narc.h" #include "party.h" #include "pokemon.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" #include "unk_020131EC.h" -#include "unk_02013A04.h" #include "unk_020393C8.h" static void ov94_0223D1D4(BgConfig *param0); @@ -382,7 +381,7 @@ static int ov94_0223D640(UnkStruct_ov94_0223FD4C *param0) static int ov94_0223D664(UnkStruct_ov94_0223FD4C *param0) { - int v0 = sub_02002114(param0->unk_10D0, 62); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_10D0, 62); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { @@ -402,26 +401,26 @@ static int ov94_0223D664(UnkStruct_ov94_0223FD4C *param0) static int ov94_0223D6B8(UnkStruct_ov94_0223FD4C *param0) { - UnkStruct_02081CF4 v0; + MenuTemplate v0; - v0.unk_08 = 0; - v0.unk_09 = 1; - v0.unk_0A = 2; - v0.unk_0B_0 = 0; - v0.unk_0B_4 = 0; - v0.unk_0B_6 = 0; + v0.fontID = FONT_SYSTEM; + v0.xSize = 1; + v0.ySize = 2; + v0.lineSpacing = 0; + v0.suppressCursor = FALSE; + v0.loopAround = FALSE; - param0->unk_10CC = sub_02013A04(2, 62); + param0->unk_10CC = StringList_New(2, 62); - sub_02013A4C(param0->unk_10CC, param0->unk_B90, 54, 1); - sub_02013A4C(param0->unk_10CC, param0->unk_B90, 55, 2); + StringList_AddFromMessageBank(param0->unk_10CC, param0->unk_B90, 54, 1); + StringList_AddFromMessageBank(param0->unk_10CC, param0->unk_B90, 55, 2); - v0.unk_00 = param0->unk_10CC; - v0.unk_04 = ¶m0->unk_F9C[0]; + v0.choices = param0->unk_10CC; + v0.window = ¶m0->unk_F9C[0]; Window_Show(¶m0->unk_F9C[0], 0, (1 + (18 + 12)), 11); - param0->unk_10D4 = sub_02001B7C(&v0, 9, 0, 0, 62, PAD_BUTTON_B); + param0->unk_10D4 = Menu_NewAndCopyToVRAM(&v0, 9, 0, 0, 62, PAD_BUTTON_B); param0->unk_2C = 8; return 3; @@ -429,10 +428,10 @@ static int ov94_0223D6B8(UnkStruct_ov94_0223FD4C *param0) static int ov94_0223D754(UnkStruct_ov94_0223FD4C *param0) { - switch (sub_02001BE0(param0->unk_10D4)) { + switch (Menu_ProcessInput(param0->unk_10D4)) { case 1: - sub_02001BC4(param0->unk_10D4, NULL); - sub_02013A3C(param0->unk_10CC); + Menu_Free(param0->unk_10D4, NULL); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[0], 0); { @@ -454,8 +453,8 @@ static int ov94_0223D754(UnkStruct_ov94_0223FD4C *param0) break; case 2: case 0xfffffffe: - sub_02001BC4(param0->unk_10D4, NULL); - sub_02013A3C(param0->unk_10CC); + Menu_Free(param0->unk_10D4, NULL); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[0], 0); param0->unk_2C = 2; diff --git a/src/overlay094/ov94_0223DC04.c b/src/overlay094/ov94_0223DC04.c index 6be2d0712a..3ee50ea416 100644 --- a/src/overlay094/ov94_0223DC04.c +++ b/src/overlay094/ov94_0223DC04.c @@ -19,13 +19,13 @@ #include "font.h" #include "game_options.h" #include "graphics.h" +#include "menu.h" #include "message.h" #include "message_util.h" #include "pokemon.h" #include "strbuf.h" #include "string_template.h" #include "text.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" @@ -379,7 +379,7 @@ static int ov94_0223E1B0(UnkStruct_ov94_0223FD4C *param0) static int ov94_0223E1D0(UnkStruct_ov94_0223FD4C *param0) { - int v0 = sub_02002114(param0->unk_10D0, 62); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_10D0, 62); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { diff --git a/src/overlay094/ov94_0223E46C.c b/src/overlay094/ov94_0223E46C.c index ccd46cebfd..efa99c0388 100644 --- a/src/overlay094/ov94_0223E46C.c +++ b/src/overlay094/ov94_0223E46C.c @@ -23,17 +23,17 @@ #include "graphics.h" #include "heap.h" #include "inlines.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "pokemon.h" #include "strbuf.h" +#include "string_list.h" #include "text.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" -#include "unk_02013A04.h" #include "unk_0202DA40.h" #include "unk_020366A0.h" #include "unk_020393C8.h" @@ -775,14 +775,14 @@ static int ov94_0223F190(UnkStruct_ov94_0223FD4C *param0) case 7: case 8: case 9: - sub_02001384(param0->unk_10D8, ¶m0->unk_10E4->unk_06, ¶m0->unk_10E4->unk_04); - sub_02013A3C(param0->unk_10CC); + ListMenu_Free(param0->unk_10D8, ¶m0->unk_10E4->unk_06, ¶m0->unk_10E4->unk_04); + StringList_Free(param0->unk_10CC); Sound_PlayEffect(1500); param0->unk_2C = 6; break; case 0xfffffffe: - sub_02001384(param0->unk_10D8, ¶m0->unk_10E4->unk_06, ¶m0->unk_10E4->unk_04); - sub_02013A3C(param0->unk_10CC); + ListMenu_Free(param0->unk_10D8, ¶m0->unk_10E4->unk_06, ¶m0->unk_10E4->unk_04); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[0], 0); sub_0200E084(¶m0->unk_F5C, 0); Window_Remove(¶m0->unk_F9C[0]); @@ -812,16 +812,16 @@ static int ov94_0223F2B0(UnkStruct_ov94_0223FD4C *param0) case 0xffffffff: break; case 0xfffffffe: - sub_02001384(param0->unk_10D8, ¶m0->unk_10E4->unk_0A, ¶m0->unk_10E4->unk_08); - sub_02013A3C(param0->unk_10CC); + ListMenu_Free(param0->unk_10D8, ¶m0->unk_10E4->unk_0A, ¶m0->unk_10E4->unk_08); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[1], 0); Sound_PlayEffect(1500); param0->unk_2C = 4; ov94_02242AC4(¶m0->unk_111C, param0->unk_10E4->unk_06 + param0->unk_10E4->unk_04, param0->unk_10E4->unk_0A, param0->unk_10E4->unk_08); break; default: - sub_02001384(param0->unk_10D8, ¶m0->unk_10E4->unk_0A, ¶m0->unk_10E4->unk_08); - sub_02013A3C(param0->unk_10CC); + ListMenu_Free(param0->unk_10D8, ¶m0->unk_10E4->unk_0A, ¶m0->unk_10E4->unk_08); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[0], 0); Window_Clear(¶m0->unk_F9C[1], 0); Window_Remove(¶m0->unk_F9C[0]); @@ -873,8 +873,8 @@ static int ov94_0223F4B0(UnkStruct_ov94_0223FD4C *param0) switch (v0 = ov94_02242A6C(param0->unk_10D8, ¶m0->unk_108)) { case 0xfffffffe: - sub_02001384(param0->unk_10D8, NULL, NULL); - sub_02013A3C(param0->unk_10CC); + ListMenu_Free(param0->unk_10D8, NULL, NULL); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[0], 0); sub_0200E084(¶m0->unk_F5C, 0); Window_Remove(¶m0->unk_F9C[0]); @@ -884,8 +884,8 @@ static int ov94_0223F4B0(UnkStruct_ov94_0223FD4C *param0) case 0: case 1: case 2: - sub_02001384(param0->unk_10D8, NULL, NULL); - sub_02013A3C(param0->unk_10CC); + ListMenu_Free(param0->unk_10D8, NULL, NULL); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[0], 0); Window_Remove(¶m0->unk_F9C[0]); Sound_PlayEffect(1500); @@ -930,8 +930,8 @@ static int ov94_0223F638(UnkStruct_ov94_0223FD4C *param0) break; case 0xfffffffe: case 11: - sub_02001384(param0->unk_10D8, NULL, NULL); - sub_02013A3C(param0->unk_10CC); + ListMenu_Free(param0->unk_10D8, NULL, NULL); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[0], 0); sub_0200E084(¶m0->unk_F5C, 0); Window_Remove(¶m0->unk_F9C[0]); @@ -939,8 +939,8 @@ static int ov94_0223F638(UnkStruct_ov94_0223FD4C *param0) param0->unk_2C = 0; break; default: - sub_02001384(param0->unk_10D8, NULL, NULL); - sub_02013A3C(param0->unk_10CC); + ListMenu_Free(param0->unk_10D8, NULL, NULL); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[0], 0); Window_Remove(¶m0->unk_F9C[0]); Sound_PlayEffect(1500); @@ -985,16 +985,16 @@ static int ov94_0223F7C0(UnkStruct_ov94_0223FD4C *param0) if (v0 == 0xffffffff) { (void)0; } else if ((v0 == 0xfffffffe) || (v0 == (Unk_ov94_02245FD4 + 1))) { - sub_02001384(param0->unk_10D8, NULL, NULL); - sub_02013A3C(param0->unk_10CC); + ListMenu_Free(param0->unk_10D8, NULL, NULL); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[0], 0); sub_0200E084(¶m0->unk_F5C, 0); Window_Remove(¶m0->unk_F9C[0]); Sound_PlayEffect(1500); param0->unk_2C = 0; } else { - sub_02001384(param0->unk_10D8, NULL, NULL); - sub_02013A3C(param0->unk_10CC); + ListMenu_Free(param0->unk_10D8, NULL, NULL); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[0], 0); Window_Remove(¶m0->unk_F9C[0]); Sound_PlayEffect(1500); @@ -1018,7 +1018,7 @@ static int ov94_0223F8B4(UnkStruct_ov94_0223FD4C *param0) static int ov94_0223F8D8(UnkStruct_ov94_0223FD4C *param0) { - int v0 = sub_02002114(param0->unk_10D0, 62); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_10D0, 62); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { diff --git a/src/overlay094/ov94_0223FB48.c b/src/overlay094/ov94_0223FB48.c index 8b2e0f476e..e96588a680 100644 --- a/src/overlay094/ov94_0223FB48.c +++ b/src/overlay094/ov94_0223FB48.c @@ -6,7 +6,6 @@ #include "struct_decls/struct_020797DC_decl.h" #include "struct_decls/struct_party_decl.h" -#include "struct_defs/struct_02081CF4.h" #include "overlay094/ov94_0223BCB0.h" #include "overlay094/ov94_022414B8.h" @@ -26,19 +25,19 @@ #include "gx_layers.h" #include "heap.h" #include "item.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "party.h" #include "pokemon.h" #include "pokemon_icon.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" -#include "unk_02013A04.h" #include "unk_020393C8.h" #include "unk_020797C8.h" @@ -675,27 +674,27 @@ static int ov94_022405CC(int param0, int param1, int param2) static int ov94_022405DC(UnkStruct_ov94_0223FD4C *param0) { - UnkStruct_02081CF4 v0; + MenuTemplate v0; - v0.unk_08 = 0; - v0.unk_09 = 1; - v0.unk_0A = 3; - v0.unk_0B_0 = 0; - v0.unk_0B_4 = 0; - v0.unk_0B_6 = 0; + v0.fontID = FONT_SYSTEM; + v0.xSize = 1; + v0.ySize = 3; + v0.lineSpacing = 0; + v0.suppressCursor = FALSE; + v0.loopAround = FALSE; - param0->unk_10CC = sub_02013A04(3, 62); + param0->unk_10CC = StringList_New(3, 62); - sub_02013A4C(param0->unk_10CC, param0->unk_B90, 94, 1); - sub_02013A4C(param0->unk_10CC, param0->unk_B90, 95, 2); - sub_02013A4C(param0->unk_10CC, param0->unk_B90, 96, 3); + StringList_AddFromMessageBank(param0->unk_10CC, param0->unk_B90, 94, 1); + StringList_AddFromMessageBank(param0->unk_10CC, param0->unk_B90, 95, 2); + StringList_AddFromMessageBank(param0->unk_10CC, param0->unk_B90, 96, 3); - v0.unk_00 = param0->unk_10CC; - v0.unk_04 = ¶m0->unk_F9C[0]; + v0.choices = param0->unk_10CC; + v0.window = ¶m0->unk_F9C[0]; Window_Show(¶m0->unk_F9C[0], 1, (1 + (18 + 12)), 11); - param0->unk_10D4 = sub_02001B7C(&v0, 9, 0, 0, 62, PAD_BUTTON_B); + param0->unk_10D4 = Menu_NewAndCopyToVRAM(&v0, 9, 0, 0, 62, PAD_BUTTON_B); param0->unk_2C = 8; return 3; @@ -705,17 +704,17 @@ static int ov94_02240688(UnkStruct_ov94_0223FD4C *param0) { BoxPokemon *v0; - switch (sub_02001BE0(param0->unk_10D4)) { + switch (Menu_ProcessInput(param0->unk_10D4)) { case 1: - sub_02001BC4(param0->unk_10D4, NULL); - sub_02013A3C(param0->unk_10CC); + Menu_Free(param0->unk_10D4, NULL); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[0], 0); param0->unk_2C = 2; ov94_0223C4C0(param0, 8, 5); break; case 2: - sub_02001BC4(param0->unk_10D4, NULL); - sub_02013A3C(param0->unk_10CC); + Menu_Free(param0->unk_10D4, NULL); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[0], 0); v0 = ov94_022411DC(param0->unk_00->unk_08, param0->unk_00->unk_0C, param0->unk_110, param0->unk_112); @@ -753,8 +752,8 @@ static int ov94_02240688(UnkStruct_ov94_0223FD4C *param0) break; case 3: case 0xfffffffe: - sub_02001BC4(param0->unk_10D4, NULL); - sub_02013A3C(param0->unk_10CC); + Menu_Free(param0->unk_10D4, NULL); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[0], 0); sub_0200E084(¶m0->unk_F5C, 0); param0->unk_2C = 1; @@ -766,28 +765,28 @@ static int ov94_02240688(UnkStruct_ov94_0223FD4C *param0) static int ov94_02240830(UnkStruct_ov94_0223FD4C *param0) { - UnkStruct_02081CF4 v0; + MenuTemplate v0; - v0.unk_08 = 0; - v0.unk_09 = 1; - v0.unk_0A = 3; - v0.unk_0B_0 = 0; - v0.unk_0B_4 = 0; - v0.unk_0B_6 = 0; + v0.fontID = FONT_SYSTEM; + v0.xSize = 1; + v0.ySize = 3; + v0.lineSpacing = 0; + v0.suppressCursor = FALSE; + v0.loopAround = FALSE; - param0->unk_10CC = sub_02013A04(3, 62); + param0->unk_10CC = StringList_New(3, 62); - sub_02013A4C(param0->unk_10CC, param0->unk_B90, 84, 1); - sub_02013A4C(param0->unk_10CC, param0->unk_B90, 85, 2); - sub_02013A4C(param0->unk_10CC, param0->unk_B90, 86, 3); + StringList_AddFromMessageBank(param0->unk_10CC, param0->unk_B90, 84, 1); + StringList_AddFromMessageBank(param0->unk_10CC, param0->unk_B90, 85, 2); + StringList_AddFromMessageBank(param0->unk_10CC, param0->unk_B90, 86, 3); - v0.unk_00 = param0->unk_10CC; - v0.unk_04 = ¶m0->unk_F9C[0]; + v0.choices = param0->unk_10CC; + v0.window = ¶m0->unk_F9C[0]; - Window_FillTilemap(v0.unk_04, 0xf0f); + Window_FillTilemap(v0.window, 0xf0f); Window_Show(¶m0->unk_F9C[0], 1, (1 + (18 + 12)), 11); - param0->unk_10D4 = sub_02001B7C(&v0, 9, 0, 0, 62, PAD_BUTTON_B); + param0->unk_10D4 = Menu_NewAndCopyToVRAM(&v0, 9, 0, 0, 62, PAD_BUTTON_B); param0->unk_2C = 10; return 3; @@ -797,17 +796,17 @@ static int ov94_022408E8(UnkStruct_ov94_0223FD4C *param0) { BoxPokemon *v0; - switch (sub_02001BE0(param0->unk_10D4)) { + switch (Menu_ProcessInput(param0->unk_10D4)) { case 1: - sub_02001BC4(param0->unk_10D4, NULL); - sub_02013A3C(param0->unk_10CC); + Menu_Free(param0->unk_10D4, NULL); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[0], 0); param0->unk_2C = 2; ov94_0223C4C0(param0, 8, 6); break; case 2: - sub_02001BC4(param0->unk_10D4, NULL); - sub_02013A3C(param0->unk_10CC); + Menu_Free(param0->unk_10D4, NULL); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[0], 0); v0 = ov94_022411DC(param0->unk_00->unk_08, param0->unk_00->unk_0C, param0->unk_110, param0->unk_112); @@ -842,8 +841,8 @@ static int ov94_022408E8(UnkStruct_ov94_0223FD4C *param0) break; case 3: case 0xfffffffe: - sub_02001BC4(param0->unk_10D4, NULL); - sub_02013A3C(param0->unk_10CC); + Menu_Free(param0->unk_10D4, NULL); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[0], 0); sub_0200E084(¶m0->unk_F5C, 0); param0->unk_2C = 1; @@ -877,7 +876,7 @@ static int ov94_02240AC4(UnkStruct_ov94_0223FD4C *param0) static int ov94_02240AE8(UnkStruct_ov94_0223FD4C *param0) { - int v0 = sub_02002114(param0->unk_10D0, 62); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_10D0, 62); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { @@ -909,7 +908,7 @@ static int ov94_02240B4C(UnkStruct_ov94_0223FD4C *param0) static int ov94_02240B70(UnkStruct_ov94_0223FD4C *param0) { - int v0 = sub_02002114(param0->unk_10D0, 62); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_10D0, 62); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { @@ -967,7 +966,7 @@ static int ov94_02240C84(UnkStruct_ov94_0223FD4C *param0) static int ov94_02240CA8(UnkStruct_ov94_0223FD4C *param0) { - int v0 = sub_02002114(param0->unk_10D0, 62); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_10D0, 62); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { diff --git a/src/overlay094/ov94_022414B8.c b/src/overlay094/ov94_022414B8.c index 12d5d1ea6f..aac5c45aaa 100644 --- a/src/overlay094/ov94_022414B8.c +++ b/src/overlay094/ov94_022414B8.c @@ -7,11 +7,7 @@ #include "constants/species.h" #include "struct_decls/pokedexdata_decl.h" -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02013A04_decl.h" -#include "struct_defs/struct_02013A04_t.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "overlay094/const_ov94_02245FD4.h" #include "overlay094/const_ov94_02245FD8.h" #include "overlay094/ov94_0223BCB0.h" @@ -31,20 +27,20 @@ #include "game_options.h" #include "graphics.h" #include "heap.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "message_util.h" #include "narc.h" #include "pokemon.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" #include "trainer_info.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" -#include "unk_02013A04.h" #include "unk_0202631C.h" #include "unk_0202C858.h" #include "unk_020393C8.h" @@ -82,7 +78,7 @@ static int ov94_02242040(UnkStruct_ov94_0223FD4C *param0); static int ov94_02242068(UnkStruct_ov94_0223FD4C *param0); static int ov94_0224208C(UnkStruct_ov94_0223FD4C *param0); static void ov94_02242668(UnkStruct_ov94_0223BA88 *param0, UnkStruct_ov94_0223FD4C *param1); -static int ov94_02242718(ResourceMetadata **param0, MessageLoader *param1, MessageLoader *param2, u16 *param3, u8 *param4, int param5, int param6, PokedexData *param7); +static int ov94_02242718(StringList **param0, MessageLoader *param1, MessageLoader *param2, u16 *param3, u8 *param4, int param5, int param6, PokedexData *param7); static TextColor ov94_022421E8(int param0, u32 param1); static int (*Unk_ov94_0224695C[])(UnkStruct_ov94_0223FD4C *) = { @@ -567,14 +563,14 @@ static int ov94_02241A58(UnkStruct_ov94_0223FD4C *param0) case 7: case 8: case 9: - sub_02001384(param0->unk_10D8, ¶m0->unk_10E4->unk_06, ¶m0->unk_10E4->unk_04); - sub_02013A3C(param0->unk_10CC); + ListMenu_Free(param0->unk_10D8, ¶m0->unk_10E4->unk_06, ¶m0->unk_10E4->unk_04); + StringList_Free(param0->unk_10CC); param0->unk_2C = 5; Sound_PlayEffect(1500); break; case 0xfffffffe: - sub_02001384(param0->unk_10D8, ¶m0->unk_10E4->unk_06, ¶m0->unk_10E4->unk_04); - sub_02013A3C(param0->unk_10CC); + ListMenu_Free(param0->unk_10D8, ¶m0->unk_10E4->unk_06, ¶m0->unk_10E4->unk_04); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[0], 0); sub_0200E084(¶m0->unk_F5C, 0); Window_Remove(¶m0->unk_F9C[0]); @@ -626,8 +622,8 @@ static int ov94_02241BAC(UnkStruct_ov94_0223FD4C *param0) case 0xffffffff: break; case 0xfffffffe: - sub_02001384(param0->unk_10D8, ¶m0->unk_10E4->unk_0A, ¶m0->unk_10E4->unk_08); - sub_02013A3C(param0->unk_10CC); + ListMenu_Free(param0->unk_10D8, ¶m0->unk_10E4->unk_0A, ¶m0->unk_10E4->unk_08); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[1], 0); Window_Remove(¶m0->unk_F9C[0]); Window_Remove(¶m0->unk_F9C[1]); @@ -636,8 +632,8 @@ static int ov94_02241BAC(UnkStruct_ov94_0223FD4C *param0) ov94_02242AC4(¶m0->unk_111C, param0->unk_10E4->unk_06 + param0->unk_10E4->unk_04, param0->unk_10E4->unk_0A, param0->unk_10E4->unk_08); break; default: - sub_02001384(param0->unk_10D8, ¶m0->unk_10E4->unk_0A, ¶m0->unk_10E4->unk_08); - sub_02013A3C(param0->unk_10CC); + ListMenu_Free(param0->unk_10D8, ¶m0->unk_10E4->unk_0A, ¶m0->unk_10E4->unk_08); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[0], 0); Window_Clear(¶m0->unk_F9C[1], 0); Window_Remove(¶m0->unk_F9C[0]); @@ -688,8 +684,8 @@ static int ov94_02241DA0(UnkStruct_ov94_0223FD4C *param0) switch (v0 = ov94_02242A6C(param0->unk_10D8, ¶m0->unk_108)) { case 0xfffffffe: - sub_02001384(param0->unk_10D8, NULL, NULL); - sub_02013A3C(param0->unk_10CC); + ListMenu_Free(param0->unk_10D8, NULL, NULL); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[0], 0); sub_0200E084(¶m0->unk_F5C, 0); Window_Remove(¶m0->unk_F9C[0]); @@ -700,8 +696,8 @@ static int ov94_02241DA0(UnkStruct_ov94_0223FD4C *param0) case 0: case 1: case 2: - sub_02001384(param0->unk_10D8, NULL, NULL); - sub_02013A3C(param0->unk_10CC); + ListMenu_Free(param0->unk_10D8, NULL, NULL); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[0], 0); Window_Remove(¶m0->unk_F9C[0]); Sound_PlayEffect(1500); @@ -743,8 +739,8 @@ static int ov94_02241F28(UnkStruct_ov94_0223FD4C *param0) break; case 0xfffffffe: case 12: - sub_02001384(param0->unk_10D8, NULL, NULL); - sub_02013A3C(param0->unk_10CC); + ListMenu_Free(param0->unk_10D8, NULL, NULL); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[0], 0); sub_0200E084(¶m0->unk_F5C, 0); Window_Remove(¶m0->unk_F9C[0]); @@ -758,8 +754,8 @@ static int ov94_02241F28(UnkStruct_ov94_0223FD4C *param0) break; default: Sound_PlayEffect(1500); - sub_02001384(param0->unk_10D8, NULL, NULL); - sub_02013A3C(param0->unk_10CC); + ListMenu_Free(param0->unk_10D8, NULL, NULL); + StringList_Free(param0->unk_10CC); Window_Clear(¶m0->unk_F9C[0], 0); Window_Remove(¶m0->unk_F9C[0]); ov94_02242934(¶m0->unk_B74, v0, 0); @@ -789,7 +785,7 @@ static int ov94_02242068(UnkStruct_ov94_0223FD4C *param0) static int ov94_0224208C(UnkStruct_ov94_0223FD4C *param0) { - int v0 = sub_02002114(param0->unk_10D0, 62); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_10D0, 62); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { @@ -1073,7 +1069,7 @@ static void ov94_02242668(UnkStruct_ov94_0223BA88 *param0, UnkStruct_ov94_0223FD param0->unk_F0 = param1->unk_B74; } -static const UnkStruct_ov84_02240FA8 Unk_ov94_0224608C = { +static const ListMenuTemplate Unk_ov94_0224608C = { NULL, NULL, NULL, @@ -1095,24 +1091,24 @@ static const UnkStruct_ov84_02240FA8 Unk_ov94_0224608C = { NULL }; -BmpList *ov94_022426A8(UnkStruct_ov94_0223FD4C *param0, ResourceMetadata **param1, Window *param2, MessageLoader *param3) +ListMenu *ov94_022426A8(UnkStruct_ov94_0223FD4C *param0, StringList **param1, Window *param2, MessageLoader *param3) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; int v1; - *param1 = sub_02013A04(9, 62); + *param1 = StringList_New(9, 62); for (v1 = 0; v1 < 9; v1++) { - sub_02013A4C(*param1, param3, 104 + v1, v1 + 1); + StringList_AddFromMessageBank(*param1, param3, 104 + v1, v1 + 1); } v0 = Unk_ov94_0224608C; - v0.unk_00 = *param1; - v0.unk_0C = param2; + v0.choices = *param1; + v0.window = param2; Window_Show(param2, 0, (1 + (18 + 12)), 11); - return sub_0200112C(&v0, param0->unk_10E4->unk_06, param0->unk_10E4->unk_04, 62); + return ListMenu_New(&v0, param0->unk_10E4->unk_06, param0->unk_10E4->unk_04, 62); } static u16 Unk_ov94_02246928[] = { @@ -1128,7 +1124,7 @@ static u16 Unk_ov94_02246928[] = { 0x1ED }; -static int ov94_02242718(ResourceMetadata **param0, MessageLoader *param1, MessageLoader *param2, u16 *param3, u8 *param4, int param5, int param6, PokedexData *param7) +static int ov94_02242718(StringList **param0, MessageLoader *param1, MessageLoader *param2, u16 *param3, u8 *param4, int param5, int param6, PokedexData *param7) { int v0, v1, v2 = 0; int v3 = Unk_ov94_02246928[param6 + 1] - Unk_ov94_02246928[param6]; @@ -1150,30 +1146,30 @@ static int ov94_02242718(ResourceMetadata **param0, MessageLoader *param1, Messa } } - *param0 = sub_02013A04(v2 + 1, 62); + *param0 = StringList_New(v2 + 1, 62); for (v0 = 0; v0 < v3; v0++) { if (v4) { if (sub_02026FE8(param7, param3[v1 + v0])) { - sub_02013A4C(*param0, param1, param3[v1 + v0], param3[v1 + v0]); + StringList_AddFromMessageBank(*param0, param1, param3[v1 + v0], param3[v1 + v0]); } } else { if (param4[param3[v1 + v0]]) { if (sub_02026FE8(param7, param3[v1 + v0])) { - sub_02013A4C(*param0, param1, param3[v1 + v0], param3[v1 + v0]); + StringList_AddFromMessageBank(*param0, param1, param3[v1 + v0], param3[v1 + v0]); } } } } - sub_02013A4C(*param0, param2, 121, 0xfffffffe); + StringList_AddFromMessageBank(*param0, param2, 121, 0xfffffffe); return v2 + 1; } -BmpList *ov94_022427C0(UnkStruct_ov94_0223FD4C *param0, ResourceMetadata **param1, Window *param2, MessageLoader *param3, MessageLoader *param4, UnkStruct_ov94_0223FD4C_sub3 *param5, PokedexData *param6) +ListMenu *ov94_022427C0(UnkStruct_ov94_0223FD4C *param0, StringList **param1, Window *param2, MessageLoader *param3, MessageLoader *param4, UnkStruct_ov94_0223FD4C_sub3 *param5, PokedexData *param6) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; int v1, v2, v3; Window_FillTilemap(param2, 0xf0f); @@ -1182,13 +1178,13 @@ BmpList *ov94_022427C0(UnkStruct_ov94_0223FD4C *param0, ResourceMetadata **param v2 = ov94_02242718(param1, param4, param3, param5->unk_18, param5->unk_14, param5->unk_1C, v3, param6); v0 = Unk_ov94_0224608C; - v0.unk_10 = v2; - v0.unk_00 = *param1; - v0.unk_0C = param2; + v0.count = v2; + v0.choices = *param1; + v0.window = param2; Window_Show(param2, 0, (1 + (18 + 12)), 11); - return sub_0200112C(&v0, param0->unk_111C.unk_04[v3], param0->unk_111C.unk_16[v3], 62); + return ListMenu_New(&v0, param0->unk_111C.unk_04[v3], param0->unk_111C.unk_16[v3], 62); } static Unk_ov94_0224693C[][2] = { @@ -1198,30 +1194,30 @@ static Unk_ov94_0224693C[][2] = { { 0x79, 0xFFFFFFFE } }; -BmpList *ov94_02242840(ResourceMetadata **param0, Window *param1, MessageLoader *param2) +ListMenu *ov94_02242840(StringList **param0, Window *param1, MessageLoader *param2) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; int v1; - *param0 = sub_02013A04(4, 62); + *param0 = StringList_New(4, 62); for (v1 = 0; v1 < 4; v1++) { - sub_02013A4C(*param0, param2, Unk_ov94_0224693C[v1][0], Unk_ov94_0224693C[v1][1]); + StringList_AddFromMessageBank(*param0, param2, Unk_ov94_0224693C[v1][0], Unk_ov94_0224693C[v1][1]); } v0 = Unk_ov94_0224608C; - v0.unk_10 = 4; - v0.unk_00 = *param0; - v0.unk_0C = param1; + v0.count = 4; + v0.choices = *param0; + v0.window = param1; Window_Show(param1, 0, (1 + (18 + 12)), 11); - return sub_0200112C(&v0, 0, 0, 62); + return ListMenu_New(&v0, 0, 0, 62); } -BmpList *ov94_022428B0(ResourceMetadata **param0, Window *param1, MessageLoader *param2, int param3) +ListMenu *ov94_022428B0(StringList **param0, Window *param1, MessageLoader *param2, int param3) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; int v1; const UnkStruct_ov94_022460AC *v2; int v3; @@ -1234,20 +1230,20 @@ BmpList *ov94_022428B0(ResourceMetadata **param0, Window *param1, MessageLoader v3 = (NELEMS(Unk_ov94_022460AC)); } - *param0 = sub_02013A04(v3, 62); + *param0 = StringList_New(v3, 62); for (v1 = 0; v1 < v3; v1++) { - sub_02013A4C(*param0, param2, v2[v1].unk_00, v1); + StringList_AddFromMessageBank(*param0, param2, v2[v1].unk_00, v1); } v0 = Unk_ov94_0224608C; - v0.unk_10 = v3; - v0.unk_00 = *param0; - v0.unk_0C = param1; + v0.count = v3; + v0.choices = *param0; + v0.window = param1; Window_Show(param1, 0, (1 + (18 + 12)), 11); - return sub_0200112C(&v0, 0, 0, 62); + return ListMenu_New(&v0, 0, 0, 62); } void ov94_02242934(UnkStruct_ov94_0223BA88_sub3 *param0, int param1, int param2) @@ -1289,30 +1285,30 @@ int ov94_02242970(int param0, int param1, int param2) return 0; } -BmpList *ov94_022429B4(ResourceMetadata **param0, Window *param1, MessageLoader *param2, MessageLoader *param3) +ListMenu *ov94_022429B4(StringList **param0, Window *param1, MessageLoader *param2, MessageLoader *param3) { - UnkStruct_ov84_02240FA8 v0; + ListMenuTemplate v0; int v1; int v2 = NELEMS(Unk_ov94_02246174) + 2; - *param0 = sub_02013A04(v2, 62); + *param0 = StringList_New(v2, 62); - sub_02013A4C(*param0, param3, 167, 0); + StringList_AddFromMessageBank(*param0, param3, 167, 0); for (v1 = 1; v1 < v2 - 1; v1++) { - sub_02013A4C(*param0, param2, Unk_ov94_02246174[v1 - 1], v1); + StringList_AddFromMessageBank(*param0, param2, Unk_ov94_02246174[v1 - 1], v1); } - sub_02013A4C(*param0, param3, 168, v2 - 1); + StringList_AddFromMessageBank(*param0, param3, 168, v2 - 1); v0 = Unk_ov94_0224608C; - v0.unk_10 = v2; - v0.unk_00 = *param0; - v0.unk_0C = param1; + v0.count = v2; + v0.choices = *param0; + v0.window = param1; Window_Show(param1, 1, (1 + (18 + 12)), 11); - return sub_0200112C(&v0, 0, 0, 62); + return ListMenu_New(&v0, 0, 0, 62); } void ov94_02242A44(UnkStruct_ov94_0223FD4C *param0, int param1) @@ -1324,12 +1320,12 @@ void ov94_02242A44(UnkStruct_ov94_0223FD4C *param0, int param1) } } -u32 ov94_02242A6C(BmpList *param0, u16 *param1) +u32 ov94_02242A6C(ListMenu *param0, u16 *param1) { u16 v0; - u32 v1 = sub_02001288(param0); + u32 v1 = ListMenu_ProcessInput(param0); - sub_020014D0(param0, &v0); + ListMenu_CalcTrueCursorPos(param0, &v0); if (*param1 != v0) { if (*param1 != 0xffff) { diff --git a/src/overlay094/ov94_02244950.c b/src/overlay094/ov94_02244950.c index dff8d0e3d0..8d0466bf44 100644 --- a/src/overlay094/ov94_02244950.c +++ b/src/overlay094/ov94_02244950.c @@ -16,12 +16,12 @@ #include "graphics.h" #include "gx_layers.h" #include "inlines.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "strbuf.h" #include "string_template.h" #include "text.h" -#include "unk_02001AF4.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" #include "unk_02025CB0.h" @@ -336,7 +336,7 @@ static int ov94_02244F8C(UnkStruct_ov94_0223FD4C *param0) static int ov94_02244FC4(UnkStruct_ov94_0223FD4C *param0) { - int v0 = sub_02002114(param0->unk_10D0, 62); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_10D0, 62); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { @@ -363,7 +363,7 @@ static int ov94_0224502C(UnkStruct_ov94_0223FD4C *param0) static int ov94_0224505C(UnkStruct_ov94_0223FD4C *param0) { - int v0 = sub_02002114(param0->unk_10D0, 62); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_10D0, 62); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { @@ -767,7 +767,7 @@ static int ov94_02245594(UnkStruct_ov94_0223FD4C *param0) static int ov94_022455D0(UnkStruct_ov94_0223FD4C *param0) { - int v0 = sub_02002114(param0->unk_10D0, 62); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_10D0, 62); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { diff --git a/src/overlay096/ov96_0223B6A0.c b/src/overlay096/ov96_0223B6A0.c index 633bc684e3..f0390e6ddc 100644 --- a/src/overlay096/ov96_0223B6A0.c +++ b/src/overlay096/ov96_0223B6A0.c @@ -4,7 +4,6 @@ #include #include -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_defs/struct_0206BC70.h" #include "struct_defs/struct_02099F80.h" @@ -19,12 +18,12 @@ #include "gx_layers.h" #include "heap.h" #include "inlines.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "overlay_manager.h" #include "sprite_resource.h" #include "string_template.h" -#include "unk_02001AF4.h" #include "unk_020041CC.h" #include "unk_020093B4.h" #include "unk_0200A328.h" @@ -331,7 +330,7 @@ static const WindowTemplate Unk_ov96_0223DA78 = { 0x0 }; -UIControlData *ov96_0223BBC8(BgConfig *param0, int param1, int param2) +Menu *ov96_0223BBC8(BgConfig *param0, int param1, int param2) { WindowTemplate v0; @@ -339,7 +338,7 @@ UIControlData *ov96_0223BBC8(BgConfig *param0, int param1, int param2) v0.tilemapTop = param1; v0.baseTile = param2; - return sub_02002100(param0, &v0, (1 + (18 + 12)), 11, 68); + return Menu_MakeYesNoChoice(param0, &v0, (1 + (18 + 12)), 11, 68); } void ov96_0223BBFC(UnkStruct_ov96_0223BF40 *param0, int param1, int param2) diff --git a/src/overlay096/ov96_0223BCE0.c b/src/overlay096/ov96_0223BCE0.c index d6af618a8f..1a95de97f5 100644 --- a/src/overlay096/ov96_0223BCE0.c +++ b/src/overlay096/ov96_0223BCE0.c @@ -23,13 +23,13 @@ #include "graphics.h" #include "gx_layers.h" #include "inlines.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "savedata.h" #include "strbuf.h" #include "string_template.h" #include "text.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" @@ -421,7 +421,7 @@ static int ov96_0223C3F0(UnkStruct_ov96_0223BF40 *param0) static int ov96_0223C420(UnkStruct_ov96_0223BF40 *param0) { - int v0 = sub_02002114(param0->unk_F68, 68); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_F68, 68); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { @@ -448,7 +448,7 @@ static int ov96_0223C488(UnkStruct_ov96_0223BF40 *param0) static int ov96_0223C4B8(UnkStruct_ov96_0223BF40 *param0) { - int v0 = sub_02002114(param0->unk_F68, 68); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_F68, 68); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { @@ -1358,7 +1358,7 @@ static int ov96_0223D3D8(UnkStruct_ov96_0223BF40 *param0) static int ov96_0223D408(UnkStruct_ov96_0223BF40 *param0) { - int v0 = sub_02002114(param0->unk_F68, 68); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_F68, 68); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { @@ -1382,7 +1382,7 @@ static int ov96_0223D43C(UnkStruct_ov96_0223BF40 *param0) static int ov96_0223D46C(UnkStruct_ov96_0223BF40 *param0) { - int v0 = sub_02002114(param0->unk_F68, 68); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_F68, 68); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { @@ -1440,7 +1440,7 @@ static int ov96_0223D528(UnkStruct_ov96_0223BF40 *param0) static int ov96_0223D558(UnkStruct_ov96_0223BF40 *param0) { - int v0 = sub_02002114(param0->unk_F68, 68); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_F68, 68); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { diff --git a/src/overlay097/ov97_0222D30C.c b/src/overlay097/ov97_0222D30C.c index 4b022484a8..de1f696c87 100644 --- a/src/overlay097/ov97_0222D30C.c +++ b/src/overlay097/ov97_0222D30C.c @@ -9,7 +9,6 @@ #include "struct_defs/struct_0203CC84.h" #include "overlay077/const_ov77_021D742C.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "overlay097/ov97_0222D04C.h" #include "overlay097/ov97_02232054.h" #include "overlay097/ov97_02237520.h" @@ -32,6 +31,7 @@ #include "graphics.h" #include "gx_layers.h" #include "heap.h" +#include "list_menu.h" #include "message.h" #include "message_util.h" #include "overlay_manager.h" @@ -41,19 +41,18 @@ #include "savedata.h" #include "sprite_resource.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "sys_task.h" #include "sys_task_manager.h" #include "text.h" #include "unk_02000C88.h" -#include "unk_0200112C.h" #include "unk_020041CC.h" #include "unk_02005474.h" #include "unk_020093B4.h" #include "unk_0200A328.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" -#include "unk_02013A04.h" #include "unk_02017728.h" #include "unk_0201D15C.h" #include "unk_0202DAB4.h" @@ -183,7 +182,7 @@ UnkStruct_ov97_0223E5B8 Unk_ov97_0223E588[] = { { 0x13, (u32)ov97_0222D9F0 } }; -static UnkStruct_ov84_02240FA8 Unk_ov97_0223E5D0 = { +static ListMenuTemplate Unk_ov97_0223E5D0 = { NULL, ov97_022383C4, NULL, @@ -236,11 +235,11 @@ static void ov97_0222D34C(OverlayManager *param0) ov97_02237DA0(); if (v1->unk_7C) { - sub_02013A3C(v1->unk_7C); + StringList_Free(v1->unk_7C); } if (v1->unk_78) { - sub_02001384(v1->unk_78, NULL, NULL); + ListMenu_Free(v1->unk_78, NULL, NULL); } Window_ClearAndCopyToVRAM(&v1->unk_18); @@ -779,33 +778,33 @@ static void ov97_0222DC9C(BgConfig *param0) static void ov97_0222DD1C(OverlayManager *param0, UnkStruct_ov97_0223E5B8 *param1, int param2, Window *param3, u32 param4) { int v0; - UnkStruct_ov84_02240FA8 v1; + ListMenuTemplate v1; UnkStruct_ov97_0222D04C *v2 = OverlayManager_Data(param0); if (v2->unk_7C) { - sub_02013A3C(v2->unk_7C); + StringList_Free(v2->unk_7C); } - v2->unk_7C = sub_02013A04(param2, 86); + v2->unk_7C = StringList_New(param2, 86); v2->unk_10 = MessageLoader_Init(0, 26, 421, 86); for (v0 = 0; v0 < param2; v0++) { - sub_02013A4C(v2->unk_7C, v2->unk_10, param1[v0].unk_00, param1[v0].unk_04); + StringList_AddFromMessageBank(v2->unk_7C, v2->unk_10, param1[v0].unk_00, param1[v0].unk_04); } MessageLoader_Free(v2->unk_10); v1 = Unk_ov97_0223E5D0; - v1.unk_00 = v2->unk_7C; - v1.unk_10 = v1.unk_12 = param2; - v1.unk_0C = param3; + v1.choices = v2->unk_7C; + v1.count = v1.maxDisplay = param2; + v1.window = param3; if (v2->unk_78) { - sub_02001384(v2->unk_78, NULL, NULL); + ListMenu_Free(v2->unk_78, NULL, NULL); } - v2->unk_78 = sub_0200112C(&v1, 0, 0, 86); + v2->unk_78 = ListMenu_New(&v1, 0, 0, 86); if (param4 != -1) { ov97_0222DE78(param0, &v2->unk_18, param4); @@ -887,7 +886,7 @@ static void ov97_0222DF70(OverlayManager *param0, int *param1, int (*param2)(Ove UnkStruct_ov97_0222D04C *v2 = OverlayManager_Data(param0); static int (*v3)(OverlayManager *); - v0 = sub_02001288(v2->unk_78); + v0 = ListMenu_ProcessInput(v2->unk_78); switch (v0) { case 0xffffffff: diff --git a/src/overlay097/ov97_02230410.c b/src/overlay097/ov97_02230410.c index e301897b2b..943d507b13 100644 --- a/src/overlay097/ov97_02230410.c +++ b/src/overlay097/ov97_02230410.c @@ -1,15 +1,11 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_0202442C_decl.h" #include "struct_defs/struct_0200C738.h" -#include "struct_defs/struct_02013A04_t.h" #include "struct_defs/struct_0202DBAC.h" #include "struct_defs/struct_0203CC84.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "overlay097/ov97_0222D04C.h" #include "overlay097/ov97_02232054.h" #include "overlay097/ov97_02237694.h" @@ -29,6 +25,7 @@ #include "graphics.h" #include "gx_layers.h" #include "heap.h" +#include "list_menu.h" #include "message.h" #include "message_util.h" #include "overlay_manager.h" @@ -37,17 +34,16 @@ #include "savedata.h" #include "sprite_resource.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "sys_task.h" #include "sys_task_manager.h" #include "text.h" #include "trainer_info.h" #include "unk_02000C88.h" -#include "unk_0200112C.h" #include "unk_02005474.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" -#include "unk_02013A04.h" #include "unk_0202DAB4.h" #include "unk_02033200.h" #include "unk_020363E8.h" @@ -84,8 +80,8 @@ typedef struct { UnkStruct_0202DBAC *unk_2C14[3]; int unk_2C20; int unk_2C24; - BmpList *unk_2C28; - ResourceMetadata *unk_2C2C; + ListMenu *unk_2C28; + StringList *unk_2C2C; Window unk_2C30; Window unk_2C40; int unk_2C50; @@ -210,7 +206,7 @@ UnkStruct_ov97_0223E640 Unk_ov97_0223E620[] = { { 0x41, (u32)ov97_02230834 } }; -static UnkStruct_ov84_02240FA8 Unk_ov97_0223E660 = { +static ListMenuTemplate Unk_ov97_0223E660 = { NULL, ov97_022383C4, NULL, @@ -294,32 +290,32 @@ static void ov97_02230518(Window *param0, u8 param1) static void ov97_02230530(UnkStruct_ov97_02230868 *param0, UnkStruct_ov97_0223E640 *param1, int param2, Window *param3, int param4) { int v0; - UnkStruct_ov84_02240FA8 v1; + ListMenuTemplate v1; if (param0->unk_2C2C) { - sub_02013A3C(param0->unk_2C2C); + StringList_Free(param0->unk_2C2C); } if (param0->unk_2C28) { - sub_02001384(param0->unk_2C28, NULL, NULL); + ListMenu_Free(param0->unk_2C28, NULL, NULL); } - param0->unk_2C2C = sub_02013A04(param2, 87); + param0->unk_2C2C = StringList_New(param2, 87); param0->unk_2A64 = MessageLoader_Init(0, 26, 421, 87); for (v0 = 0; v0 < param2; v0++) { - sub_02013A4C(param0->unk_2C2C, param0->unk_2A64, param1[v0].unk_00, param1[v0].unk_04); + StringList_AddFromMessageBank(param0->unk_2C2C, param0->unk_2A64, param1[v0].unk_00, param1[v0].unk_04); } MessageLoader_Free(param0->unk_2A64); v1 = Unk_ov97_0223E660; - v1.unk_00 = param0->unk_2C2C; - v1.unk_10 = param2; - v1.unk_0C = param3; + v1.choices = param0->unk_2C2C; + v1.count = param2; + v1.window = param3; - param0->unk_2C28 = sub_0200112C(&v1, 0, param4, 87); + param0->unk_2C28 = ListMenu_New(&v1, 0, param4, 87); } static void ov97_022305EC(Window *param0, int param1) @@ -420,9 +416,9 @@ static int ov97_02230834(OverlayManager *param0) static void ov97_02230868(UnkStruct_ov97_02230868 *param0) { - sub_02013A3C(param0->unk_2C2C); + StringList_Free(param0->unk_2C2C); param0->unk_2C2C = NULL; - sub_02001384(param0->unk_2C28, NULL, NULL); + ListMenu_Free(param0->unk_2C28, NULL, NULL); param0->unk_2C28 = NULL; ov97_02230500(¶m0->unk_2C40, 0); Window_ClearAndCopyToVRAM(¶m0->unk_2C40); @@ -744,7 +740,7 @@ static void ov97_02231088(OverlayManager *param0, int *param1, int (*param2)(Ove UnkStruct_ov97_02230868 *v2 = OverlayManager_Data(param0); static int (*v3)(OverlayManager *); - v0 = sub_02001288(v2->unk_2C28); + v0 = ListMenu_ProcessInput(v2->unk_2C28); switch (v0) { case 0xffffffff: diff --git a/src/overlay097/ov97_02237694.c b/src/overlay097/ov97_02237694.c index eb03b71b1f..4c4d6f7829 100644 --- a/src/overlay097/ov97_02237694.c +++ b/src/overlay097/ov97_02237694.c @@ -5,7 +5,6 @@ #include "constants/species.h" -#include "struct_decls/struct_0200112C_decl.h" #include "struct_defs/archived_sprite.h" #include "struct_defs/struct_0202DF40.h" @@ -25,6 +24,7 @@ #include "gx_layers.h" #include "heap.h" #include "item.h" +#include "list_menu.h" #include "message.h" #include "message_util.h" #include "overlay_manager.h" @@ -784,7 +784,7 @@ void ov97_02238324(UnkStruct_ov97_0223829C *param0, UnkUnion_ov97_0222D2B0 *para Heap_FreeToHeap(v1); } -void ov97_022383C4(BmpList *param0, u32 param1, u8 param2) +void ov97_022383C4(ListMenu *param0, u32 param1, u8 param2) { switch (param2) { case 0: diff --git a/src/overlay098/ov98_022471C8.c b/src/overlay098/ov98_022471C8.c index 63c5bb085e..9c197b09a9 100644 --- a/src/overlay098/ov98_022471C8.c +++ b/src/overlay098/ov98_022471C8.c @@ -4,17 +4,12 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_02025CCC_decl.h" #include "struct_decls/struct_0202B370_decl.h" -#include "struct_defs/struct_02013A04_t.h" #include "struct_defs/struct_02099F80.h" #include "overlay004/ov4_021D0D80.h" #include "overlay061/struct_ov61_0222C3B0.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "overlay094/ov94_0223B140.h" #include "overlay098/ov98_02246C20.h" #include "overlay098/ov98_022499C8.h" @@ -29,6 +24,8 @@ #include "gx_layers.h" #include "heap.h" #include "inlines.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "overlay_manager.h" @@ -36,15 +33,13 @@ #include "save_player.h" #include "savedata.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200A784.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" -#include "unk_02013A04.h" #include "unk_02017728.h" #include "unk_0201DBEC.h" #include "unk_0201E3D8.h" @@ -78,14 +73,14 @@ typedef struct { Window unk_58; Window unk_68; Window unk_78; - UIControlData * unk_88; + Menu *unk_88; void * unk_8C; int unk_90; int unk_94; int unk_98; int unk_9C; - ResourceMetadata * unk_A0; - BmpList * unk_A4; + StringList *unk_A0; + ListMenu *unk_A4; int unk_A8; int unk_AC; int unk_B0; @@ -117,7 +112,7 @@ static void ov98_02247ACC(UnkStruct_ov98_02247704 * param0); static void ov98_02247AE8(UnkStruct_ov98_02247704 * param0, int param1, int param2); static void ov98_02247AF0(UnkStruct_ov98_02247704 * param0); static void ov98_02247B0C(UnkStruct_ov98_02247704 * param0); -static UIControlData *ov98_02247B24(BgConfig *param0, int param1, int param2); +static Menu *ov98_02247B24(BgConfig *param0, int param1, int param2); static int ov98_02247B98(UnkStruct_ov98_02247704 * param0); static int ov98_02247D30(UnkStruct_ov98_02247704 * param0); static int ov98_02247D50(UnkStruct_ov98_02247704 * param0); @@ -162,8 +157,8 @@ static int ov98_02249894(Window * param0, Strbuf *param1, int param2, int param3 void ov98_022498CC(Window *param0, Strbuf *param1, int param2, int param3, int param4, TextColor param5); static void ov98_02249900(UnkStruct_ov98_02247704 * param0, int param1); static void ov98_02249964(UnkStruct_ov98_02247704 * param0, int param1, int param2); -static void ov98_022499A0(BmpList * param0, u32 param1, u8 param2); -static void ov98_022499B4(BmpList * param0, u32 param1, u8 param2); +static void ov98_022499A0(ListMenu *param0, u32 param1, u8 param2); +static void ov98_022499B4(ListMenu *param0, u32 param1, u8 param2); static int (* Unk_ov98_02249D70[])(UnkStruct_ov98_02247704 *) = { ov98_02247B98, @@ -214,7 +209,7 @@ static const UnkStruct_ov98_02249BDC Unk_ov98_02249BEC[] = { {0x4, 0x1D} }; -static const UnkStruct_ov84_02240FA8 Unk_ov98_02249C0C = { +static const ListMenuTemplate Unk_ov98_02249C0C = { NULL, ov98_022499A0, NULL, @@ -247,7 +242,7 @@ static const UnkStruct_ov98_02249BDC Unk_ov98_02249BDC[] = { {0x4, 0x1D} }; -static const UnkStruct_ov84_02240FA8 Unk_ov98_02249C2C = { +static const ListMenuTemplate Unk_ov98_02249C2C = { NULL, ov98_022499B4, NULL, @@ -699,7 +694,7 @@ static void ov98_02247B0C (UnkStruct_ov98_02247704 * param0) } } -static UIControlData *ov98_02247B24(BgConfig *param0, int param1, int param2) +static Menu *ov98_02247B24(BgConfig *param0, int param1, int param2) { WindowTemplate v0; @@ -707,10 +702,10 @@ static UIControlData *ov98_02247B24(BgConfig *param0, int param1, int param2) v0.tilemapTop = param1; v0.baseTile = param2; - return sub_02002100(param0, &v0, (1 + (18 + 12)), 11, 109); + return Menu_MakeYesNoChoice(param0, &v0, (1 + (18 + 12)), 11, 109); } -static UIControlData *ov98_02247B58(BgConfig *param0, int param1, int param2, int param3) +static Menu *ov98_02247B58(BgConfig *param0, int param1, int param2, int param3) { WindowTemplate v0; @@ -718,7 +713,7 @@ static UIControlData *ov98_02247B58(BgConfig *param0, int param1, int param2, in v0.tilemapTop = param1; v0.baseTile = param2; - return sub_02002054(param0, &v0, (1 + (18 + 12)), 11, param3, 109); + return Menu_MakeYesNoChoiceWithCursorAt(param0, &v0, (1 + (18 + 12)), 11, param3, 109); } static int ov98_02247B98 (UnkStruct_ov98_02247704 * param0) @@ -729,7 +724,7 @@ static int ov98_02247B98 (UnkStruct_ov98_02247704 * param0) case 0: { int v1; - UnkStruct_ov84_02240FA8 v2; + ListMenuTemplate v2; const u8 * v3; const UnkStruct_ov98_02249BDC * v4; int v5; @@ -748,15 +743,15 @@ static int ov98_02247B98 (UnkStruct_ov98_02247704 * param0) Window_Add(param0->unk_04, ¶m0->unk_78, 0, v3[0], v3[1], v3[2], v3[3], 13, (((1 + (18 + 12)) + 9) + 27 * 4)); - param0->unk_A0 = sub_02013A04(v5, 109); + param0->unk_A0 = StringList_New(v5, 109); for (v1 = 0; v1 < v5; v1++) { - sub_02013A4C(param0->unk_A0, param0->unk_34, v4[v1].unk_00, v4[v1].unk_04); + StringList_AddFromMessageBank(param0->unk_A0, param0->unk_34, v4[v1].unk_00, v4[v1].unk_04); } - v2.unk_0C = ¶m0->unk_78; - v2.unk_00 = param0->unk_A0; - param0->unk_A4 = sub_0200112C(&v2, 0, 0, 109); + v2.window = ¶m0->unk_78; + v2.choices = param0->unk_A0; + param0->unk_A4 = ListMenu_New(&v2, 0, 0, 109); Window_Show(¶m0->unk_78, 1, (1 + (18 + 12)), 11); sub_0200E084(¶m0->unk_48, 1); @@ -766,7 +761,7 @@ static int ov98_02247B98 (UnkStruct_ov98_02247704 * param0) param0->unk_94++; break; case 1: - v0 = sub_02001288(param0->unk_A4); + v0 = ListMenu_ProcessInput(param0->unk_A4); switch (v0) { case 0xffffffff: @@ -785,8 +780,8 @@ static int ov98_02247B98 (UnkStruct_ov98_02247704 * param0) } break; default: - sub_02013A3C(param0->unk_A0); - sub_02001384(param0->unk_A4, NULL, NULL); + StringList_Free(param0->unk_A0); + ListMenu_Free(param0->unk_A4, NULL, NULL); Window_Clear(¶m0->unk_78, 1); Window_ClearAndCopyToVRAM(¶m0->unk_78); Window_Remove(¶m0->unk_78); @@ -823,7 +818,7 @@ static int ov98_02247D50 (UnkStruct_ov98_02247704 * param0) break; case 2: { - int v0 = sub_02002114(param0->unk_88, 109); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_88, 109); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { @@ -863,7 +858,7 @@ static int ov98_02247E38 (UnkStruct_ov98_02247704 * param0) break; case 2: { - int v0 = sub_02002114(param0->unk_88, 109); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_88, 109); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { @@ -1382,7 +1377,7 @@ static int ov98_02248684 (UnkStruct_ov98_02247704 * param0) break; case 2: { - int v0 = sub_02002114(param0->unk_88, 109); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_88, 109); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { @@ -1412,7 +1407,7 @@ static int ov98_02248684 (UnkStruct_ov98_02247704 * param0) break; default: { - int v2 = sub_02002114(param0->unk_88, 109); + int v2 = Menu_ProcessInputAndHandleExit(param0->unk_88, 109); if (v2 != 0xffffffff) { if (v2 == 0xfffffffe) { @@ -1476,7 +1471,7 @@ static int ov98_02248804 (UnkStruct_ov98_02247704 * param0) break; case 3: { - int v0 = sub_02002114(param0->unk_88, 109); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_88, 109); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { @@ -1504,7 +1499,7 @@ static int ov98_02248804 (UnkStruct_ov98_02247704 * param0) static int ov98_022488F8 (UnkStruct_ov98_02247704 * param0) { - int v0 = sub_02002114(param0->unk_88, 109); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_88, 109); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { @@ -1877,7 +1872,7 @@ static int ov98_02248DF4 (UnkStruct_ov98_02247704 * param0) break; case 2: { - int v0 = sub_02002114(param0->unk_88, 109); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_88, 109); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { @@ -1923,7 +1918,7 @@ static int ov98_02248EE0 (UnkStruct_ov98_02247704 * param0) break; case 2: { - int v0 = sub_02002114(param0->unk_88, 109); + int v0 = Menu_ProcessInputAndHandleExit(param0->unk_88, 109); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { @@ -2514,14 +2509,14 @@ static void ov98_02249964 (UnkStruct_ov98_02247704 * param0, int param1, int par ov98_02249900(param0, v0); } -static void ov98_022499A0 (BmpList * param0, u32 param1, u8 param2) +static void ov98_022499A0(ListMenu *param0, u32 param1, u8 param2) { if (param2 == 0) { Sound_PlayEffect(1500); } } -static void ov98_022499B4 (BmpList * param0, u32 param1, u8 param2) +static void ov98_022499B4(ListMenu *param0, u32 param1, u8 param2) { if (param2 == 0) { Sound_PlayEffect(1500); diff --git a/src/overlay104/ov104_0222FBE4.c b/src/overlay104/ov104_0222FBE4.c index 50583524d9..6f9c85b393 100644 --- a/src/overlay104/ov104_0222FBE4.c +++ b/src/overlay104/ov104_0222FBE4.c @@ -67,6 +67,7 @@ #include "field_comm_manager.h" #include "game_records.h" #include "heap.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "palette.h" @@ -80,7 +81,6 @@ #include "sys_task_manager.h" #include "text.h" #include "trainer_info.h" -#include "unk_02001AF4.h" #include "unk_020041CC.h" #include "unk_0200A9DC.h" #include "unk_0200C6E4.h" @@ -1009,7 +1009,7 @@ static BOOL ov104_02230260(UnkStruct_ov104_0222E930 *param0) u16 v2 = ov104_0222EA48(param0); u8 v3 = (*((param0)->unk_1C++)); - v0->unk_74 = sub_02002054(v1->unk_00, &Unk_ov104_0223F640, ((1024 - (18 + 12)) - 9), 12, v3, v0->unk_34); + v0->unk_74 = Menu_MakeYesNoChoiceWithCursorAt(v1->unk_00, &Unk_ov104_0223F640, ((1024 - (18 + 12)) - 9), 12, v3, v0->unk_34); param0->unk_78[0] = v2; ov104_0222E974(param0, ov104_022302B4); @@ -1023,7 +1023,7 @@ static BOOL ov104_022302B4(UnkStruct_ov104_0222E930 *param0) UnkStruct_ov104_022320B4 *v1 = param0->unk_00; u16 *v2 = ov104_0222FC14(param0, param0->unk_78[0]); - v0 = sub_02002114(v1->unk_74, v1->unk_34); + v0 = Menu_ProcessInputAndHandleExit(v1->unk_74, v1->unk_34); if (v0 == 0xffffffff) { return 0; diff --git a/src/overlay104/ov104_02231F74.c b/src/overlay104/ov104_02231F74.c index 1c8bf75c5b..67828b8abe 100644 --- a/src/overlay104/ov104_02231F74.c +++ b/src/overlay104/ov104_02231F74.c @@ -3,24 +3,18 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_0200C6E4_decl.h" #include "struct_decls/struct_0200C704_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_defs/archived_sprite.h" #include "struct_defs/sentence.h" #include "struct_defs/sprite_template.h" #include "struct_defs/struct_0200D0F4.h" -#include "struct_defs/struct_02013A04_t.h" -#include "struct_defs/struct_02081CF4.h" #include "overlay063/ov63_0222BE18.h" #include "overlay063/ov63_0222CCE4.h" #include "overlay063/ov63_0222D77C.h" #include "overlay063/struct_ov63_0222BEC0_decl.h" #include "overlay063/struct_ov63_0222CCB8.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "overlay104/ov104_0222E63C.h" #include "overlay104/ov104_0222E930.h" #include "overlay104/struct_ov104_0222E930_decl.h" @@ -40,6 +34,8 @@ #include "font.h" #include "game_options.h" #include "heap.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "palette.h" @@ -48,12 +44,11 @@ #include "render_text.h" #include "save_player.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "sys_task.h" #include "sys_task_manager.h" #include "text.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200C6E4.h" #include "unk_0200DA60.h" @@ -86,14 +81,14 @@ typedef struct UnkStruct_ov104_02232B5C_t { u8 unk_9B; u16 *unk_9C; u16 *unk_A0; - UnkStruct_02081CF4 unk_A4; - UIControlData *unk_B0; - ResourceMetadata unk_B4[28]; - UnkStruct_ov84_02240FA8 unk_194; - BmpList *unk_1B4; + MenuTemplate unk_A4; + Menu *unk_B0; + StringList unk_B4[28]; + ListMenuTemplate unk_194; + ListMenu *unk_1B4; u16 unk_1B8; u16 unk_1BA; - ResourceMetadata unk_1BC[28]; + StringList unk_1BC[28]; u16 unk_29C[28]; u16 unk_2D4; } UnkStruct_ov104_02232B5C; @@ -126,8 +121,8 @@ void ov104_02232624(UnkStruct_ov104_02232B5C *param0); static void ov104_02232750(UnkStruct_ov104_02232B5C *param0, u32 param1, u32 param2, u32 param3); static u32 ov104_022327F0(UnkStruct_ov104_02232B5C *param0); static void ov104_02232830(UnkStruct_ov104_02232B5C *param0); -static void ov104_0223293C(BmpList *param0, u32 param1, u8 param2); -static void ov104_02232960(BmpList *param0, u32 param1, u8 param2); +static void ov104_0223293C(ListMenu *param0, u32 param1, u8 param2); +static void ov104_02232960(ListMenu *param0, u32 param1, u8 param2); static void ov104_0223296C(SysTask *param0, void *param1); static void ov104_02232A58(UnkStruct_ov104_02232B5C *param0, u8 param1); static void ov104_02232B2C(UnkStruct_ov104_02232B5C *param0); @@ -263,13 +258,13 @@ static void ov104_0223214C(UnkStruct_ov104_022320B4 *param0, UnkStruct_ov104_022 param1->unk_2D4 = param4; for (v0 = 0; v0 < 28; v0++) { - param1->unk_B4[v0].unk_00 = NULL; - param1->unk_B4[v0].unk_04 = 0; + param1->unk_B4[v0].entry = NULL; + param1->unk_B4[v0].index = 0; } for (v0 = 0; v0 < 28; v0++) { - param1->unk_1BC[v0].unk_00 = NULL; - param1->unk_1BC[v0].unk_04 = 0; + param1->unk_1BC[v0].entry = NULL; + param1->unk_1BC[v0].index = 0; param1->unk_29C[v0] = 0xff; } @@ -328,7 +323,7 @@ void ov104_022322B0(UnkStruct_ov104_02232B5C *param0) Window_Add(v1->unk_00, ¶m0->unk_08, 1, param0->unk_98, param0->unk_99, v0, param0->unk_9B * 2, 14, 1); Window_Show(¶m0->unk_08, 1, 985, 12); ov104_02232454(param0); - param0->unk_B0 = sub_02001B9C(¶m0->unk_A4, param0->unk_96, param0->unk_00->unk_34); + param0->unk_B0 = Menu_NewSimple(¶m0->unk_A4, param0->unk_96, param0->unk_00->unk_34); ov104_022325D8(param0); param0->unk_04 = SysTask_Start(ov104_022324C8, param0, 0); } @@ -343,12 +338,12 @@ static void ov104_02232390(UnkStruct_ov104_02232B5C *param0, u32 param1, u32 par MessageLoader_GetStrbuf(param0->unk_8C, param1, v2); StringTemplate_Format(param0->unk_90, param0->unk_1C[param0->unk_9B], v2); - param0->unk_B4[param0->unk_9B].unk_00 = (const void *)param0->unk_1C[param0->unk_9B]; + param0->unk_B4[param0->unk_9B].entry = (const void *)param0->unk_1C[param0->unk_9B]; Strbuf_Free(v2); } param0->unk_29C[param0->unk_9B] = param2; - param0->unk_B4[param0->unk_9B].unk_04 = param3; + param0->unk_B4[param0->unk_9B].index = param3; param0->unk_9B++; return; @@ -363,11 +358,11 @@ static u32 ov104_02232414(UnkStruct_ov104_02232B5C *param0) v2 = 0; for (v0 = 0; v0 < param0->unk_9B; v0++) { - if (param0->unk_B4[v0].unk_00 == NULL) { + if (param0->unk_B4[v0].entry == NULL) { break; } - v1 = Font_CalcStrbufWidth(FONT_SYSTEM, (Strbuf *)param0->unk_B4[v0].unk_00, 0); + v1 = Font_CalcStrbufWidth(FONT_SYSTEM, (Strbuf *)param0->unk_B4[v0].entry, 0); if (v2 < v1) { v2 = v1; @@ -379,18 +374,18 @@ static u32 ov104_02232414(UnkStruct_ov104_02232B5C *param0) static void ov104_02232454(UnkStruct_ov104_02232B5C *param0) { - param0->unk_A4.unk_00 = param0->unk_B4; - param0->unk_A4.unk_04 = ¶m0->unk_08; - param0->unk_A4.unk_08 = 0; - param0->unk_A4.unk_09 = 1; - param0->unk_A4.unk_0A = param0->unk_9B; - param0->unk_A4.unk_0B_0 = 0; - param0->unk_A4.unk_0B_4 = 0; + param0->unk_A4.choices = param0->unk_B4; + param0->unk_A4.window = ¶m0->unk_08; + param0->unk_A4.fontID = FONT_SYSTEM; + param0->unk_A4.xSize = 1; + param0->unk_A4.ySize = param0->unk_9B; + param0->unk_A4.lineSpacing = 0; + param0->unk_A4.suppressCursor = FALSE; if (param0->unk_9B >= 4) { - param0->unk_A4.unk_0B_6 = 1; + param0->unk_A4.loopAround = TRUE; } else { - param0->unk_A4.unk_0B_6 = 0; + param0->unk_A4.loopAround = FALSE; } return; @@ -410,7 +405,7 @@ static void ov104_022324C8(SysTask *param0, void *param1) return; } - v0 = sub_02001BE0(v1->unk_B0); + v0 = Menu_ProcessInput(v1->unk_B0); if ((gCoreSys.pressedKeysRepeatable & PAD_KEY_UP) || (gCoreSys.pressedKeysRepeatable & PAD_KEY_DOWN) || (gCoreSys.pressedKeysRepeatable & PAD_KEY_LEFT) || (gCoreSys.pressedKeysRepeatable & PAD_KEY_RIGHT)) { ov104_022325D8(v1); @@ -444,9 +439,9 @@ static void ov104_02232570(UnkStruct_ov104_02232B5C *param0) Sound_PlayEffect(1500); - sub_02001BC4(param0->unk_B0, NULL); - Window_Clear(param0->unk_A4.unk_04, 0); - Window_Remove(param0->unk_A4.unk_04); + Menu_Free(param0->unk_B0, NULL); + Window_Clear(param0->unk_A4.window, 0); + Window_Remove(param0->unk_A4.window); for (v0 = 0; v0 < 28; v0++) { Strbuf_Free(param0->unk_1C[v0]); @@ -465,7 +460,7 @@ static void ov104_022325D8(UnkStruct_ov104_02232B5C *param0) { u8 v0; - v0 = sub_02001DC4(param0->unk_B0); + v0 = Menu_GetCursorPos(param0->unk_B0); if (param0->unk_29C[v0] != 0xff) { ov104_02232AC4(param0, param0->unk_29C[v0], TEXT_SPEED_INSTANT); @@ -514,7 +509,7 @@ void ov104_02232624(UnkStruct_ov104_02232B5C *param0) } Window_Show(¶m0->unk_08, 1, 985, 12); ov104_02232830(param0); - param0->unk_1B4 = sub_0200112C((const UnkStruct_ov84_02240FA8 *)¶m0->unk_194, 0, param0->unk_96, param0->unk_00->unk_34); + param0->unk_1B4 = ListMenu_New((const ListMenuTemplate *)¶m0->unk_194, 0, param0->unk_96, param0->unk_00->unk_34); ov104_02232B2C(param0); param0->unk_04 = SysTask_Start(ov104_0223296C, param0, 0); } @@ -529,15 +524,15 @@ static void ov104_02232750(UnkStruct_ov104_02232B5C *param0, u32 param1, u32 par MessageLoader_GetStrbuf(param0->unk_8C, param1, v2); StringTemplate_Format(param0->unk_90, param0->unk_1C[param0->unk_9B], v2); - param0->unk_1BC[param0->unk_9B].unk_00 = (const void *)param0->unk_1C[param0->unk_9B]; + param0->unk_1BC[param0->unk_9B].entry = (const void *)param0->unk_1C[param0->unk_9B]; Strbuf_Free(v2); } if (param3 == 0xfa) { - param0->unk_1BC[param0->unk_9B].unk_04 = 0xfffffffd; + param0->unk_1BC[param0->unk_9B].index = 0xfffffffd; } else { - param0->unk_1BC[param0->unk_9B].unk_04 = param3; + param0->unk_1BC[param0->unk_9B].index = param3; } param0->unk_29C[param0->unk_9B] = param2; @@ -555,11 +550,11 @@ static u32 ov104_022327F0(UnkStruct_ov104_02232B5C *param0) v2 = 0; for (v0 = 0; v0 < param0->unk_9B; v0++) { - if (param0->unk_1BC[v0].unk_00 == NULL) { + if (param0->unk_1BC[v0].entry == NULL) { break; } - v1 = Font_CalcStrbufWidth(FONT_SYSTEM, (Strbuf *)param0->unk_1BC[v0].unk_00, 0); + v1 = Font_CalcStrbufWidth(FONT_SYSTEM, (Strbuf *)param0->unk_1BC[v0].entry, 0); if (v2 < v1) { v2 = v1; @@ -571,50 +566,50 @@ static u32 ov104_022327F0(UnkStruct_ov104_02232B5C *param0) static void ov104_02232830(UnkStruct_ov104_02232B5C *param0) { - param0->unk_194.unk_00 = param0->unk_1BC; - param0->unk_194.unk_04 = ov104_02232960; - param0->unk_194.unk_08 = ov104_0223293C; - param0->unk_194.unk_0C = ¶m0->unk_08; + param0->unk_194.choices = param0->unk_1BC; + param0->unk_194.cursorCallback = ov104_02232960; + param0->unk_194.printCallback = ov104_0223293C; + param0->unk_194.window = ¶m0->unk_08; - param0->unk_194.unk_10 = param0->unk_9B; - param0->unk_194.unk_12 = 8; + param0->unk_194.count = param0->unk_9B; + param0->unk_194.maxDisplay = 8; - param0->unk_194.unk_14 = 1; - param0->unk_194.unk_15 = 12; - param0->unk_194.unk_16 = 2; - param0->unk_194.unk_17_0 = 1; + param0->unk_194.headerXOffset = 1; + param0->unk_194.textXOffset = 12; + param0->unk_194.cursorXOffset = 2; + param0->unk_194.yOffset = 1; - param0->unk_194.unk_17_4 = 1; - param0->unk_194.unk_18_0 = 15; - param0->unk_194.unk_18_4 = 2; + param0->unk_194.textColorFg = 1; + param0->unk_194.textColorBg = 15; + param0->unk_194.textColorShadow = 2; - param0->unk_194.unk_1A_0 = 0; - param0->unk_194.unk_1A_3 = 16; + param0->unk_194.letterSpacing = 0; + param0->unk_194.lineSpacing = 0; - param0->unk_194.unk_1A_7 = 0; + param0->unk_194.pagerMode = PAGER_MODE_NONE; - param0->unk_194.unk_1A_9 = 0; - param0->unk_194.unk_1A_15 = 0; + param0->unk_194.fontID = FONT_SYSTEM; + param0->unk_194.cursorType = 0; - param0->unk_194.unk_1C = (void *)param0; + param0->unk_194.tmp = (void *)param0; return; } -static void ov104_0223293C(BmpList *param0, u32 param1, u8 param2) +static void ov104_0223293C(ListMenu *param0, u32 param1, u8 param2) { if (param1 == 0xfffffffd) { - sub_0200147C(param0, 3, 15, 4); + ListMenu_SetAltTextColors(param0, 3, 15, 4); } else { - sub_0200147C(param0, 1, 15, 2); + ListMenu_SetAltTextColors(param0, 1, 15, 2); } } -static void ov104_02232960(BmpList *param0, u32 param1, u8 param2) +static void ov104_02232960(ListMenu *param0, u32 param1, u8 param2) { u32 v0, v1; u16 v2 = 0; u16 v3 = 0; - UnkStruct_ov104_02232B5C *v4 = (UnkStruct_ov104_02232B5C *)sub_02001504(param0, 19); + UnkStruct_ov104_02232B5C *v4 = (UnkStruct_ov104_02232B5C *)ListMenu_GetAttribute(param0, 19); return; } @@ -636,10 +631,10 @@ static void ov104_0223296C(SysTask *param0, void *param1) return; } - v1 = sub_02001288(v2->unk_1B4); + v1 = ListMenu_ProcessInput(v2->unk_1B4); v0 = v2->unk_2D4; - sub_020014D0(v2->unk_1B4, &v2->unk_2D4); + ListMenu_CalcTrueCursorPos(v2->unk_1B4, &v2->unk_2D4); if (v0 != v2->unk_2D4) { Sound_PlayEffect(1500); @@ -684,8 +679,8 @@ static void ov104_02232A58(UnkStruct_ov104_02232B5C *param0, u8 param1) Sound_PlayEffect(1500); } - sub_02001384(param0->unk_1B4, NULL, NULL); - Window_Clear(param0->unk_194.unk_0C, 0); + ListMenu_Free(param0->unk_1B4, NULL, NULL); + Window_Clear(param0->unk_194.window, 0); Window_Remove(¶m0->unk_08); for (v0 = 0; v0 < 28; v0++) { @@ -721,7 +716,7 @@ static void ov104_02232AC4(UnkStruct_ov104_02232B5C *param0, u16 param1, u32 par static void ov104_02232B2C(UnkStruct_ov104_02232B5C *param0) { - sub_020014D0(param0->unk_1B4, ¶m0->unk_1BA); + ListMenu_CalcTrueCursorPos(param0->unk_1B4, ¶m0->unk_1BA); if (param0->unk_29C[param0->unk_1BA] != 0xff) { ov104_02232AC4(param0, param0->unk_29C[param0->unk_1BA], TEXT_SPEED_INSTANT); diff --git a/src/overlay105/ov105_02241AE0.c b/src/overlay105/ov105_02241AE0.c index 74e1ff51d3..034d92fe10 100644 --- a/src/overlay105/ov105_02241AE0.c +++ b/src/overlay105/ov105_02241AE0.c @@ -4,14 +4,10 @@ #include #include "struct_decls/sprite_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_02007768_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/pokemon_summary.h" -#include "struct_defs/struct_02013A04_t.h" #include "struct_defs/struct_0207C690.h" -#include "struct_defs/struct_02081CF4.h" #include "struct_defs/struct_02099F80.h" #include "overlay104/ov104_0222DCE0.h" @@ -40,6 +36,7 @@ #include "graphics.h" #include "gx_layers.h" #include "heap.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "overlay_manager.h" @@ -50,10 +47,10 @@ #include "save_player.h" #include "savedata.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" #include "trainer_info.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200762C.h" #include "unk_020093B4.h" @@ -104,9 +101,9 @@ struct UnkStruct_ov105_02241FF4_t { u16 unk_3C[8]; BgConfig *unk_4C; Window unk_50[10]; - UnkStruct_02081CF4 unk_F0; - UIControlData *unk_FC; - ResourceMetadata unk_100[4]; + MenuTemplate unk_F0; + Menu *unk_FC; + StringList unk_100[4]; PaletteData *unk_120; GenericPointerData *unk_124; UnkStruct_02007768 *unk_128; @@ -925,15 +922,15 @@ static BOOL ov105_022426E0(UnkStruct_ov105_02241FF4 *param0) } break; case 2: - v1 = sub_02001BE0(param0->unk_FC); + v1 = Menu_ProcessInput(param0->unk_FC); ov105_02246080(param0->unk_310); switch (v1) { case 0xffffffff: break; case 0: - sub_02001BC4(param0->unk_FC, NULL); - ov105_02245A98(param0->unk_F0.unk_04); + Menu_Free(param0->unk_FC, NULL); + ov105_02245A98(param0->unk_F0.window); ov105_02246060(param0->unk_310); param0->unk_310 = NULL; param0->unk_13_6 = 1; @@ -941,9 +938,9 @@ static BOOL ov105_022426E0(UnkStruct_ov105_02241FF4 *param0) param0->unk_08++; break; case 1: - sub_02001BC4(param0->unk_FC, NULL); + Menu_Free(param0->unk_FC, NULL); - ov105_02245A98(param0->unk_F0.unk_04); + ov105_02245A98(param0->unk_F0.window); ov105_02242A58(param0); if (ov104_0223AED4(param0->unk_09) == 1) { @@ -952,9 +949,9 @@ static BOOL ov105_022426E0(UnkStruct_ov105_02241FF4 *param0) return 1; case 3: - sub_02001BC4(param0->unk_FC, NULL); + Menu_Free(param0->unk_FC, NULL); - ov105_02245A98(param0->unk_F0.unk_04); + ov105_02245A98(param0->unk_F0.window); ov105_02242B54(param0); if (ov104_0223AED4(param0->unk_09) == 1) { @@ -965,8 +962,8 @@ static BOOL ov105_022426E0(UnkStruct_ov105_02241FF4 *param0) case 0xfffffffe: case 2: default: - sub_02001BC4(param0->unk_FC, NULL); - ov105_02245A98(param0->unk_F0.unk_04); + Menu_Free(param0->unk_FC, NULL); + ov105_02245A98(param0->unk_F0.window); ov105_022461A4(param0->unk_30C, 0); ov105_02246060(param0->unk_310); param0->unk_310 = NULL; @@ -1220,15 +1217,15 @@ static BOOL ov105_02242D04(UnkStruct_ov105_02241FF4 *param0) param0->unk_08++; break; case 5: - v1 = sub_02001BE0(param0->unk_FC); + v1 = Menu_ProcessInput(param0->unk_FC); ov105_02246080(param0->unk_310); switch (v1) { case 0xffffffff: break; case 0: - sub_02001BC4(param0->unk_FC, NULL); - ov105_02245A98(param0->unk_F0.unk_04); + Menu_Free(param0->unk_FC, NULL); + ov105_02245A98(param0->unk_F0.window); ov105_02246060(param0->unk_310); param0->unk_310 = NULL; param0->unk_08++; @@ -1237,9 +1234,9 @@ static BOOL ov105_02242D04(UnkStruct_ov105_02241FF4 *param0) case 1: default: ov105_02246074(param0->unk_30C, 1); - sub_02001BC4(param0->unk_FC, NULL); + Menu_Free(param0->unk_FC, NULL); - ov105_02245A98(param0->unk_F0.unk_04); + ov105_02245A98(param0->unk_F0.window); ov105_02246060(param0->unk_310); param0->unk_310 = NULL; @@ -1455,15 +1452,15 @@ static BOOL ov105_022434BC(UnkStruct_ov105_02241FF4 *param0) } break; case 2: - v1 = sub_02001BE0(param0->unk_FC); + v1 = Menu_ProcessInput(param0->unk_FC); ov105_02246080(param0->unk_310); switch (v1) { case 0xffffffff: break; case 0: - sub_02001BC4(param0->unk_FC, NULL); - ov105_02245A98(param0->unk_F0.unk_04); + Menu_Free(param0->unk_FC, NULL); + ov105_02245A98(param0->unk_F0.window); ov105_02246060(param0->unk_310); param0->unk_310 = NULL; param0->unk_13_6 = 1; @@ -1471,15 +1468,15 @@ static BOOL ov105_022434BC(UnkStruct_ov105_02241FF4 *param0) param0->unk_08++; break; case 4: - sub_02001BC4(param0->unk_FC, NULL); - ov105_02245A98(param0->unk_F0.unk_04); + Menu_Free(param0->unk_FC, NULL); + ov105_02245A98(param0->unk_F0.window); ov105_02243738(param0); return 1; case 0xfffffffe: case 2: default: - sub_02001BC4(param0->unk_FC, NULL); - ov105_02245A98(param0->unk_F0.unk_04); + Menu_Free(param0->unk_FC, NULL); + ov105_02245A98(param0->unk_F0.window); ov105_022461A4(param0->unk_30C, 0); ov105_02246060(param0->unk_310); param0->unk_310 = NULL; @@ -1558,15 +1555,15 @@ static BOOL ov105_02243818(UnkStruct_ov105_02241FF4 *param0) param0->unk_08++; break; case 1: - v2 = sub_02001BE0(param0->unk_FC); + v2 = Menu_ProcessInput(param0->unk_FC); ov105_02246080(param0->unk_310); switch (v2) { case 0xffffffff: break; case 0: - sub_02001BC4(param0->unk_FC, NULL); - ov105_02245A98(param0->unk_F0.unk_04); + Menu_Free(param0->unk_FC, NULL); + ov105_02245A98(param0->unk_F0.window); ov105_02246060(param0->unk_310); param0->unk_310 = NULL; param0->unk_13_3 = 0; @@ -1580,8 +1577,8 @@ static BOOL ov105_02243818(UnkStruct_ov105_02241FF4 *param0) case 0xfffffffe: case 1: default: - sub_02001BC4(param0->unk_FC, NULL); - ov105_02245A98(param0->unk_F0.unk_04); + Menu_Free(param0->unk_FC, NULL); + ov105_02245A98(param0->unk_F0.window); ov105_02246060(param0->unk_310); param0->unk_310 = NULL; ov105_0224396C(param0); @@ -1680,7 +1677,7 @@ static BOOL ov105_02243A3C(UnkStruct_ov105_02241FF4 *param0) } break; case 2: - v2 = sub_02001BE0(param0->unk_FC); + v2 = Menu_ProcessInput(param0->unk_FC); ov105_02246080(param0->unk_310); switch (v2) { @@ -1688,8 +1685,8 @@ static BOOL ov105_02243A3C(UnkStruct_ov105_02241FF4 *param0) break; case 0: - sub_02001BC4(param0->unk_FC, NULL); - ov105_02245A98(param0->unk_F0.unk_04); + Menu_Free(param0->unk_FC, NULL); + ov105_02245A98(param0->unk_F0.window); ov105_02243D84(param0); if (ov104_0223AED4(param0->unk_09) == 1) { @@ -1701,8 +1698,8 @@ static BOOL ov105_02243A3C(UnkStruct_ov105_02241FF4 *param0) case 0xfffffffe: case 1: default: - sub_02001BC4(param0->unk_FC, NULL); - ov105_02245A98(param0->unk_F0.unk_04); + Menu_Free(param0->unk_FC, NULL); + ov105_02245A98(param0->unk_F0.window); ov105_02243DE4(param0); param0->unk_08 = 1; break; @@ -1787,16 +1784,16 @@ static BOOL ov105_02243E84(UnkStruct_ov105_02241FF4 *param0) break; case 1: - v2 = sub_02001BE0(param0->unk_FC); + v2 = Menu_ProcessInput(param0->unk_FC); ov105_02246080(param0->unk_310); switch (v2) { case 0xffffffff: break; case 0: - sub_02001BC4(param0->unk_FC, NULL); + Menu_Free(param0->unk_FC, NULL); - ov105_02245A98(param0->unk_F0.unk_04); + ov105_02245A98(param0->unk_F0.window); ov105_02246060(param0->unk_310); param0->unk_310 = NULL; @@ -1811,7 +1808,7 @@ static BOOL ov105_02243E84(UnkStruct_ov105_02241FF4 *param0) case 0xfffffffe: case 1: default: - sub_02001BC4(param0->unk_FC, NULL); + Menu_Free(param0->unk_FC, NULL); ov105_02246060(param0->unk_30C); param0->unk_30C = NULL; @@ -2083,8 +2080,8 @@ static BOOL ov105_02244424(UnkStruct_ov105_02241FF4 *param0) case 0: if (param0->unk_310 != NULL) { - sub_02001BC4(param0->unk_FC, NULL); - ov105_02245A98(param0->unk_F0.unk_04); + Menu_Free(param0->unk_FC, NULL); + ov105_02245A98(param0->unk_F0.window); ov105_02246060(param0->unk_310); param0->unk_310 = NULL; } @@ -2564,18 +2561,18 @@ static void ov105_02244D48(UnkStruct_ov105_02241FF4 *param0, Window *param1, u8 int v0; for (v0 = 0; v0 < 4; v0++) { - param0->unk_100[v0].unk_00 = NULL; - param0->unk_100[v0].unk_04 = 0; + param0->unk_100[v0].entry = NULL; + param0->unk_100[v0].index = 0; } - param0->unk_F0.unk_00 = param0->unk_100; - param0->unk_F0.unk_04 = param1; - param0->unk_F0.unk_08 = 0; - param0->unk_F0.unk_09 = 1; - param0->unk_F0.unk_0A = param2; - param0->unk_F0.unk_0B_0 = 0; - param0->unk_F0.unk_0B_4 = 1; - param0->unk_F0.unk_0B_6 = 1; + param0->unk_F0.choices = param0->unk_100; + param0->unk_F0.window = param1; + param0->unk_F0.fontID = FONT_SYSTEM; + param0->unk_F0.xSize = 1; + param0->unk_F0.ySize = param2; + param0->unk_F0.lineSpacing = 0; + param0->unk_F0.suppressCursor = TRUE; + param0->unk_F0.loopAround = TRUE; return; } @@ -2587,8 +2584,8 @@ static void ov105_02244DC4(UnkStruct_ov105_02241FF4 *param0, u8 param1, u8 param MessageLoader_GetStrbuf(param0->unk_1C, param3, param0->unk_2C[param1]); - param0->unk_100[param1].unk_00 = (const void *)param0->unk_2C[param1]; - param0->unk_100[param1].unk_04 = param2; + param0->unk_100[param1].entry = (const void *)param0->unk_2C[param1]; + param0->unk_100[param1].index = param2; return; } @@ -2610,7 +2607,7 @@ static void ov105_02244DF0(UnkStruct_ov105_02241FF4 *param0) } ov105_02244DC4(param0, 2, 2, 7); - param0->unk_FC = sub_02001B7C(¶m0->unk_F0, 0, 0, 0, 93, PAD_BUTTON_B); + param0->unk_FC = Menu_NewAndCopyToVRAM(¶m0->unk_F0, 0, 0, 0, 93, PAD_BUTTON_B); return; } @@ -2622,7 +2619,7 @@ static void ov105_02244E94(UnkStruct_ov105_02241FF4 *param0) ov105_02244DC4(param0, 0, 0, 3); ov105_02244DC4(param0, 1, 1, 4); - param0->unk_FC = sub_02001B7C(¶m0->unk_F0, 0, 0, 0, 93, PAD_BUTTON_B); + param0->unk_FC = Menu_NewAndCopyToVRAM(¶m0->unk_F0, 0, 0, 0, 93, PAD_BUTTON_B); return; } diff --git a/src/overlay106/ov106_02241AE0.c b/src/overlay106/ov106_02241AE0.c index 8960d33772..5356ab31d0 100644 --- a/src/overlay106/ov106_02241AE0.c +++ b/src/overlay106/ov106_02241AE0.c @@ -3,13 +3,9 @@ #include #include -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_0200C440_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/pokemon_summary.h" -#include "struct_defs/struct_02013A04_t.h" -#include "struct_defs/struct_02081CF4.h" #include "struct_defs/struct_02099F80.h" #include "overlay104/ov104_0222DCE0.h" @@ -32,6 +28,7 @@ #include "graphics.h" #include "gx_layers.h" #include "heap.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "overlay_manager.h" @@ -42,10 +39,10 @@ #include "save_player.h" #include "savedata.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" #include "trainer_info.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_020093B4.h" #include "unk_0200A784.h" @@ -95,9 +92,9 @@ struct UnkStruct_ov106_02243118_t { u16 unk_38[8]; BgConfig *unk_48; Window unk_4C[4]; - UnkStruct_02081CF4 unk_8C; - UIControlData *unk_98; - ResourceMetadata unk_9C[2]; + MenuTemplate unk_8C; + Menu *unk_98; + StringList unk_9C[2]; PaletteData *unk_AC; UnkStruct_0200C440 *unk_B0; Options *unk_B4; @@ -467,7 +464,7 @@ static BOOL ov106_02241E5C(UnkStruct_ov106_02243118 *param0) } break; case 3: - v1 = sub_02001BE0(param0->unk_98); + v1 = Menu_ProcessInput(param0->unk_98); switch (v1) { case 0xffffffff: @@ -613,7 +610,7 @@ static BOOL ov106_02242108(UnkStruct_ov106_02243118 *param0) param0->unk_08 = 5; break; case 5: - v1 = sub_02001BE0(param0->unk_98); + v1 = Menu_ProcessInput(param0->unk_98); switch (v1) { case 0xffffffff: @@ -1079,18 +1076,18 @@ static void ov106_022429B0(UnkStruct_ov106_02243118 *param0, Window *param1, u8 int v0; for (v0 = 0; v0 < 2; v0++) { - param0->unk_9C[v0].unk_00 = NULL; - param0->unk_9C[v0].unk_04 = 0; + param0->unk_9C[v0].entry = NULL; + param0->unk_9C[v0].index = 0; } - param0->unk_8C.unk_00 = param0->unk_9C; - param0->unk_8C.unk_04 = param1; - param0->unk_8C.unk_08 = 0; - param0->unk_8C.unk_09 = 1; - param0->unk_8C.unk_0A = param2; - param0->unk_8C.unk_0B_0 = 0; - param0->unk_8C.unk_0B_4 = 0; - param0->unk_8C.unk_0B_6 = 1; + param0->unk_8C.choices = param0->unk_9C; + param0->unk_8C.window = param1; + param0->unk_8C.fontID = FONT_SYSTEM; + param0->unk_8C.xSize = 1; + param0->unk_8C.ySize = param2; + param0->unk_8C.lineSpacing = 0; + param0->unk_8C.suppressCursor = FALSE; + param0->unk_8C.loopAround = TRUE; return; } @@ -1102,8 +1099,8 @@ static void ov106_02242A28(UnkStruct_ov106_02243118 *param0, u8 param1, u8 param MessageLoader_GetStrbuf(param0->unk_20, param3, param0->unk_30[param1]); - param0->unk_9C[param1].unk_00 = (const void *)param0->unk_30[param1]; - param0->unk_9C[param1].unk_04 = param2; + param0->unk_9C[param1].entry = (const void *)param0->unk_30[param1]; + param0->unk_9C[param1].index = param2; return; } @@ -1117,7 +1114,7 @@ static void ov106_02242A54(UnkStruct_ov106_02243118 *param0) ov106_02242A28(param0, 0, 0, 27); ov106_02242A28(param0, 1, 1, 28); - param0->unk_98 = sub_02001B7C(¶m0->unk_8C, 8, 0, 0, 98, PAD_BUTTON_B); + param0->unk_98 = Menu_NewAndCopyToVRAM(¶m0->unk_8C, 8, 0, 0, 98, PAD_BUTTON_B); return; } @@ -1619,8 +1616,8 @@ static void ov106_02243200(UnkStruct_ov106_02243118 *param0) { if (param0->unk_0F == 1) { param0->unk_0F = 0; - sub_02001BC4(param0->unk_98, NULL); - Window_Clear(param0->unk_8C.unk_04, 0); + Menu_Free(param0->unk_98, NULL); + Window_Clear(param0->unk_8C.window, 0); } return; diff --git a/src/overlay107/ov107_02241AE0.c b/src/overlay107/ov107_02241AE0.c index 0671fd0110..5bd0f1c5e1 100644 --- a/src/overlay107/ov107_02241AE0.c +++ b/src/overlay107/ov107_02241AE0.c @@ -3,19 +3,13 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_0200C440_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_020302DC_decl.h" #include "struct_decls/struct_0203041C_decl.h" #include "struct_decls/struct_0203068C_decl.h" #include "struct_decls/struct_party_decl.h" -#include "struct_defs/struct_02013A04_t.h" -#include "struct_defs/struct_02081CF4.h" #include "struct_defs/struct_02099F80.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "overlay104/ov104_0222DCE0.h" #include "overlay104/ov104_0223B6F4.h" #include "overlay104/struct_ov104_0223597C.h" @@ -38,6 +32,8 @@ #include "graphics.h" #include "gx_layers.h" #include "heap.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "overlay_manager.h" @@ -47,18 +43,16 @@ #include "save_player.h" #include "savedata.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" #include "trainer_info.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_020093B4.h" #include "unk_0200A784.h" #include "unk_0200C440.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" -#include "unk_02013A04.h" #include "unk_02017728.h" #include "unk_0201DBEC.h" #include "unk_020302D0.h" @@ -249,12 +243,12 @@ struct UnkStruct_ov107_02241D6C_t { u16 unk_3C[8]; BgConfig *unk_4C; Window unk_50[18]; - UnkStruct_02081CF4 unk_170; - UIControlData * unk_17C; - ResourceMetadata unk_180[3]; - BmpList * unk_198; - ResourceMetadata * unk_19C; - UnkStruct_ov84_02240FA8 unk_1A0; + MenuTemplate unk_170; + Menu *unk_17C; + StringList unk_180[3]; + ListMenu *unk_198; + StringList *unk_19C; + ListMenuTemplate unk_1A0; PaletteData *unk_1C0; UnkStruct_0200C440 * unk_1C4; Options * unk_1C8; @@ -339,16 +333,16 @@ static void ov107_0224414C(UnkStruct_ov107_02241D6C * param0, Window * param1, u static void ov107_022441B0(UnkStruct_ov107_02241D6C * param0, u8 param1, u8 param2, int param3); static void ov107_022441DC(UnkStruct_ov107_02241D6C * param0); static void ov107_02244240(UnkStruct_ov107_02241D6C * param0, u8 param1); -static void ov107_0224440C(BmpList * param0, u32 param1, u8 param2); -static void ov107_02244560(BmpList * param0, u32 param1, u8 param2); +static void ov107_0224440C(ListMenu *param0, u32 param1, u8 param2); +static void ov107_02244560(ListMenu *param0, u32 param1, u8 param2); static void ov107_022445C4(UnkStruct_ov107_02241D6C * param0); -static void ov107_02244690(BmpList * param0, u32 param1, u8 param2); -static void ov107_02244708(BmpList * param0, u32 param1, u8 param2); +static void ov107_02244690(ListMenu *param0, u32 param1, u8 param2); +static void ov107_02244708(ListMenu *param0, u32 param1, u8 param2); static void ov107_02244780(UnkStruct_ov107_02241D6C * param0); -static void ov107_0224486C(BmpList * param0, u32 param1, u8 param2); -static void ov107_022448E8(BmpList * param0, u32 param1, u8 param2); +static void ov107_0224486C(ListMenu *param0, u32 param1, u8 param2); +static void ov107_022448E8(ListMenu *param0, u32 param1, u8 param2); static void ov107_02244944(UnkStruct_ov107_02241D6C * param0); -static void ov107_02244A1C(BmpList * param0, u32 param1, u8 param2); +static void ov107_02244A1C(ListMenu *param0, u32 param1, u8 param2); static void ov107_02244A74(UnkStruct_ov107_02241D6C * param0, u32 param1, s32 param2, u32 param3, int param4); static void ov107_02244A8C(UnkStruct_ov107_02241D6C * param0, u32 param1, BoxPokemon * param2); static void ov107_02244A98(UnkStruct_ov107_02241D6C * param0, u32 param1); @@ -432,7 +426,7 @@ static const u16 Unk_ov107_02249E34[3][3] = { {0x0, 0x0, 0x0} }; -static const UnkStruct_ov84_02240FA8 Unk_ov107_02249EE4 = { +static const ListMenuTemplate Unk_ov107_02249EE4 = { NULL, ov107_0224440C, ov107_02244560, @@ -721,7 +715,7 @@ static BOOL ov107_02241EC8 (UnkStruct_ov107_02241D6C * param0) } break; case 1: - v6 = sub_02001288(param0->unk_198); + v6 = ListMenu_ProcessInput(param0->unk_198); ov107_02249CE0(v6, 1500); switch (v6) { @@ -760,30 +754,30 @@ static BOOL ov107_02241EC8 (UnkStruct_ov107_02241D6C * param0) } break; case 2: - sub_020014D0(param0->unk_198, ¶m0->unk_16); + ListMenu_CalcTrueCursorPos(param0->unk_198, ¶m0->unk_16); if (gCoreSys.pressedKeys & PAD_KEY_UP) { if (param0->unk_16 == 0) { - sub_02001408(param0->unk_198, (UnkStruct_ov84_02240FA8 *)¶m0->unk_1A0, 0, ((NELEMS(Unk_ov107_02249FF0)) - 1), 1, PAD_KEY_DOWN, NULL, NULL); - sub_020013AC(param0->unk_198); + ListMenu_TestInput(param0->unk_198, (ListMenuTemplate *)¶m0->unk_1A0, 0, ((NELEMS(Unk_ov107_02249FF0)) - 1), 1, PAD_KEY_DOWN, NULL, NULL); + ListMenu_Draw(param0->unk_198); Sound_PlayEffect(1500); ov107_0224379C(param0, ¶m0->unk_50[6], 28, 1, 1, TEXT_SPEED_NO_TRANSFER, 1, 2, 15, FONT_MESSAGE); return 0; } } else if (gCoreSys.pressedKeys & PAD_KEY_DOWN) { if (param0->unk_16 == ((NELEMS(Unk_ov107_02249FF0)) - 1)) { - sub_02001408(param0->unk_198, (UnkStruct_ov84_02240FA8 *)¶m0->unk_1A0, 0, 0, 1, PAD_KEY_UP, NULL, NULL); - sub_020013AC(param0->unk_198); + ListMenu_TestInput(param0->unk_198, (ListMenuTemplate *)¶m0->unk_1A0, 0, 0, 1, PAD_KEY_UP, NULL, NULL); + ListMenu_Draw(param0->unk_198); Sound_PlayEffect(1500); ov107_0224379C(param0, ¶m0->unk_50[6], 24, 1, 1, TEXT_SPEED_NO_TRANSFER, 1, 2, 15, FONT_MESSAGE); return 0; } } - v6 = sub_02001288(param0->unk_198); + v6 = ListMenu_ProcessInput(param0->unk_198); ov107_02249CE0(v6, 1500); - sub_020014D0(param0->unk_198, ¶m0->unk_16); + ListMenu_CalcTrueCursorPos(param0->unk_198, ¶m0->unk_16); switch (v6) { case 0xffffffff: @@ -832,7 +826,7 @@ static BOOL ov107_02241EC8 (UnkStruct_ov107_02241D6C * param0) } break; case 3: - v6 = sub_02001BE0(param0->unk_17C); + v6 = Menu_ProcessInput(param0->unk_17C); switch (v6) { case 0xffffffff: @@ -900,7 +894,7 @@ static BOOL ov107_02241EC8 (UnkStruct_ov107_02241D6C * param0) } break; case 4: - v6 = sub_02001BE0(param0->unk_17C); + v6 = Menu_ProcessInput(param0->unk_17C); switch (v6) { case 0xffffffff: @@ -961,9 +955,9 @@ static BOOL ov107_02241EC8 (UnkStruct_ov107_02241D6C * param0) break; case 8: GXLayers_EngineAToggleLayers(GX_PLANEMASK_BG2, 0); - v6 = sub_02001288(param0->unk_198); + v6 = ListMenu_ProcessInput(param0->unk_198); ov107_02249CE0(v6, 1500); - sub_020014D0(param0->unk_198, ¶m0->unk_16); + ListMenu_CalcTrueCursorPos(param0->unk_198, ¶m0->unk_16); switch (v6) { case 0xffffffff: @@ -1017,9 +1011,9 @@ static BOOL ov107_02241EC8 (UnkStruct_ov107_02241D6C * param0) } break; case 9: - v6 = sub_02001288(param0->unk_198); + v6 = ListMenu_ProcessInput(param0->unk_198); ov107_02249CE0(v6, 1500); - sub_020014D0(param0->unk_198, ¶m0->unk_16); + ListMenu_CalcTrueCursorPos(param0->unk_198, ¶m0->unk_16); switch (v6) { case 0xffffffff: @@ -1046,7 +1040,7 @@ static BOOL ov107_02241EC8 (UnkStruct_ov107_02241D6C * param0) break; case 10: v7 = Party_GetPokemonBySlotIndex(param0->unk_43C, ov107_02249C98(param0->unk_14, param0->unk_0D)); - v6 = sub_02001BE0(param0->unk_17C); + v6 = Menu_ProcessInput(param0->unk_17C); switch (v6) { case 0xffffffff: @@ -1095,7 +1089,7 @@ static BOOL ov107_02241EC8 (UnkStruct_ov107_02241D6C * param0) } break; case 11: - v6 = sub_02001BE0(param0->unk_17C); + v6 = Menu_ProcessInput(param0->unk_17C); switch (v6) { case 0xffffffff: @@ -1170,7 +1164,7 @@ static BOOL ov107_02241EC8 (UnkStruct_ov107_02241D6C * param0) } break; case 17: - v6 = sub_02001BE0(param0->unk_17C); + v6 = Menu_ProcessInput(param0->unk_17C); switch (v6) { case 0xffffffff: @@ -2318,7 +2312,7 @@ static void ov107_02244018 (UnkStruct_ov107_02241D6C * param0) static void ov107_0224403C (UnkStruct_ov107_02241D6C * param0) { - sub_020014DC(param0->unk_198, ¶m0->unk_18, ¶m0->unk_1A); + ListMenu_GetListAndCursorPos(param0->unk_198, ¶m0->unk_18, ¶m0->unk_1A); ov107_02245288(¶m0->unk_50[8]); ov107_02245730(param0); @@ -2397,18 +2391,18 @@ static void ov107_0224414C (UnkStruct_ov107_02241D6C * param0, Window * param1, int v0; for (v0 = 0; v0 < 3; v0++) { - param0->unk_180[v0].unk_00 = NULL; - param0->unk_180[v0].unk_04 = 0; + param0->unk_180[v0].entry = NULL; + param0->unk_180[v0].index = 0; } - param0->unk_170.unk_00 = param0->unk_180; - param0->unk_170.unk_04 = param1; - param0->unk_170.unk_08 = 0; - param0->unk_170.unk_09 = 1; - param0->unk_170.unk_0A = param2; - param0->unk_170.unk_0B_0 = 0; - param0->unk_170.unk_0B_4 = 0; - param0->unk_170.unk_0B_6 = 1; + param0->unk_170.choices = param0->unk_180; + param0->unk_170.window = param1; + param0->unk_170.fontID = FONT_SYSTEM; + param0->unk_170.xSize = 1; + param0->unk_170.ySize = param2; + param0->unk_170.lineSpacing = 0; + param0->unk_170.suppressCursor = FALSE; + param0->unk_170.loopAround = TRUE; return; } @@ -2420,8 +2414,8 @@ static void ov107_022441B0 (UnkStruct_ov107_02241D6C * param0, u8 param1, u8 par MessageLoader_GetStrbuf(param0->unk_20, param3, param0->unk_30[param1]); - param0->unk_180[param1].unk_00 = (const void *)param0->unk_30[param1]; - param0->unk_180[param1].unk_04 = param2; + param0->unk_180[param1].entry = (const void *)param0->unk_30[param1]; + param0->unk_180[param1].index = param2; return; } @@ -2433,7 +2427,7 @@ static void ov107_022441DC (UnkStruct_ov107_02241D6C * param0) ov107_022441B0(param0, 0, 0, 30); ov107_022441B0(param0, 1, 1, 31); - param0->unk_17C = sub_02001B7C(¶m0->unk_170, 8, 0, 0, 100, PAD_BUTTON_B); + param0->unk_17C = Menu_NewAndCopyToVRAM(¶m0->unk_170, 8, 0, 0, 100, PAD_BUTTON_B); param0->unk_0E_4 = 1; return; @@ -2468,7 +2462,7 @@ static void ov107_02244240 (UnkStruct_ov107_02241D6C * param0, u8 param1) v1 = Unk_ov107_02249E06[v0 - 1]; } - param0->unk_19C = sub_02013A04((v1 + 1), 100); + param0->unk_19C = StringList_New((v1 + 1), 100); for (v4 = 0; v4 < v1; v4++) { if (param1 == 6) { @@ -2477,23 +2471,23 @@ static void ov107_02244240 (UnkStruct_ov107_02241D6C * param0, u8 param1) v3 = Unk_ov107_02249F84[v4]; } - sub_02013A4C(param0->unk_19C, v5, v3, v4); + StringList_AddFromMessageBank(param0->unk_19C, v5, v3, v4); } - sub_02013A4C(param0->unk_19C, param0->unk_20, 13, 0xfffffffe); + StringList_AddFromMessageBank(param0->unk_19C, param0->unk_20, 13, 0xfffffffe); param0->unk_1A0 = Unk_ov107_02249EE4; - param0->unk_1A0.unk_00 = param0->unk_19C; - param0->unk_1A0.unk_0C = ¶m0->unk_50[5]; - param0->unk_1A0.unk_1C = param0; - param0->unk_1A0.unk_04 = ov107_0224440C; - param0->unk_1A0.unk_08 = ov107_02244560; - param0->unk_1A0.unk_10 = (v1 + 1); - param0->unk_1A0.unk_18_0 = 0; - param0->unk_1A0.unk_12 = 6; - param0->unk_1A0.unk_15 = 0; - param0->unk_1A0.unk_1A_15 = 1; - param0->unk_198 = sub_0200112C(¶m0->unk_1A0, 0, 0, 100); + param0->unk_1A0.choices = param0->unk_19C; + param0->unk_1A0.window = ¶m0->unk_50[5]; + param0->unk_1A0.tmp = param0; + param0->unk_1A0.cursorCallback = ov107_0224440C; + param0->unk_1A0.printCallback = ov107_02244560; + param0->unk_1A0.count = (v1 + 1); + param0->unk_1A0.textColorBg = 0; + param0->unk_1A0.maxDisplay = 6; + param0->unk_1A0.textXOffset = 0; + param0->unk_1A0.cursorType = 1; + param0->unk_198 = ListMenu_New(¶m0->unk_1A0, 0, 0, 100); ov107_02245650(param0, ¶m0->unk_50[5]); MessageLoader_Free(v5); @@ -2501,23 +2495,23 @@ static void ov107_02244240 (UnkStruct_ov107_02241D6C * param0, u8 param1) return; } -static void ov107_0224440C (BmpList * param0, u32 param1, u8 param2) +static void ov107_0224440C(ListMenu *param0, u32 param1, u8 param2) { u32 v0, v1; u16 v2, v3, v4, v5; - UnkStruct_ov107_02241D6C * v6 = (UnkStruct_ov107_02241D6C *)sub_02001504(param0, 19); + UnkStruct_ov107_02241D6C *v6 = (UnkStruct_ov107_02241D6C *)ListMenu_GetAttribute(param0, 19); if (param2 == 0) { Sound_PlayEffect(1500); - sub_020014D0(v6->unk_198, &v5); + ListMenu_CalcTrueCursorPos(v6->unk_198, &v5); } else { v5 = 0; } - v0 = sub_02001504(param0, 2); - v1 = sub_02001504(param0, 3); + v0 = ListMenu_GetAttribute(param0, 2); + v1 = ListMenu_GetAttribute(param0, 3); - sub_020014DC(param0, &v3, &v4); + ListMenu_GetListAndCursorPos(param0, &v3, &v4); if (v3 == 0) { ov107_02249BAC(v6->unk_3E8, 0); @@ -2547,9 +2541,9 @@ static void ov107_0224440C (BmpList * param0, u32 param1, u8 param2) return; } -static void ov107_02244560 (BmpList * param0, u32 param1, u8 param2) +static void ov107_02244560(ListMenu *param0, u32 param1, u8 param2) { - UnkStruct_ov107_02241D6C * v0 = (UnkStruct_ov107_02241D6C *)sub_02001504(param0, 19); + UnkStruct_ov107_02241D6C *v0 = (UnkStruct_ov107_02241D6C *)ListMenu_GetAttribute(param0, 19); if (param1 != 0xfffffffe) { ov107_02244A74(v0, 0, ov107_02244D5C(v0, param1, v0->unk_13), 4, 1); @@ -2570,33 +2564,33 @@ static void ov107_022445C4 (UnkStruct_ov107_02241D6C * param0) ov107_02249D84(param0->unk_4C, ¶m0->unk_50[10]); Window_FillTilemap(¶m0->unk_50[10], 15); - param0->unk_19C = sub_02013A04((NELEMS(Unk_ov107_02249FF0)), 100); + param0->unk_19C = StringList_New((NELEMS(Unk_ov107_02249FF0)), 100); for (v3 = 0; v3 < (NELEMS(Unk_ov107_02249FF0)); v3++) { - sub_02013A4C(param0->unk_19C, param0->unk_20, Unk_ov107_02249FF0[v3][1], Unk_ov107_02249FF0[v3][2]); + StringList_AddFromMessageBank(param0->unk_19C, param0->unk_20, Unk_ov107_02249FF0[v3][1], Unk_ov107_02249FF0[v3][2]); } param0->unk_1A0 = Unk_ov107_02249EE4; - param0->unk_1A0.unk_00 = param0->unk_19C; - param0->unk_1A0.unk_0C = ¶m0->unk_50[10]; - param0->unk_1A0.unk_1C = param0; - param0->unk_1A0.unk_04 = ov107_02244690; - param0->unk_1A0.unk_08 = ov107_02244708; - param0->unk_1A0.unk_10 = (NELEMS(Unk_ov107_02249FF0)); - param0->unk_1A0.unk_12 = (NELEMS(Unk_ov107_02249FF0)); - param0->unk_1A0.unk_18_0 = 15; - param0->unk_198 = sub_0200112C(¶m0->unk_1A0, 0, 0, 100); + param0->unk_1A0.choices = param0->unk_19C; + param0->unk_1A0.window = ¶m0->unk_50[10]; + param0->unk_1A0.tmp = param0; + param0->unk_1A0.cursorCallback = ov107_02244690; + param0->unk_1A0.printCallback = ov107_02244708; + param0->unk_1A0.count = (NELEMS(Unk_ov107_02249FF0)); + param0->unk_1A0.maxDisplay = (NELEMS(Unk_ov107_02249FF0)); + param0->unk_1A0.textColorBg = 15; + param0->unk_198 = ListMenu_New(¶m0->unk_1A0, 0, 0, 100); ov107_02245650(param0, ¶m0->unk_50[10]); return; } -static void ov107_02244690 (BmpList * param0, u32 param1, u8 param2) +static void ov107_02244690(ListMenu *param0, u32 param1, u8 param2) { u8 v0; u16 v1; - UnkStruct_ov107_02241D6C * v2 = (UnkStruct_ov107_02241D6C *)sub_02001504(param0, 19); + UnkStruct_ov107_02241D6C *v2 = (UnkStruct_ov107_02241D6C *)ListMenu_GetAttribute(param0, 19); if (param2 == 0) { Sound_PlayEffect(1500); @@ -2626,13 +2620,13 @@ static void ov107_02244690 (BmpList * param0, u32 param1, u8 param2) return; } -static void ov107_02244708 (BmpList * param0, u32 param1, u8 param2) +static void ov107_02244708(ListMenu *param0, u32 param1, u8 param2) { u16 v0; u8 v1, v2; - UnkStruct_ov107_02241D6C * v3 = (UnkStruct_ov107_02241D6C *)sub_02001504(param0, 19); + UnkStruct_ov107_02241D6C *v3 = (UnkStruct_ov107_02241D6C *)ListMenu_GetAttribute(param0, 19); - sub_020014D0(param0, &v0); + ListMenu_CalcTrueCursorPos(param0, &v0); v1 = ov107_02249CAC(v3->unk_1CC, v3->unk_09, 0); switch (param1) { @@ -2657,7 +2651,7 @@ static void ov107_02244708 (BmpList * param0, u32 param1, u8 param2) break; } - sub_020013D8(param0, v2, 15, 2); + ListMenu_SetTextColors(param0, v2, 15, 2); return; } @@ -2678,22 +2672,22 @@ static void ov107_02244780 (UnkStruct_ov107_02241D6C * param0) ov107_02249D84(param0->unk_4C, ¶m0->unk_50[11]); Window_FillTilemap(¶m0->unk_50[11], 15); - param0->unk_19C = sub_02013A04((NELEMS(Unk_ov107_02249F54)), 100); + param0->unk_19C = StringList_New((NELEMS(Unk_ov107_02249F54)), 100); for (v3 = 0; v3 < (NELEMS(Unk_ov107_02249F54)); v3++) { - sub_02013A4C(param0->unk_19C, param0->unk_20, Unk_ov107_02249F54[v3][1], Unk_ov107_02249F54[v3][2]); + StringList_AddFromMessageBank(param0->unk_19C, param0->unk_20, Unk_ov107_02249F54[v3][1], Unk_ov107_02249F54[v3][2]); } param0->unk_1A0 = Unk_ov107_02249EE4; - param0->unk_1A0.unk_00 = param0->unk_19C; - param0->unk_1A0.unk_0C = ¶m0->unk_50[11]; - param0->unk_1A0.unk_1C = param0; - param0->unk_1A0.unk_04 = ov107_0224486C; - param0->unk_1A0.unk_08 = ov107_022448E8; - param0->unk_1A0.unk_10 = (NELEMS(Unk_ov107_02249F54)); - param0->unk_1A0.unk_12 = (NELEMS(Unk_ov107_02249F54)); - param0->unk_1A0.unk_18_0 = 15; - param0->unk_198 = sub_0200112C(¶m0->unk_1A0, 0, 0, 100); + param0->unk_1A0.choices = param0->unk_19C; + param0->unk_1A0.window = ¶m0->unk_50[11]; + param0->unk_1A0.tmp = param0; + param0->unk_1A0.cursorCallback = ov107_0224486C; + param0->unk_1A0.printCallback = ov107_022448E8; + param0->unk_1A0.count = (NELEMS(Unk_ov107_02249F54)); + param0->unk_1A0.maxDisplay = (NELEMS(Unk_ov107_02249F54)); + param0->unk_1A0.textColorBg = 15; + param0->unk_198 = ListMenu_New(¶m0->unk_1A0, 0, 0, 100); ov107_02245650(param0, ¶m0->unk_50[11]); @@ -2703,11 +2697,11 @@ static void ov107_02244780 (UnkStruct_ov107_02241D6C * param0) return; } -static void ov107_0224486C (BmpList * param0, u32 param1, u8 param2) +static void ov107_0224486C(ListMenu *param0, u32 param1, u8 param2) { u16 v0; u8 v1; - UnkStruct_ov107_02241D6C * v2 = (UnkStruct_ov107_02241D6C *)sub_02001504(param0, 19); + UnkStruct_ov107_02241D6C *v2 = (UnkStruct_ov107_02241D6C *)ListMenu_GetAttribute(param0, 19); if (param2 == 0) { Sound_PlayEffect(1500); @@ -2740,10 +2734,10 @@ static void ov107_0224486C (BmpList * param0, u32 param1, u8 param2) return; } -static void ov107_022448E8 (BmpList * param0, u32 param1, u8 param2) +static void ov107_022448E8(ListMenu *param0, u32 param1, u8 param2) { u8 v0, v1; - UnkStruct_ov107_02241D6C * v2 = (UnkStruct_ov107_02241D6C *)sub_02001504(param0, 19); + UnkStruct_ov107_02241D6C *v2 = (UnkStruct_ov107_02241D6C *)ListMenu_GetAttribute(param0, 19); v0 = ov107_02249CAC(v2->unk_1CC, v2->unk_09, 1); @@ -2767,7 +2761,7 @@ static void ov107_022448E8 (BmpList * param0, u32 param1, u8 param2) break; } - sub_020013D8(param0, v1, 15, 2); + ListMenu_SetTextColors(param0, v1, 15, 2); return; } @@ -2794,23 +2788,23 @@ static void ov107_02244944 (UnkStruct_ov107_02241D6C * param0) ov107_02249D84(param0->unk_4C, ¶m0->unk_50[9]); Window_FillTilemap(¶m0->unk_50[9], 15); - param0->unk_19C = sub_02013A04(5, 100); + param0->unk_19C = StringList_New(5, 100); for (v0 = 0; v0 < 5; v0++) { - sub_02013A4C(param0->unk_19C, param0->unk_20, Unk_ov107_02249F2C[v0][0], Unk_ov107_02249F2C[v0][1]); + StringList_AddFromMessageBank(param0->unk_19C, param0->unk_20, Unk_ov107_02249F2C[v0][0], Unk_ov107_02249F2C[v0][1]); } param0->unk_1A0 = Unk_ov107_02249EE4; - param0->unk_1A0.unk_00 = param0->unk_19C; - param0->unk_1A0.unk_0C = ¶m0->unk_50[9]; - param0->unk_1A0.unk_1C = param0; - param0->unk_1A0.unk_04 = ov107_02244A1C; - param0->unk_1A0.unk_08 = NULL; - param0->unk_1A0.unk_10 = 5; - param0->unk_1A0.unk_12 = 5; - param0->unk_1A0.unk_18_0 = 15; - param0->unk_1A0.unk_1C = param0; - param0->unk_198 = sub_0200112C(¶m0->unk_1A0, param0->unk_18, param0->unk_1A, 100); + param0->unk_1A0.choices = param0->unk_19C; + param0->unk_1A0.window = ¶m0->unk_50[9]; + param0->unk_1A0.tmp = param0; + param0->unk_1A0.cursorCallback = ov107_02244A1C; + param0->unk_1A0.printCallback = NULL; + param0->unk_1A0.count = 5; + param0->unk_1A0.maxDisplay = 5; + param0->unk_1A0.textColorBg = 15; + param0->unk_1A0.tmp = param0; + param0->unk_198 = ListMenu_New(¶m0->unk_1A0, param0->unk_18, param0->unk_1A, 100); ov107_02245650(param0, ¶m0->unk_50[9]); Window_ScheduleCopyToVRAM(¶m0->unk_50[9]); @@ -2818,18 +2812,18 @@ static void ov107_02244944 (UnkStruct_ov107_02241D6C * param0) return; } -static void ov107_02244A1C (BmpList * param0, u32 param1, u8 param2) +static void ov107_02244A1C(ListMenu *param0, u32 param1, u8 param2) { UnkStruct_ov107_02241D6C * v0; u16 v1; - v0 = (UnkStruct_ov107_02241D6C *)sub_02001504(param0, 19); + v0 = (UnkStruct_ov107_02241D6C *)ListMenu_GetAttribute(param0, 19); if (param2 == 0) { Sound_PlayEffect(1500); } - sub_020014D0(param0, &v1); + ListMenu_CalcTrueCursorPos(param0, &v1); ov107_0224379C(v0, &v0->unk_50[8], Unk_ov107_02249E18[v1], 1, 1, TEXT_SPEED_NO_TRANSFER, 1, 2, 15, FONT_MESSAGE); return; @@ -3651,9 +3645,9 @@ static void ov107_02245618 (UnkStruct_ov107_02241D6C * param0) { if (param0->unk_0E_4 == 1) { param0->unk_0E_4 = 0; - sub_02001BC4(param0->unk_17C, NULL); - Window_Clear(param0->unk_170.unk_04, 1); - Window_ClearAndScheduleCopyToVRAM(param0->unk_170.unk_04); + Menu_Free(param0->unk_17C, NULL); + Window_Clear(param0->unk_170.window, 1); + Window_ClearAndScheduleCopyToVRAM(param0->unk_170.window); } return; @@ -3692,8 +3686,8 @@ static void ov107_022456E4 (UnkStruct_ov107_02241D6C * param0) ov107_02245288(¶m0->unk_50[6]); ov107_02249BAC(param0->unk_3F0, 1); - sub_020013AC(param0->unk_198); - sub_020014D0(param0->unk_198, &v0); + ListMenu_Draw(param0->unk_198); + ListMenu_CalcTrueCursorPos(param0->unk_198, &v0); ov107_02243EF8(param0, ¶m0->unk_50[12], ov107_02244DE0(param0, v0, param0->unk_13)); return; @@ -3705,14 +3699,14 @@ static void ov107_02245730 (UnkStruct_ov107_02241D6C * param0) if (param0->unk_0E_0 == 1) { param0->unk_0E_0 = 0; - v0 = (Window *)sub_02001504(param0->unk_198, 18); + v0 = (Window *)ListMenu_GetAttribute(param0->unk_198, 18); Window_Clear(v0, 1); Window_FillTilemap(v0, 0); Window_ClearAndScheduleCopyToVRAM(v0); - sub_02013A3C(param0->unk_19C); - sub_02001384(param0->unk_198, NULL, NULL); + StringList_Free(param0->unk_19C); + ListMenu_Free(param0->unk_198, NULL, NULL); } return; diff --git a/src/overlay107/ov107_02245EB0.c b/src/overlay107/ov107_02245EB0.c index 300d50777c..d3c1073e53 100644 --- a/src/overlay107/ov107_02245EB0.c +++ b/src/overlay107/ov107_02245EB0.c @@ -3,19 +3,13 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_0200C440_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_020302DC_decl.h" #include "struct_decls/struct_0203041C_decl.h" #include "struct_decls/struct_0203068C_decl.h" #include "struct_decls/struct_party_decl.h" -#include "struct_defs/struct_02013A04_t.h" -#include "struct_defs/struct_02081CF4.h" #include "struct_defs/struct_02099F80.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "overlay104/ov104_0222DCE0.h" #include "overlay104/ov104_0223B6F4.h" #include "overlay104/struct_ov104_0223597C.h" @@ -38,6 +32,8 @@ #include "graphics.h" #include "gx_layers.h" #include "heap.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "overlay_manager.h" @@ -47,18 +43,16 @@ #include "save_player.h" #include "savedata.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" #include "trainer_info.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_020093B4.h" #include "unk_0200A784.h" #include "unk_0200C440.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" -#include "unk_02013A04.h" #include "unk_02017728.h" #include "unk_0201DBEC.h" #include "unk_020302D0.h" @@ -104,11 +98,11 @@ struct UnkStruct_ov107_02246170_t { u16 unk_3C[8]; BgConfig *unk_4C; Window unk_50[12]; - UnkStruct_02081CF4 unk_110; - UIControlData * unk_11C; - ResourceMetadata unk_120[3]; - BmpList * unk_138; - ResourceMetadata * unk_13C; + MenuTemplate unk_110; + Menu *unk_11C; + StringList unk_120[3]; + ListMenu *unk_138; + StringList *unk_13C; PaletteData *unk_140; UnkStruct_0200C440 * unk_144; Options * unk_148; @@ -180,10 +174,10 @@ static void ov107_02247D68(UnkStruct_ov107_02246170 * param0, u8 param1, u8 para static void ov107_02247D94(UnkStruct_ov107_02246170 * param0); static void ov107_02247DF0(UnkStruct_ov107_02246170 * param0); static void ov107_02247E5C(UnkStruct_ov107_02246170 * param0); -static void ov107_02247F14(BmpList * param0, u32 param1, u8 param2); +static void ov107_02247F14(ListMenu *param0, u32 param1, u8 param2); static void ov107_02247F6C(UnkStruct_ov107_02246170 * param0); -static void ov107_02248028(BmpList * param0, u32 param1, u8 param2); -static void ov107_022480A0(BmpList * param0, u32 param1, u8 param2); +static void ov107_02248028(ListMenu *param0, u32 param1, u8 param2); +static void ov107_022480A0(ListMenu *param0, u32 param1, u8 param2); static void ov107_022480EC(UnkStruct_ov107_02246170 * param0, u32 param1, s32 param2, u32 param3, int param4); static void ov107_02248104(UnkStruct_ov107_02246170 * param0, u32 param1, BoxPokemon * param2); static void ov107_02248110(UnkStruct_ov107_02246170 * param0, u32 param1); @@ -521,9 +515,9 @@ static BOOL ov107_022462CC (UnkStruct_ov107_02246170 * param0) } break; case 2: - v7 = sub_02001288(param0->unk_138); + v7 = ListMenu_ProcessInput(param0->unk_138); ov107_02249CE0(v7, 1500); - sub_020014D0(param0->unk_138, ¶m0->unk_18); + ListMenu_CalcTrueCursorPos(param0->unk_138, ¶m0->unk_18); switch (v7) { case 0xffffffff: @@ -582,7 +576,7 @@ static BOOL ov107_022462CC (UnkStruct_ov107_02246170 * param0) } break; case 3: - v7 = sub_02001BE0(param0->unk_11C); + v7 = Menu_ProcessInput(param0->unk_11C); switch (v7) { case 0xffffffff: @@ -620,7 +614,7 @@ static BOOL ov107_022462CC (UnkStruct_ov107_02246170 * param0) } break; case 4: - v7 = sub_02001BE0(param0->unk_11C); + v7 = Menu_ProcessInput(param0->unk_11C); switch (v7) { case 0xffffffff: @@ -663,7 +657,7 @@ static BOOL ov107_022462CC (UnkStruct_ov107_02246170 * param0) } break; case 5: - v7 = sub_02001BE0(param0->unk_11C); + v7 = Menu_ProcessInput(param0->unk_11C); switch (v7) { case 0xffffffff: @@ -704,9 +698,9 @@ static BOOL ov107_022462CC (UnkStruct_ov107_02246170 * param0) } break; case 6: - v7 = sub_02001288(param0->unk_138); + v7 = ListMenu_ProcessInput(param0->unk_138); ov107_02249CE0(v7, 1500); - sub_020014D0(param0->unk_138, ¶m0->unk_18); + ListMenu_CalcTrueCursorPos(param0->unk_138, ¶m0->unk_18); switch (v7) { case 0xffffffff: @@ -777,7 +771,7 @@ static BOOL ov107_022462CC (UnkStruct_ov107_02246170 * param0) } break; case 7: - v7 = sub_02001BE0(param0->unk_11C); + v7 = Menu_ProcessInput(param0->unk_11C); switch (v7) { case 0xffffffff: @@ -798,7 +792,7 @@ static BOOL ov107_022462CC (UnkStruct_ov107_02246170 * param0) } break; case 8: - v7 = sub_02001BE0(param0->unk_11C); + v7 = Menu_ProcessInput(param0->unk_11C); switch (v7) { case 0xffffffff: @@ -819,7 +813,7 @@ static BOOL ov107_022462CC (UnkStruct_ov107_02246170 * param0) } break; case 9: - v7 = sub_02001BE0(param0->unk_11C); + v7 = Menu_ProcessInput(param0->unk_11C); switch (v7) { case 0xffffffff: @@ -1871,18 +1865,18 @@ static void ov107_02247D04 (UnkStruct_ov107_02246170 * param0, Window * param1, int v0; for (v0 = 0; v0 < 3; v0++) { - param0->unk_120[v0].unk_00 = NULL; - param0->unk_120[v0].unk_04 = 0; + param0->unk_120[v0].entry = NULL; + param0->unk_120[v0].index = 0; } - param0->unk_110.unk_00 = param0->unk_120; - param0->unk_110.unk_04 = param1; - param0->unk_110.unk_08 = 0; - param0->unk_110.unk_09 = 1; - param0->unk_110.unk_0A = param2; - param0->unk_110.unk_0B_0 = 0; - param0->unk_110.unk_0B_4 = 0; - param0->unk_110.unk_0B_6 = 1; + param0->unk_110.choices = param0->unk_120; + param0->unk_110.window = param1; + param0->unk_110.fontID = FONT_SYSTEM; + param0->unk_110.xSize = 1; + param0->unk_110.ySize = param2; + param0->unk_110.lineSpacing = 0; + param0->unk_110.suppressCursor = FALSE; + param0->unk_110.loopAround = TRUE; return; } @@ -1894,8 +1888,8 @@ static void ov107_02247D68 (UnkStruct_ov107_02246170 * param0, u8 param1, u8 par MessageLoader_GetStrbuf(param0->unk_20, param3, param0->unk_30[param1]); - param0->unk_120[param1].unk_00 = (const void *)param0->unk_30[param1]; - param0->unk_120[param1].unk_04 = param2; + param0->unk_120[param1].entry = (const void *)param0->unk_30[param1]; + param0->unk_120[param1].index = param2; return; } @@ -1907,7 +1901,7 @@ static void ov107_02247D94 (UnkStruct_ov107_02246170 * param0) ov107_02247D68(param0, 0, 0, 26); ov107_02247D68(param0, 1, 1, 27); - param0->unk_11C = sub_02001B7C(¶m0->unk_110, 8, 0, 0, 100, PAD_BUTTON_B); + param0->unk_11C = Menu_NewAndCopyToVRAM(¶m0->unk_110, 8, 0, 0, 100, PAD_BUTTON_B); param0->unk_0F_2 = 1; return; @@ -1921,13 +1915,13 @@ static void ov107_02247DF0 (UnkStruct_ov107_02246170 * param0) ov107_02247D68(param0, 1, 1, 23); ov107_02247D68(param0, 2, 2, 24); - param0->unk_11C = sub_02001B7C(¶m0->unk_110, 8, 0, 0, 100, PAD_BUTTON_B); + param0->unk_11C = Menu_NewAndCopyToVRAM(¶m0->unk_110, 8, 0, 0, 100, PAD_BUTTON_B); param0->unk_0F_2 = 1; return; } -static const UnkStruct_ov84_02240FA8 Unk_ov107_0224A17C = { +static const ListMenuTemplate Unk_ov107_0224A17C = { NULL, NULL, NULL, @@ -1966,46 +1960,46 @@ static const u32 Unk_ov107_0224A0CC[] = { static void ov107_02247E5C (UnkStruct_ov107_02246170 * param0) { int v0; - UnkStruct_ov84_02240FA8 v1; + ListMenuTemplate v1; ov107_02249D84(param0->unk_4C, ¶m0->unk_50[5]); Window_FillTilemap(¶m0->unk_50[5], 15); - param0->unk_13C = sub_02013A04((NELEMS(Unk_ov107_0224A1BC)), 100); + param0->unk_13C = StringList_New((NELEMS(Unk_ov107_0224A1BC)), 100); for (v0 = 0; v0 < (NELEMS(Unk_ov107_0224A1BC)); v0++) { - sub_02013A4C(param0->unk_13C, param0->unk_20, Unk_ov107_0224A1BC[v0][0], Unk_ov107_0224A1BC[v0][1]); + StringList_AddFromMessageBank(param0->unk_13C, param0->unk_20, Unk_ov107_0224A1BC[v0][0], Unk_ov107_0224A1BC[v0][1]); } v1 = Unk_ov107_0224A17C; - v1.unk_00 = param0->unk_13C; - v1.unk_0C = ¶m0->unk_50[5]; - v1.unk_1C = param0; - v1.unk_04 = ov107_02247F14; - v1.unk_08 = NULL; - v1.unk_10 = (NELEMS(Unk_ov107_0224A1BC)); - v1.unk_18_0 = 15; - v1.unk_12 = 4; + v1.choices = param0->unk_13C; + v1.window = ¶m0->unk_50[5]; + v1.tmp = param0; + v1.cursorCallback = ov107_02247F14; + v1.printCallback = NULL; + v1.count = (NELEMS(Unk_ov107_0224A1BC)); + v1.textColorBg = 15; + v1.maxDisplay = 4; - param0->unk_138 = sub_0200112C(&v1, param0->unk_1C, param0->unk_1E, 100); + param0->unk_138 = ListMenu_New(&v1, param0->unk_1C, param0->unk_1E, 100); param0->unk_0F_1 = 1; Window_ScheduleCopyToVRAM(¶m0->unk_50[5]); return; } -static void ov107_02247F14 (BmpList * param0, u32 param1, u8 param2) +static void ov107_02247F14(ListMenu *param0, u32 param1, u8 param2) { u32 v0, v1; u16 v2, v3, v4; - UnkStruct_ov107_02246170 * v5 = (UnkStruct_ov107_02246170 *)sub_02001504(param0, 19); + UnkStruct_ov107_02246170 *v5 = (UnkStruct_ov107_02246170 *)ListMenu_GetAttribute(param0, 19); if (param2 == 0) { Sound_PlayEffect(1500); } - sub_020014D0(param0, &v4); + ListMenu_CalcTrueCursorPos(param0, &v4); ov107_02247650(v5, &v5->unk_50[9], Unk_ov107_0224A0CC[v4], 1, 1, TEXT_SPEED_NO_TRANSFER, 1, 2, 15, FONT_MESSAGE); return; @@ -2028,46 +2022,46 @@ static const u16 Unk_ov107_0224A0AC[][2] = { static void ov107_02247F6C (UnkStruct_ov107_02246170 * param0) { int v0; - UnkStruct_ov84_02240FA8 v1; + ListMenuTemplate v1; ov107_02249D84(param0->unk_4C, ¶m0->unk_50[6]); Window_FillTilemap(¶m0->unk_50[6], 15); - param0->unk_13C = sub_02013A04((NELEMS(Unk_ov107_0224A19C)), 100); + param0->unk_13C = StringList_New((NELEMS(Unk_ov107_0224A19C)), 100); for (v0 = 0; v0 < (NELEMS(Unk_ov107_0224A19C)); v0++) { - sub_02013A4C(param0->unk_13C, param0->unk_20, Unk_ov107_0224A19C[v0][0], Unk_ov107_0224A19C[v0][1]); + StringList_AddFromMessageBank(param0->unk_13C, param0->unk_20, Unk_ov107_0224A19C[v0][0], Unk_ov107_0224A19C[v0][1]); } v1 = Unk_ov107_0224A17C; - v1.unk_00 = param0->unk_13C; - v1.unk_0C = ¶m0->unk_50[6]; - v1.unk_1C = param0; - v1.unk_04 = ov107_02248028; - v1.unk_08 = ov107_022480A0; - v1.unk_10 = (NELEMS(Unk_ov107_0224A19C)); - v1.unk_18_0 = 15; - v1.unk_12 = 4; + v1.choices = param0->unk_13C; + v1.window = ¶m0->unk_50[6]; + v1.tmp = param0; + v1.cursorCallback = ov107_02248028; + v1.printCallback = ov107_022480A0; + v1.count = (NELEMS(Unk_ov107_0224A19C)); + v1.textColorBg = 15; + v1.maxDisplay = 4; - param0->unk_138 = sub_0200112C(&v1, 0, 0, 100); + param0->unk_138 = ListMenu_New(&v1, 0, 0, 100); param0->unk_0F_1 = 1; Window_ScheduleCopyToVRAM(¶m0->unk_50[6]); return; } -static void ov107_02248028 (BmpList * param0, u32 param1, u8 param2) +static void ov107_02248028(ListMenu *param0, u32 param1, u8 param2) { u8 v0, v1; u16 v2; - UnkStruct_ov107_02246170 * v3 = (UnkStruct_ov107_02246170 *)sub_02001504(param0, 19); + UnkStruct_ov107_02246170 *v3 = (UnkStruct_ov107_02246170 *)ListMenu_GetAttribute(param0, 19); if (param2 == 0) { Sound_PlayEffect(1500); } - sub_020014D0(param0, &v2); + ListMenu_CalcTrueCursorPos(param0, &v2); v0 = ov107_02249CAC(v3->unk_14C, v3->unk_09, 2); @@ -2082,10 +2076,10 @@ static void ov107_02248028 (BmpList * param0, u32 param1, u8 param2) return; } -static void ov107_022480A0 (BmpList * param0, u32 param1, u8 param2) +static void ov107_022480A0(ListMenu *param0, u32 param1, u8 param2) { u8 v0, v1; - UnkStruct_ov107_02246170 * v2 = (UnkStruct_ov107_02246170 *)sub_02001504(param0, 19); + UnkStruct_ov107_02246170 *v2 = (UnkStruct_ov107_02246170 *)ListMenu_GetAttribute(param0, 19); v0 = ov107_02249CAC(v2->unk_14C, v2->unk_09, 2); v1 = 1; @@ -2110,7 +2104,7 @@ static void ov107_022480A0 (BmpList * param0, u32 param1, u8 param2) break; } - sub_020013D8(param0, v1, 15, 2); + ListMenu_SetTextColors(param0, v1, 15, 2); return; } @@ -2223,7 +2217,7 @@ static void ov107_022482B0 (UnkStruct_ov107_02246170 * param0) static void ov107_022482D4 (UnkStruct_ov107_02246170 * param0) { - sub_020014DC(param0->unk_138, ¶m0->unk_1C, ¶m0->unk_1E); + ListMenu_GetListAndCursorPos(param0->unk_138, ¶m0->unk_1C, ¶m0->unk_1E); ov107_02248860(¶m0->unk_50[9]); ov107_02249258(param0); @@ -2890,9 +2884,9 @@ static void ov107_02248BB4 (UnkStruct_ov107_02246170 * param0) { if (param0->unk_0F_2 == 1) { param0->unk_0F_2 = 0; - sub_02001BC4(param0->unk_11C, NULL); - Window_Clear(param0->unk_110.unk_04, 1); - Window_ClearAndScheduleCopyToVRAM(param0->unk_110.unk_04); + Menu_Free(param0->unk_11C, NULL); + Window_Clear(param0->unk_110.window, 1); + Window_ClearAndScheduleCopyToVRAM(param0->unk_110.window); } return; @@ -3372,13 +3366,13 @@ static void ov107_02249258 (UnkStruct_ov107_02246170 * param0) if (param0->unk_0F_1 == 1) { param0->unk_0F_1 = 0; - v0 = (Window *)sub_02001504(param0->unk_138, 18); + v0 = (Window *)ListMenu_GetAttribute(param0->unk_138, 18); Window_Clear(v0, 1); Window_FillTilemap(v0, 0); Window_ClearAndScheduleCopyToVRAM(v0); - sub_02013A3C(param0->unk_13C); - sub_02001384(param0->unk_138, NULL, NULL); + StringList_Free(param0->unk_13C); + ListMenu_Free(param0->unk_138, NULL, NULL); } return; diff --git a/src/overlay108/ov108_02241AE0.c b/src/overlay108/ov108_02241AE0.c index c5107ec807..6f2f36caaa 100644 --- a/src/overlay108/ov108_02241AE0.c +++ b/src/overlay108/ov108_02241AE0.c @@ -3,14 +3,10 @@ #include #include -#include "struct_decls/struct_02001AF4_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_020304A0_decl.h" #include "struct_decls/struct_020305B8_decl.h" #include "struct_decls/struct_0203068C_decl.h" #include "struct_decls/struct_party_decl.h" -#include "struct_defs/struct_02013A04_t.h" -#include "struct_defs/struct_02081CF4.h" #include "struct_defs/struct_02099F80.h" #include "overlay104/ov104_0223BCBC.h" @@ -32,6 +28,7 @@ #include "graphics.h" #include "gx_layers.h" #include "heap.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "overlay_manager.h" @@ -41,6 +38,7 @@ #include "save_player.h" #include "savedata.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "touch_screen.h" #include "trainer_info.h" @@ -194,9 +192,9 @@ struct UnkStruct_ov108_02241DB0_t { u16 unk_80[8]; BgConfig *unk_90; Window unk_94[2]; - UnkStruct_02081CF4 unk_B4; - UIControlData *unk_C0; - ResourceMetadata unk_C4[2]; + MenuTemplate unk_B4; + Menu *unk_C0; + StringList unk_C4[2]; PaletteData *unk_D4; Options *unk_D8; SaveData *unk_DC; diff --git a/src/overlay109/ov109_021D3D50.c b/src/overlay109/ov109_021D3D50.c index 1b17c9470b..2b1bf23875 100644 --- a/src/overlay109/ov109_021D3D50.c +++ b/src/overlay109/ov109_021D3D50.c @@ -26,6 +26,7 @@ #include "gx_layers.h" #include "heap.h" #include "journal.h" +#include "menu.h" #include "message.h" #include "message_util.h" #include "narc.h" @@ -38,7 +39,6 @@ #include "sys_task_manager.h" #include "text.h" #include "trainer_info.h" -#include "unk_02001AF4.h" #include "unk_020041CC.h" #include "unk_02005474.h" #include "unk_020093B4.h" @@ -838,7 +838,7 @@ static const WindowTemplate Unk_ov109_021D5D94 = { static int ov109_021D4950(UnkStruct_ov109_021D5140 *param0, int param1) { - param0->unk_394 = sub_02002100(param0->unk_14, &Unk_ov109_021D5D94, (1 + (18 + 12)), 11, 95); + param0->unk_394 = Menu_MakeYesNoChoice(param0->unk_14, &Unk_ov109_021D5D94, (1 + (18 + 12)), 11, 95); param0->unk_3B8 = 5; ov109_021D48D0(param0); @@ -875,7 +875,7 @@ static int ov109_021D4980(UnkStruct_ov109_021D5140 *param0, int param1) return param1; } - v1 = sub_02002114(param0->unk_394, 95); + v1 = Menu_ProcessInputAndHandleExit(param0->unk_394, 95); if (v1 != 0xffffffff) { if (v1 == 0xfffffffe) { @@ -962,7 +962,7 @@ static int ov109_021D4B44(UnkStruct_ov109_021D5140 *param0, int param1) static int ov109_021D4B64(UnkStruct_ov109_021D5140 *param0, int param1) { - param0->unk_394 = sub_02002100(param0->unk_14, &Unk_ov109_021D5D94, (1 + (18 + 12)), 11, 95); + param0->unk_394 = Menu_MakeYesNoChoice(param0->unk_14, &Unk_ov109_021D5D94, (1 + (18 + 12)), 11, 95); param0->unk_3B8 = 23; ov109_021D48D0(param0); @@ -984,7 +984,7 @@ static int ov109_021D4B94(UnkStruct_ov109_021D5140 *param0, int param1) return param1; } - v1 = sub_02002114(param0->unk_394, 95); + v1 = Menu_ProcessInputAndHandleExit(param0->unk_394, 95); if (v1 != 0xffffffff) { if (v1 == 0xfffffffe) { @@ -1122,7 +1122,7 @@ static int ov109_021D4DBC(UnkStruct_ov109_021D5140 *param0, int param1) static int ov109_021D4DF8(UnkStruct_ov109_021D5140 *param0, int param1) { - param0->unk_394 = sub_02002100(param0->unk_14, &Unk_ov109_021D5D94, (1 + (18 + 12)), 11, 95); + param0->unk_394 = Menu_MakeYesNoChoice(param0->unk_14, &Unk_ov109_021D5D94, (1 + (18 + 12)), 11, 95); param0->unk_3B8 = 12; ov109_021D48D0(param0); @@ -1142,7 +1142,7 @@ static int ov109_021D4E28(UnkStruct_ov109_021D5140 *param0, int param1) return param1; } - v0 = sub_02002114(param0->unk_394, 95); + v0 = Menu_ProcessInputAndHandleExit(param0->unk_394, 95); if (v0 != 0xffffffff) { if (v0 == 0xfffffffe) { @@ -1314,7 +1314,7 @@ void ov109_021D5140(UnkStruct_ov109_021D5140 *param0, int param1, u8 param2) break; case 13: if (param0->unk_394 != NULL) { - sub_02002154(param0->unk_394, 95); + Menu_DestroyForExit(param0->unk_394, 95); param0->unk_394 = NULL; } @@ -1327,7 +1327,7 @@ void ov109_021D5140(UnkStruct_ov109_021D5140 *param0, int param1, u8 param2) ov109_021D55A8(param0, 12, 0); if (param0->unk_394 != NULL) { - sub_02002154(param0->unk_394, 95); + Menu_DestroyForExit(param0->unk_394, 95); param0->unk_394 = NULL; } @@ -1344,7 +1344,7 @@ void ov109_021D5140(UnkStruct_ov109_021D5140 *param0, int param1, u8 param2) } if (param0->unk_394 != NULL) { - sub_02002154(param0->unk_394, 95); + Menu_DestroyForExit(param0->unk_394, 95); param0->unk_394 = NULL; } @@ -1362,7 +1362,7 @@ void ov109_021D5140(UnkStruct_ov109_021D5140 *param0, int param1, u8 param2) } if (param0->unk_394 != NULL) { - sub_02002154(param0->unk_394, 95); + Menu_DestroyForExit(param0->unk_394, 95); param0->unk_394 = NULL; } @@ -1745,7 +1745,7 @@ static int ov109_021D58AC(UnkStruct_ov109_021D5140 *param0, int param1) ov109_021D5858(param0, -1); if (param0->unk_394 != NULL) { - sub_02002154(param0->unk_394, 95); + Menu_DestroyForExit(param0->unk_394, 95); param0->unk_394 = NULL; } return 2; diff --git a/src/overlay119/ov119_021D0D80.c b/src/overlay119/ov119_021D0D80.c index ebe854c994..0d1077adb1 100644 --- a/src/overlay119/ov119_021D0D80.c +++ b/src/overlay119/ov119_021D0D80.c @@ -10,7 +10,6 @@ #include "struct_defs/sprite_animation_frame.h" #include "struct_defs/sprite_template.h" #include "struct_defs/struct_0207C690.h" -#include "struct_defs/struct_02081CF4.h" #include "struct_defs/struct_02099F80.h" #include "overlay104/struct_ov104_022412F4.h" @@ -24,22 +23,23 @@ #include "bg_window.h" #include "camera.h" +#include "font.h" #include "graphics.h" #include "gx_layers.h" #include "heap.h" +#include "menu.h" #include "message.h" #include "palette.h" #include "pokemon.h" #include "spl.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" -#include "unk_02001AF4.h" #include "unk_0200762C.h" #include "unk_0200C6E4.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" -#include "unk_02013A04.h" #include "unk_02014000.h" #include "unk_0201DBEC.h" #include "unk_0202419C.h" @@ -329,12 +329,12 @@ int ov119_021D1158(Window *param0, int param1, Pokemon *param2, int param3) void ov119_021D11E4(UnkStruct_ov119_021D0FD0 *param0, BgConfig *param1, Window *param2, int param3, int param4, int param5, int param6, int param7, int param8, int param9) { - UnkStruct_02081CF4 v0; + MenuTemplate v0; Window_Init(param2); Window_Add(param1, param2, param3, param4, param5, param6, param7, param9, param8); - param0->unk_04.unk_44 = sub_02013A04(2, 71); + param0->unk_04.unk_44 = StringList_New(2, 71); { int v1; @@ -343,24 +343,24 @@ void ov119_021D11E4(UnkStruct_ov119_021D0FD0 *param0, BgConfig *param1, Window * for (v1 = 0; v1 < 2; v1++) { v2 = MessageLoader_GetNewStrbuf(v3, 2 + v1); - sub_02013A6C(param0->unk_04.unk_44, v2, v1); + StringList_AddFromStrbuf(param0->unk_04.unk_44, v2, v1); Strbuf_Free(v2); } MessageLoader_Free(v3); } - v0.unk_00 = param0->unk_04.unk_44; - v0.unk_08 = 0; - v0.unk_04 = param2; - v0.unk_09 = 1; - v0.unk_0A = 2; - v0.unk_0B_0 = 0; - v0.unk_0B_4 = 0; - v0.unk_0B_6 = 1; + v0.choices = param0->unk_04.unk_44; + v0.fontID = FONT_SYSTEM; + v0.window = param2; + v0.xSize = 1; + v0.ySize = 2; + v0.lineSpacing = 0; + v0.suppressCursor = FALSE; + v0.loopAround = TRUE; Window_Show(param2, 1, (20 + (18 + 12)), 13); - param0->unk_04.unk_48 = sub_02001B7C(&v0, 8, 0, 0, 71, PAD_BUTTON_B); + param0->unk_04.unk_48 = Menu_NewAndCopyToVRAM(&v0, 8, 0, 0, 71, PAD_BUTTON_B); } void ov119_021D12CC(UnkStruct_ov119_021D0FD0 *param0) @@ -368,8 +368,8 @@ void ov119_021D12CC(UnkStruct_ov119_021D0FD0 *param0) Window_Clear(¶m0->unk_04.unk_14[1], 1); Window_ClearAndCopyToVRAM(¶m0->unk_04.unk_14[1]); Window_Remove(¶m0->unk_04.unk_14[1]); - sub_02001BC4(param0->unk_04.unk_48, NULL); - sub_02013A3C(param0->unk_04.unk_44); + Menu_Free(param0->unk_04.unk_48, NULL); + StringList_Free(param0->unk_04.unk_44); } void ov119_021D12F8(Window *param0) diff --git a/src/overlay119/ov119_021D191C.c b/src/overlay119/ov119_021D191C.c index 740251dd6e..220a7b75bf 100644 --- a/src/overlay119/ov119_021D191C.c +++ b/src/overlay119/ov119_021D191C.c @@ -11,10 +11,10 @@ #include "cell_actor.h" #include "gx_layers.h" +#include "menu.h" #include "palette.h" #include "pokemon.h" #include "text.h" -#include "unk_02001AF4.h" #include "unk_020041CC.h" #include "unk_02005474.h" #include "unk_0200762C.h" @@ -176,7 +176,7 @@ static BOOL ov119_021D1930(UnkStruct_ov119_021D0FD0 *param0) param0->unk_60++; break; case 12: { - u32 v9 = sub_02001BE0(param0->unk_04.unk_48); + u32 v9 = Menu_ProcessInput(param0->unk_04.unk_48); switch (v9) { case 0xfffffffe: @@ -329,7 +329,7 @@ static BOOL ov119_021D1BD0(UnkStruct_ov119_021D0FD0 *param0) param0->unk_60++; break; case 12: { - u32 v5 = sub_02001BE0(param0->unk_04.unk_48); + u32 v5 = Menu_ProcessInput(param0->unk_04.unk_48); switch (v5) { case 0xfffffffe: diff --git a/src/scrcmd.c b/src/scrcmd.c index d718603a05..f7b58354b7 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -9,7 +9,6 @@ #include "consts/scrcmd.h" #include "struct_decls/pokedexdata_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_decls/struct_02014EC4_decl.h" #include "struct_decls/struct_0202440C_decl.h" #include "struct_decls/struct_02025CCC_decl.h" @@ -111,6 +110,7 @@ #include "map_header_data.h" #include "map_object.h" #include "map_object_move.h" +#include "menu.h" #include "message.h" #include "message_util.h" #include "party.h" @@ -131,7 +131,6 @@ #include "text.h" #include "trainer_data.h" #include "trainer_info.h" -#include "unk_02001AF4.h" #include "unk_020041CC.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" @@ -2658,12 +2657,12 @@ static BOOL ScrCmd_03C(ScriptContext *ctx) static BOOL ScrCmd_03E(ScriptContext *ctx) { FieldSystem *fieldSystem = ctx->fieldSystem; - UIControlData **v1 = FieldSystem_GetScriptMemberPtr(fieldSystem, SCRIPT_MANAGER_UI_CONTROL); + Menu **v1 = FieldSystem_GetScriptMemberPtr(fieldSystem, SCRIPT_MANAGER_UI_CONTROL); u16 v2 = ScriptContext_ReadHalfWord(ctx); sub_0200DAA4(fieldSystem->unk_08, 3, 1024 - (18 + 12) - 9, 11, 0, 4); - *v1 = sub_02002100(fieldSystem->unk_08, &Unk_020EAB84, 1024 - (18 + 12) - 9, 11, 4); + *v1 = Menu_MakeYesNoChoice(fieldSystem->unk_08, &Unk_020EAB84, 1024 - (18 + 12) - 9, 11, 4); ctx->data[0] = v2; ScriptContext_Pause(ctx, sub_02040824); @@ -2675,10 +2674,10 @@ static BOOL sub_02040824(ScriptContext *ctx) { u32 v0; FieldSystem *fieldSystem = ctx->fieldSystem; - UIControlData **v2 = FieldSystem_GetScriptMemberPtr(fieldSystem, SCRIPT_MANAGER_UI_CONTROL); + Menu **v2 = FieldSystem_GetScriptMemberPtr(fieldSystem, SCRIPT_MANAGER_UI_CONTROL); u16 *v3 = FieldSystem_GetVarPointer(fieldSystem, ctx->data[0]); - v0 = sub_02002114(*v2, 4); + v0 = Menu_ProcessInputAndHandleExit(*v2, 4); if (v0 == 0xffffffff) { return 0; diff --git a/src/string_list.c b/src/string_list.c new file mode 100644 index 0000000000..272d84e6c9 --- /dev/null +++ b/src/string_list.c @@ -0,0 +1,106 @@ +#include "string_list.h" + +#include +#include + +#include "heap.h" +#include "message.h" +#include "strbuf.h" + +static StringList *FindFirstEmptyEntry(StringList *list, u32 *outHeapID); +static void FreeEntries(StringList *list); + +StringList *StringList_New(u32 capacity, u32 heapID) +{ + StringList *list = Heap_AllocFromHeap(heapID, sizeof(StringList) * (capacity + 1)); + + if (list) { + u32 i; + for (i = 0; i < capacity; i++) { + list[i].entry = NULL; + list[i].index = 0; + } + + // This entry is special; it should always have an index value equal + // to the heap on which this list was allocated. + list[i].entry = STRING_LIST_TERMINATOR; + list[i].index = heapID; + } + + return list; +} + +void StringList_Free(StringList *list) +{ + FreeEntries(list); + Heap_FreeToHeap(list); +} + +void StringList_AddFromMessageBank(StringList *list, const MessageLoader *loader, u32 bankEntry, u32 index) +{ + u32 tmp; + list = FindFirstEmptyEntry(list, &tmp); + + if (list) { + list->entry = MessageLoader_GetNewStrbuf(loader, bankEntry); + list->index = index; + } +} + +void StringList_AddFromStrbuf(StringList *list, const Strbuf *strbuf, u32 index) +{ + u32 heapID; + list = FindFirstEmptyEntry(list, &heapID); + + if (list) { + list->entry = Strbuf_Clone(strbuf, heapID); + list->index = index; + } +} + +void StringList_AddFromEntry(StringList *list, const StringList *entry) +{ + u32 tmp; + list = FindFirstEmptyEntry(list, &tmp); + + if (list) { + list->entry = entry->entry; + list->index = entry->index; + } +} + +static StringList *FindFirstEmptyEntry(StringList *list, u32 *outHeapID) +{ + while (list->entry != NULL) { + if (list->entry == STRING_LIST_TERMINATOR) { + GF_ASSERT(FALSE); + return NULL; + } + + list++; + } + + StringList *empty = list; + + // Keep going, so we can also get the heap ID + while (list->entry != STRING_LIST_TERMINATOR) { + list++; + } + + *outHeapID = list->index; + return empty; +} + +static void FreeEntries(StringList *list) +{ + StringList *tmp = list; + while (tmp->entry != STRING_LIST_TERMINATOR) { + if (tmp->entry == NULL) { + break; + } + + Strbuf_Free(tmp->entry); + tmp->entry = NULL; + tmp++; + } +} diff --git a/src/unk_0200112C.c b/src/unk_0200112C.c deleted file mode 100644 index 0193e22f7f..0000000000 --- a/src/unk_0200112C.c +++ /dev/null @@ -1,550 +0,0 @@ -#include "unk_0200112C.h" - -#include -#include -#include - -#include "struct_decls/struct_02013A04_decl.h" -#include "struct_defs/struct_02013A04_t.h" - -#include "overlay084/struct_ov84_02240FA8.h" - -#include "bg_window.h" -#include "colored_arrow.h" -#include "core_sys.h" -#include "font.h" -#include "heap.h" -#include "text.h" - -typedef struct { - u8 unk_00_0 : 4; - u8 unk_00_4 : 4; - u8 unk_01_0 : 4; - u8 unk_02_0 : 6; - u8 unk_03_0 : 6; - u8 unk_04_0 : 7; - u8 unk_04_7 : 1; -} UnkStruct_0200112C_sub1; - -typedef struct UnkStruct_0200112C_t { - UnkStruct_ov84_02240FA8 unk_00; - UnkStruct_0200112C_sub1 unk_1F; - ColoredArrow *unk_24; - u16 unk_28; - u16 unk_2A; - u8 unk_2C; - u8 unk_2D; - u8 unk_2E; - u8 unk_2F; - u8 unk_30; -} BmpList; - -static void sub_020015D0(BmpList *param0, void *param1, u8 param2, u8 param3); -static void sub_02001688(BmpList *param0, u16 param1, u16 param2, u16 param3); -static void sub_02001720(BmpList *param0); -static void sub_02001778(BmpList *param0, u16 param1); -static u8 sub_020017E0(BmpList *param0, u8 param1); -static void sub_02001900(BmpList *param0, u8 param1, u8 param2); -static u8 sub_02001A18(BmpList *param0, u8 param1, u8 param2, u8 param3); -static void sub_02001AD8(BmpList *param0, u8 param1); - -BmpList *sub_0200112C(const UnkStruct_ov84_02240FA8 *param0, u16 param1, u16 param2, u8 param3) -{ - BmpList *v0 = (BmpList *)Heap_AllocFromHeap(param3, sizeof(BmpList)); - - v0->unk_00 = *param0; - v0->unk_24 = ColoredArrow_New(param3); - v0->unk_28 = param1; - v0->unk_2A = param2; - v0->unk_2C = 0; - v0->unk_2D = 0; - v0->unk_2E = 0xff; - v0->unk_2F = 0; - v0->unk_30 = param3; - - v0->unk_1F.unk_00_0 = v0->unk_00.unk_17_4; - v0->unk_1F.unk_00_4 = v0->unk_00.unk_18_0; - v0->unk_1F.unk_01_0 = v0->unk_00.unk_18_4; - v0->unk_1F.unk_02_0 = v0->unk_00.unk_1A_0; - v0->unk_1F.unk_04_0 = v0->unk_00.unk_1A_9; - v0->unk_1F.unk_04_7 = 0; - - if (v0->unk_00.unk_10 < v0->unk_00.unk_12) { - v0->unk_00.unk_12 = v0->unk_00.unk_10; - } - - ColoredArrow_SetColor(v0->unk_24, TEXT_COLOR(v0->unk_00.unk_17_4, v0->unk_00.unk_18_4, v0->unk_00.unk_18_0)); - Window_FillTilemap(v0->unk_00.unk_0C, v0->unk_00.unk_18_0); - sub_02001688(v0, v0->unk_28, 0, v0->unk_00.unk_12); - sub_02001720(v0); - sub_02001AD8(v0, 1); - Window_CopyToVRAM(param0->unk_0C); - - return v0; -} - -u32 sub_02001288(BmpList *param0) -{ - u16 v0, v1; - - param0->unk_2F = 0; - - if (gCoreSys.pressedKeys & PAD_BUTTON_A) { - return param0->unk_00.unk_00[param0->unk_28 + param0->unk_2A].unk_04; - } - - if (gCoreSys.pressedKeys & PAD_BUTTON_B) { - return 0xfffffffe; - } - - if (gCoreSys.pressedKeysRepeatable & PAD_KEY_UP) { - if (sub_02001A18(param0, 1, 1, 0) == 0) { - param0->unk_2F = 1; - } - - return 0xffffffff; - } - - if (gCoreSys.pressedKeysRepeatable & PAD_KEY_DOWN) { - if (sub_02001A18(param0, 1, 1, 1) == 0) { - param0->unk_2F = 2; - } - - return 0xffffffff; - } - - switch (param0->unk_00.unk_1A_7) { - default: - case 0: - v0 = 0; - v1 = 0; - break; - case 1: - v0 = (gCoreSys.pressedKeysRepeatable & PAD_KEY_LEFT); - v1 = (gCoreSys.pressedKeysRepeatable & PAD_KEY_RIGHT); - break; - case 2: - v0 = (gCoreSys.pressedKeysRepeatable & PAD_BUTTON_L); - v1 = (gCoreSys.pressedKeysRepeatable & PAD_BUTTON_R); - break; - } - - if (v0) { - if (sub_02001A18(param0, 1, (u8)param0->unk_00.unk_12, 0) == 0) { - param0->unk_2F = 3; - } - - return 0xffffffff; - } - - if (v1) { - if (sub_02001A18(param0, 1, (u8)param0->unk_00.unk_12, 1) == 0) { - param0->unk_2F = 4; - } - - return 0xffffffff; - } - - return 0xffffffff; -} - -void sub_02001384(BmpList *param0, u16 *param1, u16 *param2) -{ - if (param1 != NULL) { - *param1 = param0->unk_28; - } - - if (param2 != NULL) { - *param2 = param0->unk_2A; - } - - ColoredArrow_Free(param0->unk_24); - Heap_FreeToHeapExplicit(param0->unk_30, param0); -} - -void sub_020013AC(BmpList *param0) -{ - Window_FillTilemap(param0->unk_00.unk_0C, param0->unk_00.unk_18_0); - sub_02001688(param0, param0->unk_28, 0, param0->unk_00.unk_12); - sub_02001720(param0); - Window_CopyToVRAM(param0->unk_00.unk_0C); -} - -void sub_020013D8(BmpList *param0, u8 param1, u8 param2, u8 param3) -{ - param0->unk_00.unk_17_4 = param1; - param0->unk_00.unk_18_0 = param2; - param0->unk_00.unk_18_4 = param3; -} - -u32 sub_02001408(BmpList *param0, UnkStruct_ov84_02240FA8 *param1, u16 param2, u16 param3, u16 param4, u16 param5, u16 *param6, u16 *param7) -{ - if (param1) { - param0->unk_00 = *param1; - } - - param0->unk_28 = param2; - param0->unk_2A = param3; - param0->unk_2C = 0; - param0->unk_2D = 0; - - if (param5 == PAD_KEY_UP) { - sub_02001A18(param0, param4, 1, 0); - } else if (param5 == PAD_KEY_DOWN) { - sub_02001A18(param0, param4, 1, 1); - } - - if (param6 != NULL) { - *param6 = param0->unk_28; - } - - if (param7 != NULL) { - *param7 = param0->unk_2A; - } - - return 0xffffffff; -} - -void sub_0200147C(BmpList *param0, u8 param1, u8 param2, u8 param3) -{ - param0->unk_1F.unk_00_0 = param1; - param0->unk_1F.unk_00_4 = param2; - param0->unk_1F.unk_01_0 = param3; - param0->unk_1F.unk_04_7 = 1; -} - -void sub_020014D0(BmpList *param0, u16 *param1) -{ - *param1 = (u16)(param0->unk_28 + param0->unk_2A); -} - -void sub_020014DC(BmpList *param0, u16 *param1, u16 *param2) -{ - if (param1 != NULL) { - *param1 = param0->unk_28; - } - - if (param2 != NULL) { - *param2 = param0->unk_2A; - } -} - -u8 sub_020014F0(BmpList *param0) -{ - return param0->unk_2F; -} - -u32 sub_020014F8(BmpList *param0, u16 param1) -{ - return param0->unk_00.unk_00[param1].unk_04; -} - -u32 sub_02001504(BmpList *param0, u8 param1) -{ - u32 v0; - - switch (param1) { - case 0: - v0 = (u32)param0->unk_00.unk_04; - break; - case 1: - v0 = (u32)param0->unk_00.unk_08; - break; - case 2: - v0 = (u32)param0->unk_00.unk_10; - break; - case 3: - v0 = (u32)param0->unk_00.unk_12; - break; - case 5: - v0 = (u32)param0->unk_00.unk_14; - break; - case 6: - v0 = (u32)param0->unk_00.unk_15; - break; - case 7: - v0 = (u32)param0->unk_00.unk_16; - break; - case 8: - v0 = (u32)param0->unk_00.unk_17_0; - break; - case 9: - v0 = (u32)Font_GetAttribute(param0->unk_00.unk_1A_9, 1) + param0->unk_00.unk_1A_3; - break; - case 10: - v0 = (u32)param0->unk_00.unk_17_4; - break; - case 11: - v0 = (u32)param0->unk_00.unk_18_0; - break; - case 12: - v0 = (u32)param0->unk_00.unk_18_4; - break; - case 13: - v0 = (u32)param0->unk_00.unk_1A_0; - break; - case 14: - v0 = (u32)param0->unk_00.unk_1A_3; - break; - case 15: - v0 = (u32)param0->unk_00.unk_1A_7; - break; - case 16: - v0 = (u32)param0->unk_00.unk_1A_9; - break; - case 17: - v0 = (u32)param0->unk_00.unk_1A_15; - break; - case 18: - v0 = (u32)param0->unk_00.unk_0C; - break; - case 19: - v0 = (u32)param0->unk_00.unk_1C; - break; - default: - v0 = 0xffffffff; - } - - return v0; -} - -void sub_020015CC(BmpList *param0, ResourceMetadata *param1) -{ - param0->unk_00.unk_00 = param1; -} - -static void sub_020015D0(BmpList *param0, void *param1, u8 param2, u8 param3) -{ - if (param1 == NULL) { - return; - } - - if (param0->unk_1F.unk_04_7) { - Text_AddPrinterWithParamsColorAndSpacing(param0->unk_00.unk_0C, param0->unk_1F.unk_04_0, param1, param2, param3, TEXT_SPEED_NO_TRANSFER, TEXT_COLOR(param0->unk_1F.unk_00_0, param0->unk_1F.unk_01_0, param0->unk_1F.unk_00_4), param0->unk_1F.unk_02_0, 0, NULL); - } else { - Text_AddPrinterWithParamsColorAndSpacing(param0->unk_00.unk_0C, param0->unk_00.unk_1A_9, param1, param2, param3, TEXT_SPEED_NO_TRANSFER, TEXT_COLOR(param0->unk_00.unk_17_4, param0->unk_00.unk_18_4, param0->unk_00.unk_18_0), param0->unk_00.unk_1A_0, 0, NULL); - } -} - -static void sub_02001688(BmpList *param0, u16 param1, u16 param2, u16 param3) -{ - int v0; - u8 v1, v2, v3; - - v3 = Font_GetAttribute(param0->unk_00.unk_1A_9, 1) + param0->unk_00.unk_1A_3; - - for (v0 = 0; v0 < param3; v0++) { - if (param0->unk_00.unk_00[param1].unk_04 != 0xfffffffd) { - v1 = param0->unk_00.unk_15; - } else { - v1 = param0->unk_00.unk_14; - } - - v2 = (u8)(((v0 + param2) * v3) + param0->unk_00.unk_17_0); - - if (param0->unk_00.unk_08 != NULL) { - param0->unk_00.unk_08(param0, param0->unk_00.unk_00[param1].unk_04, v2); - } - - sub_020015D0(param0, (void *)param0->unk_00.unk_00[param1].unk_00, v1, v2); - param1++; - } -} - -static void sub_02001720(BmpList *param0) -{ - u8 v0, v1, v2; - - v2 = Font_GetAttribute(param0->unk_00.unk_1A_9, 1) + param0->unk_00.unk_1A_3; - v0 = param0->unk_00.unk_16; - v1 = (u8)((param0->unk_2A * v2) + param0->unk_00.unk_17_0); - - switch (param0->unk_00.unk_1A_15) { - case 0: - ColoredArrow_Print(param0->unk_24, param0->unk_00.unk_0C, v0, v1); - break; - case 1: - break; - case 2: - break; - case 3: - break; - } -} - -static void sub_02001778(BmpList *param0, u16 param1) -{ - u8 v0; - - switch (param0->unk_00.unk_1A_15) { - case 0: - v0 = Font_GetAttribute(param0->unk_00.unk_1A_9, 1) + param0->unk_00.unk_1A_3; - Window_FillRectWithColor(param0->unk_00.unk_0C, (u8)param0->unk_00.unk_18_0, param0->unk_00.unk_16, (u16)(param1 * v0 + param0->unk_00.unk_17_0), 8, 16); - break; - case 1: - case 2: - case 3: - break; - } -} - -static u8 sub_020017E0(BmpList *param0, u8 param1) -{ - u16 v0, v1, v2; - - v1 = param0->unk_2A; - v0 = param0->unk_28; - - if (param1 == 0) { - if (param0->unk_00.unk_12 == 1) { - v2 = 0; - } else { - v2 = (u16)(param0->unk_00.unk_12 - ((param0->unk_00.unk_12 / 2) + (param0->unk_00.unk_12 % 2)) - 1); - } - - if (v0 == 0) { - while (v1 > 0) { - v1--; - - if (param0->unk_00.unk_00[v0 + v1].unk_04 != 0xfffffffd) { - param0->unk_2A = v1; - return 1; - } - } - - return 0; - } - - while (v1 > v2) { - v1--; - - if (param0->unk_00.unk_00[v0 + v1].unk_04 != 0xfffffffd) { - param0->unk_2A = v1; - return 1; - } - } - - v0--; - - param0->unk_2A = v2; - param0->unk_28 = v0; - } else { - if (param0->unk_00.unk_12 == 1) { - v2 = 0; - } else { - v2 = (u16)((param0->unk_00.unk_12 / 2) + (param0->unk_00.unk_12 % 2)); - } - - if (v0 == (param0->unk_00.unk_10 - param0->unk_00.unk_12)) { - while (v1 < (param0->unk_00.unk_12 - 1)) { - v1++; - - if (param0->unk_00.unk_00[v0 + v1].unk_04 != 0xfffffffd) { - param0->unk_2A = v1; - return 1; - } - } - - return 0; - } - - while (v1 < v2) { - v1++; - - if (param0->unk_00.unk_00[v0 + v1].unk_04 != 0xfffffffd) { - param0->unk_2A = v1; - return 1; - } - } - - v0++; - - param0->unk_2A = v2; - param0->unk_28 = v0; - } - - return 2; -} - -static void sub_02001900(BmpList *param0, u8 param1, u8 param2) -{ - u8 v0; - u16 v1; - - if (param1 >= param0->unk_00.unk_12) { - Window_FillTilemap(param0->unk_00.unk_0C, param0->unk_00.unk_18_0); - sub_02001688(param0, param0->unk_28, 0, param0->unk_00.unk_12); - return; - } - - v0 = Font_GetAttribute(param0->unk_00.unk_1A_9, 1) + param0->unk_00.unk_1A_3; - - if (param2 == 0) { - Window_Scroll(param0->unk_00.unk_0C, 1, (u8)(param1 * v0), (u8)((param0->unk_00.unk_18_0 << 4) | param0->unk_00.unk_18_0)); - sub_02001688(param0, param0->unk_28, 0, param1); - - v1 = (u16)(param0->unk_00.unk_12 * v0 + param0->unk_00.unk_17_0); - - Window_FillRectWithColor(param0->unk_00.unk_0C, (u8)param0->unk_00.unk_18_0, 0, v1, (u16)(Window_GetWidth(param0->unk_00.unk_0C) * 8), (u16)(Window_GetHeight(param0->unk_00.unk_0C) * 8 - v1)); - } else { - Window_Scroll(param0->unk_00.unk_0C, 0, (u8)(param1 * v0), (u8)((param0->unk_00.unk_18_0 << 4) | param0->unk_00.unk_18_0)); - sub_02001688(param0, (u16)(param0->unk_28 + (param0->unk_00.unk_12 - param1)), (u16)(param0->unk_00.unk_12 - param1), (u16)param1); - Window_FillRectWithColor(param0->unk_00.unk_0C, (u8)param0->unk_00.unk_18_0, 0, 0, (u16)(Window_GetWidth(param0->unk_00.unk_0C) * 8), (u16)param0->unk_00.unk_17_0); - } -} - -static u8 sub_02001A18(BmpList *param0, u8 param1, u8 param2, u8 param3) -{ - u16 v0; - u8 v1, v2; - u8 v3, v4; - - v0 = param0->unk_2A; - v4 = 0; - v2 = 0; - - for (v3 = 0; v3 < param2; v3++) { - do { - v1 = sub_020017E0(param0, param3); - v2 |= v1; - - if (v1 != 2) { - break; - } - - v4++; - } while (param0->unk_00.unk_00[param0->unk_28 + param0->unk_2A].unk_04 == 0xfffffffd); - } - - if (param1) { - switch (v2) { - default: - case 0: - return 1; - break; - case 1: - sub_02001778(param0, v0); - sub_02001720(param0); - sub_02001AD8(param0, 0); - Window_CopyToVRAM(param0->unk_00.unk_0C); - break; - case 2: - case 3: - sub_02001778(param0, v0); - sub_02001900(param0, v4, param3); - sub_02001720(param0); - sub_02001AD8(param0, 0); - Window_CopyToVRAM(param0->unk_00.unk_0C); - break; - } - } - - return 0; -} - -static void sub_02001AD8(BmpList *param0, u8 param1) -{ - if (param0->unk_00.unk_04 != NULL) { - param0->unk_00.unk_04(param0, param0->unk_00.unk_00[param0->unk_28 + param0->unk_2A].unk_04, param1); - } -} diff --git a/src/unk_02001AF4.c b/src/unk_02001AF4.c deleted file mode 100644 index a7ac374f5a..0000000000 --- a/src/unk_02001AF4.c +++ /dev/null @@ -1,508 +0,0 @@ -#include "unk_02001AF4.h" - -#include -#include - -#include "struct_decls/struct_02013A04_decl.h" -#include "struct_defs/struct_02013A04_t.h" -#include "struct_defs/struct_02081CF4.h" - -#include "bg_window.h" -#include "colored_arrow.h" -#include "core_sys.h" -#include "font.h" -#include "heap.h" -#include "message.h" -#include "text.h" -#include "unk_02005474.h" -#include "unk_0200DA60.h" -#include "unk_02013A04.h" - -typedef struct UIControlData_t { - UnkStruct_02081CF4 unk_00; - ColoredArrow *unk_0C; - u32 unk_10; - u8 unk_14; - u8 unk_15; - u8 unk_16; - u8 unk_17; - u8 unk_18; - u8 unk_19; - u8 unk_1A; - u8 unk_1B; - u8 unk_1C; -} UIControlData; - -static void sub_0200DB10(BgConfig *param0, u8 param1, u8 param2, u8 param3, u8 param4, u8 param5, u8 param6, u16 param7); -static void sub_0200DD7C(BgConfig *param0, u8 param1, u8 param2, u8 param3, u8 param4, u8 param5, u8 param6, u16 param7); -static BOOL sub_02001DCC(UIControlData *param0, u8 param1, u16 param2); -static u8 sub_02001E24(UIControlData *param0, u8 param1); -static u8 sub_02001F1C(UIControlData *param0); -static void sub_02001F5C(UIControlData *param0); -static void sub_02001FE8(UIControlData *param0); -static void sub_02002018(UIControlData *param0, u8 *param1, u8 *param2, u8 param3); - -UIControlData *sub_02001AF4(const UnkStruct_02081CF4 *param0, u8 param1, u8 param2, u8 param3, u8 param4, u32 param5) -{ - UIControlData *v0 = (UIControlData *)Heap_AllocFromHeap(param4, sizeof(UIControlData)); - - v0->unk_00 = *param0; - v0->unk_0C = ColoredArrow_New(param4); - v0->unk_10 = param5; - v0->unk_15 = param3; - v0->unk_16 = sub_02001F1C(v0); - v0->unk_1C = param4; - v0->unk_17 = param1; - v0->unk_18 = param2; - v0->unk_19 = Font_GetAttribute(param0->unk_08, 0) + Font_GetAttribute(param0->unk_08, 2); - v0->unk_1A = Font_GetAttribute(param0->unk_08, 1) + Font_GetAttribute(param0->unk_08, 3); - - sub_02001F5C(v0); - sub_02001FE8(v0); - - return v0; -} - -UIControlData *sub_02001B7C(const UnkStruct_02081CF4 *param0, u8 param1, u8 param2, u8 param3, u8 param4, u32 param5) -{ - UIControlData *v0 = sub_02001AF4(param0, param1, param2, param3, param4, param5); - - Window_CopyToVRAM(v0->unk_00.unk_04); - return v0; -} - -UIControlData *sub_02001B9C(const UnkStruct_02081CF4 *param0, u8 param1, u8 param2) -{ - return sub_02001B7C(param0, Font_GetAttribute(param0->unk_08, 0), 0, param1, param2, PAD_BUTTON_B); -} - -void sub_02001BC4(UIControlData *param0, u8 *param1) -{ - if (param1 != NULL) { - *param1 = param0->unk_15; - } - - ColoredArrow_Free(param0->unk_0C); - Heap_FreeToHeapExplicit(param0->unk_1C, param0); -} - -u32 sub_02001BE0(UIControlData *param0) -{ - param0->unk_1B = 0; - - if (gCoreSys.pressedKeys & PAD_BUTTON_A) { - Sound_PlayEffect(1500); - return param0->unk_00.unk_00[param0->unk_15].unk_04; - } - - if (gCoreSys.pressedKeys & param0->unk_10) { - Sound_PlayEffect(1500); - return 0xfffffffe; - } - - if (gCoreSys.pressedKeys & PAD_KEY_UP) { - if (sub_02001DCC(param0, 0, 1500) == 1) { - param0->unk_1B = 1; - } - - return 0xffffffff; - } - - if (gCoreSys.pressedKeys & PAD_KEY_DOWN) { - if (sub_02001DCC(param0, 1, 1500) == 1) { - param0->unk_1B = 2; - } - - return 0xffffffff; - } - - if (gCoreSys.pressedKeys & PAD_KEY_LEFT) { - if (sub_02001DCC(param0, 2, 1500) == 1) { - param0->unk_1B = 3; - } - - return 0xffffffff; - } - - if (gCoreSys.pressedKeys & PAD_KEY_RIGHT) { - if (sub_02001DCC(param0, 3, 1500) == 1) { - param0->unk_1B = 4; - } - - return 0xffffffff; - } - - return 0xffffffff; -} - -u32 sub_02001C94(UIControlData *param0, u16 param1) -{ - param0->unk_1B = 0; - - if (gCoreSys.pressedKeys & PAD_BUTTON_A) { - Sound_PlayEffect(1500); - return param0->unk_00.unk_00[param0->unk_15].unk_04; - } - - if (gCoreSys.pressedKeys & param0->unk_10) { - Sound_PlayEffect(1500); - return 0xfffffffe; - } - - if (gCoreSys.pressedKeys & PAD_KEY_UP) { - if (sub_02001DCC(param0, 0, param1) == 1) { - param0->unk_1B = 1; - } - - return 0xffffffff; - } - - if (gCoreSys.pressedKeys & PAD_KEY_DOWN) { - if (sub_02001DCC(param0, 1, param1) == 1) { - param0->unk_1B = 2; - } - - return 0xffffffff; - } - - if (gCoreSys.pressedKeys & PAD_KEY_LEFT) { - if (sub_02001DCC(param0, 2, param1) == 1) { - param0->unk_1B = 3; - } - - return 0xffffffff; - } - - if (gCoreSys.pressedKeys & PAD_KEY_RIGHT) { - if (sub_02001DCC(param0, 3, param1) == 1) { - param0->unk_1B = 4; - } - - return 0xffffffff; - } - - return 0xffffffff; -} - -u32 sub_02001D44(UIControlData *param0, u8 param1) -{ - switch (param1) { - case 0: - Sound_PlayEffect(1500); - return param0->unk_00.unk_00[param0->unk_15].unk_04; - case 1: - Sound_PlayEffect(1500); - return 0xfffffffe; - case 2: - sub_02001DCC(param0, 0, 1500); - return 0xffffffff; - case 3: - sub_02001DCC(param0, 1, 1500); - return 0xffffffff; - case 4: - sub_02001DCC(param0, 2, 1500); - return 0xffffffff; - case 5: - sub_02001DCC(param0, 3, 1500); - return 0xffffffff; - } - - return 0xffffffff; -} - -u8 sub_02001DC4(UIControlData *param0) -{ - return param0->unk_15; -} - -u8 sub_02001DC8(UIControlData *param0) -{ - return param0->unk_1B; -} - -static BOOL sub_02001DCC(UIControlData *param0, u8 param1, u16 param2) -{ - u8 v0 = param0->unk_15; - - if (sub_02001E24(param0, param1) == 0) { - return 0; - } - - { - u8 v1, v2; - u8 v3; - - v3 = Font_GetAttribute(param0->unk_00.unk_08, 6); - - sub_02002018(param0, &v1, &v2, v0); - Window_FillRectWithColor(param0->unk_00.unk_04, v3, v1, v2, 8, param0->unk_1A); - } - - sub_02001FE8(param0); - Sound_PlayEffect(param2); - - return 1; -} - -static u8 sub_02001E24(UIControlData *param0, u8 param1) -{ - s8 v0; - - if (param1 == 0) { - if (param0->unk_00.unk_0A <= 1) { - return 0; - } - - if ((param0->unk_15 % param0->unk_00.unk_0A) == 0) { - if (param0->unk_00.unk_0B_6 == 0) { - return 0; - } - - v0 = param0->unk_15 + (param0->unk_00.unk_0A - 1); - } else { - v0 = param0->unk_15 - 1; - } - } else if (param1 == 1) { - if (param0->unk_00.unk_0A <= 1) { - return 0; - } - - if ((param0->unk_15 % param0->unk_00.unk_0A) == (param0->unk_00.unk_0A - 1)) { - if (param0->unk_00.unk_0B_6 == 0) { - return 0; - } - - v0 = param0->unk_15 - (param0->unk_00.unk_0A - 1); - } else { - v0 = param0->unk_15 + 1; - } - } else if (param1 == 2) { - if (param0->unk_00.unk_09 <= 1) { - return 0; - } - - if (param0->unk_15 < param0->unk_00.unk_0A) { - if (param0->unk_00.unk_0B_6 == 0) { - return 0; - } - - v0 = param0->unk_15 + (param0->unk_00.unk_0A * (param0->unk_00.unk_09 - 1)); - } else { - v0 = param0->unk_15 - param0->unk_00.unk_0A; - } - } else { - if (param0->unk_00.unk_09 <= 1) { - return 0; - } - - if (param0->unk_15 >= (param0->unk_00.unk_0A * (param0->unk_00.unk_09 - 1))) { - if (param0->unk_00.unk_0B_6 == 0) { - return 0; - } - - v0 = param0->unk_15 % param0->unk_00.unk_0A; - } else { - v0 = param0->unk_15 + param0->unk_00.unk_0A; - } - } - - if (param0->unk_00.unk_00[v0].unk_04 == 0xfffffffd) { - return 0; - } - - param0->unk_15 = v0; - return 1; -} - -static u8 sub_02001F1C(UIControlData *param0) -{ - u8 v0 = 0; - u8 v1, v2; - - for (v1 = 0; v1 < param0->unk_00.unk_09 * param0->unk_00.unk_0A; v1++) { - v2 = Font_CalcStrbufWidth(param0->unk_00.unk_08, param0->unk_00.unk_00[v1].unk_00, 0); - - if (v0 < v2) { - v0 = v2; - } - } - - return v0; -} - -static void sub_02001F5C(UIControlData *param0) -{ - const void *v0; - u8 v1, v2, v3; - u8 v4, v5; - - Window_FillTilemap(param0->unk_00.unk_04, Font_GetAttribute(param0->unk_00.unk_08, 6)); - - v1 = param0->unk_17; - v3 = param0->unk_16 + param0->unk_19 * 2; - - for (v4 = 0; v4 < param0->unk_00.unk_09; v4++) { - for (v5 = 0; v5 < param0->unk_00.unk_0A; v5++) { - v0 = param0->unk_00.unk_00[v4 * param0->unk_00.unk_0A + v5].unk_00; - v2 = (param0->unk_1A + param0->unk_00.unk_0B_0) * v5 + param0->unk_18; - - Text_AddPrinterWithParams(param0->unk_00.unk_04, param0->unk_00.unk_08, v0, v1, v2, TEXT_SPEED_NO_TRANSFER, NULL); - } - - v1 += v3; - } -} - -static void sub_02001FE8(UIControlData *param0) -{ - u8 v0, v1; - - if (param0->unk_00.unk_0B_4 == 1) { - return; - } - - sub_02002018(param0, &v0, &v1, param0->unk_15); - ColoredArrow_Print(param0->unk_0C, param0->unk_00.unk_04, v0, v1); -} - -static void sub_02002018(UIControlData *param0, u8 *param1, u8 *param2, u8 param3) -{ - *param1 = (param3 / param0->unk_00.unk_0A) * (param0->unk_16 + param0->unk_19 * 2); - *param2 = (param3 % param0->unk_00.unk_0A) * (param0->unk_1A + param0->unk_00.unk_0B_0) + param0->unk_18; -} - -UIControlData *sub_02002054(BgConfig *param0, const WindowTemplate *param1, u16 param2, u8 param3, u8 param4, u32 param5) -{ - UnkStruct_02081CF4 v0; - MessageLoader *v1; - ResourceMetadata *v2; - - v1 = MessageLoader_Init(1, 26, 361, param5); - v2 = sub_02013A04(2, param5); - - sub_02013A4C(v2, v1, 41, 0); - sub_02013A4C(v2, v1, 42, 0xfffffffe); - MessageLoader_Free(v1); - - v0.unk_00 = v2; - v0.unk_04 = Window_New(param5, 1); - v0.unk_08 = 0; - v0.unk_09 = 1; - v0.unk_0A = 2; - v0.unk_0B_0 = 0; - v0.unk_0B_4 = 0; - v0.unk_0B_6 = 0; - - Window_AddFromTemplate(param0, v0.unk_04, param1); - Window_Show(v0.unk_04, 1, param2, param3); - - return sub_02001B7C(&v0, 8, 0, param4, param5, PAD_BUTTON_B); -} - -UIControlData *sub_02002100(BgConfig *param0, const WindowTemplate *param1, u16 param2, u8 param3, u32 param4) -{ - return sub_02002054(param0, param1, param2, param3, 0, param4); -} - -u32 sub_02002114(UIControlData *param0, u32 param1) -{ - u32 v0 = sub_02001BE0(param0); - - if (v0 != 0xffffffff) { - sub_02002154(param0, param1); - } - - return v0; -} - -u32 sub_02002134(UIControlData *param0, u8 param1, u32 param2) -{ - u32 v0 = sub_02001D44(param0, param1); - - if (v0 != 0xffffffff) { - sub_02002154(param0, param2); - } - - return v0; -} - -void sub_02002154(UIControlData *param0, u32 param1) -{ - Window_Clear(param0->unk_00.unk_04, 0); - Window_Remove(param0->unk_00.unk_04); - Heap_FreeToHeapExplicit(param1, param0->unk_00.unk_04); - sub_02013A3C((ResourceMetadata *)param0->unk_00.unk_00); - sub_02001BC4(param0, NULL); -} - -void sub_02002180(Window *param0, u32 param1, u32 param2) -{ - static const u8 v0[] = { - 0xff, - 0xff, - 0xff, - 0x0, - 0xff, - 0xff, - 0xff, - 0x0, - 0x21, - 0xff, - 0xff, - 0x0, - 0x11, - 0xf2, - 0xff, - 0x0, - 0x11, - 0x21, - 0xff, - 0x0, - 0x11, - 0x11, - 0xf2, - 0x0, - 0x11, - 0x11, - 0x21, - 0x0, - 0x11, - 0x11, - 0x22, - 0x0, - 0x11, - 0x21, - 0xf2, - 0x0, - 0x11, - 0x22, - 0xff, - 0x0, - 0x21, - 0xf2, - 0xff, - 0x0, - 0x22, - 0xff, - 0xff, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0 - }; - - Window_BlitBitmapRect(param0, (void *)v0, 0, 0, 8, 16, param1, param2, 8, 16); -} diff --git a/src/unk_02013A04.c b/src/unk_02013A04.c deleted file mode 100644 index 8e65b83146..0000000000 --- a/src/unk_02013A04.c +++ /dev/null @@ -1,114 +0,0 @@ -#include "unk_02013A04.h" - -#include -#include - -#include "struct_decls/struct_02013A04_decl.h" -#include "struct_defs/struct_02013A04_t.h" - -#include "heap.h" -#include "message.h" -#include "strbuf.h" - -static ResourceMetadata *sub_02013AAC(ResourceMetadata *param0, u32 *param1); - -ResourceMetadata *sub_02013A04(u32 param0, u32 param1) -{ - ResourceMetadata *v0 = Heap_AllocFromHeap(param1, sizeof(ResourceMetadata) * (param0 + 1)); - - if (v0) { - u32 v1; - - for (v1 = 0; v1 < param0; v1++) { - v0[v1].unk_00 = NULL; - v0[v1].unk_04 = 0; - } - - v0[v1].unk_00 = ((const void *)0xffffffff); - v0[v1].unk_04 = param1; - } - - return v0; -} - -void sub_02013A3C(ResourceMetadata *param0) -{ - sub_02013AE8(param0); - Heap_FreeToHeap(param0); -} - -void sub_02013A4C(ResourceMetadata *param0, const MessageLoader *param1, u32 param2, u32 param3) -{ - u32 v0; - - param0 = sub_02013AAC(param0, &v0); - - if (param0) { - param0->unk_00 = MessageLoader_GetNewStrbuf(param1, param2); - param0->unk_04 = param3; - } -} - -void sub_02013A6C(ResourceMetadata *param0, const Strbuf *param1, u32 param2) -{ - u32 v0; - - param0 = sub_02013AAC(param0, &v0); - - if (param0) { - param0->unk_00 = Strbuf_Clone(param1, v0); - param0->unk_04 = param2; - } -} - -void sub_02013A90(ResourceMetadata *param0, const ResourceMetadata *param1) -{ - u32 v0; - - param0 = sub_02013AAC(param0, &v0); - - if (param0) { - param0->unk_00 = param1->unk_00; - param0->unk_04 = param1->unk_04; - } -} - -static ResourceMetadata *sub_02013AAC(ResourceMetadata *param0, u32 *param1) -{ - ResourceMetadata *v0; - - while (param0->unk_00 != NULL) { - if (param0->unk_00 == ((const void *)0xffffffff)) { - GF_ASSERT(0); - return NULL; - } - - param0++; - } - - v0 = param0; - - while (param0->unk_00 != ((const void *)0xffffffff)) { - param0++; - } - - *param1 = param0->unk_04; - - return v0; -} - -void sub_02013AE8(ResourceMetadata *param0) -{ - ResourceMetadata *v0 = param0; - - while (v0->unk_00 != ((const void *)0xffffffff)) { - if (v0->unk_00 == NULL) { - break; - } - - Strbuf_Free((Strbuf *)(v0->unk_00)); - - v0->unk_00 = NULL; - v0++; - } -} diff --git a/src/unk_0206F314.c b/src/unk_0206F314.c index c7ef135d54..b3dc7fa564 100644 --- a/src/unk_0206F314.c +++ b/src/unk_0206F314.c @@ -3,21 +3,16 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_0202E8C0_decl.h" #include "struct_decls/struct_020508D4_decl.h" #include "struct_defs/sprite_template.h" #include "struct_defs/struct_0200D0F4.h" -#include "struct_defs/struct_02013A04_t.h" #include "struct_defs/struct_0202EE10.h" #include "struct_defs/struct_0202EE10_sub1.h" #include "field/field_system.h" #include "overlay005/ov5_021D2F14.h" #include "overlay005/struct_ov5_021D30A8.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "overlay104/struct_ov104_02241308.h" #include "bg_window.h" @@ -26,19 +21,19 @@ #include "font.h" #include "game_options.h" #include "heap.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "save_player.h" #include "savedata.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200C6E4.h" #include "unk_0200DA60.h" -#include "unk_02013A04.h" #include "unk_0202E840.h" #include "unk_020508D4.h" @@ -96,10 +91,10 @@ typedef struct { u16 unk_26; u16 unk_28; UnkStruct_0206F7F8_sub1 unk_2C; - UnkStruct_ov84_02240FA8 unk_A0; - BmpList *unk_C0; - ResourceMetadata *unk_C4; - UIControlData *unk_C8; + ListMenuTemplate unk_A0; + ListMenu *unk_C0; + StringList *unk_C4; + Menu *unk_C8; FieldSystem *fieldSystem; BgConfig *unk_D0; Window unk_D4; @@ -131,7 +126,7 @@ static void sub_0206FCC4(UnkStruct_0206F7F8 *param0); static void sub_0206FD94(UnkStruct_0206F7F8 *param0); static void sub_0206FDC0(UnkStruct_0206F7F8 *param0, u16 param1, u16 param2); static void sub_0206FF10(UnkStruct_0206F7F8 *param0); -static void sub_0206FF60(BmpList *param0, u32 param1, u8 param2); +static void sub_0206FF60(ListMenu *param0, u32 param1, u8 param2); static void sub_0206FFB4(UnkStruct_0206F7F8 *param0); static void sub_0206FFE4(UnkStruct_0206F7F8 *param0); static void sub_02070010(UnkStruct_0206F7F8 *param0); @@ -139,7 +134,7 @@ static void sub_02070050(UnkStruct_0206F7F8 *param0, BOOL param1); static void sub_020701DC(UnkStruct_0206F7F8 *param0, u16 param1); static void sub_02070288(UnkStruct_0206F7F8 *param0); -static const UnkStruct_ov84_02240FA8 Unk_020F02B0 = { +static const ListMenuTemplate Unk_020F02B0 = { NULL, NULL, NULL, @@ -275,7 +270,7 @@ static int sub_0206F498(UnkStruct_0206F7F8 *param0) { s32 v0; - v0 = sub_02001288(param0->unk_C0); + v0 = ListMenu_ProcessInput(param0->unk_C0); if (gCoreSys.pressedKeys & PAD_BUTTON_B) { Sound_PlayEffect(1500); @@ -381,7 +376,7 @@ static void sub_0206F62C(UnkStruct_0206F7F8 *param0) 0x355 }; - param0->unk_C8 = sub_02002100(param0->unk_D0, &v0, (1024 - (18 + 12) - 9), 11, param0->unk_00); + param0->unk_C8 = Menu_MakeYesNoChoice(param0->unk_D0, &v0, (1024 - (18 + 12) - 9), 11, param0->unk_00); } static int sub_0206F658(UnkStruct_0206F7F8 *param0) @@ -404,7 +399,7 @@ static int sub_0206F658(UnkStruct_0206F7F8 *param0) param0->unk_0C++; break; case 2: - switch (sub_02002114(param0->unk_C8, param0->unk_00)) { + switch (Menu_ProcessInputAndHandleExit(param0->unk_C8, param0->unk_00)) { case 0: param0->unk_0C++; break; @@ -685,27 +680,27 @@ static void sub_0206FDC0(UnkStruct_0206F7F8 *param0, u16 param1, u16 param2) int v0, v1; v1 = param0->unk_18 + 1; - param0->unk_C4 = sub_02013A04(v1, param0->unk_00); + param0->unk_C4 = StringList_New(v1, param0->unk_00); Window_Add(param0->unk_D0, ¶m0->unk_D4, 1, 4, 1, 24, v1 * 2, 13, 1); Window_FillTilemap(¶m0->unk_D4, ((15 << 4) | 15)); for (v0 = 0; v0 < param0->unk_18; v0++) { - sub_02013A6C(param0->unk_C4, param0->unk_2C.unk_38[v0], v0); + StringList_AddFromStrbuf(param0->unk_C4, param0->unk_2C.unk_38[v0], v0); } - sub_02013A6C(param0->unk_C4, param0->unk_2C.unk_0C, 0xFFFF); + StringList_AddFromStrbuf(param0->unk_C4, param0->unk_2C.unk_0C, 0xFFFF); - MI_CpuCopy8((void *)&Unk_020F02B0, (void *)&(param0->unk_A0), sizeof(UnkStruct_ov84_02240FA8)); + MI_CpuCopy8((void *)&Unk_020F02B0, (void *)&(param0->unk_A0), sizeof(ListMenuTemplate)); - param0->unk_A0.unk_0C = &(param0->unk_D4); - param0->unk_A0.unk_00 = param0->unk_C4; - param0->unk_A0.unk_1C = (void *)param0; - param0->unk_A0.unk_10 = v1; - param0->unk_A0.unk_17_0 = 0; - param0->unk_A0.unk_04 = sub_0206FF60; - param0->unk_A0.unk_08 = NULL; - param0->unk_C0 = sub_0200112C(&(param0->unk_A0), param1, param2, param0->unk_00); + param0->unk_A0.window = &(param0->unk_D4); + param0->unk_A0.choices = param0->unk_C4; + param0->unk_A0.tmp = (void *)param0; + param0->unk_A0.count = v1; + param0->unk_A0.yOffset = 0; + param0->unk_A0.cursorCallback = sub_0206FF60; + param0->unk_A0.printCallback = NULL; + param0->unk_C0 = ListMenu_New(&(param0->unk_A0), param1, param2, param0->unk_00); Window_Show(¶m0->unk_D4, 0, (1024 - (18 + 12) - 9), 11); sub_0200E060(¶m0->unk_E4, 1, (1024 - (18 + 12)), 10); @@ -717,8 +712,8 @@ static void sub_0206FDC0(UnkStruct_0206F7F8 *param0, u16 param1, u16 param2) static void sub_0206FF10(UnkStruct_0206F7F8 *param0) { - sub_02001384(param0->unk_C0, &(param0->unk_22), &(param0->unk_24)); - sub_02013A3C(param0->unk_C4); + ListMenu_Free(param0->unk_C0, &(param0->unk_22), &(param0->unk_24)); + StringList_Free(param0->unk_C4); Window_ClearAndCopyToVRAM(&(param0->unk_D4)); Window_Clear(&(param0->unk_D4), 0); Window_Remove(&(param0->unk_D4)); @@ -726,17 +721,17 @@ static void sub_0206FF10(UnkStruct_0206F7F8 *param0) Bg_ScheduleTilemapTransfer(param0->unk_D0, 3); } -static void sub_0206FF60(BmpList *param0, u32 param1, u8 param2) +static void sub_0206FF60(ListMenu *param0, u32 param1, u8 param2) { u16 v0, v1, v2; - UnkStruct_0206F7F8 *v3 = (UnkStruct_0206F7F8 *)sub_02001504(param0, 19); + UnkStruct_0206F7F8 *v3 = (UnkStruct_0206F7F8 *)ListMenu_GetAttribute(param0, 19); if (param2 == 0) { Sound_PlayEffect(1500); } - sub_020014DC(param0, &v0, &v1); - v2 = sub_02001504(param0, 2); + ListMenu_GetListAndCursorPos(param0, &v0, &v1); + v2 = ListMenu_GetAttribute(param0, 2); SpriteActor_SetSpritePositionXY(v3->unk_2FC[0], 126, 16 + 16 * (v1 + v0)); } diff --git a/src/unk_020722AC.c b/src/unk_020722AC.c index 93d6051818..db02a76f42 100644 --- a/src/unk_020722AC.c +++ b/src/unk_020722AC.c @@ -1,13 +1,9 @@ #include #include -#include "struct_decls/struct_0200112C_decl.h" -#include "struct_decls/struct_02001AF4_decl.h" -#include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_02028430_decl.h" #include "struct_decls/struct_020508D4_decl.h" #include "struct_decls/struct_party_decl.h" -#include "struct_defs/struct_02013A04_t.h" #include "struct_defs/struct_0202818C.h" #include "struct_defs/struct_0206A844.h" #include "struct_defs/struct_02097728.h" @@ -17,7 +13,6 @@ #include "overlay005/ov5_021D37AC.h" #include "overlay005/ov5_021D431C.h" #include "overlay006/ov6_02247078.h" -#include "overlay084/struct_ov84_02240FA8.h" #include "bag.h" #include "bg_window.h" @@ -27,6 +22,8 @@ #include "game_options.h" #include "heap.h" #include "item.h" +#include "list_menu.h" +#include "menu.h" #include "message.h" #include "party.h" #include "pokemon.h" @@ -34,16 +31,14 @@ #include "save_player.h" #include "savedata.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "sys_task.h" #include "sys_task_manager.h" #include "text.h" -#include "unk_0200112C.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" -#include "unk_02013A04.h" #include "unk_02028124.h" #include "unk_0203D1B8.h" #include "unk_020508D4.h" @@ -101,10 +96,10 @@ typedef struct { u8 unk_13B_6 : 2; u16 unk_13C; u16 unk_13E; - UnkStruct_ov84_02240FA8 unk_140; - BmpList *unk_160; - ResourceMetadata *unk_164; - UIControlData *unk_168; + ListMenuTemplate unk_140; + ListMenu *unk_160; + StringList *unk_164; + Menu *unk_168; FieldSystem *fieldSystem; BgConfig *unk_170; Window unk_174; @@ -143,10 +138,10 @@ static void sub_02072EB8(UnkStruct_02072EB8 *param0, u8 param1); static void sub_02072ED0(UnkStruct_02072EB8 *param0, u8 param1, int param2); static void sub_02072F04(UnkStruct_02072EB8 *param0, u8 param1); static void sub_020729B4(UnkStruct_02072334 *param0); -static void sub_02072BBC(BmpList *param0, u32 param1, u8 param2); -static void sub_02072C0C(BmpList *param0, u32 param1, u8 param2); +static void sub_02072BBC(ListMenu *param0, u32 param1, u8 param2); +static void sub_02072C0C(ListMenu *param0, u32 param1, u8 param2); static void sub_02072C98(UnkStruct_02072334 *param0, u8 param1, u8 param2); -static void sub_02072DA4(BmpList *param0, u32 param1, u8 param2); +static void sub_02072DA4(ListMenu *param0, u32 param1, u8 param2); static void sub_02072DB8(UnkStruct_02072334 *param0); static void sub_02072E4C(UnkStruct_02072334 *param0); static void sub_02072F30(UnkStruct_02072334 *param0, SaveData *param1, int param2); @@ -168,7 +163,7 @@ static int sub_020734F4(UnkStruct_02072334 *param0, u8 param1); static int sub_02073524(UnkStruct_02072334 *param0, int param1); static int sub_020735E8(UnkStruct_02072334 *param0); -static const UnkStruct_ov84_02240FA8 Unk_020F0504 = { +static const ListMenuTemplate Unk_020F0504 = { NULL, NULL, NULL, @@ -254,7 +249,7 @@ static void sub_02072390(SysTask *param0, void *param1) UnkStruct_02072334 *v0 = (UnkStruct_02072334 *)param1; s32 v1; - v1 = sub_02001288(v0->unk_160); + v1 = ListMenu_ProcessInput(v0->unk_160); if (v0->unk_1A4 != NULL) { sub_0206A870(v0->unk_1A4); @@ -314,7 +309,7 @@ static void sub_02072470(SysTask *param0, void *param1) UnkStruct_02072334 *v0 = (UnkStruct_02072334 *)param1; s32 v1; - v1 = sub_02001288(v0->unk_160); + v1 = ListMenu_ProcessInput(v0->unk_160); if (gCoreSys.pressedKeys & PAD_BUTTON_B) { sub_02072EA4(v0, sub_02072534, sub_02072370); @@ -689,7 +684,7 @@ static void sub_020729B4(UnkStruct_02072334 *param0) Window_FillTilemap(¶m0->unk_174, ((15 << 4) | 15)); Window_FillTilemap(¶m0->unk_194, ((15 << 4) | 15)); - param0->unk_164 = sub_02013A04(param0->unk_1B + 1, param0->unk_00); + param0->unk_164 = StringList_New(param0->unk_1B + 1, param0->unk_00); for (v0 = 0; v0 < 20; v0++) { v2 = &(param0->unk_1C[v0]); @@ -698,22 +693,22 @@ static void sub_020729B4(UnkStruct_02072334 *param0) continue; } - sub_02013A6C(param0->unk_164, v2->unk_08, v2->unk_00); + StringList_AddFromStrbuf(param0->unk_164, v2->unk_08, v2->unk_00); v1++; } - sub_02013A6C(param0->unk_164, param0->unk_110.unk_08, 0xFFFF); + StringList_AddFromStrbuf(param0->unk_164, param0->unk_110.unk_08, 0xFFFF); v1++; - MI_CpuCopy8((void *)&Unk_020F0504, (void *)&(param0->unk_140), sizeof(UnkStruct_ov84_02240FA8)); + MI_CpuCopy8((void *)&Unk_020F0504, (void *)&(param0->unk_140), sizeof(ListMenuTemplate)); - param0->unk_140.unk_0C = &(param0->unk_174); - param0->unk_140.unk_00 = param0->unk_164; - param0->unk_140.unk_1C = (void *)param0; - param0->unk_140.unk_10 = v1; - param0->unk_140.unk_17_0 = 6; - param0->unk_140.unk_04 = sub_02072C0C; - param0->unk_140.unk_08 = sub_02072BBC; + param0->unk_140.window = &(param0->unk_174); + param0->unk_140.choices = param0->unk_164; + param0->unk_140.tmp = (void *)param0; + param0->unk_140.count = v1; + param0->unk_140.yOffset = 6; + param0->unk_140.cursorCallback = sub_02072C0C; + param0->unk_140.printCallback = sub_02072BBC; if (param0->unk_13B_4) { if (param0->unk_13C == 0) { @@ -729,7 +724,7 @@ static void sub_020729B4(UnkStruct_02072334 *param0) param0->unk_13B_4 = 0; } - param0->unk_160 = sub_0200112C(&(param0->unk_140), param0->unk_13C, param0->unk_13E, param0->unk_00); + param0->unk_160 = ListMenu_New(&(param0->unk_140), param0->unk_13C, param0->unk_13E, param0->unk_00); Window_Show(¶m0->unk_174, 0, (1024 - (18 + 12) - 9), 11); Text_AddPrinterWithParamsAndColor(¶m0->unk_194, FONT_SYSTEM, param0->unk_110.unk_0C, 2, 0, TEXT_SPEED_INSTANT, TEXT_COLOR(1, 2, 15), NULL); @@ -739,28 +734,28 @@ static void sub_020729B4(UnkStruct_02072334 *param0) param0->unk_13B_0 = 0; } -static void sub_02072BBC(BmpList *param0, u32 param1, u8 param2) +static void sub_02072BBC(ListMenu *param0, u32 param1, u8 param2) { - UnkStruct_02072334 *v0 = (UnkStruct_02072334 *)sub_02001504(param0, 19); + UnkStruct_02072334 *v0 = (UnkStruct_02072334 *)ListMenu_GetAttribute(param0, 19); if (param1 == 0xFFFF) { - sub_0200147C(param0, 1, 15, 2); + ListMenu_SetAltTextColors(param0, 1, 15, 2); } else { if (v0->unk_1C[param1].unk_04) { - sub_0200147C(param0, 3, 15, 4); + ListMenu_SetAltTextColors(param0, 3, 15, 4); } else { - sub_0200147C(param0, 7, 15, 8); + ListMenu_SetAltTextColors(param0, 7, 15, 8); } } } -static void sub_02072C0C(BmpList *param0, u32 param1, u8 param2) +static void sub_02072C0C(ListMenu *param0, u32 param1, u8 param2) { u16 v0, v1, v2; - UnkStruct_02072334 *v3 = (UnkStruct_02072334 *)sub_02001504(param0, 19); + UnkStruct_02072334 *v3 = (UnkStruct_02072334 *)ListMenu_GetAttribute(param0, 19); - sub_020014DC(param0, &v0, &v1); - v2 = sub_02001504(param0, 2); + ListMenu_GetListAndCursorPos(param0, &v0, &v1); + v2 = ListMenu_GetAttribute(param0, 2); if (!param2) { Sound_PlayEffect(1500); @@ -793,25 +788,25 @@ static void sub_02072C98(UnkStruct_02072334 *param0, u8 param1, u8 param2) }; v1 = NELEMS(Unk_020F0524); - param0->unk_164 = sub_02013A04(v1, param0->unk_00); + param0->unk_164 = StringList_New(v1, param0->unk_00); Window_AddFromTemplate(param0->unk_170, &(param0->unk_174), &v2); Window_FillTilemap(¶m0->unk_174, ((15 << 4) | 15)); for (v0 = 0; v0 < v1; v0++) { - sub_02013A4C(param0->unk_164, param0->unk_10C, Unk_020F0524[v0].unk_00, Unk_020F0524[v0].unk_04); + StringList_AddFromMessageBank(param0->unk_164, param0->unk_10C, Unk_020F0524[v0].unk_00, Unk_020F0524[v0].unk_04); } - MI_CpuCopy8((void *)&Unk_020F0504, (void *)&(param0->unk_140), sizeof(UnkStruct_ov84_02240FA8)); + MI_CpuCopy8((void *)&Unk_020F0504, (void *)&(param0->unk_140), sizeof(ListMenuTemplate)); - param0->unk_140.unk_0C = &(param0->unk_174); - param0->unk_140.unk_00 = param0->unk_164; - param0->unk_140.unk_1C = (void *)param0; - param0->unk_140.unk_10 = v1; - param0->unk_140.unk_12 = 4; - param0->unk_140.unk_1A_7 = 0; - param0->unk_140.unk_04 = sub_02072DA4; - param0->unk_160 = sub_0200112C(&(param0->unk_140), param1, param2, param0->unk_00); + param0->unk_140.window = &(param0->unk_174); + param0->unk_140.choices = param0->unk_164; + param0->unk_140.tmp = (void *)param0; + param0->unk_140.count = v1; + param0->unk_140.maxDisplay = 4; + param0->unk_140.pagerMode = PAGER_MODE_NONE; + param0->unk_140.cursorCallback = sub_02072DA4; + param0->unk_160 = ListMenu_New(&(param0->unk_140), param1, param2, param0->unk_00); Window_Show(¶m0->unk_174, 0, (1024 - (18 + 12) - 9), 11); Bg_ScheduleTilemapTransfer(param0->unk_170, 3); @@ -819,7 +814,7 @@ static void sub_02072C98(UnkStruct_02072334 *param0, u8 param1, u8 param2) param0->unk_13B_0 = 1; } -static void sub_02072DA4(BmpList *param0, u32 param1, u8 param2) +static void sub_02072DA4(ListMenu *param0, u32 param1, u8 param2) { if (!param2) { Sound_PlayEffect(1500); @@ -830,8 +825,8 @@ static void sub_02072DB8(UnkStruct_02072334 *param0) { u16 v0, v1; - sub_02001384(param0->unk_160, &v0, &v1); - sub_02013A3C(param0->unk_164); + ListMenu_Free(param0->unk_160, &v0, &v1); + StringList_Free(param0->unk_164); Window_ClearAndCopyToVRAM(&(param0->unk_194)); Window_Clear(&(param0->unk_194), 0); @@ -858,8 +853,8 @@ static void sub_02072E4C(UnkStruct_02072334 *param0) Window_ClearAndCopyToVRAM(&(param0->unk_174)); Window_Clear(&(param0->unk_174), 0); - sub_02001384(param0->unk_160, &v0, &v1); - sub_02013A3C(param0->unk_164); + ListMenu_Free(param0->unk_160, &v0, &v1); + StringList_Free(param0->unk_164); Window_Remove(&(param0->unk_174)); sub_02073398(param0); Bg_ScheduleTilemapTransfer(param0->unk_170, 3); @@ -1130,12 +1125,12 @@ static void sub_020733E0(UnkStruct_02072334 *param0) 0x355 }; - param0->unk_168 = sub_02002100(param0->unk_170, &v0, (1024 - (18 + 12) - 9), 11, param0->unk_00); + param0->unk_168 = Menu_MakeYesNoChoice(param0->unk_170, &v0, (1024 - (18 + 12) - 9), 11, param0->unk_00); } static int sub_0207340C(UnkStruct_02072334 *param0) { - switch (sub_02002114(param0->unk_168, param0->unk_00)) { + switch (Menu_ProcessInputAndHandleExit(param0->unk_168, param0->unk_00)) { case 0: return 1; case 0xfffffffe: diff --git a/src/unk_0207AE68.c b/src/unk_0207AE68.c index 2e6b443c60..168fc40be4 100644 --- a/src/unk_0207AE68.c +++ b/src/unk_0207AE68.c @@ -26,6 +26,7 @@ #include "gx_layers.h" #include "hardware_palette.h" #include "heap.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "overlay_manager.h" @@ -40,7 +41,6 @@ #include "sys_task.h" #include "sys_task_manager.h" #include "text.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200762C.h" #include "unk_0200DA60.h" @@ -474,11 +474,11 @@ static void sub_0207B180(UnkStruct_0207AE68 *param0) } break; case 20: - param0->unk_40 = sub_02002100(param0->unk_00, &Unk_020F0A30, 1, 8, param0->unk_5C); + param0->unk_40 = Menu_MakeYesNoChoice(param0->unk_00, &Unk_020F0A30, 1, 8, param0->unk_5C); param0->unk_64++; break; case 21: - switch (sub_02002114(param0->unk_40, param0->unk_5C)) { + switch (Menu_ProcessInputAndHandleExit(param0->unk_40, param0->unk_5C)) { case 0: param0->unk_64 = 22; PaletteData_StartFade(param0->unk_14, (0x1 | 0x2 | 0x4 | 0x8), 0xffff, 1, 0, 16, 0x0); @@ -544,11 +544,11 @@ static void sub_0207B180(UnkStruct_0207AE68 *param0) param0->unk_64++; break; case 34: - param0->unk_40 = sub_02002100(param0->unk_00, &Unk_020F0A30, 1, 8, param0->unk_5C); + param0->unk_40 = Menu_MakeYesNoChoice(param0->unk_00, &Unk_020F0A30, 1, 8, param0->unk_5C); param0->unk_64++; break; case 35: - switch (sub_02002114(param0->unk_40, param0->unk_5C)) { + switch (Menu_ProcessInputAndHandleExit(param0->unk_40, param0->unk_5C)) { case 0: StringTemplate_SetNickname(param0->unk_0C, 0, Pokemon_GetBoxPokemon(param0->unk_28)); StringTemplate_SetMoveName(param0->unk_0C, 1, param0->unk_6C); diff --git a/src/unk_0207E0B8.c b/src/unk_0207E0B8.c index 7ce9ae3251..9bfd9fddca 100644 --- a/src/unk_0207E0B8.c +++ b/src/unk_0207E0B8.c @@ -24,6 +24,7 @@ #include "heap.h" #include "item.h" #include "journal.h" +#include "menu.h" #include "message.h" #include "narc.h" #include "overlay_manager.h" @@ -31,17 +32,16 @@ #include "pokemon.h" #include "pokemon_summary_app.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" #include "touch_screen.h" -#include "unk_02001AF4.h" #include "unk_020041CC.h" #include "unk_02005474.h" #include "unk_0200C440.h" #include "unk_0200C6E4.h" #include "unk_0200DA60.h" #include "unk_0200F174.h" -#include "unk_02013A04.h" #include "unk_02017728.h" #include "unk_0201DBEC.h" #include "unk_0201E010.h" @@ -548,7 +548,7 @@ static int sub_0207E5F4(GameWindowLayout *param0) static int sub_0207E634(GameWindowLayout *param0) { - u32 v0 = sub_02001BE0(param0->unk_700); + u32 v0 = Menu_ProcessInput(param0->unk_700); switch (v0) { case 0xffffffff: @@ -557,8 +557,8 @@ static int sub_0207E634(GameWindowLayout *param0) sub_0200E084(¶m0->unk_04[33], 1); Window_Clear(¶m0->unk_04[35], 1); Window_ClearAndScheduleCopyToVRAM(¶m0->unk_04[35]); - sub_02001BC4(param0->unk_700, NULL); - sub_02013A3C(param0->unk_6FC); + Menu_Free(param0->unk_700, NULL); + StringList_Free(param0->unk_6FC); sub_020826E0(param0, 29, 1); sub_0200D414(param0->unk_5B0[6], 0); return 1; @@ -603,7 +603,7 @@ static int sub_0207E708(GameWindowLayout *param0) static int sub_0207E714(GameWindowLayout *param0) { - switch (sub_02002114(param0->unk_700, 12)) { + switch (Menu_ProcessInputAndHandleExit(param0->unk_700, 12)) { case 0: return param0->unk_B04.unk_00(param0); case 0xfffffffe: @@ -2316,7 +2316,7 @@ static int GetValidWindowLayout(GameWindowLayout *param0) static u8 HandleWindowInputEvent(GameWindowLayout *param0, int *param1) { - u32 v0 = sub_02001BE0(param0->unk_700); + u32 v0 = Menu_ProcessInput(param0->unk_700); switch (v0) { case 0xffffffff: @@ -2777,7 +2777,7 @@ static int ProcessPokemonItemSwap(GameWindowLayout *param0) { int v0, v1; - switch (sub_02002114(param0->unk_700, 12)) { + switch (Menu_ProcessInputAndHandleExit(param0->unk_700, 12)) { case 0: { Pokemon *v2; Window *v3; diff --git a/src/unk_020819DC.c b/src/unk_020819DC.c index d1b70578f9..f203b941da 100644 --- a/src/unk_020819DC.c +++ b/src/unk_020819DC.c @@ -4,23 +4,22 @@ #include #include "struct_defs/struct_0207F248.h" -#include "struct_defs/struct_02081CF4.h" #include "bg_window.h" #include "font.h" #include "game_options.h" +#include "menu.h" #include "message.h" #include "party.h" #include "pokemon.h" #include "render_text.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200C440.h" #include "unk_0200DA60.h" -#include "unk_02013A04.h" #include "unk_0207E0B8.h" #include "unk_02083370.h" #include "unk_02084B70.h" @@ -195,39 +194,39 @@ void sub_02081CAC(GameWindowLayout *param0, u16 param1, u8 param2) void sub_02081CF4(GameWindowLayout *param0, const u8 *param1, u8 param2) { - UnkStruct_02081CF4 v0; + MenuTemplate v0; u16 v1, v2; Window_Add(param0->unk_00, ¶m0->unk_254[0], 0, 19, 23 - param2 * 2, 12, param2 * 2, 0, (((((((((((((((((((((((((((((((1 + 9) + (18 + 12)) + 9 * 2) + 6 * 2) + 8 * 2) + 6 * 1) + 9 * 2) + 6 * 2) + 8 * 2) + 6 * 1) + 9 * 2) + 6 * 2) + 8 * 2) + 6 * 1) + 9 * 2) + 6 * 2) + 8 * 2) + 6 * 1) + 9 * 2) + 6 * 2) + 8 * 2) + 6 * 1) + 9 * 2) + 6 * 2) + 8 * 2) + 6 * 1) + 5 * 2) + 7 * 2) + 20 * 2) + 13 * 4) + 27 * 4)); - param0->unk_6FC = sub_02013A04(param2, 12); + param0->unk_6FC = StringList_New(param2, 12); v2 = 0; for (v1 = 0; v1 < param2; v1++) { if (param1[v1] >= 16) { - sub_02013A6C(param0->unk_6FC, param0->unk_6AC[16 + v2], sub_02083370((u8)param1[v1])); + StringList_AddFromStrbuf(param0->unk_6FC, param0->unk_6AC[16 + v2], sub_02083370((u8)param1[v1])); v2++; } else { - sub_02013A6C(param0->unk_6FC, param0->unk_6AC[param1[v1]], sub_02083370((u8)param1[v1])); + StringList_AddFromStrbuf(param0->unk_6FC, param0->unk_6AC[param1[v1]], sub_02083370((u8)param1[v1])); } } - v0.unk_00 = param0->unk_6FC; - v0.unk_04 = ¶m0->unk_254[0]; - v0.unk_08 = 0; - v0.unk_09 = 1; - v0.unk_0A = param2; - v0.unk_0B_0 = 0; - v0.unk_0B_4 = 0; + v0.choices = param0->unk_6FC; + v0.window = ¶m0->unk_254[0]; + v0.fontID = FONT_SYSTEM; + v0.xSize = 1; + v0.ySize = param2; + v0.lineSpacing = 0; + v0.suppressCursor = FALSE; if (param2 >= 4) { - v0.unk_0B_6 = 1; + v0.loopAround = TRUE; } else { - v0.unk_0B_6 = 0; + v0.loopAround = FALSE; } Window_Show(¶m0->unk_254[0], 1, 1, 14); - param0->unk_700 = sub_02001B7C(&v0, 8, 0, 0, 12, PAD_BUTTON_B); + param0->unk_700 = Menu_NewAndCopyToVRAM(&v0, 8, 0, 0, 12, PAD_BUTTON_B); } void sub_02081E08(GameWindowLayout *param0) @@ -639,7 +638,7 @@ static BOOL sub_0208279C(TextPrinterTemplate *param0, u16 param1) void sub_020827EC(GameWindowLayout *param0) { - param0->unk_700 = sub_02002100( + param0->unk_700 = Menu_MakeYesNoChoice( param0->unk_00, &Unk_020F1E98, 1, 14, 12); } diff --git a/src/unk_02083370.c b/src/unk_02083370.c index 47a5a4c4ac..04505d0ff1 100644 --- a/src/unk_02083370.c +++ b/src/unk_02083370.c @@ -5,7 +5,6 @@ #include "struct_defs/struct_0200D0F4.h" #include "struct_defs/struct_0207F248.h" -#include "struct_defs/struct_02081CF4.h" #include "struct_defs/struct_020831B4.h" #include "struct_defs/struct_02083D1C.h" @@ -17,17 +16,18 @@ #include "bg_window.h" #include "cell_actor.h" #include "core_sys.h" +#include "font.h" #include "heap.h" +#include "menu.h" #include "message.h" #include "party.h" #include "pokemon.h" +#include "string_list.h" #include "string_template.h" #include "text.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200C6E4.h" #include "unk_0200DA60.h" -#include "unk_02013A04.h" #include "unk_0207070C.h" #include "unk_0207E0B8.h" #include "unk_020819DC.h" @@ -118,43 +118,43 @@ void sub_0208337C(GameWindowLayout *param0) { Window_Clear(¶m0->unk_254[0], 1); Window_ClearAndScheduleCopyToVRAM(¶m0->unk_254[0]); - sub_02001BC4(param0->unk_700, NULL); - sub_02013A3C(param0->unk_6FC); + Menu_Free(param0->unk_700, NULL); + StringList_Free(param0->unk_6FC); Window_Remove(¶m0->unk_254[0]); } static void sub_020833BC(GameWindowLayout *param0, int *param1) { - UnkStruct_02081CF4 v0; + MenuTemplate v0; sub_0208337C(param0); sub_020826F4(param0, 38, 0); - param0->unk_6FC = sub_02013A04(3, 12); + param0->unk_6FC = StringList_New(3, 12); - sub_02013A6C(param0->unk_6FC, param0->unk_6AC[3], sub_02083370(3)); - sub_02013A6C(param0->unk_6FC, param0->unk_6AC[4], sub_02083370(4)); - sub_02013A6C(param0->unk_6FC, param0->unk_6AC[9], sub_02083370(9)); + StringList_AddFromStrbuf(param0->unk_6FC, param0->unk_6AC[3], sub_02083370(3)); + StringList_AddFromStrbuf(param0->unk_6FC, param0->unk_6AC[4], sub_02083370(4)); + StringList_AddFromStrbuf(param0->unk_6FC, param0->unk_6AC[9], sub_02083370(9)); - v0.unk_00 = param0->unk_6FC; - v0.unk_04 = ¶m0->unk_04[35]; - v0.unk_08 = 0; - v0.unk_09 = 1; - v0.unk_0A = 3; - v0.unk_0B_0 = 0; - v0.unk_0B_4 = 0; - v0.unk_0B_6 = 0; + v0.choices = param0->unk_6FC; + v0.window = ¶m0->unk_04[35]; + v0.fontID = FONT_SYSTEM; + v0.xSize = 1; + v0.ySize = 3; + v0.lineSpacing = 0; + v0.suppressCursor = FALSE; + v0.loopAround = FALSE; Window_Show(¶m0->unk_04[35], 1, 1, 14); - param0->unk_700 = sub_02001B7C(&v0, 8, 0, 0, 12, PAD_BUTTON_B); + param0->unk_700 = Menu_NewAndCopyToVRAM(&v0, 8, 0, 0, 12, PAD_BUTTON_B); *param1 = 15; } static void sub_0208347C(GameWindowLayout *param0, int *param1) { - sub_02001BC4(param0->unk_700, NULL); - sub_02013A3C(param0->unk_6FC); + Menu_Free(param0->unk_700, NULL); + StringList_Free(param0->unk_6FC); param0->unk_5A4->unk_23 = 3; *param1 = 32; @@ -168,8 +168,8 @@ static void sub_020834B0(GameWindowLayout *param0, int *param1) FieldSystem *fieldSystem; Window_Clear(¶m0->unk_04[35], 1); - sub_02001BC4(param0->unk_700, NULL); - sub_02013A3C(param0->unk_6FC); + Menu_Free(param0->unk_700, NULL); + StringList_Free(param0->unk_6FC); fieldSystem = param0->unk_5A4->unk_1C; @@ -253,36 +253,36 @@ int sub_020836E4(GameWindowLayout *param0) static void sub_02083700(GameWindowLayout *param0, int *param1) { - UnkStruct_02081CF4 v0; + MenuTemplate v0; sub_0208337C(param0); sub_020826F4(param0, 39, 0); - param0->unk_6FC = sub_02013A04(3, 12); + param0->unk_6FC = StringList_New(3, 12); - sub_02013A6C(param0->unk_6FC, param0->unk_6AC[6], sub_02083370(6)); - sub_02013A6C(param0->unk_6FC, param0->unk_6AC[7], sub_02083370(7)); - sub_02013A6C(param0->unk_6FC, param0->unk_6AC[9], sub_02083370(9)); + StringList_AddFromStrbuf(param0->unk_6FC, param0->unk_6AC[6], sub_02083370(6)); + StringList_AddFromStrbuf(param0->unk_6FC, param0->unk_6AC[7], sub_02083370(7)); + StringList_AddFromStrbuf(param0->unk_6FC, param0->unk_6AC[9], sub_02083370(9)); - v0.unk_00 = param0->unk_6FC; - v0.unk_04 = ¶m0->unk_04[35]; - v0.unk_08 = 0; - v0.unk_09 = 1; - v0.unk_0A = 3; - v0.unk_0B_0 = 0; - v0.unk_0B_4 = 0; - v0.unk_0B_6 = 0; + v0.choices = param0->unk_6FC; + v0.window = ¶m0->unk_04[35]; + v0.fontID = FONT_SYSTEM; + v0.xSize = 1; + v0.ySize = 3; + v0.lineSpacing = 0; + v0.suppressCursor = FALSE; + v0.loopAround = FALSE; Window_Show(¶m0->unk_04[35], 1, 1, 14); - param0->unk_700 = sub_02001B7C(&v0, 8, 0, 0, 12, PAD_BUTTON_B); + param0->unk_700 = Menu_NewAndCopyToVRAM(&v0, 8, 0, 0, 12, PAD_BUTTON_B); *param1 = 15; } static void sub_020837C0(GameWindowLayout *param0, int *param1) { - sub_02001BC4(param0->unk_700, NULL); - sub_02013A3C(param0->unk_6FC); + Menu_Free(param0->unk_700, NULL); + StringList_Free(param0->unk_6FC); param0->unk_5A4->unk_23 = 7; *param1 = 32; @@ -291,8 +291,8 @@ static void sub_020837C0(GameWindowLayout *param0, int *param1) static void sub_020837F4(GameWindowLayout *param0, int *param1) { Window_Clear(¶m0->unk_04[35], 1); - sub_02001BC4(param0->unk_700, NULL); - sub_02013A3C(param0->unk_6FC); + Menu_Free(param0->unk_700, NULL); + StringList_Free(param0->unk_6FC); sub_02082708(param0, 43, 1); param0->unk_B04.unk_00 = sub_0208384C; @@ -389,8 +389,8 @@ int sub_020839BC(GameWindowLayout *param0) static void sub_020839FC(GameWindowLayout *param0, int *param1) { if (param0->unk_704[param0->unk_B11].unk_12 == 0) { - sub_02001BC4(param0->unk_700, NULL); - sub_02013A3C(param0->unk_6FC); + Menu_Free(param0->unk_700, NULL); + StringList_Free(param0->unk_6FC); param0->unk_5A4->unk_23 = 0; *param1 = 32; return; @@ -806,8 +806,8 @@ static void sub_020846CC(GameWindowLayout *param0, int *param1) { param0->unk_5A4->unk_23 = 0; - sub_02001BC4(param0->unk_700, NULL); - sub_02013A3C(param0->unk_6FC); + Menu_Free(param0->unk_700, NULL); + StringList_Free(param0->unk_6FC); *param1 = 32; } @@ -816,8 +816,8 @@ static void sub_020846FC(GameWindowLayout *param0, int *param1) { param0->unk_5A4->unk_23 = 0; - sub_02001BC4(param0->unk_700, NULL); - sub_02013A3C(param0->unk_6FC); + Menu_Free(param0->unk_700, NULL); + StringList_Free(param0->unk_6FC); *param1 = 32; } @@ -826,8 +826,8 @@ static void sub_0208472C(GameWindowLayout *param0, int *param1) { param0->unk_5A4->unk_23 = 1; - sub_02001BC4(param0->unk_700, NULL); - sub_02013A3C(param0->unk_6FC); + Menu_Free(param0->unk_700, NULL); + StringList_Free(param0->unk_6FC); *param1 = 32; } @@ -877,8 +877,8 @@ static void sub_02084808(GameWindowLayout *param0, int *param1) switch (v1) { case 0: - sub_02001BC4(param0->unk_700, NULL); - sub_02013A3C(param0->unk_6FC); + Menu_Free(param0->unk_700, NULL); + StringList_Free(param0->unk_6FC); *param1 = 32; return; case 1: diff --git a/src/unk_02084B70.c b/src/unk_02084B70.c index 755f8c8d89..f17fc0bfa5 100644 --- a/src/unk_02084B70.c +++ b/src/unk_02084B70.c @@ -4,28 +4,28 @@ #include #include "struct_defs/struct_0207F248.h" -#include "struct_defs/struct_02081CF4.h" #include "field/field_system.h" #include "bag.h" #include "bg_window.h" #include "core_sys.h" +#include "font.h" #include "heap.h" #include "item.h" #include "map_header.h" +#include "menu.h" #include "message.h" #include "move_table.h" #include "party.h" #include "pokemon.h" #include "pokemon_summary_app.h" #include "strbuf.h" +#include "string_list.h" #include "string_template.h" #include "text.h" -#include "unk_02001AF4.h" #include "unk_02005474.h" #include "unk_0200DA60.h" -#include "unk_02013A04.h" #include "unk_0207E0B8.h" #include "unk_020819DC.h" #include "unk_02082C2C.h" @@ -1166,17 +1166,17 @@ static u8 sub_02086614(GameWindowLayout *param0, u8 param1) Strbuf_Free(v1); if (v2 == 0) { - sub_02013A6C(param0->unk_6FC, param0->unk_6A8, 0xfffffffd); + StringList_AddFromStrbuf(param0->unk_6FC, param0->unk_6A8, 0xfffffffd); return 0; } - sub_02013A6C(param0->unk_6FC, param0->unk_6A8, param1); + StringList_AddFromStrbuf(param0->unk_6FC, param0->unk_6A8, param1); return 1; } void sub_020866A0(GameWindowLayout *param0, u8 param1) { - UnkStruct_02081CF4 v0; + MenuTemplate v0; u8 v1; if (param1 == 0) { @@ -1185,34 +1185,34 @@ void sub_020866A0(GameWindowLayout *param0, u8 param1) sub_020826F4(param0, 40, 1); } - param0->unk_6FC = sub_02013A04(4, 12); + param0->unk_6FC = StringList_New(4, 12); v1 = sub_02086614(param0, 0); v1 += sub_02086614(param0, 1); v1 += sub_02086614(param0, 2); v1 += sub_02086614(param0, 3); - v0.unk_00 = param0->unk_6FC; - v0.unk_04 = ¶m0->unk_04[36]; - v0.unk_08 = 0; - v0.unk_09 = 1; - v0.unk_0A = 4; - v0.unk_0B_0 = 0; - v0.unk_0B_4 = 0; + v0.choices = param0->unk_6FC; + v0.window = ¶m0->unk_04[36]; + v0.fontID = FONT_SYSTEM; + v0.xSize = 1; + v0.ySize = 4; + v0.lineSpacing = 0; + v0.suppressCursor = FALSE; if (v1 == 4) { - v0.unk_0B_6 = 1; + v0.loopAround = TRUE; } else { - v0.unk_0B_6 = 0; + v0.loopAround = FALSE; } Window_Show(¶m0->unk_04[36], 1, 1, 14); - param0->unk_700 = sub_02001B7C(&v0, 8, 0, 0, 12, PAD_BUTTON_B); + param0->unk_700 = Menu_NewAndCopyToVRAM(&v0, 8, 0, 0, 12, PAD_BUTTON_B); } int sub_02086774(GameWindowLayout *param0) { - u32 v0 = sub_02001BE0(param0->unk_700); + u32 v0 = Menu_ProcessInput(param0->unk_700); switch (v0) { case 0xffffffff: @@ -1220,15 +1220,15 @@ int sub_02086774(GameWindowLayout *param0) case 0xfffffffe: sub_0200E084(¶m0->unk_04[33], 1); Window_Clear(¶m0->unk_04[36], 1); - sub_02001BC4(param0->unk_700, NULL); - sub_02013A3C(param0->unk_6FC); + Menu_Free(param0->unk_700, NULL); + StringList_Free(param0->unk_6FC); sub_020826E0(param0, 32, 1); return 4; default: sub_0200E084(¶m0->unk_04[33], 1); Window_Clear(¶m0->unk_04[36], 1); - sub_02001BC4(param0->unk_700, NULL); - sub_02013A3C(param0->unk_6FC); + Menu_Free(param0->unk_700, NULL); + StringList_Free(param0->unk_6FC); if (sub_02096F14(param0->unk_5A4->unk_00, param0->unk_5A4->unk_24, param0->unk_B11, (u8)v0, sub_02086930(param0), 12) == 1) { Pokemon *v1 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); diff --git a/src/unk_02099DFC.c b/src/unk_02099DFC.c index 418b4d66f4..b9fc2c1257 100644 --- a/src/unk_02099DFC.c +++ b/src/unk_02099DFC.c @@ -1,7 +1,6 @@ #include #include -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_defs/struct_0203CC84.h" #include "struct_defs/struct_02099F80.h" @@ -10,13 +9,13 @@ #include "font.h" #include "gx_layers.h" #include "heap.h" +#include "menu.h" #include "message.h" #include "overlay_manager.h" #include "savedata.h" #include "strbuf.h" #include "text.h" #include "unk_02000C88.h" -#include "unk_02001AF4.h" #include "unk_020041CC.h" #include "unk_02005474.h" #include "unk_0200DA60.h" @@ -34,7 +33,7 @@ typedef struct { BgConfig *unk_14; MessageLoader *unk_18; Window unk_1C; - UIControlData *unk_2C; + Menu *unk_2C; SaveData *unk_30; void *unk_34; } UnkStruct_02099DFC; @@ -260,12 +259,12 @@ static BOOL sub_0209A0F4(UnkStruct_02099DFC *param0) switch (param0->unk_04) { case 0: if (sub_0209A200(param0, 0, 1, 4) == TRUE) { - param0->unk_2C = sub_02002054(param0->unk_14, &Unk_020F89EC, 512 - (18 + 12) - 9, 3, 1, param0->unk_00); + param0->unk_2C = Menu_MakeYesNoChoiceWithCursorAt(param0->unk_14, &Unk_020F89EC, 512 - (18 + 12) - 9, 3, 1, param0->unk_00); param0->unk_04 = 1; } break; case 1: { - u32 v1 = sub_02002114(param0->unk_2C, param0->unk_00); + u32 v1 = Menu_ProcessInputAndHandleExit(param0->unk_2C, param0->unk_00); switch (v1) { case 0: @@ -278,12 +277,12 @@ static BOOL sub_0209A0F4(UnkStruct_02099DFC *param0) } break; case 2: if (sub_0209A200(param0, 1, 1, 4) == TRUE) { - param0->unk_2C = sub_02002054(param0->unk_14, &Unk_020F89EC, (512 - (18 + 12)) - 9, 3, 1, param0->unk_00); + param0->unk_2C = Menu_MakeYesNoChoiceWithCursorAt(param0->unk_14, &Unk_020F89EC, (512 - (18 + 12)) - 9, 3, 1, param0->unk_00); param0->unk_04 = 3; } break; case 3: { - u32 v2 = sub_02002114(param0->unk_2C, param0->unk_00); + u32 v2 = Menu_ProcessInputAndHandleExit(param0->unk_2C, param0->unk_00); switch (v2) { case 0: diff --git a/src/unk_0209A2C4.c b/src/unk_0209A2C4.c index 7771dc69a7..64c14f2d8c 100644 --- a/src/unk_0209A2C4.c +++ b/src/unk_0209A2C4.c @@ -1,7 +1,6 @@ #include #include -#include "struct_decls/struct_02001AF4_decl.h" #include "struct_defs/struct_0203CC84.h" #include "struct_defs/struct_02099F80.h" @@ -10,6 +9,7 @@ #include "font.h" #include "gx_layers.h" #include "heap.h" +#include "menu.h" #include "message.h" #include "overlay_manager.h" #include "savedata.h" @@ -32,7 +32,7 @@ typedef struct { BgConfig *unk_18; MessageLoader *unk_1C; Window unk_20; - UIControlData *unk_30; + Menu *unk_30; SaveData *unk_34; void *unk_38; u32 unk_3C;