2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-08-14 21:11:44 +00:00
|
|
|
|
2017-12-29 08:08:12 +00:00
|
|
|
#include <cfloat>
|
2019-09-23 19:00:23 +00:00
|
|
|
|
|
|
|
#include "Runtime/RetroTypes.hpp"
|
|
|
|
|
|
|
|
#include <zeus/CVector2f.hpp>
|
|
|
|
#include <zeus/CVector3f.hpp>
|
|
|
|
#include <zeus/CTransform.hpp>
|
2016-08-14 21:11:44 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde {
|
2016-08-14 21:11:44 +00:00
|
|
|
|
2016-09-16 00:56:46 +00:00
|
|
|
class CStateManager;
|
2018-12-08 05:30:43 +00:00
|
|
|
class CPlayerCameraBob {
|
2016-08-14 21:11:44 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
enum class ECameraBobType { Zero, One };
|
2016-09-16 00:56:46 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
enum class ECameraBobState {
|
|
|
|
Walk,
|
|
|
|
Orbit,
|
|
|
|
InAir,
|
|
|
|
WalkNoBob,
|
|
|
|
GunFireNoBob,
|
|
|
|
TurningNoBob,
|
|
|
|
FreeLookNoBob,
|
|
|
|
GrappleNoBob,
|
|
|
|
Unspecified
|
|
|
|
};
|
2016-09-16 00:56:46 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
static float kCameraBobExtentX;
|
|
|
|
static float kCameraBobExtentY;
|
|
|
|
static float kCameraBobPeriod;
|
|
|
|
static float kOrbitBobScale;
|
|
|
|
static float kMaxOrbitBobScale;
|
|
|
|
static float kSlowSpeedPeriodScale;
|
|
|
|
static float kTargetMagnitudeTrackingRate;
|
|
|
|
static float kLandingBobSpringConstant;
|
|
|
|
static float kLandingBobSpringConstant2;
|
|
|
|
static float kViewWanderRadius;
|
|
|
|
static float kViewWanderSpeedMin;
|
|
|
|
static float kViewWanderSpeedMax;
|
|
|
|
static float kViewWanderRollVariation;
|
|
|
|
static float kGunBobMagnitude;
|
|
|
|
static float kHelmetBobMagnitude;
|
|
|
|
static const float kLandingBobDamping;
|
|
|
|
static const float kLandingBobDamping2;
|
|
|
|
static const float kCameraDamping;
|
2016-09-15 07:26:35 +00:00
|
|
|
|
2017-03-20 05:09:53 +00:00
|
|
|
private:
|
2018-12-08 05:30:43 +00:00
|
|
|
ECameraBobType x0_type;
|
|
|
|
zeus::CVector2f x4_vec;
|
|
|
|
float xc_bobPeriod;
|
|
|
|
float x10_targetBobMagnitude = 0.f;
|
|
|
|
float x14_bobMagnitude = 0.f;
|
|
|
|
float x18_bobTimeScale = 0.f;
|
|
|
|
float x1c_bobTime = 0.f;
|
|
|
|
ECameraBobState x20_oldState = ECameraBobState::Unspecified;
|
|
|
|
ECameraBobState x24_curState = ECameraBobState::Unspecified;
|
|
|
|
bool x28_applyLandingTrans = false;
|
|
|
|
bool x29_hardLand = false;
|
|
|
|
zeus::CTransform x2c_cameraBobTransform;
|
|
|
|
zeus::CVector3f x5c_playerVelocity;
|
|
|
|
float x68_playerPeakFallVel = 0.f;
|
|
|
|
float x6c_landingVelocity = 0.f;
|
|
|
|
float x70_landingTranslation = 0.f;
|
|
|
|
float x74_camVelocity = 0.f;
|
|
|
|
float x78_camTranslation = 0.f;
|
|
|
|
zeus::CVector3f x7c_wanderPoints[4];
|
|
|
|
float xb0_wanderPitches[4] = {};
|
|
|
|
float xc4_wanderTime = 0.f;
|
|
|
|
float xc8_viewWanderSpeed = kViewWanderSpeedMin;
|
|
|
|
u32 xcc_wanderIndex = 0;
|
|
|
|
zeus::CTransform xd0_viewWanderXf;
|
|
|
|
float x100_wanderMagnitude = FLT_EPSILON;
|
|
|
|
float x104_targetWanderMagnitude = 0.f;
|
2016-12-19 18:27:58 +00:00
|
|
|
|
2016-08-14 21:11:44 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
CPlayerCameraBob(ECameraBobType type, const zeus::CVector2f& vec, float bobPeriod);
|
2016-09-15 07:26:35 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
zeus::CTransform GetViewWanderTransform() const;
|
|
|
|
zeus::CVector3f GetHelmetBobTranslation() const;
|
|
|
|
zeus::CTransform GetGunBobTransformation() const;
|
|
|
|
zeus::CTransform GetCameraBobTransformation() const;
|
|
|
|
void SetPlayerVelocity(const zeus::CVector3f& velocity);
|
|
|
|
void SetBobMagnitude(float);
|
|
|
|
void SetBobTimeScale(float);
|
|
|
|
void ResetCameraBobTime();
|
|
|
|
void SetCameraBobTransform(const zeus::CTransform&);
|
|
|
|
void SetState(ECameraBobState, CStateManager&);
|
|
|
|
void InitViewWander(CStateManager&);
|
|
|
|
void UpdateViewWander(float, CStateManager&);
|
|
|
|
void Update(float, CStateManager&);
|
2019-08-14 10:04:11 +00:00
|
|
|
zeus::CVector3f CalculateRandomViewWanderPosition(CStateManager&) const;
|
|
|
|
float CalculateRandomViewWanderPitch(CStateManager&) const;
|
2018-12-08 05:30:43 +00:00
|
|
|
void CalculateMovingTranslation(float& x, float& y) const;
|
|
|
|
float CalculateLandingTranslation() const;
|
|
|
|
zeus::CTransform CalculateCameraBobTransformation() const;
|
|
|
|
static void ReadTweaks(CInputStream& in);
|
2016-08-14 21:11:44 +00:00
|
|
|
};
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace urde
|