Isle
Loading...
Searching...
No Matches
legonamedplane.h
Go to the documentation of this file.
1#ifndef LEGONAMEDPLANE_H
2#define LEGONAMEDPLANE_H
3
4#include "misc/legostorage.h"
6#include "mxstring.h"
7
8// SIZE 0x4c
9
24
25 // FUNCTION: LEGO1 0x10033a70
26 // LegoNamedPlane::~LegoNamedPlane
31 // Unclear whether getters/setters were used.
32 // Act1State::Serialize seems to access `m_name` directly (only matches like that)
33 // Act1State::PlaceActors though seems to require extensive use of getters to improve
38 const char* GetName() const { return m_name.GetData(); }
39
45
51
56 const Mx3DPointFloat& GetUp() { return m_up; }
57
62 void SetName(const char* p_name) { m_name = p_name; }
63
68 void SetPosition(const Mx3DPointFloat& p_position) { m_position = p_position; }
69
74 void SetDirection(const Mx3DPointFloat& p_direction) { m_direction = p_direction; }
75
80 void SetUp(const Mx3DPointFloat& p_up) { m_up = p_up; }
81
89 MxBool IsPresent() { return strcmp(m_name.GetData(), "") != 0; }
90
94 void Reset() { m_name = ""; }
95
106 {
107 if (p_storage->IsWriteMode()) {
108 p_storage->WriteMxString(m_name);
109 p_storage->WriteVector(m_position);
110 p_storage->WriteVector(m_direction);
111 p_storage->WriteVector(m_up);
112 }
113 else if (p_storage->IsReadMode()) {
114 p_storage->ReadMxString(m_name);
115 p_storage->ReadVector(m_position);
116 p_storage->ReadVector(m_direction);
117 p_storage->ReadVector(m_up);
118 }
119
120 return SUCCESS;
121 }
122
127
132
137
142};
143
144#endif // LEGONAMEDPLANE_H
Abstract base class providing an interface for file-like storage with binary and text read/write oper...
Definition: legostorage.h:16
LegoStorage * WriteVector(Mx3DPointFloat p_data)
Writes a 3D vector (three floats) to storage.
Definition: legostorage.h:167
LegoStorage * ReadMxString(MxString &p_data)
Reads a length-prefixed string and stores it in an MxString object.
Definition: legostorage.h:287
LegoStorage * ReadVector(Mx3DPointFloat &p_data)
Reads a 3D vector (three floats) from storage.
Definition: legostorage.h:274
virtual LegoBool IsWriteMode()
Returns TRUE if object was opened in write mode.
Definition: legostorage.h:72
virtual LegoBool IsReadMode()
Returns TRUE if object was opened in read mode.
Definition: legostorage.h:78
LegoStorage * WriteMxString(MxString p_data)
Writes a length-prefixed MxString to storage.
Definition: legostorage.h:180
[AI] Represents a 3D point with floating-point precision, inheriting from Vector3.
Definition: mxgeometry3d.h:14
Mindscape custom string class for managing dynamic C-strings within the game engine.
Definition: mxstring.h:14
char * GetData() const
Returns a pointer to the internal character buffer.
Definition: mxstring.h:110
#define SUCCESS
[AI] Used to indicate a successful operation in result codes.
Definition: legotypes.h:30
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
[AI] Represents a named 3D plane with orientation and position, used to describe places or camera tar...
void SetUp(const Mx3DPointFloat &p_up)
[AI] Set the "up" vector of the plane.
const char * GetName() const
[AI] Default destructor (implementation likely trivial).
void Reset()
[AI] Reset the plane to "not present" by clearing its name.
void SetName(const char *p_name)
[AI] Set the name identifier for this plane.
const Mx3DPointFloat & GetPosition()
[AI] Get the 3D position of this plane in world coordinates.
MxString m_name
[AI] Name identifier for this plane (used for lookups and scripting).
LegoNamedPlane()
[AI] Default constructor that initializes an unnamed plane.
MxResult Serialize(LegoStorage *p_storage)
[AI] Serialize or deserialize the plane data to or from a LegoStorage object.
Mx3DPointFloat m_direction
[AI] Direction (forward/facing) vector for the plane orientation.
MxBool IsPresent()
[AI] Determines whether the plane instance is valid (present) based on its name.
const Mx3DPointFloat & GetDirection()
[AI] Get the normalized direction (forward) vector of the plane.
const Mx3DPointFloat & GetUp()
[AI] Get the normalized "up" vector of the plane, defining its orientation.
Mx3DPointFloat m_up
[AI] "Up" vector for the plane, defines its local up direction.
Mx3DPointFloat m_position
[AI] 3D position of the plane in world space.
void SetDirection(const Mx3DPointFloat &p_direction)
[AI] Set the direction (forward) vector of the plane.
void SetPosition(const Mx3DPointFloat &p_position)
[AI] Set the 3D position of the plane.