Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
Macros | Functions | Variables
obj_behaviors.c File Reference
#include <ultra64.h>
#include "sm64.h"
#include "obj_behaviors.h"
#include "rendering_graph_node.h"
#include "memory.h"
#include "engine/behavior_script.h"
#include "engine/surface_collision.h"
#include "engine/math_util.h"
#include "display.h"
#include "object_helpers.h"
#include "behavior_data.h"
#include "mario.h"
#include "game.h"
#include "camera.h"
#include "mario_actions_cutscene.h"
#include "object_list_processor.h"
#include "save_file.h"
#include "area.h"
#include "mario_misc.h"
#include "level_update.h"
#include "audio/external.h"
#include "behavior_actions.h"
#include "spawn_object.h"
#include "spawn_sound.h"
#include "room.h"
#include "envfx_bubbles.h"
#include "ingame_menu.h"
#include "interaction.h"
#include "behaviors/moving_coin.inc.c"
#include "behaviors/seaweed.inc.c"
#include "behaviors/bobomb.inc.c"
#include "behaviors/cannon_door.inc.c"
#include "behaviors/whirlpool.inc.c"
#include "behaviors/amp.inc.c"
#include "behaviors/butterfly.inc.c"
#include "behaviors/hoot.inc.c"
#include "behaviors/beta_holdable_object.inc.c"
#include "behaviors/bubble.inc.c"
#include "behaviors/water_wave.inc.c"
#include "behaviors/explosion.inc.c"
#include "behaviors/corkbox.inc.c"
#include "behaviors/bully.inc.c"
#include "behaviors/water_ring.inc.c"
#include "behaviors/bowser_bomb.inc.c"
#include "behaviors/celebration_star.inc.c"
#include "behaviors/drawbridge.inc.c"
#include "behaviors/bomp.inc.c"
#include "behaviors/sliding_platform.inc.c"
#include "behaviors/moneybag.inc.c"
#include "behaviors/bowling_ball.inc.c"
#include "behaviors/cruiser.inc.c"
#include "behaviors/spindel.inc.c"
#include "behaviors/pyramid_wall.inc.c"
#include "behaviors/pyramid_elevator.inc.c"
#include "behaviors/pyramid_top.inc.c"
#include "behaviors/snowman.inc.c"
#include "behaviors/boulder.inc.c"
#include "behaviors/cap.inc.c"
#include "behaviors/spawn_star.inc.c"
#include "behaviors/red_coin.inc.c"
#include "behaviors/hidden_star.inc.c"
#include "behaviors/rolling_log.inc.c"
#include "behaviors/mushroom_1up.inc.c"
#include "behaviors/controllable_platform.inc.c"
#include "behaviors/breakable_box_small.inc.c"
#include "behaviors/snow_mound.inc.c"
#include "behaviors/floating_platform.inc.c"
#include "behaviors/arrow_lift.inc.c"
#include "behaviors/orange_number.inc.c"
#include "behaviors/manta_ray.inc.c"
#include "behaviors/falling_pillar.inc.c"
#include "behaviors/floating_box.inc.c"
#include "behaviors/decorative_pendulum.inc.c"
#include "behaviors/treasure_chest.inc.c"
#include "behaviors/mips.inc.c"
#include "behaviors/yoshi.inc.c"

Macros

#define o   gCurrentObject
 
#define OBJ_COL_FLAG_GROUNDED   (1 << 0)
 
#define OBJ_COL_FLAG_HIT_WALL   (1 << 1)
 
#define OBJ_COL_FLAG_UNDERWATER   (1 << 2)
 
#define OBJ_COL_FLAG_NO_Y_VEL   (1 << 3)
 
#define OBJ_COL_FLAGS_LANDED   (OBJ_COL_FLAG_GROUNDED | OBJ_COL_FLAG_NO_Y_VEL)
 

Functions

s32 count_objects_with_behavior (void *)
 
void func_802E2F40 (void)
 
struct Struct802E2F58func_802E2F58 (s32 arg0, struct Object *arg1, UNUSED s32 arg2)
 
f32 absf_2 (f32 f)
 
void TurnObjAwayFromSurface (f32 objVelX, f32 objVelZ, f32 nX, UNUSED f32 nY, f32 nZ, f32 *objYawX, f32 *objYawZ)
 
s32 ObjFindWall (f32 objNewX, f32 objY, f32 objNewZ, f32 objVelX, f32 objVelZ)
 
s32 TurnObjAwayFromAwkwardFloor (struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ)
 
void ObjOrientGraph (struct Object *obj, f32 normalX, f32 normalY, f32 normalZ)
 
void CalcObjFriction (f32 *objFriction, f32 floor_nY)
 
