Isle
Loading...
Searching...
No Matches
legorace.h
Go to the documentation of this file.
1#ifndef LEGORACE_H
2#define LEGORACE_H
3
4#include "decomp.h"
5#include "legogamestate.h"
6#include "legoraceactor.h"
7#include "legoracemap.h"
8#include "legostate.h"
9#include "legoworld.h"
10#include "mxgeometry.h"
11#include "mxtypes.h"
12
13class Act1State;
15class LegoPathActor;
19
20// VTABLE: LEGO1 0x100d5e30
21// VTABLE: BETA10 0x101be270
22// SIZE 0x2c
28class RaceState : public LegoState {
29public:
30 // SIZE 0x06
35 struct Entry {
36 public:
41 {
42 m_id = 0;
43 m_unk0x02 = 0;
44 m_score = 0;
45 }
46
52
58
65 {
66 if (p_storage->IsReadMode()) {
67 p_storage->ReadU8(m_id);
68 p_storage->ReadS16(m_unk0x02);
69 p_storage->ReadS16(m_score);
70 }
71 else if (p_storage->IsWriteMode()) {
72 p_storage->WriteU8(m_id);
73 p_storage->WriteS16(m_unk0x02);
74 p_storage->WriteS16(m_score);
75 }
76 else {
77 return FAILURE;
78 }
79
80 return SUCCESS;
81 }
82
83 // TODO: Possibly private [AI]
87 };
88
92 RaceState();
93
98 const char* ClassName() const override // vtable+0x0c
99 {
100 // STRING: LEGO1 0x100f07d0
101 // STRING: BETA10 0x101f1d20
102 return "RaceState";
103 }
104
110 MxBool IsA(const char* p_name) const override // vtable+0x10
111 {
112 return !strcmp(p_name, RaceState::ClassName()) || LegoState::IsA(p_name);
113 }
114
120 MxResult Serialize(LegoStorage* p_storage) override; // vtable+0x1c
121
127 Entry* GetState(MxU8 p_id);
128
129 // SYNTHETIC: LEGO1 0x1000f6f0
130 // RaceState::~RaceState
131
132 // SYNTHETIC: LEGO1 0x100160d0
133 // RaceState::`scalar deleting destructor'
134
135 // TODO: Most likely getters/setters are not used according to BETA. [AI]
136
139};
140
141// VTABLE: LEGO1 0x100d5db0
142// VTABLE: BETA10 0x101be1e0
143// SIZE 0x144
149class LegoRace : public LegoWorld {
150public:
154 LegoRace();
155
159 ~LegoRace() override; // vtable+0x00
160
166 MxLong Notify(MxParam& p_param) override; // vtable+0x04
167
172 static const char* HandlerClassName()
173 {
174 // STRING: LEGO1 0x100f07c4
175 return "LegoRace";
176 }
177
183 MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
184
190 virtual MxLong HandleClick(LegoEventNotificationParam&) = 0; // vtable+0x6c
191
197 virtual MxLong HandlePathStruct(LegoPathStructNotificationParam&) { return 0; } // vtable+0x70
198
204 virtual MxLong HandleEndAction(MxEndActionNotificationParam&) { return 0; } // vtable+0x74
205
210 MxBool Escape() override { return FALSE; } // vtable+0x64
211
216 const char* ClassName() const override // vtable+0x0c
217 {
218 return HandlerClassName();
219 }
220
226 MxBool IsA(const char* p_name) const override // vtable+0x10
227 {
228 return !strcmp(p_name, LegoRace::ClassName()) || LegoWorld::IsA(p_name);
229 }
230
236 virtual MxLong HandleType0Notification(MxNotificationParam&) { return 0; } // vtable+0x78
237
243 virtual void VTable0x7c(LegoRaceMap* p_map, MxU32 p_index) // vtable+0x7c
244 {
245 m_maps[p_index] = p_map;
246 }
247
252 MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c
253
258 void Enable(MxBool p_enable) override; // vtable+0x68
259
260 // SYNTHETIC: LEGO1 0x10015cc0
261 // LegoRace::`scalar deleting destructor'
262
263protected:
278};
279
280#endif // LEGORACE_H
[AI] Holds state and transient gameplay data for the first act on Lego Island.
Definition: isle.h:29
Notification parameter class for LEGO event notifications such as mouse events and modifier keys.
Area
Enumeration of all major in-game locations ("areas") for area/scene management and serialization.
Definition: legogamestate.h:92
[AI] An actor that moves along a predefined path, supporting boundary transitions,...
Definition: legopathactor.h:32
[AI] Specialized notification parameter used for path structure related events in LEGO Island.
[AI] Represents the world-space to screen-space mapping and rendering handler for the interactive rac...
Definition: legoracemap.h:29
[AI] Base class for all race-type LegoWorlds.
Definition: legorace.h:149
const char * ClassName() const override
[AI] Returns the runtime class name ("LegoRace") for type checks.
Definition: legorace.h:216
MxStillPresenter * m_unk0x128
[AI] Unknown, likely for presenting stills during race transitions or cutscenes.
Definition: legorace.h:274
MxResult Create(MxDSAction &p_dsAction) override
[AI] Creates and initializes LegoRace world/logic for a DS action.
Definition: legorace.cpp:40
MxBool Escape() override
[AI] Handles Escape input, which is intentionally disabled in race states for legacy reasons.
Definition: legorace.h:210
MxBool IsA(const char *p_name) const override
[AI] Runtime type check for this class (or parent LegoWorld).
Definition: legorace.h:226
MxLong Notify(MxParam &p_param) override
[AI] Notification callback, dispatches events to various race handlers (click, end action,...
Definition: legorace.cpp:71
virtual MxLong HandlePathStruct(LegoPathStructNotificationParam &)
[AI] Handles "path struct" notifications (such as map changes or logic triggers for race boundaries).
Definition: legorace.h:197
virtual void VTable0x7c(LegoRaceMap *p_map, MxU32 p_index)
[AI] Associates a race map instance to the maps array at the given index.
Definition: legorace.h:243
MxBool VTable0x5c() override
[AI] Indicates that custom "VTable0x5c" logic is enabled (always TRUE for LegoRace,...
Definition: legorace.h:252
MxS32 m_unk0x104
[AI] Unknown (race-specific state/control variable).
Definition: legorace.h:267
virtual MxLong HandleEndAction(MxEndActionNotificationParam &)
[AI] Handles "end action" (e.g., finish line reached, cutscene ended) events for the race state logic...
Definition: legorace.h:204
LegoPathActor * m_pathActor
[AI] User's path actor for the race event.
Definition: legorace.h:272
void Enable(MxBool p_enable) override
[AI] Enables or disables the race world and detaches the user actor if switching away.
Definition: legorace.cpp:102
MxS32 m_unk0x10c
[AI] Unknown (race-specific state/control variable).
Definition: legorace.h:269
RaceState * m_raceState
[AI] Stores persistent race state/results for the race world instance.
Definition: legorace.h:277
MxS32 m_unk0xfc
[AI] Unknown (race-specific state/control variable).
Definition: legorace.h:265
virtual MxLong HandleClick(LegoEventNotificationParam &)=0
[AI] Handles user click events within the race area.
LegoGameState::Area m_destLocation
[AI] Destination location (area to switch to after race/transition).
Definition: legorace.h:271
LegoRace()
[AI] Default constructor.
Definition: legorace.cpp:18
static const char * HandlerClassName()
[AI] Gets the handler class name string for this class ("LegoRace").
Definition: legorace.h:172
virtual MxLong HandleType0Notification(MxNotificationParam &)
[AI] Handles notification of type 0 (specific logic event), can be overridden for custom event proces...
Definition: legorace.h:236
MxRect32 m_unk0x130
[AI] Unknown 32-bit rectangle, possible HUD/viewport region.
Definition: legorace.h:276
LegoRaceMap * m_maps[3]
[AI] Map objects used by this race (main, alternate, or lap variants).
Definition: legorace.h:270
Act1State * m_act1State
[AI] Pointer to Act1State (first act/sequence logic).
Definition: legorace.h:273
MxStillPresenter * m_unk0x12c
[AI] Unknown, likely for presenting stills during race transitions or cutscenes.
Definition: legorace.h:275
MxS32 m_unk0x100
[AI] Unknown (race-specific state/control variable).
Definition: legorace.h:266
~LegoRace() override
[AI] Destructor.
Definition: legorace.cpp:56
MxS32 m_unk0x108
[AI] Unknown (race-specific state/control variable).
Definition: legorace.h:268
MxS32 m_unk0xf8
[AI] Unknown (race-specific state/control variable).
Definition: legorace.h:264
[AI] Base class for game state blocks which encapsulate serializable and/or resettable aspects of the...
Definition: legostate.h:17
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
Abstract base class providing an interface for file-like storage with binary and text read/write oper...
Definition: legostorage.h:16
LegoStorage * WriteU8(LegoU8 p_data)
Writes an 8-bit unsigned value to storage.
Definition: legostorage.h:99
virtual LegoBool IsWriteMode()
Returns TRUE if object was opened in write mode.
Definition: legostorage.h:72
LegoStorage * ReadU8(LegoU8 &p_data)
Reads an 8-bit unsigned value from storage.
Definition: legostorage.h:206
LegoStorage * WriteS16(LegoS16 p_data)
Writes a 16-bit signed value to storage.
Definition: legostorage.h:110
LegoStorage * ReadS16(LegoS16 &p_data)
Reads a 16-bit signed value from storage.
Definition: legostorage.h:217
virtual LegoBool IsReadMode()
Returns TRUE if object was opened in read mode.
Definition: legostorage.h:78
Represents the active 3D world, holding all entity, animation, sound, path, and ROI objects.
Definition: legoworld.h:49
MxBool IsA(const char *p_name) const override
Runtime type checking; checks class hierarchy.
Definition: legoworld.h:153
[AI] Represents an action deserialized from SI chunks, holding key animation or script parameters suc...
Definition: mxdsaction.h:17
[AI] Notification parameter marking the end of an action, specialization of MxActionNotificationParam...
[AI] Parameter object representing a single notification or event, carrying an identifier and sender ...
[AI] MxParam serves as a polymorphic base class for parameter passing in event and notification syste...
Definition: mxparam.h:7
[AI] Rectangle using 32-bit signed integer coordinates.
Definition: mxgeometry.h:706
[AI] Presenter for single still image/bitmap media sources in the game.
[AI] Maintains persistent information about race progress, results, and high scores for up to five ra...
Definition: legorace.h:28
const char * ClassName() const override
[AI] Returns the class name of the RaceState object ("RaceState").
Definition: legorace.h:98
Entry m_state[5]
[AI] Entries for each tracked race/state (IDs 1..5).
Definition: legorace.h:137
MxResult Serialize(LegoStorage *p_storage) override
[AI] Serializes all race state entries to or from the given storage object.
Definition: legorace.cpp:138
MxBool IsA(const char *p_name) const override
[AI] Checks if the object is exactly a RaceState or derived thereof, using class name string comparis...
Definition: legorace.h:110
undefined4 m_unk0x28
[AI] Unknown extra field, always initialized to zero.
Definition: legorace.h:138
Entry * GetState(MxU8 p_id)
[AI] Fetches a race state entry matching the given entry ID, or NULL if not found in the array.
Definition: legorace.cpp:151
RaceState()
[AI] Constructs a RaceState, initializing all races with default values and IDs (1 through 5).
Definition: legorace.cpp:116
#define override
Definition: compat.h:21
#define TRUE
Definition: d3drmdef.h:28
#define FALSE
Definition: d3drmdef.h:27
unsigned int undefined4
Definition: decomp.h:28
#define FAILURE
[AI] Used to indicate a failed operation in result codes.
Definition: legotypes.h:34
#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
int MxLong
[AI]
Definition: mxtypes.h:83
signed short MxS16
[AI]
Definition: mxtypes.h:26
unsigned char MxU8
[AI]
Definition: mxtypes.h:8
signed int MxS32
[AI]
Definition: mxtypes.h:38
unsigned int MxU32
[AI]
Definition: mxtypes.h:32
[AI] Entry for an individual race event/state, holding its identifier, unknown field,...
Definition: legorace.h:35
MxS16 m_unk0x02
[AI] Unknown field (usage unclear).
Definition: legorace.h:85
MxU8 m_id
[AI] Unique race or entry ID (1-based, up to 5).
Definition: legorace.h:84
Entry()
[AI] Default constructor that initializes all fields to zero.
Definition: legorace.h:40
MxResult Serialize(LegoStorage *p_storage)
[AI] Serializes or deserializes the entry using the specified LegoStorage.
Definition: legorace.h:64
MxS16 m_score
[AI] High score for this race/entry.
Definition: legorace.h:86
MxS16 GetHighScore()
[AI] Retrieves the race entry's current high score.
Definition: legorace.h:57
MxS16 GetUnknown0x02()
[AI] Gets the unknown 0x02 field associated with this entry.
Definition: legorace.h:51