Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
Macros | Functions | Variables
level_update.c File Reference
#include <ultra64.h>
#include "sm64.h"
#include "seq_ids.h"
#include "audio/external.h"
#include "level_update.h"
#include "game.h"
#include "main.h"
#include "engine/math_util.h"
#include "engine/graph_node.h"
#include "area.h"
#include "save_file.h"
#include "sound_init.h"
#include "mario.h"
#include "camera.h"
#include "object_list_processor.h"
#include "ingame_menu.h"
#include "obj_behaviors.h"
#include "display.h"
#include "debug_course.h"

Macros

#define PLAY_MODE_NORMAL   0
 
#define PLAY_MODE_PAUSED   2
 
#define PLAY_MODE_CHANGE_AREA   3
 
#define PLAY_MODE_CHANGE_LEVEL   4
 
#define PLAY_MODE_FRAME_ADVANCE   5
 
#define WARP_TYPE_NOT_WARPING   0
 
#define WARP_TYPE_CHANGE_LEVEL   1
 
#define WARP_TYPE_CHANGE_AREA   2
 
#define WARP_TYPE_SAME_AREA   3
 
#define WARP_NODE_F0   0xF0
 
#define WARP_NODE_DEATH   0xF1
 
#define WARP_NODE_F2   0xF2
 
#define WARP_NODE_WARP_FLOOR   0xF3
 
#define WARP_NODE_CREDITS_START   0xF8
 
#define WARP_NODE_CREDITS_NEXT   0xF9
 
#define WARP_NODE_CREDITS_END   0xFA
 
#define WARP_NODE_CREDITS_MIN   0xF8
 
#define PAINTING_WARP_INDEX_START   0x00
 
#define PAINTING_WARP_INDEX_FA   0x2A
 
#define PAINTING_WARP_INDEX_END   0x2D
 

Functions

void basic_update (s16 *arg)
 
u16 level_control_timer (s32 timerOp)
 
u32 pressed_paused (void)
 
void set_play_mode (s16 playMode)
 
void func_8024975C (s32 arg)
 
void func_80249788 (u32 arg, u32 color)
 
void nop_802497FC (void)
 
void func_8024980C (u32 arg)
 
void func_8024992C (struct SpawnInfo *spawnInfo, u32 arg1)
 
void set_mario_initial_cap_powerup (struct MarioState *m)
 
void set_mario_initial_action (struct MarioState *m, u32 spawnType, u32 actionArg)
 
void init_mario_after_warp (void)
 
void func_8024A02C (void)
 
void func_8024A094 (void)
 
void func_8024A0E0 (void)
 
void check_instant_warp (void)
 
s16 func_8024A48C (s16 arg)
 
void initiate_warp (s16 destLevel, s16 destArea, s16 destWarpNode, s32 arg3)
 Set the current warp type and destination level/area/node. More...
 
struct WarpNodeget_painting_warp_node (void)
 Check if mario is above and close to a painting warp floor, and return the corresponding warp node. More...
 
void initiate_painting_warp (void)
 Check is mario has entered a painting, and if so, initiate a warp. More...
 
s16 level_trigger_warp (struct MarioState *m, s32 warpOp)
 If there is not already a delayed warp, schedule one. More...
 
void initiate_delayed_warp (void)
 If a delayed warp is ready, initiate it. More...
 
void update_hud_values (void)
 
void basic_update (UNUSED s16 *arg)
 Update objects, hud, and camera. More...
 
s32 play_mode_normal (void)
 
s32 play_mode_paused (void)
 
s32 play_mode_frame_advance (void)
 Debug mode that lets you frame advance by pressing D-pad down. More...
 
void level_set_transition (s16 length, void(*updateFunction)(s16 *))
 Set the transition, which is a period of time after the warp is initiated but before it actually occurs. More...
 
s32 play_mode_change_area (void)
 Play the transition and then return to normal play mode. More...
 
s32 play_mode_change_level (void)
 Play the transition and then return to normal play mode. More...
 
static s32 play_mode_unused (void)
 Unused play mode. More...
 
s32 update_level (void)
 
s32 init_level (void)
 
s32 lvl_init_or_update (s16 initOrUpdate, UNUSED s32 arg1)
 Initialize the current level if initOrUpdate is 0, or update the level if it is 1. More...
 
s32 lvl_init_from_save_file (UNUSED s16 arg0, s32 levelNum)
 
s32 lvl_set_current_level (UNUSED s16 arg0, s32 levelNum)
 
s32 lvl_play_the_end_screen_sound (UNUSED s16 arg0, UNUSED s32 arg1)
 Play the "thank you so much for to playing my game" sound. More...
 

