Make ending set level to LEVEL_ENDING

This commit is contained in:
Agent X 2024-12-15 20:24:00 -05:00
parent 7e21a58eb3
commit 95ef1eb133
3 changed files with 22 additions and 20 deletions

View file

@ -17,25 +17,26 @@
#include "levels/ending/header.h" #include "levels/ending/header.h"
const LevelScript level_ending_entry[] = { const LevelScript level_ending_entry[] = {
/*0*/ INIT_LEVEL(), CALL(/*arg*/ LEVEL_ENDING, /*func*/ lvl_set_current_level),
/*1*/ LOAD_MIO0(/*seg*/ 0x07, _ending_segment_7SegmentRomStart, _ending_segment_7SegmentRomEnd), INIT_LEVEL(),
/*4*/ ALLOC_LEVEL_POOL(), LOAD_MIO0(/*seg*/ 0x07, _ending_segment_7SegmentRomStart, _ending_segment_7SegmentRomEnd),
ALLOC_LEVEL_POOL(),
/*5*/ AREA(/*index*/ 1, ending_geo_000050), AREA(/*index*/ 1, ending_geo_000050),
/*7*/ END_AREA(), END_AREA(),
/*8*/ FREE_LEVEL_POOL(), FREE_LEVEL_POOL(),
/*9*/ SLEEP(/*frames*/ 60), SLEEP(/*frames*/ 60),
/*10*/ BLACKOUT(/*active*/ FALSE), BLACKOUT(/*active*/ FALSE),
/*11*/ LOAD_AREA(/*area*/ 1), LOAD_AREA(/*area*/ 1),
/*12*/ TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_COLOR, /*time*/ 75, /*color*/ 0x00, 0x00, 0x00), TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_COLOR, /*time*/ 75, /*color*/ 0x00, 0x00, 0x00),
/*14*/ SLEEP(/*frames*/ 120), SLEEP(/*frames*/ 120),
/*15*/ CALL(/*arg*/ 0, /*func*/ lvl_play_the_end_screen_sound), CALL(/*arg*/ 0, /*func*/ lvl_play_the_end_screen_sound),
// L1: // L1:
/*17*/ //SLEEP(/*frames*/ 1), // SLEEP(/*frames*/ 1),
/*18*/ //JUMP(level_ending_entry + 17), // JUMP(level_ending_entry + 17),
SLEEP_BEFORE_EXIT(/*frames*/ 30 * 10), SLEEP_BEFORE_EXIT(/*frames*/ 30 * 10),
/*15*/ CALL(/*arg*/ 0, /*func*/ lvl_exiting_credits), CALL(/*arg*/ 0, /*func*/ lvl_exiting_credits),
CLEAR_LEVEL(), CLEAR_LEVEL(),
EXIT(), EXIT(),
}; };

View file

@ -1906,16 +1906,17 @@ s32 lvl_init_from_save_file(UNUSED s16 arg0, s16 levelNum) {
return levelNum; return levelNum;
} }
s32 lvl_set_current_level(UNUSED s16 arg0, s16 levelNum) { s32 lvl_set_current_level(s16 arg0, s16 levelNum) {
s32 warpCheckpointActive = sWarpCheckpointActive; s32 warpCheckpointActive = sWarpCheckpointActive;
s16 level = arg0 != 0 ? arg0 : levelNum;
sWarpCheckpointActive = FALSE; sWarpCheckpointActive = FALSE;
gCurrLevelNum = levelNum; gCurrLevelNum = level;
gCurrCourseNum = get_level_course_num(levelNum); gCurrCourseNum = get_level_course_num(level);
bool foundHook = false; bool foundHook = false;
bool hookUseActSelect = false; bool hookUseActSelect = false;
smlua_call_event_hooks_use_act_select(HOOK_USE_ACT_SELECT, levelNum, &foundHook, &hookUseActSelect); smlua_call_event_hooks_use_act_select(HOOK_USE_ACT_SELECT, level, &foundHook, &hookUseActSelect);
if (!foundHook || !hookUseActSelect) { if (!foundHook || !hookUseActSelect) {
if (gCurrDemoInput != NULL || gCurrCreditsEntry != NULL || gCurrCourseNum == COURSE_NONE) { if (gCurrDemoInput != NULL || gCurrCreditsEntry != NULL || gCurrCourseNum == COURSE_NONE) {

View file

@ -180,7 +180,7 @@ void initiate_warp(s16 destLevel, s16 destArea, s16 destWarpNode, s32 arg3);
s32 lvl_init_or_update(s16 initOrUpdate, UNUSED s32 unused); s32 lvl_init_or_update(s16 initOrUpdate, UNUSED s32 unused);
s32 lvl_init_from_save_file(UNUSED s16 arg0, s16 levelNum); s32 lvl_init_from_save_file(UNUSED s16 arg0, s16 levelNum);
s32 lvl_set_current_level(UNUSED s16 arg0, s16 levelNum); s32 lvl_set_current_level(s16 arg0, s16 levelNum);
s32 lvl_play_the_end_screen_sound(UNUSED s16 arg0, UNUSED s32 arg1); s32 lvl_play_the_end_screen_sound(UNUSED s16 arg0, UNUSED s32 arg1);
void basic_update(UNUSED s16 *arg); void basic_update(UNUSED s16 *arg);