diff --git a/source/funkin/input/Controls.hx b/source/funkin/input/Controls.hx index e80d942d4d..5863496249 100644 --- a/source/funkin/input/Controls.hx +++ b/source/funkin/input/Controls.hx @@ -69,6 +69,7 @@ class Controls extends FlxActionSet var _freeplay_char_select = new FunkinAction(Action.FREEPLAY_CHAR_SELECT); var _freeplay_jump_to_top = new FunkinAction(Action.FREEPLAY_JUMP_TO_TOP); var _freeplay_jump_to_bottom = new FunkinAction(Action.FREEPLAY_JUMP_TO_BOTTOM); + var _freeplay_results_screen = new FunkinAction(Action.FREEPLAY_RESULTS_SCREEN); var _cutscene_advance = new FunkinAction(Action.CUTSCENE_ADVANCE); var _debug_menu = new FunkinAction(Action.DEBUG_MENU); #if FEATURE_CHART_EDITOR @@ -288,6 +289,11 @@ class Controls extends FlxActionSet inline function get_FREEPLAY_JUMP_TO_BOTTOM() return _freeplay_jump_to_bottom.check(); + public var FREEPLAY_RESULTS_SCREEN(get, never):Bool; + + inline function get_FREEPLAY_RESULTS_SCREEN() + return _freeplay_results_screen.check(); + public var CUTSCENE_ADVANCE(get, never):Bool; inline function get_CUTSCENE_ADVANCE() @@ -351,6 +357,7 @@ class Controls extends FlxActionSet add(_freeplay_char_select); add(_freeplay_jump_to_top); add(_freeplay_jump_to_bottom); + add(_freeplay_results_screen); add(_cutscene_advance); add(_debug_menu); #if FEATURE_CHART_EDITOR add(_debug_chart); #end @@ -478,6 +485,7 @@ class Controls extends FlxActionSet case FREEPLAY_CHAR_SELECT: _freeplay_char_select; case FREEPLAY_JUMP_TO_TOP: _freeplay_jump_to_top; case FREEPLAY_JUMP_TO_BOTTOM: _freeplay_jump_to_bottom; + case FREEPLAY_RESULTS_SCREEN: _freeplay_results_screen; case CUTSCENE_ADVANCE: _cutscene_advance; case DEBUG_MENU: _debug_menu; #if FEATURE_CHART_EDITOR case DEBUG_CHART: _debug_chart; #end @@ -562,6 +570,8 @@ class Controls extends FlxActionSet func(_freeplay_jump_to_top, JUST_PRESSED); case FREEPLAY_JUMP_TO_BOTTOM: func(_freeplay_jump_to_bottom, JUST_PRESSED); + case FREEPLAY_RESULTS_SCREEN: + func(_freeplay_results_screen, JUST_PRESSED); case CUTSCENE_ADVANCE: func(_cutscene_advance, JUST_PRESSED); case DEBUG_MENU: @@ -792,6 +802,7 @@ class Controls extends FlxActionSet bindKeys(Control.FREEPLAY_CHAR_SELECT, getDefaultKeybinds(scheme, Control.FREEPLAY_CHAR_SELECT)); bindKeys(Control.FREEPLAY_JUMP_TO_TOP, getDefaultKeybinds(scheme, Control.FREEPLAY_JUMP_TO_TOP)); bindKeys(Control.FREEPLAY_JUMP_TO_BOTTOM, getDefaultKeybinds(scheme, Control.FREEPLAY_JUMP_TO_BOTTOM)); + bindKeys(Control.FREEPLAY_RESULTS_SCREEN, getDefaultKeybinds(scheme, Control.FREEPLAY_RESULTS_SCREEN)); bindKeys(Control.CUTSCENE_ADVANCE, getDefaultKeybinds(scheme, Control.CUTSCENE_ADVANCE)); bindKeys(Control.DEBUG_MENU, getDefaultKeybinds(scheme, Control.DEBUG_MENU)); #if FEATURE_CHART_EDITOR @@ -834,6 +845,7 @@ class Controls extends FlxActionSet case Control.FREEPLAY_CHAR_SELECT: return [TAB]; case Control.FREEPLAY_JUMP_TO_TOP: return [HOME]; case Control.FREEPLAY_JUMP_TO_BOTTOM: return [END]; + case Control.FREEPLAY_RESULTS_SCREEN: return [R]; case Control.CUTSCENE_ADVANCE: return [Z, ENTER]; case Control.DEBUG_MENU: return [GRAVEACCENT]; #if FEATURE_CHART_EDITOR case Control.DEBUG_CHART: return []; #end @@ -865,6 +877,7 @@ class Controls extends FlxActionSet case Control.FREEPLAY_CHAR_SELECT: return [TAB]; case Control.FREEPLAY_JUMP_TO_TOP: return [HOME]; case Control.FREEPLAY_JUMP_TO_BOTTOM: return [END]; + case Control.FREEPLAY_RESULTS_SCREEN: return [R]; case Control.CUTSCENE_ADVANCE: return [G, Z]; case Control.DEBUG_MENU: return [GRAVEACCENT]; #if FEATURE_CHART_EDITOR case Control.DEBUG_CHART: return []; #end @@ -896,6 +909,7 @@ class Controls extends FlxActionSet case Control.FREEPLAY_CHAR_SELECT: return []; case Control.FREEPLAY_JUMP_TO_TOP: return []; case Control.FREEPLAY_JUMP_TO_BOTTOM: return []; + case Control.FREEPLAY_RESULTS_SCREEN: return []; case Control.CUTSCENE_ADVANCE: return [ENTER]; case Control.DEBUG_MENU: return []; #if FEATURE_CHART_EDITOR case Control.DEBUG_CHART: return []; #end @@ -1014,6 +1028,7 @@ class Controls extends FlxActionSet Control.FREEPLAY_CHAR_SELECT => getDefaultGamepadBinds(Control.FREEPLAY_CHAR_SELECT), Control.FREEPLAY_JUMP_TO_TOP => getDefaultGamepadBinds(Control.FREEPLAY_JUMP_TO_TOP), Control.FREEPLAY_JUMP_TO_BOTTOM => getDefaultGamepadBinds(Control.FREEPLAY_JUMP_TO_BOTTOM), + Control.FREEPLAY_RESULTS_SCREEN => getDefaultGamepadBinds(Control.FREEPLAY_RESULTS_SCREEN), Control.VOLUME_UP => getDefaultGamepadBinds(Control.VOLUME_UP), Control.VOLUME_DOWN => getDefaultGamepadBinds(Control.VOLUME_DOWN), Control.VOLUME_MUTE => getDefaultGamepadBinds(Control.VOLUME_MUTE), @@ -1075,6 +1090,8 @@ class Controls extends FlxActionSet return []; case Control.FREEPLAY_JUMP_TO_BOTTOM: return []; + case Control.FREEPLAY_RESULTS_SCREEN: + return []; case Control.VOLUME_UP: []; case Control.VOLUME_DOWN: @@ -1656,6 +1673,7 @@ enum Control FREEPLAY_CHAR_SELECT; FREEPLAY_JUMP_TO_TOP; FREEPLAY_JUMP_TO_BOTTOM; + FREEPLAY_RESULTS_SCREEN; // WINDOW #if FEATURE_SCREENSHOTS WINDOW_SCREENSHOT; #end WINDOW_FULLSCREEN; @@ -1715,6 +1733,7 @@ enum abstract Action(String) to String from String var FREEPLAY_CHAR_SELECT = "freeplay_char_select"; var FREEPLAY_JUMP_TO_TOP = "freeplay_jump_to_top"; var FREEPLAY_JUMP_TO_BOTTOM = "freeplay_jump_to_bottom"; + var FREEPLAY_RESULTS_SCREEN = "freeplay_results_screen"; // VOLUME var VOLUME_UP = "volume_up"; var VOLUME_DOWN = "volume_down"; diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 2cdd3ef543..8397d7b445 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -1674,6 +1674,12 @@ class FreeplayState extends MusicBeatSubState { grpCapsules.members[curSelected].onConfirm(); } + + if (intendedScore > 0 && controls.FREEPLAY_RESULTS_SCREEN && !busy) + { + busy = true; + moveToResultsScreen(); + } } override function beatHit():Bool @@ -2143,6 +2149,53 @@ class FreeplayState extends MusicBeatSubState result.persistentDraw = true; return result; } + + @:nullSafety(Off) // This shouldn't cause any issues, right? + function moveToResultsScreen():Void + { + var save = Save.instance; + var song = save.getSongScore(rememberedSongId, currentDifficulty); + if (song != null) + { + // Ok, so there's actually a score for this song on this difficulty + var songEntry = SongRegistry.instance.fetchEntry(rememberedSongId); + var songName = songEntry.songName; + var songArtist = songEntry.songArtist; + var songScore = song.score; + // persistentUpdate = false; + + var talliesToUse = song.tallies; + + var res:funkin.play.ResultState = new funkin.play.ResultState( + { + storyMode: false, + songId: rememberedSongId, + difficultyId: currentDifficulty, + characterId: rememberedCharacterId, + title: ('${songName} by ${songArtist}'), + prevScoreData: song, + scoreData: + { + score: songScore, + tallies: + { + sick: talliesToUse.sick, + good: talliesToUse.good, + bad: talliesToUse.bad, + shit: talliesToUse.shit, + missed: talliesToUse.missed, + combo: talliesToUse.combo, + maxCombo: talliesToUse.maxCombo, + totalNotesHit: talliesToUse.totalNotesHit, + totalNotes: talliesToUse.totalNotes, + }, + }, + isNewHighscore: false + }); + // this.persistentDraw = false; + openSubState(res); + } + } } /**