Variables

const charcredits01 [] = { "1GAME DIRECTOR", "SHIGERU MIYAMOTO" }
 
const charcredits02 [] = { "2ASSISTANT DIRECTORS", "YOSHIAKI KOIZUMI", "TAKASHI TEZUKA" }
 
const charcredits03 [] = { "2SYSTEM PROGRAMMERS", "YASUNARI NISHIDA", "YOSHINORI TANIMOTO" }
 
const charcredits04 [] = { "3PROGRAMMERS", "HAJIME YAJIMA", "DAIKI IWAMOTO", "TOSHIO IWAWAKI" }
 
const charcredits05 []
 
const charcredits06 [] = { "2COURSE DIRECTORS", "YOICHI YAMADA", "YASUHISA YAMAMURA" }
 
const charcredits07 [] = { "2COURSE DESIGNERS", "KENTA USUI", "NAOKI MORI" }
 
const charcredits08 []
 
const charcredits09 [] = { "1SOUND COMPOSER", "KOJI KONDO" }
 
const charcredits10 []
 
const charcredits11 [] = { "23-D ANIMATORS", "YOSHIAKI KOIZUMI", "SATORU TAKIZAWA" }
 
const charcredits12 [] = { "1ADDITIONAL GRAPHICS", "MASANAO ARIMOTO" }
 
const charcredits13 [] = { "3TECHNICAL SUPPORT", "TAKAO SAWANO", "HIROHITO YOSHIMOTO", "HIROTO YADA" }
 
const charcredits14 [] = { "1TECHNICAL SUPPORT", "SGI N64 PROJECT STAFF" }
 
const charcredits15 [] = { "2PROGRESS MANAGEMENT", "KIMIYOSHI FUKUI", "KEIZO KATO" }
 
const charcredits16 []
 
const charcredits17 [] = { "4MARIO VOICE", "PEACH VOICE", "CHARLES MARTINET", "LESLIE SWAN" }
 
const charcredits18 []
 
const charcredits19 [] = { "1PRODUCER", "SHIGERU MIYAMOTO" }
 
const charcredits20 [] = { "1EXECUTIVE PRODUCER", "HIROSHI YAMAUCHI" }
 
struct CreditsEntry sCreditsSequence []
 
struct MarioState gMarioStates [1]
 
struct MarioStategMarioState = &gMarioStates[0]
 
u8 unused1 [4] = { 0 }
 
s8 D_8032C9E0 = 0
 
s16 sCurrPlayMode
 
u16 D_80339ECA
 
s16 sTransitionTimer
 
void(* sTransitionUpdate )(s16 *)
 
u8 unused3 [4]
 
struct WarpDest sWarpDest
 
s16 D_80339EE0
 
s16 sDelayedWarpOp
 
s16 sDelayedWarpTimer
 
s16 sSourceWarpNodeId
 
s32 sDelayedWarpArg
 
u8 unused4 [2]
 
s8 sTimerRunning
 
struct HudDisplay gHudDisplay
 
s8 gShouldNotPlayCastleMusic
 

Macro Definition Documentation

◆ PAINTING_WARP_INDEX_END

#define PAINTING_WARP_INDEX_END   0x2D

◆ PAINTING_WARP_INDEX_FA

#define PAINTING_WARP_INDEX_FA   0x2A

◆ PAINTING_WARP_INDEX_START

#define PAINTING_WARP_INDEX_START   0x00

◆ PLAY_MODE_CHANGE_AREA

#define PLAY_MODE_CHANGE_AREA   3

◆ PLAY_MODE_CHANGE_LEVEL

#define PLAY_MODE_CHANGE_LEVEL   4

◆ PLAY_MODE_FRAME_ADVANCE

#define PLAY_MODE_FRAME_ADVANCE   5

◆ PLAY_MODE_NORMAL

#define PLAY_MODE_NORMAL   0

◆ PLAY_MODE_PAUSED

#define PLAY_MODE_PAUSED   2

◆ WARP_NODE_CREDITS_END

#define WARP_NODE_CREDITS_END   0xFA

◆ WARP_NODE_CREDITS_MIN

#define WARP_NODE_CREDITS_MIN   0xF8

◆ WARP_NODE_CREDITS_NEXT

#define WARP_NODE_CREDITS_NEXT   0xF9

◆ WARP_NODE_CREDITS_START

#define WARP_NODE_CREDITS_START   0xF8

◆ WARP_NODE_DEATH

#define WARP_NODE_DEATH   0xF1

◆ WARP_NODE_F0

#define WARP_NODE_F0   0xF0

