From 0afbbbf625b128496e973b4f7922a187339330ef Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Fri, 22 Nov 2024 03:28:18 +0100 Subject: [PATCH 1/9] Fix crash when passing assets path in event pack --- source/funkin/editors/charter/CharterEvent.hx | 35 +++++++++++++++---- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/source/funkin/editors/charter/CharterEvent.hx b/source/funkin/editors/charter/CharterEvent.hx index 89a5d0d9..8bb7fc75 100644 --- a/source/funkin/editors/charter/CharterEvent.hx +++ b/source/funkin/editors/charter/CharterEvent.hx @@ -1,5 +1,6 @@ package funkin.editors.charter; +import flixel.system.FlxAssets.FlxGraphicAsset; import funkin.editors.charter.Charter.ICharterSelectable; import flixel.math.FlxPoint; import funkin.game.Character; @@ -47,14 +48,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'); - if (Assets.exists(Paths.pack('events/$name'))) { - var packimg = Assets.getText(Paths.pack('events/$name')).split('________PACKSEP________')[3]; - if (isBase64 = (packimg != null)) - path = Assets.getText(Paths.pack('events/$name')).split('________PACKSEP________')[3]; + 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(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) { From f6710550c8805f1a1c987723faa77b884243d002 Mon Sep 17 00:00:00 2001 From: ~ Care <126361810+usb-port-2@users.noreply.github.com> Date: Sun, 24 Nov 2024 16:32:40 +0000 Subject: [PATCH 2/9] allow me to use my mouse scroll wheel in the mod menu (+ more menus) (#450) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update ModSwitchMenu.hx * fixed * adding wheel to more menus * forgor pixel --------- Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com> --- assets/data/scripts/week6-pause.hx | 12 ++++-------- source/funkin/menus/FreeplayState.hx | 2 +- source/funkin/menus/MainMenuState.hx | 11 +++++------ source/funkin/menus/ModSwitchMenu.hx | 4 ++-- source/funkin/menus/PauseSubState.hx | 11 +++++------ source/funkin/menus/StoryMenuState.hx | 2 +- 6 files changed, 18 insertions(+), 24 deletions(-) diff --git a/assets/data/scripts/week6-pause.hx b/assets/data/scripts/week6-pause.hx index 6a4455cd..a80598ce 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/source/funkin/menus/FreeplayState.hx b/source/funkin/menus/FreeplayState.hx index 7ca66b02..96aab829 100644 --- a/source/funkin/menus/FreeplayState.hx +++ b/source/funkin/menus/FreeplayState.hx @@ -216,7 +216,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 448552ac..968494f1 100644 --- a/source/funkin/menus/MainMenuState.hx +++ b/source/funkin/menus/MainMenuState.hx @@ -109,11 +109,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()); @@ -127,9 +128,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 1b23b9d2..eac992dc 100644 --- a/source/funkin/menus/ModSwitchMenu.hx +++ b/source/funkin/menus/ModSwitchMenu.hx @@ -39,7 +39,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]); @@ -64,4 +64,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 bff3cd4d..ecf2fa7d 100644 --- a/source/funkin/menus/PauseSubState.hx +++ b/source/funkin/menus/PauseSubState.hx @@ -124,13 +124,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 d69d0c5b..847d921e 100644 --- a/source/funkin/menus/StoryMenuState.hx +++ b/source/funkin/menus/StoryMenuState.hx @@ -142,7 +142,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(); From 4bf58aeda5b66a6b4a9a2cfa5f2e1536d8c95bad Mon Sep 17 00:00:00 2001 From: NyxieFemboy <132237065+NyxieFemboy@users.noreply.github.com> Date: Sun, 24 Nov 2024 13:39:17 -0500 Subject: [PATCH 3/9] Fixing the split vocals not pausing issue in charter (#456) --- .gitignore | 3 ++- source/funkin/editors/charter/ChartDataScreen.hx | 1 + source/funkin/editors/charter/CharterEventScreen.hx | 1 + source/funkin/editors/charter/CharterMetaDataScreen.hx | 1 + source/funkin/editors/charter/CharterNoteTypesList.hx | 1 + source/funkin/editors/charter/CharterStrumlineScreen.hx | 1 + 6 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 59fb2c28..0b7c366d 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ latest/windows/haxe/ .haxelib/ pages/ docs/doc.xml -mods/Baldi's Basics in Funkin'/ \ No newline at end of file +mods/* +!mods/readme.txt \ No newline at end of file diff --git a/source/funkin/editors/charter/ChartDataScreen.hx b/source/funkin/editors/charter/ChartDataScreen.hx index b4592d05..c629c7de 100644 --- a/source/funkin/editors/charter/ChartDataScreen.hx +++ b/source/funkin/editors/charter/ChartDataScreen.hx @@ -23,6 +23,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/CharterEventScreen.hx b/source/funkin/editors/charter/CharterEventScreen.hx index 31d62580..7c2c03c1 100644 --- a/source/funkin/editors/charter/CharterEventScreen.hx +++ b/source/funkin/editors/charter/CharterEventScreen.hx @@ -41,6 +41,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 900cc721..4179dfc7 100644 --- a/source/funkin/editors/charter/CharterMetaDataScreen.hx +++ b/source/funkin/editors/charter/CharterMetaDataScreen.hx @@ -40,6 +40,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 b1cc28b6..827cfa7e 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 26696251..d9298430 100644 --- a/source/funkin/editors/charter/CharterStrumlineScreen.hx +++ b/source/funkin/editors/charter/CharterStrumlineScreen.hx @@ -52,6 +52,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(); From 4295d424941537d5a36dad4f8ae3526910d1f25e Mon Sep 17 00:00:00 2001 From: SrtHero278 Date: Mon, 25 Nov 2024 10:16:34 -0800 Subject: [PATCH 4/9] quick fix --- source/funkin/game/PlayState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index a22ab619..1b5bf86c 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -686,7 +686,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]; From a2a12f121ec388703f003f53dd4be689402099cd Mon Sep 17 00:00:00 2001 From: SrtHero278 Date: Mon, 25 Nov 2024 11:33:48 -0800 Subject: [PATCH 5/9] quick fix 2 classes not using the correct line number. --- source/funkin/backend/scripting/HScript.hx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/funkin/backend/scripting/HScript.hx b/source/funkin/backend/scripting/HScript.hx index 37aaaa95..0597a32f 100644 --- a/source/funkin/backend/scripting/HScript.hx +++ b/source/funkin/backend/scripting/HScript.hx @@ -74,8 +74,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) { From 454bb735719a13a444ad9cfafa20d25266e8f799 Mon Sep 17 00:00:00 2001 From: TBar09 <131258758+TBar09@users.noreply.github.com> Date: Tue, 26 Nov 2024 17:30:17 -0600 Subject: [PATCH 6/9] Fixed Window dark mode issue for Windows 10 users! (#449) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added extras to NativeAPI.hx -Added `setWindowBorderColor()`, `hasVersion()`, and `redrawWindowHeader`. * Added `redrawWindowHeader` to Main.hx * Added setWindowBorderColor * Update NativeAPI.hx * Update Main.hx * Update Windows.hx * Update NativeAPI.hx * Update Windows.hx * Update NativeAPI.hx * Added FlxColorToArray to CoolUtil -Added the FlxColorToArray function to CoolUtil so people can easily use FlxColors with functions like setWindowBorderColor and setWindowTitleColor. * Update Windows.hx * Fix Windows.hx -You now have to use `FlxColor.fromRGB(255, 255, 254)` or 0xFFFFFFFE to set the border to normal * Update Windows.hx shhh * Update NativeAPI.hx * Small fixes * small optimization * eh imma add it here too --------- Co-authored-by: Ne_Eo Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com> --- source/funkin/backend/system/Main.hx | 3 + source/funkin/backend/utils/NativeAPI.hx | 75 +++++++++++++++++++ source/funkin/backend/utils/native/Windows.hx | 46 +++++++++++- 3 files changed, 123 insertions(+), 1 deletion(-) diff --git a/source/funkin/backend/system/Main.hx b/source/funkin/backend/system/Main.hx index 6705b93c..78369f60 100644 --- a/source/funkin/backend/system/Main.hx +++ b/source/funkin/backend/system/Main.hx @@ -156,6 +156,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/utils/NativeAPI.hx b/source/funkin/backend/utils/NativeAPI.hx index 78f0b38d..a8753a8a 100644 --- a/source/funkin/backend/utils/NativeAPI.hx +++ b/source/funkin/backend/utils/NativeAPI.hx @@ -3,6 +3,7 @@ package funkin.backend.utils; 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. @@ -84,12 +85,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 a536c75f..8653d2e8 100644 --- a/source/funkin/backend/utils/native/Windows.hx +++ b/source/funkin/backend/utils/native/Windows.hx @@ -134,13 +134,57 @@ 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 From 32a0eda1b03eefeab62ccddb734282cbc747a394 Mon Sep 17 00:00:00 2001 From: bctix <51544115+bctix@users.noreply.github.com> Date: Tue, 26 Nov 2024 19:00:25 -0500 Subject: [PATCH 7/9] Add extra charter controls (#412) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add new charter controls * typo.... * boundin fix --------- Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com> --- source/funkin/editors/charter/Charter.hx | 30 ++++++++++++++++++++++++ source/funkin/editors/ui/UISlider.hx | 1 + 2 files changed, 31 insertions(+) diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 99f6f690..cf13c0c2 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -341,6 +341,7 @@ class Charter extends UIState { null, { label: "↑ Speed 25%", + keybind: [PERIOD], onSelect: _playback_speed_raise }, { @@ -349,6 +350,7 @@ class Charter extends UIState { }, { label: "↓ Speed 25%", + keybind: [COMMA], onSelect: _playback_speed_lower }, null, @@ -362,6 +364,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", @@ -1579,6 +1597,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/ui/UISlider.hx b/source/funkin/editors/ui/UISlider.hx index 277c7b95..091886c1 100644 --- a/source/funkin/editors/ui/UISlider.hx +++ b/source/funkin/editors/ui/UISlider.hx @@ -26,6 +26,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; From 0da2fd27d03641903b4390b6f06090acc8387005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=8D=9A=7ENex?= <87421482+NexIsDumb@users.noreply.github.com> Date: Wed, 27 Nov 2024 01:10:52 +0100 Subject: [PATCH 8/9] fixing actions by locking hxvlc's version temp --- libs.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs.xml b/libs.xml index 4218feeb..103442fa 100644 --- a/libs.xml +++ b/libs.xml @@ -12,7 +12,7 @@ - + From 85617b7b4eedfcd4ee6daa4415ab1f6ecad0213b Mon Sep 17 00:00:00 2001 From: Furo Date: Fri, 29 Nov 2024 15:27:24 +0100 Subject: [PATCH 9/9] Hide UI Debug State in release mode (#462) --- source/funkin/editors/EditorPicker.hx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/funkin/editors/EditorPicker.hx b/source/funkin/editors/EditorPicker.hx index 7056305f..f210ba92 100644 --- a/source/funkin/editors/EditorPicker.hx +++ b/source/funkin/editors/EditorPicker.hx @@ -22,11 +22,13 @@ class EditorPicker extends MusicBeatSubstate { iconID: 2, state: null }, + #if debug { name: "UI Debug State", iconID: 3, state: UIDebugState }, + #end { name: "Debug Options", iconID: 4, @@ -214,4 +216,4 @@ class EditorPickerOption extends FlxTypedSpriteGroup { callback(); }); } -} \ No newline at end of file +}