mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-20 23:01:16 +00:00
Add other Serialize implementations
This commit is contained in:
parent
3e50893ea4
commit
78ee2de392
@ -42,14 +42,17 @@ class RaceState : public LegoState {
|
||||
MxResult Serialize(LegoFile* p_file)
|
||||
{
|
||||
if (p_file->IsReadMode()) {
|
||||
Read(p_file, &m_id);
|
||||
Read(p_file, &m_unk0x02);
|
||||
Read(p_file, &m_score);
|
||||
p_file->Read(m_id);
|
||||
p_file->Read(m_unk0x02);
|
||||
p_file->Read(m_score);
|
||||
}
|
||||
else if (p_file->IsWriteMode()) {
|
||||
Write(p_file, m_id);
|
||||
Write(p_file, m_unk0x02);
|
||||
Write(p_file, m_score);
|
||||
p_file->Write(m_id);
|
||||
p_file->Write(m_unk0x02);
|
||||
p_file->Write(m_score);
|
||||
}
|
||||
else {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
@ -605,18 +605,25 @@ PizzaMissionState::PizzaMissionState()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100393c0
|
||||
// FUNCTION: BETA10 0x100eebf2
|
||||
MxResult PizzaMissionState::Serialize(LegoFile* p_file)
|
||||
{
|
||||
LegoState::Serialize(p_file);
|
||||
|
||||
if (p_file->IsReadMode()) {
|
||||
for (MxS16 i = 0; i < 5; i++) {
|
||||
m_missions[i].ReadFromFile(p_file);
|
||||
p_file->Read(m_missions[i].m_unk0x06);
|
||||
p_file->Read(m_missions[i].m_unk0x14);
|
||||
p_file->Read(m_missions[i].m_score);
|
||||
p_file->Read(m_missions[i].m_hiScore);
|
||||
}
|
||||
}
|
||||
else if (p_file->IsWriteMode()) {
|
||||
for (MxS16 i = 0; i < 5; i++) {
|
||||
m_missions[i].WriteToFile(p_file);
|
||||
p_file->Write(m_missions[i].m_unk0x06);
|
||||
p_file->Write(m_missions[i].m_unk0x14);
|
||||
p_file->Write(m_missions[i].m_score);
|
||||
p_file->Write(m_missions[i].m_hiScore);
|
||||
}
|
||||
}
|
||||
|
||||
@ -633,6 +640,7 @@ PizzaMissionState::Mission* PizzaMissionState::GetMission(MxU8 p_actorId)
|
||||
}
|
||||
}
|
||||
|
||||
assert("No pizza mission for this character!" == NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -609,33 +609,34 @@ TowTrackMissionState::TowTrackMissionState()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1004dde0
|
||||
// FUNCTION: BETA10 0x100f8720
|
||||
MxResult TowTrackMissionState::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;
|
||||
|
||||
@ -208,15 +208,16 @@ PoliceState::PoliceState()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1005e990
|
||||
// FUNCTION: BETA10 0x100f08b0
|
||||
MxResult PoliceState::Serialize(LegoFile* p_file)
|
||||
{
|
||||
LegoState::Serialize(p_file);
|
||||
|
||||
if (p_file->IsReadMode()) {
|
||||
Read(p_file, &m_policeScript);
|
||||
p_file->Read((MxS32&) m_policeScript);
|
||||
}
|
||||
else {
|
||||
Write(p_file, m_policeScript);
|
||||
p_file->Write((MxS32) m_policeScript);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
@ -136,6 +136,14 @@ class LegoFile : public LegoStorage {
|
||||
return this;
|
||||
}
|
||||
|
||||
// TODO: Type might be different (LegoS32). MxS32 is incompatible with LegoS32.
|
||||
// FUNCTION: BETA10 0x10088540
|
||||
LegoStorage* Write(MxS32 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)
|
||||
@ -195,6 +203,14 @@ class LegoFile : public LegoStorage {
|
||||
return this;
|
||||
}
|
||||
|
||||
// TODO: Type might be different (LegoS32). MxS32 is incompatible with LegoS32.
|
||||
// FUNCTION: BETA10 0x10088580
|
||||
LegoStorage* Read(MxS32& 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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user