Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
Data Structures | Macros | Enumerations | Functions | Variables
object_list_processor.h File Reference

Go to the source code of this file.

Data Structures

struct  NumTimesCalled
 

Macros

#define TIME_STOP_UNKNOWN_0   (1 << 0)
 Flags for gTimeStopState. More...
 
#define TIME_STOP_ENABLED   (1 << 1)
 
#define TIME_STOP_UNKNOWN_2   (1 << 2)
 
#define TIME_STOP_MARIO_AND_DOORS   (1 << 3)
 
#define TIME_STOP_ALL_OBJECTS   (1 << 4)
 
#define TIME_STOP_MARIO_OPENED_DOOR   (1 << 5)
 
#define TIME_STOP_ACTIVE   (1 << 6)
 
#define OBJECT_POOL_CAPACITY   240
 The maximum number of objects that can be loaded at once. More...
 

Enumerations

enum  ObjectList {
  OBJ_LIST_PLAYER, OBJ_LIST_UNUSED_1, OBJ_LIST_DESTRUCTIVE, OBJ_LIST_UNUSED_3,
  OBJ_LIST_GENACTOR, OBJ_LIST_PUSHABLE, OBJ_LIST_LEVEL, OBJ_LIST_UNUSED_7,
  OBJ_LIST_DEFAULT, OBJ_LIST_SURFACE, OBJ_LIST_POLELIKE, OBJ_LIST_SPAWNER,
  OBJ_LIST_UNIMPORTANT, NUM_OBJ_LISTS
}
 Every object is categorized into an object list, which controls the order they are processed and which objects they can collide with. More...
 

Functions

void bhv_mario_update (void)
 Mario's primary behavior update function. More...
 
void set_object_respawn_info_bits (struct Object *obj, u8 bits)
 OR the object's respawn info with bits << 8. More...
 
void unload_objects_from_area (s32 unused, s32 areaIndex)
 
void spawn_objects_from_info (s32 unused, struct SpawnInfo *spawnInfo)
 
void clear_objects (void)
 Clear objects, dynamic surfaces, and some miscellaneous level data used by objects. More...
 
void update_objects (s32 unused)
 

Variables

struct ObjectNode gObjectListArray []
 Nodes used to represent the doubly linked object lists. More...
 
s32 gDebugInfoFlags
 Flags controlling what debug info is displayed. More...
 
s32 gNumFindFloorMisses
 The number of times per frame find_floor found no floor beneath an object, and therefore either returned a dynamic floor or NULL. More...
 
UNUSED s32 unused_8033BEF8
 
s32 gUnknownWallCount
 An unused debug counter with the label "WALL". More...
 
u32 gObjectCounter
 Roughly the number of objects that have been processed this frame so far. More...
 
struct NumTimesCalled gNumCalls
 The number of times find_floor, find_ceil, and find_wall_collisions have been called respectively. More...
 
s16 gDebugInfo [][8]
 An array of debug controls that could be used to tweak in-game parameters. More...
 
s16 gDebugInfoOverwrite [][8]
 
u32 gTimeStopState
 A set of flags to control which objects are updated on a given frame. More...
 
struct Object gObjectPool []
 The pool that objects are allocated from. More...
 
struct Object gMacroObjectDefaultParent
 A special object whose purpose is to act as a parent for macro objects. More...
 
struct ObjectNodegObjectLists
 A pointer to gObjectListArray. More...
 
struct ObjectNode gFreeObjectList
 A singly linked list of available slots in the object pool. More...
 
struct ObjectgMarioObject
 The object representing mario. More...
 
struct ObjectgLuigiObject
 An object variable that may have been used to represent the planned second player. More...
 
struct ObjectgCurrentObject
 The object whose behavior script is currently being updated. More...
 
u32gBehCommand
 The next object behavior command to be executed. More...
 
s16 gPrevFrameObjectCount
 The number of objects that were processed last frame, which may miss some objects that were spawned last frame and all objects that were spawned this frame. More...
 
s32 gSurfaceNodesAllocated
 The total number of surface nodes allocated (a node is allocated for each spatial partition cell that a surface intersects). More...
 
s32 gSurfacesAllocated
 The total number of surfaces allocated. More...
 
s32 gNumStaticSurfaceNodes
 The number of nodes that have been created for surfaces. More...
 
s32 gNumStaticSurfaces
 The number of surfaces in the pool. More...
 
struct MemoryPoolgObjectMemoryPool
 A pool used by chain chomp and wiggler to allocate their body parts. More...
 

Macro Definition Documentation

◆ OBJECT_POOL_CAPACITY

#define OBJECT_POOL_CAPACITY   240

The maximum number of objects that can be loaded at once.

◆ TIME_STOP_ACTIVE

#define TIME_STOP_ACTIVE   (1 << 6)

◆ TIME_STOP_ALL_OBJECTS

#define TIME_STOP_ALL_OBJECTS   (1 << 4)

◆ TIME_STOP_ENABLED

#define TIME_STOP_ENABLED   (1 << 1)

◆ TIME_STOP_MARIO_AND_DOORS

#define TIME_STOP_MARIO_AND_DOORS   (1 << 3)

◆ TIME_STOP_MARIO_OPENED_DOOR

#define TIME_STOP_MARIO_OPENED_DOOR   (1 << 5)

◆ TIME_STOP_UNKNOWN_0

