Isle
Loading...
Searching...
No Matches
legoentity.h
Go to the documentation of this file.
1#ifndef LEGOENTITY_H
2#define LEGOENTITY_H
3
4#include "decomp.h"
5#include "extra.h"
6#include "mxentity.h"
7
8class LegoROI;
9class MxDSAction;
10class Vector3;
11
16class LegoEntity : public MxEntity {
17public:
19 enum Type {
20 e_actor = 0,
25 };
26
28 enum {
29 c_bit1 = 0x01,
30 c_managerOwned = 0x02
31 };
32
34 enum {
35 c_altBit1 = 0x01
36 };
37
40
42 // FUNCTION: LEGO1 0x1000c290
43 ~LegoEntity() override { Destroy(TRUE); }
44
48 MxLong Notify(MxParam& p_param) override; // vtable+0x04
49
51 const char* ClassName() const override // vtable+0x0c
52 {
53 // STRING: LEGO1 0x100f0064
54 return "LegoEntity";
55 }
56
59 MxBool IsA(const char* p_name) const override // vtable+0x10
60 {
61 return !strcmp(p_name, LegoEntity::ClassName()) || MxEntity::IsA(p_name);
62 }
63
66 virtual MxResult Create(MxDSAction& p_dsAction); // vtable+0x18
67
70 virtual void Destroy(MxBool p_fromDestructor); // vtable+0x1c
71
74 virtual void ParseAction(char* p_extra); // vtable+0x20
75
80 virtual void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2); // vtable+0x24
81
86 virtual void SetWorldTransform(
87 const Vector3& p_location,
88 const Vector3& p_direction,
89 const Vector3& p_up
90 ); // vtable+0x28
91
94 virtual void ResetWorldTransform(MxBool p_cameraFlag); // vtable+0x2c
95
98 virtual void SetWorldSpeed(MxFloat p_worldSpeed) { m_worldSpeed = p_worldSpeed; } // vtable+0x30
99
102 virtual void ClickSound(MxBool p_und); // vtable+0x34
103
105 virtual void ClickAnimation(); // vtable+0x38
106
108 virtual void SwitchVariant(); // vtable+0x3c
109
111 virtual void SwitchSound(); // vtable+0x40
112
114 virtual void SwitchMove(); // vtable+0x44
115
118 virtual void SwitchColor(LegoROI* p_roi); // vtable+0x48
119
121 virtual void SwitchMood(); // vtable+0x4c
122
124 void FUN_10010c30();
125
128 void SetType(MxU8 p_type);
129
135 void SetLocation(const Vector3& p_location, const Vector3& p_direction, const Vector3& p_up, MxBool p_und);
136
139
142
145
148 MxBool GetUnknown0x10IsSet(MxU8 p_flag) { return m_unk0x10 & p_flag; }
149
152 MxBool GetFlagsIsSet(MxU8 p_flag) { return m_flags & p_flag; }
153
155 MxU8 GetFlags() { return m_flags; }
156
159
161 LegoROI* GetROI() { return m_roi; }
162
164 MxU8 GetType() { return m_type; }
165
168
171 void SetFlags(MxU8 p_flags) { m_flags = p_flags; }
172
175 void SetFlag(MxU8 p_flag) { m_flags |= p_flag; }
176
179 void ClearFlag(MxU8 p_flag) { m_flags &= ~p_flag; }
180
183 void SetUnknown0x10Flag(MxU8 p_flag) { m_unk0x10 |= p_flag; }
184
187 void ClearUnknown0x10Flag(MxU8 p_flag) { m_unk0x10 &= ~p_flag; }
188
189protected:
191 void Init();
192
194 void SetWorld();
195
198
200 MxU8 m_flags; // 0x11
201
204
207
210
213
215 LegoROI* m_roi; // 0x54
216
219
221 MxU8 m_type; // 0x59
222
225
227 // variable name verified by BETA10 0x1007eddf
228 char* m_siFile; // 0x60
229
232};
233
234// SYNTHETIC: LEGO1 0x1000c3b0
235// LegoEntity::`scalar deleting destructor'
236
237#endif // LEGOENTITY_H
[AI] Represents an entity that can be placed and managed in the LEGO Island world.
Definition: legoentity.h:16
MxBool GetUnknown0x10IsSet(MxU8 p_flag)
[AI] Checks if a bit flag in m_unk0x10 is set (purpose: state/animation suppression lock).
Definition: legoentity.h:148
~LegoEntity() override
[AI] Destructor. Cleans up resources and ensures ROI and script state are released....
Definition: legoentity.h:43
void Init()
[AI] Initializes the entity's members to default/neutral values (utility for constructors and resets)...
Definition: legoentity.cpp:24
void SetFlag(MxU8 p_flag)
[AI] Sets the given flag in the flags byte.
Definition: legoentity.h:175
virtual void SetROI(LegoROI *p_roi, MxBool p_bool1, MxBool p_bool2)
[AI] Assigns a 3D ROI (3D object instance) to this entity, controlling how it appears/acts in the wor...
Definition: legoentity.cpp:127
void ClearUnknown0x10Flag(MxU8 p_flag)
[AI] Clears the given bit in the unknown flag byte.
Definition: legoentity.h:187
void SetLocation(const Vector3 &p_location, const Vector3 &p_direction, const Vector3 &p_up, MxBool p_und)
[AI] Sets the world-space location, direction, and up, applying normalization and transformation.
Definition: legoentity.cpp:158
virtual void SwitchSound()
[AI] Triggers a context-dependent audio/sound variant switch for this entity. [AI]
Definition: legoentity.cpp:363
Mx3DPointFloat GetWorldDirection()
[AI] Gets the normalized world-space direction vector, optionally updating from ROI....
Definition: legoentity.cpp:202
virtual void SetWorldSpeed(MxFloat p_worldSpeed)
[AI] Sets the current world speed value for this entity (used to control motion/animation rate).
Definition: legoentity.h:98
virtual void ClickSound(MxBool p_und)
[AI] Plays a click sound, typically in response to user/AI actions, according to entity type.
Definition: legoentity.cpp:266
LegoROI * GetROI()
[AI] Gets the ROI (Realtime Object Instance) associated with this entity. [AI]
Definition: legoentity.h:161
virtual void Destroy(MxBool p_fromDestructor)
[AI] Cleans up the entity, detaching ROI and releasing references.
Definition: legoentity.cpp:94
MxS32 m_targetEntityId
[AI] When parsing ACTION command, this is the target entity ID for the action (or -1 for none)....
Definition: legoentity.h:231
MxBool GetFlagsIsSet(MxU8 p_flag)
[AI] Checks if a flag is set in the primary flags byte (m_flags).
Definition: legoentity.h:152
virtual void SwitchColor(LegoROI *p_roi)
[AI] Switches the color or texture variant for this entity (or target ROI).
Definition: legoentity.cpp:411
MxU8 m_type
[AI] The entity type (Type enum value). [AI]
Definition: legoentity.h:221
const char * ClassName() const override
[AI] Returns the class name string. Used in entity runtime type identification. [AI]
Definition: legoentity.h:51
void SetUnknown0x10Flag(MxU8 p_flag)
[AI] Sets the given bit in the unknown (usually internal action suppression) flag byte.
Definition: legoentity.h:183
Mx3DPointFloat m_worldDirection
[AI] Entity direction vector in world space (normalized). [AI]
Definition: legoentity.h:206
void FUN_10010c30()
[AI] Updates the camera transformation when this entity is the camera target. Used after movement or ...
Definition: legoentity.cpp:192
MxBool m_cameraFlag
[AI] Set to TRUE if this entity is currently the camera target. [AI]
Definition: legoentity.h:218
char * m_siFile
[AI] When parsing ACTION command, this is the SI script/filename to execute (owned,...
Definition: legoentity.h:228
MxU8 GetType()
[AI] Gets the type of this entity (one of the enum Type values). [AI]
Definition: legoentity.h:164
Mx3DPointFloat m_worldLocation
[AI] Entity location in world coordinates. [AI]
Definition: legoentity.h:203
MxU8 GetFlags()
[AI] Returns the value of the flag byte. [AI]
Definition: legoentity.h:155
virtual MxResult Create(MxDSAction &p_dsAction)
[AI] Initializes the entity from a DSAction object, typically from a script or file load.
Definition: legoentity.cpp:84
MxFloat m_worldSpeed
[AI] World-relative speed (can affect animation/movement logic). [AI]
Definition: legoentity.h:212
void ClearFlag(MxU8 p_flag)
[AI] Clears the given flag in the flags byte.
Definition: legoentity.h:179
MxLong Notify(MxParam &p_param) override
[AI] Handles event notification for the entity, most notably user clicks, using polymorphic dispatch.
Definition: legoentity.cpp:466
MxFloat GetWorldSpeed()
[AI] Gets the entity's current world speed state. [AI]
Definition: legoentity.h:158
virtual void ResetWorldTransform(MxBool p_cameraFlag)
[AI] Resets the transformation for this entity (e.g., used with camera transitions).
Definition: legoentity.cpp:41
Mx3DPointFloat m_worldUp
[AI] Entity up vector in world space (normalized). [AI]
Definition: legoentity.h:209
virtual void SwitchMove()
[AI] Switches movement/animation variant for this entity, if applicable (e.g., walking/running state)...
Definition: legoentity.cpp:387
Extra::ActionType m_actionType
[AI] Action type, parsed from script/extra string (e.g., openram/run/exit); guides Notify() and click...
Definition: legoentity.h:224
virtual void SetWorldTransform(const Vector3 &p_location, const Vector3 &p_direction, const Vector3 &p_up)
[AI] Explicitly sets the world transformation (location, direction, up vector) for this entity.
Definition: legoentity.cpp:71
LegoEntity()
[AI] Default constructor. Initializes the LegoEntity with default values. [AI]
Definition: legoentity.h:39
LegoROI * m_roi
[AI] Pointer to this entity's currently assigned ROI (3D instance in the world). [AI]
Definition: legoentity.h:215
MxU8 m_flags
[AI] Primary entity flags (bitfield); tracks per-entity management status, internal update locks,...
Definition: legoentity.h:200
virtual void SwitchMood()
[AI] Triggers a mood/state switch for this entity (if supported), often for characters....
Definition: legoentity.cpp:434
void SetType(MxU8 p_type)
[AI] Sets the entity's type (actor/plant/building/etc.) [AI]
Definition: legoentity.cpp:459
Mx3DPointFloat GetWorldUp()
[AI] Gets the normalized world-space up vector, optionally updating from ROI. [AI]
Definition: legoentity.cpp:213
virtual void SwitchVariant()
[AI] Switches variants for this entity (e.g., different animation, mesh, or texture variant),...
Definition: legoentity.cpp:339
void SetFlags(MxU8 p_flags)
[AI] Sets all entity flags at once (replaces previous).
Definition: legoentity.h:171
virtual void ParseAction(char *p_extra)
[AI] Parses an action description string (usually from script "extra" data) and sets up this entity's...
Definition: legoentity.cpp:236
Type
[AI] Types of LegoEntity (Actor, Plant, Building, Auto ROI, etc.) [AI]
Definition: legoentity.h:19
@ e_plant
[AI] Plant objects in the game (e.g., trees or bushes) [AI]
Definition: legoentity.h:22
@ e_unk1
[AI_SUGGESTED_NAME: e_unknown1] Reserved or unused, purpose unclear [AI]
Definition: legoentity.h:21
@ e_autoROI
[AI] Catchall for ROI-adapted/unknown entities [AI]
Definition: legoentity.h:24
@ e_building
[AI] Building entities, usually interactable or decorations [AI]
Definition: legoentity.h:23
@ e_actor
[AI] Standard character entity controlled by scripts or user [AI]
Definition: legoentity.h:20
@ c_altBit1
[AI] Used to prevent repeat sound/animation actions while one is in progress [AI]
Definition: legoentity.h:35
void SetWorld()
[AI] Registers/attaches this entity to the current world if not already; called on create or location...
Definition: legoentity.cpp:116
MxBool IsA(const char *p_name) const override
[AI] Polymorphic type check for this entity given a string.
Definition: legoentity.h:59
@ c_managerOwned
[AI] Indicates this entity is managed/owned by an entity manager [AI]
Definition: legoentity.h:30
@ c_bit1
[AI] Used internally for ROI/entity ownership tracking [AI]
Definition: legoentity.h:29
virtual void ClickAnimation()
[AI] Plays a context-sensitive click animation, driven by current entity type and state....
Definition: legoentity.cpp:298
MxBool GetCameraFlag()
[AI] Returns whether this entity is flagged as camera (affects world/camera synchronization)....
Definition: legoentity.h:167
MxU8 m_unk0x10
[AI] Unknown state/flag, used mainly to guard against repeated actions or manage animation/sound stat...
Definition: legoentity.h:197
Mx3DPointFloat GetWorldPosition()
[AI] Gets the world-space position vector, optionally updating from ROI. [AI]
Definition: legoentity.cpp:224
[AI] Represents a Real-time Object Instance enriched with LEGO-specific functionality.
Definition: legoroi.h:43
[AI] Represents a 3D point with floating-point precision, inheriting from Vector3.
Definition: mxgeometry3d.h:14
[AI] Represents an action deserialized from SI chunks, holding key animation or script parameters suc...
Definition: mxdsaction.h:17
MxEntity is a base class for game entities which are uniquely identified by an integer ID and an Atom...
Definition: mxentity.h:22
MxBool IsA(const char *p_name) const override
Checks if the object is of the given class name or a parent type.
Definition: mxentity.h:56
[AI] MxParam serves as a polymorphic base class for parameter passing in event and notification syste...
Definition: mxparam.h:7
[AI] 3D vector class, providing vector and cross-product operations in 3D space.
Definition: vector.h:249
#define override
Definition: compat.h:21
#define TRUE
Definition: d3drmdef.h:28
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
int MxLong
[AI]
Definition: mxtypes.h:83
float MxFloat
[AI]
Definition: mxtypes.h:68
unsigned char MxU8
[AI]
Definition: mxtypes.h:8
signed int MxS32
[AI]
Definition: mxtypes.h:38
ActionType
[AI] Enumerates the possible operation types that may appear as actions in the "Extra" key-value stri...
Definition: extra.h:25