1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-01-27 07:17:20 +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;
public function new()
var isChartingMode:Bool = false;
public function new(?params:GameOverParams)
{
super();
this.isChartingMode = params?.isChartingMode ?? false;
}
/**
@ -176,9 +180,20 @@ class GameOverSubState extends MusicBeatSubState
// PlayState.seenCutscene = false; // old thing...
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
{
FlxG.switchState(new FreeplayState());
}
}
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
var gameOverSubState = new GameOverSubState();
var gameOverSubState = new GameOverSubState(
{
isChartingMode: isChartingMode
});
FlxTransitionableSubState.skipNextTransIn = true;
FlxTransitionableSubState.skipNextTransOut = true;
openSubState(gameOverSubState);

View file

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

View file

@ -106,7 +106,7 @@ class StoryMenuState extends MusicBeatState
var stickerSubState:StickerSubState;
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)
{

View file

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