Prevent Pause Exit when it actually happens (#71)

* call level exit hook sooner

call the hook here so you can actually prevent the exit from happening, also no separate hook calls anymore

* instead of here

* compliance
This commit is contained in:
Cooliokid956 2024-06-17 16:20:30 -05:00 committed by GitHub
parent 56b96a97e2
commit e76e212312
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 27 deletions

View File

@ -3110,6 +3110,11 @@ s16 render_pause_courses_and_castle(void) {
|| gPlayer1Controller->buttonPressed & START_BUTTON)
#endif
{
bool allowExit = true;
if (gDialogLineNum == 2 || gDialogLineNum == 3) {
smlua_call_event_hooks_bool_param_ret_bool(HOOK_ON_PAUSE_EXIT, (gDialogLineNum == 3), &allowExit);
}
if (allowExit) {
level_set_transition(0, NULL);
play_sound(SOUND_MENU_PAUSE_2, gGlobalSoundSource);
gDialogBoxState = DIALOG_STATE_OPENING;
@ -3122,6 +3127,9 @@ s16 render_pause_courses_and_castle(void) {
}
return num;
} else {
play_sound(SOUND_MENU_CAMERA_BUZZ | (0xFF << 8), gGlobalSoundSource);
}
}
}
break;

View File

@ -1337,16 +1337,9 @@ s32 play_mode_paused(void) {
gCameraMovementFlags &= ~CAM_MOVE_PAUSE_SCREEN;
set_play_mode(PLAY_MODE_NORMAL);
} else if (gPauseScreenMode == 2) {
bool allowExit = true;
smlua_call_event_hooks_bool_param_ret_bool(HOOK_ON_PAUSE_EXIT, false, &allowExit);
if (allowExit) {
level_trigger_warp(&gMarioStates[0], WARP_OP_EXIT);
set_play_mode(PLAY_MODE_NORMAL);
}
} else if (gPauseScreenMode == 3) {
bool allowExit = true;
smlua_call_event_hooks_bool_param_ret_bool(HOOK_ON_PAUSE_EXIT, true, &allowExit);
if (allowExit) {
// Exit level
if (gDebugLevelSelect) {
fade_into_special_warp(-9, 1);
@ -1356,7 +1349,6 @@ s32 play_mode_paused(void) {
gSavedCourseNum = COURSE_NONE;
}
set_play_mode(PLAY_MODE_CHANGE_LEVEL);
}
} /* else if (gPauseScreenMode == 4) {
// We should only be getting "int 4" to here
initiate_warp(LEVEL_CASTLE, 1, 0x1F, 0);