diff --git a/assets/xml/interface/icon_item_vtx_static.xml b/assets/xml/interface/icon_item_vtx_static.xml new file mode 100644 index 0000000000..37ccb0063c --- /dev/null +++ b/assets/xml/interface/icon_item_vtx_static.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/include/variables.h b/include/variables.h index 4e35590772..e7dc43da0e 100644 --- a/include/variables.h +++ b/include/variables.h @@ -600,7 +600,7 @@ extern UNK_PTR D_801C5CB0; // extern UNK_TYPE2 D_801C6A8C; // extern UNK_TYPE2 D_801C6A90; // extern UNK_TYPE2 D_801C6A94; -extern u8 D_801C6A98[5][5]; +extern u8 gPageSwitchNextButtonStatus[6][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 05aad655e3..12738f9a7d 100644 --- a/include/z64.h +++ b/include/z64.h @@ -200,7 +200,7 @@ typedef struct { /* 0x204 */ u16 pageIndex; /* 0x206 */ u16 switchPageTimer; /* 0x208 */ u16 savePromptState; - /* 0x20C */ f32 unk_20C; + /* 0x20C */ f32 unk_20C; // set to 936.0f, unused remnant from OoT /* 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 @@ -216,7 +216,7 @@ typedef struct { /* 0x24C */ s16 cursorYIndex[5]; /* 0x256 */ s16 unk_256; // Uses DungeonItem enum /* 0x258 */ s16 cursorSpecialPos; - /* 0x25A */ s16 pageSwitchTimer; + /* 0x25A */ s16 pageSwitchInputTimer; // Used to introduce a delay before switching page when arriving on the "scroll left/right" positions while holding stick left/right. /* 0x25C */ u16 namedItem; /* 0x25E */ u16 cursorItem[5]; /* 0x268 */ u16 cursorSlot[5]; @@ -227,15 +227,15 @@ typedef struct { /* 0x27A */ s16 equipAnimY; /* 0x27C */ s16 equipAnimAlpha; /* 0x27E */ s16 infoPanelOffsetY; - /* 0x280 */ u16 unk_280; + /* 0x280 */ u16 nameDisplayTimer; /* 0x282 */ u16 nameColorSet; /* 0x284 */ s16 cursorColorSet; - /* 0x286 */ s16 unk_286; - /* 0x288 */ f32 unk_288; - /* 0x28C */ f32 unk_28C; - /* 0x290 */ f32 unk_290; - /* 0x294 */ f32 unk_294; - /* 0x298 */ f32 unk_298; + /* 0x286 */ s16 cursorSpinPhase; + /* 0x288 */ f32 cursorX; + /* 0x28C */ f32 cursorY; + /* 0x290 */ f32 cursorWidth; + /* 0x294 */ f32 cursorHeight; + /* 0x298 */ f32 cursorShrinkRate; /* 0x29C */ s16 promptChoice; // save/continue choice: 0 = yes; 4 = no /* 0x29E */ s16 promptAlpha; /* 0x2A0 */ s16 ocarinaSongIndex; diff --git a/spec b/spec index 9bfbc750c4..a4e38cc6f5 100644 --- a/spec +++ b/spec @@ -325,7 +325,8 @@ beginseg name "icon_item_vtx_static" compress romalign 0x1000 - include "build/baserom/icon_item_vtx_static.o" + include "build/assets/interface/icon_item_vtx_static/icon_item_vtx_static.o" + number 11 endseg beginseg @@ -692,8 +693,7 @@ beginseg include "build/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.o" include "build/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_prompt.o" include "build/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.o" - include "build/data/ovl_kaleido_scope/ovl_kaleido_scope.bss.o" - include "build/data/ovl_kaleido_scope/ovl_kaleido_scope.reloc.o" + include "build/src/overlays/kaleido_scope/ovl_kaleido_scope/ovl_kaleido_scope_reloc.o" endseg beginseg diff --git a/src/code/z_actor.c b/src/code/z_actor.c index e86a341fd0..3d98c8f46b 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -849,17 +849,12 @@ void TitleCard_Draw(GameState* gameState, TitleCardContext* titleCtx) { if (titleCtx->alpha != 0) { s32 width = titleCtx->width; s32 height = titleCtx->height; - s32 unk1; - s32 spC0; - s32 sp38; - s32 spB8; - s32 spB4; - s32 temp; - - temp = width * 2; - spC0 = (titleCtx->x * 4) - temp; - spB8 = (titleCtx->y * 4) - (height * 2); - sp38 = width * 2; + s32 doubleWidth = width * 2; + s32 titleX = (titleCtx->x * 4) - doubleWidth; + s32 doubleHeight = height * 2; + s32 titleY = (titleCtx->y * 4) - doubleHeight; + s32 titleSecondY; + s32 textureLanguageOffset; OPEN_DISPS(gameState->gfxCtx); @@ -867,29 +862,30 @@ void TitleCard_Draw(GameState* gameState, TitleCardContext* titleCtx) { height = TMEM_SIZE / width; } - spB4 = spB8 + (height * 4); + titleSecondY = titleY + (height * 4); OVERLAY_DISP = Gfx_SetupDL52_NoCD(OVERLAY_DISP); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, (u8)titleCtx->intensity, (u8)titleCtx->intensity, (u8)titleCtx->intensity, (u8)titleCtx->alpha); - gDPLoadTextureBlock(OVERLAY_DISP++, (s32*)titleCtx->texture, G_IM_FMT_IA, G_IM_SIZ_8b, width, height, 0, + gDPLoadTextureBlock(OVERLAY_DISP++, titleCtx->texture, G_IM_FMT_IA, G_IM_SIZ_8b, width, height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(OVERLAY_DISP++, spC0, spB8, ((sp38 * 2) + spC0) - 4, spB8 + (height * 4) - 1, + gSPTextureRectangle(OVERLAY_DISP++, titleX, titleY, ((doubleWidth * 2) + titleX) - 4, titleY + (height * 4) - 1, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); height = titleCtx->height - height; + // If texture is bigger than 0x1000, display the rest if (height > 0) { - gDPLoadTextureBlock(OVERLAY_DISP++, (s32)titleCtx->texture + 0x1000, G_IM_FMT_IA, G_IM_SIZ_8b, width, + gDPLoadTextureBlock(OVERLAY_DISP++, (uintptr_t)titleCtx->texture + 0x1000, G_IM_FMT_IA, G_IM_SIZ_8b, width, height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(OVERLAY_DISP++, spC0, spB4, ((sp38 * 2) + spC0) - 4, spB4 + (height * 4) - 1, - G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + gSPTextureRectangle(OVERLAY_DISP++, titleX, titleSecondY, ((doubleWidth * 2) + titleX) - 4, + titleSecondY + (height * 4) - 1, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); } CLOSE_DISPS(gameState->gfxCtx); diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index 59fde2f2d6..d0f7571251 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -40,13 +40,13 @@ void KaleidoScopeCall_Update(PlayState* play) { if (ShrinkWindow_Letterbox_GetSize() == 0) { R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP; pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; - pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_0; + pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_APPEARING; pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; } } 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->savePromptState = PAUSE_SAVEPROMPT_STATE_APPEARING; pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; } else if ((pauseCtx->state == PAUSE_STATE_OPENING_1) || (pauseCtx->state == PAUSE_STATE_GAMEOVER_1) || (pauseCtx->state == PAUSE_STATE_OWLWARP_1)) { diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 148aad84e8..130fa88db8 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -145,7 +145,7 @@ void KaleidoSetup_Init(PlayState* play) { pauseCtx->cursorPoint[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + (DUNGEON_FLOOR_INDEX_4 - 1); pauseCtx->cursorSpecialPos = PAUSE_CURSOR_PAGE_RIGHT; - pauseCtx->pageSwitchTimer = 0; + pauseCtx->pageSwitchInputTimer = 0; pauseCtx->cursorItem[PAUSE_ITEM] = PAUSE_ITEM_NONE; pauseCtx->cursorItem[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + (DUNGEON_FLOOR_INDEX_4 - 1); 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 75c031c0af..1b8511b50d 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 @@ -13,7 +13,7 @@ extern TexturePtr D_08061000; // gBombersNotebookIconTex extern TexturePtr D_08062000; // gSongNoteIconTex s16 sQuestRemainsColorTimerInit[] = { 120, 60, 2, 80 }; -s16 sQuestHpColorTimerInit[] = { 20, 4, 20, 10 }; +s16 sQuestHpColorTimerInits[] = { 20, 4, 20, 10 }; s16 sQuestSongPlayedOcarinaButtonsNum = 0; u8 sQuestSongPlayedOcarinaButtons[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; s16 sQuestSongPlayedOcarinaButtonsAlpha[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -313,7 +313,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play) { sQuestHpPrimGreen = sQuestHpPrimColorTargets[sQuestHpPrimColorTargetIndex][1]; sQuestHpPrimBlue = sQuestHpPrimColorTargets[sQuestHpPrimColorTargetIndex][2]; sQuestHpPrimAlpha = sQuestHpPrimColorTargets[sQuestHpPrimColorTargetIndex][3]; - sQuestHpColorTimer = sQuestHpColorTimerInit[sQuestHpPrimColorTargetIndex]; + sQuestHpColorTimer = sQuestHpColorTimerInits[sQuestHpPrimColorTargetIndex]; if (++sQuestHpPrimColorTargetIndex > 3) { sQuestHpPrimColorTargetIndex = 0; } @@ -618,7 +618,7 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { if (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PROMPT) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); } - pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorShrinkRate = 4.0f; nextCursorPoint = sCursorPointLinks[oldCursorPoint].left; if (nextCursorPoint == CURSOR_TO_LEFT) { @@ -641,7 +641,7 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { if (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PROMPT) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); } - pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorShrinkRate = 4.0f; nextCursorPoint = sCursorPointLinks[oldCursorPoint].right; if (nextCursorPoint == CURSOR_TO_RIGHT) { @@ -666,7 +666,7 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { nextCursorPoint = sCursorPointLinks[oldCursorPoint].down; while (nextCursorPoint > CURSOR_NONE) { - pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorShrinkRate = 4.0f; if (KaleidoScope_UpdateQuestStatusPoint(pauseCtx, nextCursorPoint)) { break; } @@ -679,7 +679,7 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { } nextCursorPoint = sCursorPointLinks[oldCursorPoint].up; while (nextCursorPoint > CURSOR_NONE) { - pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorShrinkRate = 4.0f; if (KaleidoScope_UpdateQuestStatusPoint(pauseCtx, nextCursorPoint)) { break; } @@ -907,7 +907,7 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); } - func_80821A04(play); + KaleidoScope_MoveCursorFromSpecialPos(play); pauseCtx->cursorPoint[PAUSE_QUEST] = QUEST_BOMBERS_NOTEBOOK; if (CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { @@ -925,7 +925,7 @@ void KaleidoScope_UpdateQuestCursor(PlayState* play) { AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); } - func_80821A04(play); + KaleidoScope_MoveCursorFromSpecialPos(play); pauseCtx->cursorPoint[PAUSE_QUEST] = QUEST_REMAINS_GOHT; if (CHECK_QUEST_ITEM(pauseCtx->cursorPoint[PAUSE_QUEST])) { 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 c8d963bda2..f46db573c3 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 @@ -382,7 +382,7 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { while (moveCursorResult == PAUSE_CURSOR_RESULT_NONE) { if (pauseCtx->stickAdjX < -30) { // move cursor left - pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorShrinkRate = 4.0f; if (pauseCtx->cursorXIndex[PAUSE_ITEM] != 0) { pauseCtx->cursorXIndex[PAUSE_ITEM]--; pauseCtx->cursorPoint[PAUSE_ITEM]--; @@ -413,7 +413,7 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { } } else if (pauseCtx->stickAdjX > 30) { // move cursor right - pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorShrinkRate = 4.0f; if (pauseCtx->cursorXIndex[PAUSE_ITEM] <= 4) { pauseCtx->cursorXIndex[PAUSE_ITEM]++; pauseCtx->cursorPoint[PAUSE_ITEM]++; @@ -451,7 +451,7 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { } } else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { if (pauseCtx->stickAdjX > 30) { - func_80821A04(play); + KaleidoScope_MoveCursorFromSpecialPos(play); cursorYIndex = 0; cursorXIndex = 0; cursorPoint = 0; // top row, left column (SLOT_OCARINA) @@ -489,7 +489,7 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { } } else { // PAUSE_CURSOR_PAGE_RIGHT if (pauseCtx->stickAdjX < -30) { - func_80821A04(play); + KaleidoScope_MoveCursorFromSpecialPos(play); cursorXIndex = 5; cursorPoint = 5; // top row, right columne (SLOT_TRADE_DEED) cursorYIndex = 0; @@ -541,7 +541,7 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { moveCursorResult = PAUSE_CURSOR_RESULT_SPECIAL_POS; if (pauseCtx->cursorYIndex[PAUSE_ITEM] != 0) { pauseCtx->cursorYIndex[PAUSE_ITEM]--; - pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorShrinkRate = 4.0f; pauseCtx->cursorPoint[PAUSE_ITEM] -= 6; moveCursorResult = PAUSE_CURSOR_RESULT_SLOT; } else { @@ -553,7 +553,7 @@ void KaleidoScope_UpdateItemCursor(PlayState* play) { moveCursorResult = PAUSE_CURSOR_RESULT_SPECIAL_POS; if (pauseCtx->cursorYIndex[PAUSE_ITEM] < 3) { pauseCtx->cursorYIndex[PAUSE_ITEM]++; - pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorShrinkRate = 4.0f; pauseCtx->cursorPoint[PAUSE_ITEM] += 6; moveCursorResult = PAUSE_CURSOR_RESULT_SLOT; } else { 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 6539f1b9e0..a4df2c8891 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 @@ -152,7 +152,7 @@ void KaleidoScope_DrawDungeonMap(PlayState* play) { // QUAD_MAP_PAGE_DUNGEON_BOSS_KEY, // QUAD_MAP_PAGE_DUNGEON_COMPASS, // QUAD_MAP_PAGE_DUNGEON_MAP - gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[60], 16, 0); + gSPVertex(POLY_OPA_DISP++, &pauseCtx->mapPageVtx[QUAD_MAP_PAGE_DUNGEON_TITLE * 4], 4 * 4, 0); // Dungeon Title gDPPipeSync(POLY_OPA_DISP++); @@ -317,9 +317,9 @@ void KaleidoScope_UpdateDungeonCursor(PlayState* play) { pauseCtx->cursorColorSet = PAUSE_CURSOR_COLOR_SET_WHITE; oldCursorPoint = pauseCtx->cursorPoint[PAUSE_MAP]; if (pauseCtx->stickAdjX > 30) { - pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorShrinkRate = 4.0f; if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { - func_80821A04(play); + KaleidoScope_MoveCursorFromSpecialPos(play); pauseCtx->cursorXIndex[PAUSE_MAP] = 0; pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->unk_256; pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->unk_256; @@ -345,9 +345,9 @@ void KaleidoScope_UpdateDungeonCursor(PlayState* play) { } } } else if (pauseCtx->stickAdjX < -30) { - pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorShrinkRate = 4.0f; if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT) { - func_80821A04(play); + KaleidoScope_MoveCursorFromSpecialPos(play); pauseCtx->cursorXIndex[PAUSE_MAP] = 1; pauseCtx->cursorPoint[PAUSE_MAP] = DUNGEON_MAP; if (!CHECK_DUNGEON_ITEM(DUNGEON_MAP, gSaveContext.dungeonIndex)) { @@ -390,7 +390,7 @@ void KaleidoScope_UpdateDungeonCursor(PlayState* play) { gBitFlags[i]) || func_801090B0(FLOOR_INDEX_MAX - i)) { pauseCtx->cursorPoint[PAUSE_MAP] = i + DUNGEON_FLOOR_INDEX_4; - pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorShrinkRate = 4.0f; break; } } @@ -411,7 +411,7 @@ void KaleidoScope_UpdateDungeonCursor(PlayState* play) { gBitFlags[i]) || func_801090B0(FLOOR_INDEX_MAX - i)) { pauseCtx->cursorPoint[PAUSE_MAP] = i + DUNGEON_FLOOR_INDEX_4; - pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorShrinkRate = 4.0f; break; } } @@ -854,7 +854,7 @@ void KaleidoScope_UpdateWorldMapCursor(PlayState* play) { if (pauseCtx->cursorSpecialPos == 0) { if (pauseCtx->stickAdjX > 30) { - pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorShrinkRate = 4.0f; sStickAdjTimer = 0; while (true) { @@ -869,7 +869,7 @@ void KaleidoScope_UpdateWorldMapCursor(PlayState* play) { } } } else if (pauseCtx->stickAdjX < -30) { - pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorShrinkRate = 4.0f; sStickAdjTimer = 0; while (true) { @@ -898,7 +898,7 @@ void KaleidoScope_UpdateWorldMapCursor(PlayState* play) { if (pauseCtx->stickAdjX > 30) { pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = -1; pauseCtx->cursorSpecialPos = 0; - pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorShrinkRate = 4.0f; while (true) { pauseCtx->cursorPoint[PAUSE_WORLD_MAP]++; @@ -923,7 +923,7 @@ void KaleidoScope_UpdateWorldMapCursor(PlayState* play) { } else if (pauseCtx->stickAdjX < -30) { pauseCtx->cursorPoint[PAUSE_WORLD_MAP] = 11; pauseCtx->cursorSpecialPos = 0; - pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorShrinkRate = 4.0f; while (true) { pauseCtx->cursorPoint[PAUSE_WORLD_MAP]--; @@ -958,7 +958,7 @@ void KaleidoScope_UpdateWorldMapCursor(PlayState* play) { oldCursorPoint = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; if (pauseCtx->stickAdjX > 30) { - pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorShrinkRate = 4.0f; sStickAdjTimer = 0; do { pauseCtx->cursorPoint[PAUSE_WORLD_MAP]++; @@ -967,7 +967,7 @@ void KaleidoScope_UpdateWorldMapCursor(PlayState* play) { } } while (!pauseCtx->worldMapPoints[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]); } else if (pauseCtx->stickAdjX < -30) { - pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorShrinkRate = 4.0f; sStickAdjTimer = 0; do { 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 67a8e0d368..228f0d16a4 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 @@ -309,7 +309,7 @@ void KaleidoScope_UpdateMaskCursor(PlayState* play) { while (moveCursorResult == PAUSE_CURSOR_RESULT_NONE) { if (pauseCtx->stickAdjX < -30) { // move cursor left - pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorShrinkRate = 4.0f; if (pauseCtx->cursorXIndex[PAUSE_MASK] != 0) { pauseCtx->cursorXIndex[PAUSE_MASK]--; pauseCtx->cursorPoint[PAUSE_MASK]--; @@ -339,7 +339,7 @@ void KaleidoScope_UpdateMaskCursor(PlayState* play) { } } else if (pauseCtx->stickAdjX > 30) { // move cursor right - pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorShrinkRate = 4.0f; if (pauseCtx->cursorXIndex[PAUSE_MASK] <= 4) { pauseCtx->cursorXIndex[PAUSE_MASK]++; pauseCtx->cursorPoint[PAUSE_MASK]++; @@ -380,7 +380,7 @@ void KaleidoScope_UpdateMaskCursor(PlayState* play) { } } else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { if (pauseCtx->stickAdjX > 30) { - func_80821A04(play); + KaleidoScope_MoveCursorFromSpecialPos(play); cursorYIndex = 0; cursorXIndex = 0; cursorPoint = 0; // top row, left column (SLOT_MASK_POSTMAN) @@ -421,7 +421,7 @@ void KaleidoScope_UpdateMaskCursor(PlayState* play) { //! FAKE: if (1) {} if (pauseCtx->stickAdjX < -30) { - func_80821A04(play); + KaleidoScope_MoveCursorFromSpecialPos(play); cursorXIndex = 5; cursorPoint = 5; // top row, right column (SLOT_MASK_DEKU) cursorYIndex = 0; @@ -473,7 +473,7 @@ void KaleidoScope_UpdateMaskCursor(PlayState* play) { // move cursor up moveCursorResult = PAUSE_CURSOR_RESULT_SPECIAL_POS; if (pauseCtx->cursorYIndex[PAUSE_MASK] != 0) { - pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorShrinkRate = 4.0f; pauseCtx->cursorYIndex[PAUSE_MASK]--; pauseCtx->cursorPoint[PAUSE_MASK] -= 6; moveCursorResult = PAUSE_CURSOR_RESULT_SLOT; @@ -485,7 +485,7 @@ void KaleidoScope_UpdateMaskCursor(PlayState* play) { // move cursor down moveCursorResult = PAUSE_CURSOR_RESULT_SPECIAL_POS; if (pauseCtx->cursorYIndex[PAUSE_MASK] < 3) { - pauseCtx->unk_298 = 4.0f; + pauseCtx->cursorShrinkRate = 4.0f; pauseCtx->cursorYIndex[PAUSE_MASK]++; pauseCtx->cursorPoint[PAUSE_MASK] += 6; moveCursorResult = PAUSE_CURSOR_RESULT_SLOT; 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 a9aeed70fb..c82a40e67e 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 @@ -76,9 +76,9 @@ typedef enum { } PauseMainState; typedef enum { - /* 0x00 */ PAUSE_SAVEPROMPT_STATE_0, + /* 0x00 */ PAUSE_SAVEPROMPT_STATE_APPEARING, /* 0x01 */ PAUSE_SAVEPROMPT_STATE_1, - /* 0x02 */ PAUSE_SAVEPROMPT_STATE_2, + /* 0x02 */ PAUSE_SAVEPROMPT_STATE_RETURN_TO_MENU, /* 0x03 */ PAUSE_SAVEPROMPT_STATE_3, /* 0x04 */ PAUSE_SAVEPROMPT_STATE_4, /* 0x05 */ PAUSE_SAVEPROMPT_STATE_5, @@ -303,9 +303,35 @@ typedef enum { /* 66 */ QUAD_MAP_PAGE_WORLD_MAX } WorldMapPageQuad; +// === INFO PANEL === // + +/** + * infoPanelVtx + * + * infoPanelVtx[0] name panel left texture + * infoPanelVtx[4] name panel right texture + * infoPanelVtx[8] Z Button icon + * infoPanelVtx[12] R Button icon + * infoPanelVtx[16] A button icon (or name segment) + * infoPanelVtx[20] pause-to-decide texture + * infoPanelVtx[24] (unused) oot remnant of Gold Skulltula Icon Texture + */ + #define PAUSE_NAME_COLOR_SET_WHITE 0 #define PAUSE_NAME_COLOR_SET_GREY 1 +// === CURSOR === // + +/** + * cursorVtx + * + * cursorVtx[0] cursor circle + * cursorVtx[4] (unused) oot remnant of top-right corner of cursor + * cursorVtx[8] (unused) oot remnant of bottom-left corner of cursor + * cursorVtx[12] (unused) oot remnant of bottom-right corner of cursor + * cursorVtx[16] equipping item icon (while moving) + */ + #define PAUSE_CURSOR_COLOR_SET_WHITE 0 #define PAUSE_CURSOR_COLOR_SET_YELLOW 2 #define PAUSE_CURSOR_COLOR_SET_BLUE 4 @@ -326,6 +352,36 @@ typedef enum { /* 5 */ PAUSE_QUAD_CURSOR_MAX } PauseCursorQuad; +// === PROMPT === // + +/** + * promptPageVtx (unused in MM, inferred from OoT) + * + * // PAGE_BG_QUADS + * promptPageVtx[0] prompt page background texture: row 0, column 0 + * promptPageVtx[4] prompt page background texture: row 1, column 0 + * promptPageVtx[8] prompt page background texture: row 2, column 0 + * promptPageVtx[12] prompt page background texture: row 3, column 0 + * promptPageVtx[16] prompt page background texture: row 4, column 0 + * promptPageVtx[20] prompt page background texture: row 0, column 1 + * promptPageVtx[24] prompt page background texture: row 1, column 1 + * promptPageVtx[28] prompt page background texture: row 2, column 1 + * promptPageVtx[32] prompt page background texture: row 3, column 1 + * promptPageVtx[36] prompt page background texture: row 4, column 1 + * promptPageVtx[40] prompt page background texture: row 0, column 2 + * promptPageVtx[44] prompt page background texture: row 1, column 2 + * promptPageVtx[48] prompt page background texture: row 2, column 2 + * promptPageVtx[52] prompt page background texture: row 3, column 2 + * promptPageVtx[56] prompt page background texture: row 4, column 2 + * + * // QUAD_PROMPT_MAX + * promptPageVtx[60] message + * promptPageVtx[64] cursor left + * promptPageVtx[68] cursor right + * promptPageVtx[72] choice (yes) + * promptPageVtx[76] choice (no) + */ + #define PAUSE_PROMPT_YES 0 #define PAUSE_PROMPT_NO 4 @@ -342,7 +398,7 @@ typedef enum { void KaleidoScope_MoveCursorToSpecialPos(PlayState* play, s16 cursorSpecialPos); void KaleidoScope_DrawTexQuadRGBA32(GraphicsContext* gfxCtx, TexturePtr texture, u16 width, u16 height, u16 point); void KaleidoScope_SetView(PauseContext* pauseCtx, f32 eyeX, f32 eyeY, f32 eyeZ); -void func_80821A04(PlayState* play); +void KaleidoScope_MoveCursorFromSpecialPos(PlayState* play); // Map void KaleidoScope_DrawDungeonMap(PlayState* play); 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 a882cf3e76..9d210a728c 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 @@ -1,7 +1,7 @@ /* * File: z_kaleido_scope_NES.c * Overlay: ovl_kaleido_scope - * Description: + * Description: Pause Menu */ #include "z_kaleido_scope.h" @@ -9,18 +9,13 @@ #include "interface/icon_item_gameover_static/icon_item_gameover_static.h" #include "interface/icon_item_jpn_static/icon_item_jpn_static.h" #include "z64view.h" +#include "overlays/gamestates/ovl_opening/z_opening.h" +#include "interface/icon_item_gameover_static/icon_item_gameover_static.h" +#include "interface/icon_item_jpn_static/icon_item_jpn_static.h" +#include "interface/icon_item_vtx_static/icon_item_vtx_static.h" -extern UNK_TYPE D_02001360; -extern UNK_TYPE D_020044A0; -extern UNK_TYPE D_02004AA0; -extern UNK_TYPE D_0200B998; -extern UNK_TYPE D_08062000; -extern UNK_TYPE D_08064340; -extern UNK_TYPE D_0B000000; -extern UNK_TYPE D_0C000000; -extern UNK_TYPE D_0C006C00; - -extern u8 sUnpausedButtonStatus[5]; +// iconItemSegment +extern TexturePtr D_08064340; // gPauseMenuCursorTex // Page Textures (Background of Page): // Broken up into multiple textures. @@ -242,29 +237,68 @@ s16 sPauseCursorRightX = 0; s16 D_8082B920 = 10; -u8 D_8082B924[] = { - 0x00, 0x14, 0x00, 0x04, 0x00, 0x14, 0x00, 0x0A, 0x0F, 0x1F, 0x0F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, - 0x07, 0x07, 0x03, 0x0F, 0x07, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0x1F, 0x0F, 0x03, 0x0F, 0x00, 0x00, +s16 sPauseZRCursorColorTimerInits[] = { 20, 4, 20, 10 }; + +// Unused remnant of OoT +u8 gAreaGsFlags[] = { + 0x0F, 0x1F, 0x0F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x07, 0x07, 0x03, 0x0F, + 0x07, 0x0F, 0x0F, 0xFF, 0xFF, 0xFF, 0x1F, 0x0F, 0x03, 0x0F, 0x00, 0x00, }; // TODO: Also applies to owl warps s16 sGameOverRectPosY = 66; -void func_80821900(void* segment, u32 texIndex) { +void Kaleido_LoadMapNameStatic(void* segment, u32 texIndex) { CmpDma_LoadFile(SEGMENT_ROM_START(map_name_static), texIndex, segment, 0x400); } -void func_8082192C(void* segment, u32 texIndex) { +void Kaleido_LoadMapNameStaticLarge(void* segment, u32 texIndex) { CmpDma_LoadFile(SEGMENT_ROM_START(map_name_static), texIndex, segment, 0xA00); } -void func_80821958(void* segment, u32 texIndex) { +void Kaleido_LoadItemNameStatic(void* segment, u32 texIndex) { CmpDma_LoadFile(SEGMENT_ROM_START(item_name_static), texIndex, segment, 0x400); } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/KaleidoScope_MoveCursorToSpecialPos.s") +void KaleidoScope_MoveCursorToSpecialPos(PlayState* play, s16 cursorSpecialPos) { + PauseContext* pauseCtx = &play->pauseCtx; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80821A04.s") + pauseCtx->cursorSlot[pauseCtx->pageIndex] = 0; + pauseCtx->cursorSpecialPos = cursorSpecialPos; + pauseCtx->pageSwitchInputTimer = 0; + + play_sound(NA_SE_SY_DECIDE); + + 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; + + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); +} + +void KaleidoScope_MoveCursorFromSpecialPos(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; + + pauseCtx->nameDisplayTimer = 0; + pauseCtx->cursorSpecialPos = 0; + + play_sound(NA_SE_SY_CURSOR); + + pauseCtx->cursorShrinkRate = 4.0f; + + gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = gPageSwitchNextButtonStatus[pauseCtx->pageIndex + 1][1]; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = gPageSwitchNextButtonStatus[pauseCtx->pageIndex + 1][1]; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = gPageSwitchNextButtonStatus[pauseCtx->pageIndex + 1][1]; + gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_ENABLED; + + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); +} void KaleidoScope_DrawTexQuadRGBA32(GraphicsContext* gfxCtx, TexturePtr texture, u16 width, u16 height, u16 point) { OPEN_DISPS(gfxCtx); @@ -277,10 +311,90 @@ void KaleidoScope_DrawTexQuadRGBA32(GraphicsContext* gfxCtx, TexturePtr texture, CLOSE_DISPS(gfxCtx); } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80821CC4.s") +#define SWITCH_PAGE_LEFT 0 +#define SWITCH_PAGE_RIGHT 2 -void KaleidoScope_HandlePageToggles(PlayState* play, Input* input); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/KaleidoScope_HandlePageToggles.s") +void KaleidoScope_SwitchPage(PauseContext* pauseCtx, u8 direction) { + pauseCtx->cursorSlot[pauseCtx->pageIndex] = 0; + pauseCtx->mainState = PAUSE_MAIN_STATE_SWITCHING_PAGE; + pauseCtx->switchPageTimer = 0; + + if (direction == SWITCH_PAGE_LEFT) { + pauseCtx->nextPageMode = (pauseCtx->pageIndex * 2) + 1; + play_sound(NA_SE_SY_WIN_SCROLL_LEFT); + pauseCtx->cursorSpecialPos = PAUSE_CURSOR_PAGE_RIGHT; + } else { // SWITCH_PAGE_RIGHT + pauseCtx->nextPageMode = pauseCtx->pageIndex * 2; + play_sound(NA_SE_SY_WIN_SCROLL_RIGHT); + pauseCtx->cursorSpecialPos = PAUSE_CURSOR_PAGE_LEFT; + } + + 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; + + gSaveContext.hudVisibility = HUD_VISIBILITY_IDLE; + Interface_SetHudVisibility(HUD_VISIBILITY_ALL); +} + +/** + * Process inputs to decide whether to switch pages + */ +void KaleidoScope_HandlePageToggles(PlayState* play, Input* input) { + PauseContext* pauseCtx = &play->pauseCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + + //! FAKE + if (1) {} + + if ((pauseCtx->debugEditor != DEBUG_EDITOR_NONE) || pauseCtx->itemDescriptionOn) { + return; + } + + if (CHECK_BTN_ALL(input->cur.button, BTN_DRIGHT) || CHECK_BTN_ALL(input->press.button, BTN_R)) { + // Switch the page to the right regardless of where the cursor is + if (interfaceCtx->unk_212 == 6) { + func_8011552C(play, 0x15); + } + KaleidoScope_SwitchPage(pauseCtx, SWITCH_PAGE_RIGHT); + return; + } + + if (CHECK_BTN_ALL(input->cur.button, BTN_DLEFT) || CHECK_BTN_ALL(input->press.button, BTN_Z)) { + // Switch the page to the left regardless of where the cursor is + if (interfaceCtx->unk_212 == 6) { + func_8011552C(play, 0x15); + } + KaleidoScope_SwitchPage(pauseCtx, SWITCH_PAGE_LEFT); + return; + } + + if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { + if (pauseCtx->stickAdjX < -30) { + pauseCtx->pageSwitchInputTimer++; + // Switch the page to the left after a certain number of frames with held input or after a second press + if ((pauseCtx->pageSwitchInputTimer >= 10) || (pauseCtx->pageSwitchInputTimer == 0)) { + KaleidoScope_SwitchPage(pauseCtx, SWITCH_PAGE_LEFT); + } + } else { + // stickAdjX is no longer held, so that the next input to the left will immediately switch pages + pauseCtx->pageSwitchInputTimer = -1; + } + } else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT) { + if (pauseCtx->stickAdjX > 30) { + pauseCtx->pageSwitchInputTimer++; + // Switch the page to the right after a certain number of frames with held input or after a second press + if ((pauseCtx->pageSwitchInputTimer >= 10) || (pauseCtx->pageSwitchInputTimer == 0)) { + KaleidoScope_SwitchPage(pauseCtx, SWITCH_PAGE_RIGHT); + } + } else { + // stickAdjY is no longer held, so that the next input to the right will immediately switch pages + pauseCtx->pageSwitchInputTimer = -1; + } + } +} // Draw 15 (PAGE_BG_QUADS) quads with IA8 80x32 textures Gfx* KaleidoScope_DrawPageSections(Gfx* gfx, Vtx* vertices, TexturePtr* textures) { @@ -633,19 +747,413 @@ TexturePtr D_8082B9A8[] = { gPauseToMasksENGTex, gPauseToSelectItemENGTex, }; +void KaleidoScope_DrawInfoPanel(PlayState* play) { + static s16 sPauseZRCursorColorTargets[][4] = { + { 180, 210, 255, 220 }, + { 100, 100, 150, 220 }, + }; + static s16 sPauseZRCursorColorTimer = 20; + static s16 sPauseZRCursorColorIndex = 0; + static s16 sPauseZRCursorRed; + static s16 sPauseZRCursorGreen; + static s16 sPauseZRCursorBlue; + static s16 sPauseZRCursorAlpha; + PauseContext* pauseCtx = &play->pauseCtx; + s16 stepR; + s16 stepG; + s16 stepB; + s16 stepA; + s16 y; + s16 i; + s16 j; -s16 D_8082B9B8[][4] = { - { 180, 210, 255, 220 }, - { 100, 100, 150, 220 }, -}; + OPEN_DISPS(play->state.gfxCtx); -s16 D_8082B9C8 = 20; -s16 D_8082B9CC = 0; + stepR = + ABS_ALT(sPauseZRCursorRed - sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][0]) / sPauseZRCursorColorTimer; + stepG = ABS_ALT(sPauseZRCursorGreen - sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][1]) / + sPauseZRCursorColorTimer; + stepB = ABS_ALT(sPauseZRCursorBlue - sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][2]) / + sPauseZRCursorColorTimer; + stepA = ABS_ALT(sPauseZRCursorAlpha - sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][3]) / + sPauseZRCursorColorTimer; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80823350.s") + if (sPauseZRCursorRed >= sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][0]) { + sPauseZRCursorRed -= stepR; + } else { + sPauseZRCursorRed += stepR; + } -void KaleidoScope_UpdateNamePanel(PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/KaleidoScope_UpdateNamePanel.s") + if (sPauseZRCursorGreen >= sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][1]) { + sPauseZRCursorGreen -= stepG; + } else { + sPauseZRCursorGreen += stepG; + } + + if (sPauseZRCursorBlue >= sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][2]) { + sPauseZRCursorBlue -= stepB; + } else { + sPauseZRCursorBlue += stepB; + } + + if (sPauseZRCursorAlpha >= sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][3]) { + sPauseZRCursorAlpha -= stepA; + } else { + sPauseZRCursorAlpha += stepA; + } + + sPauseZRCursorColorTimer--; + if (sPauseZRCursorColorTimer == 0) { + sPauseZRCursorRed = sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][0]; + sPauseZRCursorGreen = sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][1]; + sPauseZRCursorBlue = sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][2]; + sPauseZRCursorAlpha = sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][3]; + sPauseZRCursorColorTimer = sPauseZRCursorColorTimerInits[0]; + sPauseZRCursorColorIndex ^= 1; + } + + y = pauseCtx->infoPanelOffsetY - 76; + for (j = 0, i = 0; i < 7; i++, j += 4) { + pauseCtx->infoPanelVtx[j + 0].v.ob[0] = pauseCtx->infoPanelVtx[j + 2].v.ob[0] = -72; + + pauseCtx->infoPanelVtx[j + 1].v.ob[0] = pauseCtx->infoPanelVtx[j + 3].v.ob[0] = 0; + + pauseCtx->infoPanelVtx[j + 0].v.ob[1] = pauseCtx->infoPanelVtx[j + 1].v.ob[1] = y; + + pauseCtx->infoPanelVtx[j + 2].v.ob[1] = pauseCtx->infoPanelVtx[j + 3].v.ob[1] = y - 24; + + pauseCtx->infoPanelVtx[j + 0].v.ob[2] = pauseCtx->infoPanelVtx[j + 1].v.ob[2] = + pauseCtx->infoPanelVtx[j + 2].v.ob[2] = pauseCtx->infoPanelVtx[j + 3].v.ob[2] = 0; + + pauseCtx->infoPanelVtx[j + 0].v.flag = pauseCtx->infoPanelVtx[j + 1].v.flag = + pauseCtx->infoPanelVtx[j + 2].v.flag = pauseCtx->infoPanelVtx[j + 3].v.flag = 0; + + pauseCtx->infoPanelVtx[j + 0].v.tc[0] = pauseCtx->infoPanelVtx[j + 0].v.tc[1] = + pauseCtx->infoPanelVtx[j + 1].v.tc[1] = pauseCtx->infoPanelVtx[j + 2].v.tc[0] = 0; + + pauseCtx->infoPanelVtx[j + 1].v.tc[0] = pauseCtx->infoPanelVtx[j + 3].v.tc[0] = 72 * (1 << 5); + + pauseCtx->infoPanelVtx[j + 2].v.tc[1] = pauseCtx->infoPanelVtx[j + 3].v.tc[1] = 24 * (1 << 5); + + pauseCtx->infoPanelVtx[j + 0].v.cn[0] = pauseCtx->infoPanelVtx[j + 2].v.cn[0] = + pauseCtx->infoPanelVtx[j + 0].v.cn[1] = pauseCtx->infoPanelVtx[j + 2].v.cn[1] = + pauseCtx->infoPanelVtx[j + 0].v.cn[2] = pauseCtx->infoPanelVtx[j + 2].v.cn[2] = + pauseCtx->infoPanelVtx[j + 1].v.cn[0] = pauseCtx->infoPanelVtx[j + 3].v.cn[0] = + pauseCtx->infoPanelVtx[j + 1].v.cn[1] = pauseCtx->infoPanelVtx[j + 3].v.cn[1] = + pauseCtx->infoPanelVtx[j + 1].v.cn[2] = pauseCtx->infoPanelVtx[j + 3].v.cn[2] = 200; + + pauseCtx->infoPanelVtx[j + 0].v.cn[3] = pauseCtx->infoPanelVtx[j + 2].v.cn[3] = + pauseCtx->infoPanelVtx[j + 1].v.cn[3] = pauseCtx->infoPanelVtx[j + 3].v.cn[3] = pauseCtx->alpha; + } + + pauseCtx->infoPanelVtx[4].v.ob[0] = pauseCtx->infoPanelVtx[6].v.ob[0] = pauseCtx->infoPanelVtx[0].v.ob[0] + 72; + + pauseCtx->infoPanelVtx[5].v.ob[0] = pauseCtx->infoPanelVtx[7].v.ob[0] = pauseCtx->infoPanelVtx[4].v.ob[0] + 72; + + if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE)) { + pauseCtx->infoPanelVtx[8].v.ob[0] = pauseCtx->infoPanelVtx[10].v.ob[0] = sPauseCursorLeftX; + + pauseCtx->infoPanelVtx[9].v.ob[0] = pauseCtx->infoPanelVtx[11].v.ob[0] = pauseCtx->infoPanelVtx[8].v.ob[0] + 24; + + pauseCtx->infoPanelVtx[8].v.ob[1] = pauseCtx->infoPanelVtx[9].v.ob[1] = D_8082B920; + + pauseCtx->infoPanelVtx[10].v.ob[1] = pauseCtx->infoPanelVtx[11].v.ob[1] = + pauseCtx->infoPanelVtx[8].v.ob[1] - 32; + } else { + pauseCtx->infoPanelVtx[8].v.ob[0] = pauseCtx->infoPanelVtx[10].v.ob[0] = sPauseCursorLeftX + 3; + + pauseCtx->infoPanelVtx[9].v.ob[0] = pauseCtx->infoPanelVtx[11].v.ob[0] = pauseCtx->infoPanelVtx[8].v.ob[0] + 18; + + pauseCtx->infoPanelVtx[8].v.ob[1] = pauseCtx->infoPanelVtx[9].v.ob[1] = D_8082B920 - 3; + + pauseCtx->infoPanelVtx[10].v.ob[1] = pauseCtx->infoPanelVtx[11].v.ob[1] = + pauseCtx->infoPanelVtx[8].v.ob[1] - 26; + } + + if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE)) { + pauseCtx->infoPanelVtx[12].v.ob[0] = pauseCtx->infoPanelVtx[14].v.ob[0] = sPauseCursorRightX; + + pauseCtx->infoPanelVtx[13].v.ob[0] = pauseCtx->infoPanelVtx[15].v.ob[0] = + pauseCtx->infoPanelVtx[12].v.ob[0] + 24; + + pauseCtx->infoPanelVtx[12].v.ob[1] = pauseCtx->infoPanelVtx[13].v.ob[1] = D_8082B920; + + pauseCtx->infoPanelVtx[14].v.ob[1] = pauseCtx->infoPanelVtx[15].v.ob[1] = + pauseCtx->infoPanelVtx[12].v.ob[1] - 32; + } else { + pauseCtx->infoPanelVtx[12].v.ob[0] = pauseCtx->infoPanelVtx[14].v.ob[0] = sPauseCursorRightX + 3; + + pauseCtx->infoPanelVtx[13].v.ob[0] = pauseCtx->infoPanelVtx[15].v.ob[0] = + pauseCtx->infoPanelVtx[12].v.ob[0] + 18; + + pauseCtx->infoPanelVtx[12].v.ob[1] = pauseCtx->infoPanelVtx[13].v.ob[1] = D_8082B920 - 3; + + pauseCtx->infoPanelVtx[14].v.ob[1] = pauseCtx->infoPanelVtx[15].v.ob[1] = + pauseCtx->infoPanelVtx[12].v.ob[1] - 26; + } + + pauseCtx->infoPanelVtx[9].v.tc[0] = pauseCtx->infoPanelVtx[11].v.tc[0] = pauseCtx->infoPanelVtx[13].v.tc[0] = + pauseCtx->infoPanelVtx[15].v.tc[0] = 24 * (1 << 5); + + pauseCtx->infoPanelVtx[10].v.tc[1] = pauseCtx->infoPanelVtx[11].v.tc[1] = pauseCtx->infoPanelVtx[14].v.tc[1] = + pauseCtx->infoPanelVtx[15].v.tc[1] = 32 * (1 << 5); + + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + + Matrix_Translate(0.0f, 0.0f, -144.0f, MTXMODE_NEW); + Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 150, 140, 90, 255); + gSPVertex(POLY_OPA_DISP++, &pauseCtx->infoPanelVtx[0], 16, 0); + + gSPDisplayList(POLY_OPA_DISP++, gItemNamePanelDL); + + if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) && + (!pauseCtx->mainState || (pauseCtx->mainState == PAUSE_MAIN_STATE_UNK))) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 150, 140, 90, sPauseZRCursorAlpha); + } + + gSPDisplayList(POLY_OPA_DISP++, gZButtonIconDL); + + if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT) && + (!pauseCtx->mainState || (pauseCtx->mainState == PAUSE_MAIN_STATE_UNK))) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 150, 140, 90, sPauseZRCursorAlpha); + } + + gSPDisplayList(POLY_OPA_DISP++, gRButtonIconDL); + + if (pauseCtx->cursorSpecialPos != 0) { + j = (pauseCtx->cursorSpecialPos * 4) - 32; + pauseCtx->cursorVtx[0].v.ob[0] = pauseCtx->infoPanelVtx[j].v.ob[0]; + pauseCtx->cursorVtx[0].v.ob[1] = pauseCtx->infoPanelVtx[j].v.ob[1]; + } + + y = pauseCtx->infoPanelOffsetY - 80; + pauseCtx->infoPanelVtx[16].v.ob[1] = pauseCtx->infoPanelVtx[17].v.ob[1] = y; + + pauseCtx->infoPanelVtx[18].v.ob[1] = pauseCtx->infoPanelVtx[19].v.ob[1] = pauseCtx->infoPanelVtx[16].v.ob[1] - 16; + + pauseCtx->infoPanelVtx[18].v.tc[1] = pauseCtx->infoPanelVtx[19].v.tc[1] = 16 * (1 << 5); + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, + ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetEnvColor(POLY_OPA_DISP++, 20, 30, 40, 0); + + if (pauseCtx->itemDescriptionOn || + ((pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->namedItem != PAUSE_ITEM_NONE) && + (pauseCtx->nameDisplayTimer < 40) && + (!pauseCtx->mainState || (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PLAYBACK) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_UNK) || + ((pauseCtx->mainState >= PAUSE_MAIN_STATE_SONG_PROMPT_INIT) && + (pauseCtx->mainState <= PAUSE_MAIN_STATE_SONG_PROMPT_UNUSED)) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG)) && + (pauseCtx->cursorSpecialPos == 0))) { + if (!pauseCtx->mainState || (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PLAYBACK) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_UNK) || + ((pauseCtx->mainState >= PAUSE_MAIN_STATE_SONG_PROMPT_INIT) && + (pauseCtx->mainState <= PAUSE_MAIN_STATE_SONG_PROMPT_UNUSED)) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG)) { + + pauseCtx->infoPanelVtx[16].v.ob[0] = pauseCtx->infoPanelVtx[18].v.ob[0] = -63; + + pauseCtx->infoPanelVtx[17].v.ob[0] = pauseCtx->infoPanelVtx[19].v.ob[0] = + pauseCtx->infoPanelVtx[16].v.ob[0] + 128; + + pauseCtx->infoPanelVtx[17].v.tc[0] = pauseCtx->infoPanelVtx[19].v.tc[0] = 128 * (1 << 5); + + gSPVertex(POLY_OPA_DISP++, &pauseCtx->infoPanelVtx[16], 4, 0); + + if (pauseCtx->nameColorSet == PAUSE_NAME_COLOR_SET_GREY) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 70, 70, 70, 255); + } else { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); + } + + POLY_OPA_DISP = Gfx_DrawTexQuad4b(POLY_OPA_DISP, pauseCtx->nameSegment, G_IM_FMT_IA, 128, 16, 0); + } + } else if ((pauseCtx->mainState <= PAUSE_MAIN_STATE_SONG_PLAYBACK) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PROMPT_UNUSED) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_UNK)) { + pauseCtx->infoPanelVtx[20].v.ob[1] = pauseCtx->infoPanelVtx[21].v.ob[1] = y; + + pauseCtx->infoPanelVtx[22].v.ob[1] = pauseCtx->infoPanelVtx[23].v.ob[1] = + pauseCtx->infoPanelVtx[20].v.ob[1] - 16; + + pauseCtx->infoPanelVtx[22].v.tc[1] = pauseCtx->infoPanelVtx[23].v.tc[1] = 16 * (1 << 5); + + gSPVertex(POLY_OPA_DISP++, &pauseCtx->infoPanelVtx[16], 8, 0); + + if (pauseCtx->state == PAUSE_STATE_SAVEPROMPT) { + pauseCtx->infoPanelVtx[16].v.ob[0] = pauseCtx->infoPanelVtx[18].v.ob[0] = -33; + + pauseCtx->infoPanelVtx[17].v.ob[0] = pauseCtx->infoPanelVtx[19].v.ob[0] = + pauseCtx->infoPanelVtx[16].v.ob[0] + 24; + + pauseCtx->infoPanelVtx[20].v.ob[0] = pauseCtx->infoPanelVtx[22].v.ob[0] = + pauseCtx->infoPanelVtx[16].v.ob[0] + 0x10; + + pauseCtx->infoPanelVtx[21].v.ob[0] = pauseCtx->infoPanelVtx[23].v.ob[0] = + pauseCtx->infoPanelVtx[20].v.ob[0] + 0x30; + + pauseCtx->infoPanelVtx[17].v.tc[0] = pauseCtx->infoPanelVtx[19].v.tc[0] = 24 * (1 << 5); + + pauseCtx->infoPanelVtx[21].v.tc[0] = pauseCtx->infoPanelVtx[23].v.tc[0] = 48 * (1 << 5); + + gSPDisplayList(POLY_OPA_DISP++, gAButtonIconDL); + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); + + //! @bug: Incorrect dimensions. Should be 64x16 + POLY_OPA_DISP = Gfx_DrawTexQuad4b(POLY_OPA_DISP, gPauseToDecideENGTex, G_IM_FMT_IA, 48, 16, 4); + + } else if (pauseCtx->cursorSpecialPos != 0) { + if ((pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE)) { + + pauseCtx->infoPanelVtx[16].v.ob[0] = pauseCtx->infoPanelVtx[18].v.ob[0] = -63; + + pauseCtx->infoPanelVtx[17].v.ob[0] = pauseCtx->infoPanelVtx[19].v.ob[0] = + pauseCtx->infoPanelVtx[16].v.ob[0] + 128; + + pauseCtx->infoPanelVtx[17].v.tc[0] = pauseCtx->infoPanelVtx[19].v.tc[0] = 128 * (1 << 5); + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 200, 0, 255); + + if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { + POLY_OPA_DISP = + Gfx_DrawTexQuad4b(POLY_OPA_DISP, D_8082B998[pauseCtx->pageIndex], G_IM_FMT_IA, 128, 16, 0); + } else { + POLY_OPA_DISP = + Gfx_DrawTexQuad4b(POLY_OPA_DISP, D_8082B9A8[pauseCtx->pageIndex], G_IM_FMT_IA, 128, 16, 0); + } + } + } else if ((!pauseCtx->pageIndex || (pauseCtx->pageIndex == PAUSE_MASK)) && + (pauseCtx->namedItem != PAUSE_ITEM_NONE)) { + pauseCtx->infoPanelVtx[16].v.ob[0] = pauseCtx->infoPanelVtx[18].v.ob[0] = -49; + + pauseCtx->infoPanelVtx[17].v.ob[0] = pauseCtx->infoPanelVtx[19].v.ob[0] = + pauseCtx->infoPanelVtx[16].v.ob[0] + 48; + + pauseCtx->infoPanelVtx[20].v.ob[0] = pauseCtx->infoPanelVtx[22].v.ob[0] = + pauseCtx->infoPanelVtx[16].v.ob[0] + 47; + + pauseCtx->infoPanelVtx[21].v.ob[0] = pauseCtx->infoPanelVtx[23].v.ob[0] = + pauseCtx->infoPanelVtx[20].v.ob[0] + 64; + + pauseCtx->infoPanelVtx[17].v.tc[0] = pauseCtx->infoPanelVtx[19].v.tc[0] = 48 * (1 << 5); + + pauseCtx->infoPanelVtx[21].v.tc[0] = pauseCtx->infoPanelVtx[23].v.tc[0] = 64 * (1 << 5); + + gSPDisplayList(POLY_OPA_DISP++, gCButtonIconsDL); + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); + + POLY_OPA_DISP = Gfx_DrawTexQuad4b(POLY_OPA_DISP, gPauseToEquipENGTex, G_IM_FMT_IA, 64, 16, 4); + } else if ((pauseCtx->pageIndex == PAUSE_MAP) && sInDungeonScene) { + // No code in this case + } else if ((pauseCtx->pageIndex == PAUSE_QUEST) && + (pauseCtx->cursorSlot[PAUSE_QUEST] == QUEST_BOMBERS_NOTEBOOK)) { + if (pauseCtx->namedItem != PAUSE_ITEM_NONE) { + // The cursor is on the bombers notebook + pauseCtx->infoPanelVtx[16].v.ob[0] = pauseCtx->infoPanelVtx[18].v.ob[0] = -58; + + pauseCtx->infoPanelVtx[17].v.ob[0] = pauseCtx->infoPanelVtx[19].v.ob[0] = + pauseCtx->infoPanelVtx[16].v.ob[0] + 24; + + pauseCtx->infoPanelVtx[20].v.ob[0] = pauseCtx->infoPanelVtx[22].v.ob[0] = + pauseCtx->infoPanelVtx[16].v.ob[0] + 0x14; + + pauseCtx->infoPanelVtx[21].v.ob[0] = pauseCtx->infoPanelVtx[23].v.ob[0] = + pauseCtx->infoPanelVtx[20].v.ob[0] + 0x60; + + pauseCtx->infoPanelVtx[17].v.tc[0] = pauseCtx->infoPanelVtx[19].v.tc[0] = 24 * (1 << 5); + + pauseCtx->infoPanelVtx[21].v.tc[0] = pauseCtx->infoPanelVtx[23].v.tc[0] = 96 * (1 << 5); + + gSPDisplayList(POLY_OPA_DISP++, gAButtonIconDL); + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); + + POLY_OPA_DISP = Gfx_DrawTexQuad4b(POLY_OPA_DISP, gPauseToViewNotebookENGTex, G_IM_FMT_IA, 96, 16, 4); + } + } else if ((pauseCtx->pageIndex == PAUSE_QUEST) && (pauseCtx->cursorSlot[PAUSE_QUEST] >= QUEST_SONG_SONATA) && + (pauseCtx->cursorSlot[PAUSE_QUEST] <= QUEST_SONG_SUN) && (pauseCtx->namedItem != PAUSE_ITEM_NONE)) { + // The cursor is on a learned song + pauseCtx->infoPanelVtx[16].v.ob[0] = pauseCtx->infoPanelVtx[18].v.ob[0] = -55; + + pauseCtx->infoPanelVtx[17].v.ob[0] = pauseCtx->infoPanelVtx[19].v.ob[0] = + pauseCtx->infoPanelVtx[16].v.ob[0] + 24; + + pauseCtx->infoPanelVtx[20].v.ob[0] = pauseCtx->infoPanelVtx[22].v.ob[0] = + pauseCtx->infoPanelVtx[16].v.ob[0] + 20; + + pauseCtx->infoPanelVtx[21].v.ob[0] = pauseCtx->infoPanelVtx[23].v.ob[0] = + pauseCtx->infoPanelVtx[20].v.ob[0] + 96; + + pauseCtx->infoPanelVtx[17].v.tc[0] = pauseCtx->infoPanelVtx[19].v.tc[0] = 24 * (1 << 5); + + pauseCtx->infoPanelVtx[21].v.tc[0] = pauseCtx->infoPanelVtx[23].v.tc[0] = 96 * (1 << 5); + + gSPDisplayList(POLY_OPA_DISP++, gAButtonIconDL); + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); + + POLY_OPA_DISP = Gfx_DrawTexQuad4b(POLY_OPA_DISP, gPauseToPlayMelodyENGTex, G_IM_FMT_IA, 96, 16, 4); + } + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +u8 sUnpausedButtonStatus[5]; +f32 sCursorCirclesX[4]; +f32 sCursorCirclesY[4]; + +void KaleidoScope_UpdateNamePanel(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; + u16 namedItem; + + if ((pauseCtx->namedItem != pauseCtx->cursorItem[pauseCtx->pageIndex]) || + ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->cursorSpecialPos != 0))) { + + pauseCtx->namedItem = pauseCtx->cursorItem[pauseCtx->pageIndex]; + namedItem = pauseCtx->namedItem; + + osCreateMesgQueue(&pauseCtx->loadQueue, &pauseCtx->loadMsg, 1); + + if (pauseCtx->namedItem != PAUSE_ITEM_NONE) { + if ((pauseCtx->pageIndex == PAUSE_MAP) && !sInDungeonScene) { + Kaleido_LoadMapNameStatic(pauseCtx->nameSegment, namedItem); + } else { + Kaleido_LoadItemNameStatic(pauseCtx->nameSegment, namedItem); + } + pauseCtx->nameDisplayTimer = 0; + } + } else if (pauseCtx->nameColorSet == PAUSE_NAME_COLOR_SET_WHITE) { + if (((pauseCtx->pageIndex == PAUSE_QUEST) && (pauseCtx->cursorSlot[PAUSE_QUEST] >= QUEST_SONG_SONATA) && + (pauseCtx->cursorSlot[PAUSE_QUEST] <= QUEST_SONG_SUN) && + (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG)) || + ((pauseCtx->pageIndex == PAUSE_QUEST) && (pauseCtx->cursorSlot[PAUSE_QUEST] == QUEST_BOMBERS_NOTEBOOK)) || + (pauseCtx->pageIndex == PAUSE_ITEM) || (pauseCtx->pageIndex == PAUSE_MASK)) { + + pauseCtx->nameDisplayTimer++; + if (pauseCtx->nameDisplayTimer > 70) { + pauseCtx->nameDisplayTimer = 0; + } + } else { + pauseCtx->nameDisplayTimer = 0; + } + } else { + pauseCtx->nameDisplayTimer = 0; + } +} void KaleidoScope_DrawOwlWarpMapPage(PlayState* play) { PauseContext* pauseCtx = &play->pauseCtx; @@ -690,21 +1198,275 @@ void KaleidoScope_DrawOwlWarpMapPage(PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); } -s16 D_8082B9D0[][4] = { - { 180, 210, 255, 220 }, - { 100, 100, 150, 220 }, -}; +void KaleidoScope_DrawOwlWarpInfoPanel(PlayState* play) { + static s16 sPauseZRCursorColorTargets[][4] = { + { 180, 210, 255, 220 }, + { 100, 100, 150, 220 }, + }; + static s16 sPauseZRCursorColorTimer = 20; + static s16 sPauseZRCursorColorIndex = 0; + static s16 sPauseZRCursorRed; + static s16 sPauseZRCursorGreen; + static s16 sPauseZRCursorBlue; + static s16 sPauseZRCursorAlpha; + PauseContext* pauseCtx = &play->pauseCtx; + s16 stepR; + s16 stepG; + s16 stepB; + s16 stepA; + s16 y; + s16 i; + s16 j; -s16 D_8082B9E0 = 20; -s16 D_8082B9E4 = 0; + OPEN_DISPS(play->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80824B90.s") + stepR = + ABS_ALT(sPauseZRCursorRed - sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][0]) / sPauseZRCursorColorTimer; + stepG = ABS_ALT(sPauseZRCursorGreen - sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][1]) / + sPauseZRCursorColorTimer; + stepB = ABS_ALT(sPauseZRCursorBlue - sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][2]) / + sPauseZRCursorColorTimer; + stepA = ABS_ALT(sPauseZRCursorAlpha - sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][3]) / + sPauseZRCursorColorTimer; -void KaleidoScope_UpdateOwlWarpNamePanel(PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/KaleidoScope_UpdateOwlWarpNamePanel.s") + if (sPauseZRCursorRed >= sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][0]) { + sPauseZRCursorRed -= stepR; + } else { + sPauseZRCursorRed += stepR; + } -void KaleidoScope_UpdateSwitchPage(PlayState* play, Input* input); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/KaleidoScope_UpdateSwitchPage.s") + if (sPauseZRCursorGreen >= sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][1]) { + sPauseZRCursorGreen -= stepG; + } else { + sPauseZRCursorGreen += stepG; + } + + if (sPauseZRCursorBlue >= sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][2]) { + sPauseZRCursorBlue -= stepB; + } else { + sPauseZRCursorBlue += stepB; + } + + if (sPauseZRCursorAlpha >= sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][3]) { + sPauseZRCursorAlpha -= stepA; + } else { + sPauseZRCursorAlpha += stepA; + } + + sPauseZRCursorColorTimer--; + if (sPauseZRCursorColorTimer == 0) { + sPauseZRCursorRed = sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][0]; + sPauseZRCursorGreen = sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][1]; + sPauseZRCursorBlue = sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][2]; + sPauseZRCursorAlpha = sPauseZRCursorColorTargets[sPauseZRCursorColorIndex][3]; + sPauseZRCursorColorTimer = sPauseZRCursorColorTimerInits[0]; + sPauseZRCursorColorIndex ^= 1; + } + + y = pauseCtx->infoPanelOffsetY - 76; + for (j = 0, i = 0; i < 7; i++, j += 4) { + pauseCtx->infoPanelVtx[j + 0].v.ob[0] = pauseCtx->infoPanelVtx[j + 2].v.ob[0] = -72; + + pauseCtx->infoPanelVtx[j + 1].v.ob[0] = pauseCtx->infoPanelVtx[j + 3].v.ob[0] = 0; + + pauseCtx->infoPanelVtx[j + 0].v.ob[1] = pauseCtx->infoPanelVtx[j + 1].v.ob[1] = y; + + pauseCtx->infoPanelVtx[j + 2].v.ob[1] = pauseCtx->infoPanelVtx[j + 3].v.ob[1] = y - 24; + + pauseCtx->infoPanelVtx[j + 0].v.ob[2] = pauseCtx->infoPanelVtx[j + 1].v.ob[2] = + pauseCtx->infoPanelVtx[j + 2].v.ob[2] = pauseCtx->infoPanelVtx[j + 3].v.ob[2] = 0; + + pauseCtx->infoPanelVtx[j + 0].v.flag = pauseCtx->infoPanelVtx[j + 1].v.flag = + pauseCtx->infoPanelVtx[j + 2].v.flag = pauseCtx->infoPanelVtx[j + 3].v.flag = 0; + + pauseCtx->infoPanelVtx[j + 0].v.tc[0] = pauseCtx->infoPanelVtx[j + 0].v.tc[1] = + pauseCtx->infoPanelVtx[j + 1].v.tc[1] = pauseCtx->infoPanelVtx[j + 2].v.tc[0] = 0; + + pauseCtx->infoPanelVtx[j + 1].v.tc[0] = pauseCtx->infoPanelVtx[j + 3].v.tc[0] = 72 * (1 << 5); + + pauseCtx->infoPanelVtx[j + 2].v.tc[1] = pauseCtx->infoPanelVtx[j + 3].v.tc[1] = 24 * (1 << 5); + + pauseCtx->infoPanelVtx[j + 0].v.cn[0] = pauseCtx->infoPanelVtx[j + 2].v.cn[0] = + pauseCtx->infoPanelVtx[j + 0].v.cn[1] = pauseCtx->infoPanelVtx[j + 2].v.cn[1] = + pauseCtx->infoPanelVtx[j + 0].v.cn[2] = pauseCtx->infoPanelVtx[j + 2].v.cn[2] = + pauseCtx->infoPanelVtx[j + 1].v.cn[0] = pauseCtx->infoPanelVtx[j + 3].v.cn[0] = + pauseCtx->infoPanelVtx[j + 1].v.cn[1] = pauseCtx->infoPanelVtx[j + 3].v.cn[1] = + pauseCtx->infoPanelVtx[j + 1].v.cn[2] = pauseCtx->infoPanelVtx[j + 3].v.cn[2] = 200; + + pauseCtx->infoPanelVtx[j + 0].v.cn[3] = pauseCtx->infoPanelVtx[j + 2].v.cn[3] = + pauseCtx->infoPanelVtx[j + 1].v.cn[3] = pauseCtx->infoPanelVtx[j + 3].v.cn[3] = pauseCtx->alpha; + } + + pauseCtx->infoPanelVtx[4].v.ob[0] = pauseCtx->infoPanelVtx[6].v.ob[0] = pauseCtx->infoPanelVtx[0].v.ob[0] + 72; + + pauseCtx->infoPanelVtx[5].v.ob[0] = pauseCtx->infoPanelVtx[7].v.ob[0] = pauseCtx->infoPanelVtx[4].v.ob[0] + 72; + + if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE)) { + pauseCtx->infoPanelVtx[8].v.ob[0] = pauseCtx->infoPanelVtx[10].v.ob[0] = sPauseCursorLeftX; + + pauseCtx->infoPanelVtx[9].v.ob[0] = pauseCtx->infoPanelVtx[11].v.ob[0] = pauseCtx->infoPanelVtx[8].v.ob[0] + 24; + + pauseCtx->infoPanelVtx[8].v.ob[1] = pauseCtx->infoPanelVtx[9].v.ob[1] = D_8082B920; + + pauseCtx->infoPanelVtx[10].v.ob[1] = pauseCtx->infoPanelVtx[11].v.ob[1] = + pauseCtx->infoPanelVtx[8].v.ob[1] - 32; + } else { + pauseCtx->infoPanelVtx[8].v.ob[0] = pauseCtx->infoPanelVtx[10].v.ob[0] = sPauseCursorLeftX + 3; + + pauseCtx->infoPanelVtx[9].v.ob[0] = pauseCtx->infoPanelVtx[11].v.ob[0] = pauseCtx->infoPanelVtx[8].v.ob[0] + 18; + + pauseCtx->infoPanelVtx[8].v.ob[1] = pauseCtx->infoPanelVtx[9].v.ob[1] = D_8082B920 - 3; + + pauseCtx->infoPanelVtx[10].v.ob[1] = pauseCtx->infoPanelVtx[11].v.ob[1] = + pauseCtx->infoPanelVtx[8].v.ob[1] - 26; + } + + if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE)) { + pauseCtx->infoPanelVtx[12].v.ob[0] = pauseCtx->infoPanelVtx[14].v.ob[0] = sPauseCursorRightX; + + pauseCtx->infoPanelVtx[13].v.ob[0] = pauseCtx->infoPanelVtx[15].v.ob[0] = + pauseCtx->infoPanelVtx[12].v.ob[0] + 24; + + pauseCtx->infoPanelVtx[12].v.ob[1] = pauseCtx->infoPanelVtx[13].v.ob[1] = D_8082B920; + + pauseCtx->infoPanelVtx[14].v.ob[1] = pauseCtx->infoPanelVtx[15].v.ob[1] = + pauseCtx->infoPanelVtx[12].v.ob[1] - 32; + } else { + pauseCtx->infoPanelVtx[12].v.ob[0] = pauseCtx->infoPanelVtx[14].v.ob[0] = sPauseCursorRightX + 3; + + pauseCtx->infoPanelVtx[13].v.ob[0] = pauseCtx->infoPanelVtx[15].v.ob[0] = + pauseCtx->infoPanelVtx[12].v.ob[0] + 18; + + pauseCtx->infoPanelVtx[12].v.ob[1] = pauseCtx->infoPanelVtx[13].v.ob[1] = D_8082B920 - 3; + + pauseCtx->infoPanelVtx[14].v.ob[1] = pauseCtx->infoPanelVtx[15].v.ob[1] = + pauseCtx->infoPanelVtx[12].v.ob[1] - 26; + } + + pauseCtx->infoPanelVtx[9].v.tc[0] = pauseCtx->infoPanelVtx[11].v.tc[0] = pauseCtx->infoPanelVtx[13].v.tc[0] = + pauseCtx->infoPanelVtx[15].v.tc[0] = 24 * (1 << 5); + + pauseCtx->infoPanelVtx[10].v.tc[1] = pauseCtx->infoPanelVtx[11].v.tc[1] = pauseCtx->infoPanelVtx[14].v.tc[1] = + pauseCtx->infoPanelVtx[15].v.tc[1] = 32 * (1 << 5); + + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + + Matrix_Translate(0.0f, 0.0f, -144.0f, MTXMODE_NEW); + Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); + + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 150, 140, 90, 255); + gSPVertex(POLY_OPA_DISP++, &pauseCtx->infoPanelVtx[0], 16, 0); + + gSPDisplayList(POLY_OPA_DISP++, gItemNamePanelDL); + + if (pauseCtx->cursorSpecialPos != 0) { + j = (pauseCtx->cursorSpecialPos * 4) - 32; + pauseCtx->cursorVtx[0].v.ob[0] = pauseCtx->infoPanelVtx[j].v.ob[0]; + pauseCtx->cursorVtx[0].v.ob[1] = pauseCtx->infoPanelVtx[j].v.ob[1]; + } + + y = pauseCtx->infoPanelOffsetY - 80; + pauseCtx->infoPanelVtx[16].v.ob[1] = pauseCtx->infoPanelVtx[17].v.ob[1] = y; + + pauseCtx->infoPanelVtx[18].v.ob[1] = pauseCtx->infoPanelVtx[19].v.ob[1] = pauseCtx->infoPanelVtx[16].v.ob[1] - 16; + + pauseCtx->infoPanelVtx[18].v.tc[1] = pauseCtx->infoPanelVtx[19].v.tc[1] = 16 * (1 << 5); + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, + ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetEnvColor(POLY_OPA_DISP++, 20, 30, 40, 0); + + if ((pauseCtx->state == PAUSE_STATE_OWLWARP_SELECT) && (pauseCtx->namedItem != PAUSE_ITEM_NONE) && + (pauseCtx->nameDisplayTimer < 40)) { + pauseCtx->infoPanelVtx[16].v.ob[0] = pauseCtx->infoPanelVtx[18].v.ob[0] = -63; + + pauseCtx->infoPanelVtx[17].v.ob[0] = pauseCtx->infoPanelVtx[19].v.ob[0] = + pauseCtx->infoPanelVtx[16].v.ob[0] + 128; + + pauseCtx->infoPanelVtx[17].v.tc[0] = pauseCtx->infoPanelVtx[19].v.tc[0] = 128 * (1 << 5); + + gSPVertex(POLY_OPA_DISP++, &pauseCtx->infoPanelVtx[16], 4, 0); + + if (pauseCtx->nameColorSet == PAUSE_NAME_COLOR_SET_GREY) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 70, 70, 70, 255); + } else { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); + } + + POLY_OPA_DISP = Gfx_DrawTexQuad4b(POLY_OPA_DISP, pauseCtx->nameSegment, G_IM_FMT_IA, 128, 16, 0); + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +void KaleidoScope_UpdateOwlWarpNamePanel(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; + u16 texIndex; + + if ((pauseCtx->namedItem != pauseCtx->cursorItem[pauseCtx->pageIndex]) || + ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->cursorSpecialPos != 0))) { + + pauseCtx->namedItem = pauseCtx->cursorItem[pauseCtx->pageIndex]; + texIndex = pauseCtx->namedItem; + + osCreateMesgQueue(&pauseCtx->loadQueue, &pauseCtx->loadMsg, 1); + + if (pauseCtx->namedItem != PAUSE_ITEM_NONE) { + if ((pauseCtx->pageIndex == PAUSE_MAP) && !sInDungeonScene) { + Kaleido_LoadMapNameStatic(pauseCtx->nameSegment, texIndex); + } else { + Kaleido_LoadItemNameStatic(pauseCtx->nameSegment, texIndex); + } + pauseCtx->nameDisplayTimer = 0; + } + } else if (pauseCtx->nameColorSet == PAUSE_NAME_COLOR_SET_WHITE) { + if (((pauseCtx->pageIndex == PAUSE_QUEST) && (pauseCtx->cursorSlot[PAUSE_QUEST] >= QUEST_SONG_SONATA) && + (pauseCtx->cursorSlot[PAUSE_QUEST] <= QUEST_SONG_SUN) && + (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG)) || + (pauseCtx->pageIndex == PAUSE_ITEM)) { + + pauseCtx->nameDisplayTimer++; + if (pauseCtx->nameDisplayTimer > 70) { + pauseCtx->nameDisplayTimer = 0; + } + } else { + pauseCtx->nameDisplayTimer = 0; + } + } else { + pauseCtx->nameDisplayTimer = 0; + } +} + +void KaleidoScope_UpdateSwitchPage(PlayState* play, Input* input) { + PauseContext* pauseCtx = &play->pauseCtx; + + //! FAKE + if (1) { + pauseCtx->eye.x += sPageSwitchEyeDx[pauseCtx->nextPageMode] * 2.0f; + pauseCtx->eye.z += sPageSwitchEyeDz[pauseCtx->nextPageMode] * 2.0f; + + if (pauseCtx->switchPageTimer < 32) { + sPauseCursorLeftX -= (s16)(sPauseCursorLeftMoveOffsetX / 4); + sPauseCursorRightX -= (s16)(sPauseCursorRightMoveOffsetX / 4); + } else { + sPauseCursorLeftX += (s16)(sPauseCursorLeftMoveOffsetX / 4); + sPauseCursorRightX += (s16)(sPauseCursorRightMoveOffsetX / 4); + } + + pauseCtx->switchPageTimer += 8; + + if (pauseCtx->switchPageTimer == 64) { + pauseCtx->switchPageTimer = 0; + pauseCtx->pageIndex = sPageSwitchNextPageIndex[pauseCtx->nextPageMode]; + pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; + + KaleidoScope_HandlePageToggles(play, input); + } + } +} void KaleidoScope_SetView(PauseContext* pauseCtx, f32 eyeX, f32 eyeY, f32 eyeZ) { Vec3f eye; @@ -773,7 +1535,7 @@ s16 sVtxPageMapWorldQuadsX[VTX_PAGE_MAP_WORLD_QUADS] = { 44, // mapPageVtx[196] world map owl warp Ikana Canyon 54, // mapPageVtx[200] world map owl warp Stone Tower }; -s16 sVtxPageSaveQuadsX[VTX_PAGE_SAVE_QUADS] = { +s16 sVtxPagePromptQuadsX[VTX_PAGE_SAVE_QUADS] = { -76, // promptPageVtx[60] QUAD_PROMPT_MESSAGE -58, // promptPageVtx[64] QUAD_PROMPT_CURSOR_LEFT 10, // promptPageVtx[68] QUAD_PROMPT_CURSOR_RIGHT @@ -793,7 +1555,7 @@ s16 sVtxPageMapDungeonQuadsWidth[VTX_PAGE_MAP_DUNGEON_QUADS] = { 24, // mapPageVtx[80] QUAD_MAP_DUNGEON_UNUSED }; s16 sVtxPageQuestQuadsWidth[CLAMP_MIN(VTX_PAGE_QUEST_QUADS, 1)] = { 0 }; -s16 sVtxPageSaveQuadsWidth[VTX_PAGE_SAVE_QUADS] = { +s16 sVtxPagePromptQuadsWidth[VTX_PAGE_SAVE_QUADS] = { 152, // promptPageVtx[60] QUAD_PROMPT_MESSAGE 48, // promptPageVtx[64] QUAD_PROMPT_CURSOR_LEFT 48, // promptPageVtx[68] QUAD_PROMPT_CURSOR_RIGHT @@ -852,7 +1614,7 @@ s16 sVtxPageMapWorldQuadsY[VTX_PAGE_MAP_WORLD_QUADS] = { -1, // mapPageVtx[196] world map owl warp Ikana Canyon 24, // mapPageVtx[200] world map owl warp Stone Tower }; -s16 sVtxPageSaveQuadsY[VTX_PAGE_SAVE_QUADS] = { +s16 sVtxPagePromptQuadsY[VTX_PAGE_SAVE_QUADS] = { 36, // promptPageVtx[60] QUAD_PROMPT_MESSAGE 10, // promptPageVtx[64] QUAD_PROMPT_CURSOR_LEFT 10, // promptPageVtx[68] QUAD_PROMPT_CURSOR_RIGHT @@ -872,7 +1634,7 @@ s16 sVtxPageMapDungeonQuadsHeight[] = { 24, // mapPageVtx[80] QUAD_MAP_DUNGEON_UNUSED }; s16 sVtxPageQuestQuadsHeight[CLAMP_MIN(VTX_PAGE_QUEST_QUADS, 1)] = { 0 }; -s16 sVtxPageSaveQuadsHeight[VTX_PAGE_SAVE_QUADS] = { +s16 sVtxPagePromptQuadsHeight[VTX_PAGE_SAVE_QUADS] = { 16, // promptPageVtx[60] QUAD_PROMPT_MESSAGE 48, // promptPageVtx[64] QUAD_PROMPT_CURSOR_LEFT 48, // promptPageVtx[68] QUAD_PROMPT_CURSOR_RIGHT @@ -886,7 +1648,7 @@ s16* sVtxPageQuadsX[VTX_PAGE_MAX] = { sVtxPageMapDungeonQuadsX, // VTX_PAGE_MAP_DUNGEON sVtxPageQuestQuadsX, // VTX_PAGE_QUEST sVtxPageMapWorldQuadsX, // VTX_PAGE_MAP_WORLD - sVtxPageSaveQuadsX, // VTX_PAGE_PROMPT + sVtxPagePromptQuadsX, // VTX_PAGE_PROMPT }; s16* sVtxPageQuadsWidth[VTX_PAGE_MAX] = { @@ -895,7 +1657,7 @@ s16* sVtxPageQuadsWidth[VTX_PAGE_MAX] = { sVtxPageMapDungeonQuadsWidth, // VTX_PAGE_MAP_DUNGEON sVtxPageQuestQuadsWidth, // VTX_PAGE_QUEST gVtxPageMapWorldQuadsWidth, // VTX_PAGE_MAP_WORLD - sVtxPageSaveQuadsWidth, // VTX_PAGE_PROMPT + sVtxPagePromptQuadsWidth, // VTX_PAGE_PROMPT }; s16* sVtxPageQuadsY[VTX_PAGE_MAX] = { @@ -904,7 +1666,7 @@ s16* sVtxPageQuadsY[VTX_PAGE_MAX] = { sVtxPageMapDungeonQuadsY, // VTX_PAGE_MAP_DUNGEON sVtxPageQuestQuadsY, // VTX_PAGE_QUEST sVtxPageMapWorldQuadsY, // VTX_PAGE_MAP_WORLD - sVtxPageSaveQuadsY, // VTX_PAGE_PROMPT + sVtxPagePromptQuadsY, // VTX_PAGE_PROMPT }; s16* sVtxPageQuadsHeight[VTX_PAGE_MAX] = { @@ -913,7 +1675,7 @@ s16* sVtxPageQuadsHeight[VTX_PAGE_MAX] = { sVtxPageMapDungeonQuadsHeight, // VTX_PAGE_MAP_DUNGEON sVtxPageQuestQuadsHeight, // VTX_PAGE_QUEST gVtxPageMapWorldQuadsHeight, // VTX_PAGE_MAP_WORLD - sVtxPageSaveQuadsHeight, // VTX_PAGE_PROMPT + sVtxPagePromptQuadsHeight, // VTX_PAGE_PROMPT }; s16 sVtxPageGameOverSaveQuadsY[VTX_PAGE_SAVE_QUADS] = { @@ -1547,60 +2309,435 @@ void KaleidoScope_SetVertices(PlayState* play, GraphicsContext* gfxCtx) { } } -f32 D_8082BCB4[] = { - -62.0f, -36.0f, -10.0f, 16.0f, 42.0f, 68.0f, +f32 sItemMaskCursorsX[] = { + -62.0f, // Column 1 + -36.0f, // Column 2 + -10.0f, // Column 3 + 16.0f, // Column 4 + 42.0f, // Column 5 + 68.0f, // Column 6 }; -f32 D_8082BCCC[] = { - 31.0f, - 5.0f, - -21.0f, - -47.0f, +f32 sItemMaskCursorsY[] = { + 31.0f, // Row 1 + 5.0f, // Row 2 + -21.0f, // Row 3 + -47.0f, // Row 4 }; -f32 D_8082BCDC[] = { - -49.0f, -35.0f, -3.0f, 4.0f, 12.0f, 8.0f, 7.0f, 40.0f, 47.0f, 49.0f, 55.0f, +f32 sWorldMapCursorsX[REGION_MAX] = { + -49.0f, // REGION_GREAT_BAY + -35.0f, // REGION_ZORA_HALL + -3.0f, // REGION_ROMANI_RANCH + 4.0f, // REGION_DEKU_PALACE + 12.0f, // REGION_WOODFALL + 8.0f, // REGION_CLOCK_TOWN + 7.0f, // REGION_SNOWHEAD + 40.0f, // REGION_IKANA_GRAVEYARD + 47.0f, // REGION_IKANA_CANYON + 49.0f, // REGION_GORON_VILLAGE + 55.0f, // REGION_STONE_TOWER }; -f32 D_8082BD08[] = { - -15.0f, -36.0f, -23.0f, -49.0f, -29.0f, -8.0f, 25.0f, 2.0f, -9.0f, 28.0f, 7.0f, +f32 sWorldMapCursorsY[REGION_MAX] = { + -15.0f, // REGION_GREAT_BAY + -36.0f, // REGION_ZORA_HALL + -23.0f, // REGION_ROMANI_RANCH + -49.0f, // REGION_DEKU_PALACE + -29.0f, // REGION_WOODFALL + -8.0f, // REGION_CLOCK_TOWN + 25.0f, // REGION_SNOWHEAD + 2.0f, // REGION_IKANA_GRAVEYARD + -9.0f, // REGION_IKANA_CANYON + 28.0f, // REGION_GORON_VILLAGE + 7.0f, // REGION_STONE_TOWER }; -f32 D_8082BD34[] = { - -50.0f, -38.0f, 6.0f, 11.0f, 8.0f, 0.0f, 12.0f, 31.0f, 48.0f, 56.0f, +f32 sOwlWarpWorldMapCursorsX[OWL_WARP_MAX - 1] = { + -50.0f, // OWL_WARP_GREAT_BAY_COAST + -38.0f, // OWL_WARP_ZORA_CAPE + 6.0f, // OWL_WARP_SNOWHEAD + 11.0f, // OWL_WARP_MOUNTAIN_VILLAGE + 8.0f, // OWL_WARP_CLOCK_TOWN + 0.0f, // OWL_WARP_MILK_ROAD + 12.0f, // OWL_WARP_WOODFALL + 31.0f, // OWL_WARP_SOUTHERN_SWAMP + 48.0f, // OWL_WARP_IKANA_CANYON + 56.0f, // OWL_WARP_STONE_TOWER }; -f32 D_8082BD5C[] = { - -14.0f, -39.0f, 23.0f, 11.0f, -8.0f, -15.0f, -31.0f, -30.0f, -10.0f, 11.0f, +f32 sOwlWarpWorldMapCursorsY[OWL_WARP_MAX - 1] = { + -14.0f, // OWL_WARP_GREAT_BAY_COAST + -39.0f, // OWL_WARP_ZORA_CAPE + 23.0f, // OWL_WARP_SNOWHEAD + 11.0f, // OWL_WARP_MOUNTAIN_VILLAGE + -8.0f, // OWL_WARP_CLOCK_TOWN + -15.0f, // OWL_WARP_MILK_ROAD + -31.0f, // OWL_WARP_WOODFALL + -30.0f, // OWL_WARP_SOUTHERN_SWAMP + -10.0f, // OWL_WARP_IKANA_CANYON + 11.0f, // OWL_WARP_STONE_TOWER }; -f32 D_8082BD84[] = { - -72.0f, -47.0f, -26.0f, -50.0f, -48.0f, -48.0f, -48.0f, -48.0f, -48.0f, +f32 sDungeonMapCursorsX[] = { + -72.0f, // DUNGEON_BOSS_KEY + -47.0f, // DUNGEON_COMPASS + -26.0f, // DUNGEON_MAP + -50.0f, // DUNGEON_STRAY_FAIRIES + -48.0f, // DUNGEON_FLOOR_INDEX_4 (top floor) + -48.0f, // DUNGEON_FLOOR_INDEX_3 + -48.0f, // DUNGEON_FLOOR_INDEX_2 + -48.0f, // DUNGEON_FLOOR_INDEX_1 + -48.0f, // DUNGEON_FLOOR_INDEX_0 (bottom floor) }; -f32 D_8082BDA8[] = { - -47.0f, -47.0f, -47.0f, -30.0f, 33.0f, 22.0f, 11.0f, -2.0f, -13.0f, +f32 sDungeonMapCursorsY[] = { + -47.0f, // DUNGEON_BOSS_KEY + -47.0f, // DUNGEON_COMPASS + -47.0f, // DUNGEON_MAP + -30.0f, // DUNGEON_STRAY_FAIRIES + 33.0f, // DUNGEON_FLOOR_INDEX_4 (top floor) + 22.0f, // DUNGEON_FLOOR_INDEX_3 + 11.0f, // DUNGEON_FLOOR_INDEX_2 + -2.0f, // DUNGEON_FLOOR_INDEX_1 + -13.0f, // DUNGEON_FLOOR_INDEX_0 (bottom floor) }; -f32 D_8082BDCC[] = { - 52.0f, 80.0f, 24.0f, 52.0f, 81.0f, 24.0f, -78.0f, -61.0f, -44.0f, -24.0f, -6.0f, -3.0f, - -78.0f, -61.0f, -44.0f, -24.0f, -6.0f, -3.0f, -68.0f, 22.0f, 83.0f, -67.0f, -21.0f, +f32 sQuestStatusCursorsX[] = { + 52.0f, // QUEST_REMAINS_ODOLWA + 80.0f, // QUEST_REMAINS_GOHT + 24.0f, // QUEST_REMAINS_GYORG + 52.0f, // QUEST_REMAINS_TWINMOLD + 81.0f, // QUEST_SHIELD + 24.0f, // QUEST_SWORD + -78.0f, // QUEST_SONG_SONATA + -61.0f, // QUEST_SONG_LULLABY + -44.0f, // QUEST_SONG_BOSSA_NOVA + -24.0f, // QUEST_SONG_ELEGY + -6.0f, // QUEST_SONG_OATH + -3.0f, // QUEST_SONG_SARIA + -78.0f, // QUEST_SONG_TIME + -61.0f, // QUEST_SONG_HEALING + -44.0f, // QUEST_SONG_EPONA + -24.0f, // QUEST_SONG_SOARING + -6.0f, // QUEST_SONG_STORMS + -3.0f, // QUEST_SONG_SUN + -68.0f, // QUEST_BOMBERS_NOTEBOOK + 22.0f, // QUEST_QUIVER + 83.0f, // QUEST_BOMB_BAG + -67.0f, // QUEST_SKULL_TOKEN + -21.0f, // QUEST_HEART_PIECE }; -f32 D_8082BE28[] = { - 33.0f, 18.0f, 18.0f, 0.0f, -23.0f, -23.0f, -29.0f, -29.0f, -29.0f, -29.0f, -29.0f, -29.0f, - -11.0f, -11.0f, -11.0f, -11.0f, -11.0f, -11.0f, 27.0f, -53.0f, -53.0f, 14.0f, 26.0f, +f32 sQuestStatusCursorsY[] = { + 33.0f, // QUEST_REMAINS_ODOLWA + 18.0f, // QUEST_REMAINS_GOHT + 18.0f, // QUEST_REMAINS_GYORG + 0.0f, // QUEST_REMAINS_TWINMOLD + -23.0f, // QUEST_SHIELD + -23.0f, // QUEST_SWORD + -29.0f, // QUEST_SONG_SONATA + -29.0f, // QUEST_SONG_LULLABY + -29.0f, // QUEST_SONG_BOSSA_NOVA + -29.0f, // QUEST_SONG_ELEGY + -29.0f, // QUEST_SONG_OATH + -29.0f, // QUEST_SONG_SARIA + -11.0f, // QUEST_SONG_TIME + -11.0f, // QUEST_SONG_HEALING + -11.0f, // QUEST_SONG_EPONA + -11.0f, // QUEST_SONG_SOARING + -11.0f, // QUEST_SONG_STORMS + -11.0f, // QUEST_SONG_SUN + 27.0f, // QUEST_BOMBERS_NOTEBOOK + -53.0f, // QUEST_QUIVER + -53.0f, // QUEST_BOMB_BAG + 14.0f, // QUEST_SKULL_TOKEN + 26.0f, // QUEST_HEART_PIECE }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_808274DC.s") +void KaleidoScope_UpdateCursorSize(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; + s16 index; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80827A8C.s") + pauseCtx->cursorVtx[0].v.ob[0] = pauseCtx->cursorVtx[2].v.ob[0] = -8; + pauseCtx->cursorVtx[1].v.ob[0] = pauseCtx->cursorVtx[3].v.ob[0] = pauseCtx->cursorVtx[0].v.ob[0] + 16; -s16 D_8082BE84 = 0; + pauseCtx->cursorVtx[0].v.ob[1] = pauseCtx->cursorVtx[1].v.ob[1] = 8; + pauseCtx->cursorVtx[2].v.ob[1] = pauseCtx->cursorVtx[3].v.ob[1] = pauseCtx->cursorVtx[0].v.ob[1] - 16; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80827E08.s") + if (pauseCtx->cursorSpecialPos == 0) { + switch (pauseCtx->pageIndex) { + case PAUSE_ITEM: + pauseCtx->cursorX = sItemMaskCursorsX[pauseCtx->cursorXIndex[PAUSE_ITEM]]; + pauseCtx->cursorY = sItemMaskCursorsY[pauseCtx->cursorYIndex[PAUSE_ITEM]]; + pauseCtx->cursorWidth = 15.0f; + pauseCtx->cursorHeight = 15.0f; + break; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/KaleidoScope_Draw.s") + case PAUSE_MAP: + if (!sInDungeonScene) { + if (IS_PAUSE_STATE_OWLWARP) { + pauseCtx->cursorX = sOwlWarpWorldMapCursorsX[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]; + pauseCtx->cursorY = sOwlWarpWorldMapCursorsY[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]; + } else { + pauseCtx->cursorX = sWorldMapCursorsX[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]; + pauseCtx->cursorY = sWorldMapCursorsY[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]; + } + if (!IS_PAUSE_STATE_OWLWARP) { + pauseCtx->cursorHeight = 10.0f; + pauseCtx->cursorWidth = 10.0f; + } else { + pauseCtx->cursorHeight = 15.0f; + pauseCtx->cursorWidth = 15.0f; + } + } else { + pauseCtx->cursorX = sDungeonMapCursorsX[pauseCtx->cursorPoint[PAUSE_MAP]]; + pauseCtx->cursorY = sDungeonMapCursorsY[pauseCtx->cursorPoint[PAUSE_MAP]]; + if (pauseCtx->cursorSlot[pauseCtx->pageIndex] >= DUNGEON_FLOOR_INDEX_4) { + // Floors + pauseCtx->cursorWidth = 18.0f; + pauseCtx->cursorHeight = 12.0f; + } else if (pauseCtx->cursorSlot[pauseCtx->pageIndex] == DUNGEON_STRAY_FAIRIES) { + // Stray Fairies + pauseCtx->cursorHeight = 12.0f; + pauseCtx->cursorWidth = 40.0f; + } else { + // Map, Compass, Boss Key + pauseCtx->cursorHeight = 15.0f; + pauseCtx->cursorWidth = 15.0f; + } + } + break; + + case PAUSE_QUEST: + if (!R_PAUSE_DBG_QUEST_CURSOR_ON) { + pauseCtx->cursorX = sQuestStatusCursorsX[pauseCtx->cursorPoint[PAUSE_QUEST]]; + pauseCtx->cursorY = sQuestStatusCursorsY[pauseCtx->cursorPoint[PAUSE_QUEST]]; + } else { + pauseCtx->cursorX = R_PAUSE_DBG_QUEST_CURSOR_X; + pauseCtx->cursorY = R_PAUSE_DBG_QUEST_CURSOR_Y; + } + pauseCtx->cursorHeight = 17.0f; + pauseCtx->cursorWidth = 17.0f; + if (pauseCtx->cursorSlot[pauseCtx->pageIndex] == QUEST_17) { + pauseCtx->cursorHeight = 25.0f; + pauseCtx->cursorWidth = 25.0f; + } else if (pauseCtx->cursorSlot[pauseCtx->pageIndex] <= QUEST_SWORD) { + pauseCtx->cursorHeight = 18.0f; + pauseCtx->cursorWidth = 18.0f; + } else if ((pauseCtx->cursorSlot[pauseCtx->pageIndex] >= QUEST_SONG_SONATA) && + (pauseCtx->cursorSlot[pauseCtx->pageIndex] <= QUEST_SONG_SUN)) { + pauseCtx->cursorHeight = 12.0f; + pauseCtx->cursorWidth = 12.0f; + } + break; + + case PAUSE_MASK: + pauseCtx->cursorX = sItemMaskCursorsX[pauseCtx->cursorXIndex[PAUSE_MASK]]; + pauseCtx->cursorY = sItemMaskCursorsY[pauseCtx->cursorYIndex[PAUSE_MASK]]; + pauseCtx->cursorWidth = 15.0f; + pauseCtx->cursorHeight = 15.0f; + break; + + default: + break; + } + + pauseCtx->cursorSpinPhase += 0x300; + } else { + if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { + pauseCtx->cursorX = -93.0f; + } else { // PAUSE_CURSOR_PAGE_RIGHT + pauseCtx->cursorX = 101.0f; + } + pauseCtx->cursorSpinPhase += 0x300; + pauseCtx->cursorHeight = 16.0f; + pauseCtx->cursorWidth = 16.0f; + pauseCtx->cursorY = -4.0f; + } + + if (pauseCtx->cursorWidth < pauseCtx->cursorShrinkRate) { + pauseCtx->cursorWidth = 0; + } else { + pauseCtx->cursorWidth -= pauseCtx->cursorShrinkRate; + } + + if (pauseCtx->cursorHeight < pauseCtx->cursorShrinkRate) { + pauseCtx->cursorHeight = 0.0f; + } else { + pauseCtx->cursorHeight -= pauseCtx->cursorShrinkRate; + } + + if (pauseCtx->cursorShrinkRate != 0.0f) { + pauseCtx->cursorShrinkRate -= 1.0f; + } + + sCursorCirclesX[0] = Math_SinS(pauseCtx->cursorSpinPhase) * pauseCtx->cursorWidth; + sCursorCirclesX[1] = Math_SinS(pauseCtx->cursorSpinPhase + 0x4000) * pauseCtx->cursorWidth; + sCursorCirclesX[2] = Math_SinS(pauseCtx->cursorSpinPhase + 0x8000) * pauseCtx->cursorWidth; + sCursorCirclesX[3] = Math_SinS(pauseCtx->cursorSpinPhase + 0xC000) * pauseCtx->cursorWidth; + sCursorCirclesY[0] = Math_CosS(pauseCtx->cursorSpinPhase) * pauseCtx->cursorHeight; + sCursorCirclesY[1] = Math_CosS(pauseCtx->cursorSpinPhase + 0x4000) * pauseCtx->cursorHeight; + sCursorCirclesY[2] = Math_CosS(pauseCtx->cursorSpinPhase + 0x8000) * pauseCtx->cursorHeight; + sCursorCirclesY[3] = Math_CosS(pauseCtx->cursorSpinPhase + 0xC000) * pauseCtx->cursorHeight; +} + +void KaleidoScope_DrawCursor(PlayState* play) { + PauseContext* pauseCtx = &play->pauseCtx; + s16 i; + + OPEN_DISPS(play->state.gfxCtx); + + if ((pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG) || + ((pauseCtx->pageIndex == PAUSE_QUEST) && ((pauseCtx->mainState <= PAUSE_MAIN_STATE_SONG_PLAYBACK) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PROMPT) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG)))) { + gDPPipeSync(POLY_OPA_DISP++); + gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sCursorPrimR, sCursorPrimG, sCursorPrimB, 255); + gDPSetEnvColor(POLY_OPA_DISP++, sCursorEnvR, sCursorEnvG, sCursorEnvB, 255); + + Matrix_Translate(pauseCtx->cursorX, pauseCtx->cursorY, -50.0f, MTXMODE_NEW); + Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); + + for (i = 0; i < 4; i++) { + Matrix_Push(); + Matrix_Translate(sCursorCirclesX[i], sCursorCirclesY[i], -50.0f, MTXMODE_APPLY); + gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPPipeSync(POLY_OPA_DISP++); + gDPLoadTextureBlock(POLY_OPA_DISP++, &D_08064340, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 16, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, + G_TX_NOLOD, G_TX_NOLOD); + gSPVertex(POLY_OPA_DISP++, &pauseCtx->cursorVtx[0], 4, 0); + gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0); + Matrix_Pop(); + } + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); + } + + CLOSE_DISPS(play->state.gfxCtx); +} + +void KaleidoScope_DrawGameOver(PlayState* play) { + static s16 sGameOverUlt = 0; + GraphicsContext* gfxCtx = play->state.gfxCtx; + + OPEN_DISPS(gfxCtx); + + Gfx_SetupDL39_Opa(gfxCtx); + + gDPSetCycleType(POLY_OPA_DISP++, G_CYC_2CYCLE); + gDPSetRenderMode(POLY_OPA_DISP++, G_RM_PASS, G_RM_XLU_SURF2); + gDPSetCombineLERP(POLY_OPA_DISP++, TEXEL1, TEXEL0, PRIM_LOD_FRAC, TEXEL0, 0, 0, 0, TEXEL0, PRIMITIVE, ENVIRONMENT, + COMBINED, ENVIRONMENT, COMBINED, 0, PRIMITIVE, 0); + + gDPSetPrimColor(POLY_OPA_DISP++, 0, 80, sGameOverPrimR, sGameOverPrimG, sGameOverPrimB, sGameOverPrimAlpha); + gDPSetEnvColor(POLY_OPA_DISP++, sGameOverEnvR, sGameOverEnvG, sGameOverEnvB, 255); + + sGameOverUlt -= 2; + + gDPLoadTextureBlock(POLY_OPA_DISP++, gGameOverP1Tex, G_IM_FMT_IA, G_IM_SIZ_8b, 64, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + + gDPLoadMultiBlock(POLY_OPA_DISP++, gGameOverMaskTex, 256, 1, G_IM_FMT_IA, G_IM_SIZ_8b, 64, 32, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, 5, G_TX_NOLOD, G_TX_NOLOD); + + gDPSetTileSize(POLY_OPA_DISP++, 1, 0, sGameOverUlt & 0x7F, 252, (sGameOverUlt & 0x7F) + 124); + + gSPTextureRectangle(POLY_OPA_DISP++, 0x100, sGameOverRectPosY << 2, 0x200, (sGameOverRectPosY + 32) << 2, + G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + + gDPLoadTextureBlock(POLY_OPA_DISP++, gGameOverP2Tex, G_IM_FMT_IA, G_IM_SIZ_8b, 64, 32, 0, + G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, + G_TX_NOLOD); + + gSPTextureRectangle(POLY_OPA_DISP++, 0x200, sGameOverRectPosY << 2, 0x300, (sGameOverRectPosY + 32) << 2, + G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + + gDPLoadTextureBlock(POLY_OPA_DISP++, gGameOverP3Tex, G_IM_FMT_IA, G_IM_SIZ_8b, 64, 32, 0, + G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, + G_TX_NOLOD); + + gSPTextureRectangle(POLY_OPA_DISP++, 0x300, sGameOverRectPosY << 2, 0x400, (sGameOverRectPosY + 32) << 2, + G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); + + CLOSE_DISPS(gfxCtx); +} + +void KaleidoScope_Draw(PlayState* play) { + s32 pad; + PauseContext* pauseCtx = &play->pauseCtx; + InterfaceContext* interfaceCtx = &play->interfaceCtx; + + OPEN_DISPS(play->state.gfxCtx); + + gSPSegment(POLY_OPA_DISP++, 0x02, interfaceCtx->parameterSegment); + gSPSegment(POLY_OPA_DISP++, 0x08, pauseCtx->iconItemSegment); + gSPSegment(POLY_OPA_DISP++, 0x09, pauseCtx->iconItem24Segment); + gSPSegment(POLY_OPA_DISP++, 0x0A, pauseCtx->nameSegment); + gSPSegment(POLY_OPA_DISP++, 0x0C, pauseCtx->iconItemAltSegment); + gSPSegment(POLY_OPA_DISP++, 0x0D, pauseCtx->iconItemLangSegment); + gSPSegment(POLY_OPA_DISP++, 0x0B, pauseCtx->iconItemVtxSegment); + + if (pauseCtx->debugEditor == DEBUG_EDITOR_NONE) { + KaleidoScope_SetView(pauseCtx, pauseCtx->eye.x, pauseCtx->eye.y, pauseCtx->eye.z); + Gfx_SetupDL42_Opa(play->state.gfxCtx); + + if (!IS_PAUSE_STATE_OWLWARP) { + // Draw Default or Game Over Menus + KaleidoScope_SetVertices(play, play->state.gfxCtx); + KaleidoScope_DrawPages(play, play->state.gfxCtx); + + Gfx_SetupDL42_Opa(play->state.gfxCtx); + gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + + KaleidoScope_SetView(pauseCtx, 0.0f, 0.0f, 64.0f); + + if (!IS_PAUSE_STATE_GAMEOVER) { + KaleidoScope_DrawInfoPanel(play); + } + + KaleidoScope_UpdateCursorSize(play); + + if (pauseCtx->state == PAUSE_STATE_MAIN) { + KaleidoScope_DrawCursor(play); + } + + if ((pauseCtx->state >= PAUSE_STATE_GAMEOVER_3) && (pauseCtx->state <= PAUSE_STATE_GAMEOVER_10) && + (play->gameOverCtx.state != GAMEOVER_INACTIVE)) { + KaleidoScope_DrawGameOver(play); + } + } else { + // Draw Owl Warp Menu + KaleidoScope_SetVertices(play, play->state.gfxCtx); + KaleidoScope_DrawPages(play, play->state.gfxCtx); + KaleidoScope_DrawOwlWarpMapPage(play); + + Gfx_SetupDL42_Opa(play->state.gfxCtx); + gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + + KaleidoScope_SetView(pauseCtx, 0.0f, 0.0f, 64.0f); + KaleidoScope_DrawOwlWarpInfoPanel(play); + KaleidoScope_UpdateCursorSize(play); + + if (pauseCtx->state == PAUSE_STATE_OWLWARP_SELECT) { + KaleidoScope_DrawCursor(play); + } + } + } + + if ((pauseCtx->debugEditor == DEBUG_EDITOR_INVENTORY_INIT) || (pauseCtx->debugEditor == DEBUG_EDITOR_INVENTORY)) { + KaleidoScope_DrawInventoryEditor(play); + } + + CLOSE_DISPS(play->state.gfxCtx); +} void KaleidoScope_GrayOutTextureRGBA32(u32* texture, u16 pixelCount) { u32 rgb; @@ -1641,10 +2778,10 @@ void KaleidoScope_UpdateOpening(PlayState* play) { Interface_UpdateButtonsAlt(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_B] = gPageSwitchNextButtonStatus[pauseCtx->pageIndex][0]; + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = gPageSwitchNextButtonStatus[pauseCtx->pageIndex][1]; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = gPageSwitchNextButtonStatus[pauseCtx->pageIndex][1]; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = gPageSwitchNextButtonStatus[pauseCtx->pageIndex][1]; gSaveContext.buttonStatus[EQUIP_SLOT_A] = BTN_ENABLED; } else { gSaveContext.buttonStatus[EQUIP_SLOT_B] = BTN_ENABLED; @@ -1723,7 +2860,7 @@ void KaleidoScope_Update(PlayState* play) { size0 = SEGMENT_ROM_SIZE(icon_item_static_old); CmpDma_LoadAllFiles((uintptr_t)SEGMENT_ROM_START(icon_item_static_test), pauseCtx->iconItemSegment, size0); - gSegments[0x08] = PHYSICAL_TO_VIRTUAL(pauseCtx->iconItemSegment); + gSegments[0x08] = VIRTUAL_TO_PHYSICAL(pauseCtx->iconItemSegment); for (itemId = 0; itemId <= ITEM_BOW_ARROW_FIRE; itemId++) { if (!gPlayerFormItemRestrictions[(void)0, gSaveContext.save.playerForm][(s32)itemId]) { @@ -1760,7 +2897,7 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->nameSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemLangSegment + size2); func_8011552C(play, DO_ACTION_INFO); if (((void)0, gSaveContext.worldMapArea) < 0x16) { - func_8082192C(pauseCtx->nameSegment + 0x400, ((void)0, gSaveContext.worldMapArea)); + Kaleido_LoadMapNameStaticLarge(pauseCtx->nameSegment + 0x400, ((void)0, gSaveContext.worldMapArea)); } pauseCtx->iconItemVtxSegment = (void*)ALIGN16((uintptr_t)pauseCtx->nameSegment + 0xA00); @@ -1903,7 +3040,7 @@ void KaleidoScope_Update(PlayState* play) { case PAUSE_STATE_SAVEPROMPT: switch (pauseCtx->savePromptState) { - case PAUSE_SAVEPROMPT_STATE_0: + case PAUSE_SAVEPROMPT_STATE_APPEARING: pauseCtx->roll -= 78.5f; sPauseCursorLeftX -= (s16)(sPauseCursorLeftMoveOffsetX / 4); sPauseCursorRightX -= (s16)(sPauseCursorRightMoveOffsetX / 4); @@ -1917,7 +3054,7 @@ void KaleidoScope_Update(PlayState* play) { 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, DO_ACTION_NONE); - pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_2; + pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_RETURN_TO_MENU; } else { play_sound(NA_SE_SY_PIECE_OF_HEART); Play_SaveCycleSceneFlags(&play->state); @@ -1941,7 +3078,7 @@ void KaleidoScope_Update(PlayState* play) { func_801A3AEC(0); } else if (CHECK_BTN_ALL(input->press.button, BTN_B)) { func_8011552C(play, DO_ACTION_NONE); - pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_2; + pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_RETURN_TO_MENU; D_8082B90C = pauseCtx->roll; } break; @@ -1987,26 +3124,31 @@ void KaleidoScope_Update(PlayState* play) { } break; - case PAUSE_SAVEPROMPT_STATE_2: + case PAUSE_SAVEPROMPT_STATE_RETURN_TO_MENU: 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->savePromptState = PAUSE_SAVEPROMPT_STATE_APPEARING; pauseCtx->roll = -314.0f; pauseCtx->itemPageRoll = pauseCtx->mapPageRoll = pauseCtx->questPageRoll = pauseCtx->maskPageRoll = 0.0f; func_8011552C(play, DO_ACTION_INFO); - 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]; + gSaveContext.buttonStatus[EQUIP_SLOT_B] = + gPageSwitchNextButtonStatus[pauseCtx->pageIndex + 1][0]; + gSaveContext.buttonStatus[EQUIP_SLOT_C_LEFT] = + gPageSwitchNextButtonStatus[pauseCtx->pageIndex + 1][1]; + gSaveContext.buttonStatus[EQUIP_SLOT_C_DOWN] = + gPageSwitchNextButtonStatus[pauseCtx->pageIndex + 1][1]; + gSaveContext.buttonStatus[EQUIP_SLOT_C_RIGHT] = + gPageSwitchNextButtonStatus[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); + KaleidoScope_MoveCursorFromSpecialPos(play); } } break; @@ -2304,7 +3446,7 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->nameSegment = (void*)ALIGN16((uintptr_t)pauseCtx->iconItemLangSegment + size2); func_8011552C(play, DO_ACTION_WARP); worldMapCursorPoint = pauseCtx->cursorPoint[PAUSE_WORLD_MAP]; - func_80821900(pauseCtx->nameSegment, worldMapCursorPoint); + Kaleido_LoadMapNameStatic(pauseCtx->nameSegment, worldMapCursorPoint); pauseCtx->iconItemVtxSegment = (void*)ALIGN16((uintptr_t)pauseCtx->nameSegment + 0xA00); DmaMgr_SendRequest0(pauseCtx->iconItemVtxSegment, SEGMENT_ROM_START(icon_item_vtx_static), diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 0422c71e2b..a28ff61320 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -4218,28 +4218,28 @@ 0x808204AC:("KaleidoScope_UpdateMaskCursor",), 0x80820FA4:("KaleidoScope_UpdateMaskEquip",), 0x80821730:("KaleidoScope_UpdatePrompt",), - 0x80821900:("func_80821900",), - 0x8082192C:("func_8082192C",), - 0x80821958:("func_80821958",), + 0x80821900:("Kaleido_LoadMapNameStatic",), + 0x8082192C:("Kaleido_LoadMapNameStaticLarge",), + 0x80821958:("Kaleido_LoadItemNameStatic",), 0x80821984:("KaleidoScope_MoveCursorToSpecialPos",), - 0x80821A04:("func_80821A04",), + 0x80821A04:("KaleidoScope_MoveCursorFromSpecialPos",), 0x80821AD4:("KaleidoScope_DrawTexQuadRGBA32",), - 0x80821CC4:("func_80821CC4",), + 0x80821CC4:("KaleidoScope_SwitchPage",), 0x80821D84:("KaleidoScope_HandlePageToggles",), 0x80821F30:("KaleidoScope_DrawPageSections",), 0x808221DC:("KaleidoScope_DrawPages",), - 0x80823350:("func_80823350",), + 0x80823350:("KaleidoScope_DrawInfoPanel",), 0x80824738:("KaleidoScope_UpdateNamePanel",), 0x808248D0:("KaleidoScope_DrawOwlWarpMapPage",), - 0x80824B90:("func_80824B90",), + 0x80824B90:("KaleidoScope_DrawOwlWarpInfoPanel",), 0x808256E4:("KaleidoScope_UpdateOwlWarpNamePanel",), 0x8082585C:("KaleidoScope_UpdateSwitchPage",), 0x808259D4:("KaleidoScope_SetView",), 0x80825A50:("KaleidoScope_SetPageVertices",), 0x80825E28:("KaleidoScope_SetVertices",), - 0x808274DC:("func_808274DC",), - 0x80827A8C:("func_80827A8C",), - 0x80827E08:("func_80827E08",), + 0x808274DC:("KaleidoScope_UpdateCursorSize",), + 0x80827A8C:("KaleidoScope_DrawCursor",), + 0x80827E08:("KaleidoScope_DrawGameOver",), 0x808283D8:("KaleidoScope_Draw",), 0x808286D8:("KaleidoScope_GrayOutTextureRGBA32",), 0x80828788:("KaleidoScope_UpdateOpening",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index f3f90ba256..f58d54a87b 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -1967,7 +1967,7 @@ 0x801C6A8C:("D_801C6A8C","UNK_TYPE2","",0x2), 0x801C6A90:("D_801C6A90","UNK_TYPE2","",0x2), 0x801C6A94:("D_801C6A94","UNK_TYPE2","",0x2), - 0x801C6A98:("D_801C6A98","UNK_TYPE1","",0x1), + 0x801C6A98:("gPageSwitchNextButtonStatus","UNK_TYPE1","",0x1), 0x801C6AB8:("D_801C6AB8","UNK_TYPE1","",0x1), 0x801C6B28:("D_801C6B28","UNK_TYPE1","",0x1), 0x801C6B98:("D_801C6B98","UNK_TYPE1","",0x1), @@ -4638,7 +4638,7 @@ 0x80816004:("sDayRightTextures","TexturePtr","[4]",0x10), 0x80816014:("sHoursLeftTextures","TexturePtr","[3]",0xC), 0x8082AED0:("sQuestRemainsColorTimerInit","UNK_TYPE1","",0x1), - 0x8082AED8:("sQuestHpColorTimerInit","UNK_TYPE1","",0x1), + 0x8082AED8:("sQuestHpColorTimerInits","UNK_TYPE1","",0x1), 0x8082AEE0:("sQuestSongPlayedOcarinaButtonsNum","UNK_TYPE2","",0x2), 0x8082AEE4:("sQuestSongPlayedOcarinaButtons","UNK_TYPE1","",0x1), 0x8082AEF0:("sQuestSongPlayedOcarinaButtonsAlpha","UNK_TYPE2","",0x2), @@ -4744,7 +4744,7 @@ 0x8082B918:("sPauseCursorLeftX","UNK_TYPE2","",0x2), 0x8082B91C:("sPauseCursorRightX","UNK_TYPE2","",0x2), 0x8082B920:("D_8082B920","UNK_TYPE2","",0x2), - 0x8082B924:("D_8082B924","UNK_TYPE2","",0x2), + 0x8082B924:("sPauseZRCursorColorTimerInits","UNK_TYPE2","",0x2), 0x8082B944:("sGameOverRectPosY","UNK_TYPE2","",0x2), 0x8082B948:("sCursorPrimColorTarget","UNK_TYPE2","",0x2), 0x8082B96C:("sCursorEnvColorTarget","UNK_TYPE2","",0x2), @@ -4752,12 +4752,12 @@ 0x8082B994:("sCursorColorTargetIndex","UNK_TYPE2","",0x2), 0x8082B998:("D_8082B998","UNK_TYPE1","",0x1), 0x8082B9A8:("D_8082B9A8","UNK_TYPE1","",0x1), - 0x8082B9B8:("D_8082B9B8","UNK_TYPE1","",0x1), - 0x8082B9C8:("D_8082B9C8","UNK_TYPE2","",0x2), - 0x8082B9CC:("D_8082B9CC","UNK_TYPE2","",0x2), - 0x8082B9D0:("D_8082B9D0","UNK_TYPE1","",0x1), - 0x8082B9E0:("D_8082B9E0","UNK_TYPE2","",0x2), - 0x8082B9E4:("D_8082B9E4","UNK_TYPE2","",0x2), + 0x8082B9B8:("sPauseZRCursorColorTargets","UNK_TYPE1","",0x1), + 0x8082B9C8:("sPauseZRCursorColorTimer","UNK_TYPE2","",0x2), + 0x8082B9CC:("sPauseZRCursorColorIndex","UNK_TYPE2","",0x2), + 0x8082B9D0:("sPauseZRCursorColorTargets","UNK_TYPE1","",0x1), + 0x8082B9E0:("sPauseZRCursorColorTimer","UNK_TYPE2","",0x2), + 0x8082B9E4:("sPauseZRCursorColorIndex","UNK_TYPE2","",0x2), 0x8082B9E8:("sVtxPageMaskQuadsX","UNK_TYPE1","",0x1), 0x8082B9EC:("sVtxPageItemQuadsX","UNK_TYPE1","",0x1), 0x8082B9F0:("sVtxPageMapDungeonQuadsX","UNK_TYPE1","",0x1), @@ -4789,17 +4789,17 @@ 0x8082BBC4:("sQuestVtxRectTop","UNK_TYPE2","",0x2), 0x8082BC14:("sQuestVtxWidths","UNK_TYPE2","",0x2), 0x8082BC64:("sQuestVtxHeights","UNK_TYPE2","",0x2), - 0x8082BCB4:("D_8082BCB4","UNK_TYPE1","",0x1), - 0x8082BCCC:("D_8082BCCC","UNK_TYPE1","",0x1), - 0x8082BCDC:("D_8082BCDC","UNK_TYPE1","",0x1), - 0x8082BD08:("D_8082BD08","UNK_TYPE1","",0x1), - 0x8082BD34:("D_8082BD34","UNK_TYPE1","",0x1), - 0x8082BD5C:("D_8082BD5C","UNK_TYPE1","",0x1), - 0x8082BD84:("D_8082BD84","UNK_TYPE1","",0x1), - 0x8082BDA8:("D_8082BDA8","UNK_TYPE1","",0x1), - 0x8082BDCC:("D_8082BDCC","UNK_TYPE1","",0x1), - 0x8082BE28:("D_8082BE28","UNK_TYPE1","",0x1), - 0x8082BE84:("D_8082BE84","UNK_TYPE2","",0x2), + 0x8082BCB4:("sItemMaskCursorsX","UNK_TYPE1","",0x1), + 0x8082BCCC:("sItemMaskCursorsY","UNK_TYPE1","",0x1), + 0x8082BCDC:("sWorldMapCursorsX","UNK_TYPE1","",0x1), + 0x8082BD08:("sWorldMapCursorsY","UNK_TYPE1","",0x1), + 0x8082BD34:("sOwlWarpWorldMapCursorsX","UNK_TYPE1","",0x1), + 0x8082BD5C:("sOwlWarpWorldMapCursorsY","UNK_TYPE1","",0x1), + 0x8082BD84:("sDungeonMapCursorsX","UNK_TYPE1","",0x1), + 0x8082BDA8:("sDungeonMapCursorsY","UNK_TYPE1","",0x1), + 0x8082BDCC:("sQuestStatusCursorsX","UNK_TYPE1","",0x1), + 0x8082BE28:("sQuestStatusCursorsY","UNK_TYPE1","",0x1), + 0x8082BE84:("sGameOverUlt","UNK_TYPE2","",0x2), 0x8082BE88:("sCursorPointsToOcarinaModes","UNK_TYPE1","",0x1), 0x8082BE9C:("sUnpausedHudVisibility","UNK_TYPE2","",0x2), 0x8082BEA0:("sNextMainState","UNK_TYPE2","",0x2), @@ -4921,23 +4921,23 @@ 0x8082C0E4:("jtbl_8082C0E4","UNK_PTR","",0x4), 0x8082C148:("jtbl_8082C148","UNK_PTR","",0x4), 0x8082C18C:("jtbl_8082C18C","UNK_PTR","",0x4), - 0x8082DA50:("D_8082DA50","UNK_TYPE1","",0x1), - 0x8082DA52:("D_8082DA52","UNK_TYPE1","",0x1), - 0x8082DA54:("D_8082DA54","UNK_TYPE1","",0x1), - 0x8082DA56:("D_8082DA56","UNK_TYPE1","",0x1), + 0x8082DA50:("sPauseZRCursorRed","UNK_TYPE1","",0x1), + 0x8082DA52:("sPauseZRCursorGreen","UNK_TYPE1","",0x1), + 0x8082DA54:("sPauseZRCursorBlue","UNK_TYPE1","",0x1), + 0x8082DA56:("sPauseZRCursorAlpha","UNK_TYPE1","",0x1), 0x8082DA58:("sUnpausedButtonStatus","UNK_TYPE1","",0x1), - 0x8082DA60:("D_8082DA60","f32","",0x4), + 0x8082DA60:("sCursorCirclesX","f32","",0x4), 0x8082DA64:("D_8082DA64","f32","",0x4), 0x8082DA68:("D_8082DA68","f32","",0x4), 0x8082DA6C:("D_8082DA6C","f32","",0x4), - 0x8082DA70:("D_8082DA70","f32","",0x4), + 0x8082DA70:("sCursorCirclesY","f32","",0x4), 0x8082DA74:("D_8082DA74","f32","",0x4), 0x8082DA78:("D_8082DA78","f32","",0x4), 0x8082DA7C:("D_8082DA7C","f32","",0x4), - 0x8082DA80:("D_8082DA80","UNK_TYPE1","",0x1), - 0x8082DA82:("D_8082DA82","UNK_TYPE1","",0x1), - 0x8082DA84:("D_8082DA84","UNK_TYPE1","",0x1), - 0x8082DA86:("D_8082DA86","UNK_TYPE1","",0x1), + 0x8082DA80:("sPauseZRCursorRed","UNK_TYPE1","",0x1), + 0x8082DA82:("sPauseZRCursorGreen","UNK_TYPE1","",0x1), + 0x8082DA84:("sPauseZRCursorBlue","UNK_TYPE1","",0x1), + 0x8082DA86:("sPauseZRCursorAlpha","UNK_TYPE1","",0x1), 0x8085B9F0:("D_8085B9F0","UNK_TYPE1","",0x1), 0x8085BA08:("D_8085BA08","UNK_TYPE1","",0x1), 0x8085BA20:("D_8085BA20","UNK_TYPE1","",0x1), diff --git a/undefined_syms.txt b/undefined_syms.txt index 7ef51ef241..aad4bba7b0 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -1159,20 +1159,6 @@ D_0B000188 = 0x0B000188; // segment 0x0C D_0C000000 = 0x0C000000; -D_0C000800 = 0x0C000800; -D_0C001000 = 0x0C001000; -D_0C001800 = 0x0C001800; -D_0C001980 = 0x0C001980; -D_0C006C00 = 0x0C006C00; -D_0C006E00 = 0x0C006E00; -D_0C014668 = 0x0C014668; - -// segment 0x0D - -D_0D002000 = 0x0D002000; -D_0D002200 = 0x0D002200; -D_0D002400 = 0x0D002400; -D_0D003700 = 0x0D003700; // segment 0x0E