![]() |
Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
|
Macros | |
#define | PIRANHA_PLANT_SLEEP_MUSIC_PLAYING 0 |
Functions | |
void | piranha_plant_act_idle (void) |
Behavior for bhvPiranhaPlant. More... | |
s32 | piranha_plant_check_interactions (void) |
Check if the player has interacted with the Piranha Plant. More... | |
void | piranha_plant_act_sleeping (void) |
Make the Piranha Plant sleep. More... | |
void | piranha_plant_act_woken_up (void) |
Make the Piranha Plant wake up and stop the lullaby. More... | |
void | piranha_plant_attacked (void) |
Make the Piranha Plant play a falling-over animation and move to the dying state. More... | |
void | piranha_plant_act_shrink_and_die (void) |
Make the Piranha Plant play a sound of defeat, shrink, and then spawn a blue coin. More... | |
void | piranha_plant_act_wait_to_respawn (void) |
Wait for Mario to move far away, then respawn the Piranha Plant. More... | |
void | piranha_plant_act_respawn (void) |
Set the Piranha Plant to the sleeping animation and unshrink it. More... | |
void | piranha_plant_act_biting (void) |
Make the Piranha Plant bite in the direction of the player. More... | |
s32 | mario_moving_fast_enough_to_make_piranha_plant_bite (void) |
Check whether the player is moving fast enough to cause the Piranha Plant to start biting. More... | |
void | piranha_plant_act_stopped_biting (void) |
Make the Piranha Plant quickly nod to indicate that it has stopped biting. More... | |
void | bhv_piranha_plant_loop (void) |
Main loop for bhvPiranhaPlant. More... | |
Variables | |
static s8 | sPiranhaPlantBiteSoundFrames [] = { 12, 28, 50, 64, -1 } |
The frames of the Piranha Plant's biting animation on which to play a bite sound. More... | |
void(* | TablePiranhaPlantActions [])(void) |
Table of functions corresponding to the actions the Piranha Plant can take. More... | |
#define PIRANHA_PLANT_SLEEP_MUSIC_PLAYING 0 |
Check whether the player is moving fast enough to cause the Piranha Plant to start biting.
This is called from both the "stopped biting" state and the "sleeping" state.
Make the Piranha Plant bite in the direction of the player.
If the player moves far away, move it to the stopped biting state. If the player is wearing the Metal Cap and touches the Piranha Plant while it is attacking, the Piranha Plant will move to the attacked state.
Behavior for bhvPiranhaPlant.
This controls Piranha Plants, which alternate between sleeping, attacking, and dying, primarily depending on Mario's proximity and interaction state. Reset the Piranha Plant back to a sleeping animation, no matter what state it was in previously, and make it intangible. If Mario is close, transition directly to the sleeping state.
Set the Piranha Plant to the sleeping animation and unshrink it.
When fully- grown, set it to the idle state.
This state only occurs after PIRANHA_PLANT_ACT_WAIT_TO_RESPAWN, which in turn only occurs after PIRANHA_PLANT_ACT_SHRINK_AND_DIE. The latter sets the Piranha Plant's scale to 0, therefore the Piranha Plant will grow from the ground unconditionally when in this state.
Make the Piranha Plant play a sound of defeat, shrink, and then spawn a blue coin.
Then, move it to the waiting state.
Note that this if-statement occurs unconditionally after the above if- statement. Since the Piranha Plant's scale is 1.0f by default, perhaps this was intentional. However, it is equally plausible that the programmers meant to type else if
.
Make the Piranha Plant sleep.
If Mario moves too quickly, move the Piranha Plant to the woken up state. Otherwise, play the lullaby if Mario is close enough. If the player interacts with the Piranha Plant, it will act according to piranha_plant_check_interactions().
Make the Piranha Plant quickly nod to indicate that it has stopped biting.
If the player has drawn closer during this short animation, make the Piranha Plant start biting again. Otherwise, make it go back to sleep.
Note that this state only occurs initially when the player goes further than 500.0f units from the Piranha Plant while it is biting. This if- statement activates only when the player has drawn within 400.0f units of the Piranha Plant during the short time the Piranha Plant's nod animation plays.
Wait for Mario to move far away, then respawn the Piranha Plant.
Make the Piranha Plant wake up and stop the lullaby.
After a few frames, move to the biting state.
Make the Piranha Plant play a falling-over animation and move to the dying state.
Check if the player has interacted with the Piranha Plant.
If the Piranha Plant was attacked, move it to the dying state. If the player interacted with it through some other means (e.g. by running into it), move it to the woken up state.
|
static |
The frames of the Piranha Plant's biting animation on which to play a bite sound.
Table of functions corresponding to the actions the Piranha Plant can take.