From e116d887c72665622e2d612061c915141ea1991f Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sat, 23 Jun 2018 16:08:16 -0700 Subject: [PATCH] Implement CSnakeWeedSwarm loader --- Runtime/World/CMakeLists.txt | 2 +- Runtime/World/CSnakeWeedSwarm.cpp | 26 ++++++++++++++++ Runtime/World/CSnakeWeedSwarm.hpp | 7 +++++ Runtime/World/ScriptLoader.cpp | 49 ++++++++++++++++++++++++++++++- 4 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 Runtime/World/CSnakeWeedSwarm.cpp diff --git a/Runtime/World/CMakeLists.txt b/Runtime/World/CMakeLists.txt index dad3f34ff..6fa979e8b 100644 --- a/Runtime/World/CMakeLists.txt +++ b/Runtime/World/CMakeLists.txt @@ -88,7 +88,7 @@ set(WORLD_SOURCES CScriptGunTurret.hpp CScriptGunTurret.cpp CScriptCameraPitchVolume.hpp CScriptCameraPitchVolume.cpp CTeamAiMgr.hpp CTeamAiMgr.cpp - CSnakeWeedSwarm.hpp + CSnakeWeedSwarm.hpp CSnakeWeedSwarm.cpp CScriptSpindleCamera.hpp CScriptSpindleCamera.cpp CScriptCameraHintTrigger.hpp CScriptCameraHintTrigger.cpp CAmbientAI.hpp CAmbientAI.cpp diff --git a/Runtime/World/CSnakeWeedSwarm.cpp b/Runtime/World/CSnakeWeedSwarm.cpp new file mode 100644 index 000000000..8fab461b1 --- /dev/null +++ b/Runtime/World/CSnakeWeedSwarm.cpp @@ -0,0 +1,26 @@ +#include "CSnakeWeedSwarm.hpp" +#include "CAnimationParameters.hpp" +#include "TCastTo.hpp" + +namespace urde +{ + + +CSnakeWeedSwarm::CSnakeWeedSwarm(TUniqueId uid, bool active, std::string_view name, const CEntityInfo& info, + const zeus::CVector3f& pos, const zeus::CVector3f& scale, + const CAnimationParameters& animParms, const CActorParameters& actParms, + float f1, float f2, float f3, float f4, float f5, float f6, float f7, + float f8, float f9, float f10, float f11, float f12, float f13, float f14, + const CDamageInfo&, float /*f15*/, u32 w1, u32 w2, u32 w3, u32 w4, u32 w5, + u32 w6, float f16) +: CActor(uid, active, name, info, zeus::CTransform::Translate(pos), + CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::Trigger, EMaterialTypes::NonSolidDamageable), actParms, kInvalidUniqueId) +{ +} + +void CSnakeWeedSwarm::Accept(urde::IVisitor& visitor) +{ + visitor.Visit(this); +} + +} diff --git a/Runtime/World/CSnakeWeedSwarm.hpp b/Runtime/World/CSnakeWeedSwarm.hpp index 7723938ba..313705c44 100644 --- a/Runtime/World/CSnakeWeedSwarm.hpp +++ b/Runtime/World/CSnakeWeedSwarm.hpp @@ -6,9 +6,16 @@ namespace urde { +class CAnimationParameters; class CSnakeWeedSwarm : public CActor { public: + 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, + float, float, float, float, float, float, float, const CDamageInfo&, float, u32, u32, u32, u32, u32, + u32, float); + + void Accept(IVisitor&); void ApplyRadiusDamage(const zeus::CVector3f& pos, const CDamageInfo& info, CStateManager& stateMgr) {} }; diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index 1d8205835..3578a8172 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -19,6 +19,7 @@ #include "CAmbientAI.hpp" #include "CScriptCameraPitchVolume.hpp" #include "CTeamAiMgr.hpp" +#include "CSnakeWeedSwarm.hpp" #include "CScriptCameraShaker.hpp" #include "CScriptCameraWaypoint.hpp" #include "CScriptColorModulate.hpp" @@ -2468,7 +2469,42 @@ CEntity* ScriptLoader::LoadTeamAIMgr(CStateManager& mgr, CInputStream& in, int p CEntity* ScriptLoader::LoadSnakeWeedSwarm(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { - return nullptr; + if (!EnsurePropertyCount(propCount, 25, "SnakeWeedSwarm") || propCount > 29) + return nullptr; + + std::string name = mgr.HashInstanceName(in); + zeus::CVector3f pos = zeus::CVector3f::ReadBig(in); + zeus::CVector3f scale = zeus::CVector3f::ReadBig(in); + bool active = in.readBool(); + CAnimationParameters animParms = LoadAnimationParameters(in); + CActorParameters actParms = LoadActorParameters(in); + float f1 = in.readFloatBig(); + float f2 = in.readFloatBig(); + float f3 = in.readFloatBig(); + float f4 = in.readFloatBig(); + float f5 = in.readFloatBig(); + float f6 = in.readFloatBig(); + float f7 = in.readFloatBig(); + float f8 = in.readFloatBig(); + float f9 = in.readFloatBig(); + float f10 = in.readFloatBig(); + float f11 = in.readFloatBig(); + float f12 = in.readFloatBig(); + float f13 = in.readFloatBig(); + float f14 = in.readFloatBig(); + CDamageInfo dInfo(in); + float f15 = in.readFloatBig(); + u32 w4 = in.readUint32Big(); + u32 w5 = in.readUint32Big(); + u32 w6 = in.readUint32Big(); + u32 w7 = (propCount < 29 ? -1 : in.readUint32Big()); + u32 w8 = (propCount < 29 ? -1 : in.readUint32Big()); + u32 w9 = (propCount < 29 ? -1 : in.readUint32Big()); + u32 f16 = (propCount < 29 ? 0.f : in.readFloatBig()); + + return new CSnakeWeedSwarm(mgr.AllocateUniqueId(), active, name, info, pos, scale, animParms, + actParms, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, + f14, dInfo, f15, w4, w5, w6, w7, w8, w9, f16); } CEntity* ScriptLoader::LoadActorContraption(CStateManager& mgr, CInputStream& in, int propCount, @@ -2515,6 +2551,17 @@ CEntity* ScriptLoader::LoadOculus(CStateManager& mgr, CInputStream& in, int prop CEntity* ScriptLoader::LoadGeemer(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { + if (!EnsurePropertyCount(propCount, 16, "Geemer")) + return nullptr; + SScaledActorHead actHead = LoadScaledActorHead(in, mgr); + + auto pair = CPatternedInfo::HasCorrectParameterCount(in); + if (!pair.first) + return nullptr; + + CPatternedInfo pInfo(in, pair.second); + CActorParameters actParms = LoadActorParameters(in); + return nullptr; }