From 49b2c1911b39b0411fdce0f948ac6a90684c9332 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 2 Mar 2025 13:33:28 +0100 Subject: [PATCH] more menus --- asm/code_805D8C8.s | 24 ++--- include/dungeon_menu_team.h | 4 +- src/code_803E46C.c | 6 +- src/code_803E724.c | 6 +- src/code_805D8C8.c | 6 +- src/code_8069E0C.c | 8 +- src/code_807CD9C.c | 6 +- src/dungeon_menu_team.c | 201 +++++++++++++++++++----------------- src/dungeon_message.c | 4 +- sym_ewram.txt | 2 +- 10 files changed, 139 insertions(+), 128 deletions(-) diff --git a/asm/code_805D8C8.s b/asm/code_805D8C8.s index 4da2c1a92..9d0812bc6 100644 --- a/asm/code_805D8C8.s +++ b/asm/code_805D8C8.s @@ -114,7 +114,7 @@ _080638FE: mov r0, r8 cmp r0, 0 beq _08063908 - bl sub_8062500 + bl ShowStatusDescriptionMenuArrow _08063908: ldr r5, _08063944 adds r0, r5, 0 @@ -213,7 +213,7 @@ _080639B8: _080639C0: mov r0, r8 mov r1, r10 - bl sub_80625A4 + bl ShowStatusesDescriptionMenu b _08063898 _080639CA: movs r0, 0 @@ -229,8 +229,8 @@ _080639CA: bx r0 thumb_func_end sub_8063834 - thumb_func_start sub_80639E4 -sub_80639E4: + thumb_func_start ShowStatusDescriptionMenu +ShowStatusDescriptionMenu: push {r4-r6,lr} sub sp, 0x4 adds r5, r0, 0 @@ -288,7 +288,7 @@ _08063A60: .4byte gUnknown_8106CC8 _08063A64: .4byte gFormatBuffer_Monsters _08063A68: .4byte gUnknown_8106CCC _08063A6C: .4byte gDungeonMenu - thumb_func_end sub_80639E4 + thumb_func_end ShowStatusDescriptionMenu thumb_func_start sub_8063A70 sub_8063A70: @@ -1919,7 +1919,7 @@ _08064732: _08064738: cmp r5, 0 beq _08064740 - bl sub_8062500 + bl ShowStatusDescriptionMenuArrow _08064740: adds r0, r6, 0 movs r1, 0 @@ -1952,7 +1952,7 @@ _08064774: adds r0, 0x4 ldr r0, [r0] adds r1, r6, 0 - bl sub_80639E4 + bl ShowStatusDescriptionMenu adds r7, r4, 0x1 b _080647A0 .align 2, 0 @@ -1971,7 +1971,7 @@ _0806479A: _080647A0: cmp r4, r8 bge _080647A8 - bl sub_8062500 + bl ShowStatusDescriptionMenuArrow _080647A8: adds r0, r6, 0 movs r1, 0 @@ -2411,7 +2411,7 @@ _08064B22: _08064B28: cmp r6, 0 beq _08064B30 - bl sub_8062500 + bl ShowStatusDescriptionMenuArrow _08064B30: adds r0, r5, 0 movs r1, 0 @@ -2444,7 +2444,7 @@ _08064B64: adds r0, 0x4 ldr r0, [r0] adds r1, r5, 0 - bl sub_80639E4 + bl ShowStatusDescriptionMenu adds r7, r4, 0x1 b _08064B90 .align 2, 0 @@ -2463,7 +2463,7 @@ _08064B8A: _08064B90: cmp r4, r8 bge _08064B98 - bl sub_8062500 + bl ShowStatusDescriptionMenuArrow _08064B98: adds r0, r5, 0 movs r1, 0 @@ -5567,7 +5567,7 @@ _080664C0: bx r0 .align 2, 0 _080664C8: .4byte gUnknown_2027370 -_080664CC: .4byte gUnknown_202EDCC +_080664CC: .4byte gDungeonFramesCounter _080664D0: .4byte gUnknown_202F300 _080664D4: .4byte 0x0000feff _080664D8: .4byte 0x0000fdff diff --git a/include/dungeon_menu_team.h b/include/dungeon_menu_team.h index 485807cc5..615091ce7 100644 --- a/include/dungeon_menu_team.h +++ b/include/dungeon_menu_team.h @@ -7,8 +7,8 @@ bool8 ShowDungeonTeamMenu(Entity *a0); void ShowDungeonTacticsMenu(ActionContainer *a0); void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 a1); -void sub_8062500(void); -void sub_80625A4(s32 count, struct subStruct_203B240 **strings); +void ShowStatusDescriptionMenuArrow(void); +void ShowStatusesDescriptionMenu(s32 count, struct subStruct_203B240 **strings); #define WHICH_MENU_MOVES 1 #define WHICH_MENU_ITEMS 2 Entity *ShowDungeonToWhichMonMenu(s32 *teamId, s32 caseId); diff --git a/src/code_803E46C.c b/src/code_803E46C.c index 6e3bd9f92..9234a02aa 100644 --- a/src/code_803E46C.c +++ b/src/code_803E46C.c @@ -20,7 +20,7 @@ EWRAM_INIT u8 gUnknown_203B40C = 0; EWRAM_INIT u8 gUnknown_203B40D = 0; extern s32 gDungeonBrightness; -extern s32 gUnknown_202EDCC; +extern s32 gDungeonFramesCounter; extern u32 gUnknown_202EDD0; extern s32 gUnknown_202EDD4; @@ -95,7 +95,7 @@ void sub_803E490(u32 unused) nullsub_12(); sub_80060EC(); - gUnknown_202EDCC++; + gDungeonFramesCounter++; IncrementPlayTime(gPlayTimeRef); sub_800CB20(); @@ -128,7 +128,7 @@ void sub_803E668(u32 unused) nullsub_12(); sub_8005838(NULL, 0); sub_80060EC(); - gUnknown_202EDCC++; + gDungeonFramesCounter++; IncrementPlayTime(gPlayTimeRef); sub_800CB20(); LoadBufferedInputs(); diff --git a/src/code_803E724.c b/src/code_803E724.c index 5d47fb436..42a795d6b 100644 --- a/src/code_803E724.c +++ b/src/code_803E724.c @@ -52,7 +52,7 @@ extern const u16 gUnknown_80F6544[][9]; extern u8 gUnknown_20274A5; -extern s32 gUnknown_202EDCC; +extern s32 gDungeonFramesCounter; extern void sub_8040A84(); extern void PlayDungeonStartButtonSE(void); @@ -1109,14 +1109,14 @@ void sub_803FB74(void) hungry = TRUE; } - if (lowHp && (gUnknown_202EDCC & 16) != 0) { + if (lowHp && (gDungeonFramesCounter & 16) != 0) { r5 = 32, r6 = 32; } else { r5 = 0, r6 = 0; } - if (hungry && (gUnknown_202EDCC & 16) != 0) { + if (hungry && (gDungeonFramesCounter & 16) != 0) { r5 = 48, r6 = 48; } diff --git a/src/code_805D8C8.c b/src/code_805D8C8.c index 8d7c71136..457d35ca1 100644 --- a/src/code_805D8C8.c +++ b/src/code_805D8C8.c @@ -15,7 +15,7 @@ extern const u8 gUnknown_8106E98[]; // palet // ??? extern s32 sprintf(char *, const char *, ...); -extern u32 gUnknown_202EDCC; +extern u32 gDungeonFramesCounter; static void EnsureCastformLoaded(void); static void EnsureDeoxysLoaded(void); @@ -38,7 +38,7 @@ void sub_8068310(s32 size, u16 **param_2) void sub_8068344(void) { - if ((gUnknown_202EDCC & 8) != 0) { + if ((gDungeonFramesCounter & 8) != 0) { UnkTextStruct1 *ptr = &gUnknown_2027370[0]; SpriteOAM sprite = {0}; @@ -62,7 +62,7 @@ void sub_8068344(void) // The same as sub_80623B0 void sub_80684C4(void) { - if ((gUnknown_202EDCC & 8) != 0) { + if ((gDungeonFramesCounter & 8) != 0) { UnkTextStruct1 *ptr = &gUnknown_2027370[0]; SpriteOAM sprite = {0}; diff --git a/src/code_8069E0C.c b/src/code_8069E0C.c index baea43318..b85148372 100644 --- a/src/code_8069E0C.c +++ b/src/code_8069E0C.c @@ -71,7 +71,7 @@ extern void DeletePokemonDungeonSprite(s32 id); extern void sub_80429E8(Entity *r0); extern s32 sub_803DA20(s32 param_1); extern void sub_80694C0(Entity *, s32, s32, u32); -extern s32 gUnknown_202EDCC; +extern s32 gDungeonFramesCounter; extern void sub_800F958(s32 dungeonSpriteID, DungeonPos *pos, DungeonPos *statusOffsets, u32 a3); extern void sub_8005700(DungeonPos *a0, struct axObject *a1); u32 EntityGetStatusSprites(Entity *entity); @@ -2008,7 +2008,7 @@ void sub_806C51C(Entity *entity) } else { if (entInfo->unk15D != 0) { - if (gUnknown_202EDCC & 4) { + if (gDungeonFramesCounter & 4) { x++; } else { @@ -2080,7 +2080,7 @@ void sub_806C51C(Entity *entity) s32 overworldPal; if (entInfo->frozenClassStatus.status == STATUS_PETRIFIED || entInfo->burnClassStatus.status == STATUS_PARALYSIS || entInfo->frozenClassStatus.status == STATUS_SHADOW_HOLD) { - x += gUnknown_202EDCC & 2; + x += gDungeonFramesCounter & 2; } if (decoySprite) { @@ -2093,7 +2093,7 @@ void sub_806C51C(Entity *entity) if (entity->unk22 == 0) { DoAxFrame_800558C(&entity->axObj.axdata, x, y, y2, overworldPal, &spriteMasks); } - else if (entity->unk22 == 1 && (gUnknown_202EDCC & 1)) { + else if (entity->unk22 == 1 && (gDungeonFramesCounter & 1)) { DoAxFrame_800558C(&entity->axObj.axdata, x, y, y2, overworldPal, &spriteMasks); } } diff --git a/src/code_807CD9C.c b/src/code_807CD9C.c index 0596c8e4f..e3d0c4069 100644 --- a/src/code_807CD9C.c +++ b/src/code_807CD9C.c @@ -25,7 +25,7 @@ #include "weather.h" #include "dungeon_config.h" -extern u32 gUnknown_202EDCC; +extern u32 gDungeonFramesCounter; extern u8 *gUnknown_80FCA10[]; extern u8 *gUnknown_80F8A0C[]; @@ -278,7 +278,7 @@ void WarpTarget(Entity *pokemon, Entity *target, u32 param_3, DungeonPos *pos) direction = (info->action).direction; target->unk1C.raw += + 0x800; while ( target->unk1C.raw < 0xa000) { - if ((gUnknown_202EDCC & 3) == 0) { + if ((gDungeonFramesCounter & 3) == 0) { direction = (direction + 1) & DIRECTION_MASK; info->action.direction = direction & DIRECTION_MASK; sub_806CE68(target,direction); @@ -324,7 +324,7 @@ void WarpTarget(Entity *pokemon, Entity *target, u32 param_3, DungeonPos *pos) direction = (info->action).direction; target->unk1C.raw = 0x9c00; do { - if ((gUnknown_202EDCC & 3) == 0) { + if ((gDungeonFramesCounter & 3) == 0) { direction = (direction + 1) & DIRECTION_MASK; info->action.direction = direction & DIRECTION_MASK; sub_806CE68(target,direction); diff --git a/src/dungeon_menu_team.c b/src/dungeon_menu_team.c index a8ef93d32..3d72a0a03 100644 --- a/src/dungeon_menu_team.c +++ b/src/dungeon_menu_team.c @@ -125,12 +125,12 @@ extern char* sub_808E4FC(s32 a1); extern char* sub_808E51C(s32 a1); extern void sub_8045C18(u8 *buffer, Item *item); extern bool32 sub_8069D18(DungeonPos *a0, Entity *a1); -extern void sub_80639E4(struct subStruct_203B240 *strings, MenuInputStructSub *menuSub); +extern void ShowStatusDescriptionMenu(struct subStruct_203B240 *strings, MenuInputStructSub *menuSub); extern u8 gUnknown_202EE00; extern Entity *gLeaderPointer; extern MenuInputStruct gDungeonMenu; -extern s32 gUnknown_202EDCC; +extern s32 gDungeonFramesCounter; extern u8 gUnknown_202EE39; extern const u8 *gUnknown_80FE940; @@ -161,11 +161,11 @@ static void PrintOnDungeonTeamMenu(struct UnkFieldTeamMenuStruct *a0, Windows *w static void sub_806145C(struct UnkFieldTeamMenuStruct *a0); static void ChosenSubMenuToAction(ActionContainer *a0, struct UnkFieldTeamMenuStruct *a1); static void PrintMonTactics(s32 firstId, u8 *tacticIds, EntityInfo *mon, s32 windowId); -static void sub_8062230(void); -static void sub_80623B0(void); +static void ShowUpArrowSprite(void); +static void ShowDownArrowSprite(void); static void ShowIqDescriptionWindow(u8 iqSkillId); static void ShowTacticDescriptionWindow(u8 tacticId); -static void sub_806285C(s32 a0); +static void ShowStatusInfoWindow(s32 a0); static void PrintMoveNamesOnBottomWindow(Entity *entity); static void PrintItemNameOnBottomWindow(Entity *entity); static void ResetDungeonMenu(void); @@ -569,10 +569,10 @@ void ShowDungeonTacticsMenu(ActionContainer *a0) AddMenuCursorSprite(&gDungeonMenu); if (tacticIds[8] != TACTIC_UNUSED) { - sub_80623B0(); + ShowDownArrowSprite(); } if (scrollFirstId != 0) { - sub_8062230(); + ShowUpArrowSprite(); } DungeonRunFrameActions(0x3D); if (gRealInputs.repeated & DPAD_DOWN) { @@ -588,7 +588,7 @@ void ShowDungeonTacticsMenu(ActionContainer *a0) menuIndex = 7; break; } - MoveMenuCursorDownWrapAround(&gDungeonMenu, 0); + MoveMenuCursorDownWrapAround(&gDungeonMenu, FALSE); } if (gRealInputs.repeated & DPAD_UP) { PlayDungeonCursorSE(1); @@ -603,7 +603,7 @@ void ShowDungeonTacticsMenu(ActionContainer *a0) menuIndex = 0; break; } - MoveMenuCursorUpWrapAround(&gDungeonMenu, 0); + MoveMenuCursorUpWrapAround(&gDungeonMenu, FALSE); } if (gRealInputs.pressed & START_BUTTON) { u32 tacticId = tacticIds[gDungeonMenu.menuIndex]; @@ -729,9 +729,20 @@ static void PrintMonTactics(s32 firstId, u8 *tacticIds, EntityInfo *mon, s32 win sub_80073E0(windowId); } +enum +{ + SUB_WINDOW_NONE, + SUB_WINDOW_STATUS, + SUB_WINDOW_STATS, + SUB_WINDOW_FEATUERS, + SUB_WINDOW_IQ, + SUB_WINDOW_INFO, +}; + +// The way this function was written, it seems that they planned to put IQ skills in the Summary Menu first, but later decided to create a separate menu for it. void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 showIq) { - s32 spArr[6]; + s32 subWindowIds[6]; struct unkStruct_808FF20 unkMonStruct; struct UnkInfoTabStruct unkInfoTabStruct; Windows windows = { @@ -752,41 +763,41 @@ void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 showIq) }; s32 r8; Entity *entity; - s32 var_3C; - s32 totalWindows; + s32 currSubWindowId; + s32 totalSubWindows; EntityInfo *entityInfo; - var_3C = 0; + currSubWindowId = 0; r8 = 0; entity = gDungeon->teamPokemon[a0->actionParameters[0].actionUseIndex]; entityInfo = GetEntInfo(entity); if (IsExperienceLocked(entityInfo->joinedAt.id)) { - spArr[0] = 1; - spArr[1] = 0; - spArr[2] = 0; - spArr[3] = 0; - spArr[4] = 0; - spArr[5] = 0; - totalWindows = 1; + subWindowIds[0] = SUB_WINDOW_STATUS; + subWindowIds[1] = SUB_WINDOW_NONE; + subWindowIds[2] = SUB_WINDOW_NONE; + subWindowIds[3] = SUB_WINDOW_NONE; + subWindowIds[4] = SUB_WINDOW_NONE; + subWindowIds[5] = SUB_WINDOW_NONE; + totalSubWindows = 1; } else if (showIq) { - spArr[0] = 4; - spArr[1] = 0; - spArr[2] = 0; - spArr[3] = 0; - spArr[4] = 0; - spArr[5] = 0; - totalWindows = 1; + subWindowIds[0] = SUB_WINDOW_IQ; + subWindowIds[1] = SUB_WINDOW_NONE; + subWindowIds[2] = SUB_WINDOW_NONE; + subWindowIds[3] = SUB_WINDOW_NONE; + subWindowIds[4] = SUB_WINDOW_NONE; + subWindowIds[5] = SUB_WINDOW_NONE; + totalSubWindows = 1; } else { - spArr[0] = 2; - spArr[1] = 1; - spArr[2] = 3; - spArr[3] = 5; - spArr[4] = 0; - spArr[5] = 0; - totalWindows = 4; + subWindowIds[0] = SUB_WINDOW_STATS; + subWindowIds[1] = SUB_WINDOW_STATUS; + subWindowIds[2] = SUB_WINDOW_FEATUERS; + subWindowIds[3] = SUB_WINDOW_INFO; + subWindowIds[4] = SUB_WINDOW_NONE; + subWindowIds[5] = SUB_WINDOW_NONE; + totalSubWindows = 4; } unkMonStruct.unk40 = 0; @@ -795,20 +806,20 @@ void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 showIq) while (1) { bool8 loopBreak = FALSE; - s32 var_30 = 0; - s32 var_2C = 0; - s32 var_28 = 1; + bool8 hasIqSkills = FALSE; + bool8 hasStatusProblems = FALSE; + bool8 addCursorSprite = TRUE; UnkTextStruct1 *unkTxtStr1Ptr = &gUnknown_2027370[0]; - sTeamWindowHeader.f0 = totalWindows; - sTeamWindowHeader.f1 = var_3C; + sTeamWindowHeader.f0 = totalSubWindows; + sTeamWindowHeader.f1 = currSubWindowId; sTeamWindowHeader.f2 = 10; sTeamWindowHeader.f3 = 0; DungeonShowWindows(&windows, TRUE); sub_8069844(&unkMonStruct, entity); - CreatePokemonInfoTabScreen(spArr[var_3C], var_3C, &unkMonStruct, &unkInfoTabStruct, 0); - gDungeonMenu.unk1E = var_3C; - gDungeonMenu.unk20 = totalWindows; + CreatePokemonInfoTabScreen(subWindowIds[currSubWindowId], currSubWindowId, &unkMonStruct, &unkInfoTabStruct, 0); + gDungeonMenu.unk1E = currSubWindowId; + gDungeonMenu.unk20 = totalSubWindows; gDungeonMenu.unkC = (unkTxtStr1Ptr->unk0 + 15) * 8; gDungeonMenu.unkE = ((unkTxtStr1Ptr->unk2 + 1) * 8) - 2; gDungeonMenu.unk14.x = 0; @@ -820,7 +831,7 @@ void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 showIq) gDungeonMenu.unk1A = 0; gDungeonMenu.unk1C = 0; - if (spArr[var_3C] == 1) { + if (subWindowIds[currSubWindowId] == SUB_WINDOW_STATUS) { s32 i; for (i = 0; i < 8; i++) { @@ -830,14 +841,14 @@ void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 showIq) } if (i != 0) { - var_2C = 1; + hasStatusProblems = TRUE; gDungeonMenu.unk1A = i; gDungeonMenu.unk1C = 8; sub_80137B0(&gDungeonMenu, 0); } gDungeonMenu.menuIndex = r8; } - else if (spArr[var_3C] == 4) { + else if (subWindowIds[currSubWindowId] == SUB_WINDOW_IQ) { s32 i; for (i = 0; i < 8; i++) { @@ -847,7 +858,7 @@ void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 showIq) } if (i != 0) { - var_30 = 1; + hasIqSkills = TRUE; gDungeonMenu.unk1A = i; gDungeonMenu.unk1C = 8; sub_80137B0(&gDungeonMenu, 0); @@ -863,24 +874,24 @@ void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 showIq) unkVar = sub_8014140(0, gUnknown_8106B8C); r5 = FALSE; r6 = FALSE; - if (var_30) { + if (hasIqSkills) { if (unkInfoTabStruct.unk0[8] != 0) { r5 = TRUE; - sub_80623B0(); + ShowDownArrowSprite(); } if (unkMonStruct.unk40 != 0) { r6 = TRUE; - sub_8062230(); + ShowUpArrowSprite(); } } - if (var_2C) { + if (hasStatusProblems) { if (unkInfoTabStruct.unkC[8] != 0) { r5 = TRUE; - sub_80623B0(); + ShowDownArrowSprite(); } if (unkMonStruct.unk56 != 0) { r6 = TRUE; - sub_8062230(); + ShowUpArrowSprite(); } } @@ -888,26 +899,26 @@ void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 showIq) if (sTeamWindowHeader.f0 > 1 && !sub_80048C8()) { if ((gRealInputs.pressed & DPAD_RIGHT) || gDungeonMenu.unk28.dpad_right) { PlayDungeonCursorSE(0); - var_3C++; - if (spArr[var_3C] == 0) { - var_3C = 0; + currSubWindowId++; + if (subWindowIds[currSubWindowId] == SUB_WINDOW_NONE) { + currSubWindowId = 0; } break; } if ((gRealInputs.pressed & DPAD_LEFT) || gDungeonMenu.unk28.dpad_left) { PlayDungeonCursorSE(0); - var_3C--; - if (var_3C == -1) { - var_3C = 5; - while (spArr[var_3C] == 0) { - var_3C--; + currSubWindowId--; + if (currSubWindowId == -1) { + currSubWindowId = 5; + while (subWindowIds[currSubWindowId] == SUB_WINDOW_NONE) { + currSubWindowId--; } } break; } } - if (var_2C) { + if (hasStatusProblems) { if (unkVar == 2 && r5) { PlayDungeonCursorSE(0); if (unkInfoTabStruct.unkC[8] != 0) { @@ -936,7 +947,7 @@ void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 showIq) break; } else { - MoveMenuCursorDownWrapAround(&gDungeonMenu, 0); + MoveMenuCursorDownWrapAround(&gDungeonMenu, FALSE); } } @@ -967,11 +978,11 @@ void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 showIq) break; } else { - MoveMenuCursorUpWrapAround(&gDungeonMenu, 0); + MoveMenuCursorUpWrapAround(&gDungeonMenu, FALSE); } } } - else if (var_30) { + else if (hasIqSkills) { if (unkVar == 2 && r5) { if (unkInfoTabStruct.unk0[8] != 0) { s32 i; @@ -999,7 +1010,7 @@ void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 showIq) break; } else { - MoveMenuCursorDownWrapAround(&gDungeonMenu, 0); + MoveMenuCursorDownWrapAround(&gDungeonMenu, FALSE); } } @@ -1030,7 +1041,7 @@ void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 showIq) break; } else { - MoveMenuCursorUpWrapAround(&gDungeonMenu, 0); + MoveMenuCursorUpWrapAround(&gDungeonMenu, FALSE); } } } @@ -1039,30 +1050,30 @@ void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 showIq) continue; if (gRealInputs.pressed & START_BUTTON) { - if (var_2C) { + if (hasStatusProblems) { s32 var = unkInfoTabStruct.unkC[gDungeonMenu.menuIndex]; r8 = gDungeonMenu.menuIndex; PlayDungeonStartButtonSE(); - sub_806285C(var); - var_28 = 0; + ShowStatusInfoWindow(var); + addCursorSprite = FALSE; loopBreak = FALSE; break; } - else if (var_30) { + else if (hasIqSkills) { s32 iqSkillId = unkInfoTabStruct.unk0[gDungeonMenu.menuIndex]; r8 = gDungeonMenu.menuIndex; PlayDungeonStartButtonSE(); ShowIqDescriptionWindow(iqSkillId); - var_28 = 0; + addCursorSprite = FALSE; loopBreak = FALSE; break; } } if ((gRealInputs.pressed & A_BUTTON) || gDungeonMenu.unk28.a_button) { - if (var_2C) { + if (hasStatusProblems) { s32 var = unkInfoTabStruct.unkC[gDungeonMenu.menuIndex]; r8 = gDungeonMenu.menuIndex; @@ -1085,8 +1096,8 @@ void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 showIq) if ((gRealInputs.pressed & A_BUTTON) || gDungeonMenu.unk28.a_button) { PlayDungeonConfirmationSE(); - sub_806285C(var); - var_28 = 0; + ShowStatusInfoWindow(var); + addCursorSprite = FALSE; loopBreak = FALSE; break; } @@ -1097,13 +1108,13 @@ void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 showIq) } } } - else if (var_30) { + else if (hasIqSkills) { bool8 aPress = FALSE; s32 var = unkInfoTabStruct.unk0[gDungeonMenu.menuIndex]; r8 = gDungeonMenu.menuIndex; ResetDungeonMenu(); - gDungeonSubMenuItemsCount = var_2C; + gDungeonSubMenuItemsCount = 0; PlayDungeonConfirmationSE(); sub_8044F5C(0x28, 0); sub_8044F5C(0xC, 0); @@ -1146,7 +1157,7 @@ void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 showIq) } else { ShowIqDescriptionWindow(var); - var_28 = 0; + addCursorSprite = FALSE; } loopBreak = FALSE; break; @@ -1165,8 +1176,8 @@ void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 showIq) } } - if (var_28) { - if (var_30 != 0 || var_2C != 0) { + if (addCursorSprite) { + if (hasIqSkills || hasStatusProblems) { AddMenuCursorSprite(&gDungeonMenu); } DungeonRunFrameActions(0x1C); @@ -1182,9 +1193,9 @@ void ShowDungeonSummaryOrIQMenu(ActionContainer *a0, bool8 showIq) } // The same as sub_8068344 -static void sub_8062230(void) +static void ShowUpArrowSprite(void) { - if ((gUnknown_202EDCC & 8) != 0) { + if ((gDungeonFramesCounter & 8) != 0) { UnkTextStruct1 *txtStrPtr = &gUnknown_2027370[0]; SpriteOAM sprite = {0}; @@ -1207,9 +1218,9 @@ static void sub_8062230(void) } // The same as sub_80684C4 -static void sub_80623B0(void) +static void ShowDownArrowSprite(void) { - if ((gUnknown_202EDCC & 8) != 0) { + if ((gDungeonFramesCounter & 8) != 0) { UnkTextStruct1 *ptr = &gUnknown_2027370[0]; SpriteOAM sprite = {0}; @@ -1230,9 +1241,9 @@ static void sub_80623B0(void) } } -void sub_8062500(void) +void ShowStatusDescriptionMenuArrow(void) { - if ((gUnknown_202EDCC & 8) != 0) { + if ((gDungeonFramesCounter & 8) != 0) { UnkTextStruct1 *ptr = &gUnknown_2027370[0]; SpriteSetAffine1(&gUnknown_202F268, 0); @@ -1252,17 +1263,17 @@ void sub_8062500(void) } } -void sub_80625A4(s32 count, struct subStruct_203B240 **strings) +void ShowStatusesDescriptionMenu(s32 count, struct subStruct_203B240 **strings) { s32 i; MenuInputStructSub menuSub; sub_801317C(&menuSub); for (i = 0; i < count; i++) { - sub_80639E4(strings[i], &menuSub); + ShowStatusDescriptionMenu(strings[i], &menuSub); while (1) { if (i < count - 1) { - sub_8062500(); + ShowStatusDescriptionMenuArrow(); } nullsub_34(&menuSub, 0); DungeonRunFrameActions(0x16); @@ -1306,7 +1317,7 @@ static void ShowIqDescriptionWindow(u8 iqSkillId) count = sub_8097DF0(GetIQSkillDescription(iqSkillId), result); while (1) { if (count != 0) { - sub_8062500(); + ShowStatusDescriptionMenuArrow(); } nullsub_34(&menuSub, 0); DungeonRunFrameActions(0x16); @@ -1325,7 +1336,7 @@ static void ShowIqDescriptionWindow(u8 iqSkillId) if (bPress || count == 0) break; - sub_80625A4(count, result); + ShowStatusesDescriptionMenu(count, result); } sub_803E708(4, 0x3E); @@ -1359,7 +1370,7 @@ static void ShowTacticDescriptionWindow(u8 tacticId) count = sub_8097DF0(GetTacticsDescription(tacticId), result); while (1) { if (count != 0) { - sub_8062500(); + ShowStatusDescriptionMenuArrow(); } nullsub_34(&menuSub, 0); DungeonRunFrameActions(62); @@ -1378,13 +1389,13 @@ static void ShowTacticDescriptionWindow(u8 tacticId) if (bPress || count == 0) break; - sub_80625A4(count, result); + ShowStatusesDescriptionMenu(count, result); } sub_803E708(4, 0x3E); } -static void sub_806285C(s32 a0) +static void ShowStatusInfoWindow(s32 statusId) { const u8 *str; MenuInputStructSub menuSub; @@ -1413,10 +1424,10 @@ static void sub_806285C(s32 a0) header.f3 = 0; DungeonShowWindows(&windows, TRUE); sub_80073B8(0); - str = sub_808E4FC(a0); + str = sub_808E4FC(statusId); strcpy(gFormatBuffer_Items[0], str); PrintFormattedStringOnWindow(16, 0, gUnknown_80FE964, 0, '\0'); - PrintFormattedStringOnWindow(8, 16, sub_808E51C(a0), 0, '\0'); + PrintFormattedStringOnWindow(8, 16, sub_808E51C(statusId), 0, '\0'); sub_80073E0(0); while (1) { diff --git a/src/dungeon_message.c b/src/dungeon_message.c index 1655a1c7a..208fa09b0 100644 --- a/src/dungeon_message.c +++ b/src/dungeon_message.c @@ -45,7 +45,7 @@ extern void PlayDungeonCursorSE(u8 param_1); extern u32 gUnknown_202EDD0; extern u8 gUnknown_203B40C; extern u8 gUnknown_202EE01; -extern s32 gUnknown_202EDCC; +extern s32 gDungeonFramesCounter; extern const u8 gUnknown_80F7AE8[]; extern const u8 gUnknown_80F7AF8[]; @@ -1047,7 +1047,7 @@ static bool8 TryScrollLogDown(s32 a0) static void CreateMessageLogArrow(bool8 upArrow, s32 y) { struct UnkTextStruct1 *unkStr = &gUnknown_2027370[0]; - if (!(gUnknown_202EDCC & 8)) { + if (!(gDungeonFramesCounter & 8)) { SpriteSetAffine1(&sMessageLogArrowSpriteOAM, 0); SpriteSetAffine2(&sMessageLogArrowSpriteOAM, 0); SpriteSetObjMode(&sMessageLogArrowSpriteOAM, 0); diff --git a/sym_ewram.txt b/sym_ewram.txt index 2effcee14..f81b0f6bb 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -94,7 +94,7 @@ gUnknown_202EDC0: /* 202EDC0 (sub_803E250 - sub_80462AC) */ .space 0x8 gDungeonBrightness: /* 202EDC8 (sub_803E250 - sub_8086794) */ .space 0x4 -gUnknown_202EDCC: /* 202EDCC (sub_803E490 - sub_807D148) */ +gDungeonFramesCounter: /* 202EDCC (sub_803E490 - sub_807D148) */ .space 0x4 gUnknown_202EDD0: /* 202EDD0 (sub_803E250 - sub_8052210) */ .space 0x4