Isle
Loading...
Searching...
No Matches
LegoCharacterManager Class Reference

[AI] Manages reference-counted characters and provides character creation, switching, and property update functionality. More...

#include <legocharactermanager.h>

Public Member Functions

 LegoCharacterManager ()
 [AI] Constructs the character manager, initializing tables and the customizable animation variable. More...
 
 ~LegoCharacterManager ()
 [AI] Destroys the manager, cleaning up all managed characters and animation customization state. More...
 
MxResult Write (LegoStorage *p_storage)
 [AI] Writes the persistent character info data to a storage object. More...
 
MxResult Read (LegoStorage *p_storage)
 [AI] Reads character info data from a storage object. More...
 
const char * GetActorName (MxS32 p_index)
 [AI] Returns the actor name for the given actor index (lookup in global g_actorInfo table). More...
 
MxU32 GetNumActors ()
 [AI] Returns the number of actors registered in global g_actorInfo. More...
 
LegoROIGetActorROI (const char *p_name, MxBool p_createEntity)
 [AI] Returns a LegoROI for the given character name, creating and registering the actor if necessary. More...
 
void Init ()
 [AI] Initializes all actor info structures based on their templates/defaults. More...
 
void ReleaseAllActors ()
 [AI] Releases all actors associated with this manager, unregistering/releasing references until destroyed. More...
 
MxBool Exists (const char *p_name)
 [AI] Returns whether a character with the given name exists in the manager. More...
 
MxU32 GetRefCount (LegoROI *p_roi)
 [AI] Returns the reference count for a given LegoROI* tracked by the manager. More...
 
void ReleaseActor (const char *p_name)
 [AI] Releases a character/ROI by name, decrementing its reference count and deleting if zero. More...
 
void ReleaseActor (LegoROI *p_roi)
 [AI] Releases a character/ROI object, handling reference count and eventual deletion. More...
 
void ReleaseAutoROI (LegoROI *p_roi)
 [AI] Releases an "auto" ROI, used for dynamically created ROI objects by this manager. More...
 
MxBool FUN_100849a0 (LegoROI *p_roi, LegoTextureInfo *p_texture)
 [AI] Replaces the head LOD of a character ROI with a new LOD list built using the provided texture. More...
 
LegoExtraActorGetExtraActor (const char *p_name)
 [AI] Returns an extra actor associated with a given character name, or NULL if not found. More...
 
LegoActorInfoGetActorInfo (const char *p_name)
 [AI] Returns the actor info struct for the character of the given name, or NULL if not found. More...
 
LegoActorInfoGetActorInfo (LegoROI *p_roi)
 [AI] Returns actor info struct for the character associated with a given ROI pointer. More...
 
MxBool SwitchColor (LegoROI *p_roi, LegoROI *p_targetROI)
 [AI] Changes the color of a part of a character's ROI, updating its part info index and updating ROI color. More...
 
