diff --git a/Runtime/AutoMapper/CAutoMapper.cpp b/Runtime/AutoMapper/CAutoMapper.cpp index 5daf97279..d87e08768 100644 --- a/Runtime/AutoMapper/CAutoMapper.cpp +++ b/Runtime/AutoMapper/CAutoMapper.cpp @@ -110,13 +110,13 @@ CAutoMapper::CAutoMapper(CStateManager& stateMgr) x48_mapIcons.push_back(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), g_tweakPlayerRes->x10_minesBreakFirstTopIcon})); x48_mapIcons.push_back(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), g_tweakPlayerRes->x14_minesBreakFirstBottomIcon})); - for (int i=0 ; i<9 ; ++i) + for (u32 i=0 ; i<9 ; ++i) { x210_lstick.push_back(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), g_tweakPlayerRes->x24_lStick[i]})); x25c_cstick.push_back(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), g_tweakPlayerRes->x4c_cStick[i]})); } - for (int i=0 ; i<2 ; ++i) + for (u32 i=0 ; i<2 ; ++i) { x2a8_ltrigger.push_back(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), g_tweakPlayerRes->x74_lTrigger[i]})); x2bc_rtrigger.push_back(g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), g_tweakPlayerRes->x80_rTrigger[i]})); @@ -348,8 +348,8 @@ bool CAutoMapper::CanLeaveMapScreen(const CStateManager& mgr) const void CAutoMapper::SetCurWorldAssetId(CAssetId mlvlId) { - int numWorlds = x8_mapu->GetNumMapWorldDatas(); - for (int i=0 ; iGetNumMapWorldDatas(); + for (u32 i=0 ; iGetMapWorldData(i).GetWorldAssetId() == mlvlId) { x9c_worldIdx = i; @@ -941,13 +941,13 @@ CAutoMapper::FindClosestVisibleWorld(const zeus::CVector3f& point, { float minDist = 29999.f; std::pair closestWorld = {xa0_curAreaId, xa0_curAreaId}; - for (int w=0 ; wGetNumMapWorldDatas() ; ++w) + for (u32 w=0 ; wGetNumMapWorldDatas() ; ++w) { const CMapUniverse::CMapWorldData& mwData = x8_mapu->GetMapWorldData(w); const CMapWorldInfo& mwInfo = *g_GameState->StateForWorld(mwData.GetWorldAssetId()).MapWorldInfo(); if (!mwInfo.IsAnythingSet()) continue; - for (int i=0 ; iCurrentWorldAssetId(); - for (int i=0 ; iGetMapWorldData(i); @@ -1570,7 +1570,7 @@ void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, flo zeus::CTransform universeAreaXf = mwData.GetWorldTransform() * areaXf; float minMag = FLT_MAX; int hexIdx = -1; - for (int i=0 ; iHintOptions(); - for (int i=0 ; iload(&uniform, sizeof(uniform)); + m_uniBuf->load(&uniform, sizeof(Uniform)); CGraphics::SetShaderDataBinding(m_dataBind); CGraphics::DrawArrayIndexed(start, count); } diff --git a/Runtime/MP1/CAutoSave.cpp b/Runtime/MP1/CAutoSave.cpp new file mode 100644 index 000000000..e9d988402 --- /dev/null +++ b/Runtime/MP1/CAutoSave.cpp @@ -0,0 +1,15 @@ +#include "CAutoSave.hpp" +#include "CSaveGameScreen.hpp" +#include "IMain.hpp" + +namespace urde +{ +namespace MP1 +{ +CAutoSave::CAutoSave() +: CIOWin("") +, x14_savegameScreen(new CSaveGameScreen(ESaveContext::InGame, g_GameState->GetCardSerial())) +{ +} +} +} diff --git a/Runtime/MP1/CAutoSave.hpp b/Runtime/MP1/CAutoSave.hpp new file mode 100644 index 000000000..536f9a549 --- /dev/null +++ b/Runtime/MP1/CAutoSave.hpp @@ -0,0 +1,19 @@ +#ifndef __URDE_CAUTOSAVE_HPP__ +#define __URDE_CAUTOSAVE_HPP__ + +#include "CIOWin.hpp" + +namespace urde +{ +namespace MP1 +{ +class CSaveGameScreen; +class CAutoSave : CIOWin +{ + std::unique_ptr x14_savegameScreen; +public: + CAutoSave(); +}; +} +} +#endif // __URDE_CAUTOSAVE_HPP__ diff --git a/Runtime/MP1/CPauseScreen.cpp b/Runtime/MP1/CPauseScreen.cpp index fe4f95a1c..e4fc1e625 100644 --- a/Runtime/MP1/CPauseScreen.cpp +++ b/Runtime/MP1/CPauseScreen.cpp @@ -303,7 +303,8 @@ bool CPauseScreen::ShouldSwitchToInGame() const float CPauseScreen::GetHelmetCamYOff() const { - if (CPauseScreenBase* screen = x7c_screens[x78_activeIdx].get()) + CPauseScreenBase* screen = x7c_screens[x78_activeIdx].get(); + if (screen) return screen->GetCameraYBias(); return 0.f; } diff --git a/Runtime/MP1/World/CMakeLists.txt b/Runtime/MP1/World/CMakeLists.txt index 8df8a0819..5dc593986 100644 --- a/Runtime/MP1/World/CMakeLists.txt +++ b/Runtime/MP1/World/CMakeLists.txt @@ -3,6 +3,7 @@ set(MP1_WORLD_SOURCES CBeetle.hpp CBeetle.cpp CWarWasp.hpp CWarWasp.cpp CSpacePirate.hpp CSpacePirate.cpp + CParasite.hpp CParasite.cpp CBabygoth.hpp CBabygoth.cpp CMetroidPrimeRelay.hpp CMetroidPrimeRelay.cpp CMetroidPrimeExo.hpp CMetroidPrimeExo.cpp diff --git a/Runtime/MP1/World/CParasite.cpp b/Runtime/MP1/World/CParasite.cpp new file mode 100644 index 000000000..77174b57f --- /dev/null +++ b/Runtime/MP1/World/CParasite.cpp @@ -0,0 +1 @@ +#include "CParasite.hpp" diff --git a/Runtime/MP1/World/CParasite.hpp b/Runtime/MP1/World/CParasite.hpp new file mode 100644 index 000000000..6b325411a --- /dev/null +++ b/Runtime/MP1/World/CParasite.hpp @@ -0,0 +1,14 @@ +#ifndef __URDE_MP1_CPARASITE_HPP__ +#define __URDE_MP1_CPARASITE_HPP__ + +#include "World/CWallWalker.hpp" + +namespace urde::MP1 +{ +class CParasite : public CWallWalker +{ +public: + CParasite(); +}; +} +#endif // __URDE_MP1_CPARASITE_HPP__ diff --git a/Runtime/World/CMakeLists.txt b/Runtime/World/CMakeLists.txt index 56202b65a..51be0f4b0 100644 --- a/Runtime/World/CMakeLists.txt +++ b/Runtime/World/CMakeLists.txt @@ -76,6 +76,7 @@ set(WORLD_SOURCES CScriptTargetingPoint.hpp CScriptTargetingPoint.cpp CScriptPlayerActor.hpp CScriptPlayerActor.cpp CScriptSwitch.hpp CScriptSwitch.cpp + CWallWalker.hpp CWallWalker.cpp CWallCrawlerSwarm.hpp CWallCrawlerSwarm.cpp CScriptAiJumpPoint.hpp CScriptAiJumpPoint.cpp CScriptRoomAcoustics.hpp CScriptRoomAcoustics.cpp diff --git a/Runtime/World/CScriptAiJumpPoint.cpp b/Runtime/World/CScriptAiJumpPoint.cpp index 691575373..4f162c76f 100644 --- a/Runtime/World/CScriptAiJumpPoint.cpp +++ b/Runtime/World/CScriptAiJumpPoint.cpp @@ -30,7 +30,7 @@ void CScriptAiJumpPoint::Think(float dt, CStateManager&) void CScriptAiJumpPoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId other, CStateManager& mgr) { - AcceptScriptMsg(msg, other, mgr); + CActor::AcceptScriptMsg(msg, other, mgr); if (msg != EScriptObjectMessage::InitializedInArea) return; diff --git a/Runtime/World/CWallWalker.cpp b/Runtime/World/CWallWalker.cpp new file mode 100644 index 000000000..084c73ab9 --- /dev/null +++ b/Runtime/World/CWallWalker.cpp @@ -0,0 +1,11 @@ +#include "CWallWalker.hpp" + +namespace urde +{ +CWallWalker::CWallWalker(ECharacter chr, TUniqueId uid, std::string_view name, EFlavorType flavType, + const CEntityInfo& eInfo, const zeus::CTransform& xf, + CModelData&& mData, const CPatternedInfo& pInfo, EMovementType mType, + EColliderType colType, EBodyType bType, const CActorParameters& aParms, s32 w1, bool w2) + : CPatterned(chr, uid, name, flavType, eInfo, xf, std::move(mData), pInfo, mType, colType, bType, aParms, w1) +{} +} diff --git a/Runtime/World/CWallWalker.hpp b/Runtime/World/CWallWalker.hpp new file mode 100644 index 000000000..f1a856747 --- /dev/null +++ b/Runtime/World/CWallWalker.hpp @@ -0,0 +1,16 @@ +#ifndef __URDE_CWALLWALKER_HPP__ +#define __URDE_CWALLWALKER_HPP__ + +#include "CPatterned.hpp" + +namespace urde +{ +class CWallWalker : public CPatterned +{ +public: + CWallWalker(ECharacter, TUniqueId, std::string_view, EFlavorType, const CEntityInfo&, const zeus::CTransform&, + CModelData&&, const CPatternedInfo&, EMovementType, EColliderType, EBodyType, + const CActorParameters&, s32, bool); +}; +} +#endif // __URDE_CWALLWALKER_HPP__ diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index 4dda6ac7a..3f6738355 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -75,8 +75,9 @@ #include "MP1/World/CNewIntroBoss.hpp" #include "MP1/World/CSpacePirate.hpp" #include "MP1/World/CWarWasp.hpp" +#include "MP1/World/CParasite.hpp" #include "Particle/CWeaponDescription.hpp" - +#include "Camera/CPathCamera.hpp" namespace urde { static logvisor::Module Log("urde::ScriptLoader"); @@ -573,7 +574,7 @@ CEntity* ScriptLoader::LoadEffect(CStateManager& mgr, CInputStream& in, int prop bool b3 = in.readBool(); bool b4 = in.readBool(); - if (partId == 0xffffffff && elscId == 0xffffffff) + if (!partId.IsValid() && !elscId.IsValid()) return nullptr; if (!g_ResFactory->GetResourceTypeById(partId) && !g_ResFactory->GetResourceTypeById(elscId)) @@ -840,8 +841,11 @@ CEntity* ScriptLoader::LoadSpawnPoint(CStateManager& mgr, CInputStream& in, int CEntity* ScriptLoader::LoadCameraHint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { - if (!EnsurePropertyCount(propCount, 25, "CamerHint")) + if (propCount > 25) + { + Log.report(logvisor::Warning, "Too many props (%d > 25) for CameraHint entity", propCount); return nullptr; + } SActorHead head = LoadActorHead(in, mgr); @@ -1423,7 +1427,22 @@ CEntity* ScriptLoader::LoadFlickerBat(CStateManager& mgr, CInputStream& in, int CEntity* ScriptLoader::LoadPathCamera(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { - return nullptr; + if (propCount > 15) + { + Log.report(logvisor::Warning, "Too many props (%d > 15) for PathCamera entity", propCount); + return nullptr; + } + + SActorHead aHead = LoadActorHead(in, mgr); + bool active = in.readBool(); + u32 flags = LoadParameterFlags(in); + float f1 = in.readFloatBig(); + float f2 = in.readFloatBig(); + float f3 = in.readFloatBig(); + CPathCamera::EInitialSplinePosition initPos = CPathCamera::EInitialSplinePosition(in.readUint32Big()); + float f4 = in.readFloatBig(); + float f5 = in.readFloatBig(); + return new CPathCamera(mgr.AllocateUniqueId(), aHead.x0_name, info, aHead.x10_transform, active, f1, f2, f3, f4, f5, flags, initPos); } CEntity* ScriptLoader::LoadGrapplePoint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) @@ -1573,7 +1592,44 @@ CEntity* ScriptLoader::LoadSpankWeed(CStateManager& mgr, CInputStream& in, int p CEntity* ScriptLoader::LoadParasite(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) { - return nullptr; + if (!EnsurePropertyCount(propCount, 6, "Parasite")) + return nullptr; + + std::string name = mgr.HashInstanceName(in); + CPatterned::EFlavorType flavor = CPatterned::EFlavorType(in.readUint32Big()); + zeus::CTransform xf = LoadEditorTransform(in); + zeus::CVector3f scale = zeus::CVector3f::ReadBig(in); + + std::pair pcount = CPatternedInfo::HasCorrectParameterCount(in); + if (!pcount.first) + return nullptr; + + CPatternedInfo pInfo(in, pcount.second); + CActorParameters aParms = LoadActorParameters(in); + float f1 = in.readFloatBig(); + float f2 = in.readFloatBig(); + float f3 = in.readFloatBig(); + float f4 = in.readFloatBig(); + float f5 = in.readFloatBig(); + float f6 = in.readFloatBig(); + float f7 = in.readFloatBig(); + float f8 = in.readFloatBig(); + float f9 = in.readFloatBig(); + float f10 = in.readFloatBig(); + float f11 = in.readFloatBig(); + float f12 = in.readFloatBig(); + float f13 = in.readFloatBig(); + float f14 = in.readFloatBig(); + float f15 = in.readFloatBig(); + float f16 = in.readFloatBig(); + float f17 = in.readFloatBig(); + bool b1 = in.readBool(); + + if (g_ResFactory->GetResourceTypeById(pInfo.GetAnimationParameters().GetACSFile()) != SBIG('ANCS')) + return nullptr; + const CAnimationParameters& animParms = pInfo.GetAnimationParameters(); + CModelData mData(CAnimRes(animParms.GetACSFile(), animParms.GetCharacter(), scale, animParms.GetInitialAnimation(), true)); + return nullptr; //return new MP1::CParasite(mgr.AllocateUniqueId(), name, flavor, info, xf, std::move(mData), pInfo, ) } CEntity* ScriptLoader::LoadPlayerHint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)