From 2f223f84f5ead936b95ecaf7cdca814b36b0d7b3 Mon Sep 17 00:00:00 2001 From: MAJigsaw77 <77043862+MAJigsaw77@users.noreply.github.com> Date: Sat, 28 Jun 2025 22:03:39 +0300 Subject: [PATCH] Add FEATURE_DEBUG_MENU and FEATURE_ANIMATION_EDITOR defines. --- project.hxp | 38 ++++++++++++++------- source/funkin/input/Controls.hx | 26 ++++++++++---- source/funkin/ui/debug/DebugMenuSubState.hx | 2 ++ source/funkin/ui/mainmenu/MainMenuState.hx | 4 +++ source/funkin/ui/options/ControlsMenu.hx | 4 +-- 5 files changed, 54 insertions(+), 20 deletions(-) diff --git a/project.hxp b/project.hxp index 55530bfcf..af81dd5c0 100644 --- a/project.hxp +++ b/project.hxp @@ -254,12 +254,6 @@ class Project extends HXProject // Inverse build flags are automatically populated. // - /** - * `-DFEATURE_CHART_EDITOR` - * If this flag is enabled, the Chart Editor will be accessible from the debug menu. - */ - static final FEATURE_CHART_EDITOR:FeatureFlag = "FEATURE_CHART_EDITOR"; - /** * `-DFEATURE_COMPRESSED_TEXTURES` * If this flag is enabled, ASTC compressed textures will be used over uncompressed PNGs. @@ -283,6 +277,12 @@ class Project extends HXProject */ static final FEATURE_DEBUG_FUNCTIONS:FeatureFlag = "FEATURE_DEBUG_FUNCTIONS"; + /** + * `-DFEATURE_RESULTS_DEBUG` + * If this flag is enabled, a debug menu for Results screen will be accessible from the debug menu. + */ + static final FEATURE_RESULTS_DEBUG:FeatureFlag = "FEATURE_RESULTS_DEBUG"; + /** * `-DFEATURE_DEBUG_TRACY` * If this flag is enabled, the game will have the necessary hooks for the Tracy profiler. @@ -422,18 +422,30 @@ class Project extends HXProject */ static final FEATURE_POLYMOD_MODS:FeatureFlag = "FEATURE_POLYMOD_MODS"; - /** - * `-DFEATURE_RESULTS_DEBUG` - * If this flag is enabled, a debug menu for Results screen will be accessible from the debug menu. - */ - static final FEATURE_RESULTS_DEBUG:FeatureFlag = "FEATURE_RESULTS_DEBUG"; - /** * `-DFEATURE_SCREENSHOTS` * If this flag is enabled, the game will support the screenshots feature. */ static final FEATURE_SCREENSHOTS:FeatureFlag = "FEATURE_SCREENSHOTS"; + /** + * `-FEATURE_DEBUG_MENU` + * If this flag is enabled, a debug menu will be accessible. + */ + static final FEATURE_DEBUG_MENU:FeatureFlag = "FEATURE_DEBUG_MENU"; + + /** + * `-FEATURE_ANIMATION_EDITOR` + * If this flag is enabled, the Animation Editor will be accessible from the debug menu. + */ + static final FEATURE_ANIMATION_EDITOR:FeatureFlag = "FEATURE_ANIMATION_EDITOR"; + + /** + * `-DFEATURE_CHART_EDITOR` + * If this flag is enabled, the Chart Editor will be accessible from the debug menu. + */ + static final FEATURE_CHART_EDITOR:FeatureFlag = "FEATURE_CHART_EDITOR"; + /** * `-DFEATURE_STAGE_EDITOR` * If this flag is enabled, the Stage Editor will be accessible from the debug menu. @@ -812,6 +824,8 @@ class Project extends HXProject // Should be true except on web and mobile builds. // Debug editors aren't built to work on web or mobile right now. + FEATURE_DEBUG_MENU.apply(this, !(isWeb() || isMobile())); + FEATURE_ANIMATION_EDITOR.apply(this, !(isWeb() || isMobile())); FEATURE_CHART_EDITOR.apply(this, !(isWeb() || isMobile())); FEATURE_STAGE_EDITOR.apply(this, !(isWeb() || isMobile())); diff --git a/source/funkin/input/Controls.hx b/source/funkin/input/Controls.hx index fff31206d..1ef3e02f4 100644 --- a/source/funkin/input/Controls.hx +++ b/source/funkin/input/Controls.hx @@ -63,7 +63,9 @@ class Controls extends FlxActionSet 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 _cutscene_advance = new FunkinAction(Action.CUTSCENE_ADVANCE); + #if FEATURE_DEBUG_MENU var _debug_menu = new FunkinAction(Action.DEBUG_MENU); + #end #if FEATURE_CHART_EDITOR var _debug_chart = new FunkinAction(Action.DEBUG_CHART); #end @@ -286,10 +288,12 @@ class Controls extends FlxActionSet inline function get_CUTSCENE_ADVANCE() return _cutscene_advance.check(); + #if FEATURE_DEBUG_MENU public var DEBUG_MENU(get, never):Bool; inline function get_DEBUG_MENU() return _debug_menu.check(); + #end #if FEATURE_CHART_EDITOR public var DEBUG_CHART(get, never):Bool; @@ -345,7 +349,7 @@ class Controls extends FlxActionSet add(_freeplay_jump_to_top); add(_freeplay_jump_to_bottom); add(_cutscene_advance); - add(_debug_menu); + #if FEATURE_DEBUG_MENU add(_debug_menu); #end #if FEATURE_CHART_EDITOR add(_debug_chart); #end #if FEATURE_STAGE_EDITOR add(_debug_stage); #end add(_volume_up); @@ -473,7 +477,7 @@ class Controls extends FlxActionSet case FREEPLAY_JUMP_TO_TOP: _freeplay_jump_to_top; case FREEPLAY_JUMP_TO_BOTTOM: _freeplay_jump_to_bottom; case CUTSCENE_ADVANCE: _cutscene_advance; - case DEBUG_MENU: _debug_menu; + #if FEATURE_DEBUG_MENU case DEBUG_MENU: _debug_menu; #end #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; @@ -557,8 +561,10 @@ class Controls extends FlxActionSet func(_freeplay_jump_to_bottom, JUST_PRESSED); case CUTSCENE_ADVANCE: func(_cutscene_advance, JUST_PRESSED); + #if FEATURE_DEBUG_MENU case DEBUG_MENU: func(_debug_menu, JUST_PRESSED); + #end #if FEATURE_CHART_EDITOR case DEBUG_CHART: func(_debug_chart, JUST_PRESSED); @@ -781,7 +787,9 @@ class Controls extends FlxActionSet 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.CUTSCENE_ADVANCE, getDefaultKeybinds(scheme, Control.CUTSCENE_ADVANCE)); + #if FEATURE_DEBUG_MENU bindKeys(Control.DEBUG_MENU, getDefaultKeybinds(scheme, Control.DEBUG_MENU)); + #end #if FEATURE_CHART_EDITOR bindKeys(Control.DEBUG_CHART, getDefaultKeybinds(scheme, Control.DEBUG_CHART)); #end @@ -821,7 +829,7 @@ class Controls extends FlxActionSet case Control.FREEPLAY_JUMP_TO_TOP: return [HOME]; case Control.FREEPLAY_JUMP_TO_BOTTOM: return [END]; case Control.CUTSCENE_ADVANCE: return [Z, ENTER]; - case Control.DEBUG_MENU: return [GRAVEACCENT]; + #if FEATURE_DEBUG_MENU case Control.DEBUG_MENU: return [GRAVEACCENT]; #end #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]; @@ -852,7 +860,7 @@ class Controls extends FlxActionSet case Control.FREEPLAY_JUMP_TO_TOP: return [HOME]; case Control.FREEPLAY_JUMP_TO_BOTTOM: return [END]; case Control.CUTSCENE_ADVANCE: return [G, Z]; - case Control.DEBUG_MENU: return [GRAVEACCENT]; + #if FEATURE_DEBUG_MENU case Control.DEBUG_MENU: return [GRAVEACCENT]; #end #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]; @@ -883,7 +891,7 @@ class Controls extends FlxActionSet case Control.FREEPLAY_JUMP_TO_TOP: return []; case Control.FREEPLAY_JUMP_TO_BOTTOM: return []; case Control.CUTSCENE_ADVANCE: return [ENTER]; - case Control.DEBUG_MENU: return []; + #if FEATURE_DEBUG_MENU case Control.DEBUG_MENU: return []; #end #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]; @@ -979,7 +987,9 @@ class Controls extends FlxActionSet Control.VOLUME_UP => getDefaultGamepadBinds(Control.VOLUME_UP), Control.VOLUME_DOWN => getDefaultGamepadBinds(Control.VOLUME_DOWN), Control.VOLUME_MUTE => getDefaultGamepadBinds(Control.VOLUME_MUTE), + #if FEATURE_DEBUG_MENU Control.DEBUG_MENU => getDefaultGamepadBinds(Control.DEBUG_MENU), + #end #if FEATURE_CHART_EDITOR Control.DEBUG_CHART => getDefaultGamepadBinds(Control.DEBUG_CHART), #end @@ -1043,8 +1053,10 @@ class Controls extends FlxActionSet []; case Control.VOLUME_MUTE: []; + #if FEATURE_DEBUG_MENU case Control.DEBUG_MENU: []; + #end #if FEATURE_CHART_EDITOR case Control.DEBUG_CHART: []; @@ -1467,7 +1479,7 @@ enum Control VOLUME_DOWN; VOLUME_MUTE; // DEBUG - DEBUG_MENU; + #if FEATURE_DEBUG_MENU DEBUG_MENU; #end #if FEATURE_CHART_EDITOR DEBUG_CHART; #end #if FEATURE_STAGE_EDITOR DEBUG_STAGE; #end } @@ -1523,7 +1535,9 @@ enum abstract Action(String) to String from String var VOLUME_DOWN = "volume_down"; var VOLUME_MUTE = "volume_mute"; // DEBUG + #if FEATURE_DEBUG_MENU var DEBUG_MENU = "debug_menu"; + #end #if FEATURE_CHART_EDITOR var DEBUG_CHART = "debug_chart"; #end diff --git a/source/funkin/ui/debug/DebugMenuSubState.hx b/source/funkin/ui/debug/DebugMenuSubState.hx index dd004a966..98555d602 100644 --- a/source/funkin/ui/debug/DebugMenuSubState.hx +++ b/source/funkin/ui/debug/DebugMenuSubState.hx @@ -56,7 +56,9 @@ class DebugMenuSubState extends MusicBeatSubState #if FEATURE_CHART_EDITOR createItem("CHART EDITOR", openChartEditor); #end + #if FEATURE_ANIMATION_EDITOR createItem("ANIMATION EDITOR", openAnimationEditor); + #end #if FEATURE_STAGE_EDITOR createItem("STAGE EDITOR", openStageEditor); #end diff --git a/source/funkin/ui/mainmenu/MainMenuState.hx b/source/funkin/ui/mainmenu/MainMenuState.hx index 3c07a46fe..0c9ec79a9 100644 --- a/source/funkin/ui/mainmenu/MainMenuState.hx +++ b/source/funkin/ui/mainmenu/MainMenuState.hx @@ -1,7 +1,9 @@ package funkin.ui.mainmenu; import flixel.addons.transition.FlxTransitionableState; +#if FEATURE_DEBUG_MENU import funkin.ui.debug.DebugMenuSubState; +#end import flixel.FlxObject; import flixel.FlxSubState; import flixel.FlxSprite; @@ -484,6 +486,7 @@ class MainMenuState extends MusicBeatState { if (!canInteract) return; + #if FEATURE_DEBUG_MENU // Open the debug menu, defaults to ` / ~ // This includes stuff like the Chart Editor, so it should be present on all builds. if (controls.DEBUG_MENU) @@ -495,6 +498,7 @@ class MainMenuState extends MusicBeatState FlxG.state.openSubState(new DebugMenuSubState()); } + #end #if FEATURE_DEBUG_FUNCTIONS // Ctrl+Alt+Shift+P = Character Unlock screen diff --git a/source/funkin/ui/options/ControlsMenu.hx b/source/funkin/ui/options/ControlsMenu.hx index b1cce7665..c5e56fdd6 100644 --- a/source/funkin/ui/options/ControlsMenu.hx +++ b/source/funkin/ui/options/ControlsMenu.hx @@ -32,7 +32,7 @@ class ControlsMenu extends Page [WINDOW_FULLSCREEN, #if FEATURE_SCREENSHOTS WINDOW_SCREENSHOT, #end], [VOLUME_UP, VOLUME_DOWN, VOLUME_MUTE], [ - DEBUG_MENU, + #if FEATURE_DEBUG_MENU DEBUG_MENU, #end #if FEATURE_CHART_EDITOR DEBUG_CHART, #end #if FEATURE_STAGE_EDITOR DEBUG_STAGE, #end ] @@ -149,7 +149,7 @@ class ControlsMenu extends Page if (currentHeader != null && name.indexOf(currentHeader) == 0) name = name.substr(currentHeader.length); var formatName = name.replace('_', ' '); - var label = labels.add(new AtlasText(CONTROL_BASE_X, y, formatName, AtlasFont.BOLD)); + var label = labels.add(new AtlasText(Math.max(FullScreenScaleMode.gameNotchSize.x, CONTROL_BASE_X), y, formatName, AtlasFont.BOLD)); label.alpha = 0.6; for (i in 0...COLUMNS) createItem(label.x + CONTROL_MARGIN_X + i * CONTROL_SPACING_X, y, control, i);