This commit is contained in:
Jack Andersen 2017-05-09 09:44:19 -10:00
commit e798fe49b4
7 changed files with 89 additions and 5 deletions

View File

@ -1,4 +1,8 @@
#include "MP1/World/CActorContraption.hpp"
#include "Weapon/CFlameThrower.hpp"
#include "GameGlobalObjects.hpp"
#include "CSimplePool.hpp"
#include "CStateManager.hpp"
#include "TCastTo.hpp"
namespace urde
@ -10,7 +14,10 @@ MP1::CActorContraption::CActorContraption(TUniqueId uid, const std::string& name
const CDamageVulnerability& dVuln, const CActorParameters& aParams,
ResId part, const CDamageInfo& dInfo, bool active)
: CScriptActor(uid, name, info, xf, std::move(mData), aabox, f1, f2, matList, hInfo, dVuln, aParams, false, active, 0,
0.f, false, false, false, false)
1.f, false, false, false, false)
, x300_flameThrowerGen(g_SimplePool->GetObj("FlameThrower"))
, x308_partId(part)
, x30c_dInfo(dInfo)
{
}
@ -18,4 +25,19 @@ void MP1::CActorContraption::Accept(IVisitor& visitor)
{
visitor.Visit(this);
}
void MP1::CActorContraption::Think(float dt, CStateManager& mgr)
{
CScriptActor::Think(dt, mgr);
for (const std::pair<TUniqueId, std::string>& uid : x2ec_children)
{
CFlameThrower* act = static_cast<CFlameThrower*>(mgr.ObjectById(uid.first));
if (act && act->GetActive())
{
act->SetTransform(act->GetScaledLocatorTransform(uid.second));
}
}
}
}

View File

@ -11,15 +11,18 @@ namespace MP1
class CActorContraption : public CScriptActor
{
/* AKA Why Zoid?!?!?!? */
TToken<CGenDescription> x300_;
CDamageInfo x30c_;
std::vector<std::pair<TUniqueId, std::string>> x2ec_children;
TToken<CGenDescription> x300_flameThrowerGen;
ResId x308_partId;
CDamageInfo x30c_dInfo;
public:
CActorContraption(TUniqueId, const std::string&, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
const zeus::CAABox&, const CMaterialList&, float, float, const CHealthInfo&,
const CDamageVulnerability&, const CActorParameters&, ResId, const CDamageInfo&, bool);
void Accept(IVisitor &visitor);
void Think(float, CStateManager &);
};
}
}

View File

View File

@ -0,0 +1,19 @@
#ifndef __URDE_CFLAMEINFO_HPP__
#define __URDE_CFLAMEINFO_HPP__
#include "Weapon/CGameProjectile.hpp"
namespace urde
{
class CFlameInfo
{
ResId x4_flameFxId;
public:
CFlameInfo(s32, u32, s32, s32, float, float, float);
void GetAttributes() const;
void GetLength() const;
ResId GetFlameFxId() const { x4_flameFxId; }
};
}
#endif // __URDE_CFLAMEINFO_HPP__

View File

@ -0,0 +1,16 @@
#include "Weapon/CFlameThrower.hpp"
namespace urde
{
const zeus::CVector3f CFlameThrower::kLightOffset(0, 3.f, 2.f);
CFlameThrower::CFlameThrower(const TToken<CWeaponDescription>& wDesc, const std::string& name, EWeaponType wType,
const CFlameInfo& flameInfo, const zeus::CTransform& xf, EMaterialTypes matType,
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,
zeus::CVector3f(1.f), {}, -1, false)
{
}
void CFlameThrower::SetTransform(const zeus::CTransform& xf) { x2e8_ = xf; }
}

View File

@ -0,0 +1,22 @@
#ifndef __URDE_CFLAMETHROWER_HPP__
#define __URDE_CFLAMETHROWER_HPP__
#include "Weapon/CGameProjectile.hpp"
namespace urde
{
class CFlameInfo;
class CFlameThrower : public CGameProjectile
{
static const zeus::CVector3f kLightOffset;
zeus::CTransform x2e8_;
public:
CFlameThrower(const TToken<CWeaponDescription>& wDesc, const std::string& name, EWeaponType wType,
const CFlameInfo& flameInfo, const zeus::CTransform& xf, EMaterialTypes matType,
const CDamageInfo& dInfo, TUniqueId owner, TAreaId aId, TUniqueId uid, u32 w1);
void SetTransform(const zeus::CTransform& xf);
};
}
#endif // __URDE_CFLAMETHROWER_HPP__

View File

@ -25,6 +25,8 @@ set(WEAPON_SOURCES
CEnergyProjectile.cpp CEnergyProjectile.cpp
CProjectileWeapon.hpp CProjectileWeapon.cpp
CBomb.hpp CBomb.cpp
CPowerBomb.hpp CPowerBomb.cpp)
CPowerBomb.hpp CPowerBomb.cpp
CFlameInfo.hpp CFlameInfo.cpp
CFlameThrower.hpp CFlameThrower.cpp)
runtime_add_list(Weapon WEAPON_SOURCES)