diff --git a/Runtime/MP1/World/CActorContraption.cpp b/Runtime/MP1/World/CActorContraption.cpp index 41ce52a19..39bbd26d0 100644 --- a/Runtime/MP1/World/CActorContraption.cpp +++ b/Runtime/MP1/World/CActorContraption.cpp @@ -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& uid : x2ec_children) + { + CFlameThrower* act = static_cast(mgr.ObjectById(uid.first)); + + if (act && act->GetActive()) + { + act->SetTransform(act->GetScaledLocatorTransform(uid.second)); + } + } +} } diff --git a/Runtime/MP1/World/CActorContraption.hpp b/Runtime/MP1/World/CActorContraption.hpp index b7a76117e..f95012cc8 100644 --- a/Runtime/MP1/World/CActorContraption.hpp +++ b/Runtime/MP1/World/CActorContraption.hpp @@ -11,15 +11,18 @@ namespace MP1 class CActorContraption : public CScriptActor { /* AKA Why Zoid?!?!?!? */ - - TToken x300_; - CDamageInfo x30c_; + std::vector> x2ec_children; + TToken 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 &); }; } } diff --git a/Runtime/Weapon/CFlameInfo.cpp b/Runtime/Weapon/CFlameInfo.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/Runtime/Weapon/CFlameInfo.hpp b/Runtime/Weapon/CFlameInfo.hpp new file mode 100644 index 000000000..45561ff4a --- /dev/null +++ b/Runtime/Weapon/CFlameInfo.hpp @@ -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__ diff --git a/Runtime/Weapon/CFlameThrower.cpp b/Runtime/Weapon/CFlameThrower.cpp new file mode 100644 index 000000000..493efb38a --- /dev/null +++ b/Runtime/Weapon/CFlameThrower.cpp @@ -0,0 +1,16 @@ +#include "Weapon/CFlameThrower.hpp" + +namespace urde +{ +const zeus::CVector3f CFlameThrower::kLightOffset(0, 3.f, 2.f); + +CFlameThrower::CFlameThrower(const TToken& 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; } +} diff --git a/Runtime/Weapon/CFlameThrower.hpp b/Runtime/Weapon/CFlameThrower.hpp new file mode 100644 index 000000000..81ff49261 --- /dev/null +++ b/Runtime/Weapon/CFlameThrower.hpp @@ -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& 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__ diff --git a/Runtime/Weapon/CMakeLists.txt b/Runtime/Weapon/CMakeLists.txt index 7e9fa28a9..224232902 100644 --- a/Runtime/Weapon/CMakeLists.txt +++ b/Runtime/Weapon/CMakeLists.txt @@ -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)