diff --git a/include/functions.h b/include/functions.h index 1287431cef..c98e3c0216 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1556,7 +1556,7 @@ void func_80106644(PlayState* play, s16 arg1, s16 arg2, s16 arg3); // void func_8010683C(void); // void func_801068B4(void); // void func_801068D8(void); -// void func_801068FC(void); +void* func_801068FC(PlayState* play, void* arg1, size_t size); // void func_80106BEC(void); // void func_80106D08(void); // void func_80106D5C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7); @@ -1569,7 +1569,7 @@ void func_80108AF8(PlayState* play); s32 func_801090B0(s32 arg0); s32 func_80109124(s16 arg0); // void func_801091F0(void); -// void func_80109428(void); +void func_80109428(PlayState* play); // void func_801094A0(void); // void func_801094C8(void); // void func_801094F8(void); @@ -1712,13 +1712,13 @@ void Interface_StartTimer(s16 timerId, s16 seconds); void Interface_StartPostmanTimer(s16 seconds, s16 bunnyHoodState); void func_8010EE74(PlayState* play, s32 day); void Interface_SetHudVisibility(u16 hudVisibility); -// void func_80110038(void); +void func_80110038(PlayState* play); // void func_80111CB4(void); // void func_801129E4(void); void func_80112AFC(PlayState* play); void Interface_LoadItemIconImpl(PlayState* play, u8 btn); void Interface_LoadItemIcon(PlayState* play, u8 btn); -// void func_80112C0C(void); +void func_80112C0C(PlayState* play, u16 flag); u8 Item_Give(PlayState* play, u8 item); u8 Item_CheckObtainability(u8 item); void Inventory_DeleteItem(s16 item, s16 slot); @@ -2589,8 +2589,8 @@ s32 func_80178A94(s32 param_1, s32 param_2); // void func_80178C80(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); // void func_80178D7C(void); // void func_80178DAC(void); -// void func_80178E3C(void); -// void func_80178E7C(void); +void func_80178E3C(u8*, s32, s32, s32); +void func_80178E7C(uintptr_t arg0, void* arg1, size_t size); // void Check_WriteRGBA16Pixel(u16* buffer, u32 x, u32 y, u32 value); // void Check_WriteI4Pixel(u16* buffer, u32 x, u32 y, u32 value); // void Check_DrawI4Texture(u16* buffer, u32 x, u32 y, u32 width, u32 height, u8* texture); diff --git a/include/regs.h b/include/regs.h index 212c1c0317..9fa5f736a5 100644 --- a/include/regs.h +++ b/include/regs.h @@ -46,7 +46,7 @@ #define R_ENABLE_ARENA_DBG SREG(0) // Same as OoT #define R_RUN_SPEED_LIMIT REG(45) #define R_UPDATE_RATE SREG(30) -#define R_PAUSE_MENU_MODE SREG(94) +#define R_PAUSE_BG_PRERENDER_STATE SREG(94) #define R_PLAY_FILL_SCREEN_ON MREG(64) #define R_PLAY_FILL_SCREEN_R MREG(65) #define R_PLAY_FILL_SCREEN_G MREG(66) diff --git a/include/segment_symbols.h b/include/segment_symbols.h index b69439ce73..ccb5488d13 100644 --- a/include/segment_symbols.h +++ b/include/segment_symbols.h @@ -53,7 +53,9 @@ DECLARE_ROM_SEGMENT(map_grand_static) DECLARE_ROM_SEGMENT(item_name_static) DECLARE_ROM_SEGMENT(map_name_static) DECLARE_ROM_SEGMENT(icon_item_static_test) +DECLARE_ROM_SEGMENT(icon_item_static_old) DECLARE_ROM_SEGMENT(icon_item_24_static_test) +DECLARE_ROM_SEGMENT(icon_item_24_static_old) DECLARE_ROM_SEGMENT(schedule_dma_static_test) DECLARE_ROM_SEGMENT(schedule_static) DECLARE_ROM_SEGMENT(story_static) diff --git a/include/variables.h b/include/variables.h index 5221ebe945..a3278c4811 100644 --- a/include/variables.h +++ b/include/variables.h @@ -797,7 +797,7 @@ extern TexturePtr gItemIcons[]; extern u8 gItemSlots[]; extern s16 gItemPrices[]; extern u16 gSceneIdsPerRegion[11][27]; -extern u32 D_801C2410[]; +extern u8 gPlayerFormItemRestrictions[PLAYER_FORM_MAX][114]; extern s16 gPlayerFormObjectIndices[8]; extern RomFile gObjectTable[643]; extern SceneTableEntry gSceneTable[]; @@ -826,7 +826,7 @@ extern struct_801C5F44 D_801C5F44[]; // D_801C5F44 // extern UNK_TYPE2 D_801C6A8C; // extern UNK_TYPE2 D_801C6A90; // extern UNK_TYPE2 D_801C6A94; -// extern UNK_TYPE1 D_801C6A98; +extern u8 D_801C6A98[5][5]; // extern UNK_TYPE1 D_801C6AB8; // extern UNK_TYPE1 D_801C6B28; // extern UNK_TYPE1 D_801CED40; diff --git a/include/z64.h b/include/z64.h index 1b12ad5225..4b2f45bbfb 100644 --- a/include/z64.h +++ b/include/z64.h @@ -386,10 +386,10 @@ typedef struct { /* 0x000 */ View view; /* 0x168 */ u8* iconItemSegment; /* 0x16C */ u8* iconItem24Segment; - /* 0x170 */ u8* unk_170; - /* 0x174 */ u8* unk_174; - /* 0x178 */ u8* unk_178; - /* 0x17C */ u8* unk_17C; + /* 0x170 */ u8* iconItemAltSegment; + /* 0x174 */ u8* iconItemLangSegment; + /* 0x178 */ u8* nameSegment; + /* 0x17C */ u8* iconItemVtxSegment; /* 0x180 */ Vtx* itemPageVtx; /* 0x184 */ Vtx* mapPageVtx; /* 0x188 */ Vtx* questPageVtx; @@ -402,24 +402,24 @@ typedef struct { /* 0x1A4 */ Vtx* unk_1A4; /* 0x1A8 */ Vtx* cursorVtx; /* 0x1AC */ OcarinaStaff* ocarinaStaff; - /* 0x1B0 */ DmaRequest unk_1B0; + /* 0x1B0 */ UNK_TYPE1 unk_1B0[0x20]; /* 0x1D0 */ OSMesgQueue loadQueue; /* 0x1E8 */ OSMesg loadMsg; /* 0x1EC */ u16 state; /* 0x1EE */ u16 debugEditor; /* 0x1F0 */ u8 bombersNotebookOpen; /* 0x1F4 */ Vec3f eye; - /* 0x200 */ u16 unk_200; - /* 0x202 */ u16 mode; + /* 0x200 */ u16 mainState; + /* 0x202 */ u16 nextPageMode; // (2 * prev pageIndex) + (scroll left ? 1 : 0) /* 0x204 */ u16 pageIndex; - /* 0x206 */ u16 unk_206; - /* 0x208 */ u16 unk_208; + /* 0x206 */ u16 switchPageTimer; + /* 0x208 */ u16 savePromptState; /* 0x20C */ f32 unk_20C; - /* 0x210 */ f32 unk_210; - /* 0x214 */ f32 unk_214; - /* 0x218 */ f32 unk_218; - /* 0x21C */ f32 unk_21C; - /* 0x220 */ f32 unk_220; + /* 0x210 */ f32 itemPageRoll; // rotation (-z) of the item page into the screen + /* 0x214 */ f32 mapPageRoll; // rotation (+x) of the map page into the screen + /* 0x218 */ f32 questPageRoll; // rotation (+z) of the quest page into the screen + /* 0x21C */ f32 maskPageRoll; // rotation (-z) of the mask page into the screen + /* 0x220 */ f32 roll; /* 0x224 */ u16 alpha; /* 0x226 */ s16 offsetY; /* 0x228 */ UNK_TYPE1 unk_228[0x8]; @@ -431,7 +431,7 @@ typedef struct { /* 0x256 */ s16 unk_256; // Uses DungeonItem enum /* 0x258 */ s16 cursorSpecialPos; /* 0x25A */ s16 pageSwitchTimer; - /* 0x25C */ u16 unk_25C; + /* 0x25C */ u16 namedItem; /* 0x25E */ u16 cursorItem[5]; /* 0x268 */ u16 cursorSlot[5]; /* 0x272 */ u16 equipTargetItem; @@ -440,7 +440,7 @@ typedef struct { /* 0x278 */ s16 equipAnimX; /* 0x27A */ s16 equipAnimY; /* 0x27C */ s16 equipAnimAlpha; - /* 0x27E */ s16 unk_27E; + /* 0x27E */ s16 infoPanelOffsetY; /* 0x280 */ u16 unk_280; /* 0x282 */ u16 nameColorSet; /* 0x284 */ s16 cursorColorSet; @@ -454,9 +454,9 @@ typedef struct { /* 0x29E */ s16 promptAlpha; /* 0x2A0 */ s16 ocarinaSongIndex; /* 0x2A2 */ u8 worldMapPoints[20]; - /* 0x2B6 */ u8 unk_2B6; - /* 0x2B7 */ u8 unk_2B7; - /* 0x2B8 */ u8 unk_2B8; + /* 0x2B6 */ u8 unk_2B6; // unused red? + /* 0x2B7 */ u8 unk_2B7; // unused green? + /* 0x2B8 */ u8 unk_2B8; // unused blue? /* 0x2B9 */ u8 itemDescriptionOn; // helpful description of item given through a message box /* 0x2BA */ s16 equipAnimScale; // scale of item icon while moving being equipped to c-button /* 0x2BC */ s16 equipAnimShrinkRate; // rate the scale is shrinking for the item icon while moving being equipped to c-button diff --git a/src/code/game.c b/src/code/game.c index 73352379f6..b7069d312f 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -1,6 +1,7 @@ #include "global.h" #include "system_malloc.h" #include "z64rumble.h" +#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" s32 gFramerateDivisor = 1; f32 gFramerateDivisorF = 1.0f; @@ -140,7 +141,7 @@ void Game_Update(GameState* gameState) { gameState->main(gameState); - if (R_PAUSE_MENU_MODE != 2) { + if (R_PAUSE_BG_PRERENDER_STATE != PAUSE_BG_PRERENDER_PROCESS) { GameState_Draw(gameState, gfxCtx); func_801736DC(gfxCtx); } diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 2052449f78..eda6437aff 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -3318,7 +3318,7 @@ f32 BgCheck_RaycastFloorDyna(DynaRaycast* dynaRaycast) { dynaActor = DynaPoly_GetActor(dynaRaycast->colCtx, *dynaRaycast->bgId); if ((result != BGCHECK_Y_MIN) && (dynaActor != NULL) && (dynaRaycast->play != NULL)) { - pauseState = dynaRaycast->play->pauseCtx.state != 0; + pauseState = (dynaRaycast->play->pauseCtx.state != PAUSE_STATE_OFF); if (!pauseState) { pauseState = dynaRaycast->play->pauseCtx.debugEditor != DEBUG_EDITOR_NONE; } diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index 9cea42691e..5ab466ddc3 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -35,24 +35,25 @@ void KaleidoScopeCall_Update(PlayState* play) { PauseContext* pauseCtx = &play->pauseCtx; KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]; - if ((play->pauseCtx.state != 0) || (play->pauseCtx.debugEditor != DEBUG_EDITOR_NONE)) { - if (pauseCtx->state == 1 || pauseCtx->state == 19) { + if ((play->pauseCtx.state != PAUSE_STATE_OFF) || (play->pauseCtx.debugEditor != DEBUG_EDITOR_NONE)) { + if ((pauseCtx->state == PAUSE_STATE_OPENING_0) || (pauseCtx->state == PAUSE_STATE_OWLWARP_0)) { if (ShrinkWindow_Letterbox_GetSize() == 0) { - R_PAUSE_MENU_MODE = 1; - pauseCtx->unk_200 = 0; - pauseCtx->unk_208 = 0; + R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; + pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_0; pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; } - } else if (pauseCtx->state == 8) { - R_PAUSE_MENU_MODE = 1; - pauseCtx->unk_200 = 0; - pauseCtx->unk_208 = 0; + } else if (pauseCtx->state == PAUSE_STATE_GAMEOVER_0) { + R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; + pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_0; pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; - } else if ((pauseCtx->state == 2) || (pauseCtx->state == 9) || (pauseCtx->state == 20)) { - if (R_PAUSE_MENU_MODE == 3) { + } else if ((pauseCtx->state == PAUSE_STATE_OPENING_1) || (pauseCtx->state == PAUSE_STATE_GAMEOVER_1) || + (pauseCtx->state == PAUSE_STATE_OWLWARP_1)) { + if (R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_DONE) { pauseCtx->state++; } - } else if (pauseCtx->state != 0) { + } else if (pauseCtx->state != PAUSE_STATE_OFF) { if (gKaleidoMgrCurOvl != kaleidoScopeOvl) { if (gKaleidoMgrCurOvl != NULL) { KaleidoManager_ClearOvl(gKaleidoMgrCurOvl); @@ -64,7 +65,7 @@ void KaleidoScopeCall_Update(PlayState* play) { if (gKaleidoMgrCurOvl == kaleidoScopeOvl) { sKaleidoScopeUpdateFunc(play); - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { + if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { KaleidoManager_ClearOvl(kaleidoScopeOvl); KaleidoScopeCall_LoadPlayer(); } @@ -76,9 +77,9 @@ void KaleidoScopeCall_Update(PlayState* play) { void KaleidoScopeCall_Draw(PlayState* play) { KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]; - if (R_PAUSE_MENU_MODE == 3) { - if (((play->pauseCtx.state >= 4) && (play->pauseCtx.state <= 7)) || - ((play->pauseCtx.state >= 11) && (play->pauseCtx.state <= 26))) { + if (R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_DONE) { + if (((play->pauseCtx.state >= PAUSE_STATE_OPENING_3) && (play->pauseCtx.state <= PAUSE_STATE_SAVEPROMPT)) || + ((play->pauseCtx.state >= PAUSE_STATE_GAMEOVER_3) && (play->pauseCtx.state <= PAUSE_STATE_UNPAUSE_SETUP))) { if (gKaleidoMgrCurOvl == kaleidoScopeOvl) { sKaleidoScopeDrawFunc(play); } diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index ce23b6506b..475de9819b 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -4,9 +4,24 @@ #include "z64view.h" #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" -s16 D_801BDB00[] = { PAUSE_MAP, PAUSE_QUEST, PAUSE_MASK, PAUSE_ITEM }; -f32 sKaleidoSetupEyeX[] = { -64.0f, 0.0f, 64.0f, 0.0f }; -f32 sKaleidoSetupEyeZ[] = { 0.0f, -64.0f, 0.0f, 64.0f }; +s16 sKaleidoSetupRightPageIndex[] = { + PAUSE_MAP, // PAUSE_ITEM + PAUSE_QUEST, // PAUSE_MAP + PAUSE_MASK, // PAUSE_QUEST + PAUSE_ITEM, // PAUSE_MASK +}; +f32 sKaleidoSetupRightPageEyeX[] = { + PAUSE_EYE_DIST * -PAUSE_MAP_X, // PAUSE_ITEM + PAUSE_EYE_DIST * -PAUSE_QUEST_X, // PAUSE_MAP + PAUSE_EYE_DIST * -PAUSE_MASK_X, // PAUSE_QUEST + PAUSE_EYE_DIST * -PAUSE_ITEM_X, // PAUSE_MASK +}; +f32 sKaleidoSetupRightPageEyeZ[] = { + PAUSE_EYE_DIST * -PAUSE_MAP_Z, // PAUSE_ITEM + PAUSE_EYE_DIST * -PAUSE_QUEST_Z, // PAUSE_MAP + PAUSE_EYE_DIST * -PAUSE_MASK_Z, // PAUSE_QUEST + PAUSE_EYE_DIST * -PAUSE_ITEM_Z, // PAUSE_MASK +}; void func_800F4A10(PlayState* play) { PauseContext* pauseCtx = &play->pauseCtx; @@ -14,18 +29,20 @@ void func_800F4A10(PlayState* play) { Rumble_StateReset(); - pauseCtx->unk_206 = 0; - pauseCtx->unk_200 = 1; - pauseCtx->eye.x = sKaleidoSetupEyeX[pauseCtx->pageIndex]; - pauseCtx->eye.z = sKaleidoSetupEyeZ[pauseCtx->pageIndex]; - pauseCtx->pageIndex = D_801BDB00[pauseCtx->pageIndex]; - pauseCtx->unk_27E = -40; + pauseCtx->switchPageTimer = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_SWITCHING_PAGE; + + // Set eye position and pageIndex such that scrolling left brings to the desired page + pauseCtx->eye.x = sKaleidoSetupRightPageEyeX[pauseCtx->pageIndex]; + pauseCtx->eye.z = sKaleidoSetupRightPageEyeZ[pauseCtx->pageIndex]; + pauseCtx->pageIndex = sKaleidoSetupRightPageIndex[pauseCtx->pageIndex]; + pauseCtx->infoPanelOffsetY = -40; for (i = 0; i < ARRAY_COUNT(pauseCtx->worldMapPoints); i++) { pauseCtx->worldMapPoints[i] = false; } - if (pauseCtx->state == 1) { + if (pauseCtx->state == PAUSE_STATE_OPENING_0) { for (i = 0; i < REGION_MAX; i++) { if ((gSaveContext.save.regionsVisited >> i) & 1) { pauseCtx->worldMapPoints[i] = true; @@ -72,7 +89,7 @@ void KaleidoSetup_Update(PlayState* play) { if (msgCtx && msgCtx) {} } - if ((pauseCtx->state == 0) && (pauseCtx->debugEditor == DEBUG_EDITOR_NONE) && + if ((pauseCtx->state == PAUSE_STATE_OFF) && (pauseCtx->debugEditor == DEBUG_EDITOR_NONE) && (play->gameOverCtx.state == GAMEOVER_INACTIVE)) { if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { if ((gSaveContext.save.cutscene < 0xFFF0) && (gSaveContext.nextCutsceneIndex < 0xFFF0)) { @@ -85,13 +102,14 @@ void KaleidoSetup_Update(PlayState* play) { if ((play->actorCtx.unk268 == 0) && CHECK_BTN_ALL(input->press.button, BTN_START)) { gSaveContext.prevHudVisibility = gSaveContext.hudVisibility; pauseCtx->itemDescriptionOn = false; - pauseCtx->state = 1; + pauseCtx->state = PAUSE_STATE_OPENING_0; func_800F4A10(play); - pauseCtx->mode = pauseCtx->pageIndex * 2 + 1; + // Set next page mode to scroll left + pauseCtx->nextPageMode = pauseCtx->pageIndex * 2 + 1; func_801A3A7C(1); } - if (pauseCtx->state == 1) { + if (pauseCtx->state == PAUSE_STATE_OPENING_0) { Game_SetFramerateDivisor(&play->state, 2); if (ShrinkWindow_Letterbox_GetSizeTarget() != 0) { ShrinkWindow_Letterbox_SetSizeTarget(0); @@ -115,14 +133,14 @@ void KaleidoSetup_Init(PlayState* play) { pauseCtx->pageIndex = PAUSE_ITEM; - pauseCtx->unk_21C = 160.0f; - pauseCtx->unk_218 = 160.0f; - pauseCtx->unk_214 = 160.0f; - pauseCtx->unk_210 = 160.0f; + pauseCtx->maskPageRoll = 160.0f; + pauseCtx->questPageRoll = 160.0f; + pauseCtx->mapPageRoll = 160.0f; + pauseCtx->itemPageRoll = 160.0f; pauseCtx->eye.x = -64.0f; pauseCtx->unk_20C = 936.0f; - pauseCtx->unk_220 = -314.0f; + pauseCtx->roll = -314.0f; pauseCtx->cursorPoint[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + (DUNGEON_FLOOR_INDEX_4 - 1); diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index d2a3a254c4..d4927ae975 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -399,7 +399,7 @@ void LifeMeter_UpdateSizeAndBeep(PlayState* play) { if (interfaceCtx->lifeSizeChange <= 0) { interfaceCtx->lifeSizeChange = 0; interfaceCtx->lifeSizeChangeDirection = 0; - if (!Player_InCsMode(play) && (play->pauseCtx.state == 0) && + if (!Player_InCsMode(play) && (play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && LifeMeter_IsCritical() && !Play_InCsMode(play)) { play_sound(NA_SE_SY_HITPOINT_ALARM); } diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index 57f51a20ae..ac78d12299 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -226,8 +226,8 @@ void Map_Update(PlayState* play) { s16 floor; s32 pad2; - if ((play->pauseCtx.state < 4) && (CHECK_BTN_ALL(controller->press.button, BTN_L)) && (!Play_InCsMode(play)) && - (!func_80106530(play))) { + if ((play->pauseCtx.state <= PAUSE_STATE_OPENING_2) && (CHECK_BTN_ALL(controller->press.button, BTN_L)) && + !Play_InCsMode(play) && !func_80106530(play)) { if (!R_MINIMAP_DISABLED) { play_sound(NA_SE_SY_CAMERA_ZOOM_UP); } else { @@ -239,7 +239,7 @@ void Map_Update(PlayState* play) { func_80105B34(play); - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { + if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { if (Map_IsInDungeonArea(play)) { floor = func_80109124(player->actor.world.pos.y); if (floor != -1) { diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index d463edff34..a49844e5b2 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -2309,7 +2309,7 @@ void Magic_Update(PlayState* play) { case MAGIC_STATE_CONSUME_LENS: // Slowly consume magic while Lens of Truth is active - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && + if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && (msgCtx->msgMode == 0) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play)) { @@ -2352,9 +2352,9 @@ void Magic_Update(PlayState* play) { gSaveContext.magicState = MAGIC_STATE_CONSUME_GORON_ZORA; // fallthrough case MAGIC_STATE_CONSUME_GORON_ZORA: - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == 0) && (msgCtx->msgMode == 0) && - (play->gameOverCtx.state == GAMEOVER_INACTIVE) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && - (play->transitionMode == TRANS_MODE_OFF)) { + if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == 0) && + (msgCtx->msgMode == 0) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && + (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { if (!Play_InCsMode(play)) { interfaceCtx->magicConsumptionTimer--; if (interfaceCtx->magicConsumptionTimer == 0) { @@ -2374,7 +2374,7 @@ void Magic_Update(PlayState* play) { break; case MAGIC_STATE_CONSUME_GIANTS_MASK: - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && + if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && (msgCtx->msgMode == 0) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { if (!Play_InCsMode(play)) { @@ -2680,7 +2680,7 @@ void Interface_DrawTimers(PlayState* play) { OPEN_DISPS(play->state.gfxCtx); // Not satisfying any of these conditions will pause the timer - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && + if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && ((msgCtx->msgMode == 0) || ((msgCtx->msgMode != 0) && (msgCtx->currentTextId >= 0x1BB2) && (msgCtx->currentTextId <= 0x1BB6))) && @@ -3125,7 +3125,7 @@ void Interface_UpdateBottleTimers(PlayState* play) { s32 pad[2]; // Not satisfying any of these conditions will pause the bottle timer - if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && + if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && ((msgCtx->msgMode == 0) || ((msgCtx->currentTextId >= 0x100) && (msgCtx->currentTextId <= 0x200)) || ((msgCtx->currentTextId >= 0x1BB2) && (msgCtx->currentTextId <= 0x1BB6))) && diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index ace1cc4cd3..057424e3c6 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -1,4 +1,5 @@ #include "global.h" +#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" Gfx sSetupDL[438] = { /* 0x00 */ @@ -1328,7 +1329,7 @@ void func_8012CF0C(GraphicsContext* gfxCtx, s32 clearFb, s32 clearZb, u8 r, u8 g } void func_8012D374(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) { - if ((R_PAUSE_MENU_MODE < 2) && (D_801F6D10 < 2)) { + if ((R_PAUSE_BG_PRERENDER_STATE <= PAUSE_BG_PRERENDER_SETUP) && (D_801F6D10 < 2)) { func_8012CF0C(gfxCtx, true, true, r, g, b); } else { func_8012CF0C(gfxCtx, false, false, r, g, b); diff --git a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c index 2998939822..df778f1a74 100644 --- a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c +++ b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c @@ -58,7 +58,7 @@ void func_8096B104(EnOkarinaEffect* this, PlayState* play) { void func_8096B174(EnOkarinaEffect* this, PlayState* play) { DECR(this->unk144); - if ((play->pauseCtx.state == 0) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && + if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && (play->msgCtx.msgLength == 0) && !FrameAdvance_IsEnabled(&play->state) && (this->unk144 == 0)) { EnOkarinaEffect_SetupAction(this, func_8096B1FC); } diff --git a/src/overlays/actors/ovl_En_Test4/z_en_test4.c b/src/overlays/actors/ovl_En_Test4/z_en_test4.c index 0f63745602..439f3837f7 100644 --- a/src/overlays/actors/ovl_En_Test4/z_en_test4.c +++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.c @@ -4,6 +4,7 @@ * Description: Three-Day Timer */ +#include "prevent_bss_reordering.h" #include "z_en_test4.h" #include "overlays/gamestates/ovl_daytelop/z_daytelop.h" #include "overlays/actors/ovl_En_Horse/z_en_horse.h" diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c index 90a1a0effc..92fe82e76d 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c @@ -326,7 +326,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play) { gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - if ((pauseCtx->state == 4) || (pauseCtx->state == 0x1A)) { + if ((pauseCtx->state == PAUSE_STATE_OPENING_3) || (pauseCtx->state == PAUSE_STATE_UNPAUSE_SETUP)) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sQuestHpPrimColorTargets[0][0], sQuestHpPrimColorTargets[0][1], sQuestHpPrimColorTargets[0][2], pauseCtx->alpha); } else { @@ -344,11 +344,11 @@ void KaleidoScope_DrawQuestStatus(PlayState* play) { j += 4; - if (pauseCtx->state == 6) { + if (pauseCtx->state == PAUSE_STATE_MAIN) { gDPPipeSync(POLY_OPA_DISP++); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); - if (pauseCtx->unk_200 == 2) { + if (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PLAYBACK) { // Draw ocarina buttons as they are played back pauseCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff(); @@ -391,7 +391,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play) { sOcarinaButtonTextures[sQuestSongPlayedOcarinaButtons[i]], 16, 16, 0); } } - } else if (((pauseCtx->unk_200 >= 4) && (pauseCtx->unk_200 <= 6)) || (pauseCtx->unk_200 == 8)) { + } else if (IS_PAUSE_MAIN_STATE_SAVE_PROMPT || (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG)) { // Draw the buttons for playing a song sp1C8 = pauseCtx->ocarinaSongIndex; sp1CA = gOcarinaSongButtons[sp1C8].numButtons; @@ -407,7 +407,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play) { gDPPipeSync(POLY_OPA_DISP++); - if (pauseCtx->unk_200 == 8) { + if (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG) { // Draw ocarina buttons colored if (gOcarinaSongButtons[sp1C8].buttonIndex[k] == OCARINA_BTN_A) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 80, 150, 255, 200); @@ -425,7 +425,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play) { POLY_OPA_DISP, sOcarinaButtonTextures[gOcarinaSongButtons[sp1C8].buttonIndex[k]], 16, 16, 0); } - if (pauseCtx->unk_200 != 8) { + if (pauseCtx->mainState != PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG) { pauseCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff(); // Update ocarina song inputs @@ -475,7 +475,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play) { sOcarinaButtonTextures[sQuestSongPlayedOcarinaButtons[k]], 16, 16, 0); } - if (pauseCtx->unk_200 == 4) { + if (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PROMPT_INIT) { for (k = 0; k < 8; k++) { sQuestSongPlayedOcarinaButtons[k] = OCARINA_BTN_INVALID; sQuestSongPlayedOcarinaButtonsAlpha[k] = 0; @@ -487,7 +487,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play) { pauseCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff(); pauseCtx->ocarinaStaff->pos = 0; pauseCtx->ocarinaStaff->state = 0xFE; - pauseCtx->unk_200 = 5; + pauseCtx->mainState = PAUSE_MAIN_STATE_SONG_PROMPT; } } } @@ -630,15 +630,17 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { pauseCtx->nameColorSet = PAUSE_NAME_COLOR_SET_WHITE; pauseCtx->cursorColorSet = PAUSE_CURSOR_COLOR_SET_WHITE; - // != 0 - if ((pauseCtx->state == 6) && (!pauseCtx->unk_200 || (pauseCtx->unk_200 == 5) || (pauseCtx->unk_200 == 8)) && + // != PAUSE_MAIN_STATE_IDLE + if ((pauseCtx->state == PAUSE_STATE_MAIN) && + (!pauseCtx->mainState || (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PROMPT) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG)) && (pauseCtx->pageIndex == PAUSE_QUEST) && !pauseCtx->itemDescriptionOn) { if (pauseCtx->cursorSpecialPos == 0) { oldCursorPoint = pauseCtx->cursorPoint[PAUSE_QUEST]; if (pauseCtx->stickAdjX < -30) { // Move cursor left - if (pauseCtx->unk_200 == 5) { + if (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PROMPT) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); } pauseCtx->unk_298 = 4.0f; @@ -646,7 +648,7 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { nextCursorPoint = sCursorPointLinks[oldCursorPoint].left; if (nextCursorPoint == CURSOR_TO_LEFT) { KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_LEFT); - pauseCtx->unk_200 = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; if (interfaceCtx->unk_212 == 6) { func_8011552C(play, 0x15); } @@ -661,7 +663,7 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { } } else if (pauseCtx->stickAdjX > 30) { // Move cursor right - if (pauseCtx->unk_200 == 5) { + if (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PROMPT) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); } pauseCtx->unk_298 = 4.0f; @@ -669,7 +671,7 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { if (nextCursorPoint == CURSOR_TO_RIGHT) { KaleidoScope_MoveCursorToSpecialPos(play, PAUSE_CURSOR_PAGE_RIGHT); - pauseCtx->unk_200 = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; return; } @@ -683,7 +685,7 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { if (pauseCtx->stickAdjY < -30) { // Move cursor down - if (pauseCtx->unk_200 == 5) { + if (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PROMPT) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); } nextCursorPoint = sCursorPointLinks[oldCursorPoint].down; @@ -697,7 +699,7 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { } } else if (pauseCtx->stickAdjY > 30) { // Move cursor up - if (pauseCtx->unk_200 == 5) { + if (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PROMPT) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); } nextCursorPoint = sCursorPointLinks[oldCursorPoint].up; @@ -712,7 +714,7 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { // if the cursor point changed if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_QUEST]) { - pauseCtx->unk_200 = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; play_sound(NA_SE_SY_CURSOR); } @@ -787,8 +789,8 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { pauseCtx->cursorItem[pauseCtx->pageIndex] = cursorItem; pauseCtx->cursorSlot[pauseCtx->pageIndex] = cursor; - if ((pauseCtx->debugEditor == DEBUG_EDITOR_NONE) && (pauseCtx->state == 6) && (pauseCtx->unk_200 == 0) && - (pauseCtx->cursorSpecialPos == 0)) { + if ((pauseCtx->debugEditor == DEBUG_EDITOR_NONE) && (pauseCtx->state == PAUSE_STATE_MAIN) && + (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && (pauseCtx->cursorSpecialPos == 0)) { if ((cursor >= QUEST_SONG_SONATA) && (cursor <= QUEST_SONG_SUN)) { // Handle part of the ocarina songs playback if ((CHECK_QUEST_ITEM(pauseCtx->cursorPoint[PAUSE_QUEST]) || @@ -829,7 +831,7 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { pauseCtx->ocarinaButtonsY[OCARINA_BTN_C_LEFT] = -46; pauseCtx->ocarinaButtonsY[OCARINA_BTN_C_UP] = -41; - pauseCtx->unk_200 = 8; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG; if (interfaceCtx->unk_212 != 6) { func_8011552C(play, 6); @@ -873,7 +875,7 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) && (msgCtx->msgLength == 0)) { if (pauseCtx->cursorPoint[PAUSE_QUEST] == QUEST_BOMBERS_NOTEBOOK) { play->pauseCtx.bombersNotebookOpen = true; - pauseCtx->unk_200 = 0x10; + pauseCtx->mainState = PAUSE_MAIN_STATE_BOMBERS_NOTEBOOK_OPEN; play_sound(NA_SE_SY_DECIDE); } else { pauseCtx->itemDescriptionOn = true; @@ -898,31 +900,35 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { Interface_SetHudVisibility(HUD_VISIBILITY_ALL); } } - } else if (pauseCtx->unk_200 == 5) { + } else if (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PROMPT) { // Abort reading ocarina song input if the stick is moved if ((pauseCtx->stickAdjX != 0) || (pauseCtx->stickAdjY != 0)) { - pauseCtx->unk_200 = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); } - } else if ((pauseCtx->unk_200 == 8) && CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) && - (msgCtx->msgLength == 0) && (cursor >= QUEST_SONG_SONATA) && (cursor <= QUEST_SONG_SUN)) { - pauseCtx->unk_200 = 9; + } else if ((pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG) && + CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) && (msgCtx->msgLength == 0) && + (cursor >= QUEST_SONG_SONATA) && (cursor <= QUEST_SONG_SUN)) { + pauseCtx->mainState = PAUSE_MAIN_STATE_SONG_PLAYBACK_INIT; sQuestSongPlaybackDelayTimer = 10; } if (pauseCtx->cursorSpecialPos == 0) { if ((pauseCtx->cursorSlot[PAUSE_QUEST] >= 6) && (pauseCtx->cursorSlot[PAUSE_QUEST] < 0x12) && - ((pauseCtx->unk_200 <= 2) || (pauseCtx->unk_200 == 5) || (pauseCtx->unk_200 == 8)) && + ((pauseCtx->mainState <= PAUSE_MAIN_STATE_SONG_PLAYBACK) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PROMPT) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG)) && (pauseCtx->cursorItem[pauseCtx->pageIndex] != PAUSE_ITEM_NONE)) { pauseCtx->cursorColorSet = PAUSE_CURSOR_COLOR_SET_BLUE; - if ((pauseCtx->unk_200 >= 2) && (pauseCtx->unk_200 <= 6)) { + if ((pauseCtx->mainState >= PAUSE_MAIN_STATE_SONG_PLAYBACK) && + (pauseCtx->mainState <= PAUSE_MAIN_STATE_SONG_PROMPT_DONE)) { pauseCtx->cursorColorSet = PAUSE_CURSOR_COLOR_SET_WHITE; } } } } else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { if (pauseCtx->stickAdjX > 30) { - if (pauseCtx->unk_200 == 5) { + if (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PROMPT) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); } @@ -940,7 +946,7 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { pauseCtx->cursorSlot[pauseCtx->pageIndex] = cursor; } } else if (pauseCtx->stickAdjX < -30) { - if (pauseCtx->unk_200 == 5) { + if (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PROMPT) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); } @@ -961,7 +967,7 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { pauseCtx->cursorItem[pauseCtx->pageIndex] = cursorItem; pauseCtx->cursorSlot[pauseCtx->pageIndex] = cursor; } - } else if (pauseCtx->unk_200 == 9) { + } else if (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PLAYBACK_INIT) { // After a short delay, start the playback of the selected song pauseCtx->cursorColorSet = PAUSE_CURSOR_COLOR_SET_BLUE; @@ -989,7 +995,7 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_DEFAULT); pauseCtx->ocarinaSongIndex = gOcarinaSongItemMap[cursor - QUEST_SONG_SONATA]; AudioOcarina_SetPlaybackSong(pauseCtx->ocarinaSongIndex + 1, 1); - pauseCtx->unk_200 = 2; + pauseCtx->mainState = PAUSE_MAIN_STATE_SONG_PLAYBACK; pauseCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff(); pauseCtx->ocarinaStaff->pos = 0; } diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c index 120a07c0a9..8e69188fb4 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c @@ -15,7 +15,7 @@ s16 sEquipMagicArrowSlotHoldTimer = 0; // Number of frames to move icon from slot to target position when equipping. s16 sEquipAnimTimer = 10; -u8 gPlayerFormSlotRestrictions[PLAYER_FORM_MAX][24] = { +u8 gPlayerFormSlotRestrictions[PLAYER_FORM_MAX][NUM_ITEM_SLOTS] = { // Fierce Deity { false, // SLOT_OCARINA @@ -256,9 +256,9 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { // Loop over c-buttons (i) and vtx offset (j) gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); - for (i = 0, j = 24 * 4; i < 3; i++, j += 4) { + for (i = 0, j = NUM_ITEM_SLOTS * 4; i < 3; i++, j += 4) { if (GET_CUR_FORM_BTN_ITEM(i + 1) != ITEM_NONE) { - if (GET_CUR_FORM_BTN_SLOT(i + 1) < 24) { + if (GET_CUR_FORM_BTN_SLOT(i + 1) < NUM_ITEM_SLOTS) { gSPVertex(POLY_OPA_DISP++, &pauseCtx->itemVtx[j], 4, 0); POLY_OPA_DISP = func_8010DC58(POLY_OPA_DISP, gEquippedItemOutlineTex, 32, 32, 0); } @@ -270,11 +270,12 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { // Draw the item icons // Loop over slots (i) and vtx offset (j) gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); - for (j = 0, i = 0; i < 24; i++, j += 4) { + for (j = 0, i = 0; i < NUM_ITEM_SLOTS; i++, j += 4) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); if (((void)0, gSaveContext.save.inventory.items[i]) != ITEM_NONE) { - if ((pauseCtx->unk_200 == 0) && (pauseCtx->pageIndex == PAUSE_ITEM) && (pauseCtx->cursorSpecialPos == 0) && + if ((pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && (pauseCtx->pageIndex == PAUSE_ITEM) && + (pauseCtx->cursorSpecialPos == 0) && gPlayerFormSlotRestrictions[(void)0, gSaveContext.save.playerForm][i]) { if ((sEquipState == EQUIP_STATE_MAGIC_ARROW_HOVER_OVER_BOW_SLOT) && (i == SLOT_ARROW_ICE)) { // Possible bug: @@ -313,13 +314,14 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { // Draw the ammo digits if (pauseCtx->pageIndex == PAUSE_ITEM) { - if ((pauseCtx->state == 6) && ((pauseCtx->unk_200 == 0) || (pauseCtx->unk_200 == 3)) && - (pauseCtx->state != 7) && ((pauseCtx->state < 8) || (pauseCtx->state >= 0x13))) { + if ((pauseCtx->state == PAUSE_STATE_MAIN) && + ((pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) || (pauseCtx->mainState == PAUSE_MAIN_STATE_EQUIP_ITEM)) && + (pauseCtx->state != PAUSE_STATE_SAVEPROMPT) && !IS_PAUSE_STATE_GAMEOVER) { func_8012C628(play->state.gfxCtx); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); // Loop over slots (i) and ammoIndex (j) - for (j = 0, i = 0; i < 24; i++) { + for (j = 0, i = 0; i < NUM_ITEM_SLOTS; i++) { if (gAmmoItems[i] != ITEM_NONE) { if (((void)0, gSaveContext.save.inventory.items[i]) != ITEM_NONE) { KaleidoScope_DrawAmmoCount(pauseCtx, play->state.gfxCtx, @@ -357,8 +359,8 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { pauseCtx->cursorColorSet = PAUSE_CURSOR_COLOR_SET_WHITE; pauseCtx->nameColorSet = PAUSE_NAME_COLOR_SET_WHITE; - if ((pauseCtx->state == 6) && (pauseCtx->unk_200 == 0) && (pauseCtx->pageIndex == PAUSE_ITEM) && - !pauseCtx->itemDescriptionOn) { + if ((pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && + (pauseCtx->pageIndex == PAUSE_ITEM) && !pauseCtx->itemDescriptionOn) { moveCursorResult = PAUSE_CURSOR_RESULT_NONE; oldCursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM]; @@ -394,7 +396,7 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { pauseCtx->cursorPoint[PAUSE_ITEM] = pauseCtx->cursorXIndex[PAUSE_ITEM] + (pauseCtx->cursorYIndex[PAUSE_ITEM] * 6); - if (pauseCtx->cursorPoint[PAUSE_ITEM] >= 24) { + if (pauseCtx->cursorPoint[PAUSE_ITEM] >= NUM_ITEM_SLOTS) { pauseCtx->cursorPoint[PAUSE_ITEM] = pauseCtx->cursorXIndex[PAUSE_ITEM]; } @@ -425,7 +427,7 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { pauseCtx->cursorPoint[PAUSE_ITEM] = pauseCtx->cursorXIndex[PAUSE_ITEM] + (pauseCtx->cursorYIndex[PAUSE_ITEM] * 6); - if (pauseCtx->cursorPoint[PAUSE_ITEM] >= 24) { + if (pauseCtx->cursorPoint[PAUSE_ITEM] >= NUM_ITEM_SLOTS) { pauseCtx->cursorPoint[PAUSE_ITEM] = pauseCtx->cursorXIndex[PAUSE_ITEM]; } @@ -591,7 +593,7 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { if (cursorItem != PAUSE_ITEM_NONE) { // Equip item to the C buttons if ((pauseCtx->debugEditor == DEBUG_EDITOR_NONE) && !pauseCtx->itemDescriptionOn && - (pauseCtx->state == 6) && (pauseCtx->unk_200 == 0) && + (pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && CHECK_BTN_ANY(CONTROLLER1(&play->state)->press.button, BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT)) { // Ensure that a transformation mask can not be unequipped while being used @@ -645,7 +647,7 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { // Equip item to the C buttons pauseCtx->equipTargetItem = cursorItem; pauseCtx->equipTargetSlot = cursorSlot; - pauseCtx->unk_200 = 3; + pauseCtx->mainState = PAUSE_MAIN_STATE_EQUIP_ITEM; vtxIndex = cursorSlot * 4; pauseCtx->equipAnimX = pauseCtx->itemVtx[vtxIndex].v.ob[0] * 10; pauseCtx->equipAnimY = pauseCtx->itemVtx[vtxIndex].v.ob[1] * 10; @@ -671,9 +673,9 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { } else { play_sound(NA_SE_SY_DECIDE); } - } else if ((pauseCtx->debugEditor == DEBUG_EDITOR_NONE) && (pauseCtx->state == 6) && - (pauseCtx->unk_200 == 0) && CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) && - (msgCtx->msgLength == 0)) { + } else if ((pauseCtx->debugEditor == DEBUG_EDITOR_NONE) && (pauseCtx->state == PAUSE_STATE_MAIN) && + (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && + CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) && (msgCtx->msgLength == 0)) { // Give description on item through a message box pauseCtx->itemDescriptionOn = true; if (pauseCtx->cursorYIndex[PAUSE_ITEM] < 2) { @@ -690,7 +692,7 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_ITEM]) { play_sound(NA_SE_SY_CURSOR); } - } else if ((pauseCtx->unk_200 == 3) && (pauseCtx->pageIndex == PAUSE_ITEM)) { + } else if ((pauseCtx->mainState == PAUSE_MAIN_STATE_EQUIP_ITEM) && (pauseCtx->pageIndex == PAUSE_ITEM)) { pauseCtx->cursorColorSet = PAUSE_CURSOR_COLOR_SET_YELLOW; } } @@ -983,7 +985,7 @@ void KaleidoScope_UpdateItemEquip(PlayState* play) { } // Reset params - pauseCtx->unk_200 = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; sEquipAnimTimer = 10; pauseCtx->equipAnimScale = 320; pauseCtx->equipAnimShrinkRate = 40; diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c index 823a3d63f2..e0c82a1bb3 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c @@ -13,7 +13,7 @@ extern s16 D_8082B7F0[]; extern s16 D_8082B838[]; -extern TexturePtr D_09007500; // gPlayerFace +extern TexturePtr D_09007500; // gPlayerFaceIcon #define WORLD_MAP_IMAGE_TEX_WIDTH 216 #define WORLD_MAP_IMAGE_TEX_HEIGHT 128 @@ -168,11 +168,11 @@ void KaleidoScope_DrawDungeonMap(PlayState* play) { // Loop over dungeonItems (i) and vtxIndex (j) for (i = DUNGEON_BOSS_KEY, j = 4; i <= DUNGEON_STRAY_FAIRIES; i++, j += 4) { if (i == DUNGEON_STRAY_FAIRIES) { - if ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->unk_200 == 0)) { - // If (pauseCtx->state == 6), then the other conditions are redundant and + if ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE)) { + // If (pauseCtx->state == PAUSE_STATE_MAIN), then the other conditions are redundant and // always return true - if ((pauseCtx->state == 6) && (pauseCtx->state != 7) && - !((pauseCtx->state >= 8) && (pauseCtx->state <= 0x12))) { + if ((pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->state != PAUSE_STATE_SAVEPROMPT) && + !IS_PAUSE_STATE_GAMEOVER) { KaleidoScope_SetView(pauseCtx, 0.0f, 0.0f, 64.0f); if (!sStrayFairyIconAlphaScaleState) { @@ -264,11 +264,11 @@ void KaleidoScope_DrawDungeonMap(PlayState* play) { func_80108AF8(play); - if ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->unk_200 == 0)) { - // If (pauseCtx->state == 6), then the other conditions are redundant and always return + if ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE)) { + // If (pauseCtx->state == PAUSE_STATE_MAIN), then the other conditions are redundant and always return // true - if ((pauseCtx->state == 6) && (pauseCtx->state != 7) && - !((pauseCtx->state >= 8) && (pauseCtx->state <= 0x12))) { + if ((pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->state != PAUSE_STATE_SAVEPROMPT) && + !IS_PAUSE_STATE_GAMEOVER) { func_8012C628(play->state.gfxCtx); @@ -304,8 +304,8 @@ void KaleidoScope_UpdateDungeonCursor(PlayState* play) { s16 i; s16 oldCursorPoint; - if (pauseCtx->state == 6) { - if ((pauseCtx->unk_200 == 0) && (pauseCtx->pageIndex == PAUSE_MAP)) { + if (pauseCtx->state == PAUSE_STATE_MAIN) { + if ((pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && (pauseCtx->pageIndex == PAUSE_MAP)) { pauseCtx->cursorColorSet = PAUSE_CURSOR_COLOR_SET_WHITE; oldCursorPoint = pauseCtx->cursorPoint[PAUSE_MAP]; if (pauseCtx->stickAdjX > 30) { @@ -539,9 +539,9 @@ void KaleidoScope_DrawWorldMap(PlayState* play) { KaleidoScope_SetCursorVtx(pauseCtx, pauseCtx->cursorSlot[PAUSE_MAP] * 4, pauseCtx->mapPageVtx); // Draw the world map image - if ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->state == 6) && - ((pauseCtx->unk_200 == 0) || (pauseCtx->unk_200 == 3)) && YREG(6) && (pauseCtx->state != 7) && - !((pauseCtx->state >= 8) && (pauseCtx->state <= 0x12))) { + if ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->state == PAUSE_STATE_MAIN) && + ((pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) || (pauseCtx->mainState == PAUSE_MAIN_STATE_EQUIP_ITEM)) && + YREG(6) && (pauseCtx->state != PAUSE_STATE_SAVEPROMPT) && !IS_PAUSE_STATE_GAMEOVER) { // Draw the world map image flat // Because it is flat, the texture is loaded by filling it in 8 rows at a time. @@ -649,7 +649,7 @@ void KaleidoScope_DrawWorldMap(PlayState* play) { } } - if ((pauseCtx->state >= 0x15) && (pauseCtx->state <= 0x19)) { + if (IS_PAUSE_STATE_OWLWARP) { gDPPipeSync(POLY_OPA_DISP++); gDPSetRenderMode(POLY_OPA_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); @@ -659,7 +659,7 @@ void KaleidoScope_DrawWorldMap(PlayState* play) { func_8012C8AC(play->state.gfxCtx); - if (!((pauseCtx->state >= 0x15) && (pauseCtx->state <= 0x19))) { + if (!IS_PAUSE_STATE_OWLWARP) { // Browsing the world map regions on the pause menu gDPLoadTextureBlock(POLY_OPA_DISP++, gWorldMapDotTex, G_IM_FMT_IA, G_IM_SIZ_8b, 8, 8, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, @@ -728,10 +728,11 @@ void KaleidoScope_DrawWorldMap(PlayState* play) { } // Find and draw Player's face at the current region based on the current scene - // If (pauseCtx->state == 6), then the other pauseCtx->state conditions are redundant + // If (pauseCtx->state == PAUSE_STATE_MAIN), then the other pauseCtx->state conditions are redundant // and always return true - if ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->unk_200 == 0) && (pauseCtx->state == 6) && - (pauseCtx->state != 7) && !((pauseCtx->state >= 8) && (pauseCtx->state <= 0x12))) { + if ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && + (pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->state != PAUSE_STATE_SAVEPROMPT) && + !IS_PAUSE_STATE_GAMEOVER) { j = 0; n = 0; @@ -825,7 +826,8 @@ void KaleidoScope_UpdateWorldMapCursor(PlayState* play) { PauseContext* pauseCtx = &play->pauseCtx; s16 oldCursorPoint; - if ((pauseCtx->state == 6) && (pauseCtx->unk_200 == 0) && (pauseCtx->pageIndex == PAUSE_MAP)) { + if ((pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && + (pauseCtx->pageIndex == PAUSE_MAP)) { pauseCtx->cursorColorSet = PAUSE_CURSOR_COLOR_SET_WHITE; oldCursorPoint = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; @@ -936,7 +938,7 @@ void KaleidoScope_UpdateWorldMapCursor(PlayState* play) { if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_WORLD_MAP]) { play_sound(NA_SE_SY_CURSOR); } - } else if (pauseCtx->state == 0x17) { + } else if (pauseCtx->state == PAUSE_STATE_OWLWARP_SELECT) { pauseCtx->cursorColorSet = PAUSE_CURSOR_COLOR_SET_BLUE; oldCursorPoint = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c index 77835026ff..6e9f17843c 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c @@ -223,7 +223,7 @@ void KaleidoScope_DrawMaskSelect(PlayState* play) { if (((void)0, gSaveContext.save.inventory.items[i + NUM_ITEM_SLOTS]) != ITEM_NONE) { if (!CHECK_GIVEN_MASK_ON_MOON(i)) { - if ((pauseCtx->unk_200 == 0) && (pauseCtx->pageIndex == PAUSE_MASK) && + if ((pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && (pauseCtx->pageIndex == PAUSE_MASK) && (pauseCtx->cursorSpecialPos == 0) && gMaskPlayerFormSlotRestrictions[(void)0, gSaveContext.save.playerForm][i]) { if ((sMaskEquipState == EQUIP_STATE_MAGIC_ARROW_HOVER_OVER_BOW_SLOT) && (i == SLOT_ARROW_ICE)) { @@ -288,8 +288,8 @@ void KaleidoScope_UpdateMaskCursor(PlayState* play) { pauseCtx->cursorColorSet = PAUSE_CURSOR_COLOR_SET_WHITE; pauseCtx->nameColorSet = PAUSE_NAME_COLOR_SET_WHITE; - if ((pauseCtx->state == 6) && (pauseCtx->unk_200 == 0) && (pauseCtx->pageIndex == PAUSE_MASK) && - !pauseCtx->itemDescriptionOn) { + if ((pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && + (pauseCtx->pageIndex == PAUSE_MASK) && !pauseCtx->itemDescriptionOn) { moveCursorResult = PAUSE_CURSOR_RESULT_NONE; oldCursorPoint = pauseCtx->cursorPoint[PAUSE_MASK]; @@ -533,7 +533,7 @@ void KaleidoScope_UpdateMaskCursor(PlayState* play) { if (cursorItem != PAUSE_ITEM_NONE) { // Equip item to the C buttons if ((pauseCtx->debugEditor == DEBUG_EDITOR_NONE) && !pauseCtx->itemDescriptionOn && - (pauseCtx->state == 6) && (pauseCtx->unk_200 == 0) && + (pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && CHECK_BTN_ANY(input->press.button, BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT)) { // Ensure that a mask is not unequipped while being used @@ -585,7 +585,7 @@ void KaleidoScope_UpdateMaskCursor(PlayState* play) { // Equip item to the C buttons pauseCtx->equipTargetItem = cursorItem; pauseCtx->equipTargetSlot = cursorSlot + NUM_ITEM_SLOTS; - pauseCtx->unk_200 = 0xF; + pauseCtx->mainState = PAUSE_MAIN_STATE_EQUIP_MASK; vtxIndex = cursorSlot * 4; pauseCtx->equipAnimX = pauseCtx->maskVtx[vtxIndex].v.ob[0] * 10; pauseCtx->equipAnimY = pauseCtx->maskVtx[vtxIndex].v.ob[1] * 10; @@ -594,9 +594,9 @@ void KaleidoScope_UpdateMaskCursor(PlayState* play) { sMaskEquipState = EQUIP_STATE_MOVE_TO_C_BTN; sMaskEquipAnimTimer = 10; play_sound(NA_SE_SY_DECIDE); - } else if ((pauseCtx->debugEditor == DEBUG_EDITOR_NONE) && (pauseCtx->state == 6) && - (pauseCtx->unk_200 == 0) && CHECK_BTN_ALL(input->press.button, BTN_A) && - (msgCtx->msgLength == 0)) { + } else if ((pauseCtx->debugEditor == DEBUG_EDITOR_NONE) && (pauseCtx->state == PAUSE_STATE_MAIN) && + (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && + CHECK_BTN_ALL(input->press.button, BTN_A) && (msgCtx->msgLength == 0)) { // Give description on item through a message box pauseCtx->itemDescriptionOn = true; if (pauseCtx->cursorYIndex[PAUSE_MASK] < 2) { @@ -613,7 +613,7 @@ void KaleidoScope_UpdateMaskCursor(PlayState* play) { if (oldCursorPoint != pauseCtx->cursorPoint[PAUSE_MASK]) { play_sound(NA_SE_SY_CURSOR); } - } else if ((pauseCtx->unk_200 == 0xF) && (pauseCtx->pageIndex == PAUSE_MASK)) { + } else if ((pauseCtx->mainState == PAUSE_MAIN_STATE_EQUIP_MASK) && (pauseCtx->pageIndex == PAUSE_MASK)) { pauseCtx->cursorColorSet = PAUSE_CURSOR_COLOR_SET_YELLOW; } } @@ -796,7 +796,7 @@ void KaleidoScope_UpdateMaskEquip(PlayState* play) { } // Reset params - pauseCtx->unk_200 = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; sMaskEquipAnimTimer = 10; pauseCtx->equipAnimScale = 320; pauseCtx->equipAnimShrinkRate = 40; diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_prompt.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_prompt.c index 53453e8e78..13e233b581 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_prompt.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_prompt.c @@ -17,7 +17,9 @@ void KaleidoScope_UpdatePrompt(PlayState* play) { s8 relStickX = input->rel.stick_x; s16 alphaStep; - if (((pauseCtx->state == 7) && (pauseCtx->unk_208 == 1)) || (pauseCtx->state == 0xE) || (pauseCtx->state == 0x11)) { + if (((pauseCtx->state == PAUSE_STATE_SAVEPROMPT) && (pauseCtx->savePromptState == PAUSE_SAVEPROMPT_STATE_1)) || + (pauseCtx->state == PAUSE_STATE_GAMEOVER_SAVE_PROMPT) || + (pauseCtx->state == PAUSE_STATE_GAMEOVER_CONTINUE_PROMPT)) { // Move the prompt if ((pauseCtx->promptChoice == PAUSE_PROMPT_YES) && (relStickX >= 30)) { diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h index 14c16ddcd3..7349db241d 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h @@ -16,6 +16,86 @@ typedef enum { /* 4 */ PAUSE_WORLD_MAP } PauseMenuPage; +// Direction of pause pages +#define PAUSE_ITEM_X (0) +#define PAUSE_ITEM_Z (-1) +#define PAUSE_MAP_X (1) +#define PAUSE_MAP_Z (0) +#define PAUSE_QUEST_X (0) +#define PAUSE_QUEST_Z (1) +#define PAUSE_MASK_X (-1) +#define PAUSE_MASK_Z (0) + +#define PAUSE_EYE_DIST (64.0f) + +typedef enum { + /* 0x00 */ PAUSE_STATE_OFF, + /* 0x01 */ PAUSE_STATE_OPENING_0, + /* 0x02 */ PAUSE_STATE_OPENING_1, + /* 0x03 */ PAUSE_STATE_OPENING_2, + /* 0x04 */ PAUSE_STATE_OPENING_3, + /* 0x05 */ PAUSE_STATE_OPENING_4, + /* 0x06 */ PAUSE_STATE_MAIN, // Pause menu ready for player inputs. + /* 0x07 */ PAUSE_STATE_SAVEPROMPT, + /* 0x08 */ PAUSE_STATE_GAMEOVER_0, + /* 0x09 */ PAUSE_STATE_GAMEOVER_1, + /* 0x0A */ PAUSE_STATE_GAMEOVER_2, + /* 0x0B */ PAUSE_STATE_GAMEOVER_3, + /* 0x0C */ PAUSE_STATE_GAMEOVER_4, + /* 0x0D */ PAUSE_STATE_GAMEOVER_5, + /* 0x0E */ PAUSE_STATE_GAMEOVER_SAVE_PROMPT, + /* 0x0F */ PAUSE_STATE_GAMEOVER_7, + /* 0x10 */ PAUSE_STATE_GAMEOVER_8, + /* 0x11 */ PAUSE_STATE_GAMEOVER_CONTINUE_PROMPT, + /* 0x12 */ PAUSE_STATE_GAMEOVER_10, + /* 0x13 */ PAUSE_STATE_OWLWARP_0, + /* 0x14 */ PAUSE_STATE_OWLWARP_1, + /* 0x15 */ PAUSE_STATE_OWLWARP_2, + /* 0x16 */ PAUSE_STATE_OWLWARP_3, + /* 0x17 */ PAUSE_STATE_OWLWARP_SELECT, // Selecting the destination + /* 0x18 */ PAUSE_STATE_OWLWARP_CONFIRM, // Confirming the choice given + /* 0x19 */ PAUSE_STATE_OWLWARP_6, + /* 0x1A */ PAUSE_STATE_UNPAUSE_SETUP, // Unpause + /* 0x1B */ PAUSE_STATE_UNPAUSE_CLOSE +} PauseState; + +typedef enum { + /* 0x00 */ PAUSE_MAIN_STATE_IDLE, // Await input for the next action + /* 0x01 */ PAUSE_MAIN_STATE_SWITCHING_PAGE, + /* 0x02 */ PAUSE_MAIN_STATE_SONG_PLAYBACK, + /* 0x03 */ PAUSE_MAIN_STATE_EQUIP_ITEM, + /* 0x04 */ PAUSE_MAIN_STATE_SONG_PROMPT_INIT, + /* 0x05 */ PAUSE_MAIN_STATE_SONG_PROMPT, + /* 0x06 */ PAUSE_MAIN_STATE_SONG_PROMPT_DONE, + /* 0x07 */ PAUSE_MAIN_STATE_SONG_PROMPT_UNUSED, + /* 0x08 */ PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG, // Await input but the cursor is on a song + /* 0x09 */ PAUSE_MAIN_STATE_SONG_PLAYBACK_INIT, + /* 0x0F */ PAUSE_MAIN_STATE_EQUIP_MASK = 0xF, + /* 0x10 */ PAUSE_MAIN_STATE_BOMBERS_NOTEBOOK_OPEN, + /* 0x11 */ PAUSE_MAIN_STATE_UNK +} PauseMainState; + +typedef enum { + /* 0x00 */ PAUSE_SAVEPROMPT_STATE_0, + /* 0x01 */ PAUSE_SAVEPROMPT_STATE_1, + /* 0x02 */ PAUSE_SAVEPROMPT_STATE_2, + /* 0x03 */ PAUSE_SAVEPROMPT_STATE_3, + /* 0x04 */ PAUSE_SAVEPROMPT_STATE_4, + /* 0x05 */ PAUSE_SAVEPROMPT_STATE_5, + /* 0x06 */ PAUSE_SAVEPROMPT_STATE_6, + /* 0x07 */ PAUSE_SAVEPROMPT_STATE_7 +} PauseSavePromptState; + +#define IS_PAUSE_STATE_GAMEOVER \ + ((pauseCtx->state >= PAUSE_STATE_GAMEOVER_0) && (pauseCtx->state <= PAUSE_STATE_GAMEOVER_10)) + +#define IS_PAUSE_STATE_OWLWARP \ + ((pauseCtx->state >= PAUSE_STATE_OWLWARP_2) && (pauseCtx->state <= PAUSE_STATE_OWLWARP_6)) + +#define IS_PAUSE_MAIN_STATE_SAVE_PROMPT \ + ((pauseCtx->mainState >= PAUSE_MAIN_STATE_SONG_PROMPT_INIT) && \ + (pauseCtx->mainState <= PAUSE_MAIN_STATE_SONG_PROMPT_DONE)) + typedef enum { /* 0 */ PAUSE_EQUIP_C_LEFT, /* 1 */ PAUSE_EQUIP_C_DOWN, @@ -36,6 +116,15 @@ typedef enum { /* 3 */ DEBUG_EDITOR_EVENTS } DebugEditor; +typedef enum { + /* 0 */ PAUSE_BG_PRERENDER_OFF, + /* 1 */ PAUSE_BG_PRERENDER_SETUP, // The current frame is only drawn for the purpose of serving as the pause background. + /* 2 */ PAUSE_BG_PRERENDER_PROCESS, // The previous frame was PAUSE_BG_PRERENDER_DRAW, now apply prerender filters. + /* 3 */ PAUSE_BG_PRERENDER_DONE, // The pause background is ready to be used. + /* 4 */ PAUSE_BG_PRERENDER_UNK4, + /* 5 */ PAUSE_BG_PRERENDER_MAX +} PauseBgPreRenderState; + #define PAUSE_NAME_COLOR_SET_WHITE 0 #define PAUSE_NAME_COLOR_SET_GREY 1 @@ -70,7 +159,7 @@ void KaleidoScope_UpdateWorldMapCursor(PlayState* play); // Collect void KaleidoScope_DrawQuestStatus(PlayState* play); -void KaleidoScope_UpdateQuestCursor(PlayState* play); +void KaleidoScope_UpdateQuestCursor(PlayState* play); // Item void KaleidoScope_SetCursorVtx(PauseContext* pauseCtx, u16 index, Vtx* vtx); diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c index a322fda1f3..77f0a37c4f 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c @@ -5,6 +5,7 @@ */ #include "z_kaleido_scope.h" +#include "overlays/gamestates/ovl_opening/z_opening.h" #include "z64view.h" extern UNK_TYPE D_02001360; @@ -17,6 +18,8 @@ extern UNK_TYPE D_0B000000; extern UNK_TYPE D_0C000000; extern UNK_TYPE D_0C006C00; +extern u8 sUnpausedButtonStatus[5]; + void* D_8082B700[] = { 0x08064440, 0x0806E440, 0x08077A40, 0x08081040, 0x0808A640, 0x0D003A00, 0x0806EE40, 0x08078440, 0x08081A40, 0x0808B040, 0x08065840, 0x0806F840, 0x08078E40, 0x08082440, 0x0808BA40, @@ -45,42 +48,62 @@ s16 D_8082B838[] = { 0x0008, 0x0008, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, 0x000C, }; -s16 D_8082B880 = 0; -s16 D_8082B884 = 0; -s16 D_8082B888 = 0; -s16 D_8082B88C = 255; -s16 D_8082B890 = 0; -s16 D_8082B894 = 0; -s16 D_8082B898 = 0; -s16 D_8082B89C = 0; -s16 D_8082B8A0 = 0; -s16 D_8082B8A4 = 0; -s16 D_8082B8A8 = 255; -s16 D_8082B8AC = 0; -s16 D_8082B8B0 = 0; +s16 sGameOverPrimR = 0; +s16 sGameOverPrimG = 0; +s16 sGameOverPrimB = 0; +s16 sGameOverPrimAlpha = 255; +s16 sCursorPrimR = 0; +s16 sCursorPrimG = 0; +s16 sCursorPrimB = 0; +s16 sCursorEnvR = 0; +s16 sCursorEnvG = 0; +s16 sCursorEnvB = 0; +s16 sGameOverEnvR = 255; +s16 sGameOverEnvG = 0; +s16 sGameOverEnvB = 0; -s16 D_8082B8B4 = false; +s16 sInDungeonScene = false; -f32 D_8082B8B8[] = { - -4.0f, 4.0f, 4.0f, 4.0f, 4.0f, -4.0f, -4.0f, -4.0f, +f32 sPageSwitchEyeDx[] = { + -PAUSE_EYE_DIST * (PAUSE_MAP_X - PAUSE_ITEM_X) / 16, // From PAUSE_ITEM to PAUSE_MAP (switching right) + -PAUSE_EYE_DIST*(PAUSE_MASK_X - PAUSE_ITEM_X) / 16, // From PAUSE_ITEM to PAUSE_MASK (switching left) + -PAUSE_EYE_DIST*(PAUSE_QUEST_X - PAUSE_MAP_X) / 16, // From PAUSE_MAP to PAUSE_QUEST (switching right) + -PAUSE_EYE_DIST*(PAUSE_ITEM_X - PAUSE_MAP_X) / 16, // From PAUSE_MAP to PAUSE_ITEM (switching left) + -PAUSE_EYE_DIST*(PAUSE_MASK_X - PAUSE_QUEST_X) / 16, // From PAUSE_QUEST to PAUSE_MASK (switching right) + -PAUSE_EYE_DIST*(PAUSE_MAP_X - PAUSE_QUEST_X) / 16, // From PAUSE_QUEST to PAUSE_MAP (switching left) + -PAUSE_EYE_DIST*(PAUSE_ITEM_X - PAUSE_MASK_X) / 16, // From PAUSE_MASK to PAUSE_ITEM (switching right) + -PAUSE_EYE_DIST*(PAUSE_QUEST_X - PAUSE_MASK_X) / 16, // From PAUSE_MASK to PAUSE_QUEST (switching left) }; -f32 D_8082B8D8[] = { - -4.0f, -4.0f, -4.0f, 4.0f, 4.0f, 4.0f, 4.0f, -4.0f, +f32 sPageSwitchEyeDz[] = { + -PAUSE_EYE_DIST * (PAUSE_MAP_Z - PAUSE_ITEM_Z) / 16, // From PAUSE_ITEM to PAUSE_MAP (switching right) + -PAUSE_EYE_DIST*(PAUSE_MASK_Z - PAUSE_ITEM_Z) / 16, // From PAUSE_ITEM to PAUSE_MASK (switching left) + -PAUSE_EYE_DIST*(PAUSE_QUEST_Z - PAUSE_MAP_Z) / 16, // From PAUSE_MAP to PAUSE_QUEST (switching right) + -PAUSE_EYE_DIST*(PAUSE_ITEM_Z - PAUSE_MAP_Z) / 16, // From PAUSE_MAP to PAUSE_ITEM (switching left) + -PAUSE_EYE_DIST*(PAUSE_MASK_Z - PAUSE_QUEST_Z) / 16, // From PAUSE_QUEST to PAUSE_MASK (switching right) + -PAUSE_EYE_DIST*(PAUSE_MAP_Z - PAUSE_QUEST_Z) / 16, // From PAUSE_QUEST to PAUSE_MAP (switching left) + -PAUSE_EYE_DIST*(PAUSE_ITEM_Z - PAUSE_MASK_Z) / 16, // From PAUSE_MASK to PAUSE_ITEM (switching right) + -PAUSE_EYE_DIST*(PAUSE_QUEST_Z - PAUSE_MASK_Z) / 16, // From PAUSE_MASK to PAUSE_QUEST (switching left) }; -s16 D_8082B8F8[] = { - PAUSE_MAP, PAUSE_MASK, PAUSE_QUEST, PAUSE_ITEM, PAUSE_MASK, PAUSE_MAP, PAUSE_ITEM, PAUSE_QUEST, +u16 sPageSwitchNextPageIndex[] = { + PAUSE_MAP, // From PAUSE_ITEM (switching right) + PAUSE_MASK, // From PAUSE_ITEM (switching left) + PAUSE_QUEST, // From PAUSE_MAP (switching right) + PAUSE_ITEM, // From PAUSE_MAP (switching left) + PAUSE_MASK, // From PAUSE_QUEST (switching right) + PAUSE_MAP, // From PAUSE_QUEST (switching left) + PAUSE_ITEM, // From PAUSE_MASK (switching right) + PAUSE_QUEST, // From PAUSE_MASK (switching left) }; -f32 D_8082B908 = 0.0f; +f32 sPauseMenuVerticalOffset = 0.0f; f32 D_8082B90C = 0.0f; -f32 D_8082B910 = 40.0f; -f32 D_8082B914 = -40.0f; +f32 sPauseCursorLeftMoveOffsetX = 40.0f; +f32 sPauseCursorRightMoveOffsetX = -40.0f; -s32 D_8082B918 = 0; - -s32 D_8082B91C = 0; +s16 sPauseCursorLeftX = 0; +s16 sPauseCursorRightX = 0; s16 D_8082B920 = 10; @@ -89,7 +112,8 @@ u8 D_8082B924[] = { 0x07, 0x07, 0x03, 0x0F, 0x07, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0x1F, 0x0F, 0x03, 0x0F, 0x00, 0x00, }; -s16 D_8082B944 = 0x42; +// TODO: Also applies to owl warps +s16 sGameOverRectPosY = 66; s16 D_8082B948[][3] = { { 0x00FF, 0x00FF, 0x00FF }, { 0x00FF, 0x00FF, 0x00FF }, { 0x00FF, 0x00FF, 0x0000 }, @@ -436,31 +460,17 @@ f32 D_8082BE28[] = { s16 D_8082BE84 = 0; -s16 D_8082BE88[] = { - 0x001C, 0x001D, 0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, -}; +void func_80821900(void* segment, u32 texIndex) { + func_80178E3C(SEGMENT_ROM_START(map_name_static), texIndex, segment, 0x400); +} -s32 D_8082BE9C = 0; +void func_8082192C(void* segment, u32 texIndex) { + func_80178E3C(SEGMENT_ROM_START(map_name_static), texIndex, segment, 0xA00); +} -s32 D_8082BEA0 = 0; - -s16 D_8082BEA4 = 10; - -s32 D_8082BEA8 = 0; - -s32 D_8082BEAC = 0; - -s32 D_8082BEB0 = 0; - -s32 D_8082BEB4 = 0; - -s32 D_8082BEB8[] = { 0, 0 }; - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80821900.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8082192C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80821958.s") +void func_80821958(void* segment, u32 texIndex) { + func_80178E3C(SEGMENT_ROM_START(item_name_static), texIndex, segment, 0x400); +} #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/KaleidoScope_MoveCursorToSpecialPos.s") @@ -470,7 +480,8 @@ s32 D_8082BEB8[] = { 0, 0 }; #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80821CC4.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80821D84.s") +void KaleidoScope_HandlePageToggles(PlayState* play, Input* input); +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/KaleidoScope_HandlePageToggles.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80821F30.s") @@ -478,15 +489,18 @@ s32 D_8082BEB8[] = { 0, 0 }; #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80823350.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80824738.s") +void KaleidoScope_UpdateNamePanel(PlayState* play); +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/KaleidoScope_UpdateNamePanel.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_808248D0.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80824B90.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_808256E4.s") +void KaleidoScope_UpdateOwlWarpNamePanel(PlayState* play); +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/KaleidoScope_UpdateOwlWarpNamePanel.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8082585C.s") +void KaleidoScope_UpdateSwitchPage(PlayState* play, Input* input); +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/KaleidoScope_UpdateSwitchPage.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/KaleidoScope_SetView.s") @@ -502,8 +516,964 @@ s32 D_8082BEB8[] = { 0, 0 }; #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/KaleidoScope_Draw.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_808286D8.s") +void KaleidoScope_GrayOutTextureRGBA32(u32* texture, u16 pixelCount); +#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/KaleidoScope_GrayOutTextureRGBA32.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80828788.s") +void KaleidoScope_UpdateOpening(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/KaleidoScope_Update.s") + pauseCtx->eye.x += sPageSwitchEyeDx[pauseCtx->nextPageMode] * 2.0f; + pauseCtx->eye.z += sPageSwitchEyeDz[pauseCtx->nextPageMode] * 2.0f; + pauseCtx->switchPageTimer += 8; + + if (pauseCtx->switchPageTimer == 64) { + // Finished opening + func_80112C0C(play, 1); + + if (pauseCtx->cursorSpecialPos == 0) { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = D_801C6A98[pauseCtx->pageIndex][0]; + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = D_801C6A98[pauseCtx->pageIndex][1]; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = D_801C6A98[pauseCtx->pageIndex][1]; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = D_801C6A98[pauseCtx->pageIndex][1]; + gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_ENABLED; + } else { + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = BTN_DISABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_DISABLED; + } + + pauseCtx->pageIndex = sPageSwitchNextPageIndex[pauseCtx->nextPageMode]; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; + pauseCtx->state++; // PAUSE_STATE_MAIN + pauseCtx->alpha = 255; + func_80115844(play, 3); + } else if (pauseCtx->switchPageTimer == 64) { + pauseCtx->pageIndex = sPageSwitchNextPageIndex[pauseCtx->nextPageMode]; + pauseCtx->nextPageMode = (pauseCtx->pageIndex * 2) + 1; + } +} + +void KaleidoScope_Update(PlayState* play) { + static u16 sCursorPointsToOcarinaModes[] = { + 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, + }; + static s16 sUnpausedHudVisibility = HUD_VISIBILITY_IDLE; + static s16 sNextMainState = PAUSE_MAIN_STATE_IDLE; + static s16 sDelayTimer = 10; + static s16 sGameOverColorTimer = 0; + static s16 sStickXRepeatTimer = 0; + static s16 sStickYRepeatTimer = 0; + static s16 sStickXRepeatState = 0; + static s16 sStickYRepeatState = 0; + PauseContext* pauseCtx = &play->pauseCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + MessageContext* msgCtx = &play->msgCtx; + GameOverContext* gameOverCtx = &play->gameOverCtx; + SramContext* sramCtx = &play->sramCtx; + Input* input = CONTROLLER1(&play->state); + size_t size0; + size_t size1; + size_t size2; + u16 itemId; + u16 worldMapCursorPoint; + void* iconItemLangSegment; + s16 stepR; + s16 stepG; + s16 stepB; + s16 stepA; + s16 stickAdjX = input->rel.stick_x; + + func_80109428(play); + + pauseCtx->stickAdjX = input->rel.stick_x; + pauseCtx->stickAdjY = input->rel.stick_y; + + switch (pauseCtx->state) { + case PAUSE_STATE_OPENING_2: + sUnpausedHudVisibility = gSaveContext.hudVisibility; + sPauseMenuVerticalOffset = -6240.0f; + + sUnpausedButtonStatus[EQUIP_SLOT_B] = gSaveContext.buttonStatus[EQUIP_SLOT_B]; + sUnpausedButtonStatus[EQUIP_SLOT_C_LEFT] = gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT]; + sUnpausedButtonStatus[EQUIP_SLOT_C_DOWN] = gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN]; + sUnpausedButtonStatus[EQUIP_SLOT_C_RIGHT] = gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT]; + sUnpausedButtonStatus[EQUIP_SLOT_A] = gSaveContext.buttonStatus[EQUIP_SLOT_A]; + + pauseCtx->cursorXIndex[PAUSE_MAP] = 0; + pauseCtx->cursorSlot[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + DUNGEON_FLOOR_INDEX_4; + pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->unk_256 = R_REVERSE_FLOOR_INDEX + DUNGEON_FLOOR_INDEX_4; + + sPauseCursorLeftX = -175; + sPauseCursorRightX = 155; + pauseCtx->roll = -314.0f; + + pauseCtx->iconItemSegment = (void*)ALIGN16((uintptr_t)play->objectCtx.spaceStart); + size0 = SEGMENT_ROM_SIZE(icon_item_static_old); + func_80178E7C((uintptr_t)SEGMENT_ROM_START(icon_item_static_test), pauseCtx->iconItemSegment, size0); + + gSegments[0x08] = PHYSICAL_TO_VIRTUAL(pauseCtx->iconItemSegment); + + for (itemId = 0; itemId <= ITEM_BOW_ARROW_FIRE; itemId++) { + if (!gPlayerFormItemRestrictions[(void)0, gSaveContext.save.playerForm][(s32)itemId]) { + KaleidoScope_GrayOutTextureRGBA32(Lib_SegmentedToVirtual(gItemIcons[(s32)itemId]), 0x400); + } + } + + pauseCtx->iconItem24Segment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemSegment + size0); + size1 = SEGMENT_ROM_SIZE(icon_item_24_static_old); + func_80178E7C((uintptr_t)SEGMENT_ROM_START(icon_item_24_static_test), pauseCtx->iconItem24Segment, size1); + + pauseCtx->iconItemAltSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItem24Segment + size1); + if (func_8010A0A4(play)) { + size_t size = SEGMENT_ROM_SIZE(icon_item_dungeon_static); + + DmaMgr_SendRequest0(pauseCtx->iconItemAltSegment, SEGMENT_ROM_START(icon_item_dungeon_static), size); + iconItemLangSegment = + func_801068FC(play, (void*)ALIGN16((uintptr_t)pauseCtx->iconItemAltSegment + size), size); + sInDungeonScene = true; + } else { + size_t size; + + sInDungeonScene = false; + size = SEGMENT_ROM_SIZE(icon_item_field_static); + DmaMgr_SendRequest0(pauseCtx->iconItemAltSegment, _icon_item_field_staticSegmentRomStart, size); + iconItemLangSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemAltSegment + size); + } + + pauseCtx->iconItemLangSegment = iconItemLangSegment; + size2 = SEGMENT_ROM_SIZE(icon_item_jpn_static); + DmaMgr_SendRequest0(pauseCtx->iconItemLangSegment, SEGMENT_ROM_START(icon_item_jpn_static), size2); + + pauseCtx->nameSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemLangSegment + size2); + func_8011552C(play, 0x15); + if (((void)0, gSaveContext.worldMapArea) < 0x16) { + func_8082192C(pauseCtx->nameSegment + 0x400, ((void)0, gSaveContext.worldMapArea)); + } + + pauseCtx->iconItemVtxSegment = (void*)ALIGN16((uintptr_t)pauseCtx->nameSegment + 0xA00); + DmaMgr_SendRequest0(pauseCtx->iconItemVtxSegment, SEGMENT_ROM_START(icon_item_vtx_static), + SEGMENT_ROM_SIZE(icon_item_vtx_static)); + + pauseCtx->unk_2B6 = 255; + pauseCtx->unk_2B7 = 255; + pauseCtx->unk_2B8 = 255; + pauseCtx->state = PAUSE_STATE_OPENING_3; + break; + + case PAUSE_STATE_OPENING_3: + pauseCtx->infoPanelOffsetY += 10; + pauseCtx->itemPageRoll = pauseCtx->mapPageRoll = pauseCtx->questPageRoll = pauseCtx->maskPageRoll -= 40.0f; + + interfaceCtx->startAlpha += 63; + sPauseCursorLeftX += (s16)(sPauseCursorLeftMoveOffsetX / 4); + sPauseCursorRightX += (s16)(sPauseCursorRightMoveOffsetX / 4); + pauseCtx->alpha += 31; + if (pauseCtx->itemPageRoll == 0) { + interfaceCtx->startAlpha = 255; + sPauseMenuVerticalOffset = 0.0f; + pauseCtx->state = PAUSE_STATE_OPENING_4; + } + + KaleidoScope_UpdateOpening(play); + break; + + case PAUSE_STATE_OPENING_4: + pauseCtx->alpha += 31; + KaleidoScope_UpdateOpening(play); + + if (pauseCtx->state == PAUSE_STATE_MAIN) { + KaleidoScope_UpdateNamePanel(play); + } + break; + + case PAUSE_STATE_MAIN: + switch (pauseCtx->mainState) { + case PAUSE_MAIN_STATE_IDLE: + if (!pauseCtx->itemDescriptionOn && + (CHECK_BTN_ALL(input->press.button, BTN_START) || CHECK_BTN_ALL(input->press.button, BTN_B))) { + func_8011552C(play, 0xA); + pauseCtx->state = PAUSE_STATE_UNPAUSE_SETUP; + sPauseMenuVerticalOffset = -6240.0f; + func_801A3AEC(0); + } + break; + + case PAUSE_MAIN_STATE_SWITCHING_PAGE: + KaleidoScope_UpdateSwitchPage(play, input); + break; + + case PAUSE_MAIN_STATE_SONG_PLAYBACK: + // Song is in playback + pauseCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff(); + if (pauseCtx->ocarinaStaff->state == 0) { + // Song playback is finished, give song prompt to player + pauseCtx->mainState = PAUSE_MAIN_STATE_SONG_PROMPT_INIT; + AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); + } + break; + + case PAUSE_MAIN_STATE_EQUIP_ITEM: + KaleidoScope_UpdateItemEquip(play); + break; + + case PAUSE_MAIN_STATE_SONG_PROMPT_INIT: + break; + + case PAUSE_MAIN_STATE_SONG_PROMPT: + pauseCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff(); + + if (CHECK_BTN_ALL(input->press.button, BTN_START) || CHECK_BTN_ALL(input->press.button, BTN_B)) { + // Abort having the player play the song and close the pause menu + AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); + func_8011552C(play, 0xA); + pauseCtx->state = PAUSE_STATE_UNPAUSE_SETUP; + sPauseMenuVerticalOffset = -6240.0f; + func_801A3AEC(0); + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; + } else if (pauseCtx->ocarinaStaff->state == pauseCtx->ocarinaSongIndex) { + // The player successfully played the song + play_sound(NA_SE_SY_TRE_BOX_APPEAR); + sNextMainState = PAUSE_MAIN_STATE_IDLE; + sDelayTimer = 30; + pauseCtx->mainState = PAUSE_MAIN_STATE_SONG_PROMPT_DONE; + } else if (pauseCtx->ocarinaStaff->state == 0xFF) { + // The player failed to play the song + play_sound(NA_SE_SY_OCARINA_ERROR); + sNextMainState = PAUSE_MAIN_STATE_SONG_PROMPT_INIT; + sDelayTimer = 20; + pauseCtx->mainState = PAUSE_MAIN_STATE_SONG_PROMPT_DONE; + } + break; + + case PAUSE_MAIN_STATE_SONG_PROMPT_DONE: + sDelayTimer--; + if (sDelayTimer == 0) { + pauseCtx->mainState = sNextMainState; + if (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) { + AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); + } + } + break; + + case PAUSE_MAIN_STATE_SONG_PROMPT_UNUSED: + break; + + case PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG: + if (CHECK_BTN_ALL(input->press.button, BTN_START) || CHECK_BTN_ALL(input->press.button, BTN_B)) { + AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); + func_8011552C(play, 0xA); + pauseCtx->state = PAUSE_STATE_UNPAUSE_SETUP; + sPauseMenuVerticalOffset = -6240.0f; + func_801A3AEC(0); + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; + } + break; + + case PAUSE_MAIN_STATE_SONG_PLAYBACK_INIT: + break; + + case PAUSE_MAIN_STATE_EQUIP_MASK: + KaleidoScope_UpdateMaskEquip(play); + break; + + case PAUSE_MAIN_STATE_BOMBERS_NOTEBOOK_OPEN: + if (!play->pauseCtx.bombersNotebookOpen) { + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; + } + break; + + default: + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; + break; + } + break; + + case PAUSE_STATE_SAVEPROMPT: + switch (pauseCtx->savePromptState) { + case PAUSE_SAVEPROMPT_STATE_0: + pauseCtx->roll -= 78.5f; + sPauseCursorLeftX -= (s16)(sPauseCursorLeftMoveOffsetX / 4); + sPauseCursorRightX -= (s16)(sPauseCursorRightMoveOffsetX / 4); + if (pauseCtx->roll <= -628.0f) { + pauseCtx->roll = -628.0f; + pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_1; + } + break; + + case PAUSE_SAVEPROMPT_STATE_1: + if (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_CUP)) { + if (pauseCtx->promptChoice != PAUSE_PROMPT_YES) { + func_8011552C(play, 0xA); + pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_2; + } else { + play_sound(NA_SE_SY_PIECE_OF_HEART); + Play_SaveCycleSceneFlags(&play->state); + gSaveContext.save.playerData.savedSceneId = play->sceneId; + func_8014546C(sramCtx); + if (gSaveContext.unk_3F3F == 0) { + pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_5; + } else { + func_80147008(sramCtx, D_801C67C8[gSaveContext.fileNum], + D_801C67F0[gSaveContext.fileNum]); + func_80147020(sramCtx); + pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_4; + } + sDelayTimer = 90; + } + } else if (CHECK_BTN_ALL(input->press.button, BTN_START)) { + func_8011552C(play, 0xA); + pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_3; + sPauseMenuVerticalOffset = -6240.0f; + D_8082B90C = pauseCtx->roll; + func_801A3AEC(0); + } else if (CHECK_BTN_ALL(input->press.button, BTN_B)) { + func_8011552C(play, 0xA); + pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_2; + D_8082B90C = pauseCtx->roll; + } + break; + + case PAUSE_SAVEPROMPT_STATE_4: + if (sramCtx->status == 0) { + pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_5; + } + break; + + case PAUSE_SAVEPROMPT_STATE_5: + if (CHECK_BTN_ALL(input->press.button, BTN_B) || CHECK_BTN_ALL(input->press.button, BTN_A) || + CHECK_BTN_ALL(input->press.button, BTN_START) || (--sDelayTimer == 0)) { + func_8011552C(play, 0xA); + pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_3; + sPauseMenuVerticalOffset = -6240.0f; + D_8082B90C = pauseCtx->roll; + func_801A3AEC(0); + } + break; + + case PAUSE_SAVEPROMPT_STATE_3: + case PAUSE_SAVEPROMPT_STATE_7: + if (pauseCtx->roll != (D_8082B90C + 160.0f)) { + pauseCtx->itemPageRoll = pauseCtx->mapPageRoll = pauseCtx->questPageRoll = + pauseCtx->maskPageRoll += 40.0f; + pauseCtx->roll += 40.0f; + pauseCtx->infoPanelOffsetY -= 10; + sPauseCursorLeftX -= (s16)(sPauseCursorLeftMoveOffsetX / 4); + sPauseCursorRightX -= (s16)(sPauseCursorRightMoveOffsetX / 4); + pauseCtx->alpha -= 63; + if (pauseCtx->roll == (D_8082B90C + 160.0f)) { + pauseCtx->alpha = 0; + } + } else { + pauseCtx->debugEditor = DEBUG_EDITOR_NONE; + pauseCtx->state = PAUSE_STATE_UNPAUSE_CLOSE; + pauseCtx->itemPageRoll = pauseCtx->mapPageRoll = pauseCtx->questPageRoll = + pauseCtx->maskPageRoll = 160.0f; + pauseCtx->roll = -434.0f; + pauseCtx->namedItem = PAUSE_ITEM_NONE; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; + } + break; + + case PAUSE_SAVEPROMPT_STATE_2: + pauseCtx->roll += 78.5f; + sPauseCursorLeftX += (s16)(sPauseCursorLeftMoveOffsetX / 4); + sPauseCursorRightX += (s16)(sPauseCursorRightMoveOffsetX / 4); + if (pauseCtx->roll >= -314.0f) { + pauseCtx->state = PAUSE_STATE_MAIN; + pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_0; + pauseCtx->roll = -314.0f; + pauseCtx->itemPageRoll = pauseCtx->mapPageRoll = pauseCtx->questPageRoll = + pauseCtx->maskPageRoll = 0.0f; + func_8011552C(play, 0x15); + gSaveContext.buttonStatus[EQUIP_SLOT_B] = D_801C6A98[pauseCtx->pageIndex + 1][0]; + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = D_801C6A98[pauseCtx->pageIndex + 1][1]; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = D_801C6A98[pauseCtx->pageIndex + 1][1]; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = D_801C6A98[pauseCtx->pageIndex + 1][1]; + if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) || + (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT)) { + KaleidoScope_MoveCursorToSpecialPos(play, pauseCtx->cursorSpecialPos); + } else { + func_80821A04(play); + } + } + break; + + case PAUSE_SAVEPROMPT_STATE_6: + if (interfaceCtx->unk_264 != 255) { + interfaceCtx->unk_264 += 10; + if (interfaceCtx->unk_264 >= 255) { + interfaceCtx->unk_264 = 255; + pauseCtx->state = PAUSE_STATE_OFF; + Game_SetFramerateDivisor(&play->state, 3); + R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_UNK4; + Object_LoadAll(&play->objectCtx); + BgCheck_InitCollisionHeaders(&play->colCtx, play); + STOP_GAMESTATE(&play->state); + SET_NEXT_GAMESTATE(&play->state, TitleSetup_Init, sizeof(TitleSetupState)); + func_801A4058(0x14); + gSaveContext.seqId = (u8)NA_BGM_DISABLED; + gSaveContext.ambienceId = AMBIENCE_ID_DISABLED; + } + } + break; + } + break; + + case PAUSE_STATE_GAMEOVER_2: + pauseCtx->cursorSlot[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + DUNGEON_FLOOR_INDEX_4; + pauseCtx->cursorPoint[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + DUNGEON_FLOOR_INDEX_4; + sPauseCursorLeftX = -175; + sPauseCursorRightX = 155; + pauseCtx->roll = -434.0f; + Interface_SetHudVisibility(HUD_VISIBILITY_NONE); + + pauseCtx->iconItemSegment = + (void*)(((uintptr_t)play->objectCtx.spaceStart + 0x30) & ~0x3F); // Messed up ALIGN64 + size0 = SEGMENT_ROM_SIZE(icon_item_static_old); + func_80178E7C(SEGMENT_ROM_START(icon_item_static_test), pauseCtx->iconItemSegment, size0); + + pauseCtx->iconItem24Segment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemSegment + size0); + size1 = SEGMENT_ROM_SIZE(icon_item_24_static_old); + func_80178E7C(SEGMENT_ROM_START(icon_item_24_static_test), pauseCtx->iconItem24Segment, size1); + + pauseCtx->iconItemAltSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItem24Segment + size1); + size2 = SEGMENT_ROM_SIZE(icon_item_gameover_static); + DmaMgr_SendRequest0(pauseCtx->iconItemAltSegment, SEGMENT_ROM_START(icon_item_gameover_static), size2); + + pauseCtx->iconItemLangSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemAltSegment + size2); + DmaMgr_SendRequest0(pauseCtx->iconItemLangSegment, SEGMENT_ROM_START(icon_item_jpn_static), + SEGMENT_ROM_SIZE(icon_item_jpn_static)); + + gSaveContext.timerStates[TIMER_ID_MOON_CRASH] = TIMER_STATE_OFF; + + sGameOverPrimR = 255; + sGameOverPrimG = 130; + sGameOverPrimB = 0; + sGameOverPrimAlpha = 0; + sGameOverEnvR = 30; + sGameOverEnvG = 0; + sGameOverEnvB = 0; + sGameOverRectPosY = 98; + sGameOverColorTimer = 30; + + pauseCtx->promptChoice = PAUSE_PROMPT_YES; + pauseCtx->state++; + if (gameOverCtx->state == GAMEOVER_INACTIVE) { + pauseCtx->state++; + } + break; + + case PAUSE_STATE_GAMEOVER_3: + stepR = ABS_ALT(sGameOverPrimR - 30) / sGameOverColorTimer; + stepG = ABS_ALT(sGameOverPrimG - 0) / sGameOverColorTimer; + stepB = ABS_ALT(sGameOverPrimB - 0) / sGameOverColorTimer; + stepA = ABS_ALT(sGameOverPrimAlpha - 255) / sGameOverColorTimer; + if (sGameOverPrimR >= 30) { + sGameOverPrimR -= stepR; + } else { + sGameOverPrimR += stepR; + } + if (sGameOverPrimG >= 0) { + sGameOverPrimG -= stepG; + } else { + sGameOverPrimG += stepG; + } + if (sGameOverPrimB >= 0) { + sGameOverPrimB -= stepB; + } else { + sGameOverPrimB += stepB; + } + if (sGameOverPrimAlpha >= 255) { + sGameOverPrimAlpha -= stepA; + } else { + sGameOverPrimAlpha += stepA; + } + + stepR = ABS_ALT(sGameOverEnvR - 255) / sGameOverColorTimer; + stepG = ABS_ALT(sGameOverEnvG - 130) / sGameOverColorTimer; + stepB = ABS_ALT(sGameOverEnvB - 0) / sGameOverColorTimer; + if (sGameOverEnvR >= 255) { + sGameOverEnvR -= stepR; + } else { + sGameOverEnvR += stepR; + } + if (sGameOverEnvG >= 130) { + sGameOverEnvG -= stepG; + } else { + sGameOverEnvG += stepG; + } + if (sGameOverEnvB >= 0) { + sGameOverEnvB -= stepB; + } else { + sGameOverEnvB += stepB; + } + + sGameOverColorTimer--; + if (sGameOverColorTimer == 0) { + sGameOverPrimR = 30; + sGameOverPrimG = 0; + sGameOverPrimB = 0; + sGameOverPrimAlpha = 255; + + sGameOverEnvR = 255; + sGameOverEnvG = 130; + sGameOverEnvB = 0; + + sGameOverColorTimer = 40; + pauseCtx->state++; + } + break; + + case PAUSE_STATE_GAMEOVER_4: + sGameOverColorTimer--; + if (sGameOverColorTimer == 0) { + pauseCtx->state = PAUSE_STATE_GAMEOVER_5; + } + break; + + case PAUSE_STATE_GAMEOVER_5: + pauseCtx->infoPanelOffsetY += 10; + pauseCtx->roll -= 40.0f; + pauseCtx->itemPageRoll = pauseCtx->mapPageRoll = pauseCtx->questPageRoll = pauseCtx->maskPageRoll = + pauseCtx->roll; + interfaceCtx->startAlpha += 63; + sGameOverRectPosY -= 3; + sPauseCursorLeftX += (s16)(sPauseCursorLeftMoveOffsetX / 4); + sPauseCursorRightX += (s16)(sPauseCursorRightMoveOffsetX / 4); + pauseCtx->alpha += 31; + if (pauseCtx->roll < -628.0f) { + pauseCtx->roll = -628.0f; + interfaceCtx->startAlpha = 255; + sGameOverRectPosY = 66; + sPauseMenuVerticalOffset = 0.0f; + pauseCtx->alpha = 255; + if (gameOverCtx->state == GAMEOVER_INACTIVE) { + pauseCtx->state = PAUSE_STATE_GAMEOVER_SAVE_PROMPT; + } else { + pauseCtx->state = PAUSE_STATE_GAMEOVER_CONTINUE_PROMPT; + } + } + break; + + case PAUSE_STATE_GAMEOVER_SAVE_PROMPT: + if (CHECK_BTN_ALL(input->press.button, BTN_A)) { + if (pauseCtx->promptChoice != PAUSE_PROMPT_YES) { + pauseCtx->promptChoice = PAUSE_PROMPT_YES; + play_sound(NA_SE_SY_DECIDE); + pauseCtx->state = PAUSE_STATE_OFF; + Game_SetFramerateDivisor(&play->state, 3); + R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_UNK4; + Object_LoadAll(&play->objectCtx); + BgCheck_InitCollisionHeaders(&play->colCtx, play); + } else { + play_sound(NA_SE_SY_PIECE_OF_HEART); + pauseCtx->promptChoice = PAUSE_PROMPT_YES; + Play_SaveCycleSceneFlags(&play->state); + gSaveContext.save.playerData.savedSceneId = play->sceneId; + gSaveContext.save.playerData.health = 0x30; + func_8014546C(sramCtx); + if (gSaveContext.unk_3F3F == 0) { + pauseCtx->state = PAUSE_STATE_GAMEOVER_8; + } else { + func_80147008(sramCtx, D_801C67C8[gSaveContext.fileNum], D_801C67F0[gSaveContext.fileNum]); + func_80147020(sramCtx); + pauseCtx->state = PAUSE_STATE_GAMEOVER_7; + } + sDelayTimer = 90; + } + } else if ((pauseCtx->promptChoice == PAUSE_PROMPT_YES) && (stickAdjX >= 30)) { + play_sound(NA_SE_SY_CURSOR); + pauseCtx->promptChoice = PAUSE_PROMPT_NO; + } else if ((pauseCtx->promptChoice != PAUSE_PROMPT_YES) && (stickAdjX <= -30)) { + play_sound(NA_SE_SY_CURSOR); + pauseCtx->promptChoice = PAUSE_PROMPT_YES; + } + break; + + case PAUSE_STATE_GAMEOVER_7: + if (sramCtx->status == 0) { + pauseCtx->state = PAUSE_STATE_OFF; + Game_SetFramerateDivisor(&play->state, 3); + R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_UNK4; + Object_LoadAll(&play->objectCtx); + BgCheck_InitCollisionHeaders(&play->colCtx, play); + } + break; + + case PAUSE_STATE_GAMEOVER_8: + sDelayTimer--; + if (sDelayTimer == 0) { + pauseCtx->state = PAUSE_STATE_GAMEOVER_CONTINUE_PROMPT; + gameOverCtx->state++; + } else if ((sDelayTimer <= 80) && + (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_START))) { + pauseCtx->state = PAUSE_STATE_GAMEOVER_CONTINUE_PROMPT; + gameOverCtx->state++; + func_801A3AEC(0); + } + break; + + case PAUSE_STATE_GAMEOVER_CONTINUE_PROMPT: + if (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_START)) { + if (pauseCtx->promptChoice == PAUSE_PROMPT_YES) { + play_sound(NA_SE_SY_PIECE_OF_HEART); + Play_SaveCycleSceneFlags(&play->state); + if (gSaveContext.save.entrance == ENTRANCE(UNSET_0D, 0)) {} + } else { // PAUSE_PROMPT_NO + play_sound(NA_SE_SY_DECIDE); + } + pauseCtx->state = PAUSE_STATE_GAMEOVER_10; + } + break; + + case PAUSE_STATE_GAMEOVER_10: + if (interfaceCtx->unk_264 != 255) { + interfaceCtx->unk_264 += 10; + if (interfaceCtx->unk_264 >= 255) { + interfaceCtx->unk_264 = 255; + + pauseCtx->state = PAUSE_STATE_OFF; + Game_SetFramerateDivisor(&play->state, 3); + R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_UNK4; + Object_LoadAll(&play->objectCtx); + BgCheck_InitCollisionHeaders(&play->colCtx, play); + + if (pauseCtx->promptChoice == PAUSE_PROMPT_YES) { + func_80169FDC(&play->state); + gSaveContext.respawnFlag = -2; + gSaveContext.nextTransitionType = TRANS_TYPE_02; + gSaveContext.save.playerData.health = 0x30; + Audio_SetSpec(0xA); + gSaveContext.healthAccumulator = 0; + gSaveContext.magicState = MAGIC_STATE_IDLE; + gSaveContext.magicFlag = 0; + gSaveContext.magicCapacity = 0; + gSaveContext.magicFillTarget = gSaveContext.save.playerData.magic; + gSaveContext.save.playerData.magicLevel = 0; + gSaveContext.save.playerData.magic = 0; + } else { // PAUSE_PROMPT_NO + STOP_GAMESTATE(&play->state); + SET_NEXT_GAMESTATE(&play->state, TitleSetup_Init, sizeof(TitleSetupState)); + } + } + } + break; + + case PAUSE_STATE_OWLWARP_2: + sPauseMenuVerticalOffset = -6240.0f; + + sUnpausedButtonStatus[EQUIP_SLOT_B] = gSaveContext.buttonStatus[EQUIP_SLOT_B]; + sUnpausedButtonStatus[EQUIP_SLOT_C_LEFT] = gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT]; + sUnpausedButtonStatus[EQUIP_SLOT_C_DOWN] = gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN]; + sUnpausedButtonStatus[EQUIP_SLOT_C_RIGHT] = gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT]; + sUnpausedButtonStatus[EQUIP_SLOT_A] = gSaveContext.buttonStatus[EQUIP_SLOT_A]; + + pauseCtx->cursorXIndex[PAUSE_MAP] = 0; + pauseCtx->cursorSlot[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + DUNGEON_FLOOR_INDEX_4; + pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->unk_256 = R_REVERSE_FLOOR_INDEX + DUNGEON_FLOOR_INDEX_4; + + sPauseCursorLeftX = -175; + sPauseCursorRightX = 155; + + pauseCtx->iconItemSegment = (void*)ALIGN16((uintptr_t)play->objectCtx.spaceStart); + size0 = SEGMENT_ROM_SIZE(icon_item_static_old); + func_80178E7C(SEGMENT_ROM_START(icon_item_static_test), pauseCtx->iconItemSegment, size0); + + pauseCtx->iconItemAltSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemSegment + size0); + sInDungeonScene = false; + size1 = SEGMENT_ROM_SIZE(icon_item_field_static); + DmaMgr_SendRequest0(pauseCtx->iconItemAltSegment, SEGMENT_ROM_START(icon_item_field_static), size1); + + pauseCtx->iconItemLangSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemAltSegment + size1); + size2 = SEGMENT_ROM_SIZE(icon_item_jpn_static); + DmaMgr_SendRequest0(pauseCtx->iconItemLangSegment, SEGMENT_ROM_START(icon_item_jpn_static), size2); + + pauseCtx->nameSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemLangSegment + size2); + func_8011552C(play, 0x16); + worldMapCursorPoint = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; + func_80821900(pauseCtx->nameSegment, worldMapCursorPoint); + + pauseCtx->iconItemVtxSegment = (void*)ALIGN16((uintptr_t)pauseCtx->nameSegment + 0xA00); + DmaMgr_SendRequest0(pauseCtx->iconItemVtxSegment, SEGMENT_ROM_START(icon_item_vtx_static), + SEGMENT_ROM_SIZE(icon_item_vtx_static)); + + pauseCtx->state = PAUSE_STATE_OWLWARP_3; + sGameOverRectPosY = 98; + pauseCtx->promptChoice = PAUSE_PROMPT_YES; + break; + + case PAUSE_STATE_OWLWARP_3: + R_PAUSE_OWLWARP_ALPHA += 20; + pauseCtx->infoPanelOffsetY += 10; + pauseCtx->mapPageRoll -= 40.0f; + interfaceCtx->startAlpha += 63; + sGameOverRectPosY -= 3; + sPauseCursorLeftX += (s16)(sPauseCursorLeftMoveOffsetX / 4); + sPauseCursorRightX += (s16)(sPauseCursorRightMoveOffsetX / 4); + pauseCtx->alpha += 31; + + if (pauseCtx->mapPageRoll == 0) { + interfaceCtx->startAlpha = 255; + sPauseMenuVerticalOffset = 0.0f; + pauseCtx->alpha = 255; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; + pauseCtx->cursorSpecialPos = 0; + pauseCtx->state = PAUSE_STATE_OWLWARP_SELECT; + R_PAUSE_OWLWARP_ALPHA = 120; + } + break; + + case PAUSE_STATE_OWLWARP_SELECT: + if (CHECK_BTN_ALL(input->press.button, BTN_START) || CHECK_BTN_ALL(input->press.button, BTN_B)) { + func_8011552C(play, 0xA); + pauseCtx->state = PAUSE_STATE_OWLWARP_6; + sPauseMenuVerticalOffset = -6240.0f; + func_801A3AEC(0); + play->msgCtx.ocarinaMode = 4; + gSaveContext.prevHudVisibility = HUD_VISIBILITY_ALL; + } else if (CHECK_BTN_ALL(input->press.button, BTN_A)) { + play_sound(NA_SE_SY_DECIDE); + Message_StartTextbox(play, 0x1B93, NULL); + pauseCtx->state = PAUSE_STATE_OWLWARP_CONFIRM; + } else { + KaleidoScope_UpdateOwlWarpNamePanel(play); + } + break; + + case PAUSE_STATE_OWLWARP_CONFIRM: + if (CHECK_BTN_ALL(input->press.button, BTN_A)) { + msgCtx->msgLength = 0; + msgCtx->msgMode = 0; + if (msgCtx->choiceIndex == 0) { + func_8011552C(play, 0xA); + pauseCtx->state = PAUSE_STATE_OWLWARP_6; + sPauseMenuVerticalOffset = -6240.0f; + func_801A3AEC(0); + play->msgCtx.ocarinaMode = sCursorPointsToOcarinaModes[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]; + play_sound(NA_SE_SY_DECIDE); + } else { + pauseCtx->state = PAUSE_STATE_OWLWARP_SELECT; + func_8011552C(play, 0x16); + play_sound(NA_SE_SY_MESSAGE_PASS); + } + } else if (CHECK_BTN_ALL(input->press.button, BTN_B)) { + msgCtx->msgLength = 0; + msgCtx->msgMode = 0; + pauseCtx->state = PAUSE_STATE_OWLWARP_SELECT; + play_sound(NA_SE_SY_MESSAGE_PASS); + } else if (CHECK_BTN_ALL(input->press.button, BTN_START)) { + msgCtx->msgLength = 0; + msgCtx->msgMode = 0; + func_8011552C(play, 0xA); + pauseCtx->state = PAUSE_STATE_OWLWARP_6; + sPauseMenuVerticalOffset = -6240.0f; + func_801A3AEC(0); + play->msgCtx.ocarinaMode = 4; + gSaveContext.prevHudVisibility = HUD_VISIBILITY_ALL; + } + break; + + case PAUSE_STATE_OWLWARP_6: + if (pauseCtx->mapPageRoll != 160.0f) { + R_PAUSE_OWLWARP_ALPHA -= 60; + if (R_PAUSE_OWLWARP_ALPHA <= 0) { + R_PAUSE_OWLWARP_ALPHA = 0; + } + pauseCtx->infoPanelOffsetY -= 10; + pauseCtx->mapPageRoll += 40.0f; + interfaceCtx->startAlpha -= 63; + sPauseCursorLeftX -= (s16)(sPauseCursorLeftMoveOffsetX / 4); + sPauseCursorRightX -= (s16)(sPauseCursorRightMoveOffsetX / 4); + pauseCtx->alpha -= 63; + if (pauseCtx->mapPageRoll == 160.0f) { + pauseCtx->alpha = 0; + } + } else { + pauseCtx->debugEditor = DEBUG_EDITOR_NONE; + pauseCtx->state = PAUSE_STATE_UNPAUSE_CLOSE; + pauseCtx->itemPageRoll = pauseCtx->mapPageRoll = pauseCtx->questPageRoll = pauseCtx->maskPageRoll = + 160.0f; + pauseCtx->namedItem = PAUSE_ITEM_NONE; + interfaceCtx->startAlpha = 0; + pauseCtx->pageIndex = pauseCtx->unk_2C8; + pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = pauseCtx->unk_2CA; + } + break; + + case PAUSE_STATE_UNPAUSE_SETUP: + if (pauseCtx->itemPageRoll != 160.0f) { + pauseCtx->infoPanelOffsetY -= 10; + pauseCtx->itemPageRoll = pauseCtx->mapPageRoll = pauseCtx->questPageRoll = pauseCtx->maskPageRoll += + 40.0f; + interfaceCtx->startAlpha -= 63; + sPauseCursorLeftX -= (s16)(sPauseCursorLeftMoveOffsetX / 4); + sPauseCursorRightX -= (s16)(sPauseCursorRightMoveOffsetX / 4); + pauseCtx->alpha -= 63; + if (pauseCtx->itemPageRoll == 160.0f) { + pauseCtx->alpha = 0; + } + } else { + pauseCtx->debugEditor = DEBUG_EDITOR_NONE; + pauseCtx->state = PAUSE_STATE_UNPAUSE_CLOSE; + pauseCtx->maskPageRoll = 160.0f; + pauseCtx->questPageRoll = 160.0f; + pauseCtx->mapPageRoll = 160.0f; + pauseCtx->itemPageRoll = 160.0f; + pauseCtx->namedItem = PAUSE_ITEM_NONE; + interfaceCtx->startAlpha = 0; + } + break; + + case PAUSE_STATE_UNPAUSE_CLOSE: + pauseCtx->state = PAUSE_STATE_OFF; + Game_SetFramerateDivisor(&play->state, 3); + R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_UNK4; + Object_LoadAll(&play->objectCtx); + BgCheck_InitCollisionHeaders(&play->colCtx, play); + + gSaveContext.buttonStatus[EQUIP_SLOT_B] = sUnpausedButtonStatus[EQUIP_SLOT_B]; + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = sUnpausedButtonStatus[EQUIP_SLOT_C_LEFT]; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = sUnpausedButtonStatus[EQUIP_SLOT_C_DOWN]; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = sUnpausedButtonStatus[EQUIP_SLOT_C_RIGHT]; + gSaveContext.buttonStatus[EQUIP_SLOT_A] = sUnpausedButtonStatus[EQUIP_SLOT_A]; + + func_80110038(play); + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); + MsgEvent_SendNullTask(); + func_80143324(play, &play->skyboxCtx, play->skyboxId); + + if ((msgCtx->msgMode != 0) && (msgCtx->currentTextId == 0xFF)) { + func_80115844(play, 0x12); + func_8011552C(play, 0x12); + Interface_SetHudVisibility(HUD_VISIBILITY_A_B_C); + } else { + interfaceCtx->unk_222 = interfaceCtx->unk_224 = 0; + } + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + Interface_SetHudVisibility(sUnpausedHudVisibility); + func_801A3A7C(0); + break; + } + + // If stickAdj is held, set a delay to allow the cursor to read the next input. + // The first delay is given a longer time than all subsequent delays. + if (!IS_PAUSE_STATE_GAMEOVER && (pauseCtx->state != PAUSE_STATE_SAVEPROMPT)) { + if (pauseCtx->stickAdjX < -30) { + if (sStickXRepeatState == -1) { + sStickXRepeatTimer--; + if (sStickXRepeatTimer < 0) { + // Allow the input to register and apply the delay for all subsequent repeated inputs + sStickXRepeatTimer = 2; + } else { + // Cancel the current input + pauseCtx->stickAdjX = 0; + } + } else { + // Allow the input to register and apply the delay for the first repeated input + sStickXRepeatTimer = 10; + sStickXRepeatState = -1; + } + } else if (pauseCtx->stickAdjX > 30) { + if (sStickXRepeatState == 1) { + sStickXRepeatTimer--; + if (sStickXRepeatTimer < 0) { + // Allow the input to register and apply the delay for all subsequent repeated inputs + sStickXRepeatTimer = 2; + } else { + // Cancel the current input + pauseCtx->stickAdjX = 0; + } + } else { + // Allow the input to register and apply the delay for the first repeated input + sStickXRepeatTimer = 10; + sStickXRepeatState = 1; + } + } else { + sStickXRepeatState = 0; + } + + if (pauseCtx->stickAdjY < -30) { + if (sStickYRepeatState == -1) { + sStickYRepeatTimer--; + if (sStickYRepeatTimer < 0) { + // Allow the input to register and apply the delay for all subsequent repeated inputs + sStickYRepeatTimer = 2; + } else { + // Cancel the current input + pauseCtx->stickAdjY = 0; + } + } else { + // Allow the input to register and apply the delay for the first repeated input + sStickYRepeatTimer = 10; + sStickYRepeatState = -1; + } + } else if (pauseCtx->stickAdjY > 30) { + if (sStickYRepeatState == 1) { + sStickYRepeatTimer--; + if (sStickYRepeatTimer < 0) { + // Allow the input to register and apply the delay for all subsequent repeated inputs + sStickYRepeatTimer = 2; + } else { + // Cancel the current input + pauseCtx->stickAdjY = 0; + } + } else { + // Allow the input to register and apply the delay for the first repeated input + sStickYRepeatTimer = 10; + sStickYRepeatState = 1; + } + } else { + sStickYRepeatState = 0; + } + } + + // Process the Cursor input + if ((R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_DONE) && (pauseCtx->debugEditor == DEBUG_EDITOR_NONE) && + !IS_PAUSE_STATE_OWLWARP && + (((pauseCtx->state >= PAUSE_STATE_OPENING_3) && (pauseCtx->state <= PAUSE_STATE_SAVEPROMPT)) || + ((pauseCtx->state >= PAUSE_STATE_GAMEOVER_2) && (pauseCtx->state <= PAUSE_STATE_UNPAUSE_SETUP)))) { + if (!IS_PAUSE_STATE_GAMEOVER) { + switch (pauseCtx->pageIndex) { + case PAUSE_ITEM: + KaleidoScope_UpdateItemCursor(play); + break; + + case PAUSE_MAP: + if (sInDungeonScene) { + KaleidoScope_UpdateDungeonCursor(play); + } else { + KaleidoScope_UpdateWorldMapCursor(play); + } + break; + + case PAUSE_QUEST: + KaleidoScope_UpdateQuestCursor(play); + break; + + case PAUSE_MASK: + KaleidoScope_UpdateMaskCursor(play); + break; + } + + if ((pauseCtx->state == PAUSE_STATE_MAIN) && + ((pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG))) { + KaleidoScope_HandlePageToggles(play, input); + } + } + if (pauseCtx->state == PAUSE_STATE_MAIN) { + KaleidoScope_UpdateNamePanel(play); + } + } else if (pauseCtx->state == PAUSE_STATE_OWLWARP_SELECT) { + KaleidoScope_UpdateWorldMapCursor(play); + KaleidoScope_UpdateNamePanel(play); + } + + // Update the inventory editor + if ((pauseCtx->debugEditor == DEBUG_EDITOR_INVENTORY_INIT) || (pauseCtx->debugEditor == DEBUG_EDITOR_INVENTORY)) { + KaleidoScope_UpdateInventoryEditor(play); + } +} diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 75317a3fb7..0e450dfa26 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -4225,15 +4225,15 @@ 0x80821A04:("func_80821A04",), 0x80821AD4:("KaleidoScope_DrawTexQuadRGBA32",), 0x80821CC4:("func_80821CC4",), - 0x80821D84:("func_80821D84",), + 0x80821D84:("KaleidoScope_HandlePageToggles",), 0x80821F30:("func_80821F30",), 0x808221DC:("func_808221DC",), 0x80823350:("func_80823350",), - 0x80824738:("func_80824738",), + 0x80824738:("KaleidoScope_UpdateNamePanel",), 0x808248D0:("func_808248D0",), 0x80824B90:("func_80824B90",), - 0x808256E4:("func_808256E4",), - 0x8082585C:("func_8082585C",), + 0x808256E4:("KaleidoScope_UpdateOwlWarpNamePanel",), + 0x8082585C:("KaleidoScope_UpdateSwitchPage",), 0x808259D4:("KaleidoScope_SetView",), 0x80825A50:("func_80825A50",), 0x80825E28:("func_80825E28",), @@ -4241,8 +4241,8 @@ 0x80827A8C:("func_80827A8C",), 0x80827E08:("func_80827E08",), 0x808283D8:("KaleidoScope_Draw",), - 0x808286D8:("func_808286D8",), - 0x80828788:("func_80828788",), + 0x808286D8:("KaleidoScope_GrayOutTextureRGBA32",), + 0x80828788:("KaleidoScope_UpdateOpening",), 0x8082895C:("KaleidoScope_Update",), 0x8082DA90:("func_8082DA90",), 0x8082DABC:("func_8082DABC",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 3530c456bd..5edd9d8010 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -971,9 +971,9 @@ 0x801BDACC:("D_801BDACC","UNK_TYPE4","",0x4), 0x801BDAF0:("D_801BDAF0","UNK_TYPE4","",0x4), 0x801BDAF8:("D_801BDAF8","UNK_TYPE4","",0x4), - 0x801BDB00:("D_801BDB00","UNK_TYPE1","",0x1), - 0x801BDB08:("sKaleidoSetupEyeX","UNK_TYPE1","",0x1), - 0x801BDB18:("sKaleidoSetupEyeZ","UNK_TYPE1","",0x1), + 0x801BDB00:("sKaleidoSetupRightPageIndex","UNK_TYPE1","",0x1), + 0x801BDB08:("sKaleidoSetupRightPageEyeX","UNK_TYPE1","",0x1), + 0x801BDB18:("sKaleidoSetupRightPageEyeZ","UNK_TYPE1","",0x1), 0x801BDB30:("kanfontOrdering","u8","[92]",0x5c), 0x801BDB90:("D_801BDB90","f32","",0x4), 0x801BDB94:("D_801BDB94","UNK_TYPE4","",0x4), @@ -1356,7 +1356,7 @@ 0x801C20C8:("gItemPrices","UNK_TYPE1","",0x1), 0x801C212C:("gSceneIdsPerRegion","SceneIdList","[]",0x252), 0x801C2380:("sSceneIdsPerTingleMap","u16","[]",0x90), - 0x801C2410:("D_801C2410","UNK_TYPE1","",0x1), + 0x801C2410:("gPlayerFormItemRestrictions","UNK_TYPE1","",0x1), 0x801C2650:("tatlMessageFiles","RomFile","[2]",0x10), 0x801C2660:("sceneTextureFiles","RomFile","[9]",0x48), 0x801C26A8:("sceneHeaderFuncTable","scene_header_func","[31]",0x7c), @@ -4743,32 +4743,32 @@ 0x8082B7B4:("D_8082B7B4","UNK_TYPE1","",0x1), 0x8082B7F0:("D_8082B7F0","UNK_TYPE2","",0x2), 0x8082B838:("D_8082B838","UNK_TYPE2","",0x2), - 0x8082B880:("D_8082B880","UNK_TYPE2","",0x2), - 0x8082B884:("D_8082B884","UNK_TYPE2","",0x2), - 0x8082B888:("D_8082B888","UNK_TYPE2","",0x2), - 0x8082B88C:("D_8082B88C","UNK_TYPE2","",0x2), - 0x8082B890:("D_8082B890","UNK_TYPE2","",0x2), - 0x8082B894:("D_8082B894","UNK_TYPE2","",0x2), - 0x8082B898:("D_8082B898","UNK_TYPE2","",0x2), - 0x8082B89C:("D_8082B89C","UNK_TYPE2","",0x2), - 0x8082B8A0:("D_8082B8A0","UNK_TYPE2","",0x2), - 0x8082B8A4:("D_8082B8A4","UNK_TYPE2","",0x2), - 0x8082B8A8:("D_8082B8A8","UNK_TYPE2","",0x2), - 0x8082B8AC:("D_8082B8AC","UNK_TYPE2","",0x2), - 0x8082B8B0:("D_8082B8B0","UNK_TYPE2","",0x2), - 0x8082B8B4:("D_8082B8B4","UNK_TYPE2","",0x2), - 0x8082B8B8:("D_8082B8B8","UNK_TYPE1","",0x1), - 0x8082B8D8:("D_8082B8D8","UNK_TYPE1","",0x1), - 0x8082B8F8:("D_8082B8F8","UNK_TYPE1","",0x1), - 0x8082B908:("D_8082B908","f32","",0x4), + 0x8082B880:("sGameOverPrimR","UNK_TYPE2","",0x2), + 0x8082B884:("sGameOverPrimG","UNK_TYPE2","",0x2), + 0x8082B888:("sGameOverPrimB","UNK_TYPE2","",0x2), + 0x8082B88C:("sGameOverPrimAlpha","UNK_TYPE2","",0x2), + 0x8082B890:("sCursorPrimR","UNK_TYPE2","",0x2), + 0x8082B894:("sCursorPrimG","UNK_TYPE2","",0x2), + 0x8082B898:("sCursorPrimB","UNK_TYPE2","",0x2), + 0x8082B89C:("sCursorEnvR","UNK_TYPE2","",0x2), + 0x8082B8A0:("sCursorEnvG","UNK_TYPE2","",0x2), + 0x8082B8A4:("sCursorEnvB","UNK_TYPE2","",0x2), + 0x8082B8A8:("sGameOverEnvR","UNK_TYPE2","",0x2), + 0x8082B8AC:("sGameOverEnvG","UNK_TYPE2","",0x2), + 0x8082B8B0:("sGameOverEnvB","UNK_TYPE2","",0x2), + 0x8082B8B4:("sInDungeonScene","UNK_TYPE2","",0x2), + 0x8082B8B8:("sPageSwitchEyeDx","UNK_TYPE1","",0x1), + 0x8082B8D8:("sPageSwitchEyeDz","UNK_TYPE1","",0x1), + 0x8082B8F8:("sPageSwitchNextPageIndex","UNK_TYPE1","",0x1), + 0x8082B908:("sPauseMenuVerticalOffset","f32","",0x4), 0x8082B90C:("D_8082B90C","f32","",0x4), - 0x8082B910:("D_8082B910","f32","",0x4), - 0x8082B914:("D_8082B914","f32","",0x4), - 0x8082B918:("D_8082B918","UNK_TYPE2","",0x2), - 0x8082B91C:("D_8082B91C","UNK_TYPE2","",0x2), + 0x8082B910:("sPauseCursorLeftMoveOffsetX","f32","",0x4), + 0x8082B914:("sPauseCursorRightMoveOffsetX","f32","",0x4), + 0x8082B918:("sPauseCursorLeftX","UNK_TYPE2","",0x2), + 0x8082B91C:("sPauseCursorRightX","UNK_TYPE2","",0x2), 0x8082B920:("D_8082B920","UNK_TYPE2","",0x2), 0x8082B924:("D_8082B924","UNK_TYPE2","",0x2), - 0x8082B944:("D_8082B944","UNK_TYPE2","",0x2), + 0x8082B944:("sGameOverRectPosY","UNK_TYPE2","",0x2), 0x8082B948:("D_8082B948","UNK_TYPE2","",0x2), 0x8082B96C:("D_8082B96C","UNK_TYPE2","",0x2), 0x8082B990:("D_8082B990","UNK_TYPE2","",0x2), @@ -4823,15 +4823,15 @@ 0x8082BDCC:("D_8082BDCC","UNK_TYPE1","",0x1), 0x8082BE28:("D_8082BE28","UNK_TYPE1","",0x1), 0x8082BE84:("D_8082BE84","UNK_TYPE2","",0x2), - 0x8082BE88:("D_8082BE88","UNK_TYPE1","",0x1), - 0x8082BE9C:("D_8082BE9C","UNK_TYPE2","",0x2), - 0x8082BEA0:("D_8082BEA0","UNK_TYPE2","",0x2), - 0x8082BEA4:("D_8082BEA4","UNK_TYPE2","",0x2), - 0x8082BEA8:("D_8082BEA8","UNK_TYPE2","",0x2), - 0x8082BEAC:("D_8082BEAC","UNK_TYPE2","",0x2), - 0x8082BEB0:("D_8082BEB0","UNK_TYPE2","",0x2), - 0x8082BEB4:("D_8082BEB4","UNK_TYPE2","",0x2), - 0x8082BEB8:("D_8082BEB8","UNK_TYPE2","",0x2), + 0x8082BE88:("sCursorPointsToOcarinaModes","UNK_TYPE1","",0x1), + 0x8082BE9C:("sUnpausedHudVisibility","UNK_TYPE2","",0x2), + 0x8082BEA0:("sNextMainState","UNK_TYPE2","",0x2), + 0x8082BEA4:("sDelayTimer","UNK_TYPE2","",0x2), + 0x8082BEA8:("sGameOverColorTimer","UNK_TYPE2","",0x2), + 0x8082BEAC:("sStickXRepeatTimer","UNK_TYPE2","",0x2), + 0x8082BEB0:("sStickYRepeatTimer","UNK_TYPE2","",0x2), + 0x8082BEB4:("sStickXRepeatState","UNK_TYPE2","",0x2), + 0x8082BEB8:("sStickYRepeatState","UNK_TYPE2","",0x2), 0x8082BEC0:("D_8082BEC0","char","[]",0x1), 0x8082BEC4:("D_8082BEC4","char","[]",0x1), 0x8082BED0:("D_8082BED0","char","[]",0x1), @@ -4948,7 +4948,7 @@ 0x8082DA52:("D_8082DA52","UNK_TYPE1","",0x1), 0x8082DA54:("D_8082DA54","UNK_TYPE1","",0x1), 0x8082DA56:("D_8082DA56","UNK_TYPE1","",0x1), - 0x8082DA58:("D_8082DA58","UNK_TYPE1","",0x1), + 0x8082DA58:("sUnpausedButtonStatus","UNK_TYPE1","",0x1), 0x8082DA60:("D_8082DA60","f32","",0x4), 0x8082DA64:("D_8082DA64","f32","",0x4), 0x8082DA68:("D_8082DA68","f32","",0x4),