From d4071a81234b5a8a52635ff4ad8f5a7946cd5660 Mon Sep 17 00:00:00 2001 From: fig02 Date: Tue, 19 Nov 2024 00:01:16 -0500 Subject: [PATCH] document blue warp mode --- include/z64player.h | 2 ++ .../actors/ovl_player_actor/z_player.c | 24 ++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/include/z64player.h b/include/z64player.h index c664a1462b..d73c62b1c5 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -900,6 +900,7 @@ typedef struct Player { /* 0x084F */ union { s8 actionVar1; s8 facingUpSlope; // Player_Action_SlideOnSlope: facing uphill when sliding on a slope + s8 isLakeHyliaCs; // Player_Action_BlueWarpArrive: In Lake Hylia CS after Water Temple. Floating down is delayed until a specific point in the cutscene. s8 bottleCatchType; // Player_Action_SwingBottle: entry type for `sBottleCatchInfo`, corresponds to actor caught in a bottle } av1; // "Action Variable 1": context dependent variable that has different meanings depending on what action is currently running @@ -909,6 +910,7 @@ typedef struct Player { s16 bonked; // Player_Action_Roll: set to true after bonking into a wall or an actor s16 startedTextbox; // Player_Action_SwingBottle: set to true when the textbox is started s16 inWater; // Player_Action_SwingBottle: true if a bottle is swung in water. Used to determine which bottle swing animation to use. + s16 playedLandingSfx; // Player_Action_BlueWarpArrive: Played sfx when landing on the ground } av2; // "Action Variable 2": context dependent variable that has different meanings depending on what action is currently running /* 0x0854 */ f32 unk_854; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 0d9ab95236..085af00015 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -312,7 +312,7 @@ void Player_Action_ExchangeItem(Player* this, PlayState* play); void Player_Action_SlideOnSlope(Player* this, PlayState* play); void Player_Action_8084F608(Player* this, PlayState* play); void Player_Action_8084F698(Player* this, PlayState* play); -void Player_Action_8084F710(Player* this, PlayState* play); +void Player_Action_BlueWarpArrive(Player* this, PlayState* play); void Player_Action_8084F88C(Player* this, PlayState* play); void Player_Action_8084F9A0(Player* this, PlayState* play); void Player_Action_8084F9C0(Player* this, PlayState* play); @@ -10499,15 +10499,17 @@ void Player_StartMode_Nothing(PlayState* play, Player* this) { } void Player_StartMode_BlueWarp(PlayState* play, Player* this) { - Player_SetupAction(play, this, Player_Action_8084F710, 0); + Player_SetupAction(play, this, Player_Action_BlueWarpArrive, 0); if ((play->sceneId == SCENE_LAKE_HYLIA) && IS_CUTSCENE_LAYER) { - this->av1.actionVar1 = 1; + this->av1.isLakeHyliaCs = true; } this->stateFlags1 |= PLAYER_STATE1_29; LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_okarina_warp_goal, 2.0f / 3.0f, 0.0f, 24.0f, ANIMMODE_ONCE, 0.0f); + + // Start high up in the air this->actor.world.pos.y += 800.0f; } @@ -14275,27 +14277,30 @@ void Player_Action_8084F698(Player* this, PlayState* play) { Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_KANKYO, 0.0f, 0.0f, 0.0f, 0, 0, 0, DEMOKANKYO_WARP_IN); } -void Player_Action_8084F710(Player* this, PlayState* play) { +void Player_Action_BlueWarpArrive(Player* this, PlayState* play) { s32 pad; - if ((this->av1.actionVar1 != 0) && (play->csCtx.curFrame < 305)) { + if ((this->av1.isLakeHyliaCs) && (play->csCtx.curFrame < 305)) { + // Delay falling down until frame 306 of the Lake Hylia cutscene after completing Water Temple this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; } else if (sYDistToFloor < 150.0f) { if (LinkAnimation_Update(play, &this->skelAnime)) { - if (this->av2.actionVar2 == 0) { + if (!this->av2.playedLandingSfx) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; Player_PlayLandingSfx(this); - this->av2.actionVar2 = 1; + this->av2.playedLandingSfx = true; } } else { if ((play->sceneId == SCENE_KOKIRI_FOREST) && Player_StartCsAction(play, this)) { return; } + func_80853080(this, play); } } + Math_SmoothStepToF(&this->actor.velocity.y, 2.0f, 0.3f, 8.0f, 0.5f); } @@ -14304,9 +14309,10 @@ void Player_Action_8084F710(Player* this, PlayState* play) { } if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.playerCue != NULL)) { - f32 sp28 = this->actor.world.pos.y; + f32 savedYPos = this->actor.world.pos.y; + func_808529D0(play, this, play->csCtx.playerCue); - this->actor.world.pos.y = sp28; + this->actor.world.pos.y = savedYPos; } }