diff --git a/Runtime/Collision/CMaterialList.hpp b/Runtime/Collision/CMaterialList.hpp index 01eaa5dcd..fbbdffa89 100644 --- a/Runtime/Collision/CMaterialList.hpp +++ b/Runtime/Collision/CMaterialList.hpp @@ -11,7 +11,7 @@ class CMaterialList public: u64 x0_ = 0; CMaterialList() = default; - CMaterialList(int idx) : x0_(1 << idx) {} + CMaterialList(int idx) : x0_(1ull << idx) {} }; } diff --git a/Runtime/World/CMakeLists.txt b/Runtime/World/CMakeLists.txt index 72efb5ced..34d9a1413 100644 --- a/Runtime/World/CMakeLists.txt +++ b/Runtime/World/CMakeLists.txt @@ -14,7 +14,6 @@ add_library(RuntimeCommonWorld CTeamAiTypes.hpp CTeamAiTypes.cpp ScriptObjectSupport.hpp ScriptObjectSupport.cpp ScriptLoader.hpp ScriptLoader.cpp - CScriptWater.hpp CScriptWater.cpp CScriptActor.hpp CScriptActor.cpp CScriptWaypoint.hpp CScriptWaypoint.cpp CScriptDoor.hpp CScriptDoor.cpp @@ -25,6 +24,9 @@ add_library(RuntimeCommonWorld CScriptPlatform.hpp CScriptPlatform.cpp CScriptSound.hpp CScriptSound.cpp CScriptGenerator.hpp CScriptGenerator.cpp + CScriptDock.hpp CScriptDock.cpp + CScriptWater.hpp CScriptWater.cpp + CScriptGrapplePoint.hpp CScriptGrapplePoint.cpp CGrappleParameters.hpp CActorParameters.hpp CLightParameters.hpp diff --git a/Runtime/World/CScriptDock.cpp b/Runtime/World/CScriptDock.cpp new file mode 100644 index 000000000..1d2a49b25 --- /dev/null +++ b/Runtime/World/CScriptDock.cpp @@ -0,0 +1,30 @@ +#include "CScriptDock.hpp" +#include "CActorParameters.hpp" +#include "Character/CModelData.hpp" +#include "Collision/CMaterialList.hpp" + +namespace urde +{ +CMaterialList MakeDockMaterialList() +{ + CMaterialList list; + list.x0_ |= (1ull << 34); + list.x0_ |= (1ull << 43); + list.x0_ |= (1ull << 48); + return list; +} + +CScriptDock::CScriptDock(TUniqueId uid, const std::string &name, const CEntityInfo &info, const zeus::CVector3f position, + const zeus::CVector3f& extents, s32 dock, TAreaId area, bool active, s32 w1, bool b1) + : CPhysicsActor(uid, active, name, info, zeus::CTransform(zeus::CMatrix3f::skIdentityMatrix3f, position), + CModelData::CModelDataNull(), MakeDockMaterialList(), zeus::CAABox(-extents * 0.5f, extents * 0.5f), SMoverData(1.f), CActorParameters::None(), 0.3f, 0.1f), + x258_(w1), + x25c_dock(dock), + x260_area(area), + x264_(3) +{ + x268_24_ = false; + x268_25_ = b1; + x268_26_ = false; +} +} diff --git a/Runtime/World/CScriptDock.hpp b/Runtime/World/CScriptDock.hpp new file mode 100644 index 000000000..621d7c268 --- /dev/null +++ b/Runtime/World/CScriptDock.hpp @@ -0,0 +1,30 @@ +#ifndef __URDE_CSCRIPTDOCK_HPP__ +#define __URDE_CSCRIPTDOCK_HPP__ + +#include "CPhysicsActor.hpp" + +namespace urde +{ + +class CScriptDock : public CPhysicsActor +{ + s32 x258_; + s32 x25c_dock; + TAreaId x260_area; + u32 x264_; + union + { + struct + { + bool x268_24_ : 1; + bool x268_25_ : 1; + bool x268_26_ : 1; + }; + u8 dummy = 0; + }; +public: + CScriptDock(TUniqueId uid, const std::string& name, const CEntityInfo& info, const zeus::CVector3f position, + const zeus::CVector3f& extent, s32, TAreaId, bool active, s32 w1, bool b1); +}; +} +#endif // __URDE_CSCRIPTDOCK_HPP__ diff --git a/Runtime/World/CScriptGrapplePoint.cpp b/Runtime/World/CScriptGrapplePoint.cpp new file mode 100644 index 000000000..1b5d612a9 --- /dev/null +++ b/Runtime/World/CScriptGrapplePoint.cpp @@ -0,0 +1,18 @@ +#include "CScriptGrapplePoint.hpp" +#include "Character/CModelData.hpp" +#include "Collision/CMaterialList.hpp" +#include "CActorParameters.hpp" + +namespace urde +{ +CScriptGrapplePoint::CScriptGrapplePoint(TUniqueId uid, const std::string &name, const CEntityInfo& info, + const zeus::CTransform &transform, bool active, const CGrappleParameters ¶ms) + : CActor(uid, active, name, info, transform, CModelData::CModelDataNull(), CMaterialList(41), CActorParameters::None(), + kInvalidUniqueId), + xe8_({x40_unknown - 0.5f, x50_unknown - 0.5f, x60_unknown - 0.5f}, + {x40_unknown + 0.5f, x50_unknown + 0.5f, x60_unknown + 0.5f}), + x100_parameters(params) +{ +} + +} diff --git a/Runtime/World/CScriptGrapplePoint.hpp b/Runtime/World/CScriptGrapplePoint.hpp new file mode 100644 index 000000000..11e5216eb --- /dev/null +++ b/Runtime/World/CScriptGrapplePoint.hpp @@ -0,0 +1,19 @@ +#ifndef __URDE_CSCRIPTGRAPPLEPOINT_HPP__ +#define __URDE_CSCRIPTGRAPPLEPOINT_HPP__ + +#include "CActor.hpp" +#include "CGrappleParameters.hpp" + +namespace urde +{ +class CScriptGrapplePoint : public CActor +{ + zeus::CAABox xe8_; + CGrappleParameters x100_parameters; +public: + CScriptGrapplePoint(TUniqueId uid, const std::string& name, const CEntityInfo& info, const zeus::CTransform& transform, + bool active, const CGrappleParameters& params); +}; +} + +#endif // __URDE_CSCRIPTGRAPPLEPOINT_HPP__ diff --git a/Runtime/World/CScriptWaypoint.hpp b/Runtime/World/CScriptWaypoint.hpp index 0235ec7df..fa0c82086 100644 --- a/Runtime/World/CScriptWaypoint.hpp +++ b/Runtime/World/CScriptWaypoint.hpp @@ -13,7 +13,6 @@ public: const zeus::CTransform&, bool, float, float, u32, u32, u32, u32, u32, u32, u32); }; - } #endif // __URDE_CSCRIPTWAYPOINT_HPP__ diff --git a/Runtime/World/CScriptWorldTeleporter.cpp b/Runtime/World/CScriptWorldTeleporter.cpp new file mode 100644 index 000000000..5ac2b0077 --- /dev/null +++ b/Runtime/World/CScriptWorldTeleporter.cpp @@ -0,0 +1,6 @@ +#include "CScriptWorldTeleporter.hpp" + +namespace urde +{ + +} diff --git a/Runtime/World/CScriptWorldTeleporter.hpp b/Runtime/World/CScriptWorldTeleporter.hpp new file mode 100644 index 000000000..5e9fbed44 --- /dev/null +++ b/Runtime/World/CScriptWorldTeleporter.hpp @@ -0,0 +1,17 @@ +#ifndef __CSCRIPTWORLDTELEPORTER_HPP__ +#define __CSCRIPTWORLDTELEPORTER_HPP__ + +#include "CEntity.hpp" + +namespace urde +{ + +class CScriptWorldTeleporter +{ +public: + +}; + +} + +#endif // __CSCRIPTWORLDTELEPORTER_HPP__ diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index e531087da..a31b31aa3 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -18,11 +18,13 @@ #include "CScriptTrigger.hpp" #include "CScriptTimer.hpp" #include "CScriptCounter.hpp" +#include "CScriptDock.hpp" #include "CScriptWater.hpp" #include "CScriptEffect.hpp" #include "CScriptPlatform.hpp" #include "CScriptSound.hpp" #include "CScriptGenerator.hpp" +#include "CScriptGrapplePoint.hpp" #include "CSimplePool.hpp" #include "Collision/CCollidableOBBTreeGroup.hpp" #include "Editor/ProjectResourceFactoryMP1.hpp" @@ -709,7 +711,20 @@ CEntity* ScriptLoader::LoadGenerator(CStateManager& mgr, CInputStream& in, CEntity* ScriptLoader::LoadDock(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) -{ +{ + if (!EnsurePropertyCount(propCount, 7, "Dock")) + return nullptr; + + std::string name = *mgr.HashInstanceName(in); + bool active = in.readBool(); + zeus::CVector3f position; + position.readBig(in); + zeus::CVector3f scale; + scale.readBig(in); + u32 dock = in.readUint32Big(); + TAreaId area = in.readUint32Big(); + bool b1 = in.readBool(); + return new CScriptDock(mgr.AllocateUniqueId(), name, info, position, scale, dock, area, active, 0, b1); } CEntity* ScriptLoader::LoadCamera(CStateManager& mgr, CInputStream& in, @@ -967,6 +982,14 @@ CEntity* ScriptLoader::LoadPathCamera(CStateManager& mgr, CInputStream& in, CEntity* ScriptLoader::LoadGrapplePoint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { + if (!EnsurePropertyCount(propCount, 5, "GrapplePoint")) + return nullptr; + + std::string name = *mgr.HashInstanceName(in); + zeus::CTransform grappleXf = LoadEditorTransform(in); + bool active = in.readBool(); + CGrappleParameters parameters = LoadGrappleParameters(in); + return new CScriptGrapplePoint(mgr.AllocateUniqueId(), name, info, grappleXf, active, parameters); } CEntity* ScriptLoader::LoadPuddleSpore(CStateManager& mgr, CInputStream& in,