From 9e652db6f02ea586768741066910b97cef504a6f Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sat, 23 Apr 2016 15:10:47 -1000 Subject: [PATCH] Add CameraWaypoint loader --- Runtime/Collision/CMaterialList.hpp | 1 + Runtime/World/CMakeLists.txt | 1 + Runtime/World/CScriptCameraWaypoint.cpp | 15 +++++++++++++++ Runtime/World/CScriptCameraWaypoint.hpp | 18 ++++++++++++++++++ Runtime/World/ScriptLoader.cpp | 12 ++++++++++++ 5 files changed, 47 insertions(+) create mode 100644 Runtime/World/CScriptCameraWaypoint.cpp create mode 100644 Runtime/World/CScriptCameraWaypoint.hpp diff --git a/Runtime/Collision/CMaterialList.hpp b/Runtime/Collision/CMaterialList.hpp index 668ee75c3..0399449e5 100644 --- a/Runtime/Collision/CMaterialList.hpp +++ b/Runtime/Collision/CMaterialList.hpp @@ -7,6 +7,7 @@ namespace urde { enum class EMaterialTypes { + Zero = 0, Six = 6, Eight = 8, Ten = 10, diff --git a/Runtime/World/CMakeLists.txt b/Runtime/World/CMakeLists.txt index e2daffcee..5d1b0d71e 100644 --- a/Runtime/World/CMakeLists.txt +++ b/Runtime/World/CMakeLists.txt @@ -29,6 +29,7 @@ add_library(RuntimeCommonWorld CScriptWater.hpp CScriptWater.cpp CScriptGrapplePoint.hpp CScriptGrapplePoint.cpp CScriptAreaAttributes.hpp CScriptAreaAttributes.cpp + CScriptCameraWaypoint.hpp CScriptCameraWaypoint.cpp CGrappleParameters.hpp CActorParameters.hpp CLightParameters.hpp diff --git a/Runtime/World/CScriptCameraWaypoint.cpp b/Runtime/World/CScriptCameraWaypoint.cpp new file mode 100644 index 000000000..8b276c071 --- /dev/null +++ b/Runtime/World/CScriptCameraWaypoint.cpp @@ -0,0 +1,15 @@ +#include "CScriptCameraWaypoint.hpp" +#include "CActorParameters.hpp" + +namespace urde +{ + +CScriptCameraWaypoint::CScriptCameraWaypoint(TUniqueId uid, const std::string& name, const CEntityInfo& info, + const zeus::CTransform& xf, bool active, float, u32) +: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::Zero), + CActorParameters::None(), kInvalidUniqueId) +{ + +} + +} diff --git a/Runtime/World/CScriptCameraWaypoint.hpp b/Runtime/World/CScriptCameraWaypoint.hpp new file mode 100644 index 000000000..e2800d4e4 --- /dev/null +++ b/Runtime/World/CScriptCameraWaypoint.hpp @@ -0,0 +1,18 @@ +#ifndef __URDE_CSCRIPTCAMERAWAYPOINT_HPP__ +#define __URDE_CSCRIPTCAMERAWAYPOINT_HPP__ + +#include "CActor.hpp" + +namespace urde +{ + +class CScriptCameraWaypoint : public CActor +{ +public: + CScriptCameraWaypoint(TUniqueId uid, const std::string& name, const CEntityInfo& info, + const zeus::CTransform& xf, bool active, float, u32); +}; + +} + +#endif // __URDE_CSCRIPTCAMERAWAYPOINT_HPP__ diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index f20e0b8f4..be1209fd1 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -26,6 +26,7 @@ #include "CScriptGenerator.hpp" #include "CScriptGrapplePoint.hpp" #include "CScriptAreaAttributes.hpp" +#include "CScriptCameraWaypoint.hpp" #include "Camera/CCinematicCamera.hpp" #include "CSimplePool.hpp" #include "Collision/CCollidableOBBTreeGroup.hpp" @@ -764,6 +765,17 @@ CEntity* ScriptLoader::LoadCamera(CStateManager& mgr, CInputStream& in, CEntity* ScriptLoader::LoadCameraWaypoint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { + if (!EnsurePropertyCount(propCount, 6, "CameraWaypoint")) + return nullptr; + + SActorHead head = LoadActorHead(in, mgr); + + bool b1 = in.readBool(); + float f1 = in.readFloatBig(); + u32 w1 = in.readUint32Big(); + + return new CScriptCameraWaypoint(mgr.AllocateUniqueId(), head.x0_name, info, + head.x10_transform, b1, f1, w1); } CEntity* ScriptLoader::LoadNewIntroBoss(CStateManager& mgr, CInputStream& in,