diff --git a/assets b/assets index 51ac128a3..d22c7f830 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 51ac128a3a658488408dc548c9845ac7d485ab24 +Subproject commit d22c7f8300616bd9e0a78866cba7bc67f5756220 diff --git a/project.hxp b/project.hxp index 1a2198997..eaabf9d30 100644 --- a/project.hxp +++ b/project.hxp @@ -214,6 +214,12 @@ class Project extends HXProject { */ static final FEATURE_OPEN_URL:FeatureFlag = "FEATURE_OPEN_URL"; + /** + * `-DFEATURE_SCREENSHOTS` + * If this flag is enabled, the game will support the screenshots feature. + */ + static final FEATURE_SCREENSHOTS:FeatureFlag = "FEATURE_SCREENSHOTS"; + /** * `-DFEATURE_CHART_EDITOR` * If this flag is enabled, the Chart Editor will be accessible from the debug menu. @@ -494,6 +500,10 @@ class Project extends HXProject { // Should be true except on web builds. // Chart editor doesn't work there. FEATURE_CHART_EDITOR.apply(this, !isWeb()); + + // Should be true except on web builds. + // Screenshots doesn't work there. + FEATURE_SCREENSHOTS.apply(this, !isWeb()); } /** diff --git a/source/funkin/InitState.hx b/source/funkin/InitState.hx index f71de00f4..30a6d253a 100644 --- a/source/funkin/InitState.hx +++ b/source/funkin/InitState.hx @@ -148,10 +148,12 @@ class InitState extends FlxState #if FEATURE_DEBUG_FUNCTIONS funkin.util.plugins.MemoryGCPlugin.initialize(); #end + #if FEATURE_SCREENSHOTS + funkin.util.plugins.ScreenshotPlugin.initialize(); + #end funkin.util.plugins.EvacuateDebugPlugin.initialize(); funkin.util.plugins.ForceCrashPlugin.initialize(); funkin.util.plugins.ReloadAssetsDebugPlugin.initialize(); - funkin.util.plugins.ScreenshotPlugin.initialize(); funkin.util.plugins.VolumePlugin.initialize(); funkin.util.plugins.WatchPlugin.initialize(); diff --git a/source/funkin/input/Controls.hx b/source/funkin/input/Controls.hx index da5aaac58..ab1d0e0a7 100644 --- a/source/funkin/input/Controls.hx +++ b/source/funkin/input/Controls.hx @@ -59,7 +59,9 @@ class Controls extends FlxActionSet var _back = new FunkinAction(Action.BACK); var _pause = new FunkinAction(Action.PAUSE); var _reset = new FunkinAction(Action.RESET); + #if FEATURE_SCREENSHOTS var _window_screenshot = new FunkinAction(Action.WINDOW_SCREENSHOT); + #end var _window_fullscreen = new FunkinAction(Action.WINDOW_FULLSCREEN); var _freeplay_favorite = new FunkinAction(Action.FREEPLAY_FAVORITE); var _freeplay_left = new FunkinAction(Action.FREEPLAY_LEFT); @@ -67,8 +69,12 @@ class Controls extends FlxActionSet var _freeplay_char_select = new FunkinAction(Action.FREEPLAY_CHAR_SELECT); var _cutscene_advance = new FunkinAction(Action.CUTSCENE_ADVANCE); var _debug_menu = new FunkinAction(Action.DEBUG_MENU); + #if FEATURE_CHART_EDITOR var _debug_chart = new FunkinAction(Action.DEBUG_CHART); + #end + #if FEATURE_STAGE_EDITOR var _debug_stage = new FunkinAction(Action.DEBUG_STAGE); + #end var _volume_up = new FunkinAction(Action.VOLUME_UP); var _volume_down = new FunkinAction(Action.VOLUME_DOWN); var _volume_mute = new FunkinAction(Action.VOLUME_MUTE); @@ -243,10 +249,12 @@ class Controls extends FlxActionSet inline function get_WINDOW_FULLSCREEN() return _window_fullscreen.check(); + #if FEATURE_SCREENSHOTS public var WINDOW_SCREENSHOT(get, never):Bool; inline function get_WINDOW_SCREENSHOT() return _window_screenshot.check(); + #end public var FREEPLAY_FAVORITE(get, never):Bool; @@ -278,15 +286,19 @@ class Controls extends FlxActionSet inline function get_DEBUG_MENU() return _debug_menu.check(); + #if FEATURE_CHART_EDITOR public var DEBUG_CHART(get, never):Bool; inline function get_DEBUG_CHART() return _debug_chart.check(); + #end + #if FEATURE_STAGE_EDITOR public var DEBUG_STAGE(get, never):Bool; inline function get_DEBUG_STAGE() return _debug_stage.check(); + #end public var VOLUME_UP(get, never):Bool; @@ -319,7 +331,7 @@ class Controls extends FlxActionSet add(_back); add(_pause); add(_reset); - add(_window_screenshot); + #if FEATURE_SCREENSHOTS add(_window_screenshot); #end add(_window_fullscreen); add(_freeplay_favorite); add(_freeplay_left); @@ -327,8 +339,8 @@ class Controls extends FlxActionSet add(_freeplay_char_select); add(_cutscene_advance); add(_debug_menu); - add(_debug_chart); - add(_debug_stage); + #if FEATURE_CHART_EDITOR add(_debug_chart); #end + #if FEATURE_STAGE_EDITOR add(_debug_stage); #end add(_volume_up); add(_volume_down); add(_volume_mute); @@ -444,7 +456,7 @@ class Controls extends FlxActionSet case BACK: _back; case PAUSE: _pause; case RESET: _reset; - case WINDOW_SCREENSHOT: _window_screenshot; + #if FEATURE_SCREENSHOTS case WINDOW_SCREENSHOT: _window_screenshot; #end case WINDOW_FULLSCREEN: _window_fullscreen; case FREEPLAY_FAVORITE: _freeplay_favorite; case FREEPLAY_LEFT: _freeplay_left; @@ -452,8 +464,8 @@ class Controls extends FlxActionSet case FREEPLAY_CHAR_SELECT: _freeplay_char_select; case CUTSCENE_ADVANCE: _cutscene_advance; case DEBUG_MENU: _debug_menu; - case DEBUG_CHART: _debug_chart; - case DEBUG_STAGE: _debug_stage; + #if FEATURE_CHART_EDITOR case DEBUG_CHART: _debug_chart; #end + #if FEATURE_STAGE_EDITOR case DEBUG_STAGE: _debug_stage; #end case VOLUME_UP: _volume_up; case VOLUME_DOWN: _volume_down; case VOLUME_MUTE: _volume_mute; @@ -516,8 +528,10 @@ class Controls extends FlxActionSet func(_pause, JUST_PRESSED); case RESET: func(_reset, JUST_PRESSED); + #if FEATURE_SCREENSHOTS case WINDOW_SCREENSHOT: func(_window_screenshot, JUST_PRESSED); + #end case WINDOW_FULLSCREEN: func(_window_fullscreen, JUST_PRESSED); case FREEPLAY_FAVORITE: @@ -532,10 +546,14 @@ class Controls extends FlxActionSet func(_cutscene_advance, JUST_PRESSED); case DEBUG_MENU: func(_debug_menu, JUST_PRESSED); + #if FEATURE_CHART_EDITOR case DEBUG_CHART: func(_debug_chart, JUST_PRESSED); + #end + #if FEATURE_STAGE_EDITOR case DEBUG_STAGE: func(_debug_stage, JUST_PRESSED); + #end case VOLUME_UP: func(_volume_up, JUST_PRESSED); case VOLUME_DOWN: @@ -744,7 +762,9 @@ class Controls extends FlxActionSet bindKeys(Control.BACK, getDefaultKeybinds(scheme, Control.BACK)); bindKeys(Control.PAUSE, getDefaultKeybinds(scheme, Control.PAUSE)); bindKeys(Control.RESET, getDefaultKeybinds(scheme, Control.RESET)); + #if FEATURE_SCREENSHOTS bindKeys(Control.WINDOW_SCREENSHOT, getDefaultKeybinds(scheme, Control.WINDOW_SCREENSHOT)); + #end bindKeys(Control.WINDOW_FULLSCREEN, getDefaultKeybinds(scheme, Control.WINDOW_FULLSCREEN)); bindKeys(Control.FREEPLAY_FAVORITE, getDefaultKeybinds(scheme, Control.FREEPLAY_FAVORITE)); bindKeys(Control.FREEPLAY_LEFT, getDefaultKeybinds(scheme, Control.FREEPLAY_LEFT)); @@ -752,8 +772,12 @@ class Controls extends FlxActionSet bindKeys(Control.FREEPLAY_CHAR_SELECT, getDefaultKeybinds(scheme, Control.FREEPLAY_CHAR_SELECT)); bindKeys(Control.CUTSCENE_ADVANCE, getDefaultKeybinds(scheme, Control.CUTSCENE_ADVANCE)); bindKeys(Control.DEBUG_MENU, getDefaultKeybinds(scheme, Control.DEBUG_MENU)); + #if FEATURE_CHART_EDITOR bindKeys(Control.DEBUG_CHART, getDefaultKeybinds(scheme, Control.DEBUG_CHART)); + #end + #if FEATURE_STAGE_EDITOR bindKeys(Control.DEBUG_STAGE, getDefaultKeybinds(scheme, Control.DEBUG_STAGE)); + #end bindKeys(Control.VOLUME_UP, getDefaultKeybinds(scheme, Control.VOLUME_UP)); bindKeys(Control.VOLUME_DOWN, getDefaultKeybinds(scheme, Control.VOLUME_DOWN)); bindKeys(Control.VOLUME_MUTE, getDefaultKeybinds(scheme, Control.VOLUME_MUTE)); @@ -781,15 +805,15 @@ class Controls extends FlxActionSet case Control.PAUSE: return [P, ENTER, ESCAPE]; case Control.RESET: return [R]; case Control.WINDOW_FULLSCREEN: return [F11]; // We use F for other things LOL. - case Control.WINDOW_SCREENSHOT: return [F3]; + #if FEATURE_SCREENSHOTS case Control.WINDOW_SCREENSHOT: return [F3]; #end case Control.FREEPLAY_FAVORITE: return [F]; // Favorite a song on the menu case Control.FREEPLAY_LEFT: return [Q]; // Switch tabs on the menu case Control.FREEPLAY_RIGHT: return [E]; // Switch tabs on the menu case Control.FREEPLAY_CHAR_SELECT: return [TAB]; case Control.CUTSCENE_ADVANCE: return [Z, ENTER]; case Control.DEBUG_MENU: return [GRAVEACCENT]; - case Control.DEBUG_CHART: return []; - case Control.DEBUG_STAGE: return []; + #if FEATURE_CHART_EDITOR case Control.DEBUG_CHART: return []; #end + #if FEATURE_STAGE_EDITOR case Control.DEBUG_STAGE: return []; #end case Control.VOLUME_UP: return [PLUS, NUMPADPLUS]; case Control.VOLUME_DOWN: return [MINUS, NUMPADMINUS]; case Control.VOLUME_MUTE: return [ZERO, NUMPADZERO]; @@ -809,7 +833,7 @@ class Controls extends FlxActionSet case Control.BACK: return [H, X]; case Control.PAUSE: return [ONE]; case Control.RESET: return [R]; - case Control.WINDOW_SCREENSHOT: return [F3]; + #if FEATURE_SCREENSHOTS case Control.WINDOW_SCREENSHOT: return [F3]; #end case Control.WINDOW_FULLSCREEN: return [F11]; case Control.FREEPLAY_FAVORITE: return [F]; // Favorite a song on the menu case Control.FREEPLAY_LEFT: return [Q]; // Switch tabs on the menu @@ -817,8 +841,8 @@ class Controls extends FlxActionSet case Control.FREEPLAY_CHAR_SELECT: return [TAB]; case Control.CUTSCENE_ADVANCE: return [G, Z]; case Control.DEBUG_MENU: return [GRAVEACCENT]; - case Control.DEBUG_CHART: return []; - case Control.DEBUG_STAGE: return []; + #if FEATURE_CHART_EDITOR case Control.DEBUG_CHART: return []; #end + #if FEATURE_STAGE_EDITOR case Control.DEBUG_STAGE: return []; #end case Control.VOLUME_UP: return [PLUS]; case Control.VOLUME_DOWN: return [MINUS]; case Control.VOLUME_MUTE: return [ZERO]; @@ -838,7 +862,7 @@ class Controls extends FlxActionSet case Control.BACK: return [ESCAPE]; case Control.PAUSE: return [ONE]; case Control.RESET: return [R]; - case Control.WINDOW_SCREENSHOT: return []; + #if FEATURE_SCREENSHOTS case Control.WINDOW_SCREENSHOT: return []; #end case Control.WINDOW_FULLSCREEN: return []; case Control.FREEPLAY_FAVORITE: return []; case Control.FREEPLAY_LEFT: return []; @@ -846,8 +870,8 @@ class Controls extends FlxActionSet case Control.FREEPLAY_CHAR_SELECT: return []; case Control.CUTSCENE_ADVANCE: return [ENTER]; case Control.DEBUG_MENU: return []; - case Control.DEBUG_CHART: return []; - case Control.DEBUG_STAGE: return []; + #if FEATURE_CHART_EDITOR case Control.DEBUG_CHART: return []; #end + #if FEATURE_STAGE_EDITOR case Control.DEBUG_STAGE: return []; #end case Control.VOLUME_UP: return [NUMPADPLUS]; case Control.VOLUME_DOWN: return [NUMPADMINUS]; case Control.VOLUME_MUTE: return [NUMPADZERO]; @@ -952,7 +976,9 @@ class Controls extends FlxActionSet Control.PAUSE => getDefaultGamepadBinds(Control.PAUSE), Control.RESET => getDefaultGamepadBinds(Control.RESET), Control.WINDOW_FULLSCREEN => getDefaultGamepadBinds(Control.WINDOW_FULLSCREEN), + #if FEATURE_SCREENSHOTS Control.WINDOW_SCREENSHOT => getDefaultGamepadBinds(Control.WINDOW_SCREENSHOT), + #end Control.CUTSCENE_ADVANCE => getDefaultGamepadBinds(Control.CUTSCENE_ADVANCE), Control.FREEPLAY_FAVORITE => getDefaultGamepadBinds(Control.FREEPLAY_FAVORITE), Control.FREEPLAY_LEFT => getDefaultGamepadBinds(Control.FREEPLAY_LEFT), @@ -961,8 +987,12 @@ class Controls extends FlxActionSet Control.VOLUME_DOWN => getDefaultGamepadBinds(Control.VOLUME_DOWN), Control.VOLUME_MUTE => getDefaultGamepadBinds(Control.VOLUME_MUTE), Control.DEBUG_MENU => getDefaultGamepadBinds(Control.DEBUG_MENU), + #if FEATURE_CHART_EDITOR Control.DEBUG_CHART => getDefaultGamepadBinds(Control.DEBUG_CHART), + #end + #if FEATURE_STAGE_EDITOR Control.DEBUG_STAGE => getDefaultGamepadBinds(Control.DEBUG_STAGE), + #end ]); } @@ -996,8 +1026,10 @@ class Controls extends FlxActionSet return [FlxGamepadInputID.BACK]; // Back (i.e. Select) case Control.WINDOW_FULLSCREEN: []; + #if FEATURE_SCREENSHOTS case Control.WINDOW_SCREENSHOT: []; + #end case Control.CUTSCENE_ADVANCE: return [A]; case Control.FREEPLAY_FAVORITE: @@ -1014,10 +1046,14 @@ class Controls extends FlxActionSet []; case Control.DEBUG_MENU: []; + #if FEATURE_CHART_EDITOR case Control.DEBUG_CHART: []; + #end + #if FEATURE_STAGE_EDITOR case Control.DEBUG_STAGE: []; + #end default: // Fallthrough. } @@ -1582,7 +1618,7 @@ enum Control FREEPLAY_RIGHT; FREEPLAY_CHAR_SELECT; // WINDOW - WINDOW_SCREENSHOT; + #if FEATURE_SCREENSHOTS WINDOW_SCREENSHOT; #end WINDOW_FULLSCREEN; // VOLUME VOLUME_UP; @@ -1590,8 +1626,8 @@ enum Control VOLUME_MUTE; // DEBUG DEBUG_MENU; - DEBUG_CHART; - DEBUG_STAGE; + #if FEATURE_CHART_EDITOR DEBUG_CHART; #end + #if FEATURE_STAGE_EDITOR DEBUG_STAGE; #end } enum abstract Action(String) to String from String @@ -1628,7 +1664,9 @@ enum abstract Action(String) to String from String var RESET = "reset"; // WINDOW var WINDOW_FULLSCREEN = "window_fullscreen"; + #if FEATURE_SCREENSHOTS var WINDOW_SCREENSHOT = "window_screenshot"; + #end // CUTSCENE var CUTSCENE_ADVANCE = "cutscene_advance"; // FREEPLAY @@ -1642,8 +1680,12 @@ enum abstract Action(String) to String from String var VOLUME_MUTE = "volume_mute"; // DEBUG var DEBUG_MENU = "debug_menu"; + #if FEATURE_CHART_EDITOR var DEBUG_CHART = "debug_chart"; + #end + #if FEATURE_STAGE_EDITOR var DEBUG_STAGE = "debug_stage"; + #end } enum Device diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 7a2b099e4..081b4e860 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -1979,8 +1979,8 @@ class PlayState extends MusicBeatSubState vocals.volume = 1.0; vocals.pitch = playbackRate; vocals.time = FlxG.sound.music.time; - trace('${FlxG.sound.music.time}'); - trace('${vocals.time}'); + // trace('${FlxG.sound.music.time}'); + // trace('${vocals.time}'); resyncVocals(); #if FEATURE_DISCORD_RPC @@ -2581,7 +2581,7 @@ class PlayState extends MusicBeatSubState */ function debugKeyShit():Void { - #if FEATURE_CHART_EDITOR + #if FEATURE_STAGE_EDITOR // Open the stage editor overlaying the current state. if (controls.DEBUG_STAGE) { @@ -2590,7 +2590,9 @@ class PlayState extends MusicBeatSubState persistentUpdate = false; openSubState(new StageOffsetSubState()); } + #end + #if FEATURE_CHART_EDITOR // Redirect to the chart editor playing the current song. if (controls.DEBUG_CHART) { @@ -2598,6 +2600,7 @@ class PlayState extends MusicBeatSubState persistentUpdate = false; if (isChartingMode) { + // Close the playtest substate. FlxG.sound.music?.pause(); this.close(); } diff --git a/source/funkin/play/character/BaseCharacter.hx b/source/funkin/play/character/BaseCharacter.hx index 365c8d112..d87aca9f3 100644 --- a/source/funkin/play/character/BaseCharacter.hx +++ b/source/funkin/play/character/BaseCharacter.hx @@ -305,7 +305,7 @@ class BaseCharacter extends Bopper { super.onAnimationFinished(animationName); - trace('${characterId} has finished animation: ${animationName}'); + // trace('${characterId} has finished animation: ${animationName}'); if ((animationName.endsWith(Constants.ANIMATION_END_SUFFIX) && !animationName.startsWith('idle') && !animationName.startsWith('dance')) || animationName.startsWith('combo') || animationName.startsWith('drop')) @@ -402,7 +402,7 @@ class BaseCharacter extends Bopper FlxG.watch.addQuick('singTimeSec-${characterId}', singTimeSec); if (holdTimer > singTimeSec && shouldStopSinging) { - trace('holdTimer reached ${holdTimer}sec (> ${singTimeSec}), stopping sing animation'); + // trace('holdTimer reached ${holdTimer}sec (> ${singTimeSec}), stopping sing animation'); holdTimer = 0; var currentAnimation:String = getCurrentAnimation(); @@ -636,7 +636,7 @@ class BaseCharacter extends Bopper var anim:String = 'sing${dir.nameUpper}${miss ? 'miss' : ''}${suffix != '' ? '-${suffix}' : ''}'; // restart even if already playing, because the character might sing the same note twice. - trace('Playing ${anim}...'); + // trace('Playing ${anim}...'); playAnimation(anim, true); } diff --git a/source/funkin/save/Save.hx b/source/funkin/save/Save.hx index 0d86c628b..dc92f7f1a 100644 --- a/source/funkin/save/Save.hx +++ b/source/funkin/save/Save.hx @@ -603,11 +603,14 @@ class Save return; } + var newCompletion = (newScoreData.tallies.sick + newScoreData.tallies.good) / newScoreData.tallies.totalNotes; + var previousCompletion = (previousScoreData.tallies.sick + previousScoreData.tallies.good) / previousScoreData.tallies.totalNotes; + // Set the high score and the high rank separately. var newScore:SaveScoreData = { score: (previousScoreData.score > newScoreData.score) ? previousScoreData.score : newScoreData.score, - tallies: (previousRank > newRank) ? previousScoreData.tallies : newScoreData.tallies + tallies: (previousRank > newRank || previousCompletion > newCompletion) ? previousScoreData.tallies : newScoreData.tallies }; song.set(difficultyId, newScore); diff --git a/source/funkin/ui/options/ControlsMenu.hx b/source/funkin/ui/options/ControlsMenu.hx index 1f40a8455..3d68485a5 100644 --- a/source/funkin/ui/options/ControlsMenu.hx +++ b/source/funkin/ui/options/ControlsMenu.hx @@ -28,10 +28,14 @@ class ControlsMenu extends funkin.ui.options.OptionsState.Page [NOTE_UP, NOTE_DOWN, NOTE_LEFT, NOTE_RIGHT], [UI_UP, UI_DOWN, UI_LEFT, UI_RIGHT, ACCEPT, BACK], [CUTSCENE_ADVANCE], - [FREEPLAY_FAVORITE, FREEPLAY_LEFT, FREEPLAY_RIGHT], - [WINDOW_FULLSCREEN, WINDOW_SCREENSHOT], + [FREEPLAY_FAVORITE, FREEPLAY_LEFT, FREEPLAY_RIGHT, FREEPLAY_CHAR_SELECT], + [WINDOW_FULLSCREEN, #if FEATURE_SCREENSHOTS WINDOW_SCREENSHOT, #end], [VOLUME_UP, VOLUME_DOWN, VOLUME_MUTE], - [DEBUG_MENU, DEBUG_CHART] + [ + DEBUG_MENU, + #if FEATURE_CHART_EDITOR DEBUG_CHART, #end + #if FEATURE_STAGE_EDITOR DEBUG_STAGE, #end + ] ]; var itemGroups:Array> = [for (i in 0...controlGroups.length) []]; @@ -137,7 +141,8 @@ class ControlsMenu extends funkin.ui.options.OptionsState.Page if (currentHeader != null && name.indexOf(currentHeader) == 0) name = name.substr(currentHeader.length); - var label = labels.add(new AtlasText(100, y, name, AtlasFont.BOLD)); + var formatName = name.replace('_', ' '); + var label = labels.add(new AtlasText(100, y, formatName, AtlasFont.BOLD)); label.alpha = 0.6; for (i in 0...COLUMNS) createItem(label.x + 550 + i * 400, y, control, i); diff --git a/source/funkin/util/plugins/ScreenshotPlugin.hx b/source/funkin/util/plugins/ScreenshotPlugin.hx index c859710de..dcd82ecc5 100644 --- a/source/funkin/util/plugins/ScreenshotPlugin.hx +++ b/source/funkin/util/plugins/ScreenshotPlugin.hx @@ -103,7 +103,11 @@ class ScreenshotPlugin extends FlxBasic public function hasPressedScreenshot():Bool { + #if FEATURE_SCREENSHOTS return PlayerSettings.player1.controls.WINDOW_SCREENSHOT; + #else + return false; + #end } public function updatePreferences():Void