void CalcNewObjVelAndPosY (struct Surface *objFloor, f32 objFloorY, f32 objVelX, f32 objVelZ)
 
void CalcNewObjVelAndPosYUnderwater (struct Surface *objFloor, f32 floorY, f32 objVelX, f32 objVelZ, f32 waterY)
 
void ObjUpdatePosVelXZ (void)
 
void ObjSplash (s32 waterY, s32 objY)
 
s16 ObjectStep (void)
 
s16 func_802E4204 (void)
 
void obj_move_xyz_using_fvel_and_yaw (struct Object *obj)
 Uses an object's forward velocity and yaw to move its X, Y, and Z positions. More...
 
s32 is_point_within_radius_of_mario (f32 x, f32 y, f32 z, s32 dist)
 
s32 IsPointCloseToObject (struct Object *obj, f32 x, f32 y, f32 z, s32 dist)
 
void SetObjectVisibility (struct Object *obj, s32 arg1)
 
s32 ObjLeaveIfMarioIsNearHome (struct Object *obj, f32 homeX, f32 y, f32 homeZ, s32 dist)
 
void ObjDisplaceHome (struct Object *obj, f32 homeX, UNUSED f32 homeY, f32 homeZ, s32 baseDisp)
 
s32 func_802E46C0 (u32 arg0, u32 arg1, s16 arg2)
 
s32 func_802E478C (Vec3f dist, f32 x, f32 y, f32 z, f32 arg4)
 
void ObjSpawnYellowCoins (struct Object *obj, s32 nCoins)
 
s32 ObjFlickerAndDisappear (struct Object *obj, s16 arg1)
 
s8 func_802E49A4 (s16 arg0)
 
s16 func_802E4A38 (s32 *arg0, s16 arg1, f32 arg2, s32 arg3)
 
void ObjCheckFloorDeath (s16 collisionFlags, struct Surface *floor)
 
s32 ObjLavaDeath (void)
 
void SpawnOrangeNumber (s8 arg0, s16 arg1, s16 arg2, s16 arg3)
 
s32 Unknown802E4DF4 (s16 *arg0)
 
void BehWaterfallSoundLoop (void)
 
void BehVolcanoSoundLoop (void)
 
void BehCastleFlagWavingInit (void)
 
void BehBirdsSoundLoop (void)
 
void bhv_ambient_sounds_init (void)
 
void BehSandSoundLoop (void)
 
void BehHiddenAt120StarsInit (void)
 

Variables

struct SurfaceD_803600E0
 
s8 D_80331500 = 1
 
s16 D_80331504 = 0
 
s8 D_80331508 = 0
 
s8 D_8033150C = 0
 
s8 D_80331510 = 0
 
voidccm_seg7_trajectory_snowman
 
voidinside_castle_seg7_trajectory_mips
 

Macro Definition Documentation

◆ o

#define o   gCurrentObject

◆ OBJ_COL_FLAG_GROUNDED

#define OBJ_COL_FLAG_GROUNDED   (1 << 0)

◆ OBJ_COL_FLAG_HIT_WALL

#define OBJ_COL_FLAG_HIT_WALL   (1 << 1)

◆ OBJ_COL_FLAG_NO_Y_VEL

#define OBJ_COL_FLAG_NO_Y_VEL   (1 << 3)

◆ OBJ_COL_FLAG_UNDERWATER

#define OBJ_COL_FLAG_UNDERWATER   (1 << 2)

◆ OBJ_COL_FLAGS_LANDED

#define OBJ_COL_FLAGS_LANDED   (OBJ_COL_FLAG_GROUNDED | OBJ_COL_FLAG_NO_Y_VEL)

Function Documentation

◆ absf_2()

f32 absf_2 ( f32  f)

◆ BehBirdsSoundLoop()

void BehBirdsSoundLoop ( void  )

◆ BehCastleFlagWavingInit()

void BehCastleFlagWavingInit ( void  )

◆ BehHiddenAt120StarsInit()

void BehHiddenAt120StarsInit ( void  )

◆ BehSandSoundLoop()

void BehSandSoundLoop ( void  )

◆ BehVolcanoSoundLoop()

void BehVolcanoSoundLoop ( void  )

◆ BehWaterfallSoundLoop()

void BehWaterfallSoundLoop ( void  )

◆ bhv_ambient_sounds_init()

void bhv_ambient_sounds_init ( void  )

◆ CalcNewObjVelAndPosY()

void CalcNewObjVelAndPosY ( struct Surface objFloor,
f32  objFloorY,
f32  objVelX,
f32  objVelZ 
)

potential TRUNC crash

◆ CalcNewObjVelAndPosYUnderwater()

void CalcNewObjVelAndPosYUnderwater ( struct Surface objFloor,
f32  floorY,
f32  objVelX,
f32  objVelZ,
f32  waterY 
)

