This commit is contained in:
Christian Semmler
2025-01-12 13:46:34 -07:00
parent 753db8ddfd
commit d5cca696cb
5 changed files with 57 additions and 58 deletions

View File

@@ -32,15 +32,15 @@ public:
{
if (p_file->IsWriteMode()) {
p_file->Write(MxString(m_name));
p_file->WriteVector3(m_position);
p_file->WriteVector3(m_direction);
p_file->WriteVector3(m_up);
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;

View File

@@ -62,18 +62,6 @@ public:
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

View File

@@ -668,7 +668,7 @@ LegoNamedTexture* ReadNamedTexture(LegoFile* p_file)
LegoNamedTexture* namedTexture = NULL;
MxString string;
p_file->ReadString(string);
p_file->Read(string);
texture = new LegoTexture();
if (texture != NULL) {

View File

@@ -1408,8 +1408,8 @@ MxResult Act1State::Serialize(LegoFile* p_file)
}
}
m_cptClickDialogue.WriteToFile(p_file);
Write(p_file, m_unk0x022);
p_file->Write(m_cptClickDialogue.m_nextIndex);
p_file->Write(m_unk0x022);
}
else if (p_file->IsReadMode()) {
if (m_helicopterPlane.IsPresent()) {
@@ -1465,8 +1465,8 @@ MxResult Act1State::Serialize(LegoFile* p_file)
}
}
m_cptClickDialogue.ReadFromFile(p_file);
Read(p_file, &m_unk0x022);
p_file->Read(m_cptClickDialogue.m_nextIndex);
p_file->Read(m_unk0x022);
}
// TODO

View File

@@ -98,40 +98,6 @@ public:
LegoResult SetPosition(LegoU32 p_position) override; // vtable+0x10
LegoResult Open(const char* p_name, LegoU32 p_mode);
// FUNCTION: LEGO1 0x100343d0
LegoStorage* WriteVector3(Mx3DPointFloat p_vec3)
{
::Write(this, p_vec3[0]);
::Write(this, p_vec3[1]);
::Write(this, p_vec3[2]);
return this;
}
// FUNCTION: LEGO1 0x10034430
LegoStorage* ReadVector3(Mx3DPointFloat& p_vec3)
{
::Read(this, &p_vec3[0]);
::Read(this, &p_vec3[1]);
::Read(this, &p_vec3[2]);
return this;
}
// FUNCTION: LEGO1 0x10034470
LegoStorage* ReadString(MxString& p_str)
{
MxS16 len;
Read(&len, sizeof(MxS16));
char* text = new char[len + 1];
Read(text, len);
text[len] = '\0';
p_str = text;
delete[] text;
return this;
}
// FUNCTION: LEGO1 0x10006030
// FUNCTION: BETA10 0x10017bb0
LegoStorage* Write(MxString p_data)
@@ -178,6 +144,36 @@ public:
return this;
}
LegoStorage* Write(LegoFloat p_data)
{
Write(&p_data, sizeof(p_data));
return this;
}
// FUNCTION: LEGO1 0x100343d0
LegoStorage* Write(Mx3DPointFloat p_vec)
{
Write(p_vec[0]);
Write(p_vec[1]);
Write(p_vec[2]);
return this;
}
// FUNCTION: LEGO1 0x10034470
LegoStorage* Read(MxString& p_data)
{
LegoS16 length;
Read(length);
char* text = new char[length + 1];
Read(text, length);
text[length] = '\0';
p_data = text;
delete[] text;
return this;
}
// FUNCTION: BETA10 0x1004b190
LegoStorage* Read(LegoU8& p_data)
{
@@ -207,6 +203,21 @@ public:
return this;
}
LegoStorage* Read(LegoFloat& p_data)
{
Read(&p_data, sizeof(p_data));
return this;
}
// FUNCTION: LEGO1 0x10034430
LegoStorage* Read(Mx3DPointFloat& p_vec)
{
Read(p_vec[0]);
Read(p_vec[1]);
Read(p_vec[2]);
return this;
}
// SYNTHETIC: LEGO1 0x10099230
// LegoFile::`scalar deleting destructor'