From deb72468127a758159fadeef6f01a5de06fe2233 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Tue, 26 Apr 2016 14:21:08 -1000 Subject: [PATCH] Add CScriptSpawnPoint --- Runtime/World/CMakeLists.txt | 1 + Runtime/World/CScriptSpawnPoint.cpp | 13 +++++++++++++ Runtime/World/CScriptSpawnPoint.hpp | 20 ++++++++++++++++++++ Runtime/World/ScriptLoader.cpp | 26 ++++++++++++++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 Runtime/World/CScriptSpawnPoint.cpp create mode 100644 Runtime/World/CScriptSpawnPoint.hpp diff --git a/Runtime/World/CMakeLists.txt b/Runtime/World/CMakeLists.txt index 0c9e14e95..4f158141a 100644 --- a/Runtime/World/CMakeLists.txt +++ b/Runtime/World/CMakeLists.txt @@ -34,6 +34,7 @@ set(WORLD_SOURCES CScriptAreaAttributes.hpp CScriptAreaAttributes.cpp CScriptCameraWaypoint.hpp CScriptCameraWaypoint.cpp CScriptCoverPoint.hpp CScriptCoverPoint.cpp + CScriptSpawnPoint.hpp CScriptSpawnPoint.cpp CGrappleParameters.hpp CActorParameters.hpp CLightParameters.hpp diff --git a/Runtime/World/CScriptSpawnPoint.cpp b/Runtime/World/CScriptSpawnPoint.cpp new file mode 100644 index 000000000..ec3053ad7 --- /dev/null +++ b/Runtime/World/CScriptSpawnPoint.cpp @@ -0,0 +1,13 @@ +#include "CScriptSpawnPoint.hpp" + +namespace urde +{ + +CScriptSpawnPoint::CScriptSpawnPoint(TUniqueId uid, const std::string& name, const CEntityInfo& info, + const zeus::CTransform& xf, const std::vector& itemCounts, + bool, bool active, bool) +: CEntity(uid, info, active, name) +{ +} + +} diff --git a/Runtime/World/CScriptSpawnPoint.hpp b/Runtime/World/CScriptSpawnPoint.hpp new file mode 100644 index 000000000..f79447b4d --- /dev/null +++ b/Runtime/World/CScriptSpawnPoint.hpp @@ -0,0 +1,20 @@ +#ifndef __CSCRIPTSPAWNPOINT_HPP__ +#define __CSCRIPTSPAWNPOINT_HPP__ + +#include "CEntity.hpp" +#include "zeus/CTransform.hpp" + +namespace urde +{ + +class CScriptSpawnPoint : public CEntity +{ +public: + CScriptSpawnPoint(TUniqueId, const std::string& name, const CEntityInfo& info, + const zeus::CTransform& xf, const std::vector& itemCounts, + bool, bool, bool); +}; + +} + +#endif // __CSCRIPTSPAWNPOINT_HPP__ diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index d2dc6da2a..7f332e9a2 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -28,6 +28,7 @@ #include "CScriptAreaAttributes.hpp" #include "CScriptCameraWaypoint.hpp" #include "CScriptCoverPoint.hpp" +#include "CScriptSpawnPoint.hpp" #include "Camera/CCinematicCamera.hpp" #include "MP1/CNewIntroBoss.hpp" #include "MP1/CWarWasp.hpp" @@ -827,6 +828,31 @@ CEntity* ScriptLoader::LoadNewIntroBoss(CStateManager& mgr, CInputStream& in, CEntity* ScriptLoader::LoadSpawnPoint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { + if (!EnsurePropertyCount(propCount, 35, "SpawnPoint")) + return nullptr; + + const std::string* name = mgr.HashInstanceName(in); + + zeus::CVector3f position; + position.readBig(in); + + zeus::CVector3f rotation; + rotation.readBig(in); + + std::vector itemCounts; + itemCounts.reserve(propCount-6); + for (int i=0 ; i 34) + b3 = in.readBool(); + + return new CScriptSpawnPoint(mgr.AllocateUniqueId(), *name, info, + ConvertEditorEulerToTransform4f(rotation, position), + itemCounts, b1, b2, b3); } CEntity* ScriptLoader::LoadCameraHint(CStateManager& mgr, CInputStream& in,