From b4c97ce17eb35329b4a7e3d98d7f06d558683f6d Mon Sep 17 00:00:00 2001 From: fig02 Date: Mon, 2 Jan 2023 06:15:48 -0500 Subject: [PATCH] Cleanup player speed and yaw variable names (#1480) * initial changes * add comments --- include/z64player.h | 6 +- src/code/code_800430A0.c | 2 +- src/code/z_onepointdemo.c | 8 +- src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c | 12 +- .../actors/ovl_En_Encount2/z_en_encount2.c | 2 +- src/overlays/actors/ovl_En_Fr/z_en_fr.c | 2 +- src/overlays/actors/ovl_En_Reeba/z_en_reeba.c | 17 +- src/overlays/actors/ovl_En_Ru1/z_en_ru1.c | 2 +- .../actors/ovl_En_Siofuki/z_en_siofuki.c | 8 +- src/overlays/actors/ovl_En_Skj/z_en_skj.c | 2 +- .../ovl_En_Syateki_Itm/z_en_syateki_itm.c | 2 +- .../actors/ovl_En_Torch2/z_en_torch2.c | 24 +- .../actors/ovl_En_Wood02/z_en_wood02.c | 2 +- src/overlays/actors/ovl_En_Zl4/z_en_zl4.c | 4 +- .../actors/ovl_player_actor/z_player.c | 588 +++++++++--------- 15 files changed, 341 insertions(+), 340 deletions(-) diff --git a/include/z64player.h b/include/z64player.h index f08f0719b5..3610c0c31c 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -686,9 +686,9 @@ typedef struct Player { /* 0x0834 */ s16 unk_834; /* 0x0836 */ s8 unk_836; /* 0x0837 */ u8 unk_837; - /* 0x0838 */ f32 linearVelocity; - /* 0x083C */ s16 currentYaw; - /* 0x083E */ s16 targetYaw; + /* 0x0838 */ f32 speedXZ; // Controls horizontal speed, used for `actor.speed`. Current or target value depending on context. + /* 0x083C */ s16 yaw; // General yaw value, used both for world and shape rotation. Current or target value depending on context. + /* 0x083E */ s16 zTargetYaw; // yaw relating to Z targeting/"parallel" mode /* 0x0840 */ u16 underwaterTimer; /* 0x0842 */ s8 meleeWeaponAnimation; /* 0x0843 */ s8 meleeWeaponState; diff --git a/src/code/code_800430A0.c b/src/code/code_800430A0.c index 5ca844a126..98068012f6 100644 --- a/src/code/code_800430A0.c +++ b/src/code/code_800430A0.c @@ -59,7 +59,7 @@ void DynaPolyActor_UpdateCarriedActorRotY(CollisionContext* colCtx, s32 bgId, Ac s16 rotY = colCtx->dyna.bgActors[bgId].curTransform.rot.y - colCtx->dyna.bgActors[bgId].prevTransform.rot.y; if (carriedActor->id == ACTOR_PLAYER) { - ((Player*)carriedActor)->currentYaw += rotY; + ((Player*)carriedActor)->yaw += rotY; } carriedActor->shape.rot.y += rotY; diff --git a/src/code/z_onepointdemo.c b/src/code/z_onepointdemo.c index bf1a2a7521..cfe61236f1 100644 --- a/src/code/z_onepointdemo.c +++ b/src/code/z_onepointdemo.c @@ -664,7 +664,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Play_SetCameraAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 0; subCam->fov = 75.0f; - player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = spD0.yaw + 0x7FFF; + player->actor.shape.rot.y = player->actor.world.rot.y = player->yaw = spD0.yaw + 0x7FFF; func_8002DF54(play, NULL, PLAYER_CSMODE_8); break; @@ -708,7 +708,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act break; case 3390: - player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = -0x3FD9; + player->actor.shape.rot.y = player->actor.world.rot.y = player->yaw = -0x3FD9; csInfo->keyFrames = D_80121DB4; csInfo->keyFrameCount = ARRAY_COUNT(D_80121DB4); @@ -733,7 +733,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act D_80121F1C[0].eyeTargetInit = play->view.eye; D_80121F1C[0].fovTargetInit = play->view.fovy; Actor_GetFocus(&spA0, actor); - player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = spA0.rot.y; + player->actor.shape.rot.y = player->actor.world.rot.y = player->yaw = spA0.rot.y; csInfo->keyFrames = D_80121F1C; csInfo->keyFrameCount = ARRAY_COUNT(D_80121F1C); @@ -857,7 +857,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_801225D4; csInfo->keyFrameCount = ARRAY_COUNT(D_801225D4); - player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = 0x3FFC; + player->actor.shape.rot.y = player->actor.world.rot.y = player->yaw = 0x3FFC; Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); func_8002DF54(play, NULL, PLAYER_CSMODE_8); break; diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index 7706990392..fe2d9cdabe 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -363,10 +363,10 @@ void BossSst_HeadSetupIntro(BossSst* this, PlayState* play) { player->actor.world.pos.x = sRoomCenter.x; player->actor.world.pos.y = ROOM_CENTER_Y + 1000.0f; player->actor.world.pos.z = sRoomCenter.z; - player->linearVelocity = player->actor.velocity.y = 0.0f; + player->speedXZ = player->actor.velocity.y = 0.0f; player->actor.shape.rot.y = -0x8000; - player->targetYaw = -0x8000; - player->currentYaw = -0x8000; + player->zTargetYaw = -0x8000; + player->yaw = -0x8000; player->fallStartHeight = 0; player->stateFlags1 |= PLAYER_STATE1_5; @@ -422,10 +422,10 @@ void BossSst_HeadIntro(BossSst* this, PlayState* play) { if (player->actor.world.pos.y > 100.0f) { player->actor.world.pos.x = sRoomCenter.x; player->actor.world.pos.z = sRoomCenter.z; - player->linearVelocity = 0; + player->speedXZ = 0; player->actor.shape.rot.y = -0x8000; - player->targetYaw = -0x8000; - player->currentYaw = -0x8000; + player->zTargetYaw = -0x8000; + player->yaw = -0x8000; } Math_Vec3f_Copy(&sSubCamAt, &player->actor.world.pos); diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index d74ca19aee..d8a342d425 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -203,7 +203,7 @@ void EnEncount2_SpawnRocks(EnEncount2* this, PlayState* play) { tempVec2X = Rand_CenteredFloat(10.0f) + player->actor.world.pos.x; tempVec2Z = Rand_CenteredFloat(10.0f) + player->actor.world.pos.z; } else { - if (player->linearVelocity != 0.0f) { + if (player->speedXZ != 0.0f) { // rock spawn pos is between 300 and 600 units from the camera depending on the camera yaw. // Rocks will generally spawn closer to the camera in the X axis than in the Z axis. tempVec2X = Rand_CenteredFloat(200.0f) + (play->view.eye.x + (tempVec2X * 300.0f)); diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/src/overlays/actors/ovl_En_Fr/z_en_fr.c index c922a43884..0fe3dc394c 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -620,7 +620,7 @@ void EnFr_Idle(EnFr* this, PlayState* play) { player->actor.world.pos.x = this->actor.world.pos.x; // x = 990.0f player->actor.world.pos.y = this->actor.world.pos.y; // y = 205.0f player->actor.world.pos.z = this->actor.world.pos.z; // z = -1220.0f - player->currentYaw = player->actor.world.rot.y = player->actor.shape.rot.y = this->actor.world.rot.y; + player->yaw = player->actor.world.rot.y = player->actor.shape.rot.y = this->actor.world.rot.y; this->reward = GI_NONE; this->actionFunc = EnFr_Activate; } else if (EnFr_IsAboveAndWithin30DistXZ(player, this)) { diff --git a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c index 5eb4b20ab1..565c291d47 100644 --- a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c +++ b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c @@ -178,12 +178,13 @@ void EnReeba_Destroy(Actor* thisx, PlayState* play) { void EnReeba_SetupSurface(EnReeba* this, PlayState* play) { f32 frames = Animation_GetLastFrame(&object_reeba_Anim_0001E4); Player* player = GET_PLAYER(play); - s16 playerSpeed; + s16 absPlayerSpeedXZ; Animation_Change(&this->skelanime, &object_reeba_Anim_0001E4, 2.0f, 0.0f, frames, ANIMMODE_LOOP, -10.0f); - playerSpeed = fabsf(player->linearVelocity); - this->waitTimer = 20 - playerSpeed * 2; + absPlayerSpeedXZ = fabsf(player->speedXZ); + this->waitTimer = 20 - absPlayerSpeedXZ * 2; + if (this->waitTimer < 0) { this->waitTimer = 2; } @@ -205,7 +206,7 @@ void EnReeba_SetupSurface(EnReeba* this, PlayState* play) { void EnReeba_Surface(EnReeba* this, PlayState* play) { Player* player = GET_PLAYER(play); - f32 playerLinearVel; + f32 playerSpeedXZ; SkelAnime_Update(&this->skelanime); @@ -222,23 +223,23 @@ void EnReeba_Surface(EnReeba* this, PlayState* play) { } else { this->yOffsetStep = 0.0f; this->actor.shape.yOffset = 0.0f; - playerLinearVel = player->linearVelocity; + playerSpeedXZ = player->speedXZ; switch (this->aimType) { case 0: this->actor.world.rot.y = this->actor.yawTowardsPlayer; break; case 1: - this->actor.world.rot.y = this->actor.yawTowardsPlayer + (800.0f * playerLinearVel); + this->actor.world.rot.y = this->actor.yawTowardsPlayer + (800.0f * playerSpeedXZ); break; case 2: case 3: this->actor.world.rot.y = this->actor.yawTowardsPlayer + - (player->actor.shape.rot.y - this->actor.yawTowardsPlayer) * (playerLinearVel * 0.15f); + (player->actor.shape.rot.y - this->actor.yawTowardsPlayer) * (playerSpeedXZ * 0.15f); break; case 4: - this->actor.world.rot.y = this->actor.yawTowardsPlayer - (800.0f * playerLinearVel); + this->actor.world.rot.y = this->actor.yawTowardsPlayer - (800.0f * playerSpeedXZ); break; } diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index 5c14797ab2..1e9ccb6042 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -859,7 +859,7 @@ void func_80AEC780(EnRu1* this, PlayState* play) { play->csCtx.script = D_80AF0880; gSaveContext.cutsceneTrigger = 1; - player->linearVelocity = 0.0f; + player->speedXZ = 0.0f; this->action = 8; } } diff --git a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c index 4a018e28e4..ce2d541502 100644 --- a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c +++ b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c @@ -153,12 +153,12 @@ void func_80AFBE8C(EnSiofuki* this, PlayState* play) { speedScale = dist2d / (this->dyna.actor.scale.x * 40.0f * 10.0f); speedScale = CLAMP_MIN(speedScale, 0.0f); speedScale = CLAMP_MAX(speedScale, 1.0f); - player->linearVelocity *= speedScale; + player->speedXZ *= speedScale; Math_ApproachF(&this->targetAppliedSpeed, 3.0f, 1.0f, 1.0f); Math_ApproachF(&this->appliedSpeed, this->targetAppliedSpeed, 1.0f, 0.3f * speedScale); } else { this->appliedYaw = player->actor.world.rot.y; - player->linearVelocity /= 2.0f; + player->speedXZ /= 2.0f; Math_ApproachF(&this->targetAppliedSpeed, 3.0f, 1.0f, 1.0f); Math_ApproachF(&this->appliedSpeed, this->targetAppliedSpeed, 1.0f, 0.1f); } @@ -168,8 +168,8 @@ void func_80AFBE8C(EnSiofuki* this, PlayState* play) { } } else { if (this->applySpeed) { - player->linearVelocity = this->appliedSpeed + player->linearVelocity; - player->currentYaw = this->appliedYaw; + player->speedXZ = this->appliedSpeed + player->speedXZ; + player->yaw = this->appliedYaw; } this->targetAppliedSpeed = 0.0f; diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index 1a47a9f200..25dba5db71 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -1356,7 +1356,7 @@ void EnSkj_SariasSongShortStumpUpdate(Actor* thisx, PlayState* play) { void EnSkj_TurnPlayer(EnSkj* this, Player* player) { Math_SmoothStepToS(&player->actor.shape.rot.y, this->actor.world.rot.y, 5, 2000, 0); player->actor.world.rot.y = player->actor.shape.rot.y; - player->currentYaw = player->actor.shape.rot.y; + player->yaw = player->actor.shape.rot.y; } void EnSkj_SetupWaitForOcarina(EnSkj* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c index 5863d8d06e..2546911de3 100644 --- a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c +++ b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c @@ -105,7 +105,7 @@ void EnSyatekiItm_Idle(EnSyatekiItm* this, PlayState* play) { player->actor.world.pos.x = -12.0f; player->actor.world.pos.y = 20.0f; player->actor.world.pos.z = 182.0f; - player->currentYaw = player->actor.world.rot.y = player->actor.shape.rot.y = 0x7F03; + player->yaw = player->actor.world.rot.y = player->actor.shape.rot.y = 0x7F03; player->actor.world.rot.x = player->actor.shape.rot.x = player->actor.world.rot.z = player->actor.shape.rot.z = 0; func_8008EF44(play, 15); diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index db79e6f9dd..7623bd8a63 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -153,7 +153,7 @@ s32 EnTorch2_SwingSword(PlayState* play, Input* input, Player* this) { s32 attackDelay = 7; Player* player = GET_PLAYER(play); - if ((this->linearVelocity < 0.0f) || (player->linearVelocity < 0.0f)) { + if ((this->speedXZ < 0.0f) || (player->speedXZ < 0.0f)) { return 0; } if (gSaveContext.health < 0x50) { @@ -368,9 +368,9 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { this->actor.flags &= ~ACTOR_FLAG_0; sSwordJumpTimer = 27; player->meleeWeaponState = 0; - player->linearVelocity = 0.0f; + player->speedXZ = 0.0f; this->invincibilityTimer = -7; - this->linearVelocity = 0.0f; + this->speedXZ = 0.0f; player->skelAnime.curFrame = 2.0f; LinkAnimation_Update(play, &player->skelAnime); sHoldShieldTimer = 0; @@ -630,7 +630,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { */ input->cur.button = 0; input->press.button = 0; - this->linearVelocity = 0.0f; + this->speedXZ = 0.0f; } play->playerUpdate(this, play, input); @@ -639,17 +639,17 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { * Handles sword clanks and removes their recoil for both Links. Dark Link staggers * if he's had to counter with enough different sword animations in a row. */ - if (this->linearVelocity == -18.0f) { + if (this->speedXZ == -18.0f) { staggerThreshold = (u32)Rand_CenteredFloat(2.0f) + 6; if (gSaveContext.health < 0x50) { staggerThreshold = (u32)Rand_CenteredFloat(2.0f) + 3; } if (this->actor.xzDistToPlayer > 80.0f) { - this->linearVelocity = 1.2f; + this->speedXZ = 1.2f; } else if (this->actor.xzDistToPlayer < 70.0f) { - this->linearVelocity = -1.5f; + this->speedXZ = -1.5f; } else { - this->linearVelocity = 1.0f; + this->speedXZ = 1.0f; } if (staggerThreshold < sStaggerCount) { this->skelAnime.playSpeed *= 0.6f; @@ -658,13 +658,13 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { sStaggerCount = 0; } } - if (player->linearVelocity == -18.0f) { + if (player->speedXZ == -18.0f) { if (this->actor.xzDistToPlayer > 80.0f) { - player->linearVelocity = 1.2f; + player->speedXZ = 1.2f; } else if (this->actor.xzDistToPlayer < 70.0f) { - player->linearVelocity = -1.5f; + player->speedXZ = -1.5f; } else { - player->linearVelocity = 1.0f; + player->speedXZ = 1.0f; } } /* diff --git a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c index 302b4ad1cb..5f4164e3fe 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -382,7 +382,7 @@ void EnWood02_Update(Actor* thisx, PlayState* play2) { if (this->unk_14C >= -1) { if (((player->rideActor == NULL) && (sqrt(this->actor.xyzDistToPlayerSq) < 20.0) && - (player->linearVelocity != 0.0f)) || + (player->speedXZ != 0.0f)) || ((player->rideActor != NULL) && (sqrt(this->actor.xyzDistToPlayerSq) < 60.0) && (player->rideActor->speed != 0.0f))) { if ((this->unk_14C >= 0) && (this->unk_14C < 0x64)) { diff --git a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c index 79fd3860aa..6515f2da4b 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -326,7 +326,7 @@ s32 EnZl4_SetupFromLegendCs(EnZl4* this, PlayState* play) { playerx->world.pos.x += 56.0f * Math_SinS(rotY); playerx->world.pos.z += 56.0f * Math_CosS(rotY); - player->linearVelocity = playerx->speed = 0.0f; + player->speedXZ = playerx->speed = 0.0f; EnZl4_SetActiveCamMove(play, 5); Letterbox_SetSizeTarget(32); @@ -438,7 +438,7 @@ s32 EnZl4_CsWaitForPlayer(EnZl4* this, PlayState* play) { playerx->world.pos.x += 56.0f * Math_SinS(rotY); playerx->world.pos.z += 56.0f * Math_CosS(rotY); playerx->speed = 0.0f; - player->linearVelocity = 0.0f; + player->speedXZ = 0.0f; return true; } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 2c125581f2..81a6c1d530 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -1573,14 +1573,14 @@ static LinkAnimationHeader* D_808543D4[] = { }; // return type can't be void due to regalloc in func_8084FCAC -BAD_RETURN(s32) func_80832210(Player* this) { +BAD_RETURN(s32) Player_ZeroSpeedXZ(Player* this) { this->actor.speed = 0.0f; - this->linearVelocity = 0.0f; + this->speedXZ = 0.0f; } // return type can't be void due to regalloc in func_8083F72C BAD_RETURN(s32) func_80832224(Player* this) { - func_80832210(this); + Player_ZeroSpeedXZ(this); this->unk_6AD = 0; } @@ -1924,7 +1924,7 @@ void func_80832F54(PlayState* play, Player* this, s32 flags) { } this->skelAnime.moveFlags = flags; - func_80832210(this); + Player_ZeroSpeedXZ(this); AnimationContext_DisableQueue(play); } @@ -2259,8 +2259,8 @@ s32 func_80833B54(Player* this) { if (this->stateFlags1 & PLAYER_STATE1_4) { this->stateFlags1 &= ~PLAYER_STATE1_4; - if (this->linearVelocity == 0.0f) { - this->currentYaw = this->actor.shape.rot.y; + if (this->speedXZ == 0.0f) { + this->yaw = this->actor.shape.rot.y; } } @@ -2829,7 +2829,7 @@ s32 func_808351D4(Player* this, PlayState* play) { } } this->unk_834 = 10; - func_80832210(this); + Player_ZeroSpeedXZ(this); } else { this->stateFlags1 |= PLAYER_STATE1_9; } @@ -2892,10 +2892,10 @@ void func_808355DC(Player* this) { if (!(this->skelAnime.moveFlags & 0x80) && (this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && (D_80853608 < 0x2000)) { - this->currentYaw = this->actor.shape.rot.y = this->actor.wallYaw + 0x8000; + this->yaw = this->actor.shape.rot.y = this->actor.wallYaw + 0x8000; } - this->targetYaw = this->actor.shape.rot.y; + this->zTargetYaw = this->actor.shape.rot.y; } s32 func_80835644(PlayState* play, Player* this, Actor* arg2) { @@ -3271,7 +3271,7 @@ s32 func_80836670(Player* this, PlayState* play) { func_80832264(play, this, &gPlayerAnim_link_hook_fly_start); func_80832F54(play, this, 0x9B); func_80832224(this); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->hoverBootsTimer = 0; this->unk_6AE |= 0x43; @@ -3291,14 +3291,14 @@ s32 func_80836670(Player* this, PlayState* play) { } if (this->unk_830 != 0.0f) { - if ((func_80833350(this) == 0) || (this->linearVelocity != 0.0f)) { + if ((func_80833350(this) == 0) || (this->speedXZ != 0.0f)) { AnimationContext_SetCopyFalse(play, this->skelAnime.limbCount, this->skelAnime2.jointTable, this->skelAnime.jointTable, D_80853410); } Math_StepToF(&this->unk_830, 0.0f, 0.25f); AnimationContext_SetInterp(play, this->skelAnime.limbCount, this->skelAnime.jointTable, this->skelAnime2.jointTable, 1.0f - this->unk_830); - } else if ((func_80833350(this) == 0) || (this->linearVelocity != 0.0f)) { + } else if ((func_80833350(this) == 0) || (this->speedXZ != 0.0f)) { AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable, this->skelAnime2.jointTable, D_80853410); } else { @@ -3326,10 +3326,10 @@ void func_808368EC(Player* this, PlayState* play) { Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_664->focus.pos), 4000); } else if ((this->stateFlags1 & PLAYER_STATE1_17) && !(this->stateFlags2 & (PLAYER_STATE2_5 | PLAYER_STATE2_6))) { - Math_ScaledStepToS(&this->actor.shape.rot.y, this->targetYaw, 4000); + Math_ScaledStepToS(&this->actor.shape.rot.y, this->zTargetYaw, 4000); } } else if (!(this->stateFlags2 & PLAYER_STATE2_6)) { - Math_ScaledStepToS(&this->actor.shape.rot.y, this->currentYaw, 2000); + Math_ScaledStepToS(&this->actor.shape.rot.y, this->yaw, 2000); } this->unk_87C = this->actor.shape.rot.y - previousYaw; @@ -3532,7 +3532,7 @@ s32 func_80836FAC(PlayState* play, Player* this, f32* arg2, s16* arg3, f32 arg4) } s32 func_8083721C(Player* this) { - return Math_StepToF(&this->linearVelocity, 0.0f, REG(43) / 100.0f); + return Math_StepToF(&this->speedXZ, 0.0f, REG(43) / 100.0f); } s32 func_80837268(Player* this, f32* arg1, s16* arg2, f32 arg3, PlayState* play) { @@ -3545,7 +3545,7 @@ s32 func_80837268(Player* this, f32* arg1, s16* arg2, f32 arg3, PlayState* play) return 0; } } else if (func_80833B2C(this)) { - *arg2 = this->targetYaw; + *arg2 = this->zTargetYaw; } return 0; @@ -3791,7 +3791,7 @@ void func_80837948(PlayState* play, Player* this, s32 arg2) { func_80832F54(play, this, 0x209); } - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; if (Player_HoldsBrokenKnife(this)) { temp = 1; @@ -3898,7 +3898,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, func_80835C58(play, this, func_8084E30C, 0); Player_RequestRumble(this, 180, 20, 50, 0); - this->linearVelocity = 4.0f; + this->speedXZ = 4.0f; this->actor.velocity.y = 0.0f; sp2C = &gPlayerAnim_link_swimer_swim_hit; @@ -3917,14 +3917,14 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, this->unk_850 = 4; this->actor.speed = 3.0f; - this->linearVelocity = 3.0f; + this->speedXZ = 3.0f; this->actor.velocity.y = 6.0f; func_80832C2C(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_damage_run, this->modelAnimType)); func_80832698(this, NA_SE_VO_LI_DAMAGE_S); } else { this->actor.speed = arg3; - this->linearVelocity = arg3; + this->speedXZ = arg3; this->actor.velocity.y = arg4; if (ABS(arg5) > 0x4000) { @@ -3943,7 +3943,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, this->hoverBootsTimer = 0; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } else { - if ((this->linearVelocity > 4.0f) && !func_8008E9C4(this)) { + if ((this->speedXZ > 4.0f) && !func_8008E9C4(this)) { this->unk_890 = 20; Player_RequestRumble(this, 120, 20, 10, 0); func_80832698(this, NA_SE_VO_LI_DAMAGE_S); @@ -3959,7 +3959,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, Player_RequestRumble(this, 120, 20, 10, 0); } else { Player_RequestRumble(this, 180, 20, 100, 0); - this->linearVelocity = 23.0f; + this->speedXZ = 23.0f; sp28 += 4; } @@ -3977,7 +3977,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, } this->actor.shape.rot.y += arg5; - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; this->actor.world.rot.y = this->actor.shape.rot.y; if (ABS(arg5) > 0x4000) { this->actor.shape.rot.y += 0x8000; @@ -4132,8 +4132,8 @@ s32 func_808382DC(Player* this, PlayState* play) { } if (!(this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21))) { - this->linearVelocity = -18.0f; - this->currentYaw = this->actor.shape.rot.y; + this->speedXZ = -18.0f; + this->yaw = this->actor.shape.rot.y; } } @@ -4264,7 +4264,7 @@ s32 func_80838A14(Player* this, PlayState* play) { if (this->ageProperties->unk_14 <= sp34) { sp38 = &gPlayerAnim_link_normal_250jump_start; - this->linearVelocity = 1.0f; + this->speedXZ = 1.0f; } else { wallPolyNormalX = COLPOLY_GET_NORMAL(this->actor.wallPoly->normal.x); wallPolyNormalZ = COLPOLY_GET_NORMAL(this->actor.wallPoly->normal.z); @@ -4298,14 +4298,14 @@ s32 func_80838A14(Player* this, PlayState* play) { LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, sp38, 1.3f); AnimationContext_DisableQueue(play); - this->actor.shape.rot.y = this->currentYaw = this->actor.wallYaw + 0x8000; + this->actor.shape.rot.y = this->yaw = this->actor.wallYaw + 0x8000; return 1; } } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->unk_88C == 1) && (this->unk_88D >= 3)) { temp = (this->wallHeight * 0.08f) + 5.5f; func_808389E8(this, &gPlayerAnim_link_normal_jump, temp, play); - this->linearVelocity = 2.5f; + this->speedXZ = 2.5f; return 1; } @@ -4408,7 +4408,7 @@ s32 func_80839034(PlayState* play, Player* this, CollisionPoly* poly, u32 bgId) s32 exitIndex; s32 temp; s32 sp34; - f32 linearVel; + f32 speedXZ; s32 yaw; if (this->actor.category == ACTORCAT_PLAYER) { @@ -4468,17 +4468,17 @@ s32 func_80839034(PlayState* play, Player* this, CollisionPoly* poly, u32 bgId) gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.natureAmbienceId = NATURE_ID_DISABLED; } else { - linearVel = this->linearVelocity; + speedXZ = this->speedXZ; - if (linearVel < 0.0f) { + if (speedXZ < 0.0f) { this->actor.world.rot.y += 0x8000; - linearVel = -linearVel; + speedXZ = -speedXZ; } - if (linearVel > R_RUN_SPEED_LIMIT / 100.0f) { + if (speedXZ > R_RUN_SPEED_LIMIT / 100.0f) { gSaveContext.entranceSpeed = R_RUN_SPEED_LIMIT / 100.0f; } else { - gSaveContext.entranceSpeed = linearVel; + gSaveContext.entranceSpeed = speedXZ; } if (sConveyorSpeedIndex != CONVEYOR_SPEED_DISABLED) { @@ -4490,7 +4490,7 @@ s32 func_80839034(PlayState* play, Player* this, CollisionPoly* poly, u32 bgId) } } else { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - func_80832210(this); + Player_ZeroSpeedXZ(this); } } @@ -4612,14 +4612,14 @@ s32 func_80839800(Player* this, PlayState* play) { if (this->doorType == PLAYER_DOORTYPE_SLIDING) { slidingDoor = (SlidingDoorActorBase*)doorActor; - this->currentYaw = slidingDoor->dyna.actor.home.rot.y; + this->yaw = slidingDoor->dyna.actor.home.rot.y; if (doorDirection > 0) { - this->currentYaw -= 0x8000; + this->yaw -= 0x8000; } - this->actor.shape.rot.y = this->currentYaw; + this->actor.shape.rot.y = this->yaw; - if (this->linearVelocity <= 0.0f) { - this->linearVelocity = 0.1f; + if (this->speedXZ <= 0.0f) { + this->speedXZ = 0.1f; } func_80838E70(play, this, 50.0f, this->actor.shape.rot.y); @@ -4641,7 +4641,7 @@ s32 func_80839800(Player* this, PlayState* play) { func_80832B0C(play, this, func_80833338(this)); this->skelAnime.endFrame = 0.0f; } else { - this->linearVelocity = 0.1f; + this->speedXZ = 0.1f; } if (slidingDoor->dyna.actor.category == ACTORCAT_DOOR) { @@ -4679,7 +4679,7 @@ s32 func_80839800(Player* this, PlayState* play) { this->actor.shape.rot.y = doorActor->shape.rot.y - 0x8000; } - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; sp6C = (doorDirection * 22.0f); this->actor.world.pos.x = doorActor->world.pos.x + sp6C * sp74; @@ -4768,13 +4768,13 @@ void func_80839E88(Player* this, PlayState* play) { this->unk_874 = this->unk_870; func_80832284(play, this, anim); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } void func_80839F30(Player* this, PlayState* play) { func_80835C58(play, this, func_808407CC, 1); func_80832B0C(play, this, func_80833338(this)); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } void func_80839F90(Player* this, PlayState* play) { @@ -4843,7 +4843,7 @@ void func_8083A0F4(PlayState* play, Player* this) { (Math_SinS(interactRangeActor->yawTowardsPlayer) * 20.0f) + interactRangeActor->world.pos.x; this->actor.world.pos.z = (Math_CosS(interactRangeActor->yawTowardsPlayer) * 20.0f) + interactRangeActor->world.pos.z; - this->currentYaw = this->actor.shape.rot.y = interactRangeActor->yawTowardsPlayer + 0x8000; + this->yaw = this->actor.shape.rot.y = interactRangeActor->yawTowardsPlayer + 0x8000; anim = &gPlayerAnim_link_normal_nocarry_free; } else { func_80835C58(play, this, func_80846050, 0); @@ -4911,18 +4911,18 @@ s32 func_8083A4A8(Player* this, PlayState* play) { LinkAnimationHeader* anim; f32 temp; - yawDiff = this->currentYaw - this->actor.shape.rot.y; + yawDiff = this->yaw - this->actor.shape.rot.y; - if ((ABS(yawDiff) < 0x1000) && (this->linearVelocity > 4.0f)) { + if ((ABS(yawDiff) < 0x1000) && (this->speedXZ > 4.0f)) { anim = &gPlayerAnim_link_normal_run_jump; } else { anim = &gPlayerAnim_link_normal_jump; } - if (this->linearVelocity > (IREG(66) / 100.0f)) { + if (this->speedXZ > (IREG(66) / 100.0f)) { temp = IREG(67) / 100.0f; } else { - temp = (IREG(68) / 100.0f) + ((IREG(69) * this->linearVelocity) / 1000.0f); + temp = (IREG(68) / 100.0f) + ((IREG(69) * this->speedXZ) / 1000.0f); } func_80838940(this, anim, temp, play, NA_SE_VO_LI_AUTO_JUMP); @@ -4941,7 +4941,7 @@ void func_8083A5C4(PlayState* play, Player* this, CollisionPoly* arg2, f32 arg3, this->actor.world.pos.x -= (arg3 + 1.0f) * nx; this->actor.world.pos.z -= (arg3 + 1.0f) * nz; - this->actor.shape.rot.y = this->currentYaw = Math_Atan2S(nz, nx); + this->actor.shape.rot.y = this->yaw = Math_Atan2S(nz, nx); func_80832224(this); func_80832CFC(this); @@ -4991,8 +4991,8 @@ s32 func_8083A6AC(Player* this, PlayState* play) { if (sp50) { func_80836898(play, this, func_8083A3B0); - this->currentYaw += 0x8000; - this->actor.shape.rot.y = this->currentYaw; + this->yaw += 0x8000; + this->actor.shape.rot.y = this->yaw; this->stateFlags1 |= PLAYER_STATE1_21; func_80832F54(play, this, 0x9F); @@ -5045,7 +5045,7 @@ void func_8083AA10(Player* this, PlayState* play) { if ((D_80853604 == FLOOR_PROPERTY_7) || (this->meleeWeaponState != 0)) { Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos); - func_80832210(this); + Player_ZeroSpeedXZ(this); return; } @@ -5055,7 +5055,7 @@ void func_8083AA10(Player* this, PlayState* play) { return; } - sp5C = (s16)(this->currentYaw - this->actor.shape.rot.y); + sp5C = (s16)(this->yaw - this->actor.shape.rot.y); func_80835C58(play, this, func_8084411C, 1); func_80832440(play, this); @@ -5064,7 +5064,7 @@ void func_8083AA10(Player* this, PlayState* play) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_LEAVE) && !(this->stateFlags1 & PLAYER_STATE1_27) && (D_80853604 != FLOOR_PROPERTY_6) && (D_80853604 != FLOOR_PROPERTY_9) && (D_80853600 > 20.0f) && - (this->meleeWeaponState == 0) && (ABS(sp5C) < 0x2000) && (this->linearVelocity > 3.0f)) { + (this->meleeWeaponState == 0) && (ABS(sp5C) < 0x2000) && (this->speedXZ > 3.0f)) { if ((D_80853604 == FLOOR_PROPERTY_11) && !(this->stateFlags1 & PLAYER_STATE1_11)) { @@ -5333,7 +5333,7 @@ s32 func_8083B040(Player* this, PlayState* play) { } this->stateFlags1 |= PLAYER_STATE1_20; func_80078884(NA_SE_SY_CAMERA_ZOOM_UP); - func_80832210(this); + Player_ZeroSpeedXZ(this); return 1; } else { this->unk_6AD = 0; @@ -5454,14 +5454,14 @@ s32 func_8083B998(Player* this, PlayState* play) { return 0; } -void func_8083BA90(PlayState* play, Player* this, s32 arg2, f32 xzVelocity, f32 yVelocity) { +void func_8083BA90(PlayState* play, Player* this, s32 arg2, f32 xzSpeed, f32 yVelocity) { func_80837948(play, this, arg2); func_80835C58(play, this, func_80844AF4, 0); this->stateFlags3 |= PLAYER_STATE3_1; - this->currentYaw = this->actor.shape.rot.y; - this->linearVelocity = xzVelocity; + this->yaw = this->actor.shape.rot.y; + this->speedXZ = xzSpeed; this->actor.velocity.y = yVelocity; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; @@ -5515,8 +5515,8 @@ void func_8083BCD0(Player* this, PlayState* play, s32 arg2) { this->unk_850 = 1; this->unk_84F = arg2; - this->currentYaw = this->actor.shape.rot.y + (arg2 << 0xE); - this->linearVelocity = !(arg2 & 1) ? 6.0f : 8.5f; + this->yaw = this->actor.shape.rot.y + (arg2 << 0xE); + this->speedXZ = !(arg2 & 1) ? 6.0f : 8.5f; this->stateFlags2 |= PLAYER_STATE2_19; @@ -5584,7 +5584,7 @@ void func_8083BF50(Player* this, PlayState* play) { LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, 0.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, 4.0f * sp30); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } void func_8083C0B8(Player* this, PlayState* play) { @@ -5595,7 +5595,7 @@ void func_8083C0B8(Player* this, PlayState* play) { void func_8083C0E8(Player* this, PlayState* play) { func_80835C58(play, this, func_80840BC8, 1); func_80832264(play, this, func_80833338(this)); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } void func_8083C148(Player* this, PlayState* play) { @@ -5678,12 +5678,12 @@ s32 func_8083C2B0(Player* this, PlayState* play) { } s32 func_8083C484(Player* this, f32* arg1, s16* arg2) { - s16 yaw = this->currentYaw - *arg2; + s16 yaw = this->yaw - *arg2; if (ABS(yaw) > 0x6000) { if (func_8083721C(this)) { *arg1 = 0.0f; - *arg2 = this->currentYaw; + *arg2 = this->yaw; } else { return 1; } @@ -5761,7 +5761,7 @@ s32 func_8083C6B8(PlayState* play, Player* this) { func_80835C58(play, this, func_80850C68, 0); this->unk_860 = 1; - func_80832210(this); + Player_ZeroSpeedXZ(this); func_80832264(play, this, &gPlayerAnim_link_fishing_throw); return 1; } else { @@ -5789,7 +5789,7 @@ void func_8083C858(Player* this, PlayState* play) { } void func_8083C8DC(Player* this, PlayState* play, s16 arg2) { - this->actor.shape.rot.y = this->currentYaw = arg2; + this->actor.shape.rot.y = this->yaw = arg2; func_8083C858(this, play); } @@ -5806,7 +5806,7 @@ s32 func_8083C910(PlayState* play, Player* this, f32 arg2) { func_80832C6C(play, this, &gPlayerAnim_link_swimer_swim); this->stateFlags1 |= PLAYER_STATE1_27 | PLAYER_STATE1_29; this->unk_850 = 20; - this->linearVelocity = 2.0f; + this->speedXZ = 2.0f; Player_SetBootData(play, this); return 0; } @@ -5824,7 +5824,7 @@ void func_8083CA20(PlayState* play, Player* this) { } void func_8083CA54(PlayState* play, Player* this) { - this->linearVelocity = 2.0f; + this->speedXZ = 2.0f; gSaveContext.entranceSpeed = 2.0f; if (func_8083C910(play, this, 120.0f)) { this->unk_850 = -15; @@ -5836,10 +5836,10 @@ void func_8083CA9C(PlayState* play, Player* this) { gSaveContext.entranceSpeed = 0.1f; } - this->linearVelocity = gSaveContext.entranceSpeed; + this->speedXZ = gSaveContext.entranceSpeed; if (func_8083C910(play, this, 800.0f)) { - this->unk_850 = -80 / this->linearVelocity; + this->unk_850 = -80 / this->speedXZ; if (this->unk_850 < -20) { this->unk_850 = -20; } @@ -5850,7 +5850,7 @@ void func_8083CB2C(Player* this, s16 yaw, PlayState* play) { func_80835C58(play, this, func_808414F8, 1); LinkAnimation_CopyJointToMorph(play, &this->skelAnime); this->unk_864 = this->unk_868 = 0.0f; - this->currentYaw = yaw; + this->yaw = yaw; } void func_8083CB94(Player* this, PlayState* play) { @@ -5862,8 +5862,8 @@ void func_8083CBF0(Player* this, s16 yaw, PlayState* play) { func_80835C58(play, this, func_808423EC, 1); LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_anchor_back_walk, 2.2f, 0.0f, Animation_GetLastFrame(&gPlayerAnim_link_anchor_back_walk), ANIMMODE_ONCE, -6.0f); - this->linearVelocity = 8.0f; - this->currentYaw = yaw; + this->speedXZ = 8.0f; + this->yaw = yaw; } void func_8083CC9C(Player* this, PlayState* play) { @@ -5878,7 +5878,7 @@ void func_8083CD00(Player* this, PlayState* play) { } void func_8083CD54(PlayState* play, Player* this, s16 yaw) { - this->currentYaw = yaw; + this->yaw = yaw; func_80835C58(play, this, func_80841BA8, 1); this->unk_87E = 1200; this->unk_87E *= D_808535E8; @@ -5898,7 +5898,7 @@ void func_8083CE0C(Player* this, PlayState* play) { } func_80832264(play, this, anim); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } void func_8083CEAC(Player* this, PlayState* play) { @@ -5908,7 +5908,7 @@ void func_8083CEAC(Player* this, PlayState* play) { } void func_8083CF10(Player* this, PlayState* play) { - if (this->linearVelocity != 0.0f) { + if (this->speedXZ != 0.0f) { func_8083C858(this, play); } else { func_8083CE0C(this, play); @@ -5916,7 +5916,7 @@ void func_8083CF10(Player* this, PlayState* play) { } void func_8083CF5C(Player* this, PlayState* play) { - if (this->linearVelocity != 0.0f) { + if (this->speedXZ != 0.0f) { func_8083C858(this, play); } else { func_80839F90(this, play); @@ -6098,7 +6098,7 @@ void func_8083D6EC(PlayState* play, Player* this) { this->actor.gravity = REG(68) / 100.0f; if (func_8083816C(D_808535E4)) { - temp1 = fabsf(this->linearVelocity) * 20.0f; + temp1 = fabsf(this->speedXZ) * 20.0f; temp3 = 0.0f; if (D_808535E4 == FLOOR_TYPE_4) { @@ -6155,11 +6155,11 @@ void func_8083D6EC(PlayState* play, Player* this) { ripplePos.z = (Rand_ZeroOne() * 10.0f) + this->actor.world.pos.z; EffectSsGRipple_Spawn(play, &ripplePos, 100, 500, 0); - if ((this->linearVelocity > 4.0f) && !func_808332B8(this) && + if ((this->speedXZ > 4.0f) && !func_808332B8(this) && ((this->actor.world.pos.y + this->actor.yDistToWater) < this->bodyPartsPos[PLAYER_BODYPART_WAIST].y)) { func_8083CFA8(play, this, 20.0f, - (fabsf(this->linearVelocity) * 50.0f) + (this->actor.yDistToWater * 5.0f)); + (fabsf(this->speedXZ) * 50.0f) + (this->actor.yDistToWater * 5.0f)); } } } @@ -6238,9 +6238,9 @@ void func_8083DDC8(Player* this, PlayState* play) { s16 temp1; s16 temp2; - if (!func_8002DD78(this) && !func_808334B4(this) && (this->linearVelocity > 5.0f)) { - temp1 = this->linearVelocity * 200.0f; - temp2 = (s16)(this->currentYaw - this->actor.shape.rot.y) * this->linearVelocity * 0.1f; + if (!func_8002DD78(this) && !func_808334B4(this) && (this->speedXZ > 5.0f)) { + temp1 = this->speedXZ * 200.0f; + temp2 = (s16)(this->yaw - this->actor.shape.rot.y) * this->speedXZ * 0.1f; temp1 = CLAMP(temp1, -4000, 4000); temp2 = CLAMP(-temp2, -4000, 4000); Math_ScaledStepToS(&this->unk_6BC, temp1, 900); @@ -6254,24 +6254,24 @@ void func_8083DDC8(Player* this, PlayState* play) { } void func_8083DF68(Player* this, f32 arg1, s16 arg2) { - Math_AsymStepToF(&this->linearVelocity, arg1, REG(19) / 100.0f, 1.5f); - Math_ScaledStepToS(&this->currentYaw, arg2, REG(27)); + Math_AsymStepToF(&this->speedXZ, arg1, REG(19) / 100.0f, 1.5f); + Math_ScaledStepToS(&this->yaw, arg2, REG(27)); } void func_8083DFE0(Player* this, f32* arg1, s16* arg2) { - s16 yawDiff = this->currentYaw - *arg2; + s16 yawDiff = this->yaw - *arg2; if (this->meleeWeaponState == 0) { - this->linearVelocity = CLAMP(this->linearVelocity, -(R_RUN_SPEED_LIMIT / 100.0f), (R_RUN_SPEED_LIMIT / 100.0f)); + this->speedXZ = CLAMP(this->speedXZ, -(R_RUN_SPEED_LIMIT / 100.0f), (R_RUN_SPEED_LIMIT / 100.0f)); } if (ABS(yawDiff) > 0x6000) { - if (Math_StepToF(&this->linearVelocity, 0.0f, 1.0f)) { - this->currentYaw = *arg2; + if (Math_StepToF(&this->speedXZ, 0.0f, 1.0f)) { + this->yaw = *arg2; } } else { - Math_AsymStepToF(&this->linearVelocity, *arg1, 0.05f, 0.1f); - Math_ScaledStepToS(&this->currentYaw, *arg2, 200); + Math_AsymStepToF(&this->speedXZ, *arg1, 0.05f, 0.1f); + Math_ScaledStepToS(&this->yaw, *arg2, 200); } } @@ -6311,7 +6311,7 @@ s32 func_8083E0FC(Player* this, PlayState* play) { rideActor->actor.world.pos.z + rideActor->riderPos.z + ((unk_08 * sp38) - (unk_04 * sp34)); this->unk_878 = rideActor->actor.world.pos.y - this->actor.world.pos.y; - this->currentYaw = this->actor.shape.rot.y = rideActor->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y = rideActor->actor.shape.rot.y; Actor_MountHorse(play, this, &rideActor->actor); func_80832264(play, this, D_80854578[temp].anim); @@ -6374,8 +6374,8 @@ s32 func_8083E318(PlayState* play, Player* this, CollisionPoly* floorPoly) { this->unk_84F = 1; } func_80832BE8(play, this, D_80854590[this->unk_84F]); - this->linearVelocity = sqrtf(SQ(this->actor.velocity.x) + SQ(this->actor.velocity.z)); - this->currentYaw = playerVelYaw; + this->speedXZ = sqrtf(SQ(this->actor.velocity.x) + SQ(this->actor.velocity.z)); + this->yaw = playerVelYaw; return true; } } @@ -6464,7 +6464,7 @@ s32 func_8083E5A8(Player* this, PlayState* play) { chest->dyna.actor.world.pos.x - (Math_SinS(chest->dyna.actor.shape.rot.y) * 29.4343f); this->actor.world.pos.z = chest->dyna.actor.world.pos.z - (Math_CosS(chest->dyna.actor.shape.rot.y) * 29.4343f); - this->currentYaw = this->actor.shape.rot.y = chest->dyna.actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y = chest->dyna.actor.shape.rot.y; func_80832224(this); if ((giEntry->itemId != ITEM_NONE) && (giEntry->gi >= 0) && @@ -6524,7 +6524,7 @@ void func_8083EA94(Player* this, PlayState* play) { s32 func_8083EAF0(Player* this, Actor* actor) { if ((actor != NULL) && !(actor->flags & ACTOR_FLAG_23) && - ((this->linearVelocity < 1.1f) || (actor->id == ACTOR_EN_BOM_CHU))) { + ((this->speedXZ < 1.1f) || (actor->id == ACTOR_EN_BOM_CHU))) { return 0; } @@ -6634,11 +6634,11 @@ s32 func_8083EC18(Player* this, PlayState* play, u32 interactWallFlags) { } this->unk_850 = -2; this->actor.world.pos.y += phi_f20; - this->actor.shape.rot.y = this->currentYaw = this->actor.wallYaw + 0x8000; + this->actor.shape.rot.y = this->yaw = this->actor.wallYaw + 0x8000; } else { sp30 = this->ageProperties->unk_A8; this->unk_850 = -4; - this->actor.shape.rot.y = this->currentYaw = this->actor.wallYaw; + this->actor.shape.rot.y = this->yaw = this->actor.wallYaw; } this->actor.world.pos.x = (sp34 * wallPolyNormalX) + sp80; @@ -6719,7 +6719,7 @@ s32 Player_TryEnteringCrawlspace(Player* this, PlayState* play, u32 interactWall func_80836898(play, this, func_8083A40C); this->stateFlags2 |= PLAYER_STATE2_CRAWLING; - this->actor.shape.rot.y = this->currentYaw = this->actor.wallYaw + 0x8000; + this->actor.shape.rot.y = this->yaw = this->actor.wallYaw + 0x8000; this->actor.world.pos.x = xVertex1 + (wallDistance * wallPolyNormalX); this->actor.world.pos.z = zVertex1 + (wallDistance * wallPolyNormalZ); func_80832224(this); @@ -6770,7 +6770,7 @@ s32 func_8083F360(PlayState* play, Player* this, f32 arg1, f32 arg2, f32 arg3, f temp = Math_Atan2S(-wallPolyNormalZ, -wallPolyNormalX); Math_ScaledStepToS(&this->actor.shape.rot.y, temp, 800); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; this->actor.world.pos.x = sp54.x - (Math_SinS(this->actor.shape.rot.y) * arg2); this->actor.world.pos.z = sp54.z - (Math_CosS(this->actor.shape.rot.y) * arg2); @@ -6795,21 +6795,21 @@ s32 func_8083F524(PlayState* play, Player* this) { s32 Player_TryLeavingCrawlspace(Player* this, PlayState* play) { s16 yawToWall; - if ((this->linearVelocity != 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && + if ((this->speedXZ != 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (sInteractWallFlags & WALL_FLAG_CRAWLSPACE)) { // The exit wallYaws will always point inward on the crawlline // Interacting with the exit wall in front will have a yaw diff of 0x8000 // Interacting with the exit wall behind will have a yaw diff of 0 yawToWall = this->actor.shape.rot.y - this->actor.wallYaw; - if (this->linearVelocity < 0.0f) { + if (this->speedXZ < 0.0f) { yawToWall += 0x8000; } if (ABS(yawToWall) > 0x4000) { func_80835C58(play, this, func_8084C81C, 0); - if (this->linearVelocity > 0.0f) { + if (this->speedXZ > 0.0f) { // Leaving a crawlspace forwards this->actor.shape.rot.y = this->actor.wallYaw + 0x8000; func_80832264(play, this, &gPlayerAnim_link_child_tunnel_end); @@ -6825,8 +6825,8 @@ s32 Player_TryLeavingCrawlspace(Player* this, PlayState* play) { OnePointCutscene_Init(play, 9602, 999, NULL, CAM_ID_MAIN); } - this->currentYaw = this->actor.shape.rot.y; - func_80832210(this); + this->yaw = this->actor.shape.rot.y; + Player_ZeroSpeedXZ(this); return true; } @@ -6843,7 +6843,7 @@ void func_8083F72C(Player* this, LinkAnimationHeader* anim, PlayState* play) { func_80832264(play, this, anim); func_80832224(this); - this->actor.shape.rot.y = this->currentYaw = this->actor.wallYaw + 0x8000; + this->actor.shape.rot.y = this->yaw = this->actor.wallYaw + 0x8000; } s32 func_8083F7BC(Player* this, PlayState* play) { @@ -6852,12 +6852,12 @@ s32 func_8083F7BC(Player* this, PlayState* play) { if (!(this->stateFlags1 & PLAYER_STATE1_11) && (this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && (D_80853608 < 0x3000)) { - if (((this->linearVelocity > 0.0f) && func_8083EC18(this, play, sInteractWallFlags)) || + if (((this->speedXZ > 0.0f) && func_8083EC18(this, play, sInteractWallFlags)) || Player_TryEnteringCrawlspace(this, play, sInteractWallFlags)) { return 1; } - if (!func_808332B8(this) && ((this->linearVelocity == 0.0f) || !(this->stateFlags2 & PLAYER_STATE2_2)) && + if (!func_808332B8(this) && ((this->speedXZ == 0.0f) || !(this->stateFlags2 & PLAYER_STATE2_2)) && (sInteractWallFlags & WALL_FLAG_6) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->wallHeight >= 39.0f)) { @@ -6877,7 +6877,7 @@ s32 func_8083F7BC(Player* this, PlayState* play) { this->stateFlags1 |= PLAYER_STATE1_11; this->interactRangeActor = &wallPolyActor->actor; this->getItemId = GI_NONE; - this->currentYaw = this->actor.wallYaw + 0x8000; + this->yaw = this->actor.wallYaw + 0x8000; func_80832224(this); return 1; @@ -6937,7 +6937,7 @@ void func_8083FB14(Player* this, PlayState* play) { void func_8083FB7C(Player* this, PlayState* play) { this->stateFlags1 &= ~(PLAYER_STATE1_21 | PLAYER_STATE1_27); func_80837B9C(this, play); - this->linearVelocity = -0.4f; + this->speedXZ = -0.4f; } s32 func_8083FBC0(Player* this, PlayState* play) { @@ -6973,7 +6973,7 @@ s32 func_8083FC68(Player* this, f32 arg1, s16 arg2) { } s32 func_8083FD78(Player* this, f32* arg1, s16* arg2, PlayState* play) { - s16 sp2E = *arg2 - this->targetYaw; + s16 sp2E = *arg2 - this->zTargetYaw; u16 sp2C = ABS(sp2E); if ((func_8002DD78(this) || func_808334B4(this)) && (this->unk_664 == NULL)) { @@ -7093,8 +7093,8 @@ void func_8084029C(Player* this, f32 arg1) { (this->hoverBootsTimer != 0)) { func_8002F8F0(&this->actor, NA_SE_PL_HOBBERBOOTS_LV - SFX_FLAG); } else if (func_8084021C(this->unk_868, arg1, 29.0f, 10.0f) || func_8084021C(this->unk_868, arg1, 29.0f, 24.0f)) { - func_808327F8(this, this->linearVelocity); - if (this->linearVelocity > 4.0f) { + func_808327F8(this, this->speedXZ); + if (this->speedXZ > 4.0f) { this->stateFlags2 |= PLAYER_STATE2_3; } } @@ -7163,29 +7163,29 @@ void func_80840450(Player* this, PlayState* play) { return; } - func_8084029C(this, (this->linearVelocity * 0.3f) + 1.0f); + func_8084029C(this, (this->speedXZ * 0.3f) + 1.0f); func_80840138(this, sp44, sp42); temp2 = this->unk_868; if ((temp2 < 6) || ((temp2 - 0xE) < 6)) { - Math_StepToF(&this->linearVelocity, 0.0f, 1.5f); + Math_StepToF(&this->speedXZ, 0.0f, 1.5f); return; } - temp3 = sp42 - this->currentYaw; + temp3 = sp42 - this->yaw; temp4 = ABS(temp3); if (temp4 > 0x4000) { - if (Math_StepToF(&this->linearVelocity, 0.0f, 1.5f)) { - this->currentYaw = sp42; + if (Math_StepToF(&this->speedXZ, 0.0f, 1.5f)) { + this->yaw = sp42; } return; } - Math_AsymStepToF(&this->linearVelocity, sp44 * 0.3f, 2.0f, 1.5f); + Math_AsymStepToF(&this->speedXZ, sp44 * 0.3f, 2.0f, 1.5f); if (!(this->stateFlags3 & PLAYER_STATE3_3)) { - Math_ScaledStepToS(&this->currentYaw, sp42, temp4 * 0.1f); + Math_ScaledStepToS(&this->yaw, sp42, temp4 * 0.1f); } } } @@ -7212,7 +7212,7 @@ void func_808407CC(Player* this, PlayState* play) { if (!func_80833B2C(this)) { func_80835DAC(play, this, func_80840BC8, 1); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; return; } @@ -7356,7 +7356,7 @@ void func_80840BC8(Player* this, PlayState* play) { } Math_ScaledStepToS(&this->actor.shape.rot.y, sp3A, 1200); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; if (func_80833338(this) == this->skelAnime.animation) { func_8083DC54(this, play); } @@ -7390,18 +7390,18 @@ void func_80840DE4(Player* this, PlayState* play) { this->skelAnime.animLength = frames; this->skelAnime.endFrame = frames - 1.0f; - if ((s16)(this->currentYaw - this->actor.shape.rot.y) >= 0) { + if ((s16)(this->yaw - this->actor.shape.rot.y) >= 0) { direction = 1; } else { direction = -1; } - this->skelAnime.playSpeed = direction * (this->linearVelocity * coeff); + this->skelAnime.playSpeed = direction * (this->speedXZ * coeff); LinkAnimation_Update(play, &this->skelAnime); if (LinkAnimation_OnFrame(&this->skelAnime, 0.0f) || LinkAnimation_OnFrame(&this->skelAnime, frames * 0.5f)) { - func_808327F8(this, this->linearVelocity); + func_808327F8(this, this->speedXZ); } if (!func_80837348(play, this, D_808543F4, 1)) { @@ -7434,23 +7434,23 @@ void func_80840DE4(Player* this, PlayState* play) { return; } - if ((sp44 == 0.0f) && (this->linearVelocity == 0.0f)) { + if ((sp44 == 0.0f) && (this->speedXZ == 0.0f)) { func_80839F30(this, play); return; } - temp2 = sp42 - this->currentYaw; + temp2 = sp42 - this->yaw; temp3 = ABS(temp2); if (temp3 > 0x4000) { - if (Math_StepToF(&this->linearVelocity, 0.0f, 1.5f)) { - this->currentYaw = sp42; + if (Math_StepToF(&this->speedXZ, 0.0f, 1.5f)) { + this->yaw = sp42; } return; } - Math_AsymStepToF(&this->linearVelocity, sp44 * 0.4f, 1.5f, 1.5f); - Math_ScaledStepToS(&this->currentYaw, sp42, temp3 * 0.1f); + Math_AsymStepToF(&this->speedXZ, sp44 * 0.4f, 1.5f, 1.5f); + Math_ScaledStepToS(&this->yaw, sp42, temp3 * 0.1f); } } @@ -7469,16 +7469,16 @@ void func_80841138(Player* this, PlayState* play) { } temp1 = this->unk_864; } else { - temp2 = this->linearVelocity - (REG(48) / 100.0f); + temp2 = this->speedXZ - (REG(48) / 100.0f); if (temp2 < 0.0f) { temp1 = 1.0f; - func_8084029C(this, (REG(35) / 1000.0f) + ((REG(36) / 1000.0f) * this->linearVelocity)); + func_8084029C(this, (REG(35) / 1000.0f) + ((REG(36) / 1000.0f) * this->speedXZ)); LinkAnimation_LoadToJoint(play, &this->skelAnime, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_back_walk, this->modelAnimType), this->unk_868); } else { temp1 = (REG(37) / 1000.0f) * temp2; if (temp1 < 1.0f) { - func_8084029C(this, (REG(35) / 1000.0f) + ((REG(36) / 1000.0f) * this->linearVelocity)); + func_8084029C(this, (REG(35) / 1000.0f) + ((REG(36) / 1000.0f) * this->speedXZ)); } else { temp1 = 1.0f; func_8084029C(this, 1.2f + ((REG(38) / 1000.0f) * temp2)); @@ -7501,7 +7501,7 @@ void func_8084140C(Player* this, PlayState* play) { } s32 func_80841458(Player* this, f32* arg1, s16* arg2, PlayState* play) { - if (this->linearVelocity > 6.0f) { + if (this->speedXZ > 6.0f) { func_8084140C(this, play); return 1; } @@ -7509,7 +7509,7 @@ s32 func_80841458(Player* this, f32* arg1, s16* arg2, PlayState* play) { if (*arg1 != 0.0f) { if (func_8083721C(this)) { *arg1 = 0.0f; - *arg2 = this->currentYaw; + *arg2 = this->yaw; } else { return 1; } @@ -7528,7 +7528,7 @@ void func_808414F8(Player* this, PlayState* play) { if (!func_80837348(play, this, D_80854400, 1)) { if (!func_80833C04(this)) { - func_8083C8DC(this, play, this->currentYaw); + func_8083C8DC(this, play, this->yaw); return; } @@ -7546,12 +7546,12 @@ void func_808414F8(Player* this, PlayState* play) { } } } else { - sp2A = sp32 - this->currentYaw; + sp2A = sp32 - this->yaw; - Math_AsymStepToF(&this->linearVelocity, sp34 * 1.5f, 1.5f, 2.0f); - Math_ScaledStepToS(&this->currentYaw, sp32, sp2A * 0.1f); + Math_AsymStepToF(&this->speedXZ, sp34 * 1.5f, 1.5f, 2.0f); + Math_ScaledStepToS(&this->yaw, sp32, sp2A * 0.1f); - if ((sp34 == 0.0f) && (this->linearVelocity == 0.0f)) { + if ((sp34 == 0.0f) && (this->speedXZ == 0.0f)) { func_80839F30(this, play); } } @@ -7574,8 +7574,8 @@ void func_8084170C(Player* this, PlayState* play) { if (!func_80837348(play, this, D_80854400, 1)) { func_80837268(this, &sp30, &sp2E, 0.0f, play); - if (this->linearVelocity == 0.0f) { - this->currentYaw = this->actor.shape.rot.y; + if (this->speedXZ == 0.0f) { + this->yaw = this->actor.shape.rot.y; if (func_8083FD78(this, &sp30, &sp2E, play) > 0) { func_8083C858(this, play); @@ -7605,7 +7605,7 @@ void func_80841860(PlayState* play, Player* this) { this->skelAnime.animation = sp38; - func_8084029C(this, (REG(30) / 1000.0f) + ((REG(32) / 1000.0f) * this->linearVelocity)); + func_8084029C(this, (REG(30) / 1000.0f) + ((REG(32) / 1000.0f) * this->speedXZ)); frame = this->unk_868 * (16.0f / 29.0f); LinkAnimation_BlendToJoint(play, &this->skelAnime, sp34, frame, sp38, frame, this->unk_870, this->blendTable); @@ -7648,7 +7648,7 @@ void func_8084193C(Player* this, PlayState* play) { return; } - if ((this->linearVelocity < 3.6f) && (sp3C < 4.0f)) { + if ((this->speedXZ < 3.6f) && (sp3C < 4.0f)) { if (!func_8008E9C4(this) && func_80833B2C(this)) { func_8083CB94(this, play); } else { @@ -7659,19 +7659,19 @@ void func_8084193C(Player* this, PlayState* play) { func_80840138(this, sp3C, sp3A); - temp2 = sp3A - this->currentYaw; + temp2 = sp3A - this->yaw; temp3 = ABS(temp2); if (temp3 > 0x4000) { - if (Math_StepToF(&this->linearVelocity, 0.0f, 3.0f) != 0) { - this->currentYaw = sp3A; + if (Math_StepToF(&this->speedXZ, 0.0f, 3.0f) != 0) { + this->yaw = sp3A; } return; } sp3C *= 0.9f; - Math_AsymStepToF(&this->linearVelocity, sp3C, 2.0f, 3.0f); - Math_ScaledStepToS(&this->currentYaw, sp3A, temp3 * 0.1f); + Math_AsymStepToF(&this->speedXZ, sp3C, 2.0f, 3.0f); + Math_ScaledStepToS(&this->yaw, sp3A, temp3 * 0.1f); } } @@ -7698,7 +7698,7 @@ void func_80841BA8(Player* this, PlayState* play) { func_8083C0E8(this, play); } - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } } @@ -7732,7 +7732,7 @@ void func_80841CC4(Player* this, s32 arg1, PlayState* play) { rate = this->unk_6C4 * 0.0006f; } - rate *= fabsf(this->linearVelocity) * 0.5f; + rate *= fabsf(this->speedXZ) * 0.5f; if (rate > 1.0f) { rate = 1.0f; @@ -7772,17 +7772,17 @@ void func_80841EE4(Player* this, PlayState* play) { temp1 = this->unk_864; } else { - temp2 = this->linearVelocity - (REG(48) / 100.0f); + temp2 = this->speedXZ - (REG(48) / 100.0f); if (temp2 < 0.0f) { temp1 = 1.0f; - func_8084029C(this, (REG(35) / 1000.0f) + ((REG(36) / 1000.0f) * this->linearVelocity)); + func_8084029C(this, (REG(35) / 1000.0f) + ((REG(36) / 1000.0f) * this->speedXZ)); func_80841CC4(this, 0, play); } else { temp1 = (REG(37) / 1000.0f) * temp2; if (temp1 < 1.0f) { - func_8084029C(this, (REG(35) / 1000.0f) + ((REG(36) / 1000.0f) * this->linearVelocity)); + func_8084029C(this, (REG(35) / 1000.0f) + ((REG(36) / 1000.0f) * this->speedXZ)); } else { temp1 = 1.0f; func_8084029C(this, 1.2f + ((REG(38) / 1000.0f) * temp2)); @@ -7818,7 +7818,7 @@ void func_80842180(Player* this, PlayState* play) { func_8083DF68(this, sp2C, sp2A); func_8083DDC8(this, play); - if ((this->linearVelocity == 0.0f) && (sp2C == 0.0f)) { + if ((this->speedXZ == 0.0f) && (sp2C == 0.0f)) { func_8083C0B8(this, play); } } @@ -7850,7 +7850,7 @@ void func_8084227C(Player* this, PlayState* play) { func_8083DF68(this, sp2C, sp2A); func_8083DDC8(this, play); - if ((this->linearVelocity == 0) && (sp2C == 0)) { + if ((this->speedXZ == 0) && (sp2C == 0)) { func_80839F90(this, play); } } @@ -7899,8 +7899,8 @@ void func_8084251C(Player* this, PlayState* play) { if (!func_80837348(play, this, D_80854440, 1)) { func_80837268(this, &sp30, &sp2E, 0.0f, play); - if (this->linearVelocity == 0.0f) { - this->currentYaw = this->actor.shape.rot.y; + if (this->speedXZ == 0.0f) { + this->yaw = this->actor.shape.rot.y; if (func_8083FC68(this, sp30, sp2E) > 0) { func_8083C858(this, play); @@ -7967,7 +7967,7 @@ s32 func_808428D8(Player* this, PlayState* play) { func_80832264(play, this, &gPlayerAnim_link_normal_defense_kiru); this->unk_84F = 1; this->meleeWeaponAnimation = PLAYER_MWA_STAB_1H; - this->currentYaw = this->actor.shape.rot.y + this->unk_6BE; + this->yaw = this->actor.shape.rot.y + this->unk_6BE; return 1; } @@ -8060,7 +8060,7 @@ void func_80842D20(PlayState* play, Player* this) { } Player_RequestRumble(this, 180, 20, 100, 0); - this->linearVelocity = -18.0f; + this->speedXZ = -18.0f; func_80842CF0(play, this); } @@ -8103,7 +8103,7 @@ s32 func_80842DF4(PlayState* play, Player* this) { return 1; } - if (this->linearVelocity >= 0.0f) { + if (this->speedXZ >= 0.0f) { surfaceMaterial = SurfaceType_GetMaterial(&play->colCtx, groundPoly, bgId); if (surfaceMaterial == SURFACE_MATERIAL_WOOD) { @@ -8118,7 +8118,7 @@ s32 func_80842DF4(PlayState* play, Player* this) { } func_80842CF0(play, this); - this->linearVelocity = -14.0f; + this->speedXZ = -14.0f; Player_RequestRumble(this, 180, 20, 100, 0); } } @@ -8297,8 +8297,8 @@ void func_8084377C(Player* this, PlayState* play) { if (!(this->stateFlags1 & PLAYER_STATE1_29) && (this->unk_850 == 0) && (this->unk_8A1 != 0)) { s16 temp = this->actor.shape.rot.y - this->unk_8A2; - this->currentYaw = this->actor.shape.rot.y = this->unk_8A2; - this->linearVelocity = this->unk_8A4; + this->yaw = this->actor.shape.rot.y = this->unk_8A2; + this->speedXZ = this->unk_8A4; if (ABS(temp) > 0x4000) { this->actor.shape.rot.y = this->unk_8A2 + 0x8000; @@ -8326,8 +8326,8 @@ void func_8084377C(Player* this, PlayState* play) { } func_80832264(play, this, - (this->currentYaw != this->actor.shape.rot.y) ? &gPlayerAnim_link_normal_front_downB - : &gPlayerAnim_link_normal_back_downB); + (this->yaw != this->actor.shape.rot.y) ? &gPlayerAnim_link_normal_front_downB + : &gPlayerAnim_link_normal_back_downB); func_80832698(this, NA_SE_VO_LI_FREEZE); } } @@ -8343,7 +8343,7 @@ void func_80843954(Player* this, PlayState* play) { func_8083721C(this); - if (LinkAnimation_Update(play, &this->skelAnime) && (this->linearVelocity == 0.0f)) { + if (LinkAnimation_Update(play, &this->skelAnime) && (this->speedXZ == 0.0f)) { if (this->stateFlags1 & PLAYER_STATE1_29) { this->unk_850++; } else { @@ -8352,9 +8352,9 @@ void func_80843954(Player* this, PlayState* play) { } func_808322D0(play, this, - (this->currentYaw != this->actor.shape.rot.y) ? &gPlayerAnim_link_normal_front_down_wake - : &gPlayerAnim_link_normal_back_down_wake); - this->currentYaw = this->actor.shape.rot.y; + (this->yaw != this->actor.shape.rot.y) ? &gPlayerAnim_link_normal_front_down_wake + : &gPlayerAnim_link_normal_back_down_wake); + this->yaw = this->actor.shape.rot.y; } } @@ -8476,7 +8476,7 @@ s32 func_80843E64(PlayState* play, Player* this) { sp34 = this->fallDistance; } - Math_StepToF(&this->linearVelocity, 0.0f, 1.0f); + Math_StepToF(&this->speedXZ, 0.0f, 1.0f); this->stateFlags1 &= ~(PLAYER_STATE1_18 | PLAYER_STATE1_19); @@ -8556,7 +8556,7 @@ void func_8084411C(Player* this, PlayState* play) { if (!func_80835644(play, this, heldActor) && (heldActor->id == ACTOR_EN_NIW) && CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN)) { - func_8084409C(play, this, this->linearVelocity + 2.0f, this->actor.velocity.y + 2.0f); + func_8084409C(play, this, this->speedXZ + 2.0f, this->actor.velocity.y + 2.0f); } } @@ -8590,7 +8590,7 @@ void func_8084411C(Player* this, PlayState* play) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && !(this->stateFlags2 & PLAYER_STATE2_19) && - !(this->stateFlags1 & (PLAYER_STATE1_11 | PLAYER_STATE1_27)) && (this->linearVelocity > 0.0f)) { + !(this->stateFlags1 & (PLAYER_STATE1_11 | PLAYER_STATE1_27)) && (this->speedXZ > 0.0f)) { if ((this->wallHeight >= 150.0f) && (this->unk_84B[this->unk_846] == 0)) { func_8083EC18(this, play, sInteractWallFlags); } else if ((this->unk_88C >= 2) && (this->wallHeight < 150.0f) && @@ -8605,7 +8605,7 @@ void func_8084411C(Player* this, PlayState* play) { this->actor.world.pos.y += this->wallHeight; func_8083A5C4(play, this, this->actor.wallPoly, this->wallDistance, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_jump_climb_hold, this->modelAnimType)); - this->actor.shape.rot.y = this->currentYaw += 0x8000; + this->actor.shape.rot.y = this->yaw += 0x8000; this->stateFlags1 |= PLAYER_STATE1_13; } } @@ -8678,14 +8678,14 @@ void func_80844708(Player* this, PlayState* play) { if (func_80842964(this, play) == 0) { if (this->unk_850 != 0) { - Math_StepToF(&this->linearVelocity, 0.0f, 2.0f); + Math_StepToF(&this->speedXZ, 0.0f, 2.0f); temp = func_808374A0(play, this, &this->skelAnime, 5.0f); if ((temp != 0) && ((temp > 0) || sp44)) { func_8083A060(this, play); } } else { - if (this->linearVelocity >= 7.0f) { + if (this->speedXZ >= 7.0f) { if (((this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && (D_8085360C < 0x2000)) || ((this->cylinder.base.ocFlags1 & OC1_HIT) && (cylinderOc = this->cylinder.base.oc, @@ -8702,7 +8702,7 @@ void func_80844708(Player* this, PlayState* play) { } func_80832264(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_hip_down, this->modelAnimType)); - this->linearVelocity = -this->linearVelocity; + this->speedXZ = -this->speedXZ; Player_RequestQuake(play, 33267, 3, 12); Player_RequestRumble(this, 255, 20, 150, 0); Player_PlaySfx(this, NA_SE_PL_BODY_HIT); @@ -8744,7 +8744,7 @@ void func_80844A44(Player* this, PlayState* play) { func_80832284(play, this, &gPlayerAnim_link_normal_run_jump_water_fall_wait); } - Math_StepToF(&this->linearVelocity, 0.0f, 0.05f); + Math_StepToF(&this->speedXZ, 0.0f, 0.05f); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.colChkInfo.damage = 0x10; @@ -8766,7 +8766,7 @@ void func_80844AF4(Player* this, PlayState* play) { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { func_80837268(this, &sp2C, &sp2A, 0.0f, play); - func_8083DFE0(this, &sp2C, &this->currentYaw); + func_8083DFE0(this, &sp2C, &this->yaw); return; } @@ -8819,7 +8819,7 @@ void func_80844D68(Player* this, PlayState* play) { func_80839FFC(this, play); func_80832318(this); func_80832B0C(play, this, D_80854368[Player_HoldsTwoHandedWeapon(this)]); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } void func_80844DC8(Player* this, PlayState* play) { @@ -8884,10 +8884,10 @@ void func_80845000(Player* this, PlayState* play) { s16 temp5; s32 sp44; - temp1 = this->currentYaw - this->actor.shape.rot.y; + temp1 = this->yaw - this->actor.shape.rot.y; temp2 = ABS(temp1); - sp5C = fabsf(this->linearVelocity); + sp5C = fabsf(this->speedXZ); sp58 = sp5C * 1.5f; this->stateFlags1 |= PLAYER_STATE1_12; @@ -8919,23 +8919,23 @@ void func_80845000(Player* this, PlayState* play) { if (temp4 == 0) { sp54 = 0.0f; - sp52 = this->currentYaw; + sp52 = this->yaw; } - temp5 = sp52 - this->currentYaw; + temp5 = sp52 - this->yaw; sp44 = ABS(temp5); if (sp44 > 0x4000) { - if (Math_StepToF(&this->linearVelocity, 0.0f, 1.0f)) { - this->currentYaw = sp52; + if (Math_StepToF(&this->speedXZ, 0.0f, 1.0f)) { + this->yaw = sp52; } return; } - Math_AsymStepToF(&this->linearVelocity, sp54 * 0.2f, 1.0f, 0.5f); - Math_ScaledStepToS(&this->currentYaw, sp52, sp44 * 0.1f); + Math_AsymStepToF(&this->speedXZ, sp54 * 0.2f, 1.0f, 0.5f); + Math_ScaledStepToS(&this->yaw, sp52, sp44 * 0.1f); - if ((sp54 == 0.0f) && (this->linearVelocity == 0.0f)) { + if ((sp54 == 0.0f) && (this->speedXZ == 0.0f)) { func_80844DC8(this, play); } } @@ -8950,7 +8950,7 @@ void func_80845308(Player* this, PlayState* play) { s16 temp5; s32 sp44; - sp5C = fabsf(this->linearVelocity); + sp5C = fabsf(this->speedXZ); this->stateFlags1 |= PLAYER_STATE1_12; @@ -8987,23 +8987,23 @@ void func_80845308(Player* this, PlayState* play) { if (temp4 == 0) { sp54 = 0.0f; - sp52 = this->currentYaw; + sp52 = this->yaw; } - temp5 = sp52 - this->currentYaw; + temp5 = sp52 - this->yaw; sp44 = ABS(temp5); if (sp44 > 0x4000) { - if (Math_StepToF(&this->linearVelocity, 0.0f, 1.0f)) { - this->currentYaw = sp52; + if (Math_StepToF(&this->speedXZ, 0.0f, 1.0f)) { + this->yaw = sp52; } return; } - Math_AsymStepToF(&this->linearVelocity, sp54 * 0.2f, 1.0f, 0.5f); - Math_ScaledStepToS(&this->currentYaw, sp52, sp44 * 0.1f); + Math_AsymStepToF(&this->speedXZ, sp54 * 0.2f, 1.0f, 0.5f); + Math_ScaledStepToS(&this->yaw, sp52, sp44 * 0.1f); - if ((sp54 == 0.0f) && (this->linearVelocity == 0.0f) && (sp5C == 0.0f)) { + if ((sp54 == 0.0f) && (this->speedXZ == 0.0f) && (sp5C == 0.0f)) { func_80844DC8(this, play); } } @@ -9019,7 +9019,7 @@ void func_80845668(Player* this, PlayState* play) { sp3C = LinkAnimation_Update(play, &this->skelAnime); if (this->skelAnime.animation == &gPlayerAnim_link_normal_250jump_start) { - this->linearVelocity = 1.0f; + this->speedXZ = 1.0f; if (LinkAnimation_OnFrame(&this->skelAnime, 8.0f)) { temp1 = this->wallHeight; @@ -9095,7 +9095,7 @@ void func_808458D0(Player* this, PlayState* play) { } s32 func_80845964(PlayState* play, Player* this, CsCmdActorCue* cue, f32 arg3, s16 arg4, s32 arg5) { - if ((arg5 != 0) && (this->linearVelocity == 0.0f)) { + if ((arg5 != 0) && (this->speedXZ == 0.0f)) { return LinkAnimation_Update(play, &this->skelAnime); } @@ -9128,7 +9128,7 @@ s32 func_80845964(PlayState* play, Player* this, CsCmdActorCue* cue, f32 arg3, s func_80841EE4(this, play); func_8083DF68(this, arg3, arg4); - if ((arg3 == 0.0f) && (this->linearVelocity == 0.0f)) { + if ((arg3 == 0.0f) && (this->speedXZ == 0.0f)) { func_8083BF50(this, play); } @@ -9173,7 +9173,7 @@ void func_80845CA4(Player* this, PlayState* play) { LinkAnimation_Update(play, &this->skelAnime); if (DECR(this->doorTimer) == 0) { - this->linearVelocity = 0.1f; + this->speedXZ = 0.1f; this->unk_850 = 1; } } else if (this->unk_84F == 0) { @@ -9206,7 +9206,7 @@ void func_80845CA4(Player* this, PlayState* play) { temp = func_80845BA0(play, this, &sp34, sp30); - if ((this->unk_850 == 0) || ((temp == 0) && (this->linearVelocity == 0.0f) && + if ((this->unk_850 == 0) || ((temp == 0) && (this->speedXZ == 0.0f) && (Play_GetCamera(play, CAM_ID_MAIN)->stateFlags & CAM_STATE_4))) { func_8005B1A4(Play_GetCamera(play, CAM_ID_MAIN)); @@ -9418,7 +9418,7 @@ void func_80846578(Player* this, PlayState* play) { } if (LinkAnimation_OnFrame(&this->skelAnime, 3.0f)) { - func_8084409C(play, this, this->linearVelocity + 8.0f, 12.0f); + func_8084409C(play, this, this->speedXZ + 8.0f, 12.0f); } } @@ -9527,7 +9527,7 @@ void func_808467D4(PlayState* play, Player* this) { func_80835C58(play, this, func_8084E9AC, 0); this->stateFlags1 |= PLAYER_STATE1_29; Math_Vec3f_Copy(&this->actor.world.pos, &D_808546F4); - this->currentYaw = this->actor.shape.rot.y = -0x8000; + this->yaw = this->actor.shape.rot.y = -0x8000; LinkAnimation_Change(play, &this->skelAnime, this->ageProperties->unk_A0, 2.0f / 3.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f); func_80832F54(play, this, 0x28F); @@ -9588,7 +9588,7 @@ void Player_InitCommon(Player* this, PlayState* play, FlexSkeletonHeader* skelHe this->ageProperties = &sAgeProperties[gSaveContext.linkAge]; Actor_ProcessInitChain(&this->actor, sInitChain); this->meleeWeaponEffectIndex = TOTAL_EFFECT_COUNT; - this->currentYaw = this->actor.world.rot.y; + this->yaw = this->actor.world.rot.y; func_80834644(play, this); SkelAnime_InitLink(play, &this->skelAnime, skelHeader, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait, this->modelAnimType), @@ -9670,7 +9670,7 @@ void Player_Init(Actor* thisx, PlayState* play2) { Math_Vec3f_Copy(&thisx->home.pos, &thisx->world.pos); Math_Vec3f_Copy(&thisx->prevPos, &thisx->world.pos); this->fallStartHeight = thisx->world.pos.y; - this->currentYaw = thisx->shape.rot.y = gSaveContext.respawn[respawnMode].yaw; + this->yaw = thisx->shape.rot.y = gSaveContext.respawn[respawnMode].yaw; thisx->params = gSaveContext.respawn[respawnMode].playerParams; } @@ -10081,7 +10081,7 @@ void func_80847BA0(PlayState* play, Player* this) { D_80853608 = ABS(sp9A); - sp9A = this->currentYaw - (s16)(this->actor.wallYaw + 0x8000); + sp9A = this->yaw - (s16)(this->actor.wallYaw + 0x8000); D_8085360C = ABS(sp9A); @@ -10161,7 +10161,7 @@ void func_80847BA0(PlayState* play, Player* this) { } if (spC7 == this->unk_88C) { - if ((this->linearVelocity != 0.0f) && (this->unk_88D < 100)) { + if ((this->speedXZ != 0.0f) && (this->unk_88D < 100)) { this->unk_88D++; } } else { @@ -10189,8 +10189,8 @@ void func_80847BA0(PlayState* play, Player* this) { invFloorPolyNormalY = 1.0f / COLPOLY_GET_NORMAL(floorPoly->normal.y); floorPolyNormalZ = COLPOLY_GET_NORMAL(floorPoly->normal.z); - sp4C = Math_SinS(this->currentYaw); - sp44 = Math_CosS(this->currentYaw); + sp4C = Math_SinS(this->yaw); + sp44 = Math_CosS(this->yaw); this->unk_898 = Math_Atan2S(1.0f, (-(floorPolyNormalX * sp4C) - (floorPolyNormalZ * sp44)) * invFloorPolyNormalY); @@ -10281,7 +10281,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { camMode = CAM_MODE_STILL; } else { camMode = CAM_MODE_NORMAL; - if ((this->linearVelocity == 0.0f) && + if ((this->speedXZ == 0.0f) && (!(this->stateFlags1 & PLAYER_STATE1_23) || (this->rideActor->speed == 0.0f))) { // not moving seqMode = SEQ_MODE_STILL; @@ -10376,7 +10376,7 @@ void func_80848C74(PlayState* play, Player* this) { if (this->currentTunic == PLAYER_TUNIC_GORON) { sp54 = 20; } else { - sp54 = (s32)(this->linearVelocity * 0.4f) + 1; + sp54 = (s32)(this->speedXZ * 0.4f) + 1; } spawnedFlame = false; @@ -10537,7 +10537,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { if (this->stateFlags2 & PLAYER_STATE2_15) { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - func_80832210(this); + Player_ZeroSpeedXZ(this); Actor_MoveXZGravity(&this->actor); } @@ -10601,35 +10601,35 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { (this->currentBoots != PLAYER_BOOTS_IRON)) || ((this->currentBoots == PLAYER_BOOTS_HOVER) && !(this->stateFlags1 & (PLAYER_STATE1_27 | PLAYER_STATE1_29)))) { - f32 sp70 = this->linearVelocity; - s16 sp6E = this->currentYaw; - s16 yawDiff = this->actor.world.rot.y - sp6E; + f32 speedXZTarget = this->speedXZ; + s16 yawTarget = this->yaw; + s16 yawDiff = this->actor.world.rot.y - yawTarget; s32 pad; if ((ABS(yawDiff) > 0x6000) && (this->actor.speed != 0.0f)) { - sp70 = 0.0f; - sp6E += 0x8000; + speedXZTarget = 0.0f; + yawTarget += 0x8000; } - if (Math_StepToF(&this->actor.speed, sp70, 0.35f) && (sp70 == 0.0f)) { - this->actor.world.rot.y = this->currentYaw; + if (Math_StepToF(&this->actor.speed, speedXZTarget, 0.35f) && (speedXZTarget == 0.0f)) { + this->actor.world.rot.y = this->yaw; } - if (this->linearVelocity != 0.0f) { - s32 phi_v0; + if (this->speedXZ != 0.0f) { + s32 step; - phi_v0 = (fabsf(this->linearVelocity) * 700.0f) - (fabsf(this->actor.speed) * 100.0f); - phi_v0 = CLAMP(phi_v0, 0, 1350); + step = (fabsf(this->speedXZ) * 700.0f) - (fabsf(this->actor.speed) * 100.0f); + step = CLAMP(step, 0, 1350); - Math_ScaledStepToS(&this->actor.world.rot.y, sp6E, phi_v0); + Math_ScaledStepToS(&this->actor.world.rot.y, yawTarget, step); } - if ((this->linearVelocity == 0.0f) && (this->actor.speed != 0.0f)) { - func_800F4138(&this->actor.projectedPos, 0xD0, this->actor.speed); + if ((this->speedXZ == 0.0f) && (this->actor.speed != 0.0f)) { + func_800F4138(&this->actor.projectedPos, NA_SE_PL_SLIP_LEVEL - SFX_FLAG, this->actor.speed); } } else { - this->actor.speed = this->linearVelocity; - this->actor.world.rot.y = this->currentYaw; + this->actor.speed = this->speedXZ; + this->actor.world.rot.y = this->yaw; } Actor_UpdateVelocityXZGravity(&this->actor); @@ -10729,11 +10729,11 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { if ((cue != NULL) && (D_808547C4[cue->id] != PLAYER_CSMODE_NONE)) { func_8002DF54(play, NULL, PLAYER_CSMODE_6); - func_80832210(this); + Player_ZeroSpeedXZ(this); } else if ((this->csMode == PLAYER_CSMODE_NONE) && !(this->stateFlags2 & PLAYER_STATE2_10) && (play->csCtx.state != CS_STATE_STOP)) { func_8002DF54(play, NULL, PLAYER_CSMODE_49); - func_80832210(this); + Player_ZeroSpeedXZ(this); } } @@ -11176,7 +11176,7 @@ void func_8084AEEC(Player* this, f32* arg1, f32 arg2, s16 arg3) { } Math_AsymStepToF(arg1, arg2 * 0.8f, temp1, (fabsf(*arg1) * 0.02f) + 0.05f); - Math_ScaledStepToS(&this->currentYaw, arg3, 1600); + Math_ScaledStepToS(&this->yaw, arg3, 1600); } void func_8084B000(Player* this) { @@ -11250,7 +11250,7 @@ void func_8084B158(PlayState* play, Player* this, Input* input, f32 arg3) { void func_8084B1D8(Player* this, PlayState* play) { if (this->stateFlags1 & PLAYER_STATE1_27) { func_8084B000(this); - func_8084AEEC(this, &this->linearVelocity, 0, this->actor.shape.rot.y); + func_8084AEEC(this, &this->speedXZ, 0, this->actor.shape.rot.y); } else { func_8083721C(this); } @@ -11276,7 +11276,7 @@ void func_8084B1D8(Player* this, PlayState* play) { } } - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } s32 func_8084B3CC(PlayState* play, Player* this) { @@ -11290,7 +11290,7 @@ s32 func_8084B3CC(PlayState* play, Player* this) { this->stateFlags1 |= PLAYER_STATE1_20; func_80832264(play, this, func_80833338(this)); - func_80832210(this); + Player_ZeroSpeedXZ(this); func_8083B010(this); return 1; } @@ -11364,7 +11364,7 @@ void func_8084B530(Player* this, PlayState* play) { } if (this->unk_664 != NULL) { - this->currentYaw = this->actor.shape.rot.y = func_8083DB98(this, 0); + this->yaw = this->actor.shape.rot.y = func_8083DB98(this, 0); } } @@ -11436,7 +11436,7 @@ void func_8084B898(Player* this, PlayState* play) { if (this->stateFlags2 & PLAYER_STATE2_4) { func_8084B840(play, this, 2.0f); - this->linearVelocity = 2.0f; + this->speedXZ = 2.0f; } } @@ -11532,7 +11532,7 @@ void func_8084BBE4(Player* this, PlayState* play) { } } - Math_ScaledStepToS(&this->actor.shape.rot.y, this->currentYaw, 0x800); + Math_ScaledStepToS(&this->actor.shape.rot.y, this->yaw, 0x800); if (this->unk_84F != 0) { func_80837268(this, &sp3C, &sp3A, 0.0f, play); @@ -11549,9 +11549,9 @@ void func_8084BBE4(Player* this, PlayState* play) { if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A) || (this->actor.shape.feetFloorFlag != 0)) { func_80837B60(this); if (this->unk_84F < 0) { - this->linearVelocity = -0.8f; + this->speedXZ = -0.8f; } else { - this->linearVelocity = 0.8f; + this->speedXZ = 0.8f; } func_80837B9C(this, play); this->stateFlags1 &= ~(PLAYER_STATE1_13 | PLAYER_STATE1_14); @@ -11657,8 +11657,8 @@ void func_8084BF1C(Player* this, PlayState* play) { this->stateFlags1 &= ~PLAYER_STATE1_21; func_8083A5C4(play, this, this->actor.wallPoly, this->ageProperties->unk_3C, &gPlayerAnim_link_normal_jump_climb_up_free); - this->currentYaw += 0x8000; - this->actor.shape.rot.y = this->currentYaw; + this->yaw += 0x8000; + this->actor.shape.rot.y = this->yaw; func_8083A9B8(this, &gPlayerAnim_link_normal_jump_climb_up_free, play); this->stateFlags1 |= PLAYER_STATE1_14; } else { @@ -11799,7 +11799,7 @@ void func_8084C760(Player* this, PlayState* play) { if (!Player_TryLeavingCrawlspace(this, play)) { // Move forward and back while inside the crawlspace - this->linearVelocity = sControlInput->rel.stick_y * 0.03f; + this->speedXZ = sControlInput->rel.stick_y * 0.03f; } } return; @@ -12055,7 +12055,7 @@ void func_8084CC98(Player* this, PlayState* play) { this->actor.world.pos.y = (rideActor->actor.world.pos.y + rideActor->riderPos.y) - 27.0f; this->actor.world.pos.z = rideActor->actor.world.pos.z + rideActor->riderPos.z; - this->currentYaw = this->actor.shape.rot.y = rideActor->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y = rideActor->actor.shape.rot.y; if ((this->csMode != PLAYER_CSMODE_NONE) || (!func_8083224C(play) && ((rideActor->actor.speed != 0.0f) || !func_8083B644(this, play)) && @@ -12184,7 +12184,7 @@ void func_8084D530(Player* this, f32* arg1, f32 arg2, s16 arg3) { void func_8084D574(PlayState* play, Player* this, s16 arg2) { func_80835C58(play, this, func_8084D84C, 0); - this->actor.shape.rot.y = this->currentYaw = arg2; + this->actor.shape.rot.y = this->yaw = arg2; func_80832C6C(play, this, &gPlayerAnim_link_swimer_swim); } @@ -12220,7 +12220,7 @@ void func_8084D610(Player* this, PlayState* play) { if (sp34 != 0.0f) { s16 temp = this->actor.shape.rot.y - sp32; - if ((ABS(temp) > 0x6000) && !Math_StepToF(&this->linearVelocity, 0.0f, 1.0f)) { + if ((ABS(temp) > 0x6000) && !Math_StepToF(&this->speedXZ, 0.0f, 1.0f)) { return; } @@ -12232,7 +12232,7 @@ void func_8084D610(Player* this, PlayState* play) { } } - func_8084AEEC(this, &this->linearVelocity, sp34, sp32); + func_8084AEEC(this, &this->speedXZ, sp34, sp32); } } @@ -12240,7 +12240,7 @@ void func_8084D7C4(Player* this, PlayState* play) { if (!func_8083B040(this, play)) { this->stateFlags2 |= PLAYER_STATE2_5; - func_8084B158(play, this, NULL, this->linearVelocity); + func_8084B158(play, this, NULL, this->speedXZ); func_8084B000(this); if (DECR(this->unk_850) == 0) { @@ -12256,7 +12256,7 @@ void func_8084D84C(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; - func_8084B158(play, this, sControlInput, this->linearVelocity); + func_8084B158(play, this, sControlInput, this->speedXZ); func_8084B000(this); if (!func_80837348(play, this, D_80854444, 1) && !func_8083D12C(play, this, sControlInput)) { @@ -12269,7 +12269,7 @@ void func_8084D84C(Player* this, PlayState* play) { func_8084D5CC(play, this); } - func_8084D530(this, &this->linearVelocity, sp34, sp32); + func_8084D530(this, &this->speedXZ, sp34, sp32); } } @@ -12278,16 +12278,16 @@ s32 func_8084D980(PlayState* play, Player* this, f32* arg2, s16* arg3) { s16 temp1; s32 temp2; - temp1 = this->currentYaw - *arg3; + temp1 = this->yaw - *arg3; if (ABS(temp1) > 0x6000) { anim = &gPlayerAnim_link_swimer_swim_wait; - if (Math_StepToF(&this->linearVelocity, 0.0f, 1.0f)) { - this->currentYaw = *arg3; + if (Math_StepToF(&this->speedXZ, 0.0f, 1.0f)) { + this->yaw = *arg3; } else { *arg2 = 0.0f; - *arg3 = this->currentYaw; + *arg3 = this->yaw; } } else { temp2 = func_8083FD78(this, arg2, arg3, play); @@ -12315,7 +12315,7 @@ void func_8084DAB4(Player* this, PlayState* play) { f32 sp2C; s16 sp2A; - func_8084B158(play, this, sControlInput, this->linearVelocity); + func_8084B158(play, this, sControlInput, this->speedXZ); func_8084B000(this); if (!func_80837348(play, this, D_80854444, 1) && !func_8083D12C(play, this, sControlInput)) { @@ -12329,7 +12329,7 @@ void func_8084DAB4(Player* this, PlayState* play) { func_8084D980(play, this, &sp2C, &sp2A); } - func_8084D530(this, &this->linearVelocity, sp2C, sp2A); + func_8084D530(this, &this->speedXZ, sp2C, sp2A); } } @@ -12338,8 +12338,8 @@ void func_8084DBC4(PlayState* play, Player* this, f32 arg2) { s16 sp2A; func_80837268(this, &sp2C, &sp2A, 0.0f, play); - func_8084AEEC(this, &this->linearVelocity, sp2C * 0.5f, sp2A); - func_8084AEEC(this, &this->actor.velocity.y, arg2, this->currentYaw); + func_8084AEEC(this, &this->speedXZ, sp2C * 0.5f, sp2A); + func_8084AEEC(this, &this->actor.velocity.y, arg2, this->yaw); } void func_8084DC48(Player* this, PlayState* play) { @@ -12418,7 +12418,7 @@ void func_8084DFAC(PlayState* play, Player* this) { func_8084DF6C(play, this); func_808322FC(this); func_8083C0E8(this, play); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } s32 func_8084DFF4(PlayState* play, Player* this) { @@ -12490,7 +12490,7 @@ void func_8084E1EC(Player* this, PlayState* play) { } func_8084B000(this); - func_8084AEEC(this, &this->linearVelocity, 0.0f, this->actor.shape.rot.y); + func_8084AEEC(this, &this->speedXZ, 0.0f, this->actor.shape.rot.y); } void func_8084E30C(Player* this, PlayState* play) { @@ -12500,7 +12500,7 @@ void func_8084E30C(Player* this, PlayState* play) { func_80838F18(play, this); } - func_8084AEEC(this, &this->linearVelocity, 0.0f, this->actor.shape.rot.y); + func_8084AEEC(this, &this->speedXZ, 0.0f, this->actor.shape.rot.y); } void func_8084E368(Player* this, PlayState* play) { @@ -12510,7 +12510,7 @@ void func_8084E368(Player* this, PlayState* play) { func_80843AE8(play, this); } - func_8084AEEC(this, &this->linearVelocity, 0.0f, this->actor.shape.rot.y); + func_8084AEEC(this, &this->speedXZ, 0.0f, this->actor.shape.rot.y); } static s16 sWarpSongEntrances[] = { @@ -12942,7 +12942,7 @@ void func_8084F104(Player* this, PlayState* play) { } if ((this->unk_84F == 0) && (this->unk_664 != NULL)) { - this->currentYaw = this->actor.shape.rot.y = func_8083DB98(this, 0); + this->yaw = this->actor.shape.rot.y = func_8083DB98(this, 0); } } @@ -12988,7 +12988,7 @@ void func_8084F390(Player* this, PlayState* play) { sp44 = downwardSlopeYaw + 0x8000; } - if (this->linearVelocity < 0) { + if (this->speedXZ < 0) { downwardSlopeYaw += 0x8000; } @@ -13006,7 +13006,7 @@ void func_8084F390(Player* this, PlayState* play) { sp4C = 1.0f; } - if (Math_AsymStepToF(&this->linearVelocity, sp50, sp4C, sp48) && (sp50 == 0)) { + if (Math_AsymStepToF(&this->speedXZ, sp50, sp4C, sp48) && (sp50 == 0)) { LinkAnimationHeader* anim; if (this->unk_84F == 0) { @@ -13017,7 +13017,7 @@ void func_8084F390(Player* this, PlayState* play) { func_8083A098(this, anim, play); } - Math_SmoothStepToS(&this->currentYaw, downwardSlopeYaw, 10, 4000, 800); + Math_SmoothStepToS(&this->yaw, downwardSlopeYaw, 10, 4000, 800); Math_ScaledStepToS(&this->actor.shape.rot.y, sp44, 2000); } } @@ -13111,7 +13111,7 @@ void func_8084F9C0(Player* this, PlayState* play) { if (this->actor.velocity.y < 0.0f) { func_80837B9C(this, play); } else if (this->actor.velocity.y < 6.0f) { - Math_StepToF(&this->linearVelocity, 3.0f, 0.5f); + Math_StepToF(&this->speedXZ, 3.0f, 0.5f); } } @@ -13223,7 +13223,7 @@ s32 func_8084FCAC(Player* this, PlayState* play) { } } - func_80832210(this); + Player_ZeroSpeedXZ(this); this->actor.gravity = 0.0f; this->actor.velocity.z = 0.0f; @@ -13328,15 +13328,15 @@ void func_808502D0(Player* this, PlayState* play) { if ((this->stateFlags2 & PLAYER_STATE2_30) && (this->heldItemAction != PLAYER_IA_HAMMER) && LinkAnimation_OnFrame(&this->skelAnime, 0.0f)) { - this->linearVelocity = 15.0f; + this->speedXZ = 15.0f; this->stateFlags2 &= ~PLAYER_STATE2_30; } - if (this->linearVelocity > 12.0f) { + if (this->speedXZ > 12.0f) { func_8084269C(play, this); } - Math_StepToF(&this->linearVelocity, 0.0f, 5.0f); + Math_StepToF(&this->speedXZ, 0.0f, 5.0f); func_8083C50C(this); if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -13548,7 +13548,7 @@ void func_808507F4(Player* this, PlayState* play) { } } else if (D_80854A7C[this->unk_84F] < this->unk_850++) { LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, D_80854A70[this->unk_84F], 0.83f); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; this->unk_84F = -1; } } @@ -13579,7 +13579,7 @@ void func_80850AEC(Player* this, PlayState* play) { this->actor.world.rot.x = this->actor.shape.rot.x = 0; this->actor.world.pos.y -= temp; - this->linearVelocity = 1.0f; + this->speedXZ = 1.0f; this->actor.velocity.y = 0.0f; func_80837B9C(this, play); this->stateFlags2 &= ~PLAYER_STATE2_10; @@ -13871,24 +13871,24 @@ static struct_80854B18 D_80854E50[PLAYER_CSMODE_MAX] = { void func_80850ED8(PlayState* play, Player* this, LinkAnimationHeader* anim) { func_80832DB0(this); func_80832B0C(play, this, anim); - func_80832210(this); + Player_ZeroSpeedXZ(this); } void func_80850F1C(PlayState* play, Player* this, LinkAnimationHeader* anim) { func_80832DB0(this); LinkAnimation_Change(play, &this->skelAnime, anim, (2.0f / 3.0f), 0.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, -8.0f); - func_80832210(this); + Player_ZeroSpeedXZ(this); } void func_80850F9C(PlayState* play, Player* this, LinkAnimationHeader* anim) { func_80832DB0(this); LinkAnimation_Change(play, &this->skelAnime, anim, (2.0f / 3.0f), 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f); - func_80832210(this); + Player_ZeroSpeedXZ(this); } void func_80851008(PlayState* play, Player* this, void* anim) { - func_80832210(this); + Player_ZeroSpeedXZ(this); } void func_80851030(PlayState* play, Player* this, void* anim) { @@ -13898,7 +13898,7 @@ void func_80851030(PlayState* play, Player* this, void* anim) { void func_80851050(PlayState* play, Player* this, void* anim) { func_80832DB0(this); func_80832C2C(play, this, anim); - func_80832210(this); + Player_ZeroSpeedXZ(this); } void func_80851094(PlayState* play, Player* this, void* anim) { @@ -14000,7 +14000,7 @@ void func_808513BC(PlayState* play, Player* this, CsCmdActorCue* cue) { } else { func_8084B158(play, this, NULL, fabsf(this->actor.velocity.y)); Math_ScaledStepToS(&this->unk_6C2, -10000, 800); - func_8084AEEC(this, &this->actor.velocity.y, 4.0f, this->currentYaw); + func_8084AEEC(this, &this->actor.velocity.y, 4.0f, this->yaw); } return; } @@ -14014,7 +14014,7 @@ void func_808513BC(PlayState* play, Player* this, CsCmdActorCue* cue) { } func_8084B000(this); - func_8084AEEC(this, &this->linearVelocity, 0.0f, this->actor.shape.rot.y); + func_8084AEEC(this, &this->speedXZ, 0.0f, this->actor.shape.rot.y); } void func_808514C0(PlayState* play, Player* this, CsCmdActorCue* cue) { @@ -14059,7 +14059,7 @@ void func_808515A4(PlayState* play, Player* this, CsCmdActorCue* cue) { ANIMMODE_LOOP, -4.0f); } - func_80832210(this); + Player_ZeroSpeedXZ(this); } void func_80851688(PlayState* play, Player* this, CsCmdActorCue* cue) { @@ -14095,13 +14095,13 @@ void func_80851750(PlayState* play, Player* this, CsCmdActorCue* cue) { void func_80851788(PlayState* play, Player* this, CsCmdActorCue* cue) { this->stateFlags1 &= ~PLAYER_STATE1_25; - this->currentYaw = this->actor.shape.rot.y = this->actor.world.rot.y = + this->yaw = this->actor.shape.rot.y = this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_450); - if (this->linearVelocity <= 0.0f) { - this->linearVelocity = 0.1f; - } else if (this->linearVelocity > 2.5f) { - this->linearVelocity = 2.5f; + if (this->speedXZ <= 0.0f) { + this->speedXZ = 0.1f; + } else if (this->speedXZ > 2.5f) { + this->speedXZ = 2.5f; } } @@ -14376,7 +14376,7 @@ void func_808521B8(PlayState* play, Player* this, CsCmdActorCue* cue) { void func_808521F4(PlayState* play, Player* this, CsCmdActorCue* cue) { func_80832B0C(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_nwait, this->modelAnimType)); - func_80832210(this); + Player_ZeroSpeedXZ(this); } void func_80852234(PlayState* play, Player* this, CsCmdActorCue* cue) { @@ -14479,7 +14479,7 @@ void func_80852554(PlayState* play, Player* this, CsCmdActorCue* cue) { void func_80852564(PlayState* play, Player* this, CsCmdActorCue* cue) { this->stateFlags3 |= PLAYER_STATE3_1; - this->linearVelocity = 2.0f; + this->speedXZ = 2.0f; this->actor.velocity.y = -1.0f; func_80832264(play, this, &gPlayerAnim_link_normal_back_downA); @@ -14597,7 +14597,7 @@ void func_808529D0(PlayState* play, Player* this, CsCmdActorCue* cue) { } this->actor.world.pos.z = cue->startPos.z; - this->currentYaw = this->actor.shape.rot.y = cue->rot.y; + this->yaw = this->actor.shape.rot.y = cue->rot.y; } void func_80852A54(PlayState* play, Player* this, CsCmdActorCue* cue) { @@ -14607,7 +14607,7 @@ void func_80852A54(PlayState* play, Player* this, CsCmdActorCue* cue) { f32 dist = sqrtf(SQ(dx) + SQ(dy) + SQ(dz)); s16 yawDiff = (s16)cue->rot.y - this->actor.shape.rot.y; - if ((this->linearVelocity == 0.0f) && ((dist > 50.0f) || (ABS(yawDiff) > 0x4000))) { + if ((this->speedXZ == 0.0f) && ((dist > 50.0f) || (ABS(yawDiff) > 0x4000))) { func_808529D0(play, this, cue); } @@ -14643,7 +14643,7 @@ void func_80852C50(PlayState* play, Player* this, CsCmdActorCue* cueUnused) { if (play->csCtx.state == CS_STATE_STOP) { func_8002DF54(play, NULL, PLAYER_CSMODE_7); this->cueId = 0; - func_80832210(this); + Player_ZeroSpeedXZ(this); return; } @@ -14741,7 +14741,7 @@ s32 func_80852FFC(PlayState* play, Actor* actor, s32 csMode) { void func_80853080(Player* this, PlayState* play) { func_80835C58(play, this, func_80840BC8, 1); func_80832B0C(play, this, func_80833338(this)); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } s32 Player_InflictDamage(PlayState* play, s32 damage) {