![]() |
Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
|
#include <ultra64.h>
#include "sm64.h"
#include "game.h"
#include "sound_init.h"
#include "level_update.h"
#include "interaction.h"
#include "mario.h"
#include "mario_step.h"
#include "mario_actions_moving.h"
#include "save_file.h"
#include "area.h"
#include "camera.h"
#include "object_helpers.h"
#include "object_helpers2.h"
#include "moving_texture.h"
#include "ingame_menu.h"
#include "audio/external.h"
#include "seq_ids.h"
#include "engine/math_util.h"
#include "engine/graph_node.h"
#include "engine/surface_collision.h"
#include "engine/behavior_script.h"
#include "behavior_data.h"
#include "object_list_processor.h"
Variables | |
static struct Object * | sIntroWarpPipeObj |
static struct Object * | sEndPeachObj |
static struct Object * | sEndRightToadObj |
static struct Object * | sEndLeftToadObj |
static struct Object * | sEndJumboStarObj |
static UNUSED s32 | sUnused |
static s16 | sEndPeachAnimation |
static s16 | sEndToadAnims [2] |
static Vp | sEndCutsceneVp = { { { 640, 480, 511, 0 }, { 640, 480, 511, 0 } } } |
static struct CreditsEntry * | sDispCreditsEntry = NULL |
static s8 | D_8032CBE4 = 0 |
static s8 | D_8032CBE8 = 0 |
static s8 | D_8032CBEC [7] = { 2, 3, 2, 1, 2, 3, 2 } |
static u8 | sStarsNeededForDialog [6] = { 1, 3, 8, 30, 50, 70 } |
static Vec4s | sJumboStarKeyframes [27] |
Data for the jumbo star cutscene. More... | |
static s32 | sSparkleGenTheta = 0 |
static s32 | sSparkleGenPhi = 0 |
static u8 | sMarioBlinkOverride [20] |
anonymous enum |
anonymous enum |
anonymous enum |
enum SaveOption |
s32 act_bbh_enter_jump | ( | struct MarioState * | m | ) |
s32 act_bbh_enter_spin | ( | struct MarioState * | m | ) |
s32 act_butt_stuck_in_ground | ( | struct MarioState * | m | ) |
|
static |
s32 act_death_exit | ( | struct MarioState * | m | ) |
s32 act_death_on_back | ( | struct MarioState * | m | ) |
s32 act_death_on_stomach | ( | struct MarioState * | m | ) |
s32 act_debug_free_move | ( | struct MarioState * | m | ) |
s32 act_disappeared | ( | struct MarioState * | m | ) |
s32 act_eaten_by_bubba | ( | struct MarioState * | m | ) |
s32 act_electrocution | ( | struct MarioState * | m | ) |
s32 act_emerge_from_pipe | ( | struct MarioState * | m | ) |
|
static |
|
static |
s32 act_entering_star_door | ( | struct MarioState * | m | ) |
s32 act_exit_airborne | ( | struct MarioState * | m | ) |
act_exit_airborne: Jump out of a level after collecting a Power Star (no sparkles) Mario always faces a level entrance when he launches out of it, whether he died or he collected a star/key.
Because of that, we need him to move away from the painting by setting his speed to -32.0f and have him face away from the painting by adding 0x8000 (180 deg) to his graphics angle. We also set his heal counter to 31 to restore 7.75 units of his health, and enable the particle flag that generates sparkles.
s32 act_exit_land_save_dialog | ( | struct MarioState * | m | ) |
fall through
fall through
fall through
s32 act_fall_after_star_grab | ( | struct MarioState * | m | ) |
s32 act_falling_death_exit | ( | struct MarioState * | m | ) |
s32 act_falling_exit_airborne | ( | struct MarioState * | m | ) |
s32 act_feet_stuck_in_ground | ( | struct MarioState * | m | ) |
s32 act_going_through_door | ( | struct MarioState * | m | ) |
s32 act_head_stuck_in_ground | ( | struct MarioState * | m | ) |
|
static |
|
static |
s32 act_putting_on_cap | ( | struct MarioState * | m | ) |
s32 act_quicksand_death | ( | struct MarioState * | m | ) |
s32 act_reading_automatic_dialog | ( | struct MarioState * | m | ) |
s32 act_reading_npc_dialog | ( | struct MarioState * | m | ) |
s32 act_reading_sign | ( | struct MarioState * | m | ) |
s32 act_shocked | ( | struct MarioState * | m | ) |
s32 act_spawn_no_spin_airborne | ( | struct MarioState * | m | ) |
s32 act_spawn_no_spin_landing | ( | struct MarioState * | m | ) |
s32 act_spawn_spin_airborne | ( | struct MarioState * | m | ) |
s32 act_spawn_spin_landing | ( | struct MarioState * | m | ) |
s32 act_special_death_exit | ( | struct MarioState * | m | ) |
s32 act_special_exit_airborne | ( | struct MarioState * | m | ) |
s32 act_squished | ( | struct MarioState * | m | ) |
s32 act_standing_death | ( | struct MarioState * | m | ) |
s32 act_star_dance | ( | struct MarioState * | m | ) |
s32 act_star_dance_water | ( | struct MarioState * | m | ) |
s32 act_suffocation | ( | struct MarioState * | m | ) |
s32 act_teleport_fade_in | ( | struct MarioState * | m | ) |
s32 act_teleport_fade_out | ( | struct MarioState * | m | ) |
s32 act_unlocking_key_door | ( | struct MarioState * | m | ) |
s32 act_unlocking_star_door | ( | struct MarioState * | m | ) |
s32 act_unused_death_exit | ( | struct MarioState * | m | ) |
s32 act_waiting_for_dialog | ( | struct MarioState * | m | ) |
s32 act_warp_door_spawn | ( | struct MarioState * | m | ) |
|
static |
advance_cutscene_step: Advances the current step in the current cutscene.
Resets action state and action timer, adds 1 to the action arg (responsible for keeping track of what step of the cutscene Mario is in.)
|
static |
s32 common_death_handler | ( | struct MarioState * | m, |
s32 | animation, | ||
s32 | frameToDeathWarp | ||
) |
void cutscene_put_cap_on | ( | struct MarioState * | m | ) |
cutscene_put_cap_on: Put Mario's cap on.
Clears "cap in hand" flag, sets "cap on head" flag, plays sound SOUND_ACTION_UNKNOWN43E.
void cutscene_take_cap_off | ( | struct MarioState * | m | ) |
cutscene_take_cap_off: Put Mario's cap on.
Clears "cap on head" flag, sets "cap in hand" flag, plays sound SOUND_ACTION_UNKNOWN43D.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
void general_star_dance_handler | ( | struct MarioState * | m, |
s32 | isInWater | ||
) |
get_credits_str_width: Calculate width of a Credits String Loop over each character in a credits string and increment the length.
If the character is a space, increment by 4; otherwise increment by 7. Once the next character is a null character (equal to 0), stop counting the length since that's the end of the string.
s32 get_star_collection_dialog | ( | struct MarioState * | m | ) |
get_star_collection_dialog: Determine what dialog should show when Mario collects a star.
Determines if Mario has collected enough stars to get a dialog for it, and if so, return the dialog ID. Otherwise, return 0
void handle_save_menu | ( | struct MarioState * | m | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
s32 mario_execute_cutscene_action | ( | struct MarioState * | m | ) |
mario_ready_to_speak: Determine if Mario is able to speak to a NPC The following conditions must be met in order for Mario to be considered ready to speak.
1: Mario's action must be in the stationary or moving action groups, or if not, he must be in the "waiting for dialog" state. 2: Mario mat not be riding a shell or be invulnerable. 3: Mario must not be in first person mode.
print_displaying_credits_entry: Print the current displaying Credits Entry Called in render_game.
This function checks if sDispCreditsEntry points to a credits entry (see act_credits_cutscene), and if so, display it. The reason this is called every frame in render_game is because the credits need to display on top of everything else. To print a credits entry, we take the first character of the first string, subtract the value of the 0 character, and use that as the number of lines to print, excluding the title. Then, we print the title (after advancing the pointer by 1) at X 28, Y either 28 or 172, depending on the print at bottom flag. Finally, we print each line using the number of lines previously stored as a counter, and increase the Y value by either the constant 16 (JP only) or by the value of lineHeight.
struct Object* spawn_obj_at_mario_rel_yaw | ( | struct MarioState * | m, |
s32 | model, | ||
void * | behavior, | ||
s16 | relYaw | ||
) |
spawn_obj_at_mario_rel_yaw: Spawns object at Mario with relative yaw.
Spawns object with given behavior and model and copies over Mario's position and yaw plus relative yaw.
void stuck_in_ground_handler | ( | struct MarioState * | m, |
s32 | animation, | ||
s32 | unstuckFrame, | ||
s32 | target2, | ||
s32 | target3, | ||
s32 | endAction | ||
) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Data for the jumbo star cutscene.
It specifies the flight path after triple jumping. Each entry is one keyframe. The first number is playback speed, 1000 is the maximum and means it lasts 1 frame. 20 means that it lasts 1000/20 = 50 frames. Speed 0 marks the last keyframe. Since the cubic spline looks 3 keyframes ahead, there should be at least 2 more entries afterwards. The last three numbers of each entry are x, y and z coordinates of points that define the curve.
|
static |
|
static |
|
static |
|
static |