mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-26 18:04:06 +00:00
Match more Serialize functions
This commit is contained in:
@@ -646,33 +646,34 @@ AmbulanceMissionState::AmbulanceMissionState()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10037440
|
||||
// FUNCTION: BETA10 0x10024480
|
||||
MxResult AmbulanceMissionState::Serialize(LegoFile* p_file)
|
||||
{
|
||||
LegoState::Serialize(p_file);
|
||||
|
||||
if (p_file->IsReadMode()) {
|
||||
Read(p_file, &m_peScore);
|
||||
Read(p_file, &m_maScore);
|
||||
Read(p_file, &m_paScore);
|
||||
Read(p_file, &m_niScore);
|
||||
Read(p_file, &m_laScore);
|
||||
Read(p_file, &m_peHighScore);
|
||||
Read(p_file, &m_maHighScore);
|
||||
Read(p_file, &m_paHighScore);
|
||||
Read(p_file, &m_niHighScore);
|
||||
Read(p_file, &m_laHighScore);
|
||||
p_file->Read(m_peScore);
|
||||
p_file->Read(m_maScore);
|
||||
p_file->Read(m_paScore);
|
||||
p_file->Read(m_niScore);
|
||||
p_file->Read(m_laScore);
|
||||
p_file->Read(m_peHighScore);
|
||||
p_file->Read(m_maHighScore);
|
||||
p_file->Read(m_paHighScore);
|
||||
p_file->Read(m_niHighScore);
|
||||
p_file->Read(m_laHighScore);
|
||||
}
|
||||
else if (p_file->IsWriteMode()) {
|
||||
Write(p_file, m_peScore);
|
||||
Write(p_file, m_maScore);
|
||||
Write(p_file, m_paScore);
|
||||
Write(p_file, m_niScore);
|
||||
Write(p_file, m_laScore);
|
||||
Write(p_file, m_peHighScore);
|
||||
Write(p_file, m_maHighScore);
|
||||
Write(p_file, m_paHighScore);
|
||||
Write(p_file, m_niHighScore);
|
||||
Write(p_file, m_laHighScore);
|
||||
p_file->Write(m_peScore);
|
||||
p_file->Write(m_maScore);
|
||||
p_file->Write(m_paScore);
|
||||
p_file->Write(m_niScore);
|
||||
p_file->Write(m_laScore);
|
||||
p_file->Write(m_peHighScore);
|
||||
p_file->Write(m_maHighScore);
|
||||
p_file->Write(m_paHighScore);
|
||||
p_file->Write(m_niHighScore);
|
||||
p_file->Write(m_laHighScore);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
@@ -2937,37 +2937,39 @@ void AnimState::InitFromAnims(MxU32 p_animsLength, AnimInfo* p_anims, MxU32 p_ex
|
||||
// FUNCTION: BETA10 0x10046621
|
||||
MxResult AnimState::Serialize(LegoFile* p_file)
|
||||
{
|
||||
// These two are equivalent up to the order of some deallocation.
|
||||
// Choose as needed to get 100 %.
|
||||
// Option 1:
|
||||
// LegoState::Serialize(p_file);
|
||||
// Option 2:
|
||||
if (p_file->IsWriteMode()) {
|
||||
p_file->Write(MxString(ClassName()));
|
||||
}
|
||||
MxResult result = LegoState::Serialize(p_file);
|
||||
|
||||
if (result == SUCCESS) {
|
||||
if (p_file->IsReadMode()) {
|
||||
Read(p_file, &m_extraCharacterId);
|
||||
MxS32 i;
|
||||
|
||||
p_file->Read(m_extraCharacterId);
|
||||
|
||||
if (m_unk0x10) {
|
||||
delete[] m_unk0x10;
|
||||
}
|
||||
|
||||
Read(p_file, &m_unk0x0c);
|
||||
p_file->Read(m_unk0x0c);
|
||||
|
||||
#ifndef BETA10
|
||||
if (m_unk0x0c != 0) {
|
||||
m_unk0x10 = new MxU16[m_unk0x0c];
|
||||
}
|
||||
else {
|
||||
m_unk0x10 = NULL;
|
||||
}
|
||||
#else
|
||||
m_unk0x10 = new MxU16[m_unk0x0c];
|
||||
#endif
|
||||
|
||||
for (MxS32 i = 0; i < m_unk0x0c; i++) {
|
||||
Read(p_file, &m_unk0x10[i]);
|
||||
for (i = 0; i < m_unk0x0c; i++) {
|
||||
p_file->Read(m_unk0x10[i]);
|
||||
}
|
||||
|
||||
// Note that here we read first and then free memory in contrast to above
|
||||
Read(p_file, &m_locationsFlagsLength);
|
||||
p_file->Read(m_locationsFlagsLength);
|
||||
|
||||
#ifndef BETA10
|
||||
if (m_locationsFlags) {
|
||||
delete[] m_locationsFlags;
|
||||
}
|
||||
@@ -2978,26 +2980,32 @@ MxResult AnimState::Serialize(LegoFile* p_file)
|
||||
else {
|
||||
m_locationsFlags = NULL;
|
||||
}
|
||||
#else
|
||||
m_locationsFlags = new MxBool[m_locationsFlagsLength];
|
||||
#endif
|
||||
|
||||
for (MxS32 j = 0; j < m_locationsFlagsLength; j++) {
|
||||
Read(p_file, &m_locationsFlags[j]);
|
||||
for (i = 0; i < m_locationsFlagsLength; i++) {
|
||||
p_file->Read(m_locationsFlags[i]);
|
||||
}
|
||||
}
|
||||
else if (p_file->IsWriteMode()) {
|
||||
Write(p_file, m_extraCharacterId);
|
||||
MxS32 i;
|
||||
|
||||
Write(p_file, m_unk0x0c);
|
||||
for (MxS32 i = 0; i < m_unk0x0c; i++) {
|
||||
Write(p_file, m_unk0x10[i]);
|
||||
p_file->Write(m_extraCharacterId);
|
||||
p_file->Write(m_unk0x0c);
|
||||
|
||||
for (i = 0; i < m_unk0x0c; i++) {
|
||||
p_file->Write(m_unk0x10[i]);
|
||||
}
|
||||
|
||||
Write(p_file, m_locationsFlagsLength);
|
||||
for (MxS32 j = 0; j < m_locationsFlagsLength; j++) {
|
||||
Write(p_file, m_locationsFlags[j]);
|
||||
p_file->Write(m_locationsFlagsLength);
|
||||
for (i = 0; i < m_locationsFlagsLength; i++) {
|
||||
p_file->Write(m_locationsFlags[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
return result;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100654f0
|
||||
|
||||
@@ -513,18 +513,18 @@ MxResult GasStationState::Serialize(LegoFile* p_file)
|
||||
LegoState::Serialize(p_file);
|
||||
|
||||
if (p_file->IsWriteMode()) {
|
||||
Write(p_file, m_pepperAction);
|
||||
Write(p_file, m_mamaAction);
|
||||
Write(p_file, m_papaAction);
|
||||
Write(p_file, m_nickAction);
|
||||
Write(p_file, m_lauraAction);
|
||||
p_file->Write(m_pepperAction);
|
||||
p_file->Write(m_mamaAction);
|
||||
p_file->Write(m_papaAction);
|
||||
p_file->Write(m_nickAction);
|
||||
p_file->Write(m_lauraAction);
|
||||
}
|
||||
else if (p_file->IsReadMode()) {
|
||||
Read(p_file, &m_pepperAction);
|
||||
Read(p_file, &m_mamaAction);
|
||||
Read(p_file, &m_papaAction);
|
||||
Read(p_file, &m_nickAction);
|
||||
Read(p_file, &m_lauraAction);
|
||||
p_file->Read(m_pepperAction);
|
||||
p_file->Read(m_mamaAction);
|
||||
p_file->Read(m_papaAction);
|
||||
p_file->Read(m_nickAction);
|
||||
p_file->Read(m_lauraAction);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
@@ -694,25 +694,26 @@ HospitalState::HospitalState()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10076530
|
||||
// FUNCTION: BETA10 0x1002db26
|
||||
MxResult HospitalState::Serialize(LegoFile* p_file)
|
||||
{
|
||||
LegoState::Serialize(p_file);
|
||||
|
||||
if (p_file->IsWriteMode()) {
|
||||
Write(p_file, m_unk0x0c);
|
||||
Write(p_file, m_unk0x0e);
|
||||
Write(p_file, m_unk0x10);
|
||||
Write(p_file, m_unk0x12);
|
||||
Write(p_file, m_unk0x14);
|
||||
Write(p_file, m_unk0x16);
|
||||
p_file->Write(m_unk0x0c);
|
||||
p_file->Write(m_unk0x0e);
|
||||
p_file->Write(m_unk0x10);
|
||||
p_file->Write(m_unk0x12);
|
||||
p_file->Write(m_unk0x14);
|
||||
p_file->Write(m_unk0x16);
|
||||
}
|
||||
else if (p_file->IsReadMode()) {
|
||||
Read(p_file, &m_unk0x0c);
|
||||
Read(p_file, &m_unk0x0e);
|
||||
Read(p_file, &m_unk0x10);
|
||||
Read(p_file, &m_unk0x12);
|
||||
Read(p_file, &m_unk0x14);
|
||||
Read(p_file, &m_unk0x16);
|
||||
p_file->Read(m_unk0x0c);
|
||||
p_file->Read(m_unk0x0e);
|
||||
p_file->Read(m_unk0x10);
|
||||
p_file->Read(m_unk0x12);
|
||||
p_file->Read(m_unk0x14);
|
||||
p_file->Read(m_unk0x16);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
@@ -132,13 +132,6 @@ public:
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x10024680
|
||||
LegoStorage* Read(LegoS16& p_data)
|
||||
{
|
||||
Read(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10006030
|
||||
// FUNCTION: BETA10 0x10017bb0
|
||||
LegoStorage* Write(MxString p_data)
|
||||
@@ -156,6 +149,13 @@ public:
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x1004b0d0
|
||||
LegoStorage* Write(LegoU8 p_data)
|
||||
{
|
||||
Write(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x10017ce0
|
||||
LegoStorage* Write(LegoS16 p_data)
|
||||
{
|
||||
@@ -163,6 +163,50 @@ public:
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x1004b110
|
||||
LegoStorage* Write(LegoU16 p_data)
|
||||
{
|
||||
Write(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// TODO: Type might be different (LegoU32). MxU32 is incompatible with LegoU32.
|
||||
// FUNCTION: BETA10 0x1004b150
|
||||
LegoStorage* Write(MxU32 p_data)
|
||||
{
|
||||
Write(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x1004b190
|
||||
LegoStorage* Read(LegoU8& p_data)
|
||||
{
|
||||
Read(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x10024680
|
||||
LegoStorage* Read(LegoS16& p_data)
|
||||
{
|
||||
Read(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x1004b1d0
|
||||
LegoStorage* Read(LegoU16& p_data)
|
||||
{
|
||||
Read(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// TODO: Type might be different (LegoU32). MxU32 is incompatible with LegoU32.
|
||||
// FUNCTION: BETA10 0x1004b210
|
||||
LegoStorage* Read(MxU32& p_data)
|
||||
{
|
||||
Read(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
// SYNTHETIC: LEGO1 0x10099230
|
||||
// LegoFile::`scalar deleting destructor'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user