sync with timers PR

This commit is contained in:
engineer124
2022-08-26 13:04:45 -04:00
parent dc7c5ec634
commit c330a7e015
19 changed files with 264 additions and 261 deletions
+12 -12
View File
@@ -88,7 +88,7 @@ typedef enum {
/* 4 */ TIMER_STATE_COUNTING,
/* 5 */ TIMER_STATE_STOP,
/* 6 */ TIMER_STATE_6, // like `TIMER_STATE_STOP` but with extra minigame checks
/* 7 */ TIMER_STATE_7, // stopped but still update `timerCurTime`
/* 7 */ TIMER_STATE_7, // stopped but still update `timerCurTimes`
/* 8 */ TIMER_STATE_ENV_START,
/* 9 */ TIMER_STATE_ALT_START,
/* 10 */ TIMER_STATE_10, // precursor to `TIMER_STATE_ALT_COUNTING`
@@ -294,10 +294,10 @@ typedef struct SaveContext {
/* 0x1016 */ u16 jinxTimer;
/* 0x1018 */ s16 rupeeAccumulator; // "lupy_udct"
/* 0x101A */ u8 bottleTimerState[BOTTLE_MAX]; // "bottle_status", one entry for each bottle
/* 0x1020 */ OSTime bottleTimerStartOsTime[BOTTLE_MAX]; // "bottle_ostime", one entry for each bottle
/* 0x1050 */ u64 bottleTimerCurTimeLimit[BOTTLE_MAX]; // "bottle_sub", one entry for each bottle
/* 0x1080 */ u64 bottleTimerCurTime[BOTTLE_MAX]; // "bottle_time", one entry for each bottle
/* 0x10B0 */ OSTime bottleTimerPausedOsTime[BOTTLE_MAX]; // "bottle_stop_time", 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
/* 0x10E0 */ u64 pictoPhoto[1400]; // buffer containing the pictograph photo
/* 0x3CA0 */ s32 fileNum; // "file_no"
/* 0x3CA4 */ s16 powderKegTimer; // "big_bom_timer"
@@ -317,13 +317,13 @@ typedef struct SaveContext {
/* 0x3DC0 */ s16 unk_3DC0; // "shield_magic_timer"
/* 0x3DC2 */ u8 unk_3DC2; // "pad1"
/* 0x3DC8 */ OSTime timerOsTime; // "get_time"
/* 0x3DD0 */ u8 timerState[TIMER_ID_MAX]; // "event_fg"
/* 0x3DD7 */ u8 timerDirection[TIMER_ID_MAX]; // "calc_flag"
/* 0x3DE0 */ u64 timerCurTime[TIMER_ID_MAX]; // "event_ostime"
/* 0x3E18 */ u64 timerTimeLimit[TIMER_ID_MAX]; // "event_sub"
/* 0x3E50 */ OSTime timerStartOsTime[TIMER_ID_MAX]; // "func_time"
/* 0x3E88 */ OSTime timerEndOsTime[TIMER_ID_MAX]; // "func_end_time"
/* 0x3EC0 */ OSTime timerPausedOsTime[TIMER_ID_MAX]; // "func_stop_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"
/* 0x3EF8 */ s16 timerX[TIMER_ID_MAX]; // "event_xp"
/* 0x3F06 */ s16 timerY[TIMER_ID_MAX]; // "event_yp"
/* 0x3F14 */ s16 unk_3F14; // "character_change"
+1 -1
View File
@@ -688,7 +688,7 @@ void Inventory_SetMapVisibility(s16 tingleIndex) {
void Inventory_SaveDekuPlaygroundHighScore(s16 timerId) {
s16 i;
gSaveContext.save.dekuPlaygroundHighScores[CURRENT_DAY - 1] = gSaveContext.timerCurTime[timerId];
gSaveContext.save.dekuPlaygroundHighScores[CURRENT_DAY - 1] = gSaveContext.timerCurTimes[timerId];
for (i = 0; i < 8; i++) {
gSaveContext.save.inventory.dekuPlaygroundPlayerName[CURRENT_DAY - 1][i] =
+1 -1
View File
@@ -25,7 +25,7 @@ void GameOver_Update(PlayState* play) {
func_801477B4(play);
for (timerId = 0; timerId < TIMER_ID_MAX; timerId++) {
gSaveContext.timerState[timerId] = TIMER_STATE_OFF;
gSaveContext.timerStates[timerId] = TIMER_STATE_OFF;
}
gSaveContext.eventInf[1] &= ~1;
+150 -148
View File
File diff suppressed because it is too large Load Diff
+14 -14
View File
@@ -894,13 +894,13 @@ void func_80144A94(SramContext* sramCtx) {
gSaveContext.cycleSceneFlags[i].collectible = gSaveContext.save.permanentSceneFlags[i].collectible;
}
for (i = 0; i < ARRAY_COUNT(gSaveContext.timerState); i++) {
gSaveContext.timerState[i] = TIMER_STATE_OFF;
gSaveContext.timerCurTime[i] = SECONDS_TO_TIMER(0);
gSaveContext.timerTimeLimit[i] = SECONDS_TO_TIMER(0);
gSaveContext.timerStartOsTime[i] = 0;
gSaveContext.timerEndOsTime[i] = 0;
gSaveContext.timerPausedOsTime[i] = 0;
for (i = 0; i < ARRAY_COUNT(gSaveContext.timerStates); i++) {
gSaveContext.timerStates[i] = TIMER_STATE_OFF;
gSaveContext.timerCurTimes[i] = SECONDS_TO_TIMER(0);
gSaveContext.timerTimeLimits[i] = SECONDS_TO_TIMER(0);
gSaveContext.timerStartOsTimes[i] = 0;
gSaveContext.timerEndOsTimes[i] = 0;
gSaveContext.timerPausedOsTimes[i] = 0;
}
D_801BDAA0 = 1;
@@ -969,13 +969,13 @@ void Sram_OpenSave(FileChooseContext* fileChooseCtx, SramContext* sramCtx) {
gSaveContext.cycleSceneFlags[i].collectible = gSaveContext.save.permanentSceneFlags[i].collectible;
}
for (i = 0; i < ARRAY_COUNT(gSaveContext.timerState); i++) {
gSaveContext.timerState[i] = TIMER_STATE_OFF;
gSaveContext.timerCurTime[i] = SECONDS_TO_TIMER(0);
gSaveContext.timerTimeLimit[i] = SECONDS_TO_TIMER(0);
gSaveContext.timerStartOsTime[i] = 0;
gSaveContext.timerEndOsTime[i] = 0;
gSaveContext.timerPausedOsTime[i] = 0;
for (i = 0; i < ARRAY_COUNT(gSaveContext.timerStates); i++) {
gSaveContext.timerStates[i] = TIMER_STATE_OFF;
gSaveContext.timerCurTimes[i] = SECONDS_TO_TIMER(0);
gSaveContext.timerTimeLimits[i] = SECONDS_TO_TIMER(0);
gSaveContext.timerStartOsTimes[i] = 0;
gSaveContext.timerEndOsTimes[i] = 0;
gSaveContext.timerPausedOsTimes[i] = 0;
}
if (gSaveContext.save.isFirstCycle) {
+2 -2
View File
@@ -1045,7 +1045,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) {
if (gSaveContext.save.entrance == ENTRANCE(CLOCK_TOWER_ROOFTOP, 0)) {
if (gSaveContext.sceneSetupIndex == 0) {
if (gSaveContext.timerState[TIMER_ID_FINAL_HOURS] == TIMER_STATE_OFF) {
if (gSaveContext.timerStates[TIMER_ID_FINAL_HOURS] == 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;
@@ -1062,7 +1062,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) {
} else if (gSaveContext.sceneSetupIndex == 3) {
this->animIndex = SK_ANIM_FLOATING_ARMS_CROSSED;
if (gSaveContext.timerState[TIMER_ID_FINAL_HOURS] == TIMER_STATE_OFF) {
if (gSaveContext.timerStates[TIMER_ID_FINAL_HOURS] == 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);
+2 -2
View File
@@ -216,7 +216,7 @@ void EnDno_Init(Actor* thisx, PlayState* play) {
} else {
SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 14, &this->unk_32C);
thisx->room = -1;
gSaveContext.timerState[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo);
this->unk_3B0 |= 1;
this->actionFunc = func_80A72438;
@@ -817,7 +817,7 @@ void func_80A73244(EnDno* this, PlayState* play) {
this->unk_328 = 2;
this->actor.speedXZ = 0.0f;
Flags_UnsetSwitch(play, ENDNO_GET_3F80(&this->actor));
gSaveContext.timerState[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
this->unk_44E = 0;
this->actionFunc = func_80A732C8;
}
+9 -9
View File
@@ -401,7 +401,7 @@ void func_80962340(EnFu* this, PlayState* play) {
Message_StartTextbox(play, 0x287E, &this->actor);
this->unk_552 = 0x287E;
}
} else if ((gSaveContext.timerCurTime[TIMER_ID_MINIGAME_2] == SECONDS_TO_TIMER(0)) &&
} else if ((gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] == SECONDS_TO_TIMER(0)) &&
(this->unk_552 != 0x2888)) {
Message_StartTextbox(play, 0x2886, &this->actor);
this->unk_552 = 0x2886;
@@ -762,11 +762,11 @@ void func_80962F4C(EnFu* this, PlayState* play) {
break;
}
if (gSaveContext.timerCurTime[TIMER_ID_MINIGAME_2] < SECONDS_TO_TIMER(20)) {
if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] < SECONDS_TO_TIMER(20)) {
s16 val = D_80964B00[this->unk_542] + 200;
Math_SmoothStepToS(&fuKaiten->rotationSpeed, val, 10, 5, 5);
} else if (gSaveContext.timerCurTime[TIMER_ID_MINIGAME_2] < SECONDS_TO_TIMER(40)) {
} else if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] < SECONDS_TO_TIMER(40)) {
s16 val = D_80964B00[this->unk_542] + 100;
Math_SmoothStepToS(&fuKaiten->rotationSpeed, val, 10, 5, 5);
@@ -778,12 +778,12 @@ void func_80962F4C(EnFu* this, PlayState* play) {
if ((!DynaPolyActor_IsInRidingRotatingState((DynaPolyActor*)this->actor.child) &&
(player->actor.bgCheckFlags & 1)) ||
(gSaveContext.timerCurTime[TIMER_ID_MINIGAME_2] <= SECONDS_TO_TIMER(0)) || (this->unk_548 == this->unk_54C)) {
(gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] <= SECONDS_TO_TIMER(0)) || (this->unk_548 == this->unk_54C)) {
player->stateFlags3 &= ~0x400000;
func_80961E88(play);
player->stateFlags1 |= 0x20;
if (this->unk_548 < this->unk_54C) {
if (gSaveContext.timerCurTime[TIMER_ID_MINIGAME_2] == SECONDS_TO_TIMER(0)) {
if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] == SECONDS_TO_TIMER(0)) {
Message_StartTextbox(play, 0x2885, &this->actor);
this->unk_552 = 0x2885;
} else {
@@ -791,15 +791,15 @@ void func_80962F4C(EnFu* this, PlayState* play) {
this->unk_552 = 0x2888;
}
func_801A2C20();
gSaveContext.timerCurTime[TIMER_ID_MINIGAME_2] = SECONDS_TO_TIMER(0);
gSaveContext.timerState[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP;
gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] = SECONDS_TO_TIMER(0);
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP;
this->unk_548 = 0;
func_809632D0(this);
} else {
this->unk_548 = 0;
func_801A2C20();
gSaveContext.timerCurTime[TIMER_ID_MINIGAME_2] = SECONDS_TO_TIMER(0);
gSaveContext.timerState[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP;
gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] = SECONDS_TO_TIMER(0);
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP;
func_801A3098(NA_BGM_GET_ITEM | 0x900);
Interface_SetPerfectMinigame(play, 1);
this->unk_54A = 3;
+4 -4
View File
@@ -487,7 +487,7 @@ void func_80B10344(EnGb2* this, PlayState* play) {
if (this->unk_26C & 0x200) {
if (this->unk_280 == 3) {
this->unk_26C &= ~0x200;
gSaveContext.timerState[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
func_800FE498();
gSaveContext.eventInf[4] |= 0x40;
func_80B0FE7C(play);
@@ -506,7 +506,7 @@ void func_80B10344(EnGb2* this, PlayState* play) {
}
if (gSaveContext.save.playerData.health < 49) {
gSaveContext.timerState[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
gSaveContext.eventInf[4] |= 0x40;
gSaveContext.eventInf[4] |= 0x20;
@@ -519,8 +519,8 @@ void func_80B10344(EnGb2* this, PlayState* play) {
}
func_80B0FE7C(play);
} else if (gSaveContext.timerCurTime[TIMER_ID_MINIGAME_1] == SECONDS_TO_TIMER(0)) {
gSaveContext.timerState[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
} else if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] == SECONDS_TO_TIMER(0)) {
gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
gSaveContext.eventInf[4] |= 0x40;
gSaveContext.eventInf[4] |= 0x10;
@@ -145,7 +145,7 @@ s32 func_808F8CCC(EnHorseGameCheck* this, PlayState* play2) {
}
s32 func_808F8E94(EnHorseGameCheck* this, PlayState* play) {
gSaveContext.timerState[TIMER_ID_MINIGAME_2] = TIMER_STATE_OFF;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_OFF;
return true;
}
@@ -247,11 +247,11 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) {
return true;
}
if (gSaveContext.timerCurTime[TIMER_ID_MINIGAME_2] >= SECONDS_TO_TIMER(180)) {
if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] >= SECONDS_TO_TIMER(180)) {
Audio_QueueSeqCmd(0x8041);
play_sound(NA_SE_SY_START_SHOT);
this->unk_164 |= 0x40000;
gSaveContext.timerState[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
SET_RACE_FLAGS(RACE_FLAG_4);
this->unk_174 = 60;
}
@@ -284,7 +284,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) {
Audio_QueueSeqCmd(0x8041);
play_sound(NA_SE_SY_START_SHOT);
this->unk_164 |= 0x40000;
gSaveContext.timerState[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
SET_RACE_FLAGS(RACE_FLAG_3);
this->unk_174 = 60;
}
@@ -317,7 +317,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) {
Audio_QueueSeqCmd(0x8041);
play_sound(NA_SE_SY_START_SHOT);
this->unk_164 |= 0x02000000;
gSaveContext.timerState[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
SET_RACE_FLAGS(RACE_FLAG_3);
this->unk_174 = 60;
}
@@ -346,7 +346,7 @@ s32 func_808F8FAC(EnHorseGameCheck* this, PlayState* play) {
Audio_QueueSeqCmd(0x8041);
play_sound(NA_SE_SY_START_SHOT);
this->unk_164 |= 0x800;
gSaveContext.timerState[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
SET_RACE_FLAGS(RACE_FLAG_2);
this->unk_174 = 60;
}
@@ -155,7 +155,7 @@ void func_80C13BB8(EnJgameTsn* this, PlayState* play) {
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
if (this->actor.flags & ACTOR_FLAG_10000) {
this->actor.flags &= ~ACTOR_FLAG_10000;
if (gSaveContext.timerCurTime[TIMER_ID_MINIGAME_2] > SECONDS_TO_TIMER(0)) {
if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] > SECONDS_TO_TIMER(0)) {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1);
Message_StartTextbox(play, 0x10A2, &this->actor);
this->unk_300 = 0x10A2;
@@ -352,7 +352,7 @@ void func_80C14230(EnJgameTsn* this, PlayState* play) {
func_80C14030(this);
}
if (gSaveContext.timerCurTime[TIMER_ID_MINIGAME_2] == SECONDS_TO_TIMER(0)) {
if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] == SECONDS_TO_TIMER(0)) {
Message_StartTextbox(play, 0x10A1, &this->actor);
this->unk_300 = 0x10A1;
player->stateFlags1 |= 0x20;
@@ -479,7 +479,7 @@ void func_80C147B4(EnJgameTsn* this, PlayState* play) {
case 0x10A1:
func_801477B4(play);
gSaveContext.minigameState = 3;
gSaveContext.timerState[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP;
gSaveContext.save.weekEventReg[90] &= (u8)~0x20;
func_80C144E4(this);
break;
+9 -9
View File
@@ -674,7 +674,7 @@ void EnMa4_HorsebackGameCheckPlayerInteractions(EnMa4* this, PlayState* play) {
// "You're feeling confident"
Message_StartTextbox(play, 0x336E, &this->actor);
this->actionFunc = EnMa4_HorsebackGameTalking;
} else if (gSaveContext.timerCurTime[TIMER_ID_MINIGAME_2] < SECONDS_TO_TIMER(115)) {
} else if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] < SECONDS_TO_TIMER(115)) {
func_800B8614(&this->actor, play, 100.0f);
}
}
@@ -717,9 +717,9 @@ void EnMa4_HorsebackGameWait(EnMa4* this, PlayState* play) {
play->interfaceCtx.unk_25C = 1;
}
if ((gSaveContext.timerCurTime[TIMER_ID_MINIGAME_2] >= SECONDS_TO_TIMER(120)) ||
if ((gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] >= SECONDS_TO_TIMER(120)) ||
(this->poppedBalloonCounter == 10)) {
gSaveContext.timerState[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
EnMa4_SetupHorsebackGameEnd(this, play);
D_80AC0258 = 0;
}
@@ -898,13 +898,13 @@ void EnMa4_StartDialogue(EnMa4* this, PlayState* play) {
gSaveContext.save.weekEventReg[21] |= 0x40;
}
} else if (this->state == MA4_STATE_AFTERHORSEBACKGAME) {
if (gSaveContext.timerCurTime[TIMER_ID_MINIGAME_2] >= SECONDS_TO_TIMER(120)) {
if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] >= SECONDS_TO_TIMER(120)) {
// "Too bad Grasshopper"
EnMa4_SetFaceExpression(this, 0, 0);
Message_StartTextbox(play, 0x336D, &this->actor);
this->textId = 0x336D;
} else {
time = gSaveContext.timerCurTime[TIMER_ID_MINIGAME_2];
time = gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2];
if ((s32)time < (s32)gSaveContext.save.horseBackBalloonHighScore) {
// [Score] New record!
gSaveContext.save.horseBackBalloonHighScore = time;
@@ -943,12 +943,12 @@ void EnMa4_StartDialogue(EnMa4* this, PlayState* play) {
Message_StartTextbox(play, 0x3354, &this->actor);
this->textId = 0x3354;
} else if (this->state == MA4_STATE_AFTERHORSEBACKGAME) {
if (gSaveContext.timerCurTime[TIMER_ID_MINIGAME_2] >= SECONDS_TO_TIMER(120)) {
if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] >= SECONDS_TO_TIMER(120)) {
// "Try again?"
Message_StartTextbox(play, 0x3356, &this->actor);
this->textId = 0x3356;
} else {
time = gSaveContext.timerCurTime[TIMER_ID_MINIGAME_2];
time = gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2];
if ((s32)time < (s32)gSaveContext.save.horseBackBalloonHighScore) {
gSaveContext.save.horseBackBalloonHighScore = time;
EnMa4_SetFaceExpression(this, 0, 3);
@@ -970,12 +970,12 @@ void EnMa4_StartDialogue(EnMa4* this, PlayState* play) {
Message_StartTextbox(play, 0x3358, &this->actor);
this->textId = 0x3358;
} else if (this->state == MA4_STATE_AFTERHORSEBACKGAME) {
if (gSaveContext.timerCurTime[TIMER_ID_MINIGAME_2] >= SECONDS_TO_TIMER(120)) {
if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] >= SECONDS_TO_TIMER(120)) {
// "Try again?"
Message_StartTextbox(play, 0x3356, &this->actor);
this->textId = 0x3356;
} else {
time = gSaveContext.timerCurTime[TIMER_ID_MINIGAME_2];
time = gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2];
if ((s32)time < (s32)gSaveContext.save.horseBackBalloonHighScore) {
// New record
gSaveContext.save.horseBackBalloonHighScore = time;
+14 -14
View File
@@ -249,14 +249,14 @@ void func_80A6F5E4(EnMm3* this, PlayState* play) {
break;
case 0x2791:
if (gSaveContext.timerCurTime[TIMER_ID_POSTMAN] == SECONDS_TO_TIMER(10)) {
if (gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] == SECONDS_TO_TIMER(10)) {
Message_StartTextbox(play, 0x2792, &this->actor);
this->unk_2B4 = 0x2792;
} else if ((gSaveContext.timerCurTime[TIMER_ID_POSTMAN] >= SECONDS_TO_TIMER(15))) {
} else if ((gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] >= SECONDS_TO_TIMER(15))) {
Message_StartTextbox(play, 0x2797, &this->actor);
this->unk_2B4 = 0x2797;
} else if ((gSaveContext.timerCurTime[TIMER_ID_POSTMAN] <= SECONDS_TO_TIMER_PRECISE(10, 50)) &&
(gSaveContext.timerCurTime[TIMER_ID_POSTMAN] >= SECONDS_TO_TIMER_PRECISE(9, 50))) {
} else if ((gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] <= SECONDS_TO_TIMER_PRECISE(10, 50)) &&
(gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] >= SECONDS_TO_TIMER_PRECISE(9, 50))) {
Message_StartTextbox(play, 0x2795, &this->actor);
this->unk_2B4 = 0x2795;
} else {
@@ -302,7 +302,7 @@ void func_80A6F5E4(EnMm3* this, PlayState* play) {
} else if ((this->unk_2AC > 0) && (this->unk_2B4 == 0x2791)) {
this->unk_2AC--;
if (this->unk_2AC == 0) {
if (gSaveContext.timerCurTime[TIMER_ID_POSTMAN] == SECONDS_TO_TIMER(10)) {
if (gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] == SECONDS_TO_TIMER(10)) {
func_801A3098(0x922);
} else {
play_sound(NA_SE_SY_ERROR);
@@ -382,19 +382,19 @@ void func_80A6FBA0(EnMm3* this) {
void func_80A6FBFC(EnMm3* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if (gSaveContext.timerState[TIMER_ID_POSTMAN] == TIMER_STATE_POSTMAN_END) {
if (gSaveContext.timerStates[TIMER_ID_POSTMAN] == TIMER_STATE_POSTMAN_END) {
player->stateFlags1 &= ~0x20;
this->actor.flags |= ACTOR_FLAG_10000;
if (gSaveContext.timerCurTime[TIMER_ID_POSTMAN] > SECONDS_TO_TIMER(15)) {
gSaveContext.timerCurTime[TIMER_ID_POSTMAN] = SECONDS_TO_TIMER(15);
} else if ((((void)0, gSaveContext.timerCurTime[TIMER_ID_POSTMAN]) >=
if (gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] > SECONDS_TO_TIMER(15)) {
gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] = SECONDS_TO_TIMER(15);
} else if ((((void)0, gSaveContext.timerCurTimes[TIMER_ID_POSTMAN]) >=
(OSTime)(SECONDS_TO_TIMER_PRECISE(10, -5) - XREG(16))) &&
(((void)0, gSaveContext.timerCurTime[TIMER_ID_POSTMAN]) <=
(((void)0, gSaveContext.timerCurTimes[TIMER_ID_POSTMAN]) <=
(OSTime)(SECONDS_TO_TIMER_PRECISE(10, 5) + XREG(17)))) {
gSaveContext.timerCurTime[TIMER_ID_POSTMAN] = SECONDS_TO_TIMER(10);
gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] = SECONDS_TO_TIMER(10);
}
} else if (gSaveContext.timerCurTime[TIMER_ID_POSTMAN] > SECONDS_TO_TIMER(15)) {
gSaveContext.timerState[TIMER_ID_POSTMAN] = TIMER_STATE_POSTMAN_STOP;
} else if (gSaveContext.timerCurTimes[TIMER_ID_POSTMAN] > SECONDS_TO_TIMER(15)) {
gSaveContext.timerStates[TIMER_ID_POSTMAN] = TIMER_STATE_POSTMAN_STOP;
gSaveContext.timerOsTime = osGetTime();
}
@@ -404,7 +404,7 @@ void func_80A6FBFC(EnMm3* this, PlayState* play) {
Message_StartTextbox(play, 0x2791, &this->actor);
this->unk_2B4 = 0x2791;
this->unk_2AC = 7;
gSaveContext.timerState[TIMER_ID_POSTMAN] = TIMER_STATE_OFF;
gSaveContext.timerStates[TIMER_ID_POSTMAN] = TIMER_STATE_OFF;
this->actor.flags &= ~ACTOR_FLAG_10000;
play_sound(NA_SE_SY_START_SHOT);
func_80A6F9C8(this);
@@ -253,7 +253,7 @@ s32 EnMttag_ExitRace(PlayState* play, s32 transitionType, s32 nextTransitionType
* Displays the text which says that the player has made a false start.
*/
void EnMttag_ShowFalseStartMessage(EnMttag* this, PlayState* play) {
gSaveContext.timerState[TIMER_ID_MINIGAME_2] = TIMER_STATE_OFF;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_OFF;
Message_StartTextbox(play, 0xE95, NULL); // An entrant made a false start
func_800B7298(play, &this->actor, 7);
Audio_QueueSeqCmd(0x101400FF);
@@ -359,14 +359,14 @@ void EnMttag_Race(EnMttag* this, PlayState* play) {
s32 playerCheatStatus;
if (EnMttag_IsInFinishLine(playerPos)) {
gSaveContext.timerState[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
play_sound(NA_SE_SY_START_SHOT);
Audio_QueueSeqCmd(NA_BGM_GORON_GOAL | 0x8000);
this->timer = 55;
gSaveContext.eventInf[1] |= 2;
this->actionFunc = EnMttag_RaceFinish;
} else if (EnMttag_IsAnyRaceGoronOverFinishLine(this)) {
gSaveContext.timerState[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
play_sound(NA_SE_SY_START_SHOT);
Audio_QueueSeqCmd(NA_BGM_GORON_GOAL | 0x8000);
this->timer = 55;
@@ -457,7 +457,7 @@ void EnMttag_HandleCantWinChoice(EnMttag* this, PlayState* play) {
if (play->msgCtx.choiceIndex != 0) {
// Exit the race
func_8019F230();
gSaveContext.timerState[TIMER_ID_MINIGAME_2] = TIMER_STATE_OFF;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_OFF;
EnMttag_ExitRace(play, TRANS_TYPE_02, TRANS_TYPE_02);
gSaveContext.eventInf[1] &= (u8)~8;
gSaveContext.eventInf[1] |= 4;
@@ -503,8 +503,8 @@ void EnMttag_Init(Actor* thisx, PlayState* play) {
void EnMttag_Destroy(Actor* thisx, PlayState* play) {
EnMttag* this = THIS;
if (gSaveContext.timerState[TIMER_ID_MINIGAME_2] != TIMER_STATE_6) {
gSaveContext.timerState[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP;
if (gSaveContext.timerStates[TIMER_ID_MINIGAME_2] != TIMER_STATE_6) {
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP;
}
}
@@ -271,7 +271,7 @@ void func_80A2C2E0(EnSyatekiDekunuts* this, PlayState* play) {
void func_80A2C33C(EnSyatekiDekunuts* this, PlayState* play) {
EnSyatekiMan* syatekiMan = (EnSyatekiMan*)this->actor.parent;
if ((gSaveContext.timerCurTime[TIMER_ID_MINIGAME_1] <= SECONDS_TO_TIMER(0)) ||
if ((gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] <= SECONDS_TO_TIMER(0)) ||
(syatekiMan->shootingGameState != SG_GAME_STATE_RUNNING)) {
func_80A2C3AC(this);
}
@@ -1061,9 +1061,9 @@ void EnSyatekiMan_Swamp_RunGame(EnSyatekiMan* this, PlayState* play) {
this->perGameVar1.guaySpawnTimer++;
if (gSaveContext.timerCurTime[TIMER_ID_MINIGAME_1] == SECONDS_TO_TIMER(0)) {
gSaveContext.timerCurTime[TIMER_ID_MINIGAME_1] = SECONDS_TO_TIMER(0);
gSaveContext.timerState[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] == SECONDS_TO_TIMER(0)) {
gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] = SECONDS_TO_TIMER(0);
gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
this->actor.draw = EnSyatekiMan_Draw;
this->flagsIndex = 0;
this->currentWave = 0;
@@ -1082,10 +1082,10 @@ void EnSyatekiMan_Swamp_RunGame(EnSyatekiMan* this, PlayState* play) {
this->shootingGameState = SG_GAME_STATE_GIVING_BONUS;
if (this->score == 2120) {
Interface_SetPerfectMinigame(play, 2);
gSaveContext.timerState[TIMER_ID_MINIGAME_1] = TIMER_STATE_6;
gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_6;
this->actionFunc = EnSyatekiMan_Swamp_AddBonusPoints;
} else {
gSaveContext.timerState[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
this->actionFunc = EnSyatekiMan_Swamp_EndGame;
}
}
@@ -1148,15 +1148,15 @@ void EnSyatekiMan_Swamp_AddBonusPoints(EnSyatekiMan* this, PlayState* play) {
player->stateFlags1 |= 0x20;
if (!play->interfaceCtx.isMinigamePerfect) {
if (gSaveContext.timerCurTime[TIMER_ID_MINIGAME_1] == SECONDS_TO_TIMER(0)) {
gSaveContext.timerCurTime[TIMER_ID_MINIGAME_1] = SECONDS_TO_TIMER(0);
gSaveContext.timerState[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] == SECONDS_TO_TIMER(0)) {
gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] = SECONDS_TO_TIMER(0);
gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
this->flagsIndex = 0;
this->currentWave = 0;
this->actionFunc = EnSyatekiMan_Swamp_EndGame;
sBonusTimer = 0;
} else if (sBonusTimer > 10) {
gSaveContext.timerEndOsTime[TIMER_ID_MINIGAME_1] += 100;
gSaveContext.timerEndOsTimes[TIMER_ID_MINIGAME_1] += 100;
play->interfaceCtx.unk_25C += 10;
this->score += 10;
Actor_PlaySfxAtPos(&this->actor, NA_SE_SY_TRE_BOX_APPEAR);
@@ -1292,7 +1292,8 @@ static const s32 sOctorokFlagsPerWave[] = {
void EnSyatekiMan_Town_RunGame(EnSyatekiMan* this, PlayState* play) {
static s32 sModFromLosingTime = 0;
Player* player = GET_PLAYER(play);
s32 timer = (((void)0, gSaveContext.timerCurTime[TIMER_ID_MINIGAME_1]) * 0.1f) + 1.0f; // unit is tenths of a second
s32 timer =
(((void)0, gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1]) * 0.1f) + 1.0f; // unit is tenths of a second
if (timer <= 750) {
s32 waveTimer; // unit is hundredths of a second
@@ -1302,9 +1303,9 @@ void EnSyatekiMan_Town_RunGame(EnSyatekiMan* this, PlayState* play) {
// begin hiding. This code will ultimately correct waveTimer such that its value is not affected by
// hitting Blue Octoroks.
if (sModFromLosingTime == 0) {
waveTimer = ((void)0, gSaveContext.timerCurTime[TIMER_ID_MINIGAME_1]) % SECONDS_TO_TIMER(5);
waveTimer = ((void)0, gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1]) % SECONDS_TO_TIMER(5);
} else {
waveTimer = (((void)0, gSaveContext.timerCurTime[TIMER_ID_MINIGAME_1]) + SECONDS_TO_TIMER_PRECISE(2, 50)) %
waveTimer = (((void)0, gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1]) + SECONDS_TO_TIMER_PRECISE(2, 50)) %
SECONDS_TO_TIMER(5);
}
@@ -1315,7 +1316,7 @@ void EnSyatekiMan_Town_RunGame(EnSyatekiMan* this, PlayState* play) {
if (this->perGameVar2.octorokHitType != SG_OCTO_HIT_TYPE_NONE) {
if (this->perGameVar2.octorokHitType == SG_OCTO_HIT_TYPE_BLUE) {
gSaveContext.timerTimeLimit[TIMER_ID_MINIGAME_1] -= SECONDS_TO_TIMER_PRECISE(2, 50);
gSaveContext.timerTimeLimits[TIMER_ID_MINIGAME_1] -= SECONDS_TO_TIMER_PRECISE(2, 50);
sModFromLosingTime = (sModFromLosingTime + 25) % 50;
}
@@ -1337,11 +1338,11 @@ void EnSyatekiMan_Town_RunGame(EnSyatekiMan* this, PlayState* play) {
}
}
if (gSaveContext.timerCurTime[TIMER_ID_MINIGAME_1] == SECONDS_TO_TIMER(0)) {
if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] == SECONDS_TO_TIMER(0)) {
this->flagsIndex = 0;
this->perGameVar1.octorokState = SG_OCTO_STATE_HIDING;
gSaveContext.timerCurTime[TIMER_ID_MINIGAME_1] = SECONDS_TO_TIMER(0);
gSaveContext.timerState[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_1] = SECONDS_TO_TIMER(0);
gSaveContext.timerStates[TIMER_ID_MINIGAME_1] = TIMER_STATE_STOP;
player->stateFlags1 |= 0x20;
sModFromLosingTime = 0;
this->actor.draw = EnSyatekiMan_Draw;
@@ -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.timerState[TIMER_ID_FINAL_HOURS] = TIMER_STATE_OFF;
gSaveContext.timerStates[TIMER_ID_FINAL_HOURS] = 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.timerState[TIMER_ID_FINAL_HOURS] = TIMER_STATE_OFF;
gSaveContext.timerStates[TIMER_ID_FINAL_HOURS] = TIMER_STATE_OFF;
}
play->msgCtx.ocarinaMode = 4;
}
@@ -45,8 +45,8 @@ void ObjRoomtimer_Init(Actor* thisx, PlayState* play) {
void ObjRoomtimer_Destroy(Actor* thisx, PlayState* play) {
ObjRoomtimer* this = THIS;
if (this->actor.params != 0x1FF && gSaveContext.timerState[TIMER_ID_MINIGAME_2] >= TIMER_STATE_START) {
gSaveContext.timerState[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP;
if (this->actor.params != 0x1FF && gSaveContext.timerStates[TIMER_ID_MINIGAME_2] >= TIMER_STATE_START) {
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP;
}
}
@@ -62,11 +62,11 @@ void func_80973CD8(ObjRoomtimer* this, PlayState* play) {
void func_80973D3C(ObjRoomtimer* this, PlayState* play) {
if (Flags_GetClearTemp(play, this->actor.room)) {
if (this->actor.params != 0x1FF) {
gSaveContext.timerState[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP;
gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP;
}
ActorCutscene_SetIntentToPlay(this->actor.cutscene);
this->actionFunc = func_80973DE0;
} else if (this->actor.params != 0x1FF && gSaveContext.timerState[TIMER_ID_MINIGAME_2] == TIMER_STATE_OFF) {
} else if (this->actor.params != 0x1FF && gSaveContext.timerStates[TIMER_ID_MINIGAME_2] == TIMER_STATE_OFF) {
play_sound(NA_SE_OC_ABYSS);
func_80169EFC(&play->state);
Actor_MarkForDeath(&this->actor);
@@ -514,13 +514,13 @@ void MapSelect_UpdateMenu(MapSelectState* this) {
if (this->verticalInputAccumulator == 0) {
if (CHECK_BTN_ALL(controller1->press.button, BTN_A) || CHECK_BTN_ALL(controller1->press.button, BTN_START)) {
for (i = 0; i < ARRAY_COUNT(gSaveContext.timerPausedOsTime); i++) {
gSaveContext.timerState[i] = TIMER_STATE_OFF;
gSaveContext.timerCurTime[i] = 0;
gSaveContext.timerTimeLimit[i] = SECONDS_TO_TIMER(0);
gSaveContext.timerStartOsTime[i] = 0;
gSaveContext.timerEndOsTime[i] = 0;
gSaveContext.timerPausedOsTime[i] = 0;
for (i = 0; i < ARRAY_COUNT(gSaveContext.timerPausedOsTimes); i++) {
gSaveContext.timerStates[i] = TIMER_STATE_OFF;
gSaveContext.timerCurTimes[i] = 0;
gSaveContext.timerTimeLimits[i] = SECONDS_TO_TIMER(0);
gSaveContext.timerStartOsTimes[i] = 0;
gSaveContext.timerEndOsTimes[i] = 0;
gSaveContext.timerPausedOsTimes[i] = 0;
}
gSaveContext.minigameState = 0;