1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-01-27 07:17:20 +00:00

Fix a bug where force-ending a song could occasionally try to draw destroyed sprites.

This commit is contained in:
EliteMasterEric 2024-09-27 02:52:01 -04:00
parent 2053f0d691
commit c4ed31b246

View file

@ -817,6 +817,7 @@ class PlayState extends MusicBeatSubState
} }
else else
{ {
this.remove(currentStage);
FlxG.switchState(() -> new MainMenuState()); FlxG.switchState(() -> new MainMenuState());
} }
return false; return false;
@ -965,6 +966,7 @@ class PlayState extends MusicBeatSubState
// It's a reference to Gitaroo Man, which doesn't let you pause the game. // It's a reference to Gitaroo Man, which doesn't let you pause the game.
if (!isSubState && event.gitaroo) if (!isSubState && event.gitaroo)
{ {
this.remove(currentStage);
FlxG.switchState(() -> new GitarooPause( FlxG.switchState(() -> new GitarooPause(
{ {
targetSong: currentSong, targetSong: currentSong,
@ -1366,6 +1368,7 @@ class PlayState extends MusicBeatSubState
{ {
funkin.modding.PolymodHandler.forceReloadAssets(); funkin.modding.PolymodHandler.forceReloadAssets();
lastParams.targetSong = SongRegistry.instance.fetchEntry(currentSong.id); lastParams.targetSong = SongRegistry.instance.fetchEntry(currentSong.id);
this.remove(currentStage);
LoadingState.loadPlayState(lastParams); LoadingState.loadPlayState(lastParams);
} }
@ -2600,6 +2603,7 @@ class PlayState extends MusicBeatSubState
} }
else else
{ {
this.remove(currentStage);
FlxG.switchState(() -> new ChartEditorState( FlxG.switchState(() -> new ChartEditorState(
{ {
targetSongId: currentSong.id, targetSongId: currentSong.id,
@ -2949,6 +2953,7 @@ class PlayState extends MusicBeatSubState
{ {
targetVariation = targetSong.getFirstValidVariation(PlayStatePlaylist.campaignDifficulty) ?? Constants.DEFAULT_VARIATION; targetVariation = targetSong.getFirstValidVariation(PlayStatePlaylist.campaignDifficulty) ?? Constants.DEFAULT_VARIATION;
} }
this.remove(currentStage);
LoadingState.loadPlayState( LoadingState.loadPlayState(
{ {
targetSong: targetSong, targetSong: targetSong,
@ -2966,6 +2971,7 @@ class PlayState extends MusicBeatSubState
{ {
targetVariation = targetSong.getFirstValidVariation(PlayStatePlaylist.campaignDifficulty) ?? Constants.DEFAULT_VARIATION; targetVariation = targetSong.getFirstValidVariation(PlayStatePlaylist.campaignDifficulty) ?? Constants.DEFAULT_VARIATION;
} }
this.remove(currentStage);
LoadingState.loadPlayState( LoadingState.loadPlayState(
{ {
targetSong: targetSong, targetSong: targetSong,