diff --git a/include/common_structs.h b/include/common_structs.h index fd2b6ac142..b87009b799 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -2049,56 +2049,6 @@ typedef struct PlayerStatus { /* 0x281 */ char unk_281[7]; } PlayerStatus; // size = 0x288 -typedef struct SaveGlobals { - /* 0x00 */ char magicString[16]; /* "Mario Story 006" string */ - /* 0x10 */ s8 pad[32]; /* always zero */ - /* 0x30 */ s32 crc1; - /* 0x34 */ s32 crc2; - /* 0x38 */ s32 useMonoSound; - /* 0x3C */ u32 lastFileSelected; - /* 0x40 */ s8 reserved[64]; // unused -} SaveGlobals; // size = 0x80 - -typedef struct FileDisplayData { - /* 0x00 */ s32 timePlayed; - /* 0x04 */ u8 spiritsRescued; - /* 0x05 */ char unk_05[1]; - /* 0x06 */ s8 level; - /* 0x07 */ unsigned char filename[8]; - /* 0x0F */ char unk_0F[9]; -} FileDisplayData; // size = 0x18 - -typedef struct SaveData { - /* 0x0000 */ char magicString[16]; /* "Mario Story 006" string */ - /* 0x0010 */ char modName[28]; /* always non-null for DX saves */ - /* 0x002C */ s8 majorVersion; - /* 0x002D */ s8 minorVersion; - /* 0x002E */ s8 patchVersion; - /* 0x002F */ char reserved; - /* 0x0030 */ s32 crc1; - /* 0x0034 */ s32 crc2; - /* 0x0038 */ s32 saveSlot; - /* 0x003C */ s32 saveCount; - /* 0x0040 */ PlayerData player; - /* 0x0468 */ s16 areaID; - /* 0x046A */ s16 mapID; - /* 0x046C */ s16 entryID; - /* 0x046E */ char unk_46E[2]; - /* 0x0470 */ s32 enemyDefeatFlags[60][12]; - /* 0x0FB0 */ s32 globalFlags[64]; - /* 0x10B0 */ s8 globalBytes[512]; - /* 0x12B0 */ s32 areaFlags[8]; - /* 0x12D0 */ s8 areaBytes[16]; - /* 0x12E0 */ s8 debugEnemyContact; - /* 0x12E0 */ b8 debugUnused1; - /* 0x12E0 */ b8 debugUnused2; - /* 0x12E0 */ b8 musicEnabled; - /* 0x12E4 */ char unk_12E4[0x2]; - /* 0x12E6 */ Vec3s savePos; - /* 0x12EC */ FileDisplayData metadata; - /* 0x1304 */ char unk_1304[0x7C]; -} SaveData; // size = 0x1380 - typedef struct Path { /* 0x00 */ s32 numVectors; /* 0x04 */ f32* lengths; @@ -2132,7 +2082,7 @@ typedef struct MenuPanel { /* 0x01 */ s8 col; /* 0x02 */ s8 row; /* 0x03 */ u8 selected; // usually set to the current value from gridData - /* 0x04 */ s8 page; // filemenu: 0 = select, 1 = delete, 3 = copy from, 4 = copy to, all else = save + /* 0x04 */ s8 state; // filemenu: 0 = select, 1 = delete, 3 = copy from, 4 = copy to, all else = save /* 0x05 */ s8 numCols; /* 0x06 */ s8 numRows; /* 0x07 */ s8 numPages; // unsure @@ -2320,24 +2270,8 @@ typedef struct VirtualEntity { typedef VirtualEntity* VirtualEntityList[0x40]; -typedef struct Message { - /* 0x00 */ b32 unk_00; - /* 0x04 */ s32 entityModelIndex; - /* 0x08 */ Vec3f accel; - /* 0x14 */ Vec3f vel; - /* 0x20 */ s32 appearTime; - /* 0x24 */ s32 unk_24; - /* 0x28 */ f32 rotZ; - /* 0x2C */ f32 rotVelZ; - /* 0x30 */ f32 rotY; - /* 0x34 */ f32 scale; - /* 0x38 */ Vec3f pos; - /* 0x44 */ s32 deleteTime; - /* 0x48 */ f32 unk_48; -} Message; // size = 0x4C - -struct PopupMessage; typedef void (*PopupMessageCallback)(void* popup); + typedef struct PopupMessage { /* 0x00 */ s32 unk_00; /* 0x04 */ PopupMessageCallback updateFunc; @@ -2348,7 +2282,10 @@ typedef struct PopupMessage { /* 0x14 */ s16 duration; /* 0x16 */ s8 showMsgState; /* 0x17 */ s8 needsInit; - /* 0x18 */ Message* message; + /* 0x18 */ union { + struct BonkData* bonk; + struct HudStatusIcon* icons; + } data; } PopupMessage; // size = 0x1C typedef struct HiddenPanelsData { diff --git a/include/enums.h b/include/enums.h index 3a5406f48e..6405d7e7b4 100644 --- a/include/enums.h +++ b/include/enums.h @@ -5194,78 +5194,78 @@ enum DictionaryIndex { DICTIONARY_SIZE, }; -enum WindowId { - WINDOW_ID_NONE = -1, - WINDOW_ID_0 = 0, - WINDOW_ID_1 = 1, - WINDOW_ID_2 = 2, - WINDOW_ID_3 = 3, - WINDOW_ID_4 = 4, - WINDOW_ID_5 = 5, - WINDOW_ID_6 = 6, - WINDOW_ID_7 = 7, - WINDOW_ID_8 = 8, // battle main? - WINDOW_ID_BATTLE_POPUP = 9, - WINDOW_ID_ITEM_INFO_NAME = 10, - WINDOW_ID_ITEM_INFO_DESC = 11, - WINDOW_ID_12 = 12, - WINDOW_ID_13 = 13, - WINDOW_ID_14 = 14, - WINDOW_ID_15 = 15, - WINDOW_ID_16 = 16, - WINDOW_ID_17 = 17, // brown box used for "Throw away an item" and certain popup titles - WINDOW_ID_18 = 18, - WINDOW_ID_19 = 19, - WINDOW_ID_CURRENCY_COUNTER = 20, - WINDOW_ID_21 = 21, - WINDOW_ID_PAUSE_MAIN = 22, - WINDOW_ID_PAUSE_DECRIPTION = 23, - WINDOW_ID_FILEMENU_CURSOR = 23, // same as previous - WINDOW_ID_PAUSE_TUTORIAL = 24, - WINDOW_ID_FILEMENU_COPYARROW = 24, // same as previous - WINDOW_ID_PAUSE_TAB_STATS = 25, - WINDOW_ID_PAUSE_TAB_BADGES = 26, - WINDOW_ID_PAUSE_TAB_ITEMS = 27, - WINDOW_ID_PAUSE_TAB_PARTY = 28, - WINDOW_ID_PAUSE_TAB_SPIRITS = 29, - WINDOW_ID_PAUSE_TAB_MAP = 30, - WINDOW_ID_PAUSE_STATS = 31, - WINDOW_ID_PAUSE_BADGES = 32, - WINDOW_ID_PAUSE_ITEMS = 33, - WINDOW_ID_PAUSE_PARTNERS = 34, - WINDOW_ID_PAUSE_PARTNERS_TITLE = 35, - WINDOW_ID_PAUSE_PARTNERS_MOVELIST = 36, - WINDOW_ID_PAUSE_PARTNERS_MOVELIST_TITLE = 37, - WINDOW_ID_PAUSE_PARTNERS_MOVELIST_FLOWER = 38, - WINDOW_ID_PAUSE_SPIRITS = 39, - WINDOW_ID_PAUSE_SPIRITS_TITLE = 40, - WINDOW_ID_PAUSE_MAP = 41, - WINDOW_ID_PAUSE_MAP_TITLE = 42, - WINDOW_ID_PAUSE_TAB_INVIS = 43, - WINDOW_ID_PAUSE_CURSOR = 44, - WINDOW_ID_FILEMENU_MAIN = 44, // same as previous - WINDOW_ID_FILEMENU_TITLE = 45, - WINDOW_ID_FILEMENU_YESNO_PROMPT = 46, - WINDOW_ID_FILEMENU_INFO = 47, - WINDOW_ID_FILEMENU_CREATEFILE_HEADER = 48, - WINDOW_ID_FILEMENU_KEYBOARD = 49, - WINDOW_ID_FILEMENU_YESNO_OPTIONS = 50, - WINDOW_ID_FILEMENU_STEREO = 51, - WINDOW_ID_FILEMENU_MONO = 52, - WINDOW_ID_FILEMENU_OPTION_LEFT = 53, - WINDOW_ID_FILEMENU_OPTION_CENTER = 54, - WINDOW_ID_FILEMENU_OPTION_RIGHT = 55, - WINDOW_ID_FILEMENU_FILE0_INFO = 56, - WINDOW_ID_FILEMENU_FILE1_INFO = 57, - WINDOW_ID_FILEMENU_FILE2_INFO = 58, - WINDOW_ID_FILEMENU_FILE3_INFO = 59, - WINDOW_ID_FILEMENU_FILE0_TITLE = 60, - WINDOW_ID_FILEMENU_FILE1_TITLE = 61, - WINDOW_ID_FILEMENU_FILE2_TITLE = 62, - WINDOW_ID_FILEMENU_FILE3_TITLE = 63, -}; - -enum SimpleWindowUpdateId { +enum WindowID { + WIN_NONE = -1, + WIN_UNUSED_0 = 0, + WIN_BTL_MOVES_MENU = 1, + WIN_BTL_MOVES_TITLE = 2, + WIN_BTL_MOVES_ICON = 3, + WIN_BTL_SPIRITS_TITLE = 4, + WIN_BTL_SPIRITS_ICON = 5, + WIN_BTL_STRATS_MENU = 6, + WIN_BTL_STRATS_TITLE = 7, + WIN_BTL_DESC_BOX = 8, // strats and level up menus + WIN_BTL_POPUP = 9, + WIN_SHOP_ITEM_NAME = 10, + WIN_SHOP_ITEM_DESC = 11, + WIN_PICKUP_HEADER = 12, + WIN_UNUSED_13 = 13, // unused + WIN_POPUP_CONTENT = 14, + WIN_POPUP_TITLE_A = 15, + WIN_POPUP_COST = 16, + WIN_POPUP_TITLE_B = 17, // brown box used for "Throw away an item" and certain popup titles + WIN_PARTNER_COST = 18, + WIN_POPUP_DESC = 19, + WIN_CURRENCY_COUNTER = 20, + WIN_POPUP_PROMPT = 21, + WIN_PAUSE_MAIN = 22, + WIN_PAUSE_DECRIPTION = 23, + WIN_FILES_CURSOR = 23, // same as previous + WIN_PAUSE_TUTORIAL = 24, + WIN_FILES_COPYARROW = 24, // same as previous + WIN_PAUSE_TAB_STATS = 25, + WIN_PAUSE_TAB_BADGES = 26, + WIN_PAUSE_TAB_ITEMS = 27, + WIN_PAUSE_TAB_PARTY = 28, + WIN_PAUSE_TAB_SPIRITS = 29, + WIN_PAUSE_TAB_MAP = 30, + WIN_PAUSE_STATS = 31, + WIN_PAUSE_BADGES = 32, + WIN_PAUSE_ITEMS = 33, + WIN_PAUSE_PARTNERS = 34, + WIN_PAUSE_PARTNERS_TITLE = 35, + WIN_PAUSE_PARTNERS_MOVELIST = 36, + WIN_PAUSE_PARTNERS_MOVELIST_TITLE = 37, + WIN_PAUSE_PARTNERS_MOVELIST_FLOWER = 38, + WIN_PAUSE_SPIRITS = 39, + WIN_PAUSE_SPIRITS_TITLE = 40, + WIN_PAUSE_MAP = 41, + WIN_PAUSE_MAP_TITLE = 42, + WIN_PAUSE_TAB_INVIS = 43, + WIN_PAUSE_CURSOR = 44, + WIN_FILES_MAIN = 44, // same as previous + WIN_FILES_TITLE = 45, + WIN_FILES_CONFIRM_PROMPT = 46, + WIN_FILES_MESSAGE = 47, + WIN_FILES_INPUT_FIELD = 48, + WIN_FILES_INPUT_KEYBOARD = 49, + WIN_FILES_CONFIRM_OPTIONS = 50, + WIN_FILES_STEREO = 51, + WIN_FILES_MONO = 52, + WIN_FILES_OPTION_LEFT = 53, + WIN_FILES_OPTION_CENTER = 54, + WIN_FILES_OPTION_RIGHT = 55, + WIN_FILES_SLOT0_BODY = 56, + WIN_FILES_SLOT1_BODY = 57, + WIN_FILES_SLOT2_BODY = 58, + WIN_FILES_SLOT3_BODY = 59, + WIN_FILES_SLOT0_TITLE = 60, + WIN_FILES_SLOT1_TITLE = 61, + WIN_FILES_SLOT2_TITLE = 62, + WIN_FILES_SLOT3_TITLE = 63, +}; + +enum SimpleWindowUpdateID { WINDOW_UPDATE_SHOW = 1, WINDOW_UPDATE_HIDE = 2, WINDOW_UPDATE_HIER_UPDATE = 3, @@ -5277,11 +5277,11 @@ enum SimpleWindowUpdateId { WINDOW_UPDATE_9 = 9, }; -enum WindowGroupId { +enum WindowGroups { WINDOW_GROUP_ALL = 0, - WINDOW_GROUP_1 = 1, - WINDOW_GROUP_PAUSE_MENU = 2, - WINDOW_GROUP_FILE_MENU = 3, + WINDOW_GROUP_BATTLE = 1, + WINDOW_GROUP_PAUSE = 2, + WINDOW_GROUP_FILES = 3, }; enum RushFlags { @@ -5991,6 +5991,12 @@ enum MsgChars { MSG_CHAR_UNK_C3 = 0xC3, + MSG_CHAR_MENU_SPACE = 0xC6, + MSG_CHAR_MENU_USE_CHARSET_B = 0xC7, + MSG_CHAR_MENU_USE_CHARSET_A = 0xC8, + MSG_CHAR_MENU_BACK = 0xC9, + MSG_CHAR_MENU_END = 0xCA, + // special character codes used when reading from the source buffer MSG_CHAR_READ_ENDL = 0xF0, MSG_CHAR_READ_WAIT = 0xF1, diff --git a/include/filemenu.h b/include/filemenu.h index fcb085e030..347f61cf79 100644 --- a/include/filemenu.h +++ b/include/filemenu.h @@ -3,24 +3,61 @@ #include "common.h" +#define CENTER_WINDOW_X(id) (((gWindows[id].parent != WIN_NONE) \ + ? (gWindows[gWindows[id].parent].width / 2) \ + : (SCREEN_WIDTH / 2)) \ + - (gWindows[id].width / 2)) + +#define CENTER_WINDOW_Y(id) (((gWindows[id].parent != WIN_NONE) \ + ? (gWindows[gWindows[id].parent].height / 2) \ + : (SCREEN_HEIGHT / 2)) \ + - (gWindows[id].height / 2)) + enum { - PAGE_0, - PAGE_1, -#if !VERSION_PAL - PAGE_2, -#endif - PAGE_3, - PAGE_4, + FILE_MENU_MAIN = 0, // file selection + FILE_MENU_CONFIRM = 1, // confirmation prompt is open + FILE_MENU_MESSAGE = 2, // message is displayed, e.g. "File X has been deleted." + FILE_MENU_INPUT_NAME = 3, // "Enter a file name!" screen + FILE_MENU_LANGUAGES = 4, +}; + +enum { + FM_MAIN_SELECT_FILE = 0, // choose which file to load + FM_MAIN_SELECT_DELETE = 1, // choose which file to delete + #if !VERSION_PAL + FM_MAIN_SELECT_LANGUAGE = 2, + #endif + FM_MAIN_SELECT_COPY_FROM, + FM_MAIN_SELECT_COPY_TO, + FM_CONFIRM_DELETE = 0, + FM_CONFIRM_LANGUAGE = 1, + FM_CONFIRM_CREATE = 2, + FM_CONFIRM_COPY = 3, // unused + FM_CONFIRM_START = 4, + FM_MESSAGE_DELETED = 0, + #if !VERSION_PAL + FM_MESSAGE_LANGUAGE = 1, + #endif + FM_MESSAGE_COPIED, + FM_MESSAGE_CREATED, + FM_INPUT_CHARSET_A = 0, + FM_INPUT_CHARSET_B = 1, +}; + +enum { + FM_MAIN_OPT_DELETE = 4, + FM_MAIN_OPT_COPY = 5, + FM_MAIN_OPT_CANCEL = 6, }; extern MenuPanel* filemenu_menus[]; -extern s32 filemenu_iterFileIdx; +extern s32 filemenu_CopyToFileIdx; extern s32 filemenu_pressedButtons; extern s32 filemenu_cursorHudElem; extern s32 filemenu_heldButtons; extern s8 filemenu_filename_pos; -extern s32 filemenu_loadedFileIdx; +extern s32 filemenu_CopyFromFileIdx; extern s8 filemenu_currentMenu; extern s32 filemenu_8024C09C; extern s32 filemenu_cursorHudElemID[1]; @@ -64,7 +101,7 @@ WINDOW_UPDATE_FUNC(filemenu_update_deselect_file); WINDOW_UPDATE_FUNC(filemenu_update_show_name_confirm); WINDOW_UPDATE_FUNC(filemenu_update_hidden_name_confirm); -WINDOW_UPDATE_FUNC(main_menu_window_update); +WINDOW_UPDATE_FUNC(unused_main_menu_window_darkening); WINDOW_UPDATE_FUNC(filemenu_update_show_title); diff --git a/include/macros.h b/include/macros.h index 880e2acef2..9edd4c19ba 100644 --- a/include/macros.h +++ b/include/macros.h @@ -87,7 +87,7 @@ #define ITEM_MENU_PAGE(index) (&gPauseItemsPages[index]) #define MENU_PANEL_SELECTED_GRID_DATA(panel) \ - (panel)->gridData[(panel)->page * (panel)->numCols * (panel)->numRows + \ + (panel)->gridData[(panel)->state * (panel)->numCols * (panel)->numRows + \ (panel)->numCols * (panel)->row + \ (panel)->col] diff --git a/include/variables.h b/include/variables.h index 92131d0d06..c8398623f1 100644 --- a/include/variables.h +++ b/include/variables.h @@ -75,8 +75,6 @@ extern f32 PlayerNormalPitch; extern s32 NpcHitQueryColliderID; extern Vec3s StandardActorHomePositions[]; -extern SaveData gCurrentSaveFile; - extern s32 gEncounterSubState; extern s32 timeFreezeMode; extern s32 D_8009A678; diff --git a/src/8a860_len_3f30.c b/src/8a860_len_3f30.c index d4d5fee48d..a1cb07f3c1 100644 --- a/src/8a860_len_3f30.c +++ b/src/8a860_len_3f30.c @@ -161,16 +161,16 @@ void hide_popup_menu(void) { case POPUP_MENU_READ_LETTER: case POPUP_MENU_TAKE_FROM_CHEST: case POPUP_MENU_USEKEY: - set_window_update(WINDOW_ID_14, (s32) basic_hidden_window_update); - set_window_update(WINDOW_ID_19, (s32) basic_hidden_window_update); + set_window_update(WIN_POPUP_CONTENT, (s32) basic_hidden_window_update); + set_window_update(WIN_POPUP_DESC, (s32) basic_hidden_window_update); break; case POPUP_MENU_READ_DIARY_PAGE: case POPUP_MENU_READ_POSTCARD: case POPUP_MENU_POST_OFFICE: - set_window_update(WINDOW_ID_14, (s32) basic_hidden_window_update); + set_window_update(WIN_POPUP_CONTENT, (s32) basic_hidden_window_update); break; } - set_window_update(WINDOW_ID_21, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_PROMPT, WINDOW_UPDATE_HIDE); } else { switch (gPopupMenu->popupType) { case POPUP_MENU_USE_ITEM: @@ -184,27 +184,27 @@ void hide_popup_menu(void) { case POPUP_MENU_READ_LETTER: case POPUP_MENU_TAKE_FROM_CHEST: case POPUP_MENU_USEKEY: - set_window_update(WINDOW_ID_14, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_19, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_CONTENT, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_DESC, WINDOW_UPDATE_HIDE); break; case POPUP_MENU_READ_DIARY_PAGE: case POPUP_MENU_READ_POSTCARD: case POPUP_MENU_POST_OFFICE: - set_window_update(WINDOW_ID_14, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_CONTENT, WINDOW_UPDATE_HIDE); break; } } if (gPopupMenu->popupType == POPUP_MENU_TRADE_FOR_BADGE) { - set_window_update(WINDOW_ID_16, (s32) basic_hidden_window_update); - set_window_update(WINDOW_ID_CURRENCY_COUNTER, (s32) basic_hidden_window_update); + set_window_update(WIN_POPUP_COST, (s32) basic_hidden_window_update); + set_window_update(WIN_CURRENCY_COUNTER, (s32) basic_hidden_window_update); } if (gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) { - set_window_update(WINDOW_ID_18, (s32) basic_hidden_window_update); + set_window_update(WIN_PARTNER_COST, (s32) basic_hidden_window_update); } if (gPopupMenu->popupType == POPUP_MENU_SELL_ITEM) { - set_window_update(WINDOW_ID_16, (s32) basic_hidden_window_update); - set_window_update(WINDOW_ID_CURRENCY_COUNTER, (s32) basic_hidden_window_update); + set_window_update(WIN_POPUP_COST, (s32) basic_hidden_window_update); + set_window_update(WIN_CURRENCY_COUNTER, (s32) basic_hidden_window_update); } gPopupState = POPUP_STATE_10; D_8010D644 = D_8010D692; @@ -263,24 +263,24 @@ void func_800F16CC(void) { case POPUP_MENU_READ_LETTER: case POPUP_MENU_TAKE_FROM_CHEST: case POPUP_MENU_USEKEY: - set_window_update(WINDOW_ID_14, (s32) basic_window_update); + set_window_update(WIN_POPUP_CONTENT, (s32) basic_window_update); sfx_play_sound(SOUND_OPEN_POPUP_1); - set_window_update(WINDOW_ID_19, (s32) basic_window_update); + set_window_update(WIN_POPUP_DESC, (s32) basic_window_update); break; case POPUP_MENU_SWITCH_PARTNER: case POPUP_MENU_UPGRADE_PARTNER: - set_window_update(WINDOW_ID_14, (s32) basic_window_update); + set_window_update(WIN_POPUP_CONTENT, (s32) basic_window_update); sfx_play_sound(SOUND_OPEN_POPUP_2); - set_window_update(WINDOW_ID_19, (s32) basic_window_update); + set_window_update(WIN_POPUP_DESC, (s32) basic_window_update); break; case POPUP_MENU_READ_DIARY_PAGE: case POPUP_MENU_READ_POSTCARD: case POPUP_MENU_POST_OFFICE: - set_window_update(WINDOW_ID_14, (s32) basic_window_update); + set_window_update(WIN_POPUP_CONTENT, (s32) basic_window_update); sfx_play_sound(SOUND_OPEN_POPUP_1); break; } - set_window_update(WINDOW_ID_21, (s32) basic_window_update); + set_window_update(WIN_POPUP_PROMPT, (s32) basic_window_update); } else { switch (gPopupMenu->popupType) { case POPUP_MENU_USE_ITEM: @@ -292,31 +292,31 @@ void func_800F16CC(void) { case POPUP_MENU_READ_LETTER: case POPUP_MENU_TAKE_FROM_CHEST: case POPUP_MENU_USEKEY: - set_window_update(WINDOW_ID_14, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_19, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_CONTENT, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_DESC, WINDOW_UPDATE_SHOW); break; case POPUP_MENU_SWITCH_PARTNER: case POPUP_MENU_UPGRADE_PARTNER: - set_window_update(WINDOW_ID_14, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_19, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_CONTENT, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_DESC, WINDOW_UPDATE_SHOW); break; case POPUP_MENU_READ_DIARY_PAGE: case POPUP_MENU_READ_POSTCARD: case POPUP_MENU_POST_OFFICE: - set_window_update(WINDOW_ID_14, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_CONTENT, WINDOW_UPDATE_SHOW); break; } } if (gPopupMenu->popupType == POPUP_MENU_TRADE_FOR_BADGE) { - set_window_update(WINDOW_ID_16, (s32) basic_window_update); - set_window_update(WINDOW_ID_CURRENCY_COUNTER, (s32) basic_window_update); + set_window_update(WIN_POPUP_COST, (s32) basic_window_update); + set_window_update(WIN_CURRENCY_COUNTER, (s32) basic_window_update); } if (gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) { - set_window_update(WINDOW_ID_18, (s32) basic_window_update); + set_window_update(WIN_PARTNER_COST, (s32) basic_window_update); } if (gPopupMenu->popupType == POPUP_MENU_SELL_ITEM) { - set_window_update(WINDOW_ID_16, (s32) basic_window_update); + set_window_update(WIN_POPUP_COST, (s32) basic_window_update); } hud_element_set_tint(PopupMenu_EmptybarHEID, 255, 255, 255); hud_element_set_tint(PopupMenu_EntryIconHEID, 255, 255, 255); @@ -598,18 +598,18 @@ s32 popup_menu_update(void) { posX2 = (var_s5 - width2) / 2; gPopupMenu->unk_334 = (80 - msgWidth) / 2; } - set_window_properties(WINDOW_ID_14, posX, posY, var_s6, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, + set_window_properties(WIN_POPUP_CONTENT, posX, posY, var_s6, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); if (gPopupMenu->unk_338 == 0) { - set_window_properties(WINDOW_ID_15, posX2, -6, width2, 16, WINDOW_PRIORITY_21, - popup_menu_draw_title_contents, NULL, WINDOW_ID_14); - set_window_update(WINDOW_ID_15, 1); - set_window_update(WINDOW_ID_17, 2); + set_window_properties(WIN_POPUP_TITLE_A, posX2, -6, width2, 16, WINDOW_PRIORITY_21, + popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT); + set_window_update(WIN_POPUP_TITLE_A, 1); + set_window_update(WIN_POPUP_TITLE_B, 2); } else { - set_window_properties(WINDOW_ID_17, posX2, -6, width2, 16, WINDOW_PRIORITY_21, - popup_menu_draw_title_contents, NULL, WINDOW_ID_14); - set_window_update(WINDOW_ID_15, 2); - set_window_update(WINDOW_ID_17, 1); + set_window_properties(WIN_POPUP_TITLE_B, posX2, -6, width2, 16, WINDOW_PRIORITY_21, + popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT); + set_window_update(WIN_POPUP_TITLE_A, 2); + set_window_update(WIN_POPUP_TITLE_B, 1); } #elif VERSION_JP switch (gPopupMenu->popupType) { @@ -619,58 +619,58 @@ s32 popup_menu_update(void) { case POPUP_MENU_CLAIM_ITEM: case POPUP_MENU_TAKE_FROM_CHEST: case POPUP_MENU_USEKEY: - set_window_properties(WINDOW_ID_14, posX, posY, 130, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); - set_window_properties(WINDOW_ID_15, 12, -6, 106, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14); - set_window_update(WINDOW_ID_15, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_17, WINDOW_UPDATE_HIDE); + set_window_properties(WIN_POPUP_CONTENT, posX, posY, 130, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); + set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 106, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT); + set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE); break; case POPUP_MENU_SWITCH_PARTNER: - set_window_properties(WINDOW_ID_14, posX, posY, 104, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); - set_window_properties(WINDOW_ID_17, 14, -6, 72, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14); - set_window_update(WINDOW_ID_15, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_17, WINDOW_UPDATE_SHOW); + set_window_properties(WIN_POPUP_CONTENT, posX, posY, 104, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); + set_window_properties(WIN_POPUP_TITLE_B, 14, -6, 72, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT); + set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_SHOW); break; case POPUP_MENU_TRADE_FOR_BADGE: - set_window_properties(WINDOW_ID_14, posX, posY, 152, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); - set_window_properties(WINDOW_ID_15, 12, -6, 106, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14); - set_window_update(WINDOW_ID_15, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_17, WINDOW_UPDATE_HIDE); + set_window_properties(WIN_POPUP_CONTENT, posX, posY, 152, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); + set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 106, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT); + set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE); break; case POPUP_MENU_UPGRADE_PARTNER: - set_window_properties(WINDOW_ID_14, posX, posY, 126, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); - set_window_properties(WINDOW_ID_17, 12, -6, 66, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14); - set_window_update(WINDOW_ID_15, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_17, WINDOW_UPDATE_SHOW); + set_window_properties(WIN_POPUP_CONTENT, posX, posY, 126, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); + set_window_properties(WIN_POPUP_TITLE_B, 12, -6, 66, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT); + set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_SHOW); break; case POPUP_MENU_SELL_ITEM: - set_window_properties(WINDOW_ID_14, posX, posY, 152, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); - set_window_properties(WINDOW_ID_15, 12, -6, 106, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14); - set_window_update(WINDOW_ID_15, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_17, WINDOW_UPDATE_HIDE); + set_window_properties(WIN_POPUP_CONTENT, posX, posY, 152, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); + set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 106, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT); + set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE); break; case POPUP_MENU_READ_LETTER: - set_window_properties(WINDOW_ID_14, posX, posY, 120, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); - set_window_properties(WINDOW_ID_15, 24, -6, 72, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14); - set_window_update(WINDOW_ID_15, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_17, WINDOW_UPDATE_HIDE); + set_window_properties(WIN_POPUP_CONTENT, posX, posY, 120, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); + set_window_properties(WIN_POPUP_TITLE_A, 24, -6, 72, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT); + set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE); break; case POPUP_MENU_READ_DIARY_PAGE: - set_window_properties(WINDOW_ID_14, posX, posY, 108, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); - set_window_properties(WINDOW_ID_15, 12, -6, 84, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14); - set_window_update(WINDOW_ID_15, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_17, WINDOW_UPDATE_HIDE); + set_window_properties(WIN_POPUP_CONTENT, posX, posY, 108, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); + set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 84, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT); + set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE); break; case POPUP_MENU_READ_POSTCARD: - set_window_properties(WINDOW_ID_14, posX, posY, 124, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); - set_window_properties(WINDOW_ID_15, 12, -6, 100, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14); - set_window_update(WINDOW_ID_15, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_17, WINDOW_UPDATE_HIDE); + set_window_properties(WIN_POPUP_CONTENT, posX, posY, 124, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); + set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 100, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT); + set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE); break; case POPUP_MENU_POST_OFFICE: - set_window_properties(WINDOW_ID_14, posX, posY, 96, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); - set_window_properties(WINDOW_ID_17, 10, -6, 72, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14); - set_window_update(WINDOW_ID_15, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_17, WINDOW_UPDATE_SHOW); + set_window_properties(WIN_POPUP_CONTENT, posX, posY, 96, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); + set_window_properties(WIN_POPUP_TITLE_B, 10, -6, 72, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT); + set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_SHOW); break; } #else @@ -680,68 +680,68 @@ s32 popup_menu_update(void) { case POPUP_MENU_CHECK_ITEM: case POPUP_MENU_CLAIM_ITEM: case POPUP_MENU_USEKEY: - set_window_properties(WINDOW_ID_14, posX, posY, 145, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); + set_window_properties(WIN_POPUP_CONTENT, posX, posY, 145, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); if (gPopupMenu->dipMode == 0) { - set_window_properties(WINDOW_ID_15, 25, -6, 95, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14); + set_window_properties(WIN_POPUP_TITLE_A, 25, -6, 95, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT); } else { - set_window_properties(WINDOW_ID_15, 12, -6, 121, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14); + set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 121, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT); } - set_window_update(WINDOW_ID_15, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_17, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE); break; case POPUP_MENU_SWITCH_PARTNER: - set_window_properties(WINDOW_ID_14, posX, posY, 139, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); - set_window_properties(WINDOW_ID_17, 13, -6, 114, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14); - set_window_update(WINDOW_ID_15, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_17, WINDOW_UPDATE_SHOW); + set_window_properties(WIN_POPUP_CONTENT, posX, posY, 139, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); + set_window_properties(WIN_POPUP_TITLE_B, 13, -6, 114, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT); + set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_SHOW); break; case POPUP_MENU_TRADE_FOR_BADGE: - set_window_properties(WINDOW_ID_14, posX, posY, 162, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); - set_window_properties(WINDOW_ID_15, 17, -6, 96, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14); - set_window_update(WINDOW_ID_15, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_17, WINDOW_UPDATE_HIDE); + set_window_properties(WIN_POPUP_CONTENT, posX, posY, 162, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); + set_window_properties(WIN_POPUP_TITLE_A, 17, -6, 96, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT); + set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE); break; case POPUP_MENU_UPGRADE_PARTNER: - set_window_properties(WINDOW_ID_14, posX, posY, 146, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); - set_window_properties(WINDOW_ID_17, 12, -6, 114, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14); - set_window_update(WINDOW_ID_15, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_17, WINDOW_UPDATE_SHOW); + set_window_properties(WIN_POPUP_CONTENT, posX, posY, 146, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); + set_window_properties(WIN_POPUP_TITLE_B, 12, -6, 114, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT); + set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_SHOW); break; case POPUP_MENU_SELL_ITEM: - set_window_properties(WINDOW_ID_14, posX, posY, 167, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); - set_window_properties(WINDOW_ID_15, 22, -6, 95, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14); - set_window_update(WINDOW_ID_15, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_17, WINDOW_UPDATE_HIDE); + set_window_properties(WIN_POPUP_CONTENT, posX, posY, 167, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); + set_window_properties(WIN_POPUP_TITLE_A, 22, -6, 95, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT); + set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE); break; case POPUP_MENU_READ_LETTER: - set_window_properties(WINDOW_ID_14, posX, posY, 170, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); - set_window_properties(WINDOW_ID_15, 32, -6, 104, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14); - set_window_update(WINDOW_ID_15, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_17, WINDOW_UPDATE_HIDE); + set_window_properties(WIN_POPUP_CONTENT, posX, posY, 170, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); + set_window_properties(WIN_POPUP_TITLE_A, 32, -6, 104, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT); + set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE); break; case POPUP_MENU_TAKE_FROM_CHEST: - set_window_properties(WINDOW_ID_14, posX, posY, 145, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); - set_window_properties(WINDOW_ID_15, 12, -6, 121, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14); - set_window_update(WINDOW_ID_15, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_17, WINDOW_UPDATE_HIDE); + set_window_properties(WIN_POPUP_CONTENT, posX, posY, 145, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); + set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 121, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT); + set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE); break; case POPUP_MENU_READ_DIARY_PAGE: - set_window_properties(WINDOW_ID_14, posX, posY, 128, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); - set_window_properties(WINDOW_ID_15, 12, -6, 104, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14); - set_window_update(WINDOW_ID_15, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_17, WINDOW_UPDATE_HIDE); + set_window_properties(WIN_POPUP_CONTENT, posX, posY, 128, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); + set_window_properties(WIN_POPUP_TITLE_A, 12, -6, 104, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT); + set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE); break; case POPUP_MENU_READ_POSTCARD: - set_window_properties(WINDOW_ID_14, posX, posY, 149, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); - set_window_properties(WINDOW_ID_15, 6, -6, 139, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14); - set_window_update(WINDOW_ID_15, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_17, WINDOW_UPDATE_HIDE); + set_window_properties(WIN_POPUP_CONTENT, posX, posY, 149, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); + set_window_properties(WIN_POPUP_TITLE_A, 6, -6, 139, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT); + set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_HIDE); break; case POPUP_MENU_POST_OFFICE: - set_window_properties(WINDOW_ID_14, posX, posY, 131, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); - set_window_properties(WINDOW_ID_17, 10, -6, 114, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WINDOW_ID_14); - set_window_update(WINDOW_ID_15, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_17, WINDOW_UPDATE_SHOW); + set_window_properties(WIN_POPUP_CONTENT, posX, posY, 131, (PopupMenu_DisplayedEntryCount * LINE_HEIGHT) + 26, WINDOW_PRIORITY_20, popup_menu_draw_menu_contents, NULL, -1); + set_window_properties(WIN_POPUP_TITLE_B, 10, -6, 114, 16, WINDOW_PRIORITY_21, popup_menu_draw_title_contents, NULL, WIN_POPUP_CONTENT); + set_window_update(WIN_POPUP_TITLE_A, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_TITLE_B, WINDOW_UPDATE_SHOW); break; } #endif @@ -749,22 +749,22 @@ s32 popup_menu_update(void) { #if VERSION_JP switch (gPopupMenu->popupType) { case POPUP_MENU_UPGRADE_PARTNER: - set_window_properties(WINDOW_ID_18, 84, -6, 40, 16, WINDOW_PRIORITY_21, popup_draw_cost_icon, NULL, WINDOW_ID_14); + set_window_properties(WIN_PARTNER_COST, 84, -6, 40, 16, WINDOW_PRIORITY_21, popup_draw_cost_icon, NULL, WIN_POPUP_CONTENT); break; case POPUP_MENU_TRADE_FOR_BADGE: - set_window_properties(WINDOW_ID_16, 116, -14, 32, 32, WINDOW_PRIORITY_21, popup_draw_cost_icon, NULL, WINDOW_ID_14); + set_window_properties(WIN_POPUP_COST, 116, -14, 32, 32, WINDOW_PRIORITY_21, popup_draw_cost_icon, NULL, WIN_POPUP_CONTENT); break; case POPUP_MENU_SELL_ITEM: - set_window_properties(WINDOW_ID_16, 116, -14, 32, 32, WINDOW_PRIORITY_21, popup_draw_cost_icon, NULL, WINDOW_ID_14); + set_window_properties(WIN_POPUP_COST, 116, -14, 32, 32, WINDOW_PRIORITY_21, popup_draw_cost_icon, NULL, WIN_POPUP_CONTENT); break; } #else switch (gPopupMenu->popupType) { case POPUP_MENU_TRADE_FOR_BADGE: - set_window_properties(WINDOW_ID_16, 126, -14, 32, 32, WINDOW_PRIORITY_21, popup_draw_cost_icon, NULL, WINDOW_ID_14); + set_window_properties(WIN_POPUP_COST, 126, -14, 32, 32, WINDOW_PRIORITY_21, popup_draw_cost_icon, NULL, WIN_POPUP_CONTENT); break; case POPUP_MENU_SELL_ITEM: - set_window_properties(WINDOW_ID_16, 131, -14, 32, 32, WINDOW_PRIORITY_21, popup_draw_cost_icon, NULL, WINDOW_ID_14); + set_window_properties(WIN_POPUP_COST, 131, -14, 32, 32, WINDOW_PRIORITY_21, popup_draw_cost_icon, NULL, WIN_POPUP_CONTENT); break; } #endif @@ -772,7 +772,7 @@ s32 popup_menu_update(void) { if (gPopupMenu->popupType == POPUP_MENU_TRADE_FOR_BADGE) { posX = PopupMenu_StarPieceCounterPosX; posY = PopupMenu_StarPieceCounterPosY; - set_window_properties(WINDOW_ID_CURRENCY_COUNTER, posX, posY, 64, 20, WINDOW_PRIORITY_21, func_800F4D28, NULL, -1); + set_window_properties(WIN_CURRENCY_COUNTER, posX, posY, 64, 20, WINDOW_PRIORITY_21, func_800F4D28, NULL, -1); } do { @@ -797,7 +797,7 @@ s32 popup_menu_update(void) { { posX = D_8010D680; posY = D_8010D682; - set_window_properties(WINDOW_ID_19, posX, posY, WINDOW_KEY_WIDTH, 32, WINDOW_PRIORITY_20, func_800F48F4, NULL, -1); + set_window_properties(WIN_POPUP_DESC, posX, posY, WINDOW_KEY_WIDTH, 32, WINDOW_PRIORITY_20, func_800F48F4, NULL, -1); } posX = D_8010D684; @@ -808,7 +808,7 @@ s32 popup_menu_update(void) { if (get_msg_lines(gPopupMenu->unk_33C) == 2) { height = 40; } - set_window_properties(WINDOW_ID_21, posX, posY, gPopupMenu->unk_340 + 144, height, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); + set_window_properties(WIN_POPUP_PROMPT, posX, posY, gPopupMenu->unk_340 + 144, height, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); #else switch (gPopupMenu->popupType) { #if VERSION_JP @@ -825,24 +825,24 @@ s32 popup_menu_update(void) { case POPUP_MENU_POST_OFFICE: switch (gPopupMenu->dipMode) { case 0: - set_window_properties(WINDOW_ID_21, D_8010D684, D_8010D686, 152, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); + set_window_properties(WIN_POPUP_PROMPT, D_8010D684, D_8010D686, 152, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); break; case 1: - set_window_properties(WINDOW_ID_21, D_8010D684, D_8010D686, 152, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); + set_window_properties(WIN_POPUP_PROMPT, D_8010D684, D_8010D686, 152, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); break; case 2: - set_window_properties(WINDOW_ID_21, D_8010D684, D_8010D686, 152, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); + set_window_properties(WIN_POPUP_PROMPT, D_8010D684, D_8010D686, 152, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); break; } break; case POPUP_MENU_TRADE_FOR_BADGE: - set_window_properties(WINDOW_ID_21, D_8010D684, D_8010D686, 136, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); + set_window_properties(WIN_POPUP_PROMPT, D_8010D684, D_8010D686, 136, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); break; case POPUP_MENU_UPGRADE_PARTNER: - set_window_properties(WINDOW_ID_21, D_8010D684, D_8010D686, 136, 48, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); + set_window_properties(WIN_POPUP_PROMPT, D_8010D684, D_8010D686, 136, 48, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); break; case POPUP_MENU_SELL_ITEM: - set_window_properties(WINDOW_ID_21, D_8010D684, D_8010D686, 120, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); + set_window_properties(WIN_POPUP_PROMPT, D_8010D684, D_8010D686, 120, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); break; #else case POPUP_MENU_USE_ITEM: @@ -850,26 +850,26 @@ s32 popup_menu_update(void) { case POPUP_MENU_CLAIM_ITEM: case POPUP_MENU_TAKE_FROM_CHEST: case POPUP_MENU_USEKEY: - set_window_properties(WINDOW_ID_21, posX, posY, 144, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); + set_window_properties(WIN_POPUP_PROMPT, posX, posY, 144, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); break; case POPUP_MENU_SWITCH_PARTNER: case POPUP_MENU_THROW_AWAY_ITEM: case POPUP_MENU_POST_OFFICE: - set_window_properties(WINDOW_ID_21, posX, posY, 144, 40, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); + set_window_properties(WIN_POPUP_PROMPT, posX, posY, 144, 40, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); break; case POPUP_MENU_TRADE_FOR_BADGE: case POPUP_MENU_READ_DIARY_PAGE: case POPUP_MENU_READ_POSTCARD: - set_window_properties(WINDOW_ID_21, posX, posY, 128, 40, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); + set_window_properties(WIN_POPUP_PROMPT, posX, posY, 128, 40, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); break; case POPUP_MENU_UPGRADE_PARTNER: - set_window_properties(WINDOW_ID_21, posX, posY, 136, 40, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); + set_window_properties(WIN_POPUP_PROMPT, posX, posY, 136, 40, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); break; case POPUP_MENU_READ_LETTER: - set_window_properties(WINDOW_ID_21, posX, posY, 112, 40, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); + set_window_properties(WIN_POPUP_PROMPT, posX, posY, 112, 40, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); break; case POPUP_MENU_SELL_ITEM: - set_window_properties(WINDOW_ID_21, posX, posY, 120, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); + set_window_properties(WIN_POPUP_PROMPT, posX, posY, 120, 32, WINDOW_PRIORITY_20, func_800F4944, NULL, -1); break; #endif } @@ -886,18 +886,18 @@ s32 popup_menu_update(void) { case POPUP_MENU_READ_LETTER: case POPUP_MENU_TAKE_FROM_CHEST: case POPUP_MENU_USEKEY: - set_window_update(WINDOW_ID_14, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_19, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_CONTENT, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_DESC, WINDOW_UPDATE_SHOW); break; case POPUP_MENU_SWITCH_PARTNER: case POPUP_MENU_UPGRADE_PARTNER: - set_window_update(WINDOW_ID_14, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_19, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_CONTENT, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_DESC, WINDOW_UPDATE_SHOW); break; case POPUP_MENU_READ_DIARY_PAGE: case POPUP_MENU_READ_POSTCARD: case POPUP_MENU_POST_OFFICE: - set_window_update(WINDOW_ID_14, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_CONTENT, WINDOW_UPDATE_SHOW); break; } } else { @@ -911,35 +911,35 @@ s32 popup_menu_update(void) { case POPUP_MENU_READ_LETTER: case POPUP_MENU_TAKE_FROM_CHEST: case POPUP_MENU_USEKEY: - set_window_update(WINDOW_ID_14, (s32)basic_window_update); + set_window_update(WIN_POPUP_CONTENT, (s32)basic_window_update); sfx_play_sound(SOUND_OPEN_POPUP_1); - set_window_update(WINDOW_ID_19, (s32)basic_window_update); + set_window_update(WIN_POPUP_DESC, (s32)basic_window_update); break; case POPUP_MENU_SWITCH_PARTNER: case POPUP_MENU_UPGRADE_PARTNER: - set_window_update(WINDOW_ID_14, (s32)basic_window_update); + set_window_update(WIN_POPUP_CONTENT, (s32)basic_window_update); sfx_play_sound(SOUND_OPEN_POPUP_2); - set_window_update(WINDOW_ID_19, (s32)basic_window_update); + set_window_update(WIN_POPUP_DESC, (s32)basic_window_update); break; case POPUP_MENU_READ_DIARY_PAGE: case POPUP_MENU_READ_POSTCARD: case POPUP_MENU_POST_OFFICE: - set_window_update(WINDOW_ID_14, (s32)basic_window_update); + set_window_update(WIN_POPUP_CONTENT, (s32)basic_window_update); sfx_play_sound(SOUND_OPEN_POPUP_1); break; } - set_window_update(WINDOW_ID_21, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_PROMPT, WINDOW_UPDATE_SHOW); } if (gPopupMenu->popupType == POPUP_MENU_TRADE_FOR_BADGE) { - set_window_update(WINDOW_ID_16, (s32)basic_window_update); - set_window_update(WINDOW_ID_CURRENCY_COUNTER, (s32)basic_window_update); + set_window_update(WIN_POPUP_COST, (s32)basic_window_update); + set_window_update(WIN_CURRENCY_COUNTER, (s32)basic_window_update); } if (gPopupMenu->popupType == POPUP_MENU_UPGRADE_PARTNER) { - set_window_update(WINDOW_ID_18, (s32)basic_window_update); + set_window_update(WIN_PARTNER_COST, (s32)basic_window_update); } if (gPopupMenu->popupType == POPUP_MENU_SELL_ITEM) { - set_window_update(WINDOW_ID_16, (s32)basic_window_update); + set_window_update(WIN_POPUP_COST, (s32)basic_window_update); } gPopupState = POPUP_STATE_CHOOSING; break; @@ -1152,18 +1152,18 @@ s32 popup_menu_update(void) { case POPUP_MENU_READ_LETTER: case POPUP_MENU_TAKE_FROM_CHEST: case POPUP_MENU_USEKEY: - set_window_update(WINDOW_ID_14, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_19, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_CONTENT, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_DESC, WINDOW_UPDATE_HIDE); break; case POPUP_MENU_SWITCH_PARTNER: case POPUP_MENU_UPGRADE_PARTNER: - set_window_update(WINDOW_ID_14, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_19, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_CONTENT, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_DESC, WINDOW_UPDATE_HIDE); break; case POPUP_MENU_READ_DIARY_PAGE: case POPUP_MENU_READ_POSTCARD: case POPUP_MENU_POST_OFFICE: - set_window_update(WINDOW_ID_14, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_CONTENT, WINDOW_UPDATE_HIDE); break; } destroy_popup_menu(); @@ -1204,10 +1204,10 @@ s32 popup_menu_update(void) { gPopupMenu->result = POPUP_RESULT_INVALID; return 0; case POPUP_STATE_ALREADY_HAVE_PARTNER_SHOW: - set_window_update(WINDOW_ID_14, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_19, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_CONTENT, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_DESC, WINDOW_UPDATE_HIDE); if (PopupNotBattle) { - set_window_update(WINDOW_ID_21, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_PROMPT, WINDOW_UPDATE_HIDE); } #if VERSION_PAL width = get_msg_width(MSG_Menus_006B, 0) + 32; @@ -1216,12 +1216,12 @@ s32 popup_menu_update(void) { } else { posY = 72; } - set_window_properties(WINDOW_ID_BATTLE_POPUP, 160 - (width / 2), posY, width, 40, WINDOW_PRIORITY_20, popup_draw_already_have_partner, NULL, -1); + set_window_properties(WIN_BTL_POPUP, 160 - (width / 2), posY, width, 40, WINDOW_PRIORITY_20, popup_draw_already_have_partner, NULL, -1); #else width = get_msg_width(MSG_Menus_006B, 0) + 23; - set_window_properties(WINDOW_ID_BATTLE_POPUP, 160 - (width / 2), 80, width, ALREADY_PARTNER_HEIGHT, WINDOW_PRIORITY_20, popup_draw_already_have_partner, NULL, -1); + set_window_properties(WIN_BTL_POPUP, 160 - (width / 2), 80, width, ALREADY_PARTNER_HEIGHT, WINDOW_PRIORITY_20, popup_draw_already_have_partner, NULL, -1); #endif - set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_SHOW); D_8010D644 = 60; gPopupState = POPUP_STATE_ALREADY_HAVE_PARTNER_AWAIT; return 0; @@ -1233,11 +1233,11 @@ s32 popup_menu_update(void) { D_8010D644--; return 0; } - set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_14, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_19, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_CONTENT, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_DESC, WINDOW_UPDATE_SHOW); if (PopupNotBattle) { - set_window_update(WINDOW_ID_21, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_PROMPT, WINDOW_UPDATE_SHOW); } gPopupState = POPUP_STATE_CHOOSING; gPopupMenu->result = POPUP_RESULT_CHOOSING; @@ -1275,18 +1275,18 @@ s32 popup_menu_update(void) { case POPUP_MENU_READ_LETTER: case POPUP_MENU_TAKE_FROM_CHEST: case POPUP_MENU_USEKEY: - set_window_update(WINDOW_ID_14, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_19, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_CONTENT, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_DESC, WINDOW_UPDATE_HIDE); break; case POPUP_MENU_SWITCH_PARTNER: case POPUP_MENU_UPGRADE_PARTNER: - set_window_update(WINDOW_ID_14, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_19, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_CONTENT, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_DESC, WINDOW_UPDATE_HIDE); break; case POPUP_MENU_READ_DIARY_PAGE: case POPUP_MENU_READ_POSTCARD: case POPUP_MENU_POST_OFFICE: - set_window_update(WINDOW_ID_14, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_CONTENT, WINDOW_UPDATE_HIDE); break; } @@ -1305,19 +1305,19 @@ s32 popup_menu_update(void) { height = 40; posY = 72; } - set_window_properties(WINDOW_ID_21, 160 - (width / 2), posY, width, height, WINDOW_PRIORITY_19, func_800F4C1C, NULL, -1); + set_window_properties(WIN_POPUP_PROMPT, 160 - (width / 2), posY, width, height, WINDOW_PRIORITY_19, func_800F4C1C, NULL, -1); #else width = get_msg_width(msgID, 0) + 23; - set_window_properties(WINDOW_ID_21, 160 - (width / 2), 76, width, 32, WINDOW_PRIORITY_19, func_800F4C1C, NULL, -1); + set_window_properties(WIN_POPUP_PROMPT, 160 - (width / 2), 76, width, 32, WINDOW_PRIORITY_19, func_800F4C1C, NULL, -1); #endif - set_window_update(WINDOW_ID_21, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_PROMPT, WINDOW_UPDATE_SHOW); D_8010D6A0 = msg_get_printer_for_msg(MSG_Choice_001D, &D_8010D6A4); msg_printer_set_origin_pos(D_8010D6A0, 160, 144); gPopupState = POPUP_STATE_CANCEL_DIP_AWAIT_CHOICE; break; case POPUP_STATE_CANCEL_DIP_AWAIT_CHOICE: if (D_8010D6A4 == 1) { - set_window_update(WINDOW_ID_21, WINDOW_UPDATE_HIDE); + set_window_update(WIN_POPUP_PROMPT, WINDOW_UPDATE_HIDE); switch (D_8010D6A0->curOption) { case 0: gPopupState = POPUP_STATE_CANCEL_DIP_ACCEPT; @@ -1363,18 +1363,18 @@ s32 popup_menu_update(void) { case POPUP_MENU_READ_LETTER: case POPUP_MENU_TAKE_FROM_CHEST: case POPUP_MENU_USEKEY: - set_window_update(WINDOW_ID_14, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_19, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_CONTENT, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_DESC, WINDOW_UPDATE_SHOW); break; case POPUP_MENU_SWITCH_PARTNER: case POPUP_MENU_UPGRADE_PARTNER: - set_window_update(WINDOW_ID_14, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_19, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_CONTENT, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_DESC, WINDOW_UPDATE_SHOW); break; case POPUP_MENU_READ_DIARY_PAGE: case POPUP_MENU_READ_POSTCARD: case POPUP_MENU_POST_OFFICE: - set_window_update(WINDOW_ID_14, WINDOW_UPDATE_SHOW); + set_window_update(WIN_POPUP_CONTENT, WINDOW_UPDATE_SHOW); break; } D_8010D690 = MSG_PAL_STANDARD; diff --git a/src/battle/16C8E0.c b/src/battle/16C8E0.c index 29ceeaf0c0..7ae1062f00 100644 --- a/src/battle/16C8E0.c +++ b/src/battle/16C8E0.c @@ -198,7 +198,7 @@ void initialize_battle(void) { create_worker_world(NULL, btl_render_actors); btl_popup_messages_init(); func_80268E88(); - set_windows_visible(WINDOW_GROUP_1); + set_windows_visible(WINDOW_GROUP_BATTLE); D_8029EFBC = hud_element_create(&HES_HPBar); hud_element_set_flags(D_8029EFBC, HUD_ELEMENT_FLAG_80); diff --git a/src/battle/190B20.c b/src/battle/190B20.c index b2fa6f0587..7009f90e83 100644 --- a/src/battle/190B20.c +++ b/src/battle/190B20.c @@ -608,7 +608,7 @@ s32 func_8026324C(Actor* actor, Actor* targetActor) { return func_80263064(actor, targetActor, TRUE); } -void func_80263268(void) { +void btl_check_can_change_partner(void) { BattleStatus* battleStatus = &gBattleStatus; PlayerData* playerData = &gPlayerData; Actor* partner = battleStatus->partnerActor; @@ -643,20 +643,20 @@ void func_80263268(void) { } } -void func_80263300(void) { +void btl_init_menu_items(void) { BattleStatus* battleStatus = &gBattleStatus; Actor* player = battleStatus->playerActor; PlayerData* playerData = &gPlayerData; - s32 cond; + s32 hasValidItem; s32 i; battleStatus->menuStatus[0] = 0; - cond = FALSE; + hasValidItem = FALSE; for (i = 0; i < ARRAY_COUNT(playerData->invItems); i++) { s16 itemID = playerData->invItems[i]; - if (itemID != 0) { + if (itemID != ITEM_NONE) { ItemData* itemData = &gItemTable[itemID]; if (itemData->typeFlags & ITEM_TYPE_FLAG_BATTLE_USABLE) { @@ -667,13 +667,13 @@ void func_80263300(void) { if (player->targetListLength != 0) { battleStatus->menuStatus[0]++; - cond = TRUE; + hasValidItem = TRUE; } } } } - if (!cond) { + if (!hasValidItem) { battleStatus->menuStatus[0] = 0; } } diff --git a/src/battle/btl_states_menus.c b/src/battle/btl_states_menus.c index 623ddbab82..e13473fa44 100644 --- a/src/battle/btl_states_menus.c +++ b/src/battle/btl_states_menus.c @@ -444,18 +444,20 @@ BSS s32 D_802AD6D4; void create_battle_popup_menu(PopupMenu* popup); s32 get_player_anim_for_status(s32 animID); -void func_802A3C98(void* data, s32 x, s32 y); -void func_802A43DC(void* data, s32 x, s32 y); -void func_802A4448(void* data, s32 x, s32 y); -void func_802A4494(void* data, s32 x, s32 y); -void func_802A4534(void* data, s32 x, s32 y); + +void btl_menu_moves_draw_content(void* data, s32 x, s32 y); +void btl_menu_moves_show_title(void* data, s32 x, s32 y); +void btl_menu_moves_show_icon(void* data, s32 x, s32 y); +void btl_menu_moves_show_desc(void* data, s32 x, s32 y); +void btl_menu_moves_show_error(void* data, s32 x, s32 y); + void btl_menu_strats_draw_content(void* data, s32 x, s32 y); void btl_menu_strats_show_title(void* data, s32 x, s32 y); void btl_menu_strats_show_desc(void* data, s32 x, s32 y); void btl_menu_strats_show_error(void* data, s32 x, s32 y); -void func_80263300(void); -void func_80263268(void); +void btl_init_menu_items(void); +void btl_check_can_change_partner(void); void btl_init_menu_partner(void); void func_800F52BC(void); void func_800F16CC(void); @@ -955,17 +957,17 @@ void func_802A27D0(void) { void func_802A27E4(void) { s32 i; - set_window_update(WINDOW_ID_1, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_MOVES_MENU, WINDOW_UPDATE_HIDE); if (!BattleMenu_UsingSpiritsSubmenu) { - set_window_update(WINDOW_ID_2, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_3, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_MOVES_TITLE, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_MOVES_ICON, WINDOW_UPDATE_HIDE); } else { - set_window_update(WINDOW_ID_4, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_5, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_SPIRITS_TITLE, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_SPIRITS_ICON, WINDOW_UPDATE_HIDE); } - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_HIDE); for (i = 0; i < BattleMenu_Moves_OptionCount; i++) { hud_element_free(BattleMenu_Moves_OptionIDs[i]); @@ -1004,17 +1006,17 @@ void func_802A2910(void) { } hud_element_set_script(BattleMenu_Moves_CursorID, &HES_AnimatedHandPointer); - set_window_update(WINDOW_ID_1, WINDOW_UPDATE_TRANSPARENT); + set_window_update(WIN_BTL_MOVES_MENU, WINDOW_UPDATE_TRANSPARENT); if (!BattleMenu_UsingSpiritsSubmenu) { - set_window_update(WINDOW_ID_2, WINDOW_UPDATE_TRANSPARENT); - set_window_update(WINDOW_ID_3, WINDOW_UPDATE_TRANSPARENT); + set_window_update(WIN_BTL_MOVES_TITLE, WINDOW_UPDATE_TRANSPARENT); + set_window_update(WIN_BTL_MOVES_ICON, WINDOW_UPDATE_TRANSPARENT); } else { - set_window_update(WINDOW_ID_4, WINDOW_UPDATE_TRANSPARENT); - set_window_update(WINDOW_ID_5, WINDOW_UPDATE_TRANSPARENT); + set_window_update(WIN_BTL_SPIRITS_TITLE, WINDOW_UPDATE_TRANSPARENT); + set_window_update(WIN_BTL_SPIRITS_ICON, WINDOW_UPDATE_TRANSPARENT); } - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_SHOW); BattleMenu_Moves_TextColor = MSG_PAL_STANDARD; D_802AD10F = 1; BattleMenu_Moves_TextAlpha = 255; @@ -1026,16 +1028,16 @@ void func_802A2AB8(void) { s32* moveOptionCostUnitIconIDs; s32 i; - set_window_update(WINDOW_ID_1, WINDOW_UPDATE_TRANSPARENT); + set_window_update(WIN_BTL_MOVES_MENU, WINDOW_UPDATE_TRANSPARENT); if (!BattleMenu_UsingSpiritsSubmenu) { - set_window_update(WINDOW_ID_2, WINDOW_UPDATE_TRANSPARENT); - set_window_update(WINDOW_ID_3, WINDOW_UPDATE_TRANSPARENT); + set_window_update(WIN_BTL_MOVES_TITLE, WINDOW_UPDATE_TRANSPARENT); + set_window_update(WIN_BTL_MOVES_ICON, WINDOW_UPDATE_TRANSPARENT); } else { - set_window_update(WINDOW_ID_4, WINDOW_UPDATE_TRANSPARENT); - set_window_update(WINDOW_ID_5, WINDOW_UPDATE_TRANSPARENT); + set_window_update(WIN_BTL_SPIRITS_TITLE, WINDOW_UPDATE_TRANSPARENT); + set_window_update(WIN_BTL_SPIRITS_ICON, WINDOW_UPDATE_TRANSPARENT); } - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_SHOW); moveOptionIconIDs = BattleMenu_Moves_OptionIDs; @@ -1061,13 +1063,12 @@ void func_802A2AB8(void) { } void func_802A2C58(void) { - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_SHOW); battle_menu_moveState = BTL_SUBMENU_MOVES_STATE_UNK_1E; } s32 btl_submenu_moves_update(void) { BattleStatus* battleStatus = &gBattleStatus; - s8 temp_v0_14; s32 moveX; s32 moveY; s32 msgWidth; @@ -1191,30 +1192,25 @@ s32 btl_submenu_moves_update(void) { moveX = BattleMenu_Moves_PosX; moveY = BattleMenu_Moves_PosY; if (!BattleMenu_UsingSpiritsSubmenu) { - set_window_properties(1, moveX, moveY, 150, (D_802AD10E * 13) + 28, 0, func_802A3C98, NULL, -1); - set_window_properties(2, moveX + 16, moveY - 6, 90, 16, 1, func_802A43DC, NULL, -1); - set_window_properties(3, moveX + 114, moveY - 12, 32, 32, 1, func_802A4448, NULL, -1); + set_window_properties(WIN_BTL_MOVES_MENU, moveX, moveY, 150, (D_802AD10E * 13) + 28, 0, btl_menu_moves_draw_content, NULL, -1); + set_window_properties(WIN_BTL_MOVES_TITLE, moveX + 16, moveY - 6, 90, 16, 1, btl_menu_moves_show_title, NULL, -1); + set_window_properties(WIN_BTL_MOVES_ICON, moveX + 114, moveY - 12, 32, 32, 1, btl_menu_moves_show_icon, NULL, -1); } else { - s16 new_var; - - set_window_properties(1, moveX, moveY, 144, (D_802AD10E * 13) + 28, 0, func_802A3C98, NULL, -1); - new_var = moveY; // todo required to match - set_window_properties(4, moveX + 10, new_var - 6, 100, 16, 1, func_802A43DC, 0, -1); - set_window_properties(5, moveX + 110, new_var - 12, 32, 35, 1, func_802A4448, 0, -1); + set_window_properties(WIN_BTL_MOVES_MENU, moveX, moveY, 144, (D_802AD10E * 13) + 28, 0, btl_menu_moves_draw_content, NULL, -1); + set_window_properties(WIN_BTL_SPIRITS_TITLE, moveX + 10, moveY - 6, 100, 16, 1, btl_menu_moves_show_title, 0, -1); + set_window_properties(WIN_BTL_SPIRITS_ICON, moveX + 110, moveY - 12, 32, 35, 1, btl_menu_moves_show_icon, 0, -1); } - moveX = 20; - moveY = BattleMenu_Moves_PosY; - set_window_properties(8, moveX, 186, 280, 32, WINDOW_PRIORITY_20, func_802A4494, NULL, -1); - set_window_update(WINDOW_ID_1, WINDOW_UPDATE_SHOW); + set_window_properties(WIN_BTL_DESC_BOX, 20, 186, 280, 32, WINDOW_PRIORITY_20, btl_menu_moves_show_desc, NULL, -1); + set_window_update(WIN_BTL_MOVES_MENU, WINDOW_UPDATE_SHOW); if (!BattleMenu_UsingSpiritsSubmenu) { - set_window_update(WINDOW_ID_2, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_3, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_MOVES_TITLE, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_MOVES_ICON, WINDOW_UPDATE_SHOW); } else { - set_window_update(WINDOW_ID_4, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_5, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_SPIRITS_TITLE, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_SPIRITS_ICON, WINDOW_UPDATE_SHOW); } - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_SHOW); do { cond = FALSE; @@ -1291,11 +1287,7 @@ s32 btl_submenu_moves_update(void) { battle_menu_moveState = BTL_SUBMENU_MOVES_STATE_UNK_NEGATIVE_ONE; } else { sfx_play_sound(SOUND_MENU_ERROR); - D_802AD258 = 0; - temp_v0_14 = BattleMenu_Moves_OptionCantUseMessages[BattleMenu_Moves_OptionIndexMap[battle_menu_moveCursorPos]]; - if (temp_v0_14 != 0) { - D_802AD258 = temp_v0_14; - } + D_802AD258 = BattleMenu_Moves_OptionCantUseMessages[BattleMenu_Moves_OptionIndexMap[battle_menu_moveCursorPos]]; battle_menu_moveState = BTL_SUBMENU_MOVES_STATE_UNK_28; } break; @@ -1324,15 +1316,15 @@ s32 btl_submenu_moves_update(void) { hud_element_set_script(BattleMenu_Moves_CursorID, &HES_HandPointer); BattleMenu_Moves_TextColor = MSG_PAL_0D; - set_window_update(WINDOW_ID_1, WINDOW_UPDATE_DARKENED); + set_window_update(WIN_BTL_MOVES_MENU, WINDOW_UPDATE_DARKENED); if (!BattleMenu_UsingSpiritsSubmenu) { - set_window_update(WINDOW_ID_2, WINDOW_UPDATE_DARKENED); - set_window_update(WINDOW_ID_3, WINDOW_UPDATE_DARKENED); + set_window_update(WIN_BTL_MOVES_TITLE, WINDOW_UPDATE_DARKENED); + set_window_update(WIN_BTL_MOVES_ICON, WINDOW_UPDATE_DARKENED); } else { - set_window_update(WINDOW_ID_4, WINDOW_UPDATE_DARKENED); - set_window_update(WINDOW_ID_5, WINDOW_UPDATE_DARKENED); + set_window_update(WIN_BTL_SPIRITS_TITLE, WINDOW_UPDATE_DARKENED); + set_window_update(WIN_BTL_SPIRITS_ICON, WINDOW_UPDATE_DARKENED); } - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_HIDE); if (!BattleMenu_UsingSpiritsSubmenu) { status_bar_stop_blinking_fp(); } else { @@ -1348,15 +1340,15 @@ s32 btl_submenu_moves_update(void) { } return 255; case BTL_SUBMENU_MOVES_STATE_UNK_A: - set_window_update(WINDOW_ID_1, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_MOVES_MENU, WINDOW_UPDATE_HIDE); if (!BattleMenu_UsingSpiritsSubmenu) { - set_window_update(WINDOW_ID_2, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_3, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_MOVES_TITLE, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_MOVES_ICON, WINDOW_UPDATE_HIDE); } else { - set_window_update(WINDOW_ID_4, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_5, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_SPIRITS_TITLE, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_SPIRITS_ICON, WINDOW_UPDATE_HIDE); } - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_HIDE); if (!BattleMenu_UsingSpiritsSubmenu) { status_bar_stop_blinking_fp(); } else { @@ -1369,28 +1361,28 @@ s32 btl_submenu_moves_update(void) { battle_menu_moveOptionActive = battle_menu_moveCursorPos; return BattleMenu_Moves_OptionIndexMap[battle_menu_moveCursorPos] + 1; case BTL_SUBMENU_MOVES_STATE_UNK_14: - set_window_update(WINDOW_ID_1, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_MOVES_MENU, WINDOW_UPDATE_SHOW); if (!BattleMenu_UsingSpiritsSubmenu) { - set_window_update(WINDOW_ID_2, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_3, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_MOVES_TITLE, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_MOVES_ICON, WINDOW_UPDATE_SHOW); } else { - set_window_update(WINDOW_ID_4, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_5, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_SPIRITS_TITLE, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_SPIRITS_ICON, WINDOW_UPDATE_SHOW); } - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_SHOW); battle_menu_moveState = BTL_SUBMENU_MOVES_STATE_UNK_1; battle_menu_moveOptionActive = battle_menu_moveCursorPos; return BattleMenu_Moves_OptionIndexMap[battle_menu_moveCursorPos] + 1; case BTL_SUBMENU_MOVES_STATE_UNK_1E: - set_window_update(WINDOW_ID_1, WINDOW_UPDATE_9); + set_window_update(WIN_BTL_MOVES_MENU, WINDOW_UPDATE_9); if (!BattleMenu_UsingSpiritsSubmenu) { - set_window_update(WINDOW_ID_2, WINDOW_UPDATE_9); - set_window_update(WINDOW_ID_3, WINDOW_UPDATE_9); + set_window_update(WIN_BTL_MOVES_TITLE, WINDOW_UPDATE_9); + set_window_update(WIN_BTL_MOVES_ICON, WINDOW_UPDATE_9); } else { - set_window_update(WINDOW_ID_4, WINDOW_UPDATE_9); - set_window_update(WINDOW_ID_5, WINDOW_UPDATE_9); + set_window_update(WIN_BTL_SPIRITS_TITLE, WINDOW_UPDATE_9); + set_window_update(WIN_BTL_SPIRITS_ICON, WINDOW_UPDATE_9); } - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_HIDE); battle_menu_moveState = BTL_SUBMENU_MOVES_STATE_UNK_NEGATIVE_ONE; break; case BTL_SUBMENU_MOVES_STATE_UNK_28: @@ -1398,15 +1390,15 @@ s32 btl_submenu_moves_update(void) { battle_menu_moveState = BTL_SUBMENU_MOVES_STATE_UNK_29; return -1; case BTL_SUBMENU_MOVES_STATE_UNK_29: - set_window_update(WINDOW_ID_1, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_MOVES_MENU, WINDOW_UPDATE_HIDE); if (!BattleMenu_UsingSpiritsSubmenu) { - set_window_update(WINDOW_ID_2, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_3, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_MOVES_TITLE, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_MOVES_ICON, WINDOW_UPDATE_HIDE); } else { - set_window_update(WINDOW_ID_4, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_5, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_SPIRITS_TITLE, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_SPIRITS_ICON, WINDOW_UPDATE_HIDE); } - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_HIDE); msgID = MSG_Menus_Battle_CantSelectNow; if (D_802AD258 == 0) { @@ -1419,8 +1411,8 @@ s32 btl_submenu_moves_update(void) { msgWidth = get_msg_width(msgID, 0) + 23; moveX = (SCREEN_WIDTH / 2) - (msgWidth / 2); - set_window_properties(9, moveX, 80, msgWidth, D_802AB340[get_msg_lines(msgID) - 1], 20, func_802A4534, NULL, -1); - set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_SHOW); + set_window_properties(WIN_BTL_POPUP, moveX, 80, msgWidth, D_802AB340[get_msg_lines(msgID) - 1], 20, btl_menu_moves_show_error, NULL, -1); + set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_SHOW); D_802AD10B = 60; battle_menu_moveState = BTL_SUBMENU_MOVES_STATE_UNK_2A; return -1; @@ -1432,16 +1424,16 @@ s32 btl_submenu_moves_update(void) { D_802AD10B--; return -1; } - set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_1, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_MOVES_MENU, WINDOW_UPDATE_SHOW); if (!BattleMenu_UsingSpiritsSubmenu) { - set_window_update(WINDOW_ID_2, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_3, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_MOVES_TITLE, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_MOVES_ICON, WINDOW_UPDATE_SHOW); } else { - set_window_update(WINDOW_ID_4, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_5, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_SPIRITS_TITLE, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_SPIRITS_ICON, WINDOW_UPDATE_SHOW); } - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_SHOW); battle_menu_moveState = BTL_SUBMENU_MOVES_STATE_UNK_1; break; } @@ -1458,7 +1450,7 @@ s32 btl_submenu_moves_update(void) { #define X_VAR2 93 #endif -void func_802A3C98(void* data, s32 x, s32 y) { +void btl_menu_moves_draw_content(void* data, s32 x, s32 y) { s32 var_t0; s32 temp_f6; s32 xPos, yPos; @@ -1660,7 +1652,7 @@ void func_802A3C98(void* data, s32 x, s32 y) { } } -void func_802A43DC(void* data, s32 x, s32 y) { +void btl_menu_moves_show_title(void* data, s32 x, s32 y) { s32 msgID; s32 posX; s32 posY; @@ -1683,7 +1675,7 @@ void func_802A43DC(void* data, s32 x, s32 y) { draw_msg(msgID, posX, posY, opacity, palette, DRAW_MSG_STYLE_MENU); } -void func_802A4448(void* data, s32 x, s32 y) { +void btl_menu_moves_show_icon(void* data, s32 x, s32 y) { s32 icon = BattleMenu_Moves_TitleID; hud_element_set_render_pos(icon, x + 16, y + 15); @@ -1691,7 +1683,7 @@ void func_802A4448(void* data, s32 x, s32 y) { hud_element_draw_clipped(icon); } -void func_802A4494(void* data, s32 x, s32 y) { +void btl_menu_moves_show_desc(void* data, s32 x, s32 y) { switch (battle_menu_moveState) { case BTL_SUBMENU_MOVES_STATE_UNK_NEGATIVE_ONE: case BTL_SUBMENU_MOVES_STATE_UNK_1: @@ -1706,7 +1698,7 @@ void func_802A4494(void* data, s32 x, s32 y) { } } -void func_802A4534(void* data, s32 x, s32 y) { +void btl_menu_moves_show_error(void* data, s32 x, s32 y) { s32 posY = y; s32 posX; s32 msgID; @@ -1773,9 +1765,9 @@ void func_802A4718(void) { void func_802A472C(void) { s32 i; - set_window_update(WINDOW_ID_6, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_7, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_STRATS_MENU, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_STRATS_TITLE, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_HIDE); for (i = 0; i < D_802AD66C; i++) { hud_element_free(D_802AD628[i]); @@ -1797,9 +1789,9 @@ void func_802A47E0(void) { hud_element_set_tint(GreenArrowUpID, 255, 255, 255); hud_element_set_tint(GreenArrowDownID, 255, 255, 255); hud_element_set_script(D_802AD618, &HES_AnimatedHandPointer); - set_window_update(WINDOW_ID_6, WINDOW_UPDATE_TRANSPARENT); - set_window_update(WINDOW_ID_7, WINDOW_UPDATE_TRANSPARENT); - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_STRATS_MENU, WINDOW_UPDATE_TRANSPARENT); + set_window_update(WIN_BTL_STRATS_TITLE, WINDOW_UPDATE_TRANSPARENT); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_SHOW); D_802AD614 = MSG_PAL_STANDARD; D_802AD60B = 1; D_802AD624 = 255; @@ -1809,9 +1801,9 @@ void func_802A47E0(void) { void func_802A48FC(void) { s32 i; - set_window_update(WINDOW_ID_6, WINDOW_UPDATE_TRANSPARENT); - set_window_update(WINDOW_ID_7, WINDOW_UPDATE_TRANSPARENT); - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_STRATS_MENU, WINDOW_UPDATE_TRANSPARENT); + set_window_update(WIN_BTL_STRATS_TITLE, WINDOW_UPDATE_TRANSPARENT); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_SHOW); for (i = 0; i < D_802AD66C; i++) { hud_element_set_tint(D_802AD628[i], 255, 255, 255); @@ -1827,9 +1819,9 @@ void func_802A48FC(void) { } void func_802A4A10(void) { - set_window_update(WINDOW_ID_6, WINDOW_UPDATE_TRANSPARENT); - set_window_update(WINDOW_ID_7, WINDOW_UPDATE_TRANSPARENT); - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_STRATS_MENU, WINDOW_UPDATE_TRANSPARENT); + set_window_update(WIN_BTL_STRATS_TITLE, WINDOW_UPDATE_TRANSPARENT); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_SHOW); BattleSubmenuStratsState = BTL_SUBMENU_STRATS_STATE_UNK_30; } @@ -1869,14 +1861,14 @@ s32 btl_update_strats_menu(void) { D_802AD614 = MSG_PAL_STANDARD; x = D_802AD63C; y = D_802AD63E; - set_window_properties(WINDOW_ID_6, x, y, 144, (StratsMenuLines * 13) + 26, 0, btl_menu_strats_draw_content, NULL, -1); - set_window_properties(WINDOW_ID_7, x + 18, y - 6, 108, 16, 1, btl_menu_strats_show_title, NULL, -1); + set_window_properties(WIN_BTL_STRATS_MENU, x, y, 144, (StratsMenuLines * 13) + 26, 0, btl_menu_strats_draw_content, NULL, -1); + set_window_properties(WIN_BTL_STRATS_TITLE, x + 18, y - 6, 108, 16, 1, btl_menu_strats_show_title, NULL, -1); x = 20; y = 186; - set_window_properties(WINDOW_ID_8, x, y, 280, 32, WINDOW_PRIORITY_20, btl_menu_strats_show_desc, NULL, -1); - set_window_update(WINDOW_ID_6, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_7, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_SHOW); + set_window_properties(WIN_BTL_DESC_BOX, x, y, 280, 32, WINDOW_PRIORITY_20, btl_menu_strats_show_desc, NULL, -1); + set_window_update(WIN_BTL_STRATS_MENU, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_STRATS_TITLE, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_SHOW); BattleSubmenuStratsState = BTL_SUBMENU_STRATS_STATE_CHOOSE; return 0; case BTL_SUBMENU_STRATS_STATE_CHOOSE: @@ -1949,30 +1941,30 @@ s32 btl_update_strats_menu(void) { hud_element_set_tint(GreenArrowDownID, 160, 160, 160); hud_element_set_script(D_802AD618, &HES_HandPointer); D_802AD614 = MSG_PAL_0D; - set_window_update(WINDOW_ID_6, WINDOW_UPDATE_DARKENED); - set_window_update(WINDOW_ID_7, WINDOW_UPDATE_DARKENED); - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_STRATS_MENU, WINDOW_UPDATE_DARKENED); + set_window_update(WIN_BTL_STRATS_TITLE, WINDOW_UPDATE_DARKENED); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_HIDE); return StratsMenuPos + 1; case BTL_SUBMENU_STRATS_STATE_CANCEL: return 255; case 10: - set_window_update(WINDOW_ID_6, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_7, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_STRATS_MENU, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_STRATS_TITLE, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_HIDE); BattleSubmenuStratsState = BTL_SUBMENU_STRATS_STATE_UNK_11; return StratsMenuPos + 1; case 11: return StratsMenuPos + 1; case 20: - set_window_update(WINDOW_ID_6, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_7, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_STRATS_MENU, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_STRATS_TITLE, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_SHOW); BattleSubmenuStratsState = BTL_SUBMENU_STRATS_STATE_CHOOSE; return StratsMenuPos + 1; case 30: - set_window_update(WINDOW_ID_6, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_7, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_STRATS_MENU, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_STRATS_TITLE, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_SHOW); BattleSubmenuStratsState = BTL_SUBMENU_STRATS_STATE_SELECT; return 0; case BTL_SUBMENU_STRATS_STATE_ERROR_INIT: @@ -1980,9 +1972,9 @@ s32 btl_update_strats_menu(void) { BattleSubmenuStratsState = BTL_SUBMENU_STRATS_STATE_ERROR_SHOW; return -1; case BTL_SUBMENU_STRATS_STATE_ERROR_SHOW: - set_window_update(WINDOW_ID_6, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_7, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_STRATS_MENU, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_STRATS_TITLE, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_HIDE); switch (D_802AD610) { case 0: msgID = MSG_Menus_Battle_CantSwitch2; @@ -1995,8 +1987,8 @@ s32 btl_update_strats_menu(void) { break; } width = get_msg_width(msgID, 0) + 23; - set_window_properties(WINDOW_ID_BATTLE_POPUP, (SCREEN_WIDTH / 2) - (width / 2), 80, width, 28, 20, btl_menu_strats_show_error, NULL, -1); - set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_SHOW); + set_window_properties(WIN_BTL_POPUP, (SCREEN_WIDTH / 2) - (width / 2), 80, width, 28, 20, btl_menu_strats_show_error, NULL, -1); + set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_SHOW); D_802AD612 = 60; BattleSubmenuStratsState = BTL_SUBMENU_STRATS_STATE_ERROR_DONE; return -1; @@ -2008,10 +2000,10 @@ s32 btl_update_strats_menu(void) { D_802AD612--; return -1; } - set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_6, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_7, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_STRATS_MENU, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_STRATS_TITLE, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_SHOW); BattleSubmenuStratsState = BTL_SUBMENU_STRATS_STATE_CHOOSE; return 0; } @@ -2325,8 +2317,8 @@ void btl_state_update_player_menu(void) { partnerActor->flags |= ACTOR_FLAG_USING_IDLE_ANIM; partnerActor->flags |= ACTOR_FLAG_SHOW_STATUS_ICONS; } - func_80263268(); - func_80263300(); + btl_check_can_change_partner(); + btl_init_menu_items(); btl_init_menu_boots(); btl_init_menu_hammer(); if (player_team_is_ability_active(playerActor, ABILITY_BERSERKER)) { @@ -3372,7 +3364,7 @@ void btl_state_update_player_menu(void) { break; case BTL_SUBSTATE_PLAYER_MENU_BUILD_STRATEGIES: entryIdx = 0; - func_80263268(); + btl_check_can_change_partner(); // add 'Change Member' command if (battleStatus->changePartnerAllowed >= 0) { @@ -3595,11 +3587,11 @@ void btl_state_update_player_menu(void) { btl_main_menu_destroy(); break; case BTL_SUBSTATE_PLAYER_MENU_CHANGE_MEMBER_7: - set_window_update(WINDOW_ID_6, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_7, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_STRATS_MENU, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_STRATS_TITLE, WINDOW_UPDATE_HIDE); if (popup->result != POPUP_RESULT_INVALID) { - set_window_update(WINDOW_ID_6, WINDOW_UPDATE_9); - set_window_update(WINDOW_ID_7, WINDOW_UPDATE_9); + set_window_update(WIN_BTL_STRATS_MENU, WINDOW_UPDATE_9); + set_window_update(WIN_BTL_STRATS_TITLE, WINDOW_UPDATE_9); gBattleSubState = BTL_SUBSTATE_PLAYER_MENU_CHANGE_MEMBER_2; } break; @@ -3730,15 +3722,15 @@ void btl_state_update_partner_menu(void) { partnerActor->flags &= ~ACTOR_FLAG_USING_IDLE_ANIM; playerActor->flags |= ACTOR_FLAG_USING_IDLE_ANIM; playerActor->flags |= ACTOR_FLAG_SHOW_STATUS_ICONS; - func_80263300(); - func_80263268(); + btl_init_menu_items(); + btl_check_can_change_partner(); entryIdx = 0; initialPos = 1; if (battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_MAIN] < 0) { battleStatus->lastPartnerMenuSelection[BTL_MENU_IDX_MAIN] = BTL_MENU_TYPE_ABILITY; } btl_init_menu_partner(); - func_80263268(); + btl_check_can_change_partner(); // strategies menu category battle_menu_submenuIDs[entryIdx] = BTL_MENU_TYPE_STRATEGIES; @@ -4267,7 +4259,7 @@ void btl_state_update_partner_menu(void) { break; case BTL_SUBSTATE_PARTNER_MENU_STRATEGIES_1: popupIndex = 0; - func_80263268(); + btl_check_can_change_partner(); // add 'Change Member' command if (battleStatus->changePartnerAllowed >= 0) { @@ -4462,11 +4454,11 @@ void btl_state_update_partner_menu(void) { btl_main_menu_destroy(); break; case BTL_SUBSTATE_PARTNER_MENU_CHANGE_PARTNER_7: - set_window_update(WINDOW_ID_6, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_7, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_STRATS_MENU, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_STRATS_TITLE, WINDOW_UPDATE_HIDE); if (popupMenu->result != POPUP_RESULT_INVALID) { - set_window_update(WINDOW_ID_6, WINDOW_UPDATE_9); - set_window_update(WINDOW_ID_7, WINDOW_UPDATE_9); + set_window_update(WIN_BTL_STRATS_MENU, WINDOW_UPDATE_9); + set_window_update(WIN_BTL_STRATS_TITLE, WINDOW_UPDATE_9); gBattleSubState = BTL_SUBSTATE_PARTNER_MENU_CHANGE_PARTNER_2; } break; diff --git a/src/battle/level_up.c b/src/battle/level_up.c index 3c3f8a652d..6284702376 100644 --- a/src/battle/level_up.c +++ b/src/battle/level_up.c @@ -969,8 +969,8 @@ void btl_state_update_celebration(void) { hud_element_set_tint(id, 128, 128, 128); x = 20; y = 186; - set_window_properties(WINDOW_ID_8, 20, 186, 280, 32, WINDOW_PRIORITY_20, draw_content_level_up_textbox, NULL, -1); - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_SHOW); + set_window_properties(WIN_BTL_DESC_BOX, 20, 186, 280, 32, WINDOW_PRIORITY_20, draw_content_level_up_textbox, NULL, -1); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_SHOW); gBattleSubState = BTL_SUBSTATE_CELEBRATE_LEVEL_UP_CHOOSE; } break; @@ -1013,7 +1013,7 @@ void btl_state_update_celebration(void) { break; case BTL_SUBSTATE_CELEBRATE_LEVEL_UP_UPGRADE: hud_element_free(LevelUpSpotlightID); - set_window_update(WINDOW_ID_8, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_DESC_BOX, WINDOW_UPDATE_HIDE); switch (battleStatus->curSubmenu) { case 0: @@ -1120,8 +1120,8 @@ void btl_state_update_celebration(void) { width = get_msg_width(MSG_Menus_CantIncrease, 0) + 31; x = 160 - (width / 2); y = 80; - set_window_properties(WINDOW_ID_BATTLE_POPUP, x, y, width, 28, WINDOW_PRIORITY_10, draw_content_cant_increase_popup, NULL, -1); - set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_SHOW); + set_window_properties(WIN_BTL_POPUP, x, y, width, 28, WINDOW_PRIORITY_10, draw_content_cant_increase_popup, NULL, -1); + set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_SHOW); CelebrateSubstateTime = 60; gBattleSubState = BTL_SUBSTATE_CELEBRATE_LEVEL_UP_INVALID_DELAY; break; @@ -1133,7 +1133,7 @@ void btl_state_update_celebration(void) { CelebrateSubstateTime--; break; } - set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_HIDE); gBattleSubState = BTL_SUBSTATE_CELEBRATE_LEVEL_UP_CHOOSE; break; case BTL_SUBSTATE_CELEBRATE_SKIPPABLE_END_DELAY: diff --git a/src/battle/popup_messages.c b/src/battle/popup_messages.c index f478c463ae..a2c1b31d60 100644 --- a/src/battle/popup_messages.c +++ b/src/battle/popup_messages.c @@ -4,33 +4,46 @@ #include "battle/battle.h" #include "battle/action_cmd.h" -extern EntityModelScript EMS_BonkIcon; +typedef struct BonkData { + /* 0x00 */ b32 alive; + /* 0x04 */ s32 entityModelIndex; + /* 0x08 */ Vec3f accel; + /* 0x14 */ Vec3f vel; + /* 0x20 */ s32 moveTime; + /* 0x24 */ s32 startupTime; + /* 0x28 */ f32 rotZ; + /* 0x2C */ f32 rotVelZ; + /* 0x30 */ f32 rotY; + /* 0x34 */ f32 scale; + /* 0x38 */ Vec3f pos; + /* 0x44 */ s32 holdTime; + /* 0x48 */ f32 alpha; // unused +} BonkData; // size = 0x4C // all keyed by number of lines in the message (1 or 2) s16 BattleMessage_BoxSizesY[] = { 28, 40 }; s16 BattleMessage_TextOffsetsY[] = { 0, -2 }; s16 BattleMessage_BoxOffsetsY[] = { 0, -12 }; -//TODO Vec3f[] -f32 D_802835DC[] = { - 0.0f, 4.5f, 0.0f, - 1.0f, 4.0f, 0.0f, - 2.0f, 3.0f, 0.0f, - 3.0f, 2.0f, 0.0f, - 3.5f, 1.0f, 0.0f, - 4.0f, 0.0f, 0.0f, - 4.5f, 0.0f, 0.0f, - 5.0f, 0.0f, 0.0f, - 4.5f, 0.0f, 0.0f, - 4.0f, 0.0f, 0.0f, - 3.5f, -1.0f, 0.0f, - 3.0f, -2.0f, 0.0f, - 2.0f, -3.0f, 0.0f, - 1.0f, -4.0f, 0.0f, - 0.0f, -4.5f, 0.0f, +Vec3f BonkAnimAccel[] = { + { 0.0f, 4.5f, 0.0f }, + { 1.0f, 4.0f, 0.0f }, + { 2.0f, 3.0f, 0.0f }, + { 3.0f, 2.0f, 0.0f }, + { 3.5f, 1.0f, 0.0f }, + { 4.0f, 0.0f, 0.0f }, + { 4.5f, 0.0f, 0.0f }, + { 5.0f, 0.0f, 0.0f }, + { 4.5f, 0.0f, 0.0f }, + { 4.0f, 0.0f, 0.0f }, + { 3.5f, -1.0f, 0.0f }, + { 3.0f, -2.0f, 0.0f }, + { 2.0f, -3.0f, 0.0f }, + { 1.0f, -4.0f, 0.0f }, + { 0.0f, -4.5f, 0.0f }, }; -Vec3f D_80283690[] = { +Vec3f BonkAnimScale[] = { { 1.0f, 1.0f, 1.0f }, { 0.8f, 0.8f, 0.8f }, { 0.9f, 0.9f, 0.9f }, @@ -48,6 +61,8 @@ Vec3f D_80283690[] = { { 0.9f, 0.9f, 0.9f }, }; +extern EntityModelScript EMS_BonkIcon; + EntityModelScript* BonkModelScripts[] = { NULL, &EMS_BonkIcon, &EMS_BonkIcon, &EMS_BonkIcon, &EMS_BonkIcon, &EMS_BonkIcon, @@ -219,7 +234,7 @@ void btl_popup_messages_init(void) { for (i = 0; i < ARRAY_COUNT(popupMessages); i++) { PopupMessage* popup = &popupMessages[i]; popup->active = FALSE; - popup->message = NULL; + popup->data.bonk = NULL; } } @@ -228,9 +243,9 @@ void btl_popup_messages_delete(void) { for (i = 0; i < ARRAY_COUNT(popupMessages); i++) { PopupMessage* popup = &popupMessages[i]; - if (popup->message != NULL) { - heap_free(popup->message); - popup->message = NULL; + if (popup->data.bonk != NULL) { + heap_free(popup->data.bonk); + popup->data.bonk = NULL; } popup->active = FALSE; } @@ -284,126 +299,112 @@ PopupMessage* btl_create_popup(void) { } void free_popup(PopupMessage* popup) { - if (popup->message != NULL) { - heap_free(popup->message); - popup->message = NULL; + if (popup->data.bonk != NULL) { + heap_free(popup->data.bonk); + popup->data.bonk = NULL; } popup->active = FALSE; } -void show_immune_bonk(f32 x, f32 y, f32 z, s32 numStars, s32 arg4, s32 arg5) { +void show_immune_bonk(f32 x, f32 y, f32 z, s32 numStars, s32 startupTime, s32 animDir) { BattleStatus* battleStatus = &gBattleStatus; PopupMessage* popup; - Message* message; - EntityModelScript** modelScript; - f32 var_f20; + BonkData* bonkData; + f32 timescale; f32 baseScale; - f32* f1; - f32* f2; - f32* f3; - s32 arg5mod8; - s32 iMod8; + s32 bonkPosIdx; + b32 hasShortLifetime; s32 sign; - s32 cond; - s32 one; - s32 two; s32 i; - baseScale = 1.0f; - cond = FALSE; - var_f20 = 1.0f; + popup = btl_create_popup(); + if (popup == NULL) { + // unable to create popup + return; + } + if (numStars < 1) { numStars = 1; - cond = TRUE; baseScale = 0.4f; - var_f20 = 0.7f; + timescale = 0.7f; + hasShortLifetime = TRUE; + } else { + baseScale = 1.0f; + timescale = 1.0f; + hasShortLifetime = FALSE; } if (battleStatus->flags1 & (BS_FLAGS1_NICE_HIT | BS_FLAGS1_SUPER_HIT)) { baseScale *= 2.0; } - popup = btl_create_popup(); - if (popup != NULL) { + if (animDir < 0) { + sign = -1; + } else { sign = 1; - if (arg5 < 0) { - arg5 = -arg5; - sign = -1; - } + } - while (TRUE) { - if (arg5 > 5) { - arg5 -= 5; - } else { - break; - } + animDir = abs(animDir) % 5; + + battleStatus->unk_90 = 0; + popup->updateFunc = btl_bonk_update; + popup->renderWorldFunc = btl_bonk_render; + popup->unk_00 = FALSE; + popup->renderUIFunc = NULL; + popup->messageIndex = 1; + popup->active |= 0x10; + bonkData = popup->data.bonk = heap_malloc(numStars * sizeof(*popup->data.bonk)); + ASSERT (popup->data.bonk != NULL); + + for (i = 0; i < numStars; i++) { + bonkData->alive = TRUE; + bonkData->entityModelIndex = load_entity_model(BonkModelScripts[numStars]); + set_entity_model_flags(bonkData->entityModelIndex, ENTITY_MODEL_FLAG_HIDDEN); + bind_entity_model_setupGfx(bonkData->entityModelIndex, bonkData, btl_bonk_setup_gfx); + bonkData->pos.x = x; + bonkData->pos.y = y; + bonkData->pos.z = z; + bonkPosIdx = animDir % 8; + animDir++; + + bonkData->accel.x = BonkAnimAccel[bonkPosIdx].x * timescale * sign ; + bonkData->accel.y = BonkAnimAccel[bonkPosIdx].y * timescale; + bonkData->accel.z = BonkAnimAccel[bonkPosIdx].z * timescale; + bonkData->vel.x = 2.0 * bonkData->accel.x; + bonkData->vel.y = 2.0 * bonkData->accel.y; + bonkData->vel.z = 2.0 * bonkData->accel.z; + + bonkData->scale = BonkAnimScale[i % 8].x * baseScale; + bonkData->rotY = clamp_angle(180.0f - gCameras[CAM_BATTLE].curYaw); + bonkData->rotZ = 0; + bonkData->rotVelZ = sign * 107; + + bonkData->startupTime = startupTime; + bonkData->moveTime = 14; + bonkData->holdTime = 240; + if (hasShortLifetime) { + bonkData->holdTime = 10; } - battleStatus->unk_90 = 0; - popup->updateFunc = btl_bonk_update; - popup->renderWorldFunc = btl_bonk_render; - popup->unk_00 = FALSE; - popup->renderUIFunc = NULL; - popup->messageIndex = 1; - popup->active |= 0x10; - message = popup->message = heap_malloc(numStars * sizeof(*popup->message)); - ASSERT (popup->message != NULL); - - for (i = 0; i < numStars; i++, message++) { - modelScript = &BonkModelScripts[numStars]; - message->unk_00 = TRUE; - message->entityModelIndex = load_entity_model(*modelScript); - set_entity_model_flags(message->entityModelIndex, ENTITY_MODEL_FLAG_HIDDEN); - bind_entity_model_setupGfx(message->entityModelIndex, message, btl_bonk_setup_gfx); - message->pos.x = x; - message->pos.y = y; - message->pos.z = z; - arg5mod8 = arg5 % 8; - arg5++; - - one = 1; - two = 2; - - f1 = &D_802835DC[arg5mod8 * 3]; - f2 = &D_802835DC[arg5mod8 * 3 + one]; - f3 = &D_802835DC[arg5mod8 * 3 + two]; - message->vel.x = 2.0 * *f1 * sign * var_f20; - message->vel.y = 2.0 * *f2 * var_f20; - message->vel.z = 2.0 * *f3 * var_f20; - message->accel.x = *f1 * sign * var_f20; - message->accel.y = *f2 * var_f20; - message->accel.z = *f3 * var_f20; - - iMod8 = (i % 8); - message->scale = D_80283690[iMod8].x * baseScale; - message->rotZ = 0; - message->rotVelZ = sign * 107; - message->rotY = clamp_angle(180.0f - gCameras[CAM_BATTLE].curYaw); - message->appearTime = 14; - message->unk_24 = arg4; - message->deleteTime = 240; - if (cond) { - message->deleteTime = 10; - } - message->unk_48 = 255.0f; - } + bonkData->alpha = 255.0f; + bonkData++; } } void btl_bonk_update(void* data) { PopupMessage* popup = data; - Message* message = popup->message; - s32 found = FALSE; + BonkData* bonkData = popup->data.bonk; + s32 allDone = TRUE; s32 i; - for (i = 0; i < popup->messageIndex; i++, message++) { - if (message->unk_00) { - s32 modelIdx = message->entityModelIndex; + for (i = 0; i < popup->messageIndex; i++, bonkData++) { + if (bonkData->alive) { + s32 modelIdx = bonkData->entityModelIndex; - found = TRUE; - if (message->unk_24 != 0) { - message->unk_24--; - if (message->unk_24 == 0) { + allDone = FALSE; + if (bonkData->startupTime != 0) { + bonkData->startupTime--; + if (bonkData->startupTime == 0) { clear_entity_model_flags(modelIdx, ENTITY_MODEL_FLAG_HIDDEN); } exec_entity_model_commandlist(modelIdx); @@ -411,45 +412,45 @@ void btl_bonk_update(void* data) { } exec_entity_model_commandlist(modelIdx); - if (message->appearTime >= 0) { - message->pos.x += message->vel.x; - message->pos.y += message->vel.y; - message->pos.z += message->vel.z; + if (bonkData->moveTime >= 0) { + bonkData->pos.x += bonkData->vel.x; + bonkData->pos.y += bonkData->vel.y; + bonkData->pos.z += bonkData->vel.z; } - message->rotY = clamp_angle(180.0f - gCameras[CAM_BATTLE].curYaw); - message->rotZ += message->rotVelZ; - message->rotZ = clamp_angle(message->rotZ); - message->rotVelZ *= 0.8; - if (message->appearTime < 10) { - message->accel.x *= 0.5; - message->accel.y *= 0.5; - message->accel.z *= 0.5; - message->vel.x = message->accel.x; - message->vel.y = message->accel.y; - message->vel.z = message->accel.z; + bonkData->rotY = clamp_angle(180.0f - gCameras[CAM_BATTLE].curYaw); + bonkData->rotZ += bonkData->rotVelZ; + bonkData->rotZ = clamp_angle(bonkData->rotZ); + bonkData->rotVelZ *= 0.8; + if (bonkData->moveTime < 10) { + bonkData->accel.x *= 0.5; + bonkData->accel.y *= 0.5; + bonkData->accel.z *= 0.5; + bonkData->vel.x = bonkData->accel.x; + bonkData->vel.y = bonkData->accel.y; + bonkData->vel.z = bonkData->accel.z; } - message->appearTime--; - if (message->appearTime < 0) { - message->deleteTime--; - if (message->deleteTime < 0) { + bonkData->moveTime--; + if (bonkData->moveTime < 0) { + bonkData->holdTime--; + if (bonkData->holdTime < 0) { free_entity_model_by_index(modelIdx); - message->unk_00 = FALSE; + bonkData->alive = FALSE; } } } } - if (!found) { - heap_free(popup->message); - popup->message = NULL; + if (allDone) { + heap_free(popup->data.bonk); + popup->data.bonk = NULL; free_popup(popup); } } void btl_bonk_render(void* data) { PopupMessage* popup = data; - Message* message = popup->message; + BonkData* bonkData = popup->data.bonk; Matrix4f sp18; Matrix4f mtxRotX; Matrix4f mtxRotY; @@ -461,32 +462,30 @@ void btl_bonk_render(void* data) { Mtx sp218; s32 i; - for (i = 0; i < popup->messageIndex; i++, message++) { - if (message->unk_00) { - if (message->unk_24 != 0) { + for (i = 0; i < popup->messageIndex; i++, bonkData++) { + if (bonkData->alive) { + if (bonkData->startupTime != 0) { break; } else { - s32 modelIdx = message->entityModelIndex; - - guTranslateF(sp18, message->pos.x, message->pos.y, message->pos.z); + guTranslateF(sp18, bonkData->pos.x, bonkData->pos.y, bonkData->pos.z); guRotateF(mtxRotX, 0.0f, 1.0f, 0.0f, 0.0f); - guRotateF(mtxRotY, message->rotY, 0.0f, 1.0f, 0.0f); - guRotateF(mtxRotZ, message->rotZ, 0.0f, 0.0f, 1.0f); - guScaleF(mtxScale, message->scale, message->scale, message->scale); + guRotateF(mtxRotY, bonkData->rotY, 0.0f, 1.0f, 0.0f); + guRotateF(mtxRotZ, bonkData->rotZ, 0.0f, 0.0f, 1.0f); + guScaleF(mtxScale, bonkData->scale, bonkData->scale, bonkData->scale); guMtxCatF(mtxRotZ, mtxRotX, sp158); guMtxCatF(sp158, mtxRotY, sp118); guMtxCatF(mtxScale, sp118, sp158); guMtxCatF(sp158, sp18, sp198); guMtxF2L(sp198, &sp218); - draw_entity_model_A(modelIdx, &sp218); + draw_entity_model_A(bonkData->entityModelIndex, &sp218); } } } } void btl_bonk_setup_gfx(void* data) { - Message* message = data; - s32 alphaAmt = message->deleteTime; + BonkData* bonkData = data; + s32 alphaAmt = bonkData->holdTime; if (alphaAmt > 10) { alphaAmt = 10; @@ -501,14 +500,14 @@ void btl_bonk_cleanup(void) { PopupMessage* popup = &popupMessages[i]; if (popup->active != 0 && (popup->active & 0x10)) { - Message* message = popup->message; + BonkData* bonkData = popup->data.bonk; s32 j; - for (j = 0; j < popup->messageIndex; j++, message++) { - if (message->unk_00) { - message->unk_24 = 0; - message->appearTime = 1; - message->deleteTime = 20; + for (j = 0; j < popup->messageIndex; j++, bonkData++) { + if (bonkData->alive) { + bonkData->startupTime = 0; + bonkData->moveTime = 1; + bonkData->holdTime = 20; } } } @@ -520,11 +519,11 @@ API_CALLABLE(ShowImmuneBonk) { s32 x = evt_get_variable(script, *args++); s32 y = evt_get_variable(script, *args++); s32 z = evt_get_variable(script, *args++); - s32 arg4 = evt_get_variable(script, *args++); - s32 arg5 = evt_get_variable(script, *args++); + s32 numStars = evt_get_variable(script, *args++); + s32 startupTime = evt_get_variable(script, *args++); s32 arg6 = evt_get_variable(script, *args++); - show_immune_bonk(x, y, z, arg4, arg5, arg6); + show_immune_bonk(x, y, z, numStars, startupTime, arg6); return ApiStatus_DONE2; } @@ -546,7 +545,7 @@ void btl_show_battle_message(s32 messageIndex, s32 duration) { popup->duration = duration; popup->showMsgState = BTL_MSG_STATE_INIT; popup->needsInit = TRUE; - popup->message = NULL; + popup->data.bonk = NULL; BattlePopupMessageVar = 0; bPopupMessage = popup; ActionCommandTipVisible = FALSE; @@ -569,7 +568,7 @@ void btl_show_variable_battle_message(s32 messageIndex, s32 duration, s32 varVal popup->duration = duration; popup->showMsgState = BTL_MSG_STATE_INIT; popup->needsInit = TRUE; - popup->message = NULL; + popup->data.bonk = NULL; BattlePopupMessageVar = varValue; bPopupMessage = popup; ActionCommandTipVisible = FALSE; @@ -869,7 +868,7 @@ void btl_update_message_popup(void* data) { case BTL_MSG_STATE_ACTION_TIP_DELAY: if (gBattleStatus.flags1 & BS_FLAGS1_10000) { gBattleStatus.flags1 &= ~BS_FLAGS1_4000; - set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_SHOW_TRANSPARENT); + set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_SHOW_TRANSPARENT); popup->duration = 0; popup->showMsgState = BTL_MSG_STATE_ACTION_TIP_DISPOSE; break; @@ -878,7 +877,7 @@ void btl_update_message_popup(void* data) { if (!(gBattleStatus.flags1 & BS_FLAGS1_4000) && (actionCommandMode != ACTION_COMMAND_MODE_TUTORIAL) ) { - set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_SHOW_TRANSPARENT); + set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_SHOW_TRANSPARENT); switch (popup->messageIndex) { case BTL_MSG_ACTION_TIP_MASH_BUTTON: hud_element_set_script(HID_BattleMessage1, &HES_MashAButton); @@ -971,7 +970,7 @@ void btl_update_message_popup(void* data) { } } - gWindows[WINDOW_ID_BATTLE_POPUP].pos.y = BattleMessage_CurBoxPosY + BattleMessage_CurBoxOffsetY; + gWindows[WIN_BTL_POPUP].pos.y = BattleMessage_CurBoxPosY + BattleMessage_CurBoxOffsetY; if (popup->duration == -1) { break; @@ -1119,7 +1118,7 @@ void btl_update_message_popup(void* data) { break; } if (shouldDisposeWindow) { - set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_HIDE); bPopupMessage = NULL; free_popup(popup); } @@ -1518,8 +1517,8 @@ void btl_show_message_popup(void* data) { width = msgWidth; numLines = get_msg_lines(messageID) - 1; height = BattleMessage_BoxSizesY[numLines]; - set_window_properties(WINDOW_ID_BATTLE_POPUP, posX, posY, width, height, WINDOW_PRIORITY_0, btl_message_popup_draw_content, popup, -1); - set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_SHOW); + set_window_properties(WIN_BTL_POPUP, posX, posY, width, height, WINDOW_PRIORITY_0, btl_message_popup_draw_content, popup, -1); + set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_SHOW); } break; case BTL_MSG_HAMMER_DISABLED_1: @@ -1535,8 +1534,8 @@ void btl_show_message_popup(void* data) { posX = 160 - (msgWidth / 2); width = msgWidth; height = 40; - set_window_properties(WINDOW_ID_BATTLE_POPUP, posX, posY, width, height, WINDOW_PRIORITY_0, btl_message_popup_draw_content, popup, -1); - set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_SHOW); + set_window_properties(WIN_BTL_POPUP, posX, posY, width, height, WINDOW_PRIORITY_0, btl_message_popup_draw_content, popup, -1); + set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_SHOW); } break; case BTL_MSG_CHARGE_HAMMER: @@ -1560,8 +1559,8 @@ void btl_show_message_popup(void* data) { width = msgWidth; numLines = get_msg_lines(messageID) - 1; height = BattleMessage_BoxSizesY[numLines]; - set_window_properties(WINDOW_ID_BATTLE_POPUP, posX, posY, width, height, WINDOW_PRIORITY_0, btl_message_popup_draw_content, popup, -1); - set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_SHOW); + set_window_properties(WIN_BTL_POPUP, posX, posY, width, height, WINDOW_PRIORITY_0, btl_message_popup_draw_content, popup, -1); + set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_SHOW); } break; case BTL_MSG_CANT_MOVE: @@ -1576,8 +1575,8 @@ void btl_show_message_popup(void* data) { width = msgWidth; numLines = get_msg_lines(messageID) - 1; height = BattleMessage_BoxSizesY[numLines]; - set_window_properties(WINDOW_ID_BATTLE_POPUP, posX, posY, width, height, WINDOW_PRIORITY_0, btl_message_popup_draw_content, popup, -1); - set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_SHOW); + set_window_properties(WIN_BTL_POPUP, posX, posY, width, height, WINDOW_PRIORITY_0, btl_message_popup_draw_content, popup, -1); + set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_SHOW); } break; case BTL_MSG_ACTION_TIP_PRESS_BEFORE_LANDING: @@ -1620,11 +1619,11 @@ void btl_show_message_popup(void* data) { BattleMessage_CurBoxOffsetY = BattleMessage_BoxOffsetsY[numLines]; posY = BattleMessage_CurBoxPosY + BattleMessage_CurBoxOffsetY; - set_window_properties(WINDOW_ID_BATTLE_POPUP, posX, posY, width, height, WINDOW_PRIORITY_0, btl_message_popup_draw_content, popup, -1); + set_window_properties(WIN_BTL_POPUP, posX, posY, width, height, WINDOW_PRIORITY_0, btl_message_popup_draw_content, popup, -1); if (popup->messageIndex == BTL_MSG_ACTION_TIP_UNUSED_3) { - set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_SHOW); + set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_SHOW); } else { - set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_SHOW_DARKENED); + set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_SHOW_DARKENED); } } break; diff --git a/src/dx/versioning.c b/src/dx/versioning.c index 4e7fd4944a..6cd3147281 100644 --- a/src/dx/versioning.c +++ b/src/dx/versioning.c @@ -36,15 +36,12 @@ void fio_deserialize_state() { SaveData* saveData = &gCurrentSaveFile; if (saveData->modName[0] == '\0') { - // normally a mod should not be able to load a normal Paper Mario save - // however, if you would like your mod to support this, remove this PANIC - PANIC_MSG("Cannot load unmodded save"); + // handle loading vanilla saves here ver_deserialize_vanilla_save(saveData); } else if (strcmp(saveData->modName, DX_MOD_NAME) != 0) { - // always prevent loading data from other mods - char error[0x40] = "Cannot load save from: "; - strcat(error, saveData->modName); - PANIC_MSG(error); + // handle loading saves from other mods here + // by default, dx assumes other mod save data format is vanilla + ver_deserialize_vanilla_save(saveData); } else if (saveData->majorVersion != DX_MOD_VER_MAJOR) { // handle breaking changes between major versions here ver_deserialize_standard(saveData); @@ -510,11 +507,15 @@ void ver_deserialize_vanilla_save(SaveData* newSave) { memset(newSave, 0, sizeof(SaveData)); strcpy(newSave->magicString, oldSave.magicString); + memcpy(newSave->modName, oldSave.version, ARRAY_COUNT(oldSave.version)); // copy metadata newSave->saveSlot = oldSave.saveSlot; newSave->saveCount = oldSave.saveCount; - newSave->metadata = oldSave.metadata; + memcpy(newSave->summary.filename, oldSave.summary.filename, ARRAY_COUNT(newSave->summary.filename)); + newSave->summary.level = oldSave.summary.level; + newSave->summary.timePlayed = oldSave.summary.timePlayed; + newSave->summary.spiritsRescued = oldSave.summary.spiritsRescued; // copy world location newSave->areaID = oldSave.areaID; diff --git a/src/dx/versioning.h b/src/dx/versioning.h index c79817f2e7..f94b3cd06d 100644 --- a/src/dx/versioning.h +++ b/src/dx/versioning.h @@ -6,6 +6,25 @@ void fio_deserialize_state(); void fio_serialize_state(); +typedef struct SaveGlobals { + /* 0x00 */ char magicString[16]; /* "Mario Story 006" string */ + /* 0x10 */ s8 pad[32]; /* always zero */ + /* 0x30 */ s32 crc1; + /* 0x34 */ s32 crc2; + /* 0x38 */ s32 useMonoSound; + /* 0x3C */ u32 lastFileSelected; + /* 0x40 */ s8 reserved[64]; // unused +} SaveGlobals; // size = 0x80 + +typedef struct VanillaSaveFileSummary { + /* 0x00 */ s32 timePlayed; + /* 0x04 */ u8 spiritsRescued; + /* 0x05 */ unsigned char unk_05[1]; + /* 0x06 */ s8 level; + /* 0x07 */ char filename[8]; + /* 0x0F */ unsigned char unk_0F[9]; +} VanillaSaveFileSummary; // size = 0x18 + /// PartnerData struct from unmodified Paper Mario typedef struct VanillaPartnerData { /* 0x00 */ u8 enabled; @@ -26,14 +45,14 @@ typedef struct VanillaPlayerData { /* 0x008 */ s8 maxBP; /* 0x009 */ s8 level; /* 0x00A */ b8 hasActionCommands; - /* 0x00B */ char pad_00B; + /* 0x00B */ unsigned char pad_00B; /* 0x00C */ s16 coins; /* 0x00E */ s8 fortressKeyCount; /* 0x00F */ u8 starPieces; /* 0x010 */ s8 starPoints; /* 0x011 */ s8 unused_011; /* 0x012 */ s8 curPartner; - /* 0x013 */ char pad_013; + /* 0x013 */ unsigned char pad_013; /* 0x014 */ VanillaPartnerData partners[12]; /* 0x074 */ s16 keyItems[32]; /* 0x0B4 */ s16 badges[128]; @@ -43,13 +62,13 @@ typedef struct VanillaPlayerData { /* 0x288 */ s8 unused_288; /* 0x289 */ s8 merleeSpellType; /* 0x28A */ s8 merleeCastsLeft; - /* 0x28B */ char pad_28B; + /* 0x28B */ unsigned char pad_28B; /* 0x28C */ s16 merleeTurnCount; /* 0x28E */ s8 maxStarPower; - /* 0x28F */ char pad_28F; + /* 0x28F */ unsigned char pad_28F; /* 0x290 */ s16 starPower; /* 0x292 */ s8 starBeamLevel; - /* 0x293 */ char pad_293; + /* 0x293 */ unsigned char pad_293; /* 0x294 */ u16 actionCommandAttempts; /* 0x296 */ u16 actionCommandSuccesses; /* 0x298 */ u16 hitsTaken; @@ -66,7 +85,7 @@ typedef struct VanillaPlayerData { /* 0x2B0 */ s32 runningStepsTaken; /* 0x2B4 */ u32 totalCoinsEarned; /* 0x2B8 */ s16 idleFrameCounter; - /* 0x2BA */ char pad_2BA[2]; + /* 0x2BA */ unsigned char pad_2BA[2]; /* 0x2BC */ u32 frameCounter; /* 0x2C0 */ u16 quizzesAnswered; /* 0x2C2 */ u16 quizzesCorrect; @@ -81,7 +100,7 @@ typedef struct VanillaPlayerData { /* 0x336 */ u16 smashGamePlays; /* 0x338 */ u32 smashGameTotal; /* 0x33C */ u16 smashGameRecord; - /* 0x340 */ char pad_33E[0xEA]; + /* 0x340 */ unsigned char pad_33E[0xEA]; } VanillaPlayerData; // size = 0x428 /// SaveData struct from unmodified Paper Mario @@ -96,7 +115,7 @@ typedef struct VanillaSaveData { /* 0x0468 */ s16 areaID; /* 0x046A */ s16 mapID; /* 0x046C */ s16 entryID; - /* 0x046E */ char unk_46E[2]; + /* 0x046E */ unsigned char unk_46E[2]; /* 0x0470 */ s32 enemyDefeatFlags[60][12]; /* 0x0FB0 */ s32 globalFlags[64]; /* 0x10B0 */ s8 globalBytes[512]; @@ -106,10 +125,59 @@ typedef struct VanillaSaveData { /* 0x12E0 */ b8 debugUnused1; /* 0x12E0 */ b8 debugUnused2; /* 0x12E0 */ b8 musicEnabled; - /* 0x12E4 */ char unk_12E4[0x2]; + /* 0x12E4 */ unsigned char unk_12E4[0x2]; /* 0x12E6 */ Vec3s savePos; - /* 0x12EC */ FileDisplayData metadata; - /* 0x1304 */ char unk_1304[0x7C]; + /* 0x12EC */ VanillaSaveFileSummary summary; + /* 0x1304 */ unsigned char unk_1304[0x7C]; } VanillaSaveData; // size = 0x1380 +typedef struct SaveFileSummary { + /* 0x00 */ s32 timePlayed; + /* 0x04 */ u8 spiritsRescued; + /* 0x05 */ unsigned char unused_05[1]; + /* 0x06 */ s8 level; + /* 0x07 */ char filename[8]; + /* 0x0F */ unsigned char unused_0F[9]; +} SaveFileSummary; // size = 0x18 + +typedef struct SaveData { + /* 0x0000 */ char magicString[16]; /* "Mario Story 006" string */ + /* 0x0010 */ char modName[28]; /* always non-null for DX saves */ + /* 0x002C */ s8 majorVersion; + /* 0x002D */ s8 minorVersion; + /* 0x002E */ s8 patchVersion; + /* 0x002F */ char reserved; + /* 0x0030 */ s32 crc1; + /* 0x0034 */ s32 crc2; + /* 0x0038 */ s32 saveSlot; + /* 0x003C */ s32 saveCount; + /* 0x0040 */ PlayerData player; + /* 0x0468 */ s16 areaID; + /* 0x046A */ s16 mapID; + /* 0x046C */ s16 entryID; + /* 0x046E */ unsigned char unk_46E[2]; + /* 0x0470 */ s32 enemyDefeatFlags[60][12]; + /* 0x0FB0 */ s32 globalFlags[64]; + /* 0x10B0 */ s8 globalBytes[512]; + /* 0x12B0 */ s32 areaFlags[8]; + /* 0x12D0 */ s8 areaBytes[16]; + /* 0x12E0 */ s8 debugEnemyContact; + /* 0x12E0 */ b8 debugUnused1; + /* 0x12E0 */ b8 debugUnused2; + /* 0x12E0 */ b8 musicEnabled; + /* 0x12E4 */ unsigned char unk_12E4[0x2]; + /* 0x12E6 */ Vec3s savePos; + /* 0x12EC */ SaveFileSummary summary; + /* 0x1304 */ unsigned char unk_1304[0x7C]; +} SaveData; // size = 0x1380 + +extern SaveData gCurrentSaveFile; + +typedef struct SaveSlotMetadata { + /* 0x00 */ char modName[28]; /* always non-null for DX saves */ + /* 0x29 */ b8 hasData; + /* 0x2A */ b8 validData; + /* 0x2B */ unsigned char pad[5]; +} SaveSlotMetadata; // size = 0x18 + #endif diff --git a/src/filemenu/filemenu_common.c b/src/filemenu/filemenu_common.c index b608ed1379..d48b0ab01e 100644 --- a/src/filemenu/filemenu_common.c +++ b/src/filemenu/filemenu_common.c @@ -4,6 +4,7 @@ #include "fio.h" #include "ld_addrs.h" #include "game_modes.h" +#include "dx/config.h" extern HudScript HES_AnimatedCursorHand; @@ -102,11 +103,15 @@ Vp D_80249D60 = { .vtrans = { 640, 480, 511, 0}, } }; -f32 D_80249D70[15] = { 7.0f, 12.5f, 13.0f, 14.5f, 14.0f, 13.0f, 11.5f, 9.5f, 7.5f, 5.5f, 3.5f, 2.0f, 1.0f, 0.5f, 0.0f }; +f32 CopyArrowAnimOffsets[] = { + 7.0f, 12.5f, 13.0f, 14.5f, 14.0f, + 13.0f, 11.5f, 9.5f, 7.5f, 5.5f, + 3.5f, 2.0f, 1.0f, 0.5f, 0.0f +}; -MenuWindowBP filemenu_common_windowBPs[3] = { +MenuWindowBP filemenu_common_windowBPs[] = { { - .windowID = WINDOW_ID_FILEMENU_MAIN, + .windowID = WIN_FILES_MAIN, .pos = { .x = 16, .y = 24, @@ -122,7 +127,7 @@ MenuWindowBP filemenu_common_windowBPs[3] = { .style = { .customStyle = &filemenu_windowStyles[0] }, }, { - .windowID = WINDOW_ID_FILEMENU_COPYARROW, + .windowID = WIN_FILES_COPYARROW, .pos = { .x = 0, .y = 0, @@ -132,13 +137,13 @@ MenuWindowBP filemenu_common_windowBPs[3] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = filemenu_draw_contents_copy_arrow, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_MAIN, + .parentID = WIN_FILES_MAIN, .fpUpdate = { WINDOW_UPDATE_SHOW } , .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[1] }, }, { - .windowID = WINDOW_ID_FILEMENU_CURSOR, + .windowID = WIN_FILES_CURSOR, .pos = { .x = 0, .y = 0, @@ -159,12 +164,12 @@ extern Gfx filemenu_dl_copyarrow[]; extern Gfx D_8024B6F0[]; extern Gfx D_8024B708[]; -BSS s32 filemenu_iterFileIdx; +BSS s32 filemenu_CopyToFileIdx; BSS s32 filemenu_pressedButtons; BSS s32 filemenu_cursorHudElem; BSS s32 filemenu_heldButtons; BSS s8 filemenu_filename_pos; -BSS s32 filemenu_loadedFileIdx; +BSS s32 filemenu_CopyFromFileIdx; BSS s8 filemenu_currentMenu; BSS s32 filemenu_8024C09C; BSS s32 filemenu_cursorHudElemID[1]; @@ -195,7 +200,7 @@ void filemenu_draw_rect(s32 ulx, s32 uly, s32 lrx, s32 lry, s32 tileIdx, s32 uls void filemenu_set_selected(MenuPanel* menu, s32 col, s32 row) { menu->col = col; menu->row = row; - menu->selected = menu->gridData[(menu->page * menu->numCols * menu->numRows) + + menu->selected = menu->gridData[(menu->state * menu->numCols * menu->numRows) + (menu->numCols * menu->row) + menu->col]; } @@ -213,11 +218,11 @@ void filemenu_set_cursor_goal_pos(s32 windowID, s32 posX, s32 posY) { if (D_80249BB0) { s32 i; - for (i = WINDOW_ID_FILEMENU_MAIN; i < ARRAY_COUNT(gWindows); i++) { + for (i = WIN_FILES_MAIN; i < ARRAY_COUNT(gWindows); i++) { Window* window = &gWindows[i]; s8 parent = window->parent; - if ((parent == -1 || parent == WINDOW_ID_FILEMENU_MAIN) && (window->flags & WINDOW_FLAG_INITIAL_ANIMATION)) { + if ((parent == WIN_NONE || parent == WIN_FILES_MAIN) && (window->flags & WINDOW_FLAG_INITIAL_ANIMATION)) { break; } } @@ -230,7 +235,7 @@ void filemenu_set_cursor_goal_pos(s32 windowID, s32 posX, s32 posY) { filemenu_cursor_targetY = posY; filemenu_cursor_posY = posY; } else if (!(window->flags & WINDOW_FLAG_INITIAL_ANIMATION) && - (window->parent == -1 || !(gWindows[window->parent].flags & WINDOW_FLAG_INITIAL_ANIMATION))) { + (window->parent == WIN_NONE || !(gWindows[window->parent].flags & WINDOW_FLAG_INITIAL_ANIMATION))) { filemenu_cursor_targetX = posX; filemenu_cursor_targetY = posY; } @@ -268,11 +273,11 @@ void filemenu_update_cursor(void) { } } - for (i = WINDOW_ID_FILEMENU_MAIN; i < ARRAY_COUNT(gWindows); i++) { + for (i = WIN_FILES_MAIN; i < ARRAY_COUNT(gWindows); i++) { Window* window = &gWindows[i]; s8 parent = window->parent; - if ((parent == -1 || parent == WINDOW_ID_FILEMENU_MAIN) && (window->flags & WINDOW_FLAG_INITIAL_ANIMATION)) { + if ((parent == WIN_NONE || parent == WIN_FILES_MAIN) && (window->flags & WINDOW_FLAG_INITIAL_ANIMATION)) { break; } } @@ -304,12 +309,11 @@ void filemenu_update_cursor(void) { } void filemenu_update(void) { - MenuPanel* menu = filemenu_menus[filemenu_currentMenu]; - MenuPanel** menuIt; + MenuPanel* menu; s32 i; - for (i = WINDOW_ID_FILEMENU_MAIN; i < ARRAY_COUNT(gWindows); i++) { - if ((gWindows[i].parent == -1 || gWindows[i].parent == WINDOW_ID_FILEMENU_MAIN) && + for (i = WIN_FILES_MAIN; i < ARRAY_COUNT(gWindows); i++) { + if ((gWindows[i].parent == WIN_NONE || gWindows[i].parent == WIN_FILES_MAIN) && (gWindows[i].flags & WINDOW_FLAG_INITIAL_ANIMATION)) { break; @@ -324,6 +328,7 @@ void filemenu_update(void) { filemenu_pressedButtons = 0; } + // B overrides A if (filemenu_pressedButtons & BUTTON_B) { filemenu_pressedButtons &= ~BUTTON_A; } @@ -331,16 +336,17 @@ void filemenu_update(void) { filemenu_heldButtons &= ~BUTTON_A; } + // only process inputs for the current menu + menu = filemenu_menus[filemenu_currentMenu]; if (menu->initialized) { if (menu->fpHandleInput != NULL) { menu->fpHandleInput(menu); } } - // TODO clean up bad match - menuIt = filemenu_menus; - for (i = 0; i < ARRAY_COUNT(filemenu_menus); i++, menuIt++) { - menu = *menuIt; + // update all menus + for (i = 0; i < ARRAY_COUNT(filemenu_menus); i++) { + menu = filemenu_menus[i]; if (menu->initialized && menu->fpUpdate != NULL) { menu->fpUpdate(menu); } @@ -795,16 +801,16 @@ void filemenu_update_pal_80247f40( s32 var_v1; switch (windowIndex) { - case WINDOW_ID_FILEMENU_FILE0_INFO: + case WIN_FILES_SLOT0_BODY: var_a3 = 0; break; - case WINDOW_ID_FILEMENU_FILE1_INFO: + case WIN_FILES_SLOT1_BODY: var_a3 = 1; break; - case WINDOW_ID_FILEMENU_FILE2_INFO: + case WIN_FILES_SLOT2_BODY: var_a3 = 2; break; - case WINDOW_ID_FILEMENU_FILE3_INFO: + case WIN_FILES_SLOT3_BODY: var_a3 = 3; break; } @@ -842,16 +848,16 @@ void filemenu_selectlanguage_80248018( s32 var_v1; switch (windowIndex) { - case WINDOW_ID_FILEMENU_FILE0_INFO: + case WIN_FILES_SLOT0_BODY: var_a3 = 0; break; - case WINDOW_ID_FILEMENU_FILE1_INFO: + case WIN_FILES_SLOT1_BODY: var_a3 = 1; break; - case WINDOW_ID_FILEMENU_FILE2_INFO: + case WIN_FILES_SLOT2_BODY: var_a3 = 2; break; - case WINDOW_ID_FILEMENU_FILE3_INFO: + case WIN_FILES_SLOT3_BODY: var_a3 = 3; break; } @@ -894,130 +900,137 @@ void filemenu_draw_cursor(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 } } -#if VERSION_PAL -#define PAGE_4 (3) -#else -#define PAGE_4 (4) -#endif - void filemenu_draw_contents_copy_arrow(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) { - Matrix4f sp20, sp60; - MenuPanel* menu0 = filemenu_menus[0]; + Matrix4f transformMtx, tempMtx; f32 startX, startZ; f32 endX, endZ; - f32 temp_f28; - - if (menu0->page == PAGE_4 && menu0->selected < 4) { - if (menu0->selected != filemenu_loadedFileIdx && filemenu_currentMenu != 2) { - switch (filemenu_loadedFileIdx) { - case 0: - startX = 130.0f; - startZ = 90.0f; - break; - case 1: - startX = 190.0f; - startZ = 90.0f; - break; - case 2: - startX = 130.0f; - startZ = 150.0f; - break; - default: - startX = 190.0f; - startZ = 150.0f; - break; - } + f32 rotAngle; - switch (filemenu_menus[0]->selected) { - case 0: - endX = 130.0f; - endZ = 90.0f; - break; - case 1: - endX = 190.0f; - endZ = 90.0f; - break; - case 2: - endX = 130.0f; - endZ = 150.0f; - break; - default: - endX = 190.0f; - endZ = 150.0f; - break; - } + if (filemenu_menus[FILE_MENU_MAIN]->state != FM_MAIN_SELECT_COPY_TO) { + return; + } - temp_f28 = -atan2(startX, startZ, endX, endZ) - 90.0f; - - gSPViewport(gMainGfxPos++, &D_80249D60); - - guOrthoF(sp20, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, -100.0f, 100.0f, 1.0f); - guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); - - gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); - gSPDisplayList(gMainGfxPos++, filemenu_dl_copyarrow); - gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, 128); - gDPSetEnvColor(gMainGfxPos++, 0, 0, 0, 0); - - guTranslateF(sp20, startX + 4.0f, startZ + 4.0f, 0.0f); - guScaleF(sp60, -1.0f, 1.0f, 1.0f); - guMtxCatF(sp60, sp20, sp20); - guRotateF(sp60, temp_f28, 0.0f, 0.0f, 1.0f); - guMtxCatF(sp60, sp20, sp20); - guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); - - gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], - G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gMainGfxPos++, D_8024B6F0); - gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW); - - guTranslateF(sp60, D_80249D70[gGameStatusPtr->frameCounter % ARRAY_COUNT(D_80249D70)], 0.0f, 0.0f); - guMtxCatF(sp60, sp20, sp20); - guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); - - gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], - G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetTileSize(gMainGfxPos++, 1, (gGameStatusPtr->frameCounter * 8) % 512, 0, - ((gGameStatusPtr->frameCounter * 8) % 512) + 60, 0); - gSPDisplayList(gMainGfxPos++, D_8024B708); - gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW); - gDPSetPrimColor(gMainGfxPos++, 0, 0, 230, 230, 230, 255); - gDPSetEnvColor(gMainGfxPos++, 232, 40, 160, 0); - - guTranslateF(sp20, startX, startZ, 0.0f); - guScaleF(sp60, -1.0f, 1.0f, 1.0f); - guMtxCatF(sp60, sp20, sp20); - guRotateF(sp60, temp_f28, 0.0f, 0.0f, 1.0f); - guMtxCatF(sp60, sp20, sp20); - guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); - - gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], - G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gMainGfxPos++, D_8024B6F0); - gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW); - - guTranslateF(sp60, D_80249D70[(gGameStatusPtr->frameCounter % ARRAY_COUNT(D_80249D70))], 0.0f, 0.0f); - guMtxCatF(sp60, sp20, sp20); - guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); - - gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], - G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetTileSize(gMainGfxPos++, 1, (gGameStatusPtr->frameCounter * 8) % 512, 0, - ((gGameStatusPtr->frameCounter * 8) % 512) + 60, 0); - gSPDisplayList(gMainGfxPos++, D_8024B708); - gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW); - } + // check for invalid selection + if (filemenu_menus[FILE_MENU_MAIN]->selected >= 4) { + return; + } + + // check if different files are selected + if (filemenu_menus[FILE_MENU_MAIN]->selected == filemenu_CopyFromFileIdx) { + return; + } + + // do not show while message menu is showing + if (filemenu_currentMenu == FILE_MENU_MESSAGE) { + return; + } + + switch (filemenu_CopyFromFileIdx) { + case 0: + startX = 130.0f; + startZ = 90.0f; + break; + case 1: + startX = 190.0f; + startZ = 90.0f; + break; + case 2: + startX = 130.0f; + startZ = 150.0f; + break; + default: + startX = 190.0f; + startZ = 150.0f; + break; } + + switch (filemenu_menus[FILE_MENU_MAIN]->selected) { + case 0: + endX = 130.0f; + endZ = 90.0f; + break; + case 1: + endX = 190.0f; + endZ = 90.0f; + break; + case 2: + endX = 130.0f; + endZ = 150.0f; + break; + default: + endX = 190.0f; + endZ = 150.0f; + break; + } + + rotAngle = -atan2(startX, startZ, endX, endZ) - 90.0f; + + gSPViewport(gMainGfxPos++, &D_80249D60); + + guOrthoF(transformMtx, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, 0.0f, -100.0f, 100.0f, 1.0f); + guMtxF2L(transformMtx, &gDisplayContext->matrixStack[gMatrixListPos]); + + gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPDisplayList(gMainGfxPos++, filemenu_dl_copyarrow); + gDPSetPrimColor(gMainGfxPos++, 0, 0, 0, 0, 0, 128); + gDPSetEnvColor(gMainGfxPos++, 0, 0, 0, 0); + + guTranslateF(transformMtx, startX + 4.0f, startZ + 4.0f, 0.0f); + guScaleF(tempMtx, -1.0f, 1.0f, 1.0f); + guMtxCatF(tempMtx, transformMtx, transformMtx); + guRotateF(tempMtx, rotAngle, 0.0f, 0.0f, 1.0f); + guMtxCatF(tempMtx, transformMtx, transformMtx); + guMtxF2L(transformMtx, &gDisplayContext->matrixStack[gMatrixListPos]); + + gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], + G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(gMainGfxPos++, D_8024B6F0); + gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW); + + guTranslateF(tempMtx, CopyArrowAnimOffsets[gGameStatusPtr->frameCounter % ARRAY_COUNT(CopyArrowAnimOffsets)], 0.0f, 0.0f); + guMtxCatF(tempMtx, transformMtx, transformMtx); + guMtxF2L(transformMtx, &gDisplayContext->matrixStack[gMatrixListPos]); + + gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], + G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetTileSize(gMainGfxPos++, 1, (gGameStatusPtr->frameCounter * 8) % 512, 0, + ((gGameStatusPtr->frameCounter * 8) % 512) + 60, 0); + gSPDisplayList(gMainGfxPos++, D_8024B708); + gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW); + gDPSetPrimColor(gMainGfxPos++, 0, 0, 230, 230, 230, 255); + gDPSetEnvColor(gMainGfxPos++, 232, 40, 160, 0); + + guTranslateF(transformMtx, startX, startZ, 0.0f); + guScaleF(tempMtx, -1.0f, 1.0f, 1.0f); + guMtxCatF(tempMtx, transformMtx, transformMtx); + guRotateF(tempMtx, rotAngle, 0.0f, 0.0f, 1.0f); + guMtxCatF(tempMtx, transformMtx, transformMtx); + guMtxF2L(transformMtx, &gDisplayContext->matrixStack[gMatrixListPos]); + + gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], + G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(gMainGfxPos++, D_8024B6F0); + gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW); + + guTranslateF(tempMtx, CopyArrowAnimOffsets[(gGameStatusPtr->frameCounter % ARRAY_COUNT(CopyArrowAnimOffsets))], 0.0f, 0.0f); + guMtxCatF(tempMtx, transformMtx, transformMtx); + guMtxF2L(transformMtx, &gDisplayContext->matrixStack[gMatrixListPos]); + + gSPMatrix(gMainGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], + G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetTileSize(gMainGfxPos++, 1, (gGameStatusPtr->frameCounter * 8) % 512, 0, + ((gGameStatusPtr->frameCounter * 8) % 512) + 60, 0); + gSPDisplayList(gMainGfxPos++, D_8024B708); + gSPPopMatrix(gMainGfxPos++, G_MTX_MODELVIEW); } void func_PAL_8002B574(void); // TODO identify // TODO bad match, look into void filemenu_init(s32 arg0) { - MenuPanel** panelIt; MenuPanel* menu; s32 i; @@ -1036,8 +1049,8 @@ void filemenu_init(s32 arg0) { #if VERSION_PAL if (arg0 != 2) { - filemenu_currentMenu = 0; - menu = filemenu_menus[0]; + filemenu_currentMenu = FILE_MENU_MAIN; + menu = filemenu_menus[FILE_MENU_MAIN]; menu->page = filemenu_currentMenu; func_PAL_8002B574(); @@ -1057,10 +1070,10 @@ void filemenu_init(s32 arg0) { (*panelIt)->fpInit((*panelIt)); } } - update_window_hierarchy(WINDOW_ID_PAUSE_DECRIPTION, 64); + update_window_hierarchy(WIN_PAUSE_DECRIPTION, 64); } else { - filemenu_currentMenu = 4; - filemenu_set_selected(filemenu_menus[4], 0, gCurrentLanguage); + filemenu_currentMenu = FILE_MENU_LANGUAGES; + filemenu_set_selected(filemenu_menus[FILE_MENU_LANGUAGES], 0, gCurrentLanguage); panelIt = filemenu_menus; for (i = 0; i < ARRAY_COUNT(filemenu_menus); i++, panelIt++) { @@ -1070,29 +1083,33 @@ void filemenu_init(s32 arg0) { } } } - update_window_hierarchy(WINDOW_ID_PAUSE_DECRIPTION, 64); + update_window_hierarchy(WIN_PAUSE_DECRIPTION, 64); } #else - menu = filemenu_menus[0]; - filemenu_currentMenu = 0; + filemenu_currentMenu = FILE_MENU_MAIN; + menu = filemenu_menus[FILE_MENU_MAIN]; if (arg0 == 0) { - menu->page = 0; + menu->state = FM_MAIN_SELECT_FILE; } else { - menu->page = 2; + menu->state = FM_MAIN_SELECT_LANGUAGE; } - if (menu->page == 0) { + if (menu->state == FM_MAIN_SELECT_FILE) { for (i = 0; i < ARRAY_COUNT(filemenu_menus); i++) { - if (!fio_load_game(i)) { - gSaveSlotHasData[i] = FALSE; + if (fio_load_game(i)) { + gSaveSlotSummary[i] = gCurrentSaveFile.summary; + gSaveSlotMetadata[i].hasData = TRUE; + gSaveSlotMetadata[i].validData = strcmp(gCurrentSaveFile.modName, DX_MOD_NAME) == 0; + memcpy(gSaveSlotMetadata[i].modName, gCurrentSaveFile.modName, ARRAY_COUNT(gSaveSlotMetadata[i].modName)); } else { - gFilesDisplayData[i] = gCurrentSaveFile.metadata; - gSaveSlotHasData[i] = TRUE; + gSaveSlotMetadata[i].hasData = FALSE; + gSaveSlotMetadata[i].validData = FALSE; + memset(gSaveSlotMetadata[i].modName, ARRAY_COUNT(gSaveSlotMetadata[i].modName), 0); } } - if (menu->page == 0) { + if (menu->state == FM_MAIN_SELECT_FILE) { // always the case? fio_load_globals(); if (gSaveGlobals.lastFileSelected >= 4) { gSaveGlobals.lastFileSelected = 0; @@ -1103,47 +1120,49 @@ void filemenu_init(s32 arg0) { filemenu_set_selected(menu, (gGameStatusPtr->saveSlot & 1) * 2, gGameStatusPtr->saveSlot >> 1); - panelIt = filemenu_menus; - for (i = 0; i < ARRAY_COUNT(filemenu_menus); i++, panelIt++) { - if ((*panelIt)->fpInit != NULL) { - (*panelIt)->fpInit((*panelIt)); + for (i = 0; i < ARRAY_COUNT(filemenu_menus); i++) { + menu = filemenu_menus[i]; + if (menu->fpInit != NULL) { + menu->fpInit(menu); } } - update_window_hierarchy(WINDOW_ID_PAUSE_DECRIPTION, 64); + update_window_hierarchy(WIN_PAUSE_DECRIPTION, 64); #endif } -// TODO bad match, look into void filemenu_cleanup(void) { - MenuPanel** panelIt; + MenuPanel* menu; s32 i; for (i = 0; i < ARRAY_COUNT(filemenu_cursorHudElemID); i++) { hud_element_free(filemenu_cursorHudElemID[i]); } - panelIt = filemenu_menus; - for (i = 0; i < ARRAY_COUNT(filemenu_menus); i++, panelIt++) { - if ((*panelIt)->initialized) { - if ((*panelIt)->fpCleanup != NULL) { - (*panelIt)->fpCleanup(*panelIt); + for (i = 0; i < ARRAY_COUNT(filemenu_menus); i++) { + menu = filemenu_menus[i]; + if (menu->initialized) { + if (menu->fpCleanup != NULL) { + menu->fpCleanup(menu); } } } - for (i = WINDOW_ID_FILEMENU_MAIN; i < ARRAY_COUNT(gWindows); i++) { + for (i = WIN_FILES_MAIN; i < ARRAY_COUNT(gWindows); i++) { set_window_update(i, WINDOW_UPDATE_HIDE); } - set_window_update(WINDOW_ID_PAUSE_TUTORIAL, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_PAUSE_DECRIPTION, WINDOW_UPDATE_HIDE); + set_window_update(WIN_PAUSE_TUTORIAL, WINDOW_UPDATE_HIDE); + set_window_update(WIN_PAUSE_DECRIPTION, WINDOW_UPDATE_HIDE); func_80244BC4(); } s32 func_80244BC4() { - if (filemenu_menus[0]->page == 0 && filemenu_currentMenu == 1 && filemenu_menus[1]->selected == 0) { + if (filemenu_menus[FILE_MENU_MAIN]->state == FM_MAIN_SELECT_FILE + && filemenu_currentMenu == FILE_MENU_CONFIRM + && filemenu_menus[FILE_MENU_CONFIRM]->selected == 0) + { return 2; - } else if (filemenu_menus[0]->page == 0 && filemenu_menus[0]->selected < 4) { + } else if (filemenu_menus[FILE_MENU_MAIN]->state == FM_MAIN_SELECT_FILE && filemenu_menus[FILE_MENU_MAIN]->selected < 4) { return 1; } else { return 0; diff --git a/src/filemenu/filemenu_createfile.c b/src/filemenu/filemenu_createfile.c index 68c4a395cc..95ca0815ed 100644 --- a/src/filemenu/filemenu_createfile.c +++ b/src/filemenu/filemenu_createfile.c @@ -30,7 +30,7 @@ extern u8 D_filemenu_80250960[]; MenuWindowBP filemenu_createfile_windowBPs[] = { { - .windowID = WINDOW_ID_FILEMENU_CREATEFILE_HEADER, + .windowID = WIN_FILES_INPUT_FIELD, .unk_01 = 0, .pos = { .x = 68, .y = WINDOW_1_Y }, .width = 164, @@ -38,13 +38,13 @@ MenuWindowBP filemenu_createfile_windowBPs[] = { .priority = WINDOW_PRIORITY_64, .fpDrawContents = &filemenu_draw_contents_file_create_header, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_MAIN, + .parentID = WIN_FILES_MAIN, .fpUpdate = { WINDOW_UPDATE_HIDE }, .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[21] } }, { - .windowID = WINDOW_ID_FILEMENU_KEYBOARD, + .windowID = WIN_FILES_INPUT_KEYBOARD, .unk_01 = 0, .pos = { .x = 12, .y = WINDOW_2_Y }, .width = 262, @@ -52,7 +52,7 @@ MenuWindowBP filemenu_createfile_windowBPs[] = { .priority = WINDOW_PRIORITY_64, .fpDrawContents = &filemenu_draw_contents_choose_name, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_MAIN, + .parentID = WIN_FILES_MAIN, .fpUpdate = { WINDOW_UPDATE_HIDE }, .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[22] } @@ -64,7 +64,7 @@ MenuPanel filemenu_createfile_menuBP = { .col = 0, .row = 0, .selected = 0, - .page = 0, + .state = 0, .numCols = 13, .numRows = ROWS, .numPages = 0, @@ -118,7 +118,7 @@ void filemenu_draw_contents_file_create_header( } } - if (filemenu_currentMenu == 3) { + if (filemenu_currentMenu == FILE_MENU_INPUT_NAME) { if (filemenu_filename_pos == 8) { xOffset = temp_s2 + 86; } else { @@ -132,7 +132,6 @@ void filemenu_draw_contents_file_create_header( s32 xOffset; s32 yOffset; s32 i; - s32 tempAmt; filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_ENTER_A_FILE_NAME), baseX + 10, baseY + 6, 255, 0, 0); filemenu_draw_file_name(filemenu_filename, 8, baseX + 36, baseY + 22, 255, 0, 0, 11); @@ -147,11 +146,10 @@ void filemenu_draw_contents_file_create_header( } } - tempAmt = 8; - if (filemenu_currentMenu == 3) { + if (filemenu_currentMenu == FILE_MENU_INPUT_NAME) { s32 phi_v0 = 122; - if (filemenu_filename_pos != tempAmt) { + if (filemenu_filename_pos != 8) { phi_v0 = (filemenu_filename_pos * 11) + 45; } hud_element_set_render_pos(filemenu_createfile_hudElems[0], baseX + phi_v0, baseY + 45); @@ -166,12 +164,13 @@ INCLUDE_ASM(void, "filemenu/filemenu_createfile", filemenu_draw_contents_choose_ s32 msg_get_print_char_width(s32 character, s32 charset, s32 variation, f32 msgScale, s32 overrideCharWidth, u8 flags); #if VERSION_PAL -#define FILEMENU_ROW_AMT (15) -#define FILEMENU_C9_OFFSET (16) +#define KEYBOARD_ROW_HEIGHT 15 +#define FILEMENU_C9_OFFSET 16 #else -#define FILEMENU_ROW_AMT (17) -#define FILEMENU_C9_OFFSET (5) +#define KEYBOARD_ROW_HEIGHT 17 +#define FILEMENU_C9_OFFSET 5 #endif +#define KEYBOARD_COL_WIDTH 19 void filemenu_draw_contents_choose_name( MenuPanel* menu, @@ -190,12 +189,12 @@ void filemenu_draw_contents_choose_name( s32 flags; s32 color; s32 xNudge; - Window* window = &gWindows[WINDOW_ID_FILEMENU_KEYBOARD]; + Window* window = &gWindows[WIN_FILES_INPUT_KEYBOARD]; if ((window->flags & WINDOW_FLAG_INITIAL_ANIMATION) && window->fpUpdate.func == filemenu_update_change_layout) { changeLayoutOffset = window->updateCounter * 2; - currentPage = menu->page; - previousPage = menu->page != 1; + currentPage = menu->state; + previousPage = menu->state != 1; if (changeLayoutOffset > 16) { changeLayoutOffset = 16; } @@ -221,7 +220,7 @@ void filemenu_draw_contents_choose_name( for (col = 0; col < menu->numCols; col++) { c = menu->gridData[page * menu->numCols * menu->numRows + menu->numCols * row + col]; - if (c != 0xF7) { + if (c != MSG_CHAR_MENU_SPACE) { if (col == menu->col && row == menu->row) { flags = 8; color = 0; @@ -229,30 +228,30 @@ void filemenu_draw_contents_choose_name( flags = 0; color = 10; } - xOffset = 19 * col + 12; - yOffset = FILEMENU_ROW_AMT * row + 5; + xOffset = KEYBOARD_COL_WIDTH * col + 12; + yOffset = KEYBOARD_ROW_HEIGHT * row + 5; #if VERSION_PAL xNudge = msg_get_print_char_width(c, 0, 0, 1.0f, 0, 1); #endif specialChar = c; if (c >= 0xA2 && c < 0xF0) { - if (c >= 0xC6) { + if (c >= MSG_CHAR_MENU_SPACE) { hud_element_set_render_pos(filemenu_createfile_hudElems[2], baseX + xOffset + 22, baseY + yOffset + 8); hud_element_draw_without_clipping(filemenu_createfile_hudElems[2]); flags = 0; } } - if (specialChar == 0xC6) { + if (specialChar == MSG_CHAR_MENU_SPACE) { xOffset -= 1; } - if (specialChar == 0xC9) { + if (specialChar == MSG_CHAR_MENU_BACK) { #if VERSION_PAL xOffset += 16; #else xOffset += 5; #endif } - if (specialChar == 0xCA) { + if (specialChar == MSG_CHAR_MENU_END) { #if VERSION_PAL if (gCurrentLanguage == LANGUAGE_DE) { xOffset += 4; @@ -263,7 +262,7 @@ void filemenu_draw_contents_choose_name( xOffset += 8; #endif } - if (specialChar == 0xC6 || specialChar == 0xCA || specialChar == 0xC9) { + if (specialChar == MSG_CHAR_MENU_SPACE || specialChar == MSG_CHAR_MENU_BACK || specialChar == MSG_CHAR_MENU_END) { yOffset -= 1; xNudge = 9; } @@ -280,8 +279,8 @@ void filemenu_draw_contents_choose_name( } else { for (col = 0; col < menu->numCols; col++) { for (row = 0; row < menu->numRows; row++) { - c = menu->gridData[menu->page * menu->numCols * menu->numRows + menu->numCols * row + col]; - if (c != 0xF7) { + c = menu->gridData[menu->state * menu->numCols * menu->numRows + menu->numCols * row + col]; + if (c != MSG_CHAR_MENU_SPACE) { if (col == menu->col && row == menu->row) { flags = 8; color = 0; @@ -289,26 +288,26 @@ void filemenu_draw_contents_choose_name( flags = 0; color = 10; } - xOffset = col * 19 + 12; - yOffset = row * FILEMENU_ROW_AMT + 5; + xOffset = col * KEYBOARD_COL_WIDTH + 12; + yOffset = row * KEYBOARD_ROW_HEIGHT + 5; #if VERSION_PAL xNudge = msg_get_print_char_width(c, 0, 0, 1.0f, 0, 1); #endif specialChar = c; if (c >= 0xA2 && c < 0xF0) { - if (c >= 0xC6) { + if (c >= MSG_CHAR_MENU_SPACE) { hud_element_set_render_pos(filemenu_createfile_hudElems[2], baseX + xOffset + 22, baseY + yOffset + 8); hud_element_draw_without_clipping(filemenu_createfile_hudElems[2]); flags = 0; } } - if (specialChar == 0xC6) { + if (specialChar == MSG_CHAR_MENU_SPACE) { xOffset -= 1; } - if (specialChar == 0xC9) { + if (specialChar == MSG_CHAR_MENU_BACK) { xOffset += FILEMENU_C9_OFFSET; } - if (specialChar == 0xCA) { + if (specialChar == MSG_CHAR_MENU_END) { #if VERSION_PAL if (gCurrentLanguage == LANGUAGE_DE) { xOffset += 4; @@ -319,7 +318,7 @@ void filemenu_draw_contents_choose_name( xOffset += 8; #endif } - if (specialChar == 0xC6 || specialChar == 0xCA || specialChar == 0xC9) { + if (specialChar == MSG_CHAR_MENU_SPACE || specialChar == MSG_CHAR_MENU_BACK || specialChar == MSG_CHAR_MENU_END) { yOffset -= 1; xNudge = 9; } @@ -333,19 +332,20 @@ void filemenu_draw_contents_choose_name( } } - if (filemenu_currentMenu == 3) { + if (filemenu_currentMenu == FILE_MENU_INPUT_NAME) { if (filemenu_heldButtons & (BUTTON_STICK_RIGHT | BUTTON_STICK_LEFT | BUTTON_STICK_DOWN | BUTTON_STICK_UP)) { D_8024A18C = -4; } D_8024A18C++; - filemenu_set_cursor_goal_pos(WINDOW_ID_FILEMENU_KEYBOARD, - baseX + 2 + menu->col * 19, - baseY + 13 + menu->row * FILEMENU_ROW_AMT); + filemenu_set_cursor_goal_pos(WIN_FILES_INPUT_KEYBOARD, + baseX + 2 + menu->col * KEYBOARD_COL_WIDTH, + baseY + 13 + menu->row * KEYBOARD_ROW_HEIGHT); } } #endif void filemenu_choose_name_init(MenuPanel* menu) { + s32 width; s32 i; for (i = 0; i < ARRAY_COUNT(filemenu_createfile_hudElemScripts); i++) { @@ -359,31 +359,19 @@ void filemenu_choose_name_init(MenuPanel* menu) { setup_pause_menu_tab(filemenu_createfile_windowBPs, ARRAY_COUNT(filemenu_createfile_windowBPs)); - gWindows[WINDOW_ID_FILEMENU_CREATEFILE_HEADER].pos.x = ((gWindows[WINDOW_ID_FILEMENU_CREATEFILE_HEADER].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_CREATEFILE_HEADER].parent].width / 2) - : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_CREATEFILE_HEADER].width / 2; - - gWindows[WINDOW_ID_FILEMENU_KEYBOARD].pos.x = ((gWindows[WINDOW_ID_FILEMENU_KEYBOARD].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_KEYBOARD].parent].width / 2) - : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_KEYBOARD].width / 2; + gWindows[WIN_FILES_INPUT_FIELD].pos.x = CENTER_WINDOW_X(WIN_FILES_INPUT_FIELD); + gWindows[WIN_FILES_INPUT_KEYBOARD].pos.x = CENTER_WINDOW_X(WIN_FILES_INPUT_KEYBOARD); menu->initialized = TRUE; } void filemenu_choose_name_handle_input(MenuPanel* menu) { - s32 oldSelected = menu->selected; - MenuPanel* newMenu; - MenuPanel* newMenu2; + s32 prevSelected = menu->selected; s32 i; #if VERSION_PAL - s32 halfWidth; - - gWindows[WINDOW_ID_FILEMENU_CREATEFILE_HEADER].width = D_filemenu_80250958[gCurrentLanguage]; - halfWidth = gWindows[WINDOW_ID_FILEMENU_CREATEFILE_HEADER].width / 2; - gWindows[WINDOW_ID_FILEMENU_CREATEFILE_HEADER].pos.x = gWindows[WINDOW_ID_FILEMENU_CREATEFILE_HEADER].parent != -1 ? - (gWindows[gWindows[WINDOW_ID_FILEMENU_CREATEFILE_HEADER].parent].width / 2) - halfWidth : - SCREEN_WIDTH / 2 - halfWidth; + gWindows[WIN_FILES_INPUT_FIELD].width = D_filemenu_80250958[gCurrentLanguage]; + gWindows[WIN_FILES_INPUT_FIELD].pos.x = CENTER_WINDOW_X(WIN_FILES_INPUT_FIELD); #endif if (filemenu_heldButtons & BUTTON_STICK_LEFT) { @@ -436,44 +424,45 @@ void filemenu_choose_name_handle_input(MenuPanel* menu) { } menu->selected = MENU_PANEL_SELECTED_GRID_DATA(menu); - if (oldSelected != menu->selected) { + if (prevSelected != menu->selected) { sfx_play_sound(SOUND_CREATE_FILE_MOVE_CURSOR); } if (filemenu_pressedButtons & BUTTON_A) { switch (menu->selected) { - case 0xC6: + case MSG_CHAR_MENU_SPACE: sfx_play_sound(SOUND_CREATE_FILE_SET_CHARACTER); if (filemenu_filename_pos == ARRAY_COUNT(filemenu_filename)) { filemenu_filename_pos = ARRAY_COUNT(filemenu_filename) - 1; } - filemenu_filename[filemenu_filename_pos] = 0xF7; + filemenu_filename[filemenu_filename_pos] = MSG_CHAR_READ_SPACE; filemenu_filename_pos++; if (filemenu_filename_pos > ARRAY_COUNT(filemenu_filename)) { filemenu_filename_pos = ARRAY_COUNT(filemenu_filename); } break; - case 0xC9: - break; - case 0xC7: - if (menu->page != 1) { + case MSG_CHAR_MENU_USE_CHARSET_B: + if (menu->state != FM_INPUT_CHARSET_B) { sfx_play_sound(SOUND_CREATE_FILE_CHANGE_CHARSET); - menu->page = 1; + menu->state = FM_INPUT_CHARSET_B; filemenu_set_selected(menu, menu->col, menu->row); - set_window_update(WINDOW_ID_FILEMENU_KEYBOARD, (s32)filemenu_update_change_layout); + set_window_update(WIN_FILES_INPUT_KEYBOARD, (s32)filemenu_update_change_layout); } break; - case 0xC8: - if (menu->page != 0) { + case MSG_CHAR_MENU_USE_CHARSET_A: + if (menu->state != FM_INPUT_CHARSET_A) { sfx_play_sound(SOUND_CREATE_FILE_CHANGE_CHARSET); - menu->page = 0; + menu->state = FM_INPUT_CHARSET_A; filemenu_set_selected(menu, menu->col, menu->row); - set_window_update(WINDOW_ID_FILEMENU_KEYBOARD, (s32)filemenu_update_change_layout); + set_window_update(WIN_FILES_INPUT_KEYBOARD, (s32)filemenu_update_change_layout); } break; - case 0xCA: + case MSG_CHAR_MENU_BACK: + // handled later to combine with B-input detection + break; + case MSG_CHAR_MENU_END: for (i = 0; i < ARRAY_COUNT(filemenu_filename); i++) { - if (filemenu_filename[i] != 0xF7) { + if (filemenu_filename[i] != MSG_CHAR_READ_SPACE) { break; } } @@ -483,34 +472,24 @@ void filemenu_choose_name_handle_input(MenuPanel* menu) { } sfx_play_sound(SOUND_MENU_NEXT); - set_window_update(WINDOW_ID_FILEMENU_YESNO_OPTIONS, (s32) filemenu_update_show_name_confirm); - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].pos.y = 121; - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].width = 69; - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].height = 44; - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].pos.x = ((gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].parent].width / 2) - : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].width / 2; - - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].pos.y = -70; + set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32) filemenu_update_show_name_confirm); + gWindows[WIN_FILES_CONFIRM_OPTIONS].width = 69; + gWindows[WIN_FILES_CONFIRM_OPTIONS].height = 44; + gWindows[WIN_FILES_CONFIRM_OPTIONS].pos.x = CENTER_WINDOW_X(WIN_FILES_CONFIRM_OPTIONS); + gWindows[WIN_FILES_CONFIRM_OPTIONS].pos.y = 121; + #if VERSION_PAL - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].width = D_filemenu_80250960[gCurrentLanguage]; - halfWidth = gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].width / 2; - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].height = 62; - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].pos.x = gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].parent != -1 - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].parent].width / 2) - halfWidth - : SCREEN_WIDTH / 2 - halfWidth; + gWindows[WIN_FILES_CONFIRM_PROMPT].width = D_filemenu_80250960[gCurrentLanguage]; #else - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].width = 164; - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].height = 62; - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].pos.x = ((gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].parent].width / 2) - : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].width / 2; + gWindows[WIN_FILES_CONFIRM_PROMPT].width = 164; #endif + gWindows[WIN_FILES_CONFIRM_PROMPT].height = 62; + gWindows[WIN_FILES_CONFIRM_PROMPT].pos.x = CENTER_WINDOW_X(WIN_FILES_CONFIRM_PROMPT); + gWindows[WIN_FILES_CONFIRM_PROMPT].pos.y = -70; - filemenu_currentMenu = 1; - newMenu = filemenu_menus[filemenu_currentMenu]; - newMenu->page = INPUT_FINAL_PAGE; - filemenu_set_selected(newMenu, 0, 0); + filemenu_currentMenu = FILE_MENU_CONFIRM; + filemenu_menus[filemenu_currentMenu]->state = INPUT_FINAL_PAGE; + filemenu_set_selected(filemenu_menus[filemenu_currentMenu], 0, 0); return; default: sfx_play_sound(SOUND_CREATE_FILE_SET_CHARACTER); @@ -526,43 +505,45 @@ void filemenu_choose_name_handle_input(MenuPanel* menu) { break; } - if (menu->selected != 0xC7 && menu->selected != 0xC8 && menu->selected != 0xC9 && - filemenu_filename_pos == ARRAY_COUNT(filemenu_filename)) { + if (menu->selected != MSG_CHAR_MENU_USE_CHARSET_A + && menu->selected != MSG_CHAR_MENU_USE_CHARSET_B + && menu->selected != MSG_CHAR_MENU_BACK + && filemenu_filename_pos == ARRAY_COUNT(filemenu_filename) + ) { filemenu_set_selected(menu, menu->numCols - 3, menu->numRows - 1); } } - - if ((filemenu_pressedButtons & BUTTON_B) || ((filemenu_pressedButtons & BUTTON_A) && menu->selected == 0xC9)) { + if ((filemenu_pressedButtons & BUTTON_B) || ((filemenu_pressedButtons & BUTTON_A) && menu->selected == MSG_CHAR_MENU_BACK)) { sfx_play_sound(SOUND_CREATE_FILE_BACKSPACE); filemenu_filename_pos--; if (filemenu_filename_pos < 0) { filemenu_filename_pos = 0; - set_window_update(WINDOW_ID_FILEMENU_CREATEFILE_HEADER, (s32) &filemenu_update_hidden_name_input); - set_window_update(WINDOW_ID_FILEMENU_KEYBOARD, (s32) &filemenu_update_hidden_name_input); - set_window_update(WINDOW_ID_FILEMENU_TITLE, (s32) &filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_STEREO, (s32) &filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_MONO, (s32) &filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32) &filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_CENTER, (s32) &filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, (s32) &filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32) &filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE0_INFO, (s32) &filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE1_INFO, (s32) &filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE2_INFO, (s32) &filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE3_INFO, (s32) &filemenu_update_show_with_rotation); - filemenu_currentMenu = 0; + set_window_update(WIN_FILES_INPUT_FIELD, (s32) &filemenu_update_hidden_name_input); + set_window_update(WIN_FILES_INPUT_KEYBOARD, (s32) &filemenu_update_hidden_name_input); + set_window_update(WIN_FILES_TITLE, (s32) &filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_STEREO, (s32) &filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_MONO, (s32) &filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_OPTION_LEFT, (s32) &filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_OPTION_CENTER, (s32) &filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_OPTION_RIGHT, (s32) &filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_OPTION_LEFT, (s32) &filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_SLOT0_BODY, (s32) &filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_SLOT1_BODY, (s32) &filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_SLOT2_BODY, (s32) &filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_SLOT3_BODY, (s32) &filemenu_update_show_with_rotation); + filemenu_currentMenu = FILE_MENU_MAIN; return; } for (i = filemenu_filename_pos; i < ARRAY_COUNT(filemenu_filename); i++) { - filemenu_filename[i] = 0xF7; + filemenu_filename[i] = MSG_CHAR_READ_SPACE; } } if (filemenu_pressedButtons & BUTTON_START) { for (i = 0; i < ARRAY_COUNT(filemenu_filename); i++) { - if (filemenu_filename[i] != 0xF7) { + if (filemenu_filename[i] != MSG_CHAR_READ_SPACE) { break; } } @@ -573,41 +554,28 @@ void filemenu_choose_name_handle_input(MenuPanel* menu) { } sfx_play_sound(SOUND_MENU_NEXT); - set_window_update(WINDOW_ID_FILEMENU_YESNO_OPTIONS, (s32) filemenu_update_show_name_confirm); + set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32) filemenu_update_show_name_confirm); - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].pos.y = 121; - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].width = 69; - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].height = 44; - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].pos.x = ((gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].parent].width / 2) - : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].width / 2; + gWindows[WIN_FILES_CONFIRM_OPTIONS].width = 69; + gWindows[WIN_FILES_CONFIRM_OPTIONS].height = 44; + gWindows[WIN_FILES_CONFIRM_OPTIONS].pos.x = CENTER_WINDOW_X(WIN_FILES_CONFIRM_OPTIONS); + gWindows[WIN_FILES_CONFIRM_OPTIONS].pos.y = 121; - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].pos.y = -70; #if VERSION_PAL - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].width = D_filemenu_80250960[gCurrentLanguage]; - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].height = 62; - halfWidth = gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].width / 2; - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].pos.x = gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].parent != -1 - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].parent].width / 2) - halfWidth - : SCREEN_WIDTH / 2 - halfWidth; + gWindows[WIN_FILES_CONFIRM_PROMPT].width = D_filemenu_80250960[gCurrentLanguage]; #else - - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].width = 164; - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].height = 62; - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].pos.x = ((gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].parent].width / 2) - : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].width / 2; + gWindows[WIN_FILES_CONFIRM_PROMPT].width = 164; #endif + gWindows[WIN_FILES_CONFIRM_PROMPT].height = 62; + gWindows[WIN_FILES_CONFIRM_PROMPT].pos.x = CENTER_WINDOW_X(WIN_FILES_CONFIRM_PROMPT); + gWindows[WIN_FILES_CONFIRM_PROMPT].pos.y = -70; - filemenu_currentMenu = 1; - newMenu2 = filemenu_menus[filemenu_currentMenu]; - newMenu2->page = INPUT_FINAL_PAGE; - filemenu_set_selected(newMenu2, 0, 0); + filemenu_currentMenu = FILE_MENU_CONFIRM; + filemenu_menus[FILE_MENU_CONFIRM]->state = INPUT_FINAL_PAGE; + filemenu_set_selected(filemenu_menus[FILE_MENU_CONFIRM], 0, 0); } } -static const f32 padding[2] = { 0.0f, 0.0f }; // not sure why this is needed - void filemenu_choose_name_update(MenuPanel* menu) { } diff --git a/src/filemenu/filemenu_info.c b/src/filemenu/filemenu_info.c index ee91f45812..fcfeb9b708 100644 --- a/src/filemenu/filemenu_info.c +++ b/src/filemenu/filemenu_info.c @@ -25,7 +25,7 @@ u8 filemenu_info_gridData[] = { MenuWindowBP filemenu_info_windowBPs[] = { { - .windowID = WINDOW_ID_FILEMENU_INFO, + .windowID = WIN_FILES_MESSAGE, .unk_01 = 0, .pos = { .x = 0, .y = 0 }, .width = 0, @@ -45,7 +45,7 @@ MenuPanel filemenu_info_menuBP = { .col = 0, .row = 0, .selected = 0, - .page = 0, + .state = 0, .numCols = 1, .numRows = 1, .numPages = 0, @@ -65,73 +65,72 @@ void filemenu_info_draw_message_contents( #if VERSION_PAL s32 xOffset; - // TODO figure out FILE_MESSAGE constants switch (menu->page) { - case 0: + case FM_MESSAGE_DELETED: filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_28), baseX + 10, baseY + 4, 255, 0, 0); xOffset = D_filemenu_80250934[gCurrentLanguage] + 10; filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_26), baseX + xOffset, baseY + 4, 255, 0, 0); xOffset += D_filemenu_802508FC[gCurrentLanguage]; - draw_number(filemenu_menus[0]->selected + 1, baseX + xOffset, baseY + 6, 0, 0, 255, 3); + draw_number(filemenu_menus[FILE_MENU_MAIN]->selected + 1, baseX + xOffset, baseY + 6, 0, 0, 255, 3); xOffset++; filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_HAS_BEEN_DELETED), baseX + xOffset, baseY + 4, 255, 0, 0); break; - case 1: + case FM_MESSAGE_COPIED: filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_COPY_FROM), baseX + 10, baseY + 4, 255, 0, 0); xOffset = D_filemenu_80250948[gCurrentLanguage] + 10; filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_26), baseX + xOffset, baseY + 4, 255, 0, 0); xOffset += D_filemenu_802508FC[gCurrentLanguage]; - draw_number(filemenu_loadedFileIdx + 1, baseX + xOffset, baseY + 6, 0, 0, 255, 3); + draw_number(filemenu_CopyFromFileIdx + 1, baseX + xOffset, baseY + 6, 0, 0, 255, 3); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_TO), baseX + 10, baseY + 18, 255, 0, 0); xOffset = D_filemenu_8025094C[gCurrentLanguage] + 10; filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_26), baseX + xOffset, baseY + 18, 255, 0, 0); xOffset += D_filemenu_802508FC[gCurrentLanguage]; - draw_number(filemenu_iterFileIdx + 1, baseX + xOffset, baseY + 0x14, 0, 0, 255, 3); + draw_number(filemenu_CopyToFileIdx + 1, baseX + xOffset, baseY + 0x14, 0, 0, 255, 3); xOffset += D_filemenu_80250950[gCurrentLanguage]; filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_HAS_BEEN_CREATED), baseX + xOffset, baseY + 18, 255, 0, 0); break; - case 2: + case FM_MESSAGE_CREATED: filemenu_draw_message(filemenu_get_menu_message(0x20), baseX + 10, baseY + 4, 255, 0, 0); xOffset = D_filemenu_80250968[gCurrentLanguage] + 10; filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_26), baseX + xOffset, baseY + 4, 255, 0, 0); xOffset += D_filemenu_802508FC[gCurrentLanguage]; - draw_number(filemenu_menus[0]->selected + 1, baseX + xOffset, baseY + 6, 0, 0, 255, 3); + draw_number(filemenu_menus[FILE_MENU_MAIN]->selected + 1, baseX + xOffset, baseY + 6, 0, 0, 255, 3); xOffset++; filemenu_draw_message(filemenu_get_menu_message(0x1F), baseX + xOffset, baseY + 4, 255, 0, 0); break; } #else - switch (menu->page) { - case 0: + switch (menu->state) { + case FM_MESSAGE_DELETED: filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_26), baseX + 10, baseY + 4, 255, 0, 0); - draw_number(filemenu_menus[0]->selected + 1, baseX + 48, baseY + 6 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); + draw_number(filemenu_menus[FILE_MENU_MAIN]->selected + 1, baseX + 48, baseY + 6 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_HAS_BEEN_DELETED), baseX + 49, baseY + 4, 255, 0, 0); break; - case 2: + case FM_MESSAGE_COPIED: #if VERSION_IQUE filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_COPY_FROM), baseX + 10, baseY + 7, 255, 0, 0); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_26), baseX + 42, baseY + 7, 255, 0, 0); - draw_number(filemenu_loadedFileIdx + 1, baseX + 84, baseY + 10, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); + draw_number(filemenu_CopyFromFileIdx + 1, baseX + 84, baseY + 10, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_TO), baseX + 84, baseY + 7, 255, 0, 0); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_26), baseX + 100, baseY + 7, 255, 0, 0); - draw_number(filemenu_iterFileIdx + 1, baseX + 140, baseY + 10, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); + draw_number(filemenu_CopyToFileIdx + 1, baseX + 140, baseY + 10, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_PERIOD_34), baseX + 140, baseY + 7, 255, 0, 0); #else filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_COPY_FROM), baseX + 10, baseY + 4, 255, 0, 0); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_26), baseX + 84, baseY + 4, 255, 0, 0); - draw_number(filemenu_loadedFileIdx + 1, baseX + 122, baseY + 6, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); + draw_number(filemenu_CopyFromFileIdx + 1, baseX + 122, baseY + 6, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_TO), baseX + 10, baseY + 18, 255, 0, 0); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_26), baseX + 30, baseY + 18, 255, 0, 0); - draw_number(filemenu_iterFileIdx + 1, baseX + 68, baseY + 20, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); + draw_number(filemenu_CopyToFileIdx + 1, baseX + 68, baseY + 20, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_PERIOD_34), baseX + 65, baseY + 18, 255, 0, 0); #endif break; - case 1: + case FM_MESSAGE_LANGUAGE: filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_28), baseX + 10, baseY + 4, 255, 0, 0); break; - case 3: + case FM_MESSAGE_CREATED: filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_26), baseX + 10, baseY + 4, 255, 0, 0); - draw_number(filemenu_menus[0]->selected + 1, baseX + CREATE_SUCCESS_NUMBER_X, baseY + 6 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); + draw_number(filemenu_menus[FILE_MENU_MAIN]->selected + 1, baseX + CREATE_SUCCESS_NUMBER_X, baseY + 6 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_HAS_BEEN_CREATED), baseX + 49, baseY + 4, 255, 0, 0); break; } @@ -152,35 +151,35 @@ void filemenu_info_init(MenuPanel* tab) { void filemenu_info_handle_input(MenuPanel* menu) { if (filemenu_pressedButtons & (BUTTON_A | BUTTON_B)) { - MenuPanel* menu = filemenu_menus[0]; + MenuPanel* menu = filemenu_menus[FILE_MENU_MAIN]; - filemenu_currentMenu = 0; + filemenu_currentMenu = FILE_MENU_MAIN; - switch (menu->page) { - case PAGE_1: - menu->page = PAGE_0; - set_window_update(WINDOW_ID_FILEMENU_STEREO, (s32)filemenu_update_show_options_left); - set_window_update(WINDOW_ID_FILEMENU_MONO, (s32)filemenu_update_show_options_right); - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32)filemenu_update_show_options_bottom); - set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, (s32)filemenu_update_show_options_bottom); + switch (menu->state) { + case FILE_MENU_CONFIRM: + menu->state = FILE_MENU_MAIN; + set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_show_options_left); + set_window_update(WIN_FILES_MONO, (s32)filemenu_update_show_options_right); + set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_show_options_bottom); + set_window_update(WIN_FILES_OPTION_RIGHT, (s32)filemenu_update_show_options_bottom); filemenu_set_selected(menu, 0, 2); break; - case PAGE_4: - menu->page = PAGE_0; - set_window_update(WINDOW_ID_FILEMENU_STEREO, (s32)filemenu_update_show_options_left); - set_window_update(WINDOW_ID_FILEMENU_MONO, (s32)filemenu_update_show_options_right); - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32)filemenu_update_show_options_bottom); - set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, (s32)filemenu_update_show_options_bottom); + case FILE_MENU_LANGUAGES: + menu->state = FILE_MENU_MAIN; + set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_show_options_left); + set_window_update(WIN_FILES_MONO, (s32)filemenu_update_show_options_right); + set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_show_options_bottom); + set_window_update(WIN_FILES_OPTION_RIGHT, (s32)filemenu_update_show_options_bottom); filemenu_set_selected(menu, 1, 2); break; #if !VERSION_PAL - case PAGE_2: - menu->page = 2; + case FILE_MENU_MESSAGE: + menu->state = FILE_MENU_MESSAGE; filemenu_set_selected(menu, 1, 2); break; #endif } - set_window_update(WINDOW_ID_FILEMENU_INFO, WINDOW_UPDATE_HIDE); + set_window_update(WIN_FILES_MESSAGE, WINDOW_UPDATE_HIDE); } } diff --git a/src/filemenu/filemenu_main.c b/src/filemenu/filemenu_main.c index 1e2c3ae834..f7ebae3847 100644 --- a/src/filemenu/filemenu_main.c +++ b/src/filemenu/filemenu_main.c @@ -50,6 +50,9 @@ extern u8 D_filemenu_8025093C[4]; BSS u8 filemenu_filename[8]; +#define LOCALE_FILE_NUMBER_X 33 +//TODO ifdef for LOCALE_DE/ES/FR/JP/CN ... + #if VERSION_IQUE #define OFFSET_WIDTH 5 #define DELETE_OFFSET_X 9 @@ -128,7 +131,7 @@ u8 filemenu_main_gridData[] = { MenuWindowBP filemenu_main_windowBPs[] = { { - .windowID = WINDOW_ID_FILEMENU_TITLE, + .windowID = WIN_FILES_TITLE, .unk_01 = 0, .pos = { .x = 0, .y = 0 }, .width = 0, @@ -136,13 +139,13 @@ MenuWindowBP filemenu_main_windowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &filemenu_draw_contents_title, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_MAIN, + .parentID = WIN_FILES_MAIN, .fpUpdate = { .func = &filemenu_update_show_title }, .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[3] } }, { - .windowID = WINDOW_ID_FILEMENU_STEREO, + .windowID = WIN_FILES_STEREO, .unk_01 = 0, .pos = { .x = -2, .y = 6 }, .width = 68, @@ -150,13 +153,13 @@ MenuWindowBP filemenu_main_windowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &filemenu_draw_contents_stereo, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_MAIN, + .parentID = WIN_FILES_MAIN, .fpUpdate = { .func = &filemenu_update_show_options_left }, .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[2] } }, { - .windowID = WINDOW_ID_FILEMENU_MONO, + .windowID = WIN_FILES_MONO, .unk_01 = 0, .pos = { .x = 221, .y = 6 }, .width = 68, @@ -164,13 +167,13 @@ MenuWindowBP filemenu_main_windowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &filemenu_draw_contents_mono, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_MAIN, + .parentID = WIN_FILES_MAIN, .fpUpdate = { .func = &filemenu_update_show_options_right }, .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[2] } }, { - .windowID = WINDOW_ID_FILEMENU_OPTION_LEFT, + .windowID = WIN_FILES_OPTION_LEFT, .unk_01 = 0, .pos = { .x = 5, .y = 171 }, .width = 88, @@ -178,13 +181,13 @@ MenuWindowBP filemenu_main_windowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &filemenu_draw_contents_option_left, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_MAIN, + .parentID = WIN_FILES_MAIN, .fpUpdate = { .func = &filemenu_update_show_options_bottom }, .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[4] } }, { - .windowID = WINDOW_ID_FILEMENU_OPTION_CENTER, + .windowID = WIN_FILES_OPTION_CENTER, .unk_01 = 0, .pos = { .x = 0, .y = 171 }, .width = 88, @@ -192,13 +195,13 @@ MenuWindowBP filemenu_main_windowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &filemenu_draw_contents_option_center, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_MAIN, + .parentID = WIN_FILES_MAIN, .fpUpdate = { .func = &filemenu_update_show_options_bottom }, .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[5] } }, { - .windowID = WINDOW_ID_FILEMENU_OPTION_RIGHT, + .windowID = WIN_FILES_OPTION_RIGHT, .unk_01 = 0, .pos = { .x = 195, .y = 171 }, .width = 88, @@ -206,13 +209,13 @@ MenuWindowBP filemenu_main_windowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &filemenu_draw_contents_option_right, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_MAIN, + .parentID = WIN_FILES_MAIN, .fpUpdate = { .func = &filemenu_update_show_options_bottom }, .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[6] } }, { - .windowID = WINDOW_ID_FILEMENU_FILE2_INFO, + .windowID = WIN_FILES_SLOT2_BODY, .unk_01 = 0, .pos = { .x = 9, .y = 110 }, .width = 130, @@ -220,13 +223,13 @@ MenuWindowBP filemenu_main_windowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &filemenu_draw_contents_file_2_info, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_MAIN, + .parentID = WIN_FILES_MAIN, .fpUpdate = { .func = &filemenu_update_show_options_left }, .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[9] } }, { - .windowID = WINDOW_ID_FILEMENU_FILE2_TITLE, + .windowID = WIN_FILES_SLOT2_TITLE, .unk_01 = 0, .pos = { .x = 3, .y = -8 }, .width = 124 + OFFSET_WIDTH, @@ -234,13 +237,13 @@ MenuWindowBP filemenu_main_windowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &filemenu_draw_contents_file_2_title, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_FILE2_INFO, + .parentID = WIN_FILES_SLOT2_BODY, .fpUpdate = { WINDOW_UPDATE_SHOW }, .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[13] } }, { - .windowID = WINDOW_ID_FILEMENU_FILE3_INFO, + .windowID = WIN_FILES_SLOT3_BODY, .unk_01 = 0, .pos = { .x = 149, .y = 110 }, .width = 130, @@ -248,13 +251,13 @@ MenuWindowBP filemenu_main_windowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &filemenu_draw_contents_file_3_info, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_MAIN, + .parentID = WIN_FILES_MAIN, .fpUpdate = { .func = &filemenu_update_show_options_right }, .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[10] } }, { - .windowID = WINDOW_ID_FILEMENU_FILE3_TITLE, + .windowID = WIN_FILES_SLOT3_TITLE, .unk_01 = 0, .pos = { .x = 3, .y = -8 }, .width = 124 + OFFSET_WIDTH, @@ -262,13 +265,13 @@ MenuWindowBP filemenu_main_windowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &filemenu_draw_contents_file_3_title, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_FILE3_INFO, + .parentID = WIN_FILES_SLOT3_BODY, .fpUpdate = { WINDOW_UPDATE_SHOW }, .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[14] } }, { - .windowID = WINDOW_ID_FILEMENU_FILE0_INFO, + .windowID = WIN_FILES_SLOT0_BODY, .unk_01 = 0, .pos = { .x = 9, .y = 41 }, .width = 130 + OFFSET_WIDTH, @@ -276,13 +279,13 @@ MenuWindowBP filemenu_main_windowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &filemenu_draw_contents_file_0_info, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_MAIN, + .parentID = WIN_FILES_MAIN, .fpUpdate = { .func = &filemenu_update_show_options_left }, .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[7] } }, { - .windowID = WINDOW_ID_FILEMENU_FILE0_TITLE, + .windowID = WIN_FILES_SLOT0_TITLE, .unk_01 = 0, .pos = { .x = 3, .y = -8 }, .width = 124 + OFFSET_WIDTH, @@ -290,13 +293,13 @@ MenuWindowBP filemenu_main_windowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &filemenu_draw_contents_file_0_title, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_FILE0_INFO, + .parentID = WIN_FILES_SLOT0_BODY, .fpUpdate = { WINDOW_UPDATE_SHOW }, .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[11] } }, { - .windowID = WINDOW_ID_FILEMENU_FILE1_INFO, + .windowID = WIN_FILES_SLOT1_BODY, .unk_01 = 0, .pos = { .x = 149, .y = 41 }, .width = 130, @@ -304,13 +307,13 @@ MenuWindowBP filemenu_main_windowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &filemenu_draw_contents_file_1_info, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_MAIN, + .parentID = WIN_FILES_MAIN, .fpUpdate = { .func = &filemenu_update_show_options_right }, .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[8] } }, { - .windowID = WINDOW_ID_FILEMENU_FILE1_TITLE, + .windowID = WIN_FILES_SLOT1_TITLE, .unk_01 = 0, .pos = { .x = 3, .y = -8 }, .width = 124 + OFFSET_WIDTH, @@ -318,7 +321,7 @@ MenuWindowBP filemenu_main_windowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &filemenu_draw_contents_file_1_title, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_FILE1_INFO, + .parentID = WIN_FILES_SLOT1_BODY, .fpUpdate = { WINDOW_UPDATE_SHOW }, .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[12] } @@ -330,7 +333,7 @@ MenuPanel filemenu_main_menuBP = { .col = 0, .row = 0, .selected = 0, - .page = 0, + .state = 0, .numCols = 3, .numRows = 3, .numPages = 0, @@ -354,29 +357,29 @@ void filemenu_draw_contents_title( s32 xOffset; s32 yOffset; - switch (menu->page) { - case PAGE_0: + switch (menu->state) { + case FM_MAIN_SELECT_FILE: msgIdx = FILE_MESSAGE_SELECT_FILE_TO_START; xOffset = 9; yOffset = 4; break; - case PAGE_1: + case FM_MAIN_SELECT_DELETE: msgIdx = FILE_MESSAGE_SELECT_FILE_TO_DELETE; xOffset = DELETE_OFFSET_X; yOffset = 4; break; - case PAGE_3: + case FM_MAIN_SELECT_COPY_FROM: msgIdx = FILE_MESSAGE_COPY_WHICH_FILE; xOffset = SAVE_OFFSET_X; yOffset = 4; break; - case PAGE_4: + case FM_MAIN_SELECT_COPY_TO: msgIdx = FILE_MESSAGE_COPY_TO_WHICH_FILE; xOffset = COPY_OFFSET_X; yOffset = 4; break; #if !VERSION_PAL - case PAGE_2: + case FM_MAIN_SELECT_LANGUAGE: default: msgIdx = FILE_MESSAGE_SELECT_FILE_TO_SAVE; xOffset = 10; @@ -433,13 +436,13 @@ void filemenu_draw_contents_option_left( s32 offset = D_filemenu_802508E8[gCurrentLanguage]; if (menu->col == 0 && menu->row == 2) { - filemenu_set_cursor_goal_pos(WINDOW_ID_FILEMENU_OPTION_LEFT, (baseX + offset) - 10, baseY + 8); + filemenu_set_cursor_goal_pos(WIN_FILES_OPTION_LEFT, (baseX + offset) - 10, baseY + 8); } filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_DELETE_FILE), baseX + offset + OFFSET_WIDTH, baseY + 2, 255, 0, 1); #else - if (menu->page != 2) { + if (menu->state != FM_MAIN_SELECT_LANGUAGE) { if (menu->col == 0 && menu->row == 2) { - filemenu_set_cursor_goal_pos(WINDOW_ID_FILEMENU_OPTION_LEFT, baseX, baseY + 8); + filemenu_set_cursor_goal_pos(WIN_FILES_OPTION_LEFT, baseX, baseY + 8); } filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_DELETE_FILE), baseX + 8 + OFFSET_WIDTH, baseY + 2, 255, 0, 1); } @@ -457,7 +460,7 @@ void filemenu_draw_contents_option_center( s32 xOffset; s32 yOffset; - switch (menu->page) { + switch (menu->state) { case 1: case 2: case 3: @@ -465,7 +468,7 @@ void filemenu_draw_contents_option_center( xOffset = D_filemenu_802508F4[gCurrentLanguage]; yOffset = 0; if (menu->col == 1 && menu->row == 2) { - filemenu_set_cursor_goal_pos(WINDOW_ID_FILEMENU_OPTION_CENTER, baseX + xOffset - 10, baseY + 8); + filemenu_set_cursor_goal_pos(WIN_FILES_OPTION_CENTER, baseX + xOffset - 10, baseY + 8); } break; default: @@ -473,7 +476,7 @@ void filemenu_draw_contents_option_center( xOffset = D_filemenu_802508EC[gCurrentLanguage]; yOffset = 0; if (menu->col == 1 && menu->row == 2) { - filemenu_set_cursor_goal_pos(WINDOW_ID_FILEMENU_OPTION_CENTER, baseX + xOffset - 10, baseY + 8); + filemenu_set_cursor_goal_pos(WIN_FILES_OPTION_CENTER, baseX + xOffset - 10, baseY + 8); } break; } @@ -491,7 +494,7 @@ void filemenu_draw_contents_option_center( s32 xOffset; s32 yOffset; - switch (menu->page) { + switch (menu->state) { case 1: case 2: case 3: @@ -500,7 +503,7 @@ void filemenu_draw_contents_option_center( xOffset = CENTER_CANCEL_X; yOffset = 0; if (menu->col == 1 && menu->row == 2) { - filemenu_set_cursor_goal_pos(WINDOW_ID_FILEMENU_OPTION_CENTER, baseX + CENTER_CANCEL_X - 10, baseY + 8); + filemenu_set_cursor_goal_pos(WIN_FILES_OPTION_CENTER, baseX + CENTER_CANCEL_X - 10, baseY + 8); } break; default: @@ -508,7 +511,7 @@ void filemenu_draw_contents_option_center( xOffset = 14; yOffset = 0; if (menu->col == 1 && menu->row == 2) { - filemenu_set_cursor_goal_pos(WINDOW_ID_FILEMENU_OPTION_CENTER, baseX + 4, baseY + 8); + filemenu_set_cursor_goal_pos(WIN_FILES_OPTION_CENTER, baseX + 4, baseY + 8); } break; } @@ -527,13 +530,13 @@ void filemenu_draw_contents_option_right( s32 offset = D_filemenu_802508F0[gCurrentLanguage]; if (menu->col == 2 && menu->row == 2) { - filemenu_set_cursor_goal_pos(WINDOW_ID_FILEMENU_OPTION_RIGHT, baseX + offset - 10, baseY + 8); + filemenu_set_cursor_goal_pos(WIN_FILES_OPTION_RIGHT, baseX + offset - 10, baseY + 8); } filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_CANCEL), baseX + offset, baseY + 2, 255, 0, 1); #else - if (menu->page != 2) { + if (menu->state != FM_MAIN_SELECT_LANGUAGE) { if (menu->col == 2 && menu->row == 2) { - filemenu_set_cursor_goal_pos(WINDOW_ID_FILEMENU_OPTION_RIGHT, baseX + 8, baseY + 8); + filemenu_set_cursor_goal_pos(WIN_FILES_OPTION_RIGHT, baseX + 8, baseY + 8); } filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_CANCEL), baseX + RIGHT_CANCEL_X, baseY + 2, 255, 0, 1); } @@ -555,7 +558,7 @@ void filemenu_draw_contents_file_info(s32 fileIdx, s32 i; const int MAX_DISPLAYED_TIME = 100*60*60*60 - 1; // 100 hours minus one frame at 60 fps - if (!gSaveSlotHasData[fileIdx]) { + if (!gSaveSlotMetadata[fileIdx].hasData) { #if VERSION_PAL xOffset = D_filemenu_802508E0[gCurrentLanguage]; #else @@ -565,7 +568,20 @@ void filemenu_draw_contents_file_info(s32 fileIdx, return; } - if (gFilesDisplayData[fileIdx].timePlayed == 0) { + // do not show file summary from mods that don't match the current one + if (!gSaveSlotMetadata[fileIdx].validData) { + char buf[32]; + if (gSaveSlotMetadata[fileIdx].modName[0] == '\0') { + dx_string_to_msg(&buf, "Paper Mario"); + } else { + dx_string_to_msg(&buf, gSaveSlotMetadata[fileIdx].modName); + } + xOffset = 66 - get_msg_width(&buf, 0) / 2; + filemenu_draw_message(&buf, baseX + xOffset, baseY + 20, 255, MSG_PAL_RED, 0); + return; + } + + if (gSaveSlotSummary[fileIdx].timePlayed == 0) { #if VERSION_PAL xOffset = D_filemenu_802508E4[gCurrentLanguage]; #else @@ -581,7 +597,7 @@ void filemenu_draw_contents_file_info(s32 fileIdx, xOffset = 34; #endif filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_LEVEL), baseX + xOffset, baseY + 10, 255, 0xA, 1); - temp_s3_2 = gFilesDisplayData[fileIdx].level; + temp_s3_2 = gSaveSlotSummary[fileIdx].level; temp_s3 = temp_s3_2; draw_number(temp_s3 / 10, baseX + 79, baseY + 10 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_STANDARD, 255, DRAW_NUMBER_STYLE_MONOSPACE); draw_number(temp_s3 % 10, baseX + 88, baseY + 10 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_STANDARD, 255, DRAW_NUMBER_STYLE_MONOSPACE); @@ -592,7 +608,7 @@ void filemenu_draw_contents_file_info(s32 fileIdx, #endif filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_PLAY_TIME), baseX + xOffset, baseY + 24, 255, 0xA, 1); - temp_s3_2 = gFilesDisplayData[fileIdx].timePlayed; + temp_s3_2 = gSaveSlotSummary[fileIdx].timePlayed; if (temp_s3_2 > MAX_DISPLAYED_TIME) { temp_s3_2 = MAX_DISPLAYED_TIME; } @@ -607,7 +623,7 @@ void filemenu_draw_contents_file_info(s32 fileIdx, draw_number((temp_s3_2 / 3600) - (temp_s0_3 * 10), baseX + 109, baseY + 24 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_STANDARD, 255, DRAW_NUMBER_STYLE_MONOSPACE); for (i = 0; i < 7; i++) { - if (i < gFilesDisplayData[fileIdx].spiritsRescued) { + if (i < gSaveSlotSummary[fileIdx].spiritsRescued) { id = filemenu_hudElemIDs[i]; } else { id = filemenu_hudElemIDs[i + 7]; @@ -629,7 +645,7 @@ void filemenu_draw_contents_file_title( s32 width, s32 height, s32 opacity, s32 darkening) { - if (filemenu_currentMenu == 0 && menu->selected == fileIdx) { + if (filemenu_currentMenu == FILE_MENU_MAIN && menu->selected == fileIdx) { filemenu_set_cursor_goal_pos(fileIdx + 60, baseX - 3, baseY + 8); } @@ -647,8 +663,8 @@ void filemenu_draw_contents_file_title( tmp += D_filemenu_802508D4[gCurrentLanguage]; tmp += 6; filemenu_draw_file_name( - gFilesDisplayData[fileIdx].filename, - ARRAY_COUNT(gFilesDisplayData[fileIdx].filename), + gSaveSlotSummary[fileIdx].filename, + ARRAY_COUNT(gSaveSlotSummary[fileIdx].filename), baseX + tmp, baseY + 1, 255, 0, 1, 9); } @@ -661,19 +677,19 @@ void filemenu_draw_contents_file_title( s32 width, s32 height, s32 opacity, s32 darkening) { - if (filemenu_currentMenu == 0 && menu->selected == fileIdx) { + if (filemenu_currentMenu == FILE_MENU_MAIN && menu->selected == fileIdx) { filemenu_set_cursor_goal_pos(fileIdx + 60, baseX - 3, baseY + 8); } filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_26), baseX + FILE_X, baseY + 1, 255, 0, 1); - if (!gSaveSlotHasData[fileIdx]) { + if (!gSaveSlotMetadata[fileIdx].hasData) { draw_number(fileIdx + 1, baseX + FILE_NUMBER_X, baseY + 1 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_WHITE, 255, DRAW_NUMBER_STYLE_MONOSPACE); } else { draw_number(fileIdx + 1, baseX + FILE_NUMBER_X, baseY + 1 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_WHITE, 255, DRAW_NUMBER_STYLE_MONOSPACE); filemenu_draw_file_name( - gFilesDisplayData[fileIdx].filename, - ARRAY_COUNT(gFilesDisplayData[fileIdx].filename), + gSaveSlotSummary[fileIdx].filename, + ARRAY_COUNT(gSaveSlotSummary[fileIdx].filename), baseX + FILE_NAME_X, baseY + 1, 255, 0, 1, 9); } } @@ -756,7 +772,6 @@ void filemenu_draw_contents_file_3_title( void filemenu_main_init(MenuPanel* menu) { s32 halfWidth; s32 i; - s32 tmp; for (i = 0; i < ARRAY_COUNT(filemenu_hudElemIDs); i++) { filemenu_hudElemIDs[i] = hud_element_create(filemenu_main_hudElemScripts[gCurrentLanguage][i]); @@ -770,30 +785,29 @@ void filemenu_main_init(MenuPanel* menu) { setup_pause_menu_tab(filemenu_main_windowBPs, ARRAY_COUNT(filemenu_main_windowBPs)); menu->selected = MENU_PANEL_SELECTED_GRID_DATA(menu); - gWindows[WINDOW_ID_FILEMENU_TITLE].pos.y = 1; - gWindows[WINDOW_ID_FILEMENU_TITLE].width = 162; - gWindows[WINDOW_ID_FILEMENU_TITLE].height = 25; + gWindows[WIN_FILES_TITLE].pos.y = 1; + gWindows[WIN_FILES_TITLE].width = 162; + gWindows[WIN_FILES_TITLE].height = 25; - halfWidth = gWindows[WINDOW_ID_FILEMENU_TITLE].width / 2; + halfWidth = gWindows[WIN_FILES_TITLE].width / 2; - gWindows[WINDOW_ID_FILEMENU_TITLE].pos.x = gWindows[WINDOW_ID_FILEMENU_TITLE].parent != -1 - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_TITLE].parent].width / 2) - halfWidth + gWindows[WIN_FILES_TITLE].pos.x = gWindows[WIN_FILES_TITLE].parent != WIN_NONE + ? (gWindows[gWindows[WIN_FILES_TITLE].parent].width / 2) - halfWidth : SCREEN_WIDTH / 2 - halfWidth; - tmp = 1; - halfWidth = gWindows[WINDOW_ID_FILEMENU_OPTION_CENTER].width / 2; + halfWidth = gWindows[WIN_FILES_OPTION_CENTER].width / 2; - gWindows[WINDOW_ID_FILEMENU_OPTION_CENTER].pos.x = gWindows[WINDOW_ID_FILEMENU_OPTION_CENTER].parent != -1 - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_OPTION_CENTER].parent].width / 2) - halfWidth + gWindows[WIN_FILES_OPTION_CENTER].pos.x = gWindows[WIN_FILES_OPTION_CENTER].parent != WIN_NONE + ? (gWindows[gWindows[WIN_FILES_OPTION_CENTER].parent].width / 2) - halfWidth : SCREEN_WIDTH / 2 - halfWidth; if (menu->page != 0) { - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_FILEMENU_STEREO, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_FILEMENU_MONO, WINDOW_UPDATE_HIDE); + set_window_update(WIN_FILES_OPTION_LEFT, WINDOW_UPDATE_HIDE); + set_window_update(WIN_FILES_OPTION_RIGHT, WINDOW_UPDATE_HIDE); + set_window_update(WIN_FILES_STEREO, WINDOW_UPDATE_HIDE); + set_window_update(WIN_FILES_MONO, WINDOW_UPDATE_HIDE); } - menu->initialized = tmp; + menu->initialized = 1; } #else void filemenu_main_init(MenuPanel* menu) { @@ -802,7 +816,6 @@ void filemenu_main_init(MenuPanel* menu) { s16* posXPtr; s32 x; s32 i; - s32 tmp; for (i = 0; i < ARRAY_COUNT(filemenu_hudElemIDs); i++) { filemenu_hudElemIDs[i] = hud_element_create(filemenu_main_hudElemScripts[gCurrentLanguage][i]); @@ -816,39 +829,39 @@ void filemenu_main_init(MenuPanel* menu) { setup_pause_menu_tab(filemenu_main_windowBPs, ARRAY_COUNT(filemenu_main_windowBPs)); menu->selected = MENU_PANEL_SELECTED_GRID_DATA(menu); - if (menu->page == 2) { - gWindows[WINDOW_ID_FILEMENU_TITLE].pos.y = 1; - gWindows[WINDOW_ID_FILEMENU_TITLE].width = 211; - gWindows[WINDOW_ID_FILEMENU_TITLE].height = 25; + if (menu->state == FM_MAIN_SELECT_LANGUAGE) { + gWindows[WIN_FILES_TITLE].pos.y = 1; + gWindows[WIN_FILES_TITLE].width = 211; + gWindows[WIN_FILES_TITLE].height = 25; } else { - gWindows[WINDOW_ID_FILEMENU_TITLE].pos.y = 1; - gWindows[WINDOW_ID_FILEMENU_TITLE].width = 162; - gWindows[WINDOW_ID_FILEMENU_TITLE].height = 25; + gWindows[WIN_FILES_TITLE].pos.y = 1; + gWindows[WIN_FILES_TITLE].width = 162; + gWindows[WIN_FILES_TITLE].height = 25; } - halfWidth = gWindows[WINDOW_ID_FILEMENU_TITLE].width / 2; - posXPtr = &gWindows[WINDOW_ID_FILEMENU_TITLE].pos.x; - if (gWindows[WINDOW_ID_FILEMENU_TITLE].parent != -1) { - x = (gWindows[gWindows[WINDOW_ID_FILEMENU_TITLE].parent].width / 2) - halfWidth; + halfWidth = gWindows[WIN_FILES_TITLE].width / 2; + posXPtr = &gWindows[WIN_FILES_TITLE].pos.x; + if (gWindows[WIN_FILES_TITLE].parent != WIN_NONE) { + x = (gWindows[gWindows[WIN_FILES_TITLE].parent].width / 2) - halfWidth; } else { x = SCREEN_WIDTH / 2 - halfWidth; } *posXPtr = x; - halfWidth2 = gWindows[WINDOW_ID_FILEMENU_OPTION_CENTER].width / 2; - posXPtr = &gWindows[WINDOW_ID_FILEMENU_OPTION_CENTER].pos.x; - if (gWindows[WINDOW_ID_FILEMENU_OPTION_CENTER].parent != -1) { - x = (gWindows[gWindows[WINDOW_ID_FILEMENU_OPTION_CENTER].parent].width / 2) - halfWidth2; + halfWidth2 = gWindows[WIN_FILES_OPTION_CENTER].width / 2; + posXPtr = &gWindows[WIN_FILES_OPTION_CENTER].pos.x; + if (gWindows[WIN_FILES_OPTION_CENTER].parent != WIN_NONE) { + x = (gWindows[gWindows[WIN_FILES_OPTION_CENTER].parent].width / 2) - halfWidth2; } else { x = SCREEN_WIDTH / 2 - halfWidth2; } *posXPtr = x; - if (menu->page != 0) { - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_FILEMENU_STEREO, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_FILEMENU_MONO, WINDOW_UPDATE_HIDE); + if (menu->state != FM_MAIN_SELECT_FILE) { + set_window_update(WIN_FILES_OPTION_LEFT, WINDOW_UPDATE_HIDE); + set_window_update(WIN_FILES_OPTION_RIGHT, WINDOW_UPDATE_HIDE); + set_window_update(WIN_FILES_STEREO, WINDOW_UPDATE_HIDE); + set_window_update(WIN_FILES_MONO, WINDOW_UPDATE_HIDE); } menu->initialized = 1; } @@ -902,40 +915,22 @@ void filemenu_main_handle_input(MenuPanel* menu) { } } - switch (menu->page) { - case 0: - if (menu->col == 1 && (u8) menu->row < 2) { - menu->col = 0; - } - break; - case 1: // TODO required to duplicate cases 1-4 instead of using fallthrough - if (menu->col == 1 && (u8) menu->row < 2) { - menu->col = 0; - } - if (menu->row == 2) { - menu->col = 1; - } - break; - case 2: - if (menu->col == 1 && (u8) menu->row < 2) { - menu->col = 0; - } - if (menu->row == 2) { - menu->col = 1; - } - break; - case 3: + switch (menu->state) { + case FM_MAIN_SELECT_FILE: + // force selection to column 0 when navigating up from bottom row if (menu->col == 1 && (u8) menu->row < 2) { menu->col = 0; } - if (menu->row == 2) { - menu->col = 1; - } break; - case 4: + case FM_MAIN_SELECT_DELETE: + case FM_MAIN_SELECT_LANGUAGE: + case FM_MAIN_SELECT_COPY_FROM: + case FM_MAIN_SELECT_COPY_TO: + // force selection to column 0 when navigating up from bottom row if (menu->col == 1 && (u8) menu->row < 2) { menu->col = 0; } + // force selection to column 1 when navigating down to bottom row if (menu->row == 2) { menu->col = 1; } @@ -947,7 +942,7 @@ void filemenu_main_handle_input(MenuPanel* menu) { sfx_play_sound(SOUND_FILE_MENU_MOVE_CURSOR); } - if (menu->page == 0) { + if (menu->state == FM_MAIN_SELECT_FILE) { s32 originalOutputMode = gGameStatusPtr->soundOutputMode; if (filemenu_pressedButtons & BUTTON_Z) { @@ -967,265 +962,243 @@ void filemenu_main_handle_input(MenuPanel* menu) { } } - if ((filemenu_pressedButtons & BUTTON_START) && menu->page == 0 && menu->selected < 4) { + if ((filemenu_pressedButtons & BUTTON_START) && menu->state == FM_MAIN_SELECT_FILE && menu->selected < 4) { filemenu_pressedButtons = BUTTON_A; } if (filemenu_pressedButtons & BUTTON_A) { - s32 cond = FALSE; - - switch (menu->page) { - case 0: - if (menu->selected < 4 && !gSaveSlotHasData[menu->selected]) { - cond = TRUE; - } - - if (cond) { - MenuPanel* temp_a0; + switch (menu->state) { + case FM_MAIN_SELECT_FILE: + if (menu->selected < 4 && !gSaveSlotMetadata[menu->selected].hasData) { + // selected a file with no data for (i = 0; i < ARRAY_COUNT(filemenu_filename); i++) { - filemenu_filename[i] = 0xF7; + filemenu_filename[i] = MSG_CHAR_READ_SPACE; } filemenu_filename_pos = 0; - set_window_update(WINDOW_ID_FILEMENU_CREATEFILE_HEADER, (s32)filemenu_update_show_name_input); - set_window_update(WINDOW_ID_FILEMENU_KEYBOARD, (s32)filemenu_update_show_name_input); - set_window_update(WINDOW_ID_FILEMENU_TITLE, (s32)filemenu_update_hidden_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_STEREO, (s32)filemenu_update_hidden_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_MONO, (s32)filemenu_update_hidden_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32)filemenu_update_hidden_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_CENTER, (s32)filemenu_update_hidden_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, (s32)filemenu_update_hidden_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32)filemenu_update_hidden_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE0_INFO, (s32)filemenu_update_hidden_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE1_INFO, (s32)filemenu_update_hidden_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE2_INFO, (s32)filemenu_update_hidden_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE3_INFO, (s32)filemenu_update_hidden_with_rotation); + set_window_update(WIN_FILES_INPUT_FIELD, (s32)filemenu_update_show_name_input); + set_window_update(WIN_FILES_INPUT_KEYBOARD, (s32)filemenu_update_show_name_input); + set_window_update(WIN_FILES_TITLE, (s32)filemenu_update_hidden_with_rotation); + set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_hidden_with_rotation); + set_window_update(WIN_FILES_MONO, (s32)filemenu_update_hidden_with_rotation); + set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_hidden_with_rotation); + set_window_update(WIN_FILES_OPTION_CENTER, (s32)filemenu_update_hidden_with_rotation); + set_window_update(WIN_FILES_OPTION_RIGHT, (s32)filemenu_update_hidden_with_rotation); + set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_hidden_with_rotation); + set_window_update(WIN_FILES_SLOT0_BODY, (s32)filemenu_update_hidden_with_rotation); + set_window_update(WIN_FILES_SLOT1_BODY, (s32)filemenu_update_hidden_with_rotation); + set_window_update(WIN_FILES_SLOT2_BODY, (s32)filemenu_update_hidden_with_rotation); + set_window_update(WIN_FILES_SLOT3_BODY, (s32)filemenu_update_hidden_with_rotation); sfx_play_sound(SOUND_MENU_NEXT); - filemenu_currentMenu = 3; - temp_a0 = filemenu_menus[filemenu_currentMenu]; - temp_a0->page = 0; - filemenu_set_selected(temp_a0, 0, 0); + filemenu_currentMenu = FILE_MENU_INPUT_NAME; + filemenu_menus[FILE_MENU_INPUT_NAME]->state = FM_INPUT_CHARSET_A; + filemenu_set_selected(filemenu_menus[FILE_MENU_INPUT_NAME], 0, 0); break; } if (menu->selected == 6) { - set_window_update(WINDOW_ID_FILEMENU_STEREO, (s32)filemenu_update_hidden_options_left); - set_window_update(WINDOW_ID_FILEMENU_MONO, (s32)filemenu_update_hidden_options_right); - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32)filemenu_update_hidden_options_bottom); - set_window_update(WINDOW_ID_FILEMENU_OPTION_CENTER, (s32)filemenu_update_hidden_options_bottom); - set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, (s32)filemenu_update_hidden_options_bottom); - set_window_update(WINDOW_ID_FILEMENU_FILE0_INFO, (s32)filemenu_update_hidden_options_left); - set_window_update(WINDOW_ID_FILEMENU_FILE1_INFO, (s32)filemenu_update_hidden_options_right); - set_window_update(WINDOW_ID_FILEMENU_FILE2_INFO, (s32)filemenu_update_hidden_options_left); - set_window_update(WINDOW_ID_FILEMENU_FILE3_INFO, (s32)filemenu_update_hidden_options_right); - set_window_update(WINDOW_ID_FILEMENU_TITLE, (s32)filemenu_update_hidden_title); + // selected "Cancel" button + set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_hidden_options_left); + set_window_update(WIN_FILES_MONO, (s32)filemenu_update_hidden_options_right); + set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_hidden_options_bottom); + set_window_update(WIN_FILES_OPTION_CENTER, (s32)filemenu_update_hidden_options_bottom); + set_window_update(WIN_FILES_OPTION_RIGHT, (s32)filemenu_update_hidden_options_bottom); + set_window_update(WIN_FILES_SLOT0_BODY, (s32)filemenu_update_hidden_options_left); + set_window_update(WIN_FILES_SLOT1_BODY, (s32)filemenu_update_hidden_options_right); + set_window_update(WIN_FILES_SLOT2_BODY, (s32)filemenu_update_hidden_options_left); + set_window_update(WIN_FILES_SLOT3_BODY, (s32)filemenu_update_hidden_options_right); + set_window_update(WIN_FILES_TITLE, (s32)filemenu_update_hidden_title); sfx_play_sound(SOUND_FILE_MENU_OUT); set_game_mode(GAME_MODE_END_FILE_SELECT); } else if (menu->selected == 4) { + // selected "Delete File" button sfx_play_sound(SOUND_MENU_NEXT); - menu->page = 1; + menu->state = FM_MAIN_SELECT_DELETE; filemenu_set_selected(menu, 1, 2); - set_window_update(WINDOW_ID_FILEMENU_STEREO, (s32)filemenu_update_hidden_options_left); - set_window_update(WINDOW_ID_FILEMENU_MONO, (s32)filemenu_update_hidden_options_right); - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32)filemenu_update_hidden_options_bottom); - set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, (s32)filemenu_update_hidden_options_bottom); + set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_hidden_options_left); + set_window_update(WIN_FILES_MONO, (s32)filemenu_update_hidden_options_right); + set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_hidden_options_bottom); + set_window_update(WIN_FILES_OPTION_RIGHT, (s32)filemenu_update_hidden_options_bottom); } else if (menu->selected == 5) { + // selected "Copy File" button sfx_play_sound(SOUND_MENU_NEXT); - menu->page = 3; + menu->state = FM_MAIN_SELECT_COPY_FROM; filemenu_set_selected(menu, 1, 2); - set_window_update(WINDOW_ID_FILEMENU_STEREO, (s32)filemenu_update_hidden_options_left); - set_window_update(WINDOW_ID_FILEMENU_MONO, (s32)filemenu_update_hidden_options_right); - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32)filemenu_update_hidden_options_bottom); - set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, (s32)filemenu_update_hidden_options_bottom); + set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_hidden_options_left); + set_window_update(WIN_FILES_MONO, (s32)filemenu_update_hidden_options_right); + set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_hidden_options_bottom); + set_window_update(WIN_FILES_OPTION_RIGHT, (s32)filemenu_update_hidden_options_bottom); } else if (menu->selected < 4) { - MenuPanel* temp_a0; - + // selected a file sfx_play_sound(SOUND_MENU_NEXT); - set_window_update(WINDOW_ID_FILEMENU_TITLE, (s32)filemenu_update_hidden_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_STEREO, (s32)filemenu_update_hidden_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_MONO, (s32)filemenu_update_hidden_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32)filemenu_update_hidden_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_CENTER, (s32)filemenu_update_hidden_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, (s32)filemenu_update_hidden_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32)filemenu_update_hidden_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE0_INFO, (s32)filemenu_update_hidden_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE1_INFO, (s32)filemenu_update_hidden_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE2_INFO, (s32)filemenu_update_hidden_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE3_INFO, (s32)filemenu_update_hidden_with_rotation); - set_window_update(menu->selected + WINDOW_ID_FILEMENU_FILE0_INFO, (s32)filemenu_update_select_file); + set_window_update(WIN_FILES_TITLE, (s32)filemenu_update_hidden_with_rotation); + set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_hidden_with_rotation); + set_window_update(WIN_FILES_MONO, (s32)filemenu_update_hidden_with_rotation); + set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_hidden_with_rotation); + set_window_update(WIN_FILES_OPTION_CENTER, (s32)filemenu_update_hidden_with_rotation); + set_window_update(WIN_FILES_OPTION_RIGHT, (s32)filemenu_update_hidden_with_rotation); + set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_hidden_with_rotation); + set_window_update(WIN_FILES_SLOT0_BODY, (s32)filemenu_update_hidden_with_rotation); + set_window_update(WIN_FILES_SLOT1_BODY, (s32)filemenu_update_hidden_with_rotation); + set_window_update(WIN_FILES_SLOT2_BODY, (s32)filemenu_update_hidden_with_rotation); + set_window_update(WIN_FILES_SLOT3_BODY, (s32)filemenu_update_hidden_with_rotation); + set_window_update(menu->selected + WIN_FILES_SLOT0_BODY, (s32)filemenu_update_select_file); sfx_play_sound(SOUND_MENU_NEXT); - set_window_update(WINDOW_ID_FILEMENU_YESNO_OPTIONS, WINDOW_UPDATE_SHOW); - - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].pos.y = 143; - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].width = 69; - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].height = 44; - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].pos.x = ((gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].parent].width / 2) - : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].width / 2; - - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].pos.y = -29; - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].width = 192; - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].height = 25; - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].pos.x = ((gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].parent].width / 2) - : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].width / 2; - - filemenu_currentMenu = 1; - temp_a0 = filemenu_menus[filemenu_currentMenu]; - temp_a0->page = 4; - filemenu_set_selected(temp_a0, 0, 0); + set_window_update(WIN_FILES_CONFIRM_OPTIONS, WINDOW_UPDATE_SHOW); + + gWindows[WIN_FILES_CONFIRM_OPTIONS].pos.y = 143; + gWindows[WIN_FILES_CONFIRM_OPTIONS].width = 69; + gWindows[WIN_FILES_CONFIRM_OPTIONS].height = 44; + gWindows[WIN_FILES_CONFIRM_OPTIONS].pos.x = CENTER_WINDOW_X(WIN_FILES_CONFIRM_OPTIONS); + + gWindows[WIN_FILES_CONFIRM_PROMPT].pos.y = -29; + gWindows[WIN_FILES_CONFIRM_PROMPT].width = 192; + gWindows[WIN_FILES_CONFIRM_PROMPT].height = 25; + gWindows[WIN_FILES_CONFIRM_PROMPT].pos.x = CENTER_WINDOW_X(WIN_FILES_CONFIRM_PROMPT); + + filemenu_currentMenu = FILE_MENU_CONFIRM; + filemenu_menus[FILE_MENU_CONFIRM]->state = FM_CONFIRM_START; + if (gSaveSlotMetadata[menu->selected].validData) { + filemenu_set_selected(filemenu_menus[FILE_MENU_CONFIRM], 0, 0); + } else { + filemenu_set_selected(filemenu_menus[FILE_MENU_CONFIRM], 0, 1); + } } break; - case 1: + case FM_MAIN_SELECT_DELETE: if (menu->selected == 6) { + // selected "Cancel" button sfx_play_sound(SOUND_MENU_NEXT); - menu->page = 0; - set_window_update(WINDOW_ID_FILEMENU_STEREO, (s32)filemenu_update_show_options_left); - set_window_update(WINDOW_ID_FILEMENU_MONO, (s32)filemenu_update_show_options_right); - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32)filemenu_update_show_options_bottom); - set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, (s32)filemenu_update_show_options_bottom); + menu->state = FM_MAIN_SELECT_FILE; + set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_show_options_left); + set_window_update(WIN_FILES_MONO, (s32)filemenu_update_show_options_right); + set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_show_options_bottom); + set_window_update(WIN_FILES_OPTION_RIGHT, (s32)filemenu_update_show_options_bottom); filemenu_set_selected(menu, 0, 2); } else if (menu->selected < 4) { - if (gSaveSlotHasData[menu->selected]) { - MenuPanel* temp_a0; - + // selected a file + if (gSaveSlotMetadata[menu->selected].hasData) { sfx_play_sound(SOUND_MENU_NEXT); - set_window_update(WINDOW_ID_FILEMENU_YESNO_OPTIONS, (s32)filemenu_update_show_name_confirm); - - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].pos.y = 121; - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].width = 69; - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].height = 44; - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].pos.x = ((gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].parent].width / 2) - : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].width / 2; - - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].pos.y = -29; - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].width = 118; - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].height = 25; - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].pos.x = ((gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].parent].width / 2) - : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].width / 2; - - filemenu_currentMenu = 1; - temp_a0 = filemenu_menus[filemenu_currentMenu]; - temp_a0->page = 0; - filemenu_set_selected(temp_a0, 0, 1); + set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_show_name_confirm); + + gWindows[WIN_FILES_CONFIRM_OPTIONS].pos.y = 121; + gWindows[WIN_FILES_CONFIRM_OPTIONS].width = 69; + gWindows[WIN_FILES_CONFIRM_OPTIONS].height = 44; + gWindows[WIN_FILES_CONFIRM_OPTIONS].pos.x = CENTER_WINDOW_X(WIN_FILES_CONFIRM_OPTIONS); + + gWindows[WIN_FILES_CONFIRM_PROMPT].pos.y = -29; + gWindows[WIN_FILES_CONFIRM_PROMPT].width = 118; + gWindows[WIN_FILES_CONFIRM_PROMPT].height = 25; + gWindows[WIN_FILES_CONFIRM_PROMPT].pos.x = CENTER_WINDOW_X(WIN_FILES_CONFIRM_PROMPT); + + filemenu_currentMenu = FILE_MENU_CONFIRM; + filemenu_menus[FILE_MENU_CONFIRM]->state = FM_CONFIRM_DELETE; + filemenu_set_selected(filemenu_menus[FILE_MENU_CONFIRM], 0, 1); } else { sfx_play_sound(SOUND_MENU_ERROR); } } break; - case 3: + case FM_MAIN_SELECT_COPY_FROM: if (menu->selected == 6) { + // selected "Cancel" button sfx_play_sound(SOUND_MENU_NEXT); - menu->page = 0; - set_window_update(WINDOW_ID_FILEMENU_STEREO, (s32)filemenu_update_show_options_left); - set_window_update(WINDOW_ID_FILEMENU_MONO, (s32)filemenu_update_show_options_right); - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32)filemenu_update_show_options_bottom); - set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, (s32)filemenu_update_show_options_bottom); + menu->state = FM_MAIN_SELECT_FILE; + set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_show_options_left); + set_window_update(WIN_FILES_MONO, (s32)filemenu_update_show_options_right); + set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_show_options_bottom); + set_window_update(WIN_FILES_OPTION_RIGHT, (s32)filemenu_update_show_options_bottom); filemenu_set_selected(menu, 0, 1); } else if (menu->selected < 4) { - if (gSaveSlotHasData[menu->selected]) { + // selected a file + if (gSaveSlotMetadata[menu->selected].hasData) { sfx_play_sound(SOUND_MENU_NEXT); - menu->page = 4; - filemenu_loadedFileIdx = menu->selected; + menu->state = FM_MAIN_SELECT_COPY_TO; + filemenu_CopyFromFileIdx = menu->selected; } else { sfx_play_sound(SOUND_MENU_ERROR); } } break; - case 4: + case FM_MAIN_SELECT_COPY_TO: if (menu->selected == 6) { + // selected "Cancel" button sfx_play_sound(SOUND_MENU_NEXT); - menu->page = 3; + menu->state = FM_MAIN_SELECT_COPY_FROM; filemenu_set_selected(menu, 0, 2); } else if (menu->selected < 4) { - if (filemenu_loadedFileIdx == menu->selected) { + // selected a file + if (filemenu_CopyFromFileIdx == menu->selected) { sfx_play_sound(SOUND_MENU_ERROR); } else { - filemenu_iterFileIdx = menu->selected; - if (!gSaveSlotHasData[menu->selected]) { + filemenu_CopyToFileIdx = menu->selected; + if (!gSaveSlotMetadata[menu->selected].hasData) { sfx_play_sound(SOUND_MENU_NEXT); - filemenu_currentMenu = 2; - filemenu_menus[filemenu_currentMenu]->page = 2; - gWindows[WINDOW_ID_FILEMENU_INFO].width = 154; - gWindows[WINDOW_ID_FILEMENU_INFO].height = 39; - gWindows[WINDOW_ID_FILEMENU_INFO].pos.x = ((gWindows[WINDOW_ID_FILEMENU_INFO].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_INFO].parent].width / 2) - : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_INFO].width / 2; - gWindows[WINDOW_ID_FILEMENU_INFO].pos.y = ((gWindows[WINDOW_ID_FILEMENU_INFO].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_INFO].parent].height / 2) - : SCREEN_HEIGHT / 2) - gWindows[WINDOW_ID_FILEMENU_INFO].height / 2; - - set_window_update(WINDOW_ID_FILEMENU_INFO, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_FILEMENU_YESNO_OPTIONS, WINDOW_UPDATE_HIDE); - fio_load_game(filemenu_loadedFileIdx); - gFilesDisplayData[filemenu_iterFileIdx] = gFilesDisplayData[filemenu_loadedFileIdx]; - fio_save_game(filemenu_iterFileIdx); - gSaveSlotHasData[filemenu_iterFileIdx] = TRUE; + filemenu_currentMenu = FILE_MENU_MESSAGE; + filemenu_menus[FILE_MENU_MESSAGE]->state = FM_MESSAGE_COPIED; + gWindows[WIN_FILES_MESSAGE].width = 154; + gWindows[WIN_FILES_MESSAGE].height = 39; + gWindows[WIN_FILES_MESSAGE].pos.x = CENTER_WINDOW_X(WIN_FILES_MESSAGE); + gWindows[WIN_FILES_MESSAGE].pos.y = CENTER_WINDOW_Y(WIN_FILES_MESSAGE); + + set_window_update(WIN_FILES_MESSAGE, WINDOW_UPDATE_SHOW); + set_window_update(WIN_FILES_CONFIRM_OPTIONS, WINDOW_UPDATE_HIDE); + fio_load_game(filemenu_CopyFromFileIdx); + gSaveSlotSummary[filemenu_CopyToFileIdx] = gSaveSlotSummary[filemenu_CopyFromFileIdx]; + gSaveSlotMetadata[filemenu_CopyToFileIdx] = gSaveSlotMetadata[filemenu_CopyFromFileIdx]; + fio_save_game(filemenu_CopyToFileIdx); } else { - MenuPanel* temp_a0; - sfx_play_sound(SOUND_MENU_NEXT); - set_window_update(WINDOW_ID_FILEMENU_YESNO_OPTIONS, (s32)filemenu_update_show_name_confirm); - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].pos.y = 121; - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].width = 69; - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].height = 44; - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].pos.x = ((gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].parent].width / 2) - : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].width / 2; - - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].pos.y = -43; - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].width = 182; - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].height = 39; - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].pos.x = ((gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].parent].width / 2) - : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].width / 2; - - filemenu_currentMenu = 1; - temp_a0 = filemenu_menus[filemenu_currentMenu]; - temp_a0->page = 3; - filemenu_set_selected(temp_a0, 0, 1); + set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_show_name_confirm); + gWindows[WIN_FILES_CONFIRM_OPTIONS].pos.y = 121; + gWindows[WIN_FILES_CONFIRM_OPTIONS].width = 69; + gWindows[WIN_FILES_CONFIRM_OPTIONS].height = 44; + gWindows[WIN_FILES_CONFIRM_OPTIONS].pos.x = CENTER_WINDOW_X(WIN_FILES_CONFIRM_OPTIONS); + + gWindows[WIN_FILES_CONFIRM_PROMPT].pos.y = -43; + gWindows[WIN_FILES_CONFIRM_PROMPT].width = 182; + gWindows[WIN_FILES_CONFIRM_PROMPT].height = 39; + gWindows[WIN_FILES_CONFIRM_PROMPT].pos.x = CENTER_WINDOW_X(WIN_FILES_CONFIRM_PROMPT); + + filemenu_currentMenu = FILE_MENU_CONFIRM; + filemenu_menus[FILE_MENU_CONFIRM]->state = FM_CONFIRM_COPY; + filemenu_set_selected(filemenu_menus[FILE_MENU_CONFIRM], 0, 1); } } } break; - case 2: + case FM_MAIN_SELECT_LANGUAGE: if (menu->selected == 6) { + // selected "Cancel" button sfx_play_sound(SOUND_MENU_NEXT); set_game_mode(GAME_MODE_END_LANGUAGE_SELECT); } else if (menu->selected < 4) { - if (!gSaveSlotHasData[menu->selected]) { + // selected a file + // (just a dummy placeholder implementation) + if (!gSaveSlotMetadata[menu->selected].hasData) { sfx_play_sound(SOUND_MENU_NEXT); - filemenu_currentMenu = 2; - filemenu_menus[filemenu_currentMenu]->page = 1; - set_window_update(WINDOW_ID_FILEMENU_MAIN, (s32)main_menu_window_update); - set_window_update(WINDOW_ID_FILEMENU_INFO, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_FILEMENU_YESNO_OPTIONS, WINDOW_UPDATE_HIDE); + filemenu_currentMenu = FILE_MENU_MESSAGE; + filemenu_menus[FILE_MENU_MESSAGE]->state = FM_MESSAGE_LANGUAGE; + set_window_update(WIN_FILES_MAIN, (s32)unused_main_menu_window_darkening); + set_window_update(WIN_FILES_MESSAGE, WINDOW_UPDATE_SHOW); + set_window_update(WIN_FILES_CONFIRM_OPTIONS, WINDOW_UPDATE_HIDE); fio_save_game(menu->selected); - gSaveSlotHasData[menu->selected] = TRUE; + gSaveSlotMetadata[menu->selected].hasData = TRUE; } else { - MenuPanel* temp_a0; - sfx_play_sound(SOUND_MENU_NEXT); - set_window_update(WINDOW_ID_FILEMENU_YESNO_OPTIONS, (s32)filemenu_update_show_name_confirm); - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].pos.y = 127; - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].width = 69; - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].height = 44; - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].pos.x = ((gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].parent].width / 2) - : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_YESNO_OPTIONS].width / 2; - - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].pos.y = -50; - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].width = 148; - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].height = 38; - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].pos.x = ((gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].parent].width / 2) - : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_YESNO_PROMPT].width / 2; - - filemenu_currentMenu = 1; - temp_a0 = filemenu_menus[filemenu_currentMenu]; - temp_a0->page = 1; - filemenu_set_selected(temp_a0, 0, 1); + set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_show_name_confirm); + gWindows[WIN_FILES_CONFIRM_OPTIONS].pos.y = 127; + gWindows[WIN_FILES_CONFIRM_OPTIONS].width = 69; + gWindows[WIN_FILES_CONFIRM_OPTIONS].height = 44; + gWindows[WIN_FILES_CONFIRM_OPTIONS].pos.x = CENTER_WINDOW_X(WIN_FILES_CONFIRM_OPTIONS); + + gWindows[WIN_FILES_CONFIRM_PROMPT].pos.y = -50; + gWindows[WIN_FILES_CONFIRM_PROMPT].width = 148; + gWindows[WIN_FILES_CONFIRM_PROMPT].height = 38; + gWindows[WIN_FILES_CONFIRM_PROMPT].pos.x = CENTER_WINDOW_X(WIN_FILES_CONFIRM_PROMPT); + + filemenu_currentMenu = FILE_MENU_CONFIRM; + filemenu_menus[FILE_MENU_CONFIRM]->state = FM_CONFIRM_LANGUAGE; + filemenu_set_selected(filemenu_menus[FILE_MENU_CONFIRM], 0, 1); } } break; @@ -1233,63 +1206,63 @@ void filemenu_main_handle_input(MenuPanel* menu) { } if (filemenu_pressedButtons & BUTTON_B) { - switch (menu->page) { - case 0: + switch (menu->state) { + case FM_MAIN_SELECT_FILE: filemenu_set_selected(menu, 2, 2); break; - case 1: + case FM_MAIN_SELECT_DELETE: filemenu_set_selected(menu, 1, 2); break; - case 2: + case FM_MAIN_SELECT_LANGUAGE: filemenu_set_selected(menu, 1, 2); break; - case 3: + case FM_MAIN_SELECT_COPY_FROM: filemenu_set_selected(menu, 1, 2); break; - case 4: + case FM_MAIN_SELECT_COPY_TO: filemenu_set_selected(menu, 1, 2); break; } - switch (menu->page) { - case 0: - set_window_update(WINDOW_ID_FILEMENU_STEREO, (s32)filemenu_update_hidden_options_left); - set_window_update(WINDOW_ID_FILEMENU_MONO, (s32)filemenu_update_hidden_options_right); - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32)filemenu_update_hidden_options_bottom); - set_window_update(WINDOW_ID_FILEMENU_OPTION_CENTER, (s32)filemenu_update_hidden_options_bottom); - set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, (s32)filemenu_update_hidden_options_bottom); - set_window_update(WINDOW_ID_FILEMENU_FILE0_INFO, (s32)filemenu_update_hidden_options_left); - set_window_update(WINDOW_ID_FILEMENU_FILE1_INFO, (s32)filemenu_update_hidden_options_right); - set_window_update(WINDOW_ID_FILEMENU_FILE2_INFO, (s32)filemenu_update_hidden_options_left); - set_window_update(WINDOW_ID_FILEMENU_FILE3_INFO, (s32)filemenu_update_hidden_options_right); - set_window_update(WINDOW_ID_FILEMENU_TITLE, (s32)filemenu_update_hidden_title); + switch (menu->state) { + case FM_MAIN_SELECT_FILE: + set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_hidden_options_left); + set_window_update(WIN_FILES_MONO, (s32)filemenu_update_hidden_options_right); + set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_hidden_options_bottom); + set_window_update(WIN_FILES_OPTION_CENTER, (s32)filemenu_update_hidden_options_bottom); + set_window_update(WIN_FILES_OPTION_RIGHT, (s32)filemenu_update_hidden_options_bottom); + set_window_update(WIN_FILES_SLOT0_BODY, (s32)filemenu_update_hidden_options_left); + set_window_update(WIN_FILES_SLOT1_BODY, (s32)filemenu_update_hidden_options_right); + set_window_update(WIN_FILES_SLOT2_BODY, (s32)filemenu_update_hidden_options_left); + set_window_update(WIN_FILES_SLOT3_BODY, (s32)filemenu_update_hidden_options_right); + set_window_update(WIN_FILES_TITLE, (s32)filemenu_update_hidden_title); sfx_play_sound(SOUND_FILE_MENU_OUT); set_game_mode(GAME_MODE_END_FILE_SELECT); break; - case 1: - menu->page = 0; + case FM_MAIN_SELECT_DELETE: + menu->state = FM_MAIN_SELECT_FILE; filemenu_set_selected(menu, 0, 2); - set_window_update(WINDOW_ID_FILEMENU_STEREO, (s32)filemenu_update_show_options_left); - set_window_update(WINDOW_ID_FILEMENU_MONO, (s32)filemenu_update_show_options_right); - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32)filemenu_update_show_options_bottom); - set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, (s32)filemenu_update_show_options_bottom); + set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_show_options_left); + set_window_update(WIN_FILES_MONO, (s32)filemenu_update_show_options_right); + set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_show_options_bottom); + set_window_update(WIN_FILES_OPTION_RIGHT, (s32)filemenu_update_show_options_bottom); sfx_play_sound(SOUND_MENU_BACK); break; - case 3: - menu->page = 0; + case FM_MAIN_SELECT_COPY_FROM: + menu->state = FM_MAIN_SELECT_FILE; filemenu_set_selected(menu, 1, 2); - set_window_update(WINDOW_ID_FILEMENU_STEREO, (s32)filemenu_update_show_options_left); - set_window_update(WINDOW_ID_FILEMENU_MONO, (s32)filemenu_update_show_options_right); - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32)filemenu_update_show_options_bottom); - set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, (s32)filemenu_update_show_options_bottom); + set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_show_options_left); + set_window_update(WIN_FILES_MONO, (s32)filemenu_update_show_options_right); + set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_show_options_bottom); + set_window_update(WIN_FILES_OPTION_RIGHT, (s32)filemenu_update_show_options_bottom); sfx_play_sound(SOUND_MENU_BACK); break; - case 4: - menu->page = 3; - filemenu_set_selected(menu, (filemenu_loadedFileIdx % 2) * 2, filemenu_loadedFileIdx / 2); + case FM_MAIN_SELECT_COPY_TO: + menu->state = FM_MAIN_SELECT_COPY_FROM; + filemenu_set_selected(menu, (filemenu_CopyFromFileIdx % 2) * 2, filemenu_CopyFromFileIdx / 2); sfx_play_sound(SOUND_MENU_BACK); break; - case 2: + case FM_MAIN_SELECT_LANGUAGE: sfx_play_sound(SOUND_MENU_BACK); set_game_mode(GAME_MODE_END_LANGUAGE_SELECT); break; @@ -1299,51 +1272,54 @@ void filemenu_main_handle_input(MenuPanel* menu) { #endif void filemenu_main_update(MenuPanel* menu) { - gWindowStyles[WINDOW_ID_FILEMENU_FILE0_INFO].customStyle = &filemenu_windowStyles[15]; - gWindowStyles[WINDOW_ID_FILEMENU_FILE1_INFO].customStyle = &filemenu_windowStyles[15]; - gWindowStyles[WINDOW_ID_FILEMENU_FILE2_INFO].customStyle = &filemenu_windowStyles[15]; - gWindowStyles[WINDOW_ID_FILEMENU_FILE3_INFO].customStyle = &filemenu_windowStyles[15]; - gWindowStyles[WINDOW_ID_FILEMENU_FILE0_TITLE].customStyle = &filemenu_windowStyles[17]; - gWindowStyles[WINDOW_ID_FILEMENU_FILE1_TITLE].customStyle = &filemenu_windowStyles[17]; - gWindowStyles[WINDOW_ID_FILEMENU_FILE2_TITLE].customStyle = &filemenu_windowStyles[17]; - gWindowStyles[WINDOW_ID_FILEMENU_FILE3_TITLE].customStyle = &filemenu_windowStyles[17]; - + // set default styles for all file slot panels + gWindowStyles[WIN_FILES_SLOT0_BODY].customStyle = &filemenu_windowStyles[15]; + gWindowStyles[WIN_FILES_SLOT1_BODY].customStyle = &filemenu_windowStyles[15]; + gWindowStyles[WIN_FILES_SLOT2_BODY].customStyle = &filemenu_windowStyles[15]; + gWindowStyles[WIN_FILES_SLOT3_BODY].customStyle = &filemenu_windowStyles[15]; + gWindowStyles[WIN_FILES_SLOT0_TITLE].customStyle = &filemenu_windowStyles[17]; + gWindowStyles[WIN_FILES_SLOT1_TITLE].customStyle = &filemenu_windowStyles[17]; + gWindowStyles[WIN_FILES_SLOT2_TITLE].customStyle = &filemenu_windowStyles[17]; + gWindowStyles[WIN_FILES_SLOT3_TITLE].customStyle = &filemenu_windowStyles[17]; + + // modify style for selected file slot panel to add highlight switch (menu->selected) { case 0: - gWindowStyles[WINDOW_ID_FILEMENU_FILE0_INFO].customStyle = &filemenu_windowStyles[16]; - gWindowStyles[WINDOW_ID_FILEMENU_FILE0_TITLE].customStyle = &filemenu_windowStyles[18]; + gWindowStyles[WIN_FILES_SLOT0_BODY].customStyle = &filemenu_windowStyles[16]; + gWindowStyles[WIN_FILES_SLOT0_TITLE].customStyle = &filemenu_windowStyles[18]; break; case 1: - gWindowStyles[WINDOW_ID_FILEMENU_FILE1_INFO].customStyle = &filemenu_windowStyles[16]; - gWindowStyles[WINDOW_ID_FILEMENU_FILE1_TITLE].customStyle = &filemenu_windowStyles[18]; + gWindowStyles[WIN_FILES_SLOT1_BODY].customStyle = &filemenu_windowStyles[16]; + gWindowStyles[WIN_FILES_SLOT1_TITLE].customStyle = &filemenu_windowStyles[18]; break; case 2: - gWindowStyles[WINDOW_ID_FILEMENU_FILE2_INFO].customStyle = &filemenu_windowStyles[16]; - gWindowStyles[WINDOW_ID_FILEMENU_FILE2_TITLE].customStyle = &filemenu_windowStyles[18]; + gWindowStyles[WIN_FILES_SLOT2_BODY].customStyle = &filemenu_windowStyles[16]; + gWindowStyles[WIN_FILES_SLOT2_TITLE].customStyle = &filemenu_windowStyles[18]; break; case 3: - gWindowStyles[WINDOW_ID_FILEMENU_FILE3_INFO].customStyle = &filemenu_windowStyles[16]; - gWindowStyles[WINDOW_ID_FILEMENU_FILE3_TITLE].customStyle = &filemenu_windowStyles[18]; + gWindowStyles[WIN_FILES_SLOT3_BODY].customStyle = &filemenu_windowStyles[16]; + gWindowStyles[WIN_FILES_SLOT3_TITLE].customStyle = &filemenu_windowStyles[18]; break; } - if (filemenu_menus[0]->page == PAGE_4) { - switch (filemenu_loadedFileIdx) { + // alsoadd highlight to "copy to" target + if (filemenu_menus[FILE_MENU_MAIN]->state == FM_MAIN_SELECT_COPY_TO) { + switch (filemenu_CopyFromFileIdx) { case 0: - gWindowStyles[WINDOW_ID_FILEMENU_FILE0_INFO].customStyle = &filemenu_windowStyles[16]; - gWindowStyles[WINDOW_ID_FILEMENU_FILE0_TITLE].customStyle = &filemenu_windowStyles[18]; + gWindowStyles[WIN_FILES_SLOT0_BODY].customStyle = &filemenu_windowStyles[16]; + gWindowStyles[WIN_FILES_SLOT0_TITLE].customStyle = &filemenu_windowStyles[18]; return; case 1: - gWindowStyles[WINDOW_ID_FILEMENU_FILE1_INFO].customStyle = &filemenu_windowStyles[16]; - gWindowStyles[WINDOW_ID_FILEMENU_FILE1_TITLE].customStyle = &filemenu_windowStyles[18]; + gWindowStyles[WIN_FILES_SLOT1_BODY].customStyle = &filemenu_windowStyles[16]; + gWindowStyles[WIN_FILES_SLOT1_TITLE].customStyle = &filemenu_windowStyles[18]; return; case 2: - gWindowStyles[WINDOW_ID_FILEMENU_FILE2_INFO].customStyle = &filemenu_windowStyles[16]; - gWindowStyles[WINDOW_ID_FILEMENU_FILE2_TITLE].customStyle = &filemenu_windowStyles[18]; + gWindowStyles[WIN_FILES_SLOT2_BODY].customStyle = &filemenu_windowStyles[16]; + gWindowStyles[WIN_FILES_SLOT2_TITLE].customStyle = &filemenu_windowStyles[18]; return; case 3: - gWindowStyles[WINDOW_ID_FILEMENU_FILE3_INFO].customStyle = &filemenu_windowStyles[16]; - gWindowStyles[WINDOW_ID_FILEMENU_FILE3_TITLE].customStyle = &filemenu_windowStyles[18]; + gWindowStyles[WIN_FILES_SLOT3_BODY].customStyle = &filemenu_windowStyles[16]; + gWindowStyles[WIN_FILES_SLOT3_TITLE].customStyle = &filemenu_windowStyles[18]; return; } } diff --git a/src/filemenu/filemenu_selectlanguage.c b/src/filemenu/filemenu_selectlanguage.c index 7ff4621800..629b1d96c0 100644 --- a/src/filemenu/filemenu_selectlanguage.c +++ b/src/filemenu/filemenu_selectlanguage.c @@ -64,7 +64,7 @@ void filemenu_selectlanguage_update(MenuPanel*); MenuWindowBP D_filemenu_8024F1D8[] = { { - .windowID = WINDOW_ID_FILEMENU_TITLE, + .windowID = WIN_FILES_TITLE, .unk_01 = 0, .pos = { .x = 0, .y = 0 }, .width = 0, @@ -72,13 +72,13 @@ MenuWindowBP D_filemenu_8024F1D8[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &filemenu_draw_pal_8024d6a0, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_MAIN, + .parentID = WIN_FILES_MAIN, .fpUpdate = { .func=&filemenu_update_show_title }, .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[3] } }, { - .windowID = WINDOW_ID_FILEMENU_FILE2_INFO, + .windowID = WIN_FILES_SLOT2_BODY, .unk_01 = 0, .pos = { .x = 89, .y = 98 }, .width = 110, @@ -86,13 +86,13 @@ MenuWindowBP D_filemenu_8024F1D8[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &filemenu_draw_pal_8024DA50, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_MAIN, + .parentID = WIN_FILES_MAIN, .fpUpdate = { .func=&filemenu_update_pal_80247f40 }, .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[9] } }, { - .windowID = WINDOW_ID_FILEMENU_FILE3_INFO, + .windowID = WIN_FILES_SLOT3_BODY, .unk_01 = 0, .pos = { .x = 89, .y = 124 }, .width = 110, @@ -100,13 +100,13 @@ MenuWindowBP D_filemenu_8024F1D8[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &filemenu_draw_pal_8024DAA0, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_MAIN, + .parentID = WIN_FILES_MAIN, .fpUpdate = { .func=&filemenu_update_pal_80247f40 }, .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[10] } }, { - .windowID = WINDOW_ID_FILEMENU_FILE0_INFO, + .windowID = WIN_FILES_SLOT0_BODY, .unk_01 = 0, .pos = { .x = 89, .y = 46 }, .width = 110, @@ -114,13 +114,13 @@ MenuWindowBP D_filemenu_8024F1D8[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &filemenu_draw_pal_8024D9B0, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_MAIN, + .parentID = WIN_FILES_MAIN, .fpUpdate = { .func=&filemenu_update_pal_80247f40 }, .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[7] } }, { - .windowID = WINDOW_ID_FILEMENU_FILE1_INFO, + .windowID = WIN_FILES_SLOT1_BODY, .unk_01 = 0, .pos = { .x = 89, .y = 72 }, .width = 110, @@ -128,7 +128,7 @@ MenuWindowBP D_filemenu_8024F1D8[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &filemenu_draw_pal_8024DA00, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_MAIN, + .parentID = WIN_FILES_MAIN, .fpUpdate = { .func=&filemenu_update_pal_80247f40 }, .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[8] } @@ -140,7 +140,7 @@ MenuPanel filemenu_selectlanguage_menuBP = { .col = 0, .row = 0, .selected = 0, - .page = 0, + .state = 0, .numCols =1, .numRows = 4, .numPages = 0, @@ -155,19 +155,19 @@ void filemenu_draw_pal_8024d6a0(MenuPanel* menu, s32 baseX, s32 baseY, s32 width draw_msg(MSG_PAL_Menu_0055, baseX + (192 - get_msg_width(MSG_PAL_Menu_0055, 0)) / 2, baseY + 4, 255, 0, 0); } -void func_filemenu_8024D710(s32 arg0, MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) { +void func_filemenu_8024D710(s32 language, MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s32 height, s32 opacity, s32 darkening) { s32 var_a1; - if (filemenu_currentMenu == 4 && menu->selected == arg0) { - filemenu_set_cursor_goal_pos(arg0 + 60, baseX + 4, baseY + 10); + if (filemenu_currentMenu == FILE_MENU_LANGUAGES && menu->selected == language) { + filemenu_set_cursor_goal_pos(language + 60, baseX + 4, baseY + 10); } - var_a1 = D_filemenu_8024F130[arg0]; + var_a1 = D_filemenu_8024F130[language]; draw_msg(var_a1, baseX + 36, baseY + 2, 255, 10, 0); gSPDisplayList(gMainGfxPos++, D_filemenu_8024F140); - if (arg0 != gCurrentLanguage) { + if (language != gCurrentLanguage) { gDPSetPrimColor(gMainGfxPos++, 0, 0, 255, 255, 255, 128); gDPSetCombineMode(gMainGfxPos++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); } else { @@ -175,7 +175,7 @@ void func_filemenu_8024D710(s32 arg0, MenuPanel* menu, s32 baseX, s32 baseY, s32 } gDPPipeSync(gMainGfxPos++); - gDPSetTextureImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, &D_802517E0[D_filemenu_8024F124][D_filemenu_8024F1C8[arg0]]); + gDPSetTextureImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, &D_802517E0[D_filemenu_8024F124][D_filemenu_8024F1C8[language]]); gDPSetTile(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0x0000, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); gDPLoadSync(gMainGfxPos++); @@ -221,13 +221,13 @@ void filemenu_selectlanguage_init(MenuPanel* menu) { menu->selected = MENU_PANEL_SELECTED_GRID_DATA(menu); D_802517D4[0] = (s32) menu->row; - gWindows[WINDOW_ID_FILEMENU_TITLE].pos.y = 1; - gWindows[WINDOW_ID_FILEMENU_TITLE].width = 192; - gWindows[WINDOW_ID_FILEMENU_TITLE].height = 25; + gWindows[WIN_FILES_TITLE].pos.y = 1; + gWindows[WIN_FILES_TITLE].width = 192; + gWindows[WIN_FILES_TITLE].height = 25; - posXPtr = &gWindows[WINDOW_ID_FILEMENU_TITLE].pos.x; - if (gWindows[WINDOW_ID_FILEMENU_TITLE].parent != -1) { - x = (gWindows[gWindows[WINDOW_ID_FILEMENU_TITLE].parent].width / 2) - (gWindows[WINDOW_ID_FILEMENU_TITLE].width / 2); + posXPtr = &gWindows[WIN_FILES_TITLE].pos.x; + if (gWindows[WIN_FILES_TITLE].parent != WIN_NONE) { + x = (gWindows[gWindows[WIN_FILES_TITLE].parent].width / 2) - (gWindows[WIN_FILES_TITLE].width / 2); } else { x = 64; } @@ -319,11 +319,11 @@ void filemenu_selectlanguage_handle_input(MenuPanel* menu) { } if ((filemenu_pressedButtons & (BUTTON_A | BUTTON_START)) || (var_s1 != 0)) { - set_window_update(WINDOW_ID_FILEMENU_FILE0_INFO, (s32) &filemenu_selectlanguage_80248018); - set_window_update(WINDOW_ID_FILEMENU_FILE1_INFO, (s32) &filemenu_selectlanguage_80248018); - set_window_update(WINDOW_ID_FILEMENU_FILE2_INFO, (s32) &filemenu_selectlanguage_80248018); - set_window_update(WINDOW_ID_FILEMENU_FILE3_INFO, (s32) &filemenu_selectlanguage_80248018); - set_window_update(WINDOW_ID_FILEMENU_TITLE, (s32) filemenu_update_hidden_title); + set_window_update(WIN_FILES_SLOT0_BODY, (s32) &filemenu_selectlanguage_80248018); + set_window_update(WIN_FILES_SLOT1_BODY, (s32) &filemenu_selectlanguage_80248018); + set_window_update(WIN_FILES_SLOT2_BODY, (s32) &filemenu_selectlanguage_80248018); + set_window_update(WIN_FILES_SLOT3_BODY, (s32) &filemenu_selectlanguage_80248018); + set_window_update(WIN_FILES_TITLE, (s32) filemenu_update_hidden_title); if (var_s1 == 0) { sfx_play_sound(SOUND_PLANTS_BELL); } else { @@ -334,23 +334,23 @@ void filemenu_selectlanguage_handle_input(MenuPanel* menu) { } void filemenu_selectlanguage_update(MenuPanel* menu) { - gWindowStyles[WINDOW_ID_FILEMENU_FILE0_INFO].customStyle = &filemenu_windowStyles[15]; - gWindowStyles[WINDOW_ID_FILEMENU_FILE1_INFO].customStyle = &filemenu_windowStyles[15]; - gWindowStyles[WINDOW_ID_FILEMENU_FILE2_INFO].customStyle = &filemenu_windowStyles[15]; - gWindowStyles[WINDOW_ID_FILEMENU_FILE3_INFO].customStyle = &filemenu_windowStyles[15]; + gWindowStyles[WIN_FILES_SLOT0_BODY].customStyle = &filemenu_windowStyles[15]; + gWindowStyles[WIN_FILES_SLOT1_BODY].customStyle = &filemenu_windowStyles[15]; + gWindowStyles[WIN_FILES_SLOT2_BODY].customStyle = &filemenu_windowStyles[15]; + gWindowStyles[WIN_FILES_SLOT3_BODY].customStyle = &filemenu_windowStyles[15]; switch (menu->selected) { case 0: - gWindowStyles[WINDOW_ID_FILEMENU_FILE0_INFO].customStyle = &filemenu_windowStyles[16]; + gWindowStyles[WIN_FILES_SLOT0_BODY].customStyle = &filemenu_windowStyles[16]; break; case 1: - gWindowStyles[WINDOW_ID_FILEMENU_FILE1_INFO].customStyle = &filemenu_windowStyles[16]; + gWindowStyles[WIN_FILES_SLOT1_BODY].customStyle = &filemenu_windowStyles[16]; break; case 2: - gWindowStyles[WINDOW_ID_FILEMENU_FILE2_INFO].customStyle = &filemenu_windowStyles[16]; + gWindowStyles[WIN_FILES_SLOT2_BODY].customStyle = &filemenu_windowStyles[16]; break; case 3: - gWindowStyles[WINDOW_ID_FILEMENU_FILE3_INFO].customStyle = &filemenu_windowStyles[16]; + gWindowStyles[WIN_FILES_SLOT3_BODY].customStyle = &filemenu_windowStyles[16]; break; } diff --git a/src/filemenu/filemenu_yesno.c b/src/filemenu/filemenu_yesno.c index cbf794d1a7..1511cacbfb 100644 --- a/src/filemenu/filemenu_yesno.c +++ b/src/filemenu/filemenu_yesno.c @@ -40,7 +40,7 @@ u8 filemenu_yesno_gridData[] = { MenuWindowBP filemenu_yesno_windowBPs[] = { { - .windowID = WINDOW_ID_FILEMENU_YESNO_OPTIONS, + .windowID = WIN_FILES_CONFIRM_OPTIONS, .unk_01 = 0, .pos = { .x = 0, .y = 0 }, .width = 0, @@ -54,7 +54,7 @@ MenuWindowBP filemenu_yesno_windowBPs[] = { .style = { .customStyle = &filemenu_windowStyles[19] } }, { - .windowID = WINDOW_ID_FILEMENU_YESNO_PROMPT, + .windowID = WIN_FILES_CONFIRM_PROMPT, .unk_01 = 0, .pos = { .x = 0, .y = 0 }, .width = 0, @@ -62,7 +62,7 @@ MenuWindowBP filemenu_yesno_windowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &filemenu_yesno_draw_prompt_contents, .tab = NULL, - .parentID = WINDOW_ID_FILEMENU_YESNO_OPTIONS, + .parentID = WIN_FILES_CONFIRM_OPTIONS, .fpUpdate = { WINDOW_UPDATE_SHOW }, .extraFlags = 0, .style = { .customStyle = &filemenu_windowStyles[19] } @@ -74,7 +74,7 @@ MenuPanel filemenu_yesno_menuBP = { .col = 0, .row = 0, .selected = 0, - .page = 0, + .state = 0, .numCols = 1, .numRows = 2, .numPages = 0, @@ -98,33 +98,33 @@ void filemenu_yesno_draw_options_contents( s32 cursorGoalXOffset; s32 cursorGoalYOffset; - switch (menu->page) { - case 0: + switch (menu->state) { + case FM_CONFIRM_DELETE: xOffset1 = 28; yOffset1 = 4; xOffset2 = 28; yOffset2 = 21; break; - case 1: + case FM_CONFIRM_LANGUAGE: xOffset1 = 28; yOffset1 = 4; xOffset2 = 28; yOffset2 = 21; break; - case 2: + case FM_CONFIRM_CREATE: xOffset1 = 28; yOffset1 = 4; xOffset2 = 28; yOffset2 = 21; break; - case 3: + case FM_CONFIRM_COPY: xOffset1 = 28; yOffset1 = 4; xOffset2 = 28; yOffset2 = 21; break; #if !VERSION_PAL - case 4: + case FM_CONFIRM_START: xOffset1 = 28; yOffset1 = 4; xOffset2 = 28; @@ -133,10 +133,10 @@ void filemenu_yesno_draw_options_contents( #endif } - filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_YES), baseX + xOffset1, baseY + yOffset1, 0xFF, 0, 0); - filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_NO), baseX + xOffset2, baseY + yOffset2, 0xFF, 0, 0); + filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_YES), baseX + xOffset1, baseY + yOffset1, 255, MSG_PAL_WHITE, 0); + filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_NO), baseX + xOffset2, baseY + yOffset2, 255, MSG_PAL_WHITE, 0); - if (filemenu_currentMenu == 1) { + if (filemenu_currentMenu == FILE_MENU_CONFIRM) { if (menu->selected == 0) { cursorGoalXOffset = xOffset1 - 10; cursorGoalYOffset = yOffset1 + 8; @@ -144,7 +144,7 @@ void filemenu_yesno_draw_options_contents( cursorGoalXOffset = xOffset2 - 10; cursorGoalYOffset = yOffset2 + 8; } - filemenu_set_cursor_goal_pos(WINDOW_ID_FILEMENU_YESNO_OPTIONS, baseX + cursorGoalXOffset, baseY + cursorGoalYOffset); + filemenu_set_cursor_goal_pos(WIN_FILES_CONFIRM_OPTIONS, baseX + cursorGoalXOffset, baseY + cursorGoalYOffset); } } @@ -157,30 +157,32 @@ void filemenu_yesno_draw_prompt_contents( s32 width, s32 height, s32 opacity, s32 darkening ) { + s32 selectedFile; + s32 msgColor; s32 xOffset; s32 i; - switch (menu->page) { - case 0: + switch (menu->state) { + case FM_CONFIRM_DELETE: filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_DELETE), baseX + DELETE_FILE_DELETE_X, baseY + 4, 0xFF, 0, 0); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_22), baseX + DELETE_FILE_FILE_X, baseY + 4, 0xFF, 0, 0); - draw_number(filemenu_menus[0]->selected + 1, baseX + DELETE_FILE_NUMBER_X, baseY + 6 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 0xFF, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); + draw_number(filemenu_menus[FILE_MENU_MAIN]->selected + 1, baseX + DELETE_FILE_NUMBER_X, baseY + 6 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 0xFF, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_QUESTION), baseX + DELETE_FILE_QMARK_X, baseY + 4, 0xFF, 0, 0); break; - case 3: + case FM_CONFIRM_COPY: filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_22), baseX + 10, baseY + 4, 0xFF, 0, 0); - draw_number(filemenu_menus[0]->selected + 1, baseX + COPY_FILE_NUMBER_X, baseY + 6 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 0xFF, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); + draw_number(filemenu_menus[FILE_MENU_MAIN]->selected + 1, baseX + COPY_FILE_NUMBER_X, baseY + 6 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 0xFF, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_WILL_BE_DELETED), baseX + 49, baseY + 4, 0xFF, 0, 0); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_OK_TO_COPY_TO_THIS_FILE), baseX + 10, baseY + 18, 0xFF, 0, 0); break; - case 1: + case FM_CONFIRM_LANGUAGE: filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_OVERRIDE_TO_NEW_DATA), baseX + 10, baseY + 4, 0xFF, 0, 0); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_SAVE_OK), baseX + 10, baseY + 18, 0xFF, 0, 0); break; - case 2: + case FM_CONFIRM_CREATE: filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_NAME_IS), baseX + 10, baseY + 6, 0xFF, 0, 0); for (i = ARRAY_COUNT(filemenu_filename) - 1; i >= 0; i--) { - if (filemenu_filename[i] != 0xF7) { + if (filemenu_filename[i] != MSG_CHAR_READ_SPACE) { break; } } @@ -191,11 +193,17 @@ void filemenu_yesno_draw_prompt_contents( filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_PERIOD_20), baseX + xOffset, baseY + 22, 0xFF, 0, 0); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_OK), baseX + 70, baseY + 38, 0xFF, 0, 0); break; - case 4: - filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_START_GAME_WITH), baseX + START_GAME_START_WITH_X, baseY + 4, 0xFF, 0, 0); - filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_22), baseX + START_GAME_FILE_X, baseY + 4, 0xFF, 0, 0); - draw_number(filemenu_menus[0]->selected + 1, baseX + START_GAME_NUMBER_X, baseY + 6 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_NORMAL, MSG_PAL_WHITE, 0xFF, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); - filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_QUESTION), baseX + START_GAME_QMARK_X, baseY + 4, 0xFF, 0, 0); + case FM_CONFIRM_START: + selectedFile = filemenu_menus[FILE_MENU_MAIN]->selected; + if (gSaveSlotMetadata[selectedFile].validData) { + msgColor = MSG_PAL_WHITE; + } else { + msgColor = MSG_PAL_RED; + } + filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_START_GAME_WITH), baseX + START_GAME_START_WITH_X, baseY + 4, 255, msgColor, 0); + filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FILE_22), baseX + START_GAME_FILE_X, baseY + 4, 255, msgColor, 0); + draw_number(filemenu_menus[FILE_MENU_MAIN]->selected + 1, baseX + START_GAME_NUMBER_X, baseY + 6 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_NORMAL, msgColor, 255, DRAW_NUMBER_STYLE_MONOSPACE | DRAW_NUMBER_STYLE_ALIGN_RIGHT); + filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_QUESTION), baseX + START_GAME_QMARK_X, baseY + 4, 255, msgColor, 0); break; } } @@ -217,6 +225,7 @@ INCLUDE_ASM(void, "filemenu/filemenu_yesno", filemenu_yesno_handle_input); #else void filemenu_yesno_handle_input(MenuPanel* menu) { s32 oldSelected = menu->selected; + s32 selected; if (filemenu_heldButtons & BUTTON_STICK_UP) { menu->row--; @@ -238,163 +247,147 @@ void filemenu_yesno_handle_input(MenuPanel* menu) { sfx_play_sound(SOUND_MENU_CHANGE_SELECTION); } - if ((filemenu_pressedButtons & BUTTON_START) && menu->page == 4) { + if ((filemenu_pressedButtons & BUTTON_START) && menu->state == FM_CONFIRM_START) { filemenu_set_selected(menu, 0, 0); filemenu_pressedButtons = BUTTON_A; } if (filemenu_pressedButtons & BUTTON_A) { - u32 slot; - u32 slot2; - u32 slot3; - u32 slot4; s32 i; sfx_play_sound(SOUND_MENU_NEXT); switch (menu->selected) { - case 0: - switch (menu->page) { - case 0: - filemenu_currentMenu = 2; - filemenu_menus[filemenu_currentMenu]->page = 0; - gWindows[WINDOW_ID_FILEMENU_INFO].width = 182; - gWindows[WINDOW_ID_FILEMENU_INFO].height = 25; - gWindows[WINDOW_ID_FILEMENU_INFO].pos.x = ((gWindows[WINDOW_ID_FILEMENU_INFO].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_INFO].parent].width / 2) - : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_INFO].width / 2; - gWindows[WINDOW_ID_FILEMENU_INFO].pos.y = ((gWindows[WINDOW_ID_FILEMENU_INFO].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_INFO].parent].height / 2) - : SCREEN_HEIGHT / 2) - gWindows[WINDOW_ID_FILEMENU_INFO].height / 2; - set_window_update(WINDOW_ID_FILEMENU_INFO, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_FILEMENU_YESNO_OPTIONS, (s32)filemenu_update_hidden_name_confirm); + case 0: // YES + switch (menu->state) { + case FM_CONFIRM_DELETE: + filemenu_currentMenu = FILE_MENU_MESSAGE; + filemenu_menus[FILE_MENU_MESSAGE]->state = FM_MESSAGE_DELETED; + gWindows[WIN_FILES_MESSAGE].width = 182; + gWindows[WIN_FILES_MESSAGE].height = 25; + gWindows[WIN_FILES_MESSAGE].pos.x = CENTER_WINDOW_X(WIN_FILES_MESSAGE); + gWindows[WIN_FILES_MESSAGE].pos.y = CENTER_WINDOW_Y(WIN_FILES_MESSAGE); + set_window_update(WIN_FILES_MESSAGE, WINDOW_UPDATE_SHOW); + set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_hidden_name_confirm); - slot = filemenu_menus[0]->selected; - for (i = 0; i < ARRAY_COUNT(gFilesDisplayData->filename); i++) { - gFilesDisplayData[slot].filename[i] = 0xF7; + selected = filemenu_menus[FILE_MENU_MAIN]->selected; + for (i = 0; i < ARRAY_COUNT(gSaveSlotSummary->filename); i++) { + gSaveSlotSummary[selected].filename[i] = MSG_CHAR_READ_SPACE; } - gFilesDisplayData[slot].level = 0; - gFilesDisplayData[slot].timePlayed = 0; - gFilesDisplayData[slot].spiritsRescued = 0; - fio_erase_game(slot); - gSaveSlotHasData[slot] = FALSE; + gSaveSlotSummary[selected].level = 0; + gSaveSlotSummary[selected].timePlayed = 0; + gSaveSlotSummary[selected].spiritsRescued = 0; + fio_erase_game(selected); + gSaveSlotMetadata[selected].hasData = FALSE; + gSaveSlotMetadata[selected].validData = FALSE; break; - case 3: - filemenu_currentMenu = 2; - filemenu_menus[filemenu_currentMenu]->page = 2; - gWindows[WINDOW_ID_FILEMENU_INFO].width = 154; - gWindows[WINDOW_ID_FILEMENU_INFO].height = 39; - gWindows[WINDOW_ID_FILEMENU_INFO].pos.x = ((gWindows[WINDOW_ID_FILEMENU_INFO].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_INFO].parent].width / 2) - : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_INFO].width / 2; - gWindows[WINDOW_ID_FILEMENU_INFO].pos.y = ((gWindows[WINDOW_ID_FILEMENU_INFO].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_INFO].parent].height / 2) - : SCREEN_HEIGHT / 2) - gWindows[WINDOW_ID_FILEMENU_INFO].height / 2; - set_window_update(WINDOW_ID_FILEMENU_INFO, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_FILEMENU_YESNO_OPTIONS, (s32)filemenu_update_hidden_name_confirm); - fio_load_game(filemenu_loadedFileIdx); - gFilesDisplayData[filemenu_iterFileIdx] = gFilesDisplayData[filemenu_loadedFileIdx]; - fio_save_game(filemenu_iterFileIdx); - gSaveSlotHasData[filemenu_iterFileIdx] = TRUE; + case FM_CONFIRM_COPY: + filemenu_currentMenu = FILE_MENU_MESSAGE; + filemenu_menus[FILE_MENU_MESSAGE]->state = FM_MESSAGE_COPIED; + gWindows[WIN_FILES_MESSAGE].width = 154; + gWindows[WIN_FILES_MESSAGE].height = 39; + gWindows[WIN_FILES_MESSAGE].pos.x = CENTER_WINDOW_X(WIN_FILES_MESSAGE); + gWindows[WIN_FILES_MESSAGE].pos.y = CENTER_WINDOW_Y(WIN_FILES_MESSAGE); + set_window_update(WIN_FILES_MESSAGE, WINDOW_UPDATE_SHOW); + set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_hidden_name_confirm); + fio_load_game(filemenu_CopyFromFileIdx); + gSaveSlotSummary[filemenu_CopyToFileIdx] = gSaveSlotSummary[filemenu_CopyFromFileIdx]; + gSaveSlotMetadata[filemenu_CopyToFileIdx] = gSaveSlotMetadata[filemenu_CopyFromFileIdx]; + fio_save_game(filemenu_CopyToFileIdx); break; - case 1: - filemenu_currentMenu = 2; - filemenu_menus[filemenu_currentMenu]->page = 1; - gWindows[WINDOW_ID_FILEMENU_INFO].width = 153; - gWindows[WINDOW_ID_FILEMENU_INFO].height = 25; - gWindows[WINDOW_ID_FILEMENU_INFO].pos.x = ((gWindows[WINDOW_ID_FILEMENU_INFO].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_INFO].parent].width / 2) - : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_INFO].width / 2; - gWindows[WINDOW_ID_FILEMENU_INFO].pos.y = ((gWindows[WINDOW_ID_FILEMENU_INFO].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_INFO].parent].height / 2) - : SCREEN_HEIGHT / 2) - gWindows[WINDOW_ID_FILEMENU_INFO].height / 2; - set_window_update(WINDOW_ID_FILEMENU_INFO, WINDOW_UPDATE_SHOW); - set_window_update(WINDOW_ID_FILEMENU_YESNO_OPTIONS, (s32)filemenu_update_hidden_name_confirm); - gFilesDisplayData[filemenu_menus[0]->selected] = gFilesDisplayData[gGameStatusPtr->saveSlot]; - fio_save_game(filemenu_menus[0]->selected); - gSaveSlotHasData[filemenu_menus[0]->selected] = TRUE; + case FM_CONFIRM_LANGUAGE: + filemenu_currentMenu = FILE_MENU_MESSAGE; + filemenu_menus[FILE_MENU_MESSAGE]->state = FM_MESSAGE_LANGUAGE; + gWindows[WIN_FILES_MESSAGE].width = 153; + gWindows[WIN_FILES_MESSAGE].height = 25; + gWindows[WIN_FILES_MESSAGE].pos.x = CENTER_WINDOW_X(WIN_FILES_MESSAGE); + gWindows[WIN_FILES_MESSAGE].pos.y = CENTER_WINDOW_Y(WIN_FILES_MESSAGE); + set_window_update(WIN_FILES_MESSAGE, WINDOW_UPDATE_SHOW); + set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_hidden_name_confirm); + gSaveSlotSummary[filemenu_menus[FILE_MENU_MAIN]->selected] = gSaveSlotSummary[gGameStatusPtr->saveSlot]; + fio_save_game(filemenu_menus[FILE_MENU_MAIN]->selected); + gSaveSlotMetadata[filemenu_menus[FILE_MENU_MAIN]->selected].hasData = TRUE; break; - case 2: + case FM_CONFIRM_CREATE: clear_player_data(); clear_saved_variables(); get_map_IDs_by_name_checked(NEW_GAME_MAP_ID, &gGameStatusPtr->areaID, &gGameStatusPtr->mapID); gGameStatusPtr->entryID = NEW_GAME_ENTRY_ID; evt_set_variable(NULL, GB_StoryProgress, NEW_GAME_STORY_PROGRESS); - slot2 = filemenu_menus[0]->selected; - for (i = 0; i < ARRAY_COUNT(gFilesDisplayData->filename); i++) { - gFilesDisplayData[slot2].filename[i] = filemenu_filename[i]; + selected = filemenu_menus[FILE_MENU_MAIN]->selected; + for (i = 0; i < ARRAY_COUNT(gSaveSlotSummary->filename); i++) { + gSaveSlotSummary[selected].filename[i] = filemenu_filename[i]; } - fio_save_game(slot2); - gSaveSlotHasData[slot2] = TRUE; - set_window_update(WINDOW_ID_FILEMENU_CREATEFILE_HEADER, (s32)filemenu_update_hidden_name_input); - set_window_update(WINDOW_ID_FILEMENU_KEYBOARD, (s32)filemenu_update_hidden_name_input); - set_window_update(WINDOW_ID_FILEMENU_TITLE, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_STEREO, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_MONO, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_CENTER, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE0_INFO, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE1_INFO, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE2_INFO, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE3_INFO, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_YESNO_OPTIONS, (s32)filemenu_update_hidden_name_confirm); - filemenu_currentMenu = 2; - filemenu_menus[2]->page = 3; - gWindows[WINDOW_ID_FILEMENU_INFO].width = 184; - gWindows[WINDOW_ID_FILEMENU_INFO].height = 25; - gWindows[WINDOW_ID_FILEMENU_INFO].pos.x = ((gWindows[WINDOW_ID_FILEMENU_INFO].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_INFO].parent].width / 2) - : SCREEN_WIDTH / 2) - gWindows[WINDOW_ID_FILEMENU_INFO].width / 2; - gWindows[WINDOW_ID_FILEMENU_INFO].pos.y = ((gWindows[WINDOW_ID_FILEMENU_INFO].parent != -1) - ? (gWindows[gWindows[WINDOW_ID_FILEMENU_INFO].parent].height / 2) - : SCREEN_HEIGHT / 2) - gWindows[WINDOW_ID_FILEMENU_INFO].height / 2; - set_window_update(WINDOW_ID_FILEMENU_INFO, WINDOW_UPDATE_SHOW); + fio_save_game(selected); + gSaveSlotMetadata[selected].hasData = TRUE; + gSaveSlotMetadata[selected].validData = TRUE; + strcpy(gSaveSlotMetadata[selected].modName, DX_MOD_NAME); + + set_window_update(WIN_FILES_INPUT_FIELD, (s32)filemenu_update_hidden_name_input); + set_window_update(WIN_FILES_INPUT_KEYBOARD, (s32)filemenu_update_hidden_name_input); + set_window_update(WIN_FILES_TITLE, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_MONO, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_OPTION_CENTER, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_OPTION_RIGHT, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_SLOT0_BODY, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_SLOT1_BODY, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_SLOT2_BODY, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_SLOT3_BODY, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_hidden_name_confirm); + filemenu_currentMenu = FILE_MENU_MESSAGE; + filemenu_menus[FILE_MENU_MESSAGE]->state = FM_MESSAGE_CREATED; + gWindows[WIN_FILES_MESSAGE].width = 184; + gWindows[WIN_FILES_MESSAGE].height = 25; + gWindows[WIN_FILES_MESSAGE].pos.x = CENTER_WINDOW_X(WIN_FILES_MESSAGE); + gWindows[WIN_FILES_MESSAGE].pos.y = CENTER_WINDOW_Y(WIN_FILES_MESSAGE); + set_window_update(WIN_FILES_MESSAGE, WINDOW_UPDATE_SHOW); break; - case 4: - slot3 = filemenu_menus[0]->selected; + case FM_CONFIRM_START: + selected = filemenu_menus[FILE_MENU_MAIN]->selected; if (gGameStatusPtr->soundOutputMode != 1 - gSaveGlobals.useMonoSound || - slot3 != (u8)gSaveGlobals.lastFileSelected) + selected != (u8)gSaveGlobals.lastFileSelected) { gSaveGlobals.useMonoSound = 1 - gGameStatusPtr->soundOutputMode; - gSaveGlobals.lastFileSelected = slot3; + gSaveGlobals.lastFileSelected = selected; fio_save_globals(); } - fio_load_game(slot3); + fio_load_game(selected); set_game_mode(GAME_MODE_END_FILE_SELECT); break; } break; - case 1: - switch (menu->page) { - case 0: - case 1: - case 3: - filemenu_currentMenu = 0; - set_window_update(WINDOW_ID_FILEMENU_YESNO_OPTIONS, (s32)filemenu_update_hidden_name_confirm); + case 1: // NO + switch (menu->state) { + case FM_CONFIRM_DELETE: + case FM_CONFIRM_LANGUAGE: + case FM_CONFIRM_COPY: + filemenu_currentMenu = FILE_MENU_MAIN; + set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_hidden_name_confirm); break; - case 2: - filemenu_currentMenu = 3; - set_window_update(WINDOW_ID_FILEMENU_YESNO_OPTIONS, (s32)filemenu_update_hidden_name_confirm); + case FM_CONFIRM_CREATE: + filemenu_currentMenu = FILE_MENU_INPUT_NAME; + set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_hidden_name_confirm); break; - case 4: - filemenu_currentMenu = 0; - slot4 = filemenu_menus[0]->selected; - set_window_update(WINDOW_ID_FILEMENU_TITLE, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_STEREO, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_MONO, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_CENTER, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE0_INFO, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE1_INFO, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE2_INFO, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE3_INFO, (s32)filemenu_update_show_with_rotation); - set_window_update(slot4 + WINDOW_ID_FILEMENU_FILE0_INFO, (s32)filemenu_update_deselect_file); - set_window_update(WINDOW_ID_FILEMENU_YESNO_OPTIONS, WINDOW_UPDATE_HIDE); + case FM_CONFIRM_START: + filemenu_currentMenu = FILE_MENU_MAIN; + selected = filemenu_menus[FILE_MENU_MAIN]->selected; + set_window_update(WIN_FILES_TITLE, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_MONO, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_OPTION_CENTER, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_OPTION_RIGHT, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_SLOT0_BODY, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_SLOT1_BODY, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_SLOT2_BODY, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_SLOT3_BODY, (s32)filemenu_update_show_with_rotation); + set_window_update(selected + WIN_FILES_SLOT0_BODY, (s32)filemenu_update_deselect_file); + set_window_update(WIN_FILES_CONFIRM_OPTIONS, WINDOW_UPDATE_HIDE); break; } break; @@ -402,38 +395,36 @@ void filemenu_yesno_handle_input(MenuPanel* menu) { } if (filemenu_pressedButtons & BUTTON_B) { - u32 slot; - sfx_play_sound(SOUND_MENU_BACK); filemenu_set_selected(menu, 0, 1); - switch (menu->page) { - case 0: - case 1: - case 3: - filemenu_currentMenu = 0; - set_window_update(WINDOW_ID_FILEMENU_YESNO_OPTIONS, (s32)filemenu_update_hidden_name_confirm); + switch (menu->state) { + case FM_CONFIRM_DELETE: + case FM_CONFIRM_LANGUAGE: + case FM_CONFIRM_COPY: + filemenu_currentMenu = FILE_MENU_MAIN; + set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_hidden_name_confirm); break; - case 2: - filemenu_currentMenu = 3; - set_window_update(WINDOW_ID_FILEMENU_YESNO_OPTIONS, (s32)filemenu_update_hidden_name_confirm); + case FM_CONFIRM_CREATE: + filemenu_currentMenu = FILE_MENU_INPUT_NAME; + set_window_update(WIN_FILES_CONFIRM_OPTIONS, (s32)filemenu_update_hidden_name_confirm); break; - case 4: - filemenu_currentMenu = 0; - slot = filemenu_menus[0]->selected; - set_window_update(WINDOW_ID_FILEMENU_TITLE, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_STEREO, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_MONO, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_CENTER, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE0_INFO, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE1_INFO, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE2_INFO, (s32)filemenu_update_show_with_rotation); - set_window_update(WINDOW_ID_FILEMENU_FILE3_INFO, (s32)filemenu_update_show_with_rotation); - set_window_update(slot + WINDOW_ID_FILEMENU_FILE0_INFO, (s32)filemenu_update_deselect_file); - set_window_update(WINDOW_ID_FILEMENU_YESNO_OPTIONS, WINDOW_UPDATE_HIDE); + case FM_CONFIRM_START: + filemenu_currentMenu = FILE_MENU_MAIN; + selected = filemenu_menus[FILE_MENU_MAIN]->selected; + set_window_update(WIN_FILES_TITLE, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_STEREO, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_MONO, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_OPTION_CENTER, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_OPTION_RIGHT, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_OPTION_LEFT, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_SLOT0_BODY, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_SLOT1_BODY, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_SLOT2_BODY, (s32)filemenu_update_show_with_rotation); + set_window_update(WIN_FILES_SLOT3_BODY, (s32)filemenu_update_show_with_rotation); + set_window_update(selected + WIN_FILES_SLOT0_BODY, (s32)filemenu_update_deselect_file); + set_window_update(WIN_FILES_CONFIRM_OPTIONS, WINDOW_UPDATE_HIDE); break; } } diff --git a/src/fio.c b/src/fio.c index 5d5883db16..80c5473852 100644 --- a/src/fio.c +++ b/src/fio.c @@ -174,7 +174,7 @@ b32 fio_load_game(s32 saveSlot) { gGameStatusPtr->saveCount = gCurrentSaveFile.saveCount; } fio_deserialize_state(); - gFilesDisplayData[gGameStatusPtr->saveSlot] = gCurrentSaveFile.metadata; + gSaveSlotSummary[gGameStatusPtr->saveSlot] = gCurrentSaveFile.summary; return TRUE; } return FALSE; @@ -187,11 +187,11 @@ void fio_save_game(s32 saveSlot) { fio_serialize_state(); - gFilesDisplayData[gGameStatusPtr->saveSlot].level = gPlayerData.level; - gFilesDisplayData[gGameStatusPtr->saveSlot].spiritsRescued = get_spirits_rescued(); - gFilesDisplayData[gGameStatusPtr->saveSlot].timePlayed = gPlayerData.frameCounter; + gSaveSlotSummary[gGameStatusPtr->saveSlot].level = gPlayerData.level; + gSaveSlotSummary[gGameStatusPtr->saveSlot].spiritsRescued = get_spirits_rescued(); + gSaveSlotSummary[gGameStatusPtr->saveSlot].timePlayed = gPlayerData.frameCounter; - gCurrentSaveFile.metadata = gFilesDisplayData[gGameStatusPtr->saveSlot]; + gCurrentSaveFile.summary = gSaveSlotSummary[gGameStatusPtr->saveSlot]; strcpy(gCurrentSaveFile.magicString, MagicSaveString); diff --git a/src/fio.h b/src/fio.h index ae179a913a..b3c51780a7 100644 --- a/src/fio.h +++ b/src/fio.h @@ -2,6 +2,7 @@ #define _FIO_H_ #include "common.h" +#include "dx/versioning.h" b32 fio_load_globals(void); b32 fio_save_globals(void); @@ -9,8 +10,8 @@ b32 fio_load_game(s32 saveSlot); void fio_save_game(s32 saveSlot); void fio_erase_game(s32 saveSlot); -extern FileDisplayData gFilesDisplayData[4]; -extern u8 gSaveSlotHasData[4]; +extern SaveFileSummary gSaveSlotSummary[4]; +extern SaveSlotMetadata gSaveSlotMetadata[4]; extern SaveGlobals gSaveGlobals; #endif diff --git a/src/inventory.c b/src/inventory.c index 5681e0098f..14c397588d 100644 --- a/src/inventory.c +++ b/src/inventory.c @@ -1344,7 +1344,7 @@ void update_coin_counter(void) { if ((statusBar->displayCoins == gPlayerData.coins) || (statusBar->coinCounterHideTime <= 30)) { statusBar->coinCounterHideTime--; if (statusBar->coinCounterHideTime == 0) { - set_window_update(WINDOW_ID_CURRENCY_COUNTER, (s32)basic_hidden_window_update); + set_window_update(WIN_CURRENCY_COUNTER, (s32)basic_hidden_window_update); statusBar->unk_6D = 15; D_8010CD10 = FALSE; D_8010CD12 = TRUE; @@ -1364,7 +1364,7 @@ void show_coin_counter(void) { s32 index; if (D_8010CD10 || D_8010CD12) { - set_window_update(WINDOW_ID_CURRENCY_COUNTER, WINDOW_UPDATE_HIDE); + set_window_update(WIN_CURRENCY_COUNTER, WINDOW_UPDATE_HIDE); if (statusBar->iconIndex12 > -1) { hud_element_free(statusBar->coinCountTimesHID); hud_element_free(statusBar->coinCountIconHID); @@ -1377,8 +1377,8 @@ void show_coin_counter(void) { } if (statusBar->coinCounterHideTime == 0) { - set_window_properties(WINDOW_ID_CURRENCY_COUNTER, 32, 164, 64, 20, WINDOW_PRIORITY_21, coin_counter_draw_content, 0, -1); - set_window_update(WINDOW_ID_CURRENCY_COUNTER, (s32)basic_window_update); + set_window_properties(WIN_CURRENCY_COUNTER, 32, 164, 64, 20, WINDOW_PRIORITY_21, coin_counter_draw_content, 0, -1); + set_window_update(WIN_CURRENCY_COUNTER, (s32)basic_window_update); statusBar->coinCountTimesHID = index = hud_element_create(&HES_MenuTimes); hud_element_set_flags(index, HUD_ELEMENT_FLAG_80); hud_element_set_tint(index, 255, 255, 255); diff --git a/src/item_entity.c b/src/item_entity.c index 8db5d9f172..d9742ee317 100644 --- a/src/item_entity.c +++ b/src/item_entity.c @@ -2225,9 +2225,9 @@ void update_item_entity_pickup(ItemEntity* item) { } if (item->state == ITEM_PICKUP_STATE_SHOW_TOO_MANY) { func_801363A0(item); - set_window_update(WINDOW_ID_12, (s32) basic_window_update); - set_window_update(WINDOW_ID_17, (s32) basic_window_update); - set_window_update(WINDOW_ID_19, (s32) basic_window_update); + set_window_update(WIN_PICKUP_HEADER, (s32) basic_window_update); + set_window_update(WIN_POPUP_TITLE_B, (s32) basic_window_update); + set_window_update(WIN_POPUP_DESC, (s32) basic_window_update); } increment_status_bar_disabled(); ItemPickupStateDelay = 10; @@ -2286,9 +2286,9 @@ void update_item_entity_pickup(ItemEntity* item) { if (ItemPickupStateDelay == 6) { func_801363A0(item); - set_window_update(WINDOW_ID_12, (s32) basic_window_update); + set_window_update(WIN_PICKUP_HEADER, (s32) basic_window_update); if (item->itemID != ITEM_STAR_PIECE && item->itemID != ITEM_COIN) { - set_window_update(WINDOW_ID_19, (s32) basic_window_update); + set_window_update(WIN_POPUP_DESC, (s32) basic_window_update); } } @@ -2312,14 +2312,14 @@ void update_item_entity_pickup(ItemEntity* item) { if (gItemTable[item->itemID].typeFlags & ITEM_TYPE_FLAG_GEAR) { ItemPickupGotOutline->data.gotItemOutline->timeLeft = 10; } - set_window_update(WINDOW_ID_12, (s32) basic_hidden_window_update); - set_window_update(WINDOW_ID_19, (s32) basic_hidden_window_update); + set_window_update(WIN_PICKUP_HEADER, (s32) basic_hidden_window_update); + set_window_update(WIN_POPUP_DESC, (s32) basic_hidden_window_update); item->state = ITEM_PICKUP_STATE_HIDE_GOT_ITEM; } break; case ITEM_PICKUP_STATE_HIDE_GOT_ITEM: - if (!(gWindows[WINDOW_ID_12].flags & WINDOW_FLAG_INITIAL_ANIMATION) && - !(gWindows[WINDOW_ID_19].flags & WINDOW_FLAG_INITIAL_ANIMATION)) + if (!(gWindows[WIN_PICKUP_HEADER].flags & WINDOW_FLAG_INITIAL_ANIMATION) && + !(gWindows[WIN_POPUP_DESC].flags & WINDOW_FLAG_INITIAL_ANIMATION)) { item->state = ITEM_PICKUP_STATE_CHECK_TUTORIALS; } @@ -2398,16 +2398,16 @@ void update_item_entity_pickup(ItemEntity* item) { menu->numEntries = numEntries; menu->initialPos = 0; create_standard_popup_menu(menu); - set_window_update(WINDOW_ID_12, (s32) basic_hidden_window_update); - set_window_update(WINDOW_ID_17, (s32) basic_hidden_window_update); + set_window_update(WIN_PICKUP_HEADER, (s32) basic_hidden_window_update); + set_window_update(WIN_POPUP_TITLE_B, (s32) basic_hidden_window_update); ItemPickupStateDelay = 0; item->state = ITEM_PICKUP_STATE_HIDE_TOO_MANY; } break; case ITEM_PICKUP_STATE_HIDE_TOO_MANY: - if (!(gWindows[WINDOW_ID_12].flags & WINDOW_FLAG_INITIAL_ANIMATION) && - !(gWindows[WINDOW_ID_17].flags & WINDOW_FLAG_INITIAL_ANIMATION) && - !(gWindows[WINDOW_ID_19].flags & WINDOW_FLAG_INITIAL_ANIMATION)) + if (!(gWindows[WIN_PICKUP_HEADER].flags & WINDOW_FLAG_INITIAL_ANIMATION) && + !(gWindows[WIN_POPUP_TITLE_B].flags & WINDOW_FLAG_INITIAL_ANIMATION) && + !(gWindows[WIN_POPUP_DESC].flags & WINDOW_FLAG_INITIAL_ANIMATION)) { item->state = ITEM_PICKUP_STATE_AWAIT_THROW_AWAY; } @@ -2445,21 +2445,21 @@ void update_item_entity_pickup(ItemEntity* item) { } suggest_player_anim_always_forward(ANIM_MarioW1_Lift); func_801363A0(item); - set_window_update(WINDOW_ID_12, (s32) basic_window_update); + set_window_update(WIN_PICKUP_HEADER, (s32) basic_window_update); ItemPickupStateDelay = 50; item->state = ITEM_PICKUP_STATE_SHOW_THREW_AWAY; } break; case ITEM_PICKUP_STATE_SHOW_THREW_AWAY: if (gGameStatusPtr->pressedButtons[0] & BUTTON_A) { - set_window_update(WINDOW_ID_12, (s32) basic_hidden_window_update); + set_window_update(WIN_PICKUP_HEADER, (s32) basic_hidden_window_update); item->state = ITEM_PICKUP_STATE_HIDE_THREW_AWAY; } break; case ITEM_PICKUP_STATE_HIDE_THREW_AWAY: - if (!(gWindows[WINDOW_ID_12].flags & WINDOW_FLAG_INITIAL_ANIMATION) && - !(gWindows[WINDOW_ID_17].flags & WINDOW_FLAG_INITIAL_ANIMATION) && - !(gWindows[WINDOW_ID_19].flags & WINDOW_FLAG_INITIAL_ANIMATION)) + if (!(gWindows[WIN_PICKUP_HEADER].flags & WINDOW_FLAG_INITIAL_ANIMATION) && + !(gWindows[WIN_POPUP_TITLE_B].flags & WINDOW_FLAG_INITIAL_ANIMATION) && + !(gWindows[WIN_POPUP_DESC].flags & WINDOW_FLAG_INITIAL_ANIMATION)) { item->state = ITEM_PICKUP_STATE_THROW_AWAY_DONE; } @@ -2572,23 +2572,23 @@ void func_801363A0(ItemEntity* item) { && !(item->pickupMsgFlags & (ITEM_PICKUP_FLAG_1_COIN | ITEM_PICKUP_FLAG_3_STAR_PIECES) && item->itemID != ITEM_STAR_PIECE) ) { - set_window_properties(WINDOW_ID_12, posX, posY - 24 + offsetY, width, + set_window_properties(WIN_PICKUP_HEADER, posX, posY - 24 + offsetY, width, HT_VAR1, WINDOW_PRIORITY_0, draw_content_pickup_item_header, item, -1); } else if (gItemTable[item->itemID].typeFlags & ITEM_TYPE_FLAG_WORLD_USABLE){ - set_window_properties(WINDOW_ID_12, posX, posY - 24 + offsetY, width, + set_window_properties(WIN_PICKUP_HEADER, posX, posY - 24 + offsetY, width, HT_VAR1, WINDOW_PRIORITY_0, draw_content_pickup_item_header, item, -1); } else { - set_window_properties(WINDOW_ID_12, posX, posY - 24 + offsetY, width, + set_window_properties(WIN_PICKUP_HEADER, posX, posY - 24 + offsetY, width, HT_VAR1, WINDOW_PRIORITY_0, draw_content_pickup_item_header, item, -1); } if (item->itemID != ITEM_STAR_PIECE && item->itemID != ITEM_COIN) { posX = X_VAR1; - set_window_properties(WINDOW_ID_19, posX, 186, WD_VAR4, 32, WINDOW_PRIORITY_0, draw_content_pickup_item_desc, item, -1); + set_window_properties(WIN_POPUP_DESC, posX, 186, WD_VAR4, 32, WINDOW_PRIORITY_0, draw_content_pickup_item_desc, item, -1); } if (item->state != ITEM_PICKUP_STATE_SHOW_GOT_ITEM) { width = get_msg_width(MSG_Menus_0060, 0) + 24; posX = 160 - width / 2; - set_window_properties(WINDOW_ID_17, 160 - width / 2, 36, width, 40, WINDOW_PRIORITY_0, draw_content_cant_carry_more, item, -1); + set_window_properties(WIN_POPUP_TITLE_B, 160 - width / 2, 36, width, 40, WINDOW_PRIORITY_0, draw_content_cant_carry_more, item, -1); } break; case ITEM_PICKUP_STATE_AWAIT_THROW_AWAY: @@ -2599,7 +2599,7 @@ void func_801363A0(ItemEntity* item) { width = get_msg_width(MSG_Menus_005F, 0) + 54; #endif posX = 160 - width / 2; - set_window_properties(WINDOW_ID_12, 160 - width / 2, 76, width, 40, WINDOW_PRIORITY_0, draw_content_pickup_item_header, item, -1); + set_window_properties(WIN_PICKUP_HEADER, 160 - width / 2, 76, width, 40, WINDOW_PRIORITY_0, draw_content_pickup_item_header, item, -1); break; } } diff --git a/src/pause/pause_badges.c b/src/pause/pause_badges.c index 9d2fbd3112..b19af33dc1 100644 --- a/src/pause/pause_badges.c +++ b/src/pause/pause_badges.c @@ -96,7 +96,7 @@ extern u8 D_PAL_80271B2C[]; MenuWindowBP gPauseBadgesWindowBPs[] = { { - .windowID = WINDOW_ID_PAUSE_BADGES, + .windowID = WIN_PAUSE_BADGES, .unk_01 = 0, .pos = { .x = 3, .y = 16 }, .width = 289, @@ -104,7 +104,7 @@ MenuWindowBP gPauseBadgesWindowBPs[] = { .priority = WINDOW_PRIORITY_1, .fpDrawContents = &pause_badges_draw_contents, .tab = NULL, - .parentID = WINDOW_ID_PAUSE_MAIN, + .parentID = WIN_PAUSE_MAIN, .fpUpdate = { WINDOW_UPDATE_HIDE }, .extraFlags = 0, .style = { .customStyle = &gPauseWS_16 } @@ -115,7 +115,7 @@ MenuPanel gPausePanelBadges = { .col = 0, .row = 0, .selected = 0, - .page = 0, + .state = 0, .numCols = 0, .numRows = 0, .numPages = 0, @@ -794,9 +794,9 @@ void pause_badges_draw_contents(MenuPanel* menu, s32 baseX, s32 baseY, s32 width } if (gPauseBadgesCurrentScrollPos != gPauseBadgesTargetScrollPos) { - pause_set_cursor_pos_immediate(WINDOW_ID_PAUSE_BADGES, baseX + 93 + cursorOffsetX, baseY + 23 + cursorOffsetY); + pause_set_cursor_pos_immediate(WIN_PAUSE_BADGES, baseX + 93 + cursorOffsetX, baseY + 23 + cursorOffsetY); } else { - pause_set_cursor_pos(WINDOW_ID_PAUSE_BADGES, baseX + 93 + cursorOffsetX, baseY + 23 + cursorOffsetY); + pause_set_cursor_pos(WIN_PAUSE_BADGES, baseX + 93 + cursorOffsetX, baseY + 23 + cursorOffsetY); } } } diff --git a/src/pause/pause_items.c b/src/pause/pause_items.c index 8795af791d..56bd8eb670 100644 --- a/src/pause/pause_items.c +++ b/src/pause/pause_items.c @@ -35,7 +35,7 @@ HudScript* gPauseItemsElements[] = { }; MenuWindowBP gPauseItemsWindowBPs[] = { { - .windowID = WINDOW_ID_PAUSE_ITEMS, + .windowID = WIN_PAUSE_ITEMS, .unk_01 = 0, .pos = { .x = 3, .y = 16 }, .width = 289, @@ -43,7 +43,7 @@ MenuWindowBP gPauseItemsWindowBPs[] = { .priority = WINDOW_PRIORITY_1, .fpDrawContents = &pause_items_draw_contents, .tab = NULL, - .parentID = WINDOW_ID_PAUSE_MAIN, + .parentID = WIN_PAUSE_MAIN, .fpUpdate = { WINDOW_UPDATE_HIDE }, .extraFlags = 0, .style = { .customStyle = &gPauseWS_19 } @@ -54,7 +54,7 @@ MenuPanel gPausePanelItems = { .col = 0, .row = 0, .selected = 0, - .page = 0, + .state = 0, .numCols = 0, .numRows = 0, .numPages = 0, @@ -330,7 +330,7 @@ void pause_items_draw_contents(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, if (gPauseMenuCurrentTab == 3) { if (gPauseItemsLevel == 0) { - pause_set_cursor_pos(WINDOW_ID_PAUSE_ITEMS, baseX + 12, baseY + 26 + gPauseItemsCurrentTab * 32); + pause_set_cursor_pos(WIN_PAUSE_ITEMS, baseX + 12, baseY + 26 + gPauseItemsCurrentTab * 32); } else { selectedPosX = pause_items_get_pos_x(gPauseItemsCurrentPage, gPauseItemsSelectedIndex - gPauseItemsPages[gPauseItemsCurrentPage].listStart * gPauseItemsPages[gPauseItemsCurrentPage].numCols); selectedPosY = pause_items_get_pos_y(gPauseItemsCurrentPage, gPauseItemsSelectedIndex - gPauseItemsPages[gPauseItemsCurrentPage].listStart * gPauseItemsPages[gPauseItemsCurrentPage].numCols); @@ -343,9 +343,9 @@ void pause_items_draw_contents(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, } if (gPauseItemsCurrentScrollPos != gPauseItemsTargetScrollPos) { - pause_set_cursor_pos_immediate(WINDOW_ID_PAUSE_ITEMS, baseX + 85 + cursorOffsetX, baseY + 23 + cursorOffsetY); + pause_set_cursor_pos_immediate(WIN_PAUSE_ITEMS, baseX + 85 + cursorOffsetX, baseY + 23 + cursorOffsetY); } else { - pause_set_cursor_pos(WINDOW_ID_PAUSE_ITEMS, baseX + 85 + cursorOffsetX, baseY + 23 + cursorOffsetY); + pause_set_cursor_pos(WIN_PAUSE_ITEMS, baseX + 85 + cursorOffsetX, baseY + 23 + cursorOffsetY); } } } diff --git a/src/pause/pause_main.c b/src/pause/pause_main.c index 02b5bcb4b8..b850502545 100644 --- a/src/pause/pause_main.c +++ b/src/pause/pause_main.c @@ -132,7 +132,7 @@ Vp gPauseTutorialViewport = { s32 gPauseTutorialScrollPos = 0; MenuWindowBP gPauseCommonWindowsBPs[] = { { - .windowID = WINDOW_ID_PAUSE_MAIN, + .windowID = WIN_PAUSE_MAIN, .unk_01 = 0, .pos = { .x = 12, .y = 20 }, .width = 296, @@ -140,13 +140,13 @@ MenuWindowBP gPauseCommonWindowsBPs[] = { .priority = 0, .fpDrawContents = &pause_main_draw_contents, .tab = NULL, - .parentID = WINDOW_ID_NONE, + .parentID = WIN_NONE, .fpUpdate = { WINDOW_UPDATE_SHOW }, .extraFlags = WINDOW_FLAG_40, .style = { .customStyle = &gPauseWS_0 } }, { - .windowID = WINDOW_ID_PAUSE_TUTORIAL, + .windowID = WIN_PAUSE_TUTORIAL, .unk_01 = 0, .pos = { .x = 0, .y = 138 }, .width = 296, @@ -154,13 +154,13 @@ MenuWindowBP gPauseCommonWindowsBPs[] = { .priority = 0, .fpDrawContents = &pause_tutorial_draw_contents, .tab = NULL, - .parentID = WINDOW_ID_PAUSE_MAIN, + .parentID = WIN_PAUSE_MAIN, .fpUpdate = { WINDOW_UPDATE_HIDE }, .extraFlags = 0, .style = { .customStyle = &gPauseWS_2 } }, { - .windowID = WINDOW_ID_PAUSE_DECRIPTION, + .windowID = WIN_PAUSE_DECRIPTION, .unk_01 = 0, .pos = { .x = 20, .y = 164 }, .width = 256, @@ -168,13 +168,13 @@ MenuWindowBP gPauseCommonWindowsBPs[] = { .priority = 0, .fpDrawContents = &pause_textbox_draw_contents, .tab = NULL, - .parentID = WINDOW_ID_PAUSE_MAIN, + .parentID = WIN_PAUSE_MAIN, .fpUpdate = { .func = &basic_window_update }, .extraFlags = 0, .style = { .customStyle = &gPauseWS_1 } }, { - .windowID = WINDOW_ID_PAUSE_CURSOR, + .windowID = WIN_PAUSE_CURSOR, .unk_01 = 0, .pos = { .x = 0, .y = 0 }, .width = SCREEN_WIDTH, @@ -182,7 +182,7 @@ MenuWindowBP gPauseCommonWindowsBPs[] = { .priority = 0, .fpDrawContents = &pause_draw_cursor, .tab = NULL, - .parentID = WINDOW_ID_NONE, + .parentID = WIN_NONE, .fpUpdate = { WINDOW_UPDATE_SHOW }, .extraFlags = 0, .style = { .customStyle = &gPauseWS_0 } @@ -202,15 +202,15 @@ void pause_set_cursor_pos_immediate(s32 windowID, s32 posX, s32 posY) { if (D_8024EFB4 != 0) { s32 i; - for (i = WINDOW_ID_PAUSE_MAIN; i < WINDOW_ID_PAUSE_CURSOR; i++) { + for (i = WIN_PAUSE_MAIN; i < WIN_PAUSE_CURSOR; i++) { Window* window = &gWindows[i]; s8 parent = window->parent; - if ((parent == WINDOW_ID_NONE || parent == WINDOW_ID_PAUSE_MAIN) && (window->flags & WINDOW_FLAG_INITIAL_ANIMATION)) { + if ((parent == WIN_NONE || parent == WIN_PAUSE_MAIN) && (window->flags & WINDOW_FLAG_INITIAL_ANIMATION)) { break; } } - if (i >= WINDOW_ID_PAUSE_CURSOR) { + if (i >= WIN_PAUSE_CURSOR) { D_8024EFB4 = 0; } } @@ -219,7 +219,7 @@ void pause_set_cursor_pos_immediate(s32 windowID, s32 posX, s32 posY) { gPauseCursorTargetPosY = posY; gPauseCursorPosY = posY; - } else if ((window->flags & WINDOW_FLAG_INITIAL_ANIMATION) == 0 && (window->parent == -1 || !(gWindows[window->parent].flags & WINDOW_FLAG_INITIAL_ANIMATION))) { + } else if ((window->flags & WINDOW_FLAG_INITIAL_ANIMATION) == 0 && (window->parent == WIN_NONE || !(gWindows[window->parent].flags & WINDOW_FLAG_INITIAL_ANIMATION))) { gPauseCursorTargetPosX = posX; gPauseCursorPosX = posX; gPauseCursorTargetPosY = posY; @@ -236,11 +236,11 @@ void pause_set_cursor_pos(s32 windowID, s32 posX, s32 posY) { if (D_8024EFB4 != 0) { s32 i; - for (i = WINDOW_ID_PAUSE_MAIN; i < WINDOW_ID_PAUSE_CURSOR; i++) { + for (i = WIN_PAUSE_MAIN; i < WIN_PAUSE_CURSOR; i++) { Window* window = &gWindows[i]; s8 parent = window->parent; - if ((parent == -1 || parent == WINDOW_ID_PAUSE_MAIN) && (window->flags & WINDOW_FLAG_INITIAL_ANIMATION)) { + if ((parent == WIN_NONE || parent == WIN_PAUSE_MAIN) && (window->flags & WINDOW_FLAG_INITIAL_ANIMATION)) { break; } } @@ -252,7 +252,7 @@ void pause_set_cursor_pos(s32 windowID, s32 posX, s32 posY) { gPauseCursorPosX = posX; gPauseCursorTargetPosY = posY; gPauseCursorPosY = posY; - } else if ((window->flags & WINDOW_FLAG_INITIAL_ANIMATION) == 0 && (window->parent == -1 || !(gWindows[window->parent].flags & WINDOW_FLAG_INITIAL_ANIMATION))) { + } else if ((window->flags & WINDOW_FLAG_INITIAL_ANIMATION) == 0 && (window->parent == WIN_NONE || !(gWindows[window->parent].flags & WINDOW_FLAG_INITIAL_ANIMATION))) { gPauseCursorTargetPosX = posX; gPauseCursorTargetPosY = posY; } @@ -645,26 +645,26 @@ void pause_init(void) { posX = 225; for (i = 6; i > 0; i--) { if (!gPausePanels[i]->initialized) { - set_window_update(WINDOW_ID_PAUSE_TUTORIAL + i, WINDOW_UPDATE_HIDE); + set_window_update(WIN_PAUSE_TUTORIAL + i, WINDOW_UPDATE_HIDE); } else { - gWindows[WINDOW_ID_PAUSE_TUTORIAL + i].pos.x = posX + 14; + gWindows[WIN_PAUSE_TUTORIAL + i].pos.x = posX + 14; posX -= 45; } } - pauseWindows = &gWindows[WINDOW_ID_PAUSE_TAB_STATS]; + pauseWindows = &gWindows[WIN_PAUSE_TAB_STATS]; x = pauseWindows[gPausePanels[0]->col].pos.x; - gWindows[WINDOW_ID_PAUSE_TAB_INVIS].pos.x = x + 6; + gWindows[WIN_PAUSE_TAB_INVIS].pos.x = x + 6; if (evt_get_variable(NULL, GF_Tutorial_Badges)) { for (i = 0; i < ARRAY_COUNT(gPauseTutorialSpriteAnims); i++) { gPauseTutorialSprites[i] = spr_load_npc_sprite(gPauseTutorialSpriteAnims[i][0], gPauseTutorialSpriteAnims[i]); } - set_window_update(WINDOW_ID_PAUSE_TUTORIAL, WINDOW_UPDATE_SHOW); + set_window_update(WIN_PAUSE_TUTORIAL, WINDOW_UPDATE_SHOW); sfx_play_sound(SOUND_MENU_SHOW_CHOICE); } - update_window_hierarchy(WINDOW_ID_PAUSE_CURSOR, 64); + update_window_hierarchy(WIN_PAUSE_CURSOR, 64); } void pause_tutorial_input(s32 *pressed, s32 *held) { @@ -820,10 +820,10 @@ void pause_cleanup(void) { } } - for (i = WINDOW_ID_PAUSE_MAIN; i < WINDOW_ID_PAUSE_CURSOR; i++) + for (i = WIN_PAUSE_MAIN; i < WIN_PAUSE_CURSOR; i++) set_window_update(i, WINDOW_UPDATE_HIDE); - set_window_update(WINDOW_ID_PAUSE_CURSOR, WINDOW_UPDATE_HIDE); + set_window_update(WIN_PAUSE_CURSOR, WINDOW_UPDATE_HIDE); } s32 pause_get_total_equipped_bp_cost(void) { diff --git a/src/pause/pause_map.c b/src/pause/pause_map.c index 690bb6fdbe..222c2a2d49 100644 --- a/src/pause/pause_map.c +++ b/src/pause/pause_map.c @@ -40,7 +40,7 @@ s32 D_8024FA34 = -1; s32 PauseMapArrowWobble[] = { 0, 2, 3, 3, 4, 4, 4, 4, 3, 2, 1, 0 }; MenuWindowBP PauseMapWindowBPs[] = { { - .windowID = WINDOW_ID_PAUSE_MAP, + .windowID = WIN_PAUSE_MAP, .unk_01 = 0, .pos = { .x = 3, .y = 16 }, .width = 289, @@ -48,13 +48,13 @@ MenuWindowBP PauseMapWindowBPs[] = { .priority = WINDOW_PRIORITY_1, .fpDrawContents = &pause_map_draw_contents, .tab = NULL, - .parentID = WINDOW_ID_PAUSE_MAIN, + .parentID = WIN_PAUSE_MAIN, .fpUpdate = { WINDOW_UPDATE_HIDE }, .extraFlags = 0, .style = { .customStyle = &gPauseWS_26 } }, { - .windowID = WINDOW_ID_PAUSE_MAP_TITLE, + .windowID = WIN_PAUSE_MAP_TITLE, .unk_01 = 0, .pos = { .x = MAP_TITLE_X, .y = 124 }, .width = MAP_TITLE_WIDTH, @@ -62,7 +62,7 @@ MenuWindowBP PauseMapWindowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &pause_map_draw_title, .tab = NULL, - .parentID = WINDOW_ID_PAUSE_MAP, + .parentID = WIN_PAUSE_MAP, .fpUpdate = { WINDOW_UPDATE_SHOW }, .extraFlags = 0, .style = { .customStyle = &gPauseWS_28 } @@ -78,7 +78,7 @@ MenuPanel gPausePanelMap = { .col = 0, .row = 0, .selected = 0, - .page = 0, + .state = 0, .numCols = 0, .numRows = 0, .numPages = 0, @@ -243,7 +243,7 @@ void pause_map_draw_contents(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, s currentTab = gPauseMenuCurrentTab; if (currentTab == 6) { - pause_set_cursor_pos(WINDOW_ID_PAUSE_MAP, mapULX + PauseMapTargetX - 8.0f, mapULY + PauseMapTargetY); + pause_set_cursor_pos(WIN_PAUSE_MAP, mapULX + PauseMapTargetX - 8.0f, mapULY + PauseMapTargetY); if (gPauseMenuCurrentTab == currentTab) { offset = PauseMapArrowWobble[gGameStatusPtr->frameCounter % 12]; diff --git a/src/pause/pause_partners.c b/src/pause/pause_partners.c index a9deffe7ad..0a462202bc 100644 --- a/src/pause/pause_partners.c +++ b/src/pause/pause_partners.c @@ -201,7 +201,7 @@ s32 gPausePartnersCurrentPortraitIndex = -1; s32 gPausePartnersNextPortraitIndex = -1; MenuWindowBP gPausePartnersWindowBPs[] = { { - .windowID = WINDOW_ID_PAUSE_PARTNERS, + .windowID = WIN_PAUSE_PARTNERS, .unk_01 = 0, .pos = { .x = 3, .y = 16 }, .width = 289, @@ -209,12 +209,12 @@ MenuWindowBP gPausePartnersWindowBPs[] = { .priority = WINDOW_PRIORITY_1, .fpDrawContents = &pause_partners_draw_contents, .tab = NULL, - .parentID = WINDOW_ID_PAUSE_MAIN, + .parentID = WIN_PAUSE_MAIN, .fpUpdate = { WINDOW_UPDATE_HIDE }, .extraFlags = 0, .style = { .customStyle = &gPauseWS_20 } }, { - .windowID = WINDOW_ID_PAUSE_PARTNERS_TITLE, + .windowID = WIN_PAUSE_PARTNERS_TITLE, .unk_01 = 0, .pos = { .x = 8, .y = 103 }, .width = 112, @@ -222,12 +222,12 @@ MenuWindowBP gPausePartnersWindowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &pause_partners_draw_title, .tab = NULL, - .parentID = WINDOW_ID_PAUSE_PARTNERS, + .parentID = WIN_PAUSE_PARTNERS, .fpUpdate = { WINDOW_UPDATE_SHOW }, .extraFlags = 0, .style = { .customStyle = &gPauseWS_22 } }, { - .windowID = WINDOW_ID_PAUSE_PARTNERS_MOVELIST, + .windowID = WIN_PAUSE_PARTNERS_MOVELIST, .unk_01 = 0, .pos = { .x = 133, .y = 36 }, .width = 140, @@ -235,12 +235,12 @@ MenuWindowBP gPausePartnersWindowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &pause_partners_draw_movelist, .tab = NULL, - .parentID = WINDOW_ID_PAUSE_PARTNERS, + .parentID = WIN_PAUSE_PARTNERS, .fpUpdate = { WINDOW_UPDATE_HIDE }, .extraFlags = 0, .style = { -1 } }, { - .windowID = WINDOW_ID_PAUSE_PARTNERS_MOVELIST_TITLE, + .windowID = WIN_PAUSE_PARTNERS_MOVELIST_TITLE, .unk_01 = 0, .pos = { .x = 12, .y = -6 }, .width = 80, @@ -248,12 +248,12 @@ MenuWindowBP gPausePartnersWindowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &pause_partners_draw_movelist_title, .tab = NULL, - .parentID = WINDOW_ID_PAUSE_PARTNERS_MOVELIST, + .parentID = WIN_PAUSE_PARTNERS_MOVELIST, .fpUpdate = { WINDOW_UPDATE_SHOW }, .extraFlags = 0, .style = { -1 } }, { - .windowID = WINDOW_ID_PAUSE_PARTNERS_MOVELIST_FLOWER, + .windowID = WIN_PAUSE_PARTNERS_MOVELIST_FLOWER, .unk_01 = 0, .pos = { .x = 102, .y = -12 }, .width = 32, @@ -261,7 +261,7 @@ MenuWindowBP gPausePartnersWindowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &pause_partners_draw_movelist_flower, .tab = NULL, - .parentID = WINDOW_ID_PAUSE_PARTNERS_MOVELIST, + .parentID = WIN_PAUSE_PARTNERS_MOVELIST, .fpUpdate = { WINDOW_UPDATE_SHOW }, .extraFlags = 0, .style = { -1 } @@ -273,7 +273,7 @@ MenuPanel gPausePanelPartners = { .col = 0, .row = 1, .selected = 0, - .page = 0, + .state = 0, .numCols = 4, .numRows = 2, .numPages = 0, @@ -380,7 +380,7 @@ void pause_partners_draw_contents(MenuPanel* menu, s32 baseX, s32 baseY, s32 wid currentTab = gPauseMenuCurrentTab; if (currentTab == 4) { if (gPausePartnersLevel == 0) { - pause_set_cursor_pos(WINDOW_ID_PAUSE_PARTNERS, baseX + 42, baseY + 88); + pause_set_cursor_pos(WIN_PAUSE_PARTNERS, baseX + 42, baseY + 88); } if (gPauseMenuCurrentTab == currentTab && gPausePartnersLevel == 0) { @@ -565,7 +565,7 @@ void pause_partners_draw_movelist(MenuPanel* menu, s32 baseX, s32 baseY, s32 wid } if (gPauseMenuCurrentTab == 4 && gPausePartnersLevel == 1) { - pause_set_cursor_pos(WINDOW_ID_PAUSE_PARTNERS_MOVELIST, baseX - 2, baseY + 28 + gPausePartnersSelectedMove * 13); + pause_set_cursor_pos(WIN_PAUSE_PARTNERS_MOVELIST, baseX - 2, baseY + 28 + gPausePartnersSelectedMove * 13); } } @@ -599,7 +599,7 @@ void pause_partners_init(MenuPanel* panel) { } if (gPausePartnersNumPartners == 0) { - set_window_update(WINDOW_ID_PAUSE_PARTNERS, WINDOW_UPDATE_HIDE); + set_window_update(WIN_PAUSE_PARTNERS, WINDOW_UPDATE_HIDE); panel->initialized = FALSE; return; } @@ -619,11 +619,11 @@ void pause_partners_init(MenuPanel* panel) { setup_pause_menu_tab(gPausePartnersWindowBPs, ARRAY_COUNT(gPausePartnersWindowBPs)); #if VERSION_PAL - gWindows[WINDOW_ID_PAUSE_PARTNERS_MOVELIST_TITLE].width = D_PAL_80271B50[gCurrentLanguage]; - gWindows[WINDOW_ID_PAUSE_PARTNERS_MOVELIST_TITLE].pos.x = D_PAL_80271B4C[gCurrentLanguage]; - gWindows[WINDOW_ID_PAUSE_PARTNERS_MOVELIST].width = D_PAL_80271B40[gCurrentLanguage]; - gWindows[WINDOW_ID_PAUSE_PARTNERS_MOVELIST].pos.x = D_PAL_80271B3C[gCurrentLanguage]; - gWindows[WINDOW_ID_PAUSE_PARTNERS_MOVELIST_FLOWER].pos.x = D_PAL_80271B48[gCurrentLanguage]; + gWindows[WIN_PAUSE_PARTNERS_MOVELIST_TITLE].width = D_PAL_80271B50[gCurrentLanguage]; + gWindows[WIN_PAUSE_PARTNERS_MOVELIST_TITLE].pos.x = D_PAL_80271B4C[gCurrentLanguage]; + gWindows[WIN_PAUSE_PARTNERS_MOVELIST].width = D_PAL_80271B40[gCurrentLanguage]; + gWindows[WIN_PAUSE_PARTNERS_MOVELIST].pos.x = D_PAL_80271B3C[gCurrentLanguage]; + gWindows[WIN_PAUSE_PARTNERS_MOVELIST_FLOWER].pos.x = D_PAL_80271B48[gCurrentLanguage]; #endif gPausePartnersCurrentPartnerIdx = 0; @@ -695,7 +695,7 @@ void pause_partners_handle_input(MenuPanel* panel) { level = 2; } - gWindows[WINDOW_ID_PAUSE_PARTNERS_MOVELIST].height = level * 13 + 30; + gWindows[WIN_PAUSE_PARTNERS_MOVELIST].height = level * 13 + 30; if (gPausePartnersLevel == 1) { oldPos = gPausePartnersSelectedMove; @@ -730,7 +730,7 @@ void pause_partners_handle_input(MenuPanel* panel) { if ((gPausePressedButtons & BUTTON_A) && gPausePartnersLevel == 0) { gPausePartnersLevel = 1; sfx_play_sound(SOUND_MENU_NEXT); - set_window_update(WINDOW_ID_PAUSE_PARTNERS_MOVELIST, WINDOW_UPDATE_SHOW); + set_window_update(WIN_PAUSE_PARTNERS_MOVELIST, WINDOW_UPDATE_SHOW); return; } @@ -742,7 +742,7 @@ void pause_partners_handle_input(MenuPanel* panel) { } else { gPausePartnersLevel = 0; sfx_play_sound(SOUND_MENU_BACK); - set_window_update(WINDOW_ID_PAUSE_PARTNERS_MOVELIST, WINDOW_UPDATE_HIDE); + set_window_update(WIN_PAUSE_PARTNERS_MOVELIST, WINDOW_UPDATE_HIDE); return; } } diff --git a/src/pause/pause_spirits.c b/src/pause/pause_spirits.c index cd208ca283..8148129036 100644 --- a/src/pause/pause_spirits.c +++ b/src/pause/pause_spirits.c @@ -99,7 +99,7 @@ Vec2i gPauseSpiritsCursorPositions[] = { }; MenuWindowBP gPauseSpiritsWindowsBPs[] = { { - .windowID = WINDOW_ID_PAUSE_SPIRITS, + .windowID = WIN_PAUSE_SPIRITS, .unk_01 = 0, .pos = { .x = 3, .y = 16 }, .width = 289, @@ -107,13 +107,13 @@ MenuWindowBP gPauseSpiritsWindowsBPs[] = { .priority = WINDOW_PRIORITY_1, .fpDrawContents = &pause_spirits_draw_contents, .tab = NULL, - .parentID = WINDOW_ID_PAUSE_MAIN, + .parentID = WIN_PAUSE_MAIN, .fpUpdate = { WINDOW_UPDATE_HIDE }, .extraFlags = 0, .style = { .customStyle = &gPauseWS_23 } }, { - .windowID = WINDOW_ID_PAUSE_SPIRITS_TITLE, + .windowID = WIN_PAUSE_SPIRITS_TITLE, .unk_01 = 0, .pos = { .x = 86, .y = 124 }, .width = 120, @@ -121,7 +121,7 @@ MenuWindowBP gPauseSpiritsWindowsBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &pause_spirits_draw_title, .tab = NULL, - .parentID = WINDOW_ID_PAUSE_SPIRITS, + .parentID = WIN_PAUSE_SPIRITS, .fpUpdate = { WINDOW_UPDATE_SHOW }, .extraFlags = 0, .style = { .customStyle = &gPauseWS_24 } @@ -132,7 +132,7 @@ MenuPanel gPausePanelSpirits = { .col = 2, .row = 0, .selected = 0, - .page = 0, + .state = 0, .numCols = 5, .numRows = 2, .numPages = 0, @@ -239,7 +239,7 @@ void pause_spirits_draw_contents(MenuPanel* menu, s32 baseX, s32 baseY, s32 widt draw_box(0, &gPauseWS_25, baseX + 7, baseY + 14, 0, 272, 126, opacity, darkening, 1.0f, 1.0f, 0, 0, 0, 0, 0, 0, width, height, 0); if (gPauseMenuCurrentTab == 5) { - pause_set_cursor_pos(WINDOW_ID_PAUSE_SPIRITS, baseX + gPauseSpiritsCursorPositions[menu->selected].x, baseY + gPauseSpiritsCursorPositions[menu->selected].y); + pause_set_cursor_pos(WIN_PAUSE_SPIRITS, baseX + gPauseSpiritsCursorPositions[menu->selected].x, baseY + gPauseSpiritsCursorPositions[menu->selected].y); } } diff --git a/src/pause/pause_stats.c b/src/pause/pause_stats.c index 736caa55df..f73677537b 100644 --- a/src/pause/pause_stats.c +++ b/src/pause/pause_stats.c @@ -132,7 +132,7 @@ s32 D_8024F46C[] = { -1, 1, 2, 4, 5, 7, 8 }; MenuWindowBP gStatsMenuWindowBPs[] = { { - .windowID = WINDOW_ID_PAUSE_STATS, + .windowID = WIN_PAUSE_STATS, .unk_01 = 0, .pos = { .x = 3, .y = 16 }, .width = 289, @@ -140,7 +140,7 @@ MenuWindowBP gStatsMenuWindowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = &pause_stats_draw_contents, .tab = NULL, - .parentID = WINDOW_ID_PAUSE_MAIN, + .parentID = WIN_PAUSE_MAIN, .fpUpdate = { WINDOW_UPDATE_HIDE }, .extraFlags = 0, .style = { .customStyle = &gPauseWS_12 } @@ -151,7 +151,7 @@ MenuPanel gPausePanelStats = { .col = 0, .row = 0, .selected = 0, - .page = 0, + .state = 0, .numCols = 2, .numRows = 7, .numPages = 0, @@ -593,7 +593,7 @@ void pause_stats_draw_contents(MenuPanel* menu, s32 baseX, s32 baseY, s32 width, if (gPauseMenuCurrentTab == 1) { StatsEntryData* entry = &gStatsMenuEntries[menu->selected]; - pause_set_cursor_pos(WINDOW_ID_PAUSE_STATS, baseX + entry->cursorX, baseY + entry->cursorY); + pause_set_cursor_pos(WIN_PAUSE_STATS, baseX + entry->cursorX, baseY + entry->cursorY); } } #endif diff --git a/src/pause/pause_tabs.c b/src/pause/pause_tabs.c index 38901d2f02..badd88fc94 100644 --- a/src/pause/pause_tabs.c +++ b/src/pause/pause_tabs.c @@ -69,11 +69,11 @@ HudScript* gPauseTabsHudScripts[][6] = { s8 gPauseTabsGridData[] = { 0, 1, 2, 3, 4, 5 }; u8 gPauseTabsPanelIDs[] = { 1, 2, 3, 4, 5, 6 }; -u8 gPauseTabsWindowIDs[] = { WINDOW_ID_PAUSE_TAB_STATS, WINDOW_ID_PAUSE_TAB_BADGES, WINDOW_ID_PAUSE_TAB_ITEMS, WINDOW_ID_PAUSE_TAB_PARTY, WINDOW_ID_PAUSE_TAB_SPIRITS, WINDOW_ID_PAUSE_TAB_MAP }; -u8 gPauseTabsPageWindowIDs[] = { WINDOW_ID_PAUSE_STATS, WINDOW_ID_PAUSE_BADGES, WINDOW_ID_PAUSE_ITEMS, WINDOW_ID_PAUSE_PARTNERS, WINDOW_ID_PAUSE_SPIRITS, WINDOW_ID_PAUSE_MAP }; +u8 gPauseTabsWindowIDs[] = { WIN_PAUSE_TAB_STATS, WIN_PAUSE_TAB_BADGES, WIN_PAUSE_TAB_ITEMS, WIN_PAUSE_TAB_PARTY, WIN_PAUSE_TAB_SPIRITS, WIN_PAUSE_TAB_MAP }; +u8 gPauseTabsPageWindowIDs[] = { WIN_PAUSE_STATS, WIN_PAUSE_BADGES, WIN_PAUSE_ITEMS, WIN_PAUSE_PARTNERS, WIN_PAUSE_SPIRITS, WIN_PAUSE_MAP }; MenuWindowBP gPauseTabsWindowBPs[] = { { - .windowID = WINDOW_ID_PAUSE_TAB_STATS, + .windowID = WIN_PAUSE_TAB_STATS, .unk_01 = 0, .pos = { .x = 0, .y = 7 }, .width = 43, @@ -81,13 +81,13 @@ MenuWindowBP gPauseTabsWindowBPs[] = { .priority = WINDOW_PRIORITY_64, .fpDrawContents = pause_tabs_draw_stats, .tab = NULL, - .parentID = WINDOW_ID_PAUSE_MAIN, + .parentID = WIN_PAUSE_MAIN, .fpUpdate = { WINDOW_UPDATE_SHOW }, .extraFlags = 0, .style = { .customStyle = &gPauseWS_3 } }, { - .windowID = WINDOW_ID_PAUSE_TAB_BADGES, + .windowID = WIN_PAUSE_TAB_BADGES, .unk_01 = 0, .pos = { .x = 0, .y = 7 }, .width = 43, @@ -95,13 +95,13 @@ MenuWindowBP gPauseTabsWindowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = pause_tabs_draw_badges, .tab = NULL, - .parentID = WINDOW_ID_PAUSE_MAIN, + .parentID = WIN_PAUSE_MAIN, .fpUpdate = { .func = pause_update_tab_default }, .extraFlags = 0, .style = { .customStyle = &gPauseWS_4 } }, { - .windowID = WINDOW_ID_PAUSE_TAB_ITEMS, + .windowID = WIN_PAUSE_TAB_ITEMS, .unk_01 = 0, .pos = { .x = 0, .y = 7 }, .width = 43, @@ -109,13 +109,13 @@ MenuWindowBP gPauseTabsWindowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = pause_tabs_draw_items, .tab = NULL, - .parentID = WINDOW_ID_PAUSE_MAIN, + .parentID = WIN_PAUSE_MAIN, .fpUpdate = { .func = pause_update_tab_default }, .extraFlags = 0, .style = { .customStyle = &gPauseWS_5 } }, { - .windowID = WINDOW_ID_PAUSE_TAB_PARTY, + .windowID = WIN_PAUSE_TAB_PARTY, .unk_01 = 0, .pos = { .x = 0, .y = 7 }, .width = 43, @@ -123,13 +123,13 @@ MenuWindowBP gPauseTabsWindowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = pause_tabs_draw_party, .tab = NULL, - .parentID = WINDOW_ID_PAUSE_MAIN, + .parentID = WIN_PAUSE_MAIN, .fpUpdate = { .func = pause_update_tab_default }, .extraFlags = 0, .style = { .customStyle = &gPauseWS_6 } }, { - .windowID = WINDOW_ID_PAUSE_TAB_SPIRITS, + .windowID = WIN_PAUSE_TAB_SPIRITS, .unk_01 = 0, .pos = { .x = 0, .y = 7 }, .width = 43, @@ -137,13 +137,13 @@ MenuWindowBP gPauseTabsWindowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = pause_tabs_draw_spirits, .tab = NULL, - .parentID = WINDOW_ID_PAUSE_MAIN, + .parentID = WIN_PAUSE_MAIN, .fpUpdate = { .func = pause_update_tab_default }, .extraFlags = 0, .style = { .customStyle = &gPauseWS_7 } }, { - .windowID = WINDOW_ID_PAUSE_TAB_MAP, + .windowID = WIN_PAUSE_TAB_MAP, .unk_01 = 0, .pos = { .x = 0, .y = 7 }, .width = 43, @@ -151,13 +151,13 @@ MenuWindowBP gPauseTabsWindowBPs[] = { .priority = WINDOW_PRIORITY_0, .fpDrawContents = pause_tabs_draw_map, .tab = NULL, - .parentID = WINDOW_ID_PAUSE_MAIN, + .parentID = WIN_PAUSE_MAIN, .fpUpdate = { .func = pause_update_tab_default }, .extraFlags = 0, .style = { .customStyle = &gPauseWS_8 } }, { - .windowID = WINDOW_ID_PAUSE_TAB_INVIS, + .windowID = WIN_PAUSE_TAB_INVIS, .unk_01 = 0, .pos = { .x = 8, .y = 8 }, .width = 16, @@ -165,7 +165,7 @@ MenuWindowBP gPauseTabsWindowBPs[] = { .priority = WINDOW_PRIORITY_64, .fpDrawContents = pause_tabs_draw_invis, .tab = NULL, - .parentID = WINDOW_ID_NONE, + .parentID = WIN_NONE, .fpUpdate = { WINDOW_UPDATE_SHOW }, .extraFlags = 0, .style = { .customStyle = &gPauseWS_9 } @@ -187,7 +187,7 @@ MenuPanel gPausePanelTabs = { .col = 0, .row = 0, .selected = 0, - .page = 0, + .state = 0, .numCols = 6, .numRows = 1, .numPages = 0, @@ -327,7 +327,7 @@ void pause_tabs_init(MenuPanel* tab) { } setup_pause_menu_tab(gPauseTabsWindowBPs, ARRAY_COUNT(gPauseTabsWindowBPs)); - gWindows[WINDOW_ID_PAUSE_TAB_INVIS].pos.y = 25; + gWindows[WIN_PAUSE_TAB_INVIS].pos.y = 25; gPauseTabsHorizScrollPos = 0; tab->initialized = TRUE; gPauseTabsPreviousTab = 5; @@ -363,10 +363,10 @@ void pause_tabs_handle_input(MenuPanel* tab) { replace_window_update(gPauseTabsWindowIDs[tab->col], 0x40, pause_update_tab_active); replace_window_update(gPauseTabsWindowIDs[gPauseTabsCurrentTab], 0x40, pause_update_tab_inactive); - pauseWindows = &gWindows[WINDOW_ID_PAUSE_TAB_STATS]; + pauseWindows = &gWindows[WIN_PAUSE_TAB_STATS]; x = pauseWindows[tab->col].pos.x; - gWindows[WINDOW_ID_PAUSE_TAB_INVIS].pos.x = x + 6; - gWindows[WINDOW_ID_PAUSE_TAB_INVIS].pos.y = 25; + gWindows[WIN_PAUSE_TAB_INVIS].pos.x = x + 6; + gWindows[WIN_PAUSE_TAB_INVIS].pos.y = 25; gPauseTabsPreviousTab = gPauseTabsCurrentTab; gPauseTabsCurrentTab = tab->col; sfx_play_sound(SOUND_MENU_CHANGE_TAB); diff --git a/src/state_file_select.c b/src/state_file_select.c index 0a6a82fcd5..4b0c7ddaa0 100644 --- a/src/state_file_select.c +++ b/src/state_file_select.c @@ -126,7 +126,7 @@ void state_step_language_select(void) { gOverrideFlags &= ~GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; } else { gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; - set_windows_visible(WINDOW_GROUP_FILE_MENU); + set_windows_visible(WINDOW_GROUP_FILES); D_800A0930 = 1; D_800A0931 = 3; } @@ -183,7 +183,7 @@ void state_step_file_select(void) { switch (D_800A0931) { case 1: - set_windows_visible(WINDOW_GROUP_FILE_MENU); + set_windows_visible(WINDOW_GROUP_FILES); D_800A0930 = temp; D_800A0931 = 2; break; @@ -388,7 +388,7 @@ void state_step_exit_file_select(void) { for (i = 44; i < ARRAY_COUNT(gWindows); i++) { Window* window = &gWindows[i]; - if (window->parent == WINDOW_ID_FILEMENU_MAIN || window->parent == -1) { + if (window->parent == WIN_FILES_MAIN || window->parent == WIN_NONE) { flagSum += window->flags & WINDOW_FLAG_INITIAL_ANIMATION; } } diff --git a/src/state_logos.c b/src/state_logos.c index 026b96f764..d38a38685d 100644 --- a/src/state_logos.c +++ b/src/state_logos.c @@ -6,6 +6,7 @@ #include "nu/nusys.h" #include "fio.h" #include "game_modes.h" +#include "dx/versioning.h" void appendGfx_intro_logos(void); @@ -20,18 +21,18 @@ void appendGfx_intro_logos(void); #endif enum LogoStates { - LOGOS_STATE_N64_FADE_IN = 0x00000000, - LOGOS_STATE_N64_HOLD = 0x00000001, - LOGOS_STATE_N64_FADE_OUT = 0x00000002, - LOGOS_STATE_NINTENDO_FADE_IN = 0x00000003, - LOGOS_STATE_NINTENDO_HOLD = 0x00000004, - LOGOS_STATE_NINTENDO_FADE_OUT = 0x00000005, - LOGOS_STATE_IS_FADE_IN = 0x00000006, - LOGOS_STATE_IS_HOLD_1 = 0x00000007, - LOGOS_STATE_IS_HOLD_2 = 0x00000008, - LOGOS_STATE_IS_FADE_OUT = 0x00000009, - LOGOS_STATE_CURTAINS_APPEAR = 0x0000000A, - LOGOS_STATE_CLEANUP = 0x0000000B, + LOGOS_STATE_N64_FADE_IN = 0x0, + LOGOS_STATE_N64_HOLD = 0x1, + LOGOS_STATE_N64_FADE_OUT = 0x2, + LOGOS_STATE_NINTENDO_FADE_IN = 0x3, + LOGOS_STATE_NINTENDO_HOLD = 0x4, + LOGOS_STATE_NINTENDO_FADE_OUT = 0x5, + LOGOS_STATE_IS_FADE_IN = 0x6, + LOGOS_STATE_IS_HOLD_1 = 0x7, + LOGOS_STATE_IS_HOLD_2 = 0x8, + LOGOS_STATE_IS_FADE_OUT = 0x9, + LOGOS_STATE_CURTAINS_APPEAR = 0xA, + LOGOS_STATE_CLEANUP = 0xB, }; s32 D_800778C0[] = { 0, 0 }; diff --git a/src/state_pause.c b/src/state_pause.c index 7a381fdee6..21367a4511 100644 --- a/src/state_pause.c +++ b/src/state_pause.c @@ -53,7 +53,7 @@ void state_init_pause(void) { StepPauseAlpha = 0; disable_player_input(); set_time_freeze_mode(TIME_FREEZE_POPUP_MENU); - set_windows_visible(WINDOW_GROUP_PAUSE_MENU); + set_windows_visible(WINDOW_GROUP_PAUSE); } extern Addr D_80200000; diff --git a/src/state_startup.c b/src/state_startup.c index f9b53c4f76..77cb7c35bf 100644 --- a/src/state_startup.c +++ b/src/state_startup.c @@ -4,6 +4,7 @@ #include "sprite.h" #include "game_modes.h" #include "dx/config.h" +#include "dx/versioning.h" void state_init_startup(void) { gOverrideFlags |= GLOBAL_OVERRIDES_DISABLE_DRAW_FRAME; diff --git a/src/state_title_screen.c b/src/state_title_screen.c index ff79a72739..09bb22696e 100644 --- a/src/state_title_screen.c +++ b/src/state_title_screen.c @@ -5,6 +5,7 @@ #include "game_modes.h" #include "fio.h" #include "dx/config.h" +#include "dx/versioning.h" #if VERSION_JP #define TITLE_WIDTH 272 @@ -28,13 +29,13 @@ enum TitleScreenStates { - TITLE_STATE_INIT = 0x00000000, - TITLE_STATE_APPEAR = 0x00000001, - TITLE_STATE_HOLD = 0x00000002, // show the title screen with PRESS START blinking - TITLE_STATE_UNUSED = 0x00000003, - TITLE_STATE_BEGIN_DISMISS = 0x00000004, - TITLE_STATE_DISMISS = 0x00000005, - TITLE_STATE_EXIT = 0x00000006, + TITLE_STATE_INIT = 0, + TITLE_STATE_APPEAR = 1, + TITLE_STATE_HOLD = 2, // show the title screen with PRESS START blinking + TITLE_STATE_UNUSED = 3, + TITLE_STATE_BEGIN_DISMISS = 4, + TITLE_STATE_DISMISS = 5, + TITLE_STATE_EXIT = 6, }; enum { @@ -46,14 +47,19 @@ enum { s16 TitleScreenNextState = NEXT_STATE_NONE; -FileDisplayData gFilesDisplayData[4] = { +SaveFileSummary gSaveSlotSummary[4] = { { .filename = { FILENAME_ERROR } }, { .filename = { FILENAME_ERROR } }, { .filename = { FILENAME_ERROR } }, { .filename = { FILENAME_ERROR } }, }; -u8 gSaveSlotHasData[4] = { TRUE, TRUE, TRUE, TRUE }; +SaveSlotMetadata gSaveSlotMetadata[4] = { + { .hasData = TRUE }, + { .hasData = TRUE }, + { .hasData = TRUE }, + { .hasData = TRUE }, +}; s32 PressStart_Alpha = 0; // the opacity of "PRESS START" text b32 PressStart_IsVisible = FALSE; // toggles the visibility of "PRESS START" diff --git a/src/status_icons.c b/src/status_icons.c index eeb5e4a68c..c7ba83655c 100644 --- a/src/status_icons.c +++ b/src/status_icons.c @@ -128,7 +128,7 @@ void func_80045AC0(void) { for (i = 0; i < ARRAY_COUNT(D_800A0BC0); i++) { PopupMessage* popup = &D_800A0BC0[i]; popup->active = FALSE; - popup->message = NULL; + popup->data.icons = NULL; } create_worker_world(NULL, func_80045BC8); @@ -140,8 +140,8 @@ void func_80045B10(void) { for (i = 0; i < ARRAY_COUNT(D_800A0BC0); i++) { PopupMessage* popup = &D_800A0BC0[i]; - if (popup->message != NULL) { - heap_free(popup->message); + if (popup->data.icons != NULL) { + heap_free(popup->data.icons); } popup->active = FALSE; } @@ -195,9 +195,9 @@ PopupMessage* get_current_merlee_message(void) { } void dispose_merlee_message(PopupMessage* popup) { - if (popup->message != NULL) { - heap_free(popup->message); - popup->message = NULL; + if (popup->data.icons != NULL) { + heap_free(popup->data.icons); + popup->data.icons = NULL; } popup->active = FALSE; } @@ -248,7 +248,7 @@ void update_merlee_message(void* data) { } if (closeMessage) { - set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_HIDE); + set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_HIDE); D_800A0F40 = 0; dispose_merlee_message(popup); } @@ -294,8 +294,8 @@ void draw_merlee_message(void* data) { width = get_msg_width(messageID, 0) + 23; xPos = 160 - (width / 2); height = 45; - set_window_properties(WINDOW_ID_BATTLE_POPUP, xPos, 80, width, height, WINDOW_PRIORITY_0, draw_merlee_message_string, popup, -1); - set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_SHOW); + set_window_properties(WIN_BTL_POPUP, xPos, 80, width, height, WINDOW_PRIORITY_0, draw_merlee_message_string, popup, -1); + set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_SHOW); } break; @@ -306,8 +306,8 @@ void draw_merlee_message(void* data) { width = get_msg_width(messageID, 0) + 23; xPos = 160 - (width / 2); height = 28; - set_window_properties(WINDOW_ID_BATTLE_POPUP, xPos, 80, width, height, WINDOW_PRIORITY_0, draw_merlee_message_string, popup, -1); - set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_SHOW); + set_window_properties(WIN_BTL_POPUP, xPos, 80, width, height, WINDOW_PRIORITY_0, draw_merlee_message_string, popup, -1); + set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_SHOW); } break; } @@ -322,8 +322,8 @@ void draw_merlee_message(void* data) { messageID = D_80078168[popup->messageIndex]; width = get_msg_width(messageID, 0) + 30; xPos = 160 - (width / 2); - set_window_properties(WINDOW_ID_BATTLE_POPUP, xPos, 80, width, D_80078160[get_msg_lines(messageID) - 1], 0, draw_merlee_message_string, popup, -1); - set_window_update(WINDOW_ID_BATTLE_POPUP, WINDOW_UPDATE_SHOW); + set_window_properties(WIN_BTL_POPUP, xPos, 80, width, D_80078160[get_msg_lines(messageID) - 1], 0, draw_merlee_message_string, popup, -1); + set_window_update(WIN_BTL_POPUP, WINDOW_UPDATE_SHOW); } #endif } @@ -342,8 +342,8 @@ void init_all_status_icons(void) { popup->unk_00 = 0; popup->renderWorldFunc = NULL; popup->renderUIFunc = draw_all_status_icons; - popup->message = general_heap_malloc(64 * sizeof(HudStatusIcon)); - icons = D_800A0F44 = (HudStatusIcon*)(popup->message); + popup->data.icons = general_heap_malloc(MAX_ICONS * sizeof(HudStatusIcon)); + icons = D_800A0F44 = popup->data.icons; ASSERT(icons != NULL); for (i = 0; i < MAX_ICONS; i++, icons++) diff --git a/src/vars_access.c b/src/vars_access.c index 1b5cf3c73f..a2c01c7028 100644 --- a/src/vars_access.c +++ b/src/vars_access.c @@ -1,5 +1,6 @@ #include "common.h" #include "vars_access.h" +#include "dx/versioning.h" void clear_saved_variables(void) { SaveData* saveFile = &gCurrentSaveFile; diff --git a/src/windows.c b/src/windows.c index 8ec77c6a80..7f11373f0a 100644 --- a/src/windows.c +++ b/src/windows.c @@ -126,37 +126,34 @@ u8 gWindowDisappearFlags[] = { DRAW_FLAG_ROTSCALE, DRAW_FLAG_ROTSCALE, DRAW_FLAG DRAW_FLAG_ROTSCALE, DRAW_FLAG_ROTSCALE, 0 }; WindowGroup gWindowGroups[] = { - { WINDOW_ID_0, WINDOW_ID_FILEMENU_FILE3_TITLE }, // all windows - { WINDOW_ID_8, WINDOW_ID_BATTLE_POPUP }, // battle ? - { WINDOW_ID_PAUSE_MAIN, WINDOW_ID_PAUSE_TAB_INVIS }, // pause menu - { WINDOW_ID_FILEMENU_MAIN, WINDOW_ID_FILEMENU_FILE3_TITLE } // file menu + [WINDOW_GROUP_ALL] { WIN_UNUSED_0, WIN_FILES_SLOT3_TITLE }, + [WINDOW_GROUP_BATTLE] { WIN_BTL_DESC_BOX, WIN_BTL_POPUP }, + [WINDOW_GROUP_PAUSE] { WIN_PAUSE_MAIN, WIN_PAUSE_TAB_INVIS }, + [WINDOW_GROUP_FILES] { WIN_FILES_MAIN, WIN_FILES_SLOT3_TITLE }, }; void clear_windows(void) { - Window* window = gWindows; s32 i; - for (i = 0; i < ARRAY_COUNT(gWindows); i++, window++) { - window->flags = 0; + for (i = 0; i < ARRAY_COUNT(gWindows); i++) { + gWindows[i].flags = 0; } } void update_windows(void) { - Window* window; s32 i; - u8 flags; - for (i = 0, window = gWindows; i < ARRAY_COUNT(gWindows); i++, window++) { - flags = window->flags; + for (i = 0; i < ARRAY_COUNT(gWindows); i++) { + u8 flags = gWindows[i].flags; if (!flags || (flags & WINDOW_FLAG_DISABLED)) { continue; } if (flags & WINDOW_FLAG_FPUPDATE_CHANGED) { - window->flags = flags & ~WINDOW_FLAG_FPUPDATE_CHANGED; - window->fpUpdate = window->fpPending; - window->updateCounter = 0; + gWindows[i].flags = flags & ~WINDOW_FLAG_FPUPDATE_CHANGED; + gWindows[i].fpUpdate = gWindows[i].fpPending; + gWindows[i].updateCounter = 0; } } } @@ -170,7 +167,7 @@ void basic_window_update(s32 windowID, s32* flags, s32* posX, s32* posY, s32* po window->flags &= ~WINDOW_FLAG_HIDDEN; } - if (counter < 5) { + if (counter <= 4) { *flags = gWindowAppearFlags[counter]; *scaleX = (f32)gWindowAppearScales[counter] * 0.01; *scaleY = (f32)gWindowAppearScales[counter] * 0.01; @@ -189,7 +186,7 @@ void basic_hidden_window_update(s32 windowID, s32* flags, s32* posX, s32* posY, Window* window = &gWindows[windowID]; s32 counter = window->updateCounter; - if (counter < 10) { + if (counter <= 9) { *flags = gWindowDisappearFlags[counter]; *scaleX = (f32)gWindowDisappearScales[counter] * 0.01; *scaleY = (f32)gWindowDisappearScales[counter] * 0.01; @@ -204,7 +201,7 @@ void basic_hidden_window_update(s32 windowID, s32* flags, s32* posX, s32* posY, } } -void main_menu_window_update(s32 windowID, s32* flags, s32* posX, s32* posY, s32* posZ, f32* scaleX, f32* scaleY, +void unused_main_menu_window_darkening(s32 windowID, s32* flags, s32* posX, s32* posY, s32* posZ, f32* scaleX, f32* scaleY, f32* rotX, f32* rotY, f32* rotZ, s32* darkening, s32* opacity) { Window* window = &gWindows[windowID]; s32 counter = window->updateCounter; @@ -236,15 +233,13 @@ void render_windows(s32* windowsArray, s32 parent, s32 flags, s32 baseX, s32 bas s32 width, height; s32 (*fpUpdateFunc)(s32 windowIndex, s32* flags, s32* posX, s32* posY, s32* posZ, f32* scaleX, f32* scaleY, f32* rotX, f32* rotY, f32* rotZ, s32* darkening, s32* opacity); - s32 childWindowIdCopy; WindowStyle windowStyle; void* fpDrawContents; void* drawContentsArg0; - s32* windowArrayIt; - for (i = 0, windowArrayIt = windowsArray; i < ARRAY_COUNT(gWindows); i++, windowArrayIt++) { + for (i = 0; i < ARRAY_COUNT(gWindows); i++) { window = &gWindows[parent]; - childWindowID = *windowArrayIt; + childWindowID = windowsArray[i]; if (childWindowID < 0) { continue; @@ -309,8 +304,6 @@ void render_windows(s32* windowsArray, s32 parent, s32 flags, s32 baseX, s32 bas drawContentsArg0 = childWindow->drawContentsArg0; windowStyle = gWindowStyles[childWindowID]; outMtx = matrix; - //needed to match - childWindowIdCopy = childWindowID; if (childDarkening > 255) { childDarkening = 255; @@ -321,14 +314,14 @@ void render_windows(s32* windowsArray, s32 parent, s32 flags, s32 baseX, s32 bas posY += baseY; } - if (parent == -1) { + if (parent == WIN_NONE) { boxTranslateX = SCREEN_WIDTH; } else { boxTranslateX = window->width; } boxTranslateY = SCREEN_HEIGHT; - if (parent != -1) { + if (parent != WIN_NONE) { boxTranslateY = window->height; } @@ -345,7 +338,7 @@ void render_windows(s32* windowsArray, s32 parent, s32 flags, s32 baseX, s32 bas } if (childWindow->flags & WINDOW_FLAG_HAS_CHILDREN) { - render_windows(windowsArray, childWindowIdCopy, childFlags, posX, posY, childOpacity, childDarkening, outMtx); + render_windows(windowsArray, childWindowID, childFlags, posX, posY, childOpacity, childDarkening, outMtx); } } } @@ -353,16 +346,15 @@ void render_windows(s32* windowsArray, s32 parent, s32 flags, s32 baseX, s32 bas void render_window_root(void) { s32 priorityArray[ARRAY_COUNT(gWindows)]; - s32* ptr = priorityArray; s32 i; - Window* window; for (i = 0; i < ARRAY_COUNT(gWindows); i++) { - *ptr++ = -1; + priorityArray[i] = WIN_NONE; } - for (i = 0, window = gWindows; i < ARRAY_COUNT(gWindows); window++, i++) { - if (window->flags != 0) { - priorityArray[window->priority] = i; + + for (i = 0; i < ARRAY_COUNT(gWindows); i++) { + if (gWindows[i].flags != 0) { + priorityArray[gWindows[i].priority] = i; } } @@ -375,7 +367,7 @@ void render_window_root(void) { gSPClipRatio(gMainGfxPos++, FRUSTRATIO_2); gDPSetColorImage(gMainGfxPos++, G_IM_FMT_RGBA, G_IM_SIZ_16b, SCREEN_WIDTH, osVirtualToPhysical(nuGfxCfb_ptr)); gDPPipeSync(gMainGfxPos++); - render_windows(priorityArray, WINDOW_ID_NONE, 0, 0, 0, 255, 0, NULL); + render_windows(priorityArray, WIN_NONE, 0, 0, 0, 255, 0, NULL); } void set_window_properties(s32 windowID, s32 posX, s32 posY, s32 width, s32 height, u8 priority, void* fpDrawContents, void* drawContentsArg0, s8 parent) { @@ -400,35 +392,33 @@ void set_window_properties(s32 windowID, s32 posX, s32 posY, s32 width, s32 heig void update_window_hierarchy(s32 windowID, u8 priority) { s32 priorityArray[ARRAY_COUNT(gWindows) + 1]; - s32* ptr; + s32 curPriority; s32 i; - s32 currentPriority; - Window* window; if (priority > ARRAY_COUNT(gWindows)) { priority = ARRAY_COUNT(gWindows); } - ptr = priorityArray; - for (i = 0; i < ARRAY_COUNT(priorityArray); i++, ptr++) { - *ptr = -1; + for (i = 0; i < ARRAY_COUNT(priorityArray); i++) { + priorityArray[i] = -1; } priorityArray[priority] = windowID; - for (i = 0, window = gWindows; i < ARRAY_COUNT(gWindows); i++, window++) { - if (window->flags && i != windowID) { - currentPriority = window->priority; - if (currentPriority >= priority) { - currentPriority++; + for (i = 0; i < ARRAY_COUNT(gWindows); i++) { + if (gWindows[i].flags && i != windowID) { + curPriority = gWindows[i].priority; + if (curPriority >= priority) { + curPriority++; } - priorityArray[currentPriority] = i; + priorityArray[curPriority] = i; } } - currentPriority = 0; - for (i = 0, ptr = priorityArray; i < ARRAY_COUNT(priorityArray); i++, ptr++) { - if (*ptr != -1) { - gWindows[*ptr].priority = currentPriority++; + curPriority = 0; + for (i = 0; i < ARRAY_COUNT(priorityArray); i++) { + s32 windowIdx = priorityArray[i]; + if (windowIdx != WIN_NONE) { + gWindows[windowIdx].priority = curPriority++; } } } @@ -453,17 +443,16 @@ void set_window_update(s32 windowID, s32 func) { } void set_windows_visible(s32 groupIdx) { - s32 i; - Window* window = gWindows; u8 min = gWindowGroups[groupIdx].min; u8 max = gWindowGroups[groupIdx].max; + s32 i; - for (i = 0; i < ARRAY_COUNT(gWindows); i++, window++) { - if (window->flags & WINDOW_FLAG_INITIALIZED) { + for (i = 0; i < ARRAY_COUNT(gWindows); i++) { + if (gWindows[i].flags & WINDOW_FLAG_INITIALIZED) { if (i < min || i > max) { - window->flags |= WINDOW_FLAG_DISABLED; + gWindows[i].flags |= WINDOW_FLAG_DISABLED; } else { - window->flags &= ~WINDOW_FLAG_DISABLED; + gWindows[i].flags &= ~WINDOW_FLAG_DISABLED; } } } @@ -472,7 +461,7 @@ void set_windows_visible(s32 groupIdx) { void setup_pause_menu_tab(MenuWindowBP* bp, s32 count) { s32 i; - for (i = 0; i < count; i++, bp++) { + for (i = 0; i < count; i++) { set_window_properties(bp->windowID, bp->pos.x, bp->pos.y, bp->width, bp->height, bp->priority, bp->fpDrawContents, bp->tab, bp->parentID); if (bp->style.defaultStyleID != -1) { @@ -480,6 +469,7 @@ void setup_pause_menu_tab(MenuWindowBP* bp, s32 count) { } set_window_update(bp->windowID, bp->fpUpdate.i); gWindows[bp->windowID].flags |= bp->extraFlags; + bp++; } } diff --git a/src/world/area_kkj/kkj_19/kkj_19_2_main.c b/src/world/area_kkj/kkj_19/kkj_19_2_main.c index d645a77788..293977eb0b 100644 --- a/src/world/area_kkj/kkj_19/kkj_19_2_main.c +++ b/src/world/area_kkj/kkj_19/kkj_19_2_main.c @@ -42,11 +42,11 @@ API_CALLABLE(N(TryOpenIngredientWindows)) { void N(worker_update_ingredient_windows)(void) { if (N(IngredientWindowsOpen)) { - set_window_update(WINDOW_ID_ITEM_INFO_NAME, (s32)basic_window_update); - set_window_update(WINDOW_ID_ITEM_INFO_DESC, (s32)basic_window_update); + set_window_update(WIN_SHOP_ITEM_NAME, (s32)basic_window_update); + set_window_update(WIN_SHOP_ITEM_DESC, (s32)basic_window_update); } else { - set_window_update(WINDOW_ID_ITEM_INFO_NAME, (s32)basic_hidden_window_update); - set_window_update(WINDOW_ID_ITEM_INFO_DESC, (s32)basic_hidden_window_update); + set_window_update(WIN_SHOP_ITEM_NAME, (s32)basic_hidden_window_update); + set_window_update(WIN_SHOP_ITEM_DESC, (s32)basic_hidden_window_update); } if (N(IngredientWindowsDismissTime) > 0) { @@ -111,7 +111,7 @@ WindowStyleCustom N(IngredientNameWS) = { MenuWindowBP N(IngredientWindows)[] = { { - .windowID = WINDOW_ID_ITEM_INFO_NAME, + .windowID = WIN_SHOP_ITEM_NAME, .pos = { 100, 66 }, .width = 120, .height = 28, @@ -124,7 +124,7 @@ MenuWindowBP N(IngredientWindows)[] = { .style = { .customStyle = &N(IngredientNameWS) }, }, { - .windowID = WINDOW_ID_ITEM_INFO_DESC, + .windowID = WIN_SHOP_ITEM_DESC, .pos = { 32, 184 }, .width = 256, .height = 32, diff --git a/src/world/script_api/shops.c b/src/world/script_api/shops.c index a034078efb..a992ae7d96 100644 --- a/src/world/script_api/shops.c +++ b/src/world/script_api/shops.c @@ -798,11 +798,11 @@ void draw_shop_items(void) { ShopItemEntity* shopItemEntities; if (shop->flags & SHOP_FLAG_SHOWING_ITEM_INFO) { - set_window_update(WINDOW_ID_ITEM_INFO_NAME, (s32) basic_window_update); - set_window_update(WINDOW_ID_ITEM_INFO_DESC, (s32) basic_window_update); + set_window_update(WIN_SHOP_ITEM_NAME, (s32) basic_window_update); + set_window_update(WIN_SHOP_ITEM_DESC, (s32) basic_window_update); } else { - set_window_update(WINDOW_ID_ITEM_INFO_NAME, (s32) basic_hidden_window_update); - set_window_update(WINDOW_ID_ITEM_INFO_DESC, (s32) basic_hidden_window_update); + set_window_update(WIN_SHOP_ITEM_NAME, (s32) basic_hidden_window_update); + set_window_update(WIN_SHOP_ITEM_DESC, (s32) basic_hidden_window_update); } if (shop->flags & SHOP_FLAG_SHOWING_ITEM_INFO) { @@ -937,8 +937,8 @@ API_CALLABLE(MakeShop) { hud_element_set_flags(shop->costIconID, HUD_ELEMENT_FLAG_80); hud_element_clear_flags(shop->costIconID, HUD_ELEMENT_FLAG_FILTER_TEX); get_worker(create_worker_frontUI(NULL, draw_shop_items)); - set_window_properties(WINDOW_ID_ITEM_INFO_NAME, 100, 66, 120, 28, WINDOW_PRIORITY_0, shop_draw_item_name, NULL, -1); - set_window_properties(WINDOW_ID_ITEM_INFO_DESC, 32, 184, 256, 32, WINDOW_PRIORITY_1, shop_draw_item_desc, NULL, -1); + set_window_properties(WIN_SHOP_ITEM_NAME, 100, 66, 120, 28, WINDOW_PRIORITY_0, shop_draw_item_name, NULL, -1); + set_window_properties(WIN_SHOP_ITEM_DESC, 32, 184, 256, 32, WINDOW_PRIORITY_1, shop_draw_item_desc, NULL, -1); gWindowStyles[10].defaultStyleID = WINDOW_STYLE_9; gWindowStyles[11].defaultStyleID = WINDOW_STYLE_3; shop->curItemSlot = 0; diff --git a/ver/ique/symbol_addrs.txt b/ver/ique/symbol_addrs.txt index 6099cd92d7..2c9077fd18 100644 --- a/ver/ique/symbol_addrs.txt +++ b/ver/ique/symbol_addrs.txt @@ -510,13 +510,13 @@ filemenu_char_color = 0x8024bbbc; // segment:filemenu filemenu_savedGfxPos = 0x8024bbb0; // segment:filemenu filemenu_dl_draw_char_init = 0x8024bb48; // segment:filemenu filemenu_glyphBuffer = 0x8024c4d0; // segment:filemenu -filemenu_iterFileIdx = 0x8024c440; // segment:filemenu -filemenu_loadedFileIdx = 0x8024c454; // segment:filemenu +filemenu_CopyToFileIdx = 0x8024c440; // segment:filemenu +filemenu_CopyFromFileIdx = 0x8024c454; // segment:filemenu filemenu_filename = 0x8024ced0; // segment:filemenu filemenu_set_cursor_alpha = 0x80242dec; // segment:filemenu gSaveSlotHasData = 0x80076684; -gSaveSlotMetadata = 0x80076624; +gSaveSlotSummary = 0x80076624; MsgCharsets = 0x802eb5a8; load_font_data = 0x80121ae8; D_802F4560 = 0x802f4558; @@ -4058,12 +4058,12 @@ bActorNames = 0x802810C4; btl_init_menu_partner = 0x802638D4; btl_is_popup_displayed = 0x8024FAB4; btl_show_variable_battle_message = 0x8024FA04; -func_80263268 = 0x80263228; +btl_check_can_change_partner = 0x80263228; btl_show_battle_message = 0x8024F960; get_player_anim_for_status = 0x80265D04; HES_MenuDoNothing = 0x80292260; HES_MenuDoNothingDisabled = 0x80292288; -func_80263300 = 0x802632C0; +btl_init_menu_items = 0x802632C0; HES_MenuFlee = 0x80292120; HES_MenuFleeDisabled = 0x80292148; HES_MenuStrategies = 0x802921C0; diff --git a/ver/jp/symbol_addrs.txt b/ver/jp/symbol_addrs.txt index 414d9637e3..7d2a616c2c 100644 --- a/ver/jp/symbol_addrs.txt +++ b/ver/jp/symbol_addrs.txt @@ -180,7 +180,7 @@ theater_wall_shadows_vtx = 0x80075DC0; TheaterWallShadowsGfx = 0x80075E40; ui_no_controller_png = 0x80076120; gCurrentCameraID = 0x800773E0; -gSaveSlotMetadata = 0x80077994; +gSaveSlotSummary = 0x80077994; __osRunQueue = 0x80094638; __osRunningThread = 0x80094640; __osFaultedThread = 0x80094644; @@ -2420,7 +2420,7 @@ gWindowAppearFlags = 0x80154340; // rom:0xE91D0 gWindowDisappearScales = 0x80154348; // rom:0xE91D8 gWindowDisappearFlags = 0x80154354; // rom:0xE91E4 gWindowGroups = 0x80154360; // rom:0xE91F0 -main_menu_window_update = 0x8014C700; // type:func rom:0xE1590 +unused_main_menu_window_darkening = 0x8014C700; // type:func rom:0xE1590 render_windows = 0x8014C748; // type:func rom:0xE15D8 update_window_hierarchy = 0x8014CE20; // type:func rom:0xE1CB0 replace_window_update = 0x8014CEF8; // type:func rom:0xE1D88 diff --git a/ver/pal/asm/nonmatchings/filemenu/filemenu_main/filemenu_main_handle_input.s b/ver/pal/asm/nonmatchings/filemenu/filemenu_main/filemenu_main_handle_input.s index e6b47c2725..80e433306e 100644 --- a/ver/pal/asm/nonmatchings/filemenu/filemenu_main/filemenu_main_handle_input.s +++ b/ver/pal/asm/nonmatchings/filemenu/filemenu_main/filemenu_main_handle_input.s @@ -691,8 +691,8 @@ glabel filemenu_main_handle_input /* 172FF0 8024A5D0 92630003 */ lbu $v1, 0x3($s3) /* 172FF4 8024A5D4 24020003 */ addiu $v0, $zero, 0x3 /* 172FF8 8024A5D8 A2620004 */ sb $v0, 0x4($s3) -/* 172FFC 8024A5DC 3C018025 */ lui $at, %hi(filemenu_loadedFileIdx) -/* 173000 8024A5E0 AC231754 */ sw $v1, %lo(filemenu_loadedFileIdx)($at) +/* 172FFC 8024A5DC 3C018025 */ lui $at, %hi(filemenu_CopyFromFileIdx) +/* 173000 8024A5E0 AC231754 */ sw $v1, %lo(filemenu_CopyFromFileIdx)($at) /* 173004 8024A5E4 08092A4F */ j .Lfilemenu_8024A93C /* 173008 8024A5E8 00000000 */ nop .Lfilemenu_8024A5EC: @@ -710,8 +710,8 @@ glabel filemenu_main_handle_input /* 173034 8024A614 104000C9 */ beqz $v0, .Lfilemenu_8024A93C /* 173038 8024A618 00000000 */ nop /* 17303C 8024A61C 92630003 */ lbu $v1, 0x3($s3) -/* 173040 8024A620 3C028025 */ lui $v0, %hi(filemenu_loadedFileIdx) -/* 173044 8024A624 8C421754 */ lw $v0, %lo(filemenu_loadedFileIdx)($v0) +/* 173040 8024A620 3C028025 */ lui $v0, %hi(filemenu_CopyFromFileIdx) +/* 173044 8024A624 8C421754 */ lw $v0, %lo(filemenu_CopyFromFileIdx)($v0) /* 173048 8024A628 14430005 */ bne $v0, $v1, .Lfilemenu_8024A640 /* 17304C 8024A62C 00000000 */ nop .Lfilemenu_8024A630: @@ -798,16 +798,16 @@ glabel filemenu_main_handle_input /* 17317C 8024A75C 24040032 */ addiu $a0, $zero, 0x32 /* 173180 8024A760 0C051A8B */ jal set_window_update /* 173184 8024A764 24050002 */ addiu $a1, $zero, 0x2 -/* 173188 8024A768 3C118025 */ lui $s1, %hi(filemenu_loadedFileIdx) -/* 17318C 8024A76C 26311754 */ addiu $s1, $s1, %lo(filemenu_loadedFileIdx) +/* 173188 8024A768 3C118025 */ lui $s1, %hi(filemenu_CopyFromFileIdx) +/* 17318C 8024A76C 26311754 */ addiu $s1, $s1, %lo(filemenu_CopyFromFileIdx) /* 173190 8024A770 0C00ACD3 */ jal fio_load_game /* 173194 8024A774 8E240000 */ lw $a0, 0x0($s1) /* 173198 8024A778 10400070 */ beqz $v0, .Lfilemenu_8024A93C /* 17319C 8024A77C 00000000 */ nop /* 1731A0 8024A780 3C108025 */ lui $s0, 0x8025 /* 1731A4 8024A784 26101740 */ addiu $s0, $s0, (0x80251740 & 0xFFFF) -/* 1731A8 8024A788 3C068007 */ lui $a2, %hi(gSaveSlotMetadata) -/* 1731AC 8024A78C 24C63D14 */ addiu $a2, $a2, %lo(gSaveSlotMetadata) +/* 1731A8 8024A788 3C068007 */ lui $a2, %hi(gSaveSlotSummary) +/* 1731AC 8024A78C 24C63D14 */ addiu $a2, $a2, %lo(gSaveSlotSummary) /* 1731B0 8024A790 8E040000 */ lw $a0, 0x0($s0) /* 1731B4 8024A794 8E250000 */ lw $a1, 0x0($s1) /* 1731B8 8024A798 0080102D */ daddu $v0, $a0, $zero @@ -1052,8 +1052,8 @@ glabel filemenu_main_handle_input /* 173538 8024AB18 08092AD2 */ j .Lfilemenu_8024AB48 /* 17353C 8024AB1C 00000000 */ nop .Lfilemenu_8024AB20: -/* 173540 8024AB20 3C058025 */ lui $a1, %hi(filemenu_loadedFileIdx) -/* 173544 8024AB24 8CA51754 */ lw $a1, %lo(filemenu_loadedFileIdx)($a1) +/* 173540 8024AB20 3C058025 */ lui $a1, %hi(filemenu_CopyFromFileIdx) +/* 173544 8024AB24 8CA51754 */ lw $a1, %lo(filemenu_CopyFromFileIdx)($a1) /* 173548 8024AB28 0260202D */ daddu $a0, $s3, $zero /* 17354C 8024AB2C 000537C2 */ srl $a2, $a1, 31 /* 173550 8024AB30 00A63021 */ addu $a2, $a1, $a2 diff --git a/ver/pal/asm/nonmatchings/filemenu/filemenu_yesno/filemenu_yesno_handle_input.s b/ver/pal/asm/nonmatchings/filemenu/filemenu_yesno/filemenu_yesno_handle_input.s index 04cfc6ad19..dfc6638e4a 100644 --- a/ver/pal/asm/nonmatchings/filemenu/filemenu_yesno/filemenu_yesno_handle_input.s +++ b/ver/pal/asm/nonmatchings/filemenu/filemenu_yesno/filemenu_yesno_handle_input.s @@ -187,8 +187,8 @@ glabel filemenu_yesno_handle_input /* 174048 8024B628 0000202D */ daddu $a0, $zero, $zero /* 17404C 8024B62C 3C028025 */ lui $v0, %hi(filemenu_menus) /* 174050 8024B630 8C42E984 */ lw $v0, %lo(filemenu_menus)($v0) -/* 174054 8024B634 3C068007 */ lui $a2, %hi(gSaveSlotMetadata) -/* 174058 8024B638 24C63D14 */ addiu $a2, $a2, %lo(gSaveSlotMetadata) +/* 174054 8024B634 3C068007 */ lui $a2, %hi(gSaveSlotSummary) +/* 174058 8024B638 24C63D14 */ addiu $a2, $a2, %lo(gSaveSlotSummary) /* 17405C 8024B63C 90500003 */ lbu $s0, 0x3($v0) /* 174060 8024B640 240500F7 */ addiu $a1, $zero, 0xF7 /* 174064 8024B644 00101040 */ sll $v0, $s0, 1 @@ -203,8 +203,8 @@ glabel filemenu_yesno_handle_input /* 174084 8024B664 1440FFFB */ bnez $v0, .Lfilemenu_8024B654 /* 174088 8024B668 00831021 */ addu $v0, $a0, $v1 /* 17408C 8024B66C 0200202D */ daddu $a0, $s0, $zero -/* 174090 8024B670 3C038007 */ lui $v1, %hi(gSaveSlotMetadata) -/* 174094 8024B674 24633D14 */ addiu $v1, $v1, %lo(gSaveSlotMetadata) +/* 174090 8024B670 3C038007 */ lui $v1, %hi(gSaveSlotSummary) +/* 174094 8024B674 24633D14 */ addiu $v1, $v1, %lo(gSaveSlotSummary) /* 174098 8024B678 00101040 */ sll $v0, $s0, 1 /* 17409C 8024B67C 00501021 */ addu $v0, $v0, $s0 /* 1740A0 8024B680 000210C0 */ sll $v0, $v0, 3 @@ -288,16 +288,16 @@ glabel filemenu_yesno_handle_input /* 1741C4 8024B7A4 24A57DFC */ addiu $a1, $a1, %lo(filemenu_update_hidden_name_confirm) /* 1741C8 8024B7A8 0C051A8B */ jal set_window_update /* 1741CC 8024B7AC 24040032 */ addiu $a0, $zero, 0x32 -/* 1741D0 8024B7B0 3C118025 */ lui $s1, %hi(filemenu_loadedFileIdx) -/* 1741D4 8024B7B4 26311754 */ addiu $s1, $s1, %lo(filemenu_loadedFileIdx) +/* 1741D0 8024B7B0 3C118025 */ lui $s1, %hi(filemenu_CopyFromFileIdx) +/* 1741D4 8024B7B4 26311754 */ addiu $s1, $s1, %lo(filemenu_CopyFromFileIdx) /* 1741D8 8024B7B8 0C00ACD3 */ jal fio_load_game /* 1741DC 8024B7BC 8E240000 */ lw $a0, 0x0($s1) /* 1741E0 8024B7C0 1040012E */ beqz $v0, .Lfilemenu_8024BC7C /* 1741E4 8024B7C4 00000000 */ nop /* 1741E8 8024B7C8 3C108025 */ lui $s0, 0x8025 /* 1741EC 8024B7CC 26101740 */ addiu $s0, $s0, (0x80251740 & 0xFFFF) -/* 1741F0 8024B7D0 3C068007 */ lui $a2, %hi(gSaveSlotMetadata) -/* 1741F4 8024B7D4 24C63D14 */ addiu $a2, $a2, %lo(gSaveSlotMetadata) +/* 1741F0 8024B7D0 3C068007 */ lui $a2, %hi(gSaveSlotSummary) +/* 1741F4 8024B7D4 24C63D14 */ addiu $a2, $a2, %lo(gSaveSlotSummary) /* 1741F8 8024B7D8 8E040000 */ lw $a0, 0x0($s0) /* 1741FC 8024B7DC 8E250000 */ lw $a1, 0x0($s1) /* 174200 8024B7E0 0080102D */ daddu $v0, $a0, $zero @@ -348,8 +348,8 @@ glabel filemenu_yesno_handle_input /* 1742B0 8024B890 0000202D */ daddu $a0, $zero, $zero /* 1742B4 8024B894 3C028025 */ lui $v0, %hi(filemenu_menus) /* 1742B8 8024B898 8C42E984 */ lw $v0, %lo(filemenu_menus)($v0) -/* 1742BC 8024B89C 3C078007 */ lui $a3, %hi(gSaveSlotMetadata) -/* 1742C0 8024B8A0 24E73D14 */ addiu $a3, $a3, %lo(gSaveSlotMetadata) +/* 1742BC 8024B89C 3C078007 */ lui $a3, %hi(gSaveSlotSummary) +/* 1742C0 8024B8A0 24E73D14 */ addiu $a3, $a3, %lo(gSaveSlotSummary) /* 1742C4 8024B8A4 90510003 */ lbu $s1, 0x3($v0) /* 1742C8 8024B8A8 3C068025 */ lui $a2, %hi(filemenu_filename) /* 1742CC 8024B8AC 24C627E0 */ addiu $a2, $a2, %lo(filemenu_filename) diff --git a/ver/pal/undefined_syms.txt b/ver/pal/undefined_syms.txt index 6985fb5200..11257dd293 100644 --- a/ver/pal/undefined_syms.txt +++ b/ver/pal/undefined_syms.txt @@ -250,7 +250,7 @@ gCurrentDisplayContextIndex = 0x80071504; nuGfxCfbNum = 0x80073710; gCurrentCameraID = 0x80073730; IntroMessageIdx = 0x80073D00; -gSaveSlotMetadata = 0x80073D14; +gSaveSlotSummary = 0x80073D14; gSaveSlotHasData = 0x80073D74; EnemyNpcHit = 0x80074310; EnemyNpcDefeat = 0x8007443C; diff --git a/ver/us/symbol_addrs.txt b/ver/us/symbol_addrs.txt index 9280658d81..85192f5ee6 100644 --- a/ver/us/symbol_addrs.txt +++ b/ver/us/symbol_addrs.txt @@ -1392,7 +1392,7 @@ fsFrameBuffers = 0x80077980; // rom:0x52D80 D_8007798C = 0x8007798C; // rom:0x52D8C IntroMessageIdx = 0x800779B0; // rom:0x52DB0 TitleScreenNextState = 0x800779C0; // rom:0x52DC0 -gSaveSlotMetadata = 0x800779C4; // rom:0x52DC4 +gSaveSlotSummary = 0x800779C4; // rom:0x52DC4 gSaveSlotHasData = 0x80077A24; // rom:0x52E24 TitleScreen_PressStart_Alpha = 0x80077A28; // rom:0x52E28 TitleScreen_PressStart_isVisibile = 0x80077A2C; // rom:0x52E2C @@ -4384,7 +4384,7 @@ clear_windows = 0x801473F0; // type:func rom:0xDDAF0 update_windows = 0x80147414; // type:func rom:0xDDB14 basic_window_update = 0x80147474; // type:func rom:0xDDB74 basic_hidden_window_update = 0x80147574; // type:func rom:0xDDC74 -main_menu_window_update = 0x80147650; // type:func rom:0xDDD50 +unused_main_menu_window_darkening = 0x80147650; // type:func rom:0xDDD50 render_windows = 0x80147698; // type:func rom:0xDDD98 render_window_root = 0x80147AC4; // type:func rom:0xDE1C4 set_window_properties = 0x80147CC8; // type:func rom:0xDE3C8 @@ -6415,7 +6415,7 @@ D_80249D34 = 0x80249D34; // rom:0x16A594 D_80249D48 = 0x80249D48; // rom:0x16A5A8 D_80249D4C = 0x80249D5C; // rom:0x16A5BC D_80249D60 = 0x80249D60; // rom:0x16A5C0 -D_80249D70 = 0x80249D70; // rom:0x16A5D0 +CopyArrowAnimOffsets = 0x80249D70; // rom:0x16A5D0 filemenu_common_windowBPs = 0x80249DAC; // rom:0x16A60C D_80249DCC = 0x80249DCC; // rom:0x16A62C D_80249DD0 = 0x80249DD0; // rom:0x16A630 @@ -6424,7 +6424,7 @@ filemenu_pressedButtons = 0x8024C084; // rom:0x16C8E4 filemenu_cursorHudElem = 0x8024C088; // rom:0x16C8E8 filemenu_heldButtons = 0x8024C08C; // rom:0x16C8EC filemenu_filename_pos = 0x8024C090; // rom:0x16C8F0 -filemenu_loadedFileIdx = 0x8024C094; // rom:0x16C8F4 +filemenu_CopyFromFileIdx = 0x8024C094; // rom:0x16C8F4 filemenu_currentMenu = 0x8024C098; // rom:0x16C8F8 filemenu_8024C09C = 0x8024C09C; // rom:0x16C8FC filemenu_cursorHudElemID = 0x8024C0A0; // rom:0x16C900 @@ -6763,8 +6763,8 @@ create_home_target_list = 0x80263048; // type:func rom:0x191928 func_80263064 = 0x80263064; // type:func rom:0x191944 func_80263230 = 0x80263230; // type:func rom:0x191B10 func_8026324C = 0x8026324C; // type:func rom:0x191B2C -func_80263268 = 0x80263268; // type:func rom:0x191B48 -func_80263300 = 0x80263300; // type:func rom:0x191BE0 +btl_check_can_change_partner = 0x80263268; // type:func rom:0x191B48 +btl_init_menu_items = 0x80263300; // type:func rom:0x191BE0 btl_are_all_enemies_defeated = 0x802633E8; // type:func rom:0x191CC8 btl_check_enemies_defeated = 0x80263434; // type:func rom:0x191D14 btl_check_player_defeated = 0x80263464; // type:func rom:0x191D44 @@ -7211,8 +7211,8 @@ D_8028358C = 0x8028358C; // rom:0x1B1E6C BattleMessage_BoxSizesY = 0x802835D0; // rom:0x1B1EB0 BattleMessage_TextOffsetsY = 0x802835D4; // rom:0x1B1EB4 BattleMessage_BoxOffsetsY = 0x802835D8; // rom:0x1B1EB8 -D_802835DC = 0x802835DC; // rom:0x1B1EBC -D_80283690 = 0x80283690; // rom:0x1B1F70 +BonkAnimAccel = 0x802835DC; // rom:0x1B1EBC +BonkAnimScale = 0x80283690; // rom:0x1B1F70 BonkModelScripts = 0x80283744; // rom:0x1B2024 BattleMessages = 0x80283770; // rom:0x1B2050 bActorMessages = 0x802838C4; // rom:0x1B21A4 @@ -9015,11 +9015,11 @@ func_802A2910 = 0x802A2910; // type:func rom:0x4176A0 func_802A2AB8 = 0x802A2AB8; // type:func rom:0x417848 func_802A2C58 = 0x802A2C58; // type:func rom:0x4179E8 btl_submenu_moves_update = 0x802A2C84; // type:func rom:0x417A14 -func_802A3C98 = 0x802A3C98; // type:func rom:0x418A28 -func_802A43DC = 0x802A43DC; // type:func rom:0x41916C -func_802A4448 = 0x802A4448; // type:func rom:0x4191D8 -func_802A4494 = 0x802A4494; // type:func rom:0x419224 -func_802A4534 = 0x802A4534; // type:func rom:0x4192C4 +btl_menu_moves_draw_content = 0x802A3C98; // type:func rom:0x418A28 +btl_menu_moves_show_title = 0x802A43DC; // type:func rom:0x41916C +btl_menu_moves_show_icon = 0x802A4448; // type:func rom:0x4191D8 +btl_menu_moves_show_desc = 0x802A4494; // type:func rom:0x419224 +btl_menu_moves_show_error = 0x802A4534; // type:func rom:0x4192C4 func_802A45D8 = 0x802A45D8; // type:func rom:0x419368 func_802A4718 = 0x802A4718; // type:func rom:0x4194A8 func_802A472C = 0x802A472C; // type:func rom:0x4194BC