mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 00:14:22 +00:00
Match Serialize
functions to BETA10 (#1334)
* Begin refactor Serialize functions
* Match more Serialize functions
* Match `LegoVehicleBuildState::Serialize`
* Match `LegoGameState::Username::Serialize`
* Match `LegoGameState::ScoreItem::Serialize`
* Match `LegoGameState::History::Serialize`
* Var name
* Var name
* Revert "Var name"
This reverts commit 1c0cccfba7
.
* Add other Serialize implementations
* Add remaining Serialize implementations
* Add Read for char*
* Improvements
This commit is contained in:

committed by
GitHub

parent
f95eedd0ce
commit
77a3dc0795
@@ -15,6 +15,7 @@ class MxSoundPresenter;
|
||||
class MxActionNotificationParam;
|
||||
|
||||
// VTABLE: LEGO1 0x100d66e0
|
||||
// VTABLE: BETA10 0x101bb910
|
||||
// SIZE 0x50
|
||||
class LegoVehicleBuildState : public LegoState {
|
||||
public:
|
||||
@@ -32,13 +33,13 @@ public:
|
||||
// FUNCTION: LEGO1 0x10025ff0
|
||||
const char* ClassName() const override // vtable+0x0c
|
||||
{
|
||||
return this->m_className.GetData();
|
||||
return m_className.GetData();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10026000
|
||||
MxBool IsA(const char* p_name) const override // vtable+0x10
|
||||
{
|
||||
return !strcmp(p_name, this->m_className.GetData()) || LegoState::IsA(p_name);
|
||||
return !strcmp(p_name, m_className.GetData()) || LegoState::IsA(p_name);
|
||||
}
|
||||
|
||||
MxResult Serialize(LegoFile* p_file) override; // vtable+0x1c
|
||||
@@ -56,7 +57,7 @@ public:
|
||||
MxString m_className; // 0x38
|
||||
|
||||
AnimationState m_animationState; // 0x48
|
||||
undefined m_unk0x4c; // 0x4c
|
||||
MxU8 m_unk0x4c; // 0x4c
|
||||
MxBool m_unk0x4d; // 0x4d
|
||||
MxBool m_unk0x4e; // 0x4e
|
||||
MxU8 m_placedPartCount; // 0x4f
|
||||
|
@@ -111,7 +111,7 @@ public:
|
||||
Username(Username& p_other) { Set(p_other); }
|
||||
void Set(Username& p_other) { memcpy(m_letters, p_other.m_letters, sizeof(m_letters)); }
|
||||
|
||||
MxResult Serialize(LegoStorage* p_storage);
|
||||
MxResult Serialize(LegoFile* p_file);
|
||||
Username& operator=(const Username& p_other);
|
||||
|
||||
MxS16 m_letters[7]; // 0x00
|
||||
@@ -121,10 +121,10 @@ public:
|
||||
struct ScoreItem {
|
||||
MxResult Serialize(LegoFile* p_file);
|
||||
|
||||
MxS16 m_totalScore; // 0x00
|
||||
MxU8 m_scores[5][5]; // 0x02
|
||||
Username m_name; // 0x1c
|
||||
undefined2 m_unk0x2a; // 0x2a
|
||||
MxS16 m_totalScore; // 0x00
|
||||
MxU8 m_scores[5][5]; // 0x02
|
||||
Username m_name; // 0x1c
|
||||
MxS16 m_unk0x2a; // 0x2a
|
||||
};
|
||||
|
||||
// SIZE 0x372
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
|
||||
MxS16 m_count; // 0x00
|
||||
ScoreItem m_scores[20]; // 0x02
|
||||
undefined2 m_unk0x372; // 0x372
|
||||
MxS16 m_unk0x372; // 0x372
|
||||
};
|
||||
|
||||
LegoGameState();
|
||||
@@ -214,7 +214,7 @@ private:
|
||||
// TODO: Most likely getters/setters are not used according to BETA for the following members:
|
||||
|
||||
public:
|
||||
MxU16 m_unk0x24; // 0x24
|
||||
MxS16 m_unk0x24; // 0x24
|
||||
MxS16 m_playerCount; // 0x26
|
||||
Username m_players[9]; // 0x28
|
||||
History m_history; // 0xa6
|
||||
|
@@ -24,6 +24,7 @@ public:
|
||||
void SetDirection(const Mx3DPointFloat& p_direction) { m_direction = p_direction; }
|
||||
void SetUp(const Mx3DPointFloat& p_up) { m_up = p_up; }
|
||||
|
||||
// TODO: Unclear whether this was defined
|
||||
MxBool IsPresent() { return strcmp(m_name.GetData(), "") != 0; }
|
||||
void Reset() { m_name = ""; }
|
||||
|
||||
@@ -31,22 +32,22 @@ public:
|
||||
MxResult Serialize(LegoFile* p_file)
|
||||
{
|
||||
if (p_file->IsWriteMode()) {
|
||||
p_file->WriteString(m_name);
|
||||
p_file->WriteVector3(m_position);
|
||||
p_file->WriteVector3(m_direction);
|
||||
p_file->WriteVector3(m_up);
|
||||
p_file->Write(MxString(m_name));
|
||||
p_file->Write(m_position);
|
||||
p_file->Write(m_direction);
|
||||
p_file->Write(m_up);
|
||||
}
|
||||
else if (p_file->IsReadMode()) {
|
||||
p_file->ReadString(m_name);
|
||||
p_file->ReadVector3(m_position);
|
||||
p_file->ReadVector3(m_direction);
|
||||
p_file->ReadVector3(m_up);
|
||||
p_file->Read(m_name);
|
||||
p_file->Read(m_position);
|
||||
p_file->Read(m_direction);
|
||||
p_file->Read(m_up);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
private:
|
||||
// private:
|
||||
MxString m_name; // 0x00
|
||||
Mx3DPointFloat m_position; // 0x10
|
||||
Mx3DPointFloat m_direction; // 0x24
|
||||
|
@@ -42,14 +42,17 @@ public:
|
||||
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;
|
||||
|
@@ -18,8 +18,7 @@ public:
|
||||
};
|
||||
|
||||
// SIZE 0x0c
|
||||
class Playlist {
|
||||
public:
|
||||
struct Playlist {
|
||||
enum Mode {
|
||||
e_loop,
|
||||
e_once,
|
||||
@@ -60,21 +59,6 @@ public:
|
||||
MxU32 Next();
|
||||
MxBool Contains(MxU32 p_objectId);
|
||||
|
||||
void SetNextIndex(MxS16 p_nextIndex) { m_nextIndex = p_nextIndex; }
|
||||
|
||||
MxResult ReadFromFile(LegoFile* p_file)
|
||||
{
|
||||
Read(p_file, &m_nextIndex);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
MxResult WriteToFile(LegoFile* p_file)
|
||||
{
|
||||
Write(p_file, m_nextIndex);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
private:
|
||||
MxU32* m_objectIds; // 0x00
|
||||
MxS16 m_length; // 0x04
|
||||
MxS16 m_mode; // 0x06
|
||||
@@ -95,7 +79,7 @@ public:
|
||||
virtual MxResult Serialize(LegoFile* p_file)
|
||||
{
|
||||
if (p_file->IsWriteMode()) {
|
||||
p_file->WriteString(ClassName());
|
||||
p_file->Write(MxString(ClassName()));
|
||||
}
|
||||
return SUCCESS;
|
||||
} // vtable+0x1c
|
||||
|
@@ -93,24 +93,6 @@ public:
|
||||
// FUNCTION: BETA10 0x100ef7e0
|
||||
MxLong GetTimeoutTime() { return m_finishTimes[3]; }
|
||||
|
||||
MxResult WriteToFile(LegoFile* p_file)
|
||||
{
|
||||
Write(p_file, m_unk0x06);
|
||||
Write(p_file, m_unk0x14);
|
||||
Write(p_file, m_score);
|
||||
Write(p_file, m_hiScore);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
MxResult ReadFromFile(LegoFile* p_file)
|
||||
{
|
||||
Read(p_file, &m_unk0x06);
|
||||
Read(p_file, &m_unk0x14);
|
||||
Read(p_file, &m_score);
|
||||
Read(p_file, &m_hiScore);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
MxS16 m_numActions; // 0x00
|
||||
MxU8 m_actorId; // 0x02
|
||||
undefined2 m_unk0x04; // 0x04
|
||||
|
Reference in New Issue
Block a user