Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
Data Structures | Macros | Enumerations | Functions | Variables
level_script.c File Reference
#include <ultra64.h>
#include "sm64.h"
#include "audio/external.h"
#include "game/display.h"
#include "game/game.h"
#include "geo_layout.h"
#include "graph_node.h"
#include "level_script.h"
#include "game/mario.h"
#include "math_util.h"
#include "game/memory.h"
#include "game/object_helpers.h"
#include "game/object_list_processor.h"
#include "game/area.h"
#include "game/save_file.h"
#include "game/sound_init.h"
#include "surface_collision.h"
#include "surface_load.h"
#include "goddard/renderer.h"
#include "game/profiler.h"

Data Structures

struct  LevelCommand
 

Macros

#define CMD_GET(type, offset)   (*(type *) (offset + (u8 *) sCurrentCmd))
 
#define CMD_NEXT   ((struct LevelCommand *) ((u8 *) sCurrentCmd + sCurrentCmd->size))
 
#define NEXT_CMD   ((struct LevelCommand *) (sCurrentCmd->size + (u8 *) sCurrentCmd))
 

Enumerations

enum  ScriptStatus { SCRIPT_RUNNING = 1, SCRIPT_PAUSED = 0, SCRIPT_PAUSED2 = -1 }
 

Functions

static s32 eval_script_op (s8 op, s32 arg)
 
static void level_cmd_load_and_execute (void)
 
static void level_cmd_exit_and_execute (void)
 
static void level_cmd_exit (void)
 
static void level_cmd_sleep (void)
 
static void level_cmd_sleep2 (void)
 
static void level_cmd_jump (void)
 
static void level_cmd_jump_and_link (void)
 
static void level_cmd_return (void)
 
static void level_cmd_jump_and_link_push_arg (void)
 
static void level_cmd_jump_repeat (void)
 
static void level_cmd_loop_begin (void)
 
static void level_cmd_loop_until (void)
 
static void level_cmd_jump_if (void)
 
static void level_cmd_jump_and_link_if (void)
 
static void level_cmd_skip_if (void)
 
static void level_cmd_skip (void)
 
static void level_cmd_skippable_nop (void)
 
static void level_cmd_call (void)
 
static void level_cmd_call_loop (void)
 
static void level_cmd_set_register (void)
 
static void level_cmd_push_pool_state (void)
 
static void level_cmd_pop_pool_state (void)
 
static void level_cmd_load_to_fixed_address (void)
 
static void level_cmd_load_segment (void)
 
static void level_cmd_load_compressed_segment (void)
 
static void level_cmd_19 (void)
 
static void level_cmd_1A (void)
 
static void level_cmd_init_level (void)
 
static void level_cmd_clear_level (void)
 
static void level_cmd_alloc_level_pool (void)
 
static void level_cmd_free_level_pool (void)
 
static void level_cmd_begin_area (void)
 
static void level_cmd_end_area (void)
 
static void level_cmd_21 (void)
 
static void level_cmd_22 (void)
 
static void level_cmd_23 (void)
 
static void level_cmd_init_mario (void)
 
static void level_cmd_place_object (void)
 
static void level_cmd_create_warp_node (void)
 
static void level_cmd_create_instant_warp (void)
 
static void level_cmd_set_terrain_type (void)
 
static void level_cmd_create_painting_warp_node (void)
 
static void level_cmd_3A (void)
 
static void level_cmd_create_whirlpool (void)
 
static void level_cmd_set_blackout (void)
 
static void level_cmd_set_gamma (void)
 
static void level_cmd_set_terrain_data (void)
 
static void level_cmd_set_rooms (void)
 
static void level_cmd_39 (void)
 
static void level_cmd_load_area (void)
 
static void level_cmd_2A (void)
 
static void level_cmd_set_mario_start_pos (void)
 
static void level_cmd_2C (void)
 
static void level_cmd_2D (void)
 
static void level_cmd_set_transition (void)
 
static void level_cmd_nop (void)
 
