From a491e2e9f229c8db92544b275cd1baa80bacfd17 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sun, 30 Jan 2022 12:07:24 -0800 Subject: [PATCH] Minor cleanups --- DataSpec/DNAMP1/SCLY.cpp | 4 ++-- DataSpec/DNAMP1/ScriptObjects/MazeNode.hpp | 14 +++++++------- DataSpec/DNAMP1/ScriptObjects/ScriptTypes.hpp | 2 +- Runtime/CBasics.hpp | 1 + Runtime/CGameState.cpp | 2 +- Runtime/World/CPlayerCameraBob.cpp | 2 -- Runtime/World/CStateMachine.hpp | 2 +- Runtime/World/ScriptLoader.cpp | 16 ++++++++-------- 8 files changed, 21 insertions(+), 22 deletions(-) diff --git a/DataSpec/DNAMP1/SCLY.cpp b/DataSpec/DNAMP1/SCLY.cpp index e99d97bf4..8ac610788 100644 --- a/DataSpec/DNAMP1/SCLY.cpp +++ b/DataSpec/DNAMP1/SCLY.cpp @@ -108,7 +108,7 @@ void SCLY::ScriptLayer::Enumerate(athena::io::IStreamReader& rs) { [&type](const ScriptObjectSpec* obj) -> bool { return obj->type == type; }); if (iter != SCRIPT_OBJECT_DB.end()) { - std::unique_ptr obj((*iter)->a()); + std::unique_ptr obj((*iter)->loader()); obj->type = type; obj->read(rs); objects.push_back(std::move(obj)); @@ -141,7 +141,7 @@ void SCLY::ScriptLayer::Enumerate(athena::io::YAMLDocReader& r [&type](const ScriptObjectSpec* obj) -> bool { return obj->type == type; }); if (iter != SCRIPT_OBJECT_DB.end()) { - std::unique_ptr obj((*iter)->a()); + std::unique_ptr obj((*iter)->loader()); obj->read(rs); obj->type = type; objects.push_back(std::move(obj)); diff --git a/DataSpec/DNAMP1/ScriptObjects/MazeNode.hpp b/DataSpec/DNAMP1/ScriptObjects/MazeNode.hpp index c6e740f19..b93a60691 100644 --- a/DataSpec/DNAMP1/ScriptObjects/MazeNode.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/MazeNode.hpp @@ -10,12 +10,12 @@ struct MazeNode : IScriptObject { String<-1> name; Value location; Value orientation; - Value unknown1; - Value unknown2; - Value unknown3; - Value unknown4; - Value unknown5; - Value unknown6; - Value unknown7; + Value active; + Value col; + Value row; + Value side; + Value actorPos; + Value triggerPos; + Value effectPos; }; } // namespace DataSpec::DNAMP1 diff --git a/DataSpec/DNAMP1/ScriptObjects/ScriptTypes.hpp b/DataSpec/DNAMP1/ScriptObjects/ScriptTypes.hpp index a354c9430..b0febb999 100644 --- a/DataSpec/DNAMP1/ScriptObjects/ScriptTypes.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/ScriptTypes.hpp @@ -9,7 +9,7 @@ struct IScriptObject; struct ScriptObjectSpec { atUint8 type; - IScriptObject* (*a)(); + IScriptObject* (*loader)(); }; using ScriptObjectDBArray = std::array; diff --git a/Runtime/CBasics.hpp b/Runtime/CBasics.hpp index 8e76e67fe..7e761fea0 100644 --- a/Runtime/CBasics.hpp +++ b/Runtime/CBasics.hpp @@ -34,6 +34,7 @@ public: static OSTime ToWiiTime(std::chrono::system_clock::time_point time); static std::chrono::system_clock::time_point FromWiiTime(OSTime wiiTime); + static OSTime GetTime() { return ToWiiTime(std::chrono::system_clock::now()); } static u64 GetGCTicks(); static constexpr u64 GetGCTicksPerSec() { return 486000000ull; } diff --git a/Runtime/CGameState.cpp b/Runtime/CGameState.cpp index c054f1ad5..ccfbc9a6c 100644 --- a/Runtime/CGameState.cpp +++ b/Runtime/CGameState.cpp @@ -221,7 +221,7 @@ void CGameState::PutTo(CBitStreamWriter& writer) { writer.WriteEncoded(u32(value), 8); } - writer.WriteEncoded(CBasics::ToWiiTime(std::chrono::system_clock::now()) / CBasics::TICKS_PER_SECOND, 32); + writer.WriteEncoded(CBasics::GetTime() / CBasics::TICKS_PER_SECOND, 32); writer.WriteEncoded(x228_24_hardMode, 1); writer.WriteEncoded(x228_25_initPowerupsAtFirstSpawn, 1); writer.WriteEncoded(u32(x84_mlvlId.Value()), 32); diff --git a/Runtime/World/CPlayerCameraBob.cpp b/Runtime/World/CPlayerCameraBob.cpp index 84656c2f3..f7516d96f 100644 --- a/Runtime/World/CPlayerCameraBob.cpp +++ b/Runtime/World/CPlayerCameraBob.cpp @@ -1,8 +1,6 @@ #include "Runtime/World/CPlayerCameraBob.hpp" #include "Runtime/CStateManager.hpp" -#include "Runtime/Camera/CCameraManager.hpp" -#include "Runtime/Particle/CGenDescription.hpp" #include "Runtime/World/CPlayer.hpp" #include diff --git a/Runtime/World/CStateMachine.hpp b/Runtime/World/CStateMachine.hpp index 671030044..b2600f39d 100644 --- a/Runtime/World/CStateMachine.hpp +++ b/Runtime/World/CStateMachine.hpp @@ -4,9 +4,9 @@ #include "Runtime/CToken.hpp" #include "Runtime/GCNTypes.hpp" +#include "Runtime/IOStreams.hpp" #include "Runtime/IObj.hpp" #include "Runtime/IObjFactory.hpp" -#include "Runtime/IOStreams.hpp" #include "Runtime/World/CAiFuncMap.hpp" namespace metaforce { diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index aa543a1d2..3c59d0b25 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -3760,15 +3760,15 @@ CEntity* ScriptLoader::LoadMazeNode(CStateManager& mgr, CInputStream& in, int pr SActorHead aHead = LoadActorHead(in, mgr); bool active = in.readBool(); - u32 w1 = in.readUint32Big(); - u32 w2 = in.readUint32Big(); - u32 w3 = in.readUint32Big(); - zeus::CVector3f vec1 = zeus::CVector3f::ReadBig(in); - zeus::CVector3f vec2 = zeus::CVector3f::ReadBig(in); - zeus::CVector3f vec3 = zeus::CVector3f::ReadBig(in); + u32 col = in.readUint32Big(); + u32 row = in.readUint32Big(); + u32 side = in.readUint32Big(); + zeus::CVector3f actorPos = zeus::CVector3f::ReadBig(in); + zeus::CVector3f triggerPos = zeus::CVector3f::ReadBig(in); + zeus::CVector3f effectPos = zeus::CVector3f::ReadBig(in); - return new CScriptMazeNode(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, w1, w2, w3, vec1, - vec2, vec3); + return new CScriptMazeNode(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, col, row, side, + actorPos, triggerPos, effectPos); } CEntity* ScriptLoader::LoadOmegaPirate(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {