diff --git a/include/save.h b/include/save.h index 31d7491f65..70eaff93ec 100644 --- a/include/save.h +++ b/include/save.h @@ -569,7 +569,7 @@ typedef enum LinkAge { #define EVENTCHKINF_32 0x32 #define EVENTCHKINF_GAVE_LETTER_TO_KING_ZORA 0x33 #define EVENTCHKINF_37 0x37 -#define EVENTCHKINF_38 0x38 +#define EVENTCHKINF_OBTAINED_SILVER_SCALE 0x38 #define EVENTCHKINF_39 0x39 #define EVENTCHKINF_OPENED_JABU_JABU 0x3A #define EVENTCHKINF_3B 0x3B diff --git a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c index c9c064136d..76330aff2f 100644 --- a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c +++ b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c @@ -35,22 +35,22 @@ void EnDivingGame_Destroy(Actor* thisx, PlayState* play); void EnDivingGame_Update(Actor* thisx, PlayState* play2); void EnDivingGame_Draw(Actor* thisx, PlayState* play); -void func_809EDCB0(EnDivingGame* this, PlayState* play); -void EnDivingGame_Talk(EnDivingGame* this, PlayState* play); +void EnDivingGame_Reset(EnDivingGame* this, PlayState* play); +void EnDivingGame_Idle(EnDivingGame* this, PlayState* play); void EnDivingGame_HandlePlayChoice(EnDivingGame* this, PlayState* play); -void func_809EE048(EnDivingGame* this, PlayState* play); -void func_809EE0FC(EnDivingGame* this, PlayState* play); -void func_809EE194(EnDivingGame* this, PlayState* play); -void EnDivingGame_SetupRupeeThrow(EnDivingGame* this, PlayState* play); -void EnDivingGame_RupeeThrow(EnDivingGame* this, PlayState* play); +void EnDivingGame_TalkOutsideMinigame(EnDivingGame* this, PlayState* play); +void EnDivingGame_StartThrowAnimation(EnDivingGame* this, PlayState* play); +void EnDivingGame_BeforeRupeeThrow(EnDivingGame* this, PlayState* play); +void EnDivingGame_SetupRupeeThrowCam(EnDivingGame* this, PlayState* play); +void EnDivingGame_ThrowRupees(EnDivingGame* this, PlayState* play); void EnDivingGame_SetupUnderwaterViewCs(EnDivingGame* this, PlayState* play); -void func_809EE780(EnDivingGame* this, PlayState* play); -void func_809EE800(EnDivingGame* this, PlayState* play); -void func_809EE8F0(EnDivingGame* this, PlayState* play); -void func_809EE96C(EnDivingGame* this, PlayState* play); -void func_809EEA00(EnDivingGame* this, PlayState* play); -void func_809EEA90(EnDivingGame* this, PlayState* play); -void func_809EEAF8(EnDivingGame* this, PlayState* play); +void EnDivingGame_UnderwaterViewCs(EnDivingGame* this, PlayState* play); +void EnDivingGame_StartMinigame(EnDivingGame* this, PlayState* play); +void EnDivingGame_TalkDuringMinigame(EnDivingGame* this, PlayState* play); +void EnDivingGame_EarnedScale(EnDivingGame* this, PlayState* play); +void EnDivingGame_WaitGiveScale(EnDivingGame* this, PlayState* play); +void EnDivingGame_GiveScale(EnDivingGame* this, PlayState* play); +void EnDivingGame_EndMinigameAfterScaleGiven(EnDivingGame* this, PlayState* play); ActorProfile En_Diving_Game_Profile = { /**/ ACTOR_EN_DIVING_GAME, @@ -65,7 +65,7 @@ ActorProfile En_Diving_Game_Profile = { }; // used to ensure there's only one instance of this actor. -static u8 D_809EF0B0 = false; +static u8 sIsInitialized = false; static ColliderCylinderInit sCylinderInit = { { @@ -106,22 +106,22 @@ void EnDivingGame_Init(Actor* thisx, PlayState* play) { this->actor.scale.x = 0.01f; this->actor.scale.y = 0.012999999f; this->actor.scale.z = 0.0139999995f; - if (D_809EF0B0) { + if (sIsInitialized) { PRINTF(VT_FGCOL(GREEN) T("☆☆☆☆☆ もういてる原 ☆☆☆☆☆ \n", "☆☆☆☆☆ I'm already here -Hara ☆☆☆☆☆ \n") VT_RST); - this->unk_31F = 1; + this->isDuplicate = true; Actor_Kill(&this->actor); } else { - D_809EF0B0 = true; + sIsInitialized = true; this->actor.attentionRangeType = ATTENTION_RANGE_0; this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->actionFunc = func_809EDCB0; + this->actionFunc = EnDivingGame_Reset; } } void EnDivingGame_Destroy(Actor* thisx, PlayState* play) { EnDivingGame* this = (EnDivingGame*)thisx; - if (this->unk_31F == 0) { + if (!this->isDuplicate) { gSaveContext.timerState = TIMER_STATE_OFF; } Collider_DestroyCylinder(play, &this->collider); @@ -153,22 +153,22 @@ s32 EnDivingGame_HasMinigameFinished(EnDivingGame* this, PlayState* play) { Sfx_PlaySfxCentered(NA_SE_SY_FOUND); this->actor.textId = 0x71AD; Message_StartTextbox(play, this->actor.textId, NULL); - this->unk_292 = TEXT_STATE_EVENT; - this->allRupeesThrown = this->state = this->phase = this->unk_2A2 = this->grabbedRupeesCounter = 0; + this->nextTextState = TEXT_STATE_EVENT; + this->allRupeesThrown = this->state = this->phase = this->rupeePhase = this->grabbedRupees = 0; Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); - this->actionFunc = func_809EE048; + this->actionFunc = EnDivingGame_TalkOutsideMinigame; return true; } else { rupeesNeeded = 5; - if (GET_EVENTCHKINF(EVENTCHKINF_38)) { + if (GET_EVENTCHKINF(EVENTCHKINF_OBTAINED_SILVER_SCALE)) { rupeesNeeded = 10; } - if (this->grabbedRupeesCounter >= rupeesNeeded) { + if (this->grabbedRupees >= rupeesNeeded) { // Won. gSaveContext.timerState = TIMER_STATE_OFF; - this->allRupeesThrown = this->state = this->phase = this->unk_2A2 = this->grabbedRupeesCounter = 0; - if (!GET_EVENTCHKINF(EVENTCHKINF_38)) { + this->allRupeesThrown = this->state = this->phase = this->rupeePhase = this->grabbedRupees = 0; + if (!GET_EVENTCHKINF(EVENTCHKINF_OBTAINED_SILVER_SCALE)) { this->actor.textId = 0x4055; } else { this->actor.textId = 0x405D; @@ -177,14 +177,14 @@ s32 EnDivingGame_HasMinigameFinished(EnDivingGame* this, PlayState* play) { } } Message_StartTextbox(play, this->actor.textId, NULL); - this->unk_292 = TEXT_STATE_EVENT; + this->nextTextState = TEXT_STATE_EVENT; func_800F5B58(); Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); - if (!GET_EVENTCHKINF(EVENTCHKINF_38)) { - this->actionFunc = func_809EE96C; + if (!GET_EVENTCHKINF(EVENTCHKINF_OBTAINED_SILVER_SCALE)) { + this->actionFunc = EnDivingGame_EarnedScale; } else { - this->actionFunc = func_809EE048; + this->actionFunc = EnDivingGame_TalkOutsideMinigame; } return true; } @@ -192,42 +192,41 @@ s32 EnDivingGame_HasMinigameFinished(EnDivingGame* this, PlayState* play) { return false; } -// EnDivingGame_FinishMinigame ? // Reset probably -void func_809EDCB0(EnDivingGame* this, PlayState* play) { +void EnDivingGame_Reset(EnDivingGame* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gZoraIdleAnim); Animation_Change(&this->skelAnime, &gZoraIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); this->notPlayingMinigame = true; - this->actionFunc = EnDivingGame_Talk; + this->actionFunc = EnDivingGame_Idle; } -void EnDivingGame_Talk(EnDivingGame* this, PlayState* play) { +void EnDivingGame_Idle(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->state != ENDIVINGGAME_STATE_PLAYING || !EnDivingGame_HasMinigameFinished(this, play)) { if (Actor_TalkOfferAccepted(&this->actor, play)) { - if (this->unk_292 != TEXT_STATE_DONE) { + if (this->nextTextState != TEXT_STATE_DONE) { switch (this->state) { case ENDIVINGGAME_STATE_NOTPLAYING: Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); this->actionFunc = EnDivingGame_HandlePlayChoice; break; case ENDIVINGGAME_STATE_AWARDPRIZE: - this->actionFunc = func_809EEA00; + this->actionFunc = EnDivingGame_WaitGiveScale; break; case ENDIVINGGAME_STATE_PLAYING: - this->actionFunc = func_809EE8F0; + this->actionFunc = EnDivingGame_TalkDuringMinigame; break; } } } else { if (MaskReaction_GetTextId(play, MASK_REACTION_SET_ZORA) != 0) { this->actor.textId = MaskReaction_GetTextId(play, MASK_REACTION_SET_ZORA); - this->unk_292 = TEXT_STATE_DONE; + this->nextTextState = TEXT_STATE_DONE; } else { switch (this->state) { case ENDIVINGGAME_STATE_NOTPLAYING: - this->unk_292 = TEXT_STATE_CHOICE; - if (!GET_EVENTCHKINF(EVENTCHKINF_38)) { + this->nextTextState = TEXT_STATE_CHOICE; + if (!GET_EVENTCHKINF(EVENTCHKINF_OBTAINED_SILVER_SCALE)) { this->actor.textId = 0x4053; this->phase = ENDIVINGGAME_PHASE_1; } else { @@ -237,11 +236,11 @@ void EnDivingGame_Talk(EnDivingGame* this, PlayState* play) { break; case ENDIVINGGAME_STATE_AWARDPRIZE: this->actor.textId = 0x4056; - this->unk_292 = TEXT_STATE_EVENT; + this->nextTextState = TEXT_STATE_EVENT; break; case ENDIVINGGAME_STATE_PLAYING: this->actor.textId = 0x405B; - this->unk_292 = TEXT_STATE_EVENT; + this->nextTextState = TEXT_STATE_EVENT; break; } } @@ -252,7 +251,7 @@ void EnDivingGame_Talk(EnDivingGame* this, PlayState* play) { void EnDivingGame_HandlePlayChoice(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk_292 == Message_GetState(&play->msgCtx) && + if (this->nextTextState == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { // Did the player select an answer? switch (play->msgCtx.choiceIndex) { case 0: // Yes @@ -261,62 +260,60 @@ void EnDivingGame_HandlePlayChoice(EnDivingGame* this, PlayState* play) { this->actor.textId = 0x4054; } else { this->actor.textId = 0x85; - this->allRupeesThrown = this->state = this->phase = this->unk_2A2 = this->grabbedRupeesCounter = 0; + this->allRupeesThrown = this->state = this->phase = this->rupeePhase = this->grabbedRupees = 0; } break; case 1: // No this->actor.textId = 0x2D; - this->allRupeesThrown = this->state = this->phase = this->unk_2A2 = this->grabbedRupeesCounter = 0; + this->allRupeesThrown = this->state = this->phase = this->rupeePhase = this->grabbedRupees = 0; break; } - if (!GET_EVENTCHKINF(EVENTCHKINF_38) || this->actor.textId == 0x85 || this->actor.textId == 0x2D) { + if (!GET_EVENTCHKINF(EVENTCHKINF_OBTAINED_SILVER_SCALE) || (this->actor.textId == 0x85) || + (this->actor.textId == 0x2D)) { Message_ContinueTextbox(play, this->actor.textId); - this->unk_292 = TEXT_STATE_EVENT; - this->actionFunc = func_809EE048; + this->nextTextState = TEXT_STATE_EVENT; + this->actionFunc = EnDivingGame_TalkOutsideMinigame; } else { play->msgCtx.msgMode = MSGMODE_PAUSED; Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); - this->actionFunc = func_809EE0FC; + this->actionFunc = EnDivingGame_StartThrowAnimation; } } } -// Waits for the message to close -void func_809EE048(EnDivingGame* this, PlayState* play) { +void EnDivingGame_TalkOutsideMinigame(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk_292 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { + if (this->nextTextState == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { if (this->phase == ENDIVINGGAME_PHASE_ENDED) { Message_CloseTextbox(play); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_7); - this->actionFunc = func_809EDCB0; + this->actionFunc = EnDivingGame_Reset; } else { play->msgCtx.msgMode = MSGMODE_PAUSED; Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); - this->actionFunc = func_809EE0FC; + this->actionFunc = EnDivingGame_StartThrowAnimation; } } } -// another "start minigame" step -void func_809EE0FC(EnDivingGame* this, PlayState* play) { +void EnDivingGame_StartThrowAnimation(EnDivingGame* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gZoraThrowRupeesAnim); Animation_Change(&this->skelAnime, &gZoraThrowRupeesAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_ONCE, -10.0f); this->notPlayingMinigame = false; - this->actionFunc = func_809EE194; + this->actionFunc = EnDivingGame_BeforeRupeeThrow; } -// Wait a bit before start throwing the rupees. -void func_809EE194(EnDivingGame* this, PlayState* play) { +void EnDivingGame_BeforeRupeeThrow(EnDivingGame* this, PlayState* play) { f32 currentFrame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); if (currentFrame >= 15.0f) { - this->actionFunc = EnDivingGame_SetupRupeeThrow; + this->actionFunc = EnDivingGame_SetupRupeeThrowCam; } } -void EnDivingGame_SetupRupeeThrow(EnDivingGame* this, PlayState* play) { +void EnDivingGame_SetupRupeeThrowCam(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); @@ -328,7 +325,7 @@ void EnDivingGame_SetupRupeeThrow(EnDivingGame* this, PlayState* play) { this->subCamEyeNext.x = -280.0f; this->subCamEyeNext.y = -20.0f; this->subCamEyeNext.z = -240.0f; - if (!GET_EVENTCHKINF(EVENTCHKINF_38)) { + if (!GET_EVENTCHKINF(EVENTCHKINF_OBTAINED_SILVER_SCALE)) { this->rupeesLeftToThrow = 5; } else { this->rupeesLeftToThrow = 10; @@ -350,12 +347,11 @@ void EnDivingGame_SetupRupeeThrow(EnDivingGame* this, PlayState* play) { Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); Play_SetCameraFov(play, this->subCamId, play->mainCamera.fov); this->subCamTimer = 60; - this->actionFunc = EnDivingGame_RupeeThrow; + this->actionFunc = EnDivingGame_ThrowRupees; this->subCamVelFactor = 0.0f; } -// Throws rupee when this->spawnRuppyTimer == 0 -void EnDivingGame_RupeeThrow(EnDivingGame* this, PlayState* play) { +void EnDivingGame_ThrowRupees(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (func_800C0DB4(play, &this->actor.projectedPos)) { Audio_SetExtraFilter(0); @@ -378,10 +374,10 @@ void EnDivingGame_RupeeThrow(EnDivingGame* this, PlayState* play) { this->spawnRuppyTimer = 5; EnDivingGame_SpawnRuppy(this, play); this->rupeesLeftToThrow--; - if (!GET_EVENTCHKINF(EVENTCHKINF_38)) { - this->unk_296 = 30; + if (!GET_EVENTCHKINF(EVENTCHKINF_OBTAINED_SILVER_SCALE)) { + this->throwTimer = 30; } else { - this->unk_296 = 5; + this->throwTimer = 5; } if (this->rupeesLeftToThrow <= 0) { this->rupeesLeftToThrow = 0; @@ -394,10 +390,10 @@ void EnDivingGame_RupeeThrow(EnDivingGame* this, PlayState* play) { (fabsf(this->subCamAt.x - this->subCamAtNext.x) < 2.0f) && (fabsf(this->subCamAt.y - this->subCamAtNext.y) < 2.0f) && (fabsf(this->subCamAt.z - this->subCamAtNext.z) < 2.0f))) { - if (this->unk_2A2 != 0) { + if (this->rupeePhase != ENDIVINGGAME_RUPEE_PHASE_NONE) { this->subCamTimer = 70; - this->unk_2A2 = 2; - this->actionFunc = func_809EE780; + this->rupeePhase = ENDIVINGGAME_RUPEE_PHASE_SINKING; + this->actionFunc = EnDivingGame_UnderwaterViewCs; } else { this->actionFunc = EnDivingGame_SetupUnderwaterViewCs; } @@ -407,10 +403,10 @@ void EnDivingGame_RupeeThrow(EnDivingGame* this, PlayState* play) { // Called just before changing the camera to focus the underwater rupees. void EnDivingGame_SetupUnderwaterViewCs(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk_296 == 0) { - this->unk_2A2 = 1; + if (this->throwTimer == 0) { + this->rupeePhase = ENDIVINGGAME_RUPEE_PHASE_SWITCHING_CAM; this->subCamTimer = 100; - this->actionFunc = EnDivingGame_RupeeThrow; + this->actionFunc = EnDivingGame_ThrowRupees; this->subCamAt.x = this->subCamAtNext.x = -210.0f; this->subCamAt.y = this->subCamAtNext.y = -80.0f; this->subCamAt.z = this->subCamAtNext.z = -1020.0f; @@ -420,25 +416,23 @@ void EnDivingGame_SetupUnderwaterViewCs(EnDivingGame* this, PlayState* play) { } } -// EnDivingGame_SayStartAndWait ? -void func_809EE780(EnDivingGame* this, PlayState* play) { +void EnDivingGame_UnderwaterViewCs(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->subCamTimer == 0) { Play_ClearCamera(play, this->subCamId); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); this->actor.textId = 0x405A; Message_ContinueTextbox(play, this->actor.textId); - this->unk_292 = TEXT_STATE_EVENT; - this->actionFunc = func_809EE800; + this->nextTextState = TEXT_STATE_EVENT; + this->actionFunc = EnDivingGame_StartMinigame; } } -// EnDivingGame_TalkDuringMinigame -void func_809EE800(EnDivingGame* this, PlayState* play) { +void EnDivingGame_StartMinigame(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk_292 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { + if (this->nextTextState == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - if (!GET_EVENTCHKINF(EVENTCHKINF_38)) { + if (!GET_EVENTCHKINF(EVENTCHKINF_OBTAINED_SILVER_SCALE)) { Interface_SetTimer(50 + BREG(2)); } else { Interface_SetTimer(50 + BREG(2)); @@ -446,62 +440,60 @@ void func_809EE800(EnDivingGame* this, PlayState* play) { func_800F5ACC(NA_BGM_TIMED_MINI_GAME); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_7); this->actor.textId = 0x405B; - this->unk_292 = TEXT_STATE_EVENT; + this->nextTextState = TEXT_STATE_EVENT; this->state = ENDIVINGGAME_STATE_PLAYING; - this->actionFunc = EnDivingGame_Talk; + this->actionFunc = EnDivingGame_Idle; } } -void func_809EE8F0(EnDivingGame* this, PlayState* play) { +void EnDivingGame_TalkDuringMinigame(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((this->unk_292 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play))) { + if ((this->nextTextState == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play))) { Message_CloseTextbox(play); - this->actionFunc = EnDivingGame_Talk; + this->actionFunc = EnDivingGame_Idle; } else { EnDivingGame_HasMinigameFinished(this, play); } } -// EnDivingGame_SayCongratsAndWait ? // EnDivingGame_PlayerWonPhase1 -void func_809EE96C(EnDivingGame* this, PlayState* play) { +void EnDivingGame_EarnedScale(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((this->unk_292 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play))) { + if ((this->nextTextState == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play))) { Message_CloseTextbox(play); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_7); this->actor.textId = 0x4056; - this->unk_292 = TEXT_STATE_EVENT; + this->nextTextState = TEXT_STATE_EVENT; this->state = ENDIVINGGAME_STATE_AWARDPRIZE; - this->actionFunc = EnDivingGame_Talk; + this->actionFunc = EnDivingGame_Idle; } } -void func_809EEA00(EnDivingGame* this, PlayState* play) { +void EnDivingGame_WaitGiveScale(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((this->unk_292 == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play))) { + if ((this->nextTextState == Message_GetState(&play->msgCtx) && Message_ShouldAdvance(play))) { Message_CloseTextbox(play); this->actor.parent = NULL; Actor_OfferGetItem(&this->actor, play, GI_SCALE_SILVER, 90.0f, 10.0f); - this->actionFunc = func_809EEA90; + this->actionFunc = EnDivingGame_GiveScale; } } -void func_809EEA90(EnDivingGame* this, PlayState* play) { +void EnDivingGame_GiveScale(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Actor_HasParent(&this->actor, play)) { - this->actionFunc = func_809EEAF8; + this->actionFunc = EnDivingGame_EndMinigameAfterScaleGiven; } else { Actor_OfferGetItem(&this->actor, play, GI_SCALE_SILVER, 90.0f, 10.0f); } } -// Award the scale? -void func_809EEAF8(EnDivingGame* this, PlayState* play) { +void EnDivingGame_EndMinigameAfterScaleGiven(EnDivingGame* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { PRINTF(VT_FGCOL(GREEN) T("☆☆☆☆☆ 正常終了 ☆☆☆☆☆ \n", "☆☆☆☆☆ Normal termination ☆☆☆☆☆ \n") VT_RST); - this->allRupeesThrown = this->state = this->phase = this->unk_2A2 = this->grabbedRupeesCounter = 0; - SET_EVENTCHKINF(EVENTCHKINF_38); - this->actionFunc = func_809EDCB0; + this->allRupeesThrown = this->state = this->phase = this->rupeePhase = this->grabbedRupees = 0; + SET_EVENTCHKINF(EVENTCHKINF_OBTAINED_SILVER_SCALE); + this->actionFunc = EnDivingGame_Reset; } } @@ -514,8 +506,8 @@ void EnDivingGame_Update(Actor* thisx, PlayState* play2) { if (this->subCamTimer != 0) { this->subCamTimer--; } - if (this->unk_296 != 0) { - this->unk_296--; + if (this->throwTimer != 0) { + this->throwTimer--; } if (this->eyeTimer != 0) { this->eyeTimer--; diff --git a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h index f5e9c1cc77..70261f9758 100644 --- a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h +++ b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h @@ -17,16 +17,16 @@ typedef struct EnDivingGame { /* 0x0284 */ Vec3s headRot; /* 0x028A */ Vec3s torsoRot; /* 0x0290 */ s16 unk_290; // counter that only goes up - /* 0x0292 */ s16 unk_292; + /* 0x0292 */ s16 nextTextState; /* 0x0294 */ s16 subCamTimer; - /* 0x0296 */ s16 unk_296; // read by ExRuppy // timer? + /* 0x0296 */ s16 throwTimer; // read by ExRuppy // timer? /* 0x0298 */ s16 eyeTimer; /* 0x029A */ s16 spawnRuppyTimer; /* 0x029C */ s16 phase; /* 0x029E */ s16 eyeTexIndex; /* 0x02A0 */ s16 subCamId; - /* 0x02A2 */ s16 unk_2A2; // 0: , 1: , 2: Tells rupees to sink in water - /* 0x02A4 */ s16 grabbedRupeesCounter; + /* 0x02A2 */ s16 rupeePhase; + /* 0x02A4 */ s16 grabbedRupees; /* 0x02A6 */ s16 rupeesLeftToThrow; /* 0x02A8 */ s16 state; // minigameState? 0: default, 1: waiting to give the scale, 2: minigame started /* 0x02AA */ s16 extraWinCount; // counts how many times you have beaten the minigame **after** you got the scale. ExRuppy will reset it to zero if a 500 rupee is spawned. @@ -43,7 +43,7 @@ typedef struct EnDivingGame { /* 0x031C */ char unk_31C; // unused /* 0x031D */ u8 notPlayingMinigame; // flag /* 0x031E */ u8 allRupeesThrown; // flag - /* 0x031F */ u8 unk_31F; // flag + /* 0x031F */ u8 isDuplicate; // flag /* 0x0320 */ char unk_320[0x4]; // unused /* 0x0324 */ NpcInteractInfo interactInfo; /* 0x034C */ ColliderCylinder collider; @@ -61,4 +61,10 @@ typedef enum EnDivingGameState { /* 2 */ ENDIVINGGAME_STATE_PLAYING } EnDivingGameState; +typedef enum EnDivingGameRupeePhase { + /* 0 */ ENDIVINGGAME_RUPEE_PHASE_NONE, // No rupees underwater yet, but they might be thrown. + /* 1 */ ENDIVINGGAME_RUPEE_PHASE_SWITCHING_CAM, // Switching to underwater view. + /* 2 */ ENDIVINGGAME_RUPEE_PHASE_SINKING, // Rupees are spawned and sinking, player can grab them. +} EnDivingGameRupeePhase; + #endif diff --git a/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c b/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c index 6a2c4e6cfb..d7a0009701 100644 --- a/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c +++ b/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c @@ -76,7 +76,7 @@ void EnExRuppy_Init(Actor* thisx, PlayState* play) { this->actor.gravity = 0.0f; // If you haven't won the diving game before, you will always get 5 rupees - if (!GET_EVENTCHKINF(EVENTCHKINF_38)) { + if (!GET_EVENTCHKINF(EVENTCHKINF_OBTAINED_SILVER_SCALE)) { this->rupeeValue = 5; this->colorIdx = 1; } else { @@ -227,7 +227,7 @@ void EnExRuppy_DropIntoWater(EnExRuppy* this, PlayState* play) { Sfx_PlaySfxCentered(NA_SE_EV_RAINBOW_SHOWER - SFX_FLAG); divingGame = (EnDivingGame*)this->actor.parent; if ((divingGame != NULL) && (divingGame->actor.update != NULL) && - ((divingGame->unk_296 == 0) || (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) || (this->timer == 0))) { + ((divingGame->throwTimer == 0) || (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) || (this->timer == 0))) { this->invisible = true; this->actor.speed = 0.0f; this->actor.velocity.x = this->actor.velocity.y = this->actor.velocity.z = 0.0f; @@ -241,12 +241,13 @@ void EnExRuppy_EnterWater(EnExRuppy* this, PlayState* play) { EnDivingGame* divingGame = (EnDivingGame*)this->actor.parent; f32 throwDistance; - if ((divingGame != NULL) && (divingGame->actor.update != NULL) && (divingGame->unk_2A2 == 2)) { + if ((divingGame != NULL) && (divingGame->actor.update != NULL) && + (divingGame->rupeePhase == ENDIVINGGAME_RUPEE_PHASE_SINKING)) { this->invisible = false; this->actor.world.pos.x = ((Rand_ZeroOne() - 0.5f) * 300.0f) + -260.0f; this->actor.world.pos.y = ((Rand_ZeroOne() - 0.5f) * 200.0f) + 370.0f; throwDistance = this->throwDistance * -50.0f; - if (!GET_EVENTCHKINF(EVENTCHKINF_38)) { + if (!GET_EVENTCHKINF(EVENTCHKINF_OBTAINED_SILVER_SCALE)) { throwDistance += -500.0f; this->actor.world.pos.z = ((Rand_ZeroOne() - 0.5f) * 80.0f) + throwDistance; } else { @@ -299,7 +300,7 @@ void EnExRuppy_WaitInGame(EnExRuppy* this, PlayState* play) { } else if (this->actor.xyzDistToPlayerSq < SQ(collectRadius)) { Rupees_ChangeBy(this->rupeeValue); Sfx_PlaySfxCentered(NA_SE_SY_GET_RUPY); - divingGame->grabbedRupeesCounter++; + divingGame->grabbedRupees++; Actor_Kill(&this->actor); } } else {