![]() |
Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
|
#include <ultra64.h>
#include "prevent_bss_reordering.h"
#include "sm64.h"
#include "game/ingame_menu.h"
#include "graph_node.h"
#include "behavior_script.h"
#include "behavior_data.h"
#include "game/memory.h"
#include "game/object_helpers.h"
#include "game/macro_special_objects.h"
#include "surface_collision.h"
#include "game/mario.h"
#include "game/object_list_processor.h"
#include "game/room.h"
#include "surface_load.h"
Functions | |
static struct SurfaceNode * | alloc_surface_node (void) |
Allocate the part of the surface node pool to contain a surface node. More... | |
static struct Surface * | alloc_surface (void) |
Allocate the part of the surface pool to contain a surface and initialize the surface. More... | |
static void | clear_spatial_partition (SpatialPartitionCell *cells) |
Iterates through the entire partition, clearing the surfaces. More... | |
static void | clear_static_surfaces (void) |
Clears the static (level) surface partitions for new use. More... | |
static void | add_surface_to_cell (s16 dynamic, s16 cellX, s16 cellZ, struct Surface *surface) |
Add a surface to the correct cell list of surfaces. More... | |
static s16 | min_3 (s16 a0, s16 a1, s16 a2) |
Returns the lowest of three values. More... | |
static s16 | max_3 (s16 a0, s16 a1, s16 a2) |
Returns the highest of three values. More... | |
static s16 | lower_cell_index (s16 t) |
Every level is split into 16 * 16 cells of surfaces (to limit computing time). More... | |
static s16 | upper_cell_index (s16 t) |
Every level is split into 16 * 16 cells of surfaces (to limit computing time). More... | |
static void | add_surface (struct Surface *surface, s32 dynamic) |
Every level is split into 16x16 cells, this takes a surface, finds the appropriate cells (with a buffer), and adds the surface to those cells. More... | |
static void | unused_80382B6C (void) |
static struct Surface * | read_surface_data (s16 *vertexData, s16 **vertexIndices) |
Initialize a surface from reading it's data and putting it into a surface stuct. More... | |
static s32 | surface_has_force (s16 surfaceType) |
Returns whether a surface has exertion/moves Mario based on the surface type. More... | |
static s32 | surf_has_no_cam_collision (s16 surfaceType) |
Returns whether a surface should have the SURFACE_FLAG_NO_CAM_COLLISION flag. More... | |
static void | load_static_surfaces (s16 **data, s16 *vertexData, s16 surfaceType, s8 **surfaceRooms) |
Load in the surfaces for a given surface type. More... | |
static s16 * | read_vertex_data (s16 **data) |
Read the data for vertices for reference by triangles. More... | |
static void | load_environmental_regions (s16 **data) |
Loads in special environmental regions, such as water, poison gas, and JRB fog. More... | |
void | alloc_surface_pools (void) |
Allocate some of the main pool for surfaces (2300 surf) and for surface nodes (7000 nodes). More... | |
void | load_area_terrain (s16 index, s16 *data, s8 *surfaceRooms, s16 *macroObjects) |
Process the level file, loading in vertices, surfaces, some objects, and environmental boxes (water, gas, JRB fog). More... | |
void | clear_dynamic_surfaces (void) |
If not in time stop, clear the surface partitions. More... | |
static void | unused_80383604 (void) |
static void | transform_object_vertices (s16 **data, s16 *vertexData) |
Applies an object's tranformation to the object's vertices. More... | |
static void | load_object_surfaces (s16 **data, s16 *vertexData) |
Load in the surfaces for the gCurrentObject. More... | |
void | load_object_collision_model (void) |
Transform an object's vertices, reload them, and render the object. More... | |
Variables | |
s32 | unused8038BE90 |
SpatialPartitionCell | gStaticSurfacePartition [16][16] |
Partitions for course and object surfaces. More... | |
SpatialPartitionCell | gDynamicSurfacePartition [16][16] |
struct SurfaceNode * | sSurfaceNodePool |
Pools of data to contain either surface nodes or surfaces. More... | |
struct Surface * | sSurfacePool |
s16 | sSurfacePoolSize |
The size of the surface pool (2300). More... | |
u8 | unused8038EEA8 [0x30] |
Every level is split into 16x16 cells, this takes a surface, finds the appropriate cells (with a buffer), and adds the surface to those cells.
|
static |
Add a surface to the correct cell list of surfaces.
(Surface Cucking) Surfaces are sorted by the height of their first
Allocate the part of the surface pool to contain a surface and initialize the surface.
A bounds check! If there's more surfaces than the 2300 allowed,
|
static |
Allocate the part of the surface node pool to contain a surface node.
A bounds check! If there's more surface nodes than 7000 allowed,
Allocate some of the main pool for surfaces (2300 surf) and for surface nodes (7000 nodes).
|
static |
Iterates through the entire partition, clearing the surfaces.
Clears the static (level) surface partitions for new use.
Process the level file, loading in vertices, surfaces, some objects, and environmental boxes (water, gas, JRB fog).
Loads in special environmental regions, such as water, poison gas, and JRB fog.
Transform an object's vertices, reload them, and render the object.
Load in the surfaces for the gCurrentObject.
This includes setting the flags, exertion, and room.
|
static |
Load in the surfaces for a given surface type.
This includes setting the flags, exertion, and room.
Every level is split into 16 * 16 cells of surfaces (to limit computing time).
This function determines the lower cell for a given x/z position.
Some wall checks are larger than the buffer, meaning wall checks can
Initialize a surface from reading it's data and putting it into a surface stuct.
Read the data for vertices for reference by triangles.
Returns whether a surface should have the SURFACE_FLAG_NO_CAM_COLLISION flag.
Returns whether a surface has exertion/moves Mario based on the surface type.
Applies an object's tranformation to the object's vertices.
No bounds check on vertex data
Every level is split into 16 * 16 cells of surfaces (to limit computing time).
This function determines the upper cell for a given x/z position.
Some wall checks are larger than the buffer, meaning wall checks can
SpatialPartitionCell gDynamicSurfacePartition[16][16] |
SpatialPartitionCell gStaticSurfacePartition[16][16] |
Partitions for course and object surfaces.
The arrays represent the 16x16 cells that each level is split into.
struct SurfaceNode* sSurfaceNodePool |
Pools of data to contain either surface nodes or surfaces.
s16 sSurfacePoolSize |
The size of the surface pool (2300).
s32 unused8038BE90 |
u8 unused8038EEA8[0x30] |