Files
Ghostship/levels/menu/script.c

92 lines
4.7 KiB
C
Raw Permalink Normal View History

2023-08-15 11:18:01 -06:00
#include <libultraship.h>
2019-11-03 14:36:27 -05:00
#include "sm64.h"
#include "behavior_data.h"
#include "model_ids.h"
#include "seq_ids.h"
#include "segment_symbols.h"
#include "level_commands.h"
2019-12-01 21:52:53 -05:00
#include "game/area.h"
2019-11-03 14:36:27 -05:00
#include "game/level_update.h"
#include "menu/file_select.h"
#include "menu/star_select.h"
#include "levels/scripts.h"
#include "actors/common1.h"
#include "make_const_nonconst.h"
[WIP] Implemented GeoLayout loading and moved to otr every actor (#53) * Fixed GeoLayout loading and implemented mario loading from otr * Ported bobomb and coins * Ported cannon barrel * Ported blue_coin_switch * Fixed collision loading * Ported checkerboard_platform * Ported most of common0 to otr * Fixed amp on jp * Fixed some wrong yamls * Fixed faulty snow interpolation * Bump LUS * Extracted 99.99999% actors to be loaded from otr * Removed unnessesary print and added o2r mod support * Fixed headers * Added us support into geolayout parser * Fixed conflicts * Removed done indicators * Remove duplicated headers * Added bbh, bitdw, bitfs, bits, bob and lll loaded from otr * Bump torch * Fixed linux compilation * Pushed header generation * Got compiling on Linux working. (#59) * Added more data and hopefully fix more issues * Updated libultraship * bin dls and vtxs (#60) * Fixed master volume * Updated torch * Renamed otr files * Renamed otr en cmakelists * Updated libultraship and torch * Removed actors code * [WIP] The big one that removes almost all hardcoded assets from levels and actors * Updating cmake to match Starship * Updated more references * Updated cmake to add more targets * Updated o2r name * Removed unnecesary dma call * Updated gitmodules * Bump LUS, fixed cmake and fixed audio on windows * Update torch and wdw * Fixed some corrupted ptrs, cleaned up jp support and fixed bully * Added USE_GBI_TRACE * Fixed packaging.cmake and audio fixes * Removed old LUS * Updated torch and readded LUS * More compilation issues * Removed interpolation to use on the future the new system * Bump libs * Reimplemented skybox, and added synthesis overflow fix * Removed prints to use SPDLOG * This should had been on another branch but fuck it * Added more interpolation stuff * Fixed interpolation, fixed some random things and ported from GameInteractor to Lwyx's EventSystem * Removed some FrameInterpolation changes * Fixed gitignore and implemented PortEnhancements * Fixed interpolation crashes, WIP implemented reset among other fixes * Bump torch to fix paintings * Moved log to be a trace * Readded some frame tagging * Fixed rumble * Fixed skybox crashes * Bump LUS * Moved skybox and floats to float for better precision * Moved to health change and created lives change event * Fixed bubbles being broken * Fixed lives event not being registered * Fixed skybox crashes * Initialized mixer variables * Fixed some memory leaks * Fixed trajectory being exported incorrectly * Hopefully fixed us yamls * Fixed remaining us issues * Implemented o2r generation among some other things --------- Co-authored-by: KiritoDv <KiritoDv> Co-authored-by: sitton76 <58642183+sitton76@users.noreply.github.com> Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com>
2026-01-07 01:37:43 -06:00
#include "assets/levels/menu.h"
2019-11-03 14:36:27 -05:00
const LevelScript level_main_menu_entry_1[] = {
INIT_LEVEL(),
FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd),
LOAD_MIO0(/*seg*/ 0x07, _menu_segment_7SegmentRomStart, _menu_segment_7SegmentRomEnd),
LOAD_RAW(/*seg*/ 0x13, _behaviorSegmentRomStart, _behaviorSegmentRomEnd),
ALLOC_LEVEL_POOL(),
LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_MARIO_SAVE_BUTTON, geo_menu_mario_save_button),
LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_RED_ERASE_BUTTON, geo_menu_erase_button),
LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_BLUE_COPY_BUTTON, geo_menu_copy_button),
LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_YELLOW_FILE_BUTTON, geo_menu_file_button),
LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_GREEN_SCORE_BUTTON, geo_menu_score_button),
LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_MARIO_SAVE_BUTTON_FADE, geo_menu_mario_save_button_fade),
LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_MARIO_NEW_BUTTON, geo_menu_mario_new_button),
LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_MARIO_NEW_BUTTON_FADE, geo_menu_mario_new_button_fade),
LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_PURPLE_SOUND_BUTTON, geo_menu_sound_button),
LOAD_MODEL_FROM_GEO(MODEL_MAIN_MENU_GENERIC_BUTTON, geo_menu_generic_button),
AREA(/*index*/ 1, geo_menu_file_select_strings_and_menu_cursor),
OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, 0, -19000, /*angle*/ 0, 0, 0, /*behParam*/ 0x04000000, /*beh*/ bhvMenuButtonManager),
OBJECT(/*model*/ MODEL_MAIN_MENU_YELLOW_FILE_BUTTON, /*pos*/ 0, 0, -19000, /*angle*/ 0, 0, 0, /*behParam*/ 0x04000000, /*beh*/ bhvYellowBackgroundInMenu),
TERRAIN(/*terrainData*/ main_menu_seg7_collision),
END_AREA(),
FREE_LEVEL_POOL(),
LOAD_AREA(/*area*/ 1),
2021-07-12 23:17:54 -04:00
SET_MENU_MUSIC(/*seq*/ SEQ_MENU_FILE_SELECT),
2019-12-01 21:52:53 -05:00
TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF),
2019-11-03 14:36:27 -05:00
CALL(/*arg*/ 0, /*func*/ lvl_init_menu_values_and_cursor_pos),
CALL_LOOP(/*arg*/ 0, /*func*/ lvl_update_obj_and_load_file_selected),
GET_OR_SET(/*op*/ OP_SET, /*var*/ VAR_CURR_SAVE_FILE_NUM),
STOP_MUSIC(/*fadeOutTime*/ 0x00BE),
2019-12-01 21:52:53 -05:00
TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF),
2019-11-03 14:36:27 -05:00
SLEEP(/*frames*/ 16),
CLEAR_LEVEL(),
SLEEP_BEFORE_EXIT(/*frames*/ 1),
2019-12-01 21:52:53 -05:00
SET_REG(/*value*/ LEVEL_CASTLE_GROUNDS),
2019-11-03 14:36:27 -05:00
EXIT_AND_EXECUTE(/*seg*/ 0x15, _scriptsSegmentRomStart, _scriptsSegmentRomEnd, level_main_scripts_entry),
};
const LevelScript level_main_menu_entry_2[] = {
/*0*/ CALL(/*arg*/ 0, /*func*/ lvl_set_current_level),
/*2*/ JUMP_IF(/*op*/ OP_EQ, /*arg*/ 0, level_main_menu_entry_2 + 42),
/*5*/ INIT_LEVEL(),
/*6*/ FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd),
/*10*/ LOAD_MIO0(/*seg*/ 0x07, _menu_segment_7SegmentRomStart, _menu_segment_7SegmentRomEnd),
/*13*/ ALLOC_LEVEL_POOL(),
/*14*/ AREA(/*index*/ 2, geo_menu_act_selector_strings),
/*16*/ OBJECT(/*model*/ MODEL_NONE, /*pos*/ 0, -100, 0, /*angle*/ 0, 0, 0, /*behParam*/ 0x04000000, /*beh*/ bhvActSelector),
/*22*/ TERRAIN(/*terrainData*/ main_menu_seg7_collision),
/*24*/ END_AREA(),
/*25*/ FREE_LEVEL_POOL(),
/*26*/ LOAD_AREA(/*area*/ 2),
2020-06-02 12:44:34 -04:00
// sVisibleStars is set to 0 during FIXED_LOAD above on N64, but not when NO_SEGMENTED_MEMORY is used.
// lvl_init_act_selector_values_and_stars must be called here otherwise the previous
// value is retained and causes incorrect drawing during the 16 transition frames.
CALL(/*arg*/ 0, /*func*/ lvl_init_act_selector_values_and_stars),
2019-12-01 21:52:53 -05:00
/*27*/ TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF),
2019-11-03 14:36:27 -05:00
/*29*/ SLEEP(/*frames*/ 16),
/*30*/ SET_MENU_MUSIC(/*seq*/ 0x000D),
/*33*/ CALL_LOOP(/*arg*/ 0, /*func*/ lvl_update_obj_and_load_act_button_actions),
/*35*/ GET_OR_SET(/*op*/ OP_SET, /*var*/ VAR_CURR_ACT_NUM),
/*36*/ STOP_MUSIC(/*fadeOutTime*/ 0x00BE),
2019-12-01 21:52:53 -05:00
/*37*/ TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF),
2019-11-03 14:36:27 -05:00
/*39*/ SLEEP(/*frames*/ 16),
/*40*/ CLEAR_LEVEL(),
/*41*/ SLEEP_BEFORE_EXIT(/*frames*/ 1),
// L1:
/*42*/ EXIT(),
};