mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-25 17:34:05 +00:00
Fix writing/reading of game state (#834)
* Fix writing/reading of game state * Match existing state serialization functions
This commit is contained in:
committed by
GitHub
parent
26f2dd1e5f
commit
c9db98c4c3
@@ -32,10 +32,10 @@ void AnimState::FUN_10065240(MxU32, AnimInfo*, MxU32)
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100652d0
|
||||
MxResult AnimState::VTable0x1c(LegoFile* p_legoFile)
|
||||
MxResult AnimState::Serialize(LegoFile* p_legoFile)
|
||||
{
|
||||
// TODO
|
||||
return FAILURE;
|
||||
return LegoState::Serialize(p_legoFile);
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100654f0
|
||||
|
||||
@@ -259,11 +259,11 @@ MxResult LegoGameState::Save(MxULong p_slot)
|
||||
|
||||
WriteEndOfVariables(&fileStorage);
|
||||
CharacterManager()->Write(&fileStorage);
|
||||
PlantManager()->Save(&fileStorage);
|
||||
result = BuildingManager()->Save(&fileStorage);
|
||||
PlantManager()->Write(&fileStorage);
|
||||
result = BuildingManager()->Write(&fileStorage);
|
||||
|
||||
for (j = 0; j < m_stateCount; j++) {
|
||||
if (m_stateArray[j]->VTable0x14()) {
|
||||
if (m_stateArray[j]->IsSerializable()) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@@ -271,8 +271,8 @@ MxResult LegoGameState::Save(MxULong p_slot)
|
||||
Write(&fileStorage, count);
|
||||
|
||||
for (j = 0; j < m_stateCount; j++) {
|
||||
if (m_stateArray[j]->VTable0x14()) {
|
||||
m_stateArray[j]->VTable0x1c(&fileStorage);
|
||||
if (m_stateArray[j]->IsSerializable()) {
|
||||
m_stateArray[j]->Serialize(&fileStorage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ MxResult LegoGameState::DeleteState()
|
||||
m_stateArray = NULL;
|
||||
|
||||
for (MxS32 count = 0; count < stateCount; count++) {
|
||||
if (!stateArray[count]->SetFlag() && stateArray[count]->VTable0x14()) {
|
||||
if (!stateArray[count]->SetFlag() && stateArray[count]->IsSerializable()) {
|
||||
delete stateArray[count];
|
||||
}
|
||||
else {
|
||||
@@ -360,10 +360,10 @@ MxResult LegoGameState::Load(MxULong p_slot)
|
||||
if (CharacterManager()->Read(&fileStorage) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
if (PlantManager()->Load(&fileStorage) == FAILURE) {
|
||||
if (PlantManager()->Read(&fileStorage) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
if (BuildingManager()->Load(&fileStorage) == FAILURE) {
|
||||
if (BuildingManager()->Read(&fileStorage) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
if (DeleteState() != SUCCESS) {
|
||||
@@ -389,7 +389,7 @@ MxResult LegoGameState::Load(MxULong p_slot)
|
||||
}
|
||||
}
|
||||
|
||||
state->VTable0x1c(&fileStorage);
|
||||
state->Serialize(&fileStorage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,13 +38,13 @@ void LegoPlantManager::FUN_100263a0(undefined4 p_und)
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10026720
|
||||
void LegoPlantManager::Save(LegoStorage* p_storage)
|
||||
void LegoPlantManager::Write(LegoStorage* p_storage)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100267b0
|
||||
MxResult LegoPlantManager::Load(LegoStorage* p_storage)
|
||||
MxResult LegoPlantManager::Read(LegoStorage* p_storage)
|
||||
{
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -541,6 +541,6 @@ void FUN_1003f540(LegoFile* p_file, const char* p_filename)
|
||||
// FUNCTION: LEGO1 0x1003f8a0
|
||||
void WriteNamedTexture(LegoFile* p_file, LegoNamedTexture* p_texture)
|
||||
{
|
||||
p_file->FUN_10006030(*p_texture->GetName());
|
||||
p_file->WriteString(*p_texture->GetName());
|
||||
p_texture->GetTexture()->Write(p_file);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user