◆ WARP_NODE_F2

#define WARP_NODE_F2   0xF2

◆ WARP_NODE_WARP_FLOOR

#define WARP_NODE_WARP_FLOOR   0xF3

◆ WARP_TYPE_CHANGE_AREA

#define WARP_TYPE_CHANGE_AREA   2

◆ WARP_TYPE_CHANGE_LEVEL

#define WARP_TYPE_CHANGE_LEVEL   1

◆ WARP_TYPE_NOT_WARPING

#define WARP_TYPE_NOT_WARPING   0

◆ WARP_TYPE_SAME_AREA

#define WARP_TYPE_SAME_AREA   3

Function Documentation

◆ basic_update() [1/2]

void basic_update ( s16 arg)

◆ basic_update() [2/2]

void basic_update ( UNUSED s16 arg)

Update objects, hud, and camera.

This update function excludes things like endless staircase, warps, pausing, etc. This is used when entering a painting, presumably to allow painting and camera updating while avoiding triggering the warp twice.

◆ check_instant_warp()

void check_instant_warp ( void  )

◆ func_8024975C()

void func_8024975C ( s32  arg)

◆ func_80249788()

void func_80249788 ( u32  arg,
u32  color 
)

◆ func_8024980C()

void func_8024980C ( u32  arg)

◆ func_8024992C()

void func_8024992C ( struct SpawnInfo spawnInfo,
u32  arg1 
)

◆ func_8024A02C()

void func_8024A02C ( void  )

◆ func_8024A094()

void func_8024A094 ( void  )

◆ func_8024A0E0()

void func_8024A0E0 ( void  )

◆ func_8024A48C()

s16 func_8024A48C ( s16  arg)

◆ get_painting_warp_node()

struct WarpNode* get_painting_warp_node ( void  )

Check if mario is above and close to a painting warp floor, and return the corresponding warp node.

◆ init_level()

s32 init_level ( void  )

◆ init_mario_after_warp()

void init_mario_after_warp ( void  )

◆ initiate_delayed_warp()

void initiate_delayed_warp ( void  )

If a delayed warp is ready, initiate it.

◆ initiate_painting_warp()

void initiate_painting_warp ( void  )

Check is mario has entered a painting, and if so, initiate a warp.

◆ initiate_warp()

void initiate_warp ( s16  destLevel,
s16  destArea,
s16  destWarpNode,
s32  arg3 
)

Set the current warp type and destination level/area/node.

◆ level_control_timer()

u16 level_control_timer ( s32  timerOp)

◆ level_set_transition()

void level_set_transition ( s16  length,
void(*)(s16 *)  updateFunction 
)

Set the transition, which is a period of time after the warp is initiated but before it actually occurs.

If updateFunction is not NULL, it will be called each frame during the transition.

◆ level_trigger_warp()

s16 level_trigger_warp ( struct MarioState m,
s32  warpOp 
)

If there is not already a delayed warp, schedule one.

The source node is based on the warp operation and sometimes mario's used object. Return the time left until the delayed warp is initiated.

◆ lvl_init_from_save_file()

s32 lvl_init_from_save_file ( UNUSED s16  arg0,
s32  levelNum 
)

◆ lvl_init_or_update()

s32 lvl_init_or_update ( s16  initOrUpdate,
UNUSED s32  arg1 
)

Initialize the current level if initOrUpdate is 0, or update the level if it is 1.

◆ lvl_play_the_end_screen_sound()

s32 lvl_play_the_end_screen_sound ( UNUSED s16  arg0,
UNUSED s32  arg1 
)

Play the "thank you so much for to playing my game" sound.

◆ lvl_set_current_level()

s32 lvl_set_current_level ( UNUSED s16  arg0,
s32  levelNum 
)

◆ nop_802497FC()

void nop_802497FC ( void  )

◆ play_mode_change_area()

s32 play_mode_change_area ( void  )

Play the transition and then return to normal play mode.

This maybe was supposed to be sTransitionTimer == -1? sTransitionUpdate

If sTransitionTimer is -1, this will miss.

◆ play_mode_change_level()

s32 play_mode_change_level ( void  )

Play the transition and then return to normal play mode.

If sTransitionTimer is -1, this will miss.

◆ play_mode_frame_advance()

s32 play_mode_frame_advance ( void  )

Debug mode that lets you frame advance by pressing D-pad down.

Unfortunately it uses the pause camera, making it basically unusable in most levels.

◆ play_mode_normal()

s32 play_mode_normal ( void  )

◆ play_mode_paused()

s32 play_mode_paused ( void  )

◆ play_mode_unused()