#define TIME_STOP_UNKNOWN_0   (1 << 0)

Flags for gTimeStopState.

These control which objects are processed each frame and also track some miscellaneous info.

◆ TIME_STOP_UNKNOWN_2

#define TIME_STOP_UNKNOWN_2   (1 << 2)

Enumeration Type Documentation

◆ ObjectList

enum ObjectList

Every object is categorized into an object list, which controls the order they are processed and which objects they can collide with.

Enumerator
OBJ_LIST_PLAYER 
OBJ_LIST_UNUSED_1 
OBJ_LIST_DESTRUCTIVE 
OBJ_LIST_UNUSED_3 
OBJ_LIST_GENACTOR 
OBJ_LIST_PUSHABLE 
OBJ_LIST_LEVEL 
OBJ_LIST_UNUSED_7 
OBJ_LIST_DEFAULT 
OBJ_LIST_SURFACE 
OBJ_LIST_POLELIKE 
OBJ_LIST_SPAWNER 
OBJ_LIST_UNIMPORTANT 
NUM_OBJ_LISTS 

Function Documentation

◆ bhv_mario_update()

void bhv_mario_update ( void  )

Mario's primary behavior update function.

◆ clear_objects()

void clear_objects ( void  )

Clear objects, dynamic surfaces, and some miscellaneous level data used by objects.

◆ set_object_respawn_info_bits()

void set_object_respawn_info_bits ( struct Object obj,
u8  bits 
)

OR the object's respawn info with bits << 8.

If bits = 0xFF, this prevents the object from respawning after leaving and re-entering the area. For macro objects, respawnInfo points to the 16 bit entry in the macro object list. For other objects, it points to the 32 bit behaviorArg in the SpawnInfo.

◆ spawn_objects_from_info()

void spawn_objects_from_info ( s32  unused,
struct SpawnInfo spawnInfo 
)

◆ unload_objects_from_area()

void unload_objects_from_area ( s32  unused,
s32  areaIndex 
)

◆ update_objects()

void update_objects ( s32  unused)

Variable Documentation

◆ gBehCommand

u32* gBehCommand

The next object behavior command to be executed.

◆ gCurrentObject

struct Object* gCurrentObject

The object whose behavior script is currently being updated.

This object is used frequently in object behavior code, and so is often aliased as "o".

◆ gDebugInfo

s16 gDebugInfo[][8]

An array of debug controls that could be used to tweak in-game parameters.

The only used rows are [4] and [5] (effectinfo and enemyinfo).

◆ gDebugInfoFlags

s32 gDebugInfoFlags

Flags controlling what debug info is displayed.

◆ gDebugInfoOverwrite

s16 gDebugInfoOverwrite[][8]

◆ gFreeObjectList

struct ObjectNode gFreeObjectList

A singly linked list of available slots in the object pool.

◆ gLuigiObject

struct Object* gLuigiObject

An object variable that may have been used to represent the planned second player.

This is speculation, based on its position and its usage in shadow.c.

◆ gMacroObjectDefaultParent

struct Object gMacroObjectDefaultParent

A special object whose purpose is to act as a parent for macro objects.

◆ gMarioObject

struct Object* gMarioObject

The object representing mario.

◆ gNumCalls

The number of times find_floor, find_ceil, and find_wall_collisions have been called respectively.

◆ gNumFindFloorMisses

s32 gNumFindFloorMisses

The number of times per frame find_floor found no floor beneath an object, and therefore either returned a dynamic floor or NULL.

◆ gNumStaticSurfaceNodes

s32 gNumStaticSurfaceNodes

The number of nodes that have been created for surfaces.

◆ gNumStaticSurfaces

s32 gNumStaticSurfaces

The number of surfaces in the pool.

◆ gObjectCounter

u32 gObjectCounter

Roughly the number of objects that have been processed this frame so far.

A bug in update_terrain_objects makes this count inaccurate.

◆ gObjectListArray

struct ObjectNode gObjectListArray[]

Nodes used to represent the doubly linked object lists.

◆ gObjectLists

struct ObjectNode* gObjectLists

A pointer to gObjectListArray.

Given an object list index idx, gObjectLists[idx] is the head of a doubly linked list of all currently spawned objects in the list.

◆ gObjectMemoryPool

struct MemoryPool* gObjectMemoryPool

A pool used by chain chomp and wiggler to allocate their body parts.

◆ gObjectPool

struct Object gObjectPool[]

The pool that objects are allocated from.

◆ gPrevFrameObjectCount

s16 gPrevFrameObjectCount

The number of objects that were processed last frame, which may miss some objects that were spawned last frame and all objects that were spawned this frame.

It also includes objects that were unloaded last frame. Besides this, a bug in update_terrain_objects makes this count inaccurate.

◆ gSurfaceNodesAllocated

s32 gSurfaceNodesAllocated

The total number of surface nodes allocated (a node is allocated for each spatial partition cell that a surface intersects).

◆ gSurfacesAllocated

s32 gSurfacesAllocated

The total number of surfaces allocated.

◆ gTimeStopState

u32 gTimeStopState

A set of flags to control which objects are updated on a given frame.

This is used during dialog and cutscenes to freeze most objects in place.

◆ gUnknownWallCount

s32 gUnknownWallCount

An unused debug counter with the label "WALL".

◆ unused_8033BEF8

UNUSED s32 unused_8033BEF8