Melee Modding Library  2.0.0
A C library for modding Super Smash Bros Melee
Data Structures
logic.h File Reference

Defines structs for AI logic. More...

#include "gctypes.h"

Go to the source code of this file.

Data Structures

union  FunctionArg
 Function Argument. More...
 
struct  FunctionCall
 Describes a function call. More...
 
struct  Logic
 Describes simple if-then logic. More...
 

Detailed Description

Defines structs for AI logic.


Data Structure Documentation

union FunctionArg

Function Argument.

This union allows for a function to accept multiple data types as parameters. Since it is marked as a transparent_union it is always passed as a 32-bit integer in the standard registers. Thus, if a function has the signature void foo(u32) it is valid to call it as foo(FunctionArg) . However, void bar(float) would expect the parameter to be in a floating-point register, thus calling bar(FunctionArg) is not valid.

See also
https://gcc.gnu.org/onlinedocs/gcc-3.3/gcc/Type-Attributes.html
Data Fields
u32 u

32-bit unsigned integer

s32 s

32-bit signed integer

f32 f

32-bit floating-point value

void * p

pointer (32-bits)

struct FunctionCall

Describes a function call.

Allows for a function call to be stored in memory. Essentially, a function pointer with arguments.

Data Fields
void * function

function pointer

FunctionArg arg1

first argument of function call

FunctionArg arg2

second argument of function call

struct Logic

Describes simple if-then logic.

Essentially captures the behavior of an if statement in a compact struct. This allows for arrays of 'logic' (if-else chain) to be stored in memory and accessed at specific times.

Data Fields
FunctionCall condition

function that returns bool

FunctionCall action

function to call if condition returns true