diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2021-03-23 11:28:06 -0400 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2021-03-23 11:28:06 -0400 |
commit | d1f62285b56210c1fe7e368edf63e9d7f3fd075b (patch) | |
tree | b4e48f997dea587b352a8030e42b163e28e6eb42 /src | |
parent | ff7f7744b7a898f9b460f9e403b137c95947aba3 (diff) |
Document help system
Diffstat (limited to 'src')
-rw-r--r-- | src/help_system.c | 95 | ||||
-rw-r--r-- | src/help_system_812B1E0.c | 155 | ||||
-rw-r--r-- | src/pokedex_screen.c | 4 | ||||
-rw-r--r-- | src/sound.c | 10 |
4 files changed, 142 insertions, 122 deletions
diff --git a/src/help_system.c b/src/help_system.c index fbe23bec0..45c7492fc 100644 --- a/src/help_system.c +++ b/src/help_system.c @@ -26,7 +26,7 @@ struct HelpSystemVideoState }; static EWRAM_DATA u8 sMapTilesBackup[BG_CHAR_SIZE] = {0}; -EWRAM_DATA u8 gUnknown_203F174 = 0; +EWRAM_DATA u8 gDisableHelpSystemVolumeReduce = 0; EWRAM_DATA bool8 gHelpSystemToggleWithRButtonDisabled = FALSE; static EWRAM_DATA u8 sDelayTimer = 0; static EWRAM_DATA u8 sInHelpSystem = 0; @@ -51,7 +51,7 @@ u8 RunHelpSystemCallback(void) return 0; if (JOY_NEW(L_BUTTON | R_BUTTON)) { - if (!sub_812B45C() || !gHelpSystemEnabled) + if (!HelpSystem_IsSinglePlayer() || !gHelpSystemEnabled) { PlaySE(SE_HELP_ERROR); return 0; @@ -59,7 +59,7 @@ u8 RunHelpSystemCallback(void) m4aMPlayStop(&gMPlayInfo_SE1); m4aMPlayStop(&gMPlayInfo_SE2); PlaySE(SE_HELP_OPEN); - if (!gUnknown_203F174) + if (!gDisableHelpSystemVolumeReduce) m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x80); SaveCallbacks(); sInHelpSystem = 1; @@ -81,17 +81,17 @@ u8 RunHelpSystemCallback(void) sVideoState.state = 3; break; case 3: - sub_813BCF4(); + HS_BufferFillMapWithTile1FF(); HelpSystem_FillPanel3(); HelpSystem_FillPanel2(); HelpSystem_PrintText_Row61(gString_Help); - sub_813BD14(1); + HS_ShowOrHideWordHELPinTopLeft(1); if (HelpSystem_UpdateHasntSeenIntro() == TRUE) HelpSystemSubroutine_PrintWelcomeMessage(&gHelpSystemListMenu, gHelpSystemListMenuItems); else HelpSystemSubroutine_WelcomeEndGotoMenu(&gHelpSystemListMenu, gHelpSystemListMenuItems); - sub_813BE78(1); - sub_813BF50(1); + HS_ShowOrHideHeaderAndFooterLines_Lighter(1); + HS_ShowOrHideVerticalBlackBarsAlongSides(1); CommitTilemap(); sVideoState.state = 4; break; @@ -121,7 +121,7 @@ u8 RunHelpSystemCallback(void) sVideoState.state = 7; break; case 7: - if (!gUnknown_203F174) + if (!gDisableHelpSystemVolumeReduce) m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100); RestoreMapTextColors(); RestoreGPURegs(); @@ -223,12 +223,12 @@ void HS_DrawBgTilemapRect(u16 baseTile, u8 left, u8 top, u8 width, u8 height, u1 CommitTilemap(); } -void sub_813BCF4(void) +void HS_BufferFillMapWithTile1FF(void) { HS_DrawBgTilemapRect(0x1FF, 0, 0, 30, 20, 0); } -void sub_813BD14(u8 mode) +void HS_ShowOrHideWordHELPinTopLeft(u8 mode) { switch (mode) { @@ -241,7 +241,7 @@ void sub_813BD14(u8 mode) } } -void sub_813BD5C(u8 mode) +void HS_ShowOrHideControlsGuideInTopRight(u8 mode) { switch (mode) { @@ -254,7 +254,7 @@ void sub_813BD5C(u8 mode) } } -void sub_813BDA4(u8 mode) +void HS_ShowOrHideMainWindowText(u8 mode) { switch (mode) { @@ -267,20 +267,22 @@ void sub_813BDA4(u8 mode) } } -void sub_813BDE8(u8 mode) +void HS_SetMainWindowBgBrightness(u8 mode) { switch (mode) { case 0: + // Brighter HS_DrawBgTilemapRect(0x1FF, 1, 3, 28, 16, 0); break; case 1: + // Darker HS_DrawBgTilemapRect(0x1FA, 1, 3, 28, 17, 0); break; } } -void sub_813BE30(u8 mode) +void HS_ShowOrHideToplevelTooltipWindow(u8 mode) { switch (mode) { @@ -293,7 +295,7 @@ void sub_813BE30(u8 mode) } } -void sub_813BE78(u8 mode) +void HS_ShowOrHideHeaderAndFooterLines_Lighter(u8 mode) { switch (mode) { @@ -308,7 +310,7 @@ void sub_813BE78(u8 mode) } } -void sub_813BEE4(u8 mode) +void HS_ShowOrHideHeaderAndFooterLines_Darker(u8 mode) { switch (mode) { @@ -323,7 +325,7 @@ void sub_813BEE4(u8 mode) } } -void sub_813BF50(u8 mode) +void HS_ShowOrHideVerticalBlackBarsAlongSides(u8 mode) { switch (mode) { @@ -338,7 +340,7 @@ void sub_813BF50(u8 mode) } } -void sub_813BFC0(u8 mode) +void HS_ShowOrHideHeaderLine_Darker_FooterStyle(u8 mode) { switch (mode) { @@ -351,7 +353,7 @@ void sub_813BFC0(u8 mode) } } -void sub_813C004(u8 a0, u8 mode) +void HS_ShowOrHideScrollArrows(u8 which, u8 mode) { switch (mode) { @@ -360,9 +362,9 @@ void sub_813C004(u8 a0, u8 mode) HS_DrawBgTilemapRect(0x1FF, 28, 18, 1, 1, 0); break; case 1: - if (a0 == 0) + if (which == 0) // top HS_DrawBgTilemapRect(0x1FE, 28, 3, 1, 1, 0); - else + else // bottom HS_DrawBgTilemapRect(0x1FD, 28, 18, 1, 1, 0); break; } @@ -635,7 +637,7 @@ void HelpSystem_InitListMenuController(struct HelpSystemListMenu * a0, u8 a1, u8 gHelpSystemListMenu.state = 0; if (gHelpSystemListMenu.sub.totalItems < gHelpSystemListMenu.sub.maxShowed) gHelpSystemListMenu.sub.maxShowed = gHelpSystemListMenu.sub.totalItems; - sub_813BDA4(0); + HS_ShowOrHideMainWindowText(0); HelpSystem_FillPanel1(); PrintListMenuItems(); PlaceListMenuCursor(); @@ -695,23 +697,24 @@ s32 HelpSystem_GetMenuInput(void) return -1; } -void sub_813C75C(void) +void HS_UpdateMenuScrollArrows(void) { - u8 r6 = gHelpSystemListMenu.sub.totalItems - 7; + u8 topItemIdx = gHelpSystemListMenu.sub.totalItems - 7; if (gHelpSystemListMenu.sub.totalItems > 7) { - s32 r4 = gHelpSystemListMenu.itemsAbove + gHelpSystemListMenu.cursorPos; - sub_813C004(0, 0); - if (r4 == 0) - sub_813C004(1, 1); + s32 cursorPos = gHelpSystemListMenu.itemsAbove + gHelpSystemListMenu.cursorPos; + HS_ShowOrHideScrollArrows(0, 0); // Hide both + if (cursorPos == 0) + HS_ShowOrHideScrollArrows(1, 1); // Show bottom else if (gHelpSystemListMenu.itemsAbove == 0 && gHelpSystemListMenu.cursorPos != 0) - sub_813C004(1, 1); - else if (gHelpSystemListMenu.itemsAbove == r6) - sub_813C004(0, 1); + HS_ShowOrHideScrollArrows(1, 1); // Show bottom + else if (gHelpSystemListMenu.itemsAbove == topItemIdx) + HS_ShowOrHideScrollArrows(0, 1); // Show top else if (gHelpSystemListMenu.itemsAbove != 0) { - sub_813C004(0, 1); - sub_813C004(1, 1); + // Show both + HS_ShowOrHideScrollArrows(0, 1); + HS_ShowOrHideScrollArrows(1, 1); } } } @@ -739,7 +742,7 @@ void PlaceListMenuCursor(void) HelpSystem_PrintTextAt(gText_SelectorArrow2, x, y); } -void sub_813C860(u8 i) +void HS_RemoveSelectionCursorAt(u8 i) { u8 glyphHeight = GetFontAttribute(2, FONTATTR_MAX_LETTER_HEIGHT) + 1; u8 x = gHelpSystemListMenu.sub.left; @@ -749,13 +752,13 @@ void sub_813C860(u8 i) u8 TryMoveCursor1(u8 dirn) { - u16 r4; + u16 midPoint; if (dirn == 0) { if (gHelpSystemListMenu.sub.maxShowed == 1) - r4 = 0; + midPoint = 0; else - r4 = gHelpSystemListMenu.sub.maxShowed - (gHelpSystemListMenu.sub.maxShowed / 2 + (gHelpSystemListMenu.sub.maxShowed & 1)) - 1; + midPoint = gHelpSystemListMenu.sub.maxShowed - (gHelpSystemListMenu.sub.maxShowed / 2 + (gHelpSystemListMenu.sub.maxShowed & 1)) - 1; if (gHelpSystemListMenu.itemsAbove == 0) { if (gHelpSystemListMenu.cursorPos != 0) @@ -766,7 +769,7 @@ u8 TryMoveCursor1(u8 dirn) else return 0; } - if (gHelpSystemListMenu.cursorPos > r4) + if (gHelpSystemListMenu.cursorPos > midPoint) { gHelpSystemListMenu.cursorPos--; return 1; @@ -780,9 +783,9 @@ u8 TryMoveCursor1(u8 dirn) else { if (gHelpSystemListMenu.sub.maxShowed == 1) - r4 = 0; + midPoint = 0; else - r4 = gHelpSystemListMenu.sub.maxShowed / 2 + (gHelpSystemListMenu.sub.maxShowed & 1); + midPoint = gHelpSystemListMenu.sub.maxShowed / 2 + (gHelpSystemListMenu.sub.maxShowed & 1); if (gHelpSystemListMenu.itemsAbove == gHelpSystemListMenu.sub.totalItems - gHelpSystemListMenu.sub.maxShowed) { if (gHelpSystemListMenu.cursorPos < gHelpSystemListMenu.sub.maxShowed - 1) @@ -793,7 +796,7 @@ u8 TryMoveCursor1(u8 dirn) else return 0; } - else if (gHelpSystemListMenu.cursorPos < r4) + else if (gHelpSystemListMenu.cursorPos < midPoint) { gHelpSystemListMenu.cursorPos++; return 1; @@ -822,29 +825,29 @@ bool8 MoveCursor(u8 by, u8 dirn) return TRUE; case 1: // changed cursorPos only - sub_813C860(r7); + HS_RemoveSelectionCursorAt(r7); PlaceListMenuCursor(); CommitTilemap(); break; case 2: case 3: // changed itemsAbove - if (sub_812BF88() == TRUE) + if (GetHelpSystemMenuLevel() == 1) { HelpSystem_SetInputDelay(2); HelpSystem_FillPanel1(); PrintListMenuItems(); PlaceListMenuCursor(); HelpSystem_PrintTopicLabel(); - sub_813C75C(); + HS_UpdateMenuScrollArrows(); } else { - sub_813BDA4(0); + HS_ShowOrHideMainWindowText(0); HelpSystem_FillPanel1(); PrintListMenuItems(); PlaceListMenuCursor(); - sub_813BDA4(1); + HS_ShowOrHideMainWindowText(1); } CommitTilemap(); break; diff --git a/src/help_system_812B1E0.c b/src/help_system_812B1E0.c index d9ee16cfa..a8be66b66 100644 --- a/src/help_system_812B1E0.c +++ b/src/help_system_812B1E0.c @@ -16,10 +16,42 @@ #include "constants/maps.h" #include "constants/songs.h" +#define HELP_NONE 0 +#define HELP_END 0xFF + +// Help Main Topics +enum HelpSystemTopics +{ + TOPIC_WHAT_TO_DO, + TOPIC_HOW_TO_DO, + TOPIC_TERMS, + TOPIC_ABOUT_GAME, + TOPIC_TYPE_MATCHUP, + TOPIC_EXIT, + TOPIC_COUNT +}; + static EWRAM_DATA u16 sHelpSystemContextId = 0; static EWRAM_DATA u8 sSeenHelpSystemIntro = 0; -u8 gHelpSystemState[4]; +struct HelpSystemState +{ + // 0: Top level + // 1: Submenu + // 2: Help content + u8 level; + + // enum HelpSystemTopics + u8 topic; + + // Where the player's cursor was at top level + u8 scrollMain; + + // Where the player's cursor was at submenu + u8 scrollSub; +}; + +struct HelpSystemState gHelpSystemState; u16 gHelpContextIdBackup; static bool32 IsCurrentMapInArray(const u16 * mapIdxs); @@ -34,21 +66,6 @@ static void PrintTextOnPanel2Row52RightAlign(const u8 *); static void ResetHelpSystemCursor(struct HelpSystemListMenu * a0); static void PrintHelpSystemTopicMouseoverDescription(struct HelpSystemListMenu * a0, struct ListMenuItem * a1); -#define HELP_NONE 0 -#define HELP_END 0xFF - -// Help Main Topics -enum -{ - TOPIC_WHAT_TO_DO, - TOPIC_HOW_TO_DO, - TOPIC_TERMS, - TOPIC_ABOUT_GAME, - TOPIC_TYPE_MATCHUP, - TOPIC_EXIT, - TOPIC_COUNT -}; - static const u8 *const sHelpSystemTopicPtrs[TOPIC_COUNT] = { [TOPIC_WHAT_TO_DO] = Help_Text_WhatShouldIDo, [TOPIC_HOW_TO_DO] = Help_Text_HowDoIDoThis, @@ -1878,7 +1895,7 @@ bool8 HelpSystem_UpdateHasntSeenIntro(void) return TRUE; } -bool8 sub_812B45C(void) +bool8 HelpSystem_IsSinglePlayer(void) { if (gReceivedRemoteLinkPlayers == TRUE) return FALSE; @@ -1923,10 +1940,10 @@ static void BuildAndPrintMainTopicsListMenu(struct HelpSystemListMenu * helpList ResetHelpSystemListMenu(helpListMenu, listMenuItemsBuffer); BuildMainTopicsListAndMoveToH00(helpListMenu, listMenuItemsBuffer); PrintTextOnPanel2Row52RightAlign(gUnknown_841DFAC); - HelpSystem_InitListMenuController(helpListMenu, 0, gHelpSystemState[2]); + HelpSystem_InitListMenuController(helpListMenu, 0, gHelpSystemState.scrollMain); PrintHelpSystemTopicMouseoverDescription(helpListMenu, listMenuItemsBuffer); - sub_813BDA4(1); - sub_813BD5C(1); + HS_ShowOrHideMainWindowText(1); + HS_ShowOrHideControlsGuideInTopRight(1); } static void BuildMainTopicsListAndMoveToH00(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer) @@ -1950,34 +1967,34 @@ static void BuildMainTopicsListAndMoveToH00(struct HelpSystemListMenu * helpList static void BuildAndPrintSubmenuList(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer) { - sub_813BDE8(0); - sub_813BFC0(0); - sub_813BE78(1); + HS_SetMainWindowBgBrightness(0); + HS_ShowOrHideHeaderLine_Darker_FooterStyle(0); + HS_ShowOrHideHeaderAndFooterLines_Lighter(1); ResetHelpSystemListMenu(helpListMenu, listMenuItemsBuffer); SetHelpSystemSubmenuItems(helpListMenu, listMenuItemsBuffer); PrintTextOnPanel2Row52RightAlign(gUnknown_841DFC9); HelpSystem_InitListMenuController(helpListMenu, helpListMenu->itemsAbove, helpListMenu->cursorPos); - HelpSystem_PrintTextAt(sHelpSystemTopicPtrs[gHelpSystemState[1]], 0, 0); - sub_813BDA4(1); - sub_813BD5C(1); + HelpSystem_PrintTextAt(sHelpSystemTopicPtrs[gHelpSystemState.topic], 0, 0); + HS_ShowOrHideMainWindowText(1); + HS_ShowOrHideControlsGuideInTopRight(1); } static void SetHelpSystemSubmenuItems(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer) { u8 totalItems = 0; - const u8 * submenuItems = sHelpSystemSubmenuItemLists[sHelpSystemContextId * 5 + gHelpSystemState[1]]; // accessing as 2D array + const u8 * submenuItems = sHelpSystemSubmenuItemLists[sHelpSystemContextId * 5 + gHelpSystemState.topic]; // accessing as 2D array u8 i; for (i = 0; submenuItems[i] != HELP_END; i++) { if (IsHelpSystemSubmenuEnabled(submenuItems[i]) == TRUE) { - if (gHelpSystemState[1] == TOPIC_WHAT_TO_DO) + if (gHelpSystemState.topic == TOPIC_WHAT_TO_DO) listMenuItemsBuffer[totalItems].label = sHelpSystemSpecializedQuestionTextPtrs[submenuItems[i]]; - else if (gHelpSystemState[1] == TOPIC_HOW_TO_DO) + else if (gHelpSystemState.topic == TOPIC_HOW_TO_DO) listMenuItemsBuffer[totalItems].label = sHelpSystemMenuTopicTextPtrs[submenuItems[i]]; - else if (gHelpSystemState[1] == TOPIC_TERMS) + else if (gHelpSystemState.topic == TOPIC_TERMS) listMenuItemsBuffer[totalItems].label = sHelpSystemTermTextPtrs[submenuItems[i]]; - else if (gHelpSystemState[1] == TOPIC_ABOUT_GAME) + else if (gHelpSystemState.topic == TOPIC_ABOUT_GAME) listMenuItemsBuffer[totalItems].label = sHelpSystemGeneralTopicTextPtrs[submenuItems[i]]; else // TOPIC_TYPE_MATCHUP listMenuItemsBuffer[totalItems].label = sHelpSystemTypeMatchupTextPtrs[submenuItems[i]]; @@ -2005,7 +2022,7 @@ static void SetHelpSystemSubmenuItems(struct HelpSystemListMenu * helpListMenu, static bool8 HelpSystem_ShouldShowBasicTerms(void) { - if (FlagGet(FLAG_DEFEATED_BROCK) == TRUE && gHelpSystemState[1] == TOPIC_TERMS) + if (FlagGet(FLAG_DEFEATED_BROCK) == TRUE && gHelpSystemState.topic == TOPIC_TERMS) return TRUE; return FALSE; } @@ -2014,7 +2031,7 @@ static bool8 IsHelpSystemSubmenuEnabled(u8 id) { u8 i = 0; - if (gHelpSystemState[1] == TOPIC_WHAT_TO_DO) + if (gHelpSystemState.topic == TOPIC_WHAT_TO_DO) { switch (id) { @@ -2076,7 +2093,7 @@ static bool8 IsHelpSystemSubmenuEnabled(u8 id) } return FALSE; } - if (gHelpSystemState[1] == TOPIC_HOW_TO_DO) + if (gHelpSystemState.topic == TOPIC_HOW_TO_DO) { switch (id) { @@ -2143,7 +2160,7 @@ static bool8 IsHelpSystemSubmenuEnabled(u8 id) } return FALSE; } - if (gHelpSystemState[1] == TOPIC_TERMS) + if (gHelpSystemState.topic == TOPIC_TERMS) { if (HelpSystem_ShouldShowBasicTerms() == TRUE) { @@ -2203,7 +2220,7 @@ static bool8 IsHelpSystemSubmenuEnabled(u8 id) } return TRUE; } - if (gHelpSystemState[1] == TOPIC_ABOUT_GAME) + if (gHelpSystemState.topic == TOPIC_ABOUT_GAME) { switch (id) { @@ -2214,7 +2231,7 @@ static bool8 IsHelpSystemSubmenuEnabled(u8 id) } return TRUE; } - if (gHelpSystemState[1] == TOPIC_TYPE_MATCHUP) + if (gHelpSystemState.topic == TOPIC_TYPE_MATCHUP) { return TRUE; } @@ -2273,8 +2290,8 @@ bool8 HelpSystemSubroutine_PrintWelcomeMessage(struct HelpSystemListMenu * helpL { PrintTextOnPanel2Row52RightAlign(gUnknown_841DFA5); PrintWelcomeMessageOnPanel1(); - sub_813BDA4(1); - sub_813BD5C(1); + HS_ShowOrHideMainWindowText(1); + HS_ShowOrHideControlsGuideInTopRight(1); helpListMenu->state = 9; return TRUE; } @@ -2291,7 +2308,7 @@ bool8 HelpSystemSubroutine_WelcomeWaitButton(struct HelpSystemListMenu * helpLis bool8 HelpSystemSubroutine_WelcomeEndGotoMenu(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer) { - gHelpSystemState[2] = 0; + gHelpSystemState.scrollMain = 0; ResetHelpSystemCursor(helpListMenu); BuildAndPrintMainTopicsListMenu(helpListMenu, listMenuItemsBuffer); helpListMenu->state = 0; @@ -2314,7 +2331,7 @@ bool8 HelpSystemSubroutine_MenuInputHandlerMain(struct HelpSystemListMenu * help case -1: break; default: - gHelpSystemState[1] = input; + gHelpSystemState.topic = input; helpListMenu->state = 1; break; } @@ -2323,11 +2340,11 @@ bool8 HelpSystemSubroutine_MenuInputHandlerMain(struct HelpSystemListMenu * help bool8 HelpMenuSubroutine_InitSubmenu(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer) { - gHelpSystemState[0] = 1; - gHelpSystemState[2] = helpListMenu->cursorPos; + gHelpSystemState.level = 1; + gHelpSystemState.scrollMain = helpListMenu->cursorPos; ResetHelpSystemCursor(helpListMenu); BuildAndPrintSubmenuList(helpListMenu, listMenuItemsBuffer); - sub_813C75C(); + HS_UpdateMenuScrollArrows(); HelpSystem_SetInputDelay(2); helpListMenu->state = 3; return TRUE; @@ -2335,9 +2352,9 @@ bool8 HelpMenuSubroutine_InitSubmenu(struct HelpSystemListMenu * helpListMenu, s bool8 HelpMenuSubroutine_ReturnFromSubmenu(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer) { - sub_813C004(0, 0); - sub_813C004(1, 0); - gHelpSystemState[0] = 0; + HS_ShowOrHideScrollArrows(0, 0); + HS_ShowOrHideScrollArrows(1, 0); + gHelpSystemState.level = 0; BuildAndPrintMainTopicsListMenu(helpListMenu, listMenuItemsBuffer); helpListMenu->state = 0; return TRUE; @@ -2359,7 +2376,7 @@ bool8 HelpMenuSubroutine_SubmenuInputHandler(struct HelpSystemListMenu * helpLis case -1: break; default: - gHelpSystemState[3] = input; + gHelpSystemState.scrollSub = input; helpListMenu->state = 4; break; } @@ -2368,49 +2385,49 @@ bool8 HelpMenuSubroutine_SubmenuInputHandler(struct HelpSystemListMenu * helpLis void HelpSystem_PrintTopicLabel(void) { - HelpSystem_PrintTextAt(sHelpSystemTopicPtrs[gHelpSystemState[1]], 0, 0); + HelpSystem_PrintTextAt(sHelpSystemTopicPtrs[gHelpSystemState.topic], 0, 0); } bool8 HelpMenuSubroutine_HelpItemPrint(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer) { - gHelpSystemState[0] = 2; - sub_813BDA4(0); + gHelpSystemState.level = 2; + HS_ShowOrHideMainWindowText(0); HelpSystem_FillPanel1(); PrintTextOnPanel2Row52RightAlign(gUnknown_841DFBE); - sub_813BDE8(1); - sub_813BEE4(1); + HS_SetMainWindowBgBrightness(1); + HS_ShowOrHideHeaderAndFooterLines_Darker(1); - if (gHelpSystemState[1] == TOPIC_WHAT_TO_DO) + if (gHelpSystemState.topic == TOPIC_WHAT_TO_DO) { - HelpSystem_PrintTwoStrings(sHelpSystemSpecializedQuestionTextPtrs[gHelpSystemState[3]], sHelpSystemSpecializedAnswerTextPtrs[gHelpSystemState[3]]); + HelpSystem_PrintTwoStrings(sHelpSystemSpecializedQuestionTextPtrs[gHelpSystemState.scrollSub], sHelpSystemSpecializedAnswerTextPtrs[gHelpSystemState.scrollSub]); } - else if (gHelpSystemState[1] == TOPIC_HOW_TO_DO) + else if (gHelpSystemState.topic == TOPIC_HOW_TO_DO) { - HelpSystem_PrintTwoStrings(sHelpSystemMenuTopicTextPtrs[gHelpSystemState[3]], sHelpSystemHowToUseMenuTextPtrs[gHelpSystemState[3]]); + HelpSystem_PrintTwoStrings(sHelpSystemMenuTopicTextPtrs[gHelpSystemState.scrollSub], sHelpSystemHowToUseMenuTextPtrs[gHelpSystemState.scrollSub]); } - else if (gHelpSystemState[1] == TOPIC_TERMS) + else if (gHelpSystemState.topic == TOPIC_TERMS) { - HelpSystem_PrintTwoStrings(sHelpSystemTermTextPtrs[gHelpSystemState[3]], sHelpSystemTermDefinitionsTextPtrs[gHelpSystemState[3]]); + HelpSystem_PrintTwoStrings(sHelpSystemTermTextPtrs[gHelpSystemState.scrollSub], sHelpSystemTermDefinitionsTextPtrs[gHelpSystemState.scrollSub]); } - else if (gHelpSystemState[1] == TOPIC_ABOUT_GAME) + else if (gHelpSystemState.topic == TOPIC_ABOUT_GAME) { - HelpSystem_PrintTwoStrings(sHelpSystemGeneralTopicTextPtrs[gHelpSystemState[3]], sHelpSystemGeneralTopicDescriptionTextPtrs[gHelpSystemState[3]]); + HelpSystem_PrintTwoStrings(sHelpSystemGeneralTopicTextPtrs[gHelpSystemState.scrollSub], sHelpSystemGeneralTopicDescriptionTextPtrs[gHelpSystemState.scrollSub]); } else // TOPIC_TYPE_MATCHUP { - HelpSystem_PrintTwoStrings(sHelpSystemTypeMatchupTextPtrs[gHelpSystemState[3]], sHelpSystemTypeMatchupDescriptionTextPtrs[gHelpSystemState[3]]); + HelpSystem_PrintTwoStrings(sHelpSystemTypeMatchupTextPtrs[gHelpSystemState.scrollSub], sHelpSystemTypeMatchupDescriptionTextPtrs[gHelpSystemState.scrollSub]); } - sub_813BDA4(1); - sub_813BD5C(1); + HS_ShowOrHideMainWindowText(1); + HS_ShowOrHideControlsGuideInTopRight(1); helpListMenu->state = 6; return TRUE; } bool8 HelpMenuSubroutine_ReturnFromHelpItem(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer) { - gHelpSystemState[0] = 1; + gHelpSystemState.level = 1; BuildAndPrintSubmenuList(helpListMenu, listMenuItemsBuffer); - sub_813C75C(); + HS_UpdateMenuScrollArrows(); HelpSystem_SetInputDelay(2); helpListMenu->state = 3; return TRUE; @@ -2441,9 +2458,9 @@ static void PrintTextOnPanel2Row52RightAlign(const u8 * str) HelpSystem_PrintTextRightAlign_Row52(str); } -u8 sub_812BF88(void) +u8 GetHelpSystemMenuLevel(void) { - return gHelpSystemState[0]; + return gHelpSystemState.level; } static void ResetHelpSystemCursor(struct HelpSystemListMenu * helpListMenu) @@ -2459,5 +2476,5 @@ static void PrintHelpSystemTopicMouseoverDescription(struct HelpSystemListMenu * HelpSystem_PrintText_813C584(sHelpSystemTopicMouseoverDescriptionPtrs[5]); else HelpSystem_PrintText_813C584(sHelpSystemTopicMouseoverDescriptionPtrs[index]); - sub_813BE30(1); + HS_ShowOrHideToplevelTooltipWindow(1); } diff --git a/src/pokedex_screen.c b/src/pokedex_screen.c index b3f3d18ad..d71d2bec7 100644 --- a/src/pokedex_screen.c +++ b/src/pokedex_screen.c @@ -868,7 +868,7 @@ void sub_810250C(void) gUnknown_203ACF0->field_6C = sub_8104BBC(1, 1); gUnknown_203ACF0->field_66 = sub_8104BBC(0, 0); gUnknown_203ACF0->field_68 = sub_8104BBC(1, 0); - sub_8072474(0x80); + SetBGMVolume_SuppressHelpSystemReduction(0x80); ChangeBgX(0, 0, 0); ChangeBgY(0, 0, 0); ChangeBgX(1, 0, 0); @@ -925,7 +925,7 @@ bool8 sub_8102798(void) FREE_IF_NOT_NULL(GetBgTilemapBuffer(1)); FREE_IF_NOT_NULL(GetBgTilemapBuffer(2)); FREE_IF_NOT_NULL(GetBgTilemapBuffer(3)); - sub_807249C(); + BGMVolumeMax_EnableHelySystemReduction(); break; } return TRUE; diff --git a/src/sound.c b/src/sound.c index e956896e8..47fc7e892 100644 --- a/src/sound.c +++ b/src/sound.c @@ -16,7 +16,7 @@ struct Fanfare // TODO: what are these extern u8 gDisableMapMusicChangeOnMapLoad; -extern u8 gUnknown_203F174; +extern u8 gDisableHelpSystemVolumeReduce; // ewram EWRAM_DATA struct MusicPlayerInfo* gMPlay_PokemonCry = NULL; @@ -630,14 +630,14 @@ bool8 IsSpecialSEPlaying(void) return TRUE; } -void sub_8072474(u16 volume) +void SetBGMVolume_SuppressHelpSystemReduction(u16 volume) { - gUnknown_203F174 = 1; + gDisableHelpSystemVolumeReduce = TRUE; m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, volume); } -void sub_807249C(void) +void BGMVolumeMax_EnableHelySystemReduction(void) { - gUnknown_203F174 = 0; + gDisableHelpSystemVolumeReduce = FALSE; m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 256); } |