Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
Functions | Variables
mario.h File Reference
#include "types.h"

Go to the source code of this file.

Functions

s32 is_anim_at_end (struct MarioState *m)
 Checks if Mario's animation has reached its end point. More...
 
s32 is_anim_past_end (struct MarioState *m)
 Checks if Mario's animation has surpassed 2 frames before its end point. More...
 
s16 set_mario_animation (struct MarioState *m, s32 targetAnimID)
 Sets Mario's animation without any acceleration, running at its default rate. More...
 
s16 set_mario_anim_with_accel (struct MarioState *m, s32 targetAnimID, s32 accel)
 Sets Mario's animation where the animation is sped up or slowed down via acceleration. More...
 
void set_anim_to_frame (struct MarioState *m, s16 animFrame)
 Sets the animation to a specific "next" frame from the frame given. More...
 
s32 is_anim_past_frame (struct MarioState *m, s16 animFrame)
 
s16 find_mario_anim_flags_and_translation (struct Object *o, s32 yaw, Vec3s translation)
 Rotates the animation's translation into the global coordinate system and returns the animation's flags. More...
 
void update_mario_pos_for_anim (struct MarioState *m)
 Updates Mario's position from his animation's translation. More...
 
s16 return_mario_anim_y_translation (struct MarioState *m)
 Finds the vertical translation from Mario's animation. More...
 
void play_sound_if_no_flag (struct MarioState *m, u32 soundBits, u32 flags)
 Plays a sound if if Mario doesn't have the flag being checked. More...
 
void play_mario_action_sound (struct MarioState *m)
 Plays an action sound if one has not been played since the last action change. More...
 
void adjust_sound_for_speed (struct MarioState *m)
 Adjusts the volume/pitch of sounds from Mario's speed. More...
 
void play_sound_and_spawn_particles (struct MarioState *m, u32 soundBits, u32 waveParticleType)
 Spawns particles if the step sound says to, then either plays a step sound or relevant other sound. More...
 
void play_mario_environment_sound (struct MarioState *m, u32 soundBits, u32 waveParticleType)
 Plays an environmental sound if one has not been played since the last action change. More...
 
void play_mario_step_sound (struct MarioState *m, u32 soundBits)
 Plays a step sound, accounting for metal cap. More...
 
void play_mario_landing_sound (struct MarioState *m, u32 soundBits)
 Plays a landing sound, accounting for metal cap. More...
 
void play_mario_heavy_landing_sound (struct MarioState *m, u32 soundBits)
 Plays a heavy landing (ground pound, etc.) sound, accounting for metal cap. More...
 
void play_mario_knockback_sound (struct MarioState *m, u32 soundBits)
 Plays a knockback sound, accounting for metal cap. More...
 
void play_mario_sound (struct MarioState *m, s32 primarySoundBits, s32 scondarySoundBits)
 Plays an environment and action noise relevant to what was passed into the function. More...
 
void mario_set_forward_vel (struct MarioState *m, f32 speed)
 Sets Mario's other velocities from his forward speed. More...
 
s32 mario_get_floor_class (struct MarioState *m)
 Returns the slipperines class of Mario's floor. More...
 
u32 mario_get_step_noise (struct MarioState *m)
 Finds and returns Mario's step noise/type. More...
 
struct Surfaceresolve_and_return_wall_collisions (Vec3f pos, f32 offset, f32 radius)
 Collides with walls and returns the most recent wall. More...
 
f32 vec3f_find_ceil (Vec3f pos, f32 height, struct Surface **ceil)
 Finds the ceiling from a vec3f horizontally and a height (with 80 vertical buffer). More...
 
s32 mario_facing_downhill (struct MarioState *m, s32 turnYaw)
 Determines if Mario is facing "downhill.". More...
 
u32 mario_floor_is_slippery (struct MarioState *m)
 Determines if a surface is slippery based on the surface class. More...
 
s32 mario_floor_is_slope (struct MarioState *m)
 Determines if a surface is a slope based on the surface class. More...
 
s32 mario_floor_is_steep (struct MarioState *m)
 Determines if a surface is steep based on the surface class. More...
 
f32 find_floor_height_relative_polar (struct MarioState *m, s16 angleFromMario, f32 distFromMario)
 Finds the floor height relative from Mario given polar displacement. More...
 
s16 find_floor_slope (struct MarioState *m, s16 yawOffset)
 Returns the slope of the floor based off points around Mario. More...
 
void update_mario_sound_and_camera (struct MarioState *m)
 Adjusts Mario's camera and sound based on his action status. More...
 
void set_steep_jump_action (struct MarioState *m)
 Transitions Mario to a steep jump action. More...
 
