Minor CActorParameters cleanup, initial CFlameThrower

This commit is contained in:
Phillip Stephens 2017-05-10 03:03:29 -07:00
parent c70a0d81cb
commit 3c566c2d8c
5 changed files with 39 additions and 17 deletions

View File

@ -7,13 +7,13 @@ namespace urde
{ {
class CFlameInfo class CFlameInfo
{ {
ResId x4_flameFxId; ResId x8_flameFxId;
public: public:
CFlameInfo(s32, u32, s32, s32, float, float, float); CFlameInfo(s32, u32, s32, s32, float, float, float);
void GetAttributes() const; void GetAttributes() const;
void GetLength() const; void GetLength() const;
ResId GetFlameFxId() const { x4_flameFxId; } ResId GetFlameFxId() const { return x8_flameFxId; }
}; };
} }
#endif // __URDE_CFLAMEINFO_HPP__ #endif // __URDE_CFLAMEINFO_HPP__

View File

@ -1,5 +1,9 @@
#include "Weapon/CFlameThrower.hpp" #include "Weapon/CFlameThrower.hpp"
#include "Weapon/CFlameInfo.hpp"
#include "Particle/CElementGen.hpp"
#include "GameGlobalObjects.hpp"
#include "CSimplePool.hpp"
#include "TCastTo.hpp"
namespace urde namespace urde
{ {
const zeus::CVector3f CFlameThrower::kLightOffset(0, 3.f, 2.f); const zeus::CVector3f CFlameThrower::kLightOffset(0, 3.f, 2.f);
@ -9,8 +13,14 @@ CFlameThrower::CFlameThrower(const TToken<CWeaponDescription>& wDesc, const std:
const CDamageInfo& dInfo, TUniqueId owner, TAreaId aId, TUniqueId uid, u32 w1) const CDamageInfo& dInfo, TUniqueId owner, TAreaId aId, TUniqueId uid, u32 w1)
: CGameProjectile(false, wDesc, name, wType, xf, matType, dInfo, owner, aId, uid, kInvalidUniqueId, w1, false, : CGameProjectile(false, wDesc, name, wType, xf, matType, dInfo, owner, aId, uid, kInvalidUniqueId, w1, false,
zeus::CVector3f(1.f), {}, -1, false) zeus::CVector3f(1.f), {}, -1, false)
, x2e8_(xf)
, x33c_flameDesc(g_SimplePool->GetObj({flameInfo.GetFlameFxId(), SBIG('PART')}))
, x348_flameGen(new CElementGen(x33c_flameDesc, CElementGen::EModelOrientationType::Normal,
CElementGen::EOptionalSystemFlags::One))
{ {
} }
void CFlameThrower::Accept(IVisitor& visitor) { visitor.Visit(this); }
void CFlameThrower::SetTransform(const zeus::CTransform& xf) { x2e8_ = xf; } void CFlameThrower::SetTransform(const zeus::CTransform& xf) { x2e8_ = xf; }
} }

View File

@ -6,16 +6,21 @@
namespace urde namespace urde
{ {
class CFlameInfo; class CFlameInfo;
class CElementGen;
class CFlameThrower : public CGameProjectile class CFlameThrower : public CGameProjectile
{ {
static const zeus::CVector3f kLightOffset; static const zeus::CVector3f kLightOffset;
zeus::CTransform x2e8_; zeus::CTransform x2e8_;
zeus::CAABox x318_ = zeus::CAABox::skNullBox;
TToken<CGenDescription> x33c_flameDesc;
std::unique_ptr<CElementGen> x348_flameGen;
public: public:
CFlameThrower(const TToken<CWeaponDescription>& wDesc, const std::string& name, EWeaponType wType, CFlameThrower(const TToken<CWeaponDescription>& wDesc, const std::string& name, EWeaponType wType,
const CFlameInfo& flameInfo, const zeus::CTransform& xf, EMaterialTypes matType, const CFlameInfo& flameInfo, const zeus::CTransform& xf, EMaterialTypes matType,
const CDamageInfo& dInfo, TUniqueId owner, TAreaId aId, TUniqueId uid, u32 w1); const CDamageInfo& dInfo, TUniqueId owner, TAreaId aId, TUniqueId uid, u32 w1);
void Accept(IVisitor &visitor);
void SetTransform(const zeus::CTransform& xf); void SetTransform(const zeus::CTransform& xf);
}; };
} }

