2016-08-14 21:11:44 +00:00
|
|
|
#ifndef __URDE_CPLAYERCAMERABOB_HPP__
|
|
|
|
#define __URDE_CPLAYERCAMERABOB_HPP__
|
|
|
|
|
|
|
|
#include <float.h>
|
|
|
|
#include "RetroTypes.hpp"
|
|
|
|
#include "zeus/CVector2f.hpp"
|
|
|
|
#include "zeus/CTransform.hpp"
|
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
|
2016-09-16 00:56:46 +00:00
|
|
|
class CStateManager;
|
2016-08-14 21:11:44 +00:00
|
|
|
class CPlayerCameraBob
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum class ECameraBobType
|
|
|
|
{
|
|
|
|
Zero,
|
|
|
|
One
|
|
|
|
};
|
2016-09-16 00:56:46 +00:00
|
|
|
|
|
|
|
enum class ECameraBobState
|
|
|
|
{
|
2017-08-19 06:52:13 +00:00
|
|
|
Walk,
|
|
|
|
Orbit,
|
|
|
|
InAir,
|
|
|
|
WalkNoBob,
|
|
|
|
GunFireNoBob,
|
|
|
|
TurningNoBob,
|
|
|
|
FreeLookNoBob,
|
|
|
|
GrappleNoBob,
|
|
|
|
Unspecified
|
2016-09-16 00:56:46 +00:00
|
|
|
};
|
|
|
|
|
2016-09-15 07:26:35 +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 kViewWanderRadius;
|
|
|
|
static float kViewWanderSpeedMin;
|
|
|
|
static float kViewWanderSpeedMax;
|
|
|
|
static float kViewWanderRollVariation;
|
|
|
|
static float kGunBobMagnitude;
|
|
|
|
static float kHelmetBobMagnitude;
|
2016-09-16 00:56:46 +00:00
|
|
|
static const float kLandingBobDamping;
|
2016-09-15 07:26:35 +00:00
|
|
|
|
2017-03-20 05:09:53 +00:00
|
|
|
private:
|
2016-08-14 21:11:44 +00:00
|
|
|
ECameraBobType x0_type;
|
|
|
|
zeus::CVector2f x4_vec;
|
|
|
|
float xc_;
|
2016-09-16 00:56:46 +00:00
|
|
|
float x10_bobMagnitude = 0.f;
|
2016-08-14 21:11:44 +00:00
|
|
|
float x14_ = 0.f;
|
2016-09-16 00:56:46 +00:00
|
|
|
float x18_bobTimeScale = 0.f;
|
|
|
|
float x1c_bobTime = 0.f;
|
2017-08-19 06:52:13 +00:00
|
|
|
ECameraBobState x20_oldState = ECameraBobState::Unspecified;
|
|
|
|
ECameraBobState x24_curState = ECameraBobState::Unspecified;
|
2016-09-16 00:56:46 +00:00
|
|
|
bool x28_applyLandingTrans = false;
|
2016-08-14 21:11:44 +00:00
|
|
|
bool x29_ = false;
|
2016-09-16 00:56:46 +00:00
|
|
|
zeus::CTransform x2c_cameraBobTransform;
|
|
|
|
zeus::CVector3f x5c_playerVelocity;
|
2016-08-14 21:11:44 +00:00
|
|
|
float x68_ = 0.f;
|
|
|
|
float x6c_ = 0.f;
|
2016-09-16 00:56:46 +00:00
|
|
|
float x70_landingTranslation = 0.f;
|
2016-08-14 21:11:44 +00:00
|
|
|
float x74_ = 0.f;
|
|
|
|
float x78_ = 0.f;
|
2016-09-16 00:56:46 +00:00
|
|
|
zeus::CVector3f x7c_wanderPoints[4] = {zeus::CVector3f{0.f, 1.f, 0.f}};
|
|
|
|
float xb0_wanderPitches[4] = {0.f};
|
|
|
|
float xc4_wanderTime = 0.f;
|
|
|
|
float xc8_viewWanderSpeed = kViewWanderSpeedMin;
|
|
|
|
u32 xcc_wanderIndex = 0;
|
|
|
|
zeus::CTransform xd0_viewWanderXf;
|
2016-08-14 21:11:44 +00:00
|
|
|
float x100_ = FLT_EPSILON;
|
|
|
|
float x104_ = 0.f;
|
2016-12-19 18:27:58 +00:00
|
|
|
|
2016-08-14 21:11:44 +00:00
|
|
|
public:
|
|
|
|
CPlayerCameraBob(ECameraBobType type, const zeus::CVector2f& vec, float);
|
2016-09-15 07:26:35 +00:00
|
|
|
|
2016-09-16 00:56:46 +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();
|
2016-09-16 22:21:19 +00:00
|
|
|
void SetCameraBobTransform(const zeus::CTransform&);
|
2016-09-16 00:56:46 +00:00
|
|
|
void SetState(ECameraBobState, CStateManager&);
|
|
|
|
void InitViewWander(CStateManager&);
|
|
|
|
void UpdateViewWander(float, CStateManager&);
|
2016-12-19 18:27:58 +00:00
|
|
|
void Update(float, CStateManager&);
|
2016-09-16 00:56:46 +00:00
|
|
|
zeus::CVector3f CalculateRandomViewWanderPosition(CStateManager&);
|
|
|
|
float CalculateRandomViewWanderPitch(CStateManager&);
|
|
|
|
void CalculateMovingTranslation(float& x, float& y) const;
|
|
|
|
float CalculateLandingTranslation() const;
|
|
|
|
zeus::CTransform CalculateCameraBobTransformation() const;
|
2016-09-15 07:26:35 +00:00
|
|
|
static void ReadTweaks(CInputStream& in);
|
2016-08-14 21:11:44 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __URDE_CPLAYERCAMERABOB_HPP__
|