metaforce/Runtime/Camera/CCameraShakeData.hpp

77 lines
2.7 KiB
C++
Raw Normal View History

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;
2016-04-16 23:48:29 +00:00
struct SCameraShakePoint
{
friend class CCameraShakeData;
u32 x0_w1 = 0;
float x4_ = 0.f;
2017-07-30 01:06:06 +00:00
float x8_magnitude = 0.f;
float xc_f1 = 0.f;
float x10_f2 = 0.f;
2017-07-30 01:06:06 +00:00
float x14_duration = 0.f;
SCameraShakePoint() = default;
2017-07-30 01:06:06 +00:00
SCameraShakePoint(u32 w1, float f1, float f2, float duration, float magnitude)
: x0_w1(w1), x8_magnitude(magnitude), xc_f1(f1), x10_f2(f2), x14_duration(duration) {}
float GetSomething() const { return x0_w1 ? x8_magnitude : x4_; }
static SCameraShakePoint LoadCameraShakePoint(CInputStream& in);
};
class CCameraShakerComponent
{
friend class CCameraShakeData;
u32 x4_w1 = 0;
SCameraShakePoint x8_sp1, x20_sp2;
float x38_ = 0.f;
public:
CCameraShakerComponent() = default;
CCameraShakerComponent(u32 w1, const SCameraShakePoint& sp1, const SCameraShakePoint& sp2)
: x4_w1(w1), x8_sp1(sp1), x20_sp2(sp2) {}
static CCameraShakerComponent LoadNewCameraShakerComponent(CInputStream& in);
};
2016-04-16 23:48:29 +00:00
class CCameraShakeData
{
2016-04-17 02:50:45 +00:00
friend class CCameraManager;
float x0_duration;
float x4_ = 0.f;
CCameraShakerComponent x8_shaker1;
CCameraShakerComponent x44_shaker2;
CCameraShakerComponent x80_shaker3;
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;
2016-04-16 23:48:29 +00:00
public:
2017-09-10 00:36:21 +00:00
static const CCameraShakeData skChargedShotCameraShakeData;
CCameraShakeData(float duration, float sfxDist, u32 w1, const zeus::CVector3f& sfxPos,
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);
//zeus::CVector3f GeneratePoint(float dt, CRandom16& r);
float GetSomething() const;
float GetSomething2() const;
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__