2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-04-16 23:48:29 +00:00
|
|
|
|
2019-09-28 02:53:03 +00:00
|
|
|
#include "Runtime/RetroTypes.hpp"
|
|
|
|
|
|
|
|
#include <zeus/CVector3f.hpp>
|
2016-04-17 02:50:45 +00:00
|
|
|
|
2018-12-08 05:30:43 +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
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
struct SCameraShakePoint {
|
|
|
|
friend class CCameraShakeData;
|
|
|
|
bool x0_useEnvelope = false;
|
|
|
|
float x4_value = 0.f;
|
|
|
|
float x8_magnitude = 0.f;
|
|
|
|
float xc_attackTime = 0.f;
|
|
|
|
float x10_sustainTime = 0.f;
|
|
|
|
float x14_duration = 0.f;
|
|
|
|
SCameraShakePoint() = default;
|
|
|
|
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; }
|
|
|
|
static SCameraShakePoint LoadCameraShakePoint(CInputStream& in);
|
|
|
|
void Update(float curTime);
|
2017-03-18 05:12:27 +00:00
|
|
|
};
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CCameraShakerComponent {
|
|
|
|
friend class CCameraShakeData;
|
|
|
|
bool x4_useModulation = false;
|
|
|
|
SCameraShakePoint x8_am, x20_fm;
|
|
|
|
float x38_value = 0.f;
|
|
|
|
|
2017-03-18 05:12:27 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
CCameraShakerComponent() = default;
|
|
|
|
CCameraShakerComponent(bool useModulation, const SCameraShakePoint& am, const SCameraShakePoint& fm)
|
|
|
|
: x4_useModulation(useModulation), x8_am(am), x20_fm(fm) {}
|
|
|
|
static CCameraShakerComponent LoadNewCameraShakerComponent(CInputStream& in);
|
|
|
|
void Update(float curTime, float duration, float distAtt);
|
|
|
|
float GetValue() const { return x38_value; }
|
2017-03-18 05:12:27 +00:00
|
|
|
};
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CCameraShakeData {
|
|
|
|
friend class CCameraManager;
|
|
|
|
float x0_duration;
|
|
|
|
float x4_curTime = 0.f;
|
|
|
|
CCameraShakerComponent x8_shakerX;
|
|
|
|
CCameraShakerComponent x44_shakerY;
|
|
|
|
CCameraShakerComponent x80_shakerZ;
|
|
|
|
u32 xbc_shakerId = 0;
|
|
|
|
u32 xc0_flags; // 0x1: positional sfx
|
|
|
|
zeus::CVector3f xc4_sfxPos;
|
|
|
|
float xd0_sfxDist;
|
2017-03-18 05:12:27 +00:00
|
|
|
|
2016-04-16 23:48:29 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
static const CCameraShakeData skChargedShotCameraShakeData;
|
|
|
|
CCameraShakeData(float duration, float sfxDist, u32 flags, const zeus::CVector3f& sfxPos,
|
|
|
|
const CCameraShakerComponent& shaker1, const CCameraShakerComponent& shaker2,
|
|
|
|
const CCameraShakerComponent& shaker3);
|
|
|
|
CCameraShakeData(float duration, float magnitude);
|
2020-03-31 03:52:22 +00:00
|
|
|
explicit CCameraShakeData(CInputStream&);
|
2018-12-08 05:30:43 +00:00
|
|
|
static CCameraShakeData BuildLandingCameraShakeData(float duration, float magnitude);
|
|
|
|
static CCameraShakeData BuildProjectileCameraShake(float duration, float magnitude);
|
|
|
|
static CCameraShakeData BuildMissileCameraShake(float duration, float magnitude, float sfxDistance,
|
|
|
|
const zeus::CVector3f& sfxPos);
|
|
|
|
static CCameraShakeData BuildPhazonCameraShakeData(float duration, float magnitude);
|
|
|
|
static CCameraShakeData BuildPatternedExplodeShakeData(float duration, float magnitude);
|
|
|
|
static CCameraShakeData BuildPatternedExplodeShakeData(const zeus::CVector3f& pos, float duration, float magnitude,
|
|
|
|
float distance);
|
|
|
|
void Update(float dt, CStateManager& mgr);
|
|
|
|
zeus::CVector3f GetPoint() const;
|
|
|
|
float GetMaxAMComponent() const;
|
|
|
|
float GetMaxFMComponent() const;
|
|
|
|
void SetShakerId(u32 id) { xbc_shakerId = id; }
|
|
|
|
u32 GetShakerId() const { return xbc_shakerId; }
|
|
|
|
static CCameraShakeData LoadCameraShakeData(CInputStream& in);
|
|
|
|
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
|
|
|
};
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace urde
|