2016-04-16 23:48:29 +00:00
|
|
|
#ifndef __URDE_CCAMERASHAKEDATA_HPP__
|
|
|
|
#define __URDE_CCAMERASHAKEDATA_HPP__
|
|
|
|
|
2016-04-17 02:50:45 +00:00
|
|
|
#include "zeus/CVector3f.hpp"
|
|
|
|
#include "RetroTypes.hpp"
|
|
|
|
|
2016-04-16 23:48:29 +00:00
|
|
|
namespace urde
|
|
|
|
{
|
2016-04-17 02:50:45 +00:00
|
|
|
class CRandom16;
|
2017-10-06 07:29:56 +00:00
|
|
|
class CStateManager;
|
2016-04-16 23:48:29 +00:00
|
|
|
|
2017-03-18 05:12:27 +00:00
|
|
|
struct SCameraShakePoint
|
|
|
|
{
|
|
|
|
friend class CCameraShakeData;
|
2017-10-10 03:50:48 +00:00
|
|
|
bool x0_useEnvelope = false;
|
|
|
|
float x4_value = 0.f;
|
2017-07-30 01:06:06 +00:00
|
|
|
float x8_magnitude = 0.f;
|
2017-10-10 03:50:48 +00:00
|
|
|
float xc_attackTime = 0.f;
|
|
|
|
float x10_sustainTime = 0.f;
|
2017-07-30 01:06:06 +00:00
|
|
|
float x14_duration = 0.f;
|
2017-03-18 05:12:27 +00:00
|
|
|
SCameraShakePoint() = default;
|
2017-10-10 03:50:48 +00:00
|
|
|
SCameraShakePoint(bool useEnvelope, float attackTime, float sustainTime, float duration, float magnitude)
|
|
|
|
: x0_useEnvelope(useEnvelope), x8_magnitude(magnitude), xc_attackTime(attackTime),
|
|
|
|
x10_sustainTime(sustainTime), x14_duration(duration) {}
|
|
|
|
float GetValue() const { return x0_useEnvelope ? x8_magnitude : x4_value; }
|
2017-03-18 05:12:27 +00:00
|
|
|
static SCameraShakePoint LoadCameraShakePoint(CInputStream& in);
|
2017-10-10 03:50:48 +00:00
|
|
|
void Update(float curTime);
|
2017-03-18 05:12:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CCameraShakerComponent
|
|
|
|
{
|
|
|
|
friend class CCameraShakeData;
|
2017-10-10 03:50:48 +00:00
|
|
|
bool x4_useModulation = false;
|
|
|
|
SCameraShakePoint x8_am, x20_fm;
|
2017-10-06 07:29:56 +00:00
|
|
|
float x38_value = 0.f;
|
2017-03-18 05:12:27 +00:00
|
|
|
public:
|
|
|
|
CCameraShakerComponent() = default;
|
2017-10-10 03:50:48 +00:00
|
|
|
CCameraShakerComponent(bool useModulation, const SCameraShakePoint& am, const SCameraShakePoint& fm)
|
|
|
|
: x4_useModulation(useModulation), x8_am(am), x20_fm(fm) {}
|
2017-03-18 05:12:27 +00:00
|
|
|
static CCameraShakerComponent LoadNewCameraShakerComponent(CInputStream& in);
|
2017-10-10 03:50:48 +00:00
|
|
|
void Update(float curTime, float duration, float distAtt);
|
|
|
|
float GetValue() const { return x38_value; }
|
2017-03-18 05:12:27 +00:00
|
|
|
};
|
|
|
|
|
2016-04-16 23:48:29 +00:00
|
|
|
class CCameraShakeData
|
|
|
|
{
|
2016-04-17 02:50:45 +00:00
|
|
|
friend class CCameraManager;
|
2017-03-18 05:12:27 +00:00
|
|
|
float x0_duration;
|
2017-10-06 07:29:56 +00:00
|
|
|
float x4_curTime = 0.f;
|
2017-10-10 03:50:48 +00:00
|
|
|
CCameraShakerComponent x8_shakerX;
|
|
|
|
CCameraShakerComponent x44_shakerY;
|
|
|
|
CCameraShakerComponent x80_shakerZ;
|
2017-03-18 05:12:27 +00:00
|
|
|
u32 xbc_shakerId = 0;
|
|
|
|
u32 xc0_flags; // 0x1: positional sfx
|
|
|
|
zeus::CVector3f xc4_sfxPos;
|
2017-09-10 00:36:21 +00:00
|
|
|
float xd0_sfxDist;
|
2017-03-18 05:12:27 +00:00
|
|
|
|
2016-04-16 23:48:29 +00:00
|
|
|
public:
|
2017-09-10 00:36:21 +00:00
|
|
|
static const CCameraShakeData skChargedShotCameraShakeData;
|
2017-10-10 03:50:48 +00:00
|
|
|
CCameraShakeData(float duration, float sfxDist, u32 flags, const zeus::CVector3f& sfxPos,
|
2017-03-18 05:12:27 +00:00
|
|
|
const CCameraShakerComponent& shaker1, const CCameraShakerComponent& shaker2,
|
|
|
|
const CCameraShakerComponent& shaker3);
|
2017-07-30 01:06:06 +00:00
|
|
|
CCameraShakeData(float duration, float magnitude);
|
|
|
|
static CCameraShakeData BuildLandingCameraShakeData(float duration, float magnitude);
|
|
|
|
static CCameraShakeData BuildProjectileCameraShake(float duration, float magnitude);
|
2017-09-10 00:36:21 +00:00
|
|
|
static CCameraShakeData BuildMissileCameraShake(float duration, float magnitude, float sfxDistance,
|
|
|
|
const zeus::CVector3f& sfxPos);
|
2017-07-30 01:06:06 +00:00
|
|
|
static CCameraShakeData BuildPhazonCameraShakeData(float duration, float magnitude);
|
2017-10-06 07:29:56 +00:00
|
|
|
void Update(float dt, CStateManager& mgr);
|
|
|
|
zeus::CVector3f GetPoint() const;
|
2017-10-10 03:50:48 +00:00
|
|
|
float GetMaxAMComponent() const;
|
|
|
|
float GetMaxFMComponent() const;
|
2017-03-18 05:12:27 +00:00
|
|
|
void SetShakerId(u32 id) { xbc_shakerId = id; }
|
|
|
|
u32 GetShakerId() const { return xbc_shakerId; }
|
|
|
|
static CCameraShakeData LoadCameraShakeData(CInputStream& in);
|
2017-09-10 00:36:21 +00:00
|
|
|
void SetSfxPositionAndDistance(const zeus::CVector3f& pos, float f2)
|
|
|
|
{ xc0_flags |= 0x1; xc4_sfxPos = pos; xd0_sfxDist = f2; }
|
2016-04-16 23:48:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __URDE_CCAMERASHAKEDATA_HPP__
|