diff --git a/.gitignore b/.gitignore index 259123b1..7a1c38d1 100644 --- a/.gitignore +++ b/.gitignore @@ -8,5 +8,6 @@ latest/windows/haxe/ .haxelib/ pages/ docs/doc.xml -mods/Baldi's Basics in Funkin'/ -dev-libs/ \ No newline at end of file +mods/* +!mods/readme.txt +dev-libs/ diff --git a/assets/data/scripts/week6-pause.hx b/assets/data/scripts/week6-pause.hx index f5fa3394..4eb71349 100644 --- a/assets/data/scripts/week6-pause.hx +++ b/assets/data/scripts/week6-pause.hx @@ -92,15 +92,11 @@ function update(elapsed) { if (!canDoShit) return; var oldSec = curSelected; - if (controls.DOWN_P) - changeSelection(1, false); - if (controls.UP_P) - changeSelection(-1); - if (oldSec != curSelected) { + changeSelection((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0) - FlxG.mouse.wheel); + + if (oldSec != curSelected) FlxG.sound.play(Paths.sound(isThorns ? 'pixel/type' : 'pixel/pixelText')); - } - if (controls.ACCEPT) { FlxG.sound.play(Paths.sound(isThorns ? 'pixel/ANGRY' : 'pixel/clickText')); @@ -118,7 +114,7 @@ function update(elapsed) { } } -function changeSelection(change) { +function changeSelection(change) { // this overrides the function inside of the normal pause btw, so no event gets called - Nex curSelected += change; if (curSelected < 0) diff --git a/libs.xml b/libs.xml index c024b95c..2a5dada4 100644 --- a/libs.xml +++ b/libs.xml @@ -16,7 +16,7 @@ - + diff --git a/source/funkin/backend/MusicBeatState.hx b/source/funkin/backend/MusicBeatState.hx index 604f8d1d..2413d8ba 100644 --- a/source/funkin/backend/MusicBeatState.hx +++ b/source/funkin/backend/MusicBeatState.hx @@ -163,10 +163,12 @@ class MusicBeatState extends FlxState implements IBeatReceiver super.createPost(); persistentUpdate = true; call("postCreate"); - if (!skipTransIn) - startTransition(null); - skipTransIn = false; - skipTransOut = false; + if(!Flags.DISABLE_TRANSITIONS) { + if (!skipTransIn) + startTransition(null); + skipTransIn = false; + skipTransOut = false; + } } public function startTransition(?newState:FlxState, skipSubStates:Bool = false):Bool { @@ -286,6 +288,9 @@ class MusicBeatState extends FlxState implements IBeatReceiver if (e.cancelled) return false; + if(Flags.DISABLE_TRANSITIONS) + return true; + if (skipTransOut || (subState is MusicBeatTransition && cast(subState, MusicBeatTransition).newState != null)) return true; startTransition(e.substate); diff --git a/source/funkin/backend/scripting/HScript.hx b/source/funkin/backend/scripting/HScript.hx index 5ecb6299..62a80fe4 100644 --- a/source/funkin/backend/scripting/HScript.hx +++ b/source/funkin/backend/scripting/HScript.hx @@ -79,8 +79,10 @@ class HScript extends Script { var code = Assets.getText(p); var expr:Expr = null; try { - if (code != null && code.trim() != "") + if (code != null && code.trim() != "") { + parser.line = 1; // fun fact: this is all you need to reuse a parser without issues. all the other vars get reset on parse. expr = parser.parseString(code, cl.join("/") + "." + hxExt); + } } catch(e:Error) { _errorHandler(e); } catch(e) { diff --git a/source/funkin/backend/system/Flags.hx b/source/funkin/backend/system/Flags.hx index 03a6b48c..1a28c222 100644 --- a/source/funkin/backend/system/Flags.hx +++ b/source/funkin/backend/system/Flags.hx @@ -99,7 +99,6 @@ class Flags { public static var DEFAULT_CUTSCENE_PAUSE_ITEMS:Array = ['Resume Cutscene', 'Skip Cutscene', 'Restart Cutscene', 'Exit to menu']; public static var DEFAULT_GITAROO:Bool = true; public static var GITAROO_CHANCE:Float = 0.1; - public static var DEFAULT_CAN_ACCESS_DEBUG_MENUS:Bool = true; public static var DEFAULT_MUTE_VOCALS_ON_MISS:Bool = true; public static var DEFAULT_MAX_HEALTH:Float = 2.0; @@ -132,6 +131,10 @@ class Flags { public static var UNDO_PREFIX:String = "* "; public static var JSON_PRETTY_PRINT:String = "\t"; + + public static var DISABLE_EDITORS:Bool = false; + public static var DISABLE_BETA_WARNING_SCREEN:Bool = false; + public static var DISABLE_TRANSITIONS:Bool = false; // -- End of Codename's Default Flags -- /** diff --git a/source/funkin/backend/system/Main.hx b/source/funkin/backend/system/Main.hx index 5617484f..2bc3f60b 100644 --- a/source/funkin/backend/system/Main.hx +++ b/source/funkin/backend/system/Main.hx @@ -158,6 +158,9 @@ class Main extends Sprite FlxG.signals.postStateSwitch.add(onStateSwitchPost); FlxG.mouse.useSystemCursor = true; + #if DARK_MODE_WINDOW + if(funkin.backend.utils.NativeAPI.hasVersion("Windows 10")) funkin.backend.utils.NativeAPI.redrawWindowHeader(); + #end ModsFolder.init(); #if MOD_SUPPORT diff --git a/source/funkin/backend/system/MainState.hx b/source/funkin/backend/system/MainState.hx index 1ea04d22..df171209 100644 --- a/source/funkin/backend/system/MainState.hx +++ b/source/funkin/backend/system/MainState.hx @@ -68,12 +68,11 @@ class MainState extends FlxState { if(Framerate.isLoaded) Framerate.instance.reload(); - if (betaWarningShown) + if (Flags.DISABLE_BETA_WARNING_SCREEN || betaWarningShown) FlxG.switchState(new TitleState()); - else { + else FlxG.switchState(new BetaWarningState()); - betaWarningShown = true; - } + betaWarningShown = true; #if sys CoolUtil.safeAddAttributes('./.temp/', NativeAPI.FileAttribute.HIDDEN); diff --git a/source/funkin/backend/utils/NativeAPI.hx b/source/funkin/backend/utils/NativeAPI.hx index e8320160..64ac95eb 100644 --- a/source/funkin/backend/utils/NativeAPI.hx +++ b/source/funkin/backend/utils/NativeAPI.hx @@ -6,6 +6,7 @@ import openfl.ui.MouseCursor; import funkin.backend.utils.native.*; import flixel.util.typeLimit.OneOfTwo; import flixel.util.typeLimit.OneOfThree; +import flixel.util.FlxColor; /** * Class for functions that talk to a lower level than haxe, such as message boxes, and more. @@ -87,12 +88,86 @@ class NativeAPI { #end } + /** + * WINDOW COLOR MODE FUNCTIONS. + */ + + /** + * Switch the window's color mode to dark or light mode. + */ public static function setDarkMode(title:String, enable:Bool) { #if windows + if(title == null) title = lime.app.Application.current.window.title; Windows.setDarkMode(title, enable); #end } + /** + * Switch the window's color to any color. + * + * WARNING: This is exclusive to windows 11 users, unfortunately. + * + * NOTE: Setting the color to 0x00000000 (FlxColor.TRANSPARENT) will set the border (must have setBorder on) invisible. + */ + public static function setWindowBorderColor(title:String, color:FlxColor, setHeader:Bool = true, setBorder:Bool = true) { + #if windows + if(title == null) title = lime.app.Application.current.window.title; + Windows.setWindowBorderColor(title, [color.red, color.green, color.blue, color.alpha], setHeader, setBorder); + #end + } + + /** + * Resets the window's border color to the default one. + * + * WARNING: This is exclusive to windows 11 users, unfortunately. + **/ + public static function resetWindowBorderColor(title:String, setHeader:Bool = true, setBorder:Bool = true) { + #if windows + if(title == null) title = lime.app.Application.current.window.title; + Windows.setWindowBorderColor(title, [-1, -1, -1, -1], setHeader, setBorder); + #end + } + + /** + * Switch the window's title text to any color. + * + * WARNING: This is exclusive to windows 11 users, unfortunately. + */ + public static function setWindowTitleColor(title:String, color:FlxColor) { + #if windows + if(title == null) title = lime.app.Application.current.window.title; + Windows.setWindowTitleColor(title, [color.red, color.green, color.blue, color.alpha]); + #end + } + + /** + * Resets the window's title color to the default one. + * + * WARNING: This is exclusive to windows 11 users, unfortunately. + **/ + public static function resetWindowTitleColor(title:String) { + #if windows + if(title == null) title = lime.app.Application.current.window.title; + Windows.setWindowTitleColor(title, [-1, -1, -1, -1]); + #end + } + + /** + * Forces the window header to redraw, causes a small visual jitter so use it sparingly. + */ + public static function redrawWindowHeader() { + #if windows + flixel.FlxG.stage.window.borderless = true; + flixel.FlxG.stage.window.borderless = false; + #end + } + + /** + * Can be used to check if your using a specific version of an OS (or if your using a certain OS). + */ + public static function hasVersion(vers:String) + return lime.system.System.platformLabel.toLowerCase().indexOf(vers.toLowerCase()) != -1; + /** * Shows a message box */ diff --git a/source/funkin/backend/utils/native/Windows.hx b/source/funkin/backend/utils/native/Windows.hx index eb0b8cf0..fa51737b 100644 --- a/source/funkin/backend/utils/native/Windows.hx +++ b/source/funkin/backend/utils/native/Windows.hx @@ -134,13 +134,57 @@ final class Windows { HWND window = FindWindowA(NULL, title.c_str()); // Look for child windows if top level aint found if (window == NULL) window = FindWindowExA(GetActiveWindow(), NULL, NULL, title.c_str()); + // If still not found, try to get the active window + if (window == NULL) window = GetActiveWindow(); + if (window == NULL) return; - if (window != NULL && S_OK != DwmSetWindowAttribute(window, 19, &darkMode, sizeof(darkMode))) { + if (S_OK != DwmSetWindowAttribute(window, 19, &darkMode, sizeof(darkMode))) { DwmSetWindowAttribute(window, 20, &darkMode, sizeof(darkMode)); } + UpdateWindow(window); ') public static function setDarkMode(title:String, enable:Bool) {} + @:functionCode(' + HWND window = FindWindowA(NULL, title.c_str()); + if (window == NULL) window = FindWindowExA(GetActiveWindow(), NULL, NULL, title.c_str()); + if (window == NULL) window = GetActiveWindow(); + if (window == NULL) return; + + COLORREF finalColor; + if(color[0] == -1 && color[1] == -1 && color[2] == -1 && color[3] == -1) { // bad fix, I know :sob: + finalColor = 0xFFFFFFFF; // Default border + } else if(color[3] == 0) { + finalColor = 0xFFFFFFFE; // No border (must have setBorder as true) + } else { + finalColor = RGB(color[0], color[1], color[2]); // Use your custom color + } + + if(setHeader) DwmSetWindowAttribute(window, 35, &finalColor, sizeof(COLORREF)); + if(setBorder) DwmSetWindowAttribute(window, 34, &finalColor, sizeof(COLORREF)); + + UpdateWindow(window); + ') + public static function setWindowBorderColor(title:String, color:Array, setHeader:Bool = true, setBorder:Bool = true) {} + + @:functionCode(' + HWND window = FindWindowA(NULL, title.c_str()); + if (window == NULL) window = FindWindowExA(GetActiveWindow(), NULL, NULL, title.c_str()); + if (window == NULL) window = GetActiveWindow(); + if (window == NULL) return; + + COLORREF finalColor; + if(color[0] == -1 && color[1] == -1 && color[2] == -1 && color[3] == -1) { // bad fix, I know :sob: + finalColor = 0xFFFFFFFF; // Default border + } else { + finalColor = RGB(color[0], color[1], color[2]); // Use your custom color + } + + DwmSetWindowAttribute(window, 36, &finalColor, sizeof(COLORREF)); + UpdateWindow(window); + ') + public static function setWindowTitleColor(title:String, color:Array) {} + @:functionCode(' // https://stackoverflow.com/questions/15543571/allocconsole-not-displaying-cout diff --git a/source/funkin/editors/EditorPicker.hx b/source/funkin/editors/EditorPicker.hx index f1279b9b..f34a7219 100644 --- a/source/funkin/editors/EditorPicker.hx +++ b/source/funkin/editors/EditorPicker.hx @@ -34,7 +34,7 @@ class EditorPicker extends MusicBeatSubstate { iconID: 5, state: null, onClick: function() { - CoolUtil.openURL("https://fnf-cne-devs.github.io/"); + CoolUtil.openURL("https://codename-engine.com/"); } }, { @@ -226,4 +226,4 @@ class EditorPickerOption extends FlxTypedSpriteGroup { callback(); }); } -} \ No newline at end of file +} diff --git a/source/funkin/editors/charter/ChartDataScreen.hx b/source/funkin/editors/charter/ChartDataScreen.hx index bfa0b866..510116c3 100644 --- a/source/funkin/editors/charter/ChartDataScreen.hx +++ b/source/funkin/editors/charter/ChartDataScreen.hx @@ -27,6 +27,7 @@ class ChartDataScreen extends UISubstateWindow { public override function create() { FlxG.sound.music.pause(); Charter.instance.vocals.pause(); + for (strumLine in Charter.instance.strumLines.members) strumLine.vocals.pause(); winTitle = 'Chart Properties'; winWidth = 420; winHeight = 230; // guys look, the funny numbers! diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 4d408800..842c0615 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -356,6 +356,7 @@ class Charter extends UIState { null, { label: "↑ Speed 25%", + keybind: [PERIOD], onSelect: _playback_speed_raise }, { @@ -364,6 +365,7 @@ class Charter extends UIState { }, { label: "↓ Speed 25%", + keybind: [COMMA], onSelect: _playback_speed_lower }, null, @@ -377,6 +379,22 @@ class Charter extends UIState { keybind: [D], onSelect: _playback_forward }, + { + label: "Go to start of section", + keybind: [SHIFT, S], + onSelect: _playback_section_start + }, + null, + { + label: "Go back a step", + keybind: [W], + onSelect: _playback_back_step + }, + { + label: "Go forward a step", + keybind: [S], + onSelect: _playback_forward_step + }, null, { label: "Metronome", @@ -1687,6 +1705,18 @@ class Charter extends UIState { if (FlxG.sound.music.playing) return; Conductor.songPosition += (Conductor.beatsPerMeasure * __crochet); } + function _playback_section_start(_) { + if(FlxG.sound.music.playing) return; + Conductor.songPosition = (Conductor.beatsPerMeasure * (60000 / Conductor.bpm)) * curMeasure; + } + function _playback_back_step(_) { + if (FlxG.sound.music.playing) return; + Conductor.songPosition -= Conductor.stepCrochet; + } + function _playback_forward_step(_) { + if (FlxG.sound.music.playing) return; + Conductor.songPosition += Conductor.stepCrochet; + } function _song_start(_) { if (FlxG.sound.music.playing) return; Conductor.songPosition = 0; diff --git a/source/funkin/editors/charter/CharterEvent.hx b/source/funkin/editors/charter/CharterEvent.hx index ed3458a9..02a92a8f 100644 --- a/source/funkin/editors/charter/CharterEvent.hx +++ b/source/funkin/editors/charter/CharterEvent.hx @@ -1,6 +1,7 @@ package funkin.editors.charter; import flixel.math.FlxPoint; +import flixel.system.FlxAssets.FlxGraphicAsset; import funkin.backend.chart.ChartData.ChartEvent; import funkin.editors.charter.Charter.ICharterSelectable; import funkin.editors.charter.CharterBackdropGroup.EventBackdrop; @@ -60,16 +61,34 @@ class CharterEvent extends UISliceSprite implements ICharterSelectable { private static function generateDefaultIcon(name:String) { var isBase64:Bool = false; var path:String = Paths.image('editors/charter/event-icons/$name'); - if (!Assets.exists(path)) path = Paths.image('editors/charter/event-icons/Unknown'); + var defaultPath = Paths.image('editors/charter/event-icons/Unknown'); + if (!Assets.exists(path)) path = defaultPath; + var packPath = Paths.pack('events/$name'); if (Assets.exists(packPath)) { var packText = Assets.getText(packPath).split('________PACKSEP________'); - var packimg = packText[3]; - if (isBase64 = (packimg != null)) - path = packText[3]; + var packImg = packText[3]; + if(packImg != null && packImg.length > 0) { + isBase64 = !packImg.startsWith("assets/"); + path = packImg; + } } - var spr = new FlxSprite().loadGraphic(isBase64 ? openfl.display.BitmapData.fromBase64(path.trim(), 'UTF8') : path); - return spr; + path = path.trim(); + + var graphic:FlxGraphicAsset = try { + isBase64 ? openfl.display.BitmapData.fromBase64(path, 'UTF8') : path; + } catch(e:Dynamic) { + Logs.trace('Failed to load event icon: ${e.toString()}', ERROR); + isBase64 = false; + defaultPath; + } + + if(!isBase64) { + if (!Assets.exists(graphic)) + graphic = defaultPath; + } + + return new FlxSprite().loadGraphic(graphic); } public static function generateEventIcon(event:ChartEvent) { diff --git a/source/funkin/editors/charter/CharterEventScreen.hx b/source/funkin/editors/charter/CharterEventScreen.hx index 35c0dd1c..32896076 100644 --- a/source/funkin/editors/charter/CharterEventScreen.hx +++ b/source/funkin/editors/charter/CharterEventScreen.hx @@ -45,6 +45,7 @@ class CharterEventScreen extends UISubstateWindow { FlxG.sound.music.pause(); // prevent the song from continuing Charter.instance.vocals.pause(); + for (strumLine in Charter.instance.strumLines.members) strumLine.vocals.pause(); events = chartEvent.events.copy(); diff --git a/source/funkin/editors/charter/CharterMetaDataScreen.hx b/source/funkin/editors/charter/CharterMetaDataScreen.hx index 0ab7900c..bdc38f87 100644 --- a/source/funkin/editors/charter/CharterMetaDataScreen.hx +++ b/source/funkin/editors/charter/CharterMetaDataScreen.hx @@ -39,6 +39,7 @@ class CharterMetaDataScreen extends UISubstateWindow { FlxG.sound.music.pause(); Charter.instance.vocals.pause(); + for (strumLine in Charter.instance.strumLines.members) strumLine.vocals.pause(); function addLabelOn(ui:UISprite, text:String) add(new UIText(ui.x, ui.y - 24, 0, text)); diff --git a/source/funkin/editors/charter/CharterNoteTypesList.hx b/source/funkin/editors/charter/CharterNoteTypesList.hx index 09cab8e3..7056d1b8 100644 --- a/source/funkin/editors/charter/CharterNoteTypesList.hx +++ b/source/funkin/editors/charter/CharterNoteTypesList.hx @@ -13,6 +13,7 @@ class CharterNoteTypesList extends UISubstateWindow { public override function create() { FlxG.sound.music.pause(); Charter.instance.vocals.pause(); + for (strumLine in Charter.instance.strumLines.members) strumLine.vocals.pause(); winTitle = 'Note Types List Editor'; winWidth = 380; winHeight = 390; diff --git a/source/funkin/editors/charter/CharterStrumlineScreen.hx b/source/funkin/editors/charter/CharterStrumlineScreen.hx index 42d543c9..cc8f575a 100644 --- a/source/funkin/editors/charter/CharterStrumlineScreen.hx +++ b/source/funkin/editors/charter/CharterStrumlineScreen.hx @@ -61,6 +61,7 @@ class CharterStrumlineScreen extends UISubstateWindow { FlxG.sound.music.pause(); Charter.instance.vocals.pause(); + for (strumLine in Charter.instance.strumLines.members) strumLine.vocals.pause(); super.create(); diff --git a/source/funkin/editors/ui/UISlider.hx b/source/funkin/editors/ui/UISlider.hx index 46accdd0..cbedbb62 100644 --- a/source/funkin/editors/ui/UISlider.hx +++ b/source/funkin/editors/ui/UISlider.hx @@ -27,6 +27,7 @@ class UISlider extends UISprite { public var value(default, set):Float = 0; public function set_value(newVal:Float):Float { + newVal = FlxMath.bound(newVal, segments[0].start, segments[segments.length-1].end); __barProgress = __calcProgress(newVal); if (onChange != null) onChange(newVal); if (valueStepper != null) valueStepper.value = newVal; return value = newVal; diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 01b50108..ffe4fa67 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -215,7 +215,7 @@ class PlayState extends MusicBeatState /** * Whenever the player can press 7, 8 or 9 to access the debug menus. */ - public var canAccessDebugMenus:Bool = Flags.DEFAULT_CAN_ACCESS_DEBUG_MENUS; + public var canAccessDebugMenus:Bool = !Flags.DISABLE_EDITORS; /** * Whether or not to show the secret gitaroo pause. */ @@ -718,7 +718,7 @@ class PlayState extends MusicBeatState startingPos, strumLine.strumScale == null ? 1 : strumLine.strumScale, strumLine.type == 2 || (!coopMode && !((strumLine.type == 1 && !opponentMode) || (strumLine.type == 0 && opponentMode))), - strumLine.type != 1, coopMode ? (strumLine.type == 1 ? controlsP1 : controlsP2) : controls, + strumLine.type != 1, coopMode ? ((strumLine.type == 1) != opponentMode ? controlsP1 : controlsP2) : controls, strumLine.vocalsSuffix ); strLine.cameras = [camHUD]; @@ -1311,7 +1311,7 @@ class PlayState extends MusicBeatState #end } - if (doIconBop) { + if (doIconBop) { var iconLerp = Flags.ICON_LERP; iconP1.scale.set(lerp(iconP1.scale.x, 1, iconLerp), lerp(iconP1.scale.y, 1, iconLerp)); iconP2.scale.set(lerp(iconP2.scale.x, 1, iconLerp), lerp(iconP2.scale.y, 1, iconLerp)); @@ -1874,7 +1874,7 @@ class PlayState extends MusicBeatState camHUD.zoom += Flags.HUD_BOP_STRENGTH * camZoomingStrength; } - if (doIconBop) + if (doIconBop) { var iconScale = Flags.BOP_ICON_SCALE; iconP1.scale.set(iconScale, iconScale); diff --git a/source/funkin/menus/FreeplayState.hx b/source/funkin/menus/FreeplayState.hx index afb142ea..193e56be 100644 --- a/source/funkin/menus/FreeplayState.hx +++ b/source/funkin/menus/FreeplayState.hx @@ -218,7 +218,7 @@ class FreeplayState extends MusicBeatState lerpScore = intendedScore; if (canSelect) { - changeSelection((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0)); + changeSelection((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0) - FlxG.mouse.wheel); changeDiff((controls.LEFT_P ? -1 : 0) + (controls.RIGHT_P ? 1 : 0)); changeCoopMode((FlxG.keys.justPressed.TAB ? 1 : 0)); // putting it before so that its actually smooth diff --git a/source/funkin/menus/MainMenuState.hx b/source/funkin/menus/MainMenuState.hx index 5f580868..14600f83 100644 --- a/source/funkin/menus/MainMenuState.hx +++ b/source/funkin/menus/MainMenuState.hx @@ -25,7 +25,7 @@ class MainMenuState extends MusicBeatState var camFollow:FlxObject; var versionText:FunkinText; - public var canAccessDebugMenus:Bool = Flags.DEFAULT_CAN_ACCESS_DEBUG_MENUS; + public var canAccessDebugMenus:Bool = !Flags.DISABLE_EDITORS; override function create() { @@ -106,11 +106,12 @@ class MainMenuState extends MusicBeatState */ } - if (controls.UP_P) - changeItem(-1); + var upP = controls.UP_P; + var downP = controls.DOWN_P; + var scroll = FlxG.mouse.wheel; - if (controls.DOWN_P) - changeItem(1); + if (upP || downP || scroll != 0) // like this we wont break mods that expect a 0 change event when calling sometimes - Nex + changeItem((upP ? -1 : 0) + (downP ? 1 : 0) - scroll); if (controls.BACK) FlxG.switchState(new TitleState()); @@ -124,9 +125,7 @@ class MainMenuState extends MusicBeatState #end if (controls.ACCEPT) - { selectItem(); - } } super.update(elapsed); diff --git a/source/funkin/menus/ModSwitchMenu.hx b/source/funkin/menus/ModSwitchMenu.hx index 4746b565..38175085 100644 --- a/source/funkin/menus/ModSwitchMenu.hx +++ b/source/funkin/menus/ModSwitchMenu.hx @@ -42,7 +42,7 @@ class ModSwitchMenu extends MusicBeatSubstate { public override function update(elapsed:Float) { super.update(elapsed); - changeSelection((controls.DOWN_P ? 1 : 0) + (controls.UP_P ? -1 : 0)); + changeSelection((controls.DOWN_P ? 1 : 0) + (controls.UP_P ? -1 : 0) - FlxG.mouse.wheel); if (controls.ACCEPT) { ModsFolder.switchMod(mods[curSelected]); @@ -67,4 +67,4 @@ class ModSwitchMenu extends MusicBeatSubstate { alphabets.members[curSelected].alpha = 1; } } -#end \ No newline at end of file +#end diff --git a/source/funkin/menus/PauseSubState.hx b/source/funkin/menus/PauseSubState.hx index 1ab70f33..b543742a 100644 --- a/source/funkin/menus/PauseSubState.hx +++ b/source/funkin/menus/PauseSubState.hx @@ -127,13 +127,12 @@ class PauseSubState extends MusicBeatSubstate var upP = controls.UP_P; var downP = controls.DOWN_P; - var accepted = controls.ACCEPT; + var scroll = FlxG.mouse.wheel; - if (upP) - changeSelection(-1); - if (downP) - changeSelection(1); - if (accepted) + if (upP || downP || scroll != 0) // like this we wont break mods that expect a 0 change event when calling sometimes - Nex + changeSelection((upP ? -1 : 0) + (downP ? 1 : 0) - scroll); + + if (controls.ACCEPT) selectOption(); } diff --git a/source/funkin/menus/StoryMenuState.hx b/source/funkin/menus/StoryMenuState.hx index 8cc0c431..4890c23d 100644 --- a/source/funkin/menus/StoryMenuState.hx +++ b/source/funkin/menus/StoryMenuState.hx @@ -149,7 +149,7 @@ class StoryMenuState extends MusicBeatState { } changeDifficulty((controls.LEFT_P ? -1 : 0) + (controls.RIGHT_P ? 1 : 0)); - changeWeek((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0)); + changeWeek((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0) - FlxG.mouse.wheel); if (controls.ACCEPT) selectWeek();