Implmement PoliceState::VTable0x1c (#468)

* Implmement PoliceState::VTable0x1c

* Fixes

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Joshua Peisach 2024-01-20 15:40:00 -05:00 committed by GitHub
parent ea5f9b4886
commit 46ad567760
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 51 additions and 12 deletions

View file

@ -26,6 +26,8 @@ class PoliceState : public LegoState {
// SYNTHETIC: LEGO1 0x1005e920
// PoliceState::`scalar deleting destructor'
virtual MxResult VTable0x1c(LegoFileStream* p_legoFileStream) override; // vtable+0x1C
private:
undefined4 m_unk0x8; // 0x8
undefined4 m_unk0xc; // 0xc

View file

@ -10,3 +10,21 @@ PoliceState::PoliceState()
m_unk0xc = 0;
m_unk0x8 = (rand() % 2 == 0) ? 501 : 500;
}
// FUNCTION: LEGO1 0x1005e990
MxResult PoliceState::VTable0x1c(LegoFileStream* p_legoFileStream)
{
if (p_legoFileStream->IsWriteMode()) {
p_legoFileStream->FUN_10006030(ClassName());
}
if (p_legoFileStream->IsReadMode()) {
p_legoFileStream->Read(&m_unk0x8, sizeof(m_unk0x8));
}
else {
undefined4 unk0x8 = m_unk0x8;
p_legoFileStream->Write(&unk0x8, sizeof(m_unk0x8));
}
return SUCCESS;
}

View file

@ -28,18 +28,6 @@ MxResult TowTrackMissionState::VTable0x1c(LegoFileStream* p_legoFileStream)
}
if (p_legoFileStream->IsReadMode()) {
p_legoFileStream->Write(&m_unk0x12, sizeof(MxU16));
p_legoFileStream->Write(&m_unk0x14, sizeof(MxU16));
p_legoFileStream->Write(&m_unk0x16, sizeof(MxU16));
p_legoFileStream->Write(&m_unk0x18, sizeof(MxU16));
p_legoFileStream->Write(&m_unk0x1a, sizeof(MxU16));
p_legoFileStream->Write(&m_unk0x1c, sizeof(MxU16));
p_legoFileStream->Write(&m_color1, sizeof(MxU16));
p_legoFileStream->Write(&m_color2, sizeof(MxU16));
p_legoFileStream->Write(&m_color3, sizeof(MxU16));
p_legoFileStream->Write(&m_color4, sizeof(MxU16));
}
else if (p_legoFileStream->IsWriteMode()) {
p_legoFileStream->Read(&m_unk0x12, sizeof(MxU16));
p_legoFileStream->Read(&m_unk0x14, sizeof(MxU16));
p_legoFileStream->Read(&m_unk0x16, sizeof(MxU16));
@ -51,6 +39,37 @@ MxResult TowTrackMissionState::VTable0x1c(LegoFileStream* p_legoFileStream)
p_legoFileStream->Read(&m_color3, sizeof(MxU16));
p_legoFileStream->Read(&m_color4, sizeof(MxU16));
}
else if (p_legoFileStream->IsWriteMode()) {
MxU16 write = m_unk0x12;
p_legoFileStream->Write(&write, sizeof(MxU16));
write = m_unk0x14;
p_legoFileStream->Write(&write, sizeof(MxU16));
write = m_unk0x16;
p_legoFileStream->Write(&write, sizeof(MxU16));
write = m_unk0x18;
p_legoFileStream->Write(&write, sizeof(MxU16));
write = m_unk0x1a;
p_legoFileStream->Write(&write, sizeof(MxU16));
write = m_unk0x1c;
p_legoFileStream->Write(&write, sizeof(MxU16));
write = m_color1;
p_legoFileStream->Write(&write, sizeof(MxU16));
write = m_color2;
p_legoFileStream->Write(&write, sizeof(MxU16));
write = m_color3;
p_legoFileStream->Write(&write, sizeof(MxU16));
write = m_color4;
p_legoFileStream->Write(&write, sizeof(MxU16));
}
return SUCCESS;
}