diff options
| author | engineer124 <47598039+engineer124@users.noreply.github.com> | 2023-11-27 20:04:54 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-27 20:04:54 +1100 |
| commit | c04aaab6a1d0bdaf6071fadc649385fd3e71e774 (patch) | |
| tree | 0ecf2ff0bd2282cc6b2844665dd527f60e2eca68 /src/code/z_parameter.c | |
| parent | 6dd16009361b2561f77b7933981611a9b975fa21 (diff) | |
Use `CURRENT_TIME` Macro (#1514)
* use CURRENT_TIME macro
* add comment
* cleanup brackets
Diffstat (limited to 'src/code/z_parameter.c')
| -rw-r--r-- | src/code/z_parameter.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 9bf52c4e4..c1098f23a 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -4477,9 +4477,8 @@ void Interface_DrawClock(PlayState* play) { 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))))) { + if (((CURRENT_DAY >= 4) || ((CURRENT_DAY == 3) && (CURRENT_TIME >= (CLOCK_TIME(0, 0) + 5)) && + (CURRENT_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 { @@ -4601,7 +4600,7 @@ void Interface_DrawClock(PlayState* play) { D_801BF974 ^= 1; } - timeInSeconds = TIME_TO_SECONDS_F(gSaveContext.save.time); + timeInSeconds = TIME_TO_SECONDS_F(CURRENT_TIME); timeInSeconds -= ((s16)(timeInSeconds / 3600.0f)) * 3600.0f; Gfx_SetupDL42_Overlay(play->state.gfxCtx); @@ -4640,7 +4639,7 @@ void Interface_DrawClock(PlayState* play) { // determines the current hour for (sp1C6 = 0; sp1C6 <= 24; sp1C6++) { - if (((void)0, gSaveContext.save.time) < sThreeDayClockHours[sp1C6 + 1]) { + if (CURRENT_TIME < sThreeDayClockHours[sp1C6 + 1]) { break; } } @@ -4648,7 +4647,7 @@ void Interface_DrawClock(PlayState* play) { /** * Section: Draw Three-Day Clock's Sun (for the Day-Time Hours Tracker) */ - time = gSaveContext.save.time; + time = CURRENT_TIME; sp1D8 = Math_SinS(time) * -40.0f; temp_f14 = Math_CosS(time) * -34.0f; @@ -4691,7 +4690,7 @@ void Interface_DrawClock(PlayState* play) { /** * Section: Draws Three-Day Clock's Hour Digit Above the Sun */ - sp1CC = gSaveContext.save.time * 0.000096131f; // (2.0f * 3.15f / 0x10000) + sp1CC = CURRENT_TIME * 0.000096131f; // (2.0f * 3.15f / 0x10000) // 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); @@ -4741,9 +4740,8 @@ void Interface_DrawClock(PlayState* play) { // 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)) { + ((CURRENT_DAY == 3) && (CURRENT_TIME >= (CLOCK_TIME(0, 0) + 5)) && (CURRENT_TIME < CLOCK_TIME(6, 0)))) { + if (CURRENT_TIME >= CLOCK_TIME(5, 0)) { // The Final Hours clock will flash red colorStep = ABS_ALT(sFinalHoursClockDigitsRed - @@ -7033,7 +7031,7 @@ void Interface_Update(PlayState* play) { if (play->envCtx.sceneTimeSpeed != 0) { if (gSaveContext.sunsSongState != SUNSSONG_SPEED_TIME) { sIsSunsPlayedAtDay = false; - if ((gSaveContext.save.time >= CLOCK_TIME(6, 0)) && (gSaveContext.save.time <= CLOCK_TIME(18, 0))) { + if ((CURRENT_TIME >= CLOCK_TIME(6, 0)) && (CURRENT_TIME <= CLOCK_TIME(18, 0))) { sIsSunsPlayedAtDay = true; } @@ -7042,7 +7040,7 @@ void Interface_Update(PlayState* play) { R_TIME_SPEED = 400; } else if (!sIsSunsPlayedAtDay) { // Nighttime - if ((gSaveContext.save.time >= CLOCK_TIME(6, 0)) && (gSaveContext.save.time <= CLOCK_TIME(18, 0))) { + if ((CURRENT_TIME >= CLOCK_TIME(6, 0)) && (CURRENT_TIME <= CLOCK_TIME(18, 0))) { // Daytime has been reached. End suns song effect gSaveContext.sunsSongState = SUNSSONG_INACTIVE; R_TIME_SPEED = sPrevTimeSpeed; @@ -7050,7 +7048,7 @@ void Interface_Update(PlayState* play) { } } else { // Daytime - if (gSaveContext.save.time > CLOCK_TIME(18, 0)) { + if (CURRENT_TIME > CLOCK_TIME(18, 0)) { // Nighttime has been reached. End suns song effect gSaveContext.sunsSongState = SUNSSONG_INACTIVE; R_TIME_SPEED = sPrevTimeSpeed; |
