mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-22 16:04:17 +00:00
feat: Implement several ::Serialize functions (#1017)
* feat: Implement many ::Serialize functions * address review comments, part 1 [skip ci] * address review comments, part 2 [skip ci] * review comments (final part) * refactor: Remove Read/Write duplication * fix merge conflict * Match PizzeriaState::Serialize again * Remove unused variable, add LegoVehicleBuildState::Serialize * Implement AnimState::Serialize * fix: Conform with naming scheme * refactor: change names back * refactor: int to MxS32 --------- Co-authored-by: jonschz <jonschz@users.noreply.github.com>
This commit is contained in:
@@ -25,7 +25,7 @@ public:
|
||||
return !strcmp(p_name, AmbulanceMissionState::ClassName()) || LegoState::IsA(p_name);
|
||||
}
|
||||
|
||||
MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c
|
||||
MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c
|
||||
|
||||
inline MxS16 GetHighScore(MxU8 p_actorId)
|
||||
{
|
||||
|
@@ -33,7 +33,7 @@ public:
|
||||
return !strcmp(p_name, GasStationState::ClassName()) || LegoState::IsA(p_name);
|
||||
}
|
||||
|
||||
MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c
|
||||
MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c
|
||||
|
||||
// SYNTHETIC: LEGO1 0x10006290
|
||||
// GasStationState::`scalar deleting destructor'
|
||||
|
@@ -36,7 +36,7 @@ public:
|
||||
return !strcmp(p_name, HospitalState::ClassName()) || LegoState::IsA(p_name);
|
||||
}
|
||||
|
||||
MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c
|
||||
MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c
|
||||
|
||||
// SYNTHETIC: LEGO1 0x100764c0
|
||||
// HospitalState::`scalar deleting destructor'
|
||||
|
@@ -88,8 +88,8 @@ public:
|
||||
return !strcmp(p_name, Act1State::ClassName()) || LegoState::IsA(p_name);
|
||||
}
|
||||
|
||||
MxBool SetFlag() override; // vtable+0x18
|
||||
MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c
|
||||
MxBool SetFlag() override; // vtable+0x18
|
||||
MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c
|
||||
|
||||
void FUN_10034660();
|
||||
void FUN_100346a0();
|
||||
|
@@ -68,8 +68,8 @@ public:
|
||||
return !strcmp(p_name, AnimState::ClassName()) || LegoState::IsA(p_name);
|
||||
}
|
||||
|
||||
MxBool SetFlag() override; // vtable+0x18
|
||||
MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c
|
||||
MxBool SetFlag() override; // vtable+0x18
|
||||
MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c
|
||||
|
||||
void FUN_100651d0(MxU32, AnimInfo*, MxU32&);
|
||||
void FUN_10065240(MxU32, AnimInfo*, MxU32);
|
||||
@@ -79,10 +79,14 @@ public:
|
||||
|
||||
private:
|
||||
undefined4 m_unk0x08; // 0x08
|
||||
// appears to store the length of m_unk0x10
|
||||
undefined4 m_unk0x0c; // 0x0c
|
||||
void* m_unk0x10; // 0x10
|
||||
// dynamically sized array of two-byte elements
|
||||
undefined2* m_unk0x10; // 0x10
|
||||
// appears to store the length of m_unk0x18
|
||||
undefined4 m_unk0x14; // 0x14
|
||||
void* m_unk0x18; // 0x18
|
||||
// dynamically sized array of one-byte elements
|
||||
undefined* m_unk0x18; // 0x18
|
||||
};
|
||||
|
||||
// VTABLE: LEGO1 0x100d8c18
|
||||
|
@@ -22,7 +22,7 @@ public:
|
||||
return !strcmp(p_name, this->m_className.GetData()) || LegoState::IsA(p_name);
|
||||
}
|
||||
|
||||
MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c
|
||||
MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c
|
||||
|
||||
// SYNTHETIC: LEGO1 0x100260a0
|
||||
// LegoVehicleBuildState::`scalar deleting destructor'
|
||||
|
@@ -25,6 +25,22 @@ public:
|
||||
inline MxS16 GetUnknown0x02() { return m_unk0x02; }
|
||||
inline MxS16 GetHighScore() { return m_score; }
|
||||
|
||||
inline MxResult Serialize(LegoFile* p_file)
|
||||
{
|
||||
if (p_file->IsReadMode()) {
|
||||
Read(p_file, &m_id);
|
||||
Read(p_file, &m_unk0x02);
|
||||
Read(p_file, &m_score);
|
||||
}
|
||||
else if (p_file->IsWriteMode()) {
|
||||
Write(p_file, m_id);
|
||||
Write(p_file, m_unk0x02);
|
||||
Write(p_file, m_score);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// TODO: Possibly private
|
||||
MxU8 m_id; // 0x00
|
||||
MxS16 m_unk0x02; // 0x02
|
||||
@@ -46,7 +62,7 @@ public:
|
||||
return !strcmp(p_name, RaceState::ClassName()) || LegoState::IsA(p_name);
|
||||
}
|
||||
|
||||
MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c
|
||||
MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c
|
||||
|
||||
Entry* GetState(MxU8 p_id);
|
||||
|
||||
|
@@ -58,6 +58,18 @@ public:
|
||||
|
||||
inline void SetUnknown0x08(MxS16 p_unk0x08) { m_nextIndex = p_unk0x08; }
|
||||
|
||||
inline MxResult ReadFromFile(LegoFile* p_file)
|
||||
{
|
||||
Read(p_file, &m_nextIndex);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
inline MxResult WriteToFile(LegoFile* p_file)
|
||||
{
|
||||
Write(p_file, m_nextIndex);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
private:
|
||||
MxU32* m_objectIds; // 0x00
|
||||
MxS16 m_length; // 0x04
|
||||
@@ -88,10 +100,10 @@ public:
|
||||
virtual MxBool SetFlag() { return FALSE; } // vtable+0x18
|
||||
|
||||
// FUNCTION: LEGO1 0x10005fb0
|
||||
virtual MxResult Serialize(LegoFile* p_legoFile)
|
||||
virtual MxResult Serialize(LegoFile* p_file)
|
||||
{
|
||||
if (p_legoFile->IsWriteMode()) {
|
||||
p_legoFile->WriteString(ClassName());
|
||||
if (p_file->IsWriteMode()) {
|
||||
p_file->WriteString(ClassName());
|
||||
}
|
||||
return SUCCESS;
|
||||
} // vtable+0x1c
|
||||
|
@@ -15,11 +15,35 @@ public:
|
||||
// SIZE 0x20
|
||||
struct Entry {
|
||||
public:
|
||||
undefined2 m_unk0x00; // 0x00
|
||||
MxU8 m_id; // 0x02
|
||||
undefined m_unk0x03[0x15]; // 0x03
|
||||
MxS16 m_score; // 0x18
|
||||
undefined m_unk0x18[6]; // 0x1a
|
||||
inline MxResult WriteToFile(LegoFile* p_file)
|
||||
{
|
||||
Write(p_file, m_unk0x06);
|
||||
Write(p_file, m_unk0x14);
|
||||
Write(p_file, m_unk0x16);
|
||||
Write(p_file, m_score);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
inline MxResult ReadFromFile(LegoFile* p_file)
|
||||
{
|
||||
Read(p_file, &m_unk0x06);
|
||||
Read(p_file, &m_unk0x14);
|
||||
Read(p_file, &m_unk0x16);
|
||||
Read(p_file, &m_score);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
undefined2 m_unk0x00; // 0x00
|
||||
MxU8 m_id; // 0x02
|
||||
undefined m_unk0x03[3]; // 0x03
|
||||
MxS16 m_unk0x06; // 0x06
|
||||
undefined m_unk0x08[8]; // 0x08
|
||||
MxS16 m_unk0x10; // 0x10
|
||||
MxS16 m_unk0x12; // 0x12
|
||||
MxS16 m_unk0x14; // 0x14
|
||||
MxS16 m_unk0x16; // 0x16
|
||||
MxS16 m_score; // 0x18
|
||||
undefined m_unk0x1a[6]; // 0x1a
|
||||
};
|
||||
|
||||
PizzaMissionState();
|
||||
@@ -37,7 +61,7 @@ public:
|
||||
return !strcmp(p_name, PizzaMissionState::ClassName()) || LegoState::IsA(p_name);
|
||||
}
|
||||
|
||||
MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c
|
||||
MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c
|
||||
|
||||
inline MxS16 GetHighScore(MxU8 p_id) { return GetState(p_id)->m_score; }
|
||||
|
||||
|
@@ -35,7 +35,7 @@ public:
|
||||
return !strcmp(p_name, PizzeriaState::ClassName()) || LegoState::IsA(p_name);
|
||||
}
|
||||
|
||||
MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c
|
||||
MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c
|
||||
|
||||
// SYNTHETIC: LEGO1 0x10017ce0
|
||||
// PizzeriaState::`scalar deleting destructor'
|
||||
|
@@ -31,7 +31,7 @@ public:
|
||||
return !strcmp(p_name, PoliceState::ClassName()) || LegoState::IsA(p_name);
|
||||
}
|
||||
|
||||
MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c
|
||||
MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c
|
||||
|
||||
// SYNTHETIC: LEGO1 0x1005e920
|
||||
// PoliceState::`scalar deleting destructor'
|
||||
|
@@ -24,7 +24,7 @@ public:
|
||||
return !strcmp(p_name, TowTrackMissionState::ClassName()) || LegoState::IsA(p_name);
|
||||
}
|
||||
|
||||
MxResult Serialize(LegoFile* p_legoFile) override; // vtable+0x1c
|
||||
MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c
|
||||
|
||||
inline MxS16 GetHighScore(MxU8 p_id)
|
||||
{
|
||||
|
Reference in New Issue
Block a user