2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-04-17 02:50:45 +00:00
|
|
|
|
2017-03-04 04:31:08 +00:00
|
|
|
#include <list>
|
|
|
|
#include "Audio/CSfxManager.hpp"
|
|
|
|
#include "CToken.hpp"
|
|
|
|
#include "zeus/CTransform.hpp"
|
2017-08-01 10:08:42 +00:00
|
|
|
#include "Particle/CParticleElectric.hpp"
|
|
|
|
#include "Particle/CParticleSwoosh.hpp"
|
2017-08-22 03:20:22 +00:00
|
|
|
#include "Graphics/CRainSplashGenerator.hpp"
|
2017-03-04 04:31:08 +00:00
|
|
|
|
2016-04-17 02:50:45 +00:00
|
|
|
namespace urde
|
|
|
|
{
|
2017-03-04 04:31:08 +00:00
|
|
|
class CStateManager;
|
|
|
|
class CEntity;
|
|
|
|
class CElementGen;
|
|
|
|
class CTexture;
|
|
|
|
class CGenDescription;
|
2017-07-14 05:14:19 +00:00
|
|
|
class CActor;
|
2018-05-14 04:38:58 +00:00
|
|
|
class CScriptPlayerActor;
|
2016-04-17 02:50:45 +00:00
|
|
|
|
|
|
|
class CActorModelParticles
|
|
|
|
{
|
2017-03-26 05:53:04 +00:00
|
|
|
public:
|
2018-11-06 06:16:12 +00:00
|
|
|
enum class EDependency
|
|
|
|
{
|
|
|
|
OnFire,
|
|
|
|
Ash,
|
|
|
|
IceBreak,
|
|
|
|
FirePop,
|
|
|
|
IcePop,
|
|
|
|
Electric
|
|
|
|
};
|
|
|
|
|
2017-03-04 04:31:08 +00:00
|
|
|
class CItem
|
|
|
|
{
|
|
|
|
friend class CActorModelParticles;
|
|
|
|
TUniqueId x0_id;
|
|
|
|
TAreaId x4_areaId;
|
2018-02-05 06:56:09 +00:00
|
|
|
rstl::reserved_vector<std::pair<std::unique_ptr<CElementGen>, u32>, 8> x8_thermalHotParticles;
|
2018-11-08 00:53:38 +00:00
|
|
|
float x6c_onFireDelayTimer = 0.f;
|
|
|
|
bool x70_onFire = false;
|
2017-07-30 11:00:30 +00:00
|
|
|
CSfxHandle x74_sfx;
|
2017-03-04 04:31:08 +00:00
|
|
|
std::unique_ptr<CElementGen> x78_;
|
|
|
|
u32 x80_ = 0;
|
2018-11-04 01:08:44 +00:00
|
|
|
s32 x84_ = -1;
|
2017-07-30 11:00:30 +00:00
|
|
|
u32 x88_seed1 = 99;
|
2018-02-15 04:37:21 +00:00
|
|
|
rstl::reserved_vector<std::unique_ptr<CElementGen>, 4> x8c_thermalColdParticles;
|
2017-07-31 10:47:04 +00:00
|
|
|
s32 xb0_ = -1;
|
2017-07-30 11:00:30 +00:00
|
|
|
u32 xb4_seed2 = 99;
|
2017-03-04 04:31:08 +00:00
|
|
|
std::unique_ptr<CElementGen> xb8_;
|
2017-07-31 10:47:04 +00:00
|
|
|
std::unique_ptr<CParticleElectric> xc0_particleElectric;
|
2017-03-04 04:31:08 +00:00
|
|
|
u32 xc8_ = 0;
|
2017-07-31 10:47:04 +00:00
|
|
|
u32 xcc_seed3 = 99;
|
2017-03-04 04:31:08 +00:00
|
|
|
zeus::CColor xd0_;
|
2017-08-22 03:20:22 +00:00
|
|
|
std::unique_ptr<CRainSplashGenerator> xd4_rainSplashGenerator;
|
2017-03-04 04:31:08 +00:00
|
|
|
TToken<CTexture> xdc_ashy;
|
|
|
|
std::unique_ptr<CElementGen> xe4_;
|
2017-07-30 11:00:30 +00:00
|
|
|
zeus::CVector3f xec_ = zeus::CVector3f::skOne;
|
2017-03-04 04:31:08 +00:00
|
|
|
zeus::CTransform xf8_;
|
|
|
|
CActorModelParticles& x128_parent;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
2018-02-05 06:56:09 +00:00
|
|
|
bool x12c_24_thermalCold : 1;
|
|
|
|
bool x12c_25_thermalHot : 1;
|
2017-03-04 04:31:08 +00:00
|
|
|
};
|
|
|
|
u16 _dummy = 0;
|
|
|
|
};
|
|
|
|
float x130_ = 10.f;
|
2018-12-08 01:49:15 +00:00
|
|
|
u8 x134_lockDeps = 0;
|
|
|
|
void sub_801e59a8(EDependency i);
|
|
|
|
bool UpdateOnFire(float dt, CActor* actor, CStateManager& mgr);
|
|
|
|
bool UpdateAsh(float dt, CActor* actor, CStateManager& mgr);
|
|
|
|
bool sub_801e65bc(float dt, CActor* actor, CStateManager& mgr);
|
|
|
|
bool UpdateFirePop(float dt, CActor* actor, CStateManager& mgr);
|
|
|
|
bool UpdateElectric(float dt, CActor* actor, CStateManager& mgr);
|
|
|
|
bool sub_801e69f0(float dt, CActor* actor, CStateManager& mgr);
|
|
|
|
bool sub_801e5e98(float dt, CActor* actor, CStateManager& mgr);
|
|
|
|
bool UpdateIcePop(float dt, CActor* actor, CStateManager& mgr);
|
2017-03-04 04:31:08 +00:00
|
|
|
public:
|
|
|
|
CItem(const CEntity& ent, CActorModelParticles& parent);
|
2017-08-21 05:46:59 +00:00
|
|
|
void GeneratePoints(const std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vn);
|
2018-12-08 01:49:15 +00:00
|
|
|
bool Update(float dt, CStateManager& mgr);
|
|
|
|
void Lock(EDependency i);
|
|
|
|
void Unlock(EDependency i);
|
2017-03-04 04:31:08 +00:00
|
|
|
};
|
|
|
|
|
2017-03-26 05:53:04 +00:00
|
|
|
private:
|
2018-11-06 06:16:12 +00:00
|
|
|
friend class CItem;
|
2017-03-04 04:31:08 +00:00
|
|
|
std::list<CItem> x0_items;
|
|
|
|
TToken<CGenDescription> x18_onFire;
|
|
|
|
TToken<CGenDescription> x20_ash;
|
|
|
|
TToken<CGenDescription> x28_iceBreak;
|
|
|
|
TToken<CGenDescription> x30_firePop;
|
|
|
|
TToken<CGenDescription> x38_icePop;
|
|
|
|
TToken<CElectricDescription> x40_electric;
|
|
|
|
TToken<CTexture> x48_ashy;
|
2018-11-06 06:16:12 +00:00
|
|
|
struct Dependency
|
|
|
|
{
|
|
|
|
std::vector<CToken> x0_tokens;
|
|
|
|
int x10_refCount = 0;
|
|
|
|
bool x14_loaded = false;
|
|
|
|
void Increment()
|
|
|
|
{
|
|
|
|
++x10_refCount;
|
|
|
|
if (x10_refCount == 1)
|
|
|
|
Load();
|
|
|
|
}
|
|
|
|
void Decrement()
|
|
|
|
{
|
|
|
|
--x10_refCount;
|
|
|
|
if (x10_refCount <= 0)
|
|
|
|
Unload();
|
|
|
|
}
|
|
|
|
void Load()
|
|
|
|
{
|
|
|
|
bool loading = false;
|
|
|
|
for (CToken& tok : x0_tokens)
|
|
|
|
{
|
|
|
|
tok.Lock();
|
|
|
|
if (!tok.IsLoaded())
|
|
|
|
loading = true;
|
|
|
|
}
|
|
|
|
if (!loading)
|
|
|
|
x14_loaded = true;
|
|
|
|
}
|
|
|
|
void Unload()
|
|
|
|
{
|
|
|
|
for (CToken& tok : x0_tokens)
|
|
|
|
tok.Unlock();
|
|
|
|
x14_loaded = false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
rstl::reserved_vector<Dependency, 6> x50_dgrps;
|
|
|
|
u8 xe4_bits = 0;
|
2018-12-08 01:49:15 +00:00
|
|
|
u8 xe5_bits1 = 0;
|
2018-11-06 06:16:12 +00:00
|
|
|
u8 xe6_bits2 = 0;
|
2017-03-04 04:31:08 +00:00
|
|
|
|
2018-11-06 06:16:12 +00:00
|
|
|
Dependency GetParticleDGRPTokens(const char* name);
|
2017-03-04 04:31:08 +00:00
|
|
|
void LoadParticleDGRPs();
|
|
|
|
|
|
|
|
std::unique_ptr<CElementGen> MakeOnFireGen() const;
|
|
|
|
std::unique_ptr<CElementGen> MakeAshGen() const;
|
|
|
|
std::unique_ptr<CElementGen> MakeIceGen() const;
|
|
|
|
std::unique_ptr<CElementGen> MakeFirePopGen() const;
|
|
|
|
std::unique_ptr<CElementGen> MakeIcePopGen() const;
|
|
|
|
std::unique_ptr<CParticleElectric> MakeElectricGen() const;
|
|
|
|
|
2018-12-08 01:49:15 +00:00
|
|
|
void DecrementDependency(EDependency d);
|
2018-11-06 06:16:12 +00:00
|
|
|
void IncrementDependency(EDependency d);
|
2017-03-04 04:31:08 +00:00
|
|
|
public:
|
|
|
|
CActorModelParticles();
|
2017-08-21 05:46:59 +00:00
|
|
|
static void PointGenerator(void* item, const std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vn);
|
2017-03-04 04:31:08 +00:00
|
|
|
void AddStragglersToRenderer(const CStateManager& mgr);
|
2017-03-24 05:30:16 +00:00
|
|
|
void Update(float dt, CStateManager& mgr);
|
2017-03-26 05:53:04 +00:00
|
|
|
void SetupHook(TUniqueId uid);
|
|
|
|
std::list<CItem>::const_iterator FindSystem(TUniqueId uid) const;
|
2018-05-14 04:38:58 +00:00
|
|
|
std::list<CItem>::iterator FindOrCreateSystem(CActor& act);
|
2018-09-14 00:49:34 +00:00
|
|
|
void StartIce(CActor& actor);
|
2018-06-29 20:21:36 +00:00
|
|
|
void AddRainSplashGenerator(CActor& act, CStateManager& mgr, u32 maxSplashes,
|
2018-05-14 04:38:58 +00:00
|
|
|
u32 genRate, float minZ);
|
2018-06-29 20:21:36 +00:00
|
|
|
void RemoveRainSplashGenerator(CActor& act);
|
2018-02-05 06:56:09 +00:00
|
|
|
void Render(const CActor& actor) const;
|
2018-11-06 06:16:12 +00:00
|
|
|
void StartElectric(CActor& act);
|
2018-09-14 00:49:34 +00:00
|
|
|
void StopElectric(CActor& act);
|
2018-12-08 01:49:15 +00:00
|
|
|
void sub_801e51d0(CActor& act);
|
2018-11-06 06:16:12 +00:00
|
|
|
void StopThermalHotParticles(CActor& act);
|
2018-11-08 00:53:38 +00:00
|
|
|
void StartBurnDeath(CActor& act);
|
2018-11-06 06:16:12 +00:00
|
|
|
void EnsureElectricLoaded(CActor& act);
|
|
|
|
void EnsureFirePopLoaded(CActor& act);
|
|
|
|
void EnsureIceBreakLoaded(CActor& act);
|
|
|
|
void LightDudeOnFire(CActor& act);
|
2018-11-08 00:53:38 +00:00
|
|
|
const CTexture* GetAshyTexture(const CActor& act);
|
2016-04-17 02:50:45 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|