From 8eee6097562201b4757fa341d691e87db245e744 Mon Sep 17 00:00:00 2001 From: Til <89487150+TechnikTil@users.noreply.github.com> Date: Wed, 2 Jul 2025 02:37:19 -0700 Subject: [PATCH 01/16] vcr.ttf changes when switching mods now, if it was inside source code (#672) --- source/funkin/backend/system/Main.hx | 1 + 1 file changed, 1 insertion(+) diff --git a/source/funkin/backend/system/Main.hx b/source/funkin/backend/system/Main.hx index c7d58973..42ac35e3 100644 --- a/source/funkin/backend/system/Main.hx +++ b/source/funkin/backend/system/Main.hx @@ -183,6 +183,7 @@ class Main extends Sprite public static function refreshAssets() { WindowUtils.resetTitle(); + FunkinCache.instance.clearSecondLayer(); FlxSoundTray.volumeChangeSFX = Paths.sound('menu/volume'); FlxSoundTray.volumeUpChangeSFX = null; From b55fb41f404d3dabc1b404b15a9cccd818696134 Mon Sep 17 00:00:00 2001 From: Jade <45212377+crowplexus@users.noreply.github.com> Date: Wed, 2 Jul 2025 09:00:36 -0400 Subject: [PATCH 02/16] hey community can u check if left holds are still broken? --- source/funkin/game/Note.hx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/funkin/game/Note.hx b/source/funkin/game/Note.hx index cc1dab5e..5021465c 100644 --- a/source/funkin/game/Note.hx +++ b/source/funkin/game/Note.hx @@ -154,9 +154,10 @@ class Note extends FlxSprite case 0: animation.addByPrefix('scroll', 'purple0'); animation.addByPrefix('hold', 'purple hold piece'); - animation.addByPrefix('holdend', 'purple hold end'); if (frames.getByName("pruple end hold") != null) animation.addByPrefix("holdend", "pruple end hold"); + else + animation.addByPrefix('holdend', 'purple hold end'); case 1: animation.addByPrefix('scroll', 'blue0'); animation.addByPrefix('hold', 'blue hold piece'); From 09da78cfa9fe9e26f43894a8586fa5eb6add2be9 Mon Sep 17 00:00:00 2001 From: Jade <45212377+crowplexus@users.noreply.github.com> Date: Wed, 2 Jul 2025 09:38:05 -0400 Subject: [PATCH 03/16] that should be fine now, hopefully. --- source/funkin/game/Note.hx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/funkin/game/Note.hx b/source/funkin/game/Note.hx index 5021465c..b39743cb 100644 --- a/source/funkin/game/Note.hx +++ b/source/funkin/game/Note.hx @@ -154,9 +154,8 @@ class Note extends FlxSprite case 0: animation.addByPrefix('scroll', 'purple0'); animation.addByPrefix('hold', 'purple hold piece'); - if (frames.getByName("pruple end hold") != null) - animation.addByPrefix("holdend", "pruple end hold"); - else + animation.addByPrefix("holdend", "pruple end hold"); + if (animation.exists("holdend") != true) // null or false animation.addByPrefix('holdend', 'purple hold end'); case 1: animation.addByPrefix('scroll', 'blue0'); From 291c1d25bf56da2fd6df73bc859d211dfcbaa3b1 Mon Sep 17 00:00:00 2001 From: sage <110337474+StrawberrySage@users.noreply.github.com> Date: Thu, 3 Jul 2025 01:32:14 +1000 Subject: [PATCH 04/16] Allow pathBack on Linux (for the command) (#658) --- source/funkin/backend/system/Main.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/backend/system/Main.hx b/source/funkin/backend/system/Main.hx index 42ac35e3..db4b774e 100644 --- a/source/funkin/backend/system/Main.hx +++ b/source/funkin/backend/system/Main.hx @@ -89,7 +89,7 @@ class Main extends Sprite public static var audioDisconnected:Bool = false; public static var changeID:Int = 0; - public static var pathBack = #if windows + public static var pathBack = #if (windows || linux) "../../../../" #elseif mac "../../../../../../../" From 1ca98b3013815ce4f039774093ea5c5453e3ccda Mon Sep 17 00:00:00 2001 From: Teejio <119088283+Teejio@users.noreply.github.com> Date: Wed, 2 Jul 2025 11:34:50 -0400 Subject: [PATCH 05/16] Add LoopTime to CoolUtil.playMusic ini Files (#673) * Update CoolUtil.hx * Update CoolUtil.hx * realized i like it in sec more than ms --- source/funkin/backend/utils/CoolUtil.hx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/funkin/backend/utils/CoolUtil.hx b/source/funkin/backend/utils/CoolUtil.hx index f1fc14d8..b2dad256 100644 --- a/source/funkin/backend/utils/CoolUtil.hx +++ b/source/funkin/backend/utils/CoolUtil.hx @@ -389,9 +389,14 @@ class CoolUtil if (Assets.exists(infoPath)) { var musicInfo = IniUtil.parseAsset(infoPath, [ "BPM" => null, - "TimeSignature" => "4/4" + "TimeSignature" => "4/4", + "LoopTime" => "0.0" ]); + + if (FlxG.sound.music != null) { + FlxG.sound.music.loopTime = Std.parseFloat(musicInfo["LoopTime"]) * 1000; + } var timeSignParsed:Array> = musicInfo["TimeSignature"] == null ? [] : [for(s in musicInfo["TimeSignature"].split("/")) Std.parseFloat(s)]; var beatsPerMeasure:Float = 4; var stepsPerBeat:Float = 4; From e4baf51e062fb00144215a5d7eae9ab690497adb Mon Sep 17 00:00:00 2001 From: Ralty <78720179+Raltyro@users.noreply.github.com> Date: Wed, 2 Jul 2025 22:40:56 +0700 Subject: [PATCH 06/16] Fix Inconsistency in Sustain Input (#663) Make player sustains the same as cpu sustains --- source/funkin/game/Note.hx | 32 +++++++++++++------------------- source/funkin/game/StrumLine.hx | 5 +++-- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/source/funkin/game/Note.hx b/source/funkin/game/Note.hx index b39743cb..0f007b25 100644 --- a/source/funkin/game/Note.hx +++ b/source/funkin/game/Note.hx @@ -278,30 +278,22 @@ class Note extends FlxSprite public function updateSustain(strum:Strum) { var scrollSpeed = strum.getScrollSpeed(this); - var len = 0.45 * CoolUtil.quantize(scrollSpeed, 100); - - if (nextSustain != null && lastScrollSpeed != scrollSpeed) { - // is long sustain + if (lastScrollSpeed != scrollSpeed) { lastScrollSpeed = scrollSpeed; - - scale.y = (sustainLength * len) / frameHeight; - updateHitbox(); - scale.y += gapFix / frameHeight; + if (nextSustain != null) { + scale.y = (sustainLength * 0.45 * scrollSpeed) / frameHeight; + updateHitbox(); + scale.y += gapFix / frameHeight; + } } - if (!wasGoodHit) return; - var t = FlxMath.bound((Conductor.songPosition - strumTime) / (height) * len, 0, 1); - var swagRect = this.clipRect == null ? new FlxRect() : this.clipRect; - swagRect.x = 0; - swagRect.y = t * frameHeight; - swagRect.width = frameWidth; - swagRect.height = frameHeight; - - setClipRect(swagRect); + updateSustainClip(); } - public inline function setClipRect(rect:FlxRect) { - this.clipRect = rect; + public function updateSustainClip() if (wasGoodHit) { + var t = FlxMath.bound((Conductor.songPosition - strumTime) / height * 0.45 * lastScrollSpeed, 0, 1); + var rect = clipRect == null ? FlxRect.get() : clipRect; + clipRect = rect.set(0, frameHeight * t, frameWidth, frameHeight * (1 - t)); } @:noCompletion @@ -317,5 +309,7 @@ class Note extends FlxSprite public override function destroy() { super.destroy(); + + clipRect = FlxDestroyUtil.put(clipRect); } } diff --git a/source/funkin/game/StrumLine.hx b/source/funkin/game/StrumLine.hx index 1b0780dd..7797ed12 100644 --- a/source/funkin/game/StrumLine.hx +++ b/source/funkin/game/StrumLine.hx @@ -189,7 +189,7 @@ class StrumLine extends FlxTypedGroup { if (cpu && __updateNote_event.__autoCPUHit && !daNote.avoid && !daNote.wasGoodHit && daNote.strumTime < __updateNote_songPos) PlayState.instance.goodNoteHit(this, daNote); - if (daNote.wasGoodHit && daNote.isSustainNote && daNote.strumTime + (daNote.sustainLength) < __updateNote_songPos) { + if (daNote.wasGoodHit && daNote.isSustainNote && daNote.strumTime + daNote.sustainLength < __updateNote_songPos) { deleteNote(daNote); return; } @@ -215,8 +215,9 @@ class StrumLine extends FlxTypedGroup { var __notePerStrum:Array = []; function __inputProcessPressed(note:Note) { - if (__pressed[note.strumID] && note.isSustainNote && note.canBeHit && !note.wasGoodHit) { + if (__pressed[note.strumID] && note.isSustainNote && note.strumTime < __updateNote_songPos && !note.wasGoodHit) { PlayState.instance.goodNoteHit(this, note); + note.updateSustainClip(); } } function __inputProcessJustPressed(note:Note) { From 8b05257ec561a0ed27137f7c555ac20700f06d25 Mon Sep 17 00:00:00 2001 From: TheZoroForce240 <86524550+TheZoroForce240@users.noreply.github.com> Date: Fri, 4 Jul 2025 18:35:54 +0100 Subject: [PATCH 07/16] fix loading stages with imported scripts outside of playstate (#678) --- source/funkin/game/Stage.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/game/Stage.hx b/source/funkin/game/Stage.hx index 9b3782ca..d2a52880 100644 --- a/source/funkin/game/Stage.hx +++ b/source/funkin/game/Stage.hx @@ -32,7 +32,7 @@ class Stage extends FlxBasic implements IBeatReceiver { for (k=>e in stageSprites) script.set(k, e); public function prepareInfos(node:Access) - return XMLImportedScriptInfo.prepareInfos(node, PlayState.instance.scripts, (infos) -> xmlImportedScripts.push(infos)); + return XMLImportedScriptInfo.prepareInfos(node, PlayState.instance != null ? PlayState.instance.scripts : null, (infos) -> xmlImportedScripts.push(infos)); public function new(stage:String, ?state:FlxState) { super(); From 6d18935388938d594502c26803d5bfd7be35152d Mon Sep 17 00:00:00 2001 From: Til <89487150+TechnikTil@users.noreply.github.com> Date: Fri, 4 Jul 2025 11:45:04 -0700 Subject: [PATCH 08/16] use `haxelib run lime` for compiling, so that lime from `cne setup` is used for compiling (#674) --- commandline/commands/Compiler.hx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/commandline/commands/Compiler.hx b/commandline/commands/Compiler.hx index fe64c198..2b8338bf 100644 --- a/commandline/commands/Compiler.hx +++ b/commandline/commands/Compiler.hx @@ -17,7 +17,10 @@ class Compiler { private static function __build(args:Array, arg:Array) { for(a in args) arg.push(a); - Sys.command("lime", arg); + + arg = ['run', 'lime'].concat(arg); + + Sys.command("haxelib", arg); } public static function getBuildTarget() { From bd79dd2e39bcb53dd44b3ea7d147853cc4abd738 Mon Sep 17 00:00:00 2001 From: ItsLJcool Date: Fri, 4 Jul 2025 12:51:54 -0700 Subject: [PATCH 09/16] Week6 pixel fix + more syntax cleanup (#662) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixed some issues with antialiasing not being set like wtf man why isn't it set do false in da code * oops i forgor i was testing smth lol * forcing the note sprites to be non aliased * fine lmao Co-authored-by: Til <89487150+TechnikTil@users.noreply.github.com> * my take * yes i will shut the fuck up now --------- Co-authored-by: Til <89487150+TechnikTil@users.noreply.github.com> Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com> --- assets/data/scripts/pixel.hx | 61 ++++++++--------- assets/data/scripts/week6-pause.hx | 84 ++++++++++-------------- assets/data/scripts/week7-balledLines.hx | 10 +-- assets/data/stages/tank.hx | 4 +- 4 files changed, 66 insertions(+), 93 deletions(-) diff --git a/assets/data/scripts/pixel.hx b/assets/data/scripts/pixel.hx index 1109f2dc..c428f16e 100644 --- a/assets/data/scripts/pixel.hx +++ b/assets/data/scripts/pixel.hx @@ -18,9 +18,7 @@ static var daPixelZoom = 6; * UI */ function onNoteCreation(event) { - if (event.note.strumLine == playerStrums && !pixelNotesForBF) return; - if (event.note.strumLine == cpuStrums && !pixelNotesForDad) return; - + if ((event.note.strumLine == playerStrums && !pixelNotesForBF) || (event.note.strumLine == cpuStrums && !pixelNotesForDad)) return; event.cancel(); var note = event.note; @@ -34,18 +32,14 @@ function onNoteCreation(event) { } note.scale.set(daPixelZoom, daPixelZoom); note.updateHitbox(); + note.antialiasing = false; } -function onPostNoteCreation(event) { - var splashes = event.note; - if (pixelSplashes) - splashes.splash = "pixel-default"; -} +function onPostNoteCreation(event) if (pixelSplashes) + event.note.splash = "pixel-default"; function onStrumCreation(event) { - if (event.player == 1 && !pixelNotesForBF) return; - if (event.player == 0 && !pixelNotesForDad) return; - + if ((event.player == 1 && !pixelNotesForBF) || (event.player == 0 && !pixelNotesForDad)) return; event.cancel(); var strum = event.strum; @@ -56,6 +50,7 @@ function onStrumCreation(event) { strum.scale.set(daPixelZoom, daPixelZoom); strum.updateHitbox(); + strum.antialiasing = false; } function onCountdown(event) { @@ -86,9 +81,9 @@ function onPlayerHit(event:NoteHitEvent) { * CAMERA HACKS!! */ function postCreate() { - if (enablePauseMenu) { + if (enablePauseMenu) PauseSubState.script = 'data/scripts/week6-pause'; - } + if (enableCameraHacks) { camGame.pixelPerfectRender = true; camGame.antialiasing = false; @@ -104,8 +99,8 @@ function postCreate() { } } -function onStartCountdown() { - /*var newNoteCamera = new HudCamera(); +/*function onStartCountdown() { + var newNoteCamera = new HudCamera(); newNoteCamera.bgColor = 0; // transparent FlxG.cameras.add(newNoteCamera, false); @@ -119,8 +114,8 @@ function onStartCountdown() { i++; } } - makeCameraPixely(newNoteCamera);*/ -} + makeCameraPixely(newNoteCamera); +}*/ /** * Use this to make any camera pixelly (you wont be able to zoom with it anymore!) @@ -145,33 +140,29 @@ function destroy() { FlxG.game.stage.quality = oldStageQuality; } -function pixelCam(cam) { +function pixelCam(cam) makeCameraPixely(cam); -} var pixellyCameras = []; var pixellyShaders = []; -function postUpdate(elapsed) { - for(e in pixellyCameras) { - if (Std.isOfType(e, HudCamera)) - e.downscroll = camHUD.downscroll; - } - if (enableCameraHacks) { - for(p in strumLines) - p.notes.forEach(function(n) { - if(n.isSustainNote) return; // hacky fix for hold - n.y -= n.y % daPixelZoom; - n.x -= n.x % daPixelZoom; - }); +function postUpdate() { + for (e in pixellyCameras) if (Std.isOfType(e, HudCamera)) + e.downscroll = camHUD.downscroll; + + if (enableCameraHacks) for (p in strumLines) { + p.notes.forEach(function(n) { + if(n.isSustainNote) return; // hacky fix for hold + n.y -= n.y % daPixelZoom; + n.x -= n.x % daPixelZoom; + }); } var zoom = 1 / daPixelZoom / Math.min(FlxG.scaleMode.scale.x, FlxG.scaleMode.scale.y); - for(e in pixellyCameras) { + for (e in pixellyCameras) { if (!e.exists) continue; e.zoom = zoom; } - for(e in pixellyShaders) { + for (e in pixellyShaders) e.pixelZoom = zoom; - } -} \ No newline at end of file +} diff --git a/assets/data/scripts/week6-pause.hx b/assets/data/scripts/week6-pause.hx index a80598ce..00cac24e 100644 --- a/assets/data/scripts/week6-pause.hx +++ b/assets/data/scripts/week6-pause.hx @@ -3,7 +3,7 @@ import flixel.text.FlxText; import flixel.text.FlxTextBorderStyle; import flixel.util.FlxAxes; -var pixelScript:Script; +var pixelScript:Script = game.scripts.getByName("pixel.hx"); var pauseCam = new FlxCamera(); var bg:FlxSprite; @@ -19,47 +19,40 @@ function create(event) { event.music = isThorns ? "pixel/LunchboxScary" : "pixel/Lunchbox"; - cameras = []; - - pixelScript = game.scripts.getByName("pixel.hx"); - pixelScript.call("pixelCam", [pauseCam]); + // allowing this pause script even if the pixel script is not loaded - Nex + pixelScript?.call("pixelCam", [pauseCam]); FlxG.cameras.add(pauseCam, false); + cameras = [pauseCam]; pauseCam.bgColor = isThorns ? 0x88000000 : 0x88FF99CC; pauseCam.alpha = 0; - bg = new FlxSprite(44 * 6, 14 * 6); - bg.loadGraphic(Paths.image('stages/school/pause/bg')); - if (isThorns) - bg.color = 0xFF000000; + bg = new FlxSprite(44 * 6, 14 * 6, Paths.image('stages/school/pause/bg')); + bg.antialiasing = false; + if (isThorns) bg.color = 0xFF000000; bg.scale.set(6, 6); bg.updateHitbox(); bg.scale.y = 4; - bg.cameras = [pauseCam]; add(bg); songText = new FlxText(0, 22 * 6, 0, "Pause", 8, false); confText(songText); add(songText); - var i = 2; - for(e in menuItems) { - text = new FlxText(0, (22 * 6) + (i * 9 * 6), 0, e, 8, false); + for (i=>e in menuItems) { + text = new FlxText(0, (22 * 6) + ((i+2) * 9 * 6), 0, e, 8, false); confText(text); - add(text); - texts.push(text); - i++; } hand = new FlxSprite().loadGraphic(Paths.image('stages/school/ui/hand_textbox')); + hand.antialiasing = false; hand.scale.set(6, 6); hand.updateHitbox(); add(hand); - FlxTween.tween(bg, {"scale.y": 6}, 0.75, {ease: FlxEase.elasticOut}); + FlxTween.tween(bg.scale, {y: 6}, 0.75, {ease: FlxEase.elasticOut}); - cameras = [pauseCam]; FlxG.sound.play(Paths.sound(isThorns ? 'pixel/ANGRY' : 'pixel/clickText')); } @@ -70,55 +63,50 @@ function confText(text) { text.screenCenter(FlxAxes.X); text.borderStyle = FlxTextBorderStyle.OUTLINE; if (!isThorns) text.borderColor = 0xFF953E3E; + + text.antialiasing = false; + texts.push(text); + add(text); } -function destroy() { - if(FlxG.cameras.list.contains(pauseCam)) - FlxG.cameras.remove(pauseCam); -} +function destroy() if (FlxG.cameras.list.contains(pauseCam)) + FlxG.cameras.remove(pauseCam); var canDoShit = true; var time:Float = 0; function update(elapsed) { - pixelScript.call("postUpdate", [elapsed]); + pixelScript?.call("postUpdate", [elapsed]); pauseCam.alpha = lerp(pauseCam.alpha, 1, 0.25); time += elapsed; - var curText = texts[curSelected]; + var curText = texts[curSelected + 1]; hand.setPosition(curText.x - hand.width - 18 + (Math.sin(time * Math.PI * 2) * 12), curText.y + (text.height - hand.height) - 6); hand.x -= hand.x % 6; hand.y -= hand.y % 6; - if (!canDoShit) return; - var 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) enterOption(); +} - if (controls.ACCEPT) { - FlxG.sound.play(Paths.sound(isThorns ? 'pixel/ANGRY' : 'pixel/clickText')); - var option = menuItems[curSelected]; - if (option == "Resume" || option == "Exit to menu") { +var scrollSFX = FlxG.sound.load(Paths.sound(isThorns ? 'pixel/type' : 'pixel/pixelText')); +function changeSelection(change) if (canDoShit) { // this overrides the function inside of the normal pause btw, so no event gets called - Nex + curSelected = FlxMath.wrap(curSelected + change, 0, menuItems.length - 1); + if (change != 0) scrollSFX.play(); +} + +var enterSFX = FlxG.sound.load(Paths.sound(isThorns ? 'pixel/ANGRY' : 'pixel/clickText')); +function enterOption() if (canDoShit) { + var option = menuItems[curSelected]; + enterSFX.play(); + + switch(option) { + case "Resume", "Exit to menu": canDoShit = false; for(t in texts) t.visible = false; hand.visible = songText.visible = false; - FlxTween.tween(bg, {"scale.y": 0}, 0.125, {ease: FlxEase.cubeOut, onComplete: function() { - selectOption(); - }}); - } else { - selectOption(); - } + FlxTween.tween(bg.scale, {y: 0}, 0.125, {ease: FlxEase.cubeOut, onComplete: selectOption}); + default: selectOption(); } } - -function changeSelection(change) { // this overrides the function inside of the normal pause btw, so no event gets called - Nex - curSelected += change; - - if (curSelected < 0) - curSelected = menuItems.length - 1; - if (curSelected >= menuItems.length) - curSelected = 0; -} \ No newline at end of file diff --git a/assets/data/scripts/week7-balledLines.hx b/assets/data/scripts/week7-balledLines.hx index 677d3791..d6049a48 100644 --- a/assets/data/scripts/week7-balledLines.hx +++ b/assets/data/scripts/week7-balledLines.hx @@ -3,13 +3,7 @@ var sound:Sound; function create() sound = Paths.sound('jeffGameover/jeffGameover-' + FlxG.random.int(1, 25, !Options.naughtyness ? [1, 3, 8, 13, 17, 21] : null)); -function beatHit(cur:Int) { - if(cur != 0) return; - +function beatHit(cur:Int) if (cur == 0) { + FlxG.sound.play(sound, 1, false, null, true, () -> if (!isEnding) FlxG.sound.music.fadeIn(4, 0.2, 1)); FlxG.sound.music.volume = 0.2; - FlxG.sound.play(sound, 1, false, null, true, function() - { - if (!isEnding) - FlxG.sound.music.fadeIn(4, 0.2, 1); - }); } \ No newline at end of file diff --git a/assets/data/stages/tank.hx b/assets/data/stages/tank.hx index 03e213c6..e74b04d9 100644 --- a/assets/data/stages/tank.hx +++ b/assets/data/stages/tank.hx @@ -1,7 +1,7 @@ var tankAngle:Float = FlxG.random.int(-90, 45); var tankSpeed:Float = FlxG.random.float(5, 7); -function postCreate() if(PlayState.isStoryMode) +function postCreate() if (PlayState.isStoryMode) GameOverSubstate.script = 'data/scripts/week7-balledLines'; function update(elapsed:Float) { @@ -12,7 +12,7 @@ function update(elapsed:Float) { } function onPostCountdown(event) { - if(!playCutscenes || event.sprite == null) return; + if (!playCutscenes || event.sprite == null) return; var lastIndex:Int = members.indexOf(event.sprite); remove(event.sprite); insert(lastIndex + 4, event.sprite); From 7a8f1f0dedff7d99e81599feb01ff2f580509a6b Mon Sep 17 00:00:00 2001 From: "Nebula S. Nova" <78160470+NebulaStellaNova@users.noreply.github.com> Date: Fri, 4 Jul 2025 19:06:57 -0400 Subject: [PATCH 10/16] Update FreeplayState.hx (#669) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update FreeplayState.hx * should be good * pretty print the color --------- Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com> --- source/funkin/backend/chart/Chart.hx | 26 ++++++++++--------- source/funkin/backend/chart/ChartData.hx | 5 +--- source/funkin/editors/charter/Charter.hx | 4 +-- .../editors/charter/CharterMetaDataScreen.hx | 5 ++-- .../editors/charter/CharterSelection.hx | 19 +++++++------- .../editors/charter/SongCreationScreen.hx | 3 +-- source/funkin/menus/FreeplayState.hx | 4 +-- 7 files changed, 32 insertions(+), 34 deletions(-) diff --git a/source/funkin/backend/chart/Chart.hx b/source/funkin/backend/chart/Chart.hx index 15f732ca..d7bbed6d 100644 --- a/source/funkin/backend/chart/Chart.hx +++ b/source/funkin/backend/chart/Chart.hx @@ -96,8 +96,11 @@ class Chart { var fromMods:Bool = fromMods; for (path in [metaDiffPath, metaPath]) if (Assets.exists(path)) { fromMods = Paths.assetsTree.existsSpecific(path, "TEXT", MODS); - try data = Json.parse(Assets.getText(path)) - catch(e) Logs.trace('Failed to load song metadata for ${songName} ($path): ${Std.string(e)}', ERROR); + try { + var tempData = Json.parse(Assets.getText(path)); + tempData.color = CoolUtil.getColorFromDynamic(tempData.color).getDefault(defaultColor); + data = tempData; + } catch(e) Logs.trace('Failed to load song metadata for ${songName} ($path): ${Std.string(e)}', ERROR); if (data != null) break; } @@ -115,7 +118,6 @@ class Chart { data.setFieldDefault("coopAllowed", false); data.setFieldDefault("opponentModeAllowed", false); data.setFieldDefault("displayName", data.name); - data.setFieldDefault("parsedColor", data.color.getColorFromDynamic().getDefault(defaultColor)); if (data.difficulties.length <= 0) { data.difficulties = [for(f in Paths.getFolderContent('songs/${songNameLower}/charts/', false, !fromMods)) if (Path.extension(f = f.toUpperCase()) == "JSON") Path.withoutExtension(f)]; @@ -257,33 +259,33 @@ class Chart { CoolUtil.safeSaveFile(chartPath, Json.stringify(filteredChart, null, saveSettings.prettyPrint == true ? "\t" : null)); - // idk how null reacts to it so better be sure if (saveSettings.overrideExistingMeta == true || !FileSystem.exists(metaPath)) - CoolUtil.safeSaveFile(metaPath, Json.stringify(meta, null, saveSettings.prettyPrint == true ? "\t" : null)); + CoolUtil.safeSaveFile(metaPath, makeMetaSaveable(meta)); #end return filteredChart; } public static function filterChartForSaving(chart:ChartData, ?saveMetaInChart:Null, ?saveEventsInChart:Null):ChartData { var data = Reflect.copy(chart); // make a copy of the chart to leave the OG intact - if (saveMetaInChart != true) { - data.meta = null; - } else { - data.meta = Reflect.copy(chart.meta); // also make a copy of the metadata to leave the OG intact. - if(data.meta != null && Reflect.hasField(data.meta, "parsedColor")) Reflect.deleteField(data.meta, "parsedColor"); - } + data.meta = saveMetaInChart != true ? null : data.meta = Reflect.copy(chart.meta); // also make a copy of the metadata to leave the OG intact. data.events = saveEventsInChart != true ? null : Reflect.copy(chart.events); // same here once again data.fromMods = null; var sortedData:Dynamic = {}; - for(f in Reflect.fields(data)) { + for (f in Reflect.fields(data)) { var v = Reflect.field(data, f); if (v != null) Reflect.setField(sortedData, f, v); } return sortedData; } + + public static inline function makeMetaSaveable(meta:ChartMetaData, prettyPrint:Bool = true):String { + var data:Dynamic = Reflect.copy(meta); + if (data.color != null) data.color = new FlxColor(data.color).toWebString(); // dont even ask me - Nex + return Json.stringify(data, null, prettyPrint ? "\t" : null); + } } typedef ChartSaveSettings = { diff --git a/source/funkin/backend/chart/ChartData.hx b/source/funkin/backend/chart/ChartData.hx index c46164f5..bc69d4bd 100644 --- a/source/funkin/backend/chart/ChartData.hx +++ b/source/funkin/backend/chart/ChartData.hx @@ -22,14 +22,11 @@ typedef ChartMetaData = { public var ?stepsPerBeat:Float; public var ?needsVoices:Bool; public var ?icon:String; - public var ?color:Dynamic; + public var ?color:FlxColor; public var ?difficulties:Array; public var ?coopAllowed:Bool; public var ?opponentModeAllowed:Bool; public var ?customValues:Dynamic; - - // NOT TO BE EXPORTED - public var ?parsedColor:FlxColor; } typedef ChartStrumLine = { diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index daf7aad2..83985370 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -1338,7 +1338,7 @@ class Charter extends UIState { #if sys CoolUtil.safeSaveFile( '${Paths.getAssetsRoot()}/songs/${__song.toLowerCase()}/meta.json', - Json.stringify(PlayState.SONG.meta == null ? {} : PlayState.SONG.meta, null, "\t") + PlayState.SONG.meta == null ? null : Chart.makeMetaSaveable(PlayState.SONG.meta) ); #else _file_meta_saveas(_); @@ -1346,7 +1346,7 @@ class Charter extends UIState { } function _file_meta_saveas(_) { - openSubState(new SaveSubstate(Json.stringify(PlayState.SONG.meta == null ? {} : PlayState.SONG.meta, null, "\t"), { // always pretty print meta + openSubState(new SaveSubstate(PlayState.SONG.meta == null ? null : Chart.makeMetaSaveable(PlayState.SONG.meta), { // always pretty print meta defaultSaveFile: 'meta.json' })); } diff --git a/source/funkin/editors/charter/CharterMetaDataScreen.hx b/source/funkin/editors/charter/CharterMetaDataScreen.hx index e58898c0..ddb7e322 100644 --- a/source/funkin/editors/charter/CharterMetaDataScreen.hx +++ b/source/funkin/editors/charter/CharterMetaDataScreen.hx @@ -91,7 +91,7 @@ class CharterMetaDataScreen extends UISubstateWindow { coopAllowedCheckbox = new UICheckbox(opponentModeCheckbox.x + 150 + 26, opponentModeCheckbox.y, "Co-op Mode", metadata.coopAllowed); add(coopAllowedCheckbox); - colorWheel = new UIColorwheel(iconTextBox.x, coopAllowedCheckbox.y, metadata.parsedColor); + colorWheel = new UIColorwheel(iconTextBox.x, coopAllowedCheckbox.y, metadata.color); add(colorWheel); addLabelOn(colorWheel, "Color"); @@ -158,8 +158,7 @@ class CharterMetaDataScreen extends UISubstateWindow { needsVoices: needsVoicesCheckbox.checked, displayName: displayNameTextBox.label.text, icon: iconTextBox.label.text, - color: colorWheel.curColorString, - parsedColor: colorWheel.curColor, + color: colorWheel.curColor, opponentModeAllowed: opponentModeCheckbox.checked, coopAllowed: coopAllowedCheckbox.checked, difficulties: [for (diff in difficulitesTextBox.label.text.split(",")) diff.trim()], diff --git a/source/funkin/editors/charter/CharterSelection.hx b/source/funkin/editors/charter/CharterSelection.hx index 6fd97bdc..e630c931 100644 --- a/source/funkin/editors/charter/CharterSelection.hx +++ b/source/funkin/editors/charter/CharterSelection.hx @@ -1,15 +1,16 @@ package funkin.editors.charter; -import funkin.backend.chart.ChartData; +import funkin.backend.chart.Chart; import funkin.backend.chart.ChartData.ChartMetaData; -import haxe.Json; -import funkin.editors.charter.SongCreationScreen.SongCreationData; -import funkin.options.type.NewOption; +import funkin.backend.chart.ChartData; import funkin.backend.system.framerate.Framerate; -import funkin.menus.FreeplayState.FreeplaySonglist; import funkin.editors.EditorTreeMenu; +import funkin.editors.charter.SongCreationScreen.SongCreationData; +import funkin.menus.FreeplayState.FreeplaySonglist; import funkin.options.*; import funkin.options.type.*; +import funkin.options.type.NewOption; +import haxe.Json; using StringTools; @@ -38,7 +39,7 @@ class CharterSelection extends EditorTreeMenu { FlxG.state.openSubState(new ChartCreationScreen(saveChart)); })); optionsTree.add(new OptionsScreen(s.name, "Select a difficulty to continue.", list)); - }, s.parsedColor.getDefault(0xFFFFFFFF)) + }, s.color.getDefault(0xFFFFFFFF)) ]; list.insert(0, new NewOption("New Song", "New Song", function() { @@ -109,7 +110,7 @@ class CharterSelection extends EditorTreeMenu { sys.FileSystem.createDirectory('$songFolder/charts'); // Save Files - CoolUtil.safeSaveFile('$songFolder/meta.json', Json.stringify(creation.meta, "\t")); + CoolUtil.safeSaveFile('$songFolder/meta.json', Chart.makeMetaSaveable(creation.meta)); if (creation.instBytes != null) sys.io.File.saveBytes('$songFolder/song/Inst.${Paths.SOUND_EXT}', creation.instBytes); if (creation.voicesBytes != null) sys.io.File.saveBytes('$songFolder/song/Voices.${Paths.SOUND_EXT}', creation.voicesBytes); #end @@ -126,7 +127,7 @@ class CharterSelection extends EditorTreeMenu { FlxG.state.openSubState(new ChartCreationScreen(saveChart)); })); optionsTree.insert(1, new OptionsScreen(creation.meta.name, "Select a difficulty to continue.", list)); - }, creation.meta.parsedColor.getDefault(0xFFFFFFFF)); + }, creation.meta.color.getDefault(0xFFFFFFFF)); // Add to List freeplayList.songs.insert(0, creation.meta); @@ -160,7 +161,7 @@ class CharterSelection extends EditorTreeMenu { var meta = Json.parse(sys.io.File.getContent('$songFolder/meta.json')); if (meta.difficulties != null && !meta.difficulties.contains(name)) { meta.difficulties.push(name); - CoolUtil.safeSaveFile('$songFolder/meta.json', Json.stringify(meta)); + CoolUtil.safeSaveFile('$songFolder/meta.json', Chart.makeMetaSaveable(meta)); } } } \ No newline at end of file diff --git a/source/funkin/editors/charter/SongCreationScreen.hx b/source/funkin/editors/charter/SongCreationScreen.hx index 007c8f6c..d752f42d 100644 --- a/source/funkin/editors/charter/SongCreationScreen.hx +++ b/source/funkin/editors/charter/SongCreationScreen.hx @@ -254,8 +254,7 @@ class SongCreationScreen extends UISubstateWindow { needsVoices: needsVoicesCheckbox.checked, displayName: displayNameTextBox.label.text, icon: iconTextBox.label.text, - color: colorWheel.curColorString, - parsedColor: colorWheel.curColor, + color: colorWheel.curColor, opponentModeAllowed: opponentModeCheckbox.checked, coopAllowed: coopAllowedCheckbox.checked, difficulties: [for (diff in difficulitesTextBox.label.text.split(",")) diff.trim()], diff --git a/source/funkin/menus/FreeplayState.hx b/source/funkin/menus/FreeplayState.hx index fc56054a..2a7cf8f5 100644 --- a/source/funkin/menus/FreeplayState.hx +++ b/source/funkin/menus/FreeplayState.hx @@ -234,7 +234,7 @@ class FreeplayState extends MusicBeatState scoreText.x = coopText.x = scoreBG.x + 4; diffText.x = Std.int(scoreBG.x + ((scoreBG.width - diffText.width) / 2)); - interpColor.fpsLerpTo(songs[curSelected].parsedColor, 0.0625); + interpColor.fpsLerpTo(songs[curSelected].color, 0.0625); bg.color = interpColor.color; #if PRELOAD_ALL @@ -456,4 +456,4 @@ class FreeplaySonglist { return songList; } -} \ No newline at end of file +} From 07ae6b643c573e300bb4ed64546389def02fcd12 Mon Sep 17 00:00:00 2001 From: ItsLJcool Date: Fri, 4 Jul 2025 16:46:42 -0700 Subject: [PATCH 11/16] FINALLY fixed the issue with GlobalState blowing up when pressing F5. (#666) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * peak is happening RED * oops * oops x2 forgot I left a trace when loading up global.hx from `Assets` lol * **State / SubState reloading broken rn but pushing changes to see if anyone can fix** * Human... I remember you disabling reloading substates cuz it broke... * forgor to edit assets global.hx * lemme see * kk * opa --------- Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com> --- assets/data/global.hx | 3 -- assets/songs/stress/cutscene.hx | 2 - source/funkin/backend/MusicBeatState.hx | 20 +++++----- source/funkin/backend/MusicBeatSubstate.hx | 16 ++++---- .../funkin/backend/scripting/GlobalScript.hx | 39 +++++++++++++------ source/funkin/backend/scripting/ScriptPack.hx | 2 +- source/funkin/backend/system/Controls.hx | 23 +++++++++++ source/funkin/game/PlayState.hx | 12 +----- source/funkin/options/Options.hx | 39 ++++++++++++++++--- .../options/keybinds/KeybindsOptions.hx | 9 +++++ 10 files changed, 115 insertions(+), 50 deletions(-) delete mode 100644 assets/data/global.hx diff --git a/assets/data/global.hx b/assets/data/global.hx deleted file mode 100644 index 4c49ef69..00000000 --- a/assets/data/global.hx +++ /dev/null @@ -1,3 +0,0 @@ -// -function update(elapsed:Float) - if (FlxG.keys.justPressed.F5) FlxG.resetState(); \ No newline at end of file diff --git a/assets/songs/stress/cutscene.hx b/assets/songs/stress/cutscene.hx index dd55a3da..7684f8b1 100644 --- a/assets/songs/stress/cutscene.hx +++ b/assets/songs/stress/cutscene.hx @@ -59,8 +59,6 @@ function create() { } function update(elapsed) { - if (FlxG.keys.justPressed.F5) - FlxG.resetState(); switch(step) { case 0: lipSync(tankman, 0, 16750); diff --git a/source/funkin/backend/MusicBeatState.hx b/source/funkin/backend/MusicBeatState.hx index 6ef650bc..cfb632ff 100644 --- a/source/funkin/backend/MusicBeatState.hx +++ b/source/funkin/backend/MusicBeatState.hx @@ -101,6 +101,8 @@ class MusicBeatState extends FlxState implements IBeatReceiver public static var skipTransOut:Bool = false; public static var skipTransIn:Bool = false; + public static var ALLOW_DEBUG_RELOAD:Bool = true; + inline function get_controls():Controls return PlayerSettings.solo.controls; inline function get_controlsP1():Controls @@ -147,16 +149,20 @@ class MusicBeatState extends FlxState implements IBeatReceiver call("postUpdate", [elapsed]); } - if (_requestSubStateReset) - { + if (_requestSubStateReset) { _requestSubStateReset = false; resetSubState(); } - if (subState != null) - { - subState.tryUpdate(elapsed); + + if (/*subState == null && */(ALLOW_DEBUG_RELOAD && controls.DEBUG_RELOAD)) { + Logs.trace("Reloading Current State...", INFO, YELLOW); + FlxG.resetState(); } + + if (subState != null) + subState.tryUpdate(elapsed); } + override function create() { loadScript(); @@ -189,10 +195,6 @@ class MusicBeatState extends FlxState implements IBeatReceiver override function update(elapsed:Float) { - // TODO: DEBUG MODE!! - if (FlxG.keys.justPressed.F5) { - loadScript(); - } call("update", [elapsed]); super.update(elapsed); diff --git a/source/funkin/backend/MusicBeatSubstate.hx b/source/funkin/backend/MusicBeatSubstate.hx index e2bbb312..4a4d3de8 100644 --- a/source/funkin/backend/MusicBeatSubstate.hx +++ b/source/funkin/backend/MusicBeatSubstate.hx @@ -126,15 +126,19 @@ class MusicBeatSubstate extends FlxSubState implements IBeatReceiver call("postUpdate", [elapsed]); } - if (_requestSubStateReset) - { + // if (subState == null && (MusicBeatState.ALLOW_DEBUG_RELOAD && controls.DEBUG_RELOAD)) { + // Logs.trace("Reloading Current SubState...", INFO, YELLOW); + // var test = Type.createInstance(Type.getClass(this), [this.scriptsAllowed, this.scriptName]); + // parent.openSubState(test); + // } + + if (_requestSubStateReset) { _requestSubStateReset = false; resetSubState(); } + if (subState != null) - { subState.tryUpdate(elapsed); - } } override function close() { @@ -171,10 +175,6 @@ class MusicBeatSubstate extends FlxSubState implements IBeatReceiver override function update(elapsed:Float) { - // TODO: DEBUG MODE!! - if (FlxG.keys.justPressed.F5) { - loadScript(); - } call("update", [elapsed]); super.update(elapsed); } diff --git a/source/funkin/backend/scripting/GlobalScript.hx b/source/funkin/backend/scripting/GlobalScript.hx index 5c037aec..a4dca576 100644 --- a/source/funkin/backend/scripting/GlobalScript.hx +++ b/source/funkin/backend/scripting/GlobalScript.hx @@ -11,6 +11,9 @@ import funkin.backend.assets.ModsFolder; class GlobalScript { public static var scripts:ScriptPack; + private static var reloading:Bool = false; + private static var _lastAllow_Reload:Bool = false; + public static function init() { #if MOD_SUPPORT ModsFolder.onModSwitch.add(onModSwitch); @@ -42,16 +45,12 @@ class GlobalScript { }); FlxG.signals.postUpdate.add(function() { call("postUpdate", [FlxG.elapsed]); - if (FlxG.keys.justPressed.F5) { - if (scripts.scripts.length > 0) { - Logs.trace('Reloading global script...', WARNING, YELLOW); - scripts.reload(); - Logs.trace('Global script successfully reloaded.', WARNING, GREEN); - } else { - Logs.trace('Loading global script...', WARNING, YELLOW); - onModSwitch(#if MOD_SUPPORT ModsFolder.currentModFolder #else null #end); - } + + if (reloading) { + reloading = false; + MusicBeatState.ALLOW_DEBUG_RELOAD = _lastAllow_Reload; } + if (FlxG.keys.justPressed.F2) NativeAPI.allocConsole(); }); @@ -70,12 +69,29 @@ class GlobalScript { FlxG.signals.preStateSwitch.add(function() { call("preStateSwitch", []); }); + FlxG.signals.preUpdate.add(function() { call("preUpdate", [FlxG.elapsed]); call("update", [FlxG.elapsed]); - }); - onModSwitch(#if MOD_SUPPORT ModsFolder.currentModFolder #else null #end); + if (FlxG.keys.pressed.SHIFT) { + var resetKey = FlxG.keys.justPressed.F5; // we default the key to F5, but really this shouldn't matter, as every state will be at minimum a MusicBeatState. + if ((FlxG.state is MusicBeatState)) resetKey = cast(FlxG.state, MusicBeatState).controls.DEBUG_RELOAD; + + // If we want, we could just make reseting GlobalScript it's own keybind, but for now this works. + if (resetKey) { + reloading = true; + Logs.trace("Reloading Global Scripts...", INFO, YELLOW); + + // yeah its a bit messy, sorry. This just prevents actually reloading the actual state. + _lastAllow_Reload = MusicBeatState.ALLOW_DEBUG_RELOAD; + MusicBeatState.ALLOW_DEBUG_RELOAD = false; + + // Would be better to just re-initalize GlobalScript so there aren't any lose ends. + onModSwitch(#if MOD_SUPPORT ModsFolder.currentModFolder #else null #end); + } + } + }); } public static function event(name:String, event:T):T { @@ -88,6 +104,7 @@ class GlobalScript { if (scripts != null) scripts.call(name, args); } + public static function onModSwitch(newMod:String) { call("destroy"); scripts = FlxDestroyUtil.destroy(scripts); diff --git a/source/funkin/backend/scripting/ScriptPack.hx b/source/funkin/backend/scripting/ScriptPack.hx index 32c590fc..30107746 100644 --- a/source/funkin/backend/scripting/ScriptPack.hx +++ b/source/funkin/backend/scripting/ScriptPack.hx @@ -53,7 +53,7 @@ class ScriptPack extends Script { public override function call(func:String, ?parameters:Array):Dynamic { for(e in scripts) - if(e.active) + if (e.active) e.call(func, parameters); return null; } diff --git a/source/funkin/backend/system/Controls.hx b/source/funkin/backend/system/Controls.hx index a09da1c7..113ded8b 100644 --- a/source/funkin/backend/system/Controls.hx +++ b/source/funkin/backend/system/Controls.hx @@ -44,6 +44,9 @@ enum abstract Action(String) to String from String { var RESET = "reset"; var CHEAT = "cheat"; var SWITCHMOD = "switchmod"; + + // Debugs + var DEBUG_RELOAD = "debug-reload"; } enum Device @@ -73,6 +76,9 @@ enum Control PAUSE; CHEAT; SWITCHMOD; + + // Debugs + DEBUG_RELOAD; } enum KeyboardScheme @@ -122,6 +128,8 @@ class Controls extends FlxActionSet var _reset = new FlxActionDigital(Action.RESET); var _cheat = new FlxActionDigital(Action.CHEAT); var _switchMod = new FlxActionDigital(Action.SWITCHMOD); + + var debug_reload = new FlxActionDigital(Action.DEBUG_RELOAD); #if (haxe >= "4.0.0") var byName:Map = []; @@ -372,6 +380,14 @@ class Controls extends FlxActionSet inline function set_SWITCHMOD(val) return @:privateAccess _switchMod._checked = val; + public var DEBUG_RELOAD(get, set):Bool; + + inline function get_DEBUG_RELOAD() + return debug_reload.check(); + + inline function set_DEBUG_RELOAD(val) + return @:privateAccess debug_reload._checked = val; + public function new(name, scheme = None) { super(name); @@ -408,6 +424,7 @@ class Controls extends FlxActionSet add(_reset); add(_cheat); add(_switchMod); + add(debug_reload); for (action in digitalActions) byName[action.name] = action; @@ -469,6 +486,7 @@ class Controls extends FlxActionSet case RESET: _reset; case CHEAT: _cheat; case SWITCHMOD: _switchMod; + case DEBUG_RELOAD: debug_reload; } } @@ -532,6 +550,8 @@ class Controls extends FlxActionSet func(_cheat, JUST_PRESSED); case SWITCHMOD: func(_switchMod, JUST_PRESSED); + case DEBUG_RELOAD: + func(debug_reload, JUST_PRESSED); } } @@ -687,6 +707,7 @@ class Controls extends FlxActionSet inline bindKeys(Control.PAUSE, Options.SOLO_PAUSE); inline bindKeys(Control.RESET, Options.SOLO_RESET); inline bindKeys(Control.SWITCHMOD, Options.SOLO_SWITCHMOD); + inline bindKeys(Control.DEBUG_RELOAD, Options.SOLO_DEBUG_RELOAD); case Duo(true): inline bindKeys(Control.UP, Options.P1_UP); inline bindKeys(Control.DOWN, Options.P1_DOWN); @@ -701,6 +722,7 @@ class Controls extends FlxActionSet inline bindKeys(Control.PAUSE, Options.P1_PAUSE); inline bindKeys(Control.RESET, Options.P1_RESET); inline bindKeys(Control.SWITCHMOD, Options.P1_SWITCHMOD); + inline bindKeys(Control.DEBUG_RELOAD, Options.P1_DEBUG_RELOAD); case Duo(false): inline bindKeys(Control.UP, Options.P2_UP); inline bindKeys(Control.DOWN, Options.P2_DOWN); @@ -715,6 +737,7 @@ class Controls extends FlxActionSet inline bindKeys(Control.PAUSE, Options.P2_PAUSE); inline bindKeys(Control.RESET, Options.P2_RESET); inline bindKeys(Control.SWITCHMOD, Options.P2_SWITCHMOD); + inline bindKeys(Control.DEBUG_RELOAD, Options.P2_DEBUG_RELOAD); case None: // nothing case Custom: // nothing } diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index bff696ce..3d416095 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1266,16 +1266,8 @@ class PlayState extends MusicBeatState if (updateRatingStuff != null) updateRatingStuff(); - if (canAccessDebugMenus) { - if (chartingMode && FlxG.keys.justPressed.SEVEN) { - FlxG.switchState(new funkin.editors.charter.Charter(SONG.meta.name, difficulty, false)); - } - if (FlxG.keys.justPressed.F5) { - Logs.trace('Reloading scripts...', WARNING, YELLOW); - scripts.reload(); - Logs.trace('Song scripts successfully reloaded.', WARNING, GREEN); - } - } + if (canAccessDebugMenus && chartingMode && FlxG.keys.justPressed.SEVEN) + FlxG.switchState(new funkin.editors.charter.Charter(SONG.meta.name, difficulty, false)); if (doIconBop) for (icon in iconArray) diff --git a/source/funkin/options/Options.hx b/source/funkin/options/Options.hx index a9bf72ac..a191c2ad 100644 --- a/source/funkin/options/Options.hx +++ b/source/funkin/options/Options.hx @@ -69,12 +69,16 @@ class Options public static var charterAutoSavesSeperateFolder:Bool = false; /** - * PLAYER 1 CONTROLS - */ + * PLAYER 1 CONTROLS + */ + + // Notes public static var P1_NOTE_LEFT:Array = [A]; public static var P1_NOTE_DOWN:Array = [S]; public static var P1_NOTE_UP:Array = [W]; public static var P1_NOTE_RIGHT:Array = [D]; + + // Menus public static var P1_LEFT:Array = [A]; public static var P1_DOWN:Array = [S]; public static var P1_UP:Array = [W]; @@ -82,16 +86,25 @@ class Options public static var P1_ACCEPT:Array = [ENTER]; public static var P1_BACK:Array = [BACKSPACE]; public static var P1_PAUSE:Array = [ENTER]; + + // Misc public static var P1_RESET:Array = [R]; public static var P1_SWITCHMOD:Array = [TAB]; + + // Debugs + public static var P1_DEBUG_RELOAD:Array = [F5]; /** - * PLAYER 2 CONTROLS (ALT) - */ + * PLAYER 2 CONTROLS (ALT) + */ + + // Notes public static var P2_NOTE_LEFT:Array = [LEFT]; public static var P2_NOTE_DOWN:Array = [DOWN]; public static var P2_NOTE_UP:Array = [UP]; public static var P2_NOTE_RIGHT:Array = [RIGHT]; + + // Menus public static var P2_LEFT:Array = [LEFT]; public static var P2_DOWN:Array = [DOWN]; public static var P2_UP:Array = [UP]; @@ -99,16 +112,25 @@ class Options public static var P2_ACCEPT:Array = [SPACE]; public static var P2_BACK:Array = [ESCAPE]; public static var P2_PAUSE:Array = [ESCAPE]; + + // Misc public static var P2_RESET:Array = []; public static var P2_SWITCHMOD:Array = []; + + // Debugs + public static var P2_DEBUG_RELOAD:Array = []; /** - * SOLO GETTERS - */ + * SOLO GETTERS + */ + + // Notes public static var SOLO_NOTE_LEFT(get, null):Array; public static var SOLO_NOTE_DOWN(get, null):Array; public static var SOLO_NOTE_UP(get, null):Array; public static var SOLO_NOTE_RIGHT(get, null):Array; + + // Menus public static var SOLO_LEFT(get, null):Array; public static var SOLO_DOWN(get, null):Array; public static var SOLO_UP(get, null):Array; @@ -116,9 +138,14 @@ class Options public static var SOLO_ACCEPT(get, null):Array; public static var SOLO_BACK(get, null):Array; public static var SOLO_PAUSE(get, null):Array; + + // Misc public static var SOLO_RESET(get, null):Array; public static var SOLO_SWITCHMOD(get, null):Array; + // Debugs + public static var SOLO_DEBUG_RELOAD(get, null):Array; + public static function load() { if (__save == null) __save = new FlxSave(); __save.bind("options", "CodenameEngine"); diff --git a/source/funkin/options/keybinds/KeybindsOptions.hx b/source/funkin/options/keybinds/KeybindsOptions.hx index e4e7d26c..b7cb6bbb 100644 --- a/source/funkin/options/keybinds/KeybindsOptions.hx +++ b/source/funkin/options/keybinds/KeybindsOptions.hx @@ -74,6 +74,15 @@ class KeybindsOptions extends MusicBeatSubstate { control: 'SWITCHMOD' }, ] + }, + { + name: 'DEBUG', + settings: [ + { + name: 'Reload', + control: 'DEBUG_RELOAD' + }, + ] } ]; From 7a39947b7feb37adac684ac2b61623080eed914a Mon Sep 17 00:00:00 2001 From: Tedyes <159284708+Tedyes@users.noreply.github.com> Date: Sat, 5 Jul 2025 08:04:10 +0800 Subject: [PATCH 12/16] a little charter bugfixs and dont show strumlines locks if there no strumline in the chart (#664) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * dbssdbihsadibjsdainbi * g * a little charter fixs * Update README.md * ihateyou GitHub * there --------- Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com> --- source/funkin/editors/charter/Charter.hx | 7 +++++-- source/funkin/editors/charter/CharterStrumlineButton.hx | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 83985370..860ba63c 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -609,7 +609,7 @@ class Charter extends UIState { // Just for now until i add event stacking -lunar try {__relinkUndos();} catch (e) {Logs.trace('Failed to relink undos: ${Std.string(e)}', ERROR);} - + __applyPlaytestInfo(); } @@ -1282,8 +1282,11 @@ class Charter extends UIState { for(id=>str in strumLines.members) if (str != null) str.y = strumlineInfoBG.y; + strumlineAddButton.x = 0; strumlineAddButton.y = strumlineInfoBG.y; strumlineLockButton.y = strumlineInfoBG.y; + + strumlineLockButton.text.visible = strumlineLockButton.button.selectable = strumlineLockButton.button.visible = (strumLines.members.length != 0) ? true : false; } var zoom(default, set):Float = 0; @@ -1641,7 +1644,7 @@ class Charter extends UIState { t.icon = (Options.charterLowDetailWaveforms = !Options.charterLowDetailWaveforms) ? 1 : 0; for (shader in waveformHandler.waveShaders) shader.data.lowDetail.value = [Options.charterLowDetailWaveforms]; } - + inline function _snap_increasesnap(_) changequant(1); inline function _snap_decreasesnap(_) changequant(-1); inline function _snap_resetsnap(_) setquant(16); diff --git a/source/funkin/editors/charter/CharterStrumlineButton.hx b/source/funkin/editors/charter/CharterStrumlineButton.hx index c5619330..016f0eb2 100644 --- a/source/funkin/editors/charter/CharterStrumlineButton.hx +++ b/source/funkin/editors/charter/CharterStrumlineButton.hx @@ -58,8 +58,8 @@ class CharterStrumlineButton extends UISprite { super.update(elapsed); - UIState.state.updateSpriteRect(button); - if(UIState.state.curContextMenu == null && UIState.state.isOverlapping(button, button.__rect)) { + if (UIState.state.curContextMenu == null && UIState.state.isOverlapping(button, button.__rect) && button.visible) { + UIState.state.updateSpriteRect(button); buttonScale.set(0.95, 0.95); if (FlxG.mouse.justPressed && onClick != null) { onClick(); From 9d1392399bc51f831c9b37c6824714d1c5f68f34 Mon Sep 17 00:00:00 2001 From: Hero Date: Sat, 5 Jul 2025 03:13:30 +0300 Subject: [PATCH 13/16] Add noExtension flag to getFolderContent for cleaner Paths usage (#654) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * yeah * Revert "yeah" This reverts commit 5ab6ab8c7dcef1a1e31731f4543e9f110561ba0a. * idk wtf happend * Fixed Missing Curly Bracket * hi --------- Co-authored-by: Furo Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com> --- source/funkin/backend/assets/Paths.hx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/funkin/backend/assets/Paths.hx b/source/funkin/backend/assets/Paths.hx index a29d3909..771568e5 100644 --- a/source/funkin/backend/assets/Paths.hx +++ b/source/funkin/backend/assets/Paths.hx @@ -274,13 +274,13 @@ class Paths } return content; } - static public function getFolderContent(key:String, addPath:Bool = false, source:AssetsLibraryList.AssetSource = BOTH):Array { + static public function getFolderContent(key:String, addPath:Bool = false, source:AssetsLibraryList.AssetSource = BOTH, noExtension:Bool = false):Array { // designed to work both on windows and web if (!key.endsWith("/")) key += "/"; var content = assetsTree.getFiles('assets/$key', source); - if (addPath) { - for(k=>e in content) - content[k] = '$key$e'; + for (k => e in content) { + if (noExtension) e = Path.withoutExtension(e); + content[k] = addPath ? '$key$e' : e; } return content; /* @@ -363,4 +363,4 @@ class ScriptPathInfo { this.file = file; this.library = library; } -} \ No newline at end of file +} From e13486dec047bc05b4a48f407ad06cd4eabc2e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=8D=9A=7ENex?= <87421482+NexIsDumb@users.noreply.github.com> Date: Sat, 5 Jul 2025 02:15:35 +0200 Subject: [PATCH 14/16] WHAT THE FUCK IS THIS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I DIDNT NOTICE😭 --- source/funkin/editors/charter/Charter.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 860ba63c..995baaa0 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -1286,7 +1286,7 @@ class Charter extends UIState { strumlineAddButton.y = strumlineInfoBG.y; strumlineLockButton.y = strumlineInfoBG.y; - strumlineLockButton.text.visible = strumlineLockButton.button.selectable = strumlineLockButton.button.visible = (strumLines.members.length != 0) ? true : false; + strumlineLockButton.text.visible = strumlineLockButton.button.selectable = strumlineLockButton.button.visible = strumLines.members.length > 0; } var zoom(default, set):Float = 0; From b41602ff375e8ffdcf8d218ffe355ed40b87c39f Mon Sep 17 00:00:00 2001 From: Betopia <73242725+betpowo@users.noreply.github.com> Date: Fri, 4 Jul 2025 21:23:32 -0400 Subject: [PATCH 15/16] extend functionality in stages (#633) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * extend functionality in stages adds support for scroll(x/y), zoomfactor, and alpha to solids made in a stage xml . because Why not * better --------- Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com> --- source/funkin/backend/utils/XMLUtil.hx | 9 +++++---- source/funkin/game/Stage.hx | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/source/funkin/backend/utils/XMLUtil.hx b/source/funkin/backend/utils/XMLUtil.hx index a074f97d..237d382e 100644 --- a/source/funkin/backend/utils/XMLUtil.hx +++ b/source/funkin/backend/utils/XMLUtil.hx @@ -70,12 +70,13 @@ class XMLUtil { /** * Overrides a sprite based on a XML node. */ - public static function loadSpriteFromXML(spr:FunkinSprite, node:Access, parentFolder:String = "", defaultAnimType:XMLAnimType = BEAT):FunkinSprite { + public static function loadSpriteFromXML(spr:FunkinSprite, node:Access, parentFolder:String = "", defaultAnimType:XMLAnimType = BEAT, loadGraphic:Bool = true):FunkinSprite { if (parentFolder == null) parentFolder = ""; spr.name = node.getAtt("name"); spr.antialiasing = true; - spr.loadSprite(Paths.image('$parentFolder${node.getAtt("sprite").getDefault(spr.name)}', null, true)); + if (loadGraphic) + spr.loadSprite(Paths.image('$parentFolder${node.getAtt("sprite").getDefault(spr.name)}', null, true)); spr.spriteAnimType = defaultAnimType; if (node.has.type) { @@ -185,10 +186,10 @@ class XMLUtil { /** * Creates a new sprite based on a XML node. */ - public static inline function createSpriteFromXML(node:Access, parentFolder:String = "", defaultAnimType:XMLAnimType = BEAT, ?cl:Class, ?args:Array):FunkinSprite { + public static inline function createSpriteFromXML(node:Access, parentFolder:String = "", defaultAnimType:XMLAnimType = BEAT, ?cl:Class, ?args:Array, loadGraphic:Bool = true):FunkinSprite { if(cl == null) cl = FunkinSprite; if(args == null) args = []; - return loadSpriteFromXML(Type.createInstance(cl, args), node, parentFolder, defaultAnimType); + return loadSpriteFromXML(Type.createInstance(cl, args), node, parentFolder, defaultAnimType, loadGraphic); } public static function extractAnimFromXML(anim:Access, animType:XMLAnimType = NONE, loop:Bool = false):AnimData { diff --git a/source/funkin/game/Stage.hx b/source/funkin/game/Stage.hx index d2a52880..2ec902b2 100644 --- a/source/funkin/game/Stage.hx +++ b/source/funkin/game/Stage.hx @@ -93,17 +93,28 @@ class Stage extends FlxBasic implements IBeatReceiver { case "box" | "solid": if (!node.has.name || !node.has.width || !node.has.height) continue; - var spr = new FlxSprite( + var spr = new FunkinSprite( (node.has.x) ? Std.parseFloat(node.att.x).getDefault(0) : 0, (node.has.y) ? Std.parseFloat(node.att.y).getDefault(0) : 0 ); - (node.name == "solid" ? spr.makeSolid : spr.makeGraphic)( + // just to make sure, its better to apply these before it gets inside of xmlUtil (because of mainly updateHitbox i guess), so im removing them before it gets passed - Nex + var toRemove = ["x", "y", "width", "height", "color"]; + var isSolid = node.name == "solid"; + + (isSolid ? spr.makeSolid : spr.makeGraphic)( Std.parseInt(node.att.width), Std.parseInt(node.att.height), (node.has.color) ? CoolUtil.getColorFromDynamic(node.att.color) : -1 ); + if (isSolid) toRemove.push("updateHitbox"); // makesolid already calls updateHitbox - Nex + for (a in toRemove) node.x.remove(a); + XMLUtil.loadSpriteFromXML(spr, node, "", NONE, false); + + if (!node.has.zoomfactor && PlayState.instance != null) + spr.initialZoom = PlayState.instance.defaultCamZoom; + stageSprites.set(node.getAtt("name"), spr); state.add(spr); spr; @@ -318,4 +329,4 @@ typedef StageCharPosInfo = { var y:Float; var flip:Bool; var scroll:Float; -} \ No newline at end of file +} From 1995c7ff93db57de5277425b5764ba1800008447 Mon Sep 17 00:00:00 2001 From: Til <89487150+TechnikTil@users.noreply.github.com> Date: Fri, 4 Jul 2025 18:44:42 -0700 Subject: [PATCH 16/16] [ENHANCEMENT] Add Volume Keys to Controls (#518) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add ze volume keys B) * e * better --------- Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com> --- source/funkin/options/Options.hx | 21 +++++++++++++++---- .../options/keybinds/KeybindsOptions.hx | 21 +++++++++++++++++++ 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/source/funkin/options/Options.hx b/source/funkin/options/Options.hx index a191c2ad..f01e4f10 100644 --- a/source/funkin/options/Options.hx +++ b/source/funkin/options/Options.hx @@ -71,7 +71,7 @@ class Options /** * PLAYER 1 CONTROLS */ - + // Notes public static var P1_NOTE_LEFT:Array = [A]; public static var P1_NOTE_DOWN:Array = [S]; @@ -90,7 +90,10 @@ class Options // Misc public static var P1_RESET:Array = [R]; public static var P1_SWITCHMOD:Array = [TAB]; - + public static var P1_VOLUME_UP:Array = []; + public static var P1_VOLUME_DOWN:Array = []; + public static var P1_VOLUME_MUTE:Array = []; + // Debugs public static var P1_DEBUG_RELOAD:Array = [F5]; @@ -116,14 +119,17 @@ class Options // Misc public static var P2_RESET:Array = []; public static var P2_SWITCHMOD:Array = []; - + public static var P2_VOLUME_UP:Array = [NUMPADPLUS]; + public static var P2_VOLUME_DOWN:Array = [NUMPADMINUS]; + public static var P2_VOLUME_MUTE:Array = [NUMPADZERO]; + // Debugs public static var P2_DEBUG_RELOAD:Array = []; /** * SOLO GETTERS */ - + // Notes public static var SOLO_NOTE_LEFT(get, null):Array; public static var SOLO_NOTE_DOWN(get, null):Array; @@ -142,6 +148,9 @@ class Options // Misc public static var SOLO_RESET(get, null):Array; public static var SOLO_SWITCHMOD(get, null):Array; + public static var SOLO_VOLUME_UP(get, null):Array; + public static var SOLO_VOLUME_DOWN(get, null):Array; + public static var SOLO_VOLUME_MUTE(get, null):Array; // Debugs public static var SOLO_DEBUG_RELOAD(get, null):Array; @@ -173,6 +182,10 @@ class Options PlayerSettings.solo.setKeyboardScheme(Solo); PlayerSettings.player1.setKeyboardScheme(Duo(true)); PlayerSettings.player2.setKeyboardScheme(Duo(false)); + + FlxG.sound.volumeUpKeys = SOLO_VOLUME_UP; + FlxG.sound.volumeDownKeys = SOLO_VOLUME_DOWN; + FlxG.sound.muteKeys = SOLO_VOLUME_MUTE; } public static function save() { diff --git a/source/funkin/options/keybinds/KeybindsOptions.hx b/source/funkin/options/keybinds/KeybindsOptions.hx index b7cb6bbb..621143d4 100644 --- a/source/funkin/options/keybinds/KeybindsOptions.hx +++ b/source/funkin/options/keybinds/KeybindsOptions.hx @@ -66,6 +66,23 @@ class KeybindsOptions extends MusicBeatSubstate { }, ] }, + { + name: 'Volume', + settings: [ + { + name: 'Up', + control: 'VOLUME_UP' + }, + { + name: 'Down', + control: 'VOLUME_DOWN' + }, + { + name: 'Mute', + control: 'VOLUME_MUTE' + }, + ] + }, { name: 'Engine', settings: [ @@ -171,6 +188,10 @@ class KeybindsOptions extends MusicBeatSubstate { } add(alphabets); add(camFollow); + + FlxG.sound.volumeUpKeys = []; + FlxG.sound.volumeDownKeys = []; + FlxG.sound.muteKeys = []; } public override function destroy() {