Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
Functions | Variables
surface_collision.c File Reference
#include <ultra64.h>
#include "sm64.h"
#include "game/level_update.h"
#include "game/debug.h"
#include "game/camera.h"
#include "game/mario.h"
#include "behavior_script.h"
#include "surface_collision.h"
#include "surface_load.h"
#include "game/object_list_processor.h"
#include "game/room.h"

Functions

static s32 find_wall_collisions_from_list (struct SurfaceNode *surfaceNode, struct WallCollisionData *data)
 Iterate through the list of walls until all walls are checked and have given their wall push. More...
 
s32 f32_find_wall_collision (f32 *xPtr, f32 *yPtr, f32 *zPtr, f32 offsetY, f32 radius)
 Formats the position and wall search for find_wall_collisions. More...
 
s32 find_wall_collisions (struct WallCollisionData *colData)
 Find wall collisions and receive their push. More...
 
static struct Surfacefind_ceil_from_list (struct SurfaceNode *surfaceNode, s32 x, s32 y, s32 z, f32 *pheight)
 Iterate through the list of ceilings and find the first ceiling over a given point. More...
 
f32 find_ceil (f32 posX, f32 posY, f32 posZ, struct Surface **pceil)
 Find the lowest ceiling above a given position and return the height. More...
 
static f32 unused_obj_find_floor_height (struct Object *obj)
 Find the height of the highest floor below an object. More...
 
f32 find_floor_height_and_data (f32 xPos, f32 yPos, f32 zPos, struct FloorGeometry **floorGeo)
 Return the floor height underneath (xPos, yPos, zPos) and populate floorGeo with data about the floor's normal vector and origin offset. More...
 
static struct Surfacefind_floor_from_list (struct SurfaceNode *surfaceNode, s32 x, s32 y, s32 z, f32 *pheight)
 Iterate through the list of floors and find the first floor under a given point. More...
 
f32 find_floor_height (f32 x, f32 y, f32 z)
 Find the height of the highest floor below a point. More...
 
static f32 unused_find_dynamic_floor (f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor)
 Find the highest dynamic floor under a given position. More...
 
f32 find_floor (f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor)
 Find the highest floor under a given position and return the height. More...
 
f32 find_water_level (f32 x, f32 z)
 Finds the height of water at a given location. More...
 
f32 find_poison_gas_level (f32 x, f32 z)
 Finds the height of the poison gas (used only in HMC) at a given location. More...
 
static s32 surface_list_length (struct SurfaceNode *list)
 Finds the length of a surface list for debug purposes. More...
 
void debug_surface_list_info (f32 xPos, f32 zPos)
 Print the area,number of walls, how many times they were called, and some allocation information. More...
 
static s32 unused_resolve_floor_or_ceil_collisions (s32 checkCeil, f32 *px, f32 *py, f32 *pz, f32 radius, struct Surface **psurface, f32 *surfaceHeight)
 An unused function that finds and interacts with any type of surface. More...
 

Variables

struct FloorGeometry sFloorGeo
 Basically a local variable that passes through floor geo info. More...
 
static u8 unused8038BE50 [0x40]
 

Function Documentation

◆ debug_surface_list_info()

void debug_surface_list_info ( f32  xPos,
f32  zPos 
)

Print the area,number of walls, how many times they were called, and some allocation information.

◆ f32_find_wall_collision()

s32 f32_find_wall_collision ( f32 xPtr,
f32 yPtr,
f32 zPtr,
f32  offsetY,
f32  radius 
)

Formats the position and wall search for find_wall_collisions.

◆ find_ceil()

f32 find_ceil ( f32  posX,
f32  posY,
f32  posZ,
struct Surface **  pceil 
)

Find the lowest ceiling above a given position and return the height.

(Parallel Universes) Because position is casted to an s16, reaching higher

◆ find_ceil_from_list()

static struct Surface* find_ceil_from_list ( struct SurfaceNode surfaceNode,
s32  x,
s32  y,
s32  z,
f32 pheight 
)
static

Iterate through the list of ceilings and find the first ceiling over a given point.

(Exposed Ceilings) Because any point above a ceiling counts

(Surface Cucking) Since only the first ceil is returned and not the lowest,

◆ find_floor()

f32 find_floor ( f32  xPos,
f32  yPos,
f32  zPos,
struct Surface **  pfloor 
)

Find the highest floor under a given position and return the height.

(Parallel Universes) Because position is casted to an s16, reaching higher

(BBH Crash) Most NULL checking is done by checking the height of the floor returned

◆ find_floor_from_list()

static struct Surface* find_floor_from_list ( struct SurfaceNode surfaceNode,
s32  x,
s32  y,
s32  z,
f32 pheight 
)
static

Iterate through the list of floors and find the first floor under a given point.

(Surface Cucking) Since only the first floor is returned and not the highest,

◆ find_floor_height()

f32 find_floor_height ( f32  x,
f32  y,
f32  z 
)

Find the height of the highest floor below a point.

◆ find_floor_height_and_data()

f32 find_floor_height_and_data ( f32  xPos,
f32  yPos,
f32  zPos,
struct FloorGeometry **  floorGeo 
)

Return the floor height underneath (xPos, yPos, zPos) and populate floorGeo with data about the floor's normal vector and origin offset.

Also update sFloorGeo.

◆ find_poison_gas_level()

f32 find_poison_gas_level ( f32  x,
f32  z 
)

Finds the height of the poison gas (used only in HMC) at a given location.

◆ find_wall_collisions()

s32 find_wall_collisions ( struct WallCollisionData colData)

Find wall collisions and receive their push.

◆ find_wall_collisions_from_list()

static s32 find_wall_collisions_from_list ( struct SurfaceNode surfaceNode,
struct WallCollisionData data 
)
static

Iterate through the list of walls until all walls are checked and have given their wall push.

(Quantum Tunneling) Due to issues with the vertices walls choose and

(Wall Overlaps) Because this doesn't update the x and z local variables,

(Unreferenced Walls) Since this only returns the first four walls,

◆ find_water_level()

f32 find_water_level ( f32  x,
f32  z 
)

Finds the height of water at a given location.

◆ surface_list_length()

static s32 surface_list_length ( struct SurfaceNode list)
static

Finds the length of a surface list for debug purposes.

◆ unused_find_dynamic_floor()

static f32 unused_find_dynamic_floor ( f32  xPos,
f32  yPos,
f32  zPos,
struct Surface **  pfloor 
)
static

Find the highest dynamic floor under a given position.

Perhaps originally static and and dynamic floors were checked separately.

◆ unused_obj_find_floor_height()

static f32 unused_obj_find_floor_height ( struct Object obj)
static

Find the height of the highest floor below an object.

◆ unused_resolve_floor_or_ceil_collisions()

static s32 unused_resolve_floor_or_ceil_collisions ( s32  checkCeil,
f32 px,
f32 py,
f32 pz,
f32  radius,
struct Surface **  psurface,
f32 surfaceHeight 
)
static

An unused function that finds and interacts with any type of surface.

Perhaps an original implementation of surfaces before they were more specialized.

Variable Documentation

◆ sFloorGeo

struct FloorGeometry sFloorGeo

Basically a local variable that passes through floor geo info.

◆ unused8038BE50

u8 unused8038BE50[0x40]
static