Isle
Loading...
Searching...
No Matches
mxutilities.cpp File Reference
#include "mxutilities.h"
#include "mxcompositepresenter.h"
#include "mxdsaction.h"
#include "mxdsactionlist.h"
#include "mxdsfile.h"
#include "mxdsmultiaction.h"
#include "mxdsobject.h"
#include "mxgeometry.h"
#include "mxpresenterlist.h"
#include <assert.h>
Include dependency graph for mxutilities.cpp:

Go to the source code of this file.

Functions

MxBool GetRectIntersection (MxS32 p_rect1Width, MxS32 p_rect1Height, MxS32 p_rect2Width, MxS32 p_rect2Height, MxS32 *p_rect1Left, MxS32 *p_rect1Top, MxS32 *p_rect2Left, MxS32 *p_rect2Top, MxS32 *p_width, MxS32 *p_height)
 Computes intersection of two rectangles and modifies their positions and dimensions to the intersection area. More...
 
void MakeSourceName (char *p_output, const char *p_input)
 Parses an SI source filename and normalizes it for use in the engine. More...
 
MxBool KeyValueStringParse (char *p_output, const char *p_command, const char *p_string)
 Searches p_string for a key command and copies its associated value to p_output. More...
 
MxBool ContainsPresenter (MxCompositePresenterList &p_presenterList, MxPresenter *p_presenter)
 Determines if a presenter exists within a composite presenter hierarchy. More...
 
void OmniError (const char *p_message, MxS32 p_status)
 Displays or logs an error message using the current user message handler, or aborts on error status if none is set. More...
 
void SetOmniUserMessage (void(*p_omniUserMessage)(const char *, MxS32))
 Sets the callback to handle user messages, such as errors or logs, for the OMNI engine. More...
 
void FUN_100b7220 (MxDSAction *p_action, MxU32 p_newFlags, MxBool p_setFlags)
 Recursively sets or clears flags for an MxDSAction and all sub-actions if applicable. More...
 

Variables

void(* g_omniUserMessage )(const char *, MxS32) = NULL
 

Function Documentation

◆ ContainsPresenter()

MxBool ContainsPresenter ( MxCompositePresenterList p_presenterList,
MxPresenter p_presenter 
)

Determines if a presenter exists within a composite presenter hierarchy.

[AI]

[AI] Searches recursively within all composite presenters for an exact pointer match or type match.

Parameters
p_presenterList[AI] Reference to list of composite presenters.
p_presenter[AI] Presenter to look for.
Returns
TRUE if found, FALSE otherwise. [AI]

Definition at line 122 of file mxutilities.cpp.

◆ FUN_100b7220()

void FUN_100b7220 ( MxDSAction p_action,
MxU32  p_newFlags,
MxBool  p_setFlags 
)

Recursively sets or clears flags for an MxDSAction and all sub-actions if applicable.

[AI]

[AI] If the object is a MxDSMultiAction, recurses into its action list, updating flags for all contained actions.

Parameters
p_action[AI] The root action to update.
p_newFlags[AI] Flags to set or clear.
p_setFlags[AI] TRUE to set bits, FALSE to clear bits in the action's flags. [AI_SUGGESTED_NAME: SetActionFlagsRecursive]

Definition at line 153 of file mxutilities.cpp.

◆ GetRectIntersection()

MxBool GetRectIntersection ( MxS32  p_rect1Width,
MxS32  p_rect1Height,
MxS32  p_rect2Width,
MxS32  p_rect2Height,
MxS32 p_rect1Left,
MxS32 p_rect1Top,
MxS32 p_rect2Left,
MxS32 p_rect2Top,
MxS32 p_width,
MxS32 p_height 
)

Computes intersection of two rectangles and modifies their positions and dimensions to the intersection area.

[AI]

[AI] Used to find overlapping portions when rendering or handling collision/visibility in 2D screen/UI contexts. Modifies parameters in-place.

Parameters
p_rect1Width[AI] Width of first rectangle.
p_rect1Height[AI] Height of first rectangle.
p_rect2Width[AI] Width of second rectangle.
p_rect2Height[AI] Height of second rectangle.
p_rect1Left[AI] Pointer to X of top-left of first rectangle (modified to intersection).
p_rect1Top[AI] Pointer to Y of top-left of first rectangle (modified to intersection).
p_rect2Left[AI] Pointer to X of top-left of second rectangle (modified to intersection).
p_rect2Top[AI] Pointer to Y of top-left of second rectangle (modified to intersection).
p_width[AI] Pointer to width of the intersection area.
p_height[AI] Pointer to height of the intersection area.
Returns
TRUE if the rectangles intersect, FALSE otherwise. [AI]

Definition at line 19 of file mxutilities.cpp.

◆ KeyValueStringParse()

MxBool KeyValueStringParse ( char *  p_output,
const char *  p_command,
const char *  p_string 
)

Searches p_string for a key command and copies its associated value to p_output.

[AI]

[AI] For commands like "foo:123, bar:456", if p_command is "bar" then p_output becomes "456". Used in config or SI parsing.

Parameters
p_output[AI] Buffer for found value.
p_command[AI] Key to search for.
p_string[AI] String to search in.
Returns
TRUE if key is found, FALSE otherwise. [AI]

Definition at line 85 of file mxutilities.cpp.

◆ MakeSourceName()

void MakeSourceName ( char *  p_output,
const char *  p_input 
)

Parses an SI source filename and normalizes it for use in the engine.

[AI]

[AI] Removes any disk designator (e.g., 'C:') and ".si" extension, and makes string lowercase.

Parameters
p_output[AI] Output buffer for source name.
p_input[AI] Input filename (may include drive, extension, etc.).

Definition at line 66 of file mxutilities.cpp.

◆ OmniError()

void OmniError ( const char *  p_message,
MxS32  p_status 
)

Displays or logs an error message using the current user message handler, or aborts on error status if none is set.

[AI]

[AI] If the callback is not set and status is non-zero, aborts process. Otherwise, invokes callback.

Parameters
p_message[AI] Null-terminated error message.
p_status[AI] Status code or severity.

Definition at line 135 of file mxutilities.cpp.

◆ SetOmniUserMessage()

void SetOmniUserMessage ( void(*)(const char *, MxS32 p_omniUserMessage)

Sets the callback to handle user messages, such as errors or logs, for the OMNI engine.

[AI]

[AI] The callback is a function pointer invoked by OmniError.

Parameters
p_omniUserMessage[AI] Callback function accepting a string message and status integer.

Definition at line 146 of file mxutilities.cpp.

Variable Documentation

◆ g_omniUserMessage

void(* g_omniUserMessage) (const char *, MxS32) ( const char *  ,
MxS32   
) = NULL

Definition at line 15 of file mxutilities.cpp.