1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-03-22 18:09:33 +00:00

Fix to GameOverSubstate exiting to Freeplay instead of Chart Editor

This commit is contained in:
EliteMasterEric 2023-12-19 01:27:58 -05:00
parent bb0fb02813
commit ad02bf2ee0
5 changed files with 29 additions and 5 deletions

View file

@ -64,9 +64,13 @@ class GameOverSubState extends MusicBeatSubState
*/ */
var isEnding:Bool = false; var isEnding:Bool = false;
public function new() var isChartingMode:Bool = false;
public function new(?params:GameOverParams)
{ {
super(); super();
this.isChartingMode = params?.isChartingMode ?? false;
} }
/** /**
@ -176,9 +180,20 @@ class GameOverSubState extends MusicBeatSubState
// PlayState.seenCutscene = false; // old thing... // PlayState.seenCutscene = false; // old thing...
gameOverMusic.stop(); gameOverMusic.stop();
if (PlayStatePlaylist.isStoryMode) FlxG.switchState(new StoryMenuState()); if (isChartingMode)
{
this.close();
if (FlxG.sound.music != null) FlxG.sound.music.pause(); // Don't reset song position!
PlayState.instance.close(); // This only works because PlayState is a substate!
}
else if (PlayStatePlaylist.isStoryMode)
{
FlxG.switchState(new StoryMenuState());
}
else else
{
FlxG.switchState(new FreeplayState()); FlxG.switchState(new FreeplayState());
}
} }
if (gameOverMusic.playing) if (gameOverMusic.playing)
@ -307,3 +322,8 @@ class GameOverSubState extends MusicBeatSubState
}); });
} }
} }
typedef GameOverParams =
{
var isChartingMode:Bool;
}

View file

@ -922,7 +922,10 @@ class PlayState extends MusicBeatSubState
} }
#end #end
var gameOverSubState = new GameOverSubState(); var gameOverSubState = new GameOverSubState(
{
isChartingMode: isChartingMode
});
FlxTransitionableSubState.skipNextTransIn = true; FlxTransitionableSubState.skipNextTransIn = true;
FlxTransitionableSubState.skipNextTransOut = true; FlxTransitionableSubState.skipNextTransOut = true;
openSubState(gameOverSubState); openSubState(gameOverSubState);

View file

@ -97,7 +97,7 @@ class FreeplayState extends MusicBeatSubState
var stickerSubState:StickerSubState; var stickerSubState:StickerSubState;
// //
static var rememberedDifficulty:Null<String> = "normal"; static var rememberedDifficulty:Null<String> = Constants.DEFAULT_DIFFICULTY;
static var rememberedSongId:Null<String> = null; static var rememberedSongId:Null<String> = null;
public function new(?stickers:StickerSubState = null) public function new(?stickers:StickerSubState = null)

View file

@ -106,7 +106,7 @@ class StoryMenuState extends MusicBeatState
var stickerSubState:StickerSubState; var stickerSubState:StickerSubState;
static var rememberedLevelId:Null<String> = null; static var rememberedLevelId:Null<String> = null;
static var rememberedDifficulty:Null<String> = "normal"; static var rememberedDifficulty:Null<String> = Constants.DEFAULT_DIFFICULTY;
public function new(?stickers:StickerSubState = null) public function new(?stickers:StickerSubState = null)
{ {

View file

@ -123,6 +123,7 @@ class Constants
/** /**
* Default list of difficulties for charts. * Default list of difficulties for charts.
* Assumes no Erect mode, etc.
*/ */
public static final DEFAULT_DIFFICULTY_LIST:Array<String> = ['easy', 'normal', 'hard']; public static final DEFAULT_DIFFICULTY_LIST:Array<String> = ['easy', 'normal', 'hard'];