Document help system

This commit is contained in:
PikalaxALT
2021-03-23 11:28:06 -04:00
parent ff7f7744b7
commit d1f62285b5
6 changed files with 158 additions and 138 deletions
+14 -14
View File
@@ -34,7 +34,7 @@ void SetHelpContextDontCheckBattle(u8);
void SetHelpContextForMap(void); void SetHelpContextForMap(void);
void SetHelpContext(u8); void SetHelpContext(u8);
bool8 HelpSystem_UpdateHasntSeenIntro(void); bool8 HelpSystem_UpdateHasntSeenIntro(void);
bool8 sub_812B45C(void); bool8 HelpSystem_IsSinglePlayer(void);
void HelpSystem_Disable(void); void HelpSystem_Disable(void);
void HelpSystem_Enable(void); void HelpSystem_Enable(void);
void HelpSystem_EnableToggleWithRButton(void); void HelpSystem_EnableToggleWithRButton(void);
@@ -50,7 +50,7 @@ void HelpSystem_PrintTopicLabel(void);
bool8 HelpMenuSubroutine_HelpItemPrint(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer); bool8 HelpMenuSubroutine_HelpItemPrint(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer);
bool8 HelpMenuSubroutine_ReturnFromHelpItem(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer); bool8 HelpMenuSubroutine_ReturnFromHelpItem(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer);
bool8 HelpMenuSubroutine_HelpItemWaitButton(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer); bool8 HelpMenuSubroutine_HelpItemWaitButton(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer);
bool8 sub_812BF88(void); bool8 GetHelpSystemMenuLevel(void);
// help_system // help_system
bool8 RunHelpSystemCallback(void); bool8 RunHelpSystemCallback(void);
@@ -63,17 +63,17 @@ void RestoreGPURegs(void);
void RestoreMapTiles(void); void RestoreMapTiles(void);
void RestoreMapTextColors(void); void RestoreMapTextColors(void);
void CommitTilemap(void); void CommitTilemap(void);
void sub_813BCF4(void); void HS_BufferFillMapWithTile1FF(void);
void sub_813BD14(u8); void HS_ShowOrHideWordHELPinTopLeft(u8 mode);
void sub_813BD5C(u8); void HS_ShowOrHideControlsGuideInTopRight(u8 mode);
void sub_813BDA4(u8); void HS_ShowOrHideMainWindowText(u8 mode);
void sub_813BDE8(u8); void HS_SetMainWindowBgBrightness(u8 mode);
void sub_813BE30(u8); void HS_ShowOrHideToplevelTooltipWindow(u8 mode);
void sub_813BE78(u8); void HS_ShowOrHideHeaderAndFooterLines_Lighter(u8 mode);
void sub_813BEE4(u8); void HS_ShowOrHideHeaderAndFooterLines_Darker(u8 mode);
void sub_813BF50(u8); void HS_ShowOrHideVerticalBlackBarsAlongSides(u8 mode);
void sub_813BFC0(u8); void HS_ShowOrHideHeaderLine_Darker_FooterStyle(u8 mode);
void sub_813C004(u8, u8); void HS_ShowOrHideScrollArrows(u8 which, u8 mode);
void HelpSystem_PrintTextRightAlign_Row52(const u8 *str); void HelpSystem_PrintTextRightAlign_Row52(const u8 *str);
void HelpSystem_PrintTextAt(const u8 *, u8, u8); void HelpSystem_PrintTextAt(const u8 *, u8, u8);
void HelpSystem_PrintTwoStrings(const u8 *a0, const u8 *a1); void HelpSystem_PrintTwoStrings(const u8 *a0, const u8 *a1);
@@ -83,7 +83,7 @@ void HelpSystem_FillPanel1(void);
void HelpSystem_InitListMenuController(struct HelpSystemListMenu *, u8, u8); void HelpSystem_InitListMenuController(struct HelpSystemListMenu *, u8, u8);
void HelpSystem_SetInputDelay(u8); void HelpSystem_SetInputDelay(u8);
s32 HelpSystem_GetMenuInput(void); s32 HelpSystem_GetMenuInput(void);
void sub_813C75C(void); void HS_UpdateMenuScrollArrows(void);
void DecompressAndRenderGlyph(u8 font, u16 glyph, struct Bitmap *srcBlit, struct Bitmap *destBlit, u8 *destBuffer, u8 x, u8 y, u8 width, u8 height); void DecompressAndRenderGlyph(u8 font, u16 glyph, struct Bitmap *srcBlit, struct Bitmap *destBlit, u8 *destBuffer, u8 x, u8 y, u8 width, u8 height);
void HelpSystem_PrintText_Row61(const u8 * str); void HelpSystem_PrintText_Row61(const u8 * str);
+2 -2
View File
@@ -46,7 +46,7 @@ void SE12PanpotControl(s8 pan);
bool8 IsSEPlaying(void); bool8 IsSEPlaying(void);
bool8 IsBGMPlaying(void); bool8 IsBGMPlaying(void);
bool8 IsSpecialSEPlaying(void); bool8 IsSpecialSEPlaying(void);
void sub_8072474(u16 volume); void SetBGMVolume_SuppressHelpSystemReduction(u16 volume);
void sub_807249C(void); void BGMVolumeMax_EnableHelySystemReduction(void);
#endif // GUARD_SOUND_H #endif // GUARD_SOUND_H
+49 -46
View File
@@ -26,7 +26,7 @@ struct HelpSystemVideoState
}; };
static EWRAM_DATA u8 sMapTilesBackup[BG_CHAR_SIZE] = {0}; 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; EWRAM_DATA bool8 gHelpSystemToggleWithRButtonDisabled = FALSE;
static EWRAM_DATA u8 sDelayTimer = 0; static EWRAM_DATA u8 sDelayTimer = 0;
static EWRAM_DATA u8 sInHelpSystem = 0; static EWRAM_DATA u8 sInHelpSystem = 0;
@@ -51,7 +51,7 @@ u8 RunHelpSystemCallback(void)
return 0; return 0;
if (JOY_NEW(L_BUTTON | R_BUTTON)) if (JOY_NEW(L_BUTTON | R_BUTTON))
{ {
if (!sub_812B45C() || !gHelpSystemEnabled) if (!HelpSystem_IsSinglePlayer() || !gHelpSystemEnabled)
{ {
PlaySE(SE_HELP_ERROR); PlaySE(SE_HELP_ERROR);
return 0; return 0;
@@ -59,7 +59,7 @@ u8 RunHelpSystemCallback(void)
m4aMPlayStop(&gMPlayInfo_SE1); m4aMPlayStop(&gMPlayInfo_SE1);
m4aMPlayStop(&gMPlayInfo_SE2); m4aMPlayStop(&gMPlayInfo_SE2);
PlaySE(SE_HELP_OPEN); PlaySE(SE_HELP_OPEN);
if (!gUnknown_203F174) if (!gDisableHelpSystemVolumeReduce)
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x80); m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x80);
SaveCallbacks(); SaveCallbacks();
sInHelpSystem = 1; sInHelpSystem = 1;
@@ -81,17 +81,17 @@ u8 RunHelpSystemCallback(void)
sVideoState.state = 3; sVideoState.state = 3;
break; break;
case 3: case 3:
sub_813BCF4(); HS_BufferFillMapWithTile1FF();
HelpSystem_FillPanel3(); HelpSystem_FillPanel3();
HelpSystem_FillPanel2(); HelpSystem_FillPanel2();
HelpSystem_PrintText_Row61(gString_Help); HelpSystem_PrintText_Row61(gString_Help);
sub_813BD14(1); HS_ShowOrHideWordHELPinTopLeft(1);
if (HelpSystem_UpdateHasntSeenIntro() == TRUE) if (HelpSystem_UpdateHasntSeenIntro() == TRUE)
HelpSystemSubroutine_PrintWelcomeMessage(&gHelpSystemListMenu, gHelpSystemListMenuItems); HelpSystemSubroutine_PrintWelcomeMessage(&gHelpSystemListMenu, gHelpSystemListMenuItems);
else else
HelpSystemSubroutine_WelcomeEndGotoMenu(&gHelpSystemListMenu, gHelpSystemListMenuItems); HelpSystemSubroutine_WelcomeEndGotoMenu(&gHelpSystemListMenu, gHelpSystemListMenuItems);
sub_813BE78(1); HS_ShowOrHideHeaderAndFooterLines_Lighter(1);
sub_813BF50(1); HS_ShowOrHideVerticalBlackBarsAlongSides(1);
CommitTilemap(); CommitTilemap();
sVideoState.state = 4; sVideoState.state = 4;
break; break;
@@ -121,7 +121,7 @@ u8 RunHelpSystemCallback(void)
sVideoState.state = 7; sVideoState.state = 7;
break; break;
case 7: case 7:
if (!gUnknown_203F174) if (!gDisableHelpSystemVolumeReduce)
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100); m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100);
RestoreMapTextColors(); RestoreMapTextColors();
RestoreGPURegs(); RestoreGPURegs();
@@ -223,12 +223,12 @@ void HS_DrawBgTilemapRect(u16 baseTile, u8 left, u8 top, u8 width, u8 height, u1
CommitTilemap(); CommitTilemap();
} }
void sub_813BCF4(void) void HS_BufferFillMapWithTile1FF(void)
{ {
HS_DrawBgTilemapRect(0x1FF, 0, 0, 30, 20, 0); HS_DrawBgTilemapRect(0x1FF, 0, 0, 30, 20, 0);
} }
void sub_813BD14(u8 mode) void HS_ShowOrHideWordHELPinTopLeft(u8 mode)
{ {
switch (mode) switch (mode)
{ {
@@ -241,7 +241,7 @@ void sub_813BD14(u8 mode)
} }
} }
void sub_813BD5C(u8 mode) void HS_ShowOrHideControlsGuideInTopRight(u8 mode)
{ {
switch (mode) switch (mode)
{ {
@@ -254,7 +254,7 @@ void sub_813BD5C(u8 mode)
} }
} }
void sub_813BDA4(u8 mode) void HS_ShowOrHideMainWindowText(u8 mode)
{ {
switch (mode) switch (mode)
{ {
@@ -267,20 +267,22 @@ void sub_813BDA4(u8 mode)
} }
} }
void sub_813BDE8(u8 mode) void HS_SetMainWindowBgBrightness(u8 mode)
{ {
switch (mode) switch (mode)
{ {
case 0: case 0:
// Brighter
HS_DrawBgTilemapRect(0x1FF, 1, 3, 28, 16, 0); HS_DrawBgTilemapRect(0x1FF, 1, 3, 28, 16, 0);
break; break;
case 1: case 1:
// Darker
HS_DrawBgTilemapRect(0x1FA, 1, 3, 28, 17, 0); HS_DrawBgTilemapRect(0x1FA, 1, 3, 28, 17, 0);
break; break;
} }
} }
void sub_813BE30(u8 mode) void HS_ShowOrHideToplevelTooltipWindow(u8 mode)
{ {
switch (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) switch (mode)
{ {
@@ -308,7 +310,7 @@ void sub_813BE78(u8 mode)
} }
} }
void sub_813BEE4(u8 mode) void HS_ShowOrHideHeaderAndFooterLines_Darker(u8 mode)
{ {
switch (mode) switch (mode)
{ {
@@ -323,7 +325,7 @@ void sub_813BEE4(u8 mode)
} }
} }
void sub_813BF50(u8 mode) void HS_ShowOrHideVerticalBlackBarsAlongSides(u8 mode)
{ {
switch (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) 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) switch (mode)
{ {
@@ -360,9 +362,9 @@ void sub_813C004(u8 a0, u8 mode)
HS_DrawBgTilemapRect(0x1FF, 28, 18, 1, 1, 0); HS_DrawBgTilemapRect(0x1FF, 28, 18, 1, 1, 0);
break; break;
case 1: case 1:
if (a0 == 0) if (which == 0) // top
HS_DrawBgTilemapRect(0x1FE, 28, 3, 1, 1, 0); HS_DrawBgTilemapRect(0x1FE, 28, 3, 1, 1, 0);
else else // bottom
HS_DrawBgTilemapRect(0x1FD, 28, 18, 1, 1, 0); HS_DrawBgTilemapRect(0x1FD, 28, 18, 1, 1, 0);
break; break;
} }
@@ -635,7 +637,7 @@ void HelpSystem_InitListMenuController(struct HelpSystemListMenu * a0, u8 a1, u8
gHelpSystemListMenu.state = 0; gHelpSystemListMenu.state = 0;
if (gHelpSystemListMenu.sub.totalItems < gHelpSystemListMenu.sub.maxShowed) if (gHelpSystemListMenu.sub.totalItems < gHelpSystemListMenu.sub.maxShowed)
gHelpSystemListMenu.sub.maxShowed = gHelpSystemListMenu.sub.totalItems; gHelpSystemListMenu.sub.maxShowed = gHelpSystemListMenu.sub.totalItems;
sub_813BDA4(0); HS_ShowOrHideMainWindowText(0);
HelpSystem_FillPanel1(); HelpSystem_FillPanel1();
PrintListMenuItems(); PrintListMenuItems();
PlaceListMenuCursor(); PlaceListMenuCursor();
@@ -695,23 +697,24 @@ s32 HelpSystem_GetMenuInput(void)
return -1; 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) if (gHelpSystemListMenu.sub.totalItems > 7)
{ {
s32 r4 = gHelpSystemListMenu.itemsAbove + gHelpSystemListMenu.cursorPos; s32 cursorPos = gHelpSystemListMenu.itemsAbove + gHelpSystemListMenu.cursorPos;
sub_813C004(0, 0); HS_ShowOrHideScrollArrows(0, 0); // Hide both
if (r4 == 0) if (cursorPos == 0)
sub_813C004(1, 1); HS_ShowOrHideScrollArrows(1, 1); // Show bottom
else if (gHelpSystemListMenu.itemsAbove == 0 && gHelpSystemListMenu.cursorPos != 0) else if (gHelpSystemListMenu.itemsAbove == 0 && gHelpSystemListMenu.cursorPos != 0)
sub_813C004(1, 1); HS_ShowOrHideScrollArrows(1, 1); // Show bottom
else if (gHelpSystemListMenu.itemsAbove == r6) else if (gHelpSystemListMenu.itemsAbove == topItemIdx)
sub_813C004(0, 1); HS_ShowOrHideScrollArrows(0, 1); // Show top
else if (gHelpSystemListMenu.itemsAbove != 0) else if (gHelpSystemListMenu.itemsAbove != 0)
{ {
sub_813C004(0, 1); // Show both
sub_813C004(1, 1); HS_ShowOrHideScrollArrows(0, 1);
HS_ShowOrHideScrollArrows(1, 1);
} }
} }
} }
@@ -739,7 +742,7 @@ void PlaceListMenuCursor(void)
HelpSystem_PrintTextAt(gText_SelectorArrow2, x, y); 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 glyphHeight = GetFontAttribute(2, FONTATTR_MAX_LETTER_HEIGHT) + 1;
u8 x = gHelpSystemListMenu.sub.left; u8 x = gHelpSystemListMenu.sub.left;
@@ -749,13 +752,13 @@ void sub_813C860(u8 i)
u8 TryMoveCursor1(u8 dirn) u8 TryMoveCursor1(u8 dirn)
{ {
u16 r4; u16 midPoint;
if (dirn == 0) if (dirn == 0)
{ {
if (gHelpSystemListMenu.sub.maxShowed == 1) if (gHelpSystemListMenu.sub.maxShowed == 1)
r4 = 0; midPoint = 0;
else 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.itemsAbove == 0)
{ {
if (gHelpSystemListMenu.cursorPos != 0) if (gHelpSystemListMenu.cursorPos != 0)
@@ -766,7 +769,7 @@ u8 TryMoveCursor1(u8 dirn)
else else
return 0; return 0;
} }
if (gHelpSystemListMenu.cursorPos > r4) if (gHelpSystemListMenu.cursorPos > midPoint)
{ {
gHelpSystemListMenu.cursorPos--; gHelpSystemListMenu.cursorPos--;
return 1; return 1;
@@ -780,9 +783,9 @@ u8 TryMoveCursor1(u8 dirn)
else else
{ {
if (gHelpSystemListMenu.sub.maxShowed == 1) if (gHelpSystemListMenu.sub.maxShowed == 1)
r4 = 0; midPoint = 0;
else 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.itemsAbove == gHelpSystemListMenu.sub.totalItems - gHelpSystemListMenu.sub.maxShowed)
{ {
if (gHelpSystemListMenu.cursorPos < gHelpSystemListMenu.sub.maxShowed - 1) if (gHelpSystemListMenu.cursorPos < gHelpSystemListMenu.sub.maxShowed - 1)
@@ -793,7 +796,7 @@ u8 TryMoveCursor1(u8 dirn)
else else
return 0; return 0;
} }
else if (gHelpSystemListMenu.cursorPos < r4) else if (gHelpSystemListMenu.cursorPos < midPoint)
{ {
gHelpSystemListMenu.cursorPos++; gHelpSystemListMenu.cursorPos++;
return 1; return 1;
@@ -822,29 +825,29 @@ bool8 MoveCursor(u8 by, u8 dirn)
return TRUE; return TRUE;
case 1: case 1:
// changed cursorPos only // changed cursorPos only
sub_813C860(r7); HS_RemoveSelectionCursorAt(r7);
PlaceListMenuCursor(); PlaceListMenuCursor();
CommitTilemap(); CommitTilemap();
break; break;
case 2: case 2:
case 3: case 3:
// changed itemsAbove // changed itemsAbove
if (sub_812BF88() == TRUE) if (GetHelpSystemMenuLevel() == 1)
{ {
HelpSystem_SetInputDelay(2); HelpSystem_SetInputDelay(2);
HelpSystem_FillPanel1(); HelpSystem_FillPanel1();
PrintListMenuItems(); PrintListMenuItems();
PlaceListMenuCursor(); PlaceListMenuCursor();
HelpSystem_PrintTopicLabel(); HelpSystem_PrintTopicLabel();
sub_813C75C(); HS_UpdateMenuScrollArrows();
} }
else else
{ {
sub_813BDA4(0); HS_ShowOrHideMainWindowText(0);
HelpSystem_FillPanel1(); HelpSystem_FillPanel1();
PrintListMenuItems(); PrintListMenuItems();
PlaceListMenuCursor(); PlaceListMenuCursor();
sub_813BDA4(1); HS_ShowOrHideMainWindowText(1);
} }
CommitTilemap(); CommitTilemap();
break; break;
+86 -69
View File
@@ -16,10 +16,42 @@
#include "constants/maps.h" #include "constants/maps.h"
#include "constants/songs.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 u16 sHelpSystemContextId = 0;
static EWRAM_DATA u8 sSeenHelpSystemIntro = 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; u16 gHelpContextIdBackup;
static bool32 IsCurrentMapInArray(const u16 * mapIdxs); static bool32 IsCurrentMapInArray(const u16 * mapIdxs);
@@ -34,21 +66,6 @@ static void PrintTextOnPanel2Row52RightAlign(const u8 *);
static void ResetHelpSystemCursor(struct HelpSystemListMenu * a0); static void ResetHelpSystemCursor(struct HelpSystemListMenu * a0);
static void PrintHelpSystemTopicMouseoverDescription(struct HelpSystemListMenu * a0, struct ListMenuItem * a1); 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] = { static const u8 *const sHelpSystemTopicPtrs[TOPIC_COUNT] = {
[TOPIC_WHAT_TO_DO] = Help_Text_WhatShouldIDo, [TOPIC_WHAT_TO_DO] = Help_Text_WhatShouldIDo,
[TOPIC_HOW_TO_DO] = Help_Text_HowDoIDoThis, [TOPIC_HOW_TO_DO] = Help_Text_HowDoIDoThis,
@@ -1878,7 +1895,7 @@ bool8 HelpSystem_UpdateHasntSeenIntro(void)
return TRUE; return TRUE;
} }
bool8 sub_812B45C(void) bool8 HelpSystem_IsSinglePlayer(void)
{ {
if (gReceivedRemoteLinkPlayers == TRUE) if (gReceivedRemoteLinkPlayers == TRUE)
return FALSE; return FALSE;
@@ -1923,10 +1940,10 @@ static void BuildAndPrintMainTopicsListMenu(struct HelpSystemListMenu * helpList
ResetHelpSystemListMenu(helpListMenu, listMenuItemsBuffer); ResetHelpSystemListMenu(helpListMenu, listMenuItemsBuffer);
BuildMainTopicsListAndMoveToH00(helpListMenu, listMenuItemsBuffer); BuildMainTopicsListAndMoveToH00(helpListMenu, listMenuItemsBuffer);
PrintTextOnPanel2Row52RightAlign(gUnknown_841DFAC); PrintTextOnPanel2Row52RightAlign(gUnknown_841DFAC);
HelpSystem_InitListMenuController(helpListMenu, 0, gHelpSystemState[2]); HelpSystem_InitListMenuController(helpListMenu, 0, gHelpSystemState.scrollMain);
PrintHelpSystemTopicMouseoverDescription(helpListMenu, listMenuItemsBuffer); PrintHelpSystemTopicMouseoverDescription(helpListMenu, listMenuItemsBuffer);
sub_813BDA4(1); HS_ShowOrHideMainWindowText(1);
sub_813BD5C(1); HS_ShowOrHideControlsGuideInTopRight(1);
} }
static void BuildMainTopicsListAndMoveToH00(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer) 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) static void BuildAndPrintSubmenuList(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
sub_813BDE8(0); HS_SetMainWindowBgBrightness(0);
sub_813BFC0(0); HS_ShowOrHideHeaderLine_Darker_FooterStyle(0);
sub_813BE78(1); HS_ShowOrHideHeaderAndFooterLines_Lighter(1);
ResetHelpSystemListMenu(helpListMenu, listMenuItemsBuffer); ResetHelpSystemListMenu(helpListMenu, listMenuItemsBuffer);
SetHelpSystemSubmenuItems(helpListMenu, listMenuItemsBuffer); SetHelpSystemSubmenuItems(helpListMenu, listMenuItemsBuffer);
PrintTextOnPanel2Row52RightAlign(gUnknown_841DFC9); PrintTextOnPanel2Row52RightAlign(gUnknown_841DFC9);
HelpSystem_InitListMenuController(helpListMenu, helpListMenu->itemsAbove, helpListMenu->cursorPos); HelpSystem_InitListMenuController(helpListMenu, helpListMenu->itemsAbove, helpListMenu->cursorPos);
HelpSystem_PrintTextAt(sHelpSystemTopicPtrs[gHelpSystemState[1]], 0, 0); HelpSystem_PrintTextAt(sHelpSystemTopicPtrs[gHelpSystemState.topic], 0, 0);
sub_813BDA4(1); HS_ShowOrHideMainWindowText(1);
sub_813BD5C(1); HS_ShowOrHideControlsGuideInTopRight(1);
} }
static void SetHelpSystemSubmenuItems(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer) static void SetHelpSystemSubmenuItems(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
u8 totalItems = 0; 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; u8 i;
for (i = 0; submenuItems[i] != HELP_END; i++) for (i = 0; submenuItems[i] != HELP_END; i++)
{ {
if (IsHelpSystemSubmenuEnabled(submenuItems[i]) == TRUE) 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]]; 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]]; listMenuItemsBuffer[totalItems].label = sHelpSystemMenuTopicTextPtrs[submenuItems[i]];
else if (gHelpSystemState[1] == TOPIC_TERMS) else if (gHelpSystemState.topic == TOPIC_TERMS)
listMenuItemsBuffer[totalItems].label = sHelpSystemTermTextPtrs[submenuItems[i]]; 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]]; listMenuItemsBuffer[totalItems].label = sHelpSystemGeneralTopicTextPtrs[submenuItems[i]];
else // TOPIC_TYPE_MATCHUP else // TOPIC_TYPE_MATCHUP
listMenuItemsBuffer[totalItems].label = sHelpSystemTypeMatchupTextPtrs[submenuItems[i]]; listMenuItemsBuffer[totalItems].label = sHelpSystemTypeMatchupTextPtrs[submenuItems[i]];
@@ -2005,7 +2022,7 @@ static void SetHelpSystemSubmenuItems(struct HelpSystemListMenu * helpListMenu,
static bool8 HelpSystem_ShouldShowBasicTerms(void) 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 TRUE;
return FALSE; return FALSE;
} }
@@ -2014,7 +2031,7 @@ static bool8 IsHelpSystemSubmenuEnabled(u8 id)
{ {
u8 i = 0; u8 i = 0;
if (gHelpSystemState[1] == TOPIC_WHAT_TO_DO) if (gHelpSystemState.topic == TOPIC_WHAT_TO_DO)
{ {
switch (id) switch (id)
{ {
@@ -2076,7 +2093,7 @@ static bool8 IsHelpSystemSubmenuEnabled(u8 id)
} }
return FALSE; return FALSE;
} }
if (gHelpSystemState[1] == TOPIC_HOW_TO_DO) if (gHelpSystemState.topic == TOPIC_HOW_TO_DO)
{ {
switch (id) switch (id)
{ {
@@ -2143,7 +2160,7 @@ static bool8 IsHelpSystemSubmenuEnabled(u8 id)
} }
return FALSE; return FALSE;
} }
if (gHelpSystemState[1] == TOPIC_TERMS) if (gHelpSystemState.topic == TOPIC_TERMS)
{ {
if (HelpSystem_ShouldShowBasicTerms() == TRUE) if (HelpSystem_ShouldShowBasicTerms() == TRUE)
{ {
@@ -2203,7 +2220,7 @@ static bool8 IsHelpSystemSubmenuEnabled(u8 id)
} }
return TRUE; return TRUE;
} }
if (gHelpSystemState[1] == TOPIC_ABOUT_GAME) if (gHelpSystemState.topic == TOPIC_ABOUT_GAME)
{ {
switch (id) switch (id)
{ {
@@ -2214,7 +2231,7 @@ static bool8 IsHelpSystemSubmenuEnabled(u8 id)
} }
return TRUE; return TRUE;
} }
if (gHelpSystemState[1] == TOPIC_TYPE_MATCHUP) if (gHelpSystemState.topic == TOPIC_TYPE_MATCHUP)
{ {
return TRUE; return TRUE;
} }
@@ -2273,8 +2290,8 @@ bool8 HelpSystemSubroutine_PrintWelcomeMessage(struct HelpSystemListMenu * helpL
{ {
PrintTextOnPanel2Row52RightAlign(gUnknown_841DFA5); PrintTextOnPanel2Row52RightAlign(gUnknown_841DFA5);
PrintWelcomeMessageOnPanel1(); PrintWelcomeMessageOnPanel1();
sub_813BDA4(1); HS_ShowOrHideMainWindowText(1);
sub_813BD5C(1); HS_ShowOrHideControlsGuideInTopRight(1);
helpListMenu->state = 9; helpListMenu->state = 9;
return TRUE; return TRUE;
} }
@@ -2291,7 +2308,7 @@ bool8 HelpSystemSubroutine_WelcomeWaitButton(struct HelpSystemListMenu * helpLis
bool8 HelpSystemSubroutine_WelcomeEndGotoMenu(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer) bool8 HelpSystemSubroutine_WelcomeEndGotoMenu(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
gHelpSystemState[2] = 0; gHelpSystemState.scrollMain = 0;
ResetHelpSystemCursor(helpListMenu); ResetHelpSystemCursor(helpListMenu);
BuildAndPrintMainTopicsListMenu(helpListMenu, listMenuItemsBuffer); BuildAndPrintMainTopicsListMenu(helpListMenu, listMenuItemsBuffer);
helpListMenu->state = 0; helpListMenu->state = 0;
@@ -2314,7 +2331,7 @@ bool8 HelpSystemSubroutine_MenuInputHandlerMain(struct HelpSystemListMenu * help
case -1: case -1:
break; break;
default: default:
gHelpSystemState[1] = input; gHelpSystemState.topic = input;
helpListMenu->state = 1; helpListMenu->state = 1;
break; break;
} }
@@ -2323,11 +2340,11 @@ bool8 HelpSystemSubroutine_MenuInputHandlerMain(struct HelpSystemListMenu * help
bool8 HelpMenuSubroutine_InitSubmenu(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer) bool8 HelpMenuSubroutine_InitSubmenu(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
gHelpSystemState[0] = 1; gHelpSystemState.level = 1;
gHelpSystemState[2] = helpListMenu->cursorPos; gHelpSystemState.scrollMain = helpListMenu->cursorPos;
ResetHelpSystemCursor(helpListMenu); ResetHelpSystemCursor(helpListMenu);
BuildAndPrintSubmenuList(helpListMenu, listMenuItemsBuffer); BuildAndPrintSubmenuList(helpListMenu, listMenuItemsBuffer);
sub_813C75C(); HS_UpdateMenuScrollArrows();
HelpSystem_SetInputDelay(2); HelpSystem_SetInputDelay(2);
helpListMenu->state = 3; helpListMenu->state = 3;
return TRUE; return TRUE;
@@ -2335,9 +2352,9 @@ bool8 HelpMenuSubroutine_InitSubmenu(struct HelpSystemListMenu * helpListMenu, s
bool8 HelpMenuSubroutine_ReturnFromSubmenu(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer) bool8 HelpMenuSubroutine_ReturnFromSubmenu(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
sub_813C004(0, 0); HS_ShowOrHideScrollArrows(0, 0);
sub_813C004(1, 0); HS_ShowOrHideScrollArrows(1, 0);
gHelpSystemState[0] = 0; gHelpSystemState.level = 0;
BuildAndPrintMainTopicsListMenu(helpListMenu, listMenuItemsBuffer); BuildAndPrintMainTopicsListMenu(helpListMenu, listMenuItemsBuffer);
helpListMenu->state = 0; helpListMenu->state = 0;
return TRUE; return TRUE;
@@ -2359,7 +2376,7 @@ bool8 HelpMenuSubroutine_SubmenuInputHandler(struct HelpSystemListMenu * helpLis
case -1: case -1:
break; break;
default: default:
gHelpSystemState[3] = input; gHelpSystemState.scrollSub = input;
helpListMenu->state = 4; helpListMenu->state = 4;
break; break;
} }
@@ -2368,49 +2385,49 @@ bool8 HelpMenuSubroutine_SubmenuInputHandler(struct HelpSystemListMenu * helpLis
void HelpSystem_PrintTopicLabel(void) 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) bool8 HelpMenuSubroutine_HelpItemPrint(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
gHelpSystemState[0] = 2; gHelpSystemState.level = 2;
sub_813BDA4(0); HS_ShowOrHideMainWindowText(0);
HelpSystem_FillPanel1(); HelpSystem_FillPanel1();
PrintTextOnPanel2Row52RightAlign(gUnknown_841DFBE); PrintTextOnPanel2Row52RightAlign(gUnknown_841DFBE);
sub_813BDE8(1); HS_SetMainWindowBgBrightness(1);
sub_813BEE4(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 else // TOPIC_TYPE_MATCHUP
{ {
HelpSystem_PrintTwoStrings(sHelpSystemTypeMatchupTextPtrs[gHelpSystemState[3]], sHelpSystemTypeMatchupDescriptionTextPtrs[gHelpSystemState[3]]); HelpSystem_PrintTwoStrings(sHelpSystemTypeMatchupTextPtrs[gHelpSystemState.scrollSub], sHelpSystemTypeMatchupDescriptionTextPtrs[gHelpSystemState.scrollSub]);
} }
sub_813BDA4(1); HS_ShowOrHideMainWindowText(1);
sub_813BD5C(1); HS_ShowOrHideControlsGuideInTopRight(1);
helpListMenu->state = 6; helpListMenu->state = 6;
return TRUE; return TRUE;
} }
bool8 HelpMenuSubroutine_ReturnFromHelpItem(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer) bool8 HelpMenuSubroutine_ReturnFromHelpItem(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
gHelpSystemState[0] = 1; gHelpSystemState.level = 1;
BuildAndPrintSubmenuList(helpListMenu, listMenuItemsBuffer); BuildAndPrintSubmenuList(helpListMenu, listMenuItemsBuffer);
sub_813C75C(); HS_UpdateMenuScrollArrows();
HelpSystem_SetInputDelay(2); HelpSystem_SetInputDelay(2);
helpListMenu->state = 3; helpListMenu->state = 3;
return TRUE; return TRUE;
@@ -2441,9 +2458,9 @@ static void PrintTextOnPanel2Row52RightAlign(const u8 * str)
HelpSystem_PrintTextRightAlign_Row52(str); HelpSystem_PrintTextRightAlign_Row52(str);
} }
u8 sub_812BF88(void) u8 GetHelpSystemMenuLevel(void)
{ {
return gHelpSystemState[0]; return gHelpSystemState.level;
} }
static void ResetHelpSystemCursor(struct HelpSystemListMenu * helpListMenu) static void ResetHelpSystemCursor(struct HelpSystemListMenu * helpListMenu)
@@ -2459,5 +2476,5 @@ static void PrintHelpSystemTopicMouseoverDescription(struct HelpSystemListMenu *
HelpSystem_PrintText_813C584(sHelpSystemTopicMouseoverDescriptionPtrs[5]); HelpSystem_PrintText_813C584(sHelpSystemTopicMouseoverDescriptionPtrs[5]);
else else
HelpSystem_PrintText_813C584(sHelpSystemTopicMouseoverDescriptionPtrs[index]); HelpSystem_PrintText_813C584(sHelpSystemTopicMouseoverDescriptionPtrs[index]);
sub_813BE30(1); HS_ShowOrHideToplevelTooltipWindow(1);
} }
+2 -2
View File
@@ -868,7 +868,7 @@ void sub_810250C(void)
gUnknown_203ACF0->field_6C = sub_8104BBC(1, 1); gUnknown_203ACF0->field_6C = sub_8104BBC(1, 1);
gUnknown_203ACF0->field_66 = sub_8104BBC(0, 0); gUnknown_203ACF0->field_66 = sub_8104BBC(0, 0);
gUnknown_203ACF0->field_68 = sub_8104BBC(1, 0); gUnknown_203ACF0->field_68 = sub_8104BBC(1, 0);
sub_8072474(0x80); SetBGMVolume_SuppressHelpSystemReduction(0x80);
ChangeBgX(0, 0, 0); ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0); ChangeBgY(0, 0, 0);
ChangeBgX(1, 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(1));
FREE_IF_NOT_NULL(GetBgTilemapBuffer(2)); FREE_IF_NOT_NULL(GetBgTilemapBuffer(2));
FREE_IF_NOT_NULL(GetBgTilemapBuffer(3)); FREE_IF_NOT_NULL(GetBgTilemapBuffer(3));
sub_807249C(); BGMVolumeMax_EnableHelySystemReduction();
break; break;
} }
return TRUE; return TRUE;
+5 -5
View File
@@ -16,7 +16,7 @@ struct Fanfare
// TODO: what are these // TODO: what are these
extern u8 gDisableMapMusicChangeOnMapLoad; extern u8 gDisableMapMusicChangeOnMapLoad;
extern u8 gUnknown_203F174; extern u8 gDisableHelpSystemVolumeReduce;
// ewram // ewram
EWRAM_DATA struct MusicPlayerInfo* gMPlay_PokemonCry = NULL; EWRAM_DATA struct MusicPlayerInfo* gMPlay_PokemonCry = NULL;
@@ -630,14 +630,14 @@ bool8 IsSpecialSEPlaying(void)
return TRUE; return TRUE;
} }
void sub_8072474(u16 volume) void SetBGMVolume_SuppressHelpSystemReduction(u16 volume)
{ {
gUnknown_203F174 = 1; gDisableHelpSystemVolumeReduce = TRUE;
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, volume); m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, volume);
} }
void sub_807249C(void) void BGMVolumeMax_EnableHelySystemReduction(void)
{ {
gUnknown_203F174 = 0; gDisableHelpSystemVolumeReduce = FALSE;
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 256); m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 256);
} }