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: LEGO1 0x10037440
|
||||||
|
// FUNCTION: BETA10 0x10024480
|
||||||
MxResult AmbulanceMissionState::Serialize(LegoFile* p_file)
|
MxResult AmbulanceMissionState::Serialize(LegoFile* p_file)
|
||||||
{
|
{
|
||||||
LegoState::Serialize(p_file);
|
LegoState::Serialize(p_file);
|
||||||
|
|
||||||
if (p_file->IsReadMode()) {
|
if (p_file->IsReadMode()) {
|
||||||
Read(p_file, &m_peScore);
|
p_file->Read(m_peScore);
|
||||||
Read(p_file, &m_maScore);
|
p_file->Read(m_maScore);
|
||||||
Read(p_file, &m_paScore);
|
p_file->Read(m_paScore);
|
||||||
Read(p_file, &m_niScore);
|
p_file->Read(m_niScore);
|
||||||
Read(p_file, &m_laScore);
|
p_file->Read(m_laScore);
|
||||||
Read(p_file, &m_peHighScore);
|
p_file->Read(m_peHighScore);
|
||||||
Read(p_file, &m_maHighScore);
|
p_file->Read(m_maHighScore);
|
||||||
Read(p_file, &m_paHighScore);
|
p_file->Read(m_paHighScore);
|
||||||
Read(p_file, &m_niHighScore);
|
p_file->Read(m_niHighScore);
|
||||||
Read(p_file, &m_laHighScore);
|
p_file->Read(m_laHighScore);
|
||||||
}
|
}
|
||||||
else if (p_file->IsWriteMode()) {
|
else if (p_file->IsWriteMode()) {
|
||||||
Write(p_file, m_peScore);
|
p_file->Write(m_peScore);
|
||||||
Write(p_file, m_maScore);
|
p_file->Write(m_maScore);
|
||||||
Write(p_file, m_paScore);
|
p_file->Write(m_paScore);
|
||||||
Write(p_file, m_niScore);
|
p_file->Write(m_niScore);
|
||||||
Write(p_file, m_laScore);
|
p_file->Write(m_laScore);
|
||||||
Write(p_file, m_peHighScore);
|
p_file->Write(m_peHighScore);
|
||||||
Write(p_file, m_maHighScore);
|
p_file->Write(m_maHighScore);
|
||||||
Write(p_file, m_paHighScore);
|
p_file->Write(m_paHighScore);
|
||||||
Write(p_file, m_niHighScore);
|
p_file->Write(m_niHighScore);
|
||||||
Write(p_file, m_laHighScore);
|
p_file->Write(m_laHighScore);
|
||||||
}
|
}
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
|||||||
@@ -2937,67 +2937,75 @@ void AnimState::InitFromAnims(MxU32 p_animsLength, AnimInfo* p_anims, MxU32 p_ex
|
|||||||
// FUNCTION: BETA10 0x10046621
|
// FUNCTION: BETA10 0x10046621
|
||||||
MxResult AnimState::Serialize(LegoFile* p_file)
|
MxResult AnimState::Serialize(LegoFile* p_file)
|
||||||
{
|
{
|
||||||
// These two are equivalent up to the order of some deallocation.
|
MxResult result = LegoState::Serialize(p_file);
|
||||||
// Choose as needed to get 100 %.
|
|
||||||
// Option 1:
|
|
||||||
// LegoState::Serialize(p_file);
|
|
||||||
// Option 2:
|
|
||||||
if (p_file->IsWriteMode()) {
|
|
||||||
p_file->Write(MxString(ClassName()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p_file->IsReadMode()) {
|
if (result == SUCCESS) {
|
||||||
Read(p_file, &m_extraCharacterId);
|
if (p_file->IsReadMode()) {
|
||||||
|
MxS32 i;
|
||||||
|
|
||||||
if (m_unk0x10) {
|
p_file->Read(m_extraCharacterId);
|
||||||
delete[] m_unk0x10;
|
|
||||||
}
|
|
||||||
|
|
||||||
Read(p_file, &m_unk0x0c);
|
if (m_unk0x10) {
|
||||||
if (m_unk0x0c != 0) {
|
delete[] m_unk0x10;
|
||||||
|
}
|
||||||
|
|
||||||
|
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];
|
m_unk0x10 = new MxU16[m_unk0x0c];
|
||||||
}
|
#endif
|
||||||
else {
|
|
||||||
m_unk0x10 = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (MxS32 i = 0; i < m_unk0x0c; i++) {
|
for (i = 0; i < m_unk0x0c; i++) {
|
||||||
Read(p_file, &m_unk0x10[i]);
|
p_file->Read(m_unk0x10[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that here we read first and then free memory in contrast to above
|
// Note that here we read first and then free memory in contrast to above
|
||||||
Read(p_file, &m_locationsFlagsLength);
|
p_file->Read(m_locationsFlagsLength);
|
||||||
|
|
||||||
if (m_locationsFlags) {
|
#ifndef BETA10
|
||||||
delete[] m_locationsFlags;
|
if (m_locationsFlags) {
|
||||||
}
|
delete[] m_locationsFlags;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_locationsFlagsLength != 0) {
|
if (m_locationsFlagsLength != 0) {
|
||||||
|
m_locationsFlags = new MxBool[m_locationsFlagsLength];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_locationsFlags = NULL;
|
||||||
|
}
|
||||||
|
#else
|
||||||
m_locationsFlags = new MxBool[m_locationsFlagsLength];
|
m_locationsFlags = new MxBool[m_locationsFlagsLength];
|
||||||
}
|
#endif
|
||||||
else {
|
|
||||||
m_locationsFlags = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (MxS32 j = 0; j < m_locationsFlagsLength; j++) {
|
for (i = 0; i < m_locationsFlagsLength; i++) {
|
||||||
Read(p_file, &m_locationsFlags[j]);
|
p_file->Read(m_locationsFlags[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (p_file->IsWriteMode()) {
|
||||||
else if (p_file->IsWriteMode()) {
|
MxS32 i;
|
||||||
Write(p_file, m_extraCharacterId);
|
|
||||||
|
|
||||||
Write(p_file, m_unk0x0c);
|
p_file->Write(m_extraCharacterId);
|
||||||
for (MxS32 i = 0; i < m_unk0x0c; i++) {
|
p_file->Write(m_unk0x0c);
|
||||||
Write(p_file, m_unk0x10[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Write(p_file, m_locationsFlagsLength);
|
for (i = 0; i < m_unk0x0c; i++) {
|
||||||
for (MxS32 j = 0; j < m_locationsFlagsLength; j++) {
|
p_file->Write(m_unk0x10[i]);
|
||||||
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
|
// FUNCTION: LEGO1 0x100654f0
|
||||||
|
|||||||
@@ -513,18 +513,18 @@ MxResult GasStationState::Serialize(LegoFile* p_file)
|
|||||||
LegoState::Serialize(p_file);
|
LegoState::Serialize(p_file);
|
||||||
|
|
||||||
if (p_file->IsWriteMode()) {
|
if (p_file->IsWriteMode()) {
|
||||||
Write(p_file, m_pepperAction);
|
p_file->Write(m_pepperAction);
|
||||||
Write(p_file, m_mamaAction);
|
p_file->Write(m_mamaAction);
|
||||||
Write(p_file, m_papaAction);
|
p_file->Write(m_papaAction);
|
||||||
Write(p_file, m_nickAction);
|
p_file->Write(m_nickAction);
|
||||||
Write(p_file, m_lauraAction);
|
p_file->Write(m_lauraAction);
|
||||||
}
|
}
|
||||||
else if (p_file->IsReadMode()) {
|
else if (p_file->IsReadMode()) {
|
||||||
Read(p_file, &m_pepperAction);
|
p_file->Read(m_pepperAction);
|
||||||
Read(p_file, &m_mamaAction);
|
p_file->Read(m_mamaAction);
|
||||||
Read(p_file, &m_papaAction);
|
p_file->Read(m_papaAction);
|
||||||
Read(p_file, &m_nickAction);
|
p_file->Read(m_nickAction);
|
||||||
Read(p_file, &m_lauraAction);
|
p_file->Read(m_lauraAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
|||||||
@@ -694,25 +694,26 @@ HospitalState::HospitalState()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10076530
|
// FUNCTION: LEGO1 0x10076530
|
||||||
|
// FUNCTION: BETA10 0x1002db26
|
||||||
MxResult HospitalState::Serialize(LegoFile* p_file)
|
MxResult HospitalState::Serialize(LegoFile* p_file)
|
||||||
{
|
{
|
||||||
LegoState::Serialize(p_file);
|
LegoState::Serialize(p_file);
|
||||||
|
|
||||||
if (p_file->IsWriteMode()) {
|
if (p_file->IsWriteMode()) {
|
||||||
Write(p_file, m_unk0x0c);
|
p_file->Write(m_unk0x0c);
|
||||||
Write(p_file, m_unk0x0e);
|
p_file->Write(m_unk0x0e);
|
||||||
Write(p_file, m_unk0x10);
|
p_file->Write(m_unk0x10);
|
||||||
Write(p_file, m_unk0x12);
|
p_file->Write(m_unk0x12);
|
||||||
Write(p_file, m_unk0x14);
|
p_file->Write(m_unk0x14);
|
||||||
Write(p_file, m_unk0x16);
|
p_file->Write(m_unk0x16);
|
||||||
}
|
}
|
||||||
else if (p_file->IsReadMode()) {
|
else if (p_file->IsReadMode()) {
|
||||||
Read(p_file, &m_unk0x0c);
|
p_file->Read(m_unk0x0c);
|
||||||
Read(p_file, &m_unk0x0e);
|
p_file->Read(m_unk0x0e);
|
||||||
Read(p_file, &m_unk0x10);
|
p_file->Read(m_unk0x10);
|
||||||
Read(p_file, &m_unk0x12);
|
p_file->Read(m_unk0x12);
|
||||||
Read(p_file, &m_unk0x14);
|
p_file->Read(m_unk0x14);
|
||||||
Read(p_file, &m_unk0x16);
|
p_file->Read(m_unk0x16);
|
||||||
}
|
}
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
|||||||
@@ -132,13 +132,6 @@ public:
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: BETA10 0x10024680
|
|
||||||
LegoStorage* Read(LegoS16& p_data)
|
|
||||||
{
|
|
||||||
Read(&p_data, sizeof(p_data));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10006030
|
// FUNCTION: LEGO1 0x10006030
|
||||||
// FUNCTION: BETA10 0x10017bb0
|
// FUNCTION: BETA10 0x10017bb0
|
||||||
LegoStorage* Write(MxString p_data)
|
LegoStorage* Write(MxString p_data)
|
||||||
@@ -156,6 +149,13 @@ public:
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FUNCTION: BETA10 0x1004b0d0
|
||||||
|
LegoStorage* Write(LegoU8 p_data)
|
||||||
|
{
|
||||||
|
Write(&p_data, sizeof(p_data));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
// FUNCTION: BETA10 0x10017ce0
|
// FUNCTION: BETA10 0x10017ce0
|
||||||
LegoStorage* Write(LegoS16 p_data)
|
LegoStorage* Write(LegoS16 p_data)
|
||||||
{
|
{
|
||||||
@@ -163,6 +163,50 @@ public:
|
|||||||
return this;
|
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
|
// SYNTHETIC: LEGO1 0x10099230
|
||||||
// LegoFile::`scalar deleting destructor'
|
// LegoFile::`scalar deleting destructor'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user