diff --git a/Runtime/Weapon/CPlayerGun.cpp b/Runtime/Weapon/CPlayerGun.cpp index 578d423c8..f122ab73f 100644 --- a/Runtime/Weapon/CPlayerGun.cpp +++ b/Runtime/Weapon/CPlayerGun.cpp @@ -126,9 +126,8 @@ float CPlayerGun::skTractorBeamFactor = 0.5f / CPlayerState::GetMissileComboChar CPlayerGun::CPlayerGun(TUniqueId playerId) : x0_lights(8, zeus::CVector3f{-30.f, 0.f, 30.f}, 4, 4, 0, 0, 0, 0.1f) , x538_playerId(playerId) -, x550_camBob(CPlayerCameraBob::ECameraBobType::One, - zeus::CVector2f(CPlayerCameraBob::kCameraBobExtentX, CPlayerCameraBob::kCameraBobExtentY), - CPlayerCameraBob::kCameraBobPeriod) +, x550_camBob(CPlayerCameraBob::ECameraBobType::One, CPlayerCameraBob::GetCameraBobExtent(), + CPlayerCameraBob::GetCameraBobPeriod()) , x678_morph(g_tweakPlayerGun->GetGunTransformTime(), g_tweakPlayerGun->GetHoloHoldTime()) , x6c8_hologramClipCube(zeus::CVector3f(-0.29329199f, 0.f, -0.2481945f), zeus::CVector3f(0.29329199f, 1.292392f, 0.2481945f)) diff --git a/Runtime/World/CPlayer.cpp b/Runtime/World/CPlayer.cpp index 408d0f2a2..5088641a3 100644 --- a/Runtime/World/CPlayer.cpp +++ b/Runtime/World/CPlayer.cpp @@ -225,10 +225,9 @@ CPlayer::CPlayer(TUniqueId uid, const zeus::CTransform& xf, const zeus::CAABox& x490_gun = std::make_unique(uid); x49c_gunHolsterRemTime = g_tweakPlayerGun->GetGunNotFiringTime(); x4a0_failsafeTest = std::make_unique(); - x76c_cameraBob.reset( - new CPlayerCameraBob(CPlayerCameraBob::ECameraBobType::One, - zeus::CVector2f{CPlayerCameraBob::kCameraBobExtentX, CPlayerCameraBob::kCameraBobExtentY}, - CPlayerCameraBob::kCameraBobPeriod)); + x76c_cameraBob.reset(new CPlayerCameraBob(CPlayerCameraBob::ECameraBobType::One, + CPlayerCameraBob::GetCameraBobExtent(), + CPlayerCameraBob::GetCameraBobPeriod())); x9c4_26_ = true; x9c4_27_canEnterMorphBall = true; x9c4_28_canLeaveMorphBall = true; @@ -722,8 +721,8 @@ float CPlayer::UpdateCameraBob(float dt, CStateManager& mgr) { const float strafeDist = skStrafeDistances[size_t(x2b0_outOfWaterTicks == 2 ? x2ac_surfaceRestraint : ESurfaceRestraints::Water)]; bobMag = std::min(std::sqrt(f30 * f30 + f29 * f29) / std::sqrt(strafeDist * strafeDist + maxVel * maxVel) * - CPlayerCameraBob::kOrbitBobScale, - CPlayerCameraBob::kMaxOrbitBobScale); + CPlayerCameraBob::GetOrbitBobScale(), + CPlayerCameraBob::GetMaxOrbitBobScale()); if (bobMag < 0.01f) bobMag = 0.f; } @@ -770,8 +769,8 @@ float CPlayer::UpdateCameraBob(float dt, CStateManager& mgr) { x76c_cameraBob->SetPlayerVelocity(backupVel); x76c_cameraBob->SetState(state, mgr); x76c_cameraBob->SetBobMagnitude(bobMag); - x76c_cameraBob->SetBobTimeScale((1.f - CPlayerCameraBob::kSlowSpeedPeriodScale) * bobMag + - CPlayerCameraBob::kSlowSpeedPeriodScale); + x76c_cameraBob->SetBobTimeScale((1.f - CPlayerCameraBob::GetSlowSpeedPeriodScale()) * bobMag + + CPlayerCameraBob::GetSlowSpeedPeriodScale()); x76c_cameraBob->Update(dt, mgr); return bobMag; @@ -799,9 +798,9 @@ void CPlayer::PostUpdate(float dt, CStateManager& mgr) { float cameraBobT = 0.f; if (mgr.GetCameraManager()->IsInCinematicCamera()) { - const zeus::CVector2f bobExtent(CPlayerCameraBob::kCameraBobExtentX, CPlayerCameraBob::kCameraBobExtentY); - x76c_cameraBob = std::make_unique(CPlayerCameraBob::ECameraBobType::One, bobExtent, - CPlayerCameraBob::kCameraBobPeriod); + x76c_cameraBob = std::make_unique(CPlayerCameraBob::ECameraBobType::One, + CPlayerCameraBob::GetCameraBobExtent(), + CPlayerCameraBob::GetCameraBobPeriod()); } else { cameraBobT = UpdateCameraBob(dt, mgr); } diff --git a/Runtime/World/CPlayerCameraBob.cpp b/Runtime/World/CPlayerCameraBob.cpp index c039bed5b..fb38d13e1 100644 --- a/Runtime/World/CPlayerCameraBob.cpp +++ b/Runtime/World/CPlayerCameraBob.cpp @@ -29,7 +29,7 @@ const float CPlayerCameraBob::kCameraDamping = 6.f * std::sqrt(80.f); CPlayerCameraBob::CPlayerCameraBob(ECameraBobType type, const zeus::CVector2f& vec, float bobPeriod) : x0_type(type), x4_vec(vec), xc_bobPeriod(bobPeriod) { - std::fill(std::begin(x7c_wanderPoints), std::end(x7c_wanderPoints), zeus::skForward); + x7c_wanderPoints.fill(zeus::skForward); } zeus::CTransform CPlayerCameraBob::GetViewWanderTransform() const { return xd0_viewWanderXf; } diff --git a/Runtime/World/CPlayerCameraBob.hpp b/Runtime/World/CPlayerCameraBob.hpp index 0ef07cde1..e8561594e 100644 --- a/Runtime/World/CPlayerCameraBob.hpp +++ b/Runtime/World/CPlayerCameraBob.hpp @@ -27,6 +27,13 @@ public: Unspecified }; + static zeus::CVector2f GetCameraBobExtent() { return {kCameraBobExtentX, kCameraBobExtentY}; } + static float GetCameraBobPeriod() { return kCameraBobPeriod; } + static float GetOrbitBobScale() { return kOrbitBobScale; } + static float GetMaxOrbitBobScale() { return kMaxOrbitBobScale; } + static float GetSlowSpeedPeriodScale() { return kSlowSpeedPeriodScale; } + +private: static float kCameraBobExtentX; static float kCameraBobExtentY; static float kCameraBobPeriod; @@ -46,7 +53,6 @@ public: static const float kLandingBobDamping2; static const float kCameraDamping; -private: ECameraBobType x0_type; zeus::CVector2f x4_vec; float xc_bobPeriod; @@ -65,8 +71,8 @@ private: float x70_landingTranslation = 0.f; float x74_camVelocity = 0.f; float x78_camTranslation = 0.f; - zeus::CVector3f x7c_wanderPoints[4]; - float xb0_wanderPitches[4] = {}; + std::array x7c_wanderPoints; + std::array xb0_wanderPitches{}; float xc4_wanderTime = 0.f; float xc8_viewWanderSpeed = kViewWanderSpeedMin; u32 xcc_wanderIndex = 0;