Skip to content

Commit

Permalink
Order symbols in Act1State (#1336)
Browse files Browse the repository at this point in the history
* Order functions in `Act1State`

* Remove IsPresent

* Revert some stuff
  • Loading branch information
foxtacles authored Jan 17, 2025
1 parent 70b0f76 commit e8c856c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 30 deletions.
8 changes: 5 additions & 3 deletions LEGO1/lego/legoomni/include/legonamedplane.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@
#include "mxstring.h"

// SIZE 0x4c
class LegoNamedPlane {
public:
struct LegoNamedPlane {
// FUNCTION: LEGO1 0x10033800
LegoNamedPlane() {}

// FUNCTION: LEGO1 0x10033a70
// LegoNamedPlane::~LegoNamedPlane

// Unclear whether getters/setters were used.
// Act1State::Serialize seems to access `m_name` directly (only matches like that)
// Act1State::PlaceActors though seems to require extensive use of getters to improve

const char* GetName() const { return m_name.GetData(); }
const Mx3DPointFloat& GetPosition() { return m_position; }
const Mx3DPointFloat& GetDirection() { return m_direction; }
Expand Down Expand Up @@ -47,7 +50,6 @@ class LegoNamedPlane {
return SUCCESS;
}

// private:
MxString m_name; // 0x00
Mx3DPointFloat m_position; // 0x10
Mx3DPointFloat m_direction; // 0x24
Expand Down
2 changes: 1 addition & 1 deletion LEGO1/lego/legoomni/include/legopathactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "mxtypes.h"

struct LegoEdge;
class LegoNamedPlane;
struct LegoNamedPlane;
class LegoPathBoundary;
class LegoPathController;
struct LegoPathEdgeContainer;
Expand Down
14 changes: 7 additions & 7 deletions LEGO1/lego/legoomni/src/worlds/isle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1487,12 +1487,12 @@ void Act1State::StopCptClickDialogue()
// FUNCTION: LEGO1 0x100346d0
MxBool Act1State::Reset()
{
m_motocyclePlane.Reset();
m_bikePlane.Reset();
m_skateboardPlane.Reset();
m_motocyclePlane.m_name = "";
m_bikePlane.m_name = "";
m_skateboardPlane.m_name = "";
m_unk0x022 = FALSE;

m_helicopterPlane.Reset();
m_helicopterPlane.m_name = "";
if (m_helicopterWindshield) {
delete m_helicopterWindshield;
m_helicopterWindshield = NULL;
Expand All @@ -1513,7 +1513,7 @@ MxBool Act1State::Reset()
m_helicopter = NULL;
}

m_jetskiPlane.Reset();
m_jetskiPlane.m_name = "";
if (m_jetskiFront) {
delete m_jetskiFront;
m_jetskiFront = NULL;
Expand All @@ -1529,7 +1529,7 @@ MxBool Act1State::Reset()
m_jetski = NULL;
}

m_dunebuggyPlane.Reset();
m_dunebuggyPlane.m_name = "";
if (m_dunebuggyFront) {
delete m_dunebuggyFront;
m_dunebuggyFront = NULL;
Expand All @@ -1540,7 +1540,7 @@ MxBool Act1State::Reset()
m_dunebuggy = NULL;
}

m_racecarPlane.Reset();
m_racecarPlane.m_name = "";
if (m_racecarFront) {
delete m_racecarFront;
m_racecarFront = NULL;
Expand Down
38 changes: 19 additions & 19 deletions LEGO1/lego/sources/misc/legostorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ class LegoStorage {
// FUNCTION: LEGO1 0x10045af0
virtual LegoBool IsReadMode() { return m_mode == c_read; } // vtable+0x18

// FUNCTION: LEGO1 0x10006030
// FUNCTION: BETA10 0x10017bb0
LegoStorage* WriteMxString(MxString p_data)
{
WriteString(p_data.GetData());
return this;
}

// FUNCTION: BETA10 0x10017c80
LegoStorage* WriteString(const char* p_data)
{
Expand Down Expand Up @@ -102,18 +94,11 @@ class LegoStorage {
return this;
}

// FUNCTION: LEGO1 0x10034470
LegoStorage* ReadMxString(MxString& p_data)
// FUNCTION: LEGO1 0x10006030
// FUNCTION: BETA10 0x10017bb0
LegoStorage* WriteMxString(MxString p_data)
{
LegoS16 length;
ReadS16(length);

char* text = new char[length + 1];
Read(text, length);

text[length] = '\0';
p_data = text;
delete[] text;
WriteString(p_data.GetData());
return this;
}

Expand Down Expand Up @@ -178,6 +163,21 @@ class LegoStorage {
return this;
}

// FUNCTION: LEGO1 0x10034470
LegoStorage* ReadMxString(MxString& p_data)
{
LegoS16 length;
ReadS16(length);

char* text = new char[length + 1];
Read(text, length);

text[length] = '\0';
p_data = text;
delete[] text;
return this;
}

// SYNTHETIC: LEGO1 0x10045b00
// LegoStorage::`scalar deleting destructor'

Expand Down
1 change: 1 addition & 0 deletions LEGO1/viewmanager/viewmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class ViewManager {
// FUNCTION: BETA10 0x100576b0
const CompoundObject& GetROIs() { return rois; }

// FUNCTION: BETA10 0x100e1260
void Add(ViewROI* p_roi) { rois.push_back(p_roi); }

// SYNTHETIC: LEGO1 0x100a6000
Expand Down

0 comments on commit e8c856c

Please sign in to comment.