static s32 play_mode_unused ( void  )
static

Unused play mode.

Doesn't call transition update and doesn't reset transition at the end.

◆ pressed_paused()

u32 pressed_paused ( void  )

◆ set_mario_initial_action()

void set_mario_initial_action ( struct MarioState m,
u32  spawnType,
u32  actionArg 
)

◆ set_mario_initial_cap_powerup()

void set_mario_initial_cap_powerup ( struct MarioState m)

◆ set_play_mode()

void set_play_mode ( s16  playMode)

◆ update_hud_values()

void update_hud_values ( void  )

Wrong variable

◆ update_level()

s32 update_level ( void  )

Variable Documentation

◆ credits01

const char* credits01[] = { "1GAME DIRECTOR", "SHIGERU MIYAMOTO" }

◆ credits02

const char* credits02[] = { "2ASSISTANT DIRECTORS", "YOSHIAKI KOIZUMI", "TAKASHI TEZUKA" }

◆ credits03

const char* credits03[] = { "2SYSTEM PROGRAMMERS", "YASUNARI NISHIDA", "YOSHINORI TANIMOTO" }

◆ credits04

const char* credits04[] = { "3PROGRAMMERS", "HAJIME YAJIMA", "DAIKI IWAMOTO", "TOSHIO IWAWAKI" }

◆ credits05

const char* credits05[]
Initial value:
= {
"4CAMERA PROGRAMMER", "MARIO FACE PROGRAMMER", "TAKUMI KAWAGOE", "GILES GODDARD"
}

◆ credits06

const char* credits06[] = { "2COURSE DIRECTORS", "YOICHI YAMADA", "YASUHISA YAMAMURA" }

◆ credits07

const char* credits07[] = { "2COURSE DESIGNERS", "KENTA USUI", "NAOKI MORI" }

◆ credits08

const char* credits08[]
Initial value:
= { "3COURSE DESIGNERS", "YOSHIKI HARUHANA", "MAKOTO MIYANAGA",
"KATSUHIKO KANNO" }

◆ credits09

const char* credits09[] = { "1SOUND COMPOSER", "KOJI KONDO" }

◆ credits10

const char* credits10[]
Initial value:
= { "4SOUND EFFECTS", "SOUND PROGRAMMER", "YOJI INAGAKI",
"HIDEAKI SHIMIZU" }

◆ credits11

const char* credits11[] = { "23-D ANIMATORS", "YOSHIAKI KOIZUMI", "SATORU TAKIZAWA" }

◆ credits12

const char* credits12[] = { "1ADDITIONAL GRAPHICS", "MASANAO ARIMOTO" }

◆ credits13

const char* credits13[] = { "3TECHNICAL SUPPORT", "TAKAO SAWANO", "HIROHITO YOSHIMOTO", "HIROTO YADA" }

◆ credits14

const char* credits14[] = { "1TECHNICAL SUPPORT", "SGI N64 PROJECT STAFF" }

◆ credits15

const char* credits15[] = { "2PROGRESS MANAGEMENT", "KIMIYOSHI FUKUI", "KEIZO KATO" }

◆ credits16

const char* credits16[]
Initial value:
= { "5SCREEN TEXT WRITER", "TRANSLATION", "LESLIE SWAN", "MINA AKINO",
"HIRO YAMADA" }

◆ credits17

const char* credits17[] = { "4MARIO VOICE", "PEACH VOICE", "CHARLES MARTINET", "LESLIE SWAN" }

◆ credits18

const char* credits18[]
Initial value:
= { "3SPECIAL THANKS TO", "EAD STAFF", "ALL NINTENDO PERSONNEL",
"MARIO CLUB STAFF" }

◆ credits19

const char* credits19[] = { "1PRODUCER", "SHIGERU MIYAMOTO" }

◆ credits20

const char* credits20[] = { "1EXECUTIVE PRODUCER", "HIROSHI YAMAUCHI" }

◆ D_8032C9E0

s8 D_8032C9E0 = 0

◆ D_80339ECA

u16 D_80339ECA

◆ D_80339EE0

s16 D_80339EE0

◆ gHudDisplay

struct HudDisplay gHudDisplay

◆ gMarioState

struct MarioState* gMarioState = &gMarioStates[0]

◆ gMarioStates

struct MarioState gMarioStates[1]

◆ gShouldNotPlayCastleMusic

s8 gShouldNotPlayCastleMusic

◆ sCreditsSequence

