From d5cca696cbd581d4dc1d318179756c155ef0e289 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Sun, 12 Jan 2025 13:46:34 -0700 Subject: [PATCH] Var name --- LEGO1/lego/legoomni/include/legonamedplane.h | 14 ++-- LEGO1/lego/legoomni/include/legostate.h | 12 --- LEGO1/lego/legoomni/src/common/legoutils.cpp | 2 +- LEGO1/lego/legoomni/src/worlds/isle.cpp | 8 +- LEGO1/lego/sources/misc/legostorage.h | 79 +++++++++++--------- 5 files changed, 57 insertions(+), 58 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legonamedplane.h b/LEGO1/lego/legoomni/include/legonamedplane.h index 9b7ef69c..e86f418c 100644 --- a/LEGO1/lego/legoomni/include/legonamedplane.h +++ b/LEGO1/lego/legoomni/include/legonamedplane.h @@ -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; diff --git a/LEGO1/lego/legoomni/include/legostate.h b/LEGO1/lego/legoomni/include/legostate.h index 10f761e0..93dbca72 100644 --- a/LEGO1/lego/legoomni/include/legostate.h +++ b/LEGO1/lego/legoomni/include/legostate.h @@ -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 diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index 07a43002..d6c7f84c 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -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) { diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 88fa83d7..bfc3faa1 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -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 diff --git a/LEGO1/lego/sources/misc/legostorage.h b/LEGO1/lego/sources/misc/legostorage.h index 74aa6b22..a7dab6d6 100644 --- a/LEGO1/lego/sources/misc/legostorage.h +++ b/LEGO1/lego/sources/misc/legostorage.h @@ -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'