Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
Functions | Variables
mario_step.c File Reference
#include <ultra64.h>
#include "sm64.h"
#include "engine/math_util.h"
#include "engine/surface_collision.h"
#include "mario.h"
#include "audio/external.h"
#include "display.h"
#include "interaction.h"
#include "mario_step.h"

Functions

f32 get_additive_y_vel_for_jumps (void)
 Always returns zero. More...
 
void nop_80254E3C (UNUSED struct MarioState *x)
 Does nothing, but takes in a MarioState. More...
 
void nop_80254E50 (void)
 Does nothing. More...
 
void transfer_bully_speed (struct BullyCollisionData *obj1, struct BullyCollisionData *obj2)
 
void init_bully_collision_data (struct BullyCollisionData *data, f32 posX, f32 posZ, f32 forwardVel, s16 yaw, f32 conversionRatio, f32 radius)
 
void mario_bonk_reflection (struct MarioState *m, u32 negateSpeed)
 
u32 mario_update_quicksand (struct MarioState *m, f32 sinkingSpeed)
 
u32 mario_push_off_steep_floor (struct MarioState *m, u32 action, u32 actionArg)
 
u32 mario_update_moving_sand (struct MarioState *m)
 
u32 mario_update_windy_ground (struct MarioState *m)
 
void stop_and_set_height_to_floor (struct MarioState *m)
 
s32 stationary_ground_step (struct MarioState *m)
 
static s32 perform_ground_quarter_step (struct MarioState *m, Vec3f nextPos)
 
s32 perform_ground_step (struct MarioState *m)
 
u32 check_ledge_grab (struct MarioState *m, struct Surface *wall, Vec3f intendedPos, Vec3f nextPos)
 
s32 perform_air_quarter_step (struct MarioState *m, Vec3f intendedPos, u32 stepArg)
 
void apply_twirl_gravity (struct MarioState *m)
 
u32 should_strengthen_gravity_for_jump_ascent (struct MarioState *m)
 
void apply_gravity (struct MarioState *m)
 
void apply_vertical_wind (struct MarioState *m)
 
s32 perform_air_step (struct MarioState *m, u32 stepArg)
 
void set_vel_from_pitch_and_yaw (struct MarioState *m)
 
void set_vel_from_yaw (struct MarioState *m)
 

Variables

static s16 sMovingSandSpeeds [] = { 12, 8, 4, 0 }
 
struct Surface gWaterSurfacePseudoFloor
 

Function Documentation

◆ apply_gravity()

void apply_gravity ( struct MarioState m)

◆ apply_twirl_gravity()

void apply_twirl_gravity ( struct MarioState m)

◆ apply_vertical_wind()

void apply_vertical_wind ( struct MarioState m)

◆ check_ledge_grab()

u32 check_ledge_grab ( struct MarioState m,
struct Surface wall,
Vec3f  intendedPos,
Vec3f  nextPos 
)

Since the search for floors starts at y + 160, we will sometimes grab

◆ get_additive_y_vel_for_jumps()

f32 get_additive_y_vel_for_jumps ( void  )

Always returns zero.

This may have been intended to be used for the beta trampoline. Its return value is used by set_mario_y_vel_based_on_fspeed as a constant addition to Mario's Y velocity. Given the closeness of this function to nop_80254E50, it is probable that this was intended to check whether a trampoline had made itself known through nop_80254E50 and whether Mario was on it, and if so return a higher value than 0.

◆ init_bully_collision_data()

void init_bully_collision_data ( struct BullyCollisionData data,
f32  posX,
f32  posZ,
f32  forwardVel,
s16  yaw,
f32  conversionRatio,
f32  radius 
)

◆ mario_bonk_reflection()

void mario_bonk_reflection ( struct MarioState m,
u32  negateSpeed 
)

◆ mario_push_off_steep_floor()

u32 mario_push_off_steep_floor ( struct MarioState m,
u32  action,
u32  actionArg 
)

◆ mario_update_moving_sand()

u32 mario_update_moving_sand ( struct MarioState m)

◆ mario_update_quicksand()

u32 mario_update_quicksand ( struct MarioState m,
f32  sinkingSpeed 
)

◆ mario_update_windy_ground()

u32 mario_update_windy_ground ( struct MarioState m)

◆ nop_80254E3C()

void nop_80254E3C ( UNUSED struct MarioState x)

Does nothing, but takes in a MarioState.

This is only ever called by update_mario_inputs, which is called as part of Mario's update routine. Due to its proximity to nop_80254E50, an incomplete trampoline function, and get_additive_y_vel_for_jumps, a potentially trampoline-related function, it is plausible that this could be used for checking if Mario was on the trampoline. It could, for example, make him bounce.

◆ nop_80254E50()

void nop_80254E50 ( void  )

Does nothing.

This is only called by the beta trampoline. Due to its proximity to get_additive_y_vel_for_jumps, another currently-pointless function, it is probable that this was used by the trampoline to make itself known to get_additive_y_vel_for_jumps, or to set a variable with its intended additive Y vel.

◆ perform_air_quarter_step()

s32 perform_air_quarter_step ( struct MarioState m,
Vec3f  intendedPos,
u32  stepArg 
)

The water pseudo floor is not referenced when your intended qstep is

Incorrect origin offset (no effect)

This check uses f32, but findFloor uses short (overflow jumps)

When ceilHeight - floorHeight <= 160, the step result says that

Uses referenced ceiling instead of ceil (ceiling hang upwarp)

Potential subframe downwarp->upwarp?

When the wall is not completely vertical or there is a slight wall

◆ perform_air_step()

s32 perform_air_step ( struct MarioState m,
u32  stepArg 
)

On one qf, hit OOB/ceil/wall to store the 2 return value, and continue

◆ perform_ground_quarter_step()

static s32 perform_ground_quarter_step ( struct MarioState m,
Vec3f  nextPos 
)
static

Wrong origin offset (no effect)

◆ perform_ground_step()

s32 perform_ground_step ( struct MarioState m)

◆ set_vel_from_pitch_and_yaw()

void set_vel_from_pitch_and_yaw ( struct MarioState m)

◆ set_vel_from_yaw()

void set_vel_from_yaw ( struct MarioState m)

◆ should_strengthen_gravity_for_jump_ascent()

u32 should_strengthen_gravity_for_jump_ascent ( struct MarioState m)

◆ stationary_ground_step()

s32 stationary_ground_step ( struct MarioState m)

This is responsible for several stationary downwarps.

◆ stop_and_set_height_to_floor()

void stop_and_set_height_to_floor ( struct MarioState m)

This is responsible for some downwarps.

◆ transfer_bully_speed()

void transfer_bully_speed ( struct BullyCollisionData obj1,
struct BullyCollisionData obj2 
)

Bully NaN crash

Bully battery

Variable Documentation

◆ gWaterSurfacePseudoFloor

struct Surface gWaterSurfacePseudoFloor
Initial value:
= {
SURFACE_VERY_SLIPPERY, 0, 0, 0, 0, 0, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
{ 0.0f, 1.0f, 0.0f }, 0.0f, NULL,
}
#define SURFACE_VERY_SLIPPERY
Definition: surface_terrains.h:14
#define NULL
Definition: mbi.h:101

◆ sMovingSandSpeeds

s16 sMovingSandSpeeds[] = { 12, 8, 4, 0 }
static