From 0f6d1645ba67c330fb7cb64c22d533e061fd7810 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Wed, 20 Apr 2016 11:44:18 -1000 Subject: [PATCH] More script loaders --- Editor/ProjectResourceFactoryMP1.cpp | 2 + Runtime/Collision/CCollidableOBBTreeGroup.cpp | 17 ++ Runtime/Collision/CCollidableOBBTreeGroup.hpp | 8 + Runtime/World/CActor.cpp | 4 +- Runtime/World/CEntity.cpp | 11 +- Runtime/World/CEntity.hpp | 45 +++-- Runtime/World/CMakeLists.txt | 4 + Runtime/World/CScriptCounter.cpp | 2 +- Runtime/World/CScriptEffect.cpp | 19 +++ Runtime/World/CScriptEffect.hpp | 21 +++ Runtime/World/CScriptGenerator.cpp | 12 ++ Runtime/World/CScriptGenerator.hpp | 20 +++ Runtime/World/CScriptPlatform.cpp | 28 ++++ Runtime/World/CScriptPlatform.hpp | 24 +++ Runtime/World/CScriptSound.cpp | 17 ++ Runtime/World/CScriptSound.hpp | 19 +++ Runtime/World/CScriptTimer.cpp | 2 +- Runtime/World/CScriptWaypoint.cpp | 2 +- Runtime/World/ScriptLoader.cpp | 156 ++++++++++++++++++ 19 files changed, 388 insertions(+), 25 deletions(-) create mode 100644 Runtime/World/CScriptEffect.cpp create mode 100644 Runtime/World/CScriptEffect.hpp create mode 100644 Runtime/World/CScriptGenerator.cpp create mode 100644 Runtime/World/CScriptGenerator.hpp create mode 100644 Runtime/World/CScriptPlatform.cpp create mode 100644 Runtime/World/CScriptPlatform.hpp create mode 100644 Runtime/World/CScriptSound.cpp create mode 100644 Runtime/World/CScriptSound.hpp diff --git a/Editor/ProjectResourceFactoryMP1.cpp b/Editor/ProjectResourceFactoryMP1.cpp index 8c53e8db0..1339549ab 100644 --- a/Editor/ProjectResourceFactoryMP1.cpp +++ b/Editor/ProjectResourceFactoryMP1.cpp @@ -14,6 +14,7 @@ #include "Runtime/Character/CAnimCharacterSet.hpp" #include "Runtime/Character/CAllFormatsAnimSource.hpp" #include "Runtime/Character/CAnimPOIData.hpp" +#include "Runtime/Collision/CCollidableOBBTreeGroup.hpp" #include "Runtime/CDependencyGroup.hpp" #include "DataSpec/DNACommon/TXTR.hpp" @@ -39,6 +40,7 @@ ProjectResourceFactoryMP1::ProjectResourceFactoryMP1(hecl::ClientProcess& client m_factoryMgr.AddFactory(FOURCC('ANCS'), FFactoryFunc(FAnimCharacterSet)); m_factoryMgr.AddFactory(FOURCC('ANIM'), FFactoryFunc(AnimSourceFactory)); m_factoryMgr.AddFactory(FOURCC('EVNT'), FFactoryFunc(AnimPOIDataFactory)); + m_factoryMgr.AddFactory(FOURCC('DCLN'), FFactoryFunc(FCollidableOBBTreeGroupFactory)); m_factoryMgr.AddFactory(FOURCC('DGRP'), FFactoryFunc(FDependencyGroupFactory)); } diff --git a/Runtime/Collision/CCollidableOBBTreeGroup.cpp b/Runtime/Collision/CCollidableOBBTreeGroup.cpp index e69de29bb..f272e9a22 100644 --- a/Runtime/Collision/CCollidableOBBTreeGroup.cpp +++ b/Runtime/Collision/CCollidableOBBTreeGroup.cpp @@ -0,0 +1,17 @@ +#include "CCollidableOBBTreeGroup.hpp" +#include "CToken.hpp" + +namespace urde +{ + +CCollidableOBBTreeGroup::CCollidableOBBTreeGroup(CInputStream& in) +{ +} + +CFactoryFnReturn FCollidableOBBTreeGroupFactory(const SObjectTag &tag, CInputStream &in, + const CVParamTransfer &vparms) +{ + return TToken::GetIObjObjectFor(std::make_unique(in)); +} + +} diff --git a/Runtime/Collision/CCollidableOBBTreeGroup.hpp b/Runtime/Collision/CCollidableOBBTreeGroup.hpp index 19f39060d..26346be73 100644 --- a/Runtime/Collision/CCollidableOBBTreeGroup.hpp +++ b/Runtime/Collision/CCollidableOBBTreeGroup.hpp @@ -1,13 +1,21 @@ #ifndef __URDE_CCOLLIDABLEOBBTREEGROUP_HPP__ #define __URDE_CCOLLIDABLEOBBTREEGROUP_HPP__ +#include "IOStreams.hpp" +#include "CFactoryMgr.hpp" + namespace urde { class CCollidableOBBTreeGroup { +public: + CCollidableOBBTreeGroup(CInputStream& in); }; +CFactoryFnReturn FCollidableOBBTreeGroupFactory(const SObjectTag &tag, CInputStream &in, + const CVParamTransfer &vparms); + } #endif // __URDE_CCOLLIDABLEOBBTREEGROUP_HPP__ diff --git a/Runtime/World/CActor.cpp b/Runtime/World/CActor.cpp index c9d0d6fe1..07005e9a4 100644 --- a/Runtime/World/CActor.cpp +++ b/Runtime/World/CActor.cpp @@ -3,10 +3,10 @@ namespace urde { -CActor::CActor(TUniqueId uid, bool active, const std::string&, const CEntityInfo& info, +CActor::CActor(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info, const zeus::CTransform&, const CModelData&, const CMaterialList&, const CActorParameters&, TUniqueId) -: CEntity(uid, info, active) +: CEntity(uid, info, active, name) { } diff --git a/Runtime/World/CEntity.cpp b/Runtime/World/CEntity.cpp index 72a010e0d..6d815f25c 100644 --- a/Runtime/World/CEntity.cpp +++ b/Runtime/World/CEntity.cpp @@ -4,8 +4,9 @@ namespace urde { -CEntity::CEntity(TUniqueId uniqueId, const CEntityInfo& info, bool active) -: m_uid(uniqueId), m_info(info), m_active(active) {} +CEntity::CEntity(TUniqueId uniqueId, const CEntityInfo& info, bool active, const std::string& name) +: x4_areaId(info.x0_areaId), x8_uid(uniqueId), xc_savwId(info.x14_savwId), x10_name(name), + x20_conns(info.x4_conns), x30_24_active(active) {} void CEntity::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr) { @@ -43,9 +44,9 @@ void CEntity::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateM void CEntity::SendScriptMsgs(EScriptObjectState state, CStateManager& stateMgr, EScriptObjectMessage skipMsg) { - for (const SConnection& conn : m_info.m_conns) - if (conn.state == state && conn.msg != skipMsg) - stateMgr.SendScriptMsg(m_uid, conn.objId, conn.msg, state); + for (const SConnection& conn : x20_conns) + if (conn.x0_state == state && conn.x4_msg != skipMsg) + stateMgr.SendScriptMsg(x8_uid, conn.x8_objId, conn.x4_msg, state); } } diff --git a/Runtime/World/CEntity.hpp b/Runtime/World/CEntity.hpp index 07335dbfc..65d2a7e14 100644 --- a/Runtime/World/CEntity.hpp +++ b/Runtime/World/CEntity.hpp @@ -11,39 +11,54 @@ class IVisitor; struct SConnection { - EScriptObjectState state; - EScriptObjectMessage msg; - TEditorId objId; + EScriptObjectState x0_state; + EScriptObjectMessage x4_msg; + TEditorId x8_objId; }; class CEntityInfo { friend class CEntity; - TAreaId m_aid; - std::vector m_conns; + TAreaId x0_areaId; + std::vector x4_conns; + ResId x14_savwId; public: - CEntityInfo(TAreaId aid, const std::vector& conns) - : m_aid(aid), m_conns(conns) {} - TAreaId GetAreaId() const {return m_aid;} + CEntityInfo(TAreaId aid, const std::vector& conns, ResId savwId=-1) + : x0_areaId(aid), x4_conns(conns) {} + TAreaId GetAreaId() const {return x0_areaId;} }; class CEntity { protected: - TUniqueId m_uid; - CEntityInfo m_info; - bool m_active = false; + TAreaId x4_areaId; + TUniqueId x8_uid; + ResId xc_savwId; + std::string x10_name; + std::vector x20_conns; + + union + { + struct + { + bool x30_24_active : 1; + bool x30_25_ : 1; + bool x30_26_ : 1; + }; + u8 _dummy = 0; + }; + public: virtual ~CEntity() {} - CEntity(TUniqueId uid, const CEntityInfo& info, bool active); + CEntity(TUniqueId uid, const CEntityInfo& info, bool active, const std::string& name); virtual void Accept(IVisitor&)=0; virtual void PreThink(float, CStateManager&) {} virtual void Think(float, CStateManager&) {} virtual void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr); - virtual bool GetActive() const {return m_active;} - virtual void SetActive(bool active) {m_active = active;} + virtual bool GetActive() const {return x30_24_active;} + virtual void SetActive(bool active) {x30_24_active = active;} - TUniqueId GetUniqueId() const {return m_uid;} + TUniqueId GetUniqueId() const {return x8_uid;} void SendScriptMsgs(EScriptObjectState state, CStateManager& stateMgr, EScriptObjectMessage msg); }; diff --git a/Runtime/World/CMakeLists.txt b/Runtime/World/CMakeLists.txt index 91e09aca6..72efb5ced 100644 --- a/Runtime/World/CMakeLists.txt +++ b/Runtime/World/CMakeLists.txt @@ -21,6 +21,10 @@ add_library(RuntimeCommonWorld CScriptTrigger.hpp CScriptTrigger.cpp CScriptTimer.hpp CScriptTimer.cpp CScriptCounter.hpp CScriptCounter.cpp + CScriptEffect.hpp CScriptEffect.cpp + CScriptPlatform.hpp CScriptPlatform.cpp + CScriptSound.hpp CScriptSound.cpp + CScriptGenerator.hpp CScriptGenerator.cpp CGrappleParameters.hpp CActorParameters.hpp CLightParameters.hpp diff --git a/Runtime/World/CScriptCounter.cpp b/Runtime/World/CScriptCounter.cpp index 21241cde2..d56e58326 100644 --- a/Runtime/World/CScriptCounter.cpp +++ b/Runtime/World/CScriptCounter.cpp @@ -5,7 +5,7 @@ namespace urde CScriptCounter::CScriptCounter(TUniqueId uid, const std::string& name, const CEntityInfo& info, u32, u32, bool, bool active) -: CEntity(uid, info, active) +: CEntity(uid, info, active, name) { } diff --git a/Runtime/World/CScriptEffect.cpp b/Runtime/World/CScriptEffect.cpp new file mode 100644 index 000000000..b430eb8b3 --- /dev/null +++ b/Runtime/World/CScriptEffect.cpp @@ -0,0 +1,19 @@ +#include "CScriptEffect.hpp" +#include "Character/CModelData.hpp" +#include "Collision/CMaterialList.hpp" +#include "CActorParameters.hpp" + +namespace urde +{ + +CScriptEffect::CScriptEffect(TUniqueId uid, const std::string& name, const CEntityInfo& info, + const zeus::CTransform& xf, const zeus::CVector3f& scale, + ResId partId, ResId elscId, bool, bool, bool, bool active, + bool, float, float, float, float, bool, float, float, float, + bool, bool, bool, const CLightParameters& lParms, bool) +: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(0), + CActorParameters::None(), kInvalidUniqueId) +{ +} + +} diff --git a/Runtime/World/CScriptEffect.hpp b/Runtime/World/CScriptEffect.hpp new file mode 100644 index 000000000..7feb70e8e --- /dev/null +++ b/Runtime/World/CScriptEffect.hpp @@ -0,0 +1,21 @@ +#ifndef __URDE_CSCRIPEFFECT_HPP__ +#define __URDE_CSCRIPEFFECT_HPP__ + +#include "CActor.hpp" + +namespace urde +{ + +class CScriptEffect : public CActor +{ +public: + CScriptEffect(TUniqueId, const std::string& name, const CEntityInfo& info, + const zeus::CTransform& xf, const zeus::CVector3f& scale, + ResId partId, ResId elscId, bool, bool, bool, bool active, + bool, float, float, float, float, bool, float, float, float, + bool, bool, bool, const CLightParameters& lParms, bool); +}; + +} + +#endif // __URDE_CSCRIPEFFECT_HPP__ diff --git a/Runtime/World/CScriptGenerator.cpp b/Runtime/World/CScriptGenerator.cpp new file mode 100644 index 000000000..f7e45be98 --- /dev/null +++ b/Runtime/World/CScriptGenerator.cpp @@ -0,0 +1,12 @@ +#include "CScriptGenerator.hpp" + +namespace urde +{ + +CScriptGenerator::CScriptGenerator(TUniqueId uid, const std::string& name, const CEntityInfo& info, + u32, bool, const zeus::CVector3f&, bool, bool active, float, float) +: CEntity(uid, info, active, name) +{ +} + +} diff --git a/Runtime/World/CScriptGenerator.hpp b/Runtime/World/CScriptGenerator.hpp new file mode 100644 index 000000000..255baeb80 --- /dev/null +++ b/Runtime/World/CScriptGenerator.hpp @@ -0,0 +1,20 @@ +#ifndef __URDE_CSCRIPTGENERATOR_HPP__ +#define __URDE_CSCRIPTGENERATOR_HPP__ + +#include "CEntity.hpp" +#include "zeus/CVector3f.hpp" + +namespace urde +{ + +class CScriptGenerator : public CEntity +{ +public: + CScriptGenerator(TUniqueId uid, const std::string& name, const CEntityInfo& info, + u32, bool, const zeus::CVector3f&, bool, bool, float, float); + virtual void Accept(IVisitor&); +}; + +} + +#endif // __URDE_CSCRIPTGENERATOR_HPP__ diff --git a/Runtime/World/CScriptPlatform.cpp b/Runtime/World/CScriptPlatform.cpp new file mode 100644 index 000000000..3b260711d --- /dev/null +++ b/Runtime/World/CScriptPlatform.cpp @@ -0,0 +1,28 @@ +#include "CScriptPlatform.hpp" +#include "Collision/CMaterialList.hpp" + +namespace urde +{ + +static CMaterialList MakePlatformMaterialList() +{ + CMaterialList ret; + ret.x0_ |= 1ull << 19; + ret.x0_ |= 1ull << 43; + ret.x0_ |= 1ull << 49; + ret.x0_ |= 1ull << 42; + return ret; +} + +CScriptPlatform::CScriptPlatform(TUniqueId uid, const std::string& name, const CEntityInfo& info, + const zeus::CTransform& xf, const CModelData& mData, + const CActorParameters& actParms, const zeus::CAABox& aabb, + float, bool, float, bool active, const CHealthInfo& hInfo, + const CDamageVulnerability& dInfo, const TLockedToken& dcln, + bool, u32, u32) +: CPhysicsActor(uid, active, name, info, xf, mData, MakePlatformMaterialList(), + aabb, SMoverData(15000.f), actParms, 0.3f, 0.1f) +{ +} + +} diff --git a/Runtime/World/CScriptPlatform.hpp b/Runtime/World/CScriptPlatform.hpp new file mode 100644 index 000000000..d6782e42e --- /dev/null +++ b/Runtime/World/CScriptPlatform.hpp @@ -0,0 +1,24 @@ +#ifndef __URDE_CSCRIPTPLATFORM_HPP__ +#define __URDE_CSCRIPTPLATFORM_HPP__ + +#include "CPhysicsActor.hpp" +#include "optional.hpp" +#include "CToken.hpp" + +namespace urde +{ +class CCollidableOBBTreeGroup; + +class CScriptPlatform : public CPhysicsActor +{ +public: + CScriptPlatform(TUniqueId, const std::string& name, const CEntityInfo& info, + const zeus::CTransform& xf, const CModelData& mData, + const CActorParameters& actParms, const zeus::CAABox& aabb, + float, bool, float, bool, const CHealthInfo& hInfo, const CDamageVulnerability& dInfo, + const TLockedToken& dcln, bool, u32, u32); +}; + +} + +#endif // __URDE_CSCRIPTPLATFORM_HPP__ diff --git a/Runtime/World/CScriptSound.cpp b/Runtime/World/CScriptSound.cpp new file mode 100644 index 000000000..584134b7e --- /dev/null +++ b/Runtime/World/CScriptSound.cpp @@ -0,0 +1,17 @@ +#include "CScriptSound.hpp" +#include "Character/CModelData.hpp" +#include "Collision/CMaterialList.hpp" +#include "CActorParameters.hpp" + +namespace urde +{ + +CScriptSound::CScriptSound(TUniqueId uid, const std::string& name, const CEntityInfo& info, + const zeus::CTransform& xf, s16 soundId, bool active, float, float, float, + u32, u32, u32, u32, u32, bool, bool, bool, bool, bool, bool, bool, bool, u32) +: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), + CMaterialList(0), CActorParameters::None(), kInvalidUniqueId) +{ +} + +} diff --git a/Runtime/World/CScriptSound.hpp b/Runtime/World/CScriptSound.hpp new file mode 100644 index 000000000..c084b1d17 --- /dev/null +++ b/Runtime/World/CScriptSound.hpp @@ -0,0 +1,19 @@ +#ifndef __URDE_CSCRIPTSOUND_HPP__ +#define __URDE_CSCRIPTSOUND_HPP__ + +#include "CActor.hpp" + +namespace urde +{ + +class CScriptSound : public CActor +{ +public: + CScriptSound(TUniqueId, const std::string& name, const CEntityInfo& info, + const zeus::CTransform& xf, s16 soundId, bool, float, float, float, + u32, u32, u32, u32, u32, bool, bool, bool, bool, bool, bool, bool, bool, u32); +}; + +} + +#endif // __URDE_CSCRIPTSOUND_HPP__ diff --git a/Runtime/World/CScriptTimer.cpp b/Runtime/World/CScriptTimer.cpp index f00ffce16..48ce4e0c2 100644 --- a/Runtime/World/CScriptTimer.cpp +++ b/Runtime/World/CScriptTimer.cpp @@ -5,7 +5,7 @@ namespace urde CScriptTimer::CScriptTimer(TUniqueId uid, const std::string& name, const CEntityInfo& info, float, float, bool, bool, bool active) -: CEntity(uid, info, active) +: CEntity(uid, info, active, name) { } diff --git a/Runtime/World/CScriptWaypoint.cpp b/Runtime/World/CScriptWaypoint.cpp index 12d078c6e..215dcdae2 100644 --- a/Runtime/World/CScriptWaypoint.cpp +++ b/Runtime/World/CScriptWaypoint.cpp @@ -9,7 +9,7 @@ namespace urde CScriptWaypoint::CScriptWaypoint(TUniqueId uid, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf, bool active, float, float, u32, u32, u32, u32, u32, u32, u32) -: CActor(uid, active, name, info, xf, CModelData(), CMaterialList(1), +: CActor(uid, active, name, info, xf, CModelData(), CMaterialList(0), CActorParameters::None(), kInvalidUniqueId) { } diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index 160b8e5eb..e531087da 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -19,7 +19,12 @@ #include "CScriptTimer.hpp" #include "CScriptCounter.hpp" #include "CScriptWater.hpp" +#include "CScriptEffect.hpp" +#include "CScriptPlatform.hpp" +#include "CScriptSound.hpp" +#include "CScriptGenerator.hpp" #include "CSimplePool.hpp" +#include "Collision/CCollidableOBBTreeGroup.hpp" #include "Editor/ProjectResourceFactoryMP1.hpp" #include "logvisor/logvisor.hpp" @@ -534,21 +539,172 @@ CEntity* ScriptLoader::LoadCounter(CStateManager& mgr, CInputStream& in, CEntity* ScriptLoader::LoadEffect(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { + if (!EnsurePropertyCount(propCount, 24, "Effect")) + return nullptr; + + SScaledActorHead head = LoadScaledActorHead(in, mgr); + + ResId partId = in.readUint32Big(); + ResId elscId = in.readUint32Big(); + bool b1 = in.readBool(); + bool b2 = in.readBool(); + bool b3 = in.readBool(); + bool b4 = in.readBool(); + + if (partId == 0xffffffff && elscId == 0xffffffff) + return nullptr; + + if (!g_ResFactory->GetResourceTypeById(partId) && + !g_ResFactory->GetResourceTypeById(elscId)) + return nullptr; + + bool b5 = in.readBool(); + float f1 = in.readFloatBig(); + float f2 = in.readFloatBig(); + float f3 = in.readFloatBig(); + float f4 = in.readFloatBig(); + bool b6 = in.readBool(); + float f5 = in.readFloatBig(); + float f6 = in.readFloatBig(); + float f7 = in.readFloatBig(); + bool b7 = in.readBool(); + bool b8 = in.readBool(); + bool b9 = in.readBool(); + bool b10 = in.readBool(); + + CLightParameters lParms = LoadLightParameters(in); + + return new CScriptEffect(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, + head.x40_scale, partId, elscId, b1, b2, b3, b4, b5, f1, f2, f3, f4, + b6, f5, f6, f7, b7, b8, b9, lParms, b10); } CEntity* ScriptLoader::LoadPlatform(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { + if (!EnsurePropertyCount(propCount, 19, "Platform")) + return nullptr; + + SScaledActorHead head = LoadScaledActorHead(in, mgr); + + zeus::CVector3f extent; + extent.readBig(in); + + zeus::CVector3f centroid; + centroid.readBig(in); + + ResId staticId = in.readUint32Big(); + CAnimationParameters aParms = LoadAnimationParameters(in); + + CActorParameters actParms = LoadActorParameters(in); + + float f1 = in.readFloatBig(); + bool b1 = in.readBool(); + ResId dclnId = in.readUint32Big(); + + CHealthInfo hInfo(in); + + CDamageVulnerability dInfo(in); + + bool b2 = in.readBool(); + float f2 = in.readFloatBig(); + bool b3 = in.readBool(); + u32 w2 = in.readUint32Big(); + u32 w3 = in.readUint32Big(); + + FourCC animType = g_ResFactory->GetResourceTypeById(aParms.x0_ancs); + if (!g_ResFactory->GetResourceTypeById(staticId) && !animType) + return nullptr; + + zeus::CAABox aabb = GetCollisionBox(mgr, info.GetAreaId(), extent, centroid); + + FourCC dclnType = g_ResFactory->GetResourceTypeById(dclnId); + TLockedToken dclnToken; + if (dclnType) + { + dclnToken = g_SimplePool->GetObj({SBIG('DCLN'), dclnId}); + dclnToken.GetObj(); + } + + CModelData data; + if (animType == SBIG('ANCS')) + { + CAnimRes aRes; + aRes.x0_ancsId = aParms.x0_ancs; + aRes.x4_charIdx = aParms.x4_charIdx; + aRes.x8_scale = head.x40_scale; + aRes.x14_ = true; + aRes.x1c_defaultAnim = aParms.x8_defaultAnim; + data = aRes; + } + else + { + CStaticRes sRes; + sRes.x0_cmdlId = staticId; + sRes.x4_scale = head.x40_scale; + data = sRes; + } + + if (extent.isZero()) + aabb = data.GetBounds(head.x10_transform.getRotation()); + + return new CScriptPlatform(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, + data, actParms, aabb, f1, b2, f2, b1, hInfo, dInfo, dclnToken, b3, w2, w3); } CEntity* ScriptLoader::LoadSound(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { + if (!EnsurePropertyCount(propCount, 20, "Sound")) + return nullptr; + + SActorHead head = LoadActorHead(in, mgr); + + s32 soundId = in.readInt32Big(); + bool b1 = in.readBool(); + float f1 = in.readFloatBig(); + float f2 = in.readFloatBig(); + float f3 = in.readFloatBig(); + u32 w2 = in.readUint32Big(); + u32 w3 = in.readUint32Big(); + u32 w4 = in.readUint32Big(); + u32 w5 = in.readUint32Big(); + bool b2 = in.readBool(); + bool b3 = in.readBool(); + bool b4 = in.readBool(); + bool b5 = in.readBool(); + bool b6 = in.readBool(); + bool b7 = in.readBool(); + bool b8 = in.readBool(); + u32 w6 = in.readUint32Big(); + + if (soundId < 0) + return nullptr; + + return new CScriptSound(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, + soundId, b1, f1, f2, f3, w2, w3, w4, w5, w6, 0, b2, b3, b4, b5, b6, b7, b8, w6); } CEntity* ScriptLoader::LoadGenerator(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { + if (!EnsurePropertyCount(propCount, 8, "Generator")) + return nullptr; + + const std::string* name = mgr.HashInstanceName(in); + + u32 w1 = in.readUint32Big(); + bool b1 = in.readBool(); + bool b2 = in.readBool(); + + zeus::CVector3f v1; + v1.readBig(in); + + bool b3 = in.readBool(); + float f1 = in.readFloatBig(); + float f2 = in.readFloatBig(); + + return new CScriptGenerator(mgr.AllocateUniqueId(), *name, info, w1, b1, v1, b2, b3, f1, f2); } CEntity* ScriptLoader::LoadDock(CStateManager& mgr, CInputStream& in,