Rename CSavwWorld to CWorldSaveGameInfo

This commit is contained in:
Phillip Stephens 2021-06-04 22:27:52 -07:00
parent 354d3a0199
commit 95f44be694
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
22 changed files with 73 additions and 73 deletions

View File

@ -5,7 +5,7 @@
namespace metaforce { namespace metaforce {
CMapWorldInfo::CMapWorldInfo(CBitStreamReader& reader, const CSaveWorld& savw, CAssetId mlvlId) { CMapWorldInfo::CMapWorldInfo(CBitStreamReader& reader, const CWorldSaveGameInfo& savw, CAssetId mlvlId) {
const CSaveWorldMemory& worldMem = g_MemoryCardSys->GetSaveWorldMemory(mlvlId); const CSaveWorldMemory& worldMem = g_MemoryCardSys->GetSaveWorldMemory(mlvlId);
x4_visitedAreas.reserve((worldMem.GetAreaCount() + 31) / 32); x4_visitedAreas.reserve((worldMem.GetAreaCount() + 31) / 32);
@ -27,7 +27,7 @@ CMapWorldInfo::CMapWorldInfo(CBitStreamReader& reader, const CSaveWorld& savw, C
x38_mapStationUsed = reader.ReadEncoded(1) != 0; x38_mapStationUsed = reader.ReadEncoded(1) != 0;
} }
void CMapWorldInfo::PutTo(CBitStreamWriter& writer, const CSaveWorld& savw, CAssetId mlvlId) const { void CMapWorldInfo::PutTo(CBitStreamWriter& writer, const CWorldSaveGameInfo& savw, CAssetId mlvlId) const {
const CSaveWorldMemory& worldMem = g_MemoryCardSys->GetSaveWorldMemory(mlvlId); const CSaveWorldMemory& worldMem = g_MemoryCardSys->GetSaveWorldMemory(mlvlId);
for (u32 i = 0; i < worldMem.GetAreaCount(); ++i) { for (u32 i = 0; i < worldMem.GetAreaCount(); ++i) {

View File

@ -6,7 +6,7 @@
#include "Runtime/RetroTypes.hpp" #include "Runtime/RetroTypes.hpp"
namespace metaforce { namespace metaforce {
class CSaveWorld; class CWorldSaveGameInfo;
class CMapWorldInfo { class CMapWorldInfo {
mutable u32 x0_visitedAreasAllocated = 0; mutable u32 x0_visitedAreasAllocated = 0;
@ -18,8 +18,8 @@ class CMapWorldInfo {
public: public:
CMapWorldInfo() = default; CMapWorldInfo() = default;
explicit CMapWorldInfo(CBitStreamReader& reader, const CSaveWorld& saveWorld, CAssetId mlvlId); explicit CMapWorldInfo(CBitStreamReader& reader, const CWorldSaveGameInfo& saveWorld, CAssetId mlvlId);
void PutTo(CBitStreamWriter& writer, const CSaveWorld& savw, CAssetId mlvlId) const; void PutTo(CBitStreamWriter& writer, const CWorldSaveGameInfo& savw, CAssetId mlvlId) const;
bool IsMapped(TAreaId aid) const; bool IsMapped(TAreaId aid) const;
void SetIsMapped(TAreaId aid, bool mapped); void SetIsMapped(TAreaId aid, bool mapped);
void SetDoorVisited(TEditorId eid, bool val); void SetDoorVisited(TEditorId eid, bool val);

View File

@ -5,7 +5,7 @@
#include "Runtime/CGameHintInfo.hpp" #include "Runtime/CGameHintInfo.hpp"
#include "Runtime/CGameState.hpp" #include "Runtime/CGameState.hpp"
#include "Runtime/CMemoryCardSys.hpp" #include "Runtime/CMemoryCardSys.hpp"
#include "Runtime/CSaveWorld.hpp" #include "Runtime/CWorldSaveGameInfo.hpp"
#include "Runtime/CSimplePool.hpp" #include "Runtime/CSimplePool.hpp"
#include "Runtime/CStateManager.hpp" #include "Runtime/CStateManager.hpp"
#include "Runtime/GameGlobalObjects.hpp" #include "Runtime/GameGlobalObjects.hpp"
@ -120,7 +120,7 @@ CPersistentOptions::CPersistentOptions(CBitStreamReader& stream) {
const auto& memWorlds = g_MemoryCardSys->GetMemoryWorlds(); const auto& memWorlds = g_MemoryCardSys->GetMemoryWorlds();
size_t cinematicCount = 0; size_t cinematicCount = 0;
for (const auto& world : memWorlds) { for (const auto& world : memWorlds) {
TLockedToken<CSaveWorld> saveWorld = TLockedToken<CWorldSaveGameInfo> saveWorld =
g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), world.second.GetSaveWorldAssetId()}); g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), world.second.GetSaveWorldAssetId()});
cinematicCount += saveWorld->GetCinematicCount(); cinematicCount += saveWorld->GetCinematicCount();
} }
@ -132,7 +132,7 @@ CPersistentOptions::CPersistentOptions(CBitStreamReader& stream) {
} }
for (const auto& world : memWorlds) { for (const auto& world : memWorlds) {
TLockedToken<CSaveWorld> saveWorld = TLockedToken<CWorldSaveGameInfo> saveWorld =
g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), world.second.GetSaveWorldAssetId()}); g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), world.second.GetSaveWorldAssetId()});
auto stateIt = cinematicStates.cbegin(); auto stateIt = cinematicStates.cbegin();
@ -164,7 +164,7 @@ void CPersistentOptions::PutTo(CBitStreamWriter& w) const {
const auto& memWorlds = g_MemoryCardSys->GetMemoryWorlds(); const auto& memWorlds = g_MemoryCardSys->GetMemoryWorlds();
for (const auto& world : memWorlds) { for (const auto& world : memWorlds) {
const TLockedToken<CSaveWorld> saveWorld = const TLockedToken<CWorldSaveGameInfo> saveWorld =
g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), world.second.GetSaveWorldAssetId()}); g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), world.second.GetSaveWorldAssetId()});
for (const auto& cineId : saveWorld->GetCinematics()) { for (const auto& cineId : saveWorld->GetCinematics()) {

View File

@ -4,7 +4,7 @@
#include <string_view> #include <string_view>
#include <vector> #include <vector>
#include "Runtime/CSaveWorld.hpp" #include "Runtime/CWorldSaveGameInfo.hpp"
#include "Runtime/RetroTypes.hpp" #include "Runtime/RetroTypes.hpp"
#include "Runtime/Audio/CAudioSys.hpp" #include "Runtime/Audio/CAudioSys.hpp"

View File

@ -1,7 +1,7 @@
#include "Runtime/CGameState.hpp" #include "Runtime/CGameState.hpp"
#include "Runtime/CMemoryCardSys.hpp" #include "Runtime/CMemoryCardSys.hpp"
#include "Runtime/CSaveWorld.hpp" #include "Runtime/CWorldSaveGameInfo.hpp"
#include "Runtime/CSimplePool.hpp" #include "Runtime/CSimplePool.hpp"
#include "Runtime/GameGlobalObjects.hpp" #include "Runtime/GameGlobalObjects.hpp"
#include "Runtime/IOStreams.hpp" #include "Runtime/IOStreams.hpp"
@ -23,7 +23,7 @@ union BitsToDouble {
double doub; double doub;
}; };
CScriptLayerManager::CScriptLayerManager(CBitStreamReader& reader, const CSaveWorld& saveWorld) { CScriptLayerManager::CScriptLayerManager(CBitStreamReader& reader, const CWorldSaveGameInfo& saveWorld) {
const u32 bitCount = reader.ReadEncoded(10); const u32 bitCount = reader.ReadEncoded(10);
x10_saveLayers.reserve(bitCount); x10_saveLayers.reserve(bitCount);
@ -81,7 +81,7 @@ CWorldState::CWorldState(CAssetId id) : x0_mlvlId(id), x4_areaId(0) {
x14_layerState = std::make_shared<CScriptLayerManager>(); x14_layerState = std::make_shared<CScriptLayerManager>();
} }
CWorldState::CWorldState(CBitStreamReader& reader, CAssetId mlvlId, const CSaveWorld& saveWorld) : x0_mlvlId(mlvlId) { CWorldState::CWorldState(CBitStreamReader& reader, CAssetId mlvlId, const CWorldSaveGameInfo& saveWorld) : x0_mlvlId(mlvlId) {
x4_areaId = TAreaId(reader.ReadEncoded(32)); x4_areaId = TAreaId(reader.ReadEncoded(32));
x10_desiredAreaAssetId = u32(reader.ReadEncoded(32)); x10_desiredAreaAssetId = u32(reader.ReadEncoded(32));
x8_mailbox = std::make_shared<CScriptMailbox>(reader, saveWorld); x8_mailbox = std::make_shared<CScriptMailbox>(reader, saveWorld);
@ -89,7 +89,7 @@ CWorldState::CWorldState(CBitStreamReader& reader, CAssetId mlvlId, const CSaveW
x14_layerState = std::make_shared<CScriptLayerManager>(reader, saveWorld); x14_layerState = std::make_shared<CScriptLayerManager>(reader, saveWorld);
} }
void CWorldState::PutTo(CBitStreamWriter& writer, const CSaveWorld& savw) const { void CWorldState::PutTo(CBitStreamWriter& writer, const CWorldSaveGameInfo& savw) const {
writer.WriteEncoded(x4_areaId, 32); writer.WriteEncoded(x4_areaId, 32);
writer.WriteEncoded(u32(x10_desiredAreaAssetId.Value()), 32); writer.WriteEncoded(u32(x10_desiredAreaAssetId.Value()), 32);
x8_mailbox->PutTo(writer, savw); x8_mailbox->PutTo(writer, savw);
@ -175,7 +175,7 @@ CGameState::CGameState(CBitStreamReader& stream, u32 saveIdx) : x20c_saveFileIdx
const auto& memWorlds = g_MemoryCardSys->GetMemoryWorlds(); const auto& memWorlds = g_MemoryCardSys->GetMemoryWorlds();
x88_worldStates.reserve(memWorlds.size()); x88_worldStates.reserve(memWorlds.size());
for (const auto& memWorld : memWorlds) { for (const auto& memWorld : memWorlds) {
TLockedToken<CSaveWorld> saveWorld = TLockedToken<CWorldSaveGameInfo> saveWorld =
g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), memWorld.second.GetSaveWorldAssetId()}); g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), memWorld.second.GetSaveWorldAssetId()});
x88_worldStates.emplace_back(stream, memWorld.first, *saveWorld); x88_worldStates.emplace_back(stream, memWorld.first, *saveWorld);
} }
@ -236,7 +236,7 @@ void CGameState::PutTo(CBitStreamWriter& writer) {
const auto& memWorlds = g_MemoryCardSys->GetMemoryWorlds(); const auto& memWorlds = g_MemoryCardSys->GetMemoryWorlds();
for (const auto& memWorld : memWorlds) { for (const auto& memWorld : memWorlds) {
TLockedToken<CSaveWorld> saveWorld = TLockedToken<CWorldSaveGameInfo> saveWorld =
g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), memWorld.second.GetSaveWorldAssetId()}); g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), memWorld.second.GetSaveWorldAssetId()});
const CWorldState& wld = StateForWorld(memWorld.first); const CWorldState& wld = StateForWorld(memWorld.first);
wld.PutTo(writer, *saveWorld); wld.PutTo(writer, *saveWorld);