static void level_cmd_30 (void)
 
static void level_cmd_set_music (void)
 
static void level_cmd_set_menu_music (void)
 
static void level_cmd_38 (void)
 
static void level_cmd_get_or_set_var (void)
 
struct LevelCommandlevel_script_execute (struct LevelCommand *cmd)
 

Variables

static u32 sStack [32]
 
static struct AllocOnlyPoolsLevelPool = NULL
 
static u16 sDelayFrames = 0
 
static u16 sDelayFrames2 = 0
 
static s16 sCurrAreaIndex = -1
 
static u32sStackTop = sStack
 
static u32sStackBase = NULL
 
static s16 sScriptStatus
 
static s32 sRegister
 
static struct LevelCommandsCurrentCmd
 
static void(* LevelScriptJumpTable [])(void)
 

Macro Definition Documentation

◆ CMD_GET

#define CMD_GET (   type,
  offset 
)    (*(type *) (offset + (u8 *) sCurrentCmd))

◆ CMD_NEXT

#define CMD_NEXT   ((struct LevelCommand *) ((u8 *) sCurrentCmd + sCurrentCmd->size))

◆ NEXT_CMD

#define NEXT_CMD   ((struct LevelCommand *) (sCurrentCmd->size + (u8 *) sCurrentCmd))

Enumeration Type Documentation

◆ ScriptStatus

Enumerator
SCRIPT_RUNNING 
SCRIPT_PAUSED 
SCRIPT_PAUSED2 

Function Documentation

◆ eval_script_op()

static s32 eval_script_op ( s8  op,
s32  arg 
)
static

◆ level_cmd_19()

static void level_cmd_19 ( void  )
static

◆ level_cmd_1A()

static void level_cmd_1A ( void  )
static

◆ level_cmd_21()

static void level_cmd_21 ( void  )
static

◆ level_cmd_22()

static void level_cmd_22 ( void  )
static

◆ level_cmd_23()

static void level_cmd_23 ( void  )
static

◆ level_cmd_2A()

static void level_cmd_2A ( void  )
static

◆ level_cmd_2C()

static void level_cmd_2C ( void  )
static

◆ level_cmd_2D()

static void level_cmd_2D ( void  )
static

◆ level_cmd_30()

static void level_cmd_30 ( void  )
static

◆ level_cmd_38()

static void level_cmd_38 ( void  )
static

◆ level_cmd_39()

static void level_cmd_39 ( void  )
static

◆ level_cmd_3A()

static void level_cmd_3A ( void  )
static

◆ level_cmd_alloc_level_pool()

static void level_cmd_alloc_level_pool ( void  )
static

◆ level_cmd_begin_area()

static void level_cmd_begin_area ( void  )
static

◆ level_cmd_call()

static void level_cmd_call ( void  )
static

◆ level_cmd_call_loop()

static void level_cmd_call_loop ( void  )
static

◆ level_cmd_clear_level()

static void level_cmd_clear_level ( void  )
static

◆ level_cmd_create_instant_warp()

static void level_cmd_create_instant_warp ( void  )
static

◆ level_cmd_create_painting_warp_node()

static void level_cmd_create_painting_warp_node ( void  )
static

◆ level_cmd_create_warp_node()

static void level_cmd_create_warp_node ( void  )
static

◆ level_cmd_create_whirlpool()

static void level_cmd_create_whirlpool ( void  )
static

◆ level_cmd_end_area()

static void level_cmd_end_area ( void  )
static

◆ level_cmd_exit()

static void level_cmd_exit ( void  )
static

◆ level_cmd_exit_and_execute()

static void level_cmd_exit_and_execute ( void  )
static

◆ level_cmd_free_level_pool()

static void level_cmd_free_level_pool ( void  )
static

◆ level_cmd_get_or_set_var()

static void level_cmd_get_or_set_var ( void  )
static

◆ level_cmd_init_level()

static void level_cmd_init_level ( void  )
static

◆ level_cmd_init_mario()

static void level_cmd_init_mario ( void  )
static

