diff --git a/include/z64item.h b/include/z64item.h index 28c2aa1903..60344f326c 100644 --- a/include/z64item.h +++ b/include/z64item.h @@ -113,7 +113,8 @@ typedef enum QuestItem { /* 0x15 */ QUEST_STONE_OF_AGONY, /* 0x16 */ QUEST_GERUDOS_CARD, /* 0x17 */ QUEST_SKULL_TOKEN, - /* 0x1C */ QUEST_HEART_PIECE_COUNT = 0x1C + /* 0x18 */ QUEST_HEART_PIECE, // for `pauseCtx->cursorPoint[PAUSE_QUEST]` + /* 0x1C */ QUEST_HEART_PIECE_COUNT = 0x1C // for accessing the `Inventory.questItems` bitfield } QuestItem; typedef enum DungeonItem { diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c index f706f13b99..e9379aaaf9 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c @@ -24,20 +24,21 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { // Shining medallions static s16 sMedallionsEnvColors[6 + 6][3] = { - // Target env color when sMedEnvShineState == 0 - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - { 0, 0, 0 }, - // Target env color when sMedEnvShineState == 2 - { 0, 60, 0 }, - { 90, 0, 0 }, - { 0, 40, 110 }, - { 80, 40, 0 }, - { 70, 0, 90 }, - { 90, 90, 0 }, + // Target env color when sMedallionsEnvShineState == 0 + { 0, 0, 0 }, // QUEST_MEDALLION_FOREST + { 0, 0, 0 }, // QUEST_MEDALLION_FIRE + { 0, 0, 0 }, // QUEST_MEDALLION_WATER + { 0, 0, 0 }, // QUEST_MEDALLION_SPIRIT + { 0, 0, 0 }, // QUEST_MEDALLION_SHADOW + { 0, 0, 0 }, // QUEST_MEDALLION_LIGHT + + // Target env color when sMedallionsEnvShineState == 2 + { 0, 60, 0 }, // QUEST_MEDALLION_FOREST + { 90, 0, 0 }, // QUEST_MEDALLION_FIRE + { 0, 40, 110 }, // QUEST_MEDALLION_WATER + { 80, 40, 0 }, // QUEST_MEDALLION_SPIRIT + { 70, 0, 90 }, // QUEST_MEDALLION_SHADOW + { 90, 90, 0 }, // QUEST_MEDALLION_LIGHT }; // Current (animated) env color for each medallion static s16 sMedallionsEnvRed[6] = { 255, 255, 255, 255, 255, 255 }; @@ -70,13 +71,46 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { static s32 sUnused = 0; static s16 sSongsPrimRed[] = { - 150, 255, 100, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 150, // QUEST_SONG_MINUET + 255, // QUEST_SONG_BOLERO + 100, // QUEST_SONG_SERENADE + 255, // QUEST_SONG_REQUIEM + 255, // QUEST_SONG_NOCTURNE + 255, // QUEST_SONG_PRELUDE + 255, // QUEST_SONG_LULLABY + 255, // QUEST_SONG_EPONA + 255, // QUEST_SONG_SARIA + 255, // QUEST_SONG_SUN + 255, // QUEST_SONG_TIME + 255, // QUEST_SONG_STORMS }; static s16 sSongsPrimGreen[] = { - 255, 80, 150, 160, 100, 240, 255, 255, 255, 255, 255, 255, + 255, // QUEST_SONG_MINUET + 80, // QUEST_SONG_BOLERO + 150, // QUEST_SONG_SERENADE + 160, // QUEST_SONG_REQUIEM + 100, // QUEST_SONG_NOCTURNE + 240, // QUEST_SONG_PRELUDE + 255, // QUEST_SONG_LULLABY + 255, // QUEST_SONG_EPONA + 255, // QUEST_SONG_SARIA + 255, // QUEST_SONG_SUN + 255, // QUEST_SONG_TIME + 255, // QUEST_SONG_STORMS }; static s16 sSongsPrimBlue[] = { - 100, 40, 255, 0, 255, 100, 255, 255, 255, 255, 255, 255, + 100, // QUEST_SONG_MINUET + 40, // QUEST_SONG_BOLERO + 255, // QUEST_SONG_SERENADE + 0, // QUEST_SONG_REQUIEM + 255, // QUEST_SONG_NOCTURNE + 100, // QUEST_SONG_PRELUDE + 255, // QUEST_SONG_LULLABY + 255, // QUEST_SONG_EPONA + 255, // QUEST_SONG_SARIA + 255, // QUEST_SONG_SUN + 255, // QUEST_SONG_TIME + 255, // QUEST_SONG_STORMS }; static s8 D_8082A1AC[][4] = { @@ -173,18 +207,20 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } - if (pauseCtx->cursorPoint[PAUSE_QUEST] != 0x18) { + if (pauseCtx->cursorPoint[PAUSE_QUEST] != QUEST_HEART_PIECE) { if (CHECK_QUEST_ITEM(pauseCtx->cursorPoint[PAUSE_QUEST])) { - if (pauseCtx->cursorPoint[PAUSE_QUEST] < 6) { - cursorItem = ITEM_MEDALLION_FOREST + pauseCtx->cursorPoint[PAUSE_QUEST]; + if (pauseCtx->cursorPoint[PAUSE_QUEST] < QUEST_SONG_MINUET) { + cursorItem = + ITEM_MEDALLION_FOREST - QUEST_MEDALLION_FOREST + pauseCtx->cursorPoint[PAUSE_QUEST]; PRINTF("000 ccc=%d\n", cursorItem); - } else if (pauseCtx->cursorPoint[PAUSE_QUEST] < 0x12) { - cursorItem = ITEM_SCALE_GOLDEN + pauseCtx->cursorPoint[PAUSE_QUEST]; + } else if (pauseCtx->cursorPoint[PAUSE_QUEST] < QUEST_KOKIRI_EMERALD) { + cursorItem = ITEM_SONG_MINUET - QUEST_SONG_MINUET + pauseCtx->cursorPoint[PAUSE_QUEST]; PRINTF("111 ccc=%d\n", cursorItem); } else { - cursorItem = ITEM_SONG_MINUET + pauseCtx->cursorPoint[PAUSE_QUEST]; - PRINTF("222 ccc=%d (%d, %d, %d)\n", cursorItem, pauseCtx->cursorPoint[PAUSE_QUEST], 0x12, - 0x6C); + cursorItem = + ITEM_KOKIRI_EMERALD - QUEST_KOKIRI_EMERALD + pauseCtx->cursorPoint[PAUSE_QUEST]; + PRINTF("222 ccc=%d (%d, %d, %d)\n", cursorItem, pauseCtx->cursorPoint[PAUSE_QUEST], + QUEST_KOKIRI_EMERALD, ITEM_KOKIRI_EMERALD); } } else { cursorItem = PAUSE_ITEM_NONE; @@ -255,7 +291,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { } } else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { if (pauseCtx->stickAdjX > 30) { - pauseCtx->cursorPoint[PAUSE_QUEST] = 0x15; + pauseCtx->cursorPoint[PAUSE_QUEST] = QUEST_STONE_OF_AGONY; pauseCtx->nameDisplayTimer = 0; pauseCtx->cursorSpecialPos = 0; sp216 = pauseCtx->cursorPoint[PAUSE_QUEST]; @@ -263,7 +299,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (CHECK_QUEST_ITEM(pauseCtx->cursorPoint[PAUSE_QUEST])) { - cursorItem = ITEM_SONG_MINUET + pauseCtx->cursorPoint[PAUSE_QUEST]; + cursorItem = ITEM_STONE_OF_AGONY - QUEST_STONE_OF_AGONY + pauseCtx->cursorPoint[PAUSE_QUEST]; } else { cursorItem = PAUSE_ITEM_NONE; } @@ -273,7 +309,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { } } else { if (pauseCtx->stickAdjX < -30) { - pauseCtx->cursorPoint[PAUSE_QUEST] = 0; + pauseCtx->cursorPoint[PAUSE_QUEST] = QUEST_MEDALLION_FOREST; pauseCtx->nameDisplayTimer = 0; pauseCtx->cursorSpecialPos = 0; sp216 = pauseCtx->cursorPoint[PAUSE_QUEST]; @@ -281,12 +317,16 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (CHECK_QUEST_ITEM(pauseCtx->cursorPoint[PAUSE_QUEST])) { - if (pauseCtx->cursorPoint[PAUSE_QUEST] < 6) { - cursorItem = ITEM_MEDALLION_FOREST + pauseCtx->cursorPoint[PAUSE_QUEST]; - } else if (pauseCtx->cursorPoint[PAUSE_QUEST] < 0xC) { - cursorItem = ITEM_BOMB_BAG_30 + pauseCtx->cursorPoint[PAUSE_QUEST]; + // Only the first if may be reached, as QUEST_MEDALLION_FOREST is set above + if (pauseCtx->cursorPoint[PAUSE_QUEST] < QUEST_SONG_MINUET) { + cursorItem = + ITEM_MEDALLION_FOREST - QUEST_MEDALLION_FOREST + pauseCtx->cursorPoint[PAUSE_QUEST]; + } else if (pauseCtx->cursorPoint[PAUSE_QUEST] < QUEST_SONG_LULLABY) { + // this would result in the wrong item + cursorItem = ITEM_SCALE_GOLDEN - QUEST_SONG_MINUET + pauseCtx->cursorPoint[PAUSE_QUEST]; } else { - cursorItem = ITEM_MEDALLION_SPIRIT + pauseCtx->cursorPoint[PAUSE_QUEST]; + // this would result in the wrong item + cursorItem = ITEM_DUNGEON_COMPASS - QUEST_SONG_LULLABY + pauseCtx->cursorPoint[PAUSE_QUEST]; } } else { cursorItem = PAUSE_ITEM_NONE; @@ -344,7 +384,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { sMedallionsEnvTimer--; - for (j = 0, bufI = 0; j < 6; j++, bufI += 4) { + for (j = 0, bufI = 0; j < QUEST_SONG_MINUET - QUEST_MEDALLION_FOREST; j++, bufI += 4) { if ((sMedallionsEnvShineState != 1) && (sMedallionsEnvShineState != 3)) { targetColorIndex = (sMedallionsEnvShineState != 0) ? j + 6 : j; @@ -433,7 +473,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); - for (j = 0; j < 3; j++, bufI += 4) { + for (j = 0; j < QUEST_STONE_OF_AGONY - QUEST_KOKIRI_EMERALD; j++, bufI += 4) { if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD + j)) { gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[bufI], 4, 0); KaleidoScope_DrawQuadTextureRGBA32(gfxCtx, gItemIcons[ITEM_KOKIRI_EMERALD + j], QUEST_ICON_WIDTH, @@ -446,7 +486,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { gDPPipeSync(POLY_OPA_DISP++); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); - for (j = 0; j < 3; j++, bufI += 4) { + for (j = 0; j < QUEST_HEART_PIECE - QUEST_STONE_OF_AGONY; j++, bufI += 4) { if (CHECK_QUEST_ITEM(QUEST_STONE_OF_AGONY + j)) { gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[bufI], 4, 0); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); @@ -456,6 +496,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { } // Draw heart pieces + // QUEST_HEART_PIECE stepRed = ABS(sHpPrimRed - sHpPrimColors[sHpPrimState][0]) / sHpPrimTimer; stepGreen = ABS(sHpPrimGreen - sHpPrimColors[sHpPrimState][1]) / sHpPrimTimer; @@ -519,7 +560,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { // if (pauseCtx->state == PAUSE_STATE_MAIN) { - bufI += 4; + bufI += (QUEST_QUAD_SONG_NOTE_A1 - QUEST_HEART_PIECE) * 4; gDPPipeSync(POLY_OPA_DISP++); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); @@ -539,6 +580,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { if (pauseCtx->mainState == PAUSE_MAIN_STATE_SONG_PLAYBACK) { // Draw ocarina buttons as the song playback progresses + // QUEST_QUAD_SONG_NOTE_A1 to QUEST_QUAD_SONG_NOTE_A8 pauseCtx->ocarinaStaff = AudioOcarina_GetPlaybackStaff(); @@ -589,12 +631,15 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { (pauseCtx->mainState <= PAUSE_MAIN_STATE_SONG_PROMPT_DONE)) || (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG)) { // Draw the buttons for playing a song + // QUEST_QUAD_SONG_NOTE_A1 to QUEST_QUAD_SONG_NOTE_A8 // temps reused, fake? stepGreen = pauseCtx->ocarinaSongIdx; stepRed = gOcarinaSongButtons[stepGreen].numButtons; - for (j = bufI, i = 0; i < stepRed; i++, bufI += 4) { + j = bufI; + + for (i = 0; i < stepRed; i++, bufI += 4) { pauseCtx->questVtx[bufI + 0].v.ob[1] = pauseCtx->questVtx[bufI + 1].v.ob[1] = R_PAUSE_SONG_OCA_BTN_Y(gOcarinaSongButtons[stepGreen].buttonsIndex[i]); @@ -629,6 +674,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { if (pauseCtx->mainState != PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG) { // Draw the buttons colored as the player plays the song + // QUEST_QUAD_SONG_NOTE_B1 to QUEST_QUAD_SONG_NOTE_B8 pauseCtx->ocarinaStaff = AudioOcarina_GetPlayingStaff(); @@ -643,7 +689,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { } } - bufI = j + 32; + bufI = j + ((QUEST_QUAD_SONG_NOTE_B1 - QUEST_QUAD_SONG_NOTE_A1) * 4); for (i = 0; i < SONG_MAX_LENGTH; i++, bufI += 4) { if (sPlayedSongBtns[i] == OCARINA_BTN_INVALID) { @@ -702,6 +748,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { } // Draw amount of gold skulltula tokens + // QUEST_QUAD_SKULL_TOKENS_DIGIT1_SHADOW to QUEST_QUAD_SKULL_TOKENS_DIGIT3 if (CHECK_QUEST_ITEM(QUEST_SKULL_TOKEN)) { gDPPipeSync(POLY_OPA_DISP++); @@ -722,27 +769,33 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { gsTokenDigits[2] -= 10; } - gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[164], 24, 0); + gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[QUEST_QUAD_SKULL_TOKENS_DIGIT1_SHADOW * 4], 6 * 4, 0); for (i = 0, j = 0; i < 2; i++) { if (i == 0) { + // Text shadow gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, pauseCtx->alpha); - } else if (gSaveContext.save.info.inventory.gsTokens == 100) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 200, 50, 50, pauseCtx->alpha); } else { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + // Text color + if (gSaveContext.save.info.inventory.gsTokens == 100) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 200, 50, 50, pauseCtx->alpha); + } else { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + } } - cursorItem = 0; + // Variable reused as a flag indicating all digits onwards should be displayed + cursorItem = false; + for (bufI = 0; bufI < 3; bufI++, j += 4) { - if ((bufI >= 2) || (gsTokenDigits[bufI] != 0) || (cursorItem != 0)) { + if ((bufI >= 2) || (gsTokenDigits[bufI] != 0) || cursorItem) { gDPLoadTextureBlock(POLY_OPA_DISP++, ((u8*)gCounterDigit0Tex + (8 * 16 * gsTokenDigits[bufI])), G_IM_FMT_I, G_IM_SIZ_8b, 8, 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); gSP1Quadrangle(POLY_OPA_DISP++, j, j + 2, j + 3, j + 1, 0); - cursorItem = 1; + cursorItem = true; } } } diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c index 55f7f3b3bd..83731d5255 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c @@ -2654,20 +2654,154 @@ static s16 D_8082B12C[] = { -114, 12, 44, 76 }; static u8 D_8082B134[] = { 1, 5, 9, 13 }; -static s16 D_8082B138[] = { - 74, 74, 46, 18, 18, 46, -108, -90, -72, -54, -36, -18, -108, -90, -72, -54, - -36, -18, 20, 46, 72, -110, -86, -110, -54, -98, -86, -74, -62, -50, -38, -26, - -14, -98, -86, -74, -62, -50, -38, -26, -14, -88, -81, -72, -90, -83, -74, +static s16 sQuestQuadsX[] = { + 74, // QUEST_MEDALLION_FOREST + 74, // QUEST_MEDALLION_FIRE + 46, // QUEST_MEDALLION_WATER + 18, // QUEST_MEDALLION_SPIRIT + 18, // QUEST_MEDALLION_SHADOW + 46, // QUEST_MEDALLION_LIGHT + -108, // QUEST_SONG_MINUET + -90, // QUEST_SONG_BOLERO + -72, // QUEST_SONG_SERENADE + -54, // QUEST_SONG_REQUIEM + -36, // QUEST_SONG_NOCTURNE + -18, // QUEST_SONG_PRELUDE + -108, // QUEST_SONG_LULLABY + -90, // QUEST_SONG_EPONA + -72, // QUEST_SONG_SARIA + -54, // QUEST_SONG_SUN + -36, // QUEST_SONG_TIME + -18, // QUEST_SONG_STORMS + 20, // QUEST_KOKIRI_EMERALD + 46, // QUEST_GORON_RUBY + 72, // QUEST_ZORA_SAPPHIRE + -110, // QUEST_STONE_OF_AGONY + -86, // QUEST_GERUDOS_CARD + -110, // QUEST_SKULL_TOKEN + -54, // QUEST_HEART_PIECE + -98, // QUEST_QUAD_SONG_NOTE_A1 + -86, // QUEST_QUAD_SONG_NOTE_A2 + -74, // QUEST_QUAD_SONG_NOTE_A3 + -62, // QUEST_QUAD_SONG_NOTE_A4 + -50, // QUEST_QUAD_SONG_NOTE_A5 + -38, // QUEST_QUAD_SONG_NOTE_A6 + -26, // QUEST_QUAD_SONG_NOTE_A7 + -14, // QUEST_QUAD_SONG_NOTE_A8 + -98, // QUEST_QUAD_SONG_NOTE_B1 + -86, // QUEST_QUAD_SONG_NOTE_B2 + -74, // QUEST_QUAD_SONG_NOTE_B3 + -62, // QUEST_QUAD_SONG_NOTE_B4 + -50, // QUEST_QUAD_SONG_NOTE_B5 + -38, // QUEST_QUAD_SONG_NOTE_B6 + -26, // QUEST_QUAD_SONG_NOTE_B7 + -14, // QUEST_QUAD_SONG_NOTE_B8 + -88, // QUEST_QUAD_SKULL_TOKENS_DIGIT1_SHADOW + -81, // QUEST_QUAD_SKULL_TOKENS_DIGIT2_SHADOW + -72, // QUEST_QUAD_SKULL_TOKENS_DIGIT3_SHADOW + -90, // QUEST_QUAD_SKULL_TOKENS_DIGIT1 + -83, // QUEST_QUAD_SKULL_TOKENS_DIGIT2 + -74, // QUEST_QUAD_SKULL_TOKENS_DIGIT3 }; -static s16 D_8082B198[] = { - 38, 6, -12, 6, 38, 56, -20, -20, -20, -20, -20, -20, 2, 2, 2, 2, 2, 2, -46, -46, -46, 58, 58, 34, - 58, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, 34, 34, 34, 36, 36, 36, +static s16 sQuestQuadsY[] = { + 38, // QUEST_MEDALLION_FOREST + 6, // QUEST_MEDALLION_FIRE + -12, // QUEST_MEDALLION_WATER + 6, // QUEST_MEDALLION_SPIRIT + 38, // QUEST_MEDALLION_SHADOW + 56, // QUEST_MEDALLION_LIGHT + -20, // QUEST_SONG_MINUET + -20, // QUEST_SONG_BOLERO + -20, // QUEST_SONG_SERENADE + -20, // QUEST_SONG_REQUIEM + -20, // QUEST_SONG_NOCTURNE + -20, // QUEST_SONG_PRELUDE + 2, // QUEST_SONG_LULLABY + 2, // QUEST_SONG_EPONA + 2, // QUEST_SONG_SARIA + 2, // QUEST_SONG_SUN + 2, // QUEST_SONG_TIME + 2, // QUEST_SONG_STORMS + -46, // QUEST_KOKIRI_EMERALD + -46, // QUEST_GORON_RUBY + -46, // QUEST_ZORA_SAPPHIRE + 58, // QUEST_STONE_OF_AGONY + 58, // QUEST_GERUDOS_CARD + 34, // QUEST_SKULL_TOKEN + 58, // QUEST_HEART_PIECE + -52, // QUEST_QUAD_SONG_NOTE_A1 + -52, // QUEST_QUAD_SONG_NOTE_A2 + -52, // QUEST_QUAD_SONG_NOTE_A3 + -52, // QUEST_QUAD_SONG_NOTE_A4 + -52, // QUEST_QUAD_SONG_NOTE_A5 + -52, // QUEST_QUAD_SONG_NOTE_A6 + -52, // QUEST_QUAD_SONG_NOTE_A7 + -52, // QUEST_QUAD_SONG_NOTE_A8 + -52, // QUEST_QUAD_SONG_NOTE_B1 + -52, // QUEST_QUAD_SONG_NOTE_B2 + -52, // QUEST_QUAD_SONG_NOTE_B3 + -52, // QUEST_QUAD_SONG_NOTE_B4 + -52, // QUEST_QUAD_SONG_NOTE_B5 + -52, // QUEST_QUAD_SONG_NOTE_B6 + -52, // QUEST_QUAD_SONG_NOTE_B7 + -52, // QUEST_QUAD_SONG_NOTE_B8 + 34, // QUEST_QUAD_SKULL_TOKENS_DIGIT1_SHADOW + 34, // QUEST_QUAD_SKULL_TOKENS_DIGIT2_SHADOW + 34, // QUEST_QUAD_SKULL_TOKENS_DIGIT3_SHADOW + 36, // QUEST_QUAD_SKULL_TOKENS_DIGIT1 + 36, // QUEST_QUAD_SKULL_TOKENS_DIGIT2 + 36, // QUEST_QUAD_SKULL_TOKENS_DIGIT3 }; -static s16 D_8082B1F8[] = { - 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, - 48, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, +static s16 sQuestQuadsSize[] = { + 24, // QUEST_MEDALLION_FOREST + 24, // QUEST_MEDALLION_FIRE + 24, // QUEST_MEDALLION_WATER + 24, // QUEST_MEDALLION_SPIRIT + 24, // QUEST_MEDALLION_SHADOW + 24, // QUEST_MEDALLION_LIGHT + 24, // QUEST_SONG_MINUET + 24, // QUEST_SONG_BOLERO + 24, // QUEST_SONG_SERENADE + 24, // QUEST_SONG_REQUIEM + 24, // QUEST_SONG_NOCTURNE + 24, // QUEST_SONG_PRELUDE + 24, // QUEST_SONG_LULLABY + 24, // QUEST_SONG_EPONA + 24, // QUEST_SONG_SARIA + 24, // QUEST_SONG_SUN + 24, // QUEST_SONG_TIME + 24, // QUEST_SONG_STORMS + 24, // QUEST_KOKIRI_EMERALD + 24, // QUEST_GORON_RUBY + 24, // QUEST_ZORA_SAPPHIRE + 24, // QUEST_STONE_OF_AGONY + 24, // QUEST_GERUDOS_CARD + 24, // QUEST_SKULL_TOKEN + 48, // QUEST_HEART_PIECE + 16, // QUEST_QUAD_SONG_NOTE_A1 + 16, // QUEST_QUAD_SONG_NOTE_A2 + 16, // QUEST_QUAD_SONG_NOTE_A3 + 16, // QUEST_QUAD_SONG_NOTE_A4 + 16, // QUEST_QUAD_SONG_NOTE_A5 + 16, // QUEST_QUAD_SONG_NOTE_A6 + 16, // QUEST_QUAD_SONG_NOTE_A7 + 16, // QUEST_QUAD_SONG_NOTE_A8 + 16, // QUEST_QUAD_SONG_NOTE_B1 + 16, // QUEST_QUAD_SONG_NOTE_B2 + 16, // QUEST_QUAD_SONG_NOTE_B3 + 16, // QUEST_QUAD_SONG_NOTE_B4 + 16, // QUEST_QUAD_SONG_NOTE_B5 + 16, // QUEST_QUAD_SONG_NOTE_B6 + 16, // QUEST_QUAD_SONG_NOTE_B7 + 16, // QUEST_QUAD_SONG_NOTE_B8 + 16, // QUEST_QUAD_SKULL_TOKENS_DIGIT1_SHADOW + 16, // QUEST_QUAD_SKULL_TOKENS_DIGIT2_SHADOW + 16, // QUEST_QUAD_SKULL_TOKENS_DIGIT3_SHADOW + 16, // QUEST_QUAD_SKULL_TOKENS_DIGIT1 + 16, // QUEST_QUAD_SKULL_TOKENS_DIGIT2 + 16, // QUEST_QUAD_SKULL_TOKENS_DIGIT3 }; void KaleidoScope_SetVertices(PlayState* play, GraphicsContext* gfxCtx) { @@ -3025,50 +3159,50 @@ void KaleidoScope_SetVertices(PlayState* play, GraphicsContext* gfxCtx) { k += 4; } - pauseCtx->questVtx = GRAPH_ALLOC(gfxCtx, 188 * sizeof(Vtx)); + pauseCtx->questVtx = GRAPH_ALLOC(gfxCtx, QUEST_QUAD_MAX * 4 * sizeof(Vtx)); - for (k = 0, j = 0; j < 47; j++, k += 4) { - s16 phi_t2_2 = D_8082B1F8[j]; + for (k = 0, j = 0; j < QUEST_QUAD_MAX; j++, k += 4) { + s16 quadWidth = sQuestQuadsSize[j]; - if ((j < 6) || (j >= 41)) { - pauseCtx->questVtx[k + 0].v.ob[0] = pauseCtx->questVtx[k + 2].v.ob[0] = D_8082B138[j]; + if ((j < QUEST_SONG_MINUET) || (j >= QUEST_QUAD_SKULL_TOKENS_DIGIT1_SHADOW)) { + pauseCtx->questVtx[k + 0].v.ob[0] = pauseCtx->questVtx[k + 2].v.ob[0] = sQuestQuadsX[j]; pauseCtx->questVtx[k + 1].v.ob[0] = pauseCtx->questVtx[k + 3].v.ob[0] = - pauseCtx->questVtx[k + 0].v.ob[0] + D_8082B1F8[j]; + pauseCtx->questVtx[k + 0].v.ob[0] + sQuestQuadsSize[j]; pauseCtx->questVtx[k + 0].v.ob[1] = pauseCtx->questVtx[k + 1].v.ob[1] = - D_8082B198[j] + pauseCtx->pagesYOrigin1; + sQuestQuadsY[j] + pauseCtx->pagesYOrigin1; pauseCtx->questVtx[k + 2].v.ob[1] = pauseCtx->questVtx[k + 3].v.ob[1] = - pauseCtx->questVtx[k + 0].v.ob[1] - D_8082B1F8[j]; + pauseCtx->questVtx[k + 0].v.ob[1] - sQuestQuadsSize[j]; - if (j >= 41) { + if (j >= QUEST_QUAD_SKULL_TOKENS_DIGIT1_SHADOW) { pauseCtx->questVtx[k + 1].v.ob[0] = pauseCtx->questVtx[k + 3].v.ob[0] = pauseCtx->questVtx[k + 0].v.ob[0] + 8; pauseCtx->questVtx[k + 0].v.ob[1] = pauseCtx->questVtx[k + 1].v.ob[1] = - D_8082B198[j] + pauseCtx->pagesYOrigin1 - 6; + sQuestQuadsY[j] + pauseCtx->pagesYOrigin1 - 6; pauseCtx->questVtx[k + 2].v.ob[1] = pauseCtx->questVtx[k + 3].v.ob[1] = pauseCtx->questVtx[k + 0].v.ob[1] - 16; - phi_t2_2 = 8; + quadWidth = 8; } } else { - if ((j >= 6) && (j <= 17)) { - phi_t2_2 = 16; + if ((j >= QUEST_SONG_MINUET) && (j < QUEST_KOKIRI_EMERALD)) { + quadWidth = 16; } - pauseCtx->questVtx[k + 0].v.ob[0] = pauseCtx->questVtx[k + 2].v.ob[0] = D_8082B138[j] + 2; + pauseCtx->questVtx[k + 0].v.ob[0] = pauseCtx->questVtx[k + 2].v.ob[0] = sQuestQuadsX[j] + 2; pauseCtx->questVtx[k + 1].v.ob[0] = pauseCtx->questVtx[k + 3].v.ob[0] = - pauseCtx->questVtx[k + 0].v.ob[0] + phi_t2_2 - 4; + pauseCtx->questVtx[k + 0].v.ob[0] + quadWidth - 4; pauseCtx->questVtx[k + 0].v.ob[1] = pauseCtx->questVtx[k + 1].v.ob[1] = - D_8082B198[j] + pauseCtx->pagesYOrigin1 - 2; + sQuestQuadsY[j] + pauseCtx->pagesYOrigin1 - 2; pauseCtx->questVtx[k + 2].v.ob[1] = pauseCtx->questVtx[k + 3].v.ob[1] = - pauseCtx->questVtx[k + 0].v.ob[1] - D_8082B1F8[j] + 4; + pauseCtx->questVtx[k + 0].v.ob[1] - sQuestQuadsSize[j] + 4; } pauseCtx->questVtx[k + 0].v.ob[2] = pauseCtx->questVtx[k + 1].v.ob[2] = pauseCtx->questVtx[k + 2].v.ob[2] = @@ -3080,8 +3214,8 @@ void KaleidoScope_SetVertices(PlayState* play, GraphicsContext* gfxCtx) { pauseCtx->questVtx[k + 0].v.tc[0] = pauseCtx->questVtx[k + 0].v.tc[1] = pauseCtx->questVtx[k + 1].v.tc[1] = pauseCtx->questVtx[k + 2].v.tc[0] = 0; - pauseCtx->questVtx[k + 1].v.tc[0] = pauseCtx->questVtx[k + 3].v.tc[0] = phi_t2_2 << 5; - pauseCtx->questVtx[k + 2].v.tc[1] = pauseCtx->questVtx[k + 3].v.tc[1] = D_8082B1F8[j] << 5; + pauseCtx->questVtx[k + 1].v.tc[0] = pauseCtx->questVtx[k + 3].v.tc[0] = quadWidth << 5; + pauseCtx->questVtx[k + 2].v.tc[1] = pauseCtx->questVtx[k + 3].v.tc[1] = sQuestQuadsSize[j] << 5; pauseCtx->questVtx[k + 0].v.cn[0] = pauseCtx->questVtx[k + 1].v.cn[0] = pauseCtx->questVtx[k + 2].v.cn[0] = pauseCtx->questVtx[k + 3].v.cn[0] = pauseCtx->questVtx[k + 0].v.cn[1] = pauseCtx->questVtx[k + 1].v.cn[1] = @@ -3278,23 +3412,23 @@ void KaleidoScope_UpdateCursorVtx(PlayState* play) { tlOffsetY = 4; rightOffsetX = 12; bottomOffsetY = 12; - if (pauseCtx->cursorSlot[pauseCtx->pageIndex] == 0x18) { + if (pauseCtx->cursorSlot[pauseCtx->pageIndex] == QUEST_HEART_PIECE) { tlOffsetX = -2; tlOffsetY = 2; rightOffsetX = 32; bottomOffsetY = 32; - } else if (pauseCtx->cursorSlot[pauseCtx->pageIndex] == 0x17) { + } else if (pauseCtx->cursorSlot[pauseCtx->pageIndex] == QUEST_SKULL_TOKEN) { tlOffsetX = -4; tlOffsetY = 4; bottomOffsetY = 13; rightOffsetX = 34; - } else if (pauseCtx->cursorSlot[pauseCtx->pageIndex] < 6) { + } else if (pauseCtx->cursorSlot[pauseCtx->pageIndex] < QUEST_SONG_MINUET) { tlOffsetX = -1; tlOffsetY = 1; rightOffsetX = 10; bottomOffsetY = 10; - } else if ((pauseCtx->cursorSlot[pauseCtx->pageIndex] >= 6) && - (pauseCtx->cursorSlot[pauseCtx->pageIndex] < 0x12)) { + } else if ((pauseCtx->cursorSlot[pauseCtx->pageIndex] >= QUEST_SONG_MINUET) && + (pauseCtx->cursorSlot[pauseCtx->pageIndex] < QUEST_KOKIRI_EMERALD)) { tlOffsetX = -5; tlOffsetY = 3; rightOffsetX = 8; diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h index aca4271853..a7dd165c81 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h @@ -34,6 +34,37 @@ extern u8 gAreaGsFlags[]; #define PAGE_BG_QUAD_TEX_WIDTH 80 #define PAGE_BG_QUAD_TEX_HEIGHT 32 +typedef enum QuestQuad { + // 0 to 24 matches the `QuestItem` enum + // Notes showing the correct song + /* 25 */ QUEST_QUAD_SONG_NOTE_A1 = QUEST_HEART_PIECE + 1, + /* 26 */ QUEST_QUAD_SONG_NOTE_A2, + /* 27 */ QUEST_QUAD_SONG_NOTE_A3, + /* 28 */ QUEST_QUAD_SONG_NOTE_A4, + /* 29 */ QUEST_QUAD_SONG_NOTE_A5, + /* 30 */ QUEST_QUAD_SONG_NOTE_A6, + /* 31 */ QUEST_QUAD_SONG_NOTE_A7, + /* 32 */ QUEST_QUAD_SONG_NOTE_A8, + // Notes appearing when playing + /* 33 */ QUEST_QUAD_SONG_NOTE_B1, + /* 34 */ QUEST_QUAD_SONG_NOTE_B2, + /* 35 */ QUEST_QUAD_SONG_NOTE_B3, + /* 36 */ QUEST_QUAD_SONG_NOTE_B4, + /* 37 */ QUEST_QUAD_SONG_NOTE_B5, + /* 38 */ QUEST_QUAD_SONG_NOTE_B6, + /* 39 */ QUEST_QUAD_SONG_NOTE_B7, + /* 40 */ QUEST_QUAD_SONG_NOTE_B8, + // Shadow for the amount of skulltula tokens + /* 41 */ QUEST_QUAD_SKULL_TOKENS_DIGIT1_SHADOW, + /* 42 */ QUEST_QUAD_SKULL_TOKENS_DIGIT2_SHADOW, + /* 43 */ QUEST_QUAD_SKULL_TOKENS_DIGIT3_SHADOW, + // Amount of skulltula tokens + /* 44 */ QUEST_QUAD_SKULL_TOKENS_DIGIT1, + /* 45 */ QUEST_QUAD_SKULL_TOKENS_DIGIT2, + /* 46 */ QUEST_QUAD_SKULL_TOKENS_DIGIT3, + /* 47 */ QUEST_QUAD_MAX +} QuestQuad; + // The world map image is split into a number of quad fragments for drawing #define WORLD_MAP_IMAGE_WIDTH 216 #define WORLD_MAP_IMAGE_HEIGHT 128