mirror of
				https://github.com/coop-deluxe/sm64coopdx.git
				synced 2025-10-30 08:01:01 +00:00 
			
		
		
		
	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:
		
							parent
							
								
									56b96a97e2
								
							
						
					
					
						commit
						e76e212312
					
				
					 2 changed files with 27 additions and 27 deletions
				
			
		| 
						 | 
				
			
			@ -3110,18 +3110,26 @@ s16 render_pause_courses_and_castle(void) {
 | 
			
		|||
                 || gPlayer1Controller->buttonPressed & START_BUTTON)
 | 
			
		||||
#endif
 | 
			
		||||
                {
 | 
			
		||||
                    level_set_transition(0, NULL);
 | 
			
		||||
                    play_sound(SOUND_MENU_PAUSE_2, gGlobalSoundSource);
 | 
			
		||||
                    gDialogBoxState = DIALOG_STATE_OPENING;
 | 
			
		||||
                    gMenuMode = -1;
 | 
			
		||||
 | 
			
		||||
                    bool allowExit = true;
 | 
			
		||||
                    if (gDialogLineNum == 2 || gDialogLineNum == 3) {
 | 
			
		||||
                        num = gDialogLineNum;
 | 
			
		||||
                    } else {
 | 
			
		||||
                        num = 1;
 | 
			
		||||
                        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;
 | 
			
		||||
                        gMenuMode = -1;
 | 
			
		||||
 | 
			
		||||
                    return num;
 | 
			
		||||
                        if (gDialogLineNum == 2 || gDialogLineNum == 3) {
 | 
			
		||||
                            num = gDialogLineNum;
 | 
			
		||||
                        } else {
 | 
			
		||||
                            num = 1;
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        return num;
 | 
			
		||||
                    } else {
 | 
			
		||||
                        play_sound(SOUND_MENU_CAMERA_BUZZ | (0xFF << 8), gGlobalSoundSource);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1337,26 +1337,18 @@ 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);
 | 
			
		||||
        }
 | 
			
		||||
        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);
 | 
			
		||||
            } else {
 | 
			
		||||
                initiate_warp(gLevelValues.exitCastleLevel, gLevelValues.exitCastleArea, gLevelValues.exitCastleWarpNode, 0);
 | 
			
		||||
                fade_into_special_warp(0, 0);
 | 
			
		||||
                gSavedCourseNum = COURSE_NONE;
 | 
			
		||||
            }
 | 
			
		||||
            set_play_mode(PLAY_MODE_CHANGE_LEVEL);
 | 
			
		||||
        // Exit level
 | 
			
		||||
        if (gDebugLevelSelect) {
 | 
			
		||||
            fade_into_special_warp(-9, 1);
 | 
			
		||||
        } else {
 | 
			
		||||
            initiate_warp(gLevelValues.exitCastleLevel, gLevelValues.exitCastleArea, gLevelValues.exitCastleWarpNode, 0);
 | 
			
		||||
            fade_into_special_warp(0, 0);
 | 
			
		||||
            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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue