Start doccing help system

This commit is contained in:
PikalaxALT
2020-01-28 16:05:15 -05:00
parent 65690ca7dc
commit 517f8fc9ef
8 changed files with 284 additions and 285 deletions
+2 -2
View File
@@ -1270,7 +1270,7 @@ _0800FBF8:
_0800FC00: .4byte gTrainers _0800FC00: .4byte gTrainers
_0800FC04: .4byte gTrainerBattleOpponent_A _0800FC04: .4byte gTrainerBattleOpponent_A
_0800FC08: _0800FC08:
bl sav1_map_get_battletype bl GetCurrentMapBattleScene
lsls r0, 24 lsls r0, 24
cmp r0, 0 cmp r0, 0
bne _0800FC20 bne _0800FC20
@@ -1341,7 +1341,7 @@ _0800FC88:
movs r0, 0x13 movs r0, 0x13
b _0800FCAA b _0800FCAA
_0800FC90: _0800FC90:
bl sav1_map_get_battletype bl GetCurrentMapBattleScene
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r0, 0 cmp r0, 0
+22 -22
View File
@@ -2597,7 +2597,7 @@ GetMapMusicFadeoutSpeed: @ 8055F68
push {lr} push {lr}
bl warp1_get_mapheader bl warp1_get_mapheader
ldrb r0, [r0, 0x17] ldrb r0, [r0, 0x17]
bl is_light_level_8_or_9 bl IsMapTypeIndoors
lsls r0, 24 lsls r0, 24
lsrs r0, 24 lsrs r0, 24
cmp r0, 0x1 cmp r0, 0x1
@@ -2981,8 +2981,8 @@ _08056218:
bx r1 bx r1
thumb_func_end Overworld_MapTypeAllowsTeleportAndFly thumb_func_end Overworld_MapTypeAllowsTeleportAndFly
thumb_func_start is_light_level_8_or_9 thumb_func_start IsMapTypeIndoors
is_light_level_8_or_9: @ 805621C IsMapTypeIndoors: @ 805621C
push {lr} push {lr}
lsls r0, 24 lsls r0, 24
movs r1, 0xF8 movs r1, 0xF8
@@ -2998,10 +2998,10 @@ _08056230:
_08056232: _08056232:
pop {r1} pop {r1}
bx r1 bx r1
thumb_func_end is_light_level_8_or_9 thumb_func_end IsMapTypeIndoors
thumb_func_start sav1_saved_warp2_map_get_name thumb_func_start GetSavedWarpRegionMapSectionId
sav1_saved_warp2_map_get_name: @ 8056238 GetSavedWarpRegionMapSectionId: @ 8056238
push {lr} push {lr}
ldr r0, _0805625C @ =gSaveBlock1Ptr ldr r0, _0805625C @ =gSaveBlock1Ptr
ldr r1, [r0] ldr r1, [r0]
@@ -3020,7 +3020,7 @@ sav1_saved_warp2_map_get_name: @ 8056238
bx r1 bx r1
.align 2, 0 .align 2, 0
_0805625C: .4byte gSaveBlock1Ptr _0805625C: .4byte gSaveBlock1Ptr
thumb_func_end sav1_saved_warp2_map_get_name thumb_func_end GetSavedWarpRegionMapSectionId
thumb_func_start GetCurrentRegionMapSectionId thumb_func_start GetCurrentRegionMapSectionId
GetCurrentRegionMapSectionId: @ 8056260 GetCurrentRegionMapSectionId: @ 8056260
@@ -3044,8 +3044,8 @@ GetCurrentRegionMapSectionId: @ 8056260
_08056284: .4byte gSaveBlock1Ptr _08056284: .4byte gSaveBlock1Ptr
thumb_func_end GetCurrentRegionMapSectionId thumb_func_end GetCurrentRegionMapSectionId
thumb_func_start sav1_map_get_battletype thumb_func_start GetCurrentMapBattleScene
sav1_map_get_battletype: @ 8056288 GetCurrentMapBattleScene: @ 8056288
push {lr} push {lr}
ldr r0, _080562AC @ =gSaveBlock1Ptr ldr r0, _080562AC @ =gSaveBlock1Ptr
ldr r1, [r0] ldr r1, [r0]
@@ -3064,10 +3064,10 @@ sav1_map_get_battletype: @ 8056288
bx r1 bx r1
.align 2, 0 .align 2, 0
_080562AC: .4byte gSaveBlock1Ptr _080562AC: .4byte gSaveBlock1Ptr
thumb_func_end sav1_map_get_battletype thumb_func_end GetCurrentMapBattleScene
thumb_func_start sub_80562B0 thumb_func_start InitOverworldBgs
sub_80562B0: @ 80562B0 InitOverworldBgs: @ 80562B0
push {r4-r6,lr} push {r4-r6,lr}
mov r6, r8 mov r6, r8
push {r6} push {r6}
@@ -3130,7 +3130,7 @@ _08056344: .4byte gUnknown_826D320
_08056348: .4byte gUnknown_3005018 _08056348: .4byte gUnknown_3005018
_0805634C: .4byte gUnknown_3005014 _0805634C: .4byte gUnknown_3005014
_08056350: .4byte gUnknown_300501C _08056350: .4byte gUnknown_300501C
thumb_func_end sub_80562B0 thumb_func_end InitOverworldBgs
thumb_func_start sub_8056354 thumb_func_start sub_8056354
sub_8056354: @ 8056354 sub_8056354: @ 8056354
@@ -3641,7 +3641,7 @@ _080567A8: .4byte c2_80567AC
c2_80567AC: @ 80567AC c2_80567AC: @ 80567AC
push {lr} push {lr}
ldr r0, _080567D0 @ =gMain + 0x438 ldr r0, _080567D0 @ =gMain + 0x438
bl sub_8056A5C bl map_loading_iteration_3
cmp r0, 0 cmp r0, 0
beq _080567CC beq _080567CC
bl SetFieldVBlankCallback bl SetFieldVBlankCallback
@@ -3962,8 +3962,8 @@ _08056A52:
_08056A58: .4byte gFlashEffectParams _08056A58: .4byte gFlashEffectParams
thumb_func_end InitCurrentFlashLevelScanlineEffect thumb_func_end InitCurrentFlashLevelScanlineEffect
thumb_func_start sub_8056A5C thumb_func_start map_loading_iteration_3
sub_8056A5C: @ 8056A5C map_loading_iteration_3: @ 8056A5C
push {r4,lr} push {r4,lr}
adds r4, r0, 0 adds r4, r0, 0
ldrb r0, [r4] ldrb r0, [r4]
@@ -3995,7 +3995,7 @@ _08056A78:
.4byte _08056B58 .4byte _08056B58
.4byte _08056B6A .4byte _08056B6A
_08056AB0: _08056AB0:
bl sub_80562B0 bl InitOverworldBgs
bl ScriptContext1_Init bl ScriptContext1_Init
bl ScriptContext2_Disable bl ScriptContext2_Disable
b _08056B62 b _08056B62
@@ -4084,7 +4084,7 @@ _08056B70:
pop {r4} pop {r4}
pop {r1} pop {r1}
bx r1 bx r1
thumb_func_end sub_8056A5C thumb_func_end map_loading_iteration_3
thumb_func_start sub_8056B78 thumb_func_start sub_8056B78
sub_8056B78: @ 8056B78 sub_8056B78: @ 8056B78
@@ -4121,7 +4121,7 @@ _08056B94:
.4byte _08056CC0 .4byte _08056CC0
.4byte _08056BFA .4byte _08056BFA
_08056BD0: _08056BD0:
bl sub_80562B0 bl InitOverworldBgs
bl sub_80569BC bl sub_80569BC
adds r0, r5, 0 adds r0, r5, 0
bl sub_8055920 bl sub_8055920
@@ -4266,7 +4266,7 @@ _08056CF0:
.4byte _08056D26 .4byte _08056D26
.4byte _08056D38 .4byte _08056D38
_08056D04: _08056D04:
bl sub_80562B0 bl InitOverworldBgs
bl sub_8111F14 bl sub_8111F14
movs r0, 0 movs r0, 0
bl sub_8057024 bl sub_8057024
@@ -4331,7 +4331,7 @@ _08056D60:
.4byte _08056E34 .4byte _08056E34
.4byte _08056E46 .4byte _08056E46
_08056D98: _08056D98:
bl sub_80562B0 bl InitOverworldBgs
bl sub_80569BC bl sub_80569BC
b _08056E3E b _08056E3E
_08056DA2: _08056DA2:
@@ -5019,7 +5019,7 @@ _08057330:
.4byte _08057404 .4byte _08057404
.4byte _0805740A .4byte _0805740A
_0805735C: _0805735C:
bl sub_80562B0 bl InitOverworldBgs
bl sub_80569BC bl sub_80569BC
bl sub_8111F14 bl sub_8111F14
bl sub_81113E4 bl sub_81113E4
+1 -1
View File
@@ -1,2 +1,2 @@
gUnknown_3005E9C sHelpSystemState
gSomeVariableBackup gSomeVariableBackup
+17 -17
View File
@@ -17,16 +17,16 @@ struct HelpSystemListMenu_sub
struct HelpSystemListMenu struct HelpSystemListMenu
{ {
struct HelpSystemListMenu_sub sub; struct HelpSystemListMenu_sub sub;
u8 field_0C; u8 itemsAbove;
u8 field_0D; u8 cursorPos;
u8 field_0E; u8 state;
u8 filler_10[0xC]; u8 filler_10[0xC];
}; };
extern struct HelpSystemListMenu gHelpSystemListMenu; extern struct HelpSystemListMenu gHelpSystemListMenu;
extern struct ListMenuItem gHelpSystemListMenuItems[]; extern struct ListMenuItem gHelpSystemListMenuItems[];
extern bool8 gHelpSystemEnabled; extern bool8 gHelpSystemEnabled;
extern u8 gUnknown_203F175; extern bool8 gHelpSystemToggleWithRButtonDisabled;
// help_system_812B1E0 // help_system_812B1E0
void HelpSystem_SetSomeVariable(u8); void HelpSystem_SetSomeVariable(u8);
@@ -35,19 +35,19 @@ bool8 sub_812B40C(void);
bool8 sub_812B45C(void); bool8 sub_812B45C(void);
void HelpSystem_Disable(void); void HelpSystem_Disable(void);
void HelpSystem_Enable(void); void HelpSystem_Enable(void);
void sub_812B4B8(void); void HelpSystem_EnableToggleWithRButton(void);
bool8 sub_812BB9C(struct HelpSystemListMenu * a0, struct ListMenuItem * a1); bool8 RunHelpMenuSubroutine(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer);
bool8 sub_812BC54(struct HelpSystemListMenu * a0, struct ListMenuItem * a1); bool8 HelpSystemSubroutine_PrintWelcomeMessage(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer);
bool8 sub_812BC80(struct HelpSystemListMenu * a0, struct ListMenuItem * a1); bool8 HelpSystemSubroutine_WelcomeWaitButton(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer);
bool8 sub_812BCA8(struct HelpSystemListMenu * a0, struct ListMenuItem * a1); bool8 HelpSystemSubroutine_WelcomeEndGotoMenu(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer);
bool8 sub_812BCD0(struct HelpSystemListMenu * a0, struct ListMenuItem * a1); bool8 HelpSystemSubroutine_MenuInputHandlerMain(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer);
bool8 sub_812BD2C(struct HelpSystemListMenu * a0, struct ListMenuItem * a1); bool8 HelpMenuSubroutine_InitSubmenu(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer);
bool8 sub_812BD64(struct HelpSystemListMenu * a0, struct ListMenuItem * a1); bool8 HelpMenuSubroutine_ReturnFromSubmenu(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer);
bool8 sub_812BD98(struct HelpSystemListMenu * a0, struct ListMenuItem * a1); bool8 HelpMenuSubroutine_SubmenuInputHandler(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer);
void sub_812BDEC(void); void sub_812BDEC(void);
bool8 sub_812BE10(struct HelpSystemListMenu * a0, struct ListMenuItem * a1); bool8 HelpMenuSubroutine_HelpItemPrint(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer);
bool8 sub_812BEEC(struct HelpSystemListMenu * a0, struct ListMenuItem * a1); bool8 HelpMenuSubroutine_ReturnFromHelpItem(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer);
bool8 sub_812BF18(struct HelpSystemListMenu * a0, struct ListMenuItem * a1); bool8 HelpMenuSubroutine_HelpItemWaitButton(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer);
bool8 sub_812BF88(void); bool8 sub_812BF88(void);
// help_system // help_system
@@ -92,6 +92,6 @@ bool8 MoveCursor(u8 by, u8 dirn);
void HelpSystem_BackupSomeVariable(void); void HelpSystem_BackupSomeVariable(void);
void HelpSystem_RestoreSomeVariable(void); void HelpSystem_RestoreSomeVariable(void);
void HelpSystemRenderText(u8 font, u8 * dest, const u8 * src, u8 x, u8 y, u8 width, u8 height); void HelpSystemRenderText(u8 font, u8 * dest, const u8 * src, u8 x, u8 y, u8 width, u8 height);
void sub_812B4AC(void); void HelpSystem_DisableToggleWithRButton(void);
#endif //GUARD_HELP_SYSTEM_H #endif //GUARD_HELP_SYSTEM_H
+1 -1
View File
@@ -147,7 +147,7 @@ void Overworld_ResetStateAfterTeleport(void);
void Overworld_FadeOutMapMusic(void); void Overworld_FadeOutMapMusic(void);
void CB2_LoadMap(void); void CB2_LoadMap(void);
bool8 BGMusicStopped(void); bool8 BGMusicStopped(void);
bool8 is_light_level_8_or_9(u8 mapType); bool8 IsMapTypeIndoors(u8 mapType);
bool32 sub_8055C9C(void); bool32 sub_8055C9C(void);
void Overworld_ResetStateAfterDigEscRope(void); void Overworld_ResetStateAfterDigEscRope(void);
bool32 sub_8058244(void); bool32 sub_8058244(void);
+30 -30
View File
@@ -33,7 +33,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 gUnknown_203F174 = 0;
EWRAM_DATA u8 gUnknown_203F175 = 0; 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;
static EWRAM_DATA struct HelpSystemVideoState sVideoState = {0}; static EWRAM_DATA struct HelpSystemVideoState sVideoState = {0};
@@ -53,7 +53,7 @@ u8 RunHelpSystemCallback(void)
sInHelpSystem = 0; sInHelpSystem = 0;
if (gSaveBlock2Ptr->optionsButtonMode != OPTIONS_BUTTON_MODE_HELP) if (gSaveBlock2Ptr->optionsButtonMode != OPTIONS_BUTTON_MODE_HELP)
return 0; return 0;
if (JOY_NEW(R_BUTTON) && gUnknown_203F175 == 1) if (JOY_NEW(R_BUTTON) && gHelpSystemToggleWithRButtonDisabled == TRUE)
return 0; return 0;
if (JOY_NEW(L_BUTTON | R_BUTTON)) if (JOY_NEW(L_BUTTON | R_BUTTON))
{ {
@@ -93,9 +93,9 @@ u8 RunHelpSystemCallback(void)
HelpSystem_PrintText_Row61(gString_Help); HelpSystem_PrintText_Row61(gString_Help);
sub_813BD14(1); sub_813BD14(1);
if (sub_812B40C() == TRUE) if (sub_812B40C() == TRUE)
sub_812BC54(&gHelpSystemListMenu, gHelpSystemListMenuItems); HelpSystemSubroutine_PrintWelcomeMessage(&gHelpSystemListMenu, gHelpSystemListMenuItems);
else else
sub_812BCA8(&gHelpSystemListMenu, gHelpSystemListMenuItems); HelpSystemSubroutine_WelcomeEndGotoMenu(&gHelpSystemListMenu, gHelpSystemListMenuItems);
sub_813BE78(1); sub_813BE78(1);
sub_813BF50(1); sub_813BF50(1);
CommitTilemap(); CommitTilemap();
@@ -110,7 +110,7 @@ u8 RunHelpSystemCallback(void)
sVideoState.state = 5; sVideoState.state = 5;
break; break;
case 5: case 5:
if (!sub_812BB9C(&gHelpSystemListMenu, gHelpSystemListMenuItems)) if (!RunHelpMenuSubroutine(&gHelpSystemListMenu, gHelpSystemListMenuItems))
{ {
PlaySE(SE_HELP_CL); PlaySE(SE_HELP_CL);
sVideoState.state = 6; sVideoState.state = 6;
@@ -981,9 +981,9 @@ void HelpSystem_FillPanel1(void)
void HelpSystem_InitListMenuController(struct HelpSystemListMenu * a0, u8 a1, u8 a2) void HelpSystem_InitListMenuController(struct HelpSystemListMenu * a0, u8 a1, u8 a2)
{ {
gHelpSystemListMenu.sub = a0->sub; gHelpSystemListMenu.sub = a0->sub;
gHelpSystemListMenu.field_0C = a1; gHelpSystemListMenu.itemsAbove = a1;
gHelpSystemListMenu.field_0D = a2; gHelpSystemListMenu.cursorPos = a2;
gHelpSystemListMenu.field_0E = 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); sub_813BDA4(0);
@@ -1007,7 +1007,7 @@ s32 HelpSystem_GetMenuInput(void)
else if (JOY_NEW(A_BUTTON)) else if (JOY_NEW(A_BUTTON))
{ {
PlaySE(SE_SELECT); PlaySE(SE_SELECT);
return gHelpSystemListMenu.sub.items[gHelpSystemListMenu.field_0C + gHelpSystemListMenu.field_0D].index; return gHelpSystemListMenu.sub.items[gHelpSystemListMenu.itemsAbove + gHelpSystemListMenu.cursorPos].index;
} }
else if (JOY_NEW(B_BUTTON)) else if (JOY_NEW(B_BUTTON))
{ {
@@ -1051,15 +1051,15 @@ void sub_813C75C(void)
u8 r6 = gHelpSystemListMenu.sub.totalItems - 7; u8 r6 = gHelpSystemListMenu.sub.totalItems - 7;
if (gHelpSystemListMenu.sub.totalItems > 7) if (gHelpSystemListMenu.sub.totalItems > 7)
{ {
s32 r4 = gHelpSystemListMenu.field_0C + gHelpSystemListMenu.field_0D; s32 r4 = gHelpSystemListMenu.itemsAbove + gHelpSystemListMenu.cursorPos;
sub_813C004(0, 0); sub_813C004(0, 0);
if (r4 == 0) if (r4 == 0)
sub_813C004(1, 1); sub_813C004(1, 1);
else if (gHelpSystemListMenu.field_0C == 0 && gHelpSystemListMenu.field_0D != 0) else if (gHelpSystemListMenu.itemsAbove == 0 && gHelpSystemListMenu.cursorPos != 0)
sub_813C004(1, 1); sub_813C004(1, 1);
else if (gHelpSystemListMenu.field_0C == r6) else if (gHelpSystemListMenu.itemsAbove == r6)
sub_813C004(0, 1); sub_813C004(0, 1);
else if (gHelpSystemListMenu.field_0C != 0) else if (gHelpSystemListMenu.itemsAbove != 0)
{ {
sub_813C004(0, 1); sub_813C004(0, 1);
sub_813C004(1, 1); sub_813C004(1, 1);
@@ -1071,7 +1071,7 @@ void PrintListMenuItems(void)
{ {
u8 glyphHeight = GetFontAttribute(2, 1) + 1; u8 glyphHeight = GetFontAttribute(2, 1) + 1;
s32 i; s32 i;
s32 r5 = gHelpSystemListMenu.field_0C; s32 r5 = gHelpSystemListMenu.itemsAbove;
for (i = 0; i < gHelpSystemListMenu.sub.maxShowed; i++) for (i = 0; i < gHelpSystemListMenu.sub.maxShowed; i++)
{ {
@@ -1086,7 +1086,7 @@ void PlaceListMenuCursor(void)
{ {
u8 glyphHeight = GetFontAttribute(2, 1) + 1; u8 glyphHeight = GetFontAttribute(2, 1) + 1;
u8 x = gHelpSystemListMenu.sub.left; u8 x = gHelpSystemListMenu.sub.left;
u8 y = gHelpSystemListMenu.sub.top + glyphHeight * gHelpSystemListMenu.field_0D; u8 y = gHelpSystemListMenu.sub.top + glyphHeight * gHelpSystemListMenu.cursorPos;
HelpSystem_PrintTextAt(gFameCheckerText_ListMenuCursor, x, y); HelpSystem_PrintTextAt(gFameCheckerText_ListMenuCursor, x, y);
} }
@@ -1107,24 +1107,24 @@ u8 TryMoveCursor1(u8 dirn)
r4 = 0; r4 = 0;
else else
r4 = gHelpSystemListMenu.sub.maxShowed - (gHelpSystemListMenu.sub.maxShowed / 2 + (gHelpSystemListMenu.sub.maxShowed & 1)) - 1; r4 = gHelpSystemListMenu.sub.maxShowed - (gHelpSystemListMenu.sub.maxShowed / 2 + (gHelpSystemListMenu.sub.maxShowed & 1)) - 1;
if (gHelpSystemListMenu.field_0C == 0) if (gHelpSystemListMenu.itemsAbove == 0)
{ {
if (gHelpSystemListMenu.field_0D != 0) if (gHelpSystemListMenu.cursorPos != 0)
{ {
gHelpSystemListMenu.field_0D--; gHelpSystemListMenu.cursorPos--;
return 1; return 1;
} }
else else
return 0; return 0;
} }
if (gHelpSystemListMenu.field_0D > r4) if (gHelpSystemListMenu.cursorPos > r4)
{ {
gHelpSystemListMenu.field_0D--; gHelpSystemListMenu.cursorPos--;
return 1; return 1;
} }
else else
{ {
gHelpSystemListMenu.field_0C--; gHelpSystemListMenu.itemsAbove--;
return 2; return 2;
} }
} }
@@ -1134,24 +1134,24 @@ u8 TryMoveCursor1(u8 dirn)
r4 = 0; r4 = 0;
else else
r4 = gHelpSystemListMenu.sub.maxShowed / 2 + (gHelpSystemListMenu.sub.maxShowed & 1); r4 = gHelpSystemListMenu.sub.maxShowed / 2 + (gHelpSystemListMenu.sub.maxShowed & 1);
if (gHelpSystemListMenu.field_0C == gHelpSystemListMenu.sub.totalItems - gHelpSystemListMenu.sub.maxShowed) if (gHelpSystemListMenu.itemsAbove == gHelpSystemListMenu.sub.totalItems - gHelpSystemListMenu.sub.maxShowed)
{ {
if (gHelpSystemListMenu.field_0D < gHelpSystemListMenu.sub.maxShowed - 1) if (gHelpSystemListMenu.cursorPos < gHelpSystemListMenu.sub.maxShowed - 1)
{ {
gHelpSystemListMenu.field_0D++; gHelpSystemListMenu.cursorPos++;
return 1; return 1;
} }
else else
return 0; return 0;
} }
else if (gHelpSystemListMenu.field_0D < r4) else if (gHelpSystemListMenu.cursorPos < r4)
{ {
gHelpSystemListMenu.field_0D++; gHelpSystemListMenu.cursorPos++;
return 1; return 1;
} }
else else
{ {
gHelpSystemListMenu.field_0C++; gHelpSystemListMenu.itemsAbove++;
return 2; return 2;
} }
} }
@@ -1159,7 +1159,7 @@ u8 TryMoveCursor1(u8 dirn)
bool8 MoveCursor(u8 by, u8 dirn) bool8 MoveCursor(u8 by, u8 dirn)
{ {
u8 r7 = gHelpSystemListMenu.field_0D; u8 r7 = gHelpSystemListMenu.cursorPos;
u8 flags = 0; u8 flags = 0;
s32 i; s32 i;
for (i = 0; i < by; i++) for (i = 0; i < by; i++)
@@ -1172,14 +1172,14 @@ bool8 MoveCursor(u8 by, u8 dirn)
// neither changed // neither changed
return TRUE; return TRUE;
case 1: case 1:
// changed field_0D only // changed cursorPos only
sub_813C860(r7); sub_813C860(r7);
PlaceListMenuCursor(); PlaceListMenuCursor();
CommitTilemap(); CommitTilemap();
break; break;
case 2: case 2:
case 3: case 3:
// changed field_0C // changed itemsAbove
if (sub_812BF88() == TRUE) if (sub_812BF88() == TRUE)
{ {
HelpSystem_SetInputDelay(2); HelpSystem_SetInputDelay(2);
+209 -210
View File
@@ -19,22 +19,22 @@
static EWRAM_DATA u16 sSomeVariable = 0; static EWRAM_DATA u16 sSomeVariable = 0;
static EWRAM_DATA u8 gUnknown_203B0EE = 0; static EWRAM_DATA u8 gUnknown_203B0EE = 0;
u8 gUnknown_3005E9C[4]; u8 sHelpSystemState[4];
u16 gSomeVariableBackup; u16 gSomeVariableBackup;
static bool32 IsCurrentMapInArray(const u16 * mapIdxs); static bool32 IsCurrentMapInArray(const u16 * mapIdxs);
static void sub_812B520(struct HelpSystemListMenu * a0, struct ListMenuItem * a1); static void BuildMainTopicsListAndMoveToH00(struct HelpSystemListMenu * a0, struct ListMenuItem * a1);
static void sub_812B614(struct HelpSystemListMenu * a0, struct ListMenuItem * a1); static void SetHelpSystemSubmenuItems(struct HelpSystemListMenu * a0, struct ListMenuItem * a1);
static bool8 sub_812B754(void); static bool8 HelpSystem_HasDefeatedBrock(void);
static bool8 sub_812B780(u8); static bool8 HelpSystemSubmenuIndexIsActive(u8);
static bool8 sub_812BB10(void); static bool8 HasGottenAtLeastOneHM(void);
static void sub_812BF5C(void); static void PrintWelcomeMessageOnPanel1(void);
static void sub_812BF74(const u8 *); static void PrintTextOnPanel2Row52RightAlign(const u8 *);
static void sub_812BF94(struct HelpSystemListMenu * a0); static void ResetHelpSystemCursor(struct HelpSystemListMenu * a0);
static void sub_812BF9C(struct HelpSystemListMenu * a0, struct ListMenuItem * a1); static void PrintHelpSystemTopicMouseoverDescription(struct HelpSystemListMenu * a0, struct ListMenuItem * a1);
static const u8 *const gUnknown_845B080[] = { static const u8 *const sHelpSystemTopicPtrs[] = {
gUnknown_81B2DF8, gUnknown_81B2DF8,
gUnknown_81B2E1C, gUnknown_81B2E1C,
gUnknown_81B2E2E, gUnknown_81B2E2E,
@@ -43,7 +43,7 @@ static const u8 *const gUnknown_845B080[] = {
gUnknown_81B2E6A gUnknown_81B2E6A
}; };
static const u8 *const gUnknown_845B098[] = { static const u8 *const sHelpSystemTopicMouseoverDescriptionPtrs[] = {
gUnknown_81B2E88, gUnknown_81B2E88,
gUnknown_81B2EC8, gUnknown_81B2EC8,
gUnknown_81B2F00, gUnknown_81B2F00,
@@ -52,7 +52,7 @@ static const u8 *const gUnknown_845B098[] = {
gUnknown_81B2FA9 gUnknown_81B2FA9
}; };
static const u8 *const gUnknown_845B0B0[] = { static const u8 *const sHelpSystemSpecializedQuestionTextPtrs[] = {
NULL, NULL,
gUnknown_81B3083, gUnknown_81B3083,
gUnknown_81B30A9, gUnknown_81B30A9,
@@ -100,7 +100,7 @@ static const u8 *const gUnknown_845B0B0[] = {
gUnknown_81B3516 gUnknown_81B3516
}; };
static const u8 *const gUnknown_845B164[] = { static const u8 *const sHelpSystemSpecializedAnswerTextPtrs[] = {
NULL, NULL,
gUnknown_81B3525, gUnknown_81B3525,
gUnknown_81B35E6, gUnknown_81B35E6,
@@ -148,7 +148,7 @@ static const u8 *const gUnknown_845B164[] = {
gUnknown_81B55F4 gUnknown_81B55F4
}; };
static const u8 *const gUnknown_845B218[] = { static const u8 *const sHelpSystemMenuTopicTextPtrs[] = {
NULL, NULL,
gUnknown_81B56E3, gUnknown_81B56E3,
gUnknown_81B56F4, gUnknown_81B56F4,
@@ -200,7 +200,7 @@ static const u8 *const gUnknown_845B218[] = {
gUnknown_81B5A37 gUnknown_81B5A37
}; };
static const u8 *const gUnknown_845B2DC[] = { static const u8 *const sHelpSystemSpecializedControlsTextPtrs[] = {
NULL, NULL,
gUnknown_81B5A4D, gUnknown_81B5A4D,
gUnknown_81B5B0C, gUnknown_81B5B0C,
@@ -252,7 +252,7 @@ static const u8 *const gUnknown_845B2DC[] = {
gUnknown_81B7C57 gUnknown_81B7C57
}; };
static const u8 *const gUnknown_845B3A0[] = { static const u8 *const sHelpSystemSpecializedStringsTextPtrs[] = {
NULL, NULL,
gUnknown_81B7CC1, gUnknown_81B7CC1,
gUnknown_81B7CC4, gUnknown_81B7CC4,
@@ -299,7 +299,7 @@ static const u8 *const gUnknown_845B3A0[] = {
gUnknown_81B7E0F gUnknown_81B7E0F
}; };
static const u8 *const gUnknown_845B450[] = { static const u8 *const sHelpSystemSpecializedStringDefinitionsTextPtrs[] = {
NULL, NULL,
gUnknown_81B7E16, gUnknown_81B7E16,
gUnknown_81B7F0A, gUnknown_81B7F0A,
@@ -346,7 +346,7 @@ static const u8 *const gUnknown_845B450[] = {
gUnknown_81B9B2F gUnknown_81B9B2F
}; };
static const u8 *const gUnknown_845B500[] = { static const u8 *const sHelpSystemGeneralTopicTextPtrs[] = {
NULL, NULL,
gUnknown_81B9BB7, gUnknown_81B9BB7,
gUnknown_81B9BC7, gUnknown_81B9BC7,
@@ -357,7 +357,7 @@ static const u8 *const gUnknown_845B500[] = {
gUnknown_81B9C1D gUnknown_81B9C1D
}; };
static const u8 *const gUnknown_845B520[] = { static const u8 *const sHelpSystemGeneralTopicDescriptionTextPtrs[] = {
NULL, NULL,
gUnknown_81B9C2F, gUnknown_81B9C2F,
gUnknown_81B9D04, gUnknown_81B9D04,
@@ -368,7 +368,7 @@ static const u8 *const gUnknown_845B520[] = {
gUnknown_81BA027 gUnknown_81BA027
}; };
static const u8 *const gUnknown_845B540[] = { static const u8 *const sHelpSystemTypeMatchupTextPtrs[] = {
NULL, NULL,
gUnknown_81BA0F1, gUnknown_81BA0F1,
gUnknown_81BA10D, gUnknown_81BA10D,
@@ -407,7 +407,7 @@ static const u8 *const gUnknown_845B540[] = {
gUnknown_81BA400 gUnknown_81BA400
}; };
static const u8 *const gUnknown_845B5D0[] = { static const u8 *const sHelpSystemTypeMatchupDescriptionTextPtrs[] = {
NULL, NULL,
gUnknown_81BA416, gUnknown_81BA416,
gUnknown_81BA4E6, gUnknown_81BA4E6,
@@ -446,7 +446,6 @@ static const u8 *const gUnknown_845B5D0[] = {
gUnknown_81BB156 gUnknown_81BB156
}; };
static const u8 gUnknown_845B660[] = { static const u8 gUnknown_845B660[] = {
0x01, 0x02, 0x03, 0xff 0x01, 0x02, 0x03, 0xff
}; };
@@ -739,7 +738,7 @@ static const u8 gUnknown_845B9BE[] = {
0x09, 0x01, 0x02, 0x03, 0x23, 0x25, 0x24, 0x04, 0x05, 0x06, 0x07, 0x08, 0x0a, 0x0b, 0x0c, 0x0d, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x27, 0x15, 0x26, 0x16, 0x17, 0x18, 0x1a, 0x0e, 0x1b, 0xff 0x09, 0x01, 0x02, 0x03, 0x23, 0x25, 0x24, 0x04, 0x05, 0x06, 0x07, 0x08, 0x0a, 0x0b, 0x0c, 0x0d, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x27, 0x15, 0x26, 0x16, 0x17, 0x18, 0x1a, 0x0e, 0x1b, 0xff
}; };
static const u8 *const gUnknown_845B9E0[] = { static const u8 *const sHelpSystemSubmenuIndexPointers[] = {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, gUnknown_845B660, NULL, NULL, NULL, NULL, gUnknown_845B660, NULL,
NULL, NULL, NULL, gUnknown_845B664, NULL, NULL, NULL, NULL, gUnknown_845B664, NULL,
@@ -780,48 +779,48 @@ static const u8 *const gUnknown_845B9E0[] = {
static const u16 unref_845BCB0[] = INCBIN_U16("graphics/help_system/unk_845BCB0.bin"); static const u16 unref_845BCB0[] = INCBIN_U16("graphics/help_system/unk_845BCB0.bin");
static const u8 gUnknown_845C4B0[] = { static const u8 sHelpSystemContextTopicOrder[] = {
3, 0, 1, 2, 4, 5 3, 0, 1, 2, 4, 5
}; };
static const u8 gUnknown_845C4B6[][6] = { static const bool8 sHelpSystemContextTopicFlags[][6] = {
{0, 0, 0, 0, 0, 1}, {FALSE, FALSE, FALSE, FALSE, FALSE, TRUE },
{0, 0, 0, 1, 0, 1}, {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE },
{0, 0, 0, 1, 0, 1}, {FALSE, FALSE, FALSE, TRUE, FALSE, TRUE },
{0, 1, 0, 1, 0, 1}, {FALSE, TRUE, FALSE, TRUE, FALSE, TRUE },
{0, 1, 0, 0, 0, 1}, {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE },
{0, 1, 1, 0, 0, 1}, {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE },
{0, 1, 1, 0, 0, 1}, {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE },
{0, 0, 1, 0, 0, 1}, {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE },
{0, 0, 1, 0, 0, 1}, {FALSE, FALSE, TRUE, FALSE, FALSE, TRUE },
{0, 1, 1, 0, 0, 1}, {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE },
{0, 1, 1, 0, 0, 1}, {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE },
{0, 1, 0, 0, 0, 1}, {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE },
{0, 1, 1, 0, 0, 1}, {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE },
{0, 1, 1, 0, 0, 1}, {FALSE, TRUE, TRUE, FALSE, FALSE, TRUE },
{1, 0, 0, 1, 0, 1}, {TRUE, FALSE, FALSE, TRUE, FALSE, TRUE },
{1, 1, 1, 0, 0, 1}, {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE },
{1, 1, 1, 1, 0, 1}, {TRUE, TRUE, TRUE, TRUE, FALSE, TRUE },
{1, 1, 1, 0, 0, 1}, {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE },
{1, 1, 1, 0, 1, 1}, {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE },
{1, 1, 1, 0, 0, 1}, {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE },
{1, 1, 1, 0, 0, 1}, {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE },
{1, 1, 1, 0, 0, 1}, {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE },
{1, 1, 1, 0, 0, 1}, {TRUE, TRUE, TRUE, FALSE, FALSE, TRUE },
{1, 1, 1, 0, 1, 1}, {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE },
{1, 1, 1, 0, 1, 1}, {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE },
{1, 1, 1, 0, 1, 1}, {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE },
{1, 1, 1, 0, 1, 1}, {TRUE, TRUE, TRUE, FALSE, TRUE, TRUE },
{0, 1, 0, 0, 0, 1}, {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE },
{0, 1, 0, 0, 0, 1}, {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE },
{0, 1, 0, 0, 0, 1}, {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE },
{0, 1, 0, 0, 0, 1}, {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE },
{0, 1, 0, 0, 0, 1}, {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE },
{0, 1, 0, 0, 0, 1}, {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE },
{0, 1, 0, 0, 0, 1}, {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE },
{0, 1, 0, 0, 0, 1}, {FALSE, TRUE, FALSE, FALSE, FALSE, TRUE },
{0, 0, 0, 0, 0, 0}, {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
{0, 0, 0, 0, 0, 0} {FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}
}; };
static const u16 sMartMaps[] = { static const u16 sMartMaps[] = {
@@ -961,12 +960,12 @@ static bool8 IsInDungeonMap(void)
void sub_812B35C(void) void sub_812B35C(void)
{ {
sub_812B4B8(); HelpSystem_EnableToggleWithRButton();
if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING)) if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING))
HelpSystem_SetSomeVariable2(0x16); HelpSystem_SetSomeVariable2(0x16);
else if (IsInDungeonMap()) else if (IsInDungeonMap())
HelpSystem_SetSomeVariable2(0x15); HelpSystem_SetSomeVariable2(0x15);
else if (is_light_level_8_or_9(gMapHeader.mapType)) else if (IsMapTypeIndoors(gMapHeader.mapType))
{ {
if ((gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(PALLET_TOWN_PLAYERS_HOUSE_1F) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(PALLET_TOWN_PLAYERS_HOUSE_1F)) || (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(PALLET_TOWN_PLAYERS_HOUSE_2F) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(PALLET_TOWN_PLAYERS_HOUSE_2F))) if ((gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(PALLET_TOWN_PLAYERS_HOUSE_1F) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(PALLET_TOWN_PLAYERS_HOUSE_1F)) || (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(PALLET_TOWN_PLAYERS_HOUSE_2F) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(PALLET_TOWN_PLAYERS_HOUSE_2F)))
HelpSystem_SetSomeVariable2(0x0E); HelpSystem_SetSomeVariable2(0x0E);
@@ -1015,126 +1014,126 @@ void HelpSystem_Enable(void)
if (gQuestLogState != 2 && gQuestLogState != 3) if (gQuestLogState != 2 && gQuestLogState != 3)
{ {
gHelpSystemEnabled = TRUE; gHelpSystemEnabled = TRUE;
sub_812B4B8(); HelpSystem_EnableToggleWithRButton();
} }
} }
void sub_812B4AC(void) void HelpSystem_DisableToggleWithRButton(void)
{ {
gUnknown_203F175 = 1; gHelpSystemToggleWithRButtonDisabled = TRUE;
} }
void sub_812B4B8(void) void HelpSystem_EnableToggleWithRButton(void)
{ {
gUnknown_203F175 = 0; gHelpSystemToggleWithRButtonDisabled = FALSE;
} }
static void sub_812B4C4(struct HelpSystemListMenu * a0, struct ListMenuItem * a1) static void ResetHelpSystemListMenu(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
a0->sub.items = a1; helpListMenu->sub.items = listMenuItemsBuffer;
a0->sub.totalItems = 1; helpListMenu->sub.totalItems = 1;
a0->sub.maxShowed = 1; helpListMenu->sub.maxShowed = 1;
a0->sub.left = 1; helpListMenu->sub.left = 1;
a0->sub.top = 4; helpListMenu->sub.top = 4;
} }
static void sub_812B4D8(struct HelpSystemListMenu * a0, struct ListMenuItem * a1) static void BuildAndPrintMainTopicsListMenu(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
sub_812B4C4(a0, a1); ResetHelpSystemListMenu(helpListMenu, listMenuItemsBuffer);
sub_812B520(a0, a1); BuildMainTopicsListAndMoveToH00(helpListMenu, listMenuItemsBuffer);
sub_812BF74(gUnknown_841DFAC); PrintTextOnPanel2Row52RightAlign(gUnknown_841DFAC);
HelpSystem_InitListMenuController(a0, 0, gUnknown_3005E9C[2]); HelpSystem_InitListMenuController(helpListMenu, 0, sHelpSystemState[2]);
sub_812BF9C(a0, a1); PrintHelpSystemTopicMouseoverDescription(helpListMenu, listMenuItemsBuffer);
sub_813BDA4(1); sub_813BDA4(1);
sub_813BD5C(1); sub_813BD5C(1);
} }
static void sub_812B520(struct HelpSystemListMenu * a0, struct ListMenuItem * a1) static void BuildMainTopicsListAndMoveToH00(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
u8 i; u8 i;
u8 r4 = 0; u8 totalItems = 0;
for (i = 0; i < 6; i++) for (i = 0; i < 6; i++)
{ {
if (gUnknown_845C4B6[sSomeVariable][gUnknown_845C4B0[i]] == 1) if (sHelpSystemContextTopicFlags[sSomeVariable][sHelpSystemContextTopicOrder[i]] == TRUE)
{ {
a1[r4].label = gUnknown_845B080[gUnknown_845C4B0[i]]; listMenuItemsBuffer[totalItems].label = sHelpSystemTopicPtrs[sHelpSystemContextTopicOrder[i]];
a1[r4].index = gUnknown_845C4B0[i]; listMenuItemsBuffer[totalItems].index = sHelpSystemContextTopicOrder[i];
r4++; totalItems++;
} }
} }
a1[r4 - 1].index = -2; listMenuItemsBuffer[totalItems - 1].index = -2;
a0->sub.totalItems = r4; helpListMenu->sub.totalItems = totalItems;
a0->sub.maxShowed = r4; helpListMenu->sub.maxShowed = totalItems;
a0->sub.left = 0; helpListMenu->sub.left = 0;
} }
static void sub_812B5A8(struct HelpSystemListMenu * a0, struct ListMenuItem * a1) static void BuildAndPrintSubmenuList(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
sub_813BDE8(0); sub_813BDE8(0);
sub_813BFC0(0); sub_813BFC0(0);
sub_813BE78(1); sub_813BE78(1);
sub_812B4C4(a0, a1); ResetHelpSystemListMenu(helpListMenu, listMenuItemsBuffer);
sub_812B614(a0, a1); SetHelpSystemSubmenuItems(helpListMenu, listMenuItemsBuffer);
sub_812BF74(gUnknown_841DFC9); PrintTextOnPanel2Row52RightAlign(gUnknown_841DFC9);
HelpSystem_InitListMenuController(a0, a0->field_0C, a0->field_0D); HelpSystem_InitListMenuController(helpListMenu, helpListMenu->itemsAbove, helpListMenu->cursorPos);
HelpSystem_PrintTextAt(gUnknown_845B080[gUnknown_3005E9C[1]], 0, 0); HelpSystem_PrintTextAt(sHelpSystemTopicPtrs[sHelpSystemState[1]], 0, 0);
sub_813BDA4(1); sub_813BDA4(1);
sub_813BD5C(1); sub_813BD5C(1);
} }
static void sub_812B614(struct HelpSystemListMenu * a0, struct ListMenuItem * a1) static void SetHelpSystemSubmenuItems(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
u8 r6 = 0; u8 totalItems = 0;
const u8 * r3 = gUnknown_845B9E0[sSomeVariable * 5 + gUnknown_3005E9C[1]]; const u8 * indexPtr = sHelpSystemSubmenuIndexPointers[sSomeVariable * 5 + sHelpSystemState[1]];
u8 i; u8 i;
for (i = 0; r3[i] != 0xFF; i++) for (i = 0; indexPtr[i] != 0xFF; i++)
{ {
if (sub_812B780(r3[i]) == TRUE) if (HelpSystemSubmenuIndexIsActive(indexPtr[i]) == TRUE)
{ {
if (gUnknown_3005E9C[1] == 0) if (sHelpSystemState[1] == 0)
a1[r6].label = gUnknown_845B0B0[r3[i]]; listMenuItemsBuffer[totalItems].label = sHelpSystemSpecializedQuestionTextPtrs[indexPtr[i]];
else if (gUnknown_3005E9C[1] == 1) else if (sHelpSystemState[1] == 1)
a1[r6].label = gUnknown_845B218[r3[i]]; listMenuItemsBuffer[totalItems].label = sHelpSystemMenuTopicTextPtrs[indexPtr[i]];
else if (gUnknown_3005E9C[1] == 2) else if (sHelpSystemState[1] == 2)
a1[r6].label = gUnknown_845B3A0[r3[i]]; listMenuItemsBuffer[totalItems].label = sHelpSystemSpecializedStringsTextPtrs[indexPtr[i]];
else if (gUnknown_3005E9C[1] == 3) else if (sHelpSystemState[1] == 3)
a1[r6].label = gUnknown_845B500[r3[i]]; listMenuItemsBuffer[totalItems].label = sHelpSystemGeneralTopicTextPtrs[indexPtr[i]];
else else
a1[r6].label = gUnknown_845B540[r3[i]]; listMenuItemsBuffer[totalItems].label = sHelpSystemTypeMatchupTextPtrs[indexPtr[i]];
a1[r6].index = r3[i]; listMenuItemsBuffer[totalItems].index = indexPtr[i];
r6++; totalItems++;
} }
} }
if (sub_812B754() == TRUE) if (HelpSystem_HasDefeatedBrock() == TRUE)
{ {
for (i = 0, r3 = gUnknown_845B9BE; r3[i] != 0xFF; i++) for (i = 0, indexPtr = gUnknown_845B9BE; indexPtr[i] != 0xFF; i++)
{ {
a1[r6].label = gUnknown_845B3A0[r3[i]]; listMenuItemsBuffer[totalItems].label = sHelpSystemSpecializedStringsTextPtrs[indexPtr[i]];
a1[r6].index = r3[i]; listMenuItemsBuffer[totalItems].index = indexPtr[i];
r6++; totalItems++;
} }
} }
a1[r6].label = gUnknown_81B2E6F; listMenuItemsBuffer[totalItems].label = gUnknown_81B2E6F;
a1[r6].index = -2; listMenuItemsBuffer[totalItems].index = -2;
r6++; totalItems++;
a0->sub.totalItems = r6; helpListMenu->sub.totalItems = totalItems;
a0->sub.maxShowed = 7; helpListMenu->sub.maxShowed = 7;
a0->sub.left = 0; helpListMenu->sub.left = 0;
a0->sub.top = 21; helpListMenu->sub.top = 21;
} }
static bool8 sub_812B754(void) static bool8 HelpSystem_HasDefeatedBrock(void)
{ {
if (FlagGet(FLAG_DEFEATED_BROCK) == TRUE && gUnknown_3005E9C[1] == 2) if (FlagGet(FLAG_DEFEATED_BROCK) == TRUE && sHelpSystemState[1] == 2)
return TRUE; return TRUE;
return FALSE; return FALSE;
} }
static bool8 sub_812B780(u8 id) static bool8 HelpSystemSubmenuIndexIsActive(u8 id)
{ {
u8 i = 0; u8 i = 0;
if (gUnknown_3005E9C[1] == 0) if (sHelpSystemState[1] == 0)
{ {
switch (id) switch (id)
{ {
@@ -1188,7 +1187,7 @@ static bool8 sub_812B780(u8 id)
return FlagGet(FLAG_BADGE01_GET); return FlagGet(FLAG_BADGE01_GET);
case 28: case 28:
case 40: case 40:
return sub_812BB10(); return HasGottenAtLeastOneHM();
case 39: case 39:
return FlagGet(FLAG_GOT_FAME_CHECKER); return FlagGet(FLAG_GOT_FAME_CHECKER);
case 44: case 44:
@@ -1196,7 +1195,7 @@ static bool8 sub_812B780(u8 id)
} }
return FALSE; return FALSE;
} }
if (gUnknown_3005E9C[1] == 1) if (sHelpSystemState[1] == 1)
{ {
switch (id) switch (id)
{ {
@@ -1254,7 +1253,7 @@ static bool8 sub_812B780(u8 id)
return FlagGet(FLAG_BADGE01_GET); return FlagGet(FLAG_BADGE01_GET);
case 16: case 16:
case 17: case 17:
return sub_812BB10(); return HasGottenAtLeastOneHM();
case 18: case 18:
return FlagGet(FLAG_GOT_BICYCLE); return FlagGet(FLAG_GOT_BICYCLE);
case 48: case 48:
@@ -1262,9 +1261,9 @@ static bool8 sub_812B780(u8 id)
} }
return FALSE; return FALSE;
} }
if (gUnknown_3005E9C[1] == 2) if (sHelpSystemState[1] == 2)
{ {
if (sub_812B754() == TRUE) if (HelpSystem_HasDefeatedBrock() == TRUE)
{ {
for (i = 0; gUnknown_845B9BE[i] != 0xFF; i++) for (i = 0; gUnknown_845B9BE[i] != 0xFF; i++)
{ {
@@ -1311,7 +1310,7 @@ static bool8 sub_812B780(u8 id)
return FlagGet(FLAG_SYS_POKEMON_GET); return FlagGet(FLAG_SYS_POKEMON_GET);
case 36: case 36:
case 37: case 37:
return sub_812BB10(); return HasGottenAtLeastOneHM();
case 3: case 3:
case 15: case 15:
case 18: case 18:
@@ -1320,7 +1319,7 @@ static bool8 sub_812B780(u8 id)
} }
return TRUE; return TRUE;
} }
if (gUnknown_3005E9C[1] == 3) if (sHelpSystemState[1] == 3)
{ {
switch (id) switch (id)
{ {
@@ -1331,7 +1330,7 @@ static bool8 sub_812B780(u8 id)
} }
return TRUE; return TRUE;
} }
if (gUnknown_3005E9C[1] == 4) if (sHelpSystemState[1] == 4)
{ {
return TRUE; return TRUE;
} }
@@ -1339,7 +1338,7 @@ static bool8 sub_812B780(u8 id)
return FALSE; return FALSE;
} }
static bool8 sub_812BB10(void) static bool8 HasGottenAtLeastOneHM(void)
{ {
if (FlagGet(FLAG_GOT_HM01) == TRUE) if (FlagGet(FLAG_GOT_HM01) == TRUE)
return TRUE; return TRUE;
@@ -1358,64 +1357,64 @@ static bool8 sub_812BB10(void)
return FALSE; return FALSE;
} }
bool8 sub_812BB9C(struct HelpSystemListMenu * a0, struct ListMenuItem * a1) bool8 RunHelpMenuSubroutine(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
switch (a0->field_0E) switch (helpListMenu->state)
{ {
case 8: case 8:
return sub_812BC54(a0, a1); return HelpSystemSubroutine_PrintWelcomeMessage(helpListMenu, listMenuItemsBuffer);
case 9: case 9:
return sub_812BC80(a0, a1); return HelpSystemSubroutine_WelcomeWaitButton(helpListMenu, listMenuItemsBuffer);
case 10: case 10:
return sub_812BCA8(a0, a1); return HelpSystemSubroutine_WelcomeEndGotoMenu(helpListMenu, listMenuItemsBuffer);
case 0: case 0:
return sub_812BCD0(a0, a1); return HelpSystemSubroutine_MenuInputHandlerMain(helpListMenu, listMenuItemsBuffer);
case 1: case 1:
return sub_812BD2C(a0, a1); return HelpMenuSubroutine_InitSubmenu(helpListMenu, listMenuItemsBuffer);
case 2: case 2:
return sub_812BD64(a0, a1); return HelpMenuSubroutine_ReturnFromSubmenu(helpListMenu, listMenuItemsBuffer);
case 3: case 3:
return sub_812BD98(a0, a1); return HelpMenuSubroutine_SubmenuInputHandler(helpListMenu, listMenuItemsBuffer);
case 4: case 4:
return sub_812BE10(a0, a1); return HelpMenuSubroutine_HelpItemPrint(helpListMenu, listMenuItemsBuffer);
case 5: case 5:
return sub_812BEEC(a0, a1); return HelpMenuSubroutine_ReturnFromHelpItem(helpListMenu, listMenuItemsBuffer);
case 6: case 6:
return sub_812BF18(a0, a1); return HelpMenuSubroutine_HelpItemWaitButton(helpListMenu, listMenuItemsBuffer);
} }
return FALSE; return FALSE;
} }
bool8 sub_812BC54(struct HelpSystemListMenu * a0, struct ListMenuItem * a1) bool8 HelpSystemSubroutine_PrintWelcomeMessage(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
sub_812BF74(gUnknown_841DFA5); PrintTextOnPanel2Row52RightAlign(gUnknown_841DFA5);
sub_812BF5C(); PrintWelcomeMessageOnPanel1();
sub_813BDA4(1); sub_813BDA4(1);
sub_813BD5C(1); sub_813BD5C(1);
a0->field_0E = 9; helpListMenu->state = 9;
return TRUE; return TRUE;
} }
bool8 sub_812BC80(struct HelpSystemListMenu * a0, struct ListMenuItem * a1) bool8 HelpSystemSubroutine_WelcomeWaitButton(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
if (JOY_NEW(A_BUTTON)) if (JOY_NEW(A_BUTTON))
{ {
PlaySE(SE_SELECT); PlaySE(SE_SELECT);
a0->field_0E = 10; helpListMenu->state = 10;
} }
return TRUE; return TRUE;
} }
bool8 sub_812BCA8(struct HelpSystemListMenu * a0, struct ListMenuItem * a1) bool8 HelpSystemSubroutine_WelcomeEndGotoMenu(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
gUnknown_3005E9C[2] = 0; sHelpSystemState[2] = 0;
sub_812BF94(a0); ResetHelpSystemCursor(helpListMenu);
sub_812B4D8(a0, a1); BuildAndPrintMainTopicsListMenu(helpListMenu, listMenuItemsBuffer);
a0->field_0E = 0; helpListMenu->state = 0;
return TRUE; return TRUE;
} }
bool8 sub_812BCD0(struct HelpSystemListMenu * a0, struct ListMenuItem * a1) bool8 HelpSystemSubroutine_MenuInputHandlerMain(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
s32 v0 = HelpSystem_GetMenuInput(); s32 v0 = HelpSystem_GetMenuInput();
switch (v0) switch (v0)
@@ -1425,42 +1424,42 @@ bool8 sub_812BCD0(struct HelpSystemListMenu * a0, struct ListMenuItem * a1)
return FALSE; return FALSE;
case -5: case -5:
case -4: case -4:
sub_812BF9C(a0, a1); PrintHelpSystemTopicMouseoverDescription(helpListMenu, listMenuItemsBuffer);
break; break;
case -3: case -3:
case -1: case -1:
break; break;
default: default:
gUnknown_3005E9C[1] = v0; sHelpSystemState[1] = v0;
a0->field_0E = 1; helpListMenu->state = 1;
break; break;
} }
return TRUE; return TRUE;
} }
bool8 sub_812BD2C(struct HelpSystemListMenu * a0, struct ListMenuItem * a1) bool8 HelpMenuSubroutine_InitSubmenu(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
gUnknown_3005E9C[0] = 1; sHelpSystemState[0] = 1;
gUnknown_3005E9C[2] = a0->field_0D; sHelpSystemState[2] = helpListMenu->cursorPos;
sub_812BF94(a0); ResetHelpSystemCursor(helpListMenu);
sub_812B5A8(a0, a1); BuildAndPrintSubmenuList(helpListMenu, listMenuItemsBuffer);
sub_813C75C(); sub_813C75C();
HelpSystem_SetInputDelay(2); HelpSystem_SetInputDelay(2);
a0->field_0E = 3; helpListMenu->state = 3;
return TRUE; return TRUE;
} }
bool8 sub_812BD64(struct HelpSystemListMenu * a0, struct ListMenuItem * a1) bool8 HelpMenuSubroutine_ReturnFromSubmenu(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
sub_813C004(0, 0); sub_813C004(0, 0);
sub_813C004(1, 0); sub_813C004(1, 0);
gUnknown_3005E9C[0] = 0; sHelpSystemState[0] = 0;
sub_812B4D8(a0, a1); BuildAndPrintMainTopicsListMenu(helpListMenu, listMenuItemsBuffer);
a0->field_0E = 0; helpListMenu->state = 0;
return TRUE; return TRUE;
} }
bool8 sub_812BD98(struct HelpSystemListMenu * a0, struct ListMenuItem * a1) bool8 HelpMenuSubroutine_SubmenuInputHandler(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
s32 v0 = HelpSystem_GetMenuInput(); s32 v0 = HelpSystem_GetMenuInput();
switch (v0) switch (v0)
@@ -1468,7 +1467,7 @@ bool8 sub_812BD98(struct HelpSystemListMenu * a0, struct ListMenuItem * a1)
case -6: case -6:
return FALSE; return FALSE;
case -2: case -2:
a0->field_0E = 2; helpListMenu->state = 2;
break; break;
case -5: case -5:
case -4: case -4:
@@ -1476,8 +1475,8 @@ bool8 sub_812BD98(struct HelpSystemListMenu * a0, struct ListMenuItem * a1)
case -1: case -1:
break; break;
default: default:
gUnknown_3005E9C[3] = v0; sHelpSystemState[3] = v0;
a0->field_0E = 4; helpListMenu->state = 4;
break; break;
} }
return TRUE; return TRUE;
@@ -1485,60 +1484,60 @@ bool8 sub_812BD98(struct HelpSystemListMenu * a0, struct ListMenuItem * a1)
void sub_812BDEC(void) void sub_812BDEC(void)
{ {
HelpSystem_PrintTextAt(gUnknown_845B080[gUnknown_3005E9C[1]], 0, 0); HelpSystem_PrintTextAt(sHelpSystemTopicPtrs[sHelpSystemState[1]], 0, 0);
} }
bool8 sub_812BE10(struct HelpSystemListMenu * a0, struct ListMenuItem * a1) bool8 HelpMenuSubroutine_HelpItemPrint(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
gUnknown_3005E9C[0] = 2; sHelpSystemState[0] = 2;
sub_813BDA4(0); sub_813BDA4(0);
HelpSystem_FillPanel1(); HelpSystem_FillPanel1();
sub_812BF74(gUnknown_841DFBE); PrintTextOnPanel2Row52RightAlign(gUnknown_841DFBE);
sub_813BDE8(1); sub_813BDE8(1);
sub_813BEE4(1); sub_813BEE4(1);
if (gUnknown_3005E9C[1] == 0) if (sHelpSystemState[1] == 0)
{ {
HelpSystem_PrintTwoStrings(gUnknown_845B0B0[gUnknown_3005E9C[3]], gUnknown_845B164[gUnknown_3005E9C[3]]); HelpSystem_PrintTwoStrings(sHelpSystemSpecializedQuestionTextPtrs[sHelpSystemState[3]], sHelpSystemSpecializedAnswerTextPtrs[sHelpSystemState[3]]);
} }
else if (gUnknown_3005E9C[1] == 1) else if (sHelpSystemState[1] == 1)
{ {
HelpSystem_PrintTwoStrings(gUnknown_845B218[gUnknown_3005E9C[3]], gUnknown_845B2DC[gUnknown_3005E9C[3]]); HelpSystem_PrintTwoStrings(sHelpSystemMenuTopicTextPtrs[sHelpSystemState[3]], sHelpSystemSpecializedControlsTextPtrs[sHelpSystemState[3]]);
} }
else if (gUnknown_3005E9C[1] == 2) else if (sHelpSystemState[1] == 2)
{ {
HelpSystem_PrintTwoStrings(gUnknown_845B3A0[gUnknown_3005E9C[3]], gUnknown_845B450[gUnknown_3005E9C[3]]); HelpSystem_PrintTwoStrings(sHelpSystemSpecializedStringsTextPtrs[sHelpSystemState[3]], sHelpSystemSpecializedStringDefinitionsTextPtrs[sHelpSystemState[3]]);
} }
else if (gUnknown_3005E9C[1] == 3) else if (sHelpSystemState[1] == 3)
{ {
HelpSystem_PrintTwoStrings(gUnknown_845B500[gUnknown_3005E9C[3]], gUnknown_845B520[gUnknown_3005E9C[3]]); HelpSystem_PrintTwoStrings(sHelpSystemGeneralTopicTextPtrs[sHelpSystemState[3]], sHelpSystemGeneralTopicDescriptionTextPtrs[sHelpSystemState[3]]);
} }
else else
{ {
HelpSystem_PrintTwoStrings(gUnknown_845B540[gUnknown_3005E9C[3]], gUnknown_845B5D0[gUnknown_3005E9C[3]]); HelpSystem_PrintTwoStrings(sHelpSystemTypeMatchupTextPtrs[sHelpSystemState[3]], sHelpSystemTypeMatchupDescriptionTextPtrs[sHelpSystemState[3]]);
} }
sub_813BDA4(1); sub_813BDA4(1);
sub_813BD5C(1); sub_813BD5C(1);
a0->field_0E = 6; helpListMenu->state = 6;
return TRUE; return TRUE;
} }
bool8 sub_812BEEC(struct HelpSystemListMenu * a0, struct ListMenuItem * a1) bool8 HelpMenuSubroutine_ReturnFromHelpItem(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
gUnknown_3005E9C[0] = 1; sHelpSystemState[0] = 1;
sub_812B5A8(a0, a1); BuildAndPrintSubmenuList(helpListMenu, listMenuItemsBuffer);
sub_813C75C(); sub_813C75C();
HelpSystem_SetInputDelay(2); HelpSystem_SetInputDelay(2);
a0->field_0E = 3; helpListMenu->state = 3;
return TRUE; return TRUE;
} }
bool8 sub_812BF18(struct HelpSystemListMenu * a0, struct ListMenuItem * a1) bool8 HelpMenuSubroutine_HelpItemWaitButton(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
if (JOY_NEW(B_BUTTON) || JOY_NEW(A_BUTTON)) if (JOY_NEW(B_BUTTON) || JOY_NEW(A_BUTTON))
{ {
PlaySE(SE_SELECT); PlaySE(SE_SELECT);
a0->field_0E = 5; helpListMenu->state = 5;
return TRUE; return TRUE;
} }
if (JOY_NEW(L_BUTTON | R_BUTTON)) if (JOY_NEW(L_BUTTON | R_BUTTON))
@@ -1546,13 +1545,13 @@ bool8 sub_812BF18(struct HelpSystemListMenu * a0, struct ListMenuItem * a1)
return TRUE; return TRUE;
} }
static void sub_812BF5C(void) static void PrintWelcomeMessageOnPanel1(void)
{ {
HelpSystem_FillPanel1(); HelpSystem_FillPanel1();
HelpSystem_PrintTextAt(gUnknown_81B2FC9, 0, 0); HelpSystem_PrintTextAt(gUnknown_81B2FC9, 0, 0);
} }
static void sub_812BF74(const u8 * str) static void PrintTextOnPanel2Row52RightAlign(const u8 * str)
{ {
HelpSystem_FillPanel2(); HelpSystem_FillPanel2();
HelpSystem_PrintTextRightAlign_Row52(str); HelpSystem_PrintTextRightAlign_Row52(str);
@@ -1560,21 +1559,21 @@ static void sub_812BF74(const u8 * str)
u8 sub_812BF88(void) u8 sub_812BF88(void)
{ {
return gUnknown_3005E9C[0]; return sHelpSystemState[0];
} }
static void sub_812BF94(struct HelpSystemListMenu * a0) static void ResetHelpSystemCursor(struct HelpSystemListMenu * helpListMenu)
{ {
a0->field_0C = 0; helpListMenu->itemsAbove = 0;
a0->field_0D = 0; helpListMenu->cursorPos = 0;
} }
static void sub_812BF9C(struct HelpSystemListMenu * a0, struct ListMenuItem * a1) static void PrintHelpSystemTopicMouseoverDescription(struct HelpSystemListMenu * helpListMenu, struct ListMenuItem * listMenuItemsBuffer)
{ {
s32 index = a1[a0->field_0C + a0->field_0D].index; s32 index = listMenuItemsBuffer[helpListMenu->itemsAbove + helpListMenu->cursorPos].index;
if (index == -2) if (index == -2)
HelpSystem_PrintText_813C584(gUnknown_845B098[5]); HelpSystem_PrintText_813C584(sHelpSystemTopicMouseoverDescriptionPtrs[5]);
else else
HelpSystem_PrintText_813C584(gUnknown_845B098[index]); HelpSystem_PrintText_813C584(sHelpSystemTopicMouseoverDescriptionPtrs[index]);
sub_813BE30(1); sub_813BE30(1);
} }
+2 -2
View File
@@ -207,7 +207,7 @@ void EnterUnionRoomChat(void)
sWork = Alloc(sizeof(struct UnionRoomChat)); sWork = Alloc(sizeof(struct UnionRoomChat));
InitChatWork(sWork); InitChatWork(sWork);
gKeyRepeatStartDelay = 20; gKeyRepeatStartDelay = 20;
sub_812B4AC(); HelpSystem_DisableToggleWithRButton();
SetVBlankCallback(NULL); SetVBlankCallback(NULL);
SetMainCallback2(CB2_LoadInterface); SetMainCallback2(CB2_LoadInterface);
} }
@@ -893,7 +893,7 @@ static void ChatEntryRoutine_SaveAndExit(void)
case 13: case 13:
if (!gPaletteFade.active) if (!gPaletteFade.active)
{ {
sub_812B4B8(); HelpSystem_EnableToggleWithRButton();
UnionRoomChat_FreeGraphicsWork(); UnionRoomChat_FreeGraphicsWork();
FreeChatWork(); FreeChatWork();
SetMainCallback2(CB2_ReturnToField); SetMainCallback2(CB2_ReturnToField);