View File

@ -16,28 +16,35 @@ class CActorParameters
std::pair<ResId, ResId> x44_xrayAssets = {}; std::pair<ResId, ResId> x44_xrayAssets = {};
std::pair<ResId, ResId> x4c_thermalAssets = {}; std::pair<ResId, ResId> x4c_thermalAssets = {};
CVisorParameters x54_visorParms; CVisorParameters x54_visorParms;
bool b1 : 1; union
bool b2 : 1; {
bool b3 : 1; struct
bool b4 : 1; {
bool x58_24_ : 1;
bool x58_25_thermalHeat : 1;
bool x58_26_ : 1;
bool x58_27_ : 1;
};
u32 _dummy = 0;
};
float x5c_ = 0.f; float x5c_ = 0.f;
float x60_ = 0.f; float x60_ = 0.f;
float x64_ = 0.f; float x64_ = 0.f;
public: public:
CActorParameters() : b1(true), b2(false), b3(false), b4(false) {} CActorParameters() : x58_24_(true), x58_25_thermalHeat(false), x58_26_(false), x58_27_(false) {}
CActorParameters(const CLightParameters& lightParms, const CScannableParameters& scanParms, CActorParameters(const CLightParameters& lightParms, const CScannableParameters& scanParms,
const std::pair<ResId, ResId>& xrayAssets, const std::pair<ResId, ResId>& thermalAssets, const std::pair<ResId, ResId>& xrayAssets, const std::pair<ResId, ResId>& thermalAssets,
const CVisorParameters& visorParms, bool a, bool b, bool c, bool d) const CVisorParameters& visorParms, bool b1, bool thermalHeat, bool c, bool d)
: x0_lightParms(lightParms) : x0_lightParms(lightParms)
, x40_scanParms(scanParms) , x40_scanParms(scanParms)
, x44_xrayAssets(xrayAssets) , x44_xrayAssets(xrayAssets)
, x4c_thermalAssets(thermalAssets) , x4c_thermalAssets(thermalAssets)
, x54_visorParms(visorParms) , x54_visorParms(visorParms)
, b1(a) , x58_24_(b1)
, b2(b) , x58_25_thermalHeat(thermalHeat)
, b3(c) , x58_26_(c)
, b4(d) , x58_27_(d)
{ {
} }
CActorParameters Scannable(const CScannableParameters& sParms) const CActorParameters Scannable(const CScannableParameters& sParms) const

View File

@ -216,9 +216,9 @@ CActorParameters ScriptLoader::LoadActorParameters(CInputStream& in)
if (propCount > 6) if (propCount > 6)
vParms = LoadVisorParameters(in); vParms = LoadVisorParameters(in);
bool b2 = false; bool thermalHeat = false;
if (propCount > 10) if (propCount > 10)
b2 = in.readBool(); thermalHeat = in.readBool();
bool b3 = false; bool b3 = false;
if (propCount > 11) if (propCount > 11)
@ -240,7 +240,7 @@ CActorParameters ScriptLoader::LoadActorParameters(CInputStream& in)
if (g_ResFactory->GetResourceTypeById(infraModel)) if (g_ResFactory->GetResourceTypeById(infraModel))
infra = {infraModel, infraSkin}; infra = {infraModel, infraSkin};
return CActorParameters(lParms, sParams, xray, infra, vParms, b1, b2, b3, b4); return CActorParameters(lParms, sParams, xray, infra, vParms, b1, thermalHeat, b3, b4);
} }
return CActorParameters::None(); return CActorParameters::None();
} }