diff --git a/include/z64schedule.h b/include/z64schedule.h index aafa8520e9..c70809adb3 100644 --- a/include/z64schedule.h +++ b/include/z64schedule.h @@ -32,7 +32,7 @@ #define SCHEDULE_TIME(hour, minute) SCHEDULE_CONVERT_TIME((((hour)*60.0f) + (minute)) * (0x10000 / 60 / 24.0f)) -#define SCHEDULE_TIME_NOW SCHEDULE_CONVERT_TIME(gSaveContext.save.time) +#define SCHEDULE_TIME_NOW SCHEDULE_CONVERT_TIME(CURRENT_TIME) typedef enum ScheduleCommandId { /* 0x00 */ SCHEDULE_CMD_ID_CHECK_FLAG_S, // Checks if a weekEventReg flag is set and branches if so, short range branch diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 0a5d51e224..ca6267ff4c 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -2402,7 +2402,7 @@ void Actor_DeactivateLens(PlayState* play) { void Actor_InitHalfDaysBit(ActorContext* actorCtx) { s32 halfDayCount = CURRENT_DAY * 2; - 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))) { halfDayCount++; } diff --git a/src/code/z_camera.c b/src/code/z_camera.c index b9123a718d..399b1db267 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -7229,7 +7229,7 @@ void Camera_EarthquakeDay3(Camera* camera) { }; if ((CURRENT_DAY == 3) && (CutsceneManager_GetCurrentCsId() == -1)) { - time = gSaveContext.save.time; + time = CURRENT_TIME; timeSpeedOffset = gSaveContext.save.timeSpeedOffset; // Large earthquake created diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 0ef8fed953..c2624dfd81 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -273,9 +273,9 @@ void CutsceneCmd_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdMisc* cmd) { case CS_MISC_FREEZE_TIME: if (!gSaveContext.save.isNight) { - gSaveContext.save.time = ((void)0, gSaveContext.save.time) - (u16)R_TIME_SPEED; + gSaveContext.save.time = CURRENT_TIME - (u16)R_TIME_SPEED; } else { - gSaveContext.save.time = ((void)0, gSaveContext.save.time) - (u16)(2 * R_TIME_SPEED); + gSaveContext.save.time = CURRENT_TIME - (u16)(2 * R_TIME_SPEED); } break; @@ -364,9 +364,8 @@ void CutsceneCmd_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdMisc* cmd) { D_801BB15C = csCtx->curFrame; if (R_TIME_SPEED != 0) { - gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)R_TIME_SPEED; - gSaveContext.save.time = - ((void)0, gSaveContext.save.time) + (u16)((void)0, gSaveContext.save.timeSpeedOffset); + gSaveContext.save.time = CURRENT_TIME + (u16)R_TIME_SPEED; + gSaveContext.save.time = CURRENT_TIME + (u16)((void)0, gSaveContext.save.timeSpeedOffset); } } break; diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 894daa37f4..de4ad150ab 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -572,12 +572,11 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 arg2) { gSaveContext.sunsSongState = SUNSSONG_INACTIVE; - gSaveContext.skyboxTime = ((void)0, gSaveContext.save.time); + gSaveContext.skyboxTime = CURRENT_TIME; Environment_JumpForwardInTime(); - if ((((void)0, gSaveContext.save.time) >= CLOCK_TIME(18, 0)) || - (((void)0, gSaveContext.save.time) < CLOCK_TIME(6, 0))) { + if ((CURRENT_TIME >= CLOCK_TIME(18, 0)) || (CURRENT_TIME < CLOCK_TIME(6, 0))) { gSaveContext.save.isNight = true; } else { gSaveContext.save.isNight = false; @@ -677,9 +676,9 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 arg2) { envCtx->adjLightSettings.fogNear = 0; envCtx->adjLightSettings.zFar = 0; - envCtx->sunPos.x = -(Math_SinS(((void)0, gSaveContext.save.time) - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f; - envCtx->sunPos.y = (Math_CosS(((void)0, gSaveContext.save.time) - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f; - envCtx->sunPos.z = (Math_CosS(((void)0, gSaveContext.save.time) - CLOCK_TIME(12, 0)) * 20.0f) * 25.0f; + envCtx->sunPos.x = -(Math_SinS(CURRENT_TIME - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f; + envCtx->sunPos.y = (Math_CosS(CURRENT_TIME - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f; + envCtx->sunPos.z = (Math_CosS(CURRENT_TIME - CLOCK_TIME(12, 0)) * 20.0f) * 25.0f; envCtx->windDirection.x = 80; envCtx->windDirection.y = 80; @@ -775,8 +774,7 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 arg2) { play->envCtx.precipitation[PRECIP_SNOW_MAX] = 0; if (gWeatherMode == WEATHER_MODE_RAIN) { - if (((u32)CURRENT_DAY == 2) && (((void)0, gSaveContext.save.time) >= CLOCK_TIME(7, 0)) && - (((void)0, gSaveContext.save.time) < CLOCK_TIME(17, 30))) { + if (((u32)CURRENT_DAY == 2) && (CURRENT_TIME >= CLOCK_TIME(7, 0)) && (CURRENT_TIME < CLOCK_TIME(17, 30))) { if (Environment_GetStormState(play) != STORM_STATE_OFF) { play->envCtx.precipitation[PRECIP_RAIN_MAX] = 60; } @@ -1209,10 +1207,9 @@ void Environment_UpdateTime(PlayState* play, EnvironmentContext* envCtx, PauseCo ((play->transitionMode == TRANS_MODE_OFF) || (gSaveContext.gameMode != GAMEMODE_NORMAL))) { if (play->transitionTrigger == TRANS_TRIGGER_OFF) { if ((CutsceneManager_GetCurrentCsId() == CS_ID_NONE) && !Play_InCsMode(play)) { - gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)R_TIME_SPEED; + gSaveContext.save.time = CURRENT_TIME + (u16)R_TIME_SPEED; if (R_TIME_SPEED != 0) { - gSaveContext.save.time = - ((void)0, gSaveContext.save.time) + (u16)((void)0, gSaveContext.save.timeSpeedOffset); + gSaveContext.save.time = CURRENT_TIME + (u16)((void)0, gSaveContext.save.timeSpeedOffset); } } } @@ -1220,13 +1217,12 @@ void Environment_UpdateTime(PlayState* play, EnvironmentContext* envCtx, PauseCo } } - if ((((void)0, gSaveContext.skyboxTime) >= CLOCK_TIME(6, 0)) || - (((void)0, gSaveContext.save.time) < CLOCK_TIME(6, 0)) || - (((void)0, gSaveContext.save.time) >= (CLOCK_TIME(6, 0) + 0x10))) { - gSaveContext.skyboxTime = gSaveContext.save.time; + if ((((void)0, gSaveContext.skyboxTime) >= CLOCK_TIME(6, 0)) || (CURRENT_TIME < CLOCK_TIME(6, 0)) || + (CURRENT_TIME >= (CLOCK_TIME(6, 0) + 0x10))) { + gSaveContext.skyboxTime = CURRENT_TIME; } - time = ((void)0, gSaveContext.save.time); + time = CURRENT_TIME; if ((time >= CLOCK_TIME(18, 0)) || (time < CLOCK_TIME(6, 0))) { gSaveContext.save.isNight = true; @@ -1386,9 +1382,9 @@ void Environment_UpdateLights(PlayState* play, EnvironmentContext* envCtx, Light } if (Environment_IsSceneUpsideDown(play)) { - var_v0 = ((void)0, gSaveContext.save.time) + CLOCK_TIME(12, 0); + var_v0 = CURRENT_TIME + CLOCK_TIME(12, 0); } else { - var_v0 = ((void)0, gSaveContext.save.time); + var_v0 = CURRENT_TIME; } temp_s0_2 = var_v0 - CLOCK_TIME(12, 0); @@ -1615,9 +1611,9 @@ void Environment_UpdateSun(PlayState* play) { } if (Environment_IsSceneUpsideDown(play)) { - phi_v0 = ((void)0, gSaveContext.save.time) + CLOCK_TIME(12, 0); + phi_v0 = CURRENT_TIME + CLOCK_TIME(12, 0); } else { - phi_v0 = ((void)0, gSaveContext.save.time); + phi_v0 = CURRENT_TIME; } temp_a0 = phi_v0 - CLOCK_TIME(12, 0); @@ -1747,7 +1743,7 @@ void Environment_UpdatePostmanEvents(PlayState* play) { } if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_90_01)) { - temp_a2_2 = ((void)0, gSaveContext.save.time) - D_801F4E78; + temp_a2_2 = CURRENT_TIME - D_801F4E78; if (CHECK_WEEKEVENTREG(WEEKEVENTREG_89_40) && ((u16)SCHEDULE_TIME_NOW >= (u16)SCHEDULE_TIME(5, 0))) { SET_WEEKEVENTREG(WEEKEVENTREG_90_01); } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_89_08) && (temp_a2_2 >= CLOCK_TIME(0, 23))) { @@ -1755,7 +1751,7 @@ void Environment_UpdatePostmanEvents(PlayState* play) { D_801F4E78 = 0; } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_85_80) && (temp_a2_2 >= (CLOCK_TIME(1, 39) - 1))) { SET_WEEKEVENTREG(WEEKEVENTREG_89_08); - D_801F4E78 = gSaveContext.save.time; + D_801F4E78 = CURRENT_TIME; } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_86_01) && (temp_a2_2 >= (CLOCK_TIME(1, 9) - 1))) { SET_WEEKEVENTREG(WEEKEVENTREG_85_80); } @@ -1788,7 +1784,7 @@ void Environment_DrawSun(PlayState* play) { if ((play->envCtx.sunPos.y > -800.0f) || Environment_IsSceneUpsideDown(play)) { Matrix_Translate(play->view.eye.x + play->envCtx.sunPos.x, play->view.eye.y + play->envCtx.sunPos.y, play->view.eye.z + play->envCtx.sunPos.z, MTXMODE_NEW); - if (((void)0, gSaveContext.save.time) < CLOCK_TIME(12, 0)) { + if (CURRENT_TIME < CLOCK_TIME(12, 0)) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, (u8)((u8)(sSunColor * 52.0f) + 203), (u8)((u8)(sSunColor * 19.0f) + 181), (u8)sSunPrimAlpha); gDPSetEnvColor(POLY_OPA_DISP++, (u8)(-(u8)(sSunColor * 5.0f) + 175), @@ -1813,7 +1809,7 @@ void Environment_DrawSunLensFlare(PlayState* play, EnvironmentContext* envCtx, V Vec3f vec) { if ((play->envCtx.precipitation[PRECIP_RAIN_CUR] == 0) && !(GET_ACTIVE_CAM(play)->stateFlags & CAM_STATE_UNDERWATER) && (play->skyboxId == SKYBOX_NORMAL_SKY)) { - f32 v0 = Math_CosS(((void)0, gSaveContext.save.time) - CLOCK_TIME(12, 0)); + f32 v0 = Math_CosS(CURRENT_TIME - CLOCK_TIME(12, 0)); Environment_DrawLensFlare(play, &play->envCtx, &play->view, play->state.gfxCtx, vec, 370.0f, v0 * 120.0f, 0x190, true); @@ -2450,11 +2446,10 @@ void Environment_PlaySceneSequence(PlayState* play) { if (play->sequenceCtx.seqId != ((void)0, gSaveContext.seqId)) { Audio_PlaySceneSequence(play->sequenceCtx.seqId, dayMinusOne); } - } else if ((((void)0, gSaveContext.save.time) >= CLOCK_TIME(6, 0)) && - (((void)0, gSaveContext.save.time) <= CLOCK_TIME(17, 10))) { + } else if ((CURRENT_TIME >= CLOCK_TIME(6, 0)) && (CURRENT_TIME <= CLOCK_TIME(17, 10))) { if (gSceneSeqState != SCENESEQ_DEFAULT) { Audio_PlayMorningSceneSequence(play->sequenceCtx.seqId, dayMinusOne); - } else if ((((void)0, gSaveContext.save.time) >= CLOCK_TIME(6, 1)) && + } else if ((CURRENT_TIME >= CLOCK_TIME(6, 1)) && (play->sequenceCtx.seqId != ((void)0, gSaveContext.seqId))) { Audio_PlaySceneSequence(play->sequenceCtx.seqId, dayMinusOne); } @@ -2463,11 +2458,9 @@ void Environment_PlaySceneSequence(PlayState* play) { if (play->sequenceCtx.ambienceId != ((void)0, gSaveContext.ambienceId)) { Audio_PlayAmbience(play->sequenceCtx.ambienceId); } - if ((((void)0, gSaveContext.save.time) > CLOCK_TIME(17, 10)) && - (((void)0, gSaveContext.save.time) < CLOCK_TIME(19, 0))) { + if ((CURRENT_TIME > CLOCK_TIME(17, 10)) && (CURRENT_TIME < CLOCK_TIME(19, 0))) { play->envCtx.timeSeqState = TIMESEQ_EARLY_NIGHT_CRITTERS; - } else if ((((void)0, gSaveContext.save.time) > CLOCK_TIME(19, 0)) || - (((void)0, gSaveContext.save.time) < CLOCK_TIME(5, 0))) { + } else if ((CURRENT_TIME > CLOCK_TIME(19, 0)) || (CURRENT_TIME < CLOCK_TIME(5, 0))) { play->envCtx.timeSeqState = TIMESEQ_NIGHT_CRITTERS; } else { play->envCtx.timeSeqState = TIMESEQ_MORNING_CRITTERS; @@ -2491,14 +2484,14 @@ void Environment_UpdateTimeBasedSequence(PlayState* play) { break; case TIMESEQ_FADE_DAY_BGM: - if (((void)0, gSaveContext.save.time) > CLOCK_TIME(17, 10)) { + if (CURRENT_TIME > CLOCK_TIME(17, 10)) { SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 240); play->envCtx.timeSeqState++; } break; case TIMESEQ_NIGHT_BEGIN_SFX: - if (((void)0, gSaveContext.save.time) >= CLOCK_TIME(18, 0)) { + if (CURRENT_TIME >= CLOCK_TIME(18, 0)) { play->envCtx.timeSeqState++; } break; @@ -2512,7 +2505,7 @@ void Environment_UpdateTimeBasedSequence(PlayState* play) { break; case TIMESEQ_NIGHT_DELAY: - if (((void)0, gSaveContext.save.time) >= CLOCK_TIME(19, 0)) { + if (CURRENT_TIME >= CLOCK_TIME(19, 0)) { play->envCtx.timeSeqState++; } break; @@ -2524,8 +2517,7 @@ void Environment_UpdateTimeBasedSequence(PlayState* play) { break; case TIMESEQ_DAY_BEGIN_SFX: - if ((((void)0, gSaveContext.save.time) < CLOCK_TIME(19, 0)) && - (((void)0, gSaveContext.save.time) >= CLOCK_TIME(5, 0))) { + if ((CURRENT_TIME < CLOCK_TIME(19, 0)) && (CURRENT_TIME >= CLOCK_TIME(5, 0))) { play->envCtx.timeSeqState++; } break; @@ -2545,9 +2537,9 @@ void Environment_UpdateTimeBasedSequence(PlayState* play) { } if ((play->envCtx.timeSeqState != TIMESEQ_REQUEST) && (((void)0, gSaveContext.save.day) == 3) && - (((void)0, gSaveContext.save.time) < CLOCK_TIME(6, 0)) && !func_800FE5D0(play) && - (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF) && - (play->csCtx.state == 0) && ((play->sceneId != SCENE_00KEIKOKU) || (((void)0, gSaveContext.sceneLayer) != 1)) && + (CURRENT_TIME < CLOCK_TIME(6, 0)) && !func_800FE5D0(play) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && + (play->transitionMode == TRANS_MODE_OFF) && (play->csCtx.state == 0) && + ((play->sceneId != SCENE_00KEIKOKU) || (((void)0, gSaveContext.sceneLayer) != 1)) && (CutsceneManager_GetCurrentCsId() == CS_ID_NONE) && (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_FINAL_HOURS) && (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) != NA_BGM_SONG_OF_SOARING)) { @@ -3061,8 +3053,7 @@ void Environment_PlayStormNatureAmbience(PlayState* play) { (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) == NA_BGM_FINAL_HOURS)) { Audio_PlayAmbience(AMBIENCE_ID_07); } else if ((play->sequenceCtx.seqId != NA_BGM_NO_MUSIC) && (play->sequenceCtx.ambienceId != AMBIENCE_ID_13)) { - if ((((void)0, gSaveContext.save.time) >= CLOCK_TIME(6, 0)) && - (((void)0, gSaveContext.save.time) < CLOCK_TIME(18, 0))) { + if ((CURRENT_TIME >= CLOCK_TIME(6, 0)) && (CURRENT_TIME < CLOCK_TIME(18, 0))) { Audio_PlayAmbience(play->sequenceCtx.ambienceId); } } @@ -3076,8 +3067,7 @@ void Environment_StopStormNatureAmbience(PlayState* play) { (AudioSeq_GetActiveSeqId(SEQ_PLAYER_BGM_MAIN) == NA_BGM_FINAL_HOURS)) { SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_AMBIENCE, 20); } else if ((play->sequenceCtx.seqId != NA_BGM_NO_MUSIC) && (play->sequenceCtx.ambienceId != AMBIENCE_ID_13)) { - if ((((void)0, gSaveContext.save.time) >= CLOCK_TIME(6, 0)) && - (((void)0, gSaveContext.save.time) < CLOCK_TIME(18, 0))) { + if ((CURRENT_TIME >= CLOCK_TIME(6, 0)) && (CURRENT_TIME < CLOCK_TIME(18, 0))) { SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_AMBIENCE, 20); } } @@ -3100,13 +3090,12 @@ void Environment_SetupSkyboxStars(PlayState* play) { f32 phi_f0; if ((play->envCtx.skybox1Index == 0) && (play->skyboxId == SKYBOX_NORMAL_SKY)) { - if ((((void)0, gSaveContext.save.time) >= CLOCK_TIME(21, 0)) || - (((void)0, gSaveContext.save.time) < CLOCK_TIME(2, 0))) { + if ((CURRENT_TIME >= CLOCK_TIME(21, 0)) || (CURRENT_TIME < CLOCK_TIME(2, 0))) { phi_f0 = 1.0f; - } else if (((void)0, gSaveContext.save.time) > CLOCK_TIME(19, 0)) { - phi_f0 = 1.0f - ((CLOCK_TIME(21, 0) - ((void)0, gSaveContext.save.time)) * (1.0f / (CLOCK_TIME(2, 0) + 1))); - } else if (((void)0, gSaveContext.save.time) < CLOCK_TIME(3, 0)) { - phi_f0 = (CLOCK_TIME(3, 0) - ((void)0, gSaveContext.save.time)) * (1.0f / (CLOCK_TIME(1, 0) + 1)); + } else if (CURRENT_TIME > CLOCK_TIME(19, 0)) { + phi_f0 = 1.0f - ((CLOCK_TIME(21, 0) - CURRENT_TIME) * (1.0f / (CLOCK_TIME(2, 0) + 1))); + } else if (CURRENT_TIME < CLOCK_TIME(3, 0)) { + phi_f0 = (CLOCK_TIME(3, 0) - CURRENT_TIME) * (1.0f / (CLOCK_TIME(1, 0) + 1)); } else { phi_f0 = 0.0f; } @@ -3385,7 +3374,7 @@ u32 Environment_GetStormState(PlayState* play) { u8 Environment_IsFinalHours(PlayState* play) { u8 ret = false; - if ((gSaveContext.save.day == 3) && (gSaveContext.save.time < CLOCK_TIME(6, 0))) { + if ((gSaveContext.save.day == 3) && (CURRENT_TIME < CLOCK_TIME(6, 0))) { ret = true; } @@ -3425,8 +3414,8 @@ u8 func_800FE6F8(PlayState* play, s16 timeAdvanceScaling, s16 nextTimeLimit) { u8 ret = false; if (R_TIME_SPEED != 0) { - nextTime = ((void)0, gSaveContext.save.time) + - (R_TIME_SPEED + ((void)0, gSaveContext.save.timeSpeedOffset)) * timeAdvanceScaling * 20; + nextTime = + CURRENT_TIME + (R_TIME_SPEED + ((void)0, gSaveContext.save.timeSpeedOffset)) * timeAdvanceScaling * 20; if (nextTime > nextTimeLimit) { ret = true; } @@ -3518,7 +3507,7 @@ void func_800FEAB0() { void Environment_JumpForwardInTime(void) { if (sTimeJump != 0) { - gSaveContext.save.time = ((void)0, gSaveContext.save.time) + sTimeJump; + gSaveContext.save.time = CURRENT_TIME + sTimeJump; sTimeJump = 0; } } diff --git a/src/code/z_message.c b/src/code/z_message.c index ca02888171..4e541de2e7 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -2316,7 +2316,7 @@ void Message_Decode(PlayState* play) { decodedBufPos--; } else if (curChar == 0x20A) { digits[0] = 0; - timeInSeconds = TIME_TO_MINUTES_F(gSaveContext.save.time); + timeInSeconds = TIME_TO_MINUTES_F(CURRENT_TIME); digits[1] = timeInSeconds / 60.0f; while (digits[1] >= 10) { digits[0]++; @@ -5908,7 +5908,7 @@ void Message_Update(PlayState* play) { case MSGMODE_NEW_CYCLE_0: play->state.unk_A3 = 1; sp44 = gSaveContext.save.cutsceneIndex; - sp3E = gSaveContext.save.time; + sp3E = CURRENT_TIME; sp40 = gSaveContext.save.day; Sram_SaveEndOfCycle(play); diff --git a/src/code/z_message_nes.c b/src/code/z_message_nes.c index ceb921bae2..86a644849d 100644 --- a/src/code/z_message_nes.c +++ b/src/code/z_message_nes.c @@ -1130,14 +1130,14 @@ void Message_DecodeNES(PlayState* play) { decodedBufPos--; } else if (curChar == 0xCA) { digits[0] = 0; - digits[1] = TIME_TO_MINUTES_F(gSaveContext.save.time) / 60.0f; + digits[1] = TIME_TO_MINUTES_F(CURRENT_TIME) / 60.0f; while (digits[1] >= 10) { digits[0]++; digits[1] -= 10; } digits[2] = 0; - digits[3] = (s32)TIME_TO_MINUTES_F(gSaveContext.save.time) % 60; + digits[3] = (s32)TIME_TO_MINUTES_F(CURRENT_TIME) % 60; while (digits[3] >= 10) { digits[2]++; digits[3] -= 10; diff --git a/src/code/z_message_staff.c b/src/code/z_message_staff.c index 392266d81c..1219f3dc7d 100644 --- a/src/code/z_message_staff.c +++ b/src/code/z_message_staff.c @@ -594,7 +594,7 @@ void Message_DecodeCredits(PlayState* play) { } } else if (curChar == 0x1F) { digits[0] = 0; - timeInSeconds = TIME_TO_MINUTES_F(gSaveContext.save.time); + timeInSeconds = TIME_TO_MINUTES_F(CURRENT_TIME); digits[1] = timeInSeconds / 60.0f; while (digits[1] >= 10) { diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 9bf52c4e47..c1098f23ae 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; diff --git a/src/code/z_play.c b/src/code/z_play.c index ca4fb500dc..83a2d25cee 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -2213,7 +2213,7 @@ void Play_Init(GameState* thisx) { gSaveContext.skyboxTime = gSaveContext.nextDayTime; } - if ((gSaveContext.save.time >= CLOCK_TIME(18, 0)) || (gSaveContext.save.time < CLOCK_TIME(6, 30))) { + if ((CURRENT_TIME >= CLOCK_TIME(18, 0)) || (CURRENT_TIME < CLOCK_TIME(6, 30))) { gSaveContext.save.isNight = true; } else { gSaveContext.save.isNight = false; diff --git a/src/code/z_play_hireso.c b/src/code/z_play_hireso.c index e9610039f2..1871bc67f0 100644 --- a/src/code/z_play_hireso.c +++ b/src/code/z_play_hireso.c @@ -698,13 +698,12 @@ void BombersNotebook_DrawTimeOfDay(Gfx** gfxP) { s32 tensDigit; s32 hours; - time = (((void)0, gSaveContext.save.time) - CLOCK_TIME(6, 0)); + time = CURRENT_TIME - CLOCK_TIME(6, 0); if (CURRENT_DAY == 0) { time = 0; } timeOfDayRectLeft = sBombersNotebookDayRectRectLeft[CURRENT_DAY] + (time / CLOCK_TIME(0, 10)); - if ((CURRENT_DAY_CLAMP_MIN_1 == 1) || - ((CURRENT_DAY_CLAMP_MIN_1 == 2) && (((void)0, gSaveContext.save.time) < CLOCK_TIME(12, 0)))) { + if ((CURRENT_DAY_CLAMP_MIN_1 == 1) || ((CURRENT_DAY_CLAMP_MIN_1 == 2) && (CURRENT_TIME < CLOCK_TIME(12, 0)))) { timeOfDayRectLeft -= 32; lineRectLeft = timeOfDayRectLeft + 32; } else if ((CURRENT_DAY_CLAMP_MIN_1 == 2) && (time >= (CLOCK_TIME(17, 0) - CLOCK_TIME(6, 0))) && @@ -772,7 +771,7 @@ void BombersNotebook_DrawTimeOfDay(Gfx** gfxP) { gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, 255); tensDigit = 0; - onesDigit = ((void)0, gSaveContext.save.time) / CLOCK_TIME_HOUR; + onesDigit = CURRENT_TIME / CLOCK_TIME_HOUR; if (CURRENT_DAY == 0) { onesDigit = 6; } @@ -809,7 +808,7 @@ void BombersNotebook_DrawTimeOfDay(Gfx** gfxP) { if (CURRENT_DAY == 0) { onesDigit = TIME_TO_MINUTES_ALT_F((CLOCK_TIME_F(6, 0) - (hours * CLOCK_TIME_HOUR_F))); } else { - onesDigit = TIME_TO_MINUTES_ALT_F(((void)0, gSaveContext.save.time) - (hours * CLOCK_TIME_HOUR_F)); + onesDigit = TIME_TO_MINUTES_ALT_F(CURRENT_TIME - (hours * CLOCK_TIME_HOUR_F)); } do { if (onesDigit >= 10) { diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 1798e55bfa..8f2fe0cf69 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -411,12 +411,12 @@ void Scene_CommandTimeSettings(PlayState* play, SceneCmd* cmd) { R_TIME_SPEED = play->envCtx.sceneTimeSpeed; } - play->envCtx.sunPos.x = -(Math_SinS(((void)0, gSaveContext.save.time) - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f; - play->envCtx.sunPos.y = (Math_CosS(((void)0, gSaveContext.save.time) - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f; - play->envCtx.sunPos.z = (Math_CosS(((void)0, gSaveContext.save.time) - CLOCK_TIME(12, 0)) * 20.0f) * 25.0f; + play->envCtx.sunPos.x = -(Math_SinS(CURRENT_TIME - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f; + play->envCtx.sunPos.y = (Math_CosS(CURRENT_TIME - CLOCK_TIME(12, 0)) * 120.0f) * 25.0f; + play->envCtx.sunPos.z = (Math_CosS(CURRENT_TIME - CLOCK_TIME(12, 0)) * 20.0f) * 25.0f; if ((play->envCtx.sceneTimeSpeed == 0) && (gSaveContext.save.cutsceneIndex < 0xFFF0)) { - gSaveContext.skyboxTime = gSaveContext.save.time; + gSaveContext.skyboxTime = CURRENT_TIME; if ((gSaveContext.skyboxTime >= CLOCK_TIME(4, 0)) && (gSaveContext.skyboxTime < CLOCK_TIME(6, 30))) { gSaveContext.skyboxTime = CLOCK_TIME(5, 0); diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index e4eb1ef9ac..e4a74e04c0 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -1389,7 +1389,7 @@ void func_801457CC(GameState* gameState, SramContext* sramCtx) { u16 maskCount; if (gSaveContext.flashSaveAvailable) { - D_801F6AF0 = gSaveContext.save.time; + D_801F6AF0 = CURRENT_TIME; D_801F6AF2 = gSaveContext.flashSaveAvailable; sp64 = 0; @@ -1482,7 +1482,7 @@ void func_801457CC(GameState* gameState, SramContext* sramCtx) { fileSelect->health[sp76] = gSaveContext.save.saveInfo.playerData.health; fileSelect->defenseHearts[sp76] = gSaveContext.save.saveInfo.inventory.defenseHearts; fileSelect->questItems[sp76] = gSaveContext.save.saveInfo.inventory.questItems; - fileSelect->time[sp76] = gSaveContext.save.time; + fileSelect->time[sp76] = CURRENT_TIME; fileSelect->day[sp76] = gSaveContext.save.day; fileSelect->isOwlSave[sp76] = gSaveContext.save.isOwlSave; fileSelect->rupees[sp76] = gSaveContext.save.saveInfo.playerData.rupees; @@ -1596,7 +1596,7 @@ void func_801457CC(GameState* gameState, SramContext* sramCtx) { fileSelect->health[sp76] = gSaveContext.save.saveInfo.playerData.health; fileSelect->defenseHearts[sp76] = gSaveContext.save.saveInfo.inventory.defenseHearts; fileSelect->questItems[sp76] = gSaveContext.save.saveInfo.inventory.questItems; - fileSelect->time[sp76] = gSaveContext.save.time; + fileSelect->time[sp76] = CURRENT_TIME; fileSelect->day[sp76] = gSaveContext.save.day; fileSelect->isOwlSave[sp76] = gSaveContext.save.isOwlSave; fileSelect->rupees[sp76] = gSaveContext.save.saveInfo.playerData.rupees; @@ -1713,7 +1713,7 @@ void Sram_CopySave(FileSelectState* fileSelect2, SramContext* sramCtx) { fileSelect->defenseHearts[fileSelect->copyDestFileIndex + 2] = gSaveContext.save.saveInfo.inventory.defenseHearts; fileSelect->questItems[fileSelect->copyDestFileIndex + 2] = gSaveContext.save.saveInfo.inventory.questItems; - fileSelect->time[fileSelect->copyDestFileIndex + 2] = gSaveContext.save.time; + fileSelect->time[fileSelect->copyDestFileIndex + 2] = CURRENT_TIME; fileSelect->day[fileSelect->copyDestFileIndex + 2] = gSaveContext.save.day; fileSelect->isOwlSave[fileSelect->copyDestFileIndex + 2] = gSaveContext.save.isOwlSave; fileSelect->rupees[fileSelect->copyDestFileIndex + 2] = gSaveContext.save.saveInfo.playerData.rupees; @@ -1754,7 +1754,7 @@ void Sram_CopySave(FileSelectState* fileSelect2, SramContext* sramCtx) { fileSelect->health[fileSelect->copyDestFileIndex] = gSaveContext.save.saveInfo.playerData.health; fileSelect->defenseHearts[fileSelect->copyDestFileIndex] = gSaveContext.save.saveInfo.inventory.defenseHearts; fileSelect->questItems[fileSelect->copyDestFileIndex] = gSaveContext.save.saveInfo.inventory.questItems; - fileSelect->time[fileSelect->copyDestFileIndex] = gSaveContext.save.time; + fileSelect->time[fileSelect->copyDestFileIndex] = CURRENT_TIME; fileSelect->day[fileSelect->copyDestFileIndex] = gSaveContext.save.day; fileSelect->isOwlSave[fileSelect->copyDestFileIndex] = gSaveContext.save.isOwlSave; fileSelect->rupees[fileSelect->copyDestFileIndex] = gSaveContext.save.saveInfo.playerData.rupees; @@ -1818,7 +1818,7 @@ void Sram_InitSave(FileSelectState* fileSelect2, SramContext* sramCtx) { fileSelect->health[fileSelect->buttonIndex] = gSaveContext.save.saveInfo.playerData.health; fileSelect->defenseHearts[fileSelect->buttonIndex] = gSaveContext.save.saveInfo.inventory.defenseHearts; fileSelect->questItems[fileSelect->buttonIndex] = gSaveContext.save.saveInfo.inventory.questItems; - fileSelect->time[fileSelect->buttonIndex] = gSaveContext.save.time; + fileSelect->time[fileSelect->buttonIndex] = CURRENT_TIME; fileSelect->day[fileSelect->buttonIndex] = gSaveContext.save.day; fileSelect->isOwlSave[fileSelect->buttonIndex] = gSaveContext.save.isOwlSave; fileSelect->rupees[fileSelect->buttonIndex] = gSaveContext.save.saveInfo.playerData.rupees; @@ -1890,7 +1890,7 @@ void Sram_SaveSpecialEnterClockTown(PlayState* play) { void Sram_SaveSpecialNewDay(PlayState* play) { s32 cutsceneIndex = gSaveContext.save.cutsceneIndex; s32 day; - u16 time = gSaveContext.save.time; + u16 time = CURRENT_TIME; day = gSaveContext.save.day; diff --git a/src/code/z_sub_s.c b/src/code/z_sub_s.c index f5a233ede6..9e19c1dadd 100644 --- a/src/code/z_sub_s.c +++ b/src/code/z_sub_s.c @@ -588,9 +588,9 @@ s32 SubS_HasReachedPoint(Actor* actor, Path* path, s32 pointIndex) { Path* SubS_GetDayDependentPath(PlayState* play, u8 pathIndex, u8 pathIndexNone, s32* startPointIndex) { Path* path = NULL; s32 found = false; - s32 time = (((s16)TIME_TO_MINUTES_F(gSaveContext.save.time) % 60) + - ((s16)TIME_TO_MINUTES_F(gSaveContext.save.time) / 60) * 60) / - 30; + s16 time1 = TIME_TO_MINUTES_F(CURRENT_TIME); + s16 time2 = TIME_TO_MINUTES_F(CURRENT_TIME); + s32 time = ((time1 % 60) + (time2 / 60) * 60) / 30; s32 day = CURRENT_DAY; if (pathIndex == pathIndexNone) { diff --git a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c index b82856253e..d8a0fd6127 100644 --- a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c +++ b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c @@ -162,7 +162,7 @@ void func_80BD7ED8(BgIknvObj* this, PlayState* play) { } void func_80BD7F4C(BgIknvObj* this, PlayState* play) { - if (gSaveContext.save.time > CLOCK_TIME(19, 30)) { + if (CURRENT_TIME > CLOCK_TIME(19, 30)) { this->actionFunc = func_80BD7ED8; } if ((this->dyna.actor.home.rot.x == 1) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_58_80)) { diff --git a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c index 17ba205370..c820d5c624 100644 --- a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c +++ b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c @@ -160,8 +160,7 @@ void BgUmajump_Update(Actor* thisx, PlayState* play) { } else if ((this->dyna.actor.params == BG_UMAJUMP_TYPE_6) && (this->dyna.bgId == BGACTOR_NEG_ONE) && (!CHECK_WEEKEVENTREG(WEEKEVENTREG_DEFENDED_AGAINST_THEM) || ((gSaveContext.save.day == 2) && (gSaveContext.save.isNight == true) && - ((gSaveContext.save.time >= CLOCK_TIME(5, 30)) && - (gSaveContext.save.time <= CLOCK_TIME(6, 0)))))) { + ((CURRENT_TIME >= CLOCK_TIME(5, 30)) && (CURRENT_TIME <= CLOCK_TIME(6, 0)))))) { DynaPolyActor_LoadMesh(play, &this->dyna, &object_umajump_Colheader_001558); } DynaPoly_DisableFloorCollision(play, &play->colCtx.dyna, this->dyna.bgId); @@ -199,11 +198,11 @@ void func_8091A5A0(Actor* thisx, PlayState* play) { if ((this->dyna.bgId == BGACTOR_NEG_ONE) && (!CHECK_WEEKEVENTREG(WEEKEVENTREG_DEFENDED_AGAINST_THEM) || ((gSaveContext.save.day == 2) && (gSaveContext.save.isNight == true) && - (gSaveContext.save.time >= CLOCK_TIME(5, 30)) && (gSaveContext.save.time <= CLOCK_TIME(6, 0))))) { + (CURRENT_TIME >= CLOCK_TIME(5, 30)) && (CURRENT_TIME <= CLOCK_TIME(6, 0))))) { DynaPolyActor_LoadMesh(play, &this->dyna, &object_umajump_Colheader_001558); } else if ((this->dyna.bgId != BGACTOR_NEG_ONE) && CHECK_WEEKEVENTREG(WEEKEVENTREG_DEFENDED_AGAINST_THEM) && ((gSaveContext.save.day != 2) || (gSaveContext.save.isNight != true) || - (gSaveContext.save.time < CLOCK_TIME(5, 30)) || (gSaveContext.save.time > CLOCK_TIME(6, 0)))) { + (CURRENT_TIME < CLOCK_TIME(5, 30)) || (CURRENT_TIME > CLOCK_TIME(6, 0)))) { DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } diff --git a/src/overlays/actors/ovl_Boss_06/z_boss_06.c b/src/overlays/actors/ovl_Boss_06/z_boss_06.c index a06fe25d10..4defc37415 100644 --- a/src/overlays/actors/ovl_Boss_06/z_boss_06.c +++ b/src/overlays/actors/ovl_Boss_06/z_boss_06.c @@ -514,7 +514,7 @@ void Boss06_Draw(Actor* thisx, PlayState* play2) { Gfx_SetupDL25_Xlu(play->state.gfxCtx); Gfx_SetupDL25_Opa(play->state.gfxCtx); - temp_v0 = gSaveContext.save.time; + temp_v0 = CURRENT_TIME; if (temp_v0 > CLOCK_TIME(12, 0)) { temp_v0 = (DAY_LENGTH - 1) - temp_v0; } diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c index 46fb96daee..2e0c125a93 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c @@ -1222,7 +1222,7 @@ void DmStk_StartTelescopeCutscene(DmStk* this, PlayState* play) { if (gSaveContext.save.day < 3) { csId = dayOneAndTwoCsId; } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLOCK_TOWER_OPENED) || - ((CURRENT_DAY == 3) && (gSaveContext.save.time < CLOCK_TIME(6, 0)))) { + ((CURRENT_DAY == 3) && (CURRENT_TIME < CLOCK_TIME(6, 0)))) { csId = finalHoursCsId; } else { csId = dayThreeCsId; @@ -1871,10 +1871,9 @@ void DmStk_Update(Actor* thisx, PlayState* play) { (play->msgCtx.currentTextId == 0x5E6) && !FrameAdvance_IsEnabled(&play->state) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (CutsceneManager_GetCurrentCsId() == CS_ID_NONE) && (play->csCtx.state == CS_STATE_IDLE)) { - gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)R_TIME_SPEED; + gSaveContext.save.time = CURRENT_TIME + (u16)R_TIME_SPEED; if (R_TIME_SPEED != 0) { - gSaveContext.save.time = - ((void)0, gSaveContext.save.time) + (u16)((void)0, gSaveContext.save.timeSpeedOffset); + gSaveContext.save.time = CURRENT_TIME + (u16)((void)0, gSaveContext.save.timeSpeedOffset); } } } diff --git a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c index 587667d619..a003b099c8 100644 --- a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c +++ b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c @@ -124,8 +124,8 @@ void EnAob01_Blink(EnAob01* this, s32 maxEyeIndex) { * Called every frame during the race in order to make in-game time pass. */ void EnAob01_AdvanceTime(void) { - gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)R_TIME_SPEED; - gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)((void)0, gSaveContext.save.timeSpeedOffset); + gSaveContext.save.time = CURRENT_TIME + (u16)R_TIME_SPEED; + gSaveContext.save.time = CURRENT_TIME + (u16)((void)0, gSaveContext.save.timeSpeedOffset); } /** diff --git a/src/overlays/actors/ovl_En_Baba/z_en_baba.c b/src/overlays/actors/ovl_En_Baba/z_en_baba.c index cd2dead65f..1b28887d2e 100644 --- a/src/overlays/actors/ovl_En_Baba/z_en_baba.c +++ b/src/overlays/actors/ovl_En_Baba/z_en_baba.c @@ -525,7 +525,7 @@ void EnBaba_FinishInit(EnBaba* this, PlayState* play) { (gSaveContext.save.entrance != ENTRANCE(NORTH_CLOCK_TOWN, 7)) && (BOMB_SHOP_LADY_GET_PATH_INDEX(&this->actor) != BOMB_SHOP_LADY_PATH_INDEX_NONE)) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_58_40) || - (gSaveContext.save.time >= CLOCK_TIME(0, 20) && (gSaveContext.save.time < CLOCK_TIME(6, 0)))) { + ((CURRENT_TIME >= CLOCK_TIME(0, 20)) && (CURRENT_TIME < CLOCK_TIME(6, 0)))) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index c0b889c202..b11b8f5f28 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -1421,7 +1421,7 @@ void func_8088FE64(Actor* thisx, PlayState* play2) { case 3: if (!gSaveContext.save.isNight) { Message_ContinueTextbox(play, 0x248); - } else if ((gSaveContext.save.time < CLOCK_TIME(6, 0)) && + } else if ((CURRENT_TIME < CLOCK_TIME(6, 0)) && CHECK_WEEKEVENTREG(WEEKEVENTREG_74_20)) { Message_ContinueTextbox(play, 0x225); } else { diff --git a/src/overlays/actors/ovl_En_Fall/z_en_fall.c b/src/overlays/actors/ovl_En_Fall/z_en_fall.c index 581fe6408a..18cb402504 100644 --- a/src/overlays/actors/ovl_En_Fall/z_en_fall.c +++ b/src/overlays/actors/ovl_En_Fall/z_en_fall.c @@ -80,7 +80,7 @@ ActorInit En_Fall_InitVars = { * it also moves the moon closer to the ground depending on the current time. */ void EnFall_Moon_AdjustScaleAndPosition(EnFall* this, PlayState* play) { - u16 currentTime = gSaveContext.save.time; + u16 currentTime = CURRENT_TIME; u16 dayStartTime = this->dayStartTime; f32 finalDayRelativeHeight; @@ -504,7 +504,7 @@ void EnFall_Moon_PerformDefaultActions(EnFall* this, PlayState* play) { currentDay = CURRENT_DAY; if ((u16)this->currentDay != (u32)currentDay) { this->currentDay = currentDay; - this->dayStartTime = gSaveContext.save.time; + this->dayStartTime = CURRENT_TIME; } EnFall_Moon_AdjustScaleAndPosition(this, play); } diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index 8f8264360b..69720cdc88 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -3061,11 +3061,11 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { } if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { - if ((gSaveContext.save.time >= CLOCK_TIME(18, 0)) && (gSaveContext.save.time <= 0xC01B)) { + if ((CURRENT_TIME >= CLOCK_TIME(18, 0)) && (CURRENT_TIME <= (CLOCK_TIME(18, 1) - 0x12))) { this->unk_150 = 7; this->unk_172[3] = Rand_ZeroFloat(150.0f) + 200.0f; } - if ((gSaveContext.save.time >= CLOCK_TIME(5, 30)) && (gSaveContext.save.time <= 0x3AC5)) { + if ((CURRENT_TIME >= CLOCK_TIME(5, 30)) && (CURRENT_TIME <= (CLOCK_TIME(5, 31) - 0x13))) { this->unk_150 = 7; this->unk_172[3] = Rand_ZeroFloat(150.0f) + 200.0f; } @@ -3308,9 +3308,9 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { multiplier = 1.0f; } - if ((gSaveContext.save.time >= 0xB555) && (gSaveContext.save.time <= 0xCAAA)) { + if ((CURRENT_TIME >= CLOCK_TIME(17, 0)) && (CURRENT_TIME <= CLOCK_TIME(19, 0))) { multiplier *= 1.75f; - } else if ((gSaveContext.save.time >= 0x3555) && (gSaveContext.save.time <= 0x4AAA)) { + } else if ((CURRENT_TIME >= CLOCK_TIME(5, 0)) && (CURRENT_TIME <= CLOCK_TIME(7, 0))) { multiplier *= 1.5f; } else if (D_809171CA != 0) { multiplier *= 1.5f; diff --git a/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c b/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c index 1b5890e8e1..cf302d7528 100644 --- a/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c +++ b/src/overlays/actors/ovl_En_Gakufu/z_en_gakufu.c @@ -210,7 +210,7 @@ void EnGakufu_GiveReward(EnGakufu* this, PlayState* play) { Audio_PlaySfx(NA_SE_SY_CORRECT_CHIME); - hour = TIME_TO_HOURS_F(gSaveContext.save.time); + hour = TIME_TO_HOURS_F(CURRENT_TIME); for (i = 0; i < 3; i++) { Item_DropCollectible(play, &sRewardDropsSpawnTerminaFieldPos, sRewardDrops[i + sRewardDropsIndex[hour]]); } diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 0efe07c87b..3d31dc9452 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -222,7 +222,7 @@ s32 func_808F3334(EnIn* this, PlayState* play) { s32 func_808F33B8(void) { s32 ret = (((gSaveContext.save.day == 1) && - ((gSaveContext.save.time >= CLOCK_TIME(5, 30)) && (gSaveContext.save.time <= CLOCK_TIME(6, 0)))) || + ((CURRENT_TIME >= CLOCK_TIME(5, 30)) && (CURRENT_TIME <= CLOCK_TIME(6, 0)))) || (gSaveContext.save.day >= 2)) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_DEFENDED_AGAINST_THEM); diff --git a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c index b78c5b07b3..72a3e174d0 100644 --- a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c +++ b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c @@ -176,8 +176,8 @@ void func_80C13BB8(EnJgameTsn* this, PlayState* play) { Message_StartTextbox(play, 0x10A3, &this->actor); this->unk_300 = 0x10A3; } - } else if (((gSaveContext.save.time > CLOCK_TIME(4, 0)) && (gSaveContext.save.time < CLOCK_TIME(7, 0))) || - ((gSaveContext.save.time > CLOCK_TIME(16, 0)) && (gSaveContext.save.time < CLOCK_TIME(19, 0)))) { + } else if (((CURRENT_TIME > CLOCK_TIME(4, 0)) && (CURRENT_TIME < CLOCK_TIME(7, 0))) || + ((CURRENT_TIME > CLOCK_TIME(16, 0)) && (CURRENT_TIME < CLOCK_TIME(19, 0)))) { Message_StartTextbox(play, 0x1094, &this->actor); this->unk_300 = 0x1094; } else if (this->unk_2F8 == 0) { @@ -217,8 +217,8 @@ void func_80C13E6C(EnJgameTsn* this) { void func_80C13E90(EnJgameTsn* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->actor, &play->state)) { this->actor.flags &= ~ACTOR_FLAG_10000; - if (((gSaveContext.save.time > CLOCK_TIME(4, 0)) && (gSaveContext.save.time < CLOCK_TIME(7, 0))) || - ((gSaveContext.save.time > CLOCK_TIME(16, 0)) && (gSaveContext.save.time < CLOCK_TIME(19, 0)))) { + if (((CURRENT_TIME > CLOCK_TIME(4, 0)) && (CURRENT_TIME < CLOCK_TIME(7, 0))) || + ((CURRENT_TIME > CLOCK_TIME(16, 0)) && (CURRENT_TIME < CLOCK_TIME(19, 0)))) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENJGAMETSN_ANIM_2); Message_StartTextbox(play, 0x1094, &this->actor); this->unk_300 = 0x1094; diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index d2104d153d..893ddc9ca1 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -315,8 +315,7 @@ void EnKakasi_TimeSkipDialogue(EnKakasi* this, PlayState* play) { Player* player = GET_PLAYER(play); if ((gSaveContext.respawnFlag != -4) && (gSaveContext.respawnFlag != -8)) { - if ((gSaveContext.save.time != CLOCK_TIME(6, 0)) && (gSaveContext.save.time != CLOCK_TIME(18, 0)) && - !CHECK_EVENTINF(EVENTINF_17)) { + if ((CURRENT_TIME != CLOCK_TIME(6, 0)) && (CURRENT_TIME != CLOCK_TIME(18, 0)) && !CHECK_EVENTINF(EVENTINF_17)) { if (this->picto.actor.textId == 0) { // dialogue after skipped time 'did you feel that? went by in an instant' @@ -954,7 +953,7 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { PLAYER_PARAMS(0xFF, PLAYER_INITMODE_B), &player->unk_3C0, player->unk_3CC); func_80169EFC(&play->state); - if ((gSaveContext.save.time > CLOCK_TIME(18, 0)) || (gSaveContext.save.time < CLOCK_TIME(6, 0))) { + if ((CURRENT_TIME > CLOCK_TIME(18, 0)) || (CURRENT_TIME < CLOCK_TIME(6, 0))) { gSaveContext.save.time = CLOCK_TIME(6, 0); gSaveContext.respawnFlag = -4; SET_EVENTINF(EVENTINF_TRIGGER_DAYTELOP); diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c index 65a5e77c82..d73c3727b1 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -998,7 +998,7 @@ void EnKanban_Draw(Actor* thisx, PlayState* play) { if ((this->actor.projectedPos.z <= 400.0f) && (this->actor.projectedPos.z > 0.0f) && (this->actor.floorHeight > -3000.0f) && ((this->bounceX != 0) || (this->bounceZ != 0))) { - u16 dayTime = gSaveContext.save.time; + u16 dayTime = CURRENT_TIME; f32 shadowAlpha; if (dayTime >= CLOCK_TIME(12, 0)) { diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c index 7ffe3e8388..c6ec9bd2d2 100644 --- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c +++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c @@ -120,8 +120,7 @@ void EnKendoJs_Init(Actor* thisx, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &object_js_Skel_006990, &object_js_Anim_000F4C, this->jointTable, this->morphTable, OBJECT_JS_LIMB_MAX); - if ((CURRENT_DAY == 3) && - !((gSaveContext.save.time <= CLOCK_TIME(23, 0)) && (gSaveContext.save.time >= CLOCK_TIME(6, 0)))) { + if ((CURRENT_DAY == 3) && ((CURRENT_TIME > CLOCK_TIME(23, 0)) || (CURRENT_TIME < CLOCK_TIME(6, 0)))) { if (ENKENDOJS_GET_FF(&this->actor) != ENKENDOJS_FF_1) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_KANBAN, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z - 10.0f, this->actor.home.rot.x, this->actor.home.rot.y, diff --git a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c index 105c5215f7..154a10b86f 100644 --- a/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c +++ b/src/overlays/actors/ovl_En_Kujiya/z_en_kujiya.c @@ -65,8 +65,7 @@ void EnKujiya_Init(Actor* thisx, PlayState* play) { this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 30.0f; - if (EnKujiya_CheckBoughtTicket() && (gSaveContext.save.time >= CLOCK_TIME(6, 0)) && - (gSaveContext.save.time < CLOCK_TIME(18, 0))) { + if (EnKujiya_CheckBoughtTicket() && (CURRENT_TIME >= CLOCK_TIME(6, 0)) && (CURRENT_TIME < CLOCK_TIME(18, 0))) { this->actor.shape.rot.y = 0; } else { this->actor.shape.rot.y = 0x7555; @@ -83,7 +82,7 @@ void EnKujiya_SetupWait(EnKujiya* this) { void EnKujiya_Wait(EnKujiya* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->actor, &play->state)) { - 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))) { if (EnKujiya_CheckBoughtTicket()) { Message_StartTextbox(play, 0x2B61, &this->actor); this->textId = 0x2B61; // Come back tomorrow @@ -100,8 +99,7 @@ void EnKujiya_Wait(EnKujiya* this, PlayState* play) { } EnKujiya_SetupTalk(this); - } else if ((gSaveContext.save.time >= CLOCK_TIME(18, 0)) && EnKujiya_CheckBoughtTicket() && - (this->actor.shape.rot.y == 0)) { + } else if ((CURRENT_TIME >= CLOCK_TIME(18, 0)) && EnKujiya_CheckBoughtTicket() && (this->actor.shape.rot.y == 0)) { EnKujiya_SetupTurnToOpen(this); } else if (this->actor.xzDistToPlayer < 100.0f) { Actor_OfferTalk(&this->actor, play, 100.0f); diff --git a/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c b/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c index dcbc2f0bac..cafbc9a9d7 100644 --- a/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c +++ b/src/overlays/actors/ovl_En_Lift_Nuts/z_en_lift_nuts.c @@ -388,8 +388,7 @@ void EnLiftNuts_Idle(EnLiftNuts* this, PlayState* play) { if (EnLiftNuts_MinigameState(ENLIFTNUTS_MINIGAME_STATE_MODE_CHECK, ENLIFTNUTS_MINIGAME_STATE_NONE)) { switch (CURRENT_DAY) { case 1: - if ((gSaveContext.save.time > CLOCK_TIME(23, 30)) || - (gSaveContext.save.time <= CLOCK_TIME(6, 0))) { + if ((CURRENT_TIME > CLOCK_TIME(23, 30)) || (CURRENT_TIME <= CLOCK_TIME(6, 0))) { Message_StartTextbox(play, 0x27F7, &this->actor); this->textId = 0x27F7; } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_WON_DEKU_PLAYGROUND_DAY_1)) { @@ -402,8 +401,7 @@ void EnLiftNuts_Idle(EnLiftNuts* this, PlayState* play) { break; case 2: - if ((gSaveContext.save.time > CLOCK_TIME(23, 30)) || - (gSaveContext.save.time <= CLOCK_TIME(6, 0))) { + if ((CURRENT_TIME > CLOCK_TIME(23, 30)) || (CURRENT_TIME <= CLOCK_TIME(6, 0))) { Message_StartTextbox(play, 0x27F7, &this->actor); this->textId = 0x27F7; } else { @@ -424,8 +422,7 @@ void EnLiftNuts_Idle(EnLiftNuts* this, PlayState* play) { break; case 3: - if ((gSaveContext.save.time > CLOCK_TIME(23, 30)) || - (gSaveContext.save.time <= CLOCK_TIME(6, 0))) { + if ((CURRENT_TIME > CLOCK_TIME(23, 30)) || (CURRENT_TIME <= CLOCK_TIME(6, 0))) { Message_StartTextbox(play, 0x27F7, &this->actor); this->textId = 0x27F7; } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_WON_DEKU_PLAYGROUND_DAY_3)) { diff --git a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c index 2601b54b30..67f91dfb34 100644 --- a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c +++ b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c @@ -234,7 +234,7 @@ s32 EnMaYto_CheckValidSpawn(EnMaYto* this, PlayState* play) { } else if (((this->actor.params & 0x0F00) >> 8) == 0) { return false; } - if ((gSaveContext.save.time >= CLOCK_TIME(20, 0)) && (CURRENT_DAY == 3)) { + if ((CURRENT_TIME >= CLOCK_TIME(20, 0)) && (CURRENT_DAY == 3)) { return false; } break; diff --git a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c index 0fc0dfcc43..a5bea89368 100644 --- a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c +++ b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c @@ -225,7 +225,7 @@ s32 EnMaYts_CheckValidSpawn(EnMaYts* this, PlayState* play) { // Failing the alien invasion if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_DEFENDED_AGAINST_THEM)) { return false; - } else if ((gSaveContext.save.time >= CLOCK_TIME(20, 0)) && (CURRENT_DAY == 3)) { + } else if ((CURRENT_TIME >= CLOCK_TIME(20, 0)) && (CURRENT_DAY == 3)) { return false; } break; diff --git a/src/overlays/actors/ovl_En_Osn/z_en_osn.c b/src/overlays/actors/ovl_En_Osn/z_en_osn.c index 6085c92402..93d94290d6 100644 --- a/src/overlays/actors/ovl_En_Osn/z_en_osn.c +++ b/src/overlays/actors/ovl_En_Osn/z_en_osn.c @@ -434,8 +434,7 @@ s32 EnOsn_GetInitialMaskText(EnOsn* this, PlayState* play) { break; } this->stateFlags |= OSN_STATE_END_CONVERSATION; - if ((gSaveContext.save.day == 3) && (gSaveContext.save.time >= CLOCK_TIME(5, 0)) && - (gSaveContext.save.time < CLOCK_TIME(6, 0))) { + if ((gSaveContext.save.day == 3) && (CURRENT_TIME >= CLOCK_TIME(5, 0)) && (CURRENT_TIME < CLOCK_TIME(6, 0))) { return 0x2006; } return 0x1FCD; @@ -450,8 +449,8 @@ s32 EnOsn_GetInitialText(EnOsn* this, PlayState* play) { this->stateFlags |= OSN_STATE_END_CONVERSATION; if ((gSaveContext.save.saveInfo.inventory.items[SLOT_OCARINA] != ITEM_NONE) && (INV_CONTENT(ITEM_MASK_DEKU) == ITEM_MASK_DEKU)) { - if ((gSaveContext.save.day == 3) && (gSaveContext.save.time >= CLOCK_TIME(5, 0)) && - (gSaveContext.save.time < CLOCK_TIME(6, 0))) { + if ((gSaveContext.save.day == 3) && (CURRENT_TIME >= CLOCK_TIME(5, 0)) && + (CURRENT_TIME < CLOCK_TIME(6, 0))) { return 0x2006; } return 0x1FCD; @@ -462,8 +461,8 @@ s32 EnOsn_GetInitialText(EnOsn* this, PlayState* play) { if (player->transformation == PLAYER_FORM_DEKU) { if (this->stateFlags & OSN_STATE_MET_DEKU) { this->stateFlags |= OSN_STATE_END_CONVERSATION; - if ((gSaveContext.save.day == 3) && (gSaveContext.save.time >= CLOCK_TIME(5, 0)) && - (gSaveContext.save.time < CLOCK_TIME(6, 0))) { + if ((gSaveContext.save.day == 3) && (CURRENT_TIME >= CLOCK_TIME(5, 0)) && + (CURRENT_TIME < CLOCK_TIME(6, 0))) { return 0x2006; } return 0x1FCD; @@ -475,8 +474,8 @@ s32 EnOsn_GetInitialText(EnOsn* this, PlayState* play) { if (player->transformation == PLAYER_FORM_GORON) { if (this->stateFlags & OSN_STATE_MET_GORON) { this->stateFlags |= OSN_STATE_END_CONVERSATION; - if ((gSaveContext.save.day == 3) && (gSaveContext.save.time >= CLOCK_TIME(5, 0)) && - (gSaveContext.save.time < CLOCK_TIME(6, 0))) { + if ((gSaveContext.save.day == 3) && (CURRENT_TIME >= CLOCK_TIME(5, 0)) && + (CURRENT_TIME < CLOCK_TIME(6, 0))) { return 0x2006; } else { return 0x1FCD; @@ -494,8 +493,8 @@ s32 EnOsn_GetInitialText(EnOsn* this, PlayState* play) { if (player->transformation == PLAYER_FORM_ZORA) { if (this->stateFlags & OSN_STATE_MET_ZORA) { this->stateFlags |= OSN_STATE_END_CONVERSATION; - if ((gSaveContext.save.day == 3) && (gSaveContext.save.time >= CLOCK_TIME(5, 0)) && - (gSaveContext.save.time < CLOCK_TIME(6, 0))) { + if ((gSaveContext.save.day == 3) && (CURRENT_TIME >= CLOCK_TIME(5, 0)) && + (CURRENT_TIME < CLOCK_TIME(6, 0))) { return 0x2006; } return 0x1FCD; @@ -512,8 +511,8 @@ s32 EnOsn_GetInitialText(EnOsn* this, PlayState* play) { if (Player_GetMask(play) == PLAYER_MASK_NONE) { if (this->stateFlags & OSN_STATE_MET_HUMAN) { this->stateFlags |= OSN_STATE_END_CONVERSATION; - if ((gSaveContext.save.day == 3) && (gSaveContext.save.time >= CLOCK_TIME(5, 0)) && - (gSaveContext.save.time < CLOCK_TIME(6, 0))) { + if ((gSaveContext.save.day == 3) && (CURRENT_TIME >= CLOCK_TIME(5, 0)) && + (CURRENT_TIME < CLOCK_TIME(6, 0))) { return 0x2006; } return 0x1FCD; @@ -526,8 +525,7 @@ s32 EnOsn_GetInitialText(EnOsn* this, PlayState* play) { } this->stateFlags |= OSN_STATE_END_CONVERSATION; - if ((gSaveContext.save.day == 3) && (gSaveContext.save.time >= CLOCK_TIME(5, 0)) && - (gSaveContext.save.time < CLOCK_TIME(6, 0))) { + if ((gSaveContext.save.day == 3) && (CURRENT_TIME >= CLOCK_TIME(5, 0)) && (CURRENT_TIME < CLOCK_TIME(6, 0))) { return 0x2004; } @@ -545,8 +543,8 @@ void EnOsn_HandleConversation(EnOsn* this, PlayState* play) { break; case 0x1FCA: - if ((gSaveContext.save.day == 3) && (gSaveContext.save.time >= CLOCK_TIME(5, 0)) && - (gSaveContext.save.time < CLOCK_TIME(6, 0))) { + if ((gSaveContext.save.day == 3) && (CURRENT_TIME >= CLOCK_TIME(5, 0)) && + (CURRENT_TIME < CLOCK_TIME(6, 0))) { this->textId = 0x2007; } else { this->textId = 0x1FCB; diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index a748bc2de8..2ae1df1a4c 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -210,7 +210,7 @@ void EnOssan_CheckValidSpawn(EnOssan* this) { switch (gSaveContext.save.day) { case 1: case 2: - if ((gSaveContext.save.time <= CLOCK_TIME(21, 30)) && (gSaveContext.save.time > CLOCK_TIME(6, 00))) { + if ((CURRENT_TIME <= CLOCK_TIME(21, 30)) && (CURRENT_TIME > CLOCK_TIME(6, 0))) { if (this->actor.params != ENOSSAN_CURIOSITY_SHOP_MAN) { Actor_Kill(&this->actor); } @@ -223,7 +223,7 @@ void EnOssan_CheckValidSpawn(EnOssan* this) { if (this->actor.params == ENOSSAN_CURIOSITY_SHOP_MAN) { Actor_Kill(&this->actor); } - if ((gSaveContext.save.time > CLOCK_TIME(22, 00)) || (gSaveContext.save.time < CLOCK_TIME(6, 00))) { + if ((CURRENT_TIME > CLOCK_TIME(22, 0)) || (CURRENT_TIME < CLOCK_TIME(6, 0))) { if (this->actor.params != ENOSSAN_CURIOSITY_SHOP_MAN) { Actor_Kill(&this->actor); } diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.c b/src/overlays/actors/ovl_En_Pm/z_en_pm.c index 41b80de287..e653738d80 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c @@ -567,14 +567,14 @@ s32 func_80AF7BAC(EnPm* this) { switch (this->unk_38C) { case 0: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_86_01)) { - D_801F4E78 = gSaveContext.save.time; + D_801F4E78 = CURRENT_TIME; this->unk_38C++; } break; case 1: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_89_08)) { - D_801F4E78 = gSaveContext.save.time; + D_801F4E78 = CURRENT_TIME; this->unk_38C++; } break; @@ -588,7 +588,7 @@ s32 func_80AF7BAC(EnPm* this) { case 3: if (CHECK_WEEKEVENTREG(WEEKEVENTREG_90_01)) { - D_801F4E78 = gSaveContext.save.time; + D_801F4E78 = CURRENT_TIME; this->unk_38C++; } break; @@ -1800,7 +1800,7 @@ s32 func_80AFA170(EnPm* this, PlayState* play) { switch (this->unk_258) { case 28: - if (gSaveContext.save.time >= CLOCK_TIME(1, 39)) { + if (CURRENT_TIME >= CLOCK_TIME(1, 39)) { SET_WEEKEVENTREG(WEEKEVENTREG_89_08); } @@ -1990,14 +1990,14 @@ void func_80AFA4D0(EnPm* this, PlayState* play) { static u8* D_80AFB900[] = { D_80AFAD80, D_80AFB30C, D_80AFB3C0, D_80AFB3FC, D_80AFB41C, }; - u16 time = gSaveContext.save.time; + u16 time = CURRENT_TIME; u16 sp3C = 0; ScheduleOutput sp2C; this->timePathTimeSpeed = R_TIME_SPEED + ((void)0, gSaveContext.save.timeSpeedOffset); if (this->unk_38C != 0) { - time = gSaveContext.save.time - D_801F4E78; - sp3C = gSaveContext.save.time; + time = CURRENT_TIME - D_801F4E78; + sp3C = CURRENT_TIME; gSaveContext.save.time = time; } diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c index aa3620cf0b..7d0cfdc4b9 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c @@ -256,7 +256,7 @@ void EnRailgibud_Init(Actor* thisx, PlayState* play) { EnRailgibud_SpawnOtherGibdosAndSetPositionAndRotation(this, play); this->playerStunWaitTimer = 0; - this->timeInitialized = gSaveContext.save.time; + this->timeInitialized = CURRENT_TIME; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->type = EN_RAILGIBUD_TYPE_GIBDO; this->textId = 0; diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c index 37b35086d0..fcc00d039b 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -188,7 +188,7 @@ u16 EnSob1_GetTalkOption(EnSob1* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->shopType == BOMB_SHOP) { - if ((gSaveContext.save.day == 1) && (gSaveContext.save.time >= CLOCK_TIME(6, 0))) { + if ((gSaveContext.save.day == 1) && (CURRENT_TIME >= CLOCK_TIME(6, 0))) { return 0x648; } else if (CHECK_WEEKEVENTREG(WEEKEVENTREG_RECOVERED_STOLEN_BOMB_BAG)) { return 0x649; diff --git a/src/overlays/actors/ovl_En_Sth/z_en_sth.c b/src/overlays/actors/ovl_En_Sth/z_en_sth.c index 57d9b96d83..40d9269d2c 100644 --- a/src/overlays/actors/ovl_En_Sth/z_en_sth.c +++ b/src/overlays/actors/ovl_En_Sth/z_en_sth.c @@ -454,7 +454,7 @@ void EnSth_MoonLookingIdle(EnSth* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->actor, &play->state)) { this->actionFunc = EnSth_HandleMoonLookingConversation; } else if (EnSth_CanSpeakToPlayer(this, play) || this->actor.isLockedOn) { - 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))) { this->actor.textId = 0x1130; // Huh? The Moon... } else { this->actor.textId = 0x1131; // (The Moon) gotten bigger again diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c index 14d3db8d21..b2770d93aa 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -231,8 +231,8 @@ void EnSuttari_TriggerTransition(PlayState* play, u16 entrance) { } void EnSuttari_AdvanceTime(void) { - gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)R_TIME_SPEED; - gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)((void)0, gSaveContext.save.timeSpeedOffset); + gSaveContext.save.time = CURRENT_TIME + (u16)R_TIME_SPEED; + gSaveContext.save.time = CURRENT_TIME + (u16)((void)0, gSaveContext.save.timeSpeedOffset); } s32 func_80BAA904(EnSuttari* this, PlayState* play) { @@ -1002,7 +1002,7 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { this->flags1 |= 0x80; this->actionFunc = func_80BACA14; return; - } else if ((gSaveContext.save.day == 3) && (gSaveContext.save.time <= CLOCK_TIME(19, 0)) && + } else if ((gSaveContext.save.day == 3) && (CURRENT_TIME <= CLOCK_TIME(19, 0)) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_61_08) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_RECOVERED_STOLEN_BOMB_BAG) && CHECK_WEEKEVENTREG(WEEKEVENTREG_51_08)) { @@ -1012,7 +1012,7 @@ void func_80BAC6E8(EnSuttari* this, PlayState* play) { return; } } else if (play->sceneId == SCENE_BACKTOWN) { - if ((gSaveContext.save.time >= CLOCK_TIME(0, 20)) && (gSaveContext.save.time < CLOCK_TIME(6, 00))) { + if ((CURRENT_TIME >= CLOCK_TIME(0, 20)) && (CURRENT_TIME < CLOCK_TIME(6, 0))) { Actor_Kill(&this->actor); } diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index da21100324..f1c4541c49 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -917,7 +917,7 @@ void EnSyatekiMan_Swamp_GiveReward(EnSyatekiMan* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Actor_TalkOfferAccepted(&this->actor, &play->state)) { - if ((CURRENT_DAY == 3) && (gSaveContext.save.time > CLOCK_TIME(12, 0))) { + if ((CURRENT_DAY == 3) && (CURRENT_TIME > CLOCK_TIME(12, 0))) { // We've been having a lot of earthquakes lately. Message_StartTextbox(play, 0xA36, &this->actor); this->prevTextId = 0xA36; diff --git a/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c b/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c index c2e9521768..bede359592 100644 --- a/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c +++ b/src/overlays/actors/ovl_En_Tanron4/z_en_tanron4.c @@ -72,7 +72,7 @@ void EnTanron4_Init(Actor* thisx, PlayState* play2) { } } - if ((gSaveContext.save.time > CLOCK_TIME(20, 0)) || (gSaveContext.save.time < CLOCK_TIME(4, 0))) { + if ((CURRENT_TIME > CLOCK_TIME(20, 0)) || (CURRENT_TIME < CLOCK_TIME(4, 0))) { this->timeInfluence = 1500.0f; thisx->world.pos.y += 1500.0f; } @@ -98,7 +98,7 @@ void EnTanron4_FlyNearHome(EnTanron4* this, PlayState* play) { // `timeInfluence` controls both the height of the seagulls and when they are visible. // They fly higher in the sky as the night goes on, and they disapear as dawn approaches. - if ((gSaveContext.save.time > CLOCK_TIME(20, 0)) || (gSaveContext.save.time < CLOCK_TIME(4, 0))) { + if ((CURRENT_TIME > CLOCK_TIME(20, 0)) || (CURRENT_TIME < CLOCK_TIME(4, 0))) { Math_ApproachF(&this->timeInfluence, 1500.0f, 1.0f, 1.0f); } else { Math_ApproachZeroF(&this->timeInfluence, 1.0f, 1.0f); diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.c b/src/overlays/actors/ovl_En_Test3/z_en_test3.c index c10acf5c9e..6fedf9d415 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.c +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.c @@ -785,8 +785,8 @@ s32 func_80A3FBE8(EnTest3* this, PlayState* play) { } else if ((D_80A41D20 == 2) && func_80A3E9DC(this, play)) { CutsceneManager_SetReturnCamera(CAM_ID_MAIN); Environment_StartTime(); - if (((void)0, gSaveContext.save.time) > CLOCK_TIME(6, 0)) { - Environment_SetTimeJump(TIME_TO_MINUTES_ALT_F(fabsf((s16) - ((void)0, gSaveContext.save.time)))); + if (CURRENT_TIME > CLOCK_TIME(6, 0)) { + Environment_SetTimeJump(TIME_TO_MINUTES_ALT_F(fabsf((s16)-CURRENT_TIME))); } if (play->actorCtx.flags & ACTORCTX_FLAG_6) { SET_WEEKEVENTREG(WEEKEVENTREG_ESCAPED_SAKONS_HIDEOUT); diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.c b/src/overlays/actors/ovl_En_Test6/z_en_test6.c index dc6e837d04..239af56c6c 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c @@ -1088,7 +1088,7 @@ void EnTest6_SharedSoTCutscene(EnTest6* this, PlayState* play) { play->transitionTrigger = TRANS_TRIGGER_START; play->nextEntrance = gSaveContext.respawn[RESPAWN_MODE_RETURN].entrance; play->transitionType = TRANS_TYPE_FADE_BLACK; - if ((gSaveContext.save.time > CLOCK_TIME(18, 0)) || (gSaveContext.save.time < CLOCK_TIME(6, 0))) { + if ((CURRENT_TIME > CLOCK_TIME(18, 0)) || (CURRENT_TIME < CLOCK_TIME(6, 0))) { gSaveContext.respawnFlag = -0x63; SET_EVENTINF(EVENTINF_TRIGGER_DAYTELOP); } else { @@ -1162,7 +1162,7 @@ void EnTest6_SharedSoTCutscene(EnTest6* this, PlayState* play) { return; case SOTCS_CUEID_DOUBLE_END: - if (gSaveContext.save.time > CLOCK_TIME(12, 0)) { + if (CURRENT_TIME > CLOCK_TIME(12, 0)) { Play_SetRespawnData(&play->state, RESPAWN_MODE_RETURN, ((void)0, gSaveContext.save.entrance), player->unk_3CE, PLAYER_PARAMS(0xFF, PLAYER_INITMODE_B), &player->unk_3C0, player->unk_3CC); diff --git a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c index 396d2cef9c..5e40835987 100644 --- a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c +++ b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c @@ -323,8 +323,8 @@ void EnTimeTag_KickOut_WaitForTime(EnTimeTag* this, PlayState* play) { return; } - hour = TIME_TO_HOURS_F(gSaveContext.save.time); - minute = (s32)TIME_TO_MINUTES_F(gSaveContext.save.time) % 60; + hour = TIME_TO_HOURS_F(CURRENT_TIME); + minute = (s32)TIME_TO_MINUTES_F(CURRENT_TIME) % 60; if (CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT)) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED)) { diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index 121e5875cf..4ee5679042 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -538,11 +538,11 @@ void func_80AED544(EnTk* this, PlayState* play) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_31_10)) { Message_StartTextbox(play, 0x13FE, &this->actor); SET_WEEKEVENTREG(WEEKEVENTREG_31_10); - } else if (gSaveContext.save.time < CLOCK_TIME(9, 0)) { + } else if (CURRENT_TIME < CLOCK_TIME(9, 0)) { Message_StartTextbox(play, 0x13FF, &this->actor); - } else if (gSaveContext.save.time < CLOCK_TIME(12, 0)) { + } else if (CURRENT_TIME < CLOCK_TIME(12, 0)) { Message_StartTextbox(play, 0x1400, &this->actor); - } else if (gSaveContext.save.time < CLOCK_TIME(15, 0)) { + } else if (CURRENT_TIME < CLOCK_TIME(15, 0)) { Message_StartTextbox(play, 0x1401, &this->actor); } else { Message_StartTextbox(play, 0x1402, &this->actor); diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.c b/src/overlays/actors/ovl_En_Toto/z_en_toto.c index 6afdfd43e4..f13d0d0c1e 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -189,8 +189,8 @@ void EnToto_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - if ((play->sceneId == SCENE_MILK_BAR) && (gSaveContext.save.time >= CLOCK_TIME(6, 0)) && - (gSaveContext.save.time < CLOCK_TIME(21, 30))) { + if ((play->sceneId == SCENE_MILK_BAR) && (CURRENT_TIME >= CLOCK_TIME(6, 0)) && + (CURRENT_TIME < CLOCK_TIME(21, 30))) { Actor_Kill(&this->actor); return; } @@ -257,7 +257,7 @@ void func_80BA39C8(EnToto* this, PlayState* play) { } if (((play->sceneId == SCENE_MILK_BAR) && - !((gSaveContext.save.time >= CLOCK_TIME(6, 0)) && (gSaveContext.save.time <= (CLOCK_TIME(22, 13) + 7)))) || + !((CURRENT_TIME >= CLOCK_TIME(6, 0)) && (CURRENT_TIME <= (CLOCK_TIME(22, 13) + 7)))) || ((play->sceneId != SCENE_MILK_BAR) && func_80BA397C(this, 0x2000))) { if (this->unk2B6 != 0) { this->text = D_80BA5044; diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index 513a57d2ea..90f724bcf7 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -456,7 +456,7 @@ void func_809674C8(EnWeatherTag* this, PlayState* play) { if (Actor_WorldDistXZToActor(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(&this->actor)) { if (CURRENT_DAY == 2) { - if ((gSaveContext.save.time >= CLOCK_TIME(7, 0)) && (gSaveContext.save.time < CLOCK_TIME(17, 30)) && + if ((CURRENT_TIME >= CLOCK_TIME(7, 0)) && (CURRENT_TIME < CLOCK_TIME(17, 30)) && (play->envCtx.precipitation[PRECIP_SNOW_CUR] == 0)) { gWeatherMode = WEATHER_MODE_RAIN; @@ -493,10 +493,9 @@ void EnWeatherTag_Update(Actor* thisx, PlayState* play) { (play->transitionTrigger == TRANS_TRIGGER_OFF) && (CutsceneManager_GetCurrentCsId() == CS_ID_NONE) && (play->csCtx.state == CS_STATE_IDLE)) { - gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)R_TIME_SPEED; + gSaveContext.save.time = CURRENT_TIME + (u16)R_TIME_SPEED; if (R_TIME_SPEED != 0) { - gSaveContext.save.time = - ((void)0, gSaveContext.save.time) + (u16)((void)0, gSaveContext.save.timeSpeedOffset); + gSaveContext.save.time = CURRENT_TIME + (u16)((void)0, gSaveContext.save.timeSpeedOffset); } } } diff --git a/src/overlays/actors/ovl_En_Yb/z_en_yb.c b/src/overlays/actors/ovl_En_Yb/z_en_yb.c index ca280f6040..9c4985661f 100644 --- a/src/overlays/actors/ovl_En_Yb/z_en_yb.c +++ b/src/overlays/actors/ovl_En_Yb/z_en_yb.c @@ -116,7 +116,7 @@ void EnYb_Init(Actor* thisx, PlayState* play) { this->actor.csId = this->csIdList[0]; // between midnight and morning start spawned - if (gSaveContext.save.time < CLOCK_TIME(6, 0)) { + if (CURRENT_TIME < CLOCK_TIME(6, 0)) { this->alpha = 255; } else { // else (night 6pm to midnight): wait to appear this->alpha = 0; @@ -392,7 +392,7 @@ void EnYb_Idle(EnYb* this, PlayState* play) { } void EnYb_WaitForMidnight(EnYb* this, PlayState* play) { - if (gSaveContext.save.time < CLOCK_TIME(6, 0)) { + if (CURRENT_TIME < CLOCK_TIME(6, 0)) { EnYb_UpdateAnimation(this, play); this->alpha += 5; if (this->alpha > 250) { diff --git a/src/overlays/actors/ovl_Mir_Ray3/z_mir_ray3.c b/src/overlays/actors/ovl_Mir_Ray3/z_mir_ray3.c index ade3d5db6a..08b4bdcb58 100644 --- a/src/overlays/actors/ovl_Mir_Ray3/z_mir_ray3.c +++ b/src/overlays/actors/ovl_Mir_Ray3/z_mir_ray3.c @@ -367,7 +367,7 @@ void MirRay3_Draw(Actor* thisx, PlayState* play) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (MIRRAY3_GET_F(&this->actor) == MIRRAY3_F_1) { - time = gSaveContext.save.time; + time = CURRENT_TIME; if (time > CLOCK_TIME(12, 0)) { time = (DAY_LENGTH - 1) - time; diff --git a/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c b/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c index 4b3914368d..a55f39b302 100644 --- a/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c +++ b/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c @@ -266,7 +266,7 @@ void ObjDora_UpdateCollision(ObjDora* this, PlayState* play) { u16 time; if (this->colliderTris.base.acFlags & AC_HIT) { - time = gSaveContext.save.time; + time = CURRENT_TIME; this->colliderTris.base.acFlags &= ~AC_HIT; this->collisionCooldownTimer = 5; diff --git a/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.c b/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.c index f76b5a7940..4326d7077f 100644 --- a/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.c +++ b/src/overlays/actors/ovl_Obj_Entotu/z_obj_entotu.c @@ -32,7 +32,7 @@ ActorInit Obj_Entotu_InitVars = { s32 func_80A34700(s16 minutes) { s32 ret = 0; - s16 time = TIME_TO_MINUTES_F(gSaveContext.save.time); + s16 time = TIME_TO_MINUTES_F(CURRENT_TIME); s32 hours = time / 60; s32 currMinutes = time % 60; diff --git a/src/overlays/actors/ovl_Obj_Smork/z_obj_smork.c b/src/overlays/actors/ovl_Obj_Smork/z_obj_smork.c index 765fd8389b..73650e42ce 100644 --- a/src/overlays/actors/ovl_Obj_Smork/z_obj_smork.c +++ b/src/overlays/actors/ovl_Obj_Smork/z_obj_smork.c @@ -32,7 +32,7 @@ ActorInit Obj_Smork_InitVars = { u8 func_80A3D680(s16 arg0) { u8 ret = 0; - s16 temp_f18 = TIME_TO_MINUTES_F(gSaveContext.save.time); + s16 temp_f18 = TIME_TO_MINUTES_F(CURRENT_TIME); s32 hours = temp_f18 / 60; s32 minutes = temp_f18 % 60; diff --git a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c index c3c6be76b8..8f3fdbacf3 100644 --- a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c +++ b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c @@ -199,7 +199,7 @@ void ObjTokeiStep_Init(Actor* thisx, PlayState* play) { DynaPolyActor_LoadMesh(play, &this->dyna, &gClocktowerPanelCol); ObjTokeiStep_InitSteps(this); ObjTokeiStep_SetupBeginOpen(this); - } else if (((CURRENT_DAY == 3) && (gSaveContext.save.time < CLOCK_TIME(6, 0))) || (gSaveContext.save.day >= 4)) { + } else if (((CURRENT_DAY == 3) && (CURRENT_TIME < CLOCK_TIME(6, 0))) || (gSaveContext.save.day >= 4)) { this->dyna.actor.draw = ObjTokeiStep_DrawOpen; ObjTokeiStep_InitStepsOpen(this); ObjTokeiStep_SetupDoNothingOpen(this); diff --git a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c index 4681bd07a7..b1ac272b82 100644 --- a/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c +++ b/src/overlays/actors/ovl_Obj_Tokeidai/z_obj_tokeidai.c @@ -124,7 +124,7 @@ void ObjTokeidai_ExteriorGear_Init(ObjTokeidai* this, PlayState* play) { if (((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 2) && (play->csCtx.scriptIndex == 0)) || ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 2) && (play->csCtx.scriptIndex == 0))) { ObjTokeidai_SetupTowerOpening(this); - } else if (((CURRENT_DAY == 3) && (gSaveContext.save.time < CLOCK_TIME(6, 0))) || (CURRENT_DAY >= 4)) { + } else if (((CURRENT_DAY == 3) && (CURRENT_TIME < CLOCK_TIME(6, 0))) || (CURRENT_DAY >= 4)) { this->actionFunc = ObjTokeidai_ExteriorGear_OpenedIdle; this->actor.world.pos.y += this->actor.scale.y * 1900.0f; this->actor.shape.yOffset = 1500.0f; @@ -141,7 +141,7 @@ void ObjTokeidai_TowerClock_Init(ObjTokeidai* this, PlayState* play) { if (((play->sceneId == SCENE_CLOCKTOWER) && (gSaveContext.sceneLayer == 2) && (play->csCtx.scriptIndex == 0)) || ((play->sceneId == SCENE_00KEIKOKU) && (gSaveContext.sceneLayer == 2) && (play->csCtx.scriptIndex == 0))) { ObjTokeidai_SetupTowerOpening(this); - } else if (((CURRENT_DAY == 3) && (gSaveContext.save.time < CLOCK_TIME(6, 0))) || (CURRENT_DAY >= 4)) { + } else if (((CURRENT_DAY == 3) && (CURRENT_TIME < CLOCK_TIME(6, 0))) || (CURRENT_DAY >= 4)) { this->actor.world.pos.y += (this->actor.scale.y * 5191.0f) - 50.0f; this->actor.world.pos.x += Math_SinS(this->actor.world.rot.y) * this->actor.scale.z * 1791.0f; this->actor.world.pos.z += -Math_CosS(this->actor.world.rot.y) * this->actor.scale.z * 1791.0f; @@ -192,7 +192,7 @@ void ObjTokeidai_Counterweight_Init(ObjTokeidai* this, PlayState* play) { this->actor.child->home.rot.x = 0x12C; } } - } else if (((CURRENT_DAY == 3) && (gSaveContext.save.time < CLOCK_TIME(6, 0))) || (CURRENT_DAY >= 4)) { + } else if (((CURRENT_DAY == 3) && (CURRENT_TIME < CLOCK_TIME(6, 0))) || (CURRENT_DAY >= 4)) { this->spotlightIntensity = 0; this->actor.world.pos.y += this->actor.scale.y * -2160.0f; this->actor.world.pos.x += Math_SinS(this->actor.world.rot.y) * this->actor.scale.z * 5400.0f; @@ -214,7 +214,7 @@ void ObjTokeidai_Init(Actor* thisx, PlayState* play) { this->xRotation = 0; this->yTranslation = 0; this->clockFaceZTranslation = 0; - this->clockTime = gSaveContext.save.time; + this->clockTime = CURRENT_TIME; this->actor.home.rot.x = 0; switch (OBJ_TOKEIDAI_TYPE(&this->actor)) { @@ -615,7 +615,7 @@ void ObjTokeidai_DoNothing(ObjTokeidai* this, PlayState* play) { } void ObjTokeidai_StaircaseToRooftop_Idle(ObjTokeidai* this, PlayState* play) { - if ((((CURRENT_DAY == 3) && (gSaveContext.save.time < CLOCK_TIME(6, 0))) || (CURRENT_DAY >= 4)) || + if ((((CURRENT_DAY == 3) && (CURRENT_TIME < CLOCK_TIME(6, 0))) || (CURRENT_DAY >= 4)) || CHECK_WEEKEVENTREG(WEEKEVENTREG_CLOCK_TOWER_OPENED)) { this->actor.draw = ObjTokeidai_Draw; } else { @@ -627,7 +627,7 @@ s32 ObjTokeidai_IsPostFirstCycleFinalHours(ObjTokeidai* this, PlayState* play) { if (gSaveContext.save.saveInfo.inventory.items[SLOT_OCARINA] == ITEM_NONE) { return false; } - if ((CURRENT_DAY == 3) && (gSaveContext.save.time < CLOCK_TIME(6, 0))) { + if ((CURRENT_DAY == 3) && (CURRENT_TIME < CLOCK_TIME(6, 0))) { ObjTokeidai_SetupTowerOpening(this); return true; } @@ -688,7 +688,7 @@ void ObjTokeidai_RotateOnHourChange(ObjTokeidai* this, PlayState* play) { } void ObjTokeidai_TowerClock_Idle(ObjTokeidai* this, PlayState* play) { - if ((CURRENT_DAY == 3) && (this->clockHour < 6) && (gSaveContext.save.time < CLOCK_TIME(6, 0))) { + if ((CURRENT_DAY == 3) && (this->clockHour < 6) && (CURRENT_TIME < CLOCK_TIME(6, 0))) { this->actor.draw = ObjTokeidai_Clock_Draw; ObjTokeidai_SetupTowerOpening(this); SET_WEEKEVENTREG(WEEKEVENTREG_CLOCK_TOWER_OPENED); @@ -705,21 +705,21 @@ void ObjTokeidai_TowerClock_Idle(ObjTokeidai* this, PlayState* play) { (CutsceneManager_GetCurrentCsId() == CS_ID_NONE)) { this->actor.draw = NULL; } - this->clockTime = gSaveContext.save.time; + this->clockTime = CURRENT_TIME; if (this->actor.home.rot.x != 0) { ObjTokeidai_Clock_Init(this); this->actor.home.rot.x = 0; } } - if ((CURRENT_DAY != 3) || (gSaveContext.save.time >= CLOCK_TIME(6, 0))) { + if ((CURRENT_DAY != 3) || (CURRENT_TIME >= CLOCK_TIME(6, 0))) { ObjTokeidai_RotateOnMinuteChange(this, true); } ObjTokeidai_RotateOnHourChange(this, play); } void ObjTokeidai_WallClock_Idle(ObjTokeidai* this, PlayState* play) { - this->clockTime = gSaveContext.save.time; + this->clockTime = CURRENT_TIME; ObjTokeidai_RotateOnMinuteChange(this, true); ObjTokeidai_RotateOnHourChange(this, play); } @@ -738,7 +738,7 @@ void ObjTokeidai_ExteriorGear_Idle(ObjTokeidai* this, PlayState* play) { (CutsceneManager_GetCurrentCsId() == CS_ID_NONE)) { this->actor.draw = NULL; } - this->clockTime = gSaveContext.save.time; + this->clockTime = CURRENT_TIME; if (this->actor.home.rot.x != 0) { ObjTokeidai_SetupClockOrExteriorGear(this); this->actor.home.rot.x = 0; diff --git a/src/overlays/actors/ovl_Obj_Toudai/z_obj_toudai.c b/src/overlays/actors/ovl_Obj_Toudai/z_obj_toudai.c index 7c08090960..fe9c60bdcc 100644 --- a/src/overlays/actors/ovl_Obj_Toudai/z_obj_toudai.c +++ b/src/overlays/actors/ovl_Obj_Toudai/z_obj_toudai.c @@ -81,7 +81,7 @@ void func_80A33BB4(ObjToudai* this, PlayState* play) { u8 func_80A342F4(s16 arg0) { u8 var_v1 = 0; - s16 minutes = TIME_TO_MINUTES_F(gSaveContext.save.time); + s16 minutes = TIME_TO_MINUTES_F(CURRENT_TIME); s32 hours = minutes / 60; if (hours >= 17) { diff --git a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c index 865b524131..3ffb3b1586 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c @@ -701,8 +701,8 @@ void ObjUm_Init(Actor* thisx, PlayState* play) { } else { // Waiting for player - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_34_80) || (gSaveContext.save.time >= CLOCK_TIME(19, 0)) || - (gSaveContext.save.time <= CLOCK_TIME(6, 0)) || CHECK_WEEKEVENTREG(WEEKEVENTREG_ESCORTED_CREMIA) || + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_34_80) || (CURRENT_TIME >= CLOCK_TIME(19, 0)) || + (CURRENT_TIME <= CLOCK_TIME(6, 0)) || CHECK_WEEKEVENTREG(WEEKEVENTREG_ESCORTED_CREMIA) || CHECK_WEEKEVENTREG(WEEKEVENTREG_52_02)) { Actor_Kill(&this->dyna.actor); return; @@ -999,11 +999,11 @@ void ObjUm_RanchWait(ObjUm* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_IDLE); this->flags |= OBJ_UM_FLAG_WAITING; - if ((gSaveContext.save.time > CLOCK_TIME(18, 0)) && (gSaveContext.save.time <= CLOCK_TIME(19, 0))) { + if ((CURRENT_TIME > CLOCK_TIME(18, 0)) && (CURRENT_TIME <= CLOCK_TIME(19, 0))) { if (!(player->stateFlags1 & PLAYER_STATE1_800000)) { func_80B7984C(play, this, 0, &this->unk_2B4); } - } else if (!func_80B79A24(this->unk_2B4) && (gSaveContext.save.time > CLOCK_TIME(19, 0))) { + } else if (!func_80B79A24(this->unk_2B4) && (CURRENT_TIME > CLOCK_TIME(19, 0))) { SET_WEEKEVENTREG(WEEKEVENTREG_34_80); ObjUm_SetupAction(this, ObjUm_RanchWaitPathFinished); } @@ -1163,7 +1163,7 @@ void ObjUm_RanchStartCs(ObjUm* this, PlayState* play) { if (CutsceneManager_IsNext(this->dyna.actor.csId)) { CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); - this->lastTime = gSaveContext.save.time; + this->lastTime = CURRENT_TIME; ObjUm_SetupAction(this, func_80B7A0E0); } else { CutsceneManager_Queue(this->dyna.actor.csId); @@ -1189,7 +1189,7 @@ void func_80B7A070(ObjUm* this, PlayState* play) { void func_80B7A0E0(ObjUm* this, PlayState* play) { ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_IDLE); - if (gSaveContext.save.time != this->lastTime) { + if (CURRENT_TIME != this->lastTime) { ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_TROT); ObjUm_SetupAction(this, func_80B7A070); } @@ -1231,11 +1231,11 @@ void ObjUm_PreMilkRunDialogueHandler(ObjUm* this, PlayState* play) { void func_80B7A240(ObjUm* this, PlayState* play) { ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_IDLE); - if (gSaveContext.save.time != this->lastTime) { + if (CURRENT_TIME != this->lastTime) { ObjUm_SetupAction(this, func_80B7A2AC); } - this->lastTime = gSaveContext.save.time; + this->lastTime = CURRENT_TIME; ObjUm_PreMilkRunDialogueHandler(this, play); } @@ -1253,11 +1253,11 @@ void func_80B7A2AC(ObjUm* this, PlayState* play) { break; default: - if (gSaveContext.save.time == this->lastTime) { + if (CURRENT_TIME == this->lastTime) { ObjUm_SetupAction(this, func_80B7A240); } - this->lastTime = gSaveContext.save.time; + this->lastTime = CURRENT_TIME; Actor_MoveWithGravity(&this->dyna.actor); ObjUm_PreMilkRunDialogueHandler(this, play); break; @@ -1267,7 +1267,7 @@ void func_80B7A2AC(ObjUm* this, PlayState* play) { void func_80B7A394(ObjUm* this, PlayState* play) { ObjUm_SetPlayerPosition(this, play); this->flags |= OBJ_UM_FLAG_0004; - if (gSaveContext.save.time != this->lastTime) { + if (CURRENT_TIME != this->lastTime) { ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_TROT); ObjUm_SetupAction(this, func_80B7A2AC); } @@ -1281,7 +1281,7 @@ void ObjUm_PreMilkRunStartCs(ObjUm* this, PlayState* play) { player->stateFlags1 |= PLAYER_STATE1_20; if (CutsceneManager_IsNext(this->dyna.actor.csId)) { CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); - this->lastTime = gSaveContext.save.time; + this->lastTime = CURRENT_TIME; ObjUm_SetupAction(this, func_80B7A394); } else { CutsceneManager_Queue(this->dyna.actor.csId); @@ -1492,11 +1492,11 @@ void func_80B7A860(ObjUm* this, PlayState* play) { void func_80B7AB78(ObjUm* this, PlayState* play) { ObjUm_ChangeAnim(this, play, OBJ_UM_ANIM_IDLE); - if (gSaveContext.save.time != this->lastTime) { + if (CURRENT_TIME != this->lastTime) { ObjUm_SetupAction(this, func_80B7ABE4); } - this->lastTime = gSaveContext.save.time; + this->lastTime = CURRENT_TIME; func_80B7A860(this, play); } @@ -1510,11 +1510,11 @@ void func_80B7ABE4(ObjUm* this, PlayState* play) { break; default: - if (gSaveContext.save.time == this->lastTime) { + if (CURRENT_TIME == this->lastTime) { ObjUm_SetupAction(this, func_80B7AB78); } - this->lastTime = gSaveContext.save.time; + this->lastTime = CURRENT_TIME; Actor_MoveWithGravity(&this->dyna.actor); func_80B7A860(this, play); break; @@ -1531,7 +1531,7 @@ void ObjUm_StartCs(ObjUm* this, PlayState* play) { if (CutsceneManager_IsNext(this->dyna.actor.csId)) { CutsceneManager_StartWithPlayerCs(this->dyna.actor.csId, &this->dyna.actor); - this->lastTime = gSaveContext.save.time; + this->lastTime = CURRENT_TIME; ObjUm_SetupAction(this, func_80B7ABE4); } else { CutsceneManager_Queue(this->dyna.actor.csId); diff --git a/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c b/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c index 001a005014..dad72d9a78 100644 --- a/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c +++ b/src/overlays/actors/ovl_Obj_Usiyane/z_obj_usiyane.c @@ -58,7 +58,7 @@ s32 func_80C07CD0(void) { } if (CURRENT_DAY == 1) { - s32 time = gSaveContext.save.time; + s32 time = CURRENT_TIME; s32 i; if ((time < CLOCK_TIME(2, 30)) || (time >= CLOCK_TIME(6, 0))) { diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index 68e3dccd70..29bb8662ae 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -178,8 +178,8 @@ void ShotSun_UpdateHyliaSun(ShotSun* this, PlayState* play) { return; } - if ((this->actor.xzDistToPlayer > 120.0f) || (gSaveContext.save.time < CLOCK_TIME(6, 30)) || - (gSaveContext.save.time >= CLOCK_TIME(7, 30))) { + if ((this->actor.xzDistToPlayer > 120.0f) || (CURRENT_TIME < CLOCK_TIME(6, 30)) || + (CURRENT_TIME >= CLOCK_TIME(7, 30))) { return; } diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c b/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c index 97181cefb1..bb347e94cc 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c @@ -414,7 +414,7 @@ void FileSelect_CopyConfirm(GameState* thisx) { FileSelectState* this = (FileSelectState*)thisx; SramContext* sramCtx = &this->sramCtx; Input* input = CONTROLLER1(&this->state); - u16 dayTime; + u16 time; if (((this->buttonIndex != FS_BTN_CONFIRM_YES) && CHECK_BTN_ANY(input->press.button, BTN_A | BTN_START)) || CHECK_BTN_ALL(input->press.button, BTN_B)) { @@ -423,8 +423,7 @@ void FileSelect_CopyConfirm(GameState* thisx) { this->configMode = CM_RETURN_TO_COPY_DEST; Audio_PlaySfx(NA_SE_SY_FSEL_CLOSE); } else if (CHECK_BTN_ANY(input->press.button, BTN_A | BTN_START)) { - dayTime = gSaveContext.save.time; - gSaveContext.save.time = dayTime; + gSaveContext.save.time = time = CURRENT_TIME; // Set to itself with unused temp this->nameAlpha[this->copyDestFileIndex] = 0; this->fileInfoAlpha[this->copyDestFileIndex] = this->nameAlpha[this->copyDestFileIndex]; this->nextTitleLabel = FS_TITLE_COPY_COMPLETE; diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c b/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c index 005fc7eb96..ed4af43e82 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c @@ -508,7 +508,7 @@ void FileSelect_DrawNameEntry(GameState* thisx) { if (validName) { Audio_PlaySfx(NA_SE_SY_FSEL_DECIDE_L); gSaveContext.fileNum = this->buttonIndex; - time = ((void)0, gSaveContext.save.time); + time = CURRENT_TIME; Sram_InitSave(this, sramCtx); gSaveContext.save.time = time; diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 7a79da010e..f9798d345f 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -944,7 +944,7 @@ void MapSelect_PrintCutsceneSetting(MapSelectState* this, GfxPrint* printer, u16 stage = "???"; break; } - gSaveContext.skyboxTime = gSaveContext.save.time; + gSaveContext.skyboxTime = CURRENT_TIME; GfxPrint_Printf(printer, "Stage:" GFXP_KATAKANA "%s", stage); GfxPrint_SetPos(printer, 23, 25);