Isle
|
[AI] Manages the lifecycle, state, and properties for all plant objects (flowers, trees, bushes, palms) on LEGO Island. More...
#include <legoplantmanager.h>
Classes | |
struct | AnimEntry |
[AI] Structure for scheduling plant ROI/entity animations (i.e. More... | |
Public Member Functions | |
LegoPlantManager () | |
[AI] Constructs the plant manager and initializes its bookkeeping to match the plant info array. More... | |
~LegoPlantManager () override | |
[AI] Destructor. More... | |
MxResult | Tickle () override |
[AI] Tickle handler for processing scheduled plant animation entries. More... | |
const char * | ClassName () const override |
[AI] Returns the class name "LegoPlantManager". More... | |
void | Init () |
[AI] Zeroes out state, resets world ID, and copies default plant info to runtime plant info array. More... | |
void | LoadWorldInfo (LegoOmni::World p_worldId) |
[AI] Loads all plant objects/entities for the requested world, instantiates requisite ROIs and entities. More... | |
void | Reset (LegoOmni::World p_worldId) |
[AI] Completely resets (removes) all plant objects for the supplied world. More... | |
MxResult | Write (LegoStorage *p_storage) |
[AI] Serializes persistent plant state (color, variant, mood, animation, etc) to storage for save games or transitions. More... | |
MxResult | Read (LegoStorage *p_storage) |
[AI] Rehydrates plant state from storage, restoring color/variant/mood/move properties. More... | |
MxS32 | GetNumPlants () |
[AI] Returns the total number of plant records referenced by this manager. More... | |
MxBool | SwitchColor (LegoEntity *p_entity) |
[AI] Cycles the color attribute for the plant and updates its LOD/appearance. More... | |
MxBool | SwitchVariant (LegoEntity *p_entity) |
[AI] Cycles the variant/type for a plant (flower, tree, bush, palm) and updates appearance. More... | |
MxBool | SwitchSound (LegoEntity *p_entity) |
[AI] Cycles the sound effect variant for a plant. More... | |
MxBool | SwitchMove (LegoEntity *p_entity) |
[AI] Cycles the movement/animation type for a plant. More... | |
MxBool | SwitchMood (LegoEntity *p_entity) |
[AI] Cycles the plant's "mood" state property (e.g., for appearance/hidden states) [AI] More... | |
MxU32 | GetAnimationId (LegoEntity *p_entity) |
[AI] Returns the current animation ID for the given plant, based on its variant and move type. More... | |
MxU32 | GetSoundId (LegoEntity *p_entity, MxBool p_state) |
[AI] Returns the sound ID for a plant, used for localized SFX depending on mood/state. More... | |
LegoPlantInfo * | GetInfoArray (MxS32 &p_length) |
[AI] Returns pointer to plant info array and populates its size. More... | |
LegoEntity * | CreatePlant (MxS32 p_index, LegoWorld *p_world, LegoOmni::World p_worldId) |
[AI] Instantiates an entity and ROI for the plant at given index in world (if appropriate). More... | |
MxBool | FUN_10026c50 (LegoEntity *p_entity) |
[AI] Triggers a growth decrement or similar on a plant entity, and updates accordingly if possible. More... | |
void | ScheduleAnimation (LegoEntity *p_entity, MxLong p_length) |
[AI] Schedules an animation for the given plant, adding an entry to the internal tickle array. More... | |
MxResult | FUN_10026410 () |
[AI] Repairs/updates all plant boundary references and vertical position to match world boundaries/planes. More... | |
void | FUN_10027120 () |
[AI] Resets all growth/activity/animation state for all plants in the manager. More... | |
void | FUN_10027200 () |
[AI] Propagates all plants' current growth/activity state to their restore points. More... | |
![]() | |
MxCore () | |
[AI] Constructs a new MxCore object and assigns it a unique id. More... | |
virtual | ~MxCore () |
[AI] Virtual destructor. Required for correct polymorphic cleanup in derived classes. More... | |
virtual MxLong | Notify (MxParam &p_param) |
[AI] Virtual callback notification mechanism. More... | |
virtual MxResult | Tickle () |
[AI] Called by tickle managers to allow the object to update itself. More... | |
virtual const char * | ClassName () const |
[AI] Returns the runtime class name of this object. More... | |
virtual MxBool | IsA (const char *p_name) const |
[AI] Checks whether this object's class type or parents match the given name. More... | |
MxU32 | GetId () |
[AI] Gets the unique (per-process) id assigned to this object instance. More... | |
Static Public Member Functions | |
static void | SetCustomizeAnimFile (const char *p_value) |
[AI] Sets the global file path or name to use for plant customization animations. More... | |
static const char * | GetCustomizeAnimFile () |
[AI] Gets the current file name/path for plant customization animation file. More... | |
[AI] Manages the lifecycle, state, and properties for all plant objects (flowers, trees, bushes, palms) on LEGO Island.
This class handles creation, removal, animation scheduling, color/variant/mood/sound switching, serialization, and in-world management of plants/entities considered as static environmental decorations, but with some interactability and state.
It also provides support functions for customizing and storing their state, and integrates with tickle management for scheduled behavior.
[AI] The manager is responsible for all plants present in the current world, ties plant information with entity/ROI, schedules animations (growth, custom actions), and facilitates saving/loading plant state.
Definition at line 30 of file legoplantmanager.h.
LegoPlantManager::LegoPlantManager | ( | ) |
[AI] Constructs the plant manager and initializes its bookkeeping to match the plant info array.
Definition at line 63 of file legoplantmanager.cpp.
|
override |
[AI] Destructor.
Cleans up any allocated entries and resets static animation file string.
Definition at line 70 of file legoplantmanager.cpp.
|
inlineoverridevirtual |
[AI] Returns the class name "LegoPlantManager".
Used for RTTI and debugging.
Reimplemented from MxCore.
Definition at line 69 of file legoplantmanager.h.
LegoEntity * LegoPlantManager::CreatePlant | ( | MxS32 | p_index, |
LegoWorld * | p_world, | ||
LegoOmni::World | p_worldId | ||
) |
[AI] Instantiates an entity and ROI for the plant at given index in world (if appropriate).
p_index | The index into the plant info array. [AI] |
p_world | Target world pointer for this plant's entity. [AI] |
p_worldId | World enum/ID for filtering plants that exist in this world. [AI] |
[AI] Creates only if plant meets world and activation criteria and hasn't already been made.
Definition at line 213 of file legoplantmanager.cpp.
MxResult LegoPlantManager::FUN_10026410 | ( | ) |
[AI] Repairs/updates all plant boundary references and vertical position to match world boundaries/planes.
[AI] Used to synchronize per-plant Y position against world boundaries (for collision/placement correction).
Definition at line 127 of file legoplantmanager.cpp.
MxBool LegoPlantManager::FUN_10026c50 | ( | LegoEntity * | p_entity | ) |
[AI] Triggers a growth decrement or similar on a plant entity, and updates accordingly if possible.
p_entity | Plant entity to update. [AI] |
[AI] Underlying plant property is likely its 'growth' counter or health, using index lookup.
Definition at line 553 of file legoplantmanager.cpp.
void LegoPlantManager::FUN_10027120 | ( | ) |
[AI] Resets all growth/activity/animation state for all plants in the manager.
[AI] Used to return plants to their initial/hidden or unevolved states, e.g. on world load.
Definition at line 702 of file legoplantmanager.cpp.
void LegoPlantManager::FUN_10027200 | ( | ) |
[AI] Propagates all plants' current growth/activity state to their restore points.
[AI] Used for state rollback or prepping snapshot for future restoration.
Definition at line 742 of file legoplantmanager.cpp.
MxU32 LegoPlantManager::GetAnimationId | ( | LegoEntity * | p_entity | ) |
[AI] Returns the current animation ID for the given plant, based on its variant and move type.
[AI]
p_entity | Target plant entity. [AI] |
Definition at line 503 of file legoplantmanager.cpp.
|
inlinestatic |
[AI] Gets the current file name/path for plant customization animation file.
[AI]
Definition at line 237 of file legoplantmanager.h.
LegoPlantInfo * LegoPlantManager::GetInfoArray | ( | MxS32 & | p_length | ) |
[AI] Returns pointer to plant info array and populates its size.
Triggers boundary check/correction if needed.
p_length | Set to array length on output. [AI] |
[AI] Ensures boundary/plane alignment check is performed before returning the array. [AI]
Definition at line 201 of file legoplantmanager.cpp.
MxS32 LegoPlantManager::GetNumPlants | ( | ) |
[AI] Returns the total number of plant records referenced by this manager.
Definition at line 354 of file legoplantmanager.cpp.
MxU32 LegoPlantManager::GetSoundId | ( | LegoEntity * | p_entity, |
MxBool | p_state | ||
) |
[AI] Returns the sound ID for a plant, used for localized SFX depending on mood/state.
[AI]
p_entity | Target plant entity. [AI] |
p_state | Selects sound type (mood vs sound property). [AI] |
[AI] Picks sound based on whether it is state-dependent or not.
Definition at line 516 of file legoplantmanager.cpp.
void LegoPlantManager::Init | ( | ) |
[AI] Zeroes out state, resets world ID, and copies default plant info to runtime plant info array.
[AI] Also called from constructor to ensure fresh state across world loads/restarts.
Definition at line 77 of file legoplantmanager.cpp.
void LegoPlantManager::LoadWorldInfo | ( | LegoOmni::World | p_worldId | ) |
[AI] Loads all plant objects/entities for the requested world, instantiates requisite ROIs and entities.
p_worldId | Index of the current world. [AI] |
[AI] For each entry in the plant info array, creates an entity and links it for in-world presence if the plant exists in that world. Sets up pointers and registers initial state.
Definition at line 92 of file legoplantmanager.cpp.
MxResult LegoPlantManager::Read | ( | LegoStorage * | p_storage | ) |
[AI] Rehydrates plant state from storage, restoring color/variant/mood/move properties.
p_storage | Source of the plant save data. [AI] |
[AI] After reading, also recalculates each plant position based on variant/growth state.
Definition at line 301 of file legoplantmanager.cpp.
void LegoPlantManager::Reset | ( | LegoOmni::World | p_worldId | ) |
[AI] Completely resets (removes) all plant objects for the supplied world.
p_worldId | World which is being reset. [AI] |
[AI] Destroys any entities/ROIs for plants in the specified world and reverts world ID.
Definition at line 106 of file legoplantmanager.cpp.
void LegoPlantManager::ScheduleAnimation | ( | LegoEntity * | p_entity, |
MxLong | p_length | ||
) |
[AI] Schedules an animation for the given plant, adding an entry to the internal tickle array.
p_entity | Plant to animate. [AI] |
p_length | Length (ms) that the animation should persist. [AI] |
[AI] Will register itself to tickle manager if first animation entry.
Definition at line 608 of file legoplantmanager.cpp.
|
static |
[AI] Sets the global file path or name to use for plant customization animations.
p_value | String containing file name/path for custom animation. Can be null to clear. [AI] |
[AI] String is copied and managed as a global static resource.
Definition at line 533 of file legoplantmanager.cpp.
MxBool LegoPlantManager::SwitchColor | ( | LegoEntity * | p_entity | ) |
[AI] Cycles the color attribute for the plant and updates its LOD/appearance.
p_entity | Target plant entity. [AI] |
[AI] Updates color value modulo the possible color variants (white, black, yellow, red, green), reconstructs LOD and visuals accordingly.
Definition at line 380 of file legoplantmanager.cpp.
MxBool LegoPlantManager::SwitchMood | ( | LegoEntity * | p_entity | ) |
[AI] Cycles the plant's "mood" state property (e.g., for appearance/hidden states) [AI]
p_entity | Target plant entity. [AI] |
[AI] Rolls through mood values 0..3.
Definition at line 483 of file legoplantmanager.cpp.
MxBool LegoPlantManager::SwitchMove | ( | LegoEntity * | p_entity | ) |
[AI] Cycles the movement/animation type for a plant.
[AI]
p_entity | Target plant entity. [AI] |
[AI] Increments the move index (i.e. animation), wraps at maximum allowed for current variant.
Definition at line 463 of file legoplantmanager.cpp.
MxBool LegoPlantManager::SwitchSound | ( | LegoEntity * | p_entity | ) |
[AI] Cycles the sound effect variant for a plant.
[AI]
p_entity | Target plant entity. [AI] |
[AI] Increments sound index for this plant, wraps around if exceeding max.
Definition at line 443 of file legoplantmanager.cpp.
MxBool LegoPlantManager::SwitchVariant | ( | LegoEntity * | p_entity | ) |
[AI] Cycles the variant/type for a plant (flower, tree, bush, palm) and updates appearance.
p_entity | Target plant entity. [AI] |
[AI] Only allow variant switch if plant 'growth' state allows, reassigns LOD after.
Definition at line 409 of file legoplantmanager.cpp.
|
overridevirtual |
[AI] Tickle handler for processing scheduled plant animation entries.
Periodically animates plants by updating their transformation matrices and visibility, synchronizing with the tickle system.
[AI] If all current entries complete, unregisters from tickle.
Reimplemented from MxCore.
Definition at line 630 of file legoplantmanager.cpp.
MxResult LegoPlantManager::Write | ( | LegoStorage * | p_storage | ) |
[AI] Serializes persistent plant state (color, variant, mood, animation, etc) to storage for save games or transitions.
p_storage | Where to write the serialized plant property data. [AI] |
[AI] Loops over all plants and saves only the relevant dynamic state, not entity or ROI objects.
Definition at line 266 of file legoplantmanager.cpp.