27 {
"flwrwht",
"flwrblk",
"flwryel",
"flwrred",
"flwrgrn"},
28 {
"treewht",
"treeblk",
"treeyel",
"treered",
"tree"},
29 {
"bushwht",
"bushblk",
"bushyel",
"bushred",
"bush"},
30 {
"palmwht",
"palmblk",
"palmyel",
"palmred",
"palm"}
40MxU32 LegoPlantManager::g_maxSound = 8;
49MxS32 LegoPlantManager::g_maxMove[4] = {3, 3, 3, 3};
56char* LegoPlantManager::g_customizeAnimFile =
NULL;
72 delete[] g_customizeAnimFile;
94 m_worldId = p_worldId;
111 for (i = 0; i < m_numEntries; i++) {
118 RemovePlant(i, p_worldId);
148 if (position.
Dot(*normal, position) + (*normal).index_operator(3) < -0.001) {
150 "Plant %d shot location (%g, %g, %g) is not in boundary %s.\n",
174 "Plant %d shot location (%g, %g, %g) is not on plane of boundary %s...adjusting to (%g, "
190 MxTrace(
"Plant %d is in boundary %s that does not exist.\n", i,
g_plantInfo[i].m_name);
225 sprintf(name,
"plant%d", p_index);
339void LegoPlantManager::FUN_10026860(
MxS32 p_index)
451 if (info->
m_sound >= g_maxSound) {
535 if (g_customizeAnimFile !=
NULL) {
536 delete[] g_customizeAnimFile;
539 if (p_value !=
NULL) {
540 g_customizeAnimFile =
new char[strlen(p_value) + 1];
542 if (g_customizeAnimFile !=
NULL) {
543 strcpy(g_customizeAnimFile, p_value);
547 g_customizeAnimFile =
NULL;
566MxBool LegoPlantManager::FUN_10026c80(
MxS32 p_index)
612 if (m_numEntries == 0) {
624 entry->
m_time = time + 1000;
626 FUN_100271b0(p_entity, -1);
634 if (m_numEntries != 0) {
635 for (
MxS32 i = 0; i < m_numEntries; i++) {
643 if (m_numEntries != i) {
644 m_entries[i] = m_entries[m_numEntries];
645 m_entries[m_numEntries] =
NULL;
651 if (entry->
m_time - time > 1000) {
663 locald8[1][0] = sin(((entry->
m_time - time) * 2) * 0.0062832f) * 0.2;
664 locald8[1][2] = sin(((entry->
m_time - time) * 4) * 0.0062832f) * 0.2;
665 locald8.
Scale(1.03f, 0.95f, 1.03f);
667 SET3(locald8[3], localec);
672 if (entry->
m_time < time) {
686 if (m_numEntries != i) {
688 *ppEntry = m_entries[m_numEntries];
689 m_entries[m_numEntries] =
NULL;
723void LegoPlantManager::FUN_100271b0(
LegoEntity* p_entity,
MxS32 p_adjust)
734 if (info->
m_unk0x16 <= 1 && p_adjust < 0) {
Lego3DView * GetLego3DView()
[AI] Returns the encapsulated Lego3DView instance.
ViewManager * GetViewManager()
[AI] Returns the ViewManager responsible for managing scene objects and transformations.
LegoROI * 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.
MxResult FUN_10085870(LegoROI *p_roi)
[AI] Initializes auto-ROI with bounding volume and transformation.
void ReleaseAutoROI(LegoROI *p_roi)
[AI] Releases an "auto" ROI, used for dynamically created ROI objects by this manager.
[AI] Represents an entity that can be placed and managed in the LEGO Island world.
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.
LegoROI * GetROI()
[AI] Gets the ROI (Realtime Object Instance) associated with this entity. [AI]
void SetType(MxU8 p_type)
[AI] Sets the entity's type (actor/plant/building/etc.) [AI]
@ e_plant
[AI] Plant objects in the game (e.g., trees or bushes) [AI]
World
[AI] Identifiers for all unique, script-driven world environments in LEGO Island.
@ e_undefined
[AI] No world specified. [AI]
[AI] Represents a path segment or boundary in the navigation network for actors (vehicles,...
[AI] Manages the lifecycle, state, and properties for all plant objects (flowers, trees,...
void ScheduleAnimation(LegoEntity *p_entity, MxLong p_length)
[AI] Schedules an animation for the given plant, adding an entry to the internal tickle array.
~LegoPlantManager() override
[AI] Destructor.
MxBool SwitchSound(LegoEntity *p_entity)
[AI] Cycles the sound effect variant for a plant.
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).
MxResult Read(LegoStorage *p_storage)
[AI] Rehydrates plant state from storage, restoring color/variant/mood/move properties.
void FUN_10027120()
[AI] Resets all growth/activity/animation state for all plants in the manager.
MxResult Write(LegoStorage *p_storage)
[AI] Serializes persistent plant state (color, variant, mood, animation, etc) to storage for save gam...
MxBool SwitchColor(LegoEntity *p_entity)
[AI] Cycles the color attribute for the plant and updates its LOD/appearance.
MxResult FUN_10026410()
[AI] Repairs/updates all plant boundary references and vertical position to match world boundaries/pl...
MxResult Tickle() override
[AI] Tickle handler for processing scheduled plant animation entries.
MxBool SwitchVariant(LegoEntity *p_entity)
[AI] Cycles the variant/type for a plant (flower, tree, bush, palm) and updates appearance.
MxU32 GetSoundId(LegoEntity *p_entity, MxBool p_state)
[AI] Returns the sound ID for a plant, used for localized SFX depending on mood/state.
void LoadWorldInfo(LegoOmni::World p_worldId)
[AI] Loads all plant objects/entities for the requested world, instantiates requisite ROIs and entiti...
MxBool FUN_10026c50(LegoEntity *p_entity)
[AI] Triggers a growth decrement or similar on a plant entity, and updates accordingly if possible.
LegoPlantManager()
[AI] Constructs the plant manager and initializes its bookkeeping to match the plant info array.
LegoPlantInfo * GetInfoArray(MxS32 &p_length)
[AI] Returns pointer to plant info array and populates its size.
void Init()
[AI] Zeroes out state, resets world ID, and copies default plant info to runtime plant info array.
MxBool SwitchMood(LegoEntity *p_entity)
[AI] Cycles the plant's "mood" state property (e.g., for appearance/hidden states) [AI]
void FUN_10027200()
[AI] Propagates all plants' current growth/activity state to their restore points.
MxS32 GetNumPlants()
[AI] Returns the total number of plant records referenced by this manager.
void Reset(LegoOmni::World p_worldId)
[AI] Completely resets (removes) all plant objects for the supplied world.
MxU32 GetAnimationId(LegoEntity *p_entity)
[AI] Returns the current animation ID for the given plant, based on its variant and move type.
static void SetCustomizeAnimFile(const char *p_value)
[AI] Sets the global file path or name to use for plant customization animations.
MxBool SwitchMove(LegoEntity *p_entity)
[AI] Cycles the movement/animation type for a plant.
[AI] Represents a Real-time Object Instance enriched with LEGO-specific functionality.
LegoEntity * GetEntity()
[AI] Gets the entity associated with this ROI (or NULL).
Abstract base class providing an interface for file-like storage with binary and text read/write oper...
virtual LegoResult Write(const void *p_buffer, LegoU32 p_size)=0
Write bytes from buffer into storage.
virtual LegoResult Read(void *p_buffer, LegoU32 p_size)=0
Read bytes from storage into buffer.
Lego3DManager * Get3DManager()
[AI] Returns the Lego3DManager for this manager, which owns all 3D scene representations and view con...
LegoU8 GetNumEdges()
[AI] Returns the number of edge elements assigned to this face.
const LegoChar * GetName()
[AI] Returns the name string of this edge, typically used for debugging and lookup.
Mx4DPointFloat * GetEdgeNormal(int index)
[AI] Returns a pointer to the 4D edge normal at the given sub-edge index.
Mx4DPointFloat * GetUnknown0x14()
[AI] Returns a pointer to the cached 4D normal or reference plane for the edge.
Represents the active 3D world, holding all entity, animation, sound, path, and ROI objects.
LegoPathBoundary * FindPathBoundary(const char *p_name)
Finds a path boundary in all path controllers by name.
void Scale(const float &p_x, const float &p_y, const float &p_z)
Applies scaling factors along X, Y, and Z axes.
[AI] Represents a 3D point with floating-point precision, inheriting from Vector3.
[AI] 4D point class for floating point values.
float & index_operator(int idx)
[AI] Explicit indexed access wrapper (alias for operator[]).
[AI] Represents a 4x4 transformation matrix, specialized for the LEGO Island engine and derived from ...
virtual void UnregisterClient(MxCore *p_client)
[AI] Unregisters (marks for destruction) a previously registered client.
virtual void RegisterClient(MxCore *p_client, MxTime p_interval)
[AI] Registers an MxCore object to receive periodic tickles.
MxLong GetTime()
Returns the current timer value in ms, depending on running state.
const Matrix4 & GetLocal2World() const
Accessor for the current local-to-world transformation matrix.
virtual void VTable0x14()
[AI] Calls VTable0x1c().
void FUN_100a58f0(const Matrix4 &p_transform)
Assigns the given matrix as the local-to-world transformation and enables some internal flags.
void SetVisibility(unsigned char p_visible)
[AI] Sets the visibility flag to the provided value.
virtual float Dot(const float *p_a, const float *p_b) const
[AI] Compute the dot product of the two float arrays interpreted as vectors of 2 elements.
ViewLODList * Lookup(const ROIName &) const
[AI] Looks up an existing ViewLODList by ROI name, incrementing its reference count.
[AI] Reference-counted list of Level-of-Detail (LOD) objects associated with a single ROI (Realtime O...
int Release()
[AI] Decrements the reference count.
void RemoveROIDetailFromScene(ViewROI *p_roi)
[AI] Removes the currently active LOD detail from the rendering scene for the given ROI and detaches ...
int GetUnknown0xe0()
[AI] Gets the value of an internal state field at offset 0xe0.
void SetLODList(ViewLODList *lodList)
[AI] Sets the ViewLODList for this ROI, managing reference counting.
#define DECOMP_SIZE_ASSERT(T, S)
const char * g_plantLodNames[4][5]
MxU32 g_plantAnimationId[4]
LegoPlantInfo g_plantInfo[81]
LegoPlantInfo g_plantInfoInit[81]
[AI] Static global array of all initial plant data for the island (81 entries).
#define NULL
[AI] Null pointer value (C/C++ semantics).
#define FAILURE
[AI] Used to indicate a failed operation in result codes.
#define SUCCESS
[AI] Used to indicate a successful operation in result codes.
LegoVideoManager * VideoManager()
[AI] Accessor for the game's LegoVideoManager subsystem. Used for managing 3D/video hardware....
LegoCharacterManager * CharacterManager()
[AI] Accessor for the character manager, which manages in-game characters/NPCs. [AI]
void DeleteObjects(MxAtomId *p_id, MxS32 p_first, MxS32 p_last)
[AI] Batch deletes objects, given by atom id, and within the entity id range [p_first,...
ViewLODListManager * GetViewLODListManager()
[AI] Returns the global ViewLODListManager for view LOD (Level of Detail) resources....
LegoWorld * CurrentWorld()
[AI] Accessor for the currently active LegoWorld instance. [AI]
#define MxTrace(args)
[AI] Macro for trace logging (non-variadic version, MSVC compatibility), expands to nothing.
MxTimer * Timer()
[AI] Returns the global simulation timer.
MxTickleManager * TickleManager()
[AI] Provides access to the global tickle manager.
@ c_AnimBld18
[AI] Building animation 18. [AI]
@ c_AnimC1
[AI] Animation block C1. [AI]
[AI] Contains global script AtomId pointers and utility functions for managing script AtomIds in LEGO...
MxAtomId * g_sndAnimScript
[AI] Script AtomId for sound animation or related cutscenes.
[AI] Struct representing a single plant's static configuration on LEGO Island, including placement,...
MxS8 m_initialUnk0x16
[AI] Initial value to be loaded into m_unk0x16 (reset/restore behavior) [AI]
MxU32 m_sound
[AI] Sound ID or sound group associated with this plant (e.g. upon interaction or environment event) ...
MxU8 m_color
[AI] Color enum value, determines plant's rendering color [AI]
MxS8 m_unk0x16
[AI] Unknown; appears to be a state variable, possibly animation frame or LOD index [AI]
float m_direction[3]
[AI] Orientation direction vector, typically for forward orientation of plant (for animation/transfor...
float m_up[3]
[AI] Up direction vector, typically (0,1,0) but can be used for skew or special display [AI]
MxU8 m_variant
[AI] Variant enum value specifying geometry/model [AI]
MxU32 m_move
[AI] Movement/action type (for animation, swaying, interactive move, etc.) [AI]
LegoPathBoundary * m_boundary
[AI] Pointer to a collision or path boundary for this plant, if any [AI]
float m_y
[AI] World Y position (vertical/elevation) [AI]
@ e_flower
[AI] Standard flower
MxU8 m_mood
[AI] Mood state; used for animation, facial expression, etc. [AI]
LegoEntity * m_entity
[AI] Pointer to the associated entity instance (initialized later at runtime) [AI]
float m_position[3]
[AI] Alternate position array (likely for display, reference, or bounding computations) [AI]
[AI] Structure for scheduling plant ROI/entity animations (i.e.
MxLong m_time
[AI] When the animation should end (absolute time) [AI]
LegoROI * m_roi
[AI] ROI of the animated plant entity [AI]
LegoEntity * m_entity
[AI] Pointer to the plant entity being animated [AI]