From 29693f68a1b46b5c804eb9b86c86a096da22f445 Mon Sep 17 00:00:00 2001 From: engineer124 Date: Wed, 14 Sep 2022 18:55:27 -0400 Subject: [PATCH] more cleanup and sync --- include/functions.h | 1 + include/regs.h | 98 +++++++++---------- include/z64player.h | 2 +- include/z64save.h | 28 +++--- src/code/z_parameter.c | 60 ++++++------ src/code/z_player_lib.c | 2 +- src/code/z_sram_NES.c | 4 +- src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c | 16 +-- src/overlays/actors/ovl_En_Mm3/z_en_mm3.c | 2 +- .../ovl_En_Syateki_Man/z_en_syateki_man.c | 2 +- .../actors/ovl_En_Time_Tag/z_en_time_tag.c | 4 +- src/overlays/gamestates/ovl_select/z_select.c | 2 +- 12 files changed, 111 insertions(+), 110 deletions(-) diff --git a/include/functions.h b/include/functions.h index 50e91a3a4..19c0f6ece 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1851,6 +1851,7 @@ void Interface_Draw(PlayState* play); void Interface_Update(PlayState* play); void Interface_Destroy(PlayState* play); void Interface_Init(PlayState* play); + Path* Path_GetByIndex(PlayState* play, s16 index, s16 max); f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw); void Path_CopyLastPoint(Path* path, Vec3f* dest); diff --git a/include/regs.h b/include/regs.h index fccddd2c2..cf15b236a 100644 --- a/include/regs.h +++ b/include/regs.h @@ -43,56 +43,56 @@ #define bREG(r) BASE_REG(28, r) /* TODO: Actually confirm these, in case of miss-match it's at least a simple list to `sed` */ -#define R_ENABLE_ARENA_DBG SREG(0) // Same as OoT -#define R_RUN_SPEED_LIMIT REG(45) -#define R_UPDATE_RATE SREG(30) -#define R_PAUSE_MENU_MODE SREG(94) -#define R_C_UP_ICON_X YREG(88) -#define R_C_UP_ICON_Y YREG(89) -#define R_MAGIC_FILL_COLOR(i) ZREG(0 + i) -#define R_C_BTN_COLOR(i) ZREG(39 + i) -#define R_B_BTN_COLOR(i) ZREG(43 + i) -#define R_START_LABEL_DD(i) ZREG(48 + i) -#define R_START_LABEL_Y(i) ZREG(51 + i) -#define R_START_LABEL_X(i) ZREG(54 + i) -#define R_C_UP_BTN_X ZREG(62) -#define R_C_UP_BTN_Y ZREG(63) -#define R_START_BTN_X ZREG(68) -#define R_START_BTN_Y ZREG(69) -#define R_ITEM_BTN_X(i) ZREG(70 + i) -#define R_ITEM_BTN_Y(i) ZREG(74 + i) -#define R_ITEM_BTN_DD(i) ZREG(78 + i) -#define R_ITEM_ICON_X(i) ZREG(82 + i) -#define R_ITEM_ICON_Y(i) ZREG(86 + i) -#define R_ITEM_ICON_DD(i) ZREG(90 + i) -#define R_A_BTN_Y XREG(16) -#define R_A_BTN_X XREG(17) -#define R_A_ICON_Y XREG(19) -#define R_A_ICON_X XREG(20) -#define R_A_BTN_COLOR(i) XREG(22 + i) +#define R_ENABLE_ARENA_DBG SREG(0) // Same as OoT +#define R_RUN_SPEED_LIMIT REG(45) +#define R_UPDATE_RATE SREG(30) +#define R_PAUSE_MENU_MODE SREG(94) +#define R_C_UP_ICON_X YREG(88) +#define R_C_UP_ICON_Y YREG(89) +#define R_MAGIC_FILL_COLOR(i) ZREG(0 + i) +#define R_C_BTN_COLOR(i) ZREG(39 + i) +#define R_B_BTN_COLOR(i) ZREG(43 + i) +#define R_START_LABEL_DD(i) ZREG(48 + i) +#define R_START_LABEL_Y(i) ZREG(51 + i) +#define R_START_LABEL_X(i) ZREG(54 + i) +#define R_C_UP_BTN_X ZREG(62) +#define R_C_UP_BTN_Y ZREG(63) +#define R_START_BTN_X ZREG(68) +#define R_START_BTN_Y ZREG(69) +#define R_ITEM_BTN_X(i) ZREG(70 + i) +#define R_ITEM_BTN_Y(i) ZREG(74 + i) +#define R_ITEM_BTN_DD(i) ZREG(78 + i) +#define R_ITEM_ICON_X(i) ZREG(82 + i) +#define R_ITEM_ICON_Y(i) ZREG(86 + i) +#define R_ITEM_ICON_DD(i) ZREG(90 + i) +#define R_A_BTN_Y XREG(16) +#define R_A_BTN_X XREG(17) +#define R_A_ICON_Y XREG(19) +#define R_A_ICON_X XREG(20) +#define R_A_BTN_COLOR(i) XREG(22 + i) #define R_MAGIC_CONSUME_TIMER_GIANTS_MASK XREG(41) -#define R_FINAL_HOURS_TIMER_Y XREG(80) -#define R_FINAL_HOURS_TIMER_X XREG(81) -#define R_MINIMAP_DISABLED XREG(95) -#define R_B_LABEL_DD WREG(0) -#define R_OW_MINIMAP_X WREG(29) -#define R_OW_MINIMAP_Y WREG(30) -#define R_B_LABEL_X(i) WREG(40 + i) -#define R_B_LABEL_Y(i) WREG(43 + i) -#define R_DGN_MINIMAP_X WREG(68) -#define R_DGN_MINIMAP_Y WREG(69) -#define R_MAP_INDEX VREG(11) -#define R_MAP_TEX_INDEX_BASE VREG(12) -#define R_MAP_TEX_INDEX VREG(13) -#define R_COMPASS_SCALE_X VREG(14) -#define R_COMPASS_SCALE_Y VREG(15) -#define R_COMPASS_OFFSET_X VREG(16) -#define R_COMPASS_OFFSET_Y VREG(17) -#define R_MINIMAP_COLOR(i) VREG(18 + i) -#define R_ITEM_AMMO_X(i) VREG(64 + i) -#define R_ITEM_AMMO_Y(i) VREG(68 + i) -#define R_ITEM_ICON_WIDTH(i) VREG(76 + i) -#define R_ITEM_BTN_WIDTH(i) VREG(80 + i) +#define R_MOON_CRASH_TIMER_Y XREG(80) +#define R_MOON_CRASH_TIMER_X XREG(81) +#define R_MINIMAP_DISABLED XREG(95) +#define R_B_LABEL_DD WREG(0) +#define R_OW_MINIMAP_X WREG(29) +#define R_OW_MINIMAP_Y WREG(30) +#define R_B_LABEL_X(i) WREG(40 + i) +#define R_B_LABEL_Y(i) WREG(43 + i) +#define R_DGN_MINIMAP_X WREG(68) +#define R_DGN_MINIMAP_Y WREG(69) +#define R_MAP_INDEX VREG(11) +#define R_MAP_TEX_INDEX_BASE VREG(12) +#define R_MAP_TEX_INDEX VREG(13) +#define R_COMPASS_SCALE_X VREG(14) +#define R_COMPASS_SCALE_Y VREG(15) +#define R_COMPASS_OFFSET_X VREG(16) +#define R_COMPASS_OFFSET_Y VREG(17) +#define R_MINIMAP_COLOR(i) VREG(18 + i) +#define R_ITEM_AMMO_X(i) VREG(64 + i) +#define R_ITEM_AMMO_Y(i) VREG(68 + i) +#define R_ITEM_ICON_WIDTH(i) VREG(76 + i) +#define R_ITEM_BTN_WIDTH(i) VREG(80 + i) #define R_FB_FILTER_TYPE SREG(80) #define R_FB_FILTER_PRIM_COLOR(c) SREG(81 + c) diff --git a/include/z64player.h b/include/z64player.h index 4aa40aedd..6cf7296b8 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -602,7 +602,7 @@ typedef struct Player { /* 0xAD0 */ f32 linearVelocity; /* 0xAD4 */ s16 currentYaw; /* 0xAD6 */ s16 targetYaw; - /* 0xAD8 */ u16 unk_AD8; + /* 0xAD8 */ u16 underwaterTimer; /* 0xADA */ s8 meleeWeaponAnimation; /* 0xADB */ s8 meleeWeaponState; /* 0xADC */ s8 unk_ADC; diff --git a/include/z64save.h b/include/z64save.h index c4d0d34b3..a8ccbdaa4 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -67,7 +67,7 @@ typedef enum { /* 0 */ TIMER_ID_POSTMAN, // postman's counting minigame /* 1 */ TIMER_ID_MINIGAME_1, // minigame timer /* 2 */ TIMER_ID_2, - /* 3 */ TIMER_ID_FINAL_HOURS, // countdown until mooncrash + /* 3 */ TIMER_ID_MOON_CRASH, // timer used for mooncrash on the clocktower roof /* 4 */ TIMER_ID_MINIGAME_2, // minigame timer /* 5 */ TIMER_ID_ENV, // environmental timer (underwater or hot room) /* 6 */ TIMER_ID_GORON_RACE_UNUSED, @@ -293,11 +293,11 @@ typedef struct SaveContext { /* 0x1015 */ u8 unk_1015; /* 0x1016 */ u16 jinxTimer; /* 0x1018 */ s16 rupeeAccumulator; // "lupy_udct" - /* 0x101A */ u8 bottleTimerState[BOTTLE_MAX]; // "bottle_status", one entry for each bottle - /* 0x1020 */ OSTime bottleTimerStartOsTimes[BOTTLE_MAX]; // "bottle_ostime", one entry for each bottle - /* 0x1050 */ u64 bottleTimerTimeLimits[BOTTLE_MAX]; // "bottle_sub", one entry for each bottle - /* 0x1080 */ u64 bottleTimerCurTimes[BOTTLE_MAX]; // "bottle_time", one entry for each bottle - /* 0x10B0 */ OSTime bottleTimerPausedOsTimes[BOTTLE_MAX]; // "bottle_stop_time", one entry for each bottle + /* 0x101A */ u8 bottleTimerStates[BOTTLE_MAX]; // See the `BottleTimerState` enum. "bottle_status" + /* 0x1020 */ OSTime bottleTimerStartOsTimes[BOTTLE_MAX]; // The osTime when the timer starts. "bottle_ostime" + /* 0x1050 */ u64 bottleTimerTimeLimits[BOTTLE_MAX]; // The original total time given before the timer expires, in centiseconds (1/100th sec). "bottle_sub" + /* 0x1080 */ u64 bottleTimerCurTimes[BOTTLE_MAX]; // The remaining time left before the timer expires, in centiseconds (1/100th sec). "bottle_time" + /* 0x10B0 */ OSTime bottleTimerPausedOsTimes[BOTTLE_MAX]; // The cumulative osTime spent with the timer paused. "bottle_stop_time" /* 0x10E0 */ u64 pictoPhoto[1400]; // buffer containing the pictograph photo /* 0x3CA0 */ s32 fileNum; // "file_no" /* 0x3CA4 */ s16 powderKegTimer; // "big_bom_timer" @@ -316,14 +316,14 @@ typedef struct SaveContext { /* 0x3DBF */ u8 showTitleCard; // "name_display" /* 0x3DC0 */ s16 unk_3DC0; // "shield_magic_timer" /* 0x3DC2 */ u8 unk_3DC2; // "pad1" - /* 0x3DC8 */ OSTime timerOsTime; // "get_time" - /* 0x3DD0 */ u8 timerStates[TIMER_ID_MAX]; // "event_fg" - /* 0x3DD7 */ u8 timerDirections[TIMER_ID_MAX]; // "calc_flag" - /* 0x3DE0 */ u64 timerCurTimes[TIMER_ID_MAX]; // "event_ostime" - /* 0x3E18 */ u64 timerTimeLimits[TIMER_ID_MAX]; // "event_sub" - /* 0x3E50 */ OSTime timerStartOsTimes[TIMER_ID_MAX]; // "func_time" - /* 0x3E88 */ OSTime timerEndOsTimes[TIMER_ID_MAX]; // "func_end_time" - /* 0x3EC0 */ OSTime timerPausedOsTimes[TIMER_ID_MAX]; // "func_stop_time" + /* 0x3DC8 */ OSTime postmanTimerStopOsTime; // The osTime when the timer stops for the postman minigame. "get_time" + /* 0x3DD0 */ u8 timerStates[TIMER_ID_MAX]; // See the `TimerState` enum. "event_fg" + /* 0x3DD7 */ u8 timerDirections[TIMER_ID_MAX]; // See the `TimerDirection` enum. "calc_flag" + /* 0x3DE0 */ u64 timerCurTimes[TIMER_ID_MAX]; // For countdown, the remaining time left. For countup, the time since the start. In centiseconds (1/100th sec). "event_ostime" + /* 0x3E18 */ u64 timerTimeLimits[TIMER_ID_MAX]; // The original total time given for the timer to count from, in centiseconds (1/100th sec). "event_sub" + /* 0x3E50 */ OSTime timerStartOsTimes[TIMER_ID_MAX]; // The osTime when the timer starts. "func_time" + /* 0x3E88 */ u64 timerStopTimes[TIMER_ID_MAX]; // The total amount of time taken between the start and end of the timer, in centiseconds (1/100th sec). "func_end_time" + /* 0x3EC0 */ OSTime timerPausedOsTimes[TIMER_ID_MAX]; // The cumulative osTime spent with the timer paused. "func_stop_time" /* 0x3EF8 */ s16 timerX[TIMER_ID_MAX]; // "event_xp" /* 0x3F06 */ s16 timerY[TIMER_ID_MAX]; // "event_yp" /* 0x3F14 */ s16 unk_3F14; // "character_change" diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index f6590a9e4..83df398b6 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -598,7 +598,7 @@ void Interface_PostmanTimerCallback(s32 arg0) { func_80175E68(&sPostmanTimerInput[0], 0); btnAPressed = CHECK_BTN_ALL(sPostmanTimerInput[0].cur.button, BTN_A); if ((btnAPressed != sPostmanTimerInputBtnAPressed) && btnAPressed) { - gSaveContext.timerOsTime = osGetTime(); + gSaveContext.postmanTimerStopOsTime = osGetTime(); gSaveContext.timerStates[TIMER_ID_POSTMAN] = TIMER_STATE_POSTMAN_STOP; } @@ -639,7 +639,7 @@ void Interface_StartPostmanTimer(s16 seconds, s16 bunnyHoodState) { } gSaveContext.timerStates[TIMER_ID_POSTMAN] = TIMER_STATE_POSTMAN_START; - gSaveContext.timerEndOsTimes[TIMER_ID_POSTMAN] = 0; + gSaveContext.timerStopTimes[TIMER_ID_POSTMAN] = 0; gSaveContext.timerPausedOsTimes[TIMER_ID_POSTMAN] = 0; } @@ -656,7 +656,7 @@ void Interface_StartGoronRaceTimer(s32 arg0) { } void Interface_StartBottleTimer(s16 seconds, s16 timerId) { - gSaveContext.bottleTimerState[timerId] = BOTTLE_TIMER_STATE_COUNTING; + gSaveContext.bottleTimerStates[timerId] = BOTTLE_TIMER_STATE_COUNTING; gSaveContext.bottleTimerCurTimes[timerId] = SECONDS_TO_TIMER(seconds); gSaveContext.bottleTimerTimeLimits[timerId] = gSaveContext.bottleTimerCurTimes[timerId]; gSaveContext.bottleTimerStartOsTimes[timerId] = osGetTime(); @@ -5257,7 +5257,7 @@ void Interface_DrawTimers(PlayState* play) { MessageContext* msgCtx = &play->msgCtx; Player* player = GET_PLAYER(play); OSTime osTime; - OSTime timerOsTime; + OSTime postmanTimerStopOsTime; s16 j; s16 i; @@ -5307,10 +5307,10 @@ void Interface_DrawTimers(PlayState* play) { break; case TIMER_STATE_POSTMAN_STOP: - timerOsTime = gSaveContext.timerOsTime; - gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] = - OSTIME_TO_TIMER(timerOsTime - ((void)0, gSaveContext.timerStartOsTimes[TIMER_ID_POSTMAN]) - - ((void)0, gSaveContext.timerPausedOsTimes[TIMER_ID_POSTMAN])); + postmanTimerStopOsTime = gSaveContext.postmanTimerStopOsTime; + gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] = OSTIME_TO_TIMER( + postmanTimerStopOsTime - ((void)0, gSaveContext.timerStartOsTimes[TIMER_ID_POSTMAN]) - + ((void)0, gSaveContext.timerPausedOsTimes[TIMER_ID_POSTMAN])); gSaveContext.timerStates[TIMER_ID_POSTMAN] = TIMER_STATE_POSTMAN_END; func_80174F9C(Interface_PostmanTimerCallback, NULL); break; @@ -5349,7 +5349,7 @@ void Interface_DrawTimers(PlayState* play) { } gSaveContext.timerStartOsTimes[sTimerId] = osGetTime(); - gSaveContext.timerEndOsTimes[sTimerId] = 0; + gSaveContext.timerStopTimes[sTimerId] = 0; gSaveContext.timerPausedOsTimes[sTimerId] = 0; } } else { @@ -5366,10 +5366,10 @@ void Interface_DrawTimers(PlayState* play) { break; case TIMER_STATE_MOVING_TIMER: - if (sTimerId == TIMER_ID_FINAL_HOURS) { - j = ((((void)0, gSaveContext.timerX[sTimerId]) - R_FINAL_HOURS_TIMER_X) / sTimerStateTimer); + if (sTimerId == TIMER_ID_MOON_CRASH) { + j = ((((void)0, gSaveContext.timerX[sTimerId]) - R_MOON_CRASH_TIMER_X) / sTimerStateTimer); gSaveContext.timerX[sTimerId] = ((void)0, gSaveContext.timerX[sTimerId]) - j; - j = ((((void)0, gSaveContext.timerY[sTimerId]) - R_FINAL_HOURS_TIMER_Y) / sTimerStateTimer); + j = ((((void)0, gSaveContext.timerY[sTimerId]) - R_MOON_CRASH_TIMER_Y) / sTimerStateTimer); gSaveContext.timerY[sTimerId] = ((void)0, gSaveContext.timerY[sTimerId]) - j; } else { j = ((((void)0, gSaveContext.timerX[sTimerId]) - 26) / sTimerStateTimer); @@ -5385,8 +5385,8 @@ void Interface_DrawTimers(PlayState* play) { if (sTimerStateTimer == 0) { sTimerStateTimer = 20; - if (sTimerId == TIMER_ID_FINAL_HOURS) { - gSaveContext.timerY[sTimerId] = R_FINAL_HOURS_TIMER_Y; + if (sTimerId == TIMER_ID_MOON_CRASH) { + gSaveContext.timerY[sTimerId] = R_MOON_CRASH_TIMER_Y; } else { gSaveContext.timerX[sTimerId] = 26; if (gSaveContext.save.playerData.healthCapacity > 0xA0) { @@ -5398,15 +5398,15 @@ void Interface_DrawTimers(PlayState* play) { gSaveContext.timerStates[sTimerId] = TIMER_STATE_COUNTING; gSaveContext.timerStartOsTimes[sTimerId] = osGetTime(); - gSaveContext.timerEndOsTimes[sTimerId] = 0; + gSaveContext.timerStopTimes[sTimerId] = 0; gSaveContext.timerPausedOsTimes[sTimerId] = 0; } // fallthrough case TIMER_STATE_COUNTING: if ((gSaveContext.timerStates[sTimerId] == TIMER_STATE_COUNTING) && - (sTimerId == TIMER_ID_FINAL_HOURS)) { - gSaveContext.timerX[TIMER_ID_FINAL_HOURS] = R_FINAL_HOURS_TIMER_X; - gSaveContext.timerY[TIMER_ID_FINAL_HOURS] = R_FINAL_HOURS_TIMER_Y; + (sTimerId == TIMER_ID_MOON_CRASH)) { + gSaveContext.timerX[TIMER_ID_MOON_CRASH] = R_MOON_CRASH_TIMER_X; + gSaveContext.timerY[TIMER_ID_MOON_CRASH] = R_MOON_CRASH_TIMER_Y; } break; @@ -5439,13 +5439,13 @@ void Interface_DrawTimers(PlayState* play) { case TIMER_STATE_STOP: osTime = osGetTime(); - gSaveContext.timerEndOsTimes[sTimerId] = + gSaveContext.timerStopTimes[sTimerId] = OSTIME_TO_TIMER(osTime - ((void)0, gSaveContext.timerStartOsTimes[sTimerId]) - ((void)0, gSaveContext.timerPausedOsTimes[sTimerId])); gSaveContext.timerStates[sTimerId] = TIMER_STATE_OFF; - if (sTimerId == TIMER_ID_FINAL_HOURS) { + if (sTimerId == TIMER_ID_MOON_CRASH) { gSaveContext.save.day = 4; if ((play->sceneNum == SCENE_OKUJOU) && (gSaveContext.sceneSetupIndex == 3)) { play->nextEntrance = ENTRANCE(TERMINA_FIELD, 1); @@ -5466,18 +5466,18 @@ void Interface_DrawTimers(PlayState* play) { case TIMER_STATE_6: osTime = osGetTime(); - gSaveContext.timerEndOsTimes[sTimerId] = + gSaveContext.timerStopTimes[sTimerId] = OSTIME_TO_TIMER(osTime - ((void)0, gSaveContext.timerStartOsTimes[sTimerId]) - ((void)0, gSaveContext.timerPausedOsTimes[sTimerId])); if ((gSaveContext.minigameState == 1) && (gSaveContext.save.entrance == ENTRANCE(ROMANI_RANCH, 0))) { - if (gSaveContext.timerEndOsTimes[sTimerId] >= SECONDS_TO_TIMER(120)) { - gSaveContext.timerEndOsTimes[sTimerId] = SECONDS_TO_TIMER(120); + if (gSaveContext.timerStopTimes[sTimerId] >= SECONDS_TO_TIMER(120)) { + gSaveContext.timerStopTimes[sTimerId] = SECONDS_TO_TIMER(120); gSaveContext.timerCurTimes[sTimerId] = SECONDS_TO_TIMER(120); } } else if ((gSaveContext.eventInf[3] & 0x10) && (play->sceneNum == SCENE_DEKUTES) && - (gSaveContext.timerEndOsTimes[sTimerId] >= SECONDS_TO_TIMER(120))) { + (gSaveContext.timerStopTimes[sTimerId] >= SECONDS_TO_TIMER(120))) { gSaveContext.timerCurTimes[sTimerId] = SECONDS_TO_TIMER(120); } gSaveContext.timerStates[sTimerId] = TIMER_STATE_7; @@ -5511,7 +5511,7 @@ void Interface_DrawTimers(PlayState* play) { OSTIME_TO_TIMER(osTime - ((void)0, gSaveContext.timerPausedOsTimes[sTimerId]) - D_801BF930[sTimerId] - ((void)0, gSaveContext.timerStartOsTimes[sTimerId])); } else if (gSaveContext.timerStates[sTimerId] == TIMER_STATE_7) { - osTime = gSaveContext.timerEndOsTimes[sTimerId]; + osTime = gSaveContext.timerStopTimes[sTimerId]; } else { osTime = 0; } @@ -5564,7 +5564,7 @@ void Interface_DrawTimers(PlayState* play) { OSTIME_TO_TIMER(osTime - ((void)0, gSaveContext.timerStartOsTimes[sTimerId]) - ((void)0, gSaveContext.timerPausedOsTimes[sTimerId]) - D_801BF930[sTimerId]); } else if (gSaveContext.timerStates[sTimerId] == TIMER_STATE_7) { - osTime = gSaveContext.timerEndOsTimes[sTimerId]; + osTime = gSaveContext.timerStopTimes[sTimerId]; } else if (sTimerId == TIMER_ID_POSTMAN) { osTime = gSaveContext.timerCurTimes[sTimerId]; } else { @@ -5707,7 +5707,7 @@ void Interface_UpdateBottleTimers(PlayState* play) { osTime = osGetTime(); for (j = BOTTLE_FIRST; j < BOTTLE_MAX; j++) { - if (gSaveContext.bottleTimerState[j] == BOTTLE_TIMER_STATE_COUNTING) { + if (gSaveContext.bottleTimerStates[j] == BOTTLE_TIMER_STATE_COUNTING) { gSaveContext.bottleTimerPausedOsTimes[j] += osTime - sBottleTimerPausedOsTime; } } @@ -5718,7 +5718,7 @@ void Interface_UpdateBottleTimers(PlayState* play) { sTimerId = TIMER_ID_NONE; for (i = BOTTLE_FIRST; i < BOTTLE_MAX; i++) { - if (gSaveContext.bottleTimerState[i] == BOTTLE_TIMER_STATE_COUNTING) { + if (gSaveContext.bottleTimerStates[i] == BOTTLE_TIMER_STATE_COUNTING) { osTime = osGetTime(); osTime = OSTIME_TO_TIMER_ALT(osTime - ((void)0, gSaveContext.bottleTimerPausedOsTimes[i]) - ((void)0, gSaveContext.bottleTimerStartOsTimes[i])); @@ -5737,7 +5737,7 @@ void Interface_UpdateBottleTimers(PlayState* play) { Inventory_UpdateItem(play, i + SLOT_BOTTLE_1, ITEM_SPRING_WATER); Message_StartTextbox(play, 0xFA, NULL); } - gSaveContext.bottleTimerState[i] = BOTTLE_TIMER_STATE_OFF; + gSaveContext.bottleTimerStates[i] = BOTTLE_TIMER_STATE_OFF; } } } @@ -6868,7 +6868,7 @@ void Interface_Init(PlayState* play) { gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] = SECONDS_TO_TIMER(0); gSaveContext.timerTimeLimits[TIMER_ID_MINIGAME_1] = SECONDS_TO_TIMER(0); gSaveContext.timerStartOsTimes[TIMER_ID_MINIGAME_1] = 0; - gSaveContext.timerEndOsTimes[TIMER_ID_MINIGAME_1] = 0; + gSaveContext.timerStopTimes[TIMER_ID_MINIGAME_1] = 0; gSaveContext.timerPausedOsTimes[TIMER_ID_MINIGAME_1] = 0; for (i = 0; i < TIMER_ID_MAX; i++) { diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 24c7ce5d6..37f1c1aa0 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -870,7 +870,7 @@ s32 Player_GetEnvTimerType(PlayState* play) { if (play->roomCtx.currRoom.unk2 == 3) { // Room is hot envTimerType = PLAYER_ENV_TIMER_HOTROOM - 1; - } else if ((player->transformation != PLAYER_FORM_ZORA) && (player->unk_AD8 > 80)) { + } else if ((player->transformation != PLAYER_FORM_ZORA) && (player->underwaterTimer > 80)) { envTimerType = PLAYER_ENV_TIMER_UNDERWATER_FREE - 1; } else if (player->stateFlags1 & PLAYER_STATE1_8000000) { if ((player->transformation == PLAYER_FORM_ZORA) && (player->currentBoots >= PLAYER_BOOTS_ZORA_UNDERWATER) && diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index 222b6c690..018cf12d7 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -899,7 +899,7 @@ void func_80144A94(SramContext* sramCtx) { gSaveContext.timerCurTimes[i] = SECONDS_TO_TIMER(0); gSaveContext.timerTimeLimits[i] = SECONDS_TO_TIMER(0); gSaveContext.timerStartOsTimes[i] = 0; - gSaveContext.timerEndOsTimes[i] = 0; + gSaveContext.timerStopTimes[i] = 0; gSaveContext.timerPausedOsTimes[i] = 0; } @@ -974,7 +974,7 @@ void Sram_OpenSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) { gSaveContext.timerCurTimes[i] = SECONDS_TO_TIMER(0); gSaveContext.timerTimeLimits[i] = SECONDS_TO_TIMER(0); gSaveContext.timerStartOsTimes[i] = 0; - gSaveContext.timerEndOsTimes[i] = 0; + gSaveContext.timerStopTimes[i] = 0; gSaveContext.timerPausedOsTimes[i] = 0; } 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 eaad41770..5d0a74e08 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c @@ -1045,11 +1045,11 @@ void DmStk_Init(Actor* thisx, PlayState* play) { if (gSaveContext.save.entrance == ENTRANCE(CLOCK_TOWER_ROOFTOP, 0)) { if (gSaveContext.sceneSetupIndex == 0) { - if (gSaveContext.timerStates[TIMER_ID_FINAL_HOURS] == TIMER_STATE_OFF) { + if (gSaveContext.timerStates[TIMER_ID_MOON_CRASH] == TIMER_STATE_OFF) { // Starts a 5 minute (300 second) timer until the moon falls. - Interface_StartTimer(TIMER_ID_FINAL_HOURS, 300); - R_FINAL_HOURS_TIMER_Y = 200; - R_FINAL_HOURS_TIMER_X = 115; + Interface_StartTimer(TIMER_ID_MOON_CRASH, 300); + R_MOON_CRASH_TIMER_Y = 200; + R_MOON_CRASH_TIMER_X = 115; } if (gSaveContext.save.inventory.items[SLOT_OCARINA] == ITEM_NONE) { @@ -1062,12 +1062,12 @@ void DmStk_Init(Actor* thisx, PlayState* play) { } else if (gSaveContext.sceneSetupIndex == 3) { this->animIndex = SK_ANIM_FLOATING_ARMS_CROSSED; - if (gSaveContext.timerStates[TIMER_ID_FINAL_HOURS] == TIMER_STATE_OFF) { + if (gSaveContext.timerStates[TIMER_ID_MOON_CRASH] == TIMER_STATE_OFF) { // This code is called when the Giants fail to stop the moon. // Starts a 1 minute (60 second) timer until the moon falls. - Interface_StartTimer(TIMER_ID_FINAL_HOURS, 60); - R_FINAL_HOURS_TIMER_Y = 200; - R_FINAL_HOURS_TIMER_X = 115; + Interface_StartTimer(TIMER_ID_MOON_CRASH, 60); + R_MOON_CRASH_TIMER_Y = 200; + R_MOON_CRASH_TIMER_X = 115; } this->actor.world.pos.y = 120.0f; diff --git a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c index 99521dc45..6909183f3 100644 --- a/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c +++ b/src/overlays/actors/ovl_En_Mm3/z_en_mm3.c @@ -395,7 +395,7 @@ void func_80A6FBFC(EnMm3* this, PlayState* play) { } } else if (gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] > SECONDS_TO_TIMER(15)) { gSaveContext.timerStates[TIMER_ID_POSTMAN] = TIMER_STATE_POSTMAN_STOP; - gSaveContext.timerOsTime = osGetTime(); + gSaveContext.postmanTimerStopOsTime = osGetTime(); } if (Actor_ProcessTalkRequest(&this->actor, &play->state)) { 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 50da0eb3b..852316b9b 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 @@ -1156,7 +1156,7 @@ void EnSyatekiMan_Swamp_AddBonusPoints(EnSyatekiMan* this, PlayState* play) { this->actionFunc = EnSyatekiMan_Swamp_EndGame; sBonusTimer = 0; } else if (sBonusTimer > 10) { - gSaveContext.timerEndOsTimes[TIMER_ID_MINIGAME_1] += 100; + gSaveContext.timerStopTimes[TIMER_ID_MINIGAME_1] += 100; play->interfaceCtx.unk_25C += 10; this->score += 10; Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); 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 c937f2d2d..0a013410b 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 @@ -90,7 +90,7 @@ void func_80AC9FE4(EnTimeTag* this, PlayState* play) { if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); this->actionFunc = func_80AC9FD4; - gSaveContext.timerStates[TIMER_ID_FINAL_HOURS] = TIMER_STATE_OFF; + gSaveContext.timerStates[TIMER_ID_MOON_CRASH] = TIMER_STATE_OFF; if (CHECK_QUEST_ITEM(QUEST_REMAINS_ODOWLA) && CHECK_QUEST_ITEM(QUEST_REMAINS_GOHT) && CHECK_QUEST_ITEM(QUEST_REMAINS_GYORG) && CHECK_QUEST_ITEM(QUEST_REMAINS_TWINMOLD)) { gSaveContext.save.weekEventReg[25] |= 2; @@ -107,7 +107,7 @@ void func_80ACA0A8(EnTimeTag* this, PlayState* play) { if (this->actor.cutscene != -1) { this->actionFunc = func_80AC9FE4; ActorCutscene_SetIntentToPlay(this2->actor.cutscene); - gSaveContext.timerStates[TIMER_ID_FINAL_HOURS] = TIMER_STATE_OFF; + gSaveContext.timerStates[TIMER_ID_MOON_CRASH] = TIMER_STATE_OFF; } play->msgCtx.ocarinaMode = 4; } diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 415c33f0e..e68e487aa 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -519,7 +519,7 @@ void MapSelect_UpdateMenu(MapSelectState* this) { gSaveContext.timerCurTimes[i] = 0; gSaveContext.timerTimeLimits[i] = SECONDS_TO_TIMER(0); gSaveContext.timerStartOsTimes[i] = 0; - gSaveContext.timerEndOsTimes[i] = 0; + gSaveContext.timerStopTimes[i] = 0; gSaveContext.timerPausedOsTimes[i] = 0; } gSaveContext.minigameState = 0;