struct CreditsEntry sCreditsSequence[]
Initial value:
= {
{ LEVEL_CASTLE_GROUNDS, 1, 1, -128, { 0, 8000, 0 }, NULL },
{ LEVEL_BOB, 1, 1, 117, { 713, 3918, -3889 }, credits01 },
{ LEVEL_WF, 1, 50, 46, { 347, 5376, 326 }, credits02 },
{ LEVEL_JRB, 1, 18, 22, { 3800, -4840, 2727 }, credits03 },
{ LEVEL_CCM, 2, 34, 25, { -5464, 6656, -6575 }, credits04 },
{ LEVEL_BBH, 1, 1, 60, { 257, 1922, 2580 }, credits05 },
{ LEVEL_HMC, 1, -15, 123, { -6469, 1616, -6054 }, credits06 },
{ LEVEL_THI, 3, 17, -32, { 508, 1024, 1942 }, credits07 },
{ LEVEL_LLL, 2, 33, 124, { -73, 82, -1467 }, credits08 },
{ LEVEL_SSL, 1, 65, 98, { -5906, 1024, -2576 }, credits09 },
{ LEVEL_DDD, 1, 50, 47, { -4884, -4607, -272 }, credits10 },
{ LEVEL_SL, 1, 17, -34, { 1925, 3328, 563 }, credits11 },
{ LEVEL_WDW, 1, 33, 105, { -537, 1850, 1818 }, credits12 },
{ LEVEL_TTM, 1, 2, -33, { 2613, 313, 1074 }, credits13 },
{ LEVEL_THI, 1, 51, 54, { -2609, 512, 856 }, credits14 },
{ LEVEL_TTC, 1, 17, -72, { -1304, -71, -967 }, credits15 },
{ LEVEL_RR, 1, 33, 64, { 1565, 1024, -148 }, credits16 },
{ LEVEL_SA, 1, 1, 24, { -1050, -1330, -1559 }, credits17 },
{ LEVEL_COTMC, 1, 49, -16, { -254, 415, -6045 }, credits18 },
{ LEVEL_DDD, 2, -111, -64, { 3948, 1185, -104 }, credits19 },
{ LEVEL_CCM, 1, 33, 31, { 3169, -4607, 5240 }, credits20 },
{ LEVEL_CASTLE_GROUNDS, 1, 1, -128, { 0, 906, -1200 }, NULL },
{ 0, 0, 1, 0, { 0, 0, 0 }, NULL },
}
Definition: area.h:75
Definition: area.h:57
const char * credits10[]
Definition: level_update.c:85
Definition: area.h:65
const char * credits13[]
Definition: level_update.c:89
Definition: area.h:88
const char * credits03[]
Definition: level_update.c:75
Definition: area.h:59
Definition: area.h:62
Definition: area.h:72
const char * credits02[]
Definition: level_update.c:74
Definition: area.h:66
Definition: area.h:61
Definition: area.h:67
Definition: area.h:63
const char * credits20[]
Definition: level_update.c:98
const char * credits18[]
Definition: level_update.c:95
Definition: area.h:76
const char * credits08[]
Definition: level_update.c:82
const char * credits09[]
Definition: level_update.c:84
Definition: area.h:64
const char * credits15[]
Definition: level_update.c:91
const char * credits01[]
Definition: level_update.c:73
const char * credits06[]
Definition: level_update.c:80
Definition: area.h:68
const char * credits07[]
Definition: level_update.c:81
Definition: area.h:80
Definition: area.h:56
const char * credits04[]
Definition: level_update.c:76
const char * credits14[]
Definition: level_update.c:90
const char * credits17[]
Definition: level_update.c:94
#define NULL
Definition: mbi.h:101
const char * credits05[]
Definition: level_update.c:77
const char * credits12[]
Definition: level_update.c:88
const char * credits19[]
Definition: level_update.c:97
Definition: area.h:74
const char * credits11[]
Definition: level_update.c:87
const char * credits16[]
Definition: level_update.c:92
Definition: area.h:60

◆ sCurrPlayMode

s16 sCurrPlayMode

◆ sDelayedWarpArg

s32 sDelayedWarpArg

◆ sDelayedWarpOp

s16 sDelayedWarpOp

◆ sDelayedWarpTimer

s16 sDelayedWarpTimer

◆ sSourceWarpNodeId

s16 sSourceWarpNodeId

◆ sTimerRunning

s8 sTimerRunning

◆ sTransitionTimer

s16 sTransitionTimer

◆ sTransitionUpdate

void(* sTransitionUpdate) (s16 *)

◆ sWarpDest

struct WarpDest sWarpDest

◆ unused1

u8 unused1[4] = { 0 }

◆ unused3

u8 unused3[4]

◆ unused4

u8 unused4[2]