View File

@ -24,7 +24,7 @@ class CScriptLayerManager {
public: public:
CScriptLayerManager() = default; CScriptLayerManager() = default;
CScriptLayerManager(CBitStreamReader& reader, const CSaveWorld& saveWorld); CScriptLayerManager(CBitStreamReader& reader, const CWorldSaveGameInfo& saveWorld);
bool IsLayerActive(int areaIdx, int layerIdx) const { return ((x0_areaLayers[areaIdx].m_layerBits >> layerIdx) & 1); } bool IsLayerActive(int areaIdx, int layerIdx) const { return ((x0_areaLayers[areaIdx].m_layerBits >> layerIdx) & 1); }
@ -53,7 +53,7 @@ class CWorldState {
public: public:
explicit CWorldState(CAssetId id); explicit CWorldState(CAssetId id);
CWorldState(CBitStreamReader& reader, CAssetId mlvlId, const CSaveWorld& saveWorld); CWorldState(CBitStreamReader& reader, CAssetId mlvlId, const CWorldSaveGameInfo& saveWorld);
CAssetId GetWorldAssetId() const { return x0_mlvlId; } CAssetId GetWorldAssetId() const { return x0_mlvlId; }
void SetAreaId(TAreaId aid) { x4_areaId = aid; } void SetAreaId(TAreaId aid) { x4_areaId = aid; }
TAreaId GetCurrentAreaId() const { return x4_areaId; } TAreaId GetCurrentAreaId() const { return x4_areaId; }
@ -62,7 +62,7 @@ public:
const std::shared_ptr<CScriptMailbox>& Mailbox() const { return x8_mailbox; } const std::shared_ptr<CScriptMailbox>& Mailbox() const { return x8_mailbox; }
const std::shared_ptr<CMapWorldInfo>& MapWorldInfo() const { return xc_mapWorldInfo; } const std::shared_ptr<CMapWorldInfo>& MapWorldInfo() const { return xc_mapWorldInfo; }
const std::shared_ptr<CScriptLayerManager>& GetLayerState() const { return x14_layerState; } const std::shared_ptr<CScriptLayerManager>& GetLayerState() const { return x14_layerState; }
void PutTo(CBitStreamWriter& writer, const CSaveWorld& savw) const; void PutTo(CBitStreamWriter& writer, const CWorldSaveGameInfo& savw) const;
}; };
class CGameState { class CGameState {

View File

@ -76,7 +76,7 @@ set(RUNTIME_SOURCES_B
CGameAllocator.hpp CGameAllocator.cpp CGameAllocator.hpp CGameAllocator.cpp
CMemoryCardSys.hpp CMemoryCardSys.cpp CMemoryCardSys.hpp CMemoryCardSys.cpp
CScannableObjectInfo.hpp CScannableObjectInfo.cpp CScannableObjectInfo.hpp CScannableObjectInfo.cpp
CSaveWorld.hpp CSaveWorld.cpp CWorldSaveGameInfo.hpp CWorldSaveGameInfo.cpp
CDependencyGroup.hpp CDependencyGroup.cpp CDependencyGroup.hpp CDependencyGroup.cpp
CBasics.hpp CBasicsPC.cpp CBasics.hpp CBasicsPC.cpp
CIOWin.hpp CIOWin.hpp

View File

@ -128,11 +128,11 @@ bool CMemoryCardSys::InitializePump() {
wldMemOut.xc_areaIds = world.xc_areaIds; wldMemOut.xc_areaIds = world.xc_areaIds;
wldMemOut.x1c_defaultLayerStates = world.x1c_defaultLayerStates; wldMemOut.x1c_defaultLayerStates = world.x1c_defaultLayerStates;
CSaveWorld& savw = *world.x34_saveWorld; CWorldSaveGameInfo& savw = *world.x34_saveWorld;
wldMemOut.x8_areaCount = savw.GetAreaCount(); wldMemOut.x8_areaCount = savw.GetAreaCount();
x20_scanStates.reserve(x20_scanStates.size() + savw.GetScans().size()); x20_scanStates.reserve(x20_scanStates.size() + savw.GetScans().size());
for (const CSaveWorld::SScanState& scan : savw.GetScans()) { for (const CWorldSaveGameInfo::SScanState& scan : savw.GetScans()) {
const auto scanStateIter = std::find_if(x20_scanStates.cbegin(), x20_scanStates.cend(), [&](const auto& test) { const auto scanStateIter = std::find_if(x20_scanStates.cbegin(), x20_scanStates.cend(), [&](const auto& test) {
return test.first == scan.x0_id && test.second == scan.x4_category; return test.first == scan.x0_id && test.second == scan.x4_category;
}); });

View File

@ -6,7 +6,7 @@
#include <vector> #include <vector>
#include "Runtime/CGameHintInfo.hpp" #include "Runtime/CGameHintInfo.hpp"
#include "Runtime/CSaveWorld.hpp" #include "Runtime/CWorldSaveGameInfo.hpp"
#include "Runtime/CToken.hpp" #include "Runtime/CToken.hpp"
#include "Runtime/rstl.hpp" #include "Runtime/rstl.hpp"
#include "Runtime/GuiSys/CStringTable.hpp" #include "Runtime/GuiSys/CStringTable.hpp"
@ -27,7 +27,7 @@ class CSaveWorldMemory {
std::vector<s32> xc_areaIds; std::vector<s32> xc_areaIds;
std::vector<CWorldLayers::Area> x1c_defaultLayerStates; std::vector<CWorldLayers::Area> x1c_defaultLayerStates;
TLockedToken<CStringTable> x2c_worldName; /* used to be optional */ TLockedToken<CStringTable> x2c_worldName; /* used to be optional */
TLockedToken<CSaveWorld> x3c_saveWorld; /* used to be optional */ TLockedToken<CWorldSaveGameInfo> x3c_saveWorld; /* used to be optional */
public: public:
CAssetId GetWorldNameId() const { return x0_strgId; } CAssetId GetWorldNameId() const { return x0_strgId; }
@ -35,7 +35,7 @@ public:
u32 GetAreaCount() const { return x8_areaCount; } u32 GetAreaCount() const { return x8_areaCount; }
const std::vector<CWorldLayers::Area>& GetDefaultLayerStates() const { return x1c_defaultLayerStates; } const std::vector<CWorldLayers::Area>& GetDefaultLayerStates() const { return x1c_defaultLayerStates; }
const TLockedToken<CStringTable>& GetWorldName() const { return x2c_worldName; } const TLockedToken<CStringTable>& GetWorldName() const { return x2c_worldName; }
const TLockedToken<CSaveWorld>& GetSaveWorld() const { return x3c_saveWorld; } const TLockedToken<CWorldSaveGameInfo>& GetSaveWorld() const { return x3c_saveWorld; }
const char16_t* GetFrontEndName() const { const char16_t* GetFrontEndName() const {
if (!x2c_worldName) if (!x2c_worldName)
return u""; return u"";
@ -51,7 +51,7 @@ class CSaveWorldIntermediate {
std::vector<s32> xc_areaIds; std::vector<s32> xc_areaIds;
std::vector<CWorldLayers::Area> x1c_defaultLayerStates; std::vector<CWorldLayers::Area> x1c_defaultLayerStates;
std::unique_ptr<CDummyWorld> x2c_dummyWorld; std::unique_ptr<CDummyWorld> x2c_dummyWorld;
TLockedToken<CSaveWorld> x34_saveWorld; /* Used to be auto_ptr */ TLockedToken<CWorldSaveGameInfo> x34_saveWorld; /* Used to be auto_ptr */
public: public:
CSaveWorldIntermediate(CAssetId mlvl, CAssetId savw); CSaveWorldIntermediate(CAssetId mlvl, CAssetId savw);
@ -63,7 +63,7 @@ class CMemoryCardSys {
TLockedToken<CGameHintInfo> x0_hints; TLockedToken<CGameHintInfo> x0_hints;
std::vector<std::pair<CAssetId, CSaveWorldMemory>> xc_memoryWorlds; /* MLVL as key */ std::vector<std::pair<CAssetId, CSaveWorldMemory>> xc_memoryWorlds; /* MLVL as key */
std::optional<std::vector<CSaveWorldIntermediate>> x1c_worldInter; /* used to be auto_ptr of vector */ std::optional<std::vector<CSaveWorldIntermediate>> x1c_worldInter; /* used to be auto_ptr of vector */
std::vector<std::pair<CAssetId, CSaveWorld::EScanCategory>> x20_scanStates; std::vector<std::pair<CAssetId, CWorldSaveGameInfo::EScanCategory>> x20_scanStates;
rstl::reserved_vector<u32, 6> x30_scanCategoryCounts; rstl::reserved_vector<u32, 6> x30_scanCategoryCounts;
public: public:
@ -92,12 +92,12 @@ public:
using CardStat = kabufuda::CardStat; using CardStat = kabufuda::CardStat;
const std::vector<CGameHintInfo::CGameHint>& GetHints() const { return x0_hints->GetHints(); } const std::vector<CGameHintInfo::CGameHint>& GetHints() const { return x0_hints->GetHints(); }
const std::vector<std::pair<CAssetId, CSaveWorldMemory>>& GetMemoryWorlds() const { return xc_memoryWorlds; } const std::vector<std::pair<CAssetId, CSaveWorldMemory>>& GetMemoryWorlds() const { return xc_memoryWorlds; }
const std::vector<std::pair<CAssetId, CSaveWorld::EScanCategory>>& GetScanStates() const { return x20_scanStates; } const std::vector<std::pair<CAssetId, CWorldSaveGameInfo::EScanCategory>>& GetScanStates() const { return x20_scanStates; }
u32 GetScanCategoryCount(CSaveWorld::EScanCategory cat) const { return x30_scanCategoryCounts[int(cat)]; } u32 GetScanCategoryCount(CWorldSaveGameInfo::EScanCategory cat) const { return x30_scanCategoryCounts[int(cat)]; }
std::vector<std::pair<CAssetId, CSaveWorld::EScanCategory>>::const_iterator LookupScanState(CAssetId id) const { std::vector<std::pair<CAssetId, CWorldSaveGameInfo::EScanCategory>>::const_iterator LookupScanState(CAssetId id) const {
return rstl::binary_find(x20_scanStates.cbegin(), x20_scanStates.cend(), id, return rstl::binary_find(x20_scanStates.cbegin(), x20_scanStates.cend(), id,
[](const std::pair<CAssetId, CSaveWorld::EScanCategory>& p) { return p.first; }); [](const std::pair<CAssetId, CWorldSaveGameInfo::EScanCategory>& p) { return p.first; });
} }
bool HasSaveWorldMemory(CAssetId wldId) const; bool HasSaveWorldMemory(CAssetId wldId) const;

View File

@ -1,6 +1,6 @@
#include "Runtime/CScriptMailbox.hpp" #include "Runtime/CScriptMailbox.hpp"
#include "Runtime/CSaveWorld.hpp" #include "Runtime/CWorldSaveGameInfo.hpp"
#include "Runtime/CStateManager.hpp" #include "Runtime/CStateManager.hpp"
#include "Runtime/World/CWorld.hpp" #include "Runtime/World/CWorld.hpp"
@ -8,7 +8,7 @@
namespace metaforce { namespace metaforce {
CScriptMailbox::CScriptMailbox(CBitStreamReader& in, const CSaveWorld& saveWorld) { CScriptMailbox::CScriptMailbox(CBitStreamReader& in, const CWorldSaveGameInfo& saveWorld) {
const u32 relayCount = saveWorld.GetRelayCount(); const u32 relayCount = saveWorld.GetRelayCount();
if (saveWorld.GetRelayCount()) { if (saveWorld.GetRelayCount()) {
std::vector<bool> relayStates(saveWorld.GetRelayCount()); std::vector<bool> relayStates(saveWorld.GetRelayCount());
@ -79,7 +79,7 @@ void CScriptMailbox::SendMsgs(TAreaId areaId, CStateManager& stateMgr) {
} }
} }
void CScriptMailbox::PutTo(CBitStreamWriter& out, const CSaveWorld& saveWorld) { void CScriptMailbox::PutTo(CBitStreamWriter& out, const CWorldSaveGameInfo& saveWorld) {
const u32 relayCount = saveWorld.GetRelayCount(); const u32 relayCount = saveWorld.GetRelayCount();
std::vector<bool> relays(relayCount); std::vector<bool> relays(relayCount);

View File

@ -7,7 +7,7 @@
#include "Runtime/World/ScriptObjectSupport.hpp" #include "Runtime/World/ScriptObjectSupport.hpp"
namespace metaforce { namespace metaforce {
class CSaveWorld; class CWorldSaveGameInfo;
class CStateManager; class CStateManager;
#if 0 #if 0
@ -29,13 +29,13 @@ class CScriptMailbox {
public: public:
CScriptMailbox() = default; CScriptMailbox() = default;
CScriptMailbox(CBitStreamReader& in, const CSaveWorld& saveWorld); CScriptMailbox(CBitStreamReader& in, const CWorldSaveGameInfo& saveWorld);
bool HasMsg(TEditorId id) const; bool HasMsg(TEditorId id) const;
void AddMsg(TEditorId id); void AddMsg(TEditorId id);
void RemoveMsg(TEditorId id); void RemoveMsg(TEditorId id);
void SendMsgs(TAreaId areaId, CStateManager& stateMgr); void SendMsgs(TAreaId areaId, CStateManager& stateMgr);
void PutTo(CBitStreamWriter& out, const CSaveWorld& saveWorld); void PutTo(CBitStreamWriter& out, const CWorldSaveGameInfo& saveWorld);
}; };
} // namespace metaforce } // namespace metaforce

View File

@ -2870,7 +2870,7 @@ std::pair<u32, u32> CStateManager::CalculateScanCompletionRate() const {
int idx = 0; int idx = 0;
for (const std::pair<CAssetId, float>& scan : x8b8_playerState->GetScanTimes()) { for (const std::pair<CAssetId, float>& scan : x8b8_playerState->GetScanTimes()) {
const auto category = g_MemoryCardSys->GetScanStates()[idx++].second; const auto category = g_MemoryCardSys->GetScanStates()[idx++].second;
if (category != CSaveWorld::EScanCategory::None && category != CSaveWorld::EScanCategory::Research) { if (category != CWorldSaveGameInfo::EScanCategory::None && category != CWorldSaveGameInfo::EScanCategory::Research) {
++denom; ++denom;
if (scan.second == 1.f) { if (scan.second == 1.f) {
++num; ++num;

View File

@ -1,9 +1,9 @@
#include "Runtime/CSaveWorld.hpp" #include "Runtime/CWorldSaveGameInfo.hpp"
#include "Runtime/CToken.hpp" #include "Runtime/CToken.hpp"
namespace metaforce { namespace metaforce {
CSaveWorld::CSaveWorld(CInputStream& in) { CWorldSaveGameInfo::CWorldSaveGameInfo(CInputStream& in) {
in.readUint32Big(); in.readUint32Big();
const u32 version = in.readUint32Big(); const u32 version = in.readUint32Big();
if (version > 1) { if (version > 1) {
@ -51,41 +51,41 @@ CSaveWorld::CSaveWorld(CInputStream& in) {
} }
} }
u32 CSaveWorld::GetAreaCount() const { return x0_areaCount; } u32 CWorldSaveGameInfo::GetAreaCount() const { return x0_areaCount; }
u32 CSaveWorld::GetCinematicCount() const { return x4_cinematics.size(); } u32 CWorldSaveGameInfo::GetCinematicCount() const { return x4_cinematics.size(); }
s32 CSaveWorld::GetCinematicIndex(const TEditorId& id) const { s32 CWorldSaveGameInfo::GetCinematicIndex(const TEditorId& id) const {
auto it = std::find(x4_cinematics.begin(), x4_cinematics.end(), id); auto it = std::find(x4_cinematics.begin(), x4_cinematics.end(), id);
if (it == x4_cinematics.end()) if (it == x4_cinematics.end())
return -1; return -1;
return it - x4_cinematics.begin(); return it - x4_cinematics.begin();
} }
u32 CSaveWorld::GetRelayCount() const { return x14_relays.size(); } u32 CWorldSaveGameInfo::GetRelayCount() const { return x14_relays.size(); }
s32 CSaveWorld::GetRelayIndex(const TEditorId& id) const { s32 CWorldSaveGameInfo::GetRelayIndex(const TEditorId& id) const {
auto it = std::find(x14_relays.begin(), x14_relays.end(), id); auto it = std::find(x14_relays.begin(), x14_relays.end(), id);
if (it == x14_relays.end()) if (it == x14_relays.end())
return -1; return -1;
return it - x14_relays.begin(); return it - x14_relays.begin();
} }
TEditorId CSaveWorld::GetRelayEditorId(u32 idx) const { return x14_relays[idx]; } TEditorId CWorldSaveGameInfo::GetRelayEditorId(u32 idx) const { return x14_relays[idx]; }
u32 CSaveWorld::GetDoorCount() const { return x34_doors.size(); } u32 CWorldSaveGameInfo::GetDoorCount() const { return x34_doors.size(); }
s32 CSaveWorld::GetDoorIndex(const TEditorId& id) const { s32 CWorldSaveGameInfo::GetDoorIndex(const TEditorId& id) const {
auto it = std::find(x34_doors.begin(), x34_doors.end(), id); auto it = std::find(x34_doors.begin(), x34_doors.end(), id);
if (it == x34_doors.end()) if (it == x34_doors.end())
return -1; return -1;
return it - x34_doors.begin(); return it - x34_doors.begin();
} }
CFactoryFnReturn FSaveWorldFactory([[maybe_unused]] const SObjectTag& tag, CInputStream& in, CFactoryFnReturn FWorldSaveGameInfoFactory([[maybe_unused]] const SObjectTag& tag, CInputStream& in,
[[maybe_unused]] const CVParamTransfer& param, [[maybe_unused]] const CVParamTransfer& param,
[[maybe_unused]] CObjectReference* selfRef) { [[maybe_unused]] CObjectReference* selfRef) {
return TToken<CSaveWorld>::GetIObjObjectFor(std::make_unique<CSaveWorld>(in)); return TToken<CWorldSaveGameInfo>::GetIObjObjectFor(std::make_unique<CWorldSaveGameInfo>(in));
} }
} // namespace metaforce } // namespace metaforce

View File

@ -9,7 +9,7 @@
namespace metaforce { namespace metaforce {
class CSaveWorld { class CWorldSaveGameInfo {
public: public:
using EScanCategory = DataSpec::SAVWCommon::EScanCategory; using EScanCategory = DataSpec::SAVWCommon::EScanCategory;
struct SScanState { struct SScanState {
@ -31,7 +31,7 @@ private:
std::vector<SScanState> x44_scans; std::vector<SScanState> x44_scans;
public: public:
explicit CSaveWorld(CInputStream& in); explicit CWorldSaveGameInfo(CInputStream& in);
u32 GetAreaCount() const; u32 GetAreaCount() const;
u32 GetCinematicCount() const; u32 GetCinematicCount() const;
s32 GetCinematicIndex(const TEditorId& id) const; s32 GetCinematicIndex(const TEditorId& id) const;
@ -45,7 +45,7 @@ public:
s32 GetDoorIndex(const TEditorId& id) const; s32 GetDoorIndex(const TEditorId& id) const;
}; };
CFactoryFnReturn FSaveWorldFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& param, CFactoryFnReturn FWorldSaveGameInfoFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& param,
CObjectReference* selfRef); CObjectReference* selfRef);
} // namespace metaforce } // namespace metaforce

View File

@ -5,7 +5,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "Runtime/CSaveWorld.hpp" #include "Runtime/CWorldSaveGameInfo.hpp"
#include "Runtime/CToken.hpp" #include "Runtime/CToken.hpp"
#include "Runtime/RetroTypes.hpp" #include "Runtime/RetroTypes.hpp"
#include "Runtime/GuiSys/CGuiWidget.hpp" #include "Runtime/GuiSys/CGuiWidget.hpp"

View File

@ -32,7 +32,7 @@ class CGuiTableGroup;
class CGuiTextPane; class CGuiTextPane;
class CGuiWidget; class CGuiWidget;
class CMoviePlayer; class CMoviePlayer;
class CSaveWorld; class CWorldSaveGameInfo;
class CStringTable; class CStringTable;
class CTexture; class CTexture;
struct SObjectTag; struct SObjectTag;

View File

@ -29,10 +29,10 @@ CLogBookScreen::~CLogBookScreen() {
CMain::EnsureWorldPakReady(g_GameState->CurrentWorldAssetId()); CMain::EnsureWorldPakReady(g_GameState->CurrentWorldAssetId());
} }
bool CLogBookScreen::IsScanComplete(CSaveWorld::EScanCategory category, CAssetId scan, bool CLogBookScreen::IsScanComplete(CWorldSaveGameInfo::EScanCategory category, CAssetId scan,
const CPlayerState& playerState) { const CPlayerState& playerState) {
const float time = playerState.GetScanTime(scan); const float time = playerState.GetScanTime(scan);
if (category == CSaveWorld::EScanCategory::Artifact) { if (category == CWorldSaveGameInfo::EScanCategory::Artifact) {
return time >= 0.5f; return time >= 0.5f;
} else { } else {
return time >= 1.f; return time >= 1.f;
@ -41,12 +41,12 @@ bool CLogBookScreen::IsScanComplete(CSaveWorld::EScanCategory category, CAssetId
void CLogBookScreen::InitializeLogBook() { void CLogBookScreen::InitializeLogBook() {
for (size_t i = 0; i < x19c_scanCompletes.size(); ++i) { for (size_t i = 0; i < x19c_scanCompletes.size(); ++i) {
x19c_scanCompletes[i].reserve(g_MemoryCardSys->GetScanCategoryCount(CSaveWorld::EScanCategory(i + 1))); x19c_scanCompletes[i].reserve(g_MemoryCardSys->GetScanCategoryCount(CWorldSaveGameInfo::EScanCategory(i + 1)));
} }
CPlayerState& playerState = *x4_mgr.GetPlayerState(); CPlayerState& playerState = *x4_mgr.GetPlayerState();
for (const auto& [scanId, scanCategory] : g_MemoryCardSys->GetScanStates()) { for (const auto& [scanId, scanCategory] : g_MemoryCardSys->GetScanStates()) {
if (scanCategory == CSaveWorld::EScanCategory::None) { if (scanCategory == CWorldSaveGameInfo::EScanCategory::None) {
continue; continue;
} }
@ -164,7 +164,7 @@ void CLogBookScreen::PumpArticleLoad() {
} }
} }
bool CLogBookScreen::IsScanCategoryReady(CSaveWorld::EScanCategory category) const { bool CLogBookScreen::IsScanCategoryReady(CWorldSaveGameInfo::EScanCategory category) const {
const CPlayerState& playerState = *x4_mgr.GetPlayerState(); const CPlayerState& playerState = *x4_mgr.GetPlayerState();
const auto& scanState = g_MemoryCardSys->GetScanStates(); const auto& scanState = g_MemoryCardSys->GetScanStates();
@ -381,7 +381,7 @@ bool CLogBookScreen::VReady() const { return true; }
void CLogBookScreen::VActivate() { void CLogBookScreen::VActivate() {
for (int i = 0; i < int(xa8_textpane_categories.size()); ++i) { for (int i = 0; i < int(xa8_textpane_categories.size()); ++i) {
if (IsScanCategoryReady(CSaveWorld::EScanCategory(i + 1))) { if (IsScanCategoryReady(CWorldSaveGameInfo::EScanCategory(i + 1))) {
xa8_textpane_categories[i]->TextSupport().SetText(xc_pauseStrg.GetString(i + 1)); xa8_textpane_categories[i]->TextSupport().SetText(xc_pauseStrg.GetString(i + 1));
} else { } else {
xa8_textpane_categories[i]->TextSupport().SetText(u"??????"); xa8_textpane_categories[i]->TextSupport().SetText(u"??????");
@ -430,7 +430,7 @@ void CLogBookScreen::UpdateRightTable() {
bool CLogBookScreen::ShouldLeftTableAdvance() const { bool CLogBookScreen::ShouldLeftTableAdvance() const {
if (!x260_24_loaded || x1f0_curViewScans.empty()) if (!x260_24_loaded || x1f0_curViewScans.empty())
return false; return false;
return IsScanCategoryReady(CSaveWorld::EScanCategory(x70_tablegroup_leftlog->GetUserSelection() + 1)); return IsScanCategoryReady(CWorldSaveGameInfo::EScanCategory(x70_tablegroup_leftlog->GetUserSelection() + 1));
} }
bool CLogBookScreen::ShouldRightTableAdvance() const { bool CLogBookScreen::ShouldRightTableAdvance() const {

View File

@ -4,7 +4,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "Runtime/CSaveWorld.hpp" #include "Runtime/CWorldSaveGameInfo.hpp"
#include "Runtime/CToken.hpp" #include "Runtime/CToken.hpp"
#include "Runtime/rstl.hpp" #include "Runtime/rstl.hpp"
#include "Runtime/MP1/CPauseScreenBase.hpp" #include "Runtime/MP1/CPauseScreenBase.hpp"
@ -37,13 +37,13 @@ class CLogBookScreen : public CPauseScreenBase {
void InitializeLogBook(); void InitializeLogBook();
void UpdateRightTitles(); void UpdateRightTitles();
void PumpArticleLoad(); void PumpArticleLoad();
bool IsScanCategoryReady(CSaveWorld::EScanCategory category) const; bool IsScanCategoryReady(CWorldSaveGameInfo::EScanCategory category) const;
void UpdateBodyText(); void UpdateBodyText();
void UpdateBodyImagesAndText(); void UpdateBodyImagesAndText();
int NextSurroundingArticleIndex(int cur) const; int NextSurroundingArticleIndex(int cur) const;
bool IsArtifactCategorySelected() const; bool IsArtifactCategorySelected() const;
int GetSelectedArtifactHeadScanIndex() const; int GetSelectedArtifactHeadScanIndex() const;
static bool IsScanComplete(CSaveWorld::EScanCategory category, CAssetId scan, const CPlayerState& playerState); static bool IsScanComplete(CWorldSaveGameInfo::EScanCategory category, CAssetId scan, const CPlayerState& playerState);
public: public:
CLogBookScreen(const CStateManager& mgr, CGuiFrame& frame, const CStringTable& pauseStrg); CLogBookScreen(const CStateManager& mgr, CGuiFrame& frame, const CStringTable& pauseStrg);

View File

@ -99,7 +99,7 @@ bool CSaveGameScreen::PumpLoad() {
if (!x38_strgMemoryCard.IsLoaded()) { if (!x38_strgMemoryCard.IsLoaded()) {
return false; return false;
} }
for (TLockedToken<CSaveWorld>& savw : x70_saveWorlds) { for (TLockedToken<CWorldSaveGameInfo>& savw : x70_saveWorlds) {
if (!savw.IsLoaded()) { if (!savw.IsLoaded()) {
return false; return false;
} }

View File

@ -13,7 +13,7 @@
namespace metaforce { namespace metaforce {
class CGuiTableGroup; class CGuiTableGroup;
class CGuiTextPane; class CGuiTextPane;
class CSaveWorld; class CWorldSaveGameInfo;
class CStringTable; class CStringTable;
class CTexture; class CTexture;
struct CFinalInput; struct CFinalInput;
@ -75,7 +75,7 @@ private:
CGuiTextPane* x64_textpane_choice2{}; CGuiTextPane* x64_textpane_choice2{};
CGuiTextPane* x68_textpane_choice3{}; CGuiTextPane* x68_textpane_choice3{};
std::unique_ptr<CMemoryCardDriver> x6c_cardDriver; std::unique_ptr<CMemoryCardDriver> x6c_cardDriver;
std::vector<TLockedToken<CSaveWorld>> x70_saveWorlds; std::vector<TLockedToken<CWorldSaveGameInfo>> x70_saveWorlds;
CIOWin::EMessageReturn x80_iowRet = CIOWin::EMessageReturn::Normal; CIOWin::EMessageReturn x80_iowRet = CIOWin::EMessageReturn::Normal;
u32 x84_navConfirmSfx = SFXui_frontend_save_confirm; u32 x84_navConfirmSfx = SFXui_frontend_save_confirm;
u32 x88_navMoveSfx = SFXui_frontend_save_move; u32 x88_navMoveSfx = SFXui_frontend_save_move;

View File

@ -28,7 +28,7 @@
#include "Runtime/CDependencyGroup.hpp" #include "Runtime/CDependencyGroup.hpp"
#include "Runtime/CGameHintInfo.hpp" #include "Runtime/CGameHintInfo.hpp"
#include "Runtime/CSaveWorld.hpp" #include "Runtime/CWorldSaveGameInfo.hpp"
#include "Runtime/CScannableObjectInfo.hpp" #include "Runtime/CScannableObjectInfo.hpp"
#include "Runtime/CStateManager.hpp" #include "Runtime/CStateManager.hpp"
#include "Runtime/CStopwatch.hpp" #include "Runtime/CStopwatch.hpp"
@ -311,7 +311,7 @@ void CGameGlobalObjects::AddPaksAndFactories() {
fmgr->AddFactory(FOURCC('ATBL'), FFactoryFunc(FAudioTranslationTableFactory)); fmgr->AddFactory(FOURCC('ATBL'), FFactoryFunc(FAudioTranslationTableFactory));
fmgr->AddFactory(FOURCC('STRG'), FFactoryFunc(FStringTableFactory)); fmgr->AddFactory(FOURCC('STRG'), FFactoryFunc(FStringTableFactory));
fmgr->AddFactory(FOURCC('HINT'), FFactoryFunc(FHintFactory)); fmgr->AddFactory(FOURCC('HINT'), FFactoryFunc(FHintFactory));
fmgr->AddFactory(FOURCC('SAVW'), FFactoryFunc(FSaveWorldFactory)); fmgr->AddFactory(FOURCC('SAVW'), FFactoryFunc(FWorldSaveGameInfoFactory));
fmgr->AddFactory(FOURCC('MAPW'), FFactoryFunc(FMapWorldFactory)); fmgr->AddFactory(FOURCC('MAPW'), FFactoryFunc(FMapWorldFactory));
fmgr->AddFactory(FOURCC('SCAN'), FFactoryFunc(FScannableObjectInfoFactory)); fmgr->AddFactory(FOURCC('SCAN'), FFactoryFunc(FScannableObjectInfoFactory));
fmgr->AddFactory(FOURCC('CRSC'), FFactoryFunc(FCollisionResponseDataFactory)); fmgr->AddFactory(FOURCC('CRSC'), FFactoryFunc(FCollisionResponseDataFactory));

View File

@ -1245,9 +1245,9 @@ static bool IsDataLoreResearchScan(CAssetId id) {
} }
switch (it->second) { switch (it->second) {
case CSaveWorld::EScanCategory::Data: case CWorldSaveGameInfo::EScanCategory::Data:
case CSaveWorld::EScanCategory::Lore: case CWorldSaveGameInfo::EScanCategory::Lore:
case CSaveWorld::EScanCategory::Research: case CWorldSaveGameInfo::EScanCategory::Research:
return true; return true;
default: default:
return false; return false;