◆ CalcObjFriction()

void CalcObjFriction ( f32 objFriction,
f32  floor_nY 
)

◆ count_objects_with_behavior()

s32 count_objects_with_behavior ( void )

◆ func_802E2F40()

void func_802E2F40 ( void  )

◆ func_802E2F58()

struct Struct802E2F58* func_802E2F58 ( s32  arg0,
struct Object arg1,
UNUSED s32  arg2 
)

◆ func_802E4204()

s16 func_802E4204 ( void  )

◆ func_802E46C0()

s32 func_802E46C0 ( u32  arg0,
u32  arg1,
s16  arg2 
)

◆ func_802E478C()

s32 func_802E478C ( Vec3f  dist,
f32  x,
f32  y,
f32  z,
f32  arg4 
)

◆ func_802E49A4()

s8 func_802E49A4 ( s16  arg0)

◆ func_802E4A38()

s16 func_802E4A38 ( s32 arg0,
s16  arg1,
f32  arg2,
s32  arg3 
)

◆ is_point_within_radius_of_mario()

s32 is_point_within_radius_of_mario ( f32  x,
f32  y,
f32  z,
s32  dist 
)

◆ IsPointCloseToObject()

s32 IsPointCloseToObject ( struct Object obj,
f32  x,
f32  y,
f32  z,
s32  dist 
)

◆ obj_move_xyz_using_fvel_and_yaw()

void obj_move_xyz_using_fvel_and_yaw ( struct Object obj)

Uses an object's forward velocity and yaw to move its X, Y, and Z positions.

This does accept an object as an argument, though it is always called with o. If it wasn't called with o, it would modify o's X and Z velocities based on obj's forward velocity and yaw instead of o's, and wouldn't update o's position.

◆ ObjCheckFloorDeath()

void ObjCheckFloorDeath ( s16  collisionFlags,
struct Surface floor 
)

◆ ObjDisplaceHome()

void ObjDisplaceHome ( struct Object obj,
f32  homeX,
UNUSED f32  homeY,
f32  homeZ,
s32  baseDisp 
)

◆ ObjectStep()

s16 ObjectStep ( void  )

◆ ObjFindWall()

s32 ObjFindWall ( f32  objNewX,
f32  objY,
f32  objNewZ,
f32  objVelX,
f32  objVelZ 
)

◆ ObjFlickerAndDisappear()

s32 ObjFlickerAndDisappear ( struct Object obj,
s16  arg1 
)

◆ ObjLavaDeath()

s32 ObjLavaDeath ( void  )

◆ ObjLeaveIfMarioIsNearHome()

s32 ObjLeaveIfMarioIsNearHome ( struct Object obj,
f32  homeX,
f32  y,
f32  homeZ,
s32  dist 
)

◆ ObjOrientGraph()

void ObjOrientGraph ( struct Object obj,
f32  normalX,
f32  normalY,
f32  normalZ 
)

◆ ObjSpawnYellowCoins()

void ObjSpawnYellowCoins ( struct Object obj,
s32  nCoins 
)

◆ ObjSplash()

void ObjSplash ( s32  waterY,
s32  objY 
)

◆ ObjUpdatePosVelXZ()

void ObjUpdatePosVelXZ ( void  )

◆ SetObjectVisibility()

void SetObjectVisibility ( struct Object obj,
s32  arg1 
)

◆ SpawnOrangeNumber()

void SpawnOrangeNumber ( s8  arg0,
s16  arg1,
s16  arg2,
s16  arg3 
)

◆ TurnObjAwayFromAwkwardFloor()

s32 TurnObjAwayFromAwkwardFloor ( struct Surface objFloor,
f32  floorY,
f32  objVelX,
f32  objVelZ 
)

TRUNC overflow exception after 36 minutes

◆ TurnObjAwayFromSurface()

void TurnObjAwayFromSurface ( f32  objVelX,
f32  objVelZ,
f32  nX,
UNUSED f32  nY,
f32  nZ,
f32 objYawX,
f32 objYawZ 
)

◆ Unknown802E4DF4()

s32 Unknown802E4DF4 ( s16 arg0)

Variable Documentation

◆ ccm_seg7_trajectory_snowman

void* ccm_seg7_trajectory_snowman

◆ D_80331500

s8 D_80331500 = 1

◆ D_80331504

s16 D_80331504 = 0

◆ D_80331508

s8 D_80331508 = 0

◆ D_8033150C

s8 D_8033150C = 0

◆ D_80331510

s8 D_80331510 = 0

◆ D_803600E0

struct Surface* D_803600E0

◆ inside_castle_seg7_trajectory_mips

void* inside_castle_seg7_trajectory_mips