u32 set_mario_action (struct MarioState *, u32 action, u32 actionArg)
 Puts Mario into a given action, putting Mario through the appropriate specific function if needed. More...
 
s32 set_jump_from_landing (struct MarioState *m)
 Puts Mario into a specific jumping action from a landing action. More...
 
s32 set_jumping_action (struct MarioState *m, u32 action, u32 actionArg)
 Puts Mario in a given action, as long as it is not overruled by either a quicksand or steep jump. More...
 
s32 drop_and_set_mario_action (struct MarioState *m, u32 action, u32 actionArg)
 Drop anything Mario is holding and set a new action. More...
 
s32 hurt_and_set_mario_action (struct MarioState *m, u32 action, u32 actionArg, s16 hurtCounter)
 Increment Mario's hurt counter and set a new action. More...
 
s32 check_common_action_exits (struct MarioState *m)
 Checks a variety of inputs for common transitions between many different actions. More...
 
s32 check_common_hold_action_exits (struct MarioState *m)
 Checks a variety of inputs for common transitions between many different object holding actions. More...
 
s32 transition_submerged_to_walking (struct MarioState *m)
 Transitions Mario from a submerged action to a walking action. More...
 
s32 set_water_plunge_action (struct MarioState *m)
 This is the transition function typically for entering a submerged action for a non-submerged action. More...
 
s32 execute_mario_action (struct Object *o)
 
void init_mario (void)
 
void init_mario_from_save_file (void)
 

Variables

u32 D_80226EB8
 
struct ObjectgMarioObject
 The object representing mario. More...
 
struct ObjectgLuigiObject
 An object variable that may have been used to represent the planned second player. More...
 

Function Documentation

◆ adjust_sound_for_speed()

void adjust_sound_for_speed ( struct MarioState m)

Adjusts the volume/pitch of sounds from Mario's speed.

◆ check_common_action_exits()

s32 check_common_action_exits ( struct MarioState m)

Checks a variety of inputs for common transitions between many different actions.

A common variant of the below function.

◆ check_common_hold_action_exits()

s32 check_common_hold_action_exits ( struct MarioState m)

Checks a variety of inputs for common transitions between many different object holding actions.

A holding variant of the above function.

◆ drop_and_set_mario_action()

s32 drop_and_set_mario_action ( struct MarioState m,
u32  action,
u32  actionArg 
)

Drop anything Mario is holding and set a new action.

◆ execute_mario_action()

s32 execute_mario_action ( struct Object o)

◆ find_floor_height_relative_polar()

f32 find_floor_height_relative_polar ( struct MarioState m,
s16  angleFromMario,
f32  distFromMario 
)

Finds the floor height relative from Mario given polar displacement.

◆ find_floor_slope()

s16 find_floor_slope ( struct MarioState m,
s16  yawOffset 
)

Returns the slope of the floor based off points around Mario.

If Mario is near OOB, these floorY's can sometimes be -11000.

◆ find_mario_anim_flags_and_translation()

s16 find_mario_anim_flags_and_translation ( struct Object o,
s32  yaw,
Vec3s  translation 
)

Rotates the animation's translation into the global coordinate system and returns the animation's flags.

◆ hurt_and_set_mario_action()

s32 hurt_and_set_mario_action ( struct MarioState m,
u32  action,
u32  actionArg,
s16  hurtCounter 
)

Increment Mario's hurt counter and set a new action.

◆ init_mario()

void init_mario ( void  )

◆ init_mario_from_save_file()

void init_mario_from_save_file ( void  )

◆ is_anim_at_end()

s32 is_anim_at_end ( struct MarioState m)

Checks if Mario's animation has reached its end point.

◆ is_anim_past_end()

s32 is_anim_past_end ( struct MarioState m)

Checks if Mario's animation has surpassed 2 frames before its end point.

◆ is_anim_past_frame()

s32 is_anim_past_frame ( struct MarioState m,
s16  animFrame 
)

◆ mario_facing_downhill()

s32 mario_facing_downhill ( struct MarioState m,
s32  turnYaw 
)

Determines if Mario is facing "downhill.".

◆ mario_floor_is_slippery()

u32 mario_floor_is_slippery ( struct MarioState m)

Determines if a surface is slippery based on the surface class.

◆ mario_floor_is_slope()

s32 mario_floor_is_slope ( struct MarioState m)

Determines if a surface is a slope based on the surface class.

◆ mario_floor_is_steep()

s32 mario_floor_is_steep ( struct MarioState m)

Determines if a surface is steep based on the surface class.

◆ mario_get_floor_class()

s32 mario_get_floor_class ( struct MarioState m)

Returns the slipperines class of Mario's floor.

◆ mario_get_step_noise()

u32 mario_get_step_noise ( struct MarioState m)

