Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
Data Structures | Functions | Variables
koopa.inc.c File Reference

Data Structures

struct  KoopaTheQuickProperties
 Data to control the behavior of each instance of Koopa the Quick. More...
 

Functions

void bhv_koopa_init (void)
 Initialization function. More...
 
static void koopa_play_footstep_sound (s8 animFrame1, s8 animFrame2)
 Play the appropriate footstep sound on the two provided animation frames. More...
 
static s32 koopa_check_run_from_mario (void)
 If mario is close to koopa, and koopa is facing toward mario, then begin running away. More...
 
static void koopa_shelled_act_stopped (void)
 Stay still for a while, then change target yaw by 45 degrees and begin walking. More...
 
static void koopa_walk_start (void)
 Begin walking, then increment sub-action. More...
 
static void koopa_walk (void)
 Walk until oKoopaCountdown hits zero, then increment sub-action. More...
 
static void koopa_walk_stop (void)
 Stop walking, then enter action KOOPA_SHELLED_ACT_STOPPED. More...
 
static void koopa_shelled_act_walk (void)
 Walk for a while, then come to a stop. More...
 
static void koopa_shelled_act_run_from_mario (void)
 Run while turning away from mario. More...
 
static void koopa_dive_update_speed (f32 decel)
 If on the ground, decelerate. More...
 
static void koopa_shelled_act_lying (void)
 Slide on the ground and then come to a stop. More...
 
void shelled_koopa_attack_handler (s32 attackType)
 Attack handler for regular-sized shelled koopa. More...
 
static void koopa_shelled_update (void)
 Update function for both regular and tiny shelled koopa. More...
 
static void koopa_unshelled_act_run (void)
 Attempt to run toward the shell if it exists while still running away from mario. More...
 
static void koopa_unshelled_act_dive (void)
 Dive and slide along the ground. More...
 
static void koopa_unshelled_act_unused3 (void)
 Unused action function. More...
 
static void koopa_unshelled_update (void)
 Update function for koopa after losing his shell. More...
 
s32 obj_begin_race (s32 noTimer)
 Wait 50 frames, then play the race starting sound, disable time stop, and optionally begin the timer. More...
 
static void koopa_the_quick_act_wait_before_race (void)
 Wait for mario to approach, and then enter the show init text action. More...
 
static void koopa_the_quick_act_show_init_text (void)
 Display the dialog asking mario if he wants to race. More...
 
static s32 koopa_the_quick_detect_bowling_ball (void)
 If there is a bowling ball nearby, either slow down, or return +/-1 to indicate that the ball is likely to collide. More...
 
static void koopa_the_quick_animate_footsteps (void)
 Play the running animation at a speed proportional to ktq's forward velocity. More...
 
static void koopa_the_quick_act_race (void)
 Begin the race, then follow the race path. More...
 
static void koopa_the_quick_act_decelerate (void)
 Decelerate and then enter the stop action. More...
 
static void koopa_the_quick_act_stop (void)
 Stop and then enter the after race action. More...
 
static void koopa_the_quick_act_after_race (void)
 Wait for mario to approach, then show text indicating the status of the race. More...
 
static void koopa_the_quick_update (void)
 Update function for koopa the quick. More...
 
void bhv_koopa_update (void)
 Update function. More...
 
void bhv_koopa_race_endpoint_update (void)
 Update function for bhvKoopaRaceEndpoint. More...
 

Variables

static struct ObjectHitbox sKoopaHitbox
 Behavior for bhvKoopa and bhvKoopaRaceEndpoint. More...
 
static u8 sKoopaUnshelledAttackHandlers []
 Attack handlers for unshelled koopa and tiny shelled koopa. More...
 
static u8 sKoopaShelledAttackHandlers []
 Attack handlers for regular sized shelled koopa. More...
 
static struct KoopaTheQuickProperties sKoopaTheQuickProperties []
 Properties for the BoB race and the THI race. More...
 

Function Documentation

◆ bhv_koopa_init()

void bhv_koopa_init ( void  )

Initialization function.

◆ bhv_koopa_race_endpoint_update()

void bhv_koopa_race_endpoint_update ( void  )

Update function for bhvKoopaRaceEndpoint.

◆ bhv_koopa_update()

void bhv_koopa_update ( void  )

Update function.

◆ koopa_check_run_from_mario()

static s32 koopa_check_run_from_mario ( void  )
static

If mario is close to koopa, and koopa is facing toward mario, then begin running away.

◆ koopa_dive_update_speed()

static void koopa_dive_update_speed ( f32  decel)
static

If on the ground, decelerate.

Generate dust if moving fast enough.

◆ koopa_play_footstep_sound()

static void koopa_play_footstep_sound ( s8  animFrame1,
s8  animFrame2 
)
static

Play the appropriate footstep sound on the two provided animation frames.

◆ koopa_shelled_act_lying()

static void koopa_shelled_act_lying ( void  )
static

Slide on the ground and then come to a stop.

◆ koopa_shelled_act_run_from_mario()

static void koopa_shelled_act_run_from_mario ( void  )
static

Run while turning away from mario.

Come to a stop once mario is far enough away.

◆ koopa_shelled_act_stopped()

static void koopa_shelled_act_stopped ( void  )
static

Stay still for a while, then change target yaw by 45 degrees and begin walking.

◆ koopa_shelled_act_walk()

static void koopa_shelled_act_walk ( void  )
static

