28 m_placedPartCount = 0;
39 m_mainSourceId =
NULL;
47 for (
MxS16 i = 0; i < m_numberOfParts; i++) {
58 delete[] m_mainSourceId;
63inline void LegoCarBuildAnimPresenter::Beta10Inline0x100733d0()
68 if (m_unk0x13c < time) {
74 m_unk0x13c = time + 400;
77 m_unk0x13c = time + 200;
81 m_unk0x13c &= ~c_bit1;
87 if (m_placedPartCount < m_numberOfParts) {
98 if (name && stricmp(wiredName, name) == 0) {
123 if (m_unk0x140->
GetROI()) {
130 Beta10Inline0x100733d0();
185 if (!m_unk0x140->
GetROI()) {
190 assert(m_mainSourceId);
193 m_mainSourceId[strlen(m_mainSourceId) - 1] =
'M';
198 m_placedPartCount = 10;
203 for (i = 0; i < m_numberOfParts; i++) {
204 if (m_placedPartCount == i) {
211 if (i < m_placedPartCount) {
222 if (roi && roi->
GetName() && (strcmpi(name, roi->
GetName()) == 0)) {
231 assert(videoManager);
241 for (i = 0; i < totalNodes; i++) {
244 if (strnicmp(animNodeData->
GetName(),
"CAM", strlen(
"CAM")) == 0) {
246 fov = atof(&animNodeData->
GetName()[strlen(animNodeData->
GetName()) - 2]);
263 dirVec[0] = targetPosition[0] - cameraPosition[0];
264 dirVec[1] = targetPosition[1] - cameraPosition[1];
265 dirVec[2] = targetPosition[2] - cameraPosition[2];
271 lego3dview->
Moved(*videoManagerROI);
296 p_storage->
ReadS16(m_placedPartCount);
298 for (
MxS16 i = 0; i < m_numberOfParts; i++) {
300 p_storage->
ReadString(m_parts[i].m_wiredName);
301 p_storage->
ReadS16(m_parts[i].m_objectId);
305 p_storage->
WriteS16(m_placedPartCount);
307 for (
MxS16 i = 0; i < m_numberOfParts; i++) {
310 p_storage->
WriteS16(m_parts[i].m_objectId);
321 SwapNodesByName(m_parts[p_index].m_wiredName, m_parts[p_index].m_name);
331 if (stricmp(p_name1, p_name2) != 0) {
335 strcpy(buffer, node1->
GetName());
337 strcpy(node2->
GetName(), buffer);
358 for (i = 0; i < totalNodes; i++) {
383 assert(m_numberOfParts);
387 for (i = 0; i < totalNodes; i++) {
396 assert(m_parts[name[strlen(name)-1] -
'A'].m_wiredName);
399 strcpy(m_parts[name[strlen(name) - 1] -
'A'].m_wiredName, name);
405 for (i = 0; i < totalNodes; i++) {
408 for (
MxS16 ii = 0; ii < m_numberOfParts; ii++) {
409 if (strnicmp(m_parts[ii].m_wiredName, name, strlen(name) - 2) == 0) {
411 assert(m_parts[ii].m_name);
412 strcpy(m_parts[ii].m_name, name);
415 if (m_numberOfParts == counter) {
489 if (stricmp(data->
GetName(), p_name) == 0) {
515 if (stricmp(data->
GetName(), p_name) == 0) {
538 if (strcmpi(m_parts[m_placedPartCount].m_name, p_name) != 0) {
539 for (i = m_placedPartCount + 1; i < m_numberOfParts; i++) {
540 if (stricmp(m_parts[i].m_name, p_name) == 0) {
545 strcpy(buffer, m_parts[m_placedPartCount].m_name);
546 strcpy(m_parts[m_placedPartCount].m_name, m_parts[i].m_name);
547 strcpy(m_parts[i].m_name, buffer);
548 Swap(m_parts[m_placedPartCount].m_objectId, m_parts[i].m_objectId);
555 if (m_placedPartCount < m_numberOfParts) {
568 currentRotation(rotationKey->
GetX(), rotationKey->
GetY(), rotationKey->
GetZ(), rotationKey->
GetAngle());
575 if (newRotation[3] < 0.9999) {
587 if (m_unk0x140->
GetROI()) {
597 if (m_unk0x12c >= m_unk0x134) {
599 m_unk0x12c = m_unk0x130;
602 else if (m_unk0x12c >= m_unk0x138 + m_unk0x130) {
603 m_unk0x130 = m_unk0x138 + m_unk0x130;
604 m_unk0x12c = m_unk0x130;
608 m_unk0x12c = m_unk0x138 / 10.0f + m_unk0x12c;
616 return stricmp(p_string,
"PLATFORM") == 0;
623 return (p_param[strlen(p_param) - 2] ==
'W') || (p_param[strlen(p_param) - 2] ==
'w');
630 return (p_string[strlen(p_string) - 2] ==
'N') || (p_string[strlen(p_string) - 2] ==
'n') ||
631 (p_string[strlen(p_string) - 2] ==
'Y') || (p_string[strlen(p_string) - 2] ==
'y');
638 return strnicmp(p_string,
"SHELF", strlen(
"SHELF")) == 0;
649 return m_placedPartCount < m_numberOfParts &&
650 strnicmp(p_name, m_parts[m_placedPartCount].m_name, strlen(p_name) - 3) == 0;
657 for (
MxS16 i = 0; i < m_placedPartCount; i++) {
658 if (strcmpi(p_name, m_parts[i].m_name) == 0) {
670 return (p_string[strlen(p_string) - 2] ==
'Y') || (p_string[strlen(p_string) - 2] ==
'y');
677 return (p_string[strlen(p_string) - 1] !=
'0');
684 for (
MxS16 i = 0; i < m_numberOfParts; i++) {
685 if (strcmpi(p_name, m_parts[i].m_name) == 0) {
697 for (
MxS16 i = 0; i < m_numberOfParts; i++) {
698 if (strcmpi(p_name, m_parts[i].m_name) == 0) {
[AI] Represents a bounding sphere in 3D space with center and radius.
int SetFrustrum(float p_fov, float p_front, float p_back)
[AI] Sets the 3D perspective frustum parameters for camera and view.
Lego3DView * GetLego3DView()
[AI] Returns the encapsulated Lego3DView instance.
[AI] Represents a 3D view for rendering and managing LEGO game objects in a 3D scene.
BOOL Moved(ViewROI &rROI)
[AI] Notifies the view that a ViewROI has moved.
void FUN_100739a0(MxS32 p_param)
[AI] Sets or clears bit1 depending on the parameter.
void SetTime(MxS32 p_time)
[AI] Sets the key's time (from an integer value, used during deserialization or legacy data).
[AI] Holds per-node animation data for a model's animation tree.
void SetNumMorphKeys(LegoU16 p_numMorphKeys)
[AI] Sets morph key count.
void SetRotationKeys(LegoRotationKey *p_keys)
[AI] Sets the node's rotation keys array, resets rotation index.
LegoRotationKey * GetRotationKey(MxS32 index)
[AI] Access a pointer to the i-th rotation key.
void SetUnknown0x20(LegoU16 p_unk0x20)
[AI] Sets unknown parameter (possibly camera/scene state).
void SetMorphKeys(LegoMorphKey *p_morphKeys)
void SetName(LegoChar *p_name)
[AI] Sets the node's name (deep-copies string).
LegoMorphKey * GetMorphKeys()
[AI] Returns pointer to morph keyframes array.
LegoU16 GetUnknown0x20()
[AI] Unknown, used in scene/camera calculations (purpose unclear).
LegoU16 GetNumRotationKeys()
[AI] Number of rotation keys for this node.
LegoU16 GetNumTranslationKeys()
[AI] Number of translation keys for this node.
LegoChar * GetName()
[AI] Name of this animation node (used for lookup/mapping to scene graph).
void SetNumRotationKeys(LegoU16 p_numRotationKeys)
[AI] Sets the number of rotation keys for this node.
LegoAnim * m_anim
[AI] Animation resource currently being played back.
void ReadyTickle() override
[AI] Called when the presenter is in the "Ready" tickle state.
MxU32 m_roiMapSize
[AI] Number of valid entries in m_roiMap (excluding 0th index).
LegoROI ** m_roiMap
[AI] Lookup array to map animation node indices to scene ROIs (1-based index).
void FUN_1006b9a0(LegoAnim *p_anim, MxLong p_time, Matrix4 *p_matrix)
[AI] Like FUN_1006b900, but also processes associated camera animation if present.
LegoWorld * m_currentWorld
[AI] Reference to the world in which this presenter is currently placed/active.
LegoTime GetDuration()
[AI] Duration (in time units) of the animation.
[AI] Handles the logic and animation presentation for the LEGO Island car-building activity,...
virtual MxResult Serialize(LegoStorage *p_storage)
[AI] Serializes or deserializes the assembly state of the car build.
MxBool StringEqualsShelf(const LegoChar *p_string)
[AI] Checks if the supplied string matches "SHELF" prefix (case-insensitive).
void StreamingTickle() override
[AI] Handles streaming phase:
void FUN_10079160()
[AI] (Re-)initializes internal state from animation root, prepares morph keys for "platform" node and...
void SetUnknown0xbc(undefined2 p_unk0xbc)
[AI] Sets the internal unknown word at offset 0xbc.
MxBool StringEndsOnW(LegoChar *p_param)
[AI] Returns TRUE if the given part's name ends with 'W' or 'w' as the second-to-last character.
@ c_bit1
[AI] Internal bitmask used for blinking animation state and timers.
void SwapNodesByName(LegoChar *p_param1, LegoChar *p_param2)
[AI] Swaps two animation nodes in the scene tree, exchanging their display names and internal indices...
void PutFrame() override
[AI] Called once per displayed animation frame.
MxBool StringEqualsPlatform(const LegoChar *p_string)
[AI] Checks if the supplied string matches "PLATFORM" (case-insensitive).
void EndAction() override
[AI] Ends the current build action safely, stops blinking and unlocks critical section.
void SetPartObjectIdByName(const LegoChar *p_name, MxS16 p_objectId)
[AI] Sets the object id for the given part name in the assembly state.
void FUN_10079790(const LegoChar *p_name)
[AI] Advances current placed part, handles swaps, and updates morph/visibility.
MxBool PartIsPlaced(const LegoChar *p_name)
[AI] Returns whether a part (by name) has already been placed in the sequence.
void ReadyTickle() override
[AI] "Ready" tickle for car-building: initializes main entity pointer, updates placed part count,...
~LegoCarBuildAnimPresenter() override
[AI] Destroys the presenter, deletes all allocated part information, strings, and detaches nodes from...
LegoAnimNodeData * FindNodeDataByName(LegoTreeNode *p_treeNode, const LegoChar *p_name)
[AI] Recursively searches for a node with the given name and returns its node data.
MxBool StringEndsOnY(const LegoChar *p_string)
[AI] Checks if the supplied string ends with "Y" or "y" in the second-to-last character.
void RotateAroundYAxis(MxFloat p_angle)
[AI] Rotates the assembly platform (root part) around the Y axis by the given angle (quaternion math)...
void FUN_100795d0(LegoChar *p_param)
[AI] Hides the referenced animation node by setting its morph key to invisible.
void FUN_10079050(MxS16 p_index)
[AI] Swaps the nodes representing the part at the given index, then hides the 3D node for main (wired...
MxBool StringDoesNotEndOnZero(const LegoChar *p_string)
[AI] Checks if string does not end on the character '0'.
MxBool FUN_10079c30(const LegoChar *p_name)
[AI] Returns true if the part with the given name is not yet placed, but is the current to-be-placed ...
LegoTreeNode * FindNodeByName(LegoTreeNode *p_treeNode, const LegoChar *p_name)
[AI] Recursively searches for a node with the given name and returns the node itself.
void FUN_10079680(LegoChar *p_param)
[AI] Resets the node's morph key count to zero, restoring/showing the node.
const LegoChar * GetWiredNameByPartName(const LegoChar *p_name)
[AI] Retrieves the wireframe/scene-graph name associated with the player-facing part name.
const BoundingSphere & FUN_10079e20()
[AI] Returns the world bounding sphere of the next part to be placed.
MxBool StringEndsOnYOrN(const LegoChar *p_string)
[AI] Returns TRUE if the given part's name ends with 'Y', 'y', 'N', or 'n' as the second-to-last char...
void FUN_10079a90()
[AI] Advances the internal state for the assembly animation (step advancement).
[AI] World implementation for the LEGO vehicle builder (Racecar, Copter, Dune Car,...
[AI] Represents an entity that can be placed and managed in the LEGO Island world.
LegoROI * GetROI()
[AI] Gets the ROI (Realtime Object Instance) associated with this entity. [AI]
@ e_act2
Act 2: main story segment two. [AI].
[AI] Animation key for morphing states or mesh morphing.
void SetUnknown0x08(LegoBool p_unk0x08)
[AI] Sets the morph Boolean value (meaning unknown).
[AI] Represents a Real-time Object Instance enriched with LEGO-specific functionality.
LegoROI * FindChildROI(const LegoChar *p_name, LegoROI *p_roi)
[AI] Recursively searches for a child ROI by name, starting at the given ROI.
void ClearMeshOffset()
[AI] Resets mesh offset for all LODs in this ROI.
LegoResult SetLodColor(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha)
[AI] Sets the RGBA color for all LODs and recursively for all children.
const LegoChar * GetName() const
[AI] Gets this ROI's name.
[AI] Animation key class for rotations (axis-angle format).
void SetX(LegoFloat p_x)
[AI] Sets the X-axis of the rotation.
LegoFloat GetY()
[AI] Gets the Y-axis of the rotation.
LegoFloat GetZ()
[AI] Gets the Z-axis of the rotation.
LegoFloat GetX()
[AI] Gets the X-axis of the rotation.
void SetY(LegoFloat p_y)
[AI] Sets the Y-axis of the rotation.
LegoFloat GetAngle()
[AI] Gets the rotation angle (around the axis).
void SetAngle(LegoFloat p_angle)
[AI] Sets the rotation angle.
void SetZ(LegoFloat p_z)
[AI] Sets the Z-axis of the rotation.
Abstract base class providing an interface for file-like storage with binary and text read/write oper...
LegoStorage * ReadFloat(LegoFloat &p_data)
Reads a floating-point (single-precision) value from storage.
virtual LegoBool IsWriteMode()
Returns TRUE if object was opened in write mode.
LegoStorage * WriteS16(LegoS16 p_data)
Writes a 16-bit signed value to storage.
LegoStorage * ReadS16(LegoS16 &p_data)
Reads a 16-bit signed value from storage.
virtual LegoBool IsReadMode()
Returns TRUE if object was opened in read mode.
LegoStorage * WriteString(const char *p_data)
Writes a length-prefixed string to storage.
LegoStorage * ReadString(char *p_data)
Reads a length-prefixed string from storage.
LegoStorage * WriteFloat(LegoFloat p_data)
Writes a floating-point (single-precision) value to storage.
[AI] Represents a node within a general, N-ary tree structure.
void SetData(LegoTreeNodeData *p_data)
[AI] Associates a data payload with this node.
LegoTreeNodeData * GetData()
[AI] Returns the data payload stored at this node (may be nullptr). [AI]
LegoU32 GetNumChildren()
[AI] Returns the number of direct children of this node. [AI]
void SetChildren(LegoTreeNode **p_children)
[AI] Assigns the entire children pointer array.
void SetNumChildren(LegoU32 p_numChildren)
[AI] Sets the number of children for this node (does not resize pointer array).
LegoTreeNode ** GetChildren()
[AI] Returns the pointer to the children array. [AI]
LegoTreeNode * GetRoot()
[AI] Returns a pointer to the root node of the tree. [AI]
void SetRoot(LegoTreeNode *p_root)
[AI] Assigns the root node pointer for the tree (takes ownership).
[AI] Extends the functionality of MxVideoManager to provide LEGO Island–specific video and 3D graphic...
Lego3DManager * Get3DManager()
[AI] Returns the Lego3DManager for this manager, which owns all 3D scene representations and view con...
LegoROI * GetViewROI()
[AI] Returns the viewpoint ROI for the current view/camera.
MxCore * Find(const char *p_class, const char *p_name)
Finds an object of a given class and name in the world.
[AI] Represents a 3D point with floating-point precision, inheriting from Vector3.
[AI] 4D point class for floating point values.
const char * GetInternal() const
[AI] Returns a pointer to the internal string, or nullptr if not set.
const MxAtomId & GetAtomId()
[AI] Returns a const-reference to the object's atom identifier.
[AI] Represents a 4x4 transformation matrix, specialized for the LEGO Island engine and derived from ...
MxU32 m_previousTickleStates
[AI] Bitfield representing all tickle states that have already occurred during this lifetime.
MxDSAction * m_action
[AI] The associated action currently being presented by this presenter.
TickleState m_currentTickleState
[AI] Current state in the tickle lifecycle.
@ e_repeating
[AI] Presentation is repeating (e.g., looping media).
@ e_ready
[AI] Prepared to start processing an action.
@ e_starting
[AI] In the process of starting playback/presentation.
MxCriticalSection m_criticalSection
[AI] Thread synchronization for presenter state and data.
MxCompositePresenter * m_compositePresenter
[AI] Owner composite presenter, if any.
void SendToCompositePresenter(MxOmni *p_omni)
[AI] Notifies a composite presenter (if one exists) that this presenter wishes to join a group.
MxLong GetTime()
Returns the current timer value in ms, depending on running state.
void EndAction() override
Signals the end of the current playback action.
const BoundingSphere & GetWorldBoundingSphere() const override
Returns the object's bounding sphere in world coordinates.
const float * GetWorldUp() const
Returns a pointer to the world up vector from the transformation matrix.
const float * GetWorldPosition() const
Returns a pointer to the world position from the transformation matrix (translation row).
const Matrix4 & GetLocal2World() const
Accessor for the current local-to-world transformation matrix.
void WrappedSetLocalTransform(const Matrix4 &p_transform)
Wraps SetLocalTransform, for possible override or interface uniformity.
void SetVisibility(unsigned char p_visible)
[AI] Sets the visibility flag to the provided value.
virtual int Unitize()
[AI] Scales the vector so its norm is 1 (unit vector).
[AI] 3D vector class, providing vector and cross-product operations in 3D space.
virtual int EqualsHamiltonProduct(const Vector4 &p_a, const Vector4 &p_b)
[AI] Set this vector to the Hamilton product of two quaternion Vector4s.
virtual int NormalizeQuaternion()
[AI] Normalize this quaternion (interpreted as vector) in place.
#define DECOMP_SIZE_ASSERT(T, S)
#define NULL
[AI] Null pointer value (C/C++ semantics).
char LegoChar
[AI] Alias for char, for use in character/byte data and string handling.
#define SUCCESS
[AI] Used to indicate a successful operation in result codes.
unsigned short LegoU16
[AI] Unsigned 16-bit integer type for cross-platform compatibility.
void Swap(T &p_t1, T &p_t2)
[AI] Swaps the values of two variables of the same type.
LegoTreeNode * GetTreeNode(LegoTreeNode *p_node, MxU32 p_index)
[AI] Retrieves the nth node in tree traversal order (preorder) from a LegoTreeNode root.
MxS16 CountTotalTreeNodes(LegoTreeNode *p_node)
[AI] Recursively counts the number of nodes (including the root) in a tree hierarchy rooted at the sp...
LegoGameState * GameState()
[AI] Accessor for the game's central game state controller. [AI]
LegoVideoManager * VideoManager()
[AI] Accessor for the game's LegoVideoManager subsystem. Used for managing 3D/video hardware....
LegoOmni * Lego()
[AI] Retrieves the global LegoOmni singleton instance, providing access to core subsystems.
#define AUTOLOCK(CS)
[AI] Macro for automatic locking using the MxAutoLock class. This macro instantiates an MxAutoLock ob...
MxTimer * Timer()
[AI] Returns the global simulation timer.
void CalcLocalTransform(const Vector3 &p_posVec, const Vector3 &p_dirVec, const Vector3 &p_upVec, Matrix4 &p_outMatrix)
[AI] Computes a transformation matrix based on a position, direction, and up vector.
[AI] Represents a single entry in the car assembly sequence ("part list"), providing mapping between ...
LegoChar * m_name
[AI] Player-facing name or identifier for the part.
MxS16 m_objectId
[AI] Internal object id (likely 3D node id or mapping for placement).
LegoChar * m_wiredName
[AI] Internal/scene-graph name for the 3D mesh node.