MxBool SwitchVariant (LegoROI *p_roi)
 [AI] Cycles through part variants (e.g. More...
 
MxBool SwitchSound (LegoROI *p_roi)
 [AI] Cycles the sound type for the actor, updating the per-actor info. More...
 
MxBool SwitchMove (LegoROI *p_roi)
 [AI] Cycles the move type for the actor, updating the per-actor info. More...
 
MxBool SwitchMood (LegoROI *p_roi)
 [AI] Cycles the mood type for the actor, updating the per-actor info. More...
 
MxU32 GetAnimationId (LegoROI *p_roi)
 [AI] Returns an animation ID corresponding to the ROI's move index. More...
 
MxU32 GetSoundId (LegoROI *p_roi, MxBool p_und)
 [AI] Returns the sound ID for the ROI's current sound/mood selection. More...
 
MxU8 GetMood (LegoROI *p_roi)
 [AI] Returns the current mood value (0-3) for the actor associated with the ROI. More...
 
LegoROICreateAutoROI (const char *p_name, const char *p_lodName, MxBool p_createEntity)
 [AI] Creates an "auto" ROI object with the given name, LOD name, and optional entity creation. More...
 
MxResult FUN_10085870 (LegoROI *p_roi)
 [AI] Initializes auto-ROI with bounding volume and transformation. More...
 
LegoROIFUN_10085a80 (const char *p_name, const char *p_lodName, MxBool p_createEntity)
 [AI] Helper function that delegates to CreateAutoROI. More...
 

Static Public Member Functions

static void SetCustomizeAnimFile (const char *p_value)
 [AI] Sets the value of the customization animation file variable, propagating to all relevant subsystems. More...
 
static MxBool IsActor (const char *p_name)
 [AI] Checks if the given name matches an actor in the global actor table (case-insensitive). More...
 
static const char * GetCustomizeAnimFile ()
 [AI] Gets the value of the customize animation file variable. More...
 

Detailed Description

[AI] Manages reference-counted characters and provides character creation, switching, and property update functionality.

Handles creation and deletion of LegoROI-based character objects, manages reference counts to avoid redundant copies, supports property switching for sound, color, variant, mood, animation, reading/writing state to storage, and provides runtime customization features (e.g., runtime selection of animation files).

Used for runtime management of all interactive/actor-type Lego characters and "automatic" ROI objects tied to characters (by name). [AI]

SIZE: 0x08 bytes

Definition at line 131 of file legocharactermanager.h.

Constructor & Destructor Documentation

◆ LegoCharacterManager()

LegoCharacterManager::LegoCharacterManager ( )

[AI] Constructs the character manager, initializing tables and the customizable animation variable.

Definition at line 59 of file legocharactermanager.cpp.

◆ ~LegoCharacterManager()

LegoCharacterManager::~LegoCharacterManager ( )

[AI] Destroys the manager, cleaning up all managed characters and animation customization state.

Definition at line 70 of file legocharactermanager.cpp.

Member Function Documentation

◆ CreateAutoROI()

LegoROI * LegoCharacterManager::CreateAutoROI ( const char *  p_name,
const char *  p_lodName,
MxBool  p_createEntity 
)

[AI] Creates an "auto" ROI object with the given name, LOD name, and optional entity creation.

[AI]

Parameters
p_nameName for the new ROI (or NULL for auto-generated). [AI]
p_lodNameLOD name to use to build ROI/model. [AI]
p_createEntityIf TRUE, also creates and registers a new LegoEntity. [AI]
Returns
Created ROI pointer, or NULL if failed.

Definition at line 985 of file legocharactermanager.cpp.

◆ Exists()

MxBool LegoCharacterManager::Exists ( const char *  p_name)

[AI] Returns whether a character with the given name exists in the manager.

Parameters
p_nameName of the character. [AI]
Returns
TRUE if exists, FALSE otherwise. [AI]

Definition at line 299 of file legocharactermanager.cpp.

◆ FUN_100849a0()

MxBool LegoCharacterManager::FUN_100849a0 ( LegoROI p_roi,
LegoTextureInfo p_texture 
)

[AI] Replaces the head LOD of a character ROI with a new LOD list built using the provided texture.

Parameters
p_roiROI to update. [AI]
p_textureNew texture to use for the head LOD. [AI]
Returns
TRUE if operation succeeded, FALSE otherwise. [AI]

Definition at line 605 of file legocharactermanager.cpp.

◆ FUN_10085870()

MxResult LegoCharacterManager::FUN_10085870 ( LegoROI p_roi)

[AI] Initializes auto-ROI with bounding volume and transformation.

Parameters
p_roiROI to initialize. [AI]
Returns
SUCCESS/FAILURE.

Sets up bounding box/sphere and invokes VTable0x14 for derived setup. [AI]

Definition at line 1045 of file legocharactermanager.cpp.

◆ FUN_10085a80()

LegoROI * LegoCharacterManager::FUN_10085a80 ( const char *  p_name,
const char *  p_lodName,
MxBool  p_createEntity 
)

[AI] Helper function that delegates to CreateAutoROI.

Parameters
p_nameName for the new ROI. [AI]
p_lodNameLOD name. [AI]
p_createEntityEntity creation flag. [AI]
Returns
ROI pointer (see CreateAutoROI).

Definition at line 1087 of file legocharactermanager.cpp.

◆ GetActorInfo() [1/2]

LegoActorInfo * LegoCharacterManager::GetActorInfo ( const char *  p_name)

[AI] Returns the actor info struct for the character of the given name, or NULL if not found.

Parameters
p_nameCharacter name [AI]
Returns
Pointer to actor info struct. [AI]

Definition at line 683 of file legocharactermanager.cpp.

◆ GetActorInfo() [2/2]

LegoActorInfo * LegoCharacterManager::GetActorInfo ( LegoROI p_roi)

[AI] Returns actor info struct for the character associated with a given ROI pointer.

Parameters
p_roiROI to match [AI]
Returns
Pointer to actor info struct, or NULL [AI]

Definition at line 703 of file legocharactermanager.cpp.

◆ GetActorName()

const char * LegoCharacterManager::GetActorName ( MxS32  p_index)

[AI] Returns the actor name for the given actor index (lookup in global g_actorInfo table).

Parameters
p_indexIndex into the actor info array. [AI]
Returns
Name string of the actor, or NULL if out of range. [AI]

Definition at line 230 of file legocharactermanager.cpp.

◆ GetActorROI()

LegoROI * LegoCharacterManager::GetActorROI ( const char *  p_name,
MxBool  p_createEntity 
)

[AI] Returns a LegoROI for the given character name, creating and registering the actor if necessary.

Parameters
p_nameName of the actor. [AI]
p_createEntityWhether to create and attach an entity if one doesn't exist. [AI]
Returns
Pointer to the character's LegoROI, or NULL on failure. [AI]

Definition at line 249 of file legocharactermanager.cpp.

◆ GetAnimationId()

MxU32 LegoCharacterManager::GetAnimationId ( LegoROI p_roi)

[AI] Returns an animation ID corresponding to the ROI's move index.

[AI]

Parameters
p_roiCharacter ROI [AI]
Returns
Animation ID value, or 0 if not found.

Definition at line 920 of file legocharactermanager.cpp.

◆ GetCustomizeAnimFile()

static const char * LegoCharacterManager::GetCustomizeAnimFile ( )
inlinestatic

[AI] Gets the value of the customize animation file variable.

[AI]

Returns
Current customize animation file string (global pointer, managed elsewhere). [AI]

Definition at line 354 of file legocharactermanager.h.

◆ GetExtraActor()

LegoExtraActor * LegoCharacterManager::GetExtraActor ( const char *  p_name)

[AI] Returns an extra actor associated with a given character name, or NULL if not found.

Parameters
p_nameCharacter name [AI]
Returns
Extra actor pointer. [AI]

Definition at line 670 of file legocharactermanager.cpp.

◆ GetMood()

MxU8 LegoCharacterManager::GetMood ( LegoROI p_roi)

[AI] Returns the current mood value (0-3) for the actor associated with the ROI.

[AI]

Parameters
p_roiCharacter ROI [AI]
Returns
Mood value.

Definition at line 952 of file legocharactermanager.cpp.

◆ GetNumActors()

MxU32 LegoCharacterManager::GetNumActors ( )

[AI] Returns the number of actors registered in global g_actorInfo.

[AI]

Definition at line 242 of file legocharactermanager.cpp.

◆ GetRefCount()

MxU32 LegoCharacterManager::GetRefCount ( LegoROI p_roi)

[AI] Returns the reference count for a given LegoROI* tracked by the manager.

Parameters
p_roiROI to query. [AI]
Returns
Reference count for the ROI, or 0 if not managed. [AI]

Definition at line 311 of file legocharactermanager.cpp.

◆ GetSoundId()

MxU32 LegoCharacterManager::GetSoundId ( LegoROI p_roi,
MxBool  p_und 
)

[AI] Returns the sound ID for the ROI's current sound/mood selection.

[AI]

Parameters
p_roiCharacter ROI [AI]
p_undIf true, returns alternate mood-based sound id. [AI]
Returns
Sound ID, or 0 on failure.

Definition at line 934 of file legocharactermanager.cpp.

◆ Init()

void LegoCharacterManager::Init ( )

[AI] Initializes all actor info structures based on their templates/defaults.

[AI]

Definition at line 89 of file legocharactermanager.cpp.

◆ IsActor()

MxBool LegoCharacterManager::IsActor ( const char *  p_name)
static

[AI] Checks if the given name matches an actor in the global actor table (case-insensitive).

Parameters
p_nameName string to check. [AI]
Returns
TRUE if the actor exists, FALSE otherwise. [AI]

Definition at line 658 of file legocharactermanager.cpp.

◆ Read()

MxResult LegoCharacterManager::Read ( LegoStorage p_storage)

[AI] Reads character info data from a storage object.

Parameters
p_storageStorage object to read from. [AI]
Returns
Operation result (SUCCESS/FAILURE). [AI]

Reads the dynamic properties back into LegoActorInfo structures. [AI]

Definition at line 174 of file legocharactermanager.cpp.

◆ ReleaseActor() [1/2]

void LegoCharacterManager::ReleaseActor ( const char *  p_name)

[AI] Releases a character/ROI by name, decrementing its reference count and deleting if zero.

Parameters
p_nameName of the character to release. [AI]

Definition at line 329 of file legocharactermanager.cpp.

◆ ReleaseActor() [2/2]

void LegoCharacterManager::ReleaseActor ( LegoROI p_roi)

[AI] Releases a character/ROI object, handling reference count and eventual deletion.

Parameters
p_roiROI to release. [AI]

Definition at line 370 of file legocharactermanager.cpp.

◆ ReleaseAllActors()

void LegoCharacterManager::ReleaseAllActors ( )

[AI] Releases all actors associated with this manager, unregistering/releasing references until destroyed.

Definition at line 97 of file legocharactermanager.cpp.

◆ ReleaseAutoROI()

void LegoCharacterManager::ReleaseAutoROI ( LegoROI p_roi)

[AI] Releases an "auto" ROI, used for dynamically created ROI objects by this manager.

Parameters
p_roiROI to release. [AI]

This is specifically for ROIs created via CreateAutoROI.

Definition at line 415 of file legocharactermanager.cpp.

◆ SetCustomizeAnimFile()

void LegoCharacterManager::SetCustomizeAnimFile ( const char *  p_value)
static

[AI] Sets the value of the customization animation file variable, propagating to all relevant subsystems.

Parameters
p_valueThe new animation file to use. [AI]

Also updates PlantManager and BuildingManager. [AI]

Definition at line 965 of file legocharactermanager.cpp.

◆ SwitchColor()

MxBool LegoCharacterManager::SwitchColor ( LegoROI p_roi,
LegoROI p_targetROI 
)

[AI] Changes the color of a part of a character's ROI, updating its part info index and updating ROI color.

Parameters
p_roiCharacter ROI [AI]
p_targetROIROI for the part to change (may be determined based on target name). [AI]
Returns
TRUE if color was switched, FALSE if not applicable. [AI]

Definition at line 746 of file legocharactermanager.cpp.

◆ SwitchMood()

MxBool LegoCharacterManager::SwitchMood ( LegoROI p_roi)

[AI] Cycles the mood type for the actor, updating the per-actor info.

[AI]

Parameters
p_roiCharacter ROI [AI]
Returns
TRUE if mood switched.

Definition at line 900 of file legocharactermanager.cpp.

◆ SwitchMove()

MxBool LegoCharacterManager::SwitchMove ( LegoROI p_roi)

[AI] Cycles the move type for the actor, updating the per-actor info.

[AI]

Parameters
p_roiCharacter ROI [AI]
Returns
TRUE if move switched.

Definition at line 880 of file legocharactermanager.cpp.

◆ SwitchSound()

MxBool LegoCharacterManager::SwitchSound ( LegoROI p_roi)

[AI] Cycles the sound type for the actor, updating the per-actor info.

[AI]

Parameters
p_roiCharacter ROI [AI]
Returns
TRUE if sound switched.

Definition at line 860 of file legocharactermanager.cpp.

◆ SwitchVariant()

MxBool LegoCharacterManager::SwitchVariant ( LegoROI p_roi)

[AI] Cycles through part variants (e.g.

hat) for the character's ROI, updating the model as appropriate.

Parameters
p_roiCharacter ROI [AI]
Returns
TRUE if variant switched. [AI]

Definition at line 805 of file legocharactermanager.cpp.

◆ Write()

MxResult LegoCharacterManager::Write ( LegoStorage p_storage)

[AI] Writes the persistent character info data to a storage object.

Parameters
p_storageStorage object to serialize to. [AI]
Returns
Operation result (SUCCESS/FAILURE). [AI]

Serializes out the dynamic properties of LegoActorInfo for each actor, such as sound, move, mood, etc. [AI]

Definition at line 119 of file legocharactermanager.cpp.


The documentation for this class was generated from the following files: