mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-25 01:14:19 +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
@@ -46,11 +46,9 @@ Act1State::Act1State() : m_unk0x00c(0), m_unk0x00e(0), m_unk0x008(NULL), m_unk0x
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10033ac0
|
||||
MxResult Act1State::VTable0x1c(LegoFile* p_legoFile)
|
||||
MxResult Act1State::Serialize(LegoFile* p_legoFile)
|
||||
{
|
||||
if (p_legoFile->IsWriteMode()) {
|
||||
p_legoFile->FUN_10006030(ClassName());
|
||||
}
|
||||
LegoState::Serialize(p_legoFile);
|
||||
|
||||
m_unk0x024.Serialize(p_legoFile);
|
||||
m_unk0x070.Serialize(p_legoFile);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
DECOMP_SIZE_ASSERT(LegoAct2State, 0x10)
|
||||
|
||||
// FUNCTION: LEGO1 0x1000df70
|
||||
MxBool LegoAct2State::VTable0x14()
|
||||
MxBool LegoAct2State::IsSerializable()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
DECOMP_SIZE_ASSERT(Act3State, 0x0c)
|
||||
|
||||
// FUNCTION: LEGO1 0x1000e2f0
|
||||
MxBool Act3State::VTable0x14()
|
||||
MxBool Act3State::IsSerializable()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -45,13 +45,13 @@ void LegoBuildingManager::FUN_1002fb30()
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1002fb80
|
||||
MxResult LegoBuildingManager::Save(LegoStorage* p_storage)
|
||||
MxResult LegoBuildingManager::Write(LegoStorage* p_storage)
|
||||
{
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1002fc10
|
||||
MxResult LegoBuildingManager::Load(LegoStorage* p_storage)
|
||||
MxResult LegoBuildingManager::Read(LegoStorage* p_storage)
|
||||
{
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ LegoVehicleBuildState::LegoVehicleBuildState(char* p_classType)
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10026120
|
||||
MxResult LegoVehicleBuildState::VTable0x1c(LegoFile* p_legoFile)
|
||||
MxResult LegoVehicleBuildState::Serialize(LegoFile* p_legoFile)
|
||||
{
|
||||
// TODO
|
||||
return SUCCESS;
|
||||
return LegoState::Serialize(p_legoFile);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ GasStationState::GasStationState()
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10006300
|
||||
MxResult GasStationState::VTable0x1c(LegoFile* p_legoFile)
|
||||
MxResult GasStationState::Serialize(LegoFile* p_legoFile)
|
||||
{
|
||||
// TODO
|
||||
return SUCCESS;
|
||||
return LegoState::Serialize(p_legoFile);
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10006430
|
||||
|
||||
@@ -20,8 +20,8 @@ AmbulanceMissionState::AmbulanceMissionState()
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10037440
|
||||
MxResult AmbulanceMissionState::VTable0x1c(LegoFile* p_legoFile)
|
||||
MxResult AmbulanceMissionState::Serialize(LegoFile* p_legoFile)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
return LegoState::Serialize(p_legoFile);
|
||||
}
|
||||
|
||||
@@ -14,11 +14,9 @@ HospitalState::HospitalState()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10076530
|
||||
MxResult HospitalState::VTable0x1c(LegoFile* p_legoFile)
|
||||
MxResult HospitalState::Serialize(LegoFile* p_legoFile)
|
||||
{
|
||||
if (p_legoFile->IsWriteMode()) {
|
||||
p_legoFile->FUN_10006030(ClassName());
|
||||
}
|
||||
LegoState::Serialize(p_legoFile);
|
||||
|
||||
if (p_legoFile->IsWriteMode()) {
|
||||
// A write variable needs to be used here, otherwise
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
DECOMP_SIZE_ASSERT(ScoreState, 0x0c)
|
||||
|
||||
// FUNCTION: LEGO1 0x1000de20
|
||||
MxBool ScoreState::VTable0x14()
|
||||
MxBool ScoreState::IsSerializable()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
DECOMP_SIZE_ASSERT(JukeBoxState, 0x10)
|
||||
|
||||
// FUNCTION: LEGO1 0x1000f300
|
||||
MxBool JukeBoxState::VTable0x14()
|
||||
MxBool JukeBoxState::IsSerializable()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ RadioState::RadioState()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1002cf50
|
||||
MxBool RadioState::VTable0x14()
|
||||
MxBool RadioState::IsSerializable()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@ DECOMP_SIZE_ASSERT(PizzaMissionStateEntry, 0x20)
|
||||
DECOMP_SIZE_ASSERT(PizzaMissionState, 0xb0)
|
||||
|
||||
// STUB: LEGO1 0x100393c0
|
||||
MxResult PizzaMissionState::VTable0x1c(LegoFile* p_legoFile)
|
||||
MxResult PizzaMissionState::Serialize(LegoFile* p_legoFile)
|
||||
{
|
||||
// TODO
|
||||
return SUCCESS;
|
||||
return LegoState::Serialize(p_legoFile);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10039510
|
||||
|
||||
@@ -9,8 +9,8 @@ PizzeriaState::PizzeriaState()
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10017da0
|
||||
MxResult PizzeriaState::VTable0x1c(LegoFile* p_legoFile)
|
||||
MxResult PizzeriaState::Serialize(LegoFile* p_legoFile)
|
||||
{
|
||||
// TODO
|
||||
return SUCCESS;
|
||||
return LegoState::Serialize(p_legoFile);
|
||||
}
|
||||
|
||||
@@ -20,11 +20,9 @@ PoliceState::PoliceState()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1005e990
|
||||
MxResult PoliceState::VTable0x1c(LegoFile* p_legoFile)
|
||||
MxResult PoliceState::Serialize(LegoFile* p_legoFile)
|
||||
{
|
||||
if (p_legoFile->IsWriteMode()) {
|
||||
p_legoFile->FUN_10006030(ClassName());
|
||||
}
|
||||
LegoState::Serialize(p_legoFile);
|
||||
|
||||
if (p_legoFile->IsReadMode()) {
|
||||
p_legoFile->Read(&m_policeScript, sizeof(m_policeScript));
|
||||
|
||||
@@ -12,10 +12,10 @@ RaceState::RaceState()
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10016140
|
||||
MxResult RaceState::VTable0x1c(LegoFile* p_legoFile)
|
||||
MxResult RaceState::Serialize(LegoFile* p_legoFile)
|
||||
{
|
||||
// TODO
|
||||
return SUCCESS;
|
||||
return LegoState::Serialize(p_legoFile);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10016280
|
||||
|
||||
@@ -21,11 +21,9 @@ TowTrackMissionState::TowTrackMissionState()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1004dde0
|
||||
MxResult TowTrackMissionState::VTable0x1c(LegoFile* p_legoFile)
|
||||
MxResult TowTrackMissionState::Serialize(LegoFile* p_legoFile)
|
||||
{
|
||||
if (p_legoFile->IsWriteMode()) {
|
||||
p_legoFile->FUN_10006030(this->ClassName());
|
||||
}
|
||||
LegoState::Serialize(p_legoFile);
|
||||
|
||||
if (p_legoFile->IsReadMode()) {
|
||||
p_legoFile->Read(&m_unk0x12, sizeof(m_unk0x12));
|
||||
|
||||
Reference in New Issue
Block a user