1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-03 06:24:30 +00:00

Document Timers (#1412)

* Document Timers, First Draft

* some progress

* more timer docs

* cleanup

* small cleanup

* more cleanup

* comments

* more cleanup

* extra comment

* more docs

* brackets

* PR Suggestions

* cleanup, missed some

* more suggestions

* more PR Suggestions

* small change

* environmental
This commit is contained in:
engineer124 2022-11-16 13:41:27 -05:00 committed by GitHub
parent cc2409606e
commit 40639e698d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 550 additions and 435 deletions

View file

@ -226,8 +226,8 @@ void BgPoEvent_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyTris(play, &this->collider);
} else {
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
if ((this->type == 1) && (gSaveContext.timer1Value > 0)) {
gSaveContext.timer1State = 0xA;
if ((this->type == 1) && (gSaveContext.timerSeconds > 0)) {
gSaveContext.timerState = TIMER_STATE_STOP;
}
}
}
@ -316,7 +316,7 @@ void BgPoEvent_BlockFall(BgPoEvent* this, PlayState* play) {
} else {
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_STONE_BOUND);
Actor_RequestQuakeAndRumble(&this->dyna.actor, play, 5, 5);
func_80088B34(this->timer);
Interface_SetTimer(this->timer);
if (firstFall == 0) {
firstFall = 1;
} else {
@ -342,10 +342,10 @@ void BgPoEvent_BlockIdle(BgPoEvent* this, PlayState* play) {
OnePointCutscene_Init(play, 3170, 30, amy, CAM_ID_MAIN);
}
func_80078884(NA_SE_SY_CORRECT_CHIME);
gSaveContext.timer1State = 0xA;
gSaveContext.timerState = TIMER_STATE_STOP;
}
} else {
if ((gSaveContext.timer1Value == 0) && (sBlocksAtRest == 5)) {
if ((gSaveContext.timerSeconds == 0) && (sBlocksAtRest == 5)) {
player->stateFlags2 &= ~PLAYER_STATE2_4;
sPuzzleState = 0x10;
sBlocksAtRest = 0;

View file

@ -156,7 +156,7 @@ void func_808A9234(BgRelayObjects* this, PlayState* play) {
Flags_UnsetSwitch(play, this->switchFlag);
this->dyna.actor.flags &= ~ACTOR_FLAG_4;
if (play->roomCtx.curRoom.num == 4) {
gSaveContext.timer1State = 0xF;
gSaveContext.timerState = TIMER_STATE_UP_FREEZE;
}
this->actionFunc = BgRelayObjects_DoNothing;
}

View file

@ -823,7 +823,7 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, PlayState* play) {
this->unk_150[i].unk_22++;
}
} else if (i + 1 == this->sparkleCounter && play->csCtx.state == CS_STATE_IDLE) {
func_80088AF0(play);
Interface_SetSubTimerToFinalSecond(play);
Actor_Kill(&this->actor);
}
break;

View file

@ -103,7 +103,7 @@ void EnDivingGame_Destroy(Actor* thisx, PlayState* play) {
EnDivingGame* this = (EnDivingGame*)thisx;
if (this->unk_31F == 0) {
gSaveContext.timer1State = 0;
gSaveContext.timerState = TIMER_STATE_OFF;
}
Collider_DestroyCylinder(play, &this->collider);
}
@ -125,9 +125,9 @@ void EnDivingGame_SpawnRuppy(EnDivingGame* this, PlayState* play) {
}
s32 EnDivingGame_HasMinigameFinished(EnDivingGame* this, PlayState* play) {
if (gSaveContext.timer1State == 10 && !Play_InCsMode(play)) {
if ((gSaveContext.timerState == TIMER_STATE_STOP) && !Play_InCsMode(play)) {
// Failed.
gSaveContext.timer1State = 0;
gSaveContext.timerState = TIMER_STATE_OFF;
func_800F5B58();
func_80078884(NA_SE_SY_FOUND);
this->actor.textId = 0x71AD;
@ -145,7 +145,7 @@ s32 EnDivingGame_HasMinigameFinished(EnDivingGame* this, PlayState* play) {
}
if (this->grabbedRupeesCounter >= rupeesNeeded) {
// Won.
gSaveContext.timer1State = 0;
gSaveContext.timerState = TIMER_STATE_OFF;
this->allRupeesThrown = this->state = this->phase = this->unk_2A2 = this->grabbedRupeesCounter = 0;
if (!GET_EVENTCHKINF(EVENTCHKINF_38)) {
this->actor.textId = 0x4055;
@ -418,9 +418,9 @@ void func_809EE800(EnDivingGame* this, PlayState* play) {
if (this->unk_292 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) {
Message_CloseTextbox(play);
if (!GET_EVENTCHKINF(EVENTCHKINF_38)) {
func_80088B34(BREG(2) + 50);
Interface_SetTimer(50 + BREG(2));
} else {
func_80088B34(BREG(2) + 50);
Interface_SetTimer(50 + BREG(2));
}
func_800F5ACC(NA_BGM_TIMED_MINI_GAME);
func_8002DF54(play, NULL, 7);
@ -506,9 +506,10 @@ void EnDivingGame_Update(Actor* thisx, PlayState* play2) {
if (1) {}
if (gSaveContext.timer1Value == 10) {
if (gSaveContext.timerSeconds == 10) {
Audio_SetFastTempoForTimedMinigame();
}
if (this->eyeTimer == 0) {
this->eyeTimer = 2;
this->eyeTexIndex++;

View file

@ -88,7 +88,7 @@ void EnDs_GiveOddPotion(EnDs* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play)) {
this->actor.parent = NULL;
this->actionFunc = EnDs_DisplayOddPotionText;
gSaveContext.timer2State = 0;
gSaveContext.subTimerState = SUBTIMER_STATE_OFF;
} else {
func_8002F434(&this->actor, play, GI_ODD_POTION, 10000.0f, 50.0f);
}

View file

@ -48,7 +48,7 @@ void EnEg_Init(Actor* thisx, PlayState* play) {
}
void func_809FFDC8(EnEg* this, PlayState* play) {
if (!sVoided && (gSaveContext.timer2Value < 1) && Flags_GetSwitch(play, 0x36) && (kREG(0) == 0)) {
if (!sVoided && (gSaveContext.subTimerSeconds <= 0) && Flags_GetSwitch(play, 0x36) && (kREG(0) == 0)) {
// Void the player out
Play_TriggerRespawn(play);
gSaveContext.respawnFlag = -2;

View file

@ -865,7 +865,7 @@ void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play) {
this->unk_1E0.unk_00 = 0;
EnGo_SetupAction(this, EnGo_Eyedrops);
play->msgCtx.msgMode = MSGMODE_PAUSED;
gSaveContext.timer2State = 0;
gSaveContext.subTimerState = SUBTIMER_STATE_OFF;
OnePointCutscene_Init(play, 4190, -99, &this->actor, CAM_ID_MAIN);
} else {
this->unk_1E0.unk_00 = 0;

View file

@ -1062,7 +1062,7 @@ void EnGo2_BiggoronSetTextId(EnGo2* this, PlayState* play, Player* player) {
this->actor.textId = 0x3058;
}
if (this->actor.textId == 0x3059) {
gSaveContext.timer2State = 0;
gSaveContext.subTimerState = SUBTIMER_STATE_OFF;
}
player->actor.textId = this->actor.textId;

View file

@ -128,7 +128,7 @@ void EnHorseGameCheck_FinishIngoRace(EnHorseGameCheckIngoRace* this, PlayState*
}
DREG(25) = 0;
play->transitionTrigger = TRANS_TRIGGER_START;
gSaveContext.timer1State = 0;
gSaveContext.timerState = TIMER_STATE_OFF;
}
s32 EnHorseGameCheck_UpdateIngoRace(EnHorseGameCheckBase* base, PlayState* play) {
@ -140,7 +140,7 @@ s32 EnHorseGameCheck_UpdateIngoRace(EnHorseGameCheckBase* base, PlayState* play)
if ((this->startTimer > 50) && !(this->startFlags & INGORACE_SET_TIMER)) {
this->startFlags |= INGORACE_SET_TIMER;
func_80088B34(0);
Interface_SetTimer(0);
} else if ((this->startTimer > 80) && (player->rideActor != NULL) && !(this->startFlags & INGORACE_PLAYER_MOVE)) {
this->startFlags |= INGORACE_PLAYER_MOVE;
horse = (EnHorse*)player->rideActor;
@ -211,7 +211,7 @@ s32 EnHorseGameCheck_UpdateIngoRace(EnHorseGameCheckBase* base, PlayState* play)
this->result = INGORACE_INGO_WIN;
this->finishTimer = 20;
}
if ((gSaveContext.timer1Value >= 180) && (this->startFlags & 2)) {
if ((gSaveContext.timerSeconds >= 180) && (this->startFlags & 2)) {
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_HORSE_GOAL);
this->result = INGORACE_TIME_UP;
this->finishTimer = 20;
@ -298,8 +298,8 @@ void EnHorseGameCheck_FinishMalonRace(EnHorseGameCheckMalonRace* this, PlayState
play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST);
play->transitionTrigger = TRANS_TRIGGER_START;
} else if (this->result == MALONRACE_FAILURE) {
gSaveContext.timer1Value = 240;
gSaveContext.timer1State = 0xF;
gSaveContext.timerSeconds = 240;
gSaveContext.timerState = TIMER_STATE_UP_FREEZE;
gSaveContext.cutsceneIndex = 0;
play->nextEntranceIndex = ENTR_SPOT20_7;
play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST);
@ -328,7 +328,7 @@ s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, PlayState* play
}
if ((this->startTimer > 50) && !(this->raceFlags & MALONRACE_SET_TIMER)) {
this->raceFlags |= MALONRACE_SET_TIMER;
func_80088B34(0);
Interface_SetTimer(0);
} else if ((this->startTimer > 80) && (player->rideActor != NULL) && !(this->raceFlags & MALONRACE_PLAYER_MOVE)) {
this->raceFlags |= MALONRACE_PLAYER_MOVE;
horse = (EnHorse*)player->rideActor;
@ -383,7 +383,7 @@ s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, PlayState* play
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
this->result = MALONRACE_SUCCESS;
this->finishTimer = 70;
gSaveContext.timer1State = 0xF;
gSaveContext.timerState = TIMER_STATE_UP_FREEZE;
} else if ((this->fenceCheck[7] == 1) && !(this->raceFlags & MALONRACE_SECOND_LAP)) {
this->lapCount = 1;
this->raceFlags |= MALONRACE_SECOND_LAP;
@ -400,11 +400,11 @@ s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, PlayState* play
this->finishTimer = 30;
}
}
if ((gSaveContext.timer1Value >= 180) && (this->raceFlags & MALONRACE_SET_TIMER)) {
gSaveContext.timer1Value = 240;
if ((gSaveContext.timerSeconds >= 180) && (this->raceFlags & MALONRACE_SET_TIMER)) {
gSaveContext.timerSeconds = 240;
this->result = MALONRACE_TIME_UP;
this->finishTimer = 30;
gSaveContext.timer1State = 0;
gSaveContext.timerState = TIMER_STATE_OFF;
}
} else {
if (this->finishTimer > 0) {

View file

@ -89,11 +89,11 @@ typedef struct {
// these seem to be valid coords on Hyrule field, along with target speeds
static HorsePosSpeed sHorseFieldPositions[] = {
{ {-1682, -500, 12578}, 7 }, { {-3288, -500, 13013}, 7 }, { {-5142, -417, 11630}, 7 },
{ {-5794, -473, 9573}, 7 }, { {-6765, -500, 8364}, 7 }, { {-6619, -393, 6919}, 7 },
{ {-5193, 124, 5433}, 7 }, { {-2970, 2, 4537}, 7 }, { {-2949, -35, 4527}, 7 },
{ {-1907, -47, 2978}, 7 }, { {2488, 294, 3628}, 7 }, { {3089, 378, 4713}, 7 },
{ {1614, -261, 7596}, 7 }, { {754, -187, 9295}, 7 },
{ { -1682, -500, 12578 }, 7 }, { { -3288, -500, 13013 }, 7 }, { { -5142, -417, 11630 }, 7 },
{ { -5794, -473, 9573 }, 7 }, { { -6765, -500, 8364 }, 7 }, { { -6619, -393, 6919 }, 7 },
{ { -5193, 124, 5433 }, 7 }, { { -2970, 2, 4537 }, 7 }, { { -2949, -35, 4527 }, 7 },
{ { -1907, -47, 2978 }, 7 }, { { 2488, 294, 3628 }, 7 }, { { 3089, 378, 4713 }, 7 },
{ { 1614, -261, 7596 }, 7 }, { { 754, -187, 9295 }, 7 },
};
static InitChainEntry sInitChain[] = {

View file

@ -126,9 +126,9 @@ void func_80A6E5EC(EnHs* this, PlayState* play) {
void func_80A6E630(EnHs* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) {
func_80088AA0(180);
Interface_SetSubTimer(180);
func_80A6E3A0(this, func_80A6E6B0);
CLEAR_EVENTINF(EVENTINF_10);
CLEAR_EVENTINF(EVENTINF_MARATHON_ACTIVE);
}
this->unk_2A8 |= 1;

View file

@ -437,7 +437,7 @@ void func_80A79BAC(EnIn* this, PlayState* play, s32 index, u32 transitionType) {
if (index == 0) {
AREG(6) = 0;
}
gSaveContext.timer1State = 0;
gSaveContext.timerState = TIMER_STATE_OFF;
}
void func_80A79C78(EnIn* this, PlayState* play) {
@ -580,7 +580,7 @@ void func_80A79FB0(EnIn* this, PlayState* play) {
this->actor.targetMode = 3;
EnIn_ChangeAnim(this, ENIN_ANIM_2);
this->actionFunc = func_80A7A568;
func_80088B34(0x3C);
Interface_SetTimer(60);
break;
case EVENTINF_HORSES_STATE_3:
EnIn_ChangeAnim(this, ENIN_ANIM_4);
@ -657,12 +657,12 @@ void func_80A7A568(EnIn* this, PlayState* play) {
if (!GET_EVENTCHKINF(EVENTCHKINF_1B) && (player->stateFlags1 & PLAYER_STATE1_23)) {
SET_INFTABLE(INFTABLE_AB);
}
if (gSaveContext.timer1State == 10) {
if (gSaveContext.timerState == TIMER_STATE_STOP) {
Audio_PlaySfxGeneral(NA_SE_SY_FOUND, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
func_80A79C78(this, play);
this->actionFunc = func_80A7B024;
gSaveContext.timer1State = 0;
gSaveContext.timerState = TIMER_STATE_OFF;
} else if (this->unk_308.unk_00 == 2) {
if (play->msgCtx.choiceIndex == 0) {
if (gSaveContext.rupees < 50) {
@ -929,7 +929,8 @@ void EnIn_Update(Actor* thisx, PlayState* play) {
this->actionFunc(this, play);
if (this->actionFunc != func_80A7A304) {
func_80A79AB4(this, play);
if (gSaveContext.timer2Value < 6 && gSaveContext.timer2State != 0 && this->unk_308.unk_00 == 0) {
if ((gSaveContext.subTimerSeconds < 6) && (gSaveContext.subTimerState != SUBTIMER_STATE_OFF) &&
(this->unk_308.unk_00 == 0)) {
if (Actor_ProcessTalkRequest(&this->actor, play)) {}
} else {
func_800343CC(play, &this->actor, &this->unk_308.unk_00,

View file

@ -441,8 +441,8 @@ void EnKz_SetupGetItem(EnKz* this, PlayState* play) {
void EnKz_StartTimer(EnKz* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) {
if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_EYEBALL_FROG) {
func_80088AA0(180); // start timer2 with 3 minutes
CLEAR_EVENTINF(EVENTINF_10);
Interface_SetSubTimer(180);
CLEAR_EVENTINF(EVENTINF_MARATHON_ACTIVE);
}
this->unk_1E0.unk_00 = 0;
this->actionFunc = EnKz_Wait;

View file

@ -73,39 +73,44 @@ static AnimationFrameCountInfo sAnimationInfo[] = {
u16 func_80AA2AA0(PlayState* play, Actor* thisx) {
Player* player = GET_PLAYER(play);
s16* timer1ValuePtr; // weirdness with this necessary to match
if (!GET_INFTABLE(INFTABLE_B8)) {
return 0x2000;
}
timer1ValuePtr = &gSaveContext.timer1Value;
if (GET_EVENTINF(EVENTINF_HORSES_0A)) {
gSaveContext.timer1Value = gSaveContext.timer1Value;
gSaveContext.timerSeconds = gSaveContext.timerSeconds;
thisx->flags |= ACTOR_FLAG_16;
if (gSaveContext.timer1Value >= 0xD3) {
if (((void)0, gSaveContext.timerSeconds) > 210) {
return 0x208E;
}
if ((HIGH_SCORE(HS_HORSE_RACE) == 0) || (HIGH_SCORE(HS_HORSE_RACE) >= 0xB4)) {
HIGH_SCORE(HS_HORSE_RACE) = 0xB4;
gSaveContext.timer1Value = *timer1ValuePtr;
if ((HIGH_SCORE(HS_HORSE_RACE) == 0) || (HIGH_SCORE(HS_HORSE_RACE) >= 180)) {
HIGH_SCORE(HS_HORSE_RACE) = 180;
}
if (!GET_EVENTCHKINF(EVENTCHKINF_1E) && (gSaveContext.timer1Value < 0x32)) {
if (!GET_EVENTCHKINF(EVENTCHKINF_1E) && (((void)0, gSaveContext.timerSeconds) < 50)) {
return 0x208F;
} else if (gSaveContext.timer1Value < HIGH_SCORE(HS_HORSE_RACE)) {
return 0x2012;
} else {
return 0x2004;
}
if (HIGH_SCORE(HS_HORSE_RACE) > ((void)0, gSaveContext.timerSeconds)) {
return 0x2012;
}
return 0x2004;
}
if (!(player->stateFlags1 & PLAYER_STATE1_23) &&
(Actor_FindNearby(play, thisx, ACTOR_EN_HORSE, 1, 1200.0f) == NULL)) {
return 0x2001;
}
if (!GET_INFTABLE(INFTABLE_B9)) {
return 0x2002;
} else {
return 0x2003;
}
return 0x2003;
}
s16 func_80AA2BD4(PlayState* play, Actor* thisx) {
@ -119,7 +124,7 @@ s16 func_80AA2BD4(PlayState* play, Actor* thisx) {
play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST);
play->transitionTrigger = TRANS_TRIGGER_START;
SET_EVENTINF(EVENTINF_HORSES_0A);
gSaveContext.timer1State = 0xF;
gSaveContext.timerState = TIMER_STATE_UP_FREEZE;
}
break;
case TEXT_STATE_CHOICE:
@ -147,15 +152,15 @@ s16 func_80AA2BD4(PlayState* play, Actor* thisx) {
FALLTHROUGH;
case 0x2004:
case 0x2012:
if (HIGH_SCORE(HS_HORSE_RACE) > gSaveContext.timer1Value) {
HIGH_SCORE(HS_HORSE_RACE) = gSaveContext.timer1Value;
if (HIGH_SCORE(HS_HORSE_RACE) > gSaveContext.timerSeconds) {
HIGH_SCORE(HS_HORSE_RACE) = gSaveContext.timerSeconds;
}
FALLTHROUGH;
case 0x208E:
CLEAR_EVENTINF(EVENTINF_HORSES_0A);
thisx->flags &= ~ACTOR_FLAG_16;
ret = 0;
gSaveContext.timer1State = 0xA;
gSaveContext.timerState = TIMER_STATE_STOP;
break;
case 0x2002:
SET_INFTABLE(INFTABLE_B9);

View file

@ -92,8 +92,8 @@ void func_80AACA94(EnMk* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play) != 0) {
this->actor.parent = NULL;
this->actionFunc = func_80AACA40;
func_80088AA0(240);
CLEAR_EVENTINF(EVENTINF_10);
Interface_SetSubTimer(240);
CLEAR_EVENTINF(EVENTINF_MARATHON_ACTIVE);
} else {
func_8002F434(&this->actor, play, GI_EYE_DROPS, 10000.0f, 50.0f);
}
@ -253,7 +253,7 @@ void EnMk_Wait(EnMk* this, PlayState* play) {
Animation_Change(&this->skelAnime, &object_mk_Anim_000368, 1.0f, 0.0f,
Animation_GetLastFrame(&object_mk_Anim_000368), ANIMMODE_ONCE, -4.0f);
this->flags &= ~2;
gSaveContext.timer2State = 0;
gSaveContext.subTimerState = SUBTIMER_STATE_OFF;
func_80078884(NA_SE_SY_TRE_BOX_APPEAR);
break;
default:

View file

@ -103,20 +103,20 @@ void func_80AAEF70(EnMm2* this, PlayState* play) {
if (!GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) {
this->actor.textId = 0x6086;
} else if (GET_INFTABLE(INFTABLE_17F)) {
if (GET_EVENTINF(EVENTINF_10)) {
if (GET_EVENTINF(EVENTINF_MARATHON_ACTIVE)) {
this->actor.textId = 0x6082;
} else if (gSaveContext.timer2State != 0) {
} else if (gSaveContext.subTimerState != SUBTIMER_STATE_OFF) {
this->actor.textId = 0x6076;
} else if (HIGH_SCORE(HS_MARATHON) == 158) {
this->actor.textId = 0x607E;
} else {
this->actor.textId = 0x6081;
}
} else if (gSaveContext.timer2State) {
} else if (gSaveContext.subTimerState != SUBTIMER_STATE_OFF) {
this->actor.textId = 0x6076;
} else {
this->actor.textId = 0x607D;
CLEAR_EVENTINF(EVENTINF_10);
CLEAR_EVENTINF(EVENTINF_MARATHON_ACTIVE);
HIGH_SCORE(HS_MARATHON) = 158;
}
}
@ -149,7 +149,7 @@ void EnMm2_Init(Actor* thisx, PlayState* play2) {
Actor_Kill(&this->actor);
}
if (this->actor.params == 1) {
if (!GET_INFTABLE(INFTABLE_17F) || !GET_EVENTINF(EVENTINF_10)) {
if (!GET_INFTABLE(INFTABLE_17F) || !GET_EVENTINF(EVENTINF_MARATHON_ACTIVE)) {
osSyncPrintf(VT_FGCOL(CYAN) " マラソン 開始されていない \n" VT_RST "\n");
Actor_Kill(&this->actor);
}
@ -193,8 +193,8 @@ void func_80AAF330(EnMm2* this, PlayState* play) {
if (!(this->unk_1F4 & 2)) {
Message_CloseTextbox(play);
}
gSaveContext.timer2State = 0;
CLEAR_EVENTINF(EVENTINF_10);
gSaveContext.subTimerState = SUBTIMER_STATE_OFF;
CLEAR_EVENTINF(EVENTINF_MARATHON_ACTIVE);
}
}
@ -209,7 +209,7 @@ void func_80AAF3C0(EnMm2* this, PlayState* play) {
case 0:
Message_ContinueTextbox(play, 0x607F);
this->actor.textId = 0x607F;
SET_EVENTINF(EVENTINF_10);
SET_EVENTINF(EVENTINF_MARATHON_ACTIVE);
break;
case 1:
Message_ContinueTextbox(play, 0x6080);
@ -219,14 +219,14 @@ void func_80AAF3C0(EnMm2* this, PlayState* play) {
if (this->unk_1F4 & 4) {
if (1) {}
this->unk_1F4 &= ~4;
HIGH_SCORE(HS_MARATHON) += 1;
HIGH_SCORE(HS_MARATHON)++;
}
}
return;
case 0x6081:
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
this->unk_1F4 |= 4;
HIGH_SCORE(HS_MARATHON) -= 1;
HIGH_SCORE(HS_MARATHON)--;
Message_ContinueTextbox(play, 0x607E);
this->actor.textId = 0x607E;
}
@ -235,7 +235,7 @@ void func_80AAF3C0(EnMm2* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
if (this->actor.textId == 0x607F) {
func_80088AA0(0);
Interface_SetSubTimer(0);
this->actionFunc = func_80AAF57C;
} else {
this->actionFunc = func_80AAF57C;
@ -266,19 +266,20 @@ void func_80AAF668(EnMm2* this, PlayState* play) {
this->actor.world.rot.y = -0x3E80;
this->actor.shape.rot.y = this->actor.world.rot.y;
SkelAnime_Update(&this->skelAnime);
if (((void)0, gSaveContext.timer2Value) < HIGH_SCORE(HS_MARATHON)) {
if (((void)0, gSaveContext.subTimerSeconds) < HIGH_SCORE(HS_MARATHON)) {
this->actor.textId = 0x6085;
} else {
this->actor.textId = 0x6084;
}
if (func_80AAF224(this, play, func_80AAF5EC)) {
this->unk_1F6 = 0;
if (((void)0, gSaveContext.timer2Value) < HIGH_SCORE(HS_MARATHON)) {
HIGH_SCORE(HS_MARATHON) = gSaveContext.timer2Value;
if (((void)0, gSaveContext.subTimerSeconds) < HIGH_SCORE(HS_MARATHON)) {
HIGH_SCORE(HS_MARATHON) = gSaveContext.subTimerSeconds;
}
} else {
LOG_HEX("((z_common_data.event_inf[1]) & (0x0001))", GET_EVENTINF(EVENTINF_10), "../z_en_mm2.c", 541);
if (!GET_EVENTINF(EVENTINF_10)) {
LOG_HEX("((z_common_data.event_inf[1]) & (0x0001))", GET_EVENTINF(EVENTINF_MARATHON_ACTIVE), "../z_en_mm2.c",
541);
if (!GET_EVENTINF(EVENTINF_MARATHON_ACTIVE)) {
this->unk_1F4 |= 2;
this->unk_1F4 &= ~1;
EnMm2_ChangeAnim(this, RM2_ANIM_STAND, &this->previousAnimation);

View file

@ -137,7 +137,7 @@ void EnPoRelay_SetupRace(EnPoRelay* this) {
EnPoRelay_Vec3sToVec3f(&vec, &D_80AD8C30[this->pathIndex]);
this->actionTimer = ((s16)(this->actor.shape.rot.y - this->actor.world.rot.y - 0x8000) >> 0xB) % 32U;
func_80088B34(0);
Interface_SetTimer(0);
this->hookshotSlotFull = INV_CONTENT(ITEM_HOOKSHOT) != ITEM_NONE;
this->unk_19A = Actor_WorldYawTowardPoint(&this->actor, &vec);
this->actor.flags |= ACTOR_FLAG_27;
@ -258,7 +258,7 @@ void EnPoRelay_EndRace(EnPoRelay* this, PlayState* play) {
this->actionFunc = EnPoRelay_Talk2;
} else if (play->roomCtx.curRoom.num == 5) {
Actor_Kill(&this->actor);
gSaveContext.timer1State = 0;
gSaveContext.timerState = TIMER_STATE_OFF;
} else if (Actor_IsFacingAndNearPlayer(&this->actor, 150.0f, 0x3000)) {
this->actor.textId = this->textId;
func_8002F2CC(&this->actor, play, 250.0f);
@ -279,7 +279,7 @@ void EnPoRelay_Talk2(EnPoRelay* this, PlayState* play) {
Message_ContinueTextbox(play, this->actor.textId);
}
} else if (Actor_TextboxIsClosing(&this->actor, play)) {
gSaveContext.timer1State = 0;
gSaveContext.timerState = TIMER_STATE_OFF;
this->actionTimer = 0;
this->actionFunc = EnPoRelay_DisappearAndReward;
}
@ -326,17 +326,17 @@ void EnPoRelay_DisappearAndReward(EnPoRelay* this, PlayState* play) {
sp60.x = this->actor.world.pos.x;
sp60.y = this->actor.floorHeight;
sp60.z = this->actor.world.pos.z;
if (gSaveContext.timer1Value < HIGH_SCORE(HS_DAMPE_RACE)) {
HIGH_SCORE(HS_DAMPE_RACE) = gSaveContext.timer1Value;
if (gSaveContext.timerSeconds < HIGH_SCORE(HS_DAMPE_RACE)) {
HIGH_SCORE(HS_DAMPE_RACE) = gSaveContext.timerSeconds;
}
if (Flags_GetCollectible(play, this->actor.params) == 0 && gSaveContext.timer1Value <= 60) {
if (!Flags_GetCollectible(play, this->actor.params) && (gSaveContext.timerSeconds <= 60)) {
Item_DropCollectible2(play, &sp60, (this->actor.params << 8) + (0x4000 | ITEM00_HEART_PIECE));
} else {
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, sp60.x, sp60.y, sp60.z, 0, 0, 0, 2);
}
} else {
Flags_SetTempClear(play, 4);
HIGH_SCORE(HS_DAMPE_RACE) = gSaveContext.timer1Value;
HIGH_SCORE(HS_DAMPE_RACE) = gSaveContext.timerSeconds;
}
Actor_Kill(&this->actor);
}

View file

@ -489,7 +489,7 @@ void func_80B12460(EnSyatekiNiw* this, PlayState* play) {
void func_80B128D8(EnSyatekiNiw* this, PlayState* play) {
if (this->unk_25E == 1) {
gSaveContext.timer1State = 0;
gSaveContext.timerState = TIMER_STATE_OFF;
}
}

View file

@ -278,7 +278,7 @@ void EnTa_Destroy(Actor* thisx, PlayState* play) {
if (this->actor.params != ENTA_IN_KAKARIKO && this->actor.params != ENTA_RETURNED_FROM_KAKARIKO &&
play->sceneId == SCENE_SOUKO) {
gSaveContext.timer1State = 0;
gSaveContext.timerState = TIMER_STATE_OFF;
}
if (this->stateFlags & TALON_STATE_FLAG_RESTORE_BGM_ON_DESTROY) {
@ -756,7 +756,7 @@ void EnTa_RunCuccoGame(EnTa* this, PlayState* play) {
switch (EnTa_GetSuperCuccosCount(this, play)) {
case 1:
// Last cucco found, end the game
gSaveContext.timer1State = 0;
gSaveContext.timerState = TIMER_STATE_OFF;
func_8002DF54(play, &this->actor, 1);
Message_StartTextbox(play, 0x2084, &this->actor);
@ -796,15 +796,15 @@ void EnTa_RunCuccoGame(EnTa* this, PlayState* play) {
}
}
if (gSaveContext.timer1Value == 10) {
if (gSaveContext.timerSeconds == 10) {
Audio_SetFastTempoForTimedMinigame();
}
if (gSaveContext.timer1Value == 0 && !Play_InCsMode(play)) {
if ((gSaveContext.timerSeconds == 0) && !Play_InCsMode(play)) {
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0);
this->stateFlags &= ~TALON_STATE_FLAG_RESTORE_BGM_ON_DESTROY;
func_80078884(NA_SE_SY_FOUND);
gSaveContext.timer1State = 0;
gSaveContext.timerState = TIMER_STATE_OFF;
func_8002DF54(play, &this->actor, 1);
// Time's up text
@ -881,7 +881,7 @@ void EnTa_StartingCuccoGame3(EnTa* this, PlayState* play) {
Animation_GetLastFrame(&gTalonSitHandsUpAnim), ANIMMODE_ONCE, 0.0f);
this->timer = 50;
func_80088B34(30);
Interface_SetTimer(30);
func_800F5ACC(NA_BGM_TIMED_MINI_GAME);
this->stateFlags |= TALON_STATE_FLAG_RESTORE_BGM_ON_DESTROY;
Message_CloseTextbox(play);

View file

@ -1607,7 +1607,7 @@ void EnZl2_Init(Actor* thisx, PlayState* play) {
Audio_SetSfxBanksMute(0x6F);
break;
case 4:
gSaveContext.timer2State = 0;
gSaveContext.subTimerState = SUBTIMER_STATE_OFF;
break;
}
}

View file

@ -2482,7 +2482,7 @@ s32 func_80B59698(EnZl3* this, PlayState* play) {
u8 spawn = play->spawn;
if ((func_80B54DB4(this) == 0x20) && (spawn == 0) &&
((gSaveContext.timer2Value <= 0) || (gSaveContext.timer2State == 0))) {
((gSaveContext.subTimerSeconds <= 0) || (gSaveContext.subTimerState == SUBTIMER_STATE_OFF))) {
return 1;
}
}
@ -2497,7 +2497,7 @@ s32 func_80B59768(EnZl3* this, PlayState* play) {
if (cond) {
u8 spawn = play->spawn;
if ((func_80B54DB4(this) == 0x20) && (spawn == 0) && (gSaveContext.timer2Value <= 0)) {
if ((func_80B54DB4(this) == 0x20) && (spawn == 0) && (gSaveContext.subTimerSeconds <= 0)) {
return 1;
}
}
@ -2524,7 +2524,7 @@ void func_80B59828(EnZl3* this, PlayState* play) {
}
if (func_80B59698(this, play) != 0) {
func_80088AA0(180);
Interface_SetSubTimer(180);
func_80B53468();
gSaveContext.healthAccumulator = 320;
Magic_Fill(play);
@ -2569,7 +2569,7 @@ void func_80B59AD0(EnZl3* this, PlayState* play) {
Actor* thisx = &this->actor; // unused, necessary to use 'this' first to fix regalloc
Flags_SetSwitch(play, 0x36);
func_80088AA0(180);
Interface_SetSubTimer(180);
func_80B54EA4(this, play);
func_80B53614(this, play);
CLEAR_EVENTCHKINF(EVENTCHKINF_C7);
@ -2657,7 +2657,7 @@ void EnZl3_Init(Actor* thisx, PlayState* play) {
switch (func_80B54DD4(this)) {
case 1:
gSaveContext.timer2State = 0;
gSaveContext.subTimerState = SUBTIMER_STATE_OFF;
break;
case 3:
func_80B59A80(this, play);

View file

@ -49,14 +49,14 @@ void ObjRoomtimer_Init(Actor* thisx, PlayState* play) {
void ObjRoomtimer_Destroy(Actor* thisx, PlayState* play) {
ObjRoomtimer* this = (ObjRoomtimer*)thisx;
if ((this->actor.params != 0x3FF) && (gSaveContext.timer1Value > 0)) {
gSaveContext.timer1State = 10;
if ((this->actor.params != 0x3FF) && (gSaveContext.timerSeconds > 0)) {
gSaveContext.timerState = TIMER_STATE_STOP;
}
}
void func_80B9D054(ObjRoomtimer* this, PlayState* play) {
if (this->actor.params != 0x3FF) {
func_80088B34(this->actor.params);
Interface_SetTimer(this->actor.params);
}
Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP);
@ -66,19 +66,20 @@ void func_80B9D054(ObjRoomtimer* this, PlayState* play) {
void func_80B9D0B0(ObjRoomtimer* this, PlayState* play) {
if (Flags_GetTempClear(play, this->actor.room)) {
if (this->actor.params != 0x3FF) {
gSaveContext.timer1State = 10;
gSaveContext.timerState = TIMER_STATE_STOP;
}
Flags_SetClear(play, this->actor.room);
Flags_SetSwitch(play, this->switchFlag);
func_80078884(NA_SE_SY_CORRECT_CHIME);
Actor_Kill(&this->actor);
} else {
if ((this->actor.params != 0x3FF) && (gSaveContext.timer1Value == 0)) {
Audio_PlaySfxGeneral(NA_SE_OC_ABYSS, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
Play_TriggerVoidOut(play);
Actor_Kill(&this->actor);
}
return;
}
if ((this->actor.params != 0x3FF) && (gSaveContext.timerSeconds == 0)) {
Audio_PlaySfxGeneral(NA_SE_OC_ABYSS, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
Play_TriggerVoidOut(play);
Actor_Kill(&this->actor);
}
}

View file

@ -2411,7 +2411,7 @@ void func_80834298(Player* this, PlayState* play) {
((this->heldItemAction == this->itemAction) || (this->stateFlags1 & PLAYER_STATE1_22)) &&
(gSaveContext.health != 0) && (play->csCtx.state == CS_STATE_IDLE) && (this->csMode == 0) &&
(play->shootingGalleryStatus == 0) && (play->activeCamId == CAM_ID_MAIN) &&
(play->transitionTrigger != TRANS_TRIGGER_START) && (gSaveContext.timer1State != 10)) {
(play->transitionTrigger != TRANS_TRIGGER_START) && (gSaveContext.timerState != TIMER_STATE_STOP)) {
func_80833DF8(this, play);
}
@ -6056,11 +6056,11 @@ void func_8083D36C(PlayState* play, Player* this) {
void func_8083D53C(PlayState* play, Player* this) {
if (this->actor.yDistToWater < this->ageProperties->unk_2C) {
Audio_SetBaseFilter(0);
this->unk_840 = 0;
this->underwaterTimer = 0;
} else {
Audio_SetBaseFilter(0x20);
if (this->unk_840 < 300) {
this->unk_840++;
if (this->underwaterTimer < 300) {
this->underwaterTimer++;
}
}
@ -13394,7 +13394,7 @@ void func_8085063C(Player* this, PlayState* play) {
play->transitionTrigger = TRANS_TRIGGER_START;
play->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex;
play->transitionType = TRANS_TYPE_FADE_WHITE_FAST;
func_80088AF0(play);
Interface_SetSubTimerToFinalSecond(play);
return;
}

View file

@ -1463,8 +1463,8 @@ void FileSelect_LoadGame(GameState* thisx) {
gSaveContext.natureAmbienceId = 0xFF;
gSaveContext.showTitleCard = true;
gSaveContext.dogParams = 0;
gSaveContext.timer1State = 0;
gSaveContext.timer2State = 0;
gSaveContext.timerState = TIMER_STATE_OFF;
gSaveContext.subTimerState = SUBTIMER_STATE_OFF;
gSaveContext.eventInf[0] = 0;
gSaveContext.eventInf[1] = 0;
gSaveContext.eventInf[2] = 0;