![]() |
Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
|
Go to the source code of this file.
Data Structures | |
struct | FnGraphNode |
An extension of a graph node that includes a function pointer. More... | |
struct | GraphNodeRoot |
The very root of the geo tree. More... | |
struct | GraphNodeOrthoProjection |
A node that sets up an orthographic projection based on the global root node. More... | |
struct | GraphNodePerspective |
A node that sets up a perspective projection. More... | |
struct | DisplayListNode |
An entry in the master list. More... | |
struct | GraphNodeMasterList |
GraphNode that manages the 8 top-level display lists that will be drawn Each list has its own render mode, so for example water is drawn in a different master list than opaque objects. More... | |
struct | GraphNodeStart |
Simply used as a parent to group multiple children. More... | |
struct | GraphNodeLevelOfDetail |
GraphNode that only renders its children if the current transformation matrix has a z-translation (in camera space) greater than minDistance and less than maxDistance. More... | |
struct | GraphNodeSwitchCase |
GraphNode that renders exactly one of its children. More... | |
struct | GraphNodeCamera |
GraphNode that specifies the location and aim of the camera. More... | |
struct | GraphNodeTranslationRotation |
GraphNode that translates and rotates its children. More... | |
struct | GraphNodeTranslation |
GraphNode that translates itself and its children. More... | |
struct | GraphNodeRotation |
GraphNode that rotates itself and its children. More... | |
struct | GraphNodeAnimatedPart |
GraphNode part that transforms itself and its children based on animation data. More... | |
struct | GraphNodeBillboard |
A GraphNode that draws a display list rotated in a way to always face the camera. More... | |
struct | GraphNodeDisplayList |
A GraphNode that simply draws a display list without doing any transformation beforehand. More... | |
struct | GraphNodeScale |
GraphNode part that scales itself and its children. More... | |
struct | GraphNodeShadow |
GraphNode that draws a shadow under an object. More... | |
struct | GraphNodeObjectParent |
GraphNode that contains as its sharedChild a group node containing all object nodes. More... | |
struct | GraphNodeGenerated |
GraphNode that draws display lists not directly in memory but generated by a function. More... | |
struct | GraphNodeBackground |
GraphNode that draws a background image or a rectangle of a color. More... | |
struct | GraphNodeHeldObject |
Renders the object that Mario is holding. More... | |
struct | GraphNodeCullingRadius |
A node that allows an object to specify a different culling radius than the default one of 300. More... | |
Typedefs | |
typedef s32(* | GraphNodeFunc) (s32 callContext, struct GraphNode *node, void *context) |
Functions | |
void | init_scene_graph_node_links (struct GraphNode *, s32) |
Initialize a geo node with a given type. More... | |
struct GraphNodeRoot * | init_graph_node_root (struct AllocOnlyPool *, struct GraphNodeRoot *, s16, s16 x, s16 y, s16 width, s16 height) |
Allocated and returns a newly created root node. More... | |
struct GraphNodeOrthoProjection * | init_graph_node_ortho_projection (struct AllocOnlyPool *, struct GraphNodeOrthoProjection *, f32) |
Allocates and returns a newly created otrhographic projection node. More... | |
struct GraphNodePerspective * | init_graph_node_perspective (struct AllocOnlyPool *pool, struct GraphNodePerspective *sp1c, f32 sp20, s16 sp26, s16 sp2a, GraphNodeFunc sp2c, s32 sp30) |
Allocates and returns a newly created perspective node. More... | |
struct GraphNodeStart * | init_graph_node_start (struct AllocOnlyPool *pool, struct GraphNodeStart *sp1c) |
Allocates and returns a newly created start node. More... | |
struct GraphNodeMasterList * | init_graph_node_master_list (struct AllocOnlyPool *pool, struct GraphNodeMasterList *, s16 sp22) |
Allocates and returns a newly created master list node. More... | |
struct GraphNodeLevelOfDetail * | init_graph_node_render_range (struct AllocOnlyPool *pool, struct GraphNodeLevelOfDetail *graphNode, s16 minDistance, s16 maxDistance) |
Allocates and returns a newly created render range node. More... | |
struct GraphNodeSwitchCase * | init_graph_node_switch_case (struct AllocOnlyPool *pool, struct GraphNodeSwitchCase *graphNode, s16 numCases, s16 sp26, GraphNodeFunc nodeFunc, s32 sp2c) |
Allocates and returns a newly created switch case node. More... | |
struct GraphNodeCamera * | init_graph_node_camera (struct AllocOnlyPool *pool, struct GraphNodeCamera *sp1c, f32 *sp20, f32 *sp24, GraphNodeFunc sp28, s32 sp2c) |
Allocates and returns a newly created camera node. More... | |
struct GraphNodeTranslationRotation * | init_graph_node_translation_rotation (struct AllocOnlyPool *pool, struct GraphNodeTranslationRotation *graphNode, s32 drawingLayer, void *displayList, Vec3s sp28, Vec3s sp2c) |
Allocates and returns a newly created translation rotation node. More... | |
struct GraphNodeTranslation * | init_graph_node_translation (struct AllocOnlyPool *pool, struct GraphNodeTranslation *graphNode, s32 drawingLayer, void *displayList, Vec3s sp28) |
Allocates and returns a newly created translation node. More... | |
struct GraphNodeRotation * | init_graph_node_rotation (struct AllocOnlyPool *pool, struct GraphNodeRotation *graphNode, s32 drawingLayer, void *displayList, Vec3s sp28) |
Allocates and returns a newly created rotation node. More... | |
struct GraphNodeScale * | init_graph_node_scale (struct AllocOnlyPool *pool, struct GraphNodeScale *graphNode, s32 drawingLayer, void *displayList, f32 sp28) |
Allocates and returns a newly created scaling node. More... | |
struct GraphNodeObject * | init_graph_node_object (struct AllocOnlyPool *pool, struct GraphNodeObject *graphNode, struct GraphNode *sp20, Vec3f pos, Vec3s angle, Vec3f scale) |
Allocates and returns a newly created object node. More... | |
struct GraphNodeCullingRadius * | init_graph_node_culling_radius (struct AllocOnlyPool *pool, struct GraphNodeCullingRadius *sp1c, s16 sp22) |
Allocates and returns a newly created frustum culling radius node. More... | |
struct GraphNodeAnimatedPart * | init_graph_node_animated_part (struct AllocOnlyPool *pool, struct GraphNodeAnimatedPart *graphNode, s32 drawingLayer, void *displayList, Vec3s relativePos) |
Allocates and returns a newly created animated part node. More... | |
struct GraphNodeBillboard * | init_graph_node_billboard (struct AllocOnlyPool *pool, struct GraphNodeBillboard *graphNode, s32 drawingLayer, void *displayList, Vec3s sp28) |
Allocates and returns a newly created billboard node. More... | |
struct GraphNodeDisplayList * | init_graph_node_display_list (struct AllocOnlyPool *pool, struct GraphNodeDisplayList *graphNode, s32 drawingLayer, void *displayList) |
Allocates and returns a newly created displaylist node. More... | |
struct GraphNodeShadow * | init_graph_node_shadow (struct AllocOnlyPool *pool, struct GraphNodeShadow *sp1c, s16 sp22, u8 sp27, u8 sp2b) |
Allocates and returns a newly created shadow node. More... | |
struct GraphNodeObjectParent * | init_graph_node_object_parent (struct AllocOnlyPool *pool, struct GraphNodeObjectParent *sp1c, struct GraphNode *sp20) |
Allocates and returns a newly created object parent node. More... | |
struct GraphNodeGenerated * | init_graph_node_generated (struct AllocOnlyPool *pool, struct GraphNodeGenerated *sp1c, GraphNodeFunc sp20, s32 sp24) |
Allocates and returns a newly created generated node. More... | |
struct GraphNodeBackground * | init_graph_node_background (struct AllocOnlyPool *pool, struct GraphNodeBackground *sp1c, u16 sp22, GraphNodeFunc sp24, s32 sp28) |
Allocates and returns a newly created background node. More... | |
struct GraphNodeHeldObject * | init_graph_node_held_object (struct AllocOnlyPool *pool, struct GraphNodeHeldObject *sp1c, s32 sp20, Vec3s sp24, GraphNodeFunc sp28, s32 sp2c) |
Allocates and returns a newly created held object node. More... | |
struct GraphNode * | geo_add_child (struct GraphNode *, struct GraphNode *) |
Adds 'childNode' to the end of the list children from 'parent'. More... | |
struct GraphNode * | geo_remove_child (struct GraphNode *) |
Remove a node from the scene graph. More... | |
struct GraphNode * | geo_make_first_child (struct GraphNode *a0) |
Reorders the given node so it's the first child of its parent. More... | |
void | geo_call_global_function_nodes_helper (struct GraphNode *, s32) |
Helper function for geo_call_global_function_nodes that recursively traverses the scene graph and calls the functions of global nodes. More... | |
void | geo_call_global_function_nodes (struct GraphNode *graphNode, s32 sp1c) |
Call the update functions of geo nodes that are stored in global variables. More... | |
void | geo_reset_object_node (struct GraphNodeObject *sp20) |
When objects are cleared, this is called on all object nodes (loaded or unloaded). More... | |
void | geo_obj_init (struct GraphNodeObject *sp18, void *sp1c, Vec3f sp20, Vec3s sp24) |
Initialize an object node using the given parameters. More... | |
void | geo_obj_init_spawninfo (struct GraphNodeObject *sp18, struct SpawnInfo *sp1c) |
Initialize and object node using the given SpawnInfo struct. More... | |
void | geo_obj_init_animation (struct GraphNodeObject *, void *) |
Initialize the animation of an object node. More... | |
void | geo_obj_init_animation_accel (struct GraphNodeObject *sp30, void *sp34, u32 sp38) |
Initialize the animation of an object node. More... | |
s32 | retrieve_animation_index (s32 a0, u16 **a1) |
Retrieves an index into animation data based on the attribute pointer An attribute is an x-, y- or z-component of the translation / rotation for a part Each attribute is a pair of s16's, where the first s16 represents the maximum frame and the second s16 the actual index. More... | |
s16 | geo_update_animation_frame (struct GraphNodeObject_sub *a0, s32 *a1) |
Update the animation frame of an object. More... | |
void | geo_retreive_animation_translation (struct GraphNodeObject *sp28, Vec3f sp2c) |
Unused function to retrieve an object's current animation translation Assumes that it has x, y and z data in animations, which isn't always the case since some animation types only have vertical or lateral translation. More... | |
struct GraphNodeRoot * | geo_find_root (struct GraphNode *graphNode) |
Unused function to find the root of the geo node tree, which should be a GraphNodeRoot. More... | |
s16 * | read_vec3s_to_vec3f (Vec3f, s16 *src) |
Takes a pointer to three shorts (supplied by a geo layout script) and copies it to the destination float vector. More... | |
s16 * | read_vec3s (Vec3s dst, s16 *src) |
Takes a pointer to three shorts (supplied by a geo layout script) and copies it to the destination vector. More... | |
s16 * | read_vec3s_angle (Vec3s dst, s16 *src) |
Takes a pointer to three angles in degrees (supplied by a geo layout script) and converts it to a vector of three in-game angle units in [-32768, 32767] range. More... | |
void | register_scene_graph_node (struct GraphNode *) |
Add the given graph node as a child to the current top of the gfx stack: 'gCurGraphNodeList'. More... | |
#define GEO_CONTEXT_AREA_INIT 4 |
#define GEO_CONTEXT_AREA_LOAD 3 |
#define GEO_CONTEXT_AREA_UNLOAD 2 |
#define GEO_CONTEXT_CREATE 0 |
#define GEO_CONTEXT_HELD_OBJ 5 |
#define GEO_CONTEXT_RENDER 1 |
#define GFX_NUM_MASTER_LISTS 8 |
#define GRAPH_NODE_TYPE_ANIMATED_PART 0x019 |
#define GRAPH_NODE_TYPE_BACKGROUND (0x02C | GRAPH_NODE_TYPE_FUNCTIONAL) |
#define GRAPH_NODE_TYPE_BILLBOARD 0x01A |
#define GRAPH_NODE_TYPE_CAMERA (0x014 | GRAPH_NODE_TYPE_FUNCTIONAL) |
#define GRAPH_NODE_TYPE_CULLING_RADIUS 0x02F |
#define GRAPH_NODE_TYPE_DISPLAY_LIST 0x01B |
#define GRAPH_NODE_TYPE_FUNCTIONAL 0x100 |
#define GRAPH_NODE_TYPE_GENERATED_LIST (0x02A | GRAPH_NODE_TYPE_FUNCTIONAL) |
#define GRAPH_NODE_TYPE_HELD_OBJ (0x02E | GRAPH_NODE_TYPE_FUNCTIONAL) |
#define GRAPH_NODE_TYPE_LEVEL_OF_DETAIL 0x00B |
#define GRAPH_NODE_TYPE_MASTER_LIST 0x004 |
#define GRAPH_NODE_TYPE_OBJECT 0x018 |
#define GRAPH_NODE_TYPE_OBJECT_PARENT 0x029 |
#define GRAPH_NODE_TYPE_ORTHO_PROJECTION 0x002 |
#define GRAPH_NODE_TYPE_PERSPECTIVE (0x003 | GRAPH_NODE_TYPE_FUNCTIONAL) |
#define GRAPH_NODE_TYPE_ROOT 0x001 |
#define GRAPH_NODE_TYPE_ROTATION 0x017 |
#define GRAPH_NODE_TYPE_SCALE 0x01C |
#define GRAPH_NODE_TYPE_SHADOW 0x028 |
#define GRAPH_NODE_TYPE_START 0x00A |
#define GRAPH_NODE_TYPE_SWITCH_CASE (0x00C | GRAPH_NODE_TYPE_FUNCTIONAL) |
#define GRAPH_NODE_TYPE_TRANSLATION 0x016 |
#define GRAPH_NODE_TYPE_TRANSLATION_ROTATION 0x015 |
#define GRAPH_RENDER_ACTIVE (1 << 0) |
#define GRAPH_RENDER_BILLBOARD (1 << 2) |
#define GRAPH_RENDER_CHILDREN_FIRST (1 << 1) |
#define GRAPH_RENDER_HAS_ANIMATION (1 << 5) |
#define GRAPH_RENDER_INVISIBLE (1 << 4) |
#define GRAPH_RENDER_Z_BUFFER (1 << 3) |
Adds 'childNode' to the end of the list children from 'parent'.
Call the update functions of geo nodes that are stored in global variables.
These variables include gCurGraphNodeMasterList, gCurGraphNodeCamFrustum, gCurGraphNodeCamera and gCurGraphNodeObject. callContext is one of the GEO_CONTEXT_ defines. The graphNode argument should be of type GraphNodeRoot.
Helper function for geo_call_global_function_nodes that recursively traverses the scene graph and calls the functions of global nodes.
struct GraphNodeRoot* geo_find_root | ( | struct GraphNode * | graphNode | ) |
Unused function to find the root of the geo node tree, which should be a GraphNodeRoot.
If it is not for some reason, null is returned.
Reorders the given node so it's the first child of its parent.
This is called on the Mario object when he is spawned. That's why Mario's object is always drawn before any other objects. (Note that the geo order is independent from processing group order, where Mario is not first.)
Initialize an object node using the given parameters.
void geo_obj_init_animation | ( | struct GraphNodeObject * | , |
void * | |||
) |
Initialize the animation of an object node.
void geo_obj_init_animation_accel | ( | struct GraphNodeObject * | sp30, |
void * | sp34, | ||
u32 | sp38 | ||
) |
Initialize the animation of an object node.
void geo_obj_init_spawninfo | ( | struct GraphNodeObject * | sp18, |
struct SpawnInfo * | sp1c | ||
) |
Initialize and object node using the given SpawnInfo struct.
Remove a node from the scene graph.
It changes the links with its siblings and with its parent, it doesn't deallocate the memory since geo nodes are allocated in a pointer-bumping pool that gets thrown out when changing areas.
void geo_reset_object_node | ( | struct GraphNodeObject * | sp20 | ) |
When objects are cleared, this is called on all object nodes (loaded or unloaded).
void geo_retreive_animation_translation | ( | struct GraphNodeObject * | obj, |
Vec3f | position | ||
) |
Unused function to retrieve an object's current animation translation Assumes that it has x, y and z data in animations, which isn't always the case since some animation types only have vertical or lateral translation.
This might have been used for positioning the shadow under an object, which currently happens in-line in geo_process_shadow where it also accounts for animations without lateral translation.
s16 geo_update_animation_frame | ( | struct GraphNodeObject_sub * | obj, |
s32 * | accelAssist | ||
) |
Update the animation frame of an object.
The animation flags determine whether it plays forwards or backwards, and whether it stops or loops at the end etc.
struct GraphNodeAnimatedPart* init_graph_node_animated_part | ( | struct AllocOnlyPool * | pool, |
struct GraphNodeAnimatedPart * | graphNode, | ||
s32 | drawingLayer, | ||
void * | displayList, | ||
Vec3s | relativePos | ||
) |
Allocates and returns a newly created animated part node.
struct GraphNodeBackground* init_graph_node_background | ( | struct AllocOnlyPool * | pool, |
struct GraphNodeBackground * | sp1c, | ||
u16 | sp22, | ||
GraphNodeFunc | sp24, | ||
s32 | sp28 | ||
) |
Allocates and returns a newly created background node.
struct GraphNodeBillboard* init_graph_node_billboard | ( | struct AllocOnlyPool * | pool, |
struct GraphNodeBillboard * | graphNode, | ||
s32 | drawingLayer, | ||
void * | displayList, | ||
Vec3s | sp28 | ||
) |
Allocates and returns a newly created billboard node.
struct GraphNodeCamera* init_graph_node_camera | ( | struct AllocOnlyPool * | pool, |
struct GraphNodeCamera * | sp1c, | ||
f32 * | sp20, | ||
f32 * | sp24, | ||
GraphNodeFunc | sp28, | ||
s32 | sp2c | ||
) |
Allocates and returns a newly created camera node.
struct GraphNodeCullingRadius* init_graph_node_culling_radius | ( | struct AllocOnlyPool * | pool, |
struct GraphNodeCullingRadius * | sp1c, | ||
s16 | sp22 | ||
) |
Allocates and returns a newly created frustum culling radius node.
struct GraphNodeDisplayList* init_graph_node_display_list | ( | struct AllocOnlyPool * | pool, |
struct GraphNodeDisplayList * | graphNode, | ||
s32 | drawingLayer, | ||
void * | displayList | ||
) |
Allocates and returns a newly created displaylist node.
struct GraphNodeGenerated* init_graph_node_generated | ( | struct AllocOnlyPool * | pool, |
struct GraphNodeGenerated * | sp1c, | ||
GraphNodeFunc | sp20, | ||
s32 | sp24 | ||
) |
Allocates and returns a newly created generated node.
struct GraphNodeHeldObject* init_graph_node_held_object | ( | struct AllocOnlyPool * | pool, |
struct GraphNodeHeldObject * | sp1c, | ||
s32 | sp20, | ||
Vec3s | sp24, | ||
GraphNodeFunc | sp28, | ||
s32 | sp2c | ||
) |
Allocates and returns a newly created held object node.
struct GraphNodeMasterList* init_graph_node_master_list | ( | struct AllocOnlyPool * | pool, |
struct GraphNodeMasterList * | , | ||
s16 | sp22 | ||
) |
Allocates and returns a newly created master list node.
struct GraphNodeObject* init_graph_node_object | ( | struct AllocOnlyPool * | pool, |
struct GraphNodeObject * | graphNode, | ||
struct GraphNode * | sp20, | ||
Vec3f | pos, | ||
Vec3s | angle, | ||
Vec3f | scale | ||
) |
Allocates and returns a newly created object node.
struct GraphNodeObjectParent* init_graph_node_object_parent | ( | struct AllocOnlyPool * | pool, |
struct GraphNodeObjectParent * | sp1c, | ||
struct GraphNode * | sp20 | ||
) |
Allocates and returns a newly created object parent node.
struct GraphNodeOrthoProjection* init_graph_node_ortho_projection | ( | struct AllocOnlyPool * | , |
struct GraphNodeOrthoProjection * | , | ||
f32 | |||
) |
Allocates and returns a newly created otrhographic projection node.
struct GraphNodePerspective* init_graph_node_perspective | ( | struct AllocOnlyPool * | pool, |
struct GraphNodePerspective * | sp1c, | ||
f32 | sp20, | ||
s16 | sp26, | ||
s16 | sp2a, | ||
GraphNodeFunc | sp2c, | ||
s32 | sp30 | ||
) |
Allocates and returns a newly created perspective node.
struct GraphNodeLevelOfDetail* init_graph_node_render_range | ( | struct AllocOnlyPool * | pool, |
struct GraphNodeLevelOfDetail * | graphNode, | ||
s16 | minDistance, | ||
s16 | maxDistance | ||
) |
Allocates and returns a newly created render range node.
struct GraphNodeRoot* init_graph_node_root | ( | struct AllocOnlyPool * | , |
struct GraphNodeRoot * | , | ||
s16 | , | ||
s16 | x, | ||
s16 | y, | ||
s16 | width, | ||
s16 | height | ||
) |
Allocated and returns a newly created root node.
struct GraphNodeRotation* init_graph_node_rotation | ( | struct AllocOnlyPool * | pool, |
struct GraphNodeRotation * | graphNode, | ||
s32 | drawingLayer, | ||
void * | displayList, | ||
Vec3s | sp28 | ||
) |
Allocates and returns a newly created rotation node.
struct GraphNodeScale* init_graph_node_scale | ( | struct AllocOnlyPool * | pool, |
struct GraphNodeScale * | graphNode, | ||
s32 | drawingLayer, | ||
void * | displayList, | ||
f32 | sp28 | ||
) |
Allocates and returns a newly created scaling node.
struct GraphNodeShadow* init_graph_node_shadow | ( | struct AllocOnlyPool * | pool, |
struct GraphNodeShadow * | sp1c, | ||
s16 | sp22, | ||
u8 | sp27, | ||
u8 | sp2b | ||
) |
Allocates and returns a newly created shadow node.
struct GraphNodeStart* init_graph_node_start | ( | struct AllocOnlyPool * | pool, |
struct GraphNodeStart * | sp1c | ||
) |
Allocates and returns a newly created start node.
struct GraphNodeSwitchCase* init_graph_node_switch_case | ( | struct AllocOnlyPool * | pool, |
struct GraphNodeSwitchCase * | graphNode, | ||
s16 | numCases, | ||
s16 | sp26, | ||
GraphNodeFunc | nodeFunc, | ||
s32 | sp2c | ||
) |
Allocates and returns a newly created switch case node.
struct GraphNodeTranslation* init_graph_node_translation | ( | struct AllocOnlyPool * | pool, |
struct GraphNodeTranslation * | graphNode, | ||
s32 | drawingLayer, | ||
void * | displayList, | ||
Vec3s | sp28 | ||
) |
Allocates and returns a newly created translation node.
struct GraphNodeTranslationRotation* init_graph_node_translation_rotation | ( | struct AllocOnlyPool * | pool, |
struct GraphNodeTranslationRotation * | graphNode, | ||
s32 | drawingLayer, | ||
void * | displayList, | ||
Vec3s | sp28, | ||
Vec3s | sp2c | ||
) |
Allocates and returns a newly created translation rotation node.
Initialize a geo node with a given type.
Sets all links such that there are no siblings, parent or children for this node.
Takes a pointer to three shorts (supplied by a geo layout script) and copies it to the destination vector.
It's essentially a memcpy but consistent with the other two 'geo-script vector to internal vector' functions.
Takes a pointer to three angles in degrees (supplied by a geo layout script) and converts it to a vector of three in-game angle units in [-32768, 32767] range.
Takes a pointer to three shorts (supplied by a geo layout script) and copies it to the destination float vector.
Add the given graph node as a child to the current top of the gfx stack: 'gCurGraphNodeList'.
This is called from geo_layout commands to add nodes to the scene graph.
Retrieves an index into animation data based on the attribute pointer An attribute is an x-, y- or z-component of the translation / rotation for a part Each attribute is a pair of s16's, where the first s16 represents the maximum frame and the second s16 the actual index.
This index can be used to index in the array with actual animation values.
u16 gAreaUpdateCounter |
struct GraphNodeCamera* gCurGraphNodeCamera |
struct GraphNodePerspective* gCurGraphNodeCamFrustum |
struct GraphNodeHeldObject* gCurGraphNodeHeldObject |
s16 gCurGraphNodeIndex |
struct GraphNodeMasterList* gCurGraphNodeMasterList |
Vec3f gVec3fOne |
Vec3f gVec3fZero |
Vec3s gVec3sOne |
Vec3s gVec3sZero |