script.c (6353B)
1 #include <ultra64.h> 2 #include "sm64.h" 3 #include "behavior_data.h" 4 #include "model_ids.h" 5 #include "seq_ids.h" 6 #include "segment_symbols.h" 7 #include "level_commands.h" 8 9 #include "game/area.h" 10 #include "game/level_update.h" 11 #include "menu/title_screen.h" 12 13 #include "levels/scripts.h" 14 #include "levels/menu/header.h" 15 16 #include "actors/common1.h" 17 18 #include "make_const_nonconst.h" 19 #include "levels/intro/header.h" 20 21 const LevelScript level_intro_splash_screen[] = { 22 INIT_LEVEL(), 23 FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd), 24 LOAD_RAW (/*seg*/ 0x13, _behaviorSegmentRomStart, _behaviorSegmentRomEnd), 25 LOAD_MIO0(/*seg*/ 0x07, _intro_segment_7SegmentRomStart, _intro_segment_7SegmentRomEnd), 26 27 // Load "Super Mario 64" logo 28 ALLOC_LEVEL_POOL(), 29 AREA(/*index*/ 1, intro_geo_0002D0), 30 END_AREA(), 31 FREE_LEVEL_POOL(), 32 33 // Start animation 34 LOAD_AREA(/*area*/ 1), 35 36 CALL(/*arg*/ LVL_INTRO_PLAY_ITS_A_ME_MARIO, /*func*/ lvl_intro_update), 37 SLEEP(/*frames*/ 75), 38 TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0x00, 0x00, 0x00), 39 SLEEP(/*frames*/ 16), 40 CMD2A(/*unk2*/ 1), 41 CLEAR_LEVEL(), 42 SLEEP(/*frames*/ 2), 43 EXIT_AND_EXECUTE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_mario_head_regular), 44 }; 45 46 const LevelScript level_intro_mario_head_regular[] = { 47 INIT_LEVEL(), 48 BLACKOUT(/*active*/ TRUE), 49 FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd), 50 LOAD_MARIO_HEAD(/*loadHeadID*/ REGULAR_FACE), 51 LOAD_RAW (/*seg*/ 0x13, _behaviorSegmentRomStart, _behaviorSegmentRomEnd), 52 LOAD_MIO0_TEXTURE(/*seg*/ 0x0A, _title_screen_bg_mio0SegmentRomStart, _title_screen_bg_mio0SegmentRomEnd), 53 54 ALLOC_LEVEL_POOL(), 55 AREA(/*index*/ 1, intro_geo_mario_head_regular), 56 END_AREA(), 57 FREE_LEVEL_POOL(), 58 59 SLEEP(/*frames*/ 2), 60 BLACKOUT(/*active*/ FALSE), 61 LOAD_AREA(/*area*/ 1), 62 SET_MENU_MUSIC(/*seq*/ SEQ_MENU_TITLE_SCREEN), 63 TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_STAR, /*time*/ 20, /*color*/ 0x00, 0x00, 0x00), 64 SLEEP(/*frames*/ 20), 65 CALL_LOOP(/*arg*/ LVL_INTRO_REGULAR, /*func*/ lvl_intro_update), 66 JUMP_IF(/*op*/ OP_EQ, /*arg*/ 100, script_intro_L1), 67 JUMP_IF(/*op*/ OP_EQ, /*arg*/ 101, script_intro_L2), 68 JUMP(script_intro_L4), 69 }; 70 71 const LevelScript level_intro_mario_head_dizzy[] = { 72 INIT_LEVEL(), 73 BLACKOUT(/*active*/ TRUE), 74 FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd), 75 LOAD_MARIO_HEAD(/*loadHeadID*/ DIZZY_FACE), 76 LOAD_RAW (/*seg*/ 0x13, _behaviorSegmentRomStart, _behaviorSegmentRomEnd), 77 LOAD_MIO0_TEXTURE(/*seg*/ 0x0A, _title_screen_bg_mio0SegmentRomStart, _title_screen_bg_mio0SegmentRomEnd), 78 ALLOC_LEVEL_POOL(), 79 80 AREA(/*index*/ 1, intro_geo_mario_head_dizzy), 81 END_AREA(), 82 83 FREE_LEVEL_POOL(), 84 SLEEP(/*frames*/ 2), 85 BLACKOUT(/*active*/ FALSE), 86 LOAD_AREA(/*area*/ 1), 87 SET_MENU_MUSIC(/*seq*/ SEQ_MENU_GAME_OVER), 88 TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_STAR, /*time*/ 20, /*color*/ 0x00, 0x00, 0x00), 89 SLEEP(/*frames*/ 20), 90 CALL_LOOP(/*arg*/ LVL_INTRO_GAME_OVER, /*func*/ lvl_intro_update), 91 JUMP_IF(/*op*/ OP_EQ, /*arg*/ 100, script_intro_L1), 92 JUMP_IF(/*op*/ OP_EQ, /*arg*/ 101, script_intro_L2), 93 JUMP(script_intro_L4), 94 }; 95 96 const LevelScript level_intro_entry_4[] = { 97 INIT_LEVEL(), 98 LOAD_RAW (/*seg*/ 0x13, _behaviorSegmentRomStart, _behaviorSegmentRomEnd), 99 LOAD_MIO0_TEXTURE(/*seg*/ 0x0A, _title_screen_bg_mio0SegmentRomStart, _title_screen_bg_mio0SegmentRomEnd), 100 LOAD_MIO0 (/*seg*/ 0x07, _debug_level_select_mio0SegmentRomStart, _debug_level_select_mio0SegmentRomEnd), 101 FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd), 102 ALLOC_LEVEL_POOL(), 103 104 AREA(/*index*/ 1, intro_geo_000414), 105 END_AREA(), 106 107 FREE_LEVEL_POOL(), 108 LOAD_AREA(/*area*/ 1), 109 SET_MENU_MUSIC(/*seq*/ SEQ_MENU_TITLE_SCREEN), 110 TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF), 111 SLEEP(/*frames*/ 16), 112 CALL_LOOP(/*arg*/ LVL_INTRO_LEVEL_SELECT, /*func*/ lvl_intro_update), 113 JUMP_IF(/*op*/ OP_EQ, /*arg*/ -1, script_intro_L5), 114 JUMP(script_intro_L3), 115 }; 116 117 // These should be static, but C doesn't allow non-sized forward declarations of static arrays 118 119 const LevelScript script_intro_L1[] = { 120 STOP_MUSIC(/*fadeOutTime*/ 0x00BE), 121 TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF), 122 SLEEP(/*frames*/ 16), 123 CLEAR_LEVEL(), 124 SLEEP(/*frames*/ 2), 125 SET_REG(/*value*/ 16), 126 EXIT_AND_EXECUTE(/*seg*/ 0x14, _menuSegmentRomStart, _menuSegmentRomEnd, level_main_menu_entry_1), 127 }; 128 129 const LevelScript script_intro_L2[] = { 130 TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF), 131 SLEEP(/*frames*/ 16), 132 CLEAR_LEVEL(), 133 SLEEP(/*frames*/ 2), 134 EXIT_AND_EXECUTE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_entry_4), 135 }; 136 137 const LevelScript script_intro_L3[] = { 138 STOP_MUSIC(/*fadeOutTime*/ 0x00BE), 139 TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF), 140 SLEEP(/*frames*/ 16), 141 CLEAR_LEVEL(), 142 SLEEP(/*frames*/ 2), 143 EXIT_AND_EXECUTE(/*seg*/ 0x15, _scriptsSegmentRomStart, _scriptsSegmentRomEnd, level_main_scripts_entry), 144 }; 145 146 const LevelScript script_intro_L4[] = { 147 TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF), 148 SLEEP(/*frames*/ 16), 149 CLEAR_LEVEL(), 150 SLEEP(/*frames*/ 2), 151 EXIT_AND_EXECUTE(/*seg*/ 0x15, _scriptsSegmentRomStart, _scriptsSegmentRomEnd, level_main_scripts_entry), 152 }; 153 154 const LevelScript script_intro_L5[] = { 155 STOP_MUSIC(/*fadeOutTime*/ 0x00BE), 156 TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0x00, 0x00, 0x00), 157 SLEEP(/*frames*/ 16), 158 CLEAR_LEVEL(), 159 SLEEP(/*frames*/ 2), 160 EXIT_AND_EXECUTE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_splash_screen), 161 };