diff --git a/include/z64player.h b/include/z64player.h index ab7e099c50..8cd8940d9b 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 9d84bf3ab4..3cefabff37 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); @@ -10501,15 +10501,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; } @@ -10584,7 +10586,7 @@ void Player_StartMode_KnockedOver(PlayState* play, Player* this) { void Player_StartMode_WarpSong(PlayState* play, Player* this) { Player_SetupAction(play, this, Player_Action_8084F698, 0); - this->actor.draw = NULL; + this->actor.draw = NULL; // Start invisible this->stateFlags1 |= PLAYER_STATE1_29; } @@ -14285,15 +14287,16 @@ 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); @@ -14303,9 +14306,11 @@ void Player_Action_8084F710(Player* this, PlayState* play) { 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); } @@ -14314,9 +14319,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; } }