Finds and returns Mario's step noise/type.

Depends on surfaces and terrain.

◆ mario_set_forward_vel()

void mario_set_forward_vel ( struct MarioState m,
f32  speed 
)

Sets Mario's other velocities from his forward speed.

◆ play_mario_action_sound()

void play_mario_action_sound ( struct MarioState m)

Plays an action sound if one has not been played since the last action change.

◆ play_mario_environment_sound()

void play_mario_environment_sound ( struct MarioState m,
u32  soundBits,
u32  waveParticleType 
)

Plays an environmental sound if one has not been played since the last action change.

◆ play_mario_heavy_landing_sound()

void play_mario_heavy_landing_sound ( struct MarioState m,
u32  soundBits 
)

Plays a heavy landing (ground pound, etc.) sound, accounting for metal cap.

◆ play_mario_knockback_sound()

void play_mario_knockback_sound ( struct MarioState m,
u32  soundBits 
)

Plays a knockback sound, accounting for metal cap.

◆ play_mario_landing_sound()

void play_mario_landing_sound ( struct MarioState m,
u32  soundBits 
)

Plays a landing sound, accounting for metal cap.

◆ play_mario_sound()

void play_mario_sound ( struct MarioState m,
s32  primarySoundBits,
s32  scondarySoundBits 
)

Plays an environment and action noise relevant to what was passed into the function.

◆ play_mario_step_sound()

void play_mario_step_sound ( struct MarioState m,
u32  soundBits 
)

Plays a step sound, accounting for metal cap.

◆ play_sound_and_spawn_particles()

void play_sound_and_spawn_particles ( struct MarioState m,
u32  soundBits,
u32  waveParticleType 
)

Spawns particles if the step sound says to, then either plays a step sound or relevant other sound.

◆ play_sound_if_no_flag()

void play_sound_if_no_flag ( struct MarioState m,
u32  soundBits,
u32  flags 
)

Plays a sound if if Mario doesn't have the flag being checked.

◆ resolve_and_return_wall_collisions()

struct Surface* resolve_and_return_wall_collisions ( Vec3f  pos,
f32  offset,
f32  radius 
)

Collides with walls and returns the most recent wall.

◆ return_mario_anim_y_translation()

s16 return_mario_anim_y_translation ( struct MarioState m)

Finds the vertical translation from Mario's animation.

◆ set_anim_to_frame()

void set_anim_to_frame ( struct MarioState m,
s16  animFrame 
)

Sets the animation to a specific "next" frame from the frame given.

◆ set_jump_from_landing()

s32 set_jump_from_landing ( struct MarioState m)

Puts Mario into a specific jumping action from a landing action.

◆ set_jumping_action()

s32 set_jumping_action ( struct MarioState m,
u32  action,
u32  actionArg 
)

Puts Mario in a given action, as long as it is not overruled by either a quicksand or steep jump.

◆ set_mario_action()

u32 set_mario_action ( struct MarioState ,
u32  action,
u32  actionArg 
)

Puts Mario into a given action, putting Mario through the appropriate specific function if needed.

◆ set_mario_anim_with_accel()

s16 set_mario_anim_with_accel ( struct MarioState m,
s32  targetAnimID,
s32  accel 
)

Sets Mario's animation where the animation is sped up or slowed down via acceleration.

◆ set_mario_animation()

s16 set_mario_animation ( struct MarioState m,
s32  targetAnimID 
)

Sets Mario's animation without any acceleration, running at its default rate.

◆ set_steep_jump_action()

void set_steep_jump_action ( struct MarioState m)

Transitions Mario to a steep jump action.

((s16)0x8000) has undefined behavior. Therefore, this downcast has

◆ set_water_plunge_action()

s32 set_water_plunge_action ( struct MarioState m)

This is the transition function typically for entering a submerged action for a non-submerged action.

This also applies the water surface camera preset.

◆ transition_submerged_to_walking()

s32 transition_submerged_to_walking ( struct MarioState m)

Transitions Mario from a submerged action to a walking action.

◆ update_mario_pos_for_anim()

void update_mario_pos_for_anim ( struct MarioState m)

Updates Mario's position from his animation's translation.

◆ update_mario_sound_and_camera()

void update_mario_sound_and_camera ( struct MarioState m)

Adjusts Mario's camera and sound based on his action status.

◆ vec3f_find_ceil()

f32 vec3f_find_ceil ( Vec3f  pos,
f32  height,
struct Surface **  ceil 
)

Finds the ceiling from a vec3f horizontally and a height (with 80 vertical buffer).

Variable Documentation

◆ D_80226EB8

u32 D_80226EB8

◆ 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.

◆ gMarioObject

struct Object* gMarioObject

The object representing mario.