metaforce/Runtime/Weapon/CProjectileWeapon.hpp

106 lines
4.1 KiB
C++
Raw Normal View History

2017-03-24 05:30:16 +00:00
#ifndef __URDE_CPROJECTILEWEAPON_HPP__
#define __URDE_CPROJECTILEWEAPON_HPP__
#include "RetroTypes.hpp"
#include "CRandom16.hpp"
#include "CToken.hpp"
#include "zeus/CVector3f.hpp"
#include "Particle/CElementGen.hpp"
#include "Particle/CParticleSwoosh.hpp"
#include "Particle/CGenDescription.hpp"
#include "Particle/CSwooshDescription.hpp"
#include "Particle/CWeaponDescription.hpp"
2018-02-10 06:26:12 +00:00
#include "Collision/CCollisionResponseData.hpp"
2017-03-24 05:30:16 +00:00
namespace urde
{
class CModel;
2018-02-10 06:26:12 +00:00
class CDecalDescription;
class CGenDescription;
2017-03-24 05:30:16 +00:00
class CProjectileWeapon
{
2017-06-11 02:57:35 +00:00
static u16 g_GlobalSeed;
TLockedToken<CWeaponDescription> x4_weaponDesc;
CRandom16 x10_random;
2018-02-09 07:12:26 +00:00
zeus::CTransform x14_localToWorldXf;
zeus::CTransform x44_localXf;
2018-02-10 06:26:12 +00:00
zeus::CVector3f x74_worldOffset;
zeus::CVector3f x80_localOffset = zeus::CVector3f::skZero;
zeus::CVector3f x8c_projOffset = zeus::CVector3f::skZero;
zeus::CVector3f x98_scale = zeus::CVector3f::skOne;
zeus::CVector3f xa4_localOffset2 = zeus::CVector3f::skZero;
zeus::CVector3f xb0_velocity = zeus::CVector3f::skZero;
zeus::CVector3f xbc_gravity = zeus::CVector3f::skZero;
zeus::CColor xc8_ambientLightColor = zeus::CColor::skWhite;
double xd0_curTime = 0.0;
double xd8_remainderTime = 0.0;
float xe0_maxTurnRate = 0.f;
int xe4_flags;
int xe8_lifetime = 0;
int xec_childSystemUpdateRate = 0;
int xf0_ = 0;
int xf4_curFrame = 0;
int xf8_lastParticleFrame = -1;
std::unique_ptr<CElementGen> xfc_APSMGen;
std::unique_ptr<CElementGen> x100_APS2Gen;
std::unique_ptr<CElementGen> x104_;
std::experimental::optional<TLockedToken<CModel>> x108_model;
std::unique_ptr<CParticleSwoosh> x118_swoosh1;
std::unique_ptr<CParticleSwoosh> x11c_swoosh2;
std::unique_ptr<CParticleSwoosh> x120_swoosh3;
union
{
struct
{
2018-02-09 07:12:26 +00:00
bool x124_24_active : 1;
2018-02-10 06:26:12 +00:00
bool x124_25_APSO : 1;
bool x124_26_AP11 : 1;
bool x124_27_AP21 : 1;
bool x124_28_AS11 : 1;
bool x124_29_AS12 : 1;
bool x124_30_AS13 : 1;
bool x124_31_VMD2 : 1;
};
u32 _dummy = 0;
};
2017-03-24 05:30:16 +00:00
public:
2018-02-10 06:26:12 +00:00
CProjectileWeapon(const TToken<CWeaponDescription>& wDesc, const zeus::CVector3f& worldOffset,
2018-02-09 07:12:26 +00:00
const zeus::CTransform& orient, const zeus::CVector3f& scale, s32);
virtual ~CProjectileWeapon() = default;
bool IsProjectileActive() const { return x124_24_active; }
std::experimental::optional<zeus::CAABox> GetBounds() const;
2018-02-10 06:26:12 +00:00
const zeus::CVector3f& GetVelocity() const { return xb0_velocity; }
void SetVelocity(const zeus::CVector3f& vel) { xb0_velocity = vel; }
2018-02-09 07:12:26 +00:00
float GetMaxTurnRate() const { return xe0_maxTurnRate; }
2018-02-10 06:26:12 +00:00
float GetAudibleFallOff() const;
float GetAudibleRange() const;
std::experimental::optional<TLockedToken<CDecalDescription>>
2018-02-10 06:26:12 +00:00
GetDecalForCollision(EWeaponCollisionResponseTypes type) const;
2018-05-10 07:25:26 +00:00
s32 GetSoundIdForCollision(EWeaponCollisionResponseTypes type) const;
std::experimental::optional<TLockedToken<CGenDescription>>
2018-02-12 05:30:21 +00:00
CollisionOccured(EWeaponCollisionResponseTypes type, bool deflected, bool useTarget, const zeus::CVector3f& pos,
const zeus::CVector3f& normal, const zeus::CVector3f& target);
2018-02-09 07:12:26 +00:00
TLockedToken<CWeaponDescription> GetWeaponDescription() const { return x4_weaponDesc; }
2018-02-10 06:26:12 +00:00
void RenderParticles() const;
2018-02-12 05:30:21 +00:00
virtual void AddToRenderer() const;
2018-02-10 06:26:12 +00:00
virtual void Render() const;
bool IsSystemDeletable() const;
void UpdateChildParticleSystems(float);
2018-02-10 06:26:12 +00:00
void UpdatePSTranslationAndOrientation();
2018-02-09 07:12:26 +00:00
void SetWorldSpaceOrientation(const zeus::CTransform& xf);
void SetRelativeOrientation(const zeus::CTransform& xf) { x44_localXf = xf; }
2018-02-10 06:26:12 +00:00
virtual zeus::CVector3f GetTranslation() const;
virtual zeus::CTransform GetTransform() const;
void UpdateParticleFX();
virtual void Update(float dt);
void SetGravity(const zeus::CVector3f& grav) { xbc_gravity = grav; }
2017-06-11 02:57:35 +00:00
static void SetGlobalSeed(u16 seed) { g_GlobalSeed = seed; }
2018-02-11 05:27:00 +00:00
CElementGen* GetAttachedPS1() const { return xfc_APSMGen.get(); }
2018-02-12 05:30:21 +00:00
double GameTime() const { return xd0_curTime; }
2017-03-24 05:30:16 +00:00
};
}
#endif // __URDE_CPROJECTILEWEAPON_HPP__