Isle
Loading...
Searching...
No Matches
legostate.h
Go to the documentation of this file.
1#ifndef LEGOSTATE_H
2#define LEGOSTATE_H
3
4#include "decomp.h"
5#include "misc/legostorage.h"
6#include "mxcore.h"
7
8// VTABLE: LEGO1 0x100d46c0
9// VTABLE: BETA10 0x101b89d8
10// SIZE 0x08
17class LegoState : public MxCore {
18public:
23 e_grey = 0,
26 e_red
27 };
28
35 // SIZE 0x0c
36 struct Playlist {
40 enum Mode {
45 };
46
50 // FUNCTION: LEGO1 0x10017c00
51 // FUNCTION: BETA10 0x10031dc0
53 {
55 m_length = 0;
56 m_mode = e_loop;
57 m_nextIndex = 0;
58 }
59
66 // FUNCTION: BETA10 0x10031e10
67 Playlist(MxU32* p_objectIds, MxS16 p_length, MxS16 p_mode)
68 {
69 m_objectIds = p_objectIds;
70 m_length = p_length;
71 m_mode = p_mode;
72 m_nextIndex = 0;
73 }
74
81 // FUNCTION: LEGO1 0x10071800
82 // FUNCTION: BETA10 0x10031e70
83 Playlist& operator=(const Playlist& p_playlist)
84 {
85 m_objectIds = p_playlist.m_objectIds;
86 m_length = p_playlist.m_length;
87 m_nextIndex = p_playlist.m_nextIndex;
88 m_mode = p_playlist.m_mode;
89 return *this;
90 }
91
97 MxU32 Next();
98
105 MxBool Contains(MxU32 p_objectId);
106
111 };
112
116 // FUNCTION: LEGO1 0x10005f40
117 ~LegoState() override {}
118
123 // FUNCTION: LEGO1 0x10005f90
124 virtual MxBool IsSerializable() { return TRUE; } // vtable+0x14
125
130 // FUNCTION: LEGO1 0x10005fa0
131 virtual MxBool Reset() { return FALSE; } // vtable+0x18
132
139 // FUNCTION: LEGO1 0x10005fb0
140 // FUNCTION: BETA10 0x10017af0
141 virtual MxResult Serialize(LegoStorage* p_storage)
142 {
143 if (p_storage->IsWriteMode()) {
144 p_storage->WriteMxString(ClassName());
145 }
146 return SUCCESS;
147 } // vtable+0x1c
148
153 // FUNCTION: LEGO1 0x100060d0
154 // FUNCTION: BETA10 0x10017d20
155 const char* ClassName() const override // vtable+0x0c
156 {
157 // STRING: LEGO1 0x100f01b8
158 // STRING: BETA10 0x101dcdac
159 return "LegoState";
160 }
161
167 // FUNCTION: LEGO1 0x100060e0
168 // FUNCTION: BETA10 0x100a9000
169 MxBool IsA(const char* p_name) const override // vtable+0x10
170 {
171 return !strcmp(p_name, LegoState::ClassName()) || MxCore::IsA(p_name);
172 }
173
174 // SYNTHETIC: LEGO1 0x10006160
175 // LegoState::`scalar deleting destructor'
176};
177
178#endif // LEGOSTATE_H
[AI] Base class for game state blocks which encapsulate serializable and/or resettable aspects of the...
Definition: legostate.h:17
virtual MxResult Serialize(LegoStorage *p_storage)
[AI] Serialize state to a storage (for save/load).
Definition: legostate.h:141
virtual MxBool Reset()
[AI] Hook for returning object to default (empty) state; not implemented in this base.
Definition: legostate.h:131
MxBool IsA(const char *p_name) const override
[AI] Tests if this object is of a given class name, directly or through inheritance.
Definition: legostate.h:169
~LegoState() override
[AI] Virtual destructor to allow subclass cleanup.
Definition: legostate.h:117
virtual MxBool IsSerializable()
[AI] Returns if this state can be serialized (for game saving/loading support).
Definition: legostate.h:124
const char * ClassName() const override
[AI] Gets this class's name for RTTI/IsA functionality.
Definition: legostate.h:155
ScoreColor
[AI] Score coloring values for in-game display feedback or logic.
Definition: legostate.h:22
@ e_red
[AI] Warning/critical color (3) [AI]
Definition: legostate.h:26
@ e_yellow
[AI] First colored highlight (1) [AI]
Definition: legostate.h:24
@ e_blue
[AI] Second color, e.g. better score (2) [AI]
Definition: legostate.h:25
@ e_grey
[AI] Default/neutral color (0) [AI]
Definition: legostate.h:23
Abstract base class providing an interface for file-like storage with binary and text read/write oper...
Definition: legostorage.h:16
virtual LegoBool IsWriteMode()
Returns TRUE if object was opened in write mode.
Definition: legostorage.h:72
LegoStorage * WriteMxString(MxString p_data)
Writes a length-prefixed MxString to storage.
Definition: legostorage.h:180
[AI] Base virtual class for all Mindscape engine (Mx) objects.
Definition: mxcore.h:15
virtual MxBool IsA(const char *p_name) const
[AI] Checks whether this object's class type or parents match the given name.
Definition: mxcore.h:46
#define override
Definition: compat.h:21
#define TRUE
Definition: d3drmdef.h:28
#define FALSE
Definition: d3drmdef.h:27
#define NULL
[AI] Null pointer value (C/C++ semantics).
Definition: legotypes.h:26
#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
signed short MxS16
[AI]
Definition: mxtypes.h:26
unsigned int MxU32
[AI]
Definition: mxtypes.h:32
[AI] Playlist structure representing an indexed list of object IDs with next-item selection strategie...
Definition: legostate.h:36
MxBool Contains(MxU32 p_objectId)
[AI] Checks if playlist contains an object ID.
Definition: legostate.cpp:51
MxS16 m_mode
[AI] Selection/iteration mode (as in Mode). [AI]
Definition: legostate.h:109
MxS16 m_length
[AI] Number of IDs in the playlist. [AI]
Definition: legostate.h:108
Playlist(MxU32 *p_objectIds, MxS16 p_length, MxS16 p_mode)
[AI] Initialize a Playlist using specific object IDs, length, and mode.
Definition: legostate.h:67
MxU32 Next()
[AI] Retrieves the object ID at the current position, advances next index according to playlist mode.
Definition: legostate.cpp:10
MxU32 * m_objectIds
[AI] Pointer to array of object IDs. Not owned; just used for lookup. [AI]
Definition: legostate.h:107
Mode
[AI] Playback/select mode for playlist sequencing [AI]
Definition: legostate.h:40
@ e_random
[AI] Pick a random item each time [AI]
Definition: legostate.h:43
@ e_loopSkipFirst
[AI] Repeats items in sequence, but skips first entry after the initial loop [AI]
Definition: legostate.h:44
@ e_loop
[AI] Continue repeating all items in sequence [AI]
Definition: legostate.h:41
@ e_once
[AI] Play all items just one time [AI]
Definition: legostate.h:42
Playlist()
[AI] Initializes playlist with no object IDs and default mode (loop).
Definition: legostate.h:52
Playlist & operator=(const Playlist &p_playlist)
[AI] Assignment operator to copy playlist state (pointers and counters only; does not deep-copy IDs a...
Definition: legostate.h:83
MxS16 m_nextIndex
[AI] Current index for next selection (suitable for sequential/random access). [AI]
Definition: legostate.h:110