Start implementing CSnakeWeedSwarm

This commit is contained in:
Luke Street 2020-02-20 23:27:12 -05:00
parent a978b030c3
commit f1dd82066a
3 changed files with 111 additions and 19 deletions

View File

@ -1,19 +1,66 @@
#include "Runtime/World/CSnakeWeedSwarm.hpp" #include "Runtime/World/CSnakeWeedSwarm.hpp"
#include "Runtime/CSimplePool.hpp"
#include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/World/CActorParameters.hpp"
#include "Runtime/World/CAnimationParameters.hpp" #include "Runtime/World/CAnimationParameters.hpp"
#include "TCastTo.hpp" // Generated file, do not modify include path #include "TCastTo.hpp" // Generated file, do not modify include path
namespace urde { namespace urde {
CSnakeWeedSwarm::CSnakeWeedSwarm(TUniqueId uid, bool active, std::string_view name, const CEntityInfo& info, CSnakeWeedSwarm::CSnakeWeedSwarm(TUniqueId uid, bool active, std::string_view name, const CEntityInfo& info,
const zeus::CVector3f& pos, const zeus::CVector3f& scale, const zeus::CVector3f& pos, const zeus::CVector3f& scale, const CAnimRes& animRes,
const CAnimationParameters& animParms, const CActorParameters& actParms, float f1, const CActorParameters& actParms, float f1, float f2, float f3, float f4, float f5,
float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9, float f6, float f7, float f8, float f9, float f10, float f11, float f12, float f13,
float f10, float f11, float f12, float f13, float f14, const CDamageInfo&, float f14, const CDamageInfo& dInfo, float /*f15*/, u32 sfxId1, u32 sfxId2, u32 sfxId3,
float /*f15*/, u32 w1, u32 w2, u32 w3, u32 w4, u32 w5, u32 w6, float f16) CAssetId w4, u32 w5, CAssetId w6, float f16)
: CActor(uid, active, name, info, zeus::CTransform::Translate(pos), CModelData::CModelDataNull(), : CActor(uid, active, name, info, zeus::CTransform::Translate(pos), CModelData::CModelDataNull(),
CMaterialList(EMaterialTypes::Trigger, EMaterialTypes::NonSolidDamageable), actParms, kInvalidUniqueId) {} CMaterialList(EMaterialTypes::Trigger, EMaterialTypes::NonSolidDamageable), actParms, kInvalidUniqueId)
, xe8_scale(scale)
, xf4_(f1)
, xf8_(f2)
, xfc_(f3)
, x100_(f4)
, x104_(f5)
, x108_(f6)
, x10c_(f7)
, x110_(f8)
, x114_(f9)
, x118_(f10)
, x11c_(std::cos(zeus::degToRad(f11)))
, x120_(f12)
, x124_(f13)
, x128_(f14)
, x15c_dInfo(dInfo)
, x1d0_sfx1(CSfxManager::TranslateSFXID(sfxId1))
, x1d2_sfx2(CSfxManager::TranslateSFXID(sfxId2))
, x1d4_sfx3(CSfxManager::TranslateSFXID(sfxId3))
, x1fc_(w5)
, x200_(f16) {
SetActorLights(actParms.GetLightParameters().MakeActorLights());
x1b4_modelData.emplace_back(std::make_unique<CModelData>(animRes));
x1b4_modelData.emplace_back(std::make_unique<CModelData>(animRes));
x1b4_modelData.emplace_back(std::make_unique<CModelData>(animRes));
x1b4_modelData.emplace_back(std::make_unique<CModelData>(animRes));
if (actParms.GetXRayAssets().first.IsValid()) {
for (int i = 0; i < 4; ++i)
x1b4_modelData[i]->SetXRayModel(actParms.GetXRayAssets());
x13c_xbf_modelAssetDirty = true;
}
if (actParms.GetThermalAssets().first.IsValid()) {
for (int i = 0; i < 4; ++i)
x1b4_modelData[i]->SetInfraModel(actParms.GetThermalAssets());
x13c_xbf_modelAssetDirty = true;
}
if (w4.IsValid()) {
x1dc_ = g_SimplePool->GetObj({FOURCC('PART'), w4});
x1ec_ = std::make_unique<CElementGen>(x1dc_);
}
if (w6.IsValid()) {
x1dc_ = g_SimplePool->GetObj({FOURCC('PART'), w6});
x1f4_ = std::make_unique<CElementGen>(x1dc_);
}
}
void CSnakeWeedSwarm::Accept(urde::IVisitor& visitor) { visitor.Visit(this); } void CSnakeWeedSwarm::Accept(urde::IVisitor& visitor) { visitor.Visit(this); }

View File

@ -1,19 +1,62 @@
#pragma once #pragma once
#include "Runtime/Collision/CCollisionSurface.hpp" #include "Runtime/Collision/CCollisionSurface.hpp"
#include "Runtime/Particle/CElementGen.hpp"
#include "Runtime/World/CActor.hpp" #include "Runtime/World/CActor.hpp"
#include "Runtime/World/CDamageInfo.hpp"
namespace urde { namespace urde {
class CAnimationParameters; class CAnimationParameters;
class CSnakeWeedSwarm : public CActor { class CSnakeWeedSwarm : public CActor {
zeus::CVector3f xe8_scale;
float xf4_;
float xf8_;
float xfc_;
float x100_;
float x104_;
float x108_;
float x10c_;
float x110_;
float x114_;
float x118_;
float x11c_;
float x120_;
float x124_;
float x128_;
u32 x12c_ = 0;
// x130_
u32 x134_ = 0;
u32 x138_ = 0;
u32 x13c_ = 0;
bool x13c_xbf_modelAssetDirty : 1;
zeus::CAABox x144_ = zeus::skInvertedBox;
CDamageInfo x15c_dInfo;
// x178_ = 0
// x19c_ = 0
rstl::reserved_vector<std::shared_ptr<CModelData>, 4> x1b4_modelData;
// x1c8_ = ptr to 0x10 sz?
// x1cc_ = ptr to 0x10 sz?
u16 x1d0_sfx1;
u16 x1d2_sfx2;
u16 x1d4_sfx3;
u32 x1d8_ = 0;
TLockedToken<CGenDescription> x1dc_;
// TLockedToken<CGenDescription> x1e4_; both assign to x1dc_?
std::unique_ptr<CElementGen> x1ec_;
std::unique_ptr<CElementGen> x1f4_;
u32 x1fc_;
float x200_;
float x204_ = 0.f;
public: public:
CSnakeWeedSwarm(TUniqueId, bool, std::string_view, const CEntityInfo&, const zeus::CVector3f&, const zeus::CVector3f&, CSnakeWeedSwarm(TUniqueId, bool, std::string_view, const CEntityInfo&, const zeus::CVector3f&, const zeus::CVector3f&,
const CAnimationParameters&, const CActorParameters&, float, float, float, float, float, float, float, const CAnimRes&, const CActorParameters&, float, float, float, float, float, float, float, float,
float, float, float, float, float, float, float, const CDamageInfo&, float, u32, u32, u32, u32, u32, float, float, float, float, float, float, const CDamageInfo&, float, u32, u32, u32, CAssetId, u32,
u32, float); CAssetId, float);
void Accept(IVisitor&) override; void Accept(IVisitor&) override;
void ApplyRadiusDamage(const zeus::CVector3f& pos, const CDamageInfo& info, CStateManager& stateMgr) {} void ApplyRadiusDamage(const zeus::CVector3f& pos, const CDamageInfo& info, CStateManager& stateMgr) {}
std::optional<zeus::CAABox> GetTouchBounds() const override { /* FIXME check flags */ return x144_; }
}; };
} // namespace urde } // namespace urde

View File

@ -3026,16 +3026,18 @@ CEntity* ScriptLoader::LoadSnakeWeedSwarm(CStateManager& mgr, CInputStream& in,
float f14 = in.readFloatBig(); float f14 = in.readFloatBig();
CDamageInfo dInfo(in); CDamageInfo dInfo(in);
float f15 = in.readFloatBig(); float f15 = in.readFloatBig();
u32 w4 = in.readUint32Big(); u32 w1 = in.readUint32Big();
u32 w5 = in.readUint32Big(); u32 w2 = in.readUint32Big();
u32 w6 = in.readUint32Big(); u32 w3 = in.readUint32Big();
u32 w7 = (propCount < 29 ? -1 : in.readUint32Big()); CAssetId w4 = (propCount < 29 ? -1 : in.readUint32Big());
u32 w8 = (propCount < 29 ? -1 : in.readUint32Big()); u32 w5 = (propCount < 29 ? -1 : in.readUint32Big());
u32 w9 = (propCount < 29 ? -1 : in.readUint32Big()); CAssetId w6 = (propCount < 29 ? -1 : in.readUint32Big());
u32 f16 = (propCount < 29 ? 0.f : in.readFloatBig()); float f16 = (propCount < 29 ? 0.f : in.readFloatBig());
return new CSnakeWeedSwarm(mgr.AllocateUniqueId(), active, name, info, pos, scale, animParms, actParms, f1, f2, f3, CAnimRes animRes(animParms.GetACSFile(), animParms.GetCharacter(), zeus::skOne3f, animParms.GetInitialAnimation(),
f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, dInfo, f15, w4, w5, w6, w7, w8, w9, f16); true);
return new CSnakeWeedSwarm(mgr.AllocateUniqueId(), active, name, info, pos, scale, animRes, actParms, f1, f2, f3, f4,
f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, dInfo, f15, w1, w2, w3, w4, w5, w6, f16);
} }
CEntity* ScriptLoader::LoadActorContraption(CStateManager& mgr, CInputStream& in, int propCount, CEntity* ScriptLoader::LoadActorContraption(CStateManager& mgr, CInputStream& in, int propCount,