◆ level_cmd_jump()

static void level_cmd_jump ( void  )
static

◆ level_cmd_jump_and_link()

static void level_cmd_jump_and_link ( void  )
static

◆ level_cmd_jump_and_link_if()

static void level_cmd_jump_and_link_if ( void  )
static

◆ level_cmd_jump_and_link_push_arg()

static void level_cmd_jump_and_link_push_arg ( void  )
static

◆ level_cmd_jump_if()

static void level_cmd_jump_if ( void  )
static

◆ level_cmd_jump_repeat()

static void level_cmd_jump_repeat ( void  )
static

◆ level_cmd_load_and_execute()

static void level_cmd_load_and_execute ( void  )
static

◆ level_cmd_load_area()

static void level_cmd_load_area ( void  )
static

◆ level_cmd_load_compressed_segment()

static void level_cmd_load_compressed_segment ( void  )
static

◆ level_cmd_load_segment()

static void level_cmd_load_segment ( void  )
static

◆ level_cmd_load_to_fixed_address()

static void level_cmd_load_to_fixed_address ( void  )
static

◆ level_cmd_loop_begin()

static void level_cmd_loop_begin ( void  )
static

◆ level_cmd_loop_until()

static void level_cmd_loop_until ( void  )
static

◆ level_cmd_nop()

static void level_cmd_nop ( void  )
static

◆ level_cmd_place_object()

static void level_cmd_place_object ( void  )
static

◆ level_cmd_pop_pool_state()

static void level_cmd_pop_pool_state ( void  )
static

◆ level_cmd_push_pool_state()

static void level_cmd_push_pool_state ( void  )
static

◆ level_cmd_return()

static void level_cmd_return ( void  )
static

◆ level_cmd_set_blackout()

static void level_cmd_set_blackout ( void  )
static

◆ level_cmd_set_gamma()

static void level_cmd_set_gamma ( void  )
static

◆ level_cmd_set_mario_start_pos()

static void level_cmd_set_mario_start_pos ( void  )
static

◆ level_cmd_set_menu_music()

static void level_cmd_set_menu_music ( void  )
static

◆ level_cmd_set_music()

static void level_cmd_set_music ( void  )
static

◆ level_cmd_set_register()

static void level_cmd_set_register ( void  )
static

◆ level_cmd_set_rooms()

static void level_cmd_set_rooms ( void  )
static

◆ level_cmd_set_terrain_data()

static void level_cmd_set_terrain_data ( void  )
static

◆ level_cmd_set_terrain_type()

static void level_cmd_set_terrain_type ( void  )
static

◆ level_cmd_set_transition()

static void level_cmd_set_transition ( void  )
static

◆ level_cmd_skip()

static void level_cmd_skip ( void  )
static

◆ level_cmd_skip_if()

static void level_cmd_skip_if ( void  )
static

◆ level_cmd_skippable_nop()

static void level_cmd_skippable_nop ( void  )
static

◆ level_cmd_sleep()

static void level_cmd_sleep ( void  )
static

◆ level_cmd_sleep2()

static void level_cmd_sleep2 ( void  )
static

◆ level_script_execute()

struct LevelCommand* level_script_execute ( struct LevelCommand cmd)

Variable Documentation

◆ LevelScriptJumpTable

void(* LevelScriptJumpTable[])(void)
static

◆ sCurrAreaIndex

s16 sCurrAreaIndex = -1
static

◆ sCurrentCmd

struct LevelCommand* sCurrentCmd
static

◆ sDelayFrames

u16 sDelayFrames = 0
static

◆ sDelayFrames2

u16 sDelayFrames2 = 0
static

◆ sLevelPool

struct AllocOnlyPool* sLevelPool = NULL
static

◆ sRegister

s32 sRegister
static

◆ sScriptStatus

s16 sScriptStatus
static

◆ sStack

u32 sStack[32]
static

◆ sStackBase

u32* sStackBase = NULL
static

◆ sStackTop

u32* sStackTop = sStack
static