Files

162 lines
6.2 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"
2021-07-12 23:17:54 -04:00
#include "menu/title_screen.h"
2019-11-03 14:36:27 -05:00
#include "levels/scripts.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
#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/intro.h"
2019-11-03 14:36:27 -05:00
2020-12-03 14:26:38 -05:00
const LevelScript level_intro_splash_screen[] = {
2019-11-03 14:36:27 -05:00
INIT_LEVEL(),
FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd),
LOAD_RAW(/*seg*/ 0x13, _behaviorSegmentRomStart, _behaviorSegmentRomEnd),
LOAD_MIO0(/*seg*/ 0x07, _intro_segment_7SegmentRomStart, _intro_segment_7SegmentRomEnd),
2020-12-03 14:26:38 -05:00
// Load "Super Mario 64" logo
ALLOC_LEVEL_POOL(),
2019-11-03 14:36:27 -05:00
AREA(/*index*/ 1, intro_geo_0002D0),
END_AREA(),
FREE_LEVEL_POOL(),
2020-12-03 14:26:38 -05:00
// Start animation
2019-11-03 14:36:27 -05:00
LOAD_AREA(/*area*/ 1),
2020-12-03 14:26:38 -05:00
2021-07-12 23:17:54 -04:00
CALL(/*arg*/ LVL_INTRO_PLAY_ITS_A_ME_MARIO, /*func*/ lvl_intro_update),
2019-11-03 14:36:27 -05:00
SLEEP(/*frames*/ 75),
2019-12-01 21:52:53 -05:00
TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0x00, 0x00, 0x00),
2019-11-03 14:36:27 -05:00
SLEEP(/*frames*/ 16),
CMD2A(/*unk2*/ 1),
CLEAR_LEVEL(),
SLEEP(/*frames*/ 2),
2020-12-03 14:26:38 -05:00
EXIT_AND_EXECUTE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_mario_head_regular),
2019-11-03 14:36:27 -05:00
};
2020-12-03 14:26:38 -05:00
const LevelScript level_intro_mario_head_regular[] = {
2019-11-03 14:36:27 -05:00
INIT_LEVEL(),
BLACKOUT(/*active*/ TRUE),
FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd),
LOAD_MARIO_HEAD(/*loadHeadID*/ REGULAR_FACE),
LOAD_RAW(/*seg*/ 0x13, _behaviorSegmentRomStart, _behaviorSegmentRomEnd),
LOAD_MIO0_TEXTURE(/*seg*/ 0x0A, _title_screen_bg_mio0SegmentRomStart, _title_screen_bg_mio0SegmentRomEnd),
2020-12-03 14:26:38 -05:00
2019-11-03 14:36:27 -05:00
ALLOC_LEVEL_POOL(),
2020-12-03 14:26:38 -05:00
AREA(/*index*/ 1, intro_geo_mario_head_regular),
2019-11-03 14:36:27 -05:00
END_AREA(),
FREE_LEVEL_POOL(),
2020-12-03 14:26:38 -05:00
2019-11-03 14:36:27 -05:00
SLEEP(/*frames*/ 2),
BLACKOUT(/*active*/ FALSE),
LOAD_AREA(/*area*/ 1),
2021-07-12 23:17:54 -04:00
SET_MENU_MUSIC(/*seq*/ SEQ_MENU_TITLE_SCREEN),
2019-12-01 21:52:53 -05:00
TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_STAR, /*time*/ 20, /*color*/ 0x00, 0x00, 0x00),
2019-11-03 14:36:27 -05:00
SLEEP(/*frames*/ 20),
2021-07-12 23:17:54 -04:00
CALL_LOOP(/*arg*/ LVL_INTRO_REGULAR, /*func*/ lvl_intro_update),
2019-11-03 14:36:27 -05:00
JUMP_IF(/*op*/ OP_EQ, /*arg*/ 100, script_intro_L1),
JUMP_IF(/*op*/ OP_EQ, /*arg*/ 101, script_intro_L2),
JUMP(script_intro_L4),
};
2020-12-03 14:26:38 -05:00
const LevelScript level_intro_mario_head_dizzy[] = {
2019-11-03 14:36:27 -05:00
INIT_LEVEL(),
BLACKOUT(/*active*/ TRUE),
FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd),
LOAD_MARIO_HEAD(/*loadHeadID*/ DIZZY_FACE),
LOAD_RAW(/*seg*/ 0x13, _behaviorSegmentRomStart, _behaviorSegmentRomEnd),
LOAD_MIO0_TEXTURE(/*seg*/ 0x0A, _title_screen_bg_mio0SegmentRomStart, _title_screen_bg_mio0SegmentRomEnd),
ALLOC_LEVEL_POOL(),
2020-12-03 14:26:38 -05:00
AREA(/*index*/ 1, intro_geo_mario_head_dizzy),
2019-11-03 14:36:27 -05:00
END_AREA(),
FREE_LEVEL_POOL(),
SLEEP(/*frames*/ 2),
BLACKOUT(/*active*/ FALSE),
LOAD_AREA(/*area*/ 1),
2021-07-12 23:17:54 -04:00
SET_MENU_MUSIC(/*seq*/ SEQ_MENU_GAME_OVER),
2019-12-01 21:52:53 -05:00
TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_STAR, /*time*/ 20, /*color*/ 0x00, 0x00, 0x00),
2019-11-03 14:36:27 -05:00
SLEEP(/*frames*/ 20),
2021-07-12 23:17:54 -04:00
CALL_LOOP(/*arg*/ LVL_INTRO_GAME_OVER, /*func*/ lvl_intro_update),
2019-11-03 14:36:27 -05:00
JUMP_IF(/*op*/ OP_EQ, /*arg*/ 100, script_intro_L1),
JUMP_IF(/*op*/ OP_EQ, /*arg*/ 101, script_intro_L2),
JUMP(script_intro_L4),
};
const LevelScript level_intro_entry_4[] = {
INIT_LEVEL(),
LOAD_RAW(/*seg*/ 0x13, _behaviorSegmentRomStart, _behaviorSegmentRomEnd),
LOAD_MIO0_TEXTURE(/*seg*/ 0x0A, _title_screen_bg_mio0SegmentRomStart, _title_screen_bg_mio0SegmentRomEnd),
LOAD_MIO0(/*seg*/ 0x07, _debug_level_select_mio0SegmentRomStart, _debug_level_select_mio0SegmentRomEnd),
FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd),
ALLOC_LEVEL_POOL(),
AREA(/*index*/ 1, intro_geo_000414),
END_AREA(),
FREE_LEVEL_POOL(),
LOAD_AREA(/*area*/ 1),
2021-07-12 23:17:54 -04:00
SET_MENU_MUSIC(/*seq*/ SEQ_MENU_TITLE_SCREEN),
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
SLEEP(/*frames*/ 16),
2021-07-12 23:17:54 -04:00
CALL_LOOP(/*arg*/ LVL_INTRO_LEVEL_SELECT, /*func*/ lvl_intro_update),
2019-11-03 14:36:27 -05:00
JUMP_IF(/*op*/ OP_EQ, /*arg*/ -1, script_intro_L5),
JUMP(script_intro_L3),
};
// These should be static, but C doesn't allow non-sized forward declarations of static arrays
const LevelScript script_intro_L1[] = {
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(/*frames*/ 2),
SET_REG(/*value*/ 16),
EXIT_AND_EXECUTE(/*seg*/ 0x14, _menuSegmentRomStart, _menuSegmentRomEnd, level_main_menu_entry_1),
};
const LevelScript script_intro_L2[] = {
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(/*frames*/ 2),
EXIT_AND_EXECUTE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_entry_4),
};
const LevelScript script_intro_L3[] = {
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(/*frames*/ 2),
EXIT_AND_EXECUTE(/*seg*/ 0x15, _scriptsSegmentRomStart, _scriptsSegmentRomEnd, level_main_scripts_entry),
};
const LevelScript script_intro_L4[] = {
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(/*frames*/ 2),
EXIT_AND_EXECUTE(/*seg*/ 0x15, _scriptsSegmentRomStart, _scriptsSegmentRomEnd, level_main_scripts_entry),
};
const LevelScript script_intro_L5[] = {
STOP_MUSIC(/*fadeOutTime*/ 0x00BE),
2019-12-01 21:52:53 -05:00
TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0x00, 0x00, 0x00),
2019-11-03 14:36:27 -05:00
SLEEP(/*frames*/ 16),
CLEAR_LEVEL(),
SLEEP(/*frames*/ 2),
2020-12-03 14:26:38 -05:00
EXIT_AND_EXECUTE(/*seg*/ 0x14, _introSegmentRomStart, _introSegmentRomEnd, level_intro_splash_screen),
2019-11-03 14:36:27 -05:00
};