summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorengineer124 <47598039+engineer124@users.noreply.github.com>2023-06-02 15:09:49 +1000
committerGitHub <noreply@github.com>2023-06-02 15:09:49 +1000
commit91182a796be6d089460974c6eeb6b337d8039eb7 (patch)
tree7e4985f3ccec9a1ae5f6f3a391986473b9ac7046 /src/code
parent4b25b4d8e655c5280fd42e5c99f3971ae9b5326b (diff)
Match Interface_DrawClock (#1261)
* Match Interface_DrawClock * oops * space * combine ifs to help indentation * small adjustment * PR Suggestions * extra space * Section:
Diffstat (limited to 'src/code')
-rw-r--r--src/code/z_parameter.c883
1 files changed, 423 insertions, 460 deletions
diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c
index 25e6a26a5..9672b8804 100644
--- a/src/code/z_parameter.c
+++ b/src/code/z_parameter.c
@@ -4309,11 +4309,10 @@ void Interface_DrawPauseMenuEquippingIcons(PlayState* play) {
/**
* Draws either the analog three-day clock or the digital final-hours clock
*/
-#ifdef NON_MATCHING
void Interface_DrawClock(PlayState* play) {
static s16 sThreeDayClockAlpha = 255;
- static s16 D_801BFB30 = 0; // sClockAlphaTimer1
- static s16 D_801BFB34 = 0; // sClockAlphaTimer2
+ static s16 sClockAlphaTimer1 = 0;
+ static s16 sClockAlphaTimer2 = 0;
static u16 sThreeDayClockHours[] = {
CLOCK_TIME(0, 0), CLOCK_TIME(1, 0), CLOCK_TIME(2, 0), CLOCK_TIME(3, 0), CLOCK_TIME(4, 0),
CLOCK_TIME(5, 0), CLOCK_TIME(6, 0), CLOCK_TIME(7, 0), CLOCK_TIME(8, 0), CLOCK_TIME(9, 0),
@@ -4329,31 +4328,30 @@ void Interface_DrawClock(PlayState* play) {
gThreeDayClockHour4Tex, gThreeDayClockHour5Tex, gThreeDayClockHour6Tex, gThreeDayClockHour7Tex,
gThreeDayClockHour8Tex, gThreeDayClockHour9Tex, gThreeDayClockHour10Tex, gThreeDayClockHour11Tex,
};
- static s16 D_801BFBCC = 0; // sClockInvDiamondPrimRed
- static s16 D_801BFBD0 = 0; // sClockInvDiamondPrimGreen
- static s16 D_801BFBD4 = 255; // sClockInvDiamondPrimBlue
- static s16 D_801BFBD8 = 0; // sClockInvDiamondEnvRed
- static s16 D_801BFBDC = 0; // sClockInvDiamondEnvGreen
- static s16 D_801BFBE0 = 0; // sClockInvDiamondEnvBlue
- static s16 D_801BFBE4 = 15; // sClockInvDiamondTimer
- static s16 D_801BFBE8 = 0; // sClockInvDiamondTargetIndex
- static s16 D_801BFBEC[] = { 100, 0 }; // sClockInvDiamondPrimRedTargets
- static s16 D_801BFBF0[] = { 205, 155 }; // sClockInvDiamondPrimGreenTargets
- static s16 D_801BFBF4[] = { 255, 255 }; // sClockInvDiamondPrimBlueTargets
- static s16 D_801BFBF8[] = { 30, 0 }; // sClockInvDiamondEnvRedTargets
- static s16 D_801BFBFC[] = { 30, 0 }; // sClockInvDiamondEnvGreenTargets
- static s16 D_801BFC00[] = { 100, 0 }; // sClockInvDiamondEnvBlueTargets
- static s16 D_801BFC04[] = { 255, 0 }; // sFinalHoursClockDigitsRed
- static s16 D_801BFC08[] = { 100, 0 }; // sFinalHoursClockFrameEnvRedTargets
- static s16 D_801BFC0C[] = { 30, 0 }; // sFinalHoursClockFrameEnvGreenTargets
- static s16 D_801BFC10[] = { 100, 0 }; // sFinalHoursClockFrameEnvBlueTargets
+ static s16 sClockInvDiamondPrimRed = 0;
+ static s16 sClockInvDiamondPrimGreen = 155;
+ static s16 sClockInvDiamondPrimBlue = 255;
+ static s16 sClockInvDiamondEnvRed = 0;
+ static s16 sClockInvDiamondEnvGreen = 0;
+ static s16 sClockInvDiamondEnvBlue = 0;
+ static s16 sClockInvDiamondTimer = 15;
+ static s16 sClockInvDiamondTargetIndex = 0;
+ static s16 sClockInvDiamondPrimRedTargets[] = { 100, 0 };
+ static s16 sClockInvDiamondPrimGreenTargets[] = { 205, 155 };
+ static s16 sClockInvDiamondPrimBlueTargets[] = { 255, 255 };
+ static s16 sClockInvDiamondEnvRedTargets[] = { 30, 0 };
+ static s16 sClockInvDiamondEnvGreenTargets[] = { 30, 0 };
+ static s16 sClockInvDiamondEnvBlueTargets[] = { 100, 0 };
+ static s16 sFinalHoursClockDigitsRedTargets[] = { 255, 0 };
+ static s16 sFinalHoursClockFrameEnvRedTargets[] = { 100, 0 };
+ static s16 sFinalHoursClockFrameEnvGreenTargets[] = { 30, 0 };
+ static s16 sFinalHoursClockFrameEnvBlueTargets[] = { 100, 0 };
static TexturePtr sFinalHoursDigitTextures[] = {
gFinalHoursClockDigit0Tex, gFinalHoursClockDigit1Tex, gFinalHoursClockDigit2Tex, gFinalHoursClockDigit3Tex,
gFinalHoursClockDigit4Tex, gFinalHoursClockDigit5Tex, gFinalHoursClockDigit6Tex, gFinalHoursClockDigit7Tex,
gFinalHoursClockDigit8Tex, gFinalHoursClockDigit9Tex, gFinalHoursClockColonTex,
};
- // sFinalHoursDigitSlotPosXOffset
- static s16 D_801BFC40[] = {
+ static s16 sFinalHoursDigitSlotPosXOffset[] = {
127, 136, 144, 151, 160, 168, 175, 184,
};
InterfaceContext* interfaceCtx = &play->interfaceCtx;
@@ -4365,527 +4363,492 @@ void Interface_DrawClock(PlayState* play) {
f32 timeInMinutes;
f32 timeInSeconds;
f32 sp1CC;
- s32 new_var;
+ s32 pad1;
s16 sp1C6;
s16 currentHour;
u16 time;
- s16 temp;
+ s16 pad2;
s16 colorStep;
- s16 finalHoursClockSlots[8]; // sp1AC
+ s16 finalHoursClockSlots[8];
s16 index;
OPEN_DISPS(play->state.gfxCtx);
- if (R_TIME_SPEED != 0) {
- if ((msgCtx->msgMode == 0) || ((play->actorCtx.flags & ACTORCTX_FLAG_1) && !Play_InCsMode(play)) ||
- (msgCtx->msgMode == 0) || ((msgCtx->currentTextId >= 0x100) && (msgCtx->currentTextId <= 0x200)) ||
- (gSaveContext.gameMode == GAMEMODE_END_CREDITS)) {
- if (!FrameAdvance_IsEnabled(&play->state) && !Environment_IsTimeStopped() && (gSaveContext.save.day < 4)) {
+ if ((R_TIME_SPEED != 0) &&
+ ((msgCtx->msgMode == 0) || ((play->actorCtx.flags & ACTORCTX_FLAG_1) && !Play_InCsMode(play)) ||
+ (msgCtx->msgMode == 0) || ((msgCtx->currentTextId >= 0x100) && (msgCtx->currentTextId <= 0x200)) ||
+ (gSaveContext.gameMode == GAMEMODE_END_CREDITS)) &&
+ !FrameAdvance_IsEnabled(&play->state) && !Environment_IsTimeStopped() && (gSaveContext.save.day <= 3)) {
+ /**
+ * Section: Changes Clock's transparancy depending if Player is moving or not and possibly other things
+ */
+ if (gSaveContext.hudVisibility == HUD_VISIBILITY_ALL) {
+ if (func_801234D4(play)) {
+ sThreeDayClockAlpha = 80;
+ sClockAlphaTimer1 = 5;
+ sClockAlphaTimer2 = 20;
+ } else if (sClockAlphaTimer2 != 0) {
+ sClockAlphaTimer2--;
+ } else if (sClockAlphaTimer1 != 0) {
+ colorStep = ABS_ALT(sThreeDayClockAlpha - 255) / sClockAlphaTimer1;
+ sThreeDayClockAlpha += colorStep;
+
+ if (sThreeDayClockAlpha >= 255) {
+ sThreeDayClockAlpha = 255;
+ sClockAlphaTimer1 = 0;
+ }
+ } else {
+ if (play->actorCtx.flags & ACTORCTX_FLAG_1) {
+ sThreeDayClockAlpha = 255;
+ } else {
+ sThreeDayClockAlpha = interfaceCtx->bAlpha;
+ }
+ sClockAlphaTimer2 = 0;
+ sClockAlphaTimer1 = 0;
+ }
+ } else {
+ if (play->actorCtx.flags & ACTORCTX_FLAG_1) {
+ sThreeDayClockAlpha = 255;
+ } else {
+ sThreeDayClockAlpha = interfaceCtx->bAlpha;
+ }
+ sClockAlphaTimer2 = 0;
+ sClockAlphaTimer1 = 0;
+ }
+
+ if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) {
+ Gfx_SetupDL39_Overlay(play->state.gfxCtx);
+
+ /**
+ * Section: Draw Clock's Hour Lines
+ */
+ gDPSetAlphaCompare(OVERLAY_DISP++, G_AC_THRESHOLD);
+ gDPSetRenderMode(OVERLAY_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 130, 130, 130, sThreeDayClockAlpha);
+ gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0,
+ 0, PRIMITIVE, 0);
+
+ OVERLAY_DISP = Gfx_DrawTexRect4b(OVERLAY_DISP, gThreeDayClockHourLinesTex, 4, 64, 35, 96, 180, 128, 35, 1,
+ 6, 0, 1 << 10, 1 << 10);
+
+ /**
+ * Section: Draw Clock's Border
+ */
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, sThreeDayClockAlpha);
+ gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0,
+ 0, PRIMITIVE, 0);
+
+ //! @bug A texture height of 50 is given below. The texture is only 48 units height
+ //! resulting in this reading into the next texture. This results in a white
+ //! dot in the bottom center of the clock. For the three-day clock, this is
+ //! covered by the diamond. However, it can be seen by the final-hours clock.
+ OVERLAY_DISP = Gfx_DrawTexRect4b(OVERLAY_DISP, gThreeDayClockBorderTex, 4, 64, 50, 96, 168, 128, 50, 1, 6,
+ 0, 1 << 10, 1 << 10);
+
+ if (((CURRENT_DAY >= 4) ||
+ ((CURRENT_DAY == 3) && (((void)0, gSaveContext.save.time) >= (CLOCK_TIME(0, 0) + 5)) &&
+ (((void)0, gSaveContext.save.time) < CLOCK_TIME(6, 0))))) {
+ Gfx_SetupDL42_Overlay(play->state.gfxCtx);
+ gSPMatrix(OVERLAY_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ } else {
/**
- * Changes Clock's transparancy depending if Player is moving or not and possibly other things
+ * Section: Draw Three-Day Clock's Diamond
*/
- if (gSaveContext.hudVisibility == HUD_VISIBILITY_ALL) {
- if (func_801234D4(play)) {
- sThreeDayClockAlpha = 80;
- D_801BFB30 = 5;
- D_801BFB34 = 20;
- } else if (D_801BFB34 != 0) {
- D_801BFB34--;
- } else if (D_801BFB30 != 0) {
- colorStep = ABS_ALT(sThreeDayClockAlpha - 255) / D_801BFB30;
- sThreeDayClockAlpha += colorStep;
-
- if (sThreeDayClockAlpha >= 255) {
- sThreeDayClockAlpha = 255;
- D_801BFB30 = 0;
- }
+ gDPPipeSync(OVERLAY_DISP++);
+
+ // Time is slowed down to half speed with inverted song of time
+ if (gSaveContext.save.timeSpeedOffset == -2) {
+ // Clock diamond is blue and flashes white
+ colorStep =
+ ABS_ALT(sClockInvDiamondPrimRed - sClockInvDiamondPrimRedTargets[sClockInvDiamondTargetIndex]) /
+ sClockInvDiamondTimer;
+ if (sClockInvDiamondPrimRed >= sClockInvDiamondPrimRedTargets[sClockInvDiamondTargetIndex]) {
+ sClockInvDiamondPrimRed -= colorStep;
} else {
- if (play->actorCtx.flags & ACTORCTX_FLAG_1) {
- sThreeDayClockAlpha = 255;
- } else {
- sThreeDayClockAlpha = interfaceCtx->bAlpha;
- }
- D_801BFB34 = 0;
- D_801BFB30 = 0;
+ sClockInvDiamondPrimRed += colorStep;
}
- } else {
- if (play->actorCtx.flags & ACTORCTX_FLAG_1) {
- sThreeDayClockAlpha = 255;
+
+ colorStep = ABS_ALT(sClockInvDiamondPrimGreen -
+ sClockInvDiamondPrimGreenTargets[sClockInvDiamondTargetIndex]) /
+ sClockInvDiamondTimer;
+ if (sClockInvDiamondPrimGreen >= sClockInvDiamondPrimGreenTargets[sClockInvDiamondTargetIndex]) {
+ sClockInvDiamondPrimGreen -= colorStep;
} else {
- sThreeDayClockAlpha = interfaceCtx->bAlpha;
+ sClockInvDiamondPrimGreen += colorStep;
}
- D_801BFB34 = 0;
- D_801BFB30 = 0;
- }
-
- if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) {
- Gfx_SetupDL39_Overlay(play->state.gfxCtx);
-
- /**
- * Draw Clock's Hour Lines
- */
- gDPSetAlphaCompare(OVERLAY_DISP++, G_AC_THRESHOLD);
- gDPSetRenderMode(OVERLAY_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
- gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 130, 130, 130, sThreeDayClockAlpha);
- gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE,
- TEXEL0, 0, PRIMITIVE, 0);
+ colorStep = ABS_ALT(sClockInvDiamondPrimBlue -
+ sClockInvDiamondPrimBlueTargets[sClockInvDiamondTargetIndex]) /
+ sClockInvDiamondTimer;
+ if (sClockInvDiamondPrimBlue >= sClockInvDiamondPrimBlueTargets[sClockInvDiamondTargetIndex]) {
+ sClockInvDiamondPrimBlue -= colorStep;
+ } else {
+ sClockInvDiamondPrimBlue += colorStep;
+ }
- OVERLAY_DISP = Gfx_DrawTexRect4b(OVERLAY_DISP, gThreeDayClockHourLinesTex, 4, 64, 35, 96, 180, 128,
- 35, 1, 6, 0, 1 << 10, 1 << 10);
+ colorStep =
+ ABS_ALT(sClockInvDiamondEnvRed - sClockInvDiamondEnvRedTargets[sClockInvDiamondTargetIndex]) /
+ sClockInvDiamondTimer;
+ if (sClockInvDiamondEnvRed >= sClockInvDiamondEnvRedTargets[sClockInvDiamondTargetIndex]) {
+ sClockInvDiamondEnvRed -= colorStep;
+ } else {
+ sClockInvDiamondEnvRed += colorStep;
+ }
- /**
- * Draw Clock's Border
- */
- gDPPipeSync(OVERLAY_DISP++);
- gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, sThreeDayClockAlpha);
- gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE,
- TEXEL0, 0, PRIMITIVE, 0);
+ colorStep = ABS_ALT(sClockInvDiamondEnvGreen -
+ sClockInvDiamondEnvGreenTargets[sClockInvDiamondTargetIndex]) /
+ sClockInvDiamondTimer;
+ if (sClockInvDiamondEnvGreen >= sClockInvDiamondEnvGreenTargets[sClockInvDiamondTargetIndex]) {
+ sClockInvDiamondEnvGreen -= colorStep;
+ } else {
+ sClockInvDiamondEnvGreen += colorStep;
+ }
- //! @bug A texture height of 50 is given below. The texture is only 48 units height
- //! resulting in this reading into the next texture. This results in a white
- //! dot in the bottom center of the clock. For the three-day clock, this is
- //! covered by the diamond. However, it can be seen by the final-hours clock.
- OVERLAY_DISP = Gfx_DrawTexRect4b(OVERLAY_DISP, gThreeDayClockBorderTex, 4, 64, 50, 96, 168, 128, 50,
- 1, 6, 0, 1 << 10, 1 << 10);
-
- if (((CURRENT_DAY >= 4) || ((CURRENT_DAY == 3) && (((void)0, gSaveContext.save.time) >= 5) &&
- (((void)0, gSaveContext.save.time) < CLOCK_TIME(6, 0))))) {
- Gfx_SetupDL42_Overlay(play->state.gfxCtx);
- gSPMatrix(OVERLAY_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ colorStep =
+ ABS_ALT(sClockInvDiamondEnvBlue - sClockInvDiamondEnvBlueTargets[sClockInvDiamondTargetIndex]) /
+ sClockInvDiamondTimer;
+ if (sClockInvDiamondEnvBlue >= sClockInvDiamondEnvBlueTargets[sClockInvDiamondTargetIndex]) {
+ sClockInvDiamondEnvBlue -= colorStep;
} else {
- /**
- * Draw Three-Day Clock's Diamond
- */
- gDPPipeSync(OVERLAY_DISP++);
+ sClockInvDiamondEnvBlue += colorStep;
+ }
- // Time is slowed down to half speed with inverted song of time
- if (gSaveContext.save.timeSpeedOffset == -2) {
- // Clock diamond is blue and flashes white
- colorStep = ABS_ALT(D_801BFBCC - D_801BFBEC[D_801BFBE8]) / D_801BFBE4;
- if (D_801BFBCC >= D_801BFBEC[D_801BFBE8]) {
- D_801BFBCC -= colorStep;
- } else {
- D_801BFBCC += colorStep;
- }
+ sClockInvDiamondTimer--;
+
+ if (sClockInvDiamondTimer == 0) {
+ sClockInvDiamondPrimRed = sClockInvDiamondPrimRedTargets[sClockInvDiamondTargetIndex];
+ sClockInvDiamondPrimGreen = sClockInvDiamondPrimGreenTargets[sClockInvDiamondTargetIndex];
+ sClockInvDiamondPrimBlue = sClockInvDiamondPrimBlueTargets[sClockInvDiamondTargetIndex];
+ sClockInvDiamondEnvRed = sClockInvDiamondEnvRedTargets[sClockInvDiamondTargetIndex];
+ sClockInvDiamondEnvGreen = sClockInvDiamondEnvGreenTargets[sClockInvDiamondTargetIndex];
+ sClockInvDiamondEnvBlue = sClockInvDiamondEnvBlueTargets[sClockInvDiamondTargetIndex];
+ sClockInvDiamondTimer = 15;
+ sClockInvDiamondTargetIndex ^= 1;
+ }
- colorStep = ABS_ALT(D_801BFBD0 - D_801BFBF0[D_801BFBE8]) / D_801BFBE4;
- if (D_801BFBD0 >= D_801BFBF0[D_801BFBE8]) {
- D_801BFBD0 -= colorStep;
- } else {
- D_801BFBD0 += colorStep;
- }
+ gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE,
+ 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sClockInvDiamondPrimRed, sClockInvDiamondPrimGreen, 255,
+ sThreeDayClockAlpha);
+ gDPSetEnvColor(OVERLAY_DISP++, sClockInvDiamondEnvRed, sClockInvDiamondEnvGreen,
+ sClockInvDiamondEnvBlue, 0);
+ } else {
+ // Clock diamond is green for regular timeSpeedOffset
+ gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 170, 100, sThreeDayClockAlpha);
+ }
- colorStep = ABS_ALT(D_801BFBD4 - D_801BFBF4[D_801BFBE8]) / D_801BFBE4;
- if (D_801BFBD4 >= D_801BFBF4[D_801BFBE8]) {
- D_801BFBD4 -= colorStep;
- } else {
- D_801BFBD4 += colorStep;
- }
+ OVERLAY_DISP = Gfx_DrawTexRectIA8(OVERLAY_DISP, gThreeDayClockDiamondTex, 40, 32, 140, 190, 40, 32,
+ 1 << 10, 1 << 10);
- colorStep = ABS_ALT(D_801BFBD8 - D_801BFBF8[D_801BFBE8]) / D_801BFBE4;
- if (D_801BFBD8 >= D_801BFBF8[D_801BFBE8]) {
- D_801BFBD8 -= colorStep;
- } else {
- D_801BFBD8 += colorStep;
- }
+ /**
+ * Section: Draw Three-Day Clock's Day-Number over Diamond
+ */
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 155, sThreeDayClockAlpha);
- colorStep = ABS_ALT(D_801BFBDC - D_801BFBFC[D_801BFBE8]) / D_801BFBE4;
- if (D_801BFBDC >= D_801BFBFC[D_801BFBE8]) {
- D_801BFBDC -= colorStep;
- } else {
- D_801BFBDC += colorStep;
- }
+ OVERLAY_DISP = Gfx_DrawTexRectIA8(OVERLAY_DISP, interfaceCtx->doActionSegment + 0x780, 48, 27, 137, 192,
+ 48, 27, 1 << 10, 1 << 10);
- colorStep = ABS_ALT(D_801BFBE0 - D_801BFC00[D_801BFBE8]) / D_801BFBE4;
- if (D_801BFBE0 >= D_801BFC00[D_801BFBE8]) {
- D_801BFBE0 -= colorStep;
- } else {
- D_801BFBE0 += colorStep;
- }
+ /**
+ * Section: Draw Three-Day Clock's Star (for the Minute Tracker)
+ */
+ gDPPipeSync(OVERLAY_DISP++);
- D_801BFBE4--;
-
- if (D_801BFBE4 == 0) {
- D_801BFBCC = D_801BFBEC[D_801BFBE8];
- D_801BFBD0 = D_801BFBF0[D_801BFBE8];
- D_801BFBD4 = D_801BFBF4[D_801BFBE8];
- D_801BFBD8 = D_801BFBF8[D_801BFBE8];
- D_801BFBDC = D_801BFBFC[D_801BFBE8];
- D_801BFBE0 = D_801BFC00[D_801BFBE8];
- D_801BFBE4 = 15;
- D_801BFBE8 ^= 1;
- }
+ if (D_801BF974 != 0) {
+ D_801BF980 += 0.02f;
+ D_801BF97C += 11;
+ } else {
+ D_801BF980 -= 0.02f;
+ D_801BF97C -= 11;
+ }
- gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0,
- PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0,
- PRIMITIVE, 0);
- gDPSetPrimColor(OVERLAY_DISP++, 0, 0, D_801BFBCC, D_801BFBD0, 255, sThreeDayClockAlpha);
- gDPSetEnvColor(OVERLAY_DISP++, D_801BFBD8, D_801BFBDC, D_801BFBE0, 0);
- } else {
- // Clock diamond is green for regular timeSpeedOffset
- gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
- gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 170, 100, sThreeDayClockAlpha);
- }
+ D_801BF978--;
+ if (D_801BF978 == 0) {
+ D_801BF978 = 10;
+ D_801BF974 ^= 1;
+ }
- OVERLAY_DISP = Gfx_DrawTexRectIA8(OVERLAY_DISP, gThreeDayClockDiamondTex, 40, 32, 140, 190, 40,
- 32, 1 << 10, 1 << 10);
+ timeInSeconds = TIME_TO_SECONDS_F(gSaveContext.save.time);
+ timeInSeconds -= ((s16)(timeInSeconds / 3600.0f)) * 3600.0f;
- /**
- * Draw Three-Day Clock's Day-Number over Diamond
- */
- gDPPipeSync(OVERLAY_DISP++);
- gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 155, sThreeDayClockAlpha);
+ Gfx_SetupDL42_Overlay(play->state.gfxCtx);
- OVERLAY_DISP = Gfx_DrawTexRectIA8(OVERLAY_DISP, interfaceCtx->doActionSegment + 0x780, 48, 27,
- 137, 192, 48, 27, 1 << 10, 1 << 10);
+ gSPMatrix(OVERLAY_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- /**
- * Draw Three-Day Clock's Star (for the Minute Tracker)
- */
- gDPPipeSync(OVERLAY_DISP++);
+ if (sThreeDayClockAlpha != 255) {
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 110, sThreeDayClockAlpha);
+ } else {
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 110, D_801BF97C);
+ }
- if (D_801BF974 != 0) {
- D_801BF980 += 0.02f;
- D_801BF97C += 11;
- } else {
- D_801BF980 -= 0.02f;
- D_801BF97C -= 11;
- }
+ gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
+ gDPSetAlphaCompare(OVERLAY_DISP++, G_AC_THRESHOLD);
+ gDPSetRenderMode(OVERLAY_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
- D_801BF978--;
- if (D_801BF978 == 0) {
- D_801BF978 = 10;
- D_801BF974 ^= 1;
- }
+ Matrix_Translate(0.0f, -86.0f, 0.0f, MTXMODE_NEW);
+ Matrix_Scale(1.0f, 1.0f, D_801BF980, MTXMODE_APPLY);
+ Matrix_RotateZF(-(timeInSeconds * 0.0175f) / 10.0f, MTXMODE_APPLY);
- timeInSeconds = TIME_TO_SECONDS_F(gSaveContext.save.time);
- timeInSeconds -= ((s16)(timeInSeconds / 3600.0f)) * 3600.0f;
+ gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx),
+ G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[12], 4, 0);
+ gDPLoadTextureBlock_4b(OVERLAY_DISP++, gThreeDayClockStarMinuteTex, G_IM_FMT_I, 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);
+ gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0);
+ }
- Gfx_SetupDL42_Overlay(play->state.gfxCtx);
+ /**
+ * Section: Cuts off Three-Day Clock's Sun and Moon when they dip below the clock
+ */
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetScissorFrac(OVERLAY_DISP++, G_SC_NON_INTERLACE, 400, 620, 880,
+ R_THREE_DAY_CLOCK_SUN_MOON_CUTOFF * 4.0f);
- gSPMatrix(OVERLAY_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ // determines the current hour
+ for (sp1C6 = 0; sp1C6 <= 24; sp1C6++) {
+ if (((void)0, gSaveContext.save.time) < sThreeDayClockHours[sp1C6 + 1]) {
+ break;
+ }
+ }
- if (sThreeDayClockAlpha != 255) {
- gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 110, sThreeDayClockAlpha);
- } else {
- gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 110, D_801BF97C);
- }
+ /**
+ * Section: Draw Three-Day Clock's Sun (for the Day-Time Hours Tracker)
+ */
+ time = gSaveContext.save.time;
+ sp1D8 = Math_SinS(time) * -40.0f;
+ temp_f14 = Math_CosS(time) * -34.0f;
- gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
- gDPSetAlphaCompare(OVERLAY_DISP++, G_AC_THRESHOLD);
- gDPSetRenderMode(OVERLAY_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
-
- Matrix_Translate(0.0f, -86.0f, 0.0f, MTXMODE_NEW);
- Matrix_Scale(1.0f, 1.0f, D_801BF980, MTXMODE_APPLY);
- Matrix_RotateZF(-(timeInSeconds * 0.0175f) / 10.0f, MTXMODE_APPLY);
-
- gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx),
- G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[12], 4, 0);
- gDPLoadTextureBlock_4b(OVERLAY_DISP++, gThreeDayClockStarMinuteTex, G_IM_FMT_I, 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);
- gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0);
- }
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 100, 110, sThreeDayClockAlpha);
- /**
- * Cuts off Three-Day Clock's Sun and Moon when they dip below the clock
- */
- gDPPipeSync(OVERLAY_DISP++);
- gDPSetScissorFrac(OVERLAY_DISP++, G_SC_NON_INTERLACE, 400, 620, 880,
- R_THREE_DAY_CLOCK_SUN_MOON_CUTOFF * 4.0f);
+ Matrix_Translate(sp1D8, temp_f14, 0.0f, MTXMODE_NEW);
+ Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
- // determines the current hour
- for (sp1C6 = 0; sp1C6 <= 24; sp1C6++) {
- if (((void)0, gSaveContext.save.time) < sThreeDayClockHours[sp1C6 + 1]) {
- break;
- }
- }
+ gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[16], 4, 0);
- /**
- * Draw Three-Day Clock's Sun (for the Day-Time Hours Tracker)
- */
- time = gSaveContext.save.time;
- sp1D8 = Math_SinS(time) * -40.0f;
- temp_f14 = Math_CosS(time) * -34.0f;
+ OVERLAY_DISP = Gfx_DrawTexQuadIA8(OVERLAY_DISP, gThreeDayClockSunHourTex, 24, 24, 0);
- gDPPipeSync(OVERLAY_DISP++);
- gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
- gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 100, 110, sThreeDayClockAlpha);
+ /**
+ * Section: Draw Three-Day Clock's Moon (for the Night-Time Hours Tracker)
+ */
+ sp1D8 = Math_SinS(time) * 40.0f;
+ temp_f14 = Math_CosS(time) * 34.0f;
- Matrix_Translate(sp1D8, temp_f14, 0.0f, MTXMODE_NEW);
- Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 55, sThreeDayClockAlpha);
- gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx),
- G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[16], 4, 0);
+ Matrix_Translate(sp1D8, temp_f14, 0.0f, MTXMODE_NEW);
+ Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
+ gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[20], 4, 0);
- OVERLAY_DISP = Gfx_DrawTexQuadIA8(OVERLAY_DISP, gThreeDayClockSunHourTex, 24, 24, 0);
+ OVERLAY_DISP = Gfx_DrawTexQuadIA8(OVERLAY_DISP, gThreeDayClockMoonHourTex, 24, 24, 0);
- /**
- * Draw Three-Day Clock's Moon (for the Night-Time Hours Tracker)
- */
- sp1D8 = Math_SinS(time) * 40.0f;
- temp_f14 = Math_CosS(time) * 34.0f;
+ /**
+ * Section: Cuts off Three-Day Clock's Hour Digits when they dip below the clock
+ */
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetScissorFrac(OVERLAY_DISP++, G_SC_NON_INTERLACE, 400, 620, 880,
+ R_THREE_DAY_CLOCK_HOUR_DIGIT_CUTOFF * 4.0f);
- gDPPipeSync(OVERLAY_DISP++);
- gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
- gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 55, sThreeDayClockAlpha);
+ /**
+ * Section: Draws Three-Day Clock's Hour Digit Above the Sun
+ */
+ sp1CC = gSaveContext.save.time * 0.000096131f; // (2.0f * 3.15f / 0x10000)
- Matrix_Translate(sp1D8, temp_f14, 0.0f, MTXMODE_NEW);
- Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
- gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx),
- G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[20], 4, 0);
+ // Rotates Three-Day Clock's Hour Digit To Above the Sun
+ Matrix_Translate(0.0f, R_THREE_DAY_CLOCK_Y_POS / 10.0f, 0.0f, MTXMODE_NEW);
+ Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
+ Matrix_RotateZF(-(sp1CC - 3.15f), MTXMODE_APPLY);
+ gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- OVERLAY_DISP = Gfx_DrawTexQuadIA8(OVERLAY_DISP, gThreeDayClockMoonHourTex, 24, 24, 0);
+ // Draws Three-Day Clock's Hour Digit Above the Sun
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0,
+ 0, PRIMITIVE, 0);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, sThreeDayClockAlpha);
+ gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[24], 8, 0);
- /**
- * Cuts off Three-Day Clock's Hour Digits when they dip below the clock
- */
- gDPPipeSync(OVERLAY_DISP++);
- gDPSetScissorFrac(OVERLAY_DISP++, G_SC_NON_INTERLACE, 400, 620, 880,
- R_THREE_DAY_CLOCK_HOUR_DIGIT_CUTOFF * 4.0f);
-
- /**
- * Draws Three-Day Clock's Hour Digit Above the Sun
- */
- sp1CC = gSaveContext.save.time * 0.000096131f;
-
- // Rotates Three-Day Clock's Hour Digit To Above the Sun
- Matrix_Translate(0.0f, R_THREE_DAY_CLOCK_Y_POS / 10.0f, 0.0f, MTXMODE_NEW);
- Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
- Matrix_RotateZF(-(sp1CC - 3.15f), MTXMODE_APPLY);
- gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx),
- G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ OVERLAY_DISP = Gfx_DrawTexQuad4b(OVERLAY_DISP, sThreeDayClockHourTextures[sp1C6], 4, 16, 11, 0);
- // Draws Three-Day Clock's Hour Digit Above the Sun
- gDPPipeSync(OVERLAY_DISP++);
- gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE,
- TEXEL0, 0, PRIMITIVE, 0);
- gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, sThreeDayClockAlpha);
- gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[24], 8, 0);
+ // Colours the Three-Day Clocks's Hour Digit Above the Sun
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 155, sThreeDayClockAlpha);
+ gSP1Quadrangle(OVERLAY_DISP++, 4, 6, 7, 5, 0);
- OVERLAY_DISP = Gfx_DrawTexQuad4b(OVERLAY_DISP, sThreeDayClockHourTextures[sp1C6], 4, 16, 11, 0);
+ /**
+ * Section: Draws Three-Day Clock's Hour Digit Above the Moon
+ */
- // Colours the Three-Day Clocks's Hour Digit Above the Sun
- gDPPipeSync(OVERLAY_DISP++);
- gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 155, sThreeDayClockAlpha);
- gSP1Quadrangle(OVERLAY_DISP++, 4, 6, 7, 5, 0);
-
- /**
- * Draws Three-Day Clock's Hour Digit Above the Moon
- */
- // Rotates Three-Day Clock's Hour Digit To Above the Moon
- Matrix_Translate(0.0f, R_THREE_DAY_CLOCK_Y_POS / 10.0f, 0.0f, MTXMODE_NEW);
- Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
- Matrix_RotateZF(-sp1CC, MTXMODE_APPLY);
- gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx),
- G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ // Rotates Three-Day Clock's Hour Digit To Above the Moon
+ Matrix_Translate(0.0f, R_THREE_DAY_CLOCK_Y_POS / 10.0f, 0.0f, MTXMODE_NEW);
+ Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
+ Matrix_RotateZF(-sp1CC, MTXMODE_APPLY);
+ gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- // Draws Three-Day Clock's Hour Digit Above the Moon
- gDPPipeSync(OVERLAY_DISP++);
- gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE,
- TEXEL0, 0, PRIMITIVE, 0);
- gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, sThreeDayClockAlpha);
- gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[32], 8, 0);
+ // Draws Three-Day Clock's Hour Digit Above the Moon
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0,
+ 0, PRIMITIVE, 0);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, sThreeDayClockAlpha);
+ gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[32], 8, 0);
- OVERLAY_DISP = Gfx_DrawTexQuad4b(OVERLAY_DISP, sThreeDayClockHourTextures[sp1C6], 4, 16, 11, 0);
+ OVERLAY_DISP = Gfx_DrawTexQuad4b(OVERLAY_DISP, sThreeDayClockHourTextures[sp1C6], 4, 16, 11, 0);
- // Colours the Three-Day Clocks's Hour Digit Above the Moon
- gDPPipeSync(OVERLAY_DISP++);
- gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 155, sThreeDayClockAlpha);
- gSP1Quadrangle(OVERLAY_DISP++, 4, 6, 7, 5, 0);
+ // Colours the Three-Day Clocks's Hour Digit Above the Moon
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 155, sThreeDayClockAlpha);
+ gSP1Quadrangle(OVERLAY_DISP++, 4, 6, 7, 5, 0);
- gSPDisplayList(OVERLAY_DISP++, D_0E000000.setScissor);
+ gSPDisplayList(OVERLAY_DISP++, D_0E000000.setScissor);
- // Final Hours
- if ((CURRENT_DAY >= 4) || ((CURRENT_DAY == 3) && (((void)0, gSaveContext.save.time) >= 5) &&
- (((void)0, gSaveContext.save.time) < CLOCK_TIME(6, 0)))) {
- if (((void)0, gSaveContext.save.time) >= CLOCK_TIME(5, 0)) {
- // The Final Hours clock will flash red
+ // Final Hours
+ if ((CURRENT_DAY >= 4) ||
+ ((CURRENT_DAY == 3) && (((void)0, gSaveContext.save.time) >= (CLOCK_TIME(0, 0) + 5)) &&
+ (((void)0, gSaveContext.save.time) < CLOCK_TIME(6, 0)))) {
+ if (((void)0, gSaveContext.save.time) >= CLOCK_TIME(5, 0)) {
+ // The Final Hours clock will flash red
- colorStep =
- ABS_ALT(sFinalHoursClockDigitsRed - D_801BFC04[sFinalHoursClockColorTargetIndex]) /
+ colorStep = ABS_ALT(sFinalHoursClockDigitsRed -
+ sFinalHoursClockDigitsRedTargets[sFinalHoursClockColorTargetIndex]) /
sFinalHoursClockColorTimer;
- if (sFinalHoursClockDigitsRed >= D_801BFC04[sFinalHoursClockColorTargetIndex]) {
- sFinalHoursClockDigitsRed -= colorStep;
- } else {
- sFinalHoursClockDigitsRed += colorStep;
- }
+ if (sFinalHoursClockDigitsRed >=
+ sFinalHoursClockDigitsRedTargets[sFinalHoursClockColorTargetIndex]) {
+ sFinalHoursClockDigitsRed -= colorStep;
+ } else {
+ sFinalHoursClockDigitsRed += colorStep;
+ }
- colorStep =
- ABS_ALT(sFinalHoursClockFrameEnvRed - D_801BFC08[sFinalHoursClockColorTargetIndex]) /
+ colorStep = ABS_ALT(sFinalHoursClockFrameEnvRed -
+ sFinalHoursClockFrameEnvRedTargets[sFinalHoursClockColorTargetIndex]) /
sFinalHoursClockColorTimer;
- if (sFinalHoursClockFrameEnvRed >= D_801BFC08[sFinalHoursClockColorTargetIndex]) {
- sFinalHoursClockFrameEnvRed -= colorStep;
- } else {
- sFinalHoursClockFrameEnvRed += colorStep;
- }
+ if (sFinalHoursClockFrameEnvRed >=
+ sFinalHoursClockFrameEnvRedTargets[sFinalHoursClockColorTargetIndex]) {
+ sFinalHoursClockFrameEnvRed -= colorStep;
+ } else {
+ sFinalHoursClockFrameEnvRed += colorStep;
+ }
- colorStep =
- ABS_ALT(sFinalHoursClockFrameEnvGreen - D_801BFC0C[sFinalHoursClockColorTargetIndex]) /
+ colorStep = ABS_ALT(sFinalHoursClockFrameEnvGreen -
+ sFinalHoursClockFrameEnvGreenTargets[sFinalHoursClockColorTargetIndex]) /
sFinalHoursClockColorTimer;
- if (sFinalHoursClockFrameEnvGreen >= D_801BFC0C[sFinalHoursClockColorTargetIndex]) {
- sFinalHoursClockFrameEnvGreen -= colorStep;
- } else {
- sFinalHoursClockFrameEnvGreen += colorStep;
- }
+ if (sFinalHoursClockFrameEnvGreen >=
+ sFinalHoursClockFrameEnvGreenTargets[sFinalHoursClockColorTargetIndex]) {
+ sFinalHoursClockFrameEnvGreen -= colorStep;
+ } else {
+ sFinalHoursClockFrameEnvGreen += colorStep;
+ }
- colorStep =
- ABS_ALT(sFinalHoursClockFrameEnvBlue - D_801BFC10[sFinalHoursClockColorTargetIndex]) /
+ colorStep = ABS_ALT(sFinalHoursClockFrameEnvBlue -
+ sFinalHoursClockFrameEnvBlueTargets[sFinalHoursClockColorTargetIndex]) /
sFinalHoursClockColorTimer;
- if (sFinalHoursClockFrameEnvBlue >= D_801BFC10[sFinalHoursClockColorTargetIndex]) {
- sFinalHoursClockFrameEnvBlue -= colorStep;
- } else {
- sFinalHoursClockFrameEnvBlue += colorStep;
- }
-
- sFinalHoursClockColorTimer--;
-
- if (sFinalHoursClockColorTimer == 0) {
- sFinalHoursClockDigitsRed = D_801BFC04[sFinalHoursClockColorTargetIndex];
- sFinalHoursClockFrameEnvRed = D_801BFC08[sFinalHoursClockColorTargetIndex];
- sFinalHoursClockFrameEnvGreen = D_801BFC0C[sFinalHoursClockColorTargetIndex];
- sFinalHoursClockFrameEnvBlue = D_801BFC10[sFinalHoursClockColorTargetIndex];
- sFinalHoursClockColorTimer = 6;
- sFinalHoursClockColorTargetIndex ^= 1;
- }
- }
-
- sp1E6 = sThreeDayClockAlpha;
- if (sp1E6 != 0) {
- sp1E6 = 255;
- }
-
- Gfx_SetupDL39_Overlay(play->state.gfxCtx);
-
- /**
- * Draws Final-Hours Clock's Frame
- */
- gSPMatrix(OVERLAY_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gDPSetAlphaCompare(OVERLAY_DISP++, G_AC_THRESHOLD);
- gDPSetRenderMode(OVERLAY_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
- gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0,
- PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0,
- PRIMITIVE, 0);
- gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 195, sp1E6);
- gDPSetEnvColor(OVERLAY_DISP++, sFinalHoursClockFrameEnvRed, sFinalHoursClockFrameEnvGreen,
- sFinalHoursClockFrameEnvBlue, 0);
-
- OVERLAY_DISP = Gfx_DrawTexRect4b(OVERLAY_DISP, gFinalHoursClockFrameTex, 3, 80, 13, 119, 202,
- 80, 13, 0, 0, 0, 1 << 10, 1 << 10);
-
- finalHoursClockSlots[0] = 0;
-
- timeUntilMoonCrash = TIME_UNTIL_MOON_CRASH;
+ if (sFinalHoursClockFrameEnvBlue >=
+ sFinalHoursClockFrameEnvBlueTargets[sFinalHoursClockColorTargetIndex]) {
+ sFinalHoursClockFrameEnvBlue -= colorStep;
+ } else {
+ sFinalHoursClockFrameEnvBlue += colorStep;
+ }
- timeInMinutes = TIME_TO_MINUTES_F(timeUntilMoonCrash);
+ sFinalHoursClockColorTimer--;
+
+ if (sFinalHoursClockColorTimer == 0) {
+ sFinalHoursClockDigitsRed = sFinalHoursClockDigitsRedTargets[sFinalHoursClockColorTargetIndex];
+ sFinalHoursClockFrameEnvRed =
+ sFinalHoursClockFrameEnvRedTargets[sFinalHoursClockColorTargetIndex];
+ sFinalHoursClockFrameEnvGreen =
+ sFinalHoursClockFrameEnvGreenTargets[sFinalHoursClockColorTargetIndex];
+ sFinalHoursClockFrameEnvBlue =
+ sFinalHoursClockFrameEnvBlueTargets[sFinalHoursClockColorTargetIndex];
+ sFinalHoursClockColorTimer = 6;
+ sFinalHoursClockColorTargetIndex ^= 1;
+ }
+ }
- // digits for hours
- finalHoursClockSlots[1] = timeInMinutes / 60.0f;
- finalHoursClockSlots[2] = timeInMinutes / 60.0f;
+ sp1E6 = sThreeDayClockAlpha;
+ if (sp1E6 != 0) {
+ sp1E6 = 255;
+ }
- temp = (s32)timeInMinutes % 60;
+ Gfx_SetupDL39_Overlay(play->state.gfxCtx);
- while (finalHoursClockSlots[1] >= 10) {
- finalHoursClockSlots[0]++;
- finalHoursClockSlots[1] -= 10;
- }
+ /**
+ * Section: Draws Final-Hours Clock's Frame
+ */
+ gSPMatrix(OVERLAY_DISP++, &gIdentityMtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gDPSetAlphaCompare(OVERLAY_DISP++, G_AC_THRESHOLD);
+ gDPSetRenderMode(OVERLAY_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
+ gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
+ PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 195, sp1E6);
+ gDPSetEnvColor(OVERLAY_DISP++, sFinalHoursClockFrameEnvRed, sFinalHoursClockFrameEnvGreen,
+ sFinalHoursClockFrameEnvBlue, 0);
+
+ OVERLAY_DISP = Gfx_DrawTexRect4b(OVERLAY_DISP, gFinalHoursClockFrameTex, 3, 80, 13, 119, 202, 80, 13, 0,
+ 0, 0, 1 << 10, 1 << 10);
+
+ timeUntilMoonCrash = TIME_UNTIL_MOON_CRASH;
+ timeInMinutes = TIME_TO_MINUTES_F(timeUntilMoonCrash);
+
+ // digits for hours
+ finalHoursClockSlots[0] = 0;
+ finalHoursClockSlots[1] = timeInMinutes / 60.0f;
+ finalHoursClockSlots[2] = timeInMinutes / 60.0f;
+
+ while (finalHoursClockSlots[1] >= 10) {
+ finalHoursClockSlots[0]++;
+ finalHoursClockSlots[1] -= 10;
+ }
- // digits for minutes
- finalHoursClockSlots[3] = 0;
- finalHoursClockSlots[4] = temp;
+ // digits for minutes
+ finalHoursClockSlots[3] = 0;
+ finalHoursClockSlots[4] = (s32)timeInMinutes % 60;
+ finalHoursClockSlots[5] = (s32)timeInMinutes % 60;
- while (finalHoursClockSlots[4] >= 10) {
- finalHoursClockSlots[3]++;
- finalHoursClockSlots[4] -= 10;
- }
+ while (finalHoursClockSlots[4] >= 10) {
+ finalHoursClockSlots[3]++;
+ finalHoursClockSlots[4] -= 10;
+ }
- // digits for seconds
- finalHoursClockSlots[6] = 0;
- finalHoursClockSlots[7] =
- timeUntilMoonCrash - (u32)((finalHoursClockSlots[2] * ((f32)0x10000 / 24)) +
- (((void)0, temp) * ((f32)0x10000 / (24 * 60))));
+ // digits for seconds
+ finalHoursClockSlots[6] = 0;
+ finalHoursClockSlots[7] =
+ timeUntilMoonCrash - (u32)((finalHoursClockSlots[2] * ((f32)0x10000 / 24)) +
+ (finalHoursClockSlots[5] * ((f32)0x10000 / (24 * 60))));
- while (finalHoursClockSlots[7] >= 10) {
- finalHoursClockSlots[6]++;
- finalHoursClockSlots[7] -= 10;
- }
+ while (finalHoursClockSlots[7] >= 10) {
+ finalHoursClockSlots[6]++;
+ finalHoursClockSlots[7] -= 10;
+ }
- // Colon separating hours from minutes and minutes from seconds
- finalHoursClockSlots[2] = finalHoursClockSlots[5] = 10;
+ // Colon separating hours from minutes and minutes from seconds
+ finalHoursClockSlots[2] = finalHoursClockSlots[5] = 10;
- /**
- * Draws Final-Hours Clock's Digits
- */
- gDPPipeSync(OVERLAY_DISP++);
- gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sFinalHoursClockDigitsRed, 0, 0, sp1E6);
- gDPSetEnvColor(OVERLAY_DISP++, sFinalHoursClockDigitsRed, 0, 0, 0);
+ /**
+ * Section: Draws Final-Hours Clock's Digits
+ */
+ gDPPipeSync(OVERLAY_DISP++);
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sFinalHoursClockDigitsRed, 0, 0, sp1E6);
+ gDPSetEnvColor(OVERLAY_DISP++, sFinalHoursClockDigitsRed, 0, 0, 0);
- for (sp1C6 = 0; sp1C6 < 8; sp1C6++) {
- index = D_801BFC40[sp1C6];
+ for (sp1C6 = 0; sp1C6 < 8; sp1C6++) {
+ index = sFinalHoursDigitSlotPosXOffset[sp1C6];
- OVERLAY_DISP =
- Gfx_DrawTexRectI8(OVERLAY_DISP, sFinalHoursDigitTextures[finalHoursClockSlots[sp1C6]],
- 8, 8, index, 205, 8, 8, 1 << 10, 1 << 10);
- }
- }
+ OVERLAY_DISP =
+ Gfx_DrawTexRectI8(OVERLAY_DISP, sFinalHoursDigitTextures[finalHoursClockSlots[sp1C6]], 8, 8,
+ index, 205, 8, 8, 1 << 10, 1 << 10);
}
}
}
}
+
CLOSE_DISPS(play->state.gfxCtx);
}
-#else
-s16 sThreeDayClockAlpha = 255;
-s16 D_801BFB30 = 0;
-s16 D_801BFB34 = 0;
-u16 sThreeDayClockHours[] = {
- CLOCK_TIME(0, 0), CLOCK_TIME(1, 0), CLOCK_TIME(2, 0), CLOCK_TIME(3, 0), CLOCK_TIME(4, 0),
- CLOCK_TIME(5, 0), CLOCK_TIME(6, 0), CLOCK_TIME(7, 0), CLOCK_TIME(8, 0), CLOCK_TIME(9, 0),
- CLOCK_TIME(10, 0), CLOCK_TIME(11, 0), CLOCK_TIME(12, 0), CLOCK_TIME(13, 0), CLOCK_TIME(14, 0),
- CLOCK_TIME(15, 0), CLOCK_TIME(16, 0), CLOCK_TIME(17, 0), CLOCK_TIME(18, 0), CLOCK_TIME(19, 0),
- CLOCK_TIME(20, 0), CLOCK_TIME(21, 0), CLOCK_TIME(22, 0), CLOCK_TIME(23, 0), CLOCK_TIME(24, 0) - 1,
-};
-TexturePtr sThreeDayClockHourTextures[] = {
- gThreeDayClockHour12Tex, gThreeDayClockHour1Tex, gThreeDayClockHour2Tex, gThreeDayClockHour3Tex,
- gThreeDayClockHour4Tex, gThreeDayClockHour5Tex, gThreeDayClockHour6Tex, gThreeDayClockHour7Tex,
- gThreeDayClockHour8Tex, gThreeDayClockHour9Tex, gThreeDayClockHour10Tex, gThreeDayClockHour11Tex,
- gThreeDayClockHour12Tex, gThreeDayClockHour1Tex, gThreeDayClockHour2Tex, gThreeDayClockHour3Tex,
- gThreeDayClockHour4Tex, gThreeDayClockHour5Tex, gThreeDayClockHour6Tex, gThreeDayClockHour7Tex,
- gThreeDayClockHour8Tex, gThreeDayClockHour9Tex, gThreeDayClockHour10Tex, gThreeDayClockHour11Tex,
-};
-s16 D_801BFBCC = 0; // color R
-s16 D_801BFBD0 = 155; // color G
-s16 D_801BFBD4 = 255;
-s16 D_801BFBD8 = 0;
-s16 D_801BFBDC = 0;
-s16 D_801BFBE0 = 0;
-s16 D_801BFBE4 = 0xF;
-u32 D_801BFBE8 = 0;
-s16 D_801BFBEC[] = { 100, 0 };
-s16 D_801BFBF0[] = { 205, 155 };
-s16 D_801BFBF4[] = { 255, 255 };
-s16 D_801BFBF8[] = { 30, 0 };
-s16 D_801BFBFC[] = { 30, 0 };
-s16 D_801BFC00[] = { 100, 0 };
-s16 D_801BFC04[] = { 255, 0 };
-s16 D_801BFC08[] = { 100, 0 };
-s16 D_801BFC0C[] = { 30, 0 };
-s16 D_801BFC10[] = { 100, 0 };
-TexturePtr sFinalHoursDigitTextures[] = {
- gFinalHoursClockDigit0Tex, gFinalHoursClockDigit1Tex, gFinalHoursClockDigit2Tex, gFinalHoursClockDigit3Tex,
- gFinalHoursClockDigit4Tex, gFinalHoursClockDigit5Tex, gFinalHoursClockDigit6Tex, gFinalHoursClockDigit7Tex,
- gFinalHoursClockDigit8Tex, gFinalHoursClockDigit9Tex, gFinalHoursClockColonTex,
-};
-s16 D_801BFC40[] = {
- 127, 136, 144, 151, 160, 168, 175, 184,
-};
-void Interface_DrawClock(PlayState* play);
-#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/Interface_DrawClock.s")
-#endif
void Interface_SetPerfectLetters(PlayState* play, s16 perfectLettersType) {
InterfaceContext* interfaceCtx = &play->interfaceCtx;