1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-14 21:40:03 +00:00

Pause doc: KaleidoScope_DrawQuestStatus (partial) (#2215)

* Pause doc: `KaleidoScope_DrawQuestStatus` (partial)

* review

* format
This commit is contained in:
Dragorn421 2024-09-24 11:39:34 +02:00 committed by GitHub
parent 3cea46a6c1
commit f9d892a2ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 221 additions and 179 deletions

View file

@ -134,6 +134,7 @@
#define R_START_LABEL_Y(i) ZREG(51 + (i)) #define R_START_LABEL_Y(i) ZREG(51 + (i))
#define R_START_LABEL_X(i) ZREG(54 + (i)) #define R_START_LABEL_X(i) ZREG(54 + (i))
#endif #endif
#define R_PAUSE_QUEST_MEDALLION_SHINE_TIME(i) ZREG(61 + (i)) // i = 0..3 (clashes with ZREG(62) and ZREG(63))
#define R_C_UP_BTN_X ZREG(62) #define R_C_UP_BTN_X ZREG(62)
#define R_C_UP_BTN_Y ZREG(63) #define R_C_UP_BTN_Y ZREG(63)
#define R_START_BTN_X ZREG(68) #define R_START_BTN_X ZREG(68)

View file

@ -373,10 +373,12 @@ void Regs_InitDataImpl(void) {
R_START_LABEL_X(2) = 119; R_START_LABEL_X(2) = 119;
#endif #endif
ZREG(61) = 1; R_PAUSE_QUEST_MEDALLION_SHINE_TIME(0) = 1;
R_C_UP_BTN_X = C_UP_BUTTON_X; //! @bug Overlapping reg usage
R_C_UP_BTN_Y = C_UP_BUTTON_Y; R_C_UP_BTN_X = C_UP_BUTTON_X; // R_PAUSE_QUEST_MEDALLION_SHINE_TIME(1)
ZREG(64) = 20; R_C_UP_BTN_Y = C_UP_BUTTON_Y; // R_PAUSE_QUEST_MEDALLION_SHINE_TIME(2)
R_PAUSE_QUEST_MEDALLION_SHINE_TIME(3) = 20;
ZREG(65) = 21; ZREG(65) = 21;
ZREG(66) = 122; ZREG(66) = 122;
R_ITEM_BTN_X(1) = C_LEFT_BUTTON_X; R_ITEM_BTN_X(1) = C_LEFT_BUTTON_X;

View file

@ -13,27 +13,44 @@
#endif #endif
void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
static s16 D_8082A070[][4] = { static s16 sHpPrimColors[][4] = {
{ 255, 0, 0, 255 }, { 255, 0, 0, 255 },
{ 255, 70, 0, 150 }, { 255, 70, 0, 150 },
{ 255, 70, 0, 150 }, { 255, 70, 0, 150 },
{ 255, 0, 0, 255 }, { 255, 0, 0, 255 },
}; };
static s16 D_8082A090[][3] = {
{ 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, // Shining medallions
{ 0, 60, 0 }, { 90, 0, 0 }, { 0, 40, 110 }, { 80, 40, 0 }, { 70, 0, 90 }, { 90, 90, 0 }, 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 },
}; };
static s16 D_8082A0D8[] = { 255, 255, 255, 255, 255, 255 }; // Current (animated) env color for each medallion
static s16 D_8082A0E4[] = { 255, 255, 255, 255, 255, 255 }; static s16 sMedallionsEnvRed[6] = { 255, 255, 255, 255, 255, 255 };
static s16 D_8082A0F0[] = { 150, 150, 150, 150, 150, 150 }; static s16 sMedallionsEnvGreen[6] = { 255, 255, 255, 255, 255, 255 };
static s16 D_8082A0FC = 20; static s16 sMedallionsEnvBlue[6] = { 150, 150, 150, 150, 150, 150 };
static s16 D_8082A100 = 0; static s16 sMedallionsEnvTimer = 20;
static s16 D_8082A104 = 0; static s16 sMedallionsEnvShineState = 0;
static s16 D_8082A108 = 0;
static s16 D_8082A10C = 0; static s16 sHpPrimRed = 0;
static s16 D_8082A110 = 0; static s16 sHpPrimGreen = 0;
static s16 D_8082A114 = 20; static s16 sHpPrimBlue = 0;
static s16 D_8082A118 = 0; static s16 sHpPrimAlpha = 0;
static s16 sHpPrimTimer = 20;
static s16 sHpPrimState = 0;
static s16 D_8082A11C = 0; static s16 D_8082A11C = 0;
static s16 D_8082A120 = 0; static s16 D_8082A120 = 0;
static u8 D_8082A124[] = { static u8 D_8082A124[] = {
@ -52,15 +69,17 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
static s16 D_8082A150[] = { static s16 D_8082A150[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
}; };
static s16 D_8082A164[] = {
static s16 sSongsPrimRed[] = {
150, 255, 100, 255, 255, 255, 255, 255, 255, 255, 255, 255, 150, 255, 100, 255, 255, 255, 255, 255, 255, 255, 255, 255,
}; };
static s16 D_8082A17C[] = { static s16 sSongsPrimGreen[] = {
255, 80, 150, 160, 100, 240, 255, 255, 255, 255, 255, 255, 255, 80, 150, 160, 100, 240, 255, 255, 255, 255, 255, 255,
}; };
static s16 D_8082A194[] = { static s16 sSongsPrimBlue[] = {
100, 40, 255, 0, 255, 100, 255, 255, 255, 255, 255, 255, 100, 40, 255, 0, 255, 100, 255, 255, 255, 255, 255, 255,
}; };
static s8 D_8082A1AC[][4] = { static s8 D_8082A1AC[][4] = {
{ 0x05, 0x01, 0x05, 0xFE }, { 0x00, 0x02, 0x02, 0xFE }, { 0xFF, 0x13, 0x03, 0x01 }, { 0x04, 0x02, 0x11, 0x02 }, { 0x05, 0x01, 0x05, 0xFE }, { 0x00, 0x02, 0x02, 0xFE }, { 0xFF, 0x13, 0x03, 0x01 }, { 0x04, 0x02, 0x11, 0x02 },
{ 0x05, 0x03, 0x18, 0x05 }, { 0xFF, 0xFF, 0x04, 0x00 }, { 0x0C, 0xFF, 0xFD, 0x07 }, { 0x0D, 0xFF, 0x06, 0x08 }, { 0x05, 0x03, 0x18, 0x05 }, { 0xFF, 0xFF, 0x04, 0x00 }, { 0x0C, 0xFF, 0xFD, 0x07 }, { 0x0D, 0xFF, 0x06, 0x08 },
@ -70,22 +89,23 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
{ 0x02, 0xFF, 0x13, 0xFE }, { 0xFF, 0x17, 0xFD, 0x16 }, { 0xFF, 0x17, 0x15, 0x18 }, { 0x15, 0x0C, 0xFD, 0x18 }, { 0x02, 0xFF, 0x13, 0xFE }, { 0xFF, 0x17, 0xFD, 0x16 }, { 0xFF, 0x17, 0x15, 0x18 }, { 0x15, 0x0C, 0xFD, 0x18 },
{ 0xFF, 0x10, 0x16, 0x04 }, { 0x00, 0x00, 0x00, 0x00 }, { 0xFF, 0x10, 0x16, 0x04 }, { 0x00, 0x00, 0x00, 0x00 },
}; };
PauseContext* pauseCtx = &play->pauseCtx; PauseContext* pauseCtx = &play->pauseCtx;
Input* input = &play->state.input[0]; Input* input = &play->state.input[0];
s16 sp226; s16 stepRed;
s16 sp224; s16 stepGreen;
s16 sp222; s16 stepBlue;
s16 sp220; s16 stepAlpha;
s16 phi_s0; s16 phi_s0;
s16 phi_s3; s16 phi_s3;
s16 sp21A; s16 bufI;
s16 sp218; s16 j;
s16 sp216; s16 sp216;
s16 phi_s7; s16 i;
s16 phi_v1; s16 targetColorIndex;
s16 pad2; s16 pad2;
s16 cursorItem; s16 cursorItem;
s16 sp208[3]; s16 gsTokenDigits[3];
OPEN_DISPS(gfxCtx, "../z_kaleido_collect.c", 248); OPEN_DISPS(gfxCtx, "../z_kaleido_collect.c", 248);
@ -196,9 +216,9 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
pauseCtx->ocarinaSongIdx = gOcarinaSongItemMap[sp216 - QUEST_SONG_MINUET]; pauseCtx->ocarinaSongIdx = gOcarinaSongItemMap[sp216 - QUEST_SONG_MINUET];
D_8082A120 = 10; D_8082A120 = 10;
for (phi_s7 = 0; phi_s7 < 8; phi_s7++) { for (i = 0; i < 8; i++) {
D_8082A124[phi_s7] = 0xFF; D_8082A124[i] = 0xFF;
D_8082A150[phi_s7] = 0; D_8082A150[i] = 0;
} }
D_8082A11C = 0; D_8082A11C = 0;
@ -277,9 +297,9 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
pauseCtx->cursorColorSet = 8; pauseCtx->cursorColorSet = 8;
if (--D_8082A120 == 0) { if (--D_8082A120 == 0) {
for (phi_s7 = 0; phi_s7 < 8; phi_s7++) { for (i = 0; i < 8; i++) {
D_8082A124[phi_s7] = 0xFF; D_8082A124[i] = 0xFF;
D_8082A150[phi_s7] = 0; D_8082A150[i] = 0;
} }
D_8082A11C = 0; D_8082A11C = 0;
@ -305,61 +325,68 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
} }
} }
// Draw medallions
// QUEST_MEDALLION_FOREST to QUEST_MEDALLION_LIGHT
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE,
ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
D_8082A0FC--; sMedallionsEnvTimer--;
for (sp218 = 0, sp21A = 0; sp218 < 6; sp218++, sp21A += 4) { for (j = 0, bufI = 0; j < 6; j++, bufI += 4) {
if ((D_8082A100 != 1) && (D_8082A100 != 3)) { if ((sMedallionsEnvShineState != 1) && (sMedallionsEnvShineState != 3)) {
phi_v1 = (D_8082A100 != 0) ? sp218 + 6 : sp218; targetColorIndex = (sMedallionsEnvShineState != 0) ? j + 6 : j;
if (D_8082A0FC != 0) { if (sMedallionsEnvTimer != 0) {
sp226 = ABS(D_8082A0D8[sp218] - D_8082A090[phi_v1][0]) / D_8082A0FC; stepRed = ABS(sMedallionsEnvRed[j] - sMedallionsEnvColors[targetColorIndex][0]) / sMedallionsEnvTimer;
sp224 = ABS(D_8082A0E4[sp218] - D_8082A090[phi_v1][1]) / D_8082A0FC; stepGreen =
sp222 = ABS(D_8082A0F0[sp218] - D_8082A090[phi_v1][2]) / D_8082A0FC; ABS(sMedallionsEnvGreen[j] - sMedallionsEnvColors[targetColorIndex][1]) / sMedallionsEnvTimer;
if (D_8082A0D8[sp218] >= D_8082A090[phi_v1][0]) { stepBlue = ABS(sMedallionsEnvBlue[j] - sMedallionsEnvColors[targetColorIndex][2]) / sMedallionsEnvTimer;
D_8082A0D8[sp218] -= sp226; if (sMedallionsEnvRed[j] >= sMedallionsEnvColors[targetColorIndex][0]) {
sMedallionsEnvRed[j] -= stepRed;
} else { } else {
D_8082A0D8[sp218] += sp226; sMedallionsEnvRed[j] += stepRed;
} }
if (D_8082A0E4[sp218] >= D_8082A090[phi_v1][1]) { if (sMedallionsEnvGreen[j] >= sMedallionsEnvColors[targetColorIndex][1]) {
D_8082A0E4[sp218] -= sp224; sMedallionsEnvGreen[j] -= stepGreen;
} else { } else {
D_8082A0E4[sp218] += sp224; sMedallionsEnvGreen[j] += stepGreen;
} }
if (D_8082A0F0[sp218] >= D_8082A090[phi_v1][2]) { if (sMedallionsEnvBlue[j] >= sMedallionsEnvColors[targetColorIndex][2]) {
D_8082A0F0[sp218] -= sp222; sMedallionsEnvBlue[j] -= stepBlue;
} else { } else {
D_8082A0F0[sp218] += sp222; sMedallionsEnvBlue[j] += stepBlue;
} }
} else { } else {
D_8082A0D8[sp218] = D_8082A090[phi_v1][0]; sMedallionsEnvRed[j] = sMedallionsEnvColors[targetColorIndex][0];
D_8082A0E4[sp218] = D_8082A090[phi_v1][1]; sMedallionsEnvGreen[j] = sMedallionsEnvColors[targetColorIndex][1];
D_8082A0F0[sp218] = D_8082A090[phi_v1][2]; sMedallionsEnvBlue[j] = sMedallionsEnvColors[targetColorIndex][2];
} }
} }
if (CHECK_QUEST_ITEM(QUEST_MEDALLION_FOREST + sp218)) { if (CHECK_QUEST_ITEM(QUEST_MEDALLION_FOREST + j)) {
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
gDPSetEnvColor(POLY_OPA_DISP++, D_8082A0D8[sp218], D_8082A0E4[sp218], D_8082A0F0[sp218], 0); gDPSetEnvColor(POLY_OPA_DISP++, sMedallionsEnvRed[j], sMedallionsEnvGreen[j], sMedallionsEnvBlue[j], 0);
gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[sp21A], 4, 0); gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[bufI], 4, 0);
KaleidoScope_DrawQuadTextureRGBA32(gfxCtx, gItemIcons[ITEM_MEDALLION_FOREST + sp218], QUEST_ICON_WIDTH, KaleidoScope_DrawQuadTextureRGBA32(gfxCtx, gItemIcons[ITEM_MEDALLION_FOREST + j], QUEST_ICON_WIDTH,
QUEST_ICON_HEIGHT, 0); QUEST_ICON_HEIGHT, 0);
} }
} }
if (D_8082A0FC == 0) { if (sMedallionsEnvTimer == 0) {
D_8082A0FC = ZREG(61 + D_8082A100); sMedallionsEnvTimer = R_PAUSE_QUEST_MEDALLION_SHINE_TIME(sMedallionsEnvShineState);
if (++D_8082A100 >= 4) { if (++sMedallionsEnvShineState >= 4) {
D_8082A100 = 0; sMedallionsEnvShineState = 0;
} }
} }
// Draw songs
// QUEST_SONG_MINUET to QUEST_SONG_STORMS
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
@ -367,86 +394,93 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
gDPLoadTextureBlock(POLY_OPA_DISP++, gSongNoteTex, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 24, 0, G_TX_NOMIRROR | G_TX_WRAP, gDPLoadTextureBlock(POLY_OPA_DISP++, gSongNoteTex, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 24, 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); G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
for (sp218 = 0; sp218 < QUEST_KOKIRI_EMERALD - QUEST_SONG_MINUET; sp218++, sp21A += 4) { for (j = 0; j < QUEST_KOKIRI_EMERALD - QUEST_SONG_MINUET; j++, bufI += 4) {
if (CHECK_QUEST_ITEM(QUEST_SONG_MINUET + sp218)) { if (CHECK_QUEST_ITEM(QUEST_SONG_MINUET + j)) {
if ((QUEST_SONG_MINUET + sp218) == sp216) { if ((QUEST_SONG_MINUET + j) == sp216) {
pauseCtx->questVtx[sp21A + 0].v.ob[0] = pauseCtx->questVtx[sp21A + 2].v.ob[0] = pauseCtx->questVtx[bufI + 0].v.ob[0] = pauseCtx->questVtx[bufI + 2].v.ob[0] =
pauseCtx->questVtx[sp21A + 0].v.ob[0] - 2; pauseCtx->questVtx[bufI + 0].v.ob[0] - 2;
pauseCtx->questVtx[sp21A + 1].v.ob[0] = pauseCtx->questVtx[sp21A + 3].v.ob[0] = pauseCtx->questVtx[bufI + 1].v.ob[0] = pauseCtx->questVtx[bufI + 3].v.ob[0] =
pauseCtx->questVtx[sp21A + 1].v.ob[0] + 4; pauseCtx->questVtx[bufI + 1].v.ob[0] + 4;
pauseCtx->questVtx[sp21A + 0].v.ob[1] = pauseCtx->questVtx[sp21A + 1].v.ob[1] = pauseCtx->questVtx[bufI + 0].v.ob[1] = pauseCtx->questVtx[bufI + 1].v.ob[1] =
pauseCtx->questVtx[sp21A + 0].v.ob[1] + 2; pauseCtx->questVtx[bufI + 0].v.ob[1] + 2;
pauseCtx->questVtx[sp21A + 2].v.ob[1] = pauseCtx->questVtx[sp21A + 3].v.ob[1] = pauseCtx->questVtx[bufI + 2].v.ob[1] = pauseCtx->questVtx[bufI + 3].v.ob[1] =
pauseCtx->questVtx[sp21A + 2].v.ob[1] - 4; pauseCtx->questVtx[bufI + 2].v.ob[1] - 4;
} }
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, D_8082A164[sp218], D_8082A17C[sp218], D_8082A194[sp218], gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sSongsPrimRed[j], sSongsPrimGreen[j], sSongsPrimBlue[j],
pauseCtx->alpha); pauseCtx->alpha);
gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[sp21A], 4, 0); gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[bufI], 4, 0);
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0); gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
} }
} }
// Draw spiritual stones
// QUEST_KOKIRI_EMERALD, QUEST_GORON_RUBY, QUEST_ZORA_SAPPHIRE
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
for (sp218 = 0; sp218 < 3; sp218++, sp21A += 4) { for (j = 0; j < 3; j++, bufI += 4) {
if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD + sp218)) { if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD + j)) {
gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[sp21A], 4, 0); gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[bufI], 4, 0);
KaleidoScope_DrawQuadTextureRGBA32(gfxCtx, gItemIcons[ITEM_KOKIRI_EMERALD + sp218], QUEST_ICON_WIDTH, KaleidoScope_DrawQuadTextureRGBA32(gfxCtx, gItemIcons[ITEM_KOKIRI_EMERALD + j], QUEST_ICON_WIDTH,
QUEST_ICON_HEIGHT, 0); QUEST_ICON_HEIGHT, 0);
} }
} }
// Draw QUEST_STONE_OF_AGONY, QUEST_GERUDOS_CARD, QUEST_SKULL_TOKEN
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
for (sp218 = 0; sp218 < 3; sp218++, sp21A += 4) { for (j = 0; j < 3; j++, bufI += 4) {
if (CHECK_QUEST_ITEM(QUEST_STONE_OF_AGONY + sp218)) { if (CHECK_QUEST_ITEM(QUEST_STONE_OF_AGONY + j)) {
gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[sp21A], 4, 0); gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[bufI], 4, 0);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha);
KaleidoScope_DrawQuadTextureRGBA32(gfxCtx, gItemIcons[ITEM_STONE_OF_AGONY + sp218], QUEST_ICON_WIDTH, KaleidoScope_DrawQuadTextureRGBA32(gfxCtx, gItemIcons[ITEM_STONE_OF_AGONY + j], QUEST_ICON_WIDTH,
QUEST_ICON_HEIGHT, 0); QUEST_ICON_HEIGHT, 0);
} }
} }
sp226 = ABS(D_8082A104 - D_8082A070[D_8082A118][0]) / D_8082A114; // Draw heart pieces
sp224 = ABS(D_8082A108 - D_8082A070[D_8082A118][1]) / D_8082A114;
sp222 = ABS(D_8082A10C - D_8082A070[D_8082A118][2]) / D_8082A114; stepRed = ABS(sHpPrimRed - sHpPrimColors[sHpPrimState][0]) / sHpPrimTimer;
sp220 = ABS(D_8082A110 - D_8082A070[D_8082A118][3]) / D_8082A114; stepGreen = ABS(sHpPrimGreen - sHpPrimColors[sHpPrimState][1]) / sHpPrimTimer;
if (D_8082A104 >= D_8082A070[D_8082A118][0]) { stepBlue = ABS(sHpPrimBlue - sHpPrimColors[sHpPrimState][2]) / sHpPrimTimer;
D_8082A104 -= sp226; stepAlpha = ABS(sHpPrimAlpha - sHpPrimColors[sHpPrimState][3]) / sHpPrimTimer;
if (sHpPrimRed >= sHpPrimColors[sHpPrimState][0]) {
sHpPrimRed -= stepRed;
} else { } else {
D_8082A104 += sp226; sHpPrimRed += stepRed;
} }
if (D_8082A108 >= D_8082A070[D_8082A118][1]) { if (sHpPrimGreen >= sHpPrimColors[sHpPrimState][1]) {
D_8082A108 -= sp224; sHpPrimGreen -= stepGreen;
} else { } else {
D_8082A108 += sp224; sHpPrimGreen += stepGreen;
} }
if (D_8082A10C >= D_8082A070[D_8082A118][2]) { if (sHpPrimBlue >= sHpPrimColors[sHpPrimState][2]) {
D_8082A10C -= sp222; sHpPrimBlue -= stepBlue;
} else { } else {
D_8082A10C += sp222; sHpPrimBlue += stepBlue;
} }
if (D_8082A110 >= D_8082A070[D_8082A118][3]) { if (sHpPrimAlpha >= sHpPrimColors[sHpPrimState][3]) {
D_8082A110 -= sp220; sHpPrimAlpha -= stepAlpha;
} else { } else {
D_8082A110 += sp220; sHpPrimAlpha += stepAlpha;
} }
if (--D_8082A114 == 0) { if (--sHpPrimTimer == 0) {
D_8082A104 = D_8082A070[D_8082A118][0]; sHpPrimRed = sHpPrimColors[sHpPrimState][0];
D_8082A108 = D_8082A070[D_8082A118][1]; sHpPrimGreen = sHpPrimColors[sHpPrimState][1];
D_8082A10C = D_8082A070[D_8082A118][2]; sHpPrimBlue = sHpPrimColors[sHpPrimState][2];
D_8082A110 = D_8082A070[D_8082A118][3]; sHpPrimAlpha = sHpPrimColors[sHpPrimState][3];
D_8082A114 = ZREG(24 + D_8082A118); sHpPrimTimer = ZREG(24 + sHpPrimState);
if (++D_8082A118 >= 4) { if (++sHpPrimState >= 4) {
D_8082A118 = 0; sHpPrimState = 0;
} }
} }
@ -456,14 +490,14 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
if ((pauseCtx->state == PAUSE_STATE_OPENING_1) || (pauseCtx->state == PAUSE_STATE_CLOSING)) { if ((pauseCtx->state == PAUSE_STATE_OPENING_1) || (pauseCtx->state == PAUSE_STATE_CLOSING)) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, D_8082A070[0][0], D_8082A070[0][1], D_8082A070[0][2], gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sHpPrimColors[0][0], sHpPrimColors[0][1], sHpPrimColors[0][2],
pauseCtx->alpha); pauseCtx->alpha);
} else { } else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, D_8082A104, D_8082A108, D_8082A10C, D_8082A110); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sHpPrimRed, sHpPrimGreen, sHpPrimBlue, sHpPrimAlpha);
} }
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[sp21A], 4, 0); gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[bufI], 4, 0);
POLY_OPA_DISP = KaleidoScope_QuadTextureIA8( POLY_OPA_DISP = KaleidoScope_QuadTextureIA8(
POLY_OPA_DISP, POLY_OPA_DISP,
@ -473,8 +507,10 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
48, 48, 0); 48, 48, 0);
} }
//
if (pauseCtx->state == PAUSE_STATE_MAIN) { if (pauseCtx->state == PAUSE_STATE_MAIN) {
sp21A += 4; bufI += 4;
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
@ -500,59 +536,60 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
D_8082A124[pauseCtx->ocarinaStaff->pos - 1] = pauseCtx->ocarinaStaff->buttonIndex; D_8082A124[pauseCtx->ocarinaStaff->pos - 1] = pauseCtx->ocarinaStaff->buttonIndex;
} }
for (sp218 = 0, phi_s7 = 0; sp218 < 8; sp218++, phi_s7 += 4, sp21A += 4) { for (j = 0, i = 0; j < 8; j++, i += 4, bufI += 4) {
if (D_8082A124[sp218] == 0xFF) { if (D_8082A124[j] == 0xFF) {
break; break;
} }
if (D_8082A150[sp218] != 255) { if (D_8082A150[j] != 255) {
D_8082A150[sp218] += VREG(50); D_8082A150[j] += VREG(50);
if (D_8082A150[sp218] >= 255) { if (D_8082A150[j] >= 255) {
D_8082A150[sp218] = 255; D_8082A150[j] = 255;
} }
} }
pauseCtx->questVtx[sp21A + 0].v.ob[1] = pauseCtx->questVtx[sp21A + 1].v.ob[1] = pauseCtx->questVtx[bufI + 0].v.ob[1] = pauseCtx->questVtx[bufI + 1].v.ob[1] =
VREG(21 + D_8082A124[sp218]); VREG(21 + D_8082A124[j]);
pauseCtx->questVtx[sp21A + 2].v.ob[1] = pauseCtx->questVtx[sp21A + 3].v.ob[1] = pauseCtx->questVtx[bufI + 2].v.ob[1] = pauseCtx->questVtx[bufI + 3].v.ob[1] =
pauseCtx->questVtx[sp21A + 0].v.ob[1] - 12; pauseCtx->questVtx[bufI + 0].v.ob[1] - 12;
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
if (D_8082A124[sp218] == 0) { if (D_8082A124[j] == 0) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, KALEIDO_COLOR_COLLECT_UNK_R, KALEIDO_COLOR_COLLECT_UNK_G, gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, KALEIDO_COLOR_COLLECT_UNK_R, KALEIDO_COLOR_COLLECT_UNK_G,
KALEIDO_COLOR_COLLECT_UNK_B, D_8082A150[sp218]); KALEIDO_COLOR_COLLECT_UNK_B, D_8082A150[j]);
} else { } else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 50, D_8082A150[sp218]); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 50, D_8082A150[j]);
} }
gDPSetEnvColor(POLY_OPA_DISP++, 10, 10, 10, 0); gDPSetEnvColor(POLY_OPA_DISP++, 10, 10, 10, 0);
gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[sp21A], 4, 0); gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[bufI], 4, 0);
gDPLoadTextureBlock(POLY_OPA_DISP++, D_8082A130[D_8082A124[sp218]], G_IM_FMT_IA, G_IM_SIZ_8b, 16, gDPLoadTextureBlock(POLY_OPA_DISP++, D_8082A130[D_8082A124[j]], G_IM_FMT_IA, G_IM_SIZ_8b, 16, 16, 0,
16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0); gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
} }
} }
} else if (((pauseCtx->mainState >= PAUSE_MAIN_STATE_4) && (pauseCtx->mainState <= PAUSE_MAIN_STATE_6)) || } else if (((pauseCtx->mainState >= PAUSE_MAIN_STATE_4) && (pauseCtx->mainState <= PAUSE_MAIN_STATE_6)) ||
(pauseCtx->mainState == PAUSE_MAIN_STATE_8)) { (pauseCtx->mainState == PAUSE_MAIN_STATE_8)) {
sp224 = pauseCtx->ocarinaSongIdx; // temps reused, fake?
sp226 = gOcarinaSongButtons[sp224].numButtons; stepGreen = pauseCtx->ocarinaSongIdx;
stepRed = gOcarinaSongButtons[stepGreen].numButtons;
for (sp218 = sp21A, phi_s7 = 0; phi_s7 < sp226; phi_s7++, sp21A += 4) { for (j = bufI, i = 0; i < stepRed; i++, bufI += 4) {
pauseCtx->questVtx[sp21A + 0].v.ob[1] = pauseCtx->questVtx[sp21A + 1].v.ob[1] = pauseCtx->questVtx[bufI + 0].v.ob[1] = pauseCtx->questVtx[bufI + 1].v.ob[1] =
VREG(21 + gOcarinaSongButtons[sp224].buttonsIndex[phi_s7]); VREG(21 + gOcarinaSongButtons[stepGreen].buttonsIndex[i]);
pauseCtx->questVtx[sp21A + 2].v.ob[1] = pauseCtx->questVtx[sp21A + 3].v.ob[1] = pauseCtx->questVtx[bufI + 2].v.ob[1] = pauseCtx->questVtx[bufI + 3].v.ob[1] =
pauseCtx->questVtx[sp21A + 0].v.ob[1] - 12; pauseCtx->questVtx[bufI + 0].v.ob[1] - 12;
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
if (pauseCtx->mainState == PAUSE_MAIN_STATE_8) { if (pauseCtx->mainState == PAUSE_MAIN_STATE_8) {
if (gOcarinaSongButtons[sp224].buttonsIndex[phi_s7] == OCARINA_BTN_A) { if (gOcarinaSongButtons[stepGreen].buttonsIndex[i] == OCARINA_BTN_A) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, KALEIDO_COLOR_COLLECT_UNK_R, KALEIDO_COLOR_COLLECT_UNK_G, gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, KALEIDO_COLOR_COLLECT_UNK_R, KALEIDO_COLOR_COLLECT_UNK_G,
KALEIDO_COLOR_COLLECT_UNK_B, 200); KALEIDO_COLOR_COLLECT_UNK_B, 200);
} else { } else {
@ -564,9 +601,9 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
gDPSetEnvColor(POLY_OPA_DISP++, 10, 10, 10, 0); gDPSetEnvColor(POLY_OPA_DISP++, 10, 10, 10, 0);
gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[sp21A], 4, 0); gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[bufI], 4, 0);
gDPLoadTextureBlock(POLY_OPA_DISP++, D_8082A130[gOcarinaSongButtons[sp224].buttonsIndex[phi_s7]], gDPLoadTextureBlock(POLY_OPA_DISP++, D_8082A130[gOcarinaSongButtons[stepGreen].buttonsIndex[i]],
G_IM_FMT_IA, G_IM_SIZ_8b, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, 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); G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
@ -587,49 +624,49 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
} }
} }
sp21A = sp218 + 32; bufI = j + 32;
phi_s7 = 0; i = 0;
for (; phi_s7 < 8; phi_s7++, sp21A += 4) { for (; i < 8; i++, bufI += 4) {
if (D_8082A124[phi_s7] == 0xFF) { if (D_8082A124[i] == 0xFF) {
continue; continue;
} }
if (D_8082A150[phi_s7] != 255) { if (D_8082A150[i] != 255) {
D_8082A150[phi_s7] += VREG(50); D_8082A150[i] += VREG(50);
if (D_8082A150[phi_s7] >= 255) { if (D_8082A150[i] >= 255) {
D_8082A150[phi_s7] = 255; D_8082A150[i] = 255;
} }
} }
pauseCtx->questVtx[sp21A + 0].v.ob[1] = pauseCtx->questVtx[sp21A + 1].v.ob[1] = pauseCtx->questVtx[bufI + 0].v.ob[1] = pauseCtx->questVtx[bufI + 1].v.ob[1] =
VREG(21 + D_8082A124[phi_s7]); VREG(21 + D_8082A124[i]);
pauseCtx->questVtx[sp21A + 2].v.ob[1] = pauseCtx->questVtx[sp21A + 3].v.ob[1] = pauseCtx->questVtx[bufI + 2].v.ob[1] = pauseCtx->questVtx[bufI + 3].v.ob[1] =
pauseCtx->questVtx[sp21A + 0].v.ob[1] - 12; pauseCtx->questVtx[bufI + 0].v.ob[1] - 12;
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
if (D_8082A124[phi_s7] == 0) { if (D_8082A124[i] == 0) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, KALEIDO_COLOR_COLLECT_UNK_R, KALEIDO_COLOR_COLLECT_UNK_G, gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, KALEIDO_COLOR_COLLECT_UNK_R, KALEIDO_COLOR_COLLECT_UNK_G,
KALEIDO_COLOR_COLLECT_UNK_B, D_8082A150[phi_s7]); KALEIDO_COLOR_COLLECT_UNK_B, D_8082A150[i]);
} else { } else {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 50, D_8082A150[phi_s7]); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 50, D_8082A150[i]);
} }
gDPSetEnvColor(POLY_OPA_DISP++, 10, 10, 10, 0); gDPSetEnvColor(POLY_OPA_DISP++, 10, 10, 10, 0);
gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[sp21A], 4, 0); gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[bufI], 4, 0);
gDPLoadTextureBlock(POLY_OPA_DISP++, D_8082A130[D_8082A124[phi_s7]], G_IM_FMT_IA, G_IM_SIZ_8b, 16, gDPLoadTextureBlock(POLY_OPA_DISP++, D_8082A130[D_8082A124[i]], G_IM_FMT_IA, G_IM_SIZ_8b, 16, 16, 0,
16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0); gSP1Quadrangle(POLY_OPA_DISP++, 0, 2, 3, 1, 0);
} }
if (pauseCtx->mainState == PAUSE_MAIN_STATE_4) { if (pauseCtx->mainState == PAUSE_MAIN_STATE_4) {
for (phi_s7 = 0; phi_s7 < 8; phi_s7++) { for (i = 0; i < 8; i++) {
D_8082A124[phi_s7] = 0xFF; D_8082A124[i] = 0xFF;
D_8082A150[phi_s7] = 0; D_8082A150[i] = 0;
} }
D_8082A11C = 0; D_8082A11C = 0;
@ -644,29 +681,31 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
} }
} }
// Draw amount of gold skulltula tokens
if (CHECK_QUEST_ITEM(QUEST_SKULL_TOKEN)) { if (CHECK_QUEST_ITEM(QUEST_SKULL_TOKEN)) {
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
sp208[0] = sp208[1] = 0; gsTokenDigits[0] = gsTokenDigits[1] = 0;
sp208[2] = gSaveContext.save.info.inventory.gsTokens; gsTokenDigits[2] = gSaveContext.save.info.inventory.gsTokens;
while (sp208[2] >= 100) { while (gsTokenDigits[2] >= 100) {
sp208[0]++; gsTokenDigits[0]++;
sp208[2] -= 100; gsTokenDigits[2] -= 100;
} }
while (sp208[2] >= 10) { while (gsTokenDigits[2] >= 10) {
sp208[1]++; gsTokenDigits[1]++;
sp208[2] -= 10; gsTokenDigits[2] -= 10;
} }
gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[164], 24, 0); gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[164], 24, 0);
for (phi_s7 = 0, sp218 = 0, sp21A = 0; phi_s7 < 2; phi_s7++) { for (i = 0, j = 0; i < 2; i++) {
if (phi_s7 == 0) { if (i == 0) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, pauseCtx->alpha); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, pauseCtx->alpha);
} else if (gSaveContext.save.info.inventory.gsTokens == 100) { } else if (gSaveContext.save.info.inventory.gsTokens == 100) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 200, 50, 50, pauseCtx->alpha); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 200, 50, 50, pauseCtx->alpha);
@ -675,13 +714,13 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
} }
cursorItem = 0; cursorItem = 0;
for (sp21A = 0; sp21A < 3; sp21A++, sp218 += 4) { for (bufI = 0; bufI < 3; bufI++, j += 4) {
if ((sp21A >= 2) || (sp208[sp21A] != 0) || (cursorItem != 0)) { if ((bufI >= 2) || (gsTokenDigits[bufI] != 0) || (cursorItem != 0)) {
gDPLoadTextureBlock(POLY_OPA_DISP++, ((u8*)gCounterDigit0Tex + (8 * 16 * sp208[sp21A])), G_IM_FMT_I, gDPLoadTextureBlock(POLY_OPA_DISP++, ((u8*)gCounterDigit0Tex + (8 * 16 * gsTokenDigits[bufI])),
G_IM_SIZ_8b, 8, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_IM_FMT_I, G_IM_SIZ_8b, 8, 16, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, sp218, sp218 + 2, sp218 + 3, sp218 + 1, 0); gSP1Quadrangle(POLY_OPA_DISP++, j, j + 2, j + 3, j + 1, 0);
cursorItem = 1; cursorItem = 1;
} }