Walk for a while, then come to a stop.

During this time, turn toward the target yaw.

◆ koopa_shelled_update()

static void koopa_shelled_update ( void  )
static

Update function for both regular and tiny shelled koopa.

◆ koopa_the_quick_act_after_race()

static void koopa_the_quick_act_after_race ( void  )
static

Wait for mario to approach, then show text indicating the status of the race.

If mario got to the finish line first and didn't use the cannon, then spawn the star.

◆ koopa_the_quick_act_decelerate()

static void koopa_the_quick_act_decelerate ( void  )
static

Decelerate and then enter the stop action.

◆ koopa_the_quick_act_race()

static void koopa_the_quick_act_race ( void  )
static

Begin the race, then follow the race path.

Avoid bowling balls by slowing down or jumping. After finishing the race, enter the decelerate action.

◆ koopa_the_quick_act_show_init_text()

static void koopa_the_quick_act_show_init_text ( void  )
static

Display the dialog asking mario if he wants to race.

Begin the race or return to the waiting action.

◆ koopa_the_quick_act_stop()

static void koopa_the_quick_act_stop ( void  )
static

Stop and then enter the after race action.

◆ koopa_the_quick_act_wait_before_race()

static void koopa_the_quick_act_wait_before_race ( void  )
static

Wait for mario to approach, and then enter the show init text action.

The next action doesn't execute until next frame, giving mario one

◆ koopa_the_quick_animate_footsteps()

static void koopa_the_quick_animate_footsteps ( void  )
static

Play the running animation at a speed proportional to ktq's forward velocity.

If he is moving backward, then the animation will play backward.

With high negative speed (using the bowling ball deceleration), we can

◆ koopa_the_quick_detect_bowling_ball()

static s32 koopa_the_quick_detect_bowling_ball ( void  )
static

If there is a bowling ball nearby, either slow down, or return +/-1 to indicate that the ball is likely to collide.

This can go negative and is unbounded. If placed next to

◆ koopa_the_quick_update()

static void koopa_the_quick_update ( void  )
static

Update function for koopa the quick.

◆ koopa_unshelled_act_dive()

static void koopa_unshelled_act_dive ( void  )
static

Dive and slide along the ground.

If close enough to the shell, pick it up, and otherwise enter the running action.

The shell comes after koopa in processing order, and the shell is

◆ koopa_unshelled_act_run()

static void koopa_unshelled_act_run ( void  )
static

Attempt to run toward the shell if it exists while still running away from mario.

If the shell doesn't exist, run around randomly. When close enough to the shell and with good angle and speed, enter the dive action.

This overrides turning toward home

◆ koopa_unshelled_act_unused3()

static void koopa_unshelled_act_unused3 ( void  )
static

Unused action function.

◆ koopa_unshelled_update()

static void koopa_unshelled_update ( void  )
static

Update function for koopa after losing his shell.

◆ koopa_walk()

static void koopa_walk ( void  )
static

Walk until oKoopaCountdown hits zero, then increment sub-action.

◆ koopa_walk_start()

static void koopa_walk_start ( void  )
static

Begin walking, then increment sub-action.

◆ koopa_walk_stop()

static void koopa_walk_stop ( void  )
static

Stop walking, then enter action KOOPA_SHELLED_ACT_STOPPED.

◆ obj_begin_race()

s32 obj_begin_race ( s32  noTimer)

Wait 50 frames, then play the race starting sound, disable time stop, and optionally begin the timer.

◆ shelled_koopa_attack_handler()

void shelled_koopa_attack_handler ( s32  attackType)

Attack handler for regular-sized shelled koopa.

Lose shell and enter lying action.

Because bob-ombs/corkboxes come after koopa in processing order,

Variable Documentation

◆ sKoopaHitbox

struct ObjectHitbox sKoopaHitbox
static
Initial value:
= {
0,
0,
0,
-1,
60,
40,
40,
30,
}
#define INTERACT_KOOPA
Definition: interaction.h:13

Behavior for bhvKoopa and bhvKoopaRaceEndpoint.

bhvKoopa includes normal, unshelled, tiny, and Koopa the Quick. When the race begins, koopa the quick sets his parent to bhvKoopaRaceEndpoint which assists in determining the state of the race. It is positioned at the flag. Hitbox for koopa - this is used for every form except Koopa the Quick, which uses a hardcoded soft hitbox.

◆ sKoopaShelledAttackHandlers

u8 sKoopaShelledAttackHandlers[]
static

◆ sKoopaTheQuickProperties

struct KoopaTheQuickProperties sKoopaTheQuickProperties[]
static
Initial value:
= {
{ 5, 7, bob_seg7_trajectory_koopa, { 3030, 4500, -4600 } },
{ 9, 31, thi_seg7_trajectory_koopa, { 7100, -1300, -6000 } }
}
u8 bob_seg7_trajectory_koopa[]
u8 thi_seg7_trajectory_koopa[]

Properties for the BoB race and the THI race.

◆ sKoopaUnshelledAttackHandlers

u8 sKoopaUnshelledAttackHandlers[]
static
Initial value:
= {
}
#define ATTACK_HANDLER_KNOCKBACK
Definition: obj_behaviors_2.h:8
#define ATTACK_HANDLER_SQUISHED
Definition: obj_behaviors_2.h:9

Attack handlers for unshelled koopa and tiny shelled koopa.