mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-27 02:14:18 +00:00
Begin refactor Serialize functions
This commit is contained in:
@@ -31,7 +31,7 @@ public:
|
||||
MxResult Serialize(LegoFile* p_file)
|
||||
{
|
||||
if (p_file->IsWriteMode()) {
|
||||
p_file->WriteString(m_name);
|
||||
p_file->Write(MxString(m_name));
|
||||
p_file->WriteVector3(m_position);
|
||||
p_file->WriteVector3(m_direction);
|
||||
p_file->WriteVector3(m_up);
|
||||
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
private:
|
||||
// private:
|
||||
MxU32* m_objectIds; // 0x00
|
||||
MxS16 m_length; // 0x04
|
||||
MxS16 m_mode; // 0x06
|
||||
@@ -95,7 +95,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
|
||||
|
||||
@@ -124,12 +124,12 @@ MxResult PizzeriaState::Serialize(LegoFile* p_file)
|
||||
|
||||
if (p_file->IsReadMode()) {
|
||||
for (MxS16 i = 0; i < 5; i++) {
|
||||
m_unk0x08[i].ReadFromFile(p_file);
|
||||
p_file->Read(m_unk0x08[i].m_nextIndex);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (MxS16 i = 0; i < 5; i++) {
|
||||
m_unk0x08[i].WriteToFile(p_file);
|
||||
p_file->Write(m_unk0x08[i].m_nextIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2943,7 +2943,7 @@ MxResult AnimState::Serialize(LegoFile* p_file)
|
||||
// LegoState::Serialize(p_file);
|
||||
// Option 2:
|
||||
if (p_file->IsWriteMode()) {
|
||||
p_file->WriteString(ClassName());
|
||||
p_file->Write(MxString(ClassName()));
|
||||
}
|
||||
|
||||
if (p_file->IsReadMode()) {
|
||||
|
||||
@@ -743,7 +743,7 @@ void WriteDefaultTexture(LegoFile* p_file, const char* p_name)
|
||||
LegoTexture texture;
|
||||
texture.SetImage(image);
|
||||
|
||||
p_file->WriteString(name);
|
||||
p_file->Write(MxString(name));
|
||||
texture.Write(p_file);
|
||||
}
|
||||
else {
|
||||
@@ -760,7 +760,7 @@ void WriteDefaultTexture(LegoFile* p_file, const char* p_name)
|
||||
// FUNCTION: LEGO1 0x1003f8a0
|
||||
void WriteNamedTexture(LegoFile* p_file, LegoNamedTexture* p_namedTexture)
|
||||
{
|
||||
p_file->WriteString(*p_namedTexture->GetName());
|
||||
p_file->Write(MxString(*p_namedTexture->GetName()));
|
||||
p_namedTexture->GetTexture()->Write(p_file);
|
||||
}
|
||||
|
||||
|
||||
@@ -132,16 +132,34 @@ public:
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10006030
|
||||
LegoStorage* WriteString(MxString p_str)
|
||||
// FUNCTION: BETA10 0x10024680
|
||||
LegoStorage* Read(LegoS16& p_data)
|
||||
{
|
||||
const char* data = p_str.GetData();
|
||||
LegoU32 fullLength = strlen(data);
|
||||
Read(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
LegoU16 limitedLength = (LegoU16) fullLength;
|
||||
Write(&limitedLength, sizeof(limitedLength));
|
||||
Write((char*) data, (LegoS16) fullLength);
|
||||
// FUNCTION: LEGO1 0x10006030
|
||||
// FUNCTION: BETA10 0x10017bb0
|
||||
LegoStorage* Write(MxString p_data)
|
||||
{
|
||||
Write(p_data.GetData());
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x10017c80
|
||||
LegoStorage* Write(const char* p_data)
|
||||
{
|
||||
LegoS16 length = strlen(p_data);
|
||||
Write(length);
|
||||
Write(p_data, length);
|
||||
return this;
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x10017ce0
|
||||
LegoStorage* Write(LegoS16 p_data)
|
||||
{
|
||||
Write(&p_data, sizeof(p_data));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user