script.c (4921B)
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/file_select.h" 12 #include "menu/star_select.h" 13 14 #include "levels/scripts.h" 15 16 #include "actors/common1.h" 17 18 #include "make_const_nonconst.h" 19 #include "levels/menu/header.h" 20 21 const LevelScript level_main_menu_entry_1[] = { 22 INIT_LEVEL(), 23 FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd), 24 LOAD_MIO0(/*seg*/ 0x07, _menu_segment_7SegmentRomStart, _menu_segment_7SegmentRomEnd), 25 LOAD_RAW (/*seg*/ 0x13, _behaviorSegmentRomStart, _behaviorSegmentRomEnd), 26 ALLOC_LEVEL_POOL(), 27 LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_MARIO_SAVE_BUTTON, geo_menu_mario_save_button), 28 LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_RED_ERASE_BUTTON, geo_menu_erase_button), 29 LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_BLUE_COPY_BUTTON, geo_menu_copy_button), 30 LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_YELLOW_FILE_BUTTON, geo_menu_file_button), 31 LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_GREEN_SCORE_BUTTON, geo_menu_score_button), 32 LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_MARIO_SAVE_BUTTON_FADE, geo_menu_mario_save_button_fade), 33 LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_MARIO_NEW_BUTTON, geo_menu_mario_new_button), 34 LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_MARIO_NEW_BUTTON_FADE, geo_menu_mario_new_button_fade), 35 LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_PURPLE_SOUND_BUTTON, geo_menu_sound_button), 36 LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_GENERIC_BUTTON, geo_menu_generic_button), 37 38 AREA(/*index*/ 1, geo_menu_file_select_strings_and_menu_cursor), 39 OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, 0, -19000, /*angle*/ 0, 0, 0, /*bhvParam*/ BPARAM1(0x04), /*bhv*/ bhvMenuButtonManager), 40 OBJECT(/*model*/ MODEL_MAIN_MENU_YELLOW_FILE_BUTTON, /*pos*/ 0, 0, -19000, /*angle*/ 0, 0, 0, /*bhvParam*/ BPARAM1(0x04), /*bhv*/ bhvYellowBackgroundInMenu), 41 TERRAIN(/*terrainData*/ main_menu_seg7_collision), 42 END_AREA(), 43 44 FREE_LEVEL_POOL(), 45 LOAD_AREA(/*area*/ 1), 46 SET_MENU_MUSIC(/*seq*/ SEQ_MENU_FILE_SELECT), 47 TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF), 48 CALL(/*arg*/ 0, /*func*/ lvl_init_menu_values_and_cursor_pos), 49 CALL_LOOP(/*arg*/ 0, /*func*/ lvl_update_obj_and_load_file_selected), 50 GET_OR_SET(/*op*/ OP_SET, /*var*/ VAR_CURR_SAVE_FILE_NUM), 51 STOP_MUSIC(/*fadeOutTime*/ 0x00BE), 52 TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF), 53 SLEEP(/*frames*/ 16), 54 CLEAR_LEVEL(), 55 SLEEP_BEFORE_EXIT(/*frames*/ 1), 56 SET_REG(/*value*/ LEVEL_CASTLE_GROUNDS), 57 EXIT_AND_EXECUTE(/*seg*/ 0x15, _scriptsSegmentRomStart, _scriptsSegmentRomEnd, level_main_scripts_entry), 58 }; 59 60 const LevelScript level_main_menu_entry_2[] = { 61 /*0*/ CALL(/*arg*/ 0, /*func*/ lvl_set_current_level), 62 /*2*/ JUMP_IF(/*op*/ OP_EQ, /*arg*/ 0, level_main_menu_entry_2 + 42), 63 /*5*/ INIT_LEVEL(), 64 /*6*/ FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd), 65 /*10*/ LOAD_MIO0(/*seg*/ 0x07, _menu_segment_7SegmentRomStart, _menu_segment_7SegmentRomEnd), 66 /*13*/ ALLOC_LEVEL_POOL(), 67 68 /*14*/ AREA(/*index*/ 2, geo_menu_act_selector_strings), 69 /*16*/ OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, -100, 0, /*angle*/ 0, 0, 0, /*bhvParam*/ BPARAM1(0x04), /*bhv*/ bhvActSelector), 70 /*22*/ TERRAIN(/*terrainData*/ main_menu_seg7_collision), 71 /*24*/ END_AREA(), 72 73 /*25*/ FREE_LEVEL_POOL(), 74 /*26*/ LOAD_AREA(/*area*/ 2), 75 #ifdef NO_SEGMENTED_MEMORY 76 // sVisibleStars is set to 0 during FIXED_LOAD above on N64, but not when NO_SEGMENTED_MEMORY is used. 77 // lvl_init_act_selector_values_and_stars must be called here otherwise the previous 78 // value is retained and causes incorrect drawing during the 16 transition frames. 79 CALL(/*arg*/ 0, /*func*/ lvl_init_act_selector_values_and_stars), 80 #endif 81 /*27*/ TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF), 82 /*29*/ SLEEP(/*frames*/ 16), 83 /*30*/ SET_MENU_MUSIC(/*seq*/ 0x000D), 84 #ifndef NO_SEGMENTED_MEMORY 85 /*31*/ CALL(/*arg*/ 0, /*func*/ lvl_init_act_selector_values_and_stars), 86 #endif 87 /*33*/ CALL_LOOP(/*arg*/ 0, /*func*/ lvl_update_obj_and_load_act_button_actions), 88 /*35*/ GET_OR_SET(/*op*/ OP_SET, /*var*/ VAR_CURR_ACT_NUM), 89 /*36*/ STOP_MUSIC(/*fadeOutTime*/ 0x00BE), 90 /*37*/ TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF), 91 /*39*/ SLEEP(/*frames*/ 16), 92 /*40*/ CLEAR_LEVEL(), 93 /*41*/ SLEEP_BEFORE_EXIT(/*frames*/ 1), 94 // L1: 95 /*42*/ EXIT(), 96 };