From c49b66f0e48881d7ad978428bb8237038cf6f2f6 Mon Sep 17 00:00:00 2001 From: cyn Date: Mon, 13 May 2024 11:23:16 -0700 Subject: [PATCH 001/120] flash fix --- source/funkin/ui/MenuItem.hx | 23 +++++++++++------------ source/funkin/ui/story/LevelTitle.hx | 24 ++++++++++++------------ 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/source/funkin/ui/MenuItem.hx b/source/funkin/ui/MenuItem.hx index ba5cc066b..2a483ea78 100644 --- a/source/funkin/ui/MenuItem.hx +++ b/source/funkin/ui/MenuItem.hx @@ -11,7 +11,6 @@ class MenuItem extends FlxSpriteGroup { public var targetY:Float = 0; public var week:FlxSprite; - public var flashingInt:Int = 0; public function new(x:Float, y:Float, weekNum:Int = 0, weekType:WeekType) { @@ -30,28 +29,28 @@ class MenuItem extends FlxSpriteGroup } var isFlashing:Bool = false; + var flashTick:Float = 0; + final flashFramerate:Float = 20; public function startFlashing():Void { isFlashing = true; } - // if it runs at 60fps, fake framerate will be 6 - // if it runs at 144 fps, fake framerate will be like 14, and will update the graphic every 0.016666 * 3 seconds still??? - // so it runs basically every so many seconds, not dependant on framerate?? - // I'm still learning how math works thanks whoever is reading this lol - var fakeFramerate:Int = Math.round((1 / FlxG.elapsed) / 10); - override function update(elapsed:Float) { super.update(elapsed); y = MathUtil.coolLerp(y, (targetY * 120) + 480, 0.17); - if (isFlashing) flashingInt += 1; - - if (flashingInt % fakeFramerate >= Math.floor(fakeFramerate / 2)) week.color = 0xFF33ffff; - else - week.color = FlxColor.WHITE; + if (isFlashing) + { + flashTick += elapsed; + if (flashTick >= 1 / flashFramerate) + { + flashTick %= 1 / flashFramerate; + week.color = (week.color == FlxColor.WHITE) ? 0xFF33ffff : FlxColor.WHITE; + } + } } } diff --git a/source/funkin/ui/story/LevelTitle.hx b/source/funkin/ui/story/LevelTitle.hx index e6f989016..2be2da154 100644 --- a/source/funkin/ui/story/LevelTitle.hx +++ b/source/funkin/ui/story/LevelTitle.hx @@ -13,13 +13,10 @@ class LevelTitle extends FlxSpriteGroup public final level:Level; public var targetY:Float; - public var isFlashing:Bool = false; var title:FlxSprite; var lock:FlxSprite; - var flashingInt:Int = 0; - public function new(x:Int, y:Int, level:Level) { super(x, y); @@ -46,20 +43,23 @@ class LevelTitle extends FlxSpriteGroup } } - // if it runs at 60fps, fake framerate will be 6 - // if it runs at 144 fps, fake framerate will be like 14, and will update the graphic every 0.016666 * 3 seconds still??? - // so it runs basically every so many seconds, not dependant on framerate?? - // I'm still learning how math works thanks whoever is reading this lol - var fakeFramerate:Int = Math.round((1 / FlxG.elapsed) / 10); + public var isFlashing:Bool = false; + var flashTick:Float = 0; + final flashFramerate:Float = 20; public override function update(elapsed:Float):Void { this.y = MathUtil.coolLerp(y, targetY, 0.17); - if (isFlashing) flashingInt += 1; - if (flashingInt % fakeFramerate >= Math.floor(fakeFramerate / 2)) title.color = 0xFF33ffff; - else - title.color = FlxColor.WHITE; + if (isFlashing) + { + flashTick += elapsed; + if (flashTick >= 1 / flashFramerate) + { + flashTick %= 1 / flashFramerate; + title.color = (title.color == FlxColor.WHITE) ? 0xFF33ffff : FlxColor.WHITE; + } + } } public function showLock():Void From 92b84168e1007342997bf0f7ee4619c4ad09e25f Mon Sep 17 00:00:00 2001 From: gamerbross <55158797+gamerbross@users.noreply.github.com> Date: Mon, 20 May 2024 02:56:57 +0200 Subject: [PATCH 002/120] Add camOther to fix zooms on pause and stickers --- source/funkin/play/PlayState.hx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 43dd485cf..20b9d3661 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -491,9 +491,9 @@ class PlayState extends MusicBeatSubState public var camGame:FlxCamera; /** - * The camera which contains, and controls visibility of, a video cutscene. + * The camera which contains, and controls visibility of, a video cutscene, dialogue, pause menu and sticker transition. */ - public var camCutscene:FlxCamera; + public var camOther:FlxCamera; /** * The combo popups. Includes the real-time combo counter and the rating. @@ -960,7 +960,7 @@ class PlayState extends MusicBeatSubState FlxTransitionableState.skipNextTransIn = true; FlxTransitionableState.skipNextTransOut = true; - pauseSubState.camera = camHUD; + pauseSubState.camera = camOther; openSubState(pauseSubState); // boyfriendPos.put(); // TODO: Why is this here? } @@ -1501,12 +1501,12 @@ class PlayState extends MusicBeatSubState camGame.bgColor = BACKGROUND_COLOR; // Show a pink background behind the stage. camHUD = new FlxCamera(); camHUD.bgColor.alpha = 0; // Show the game scene behind the camera. - camCutscene = new FlxCamera(); - camCutscene.bgColor.alpha = 0; // Show the game scene behind the camera. + camOther = new FlxCamera(); + camOther.bgColor.alpha = 0; // Show the game scene behind the camera. FlxG.cameras.reset(camGame); FlxG.cameras.add(camHUD, false); - FlxG.cameras.add(camCutscene, false); + FlxG.cameras.add(camOther, false); // Configure camera follow point. if (previousCameraFollowPoint != null) @@ -1900,7 +1900,6 @@ class PlayState extends MusicBeatSubState if (!result) return; isInCutscene = false; - camCutscene.visible = false; // TODO: Maybe tween in the camera after any cutscenes. camHUD.visible = true; @@ -1919,7 +1918,7 @@ class PlayState extends MusicBeatSubState if (!currentConversation.alive) currentConversation.revive(); currentConversation.completeCallback = onConversationComplete; - currentConversation.cameras = [camCutscene]; + currentConversation.cameras = [camOther]; currentConversation.zIndex = 1000; add(currentConversation); refresh(); @@ -2751,7 +2750,7 @@ class PlayState extends MusicBeatSubState persistentUpdate = false; FlxTransitionableState.skipNextTransIn = true; FlxTransitionableState.skipNextTransOut = true; - pauseSubState.camera = camCutscene; + pauseSubState.camera = camOther; openSubState(pauseSubState); } } @@ -2767,7 +2766,7 @@ class PlayState extends MusicBeatSubState persistentUpdate = false; FlxTransitionableState.skipNextTransIn = true; FlxTransitionableState.skipNextTransOut = true; - pauseSubState.camera = camCutscene; + pauseSubState.camera = camOther; openSubState(pauseSubState); } } From 0a6f1abd33d8cb474dcd8efe81380e5736538fc8 Mon Sep 17 00:00:00 2001 From: gamerbross <55158797+gamerbross@users.noreply.github.com> Date: Mon, 20 May 2024 23:52:45 +0200 Subject: [PATCH 003/120] Fix references to camCutscene --- source/funkin/play/cutscene/VideoCutscene.hx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/source/funkin/play/cutscene/VideoCutscene.hx b/source/funkin/play/cutscene/VideoCutscene.hx index 01a492a77..2177114aa 100644 --- a/source/funkin/play/cutscene/VideoCutscene.hx +++ b/source/funkin/play/cutscene/VideoCutscene.hx @@ -81,12 +81,11 @@ class VideoCutscene // Trigger the cutscene. Don't play the song in the background. PlayState.instance.isInCutscene = true; PlayState.instance.camHUD.visible = false; - PlayState.instance.camCutscene.visible = true; // Display a black screen to hide the game while the video is playing. blackScreen = new FlxSprite(-200, -200).makeGraphic(FlxG.width * 2, FlxG.height * 2, FlxColor.BLACK); blackScreen.scrollFactor.set(0, 0); - blackScreen.cameras = [PlayState.instance.camCutscene]; + blackScreen.cameras = [PlayState.instance.camOther]; PlayState.instance.add(blackScreen); VideoCutscene.cutsceneType = cutsceneType; @@ -120,7 +119,7 @@ class VideoCutscene vid.finishCallback = finishVideo.bind(0.5); - vid.cameras = [PlayState.instance.camCutscene]; + vid.cameras = [PlayState.instance.camOther]; PlayState.instance.add(vid); @@ -147,7 +146,7 @@ class VideoCutscene vid.bitmap.onEndReached.add(finishVideo.bind(0.5)); vid.autoPause = false; - vid.cameras = [PlayState.instance.camCutscene]; + vid.cameras = [PlayState.instance.camOther]; PlayState.instance.add(vid); @@ -305,7 +304,6 @@ class VideoCutscene vid = null; #end - PlayState.instance.camCutscene.visible = true; PlayState.instance.camHUD.visible = true; FlxTween.tween(blackScreen, {alpha: 0}, transitionTime, From 47cbd4b62038cbd07079b7c1d6ee88c73d54d724 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Tue, 21 May 2024 19:11:10 -0400 Subject: [PATCH 004/120] Update compiling guide with more troubleshooting --- docs/COMPILING.md | 62 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/docs/COMPILING.md b/docs/COMPILING.md index 07df6367f..b08fc528e 100644 --- a/docs/COMPILING.md +++ b/docs/COMPILING.md @@ -21,4 +21,64 @@ # Troubleshooting -- During the cloning process, you may experience an error along the lines of `error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)` due to poor connectivity. A common fix is to run ` git config --global http.postBuffer 4096M`. +While performing the process of compilation, you may experience one of the following issues: + +## PolymodHandler: extra field coreAssetRedirect + +``` +Installing funkin.vis from https://github.com/FunkinCrew/funkVis branch: 98c9db09f0bbfedfe67a84538a5814aaef80bdea +Error: std@sys_remove_dir +Execution error: command "haxelib --never git funkin.vis https://github.com/FunkinCrew/funkVis 98c9db09f0bbfedfe67a84538a5814aaef80bdea" failed with status: 1 in cwd +``` + +If you receive this error, you are on an outdated version of Polymod. + +To solve, you should try reinstalling Polymod: + +``` +haxelib run hmm reinstall --force polymod +``` + +You can also try deleting your `.haxelib` folder in your Funkin' project, then reinstalling all your Haxelibs to prevent any other errors: + +``` +rm -rf ./.haxelib +haxelib run hmm reinstall --force +``` + +## PolymodHandler: Couldn't find a match for this asset library: (vlc) + +``` +source/funkin/modding/PolymodErrorHandler.hx:84: [ERROR] Your Lime/OpenFL configuration is using custom asset libraries, and you provided frameworkParams in Polymod.init(), but we couldn't find a match for this asset library: (vlc) +source/funkin/modding/PolymodHandler.hx:158: An error occurred! Failed when loading mods! +source/funkin/util/logging/CrashHandler.hx:62: Error while handling crash: Null Object Reference +``` + +This error is specific to Linux targets. If you receive this error, you are on an outdated verison of hxCodec. + +To solve, you should try reinstalling hxCodec: + +``` +haxelib run hmm reinstall --force hxCodec +``` + +You can also try deleting your `.haxelib` folder in your Funkin' project, then reinstalling all your Haxelibs to prevent any other errors: + +``` +rm -rf ./.haxelib +haxelib run hmm reinstall --force +``` + +## Git: stream 0 was not closed cleanly: PROTOCOL_ERROR + +``` +error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1) +``` + +If you receive this error while cloning, you may be experiencing issues with your network connection. + +To solve, you should try modifying your git configuration before cloning again: + +``` +git config --global http.postBuffer 4096M +``` From e0fe7cb1ebed863111b7fffca389e9e603b47e3c Mon Sep 17 00:00:00 2001 From: lemz Date: Sat, 25 May 2024 01:11:34 +0200 Subject: [PATCH 005/120] add fps option --- source/Main.hx | 9 +- source/funkin/Preferences.hx | 29 +++ source/funkin/save/Save.hx | 10 +- source/funkin/ui/options/PreferencesMenu.hx | 211 ++++++++++++++++---- 4 files changed, 207 insertions(+), 52 deletions(-) diff --git a/source/Main.hx b/source/Main.hx index add5bbc67..8105e6c4f 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -2,6 +2,7 @@ package; import flixel.FlxGame; import flixel.FlxState; +import funkin.Preferences; import funkin.util.logging.CrashHandler; import funkin.ui.debug.MemoryCounter; import funkin.save.Save; @@ -22,12 +23,6 @@ class Main extends Sprite var gameHeight:Int = 720; // Height of the game in pixels (might be less / more in actual pixels depending on your zoom). var initialState:Class = funkin.InitState; // The FlxState the game starts with. var zoom:Float = -1; // If -1, zoom is automatically calculated to fit the window dimensions. - #if web - var framerate:Int = 60; // How many frames per second the game should run at. - #else - // TODO: This should probably be in the options menu? - var framerate:Int = 144; // How many frames per second the game should run at. - #end var skipSplash:Bool = true; // Whether to skip the flixel splash screen that appears in release mode. var startFullscreen:Bool = false; // Whether to start the game in fullscreen on desktop targets @@ -103,7 +98,7 @@ class Main extends Sprite // George recommends binding the save before FlxGame is created. Save.load(); - var game:FlxGame = new FlxGame(gameWidth, gameHeight, initialState, framerate, framerate, skipSplash, startFullscreen); + var game:FlxGame = new FlxGame(gameWidth, gameHeight, initialState, Preferences.framerate, Preferences.framerate, skipSplash, startFullscreen); // FlxG.game._customSoundTray wants just the class, it calls new from // create() in there, which gets called when it's added to stage diff --git a/source/funkin/Preferences.hx b/source/funkin/Preferences.hx index b2050c6a2..7a322283d 100644 --- a/source/funkin/Preferences.hx +++ b/source/funkin/Preferences.hx @@ -7,6 +7,35 @@ import funkin.save.Save; */ class Preferences { + /** + * FPS + * @default `60` + */ + public static var framerate(get, set):Int; + + static function get_framerate():Int + { + #if web + return 60; + #else + return Save?.instance?.options?.framerate ?? 60; + #end + } + + static function set_framerate(value:Int):Int + { + #if web + return 60; + #else + var save:Save = Save.instance; + save.options.framerate = value; + save.flush(); + FlxG.updateFramerate = value; + FlxG.drawFramerate = value; + return value; + #end + } + /** * Whether some particularly fowl language is displayed. * @default `true` diff --git a/source/funkin/save/Save.hx b/source/funkin/save/Save.hx index acbe59edd..3600e9741 100644 --- a/source/funkin/save/Save.hx +++ b/source/funkin/save/Save.hx @@ -53,7 +53,8 @@ class Save public function new(?data:RawSaveData) { if (data == null) this.data = Save.getDefault(); - else this.data = data; + else + this.data = data; } public static function getDefault():RawSaveData @@ -80,6 +81,7 @@ class Save options: { // Reasonable defaults. + framerate: 60, naughtyness: true, downscroll: false, flashingLights: true, @@ -835,6 +837,12 @@ typedef SaveScoreTallyData = */ typedef SaveDataOptions = { + /** + * FPS + * @default `60` + */ + var framerate:Int; + /** * Whether some particularly fowl language is displayed. * @default `true` diff --git a/source/funkin/ui/options/PreferencesMenu.hx b/source/funkin/ui/options/PreferencesMenu.hx index 783aef0ba..cf7296584 100644 --- a/source/funkin/ui/options/PreferencesMenu.hx +++ b/source/funkin/ui/options/PreferencesMenu.hx @@ -3,16 +3,16 @@ package funkin.ui.options; import flixel.FlxCamera; import flixel.FlxObject; import flixel.FlxSprite; +import flixel.math.FlxMath; import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup; import funkin.ui.AtlasText.AtlasFont; import funkin.ui.options.OptionsState.Page; import funkin.graphics.FunkinCamera; -import funkin.ui.TextMenuList.TextMenuItem; class PreferencesMenu extends Page { - var items:TextMenuList; - var preferenceItems:FlxTypedSpriteGroup; + var curSelected:Int = 0; + var prefs:FlxTypedSpriteGroup; var menuCamera:FlxCamera; var camFollow:FlxObject; @@ -26,22 +26,27 @@ class PreferencesMenu extends Page menuCamera.bgColor = 0x0; camera = menuCamera; - add(items = new TextMenuList()); - add(preferenceItems = new FlxTypedSpriteGroup()); + prefs = new FlxTypedSpriteGroup(); + add(prefs); createPrefItems(); camFollow = new FlxObject(FlxG.width / 2, 0, 140, 70); - if (items != null) camFollow.y = items.selectedItem.y; menuCamera.follow(camFollow, null, 0.06); var margin = 160; menuCamera.deadzone.set(0, margin, menuCamera.width, 40); menuCamera.minScrollY = 0; - items.onChange.add(function(selected) { - camFollow.y = selected.y; - }); + changeSelection(0); + } + + function addPref(pref:PreferenceItem):Void + { + pref.x = 0; + pref.y = 120 * prefs.length; + pref.ID = prefs.length; + prefs.add(pref); } /** @@ -49,50 +54,168 @@ class PreferencesMenu extends Page */ function createPrefItems():Void { - createPrefItemCheckbox('Naughtyness', 'Toggle displaying raunchy content', function(value:Bool):Void { - Preferences.naughtyness = value; - }, Preferences.naughtyness); - createPrefItemCheckbox('Downscroll', 'Enable to make notes move downwards', function(value:Bool):Void { - Preferences.downscroll = value; - }, Preferences.downscroll); - createPrefItemCheckbox('Flashing Lights', 'Disable to dampen flashing effects', function(value:Bool):Void { - Preferences.flashingLights = value; - }, Preferences.flashingLights); - createPrefItemCheckbox('Camera Zooming on Beat', 'Disable to stop the camera bouncing to the song', function(value:Bool):Void { - Preferences.zoomCamera = value; - }, Preferences.zoomCamera); - createPrefItemCheckbox('Debug Display', 'Enable to show FPS and other debug stats', function(value:Bool):Void { - Preferences.debugDisplay = value; - }, Preferences.debugDisplay); - createPrefItemCheckbox('Auto Pause', 'Automatically pause the game when it loses focus', function(value:Bool):Void { - Preferences.autoPause = value; - }, Preferences.autoPause); + #if !web + var pref:NumberedPreferenceItem = new NumberedPreferenceItem("FPS", "The framerate that the game is running on", Preferences.framerate, + function(value:Float):Void { + Preferences.framerate = Std.int(value); + }); + pref.minValue = 60; + pref.maxValue = 360; + pref.changeRate = 1; + pref.changeSpeed = 0.05; + addPref(pref); + #end + + // TODO: add these back + // createPrefItemCheckbox('Naughtyness', 'Toggle displaying raunchy content', function(value:Bool):Void { + // Preferences.naughtyness = value; + // }, Preferences.naughtyness); + // createPrefItemCheckbox('Downscroll', 'Enable to make notes move downwards', function(value:Bool):Void { + // Preferences.downscroll = value; + // }, Preferences.downscroll); + // createPrefItemCheckbox('Flashing Lights', 'Disable to dampen flashing effects', function(value:Bool):Void { + // Preferences.flashingLights = value; + // }, Preferences.flashingLights); + // createPrefItemCheckbox('Camera Zooming on Beat', 'Disable to stop the camera bouncing to the song', function(value:Bool):Void { + // Preferences.zoomCamera = value; + // }, Preferences.zoomCamera); + // createPrefItemCheckbox('Debug Display', 'Enable to show FPS and other debug stats', function(value:Bool):Void { + // Preferences.debugDisplay = value; + // }, Preferences.debugDisplay); + // createPrefItemCheckbox('Auto Pause', 'Automatically pause the game when it loses focus', function(value:Bool):Void { + // Preferences.autoPause = value; + // }, Preferences.autoPause); } - function createPrefItemCheckbox(prefName:String, prefDesc:String, onChange:Bool->Void, defaultValue:Bool):Void + function changeSelection(change:Int):Void { - var checkbox:CheckboxPreferenceItem = new CheckboxPreferenceItem(0, 120 * (items.length - 1 + 1), defaultValue); + curSelected += change; + if (curSelected < 0) + { + curSelected = prefs.length - 1; + } + else if (curSelected >= prefs.length) + { + curSelected = 0; + } - items.createItem(120, (120 * items.length) + 30, prefName, AtlasFont.BOLD, function() { - var value = !checkbox.currentValue; - onChange(value); - checkbox.currentValue = value; - }); - - preferenceItems.add(checkbox); + for (pref in prefs) + { + pref.x = 0; + if (pref.ID == curSelected) + { + pref.x = 20; + camFollow.y = pref.y; + } + } } - override function update(elapsed:Float) + override function update(elapsed:Float):Void { super.update(elapsed); - // Indent the selected item. - // TODO: Only do this on menu change? - items.forEach(function(daItem:TextMenuItem) { - if (items.selectedItem == daItem) daItem.x = 150; - else - daItem.x = 120; - }); + if (controls.UI_DOWN_P) + { + changeSelection(1); + } + else if (controls.UI_UP_P) + { + changeSelection(-1); + } + + var selectedPref:PreferenceItem = prefs.members[curSelected]; + selectedPref.handleInput(elapsed); + } +} + +class PreferenceItem extends FlxTypedSpriteGroup +{ + public var name:String = ""; + public var description:String = ""; + + public function handleInput(deltaTime:Float):Void {} +} + +class NumberedPreferenceItem extends PreferenceItem +{ + public var onChange:Float->Void; + public var changeRate:Float = 1.0; + public var changeSpeed:Float = 0.1; + + public var minValue(default, set):Null; + + function set_minValue(value:Float):Float + { + minValue = value; + currentValue = currentValue; + return value; + } + + public var maxValue(default, set):Null; + + function set_maxValue(value:Float):Float + { + maxValue = value; + currentValue = currentValue; + return value; + } + + public var currentValue(default, set):Float; + + function set_currentValue(value:Float):Float + { + currentValue = FlxMath.bound(value, minValue, maxValue); + onChange(currentValue); + updateText(); + return currentValue; + } + + var valueText:AtlasText; + var preferenceText:AtlasText; + + public function new(name:String, description:String, defaultValue:Float, onChange:Float->Void) + { + super(); + + this.valueText = new AtlasText(0, 0, '$defaultValue', AtlasFont.DEFAULT); + add(this.valueText); + + this.preferenceText = new AtlasText(this.valueText.width + 30, 0, '$name', AtlasFont.BOLD); + add(this.preferenceText); + + this.name = name; + this.description = description; + this.onChange = onChange; + this.currentValue = defaultValue; + } + + var timeToWait:Float = 0; + + public override function handleInput(deltaTime:Float):Void + { + timeToWait -= deltaTime; + + if (timeToWait > 0) + { + return; + } + + if (PlayerSettings.player1.controls.UI_RIGHT) + { + currentValue += changeRate; + timeToWait = changeSpeed; + } + else if (PlayerSettings.player1.controls.UI_LEFT) + { + currentValue -= changeRate; + timeToWait = changeSpeed; + } + } + + function updateText():Void + { + valueText.text = '$currentValue'; + preferenceText.x = valueText.width + 30; } } From dd6d12de2340563bcbe254b36977d119085a06aa Mon Sep 17 00:00:00 2001 From: lemz Date: Sat, 25 May 2024 01:20:10 +0200 Subject: [PATCH 006/120] rename vars --- source/funkin/ui/options/PreferencesMenu.hx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/funkin/ui/options/PreferencesMenu.hx b/source/funkin/ui/options/PreferencesMenu.hx index cf7296584..87917ad70 100644 --- a/source/funkin/ui/options/PreferencesMenu.hx +++ b/source/funkin/ui/options/PreferencesMenu.hx @@ -62,7 +62,7 @@ class PreferencesMenu extends Page pref.minValue = 60; pref.maxValue = 360; pref.changeRate = 1; - pref.changeSpeed = 0.05; + pref.changeDelay = 0.05; addPref(pref); #end @@ -133,14 +133,14 @@ class PreferenceItem extends FlxTypedSpriteGroup public var name:String = ""; public var description:String = ""; - public function handleInput(deltaTime:Float):Void {} + public function handleInput(elapsed:Float):Void {} } class NumberedPreferenceItem extends PreferenceItem { public var onChange:Float->Void; public var changeRate:Float = 1.0; - public var changeSpeed:Float = 0.1; + public var changeDelay:Float = 0.1; public var minValue(default, set):Null; @@ -191,9 +191,9 @@ class NumberedPreferenceItem extends PreferenceItem var timeToWait:Float = 0; - public override function handleInput(deltaTime:Float):Void + public override function handleInput(elapsed:Float):Void { - timeToWait -= deltaTime; + timeToWait -= elapsed; if (timeToWait > 0) { @@ -203,12 +203,12 @@ class NumberedPreferenceItem extends PreferenceItem if (PlayerSettings.player1.controls.UI_RIGHT) { currentValue += changeRate; - timeToWait = changeSpeed; + timeToWait = changeDelay; } else if (PlayerSettings.player1.controls.UI_LEFT) { currentValue -= changeRate; - timeToWait = changeSpeed; + timeToWait = changeDelay; } } From b75f6e58532534dd94cef1c93c24270e1f56425e Mon Sep 17 00:00:00 2001 From: lemz Date: Sat, 25 May 2024 02:19:11 +0200 Subject: [PATCH 007/120] Update PreferencesMenu.hx --- source/funkin/ui/options/PreferencesMenu.hx | 136 ++++++++++++-------- 1 file changed, 81 insertions(+), 55 deletions(-) diff --git a/source/funkin/ui/options/PreferencesMenu.hx b/source/funkin/ui/options/PreferencesMenu.hx index 87917ad70..acbb57525 100644 --- a/source/funkin/ui/options/PreferencesMenu.hx +++ b/source/funkin/ui/options/PreferencesMenu.hx @@ -66,25 +66,41 @@ class PreferencesMenu extends Page addPref(pref); #end - // TODO: add these back - // createPrefItemCheckbox('Naughtyness', 'Toggle displaying raunchy content', function(value:Bool):Void { - // Preferences.naughtyness = value; - // }, Preferences.naughtyness); - // createPrefItemCheckbox('Downscroll', 'Enable to make notes move downwards', function(value:Bool):Void { - // Preferences.downscroll = value; - // }, Preferences.downscroll); - // createPrefItemCheckbox('Flashing Lights', 'Disable to dampen flashing effects', function(value:Bool):Void { - // Preferences.flashingLights = value; - // }, Preferences.flashingLights); - // createPrefItemCheckbox('Camera Zooming on Beat', 'Disable to stop the camera bouncing to the song', function(value:Bool):Void { - // Preferences.zoomCamera = value; - // }, Preferences.zoomCamera); - // createPrefItemCheckbox('Debug Display', 'Enable to show FPS and other debug stats', function(value:Bool):Void { - // Preferences.debugDisplay = value; - // }, Preferences.debugDisplay); - // createPrefItemCheckbox('Auto Pause', 'Automatically pause the game when it loses focus', function(value:Bool):Void { - // Preferences.autoPause = value; - // }, Preferences.autoPause); + var pref:CheckboxPreferenceItem = new CheckboxPreferenceItem('Naughtyness', 'Toggle displaying raunchy content', Preferences.naughtyness, + function(value:Bool):Void { + Preferences.naughtyness = value; + }); + addPref(pref); + + var pref:CheckboxPreferenceItem = new CheckboxPreferenceItem('Downscroll', 'Enable to make notes move downwards', Preferences.downscroll, + function(value:Bool):Void { + Preferences.downscroll = value; + }); + addPref(pref); + + var pref:CheckboxPreferenceItem = new CheckboxPreferenceItem('Flashing Lights', 'Disable to dampen flashing effects', Preferences.flashingLights, + function(value:Bool):Void { + Preferences.flashingLights = value; + }); + addPref(pref); + + var pref:CheckboxPreferenceItem = new CheckboxPreferenceItem('Camera Zooming on Beat', 'Disable to stop the camera bouncing to the song', + Preferences.zoomCamera, function(value:Bool):Void { + Preferences.zoomCamera = value; + }); + addPref(pref); + + var pref:CheckboxPreferenceItem = new CheckboxPreferenceItem('Debug Display', 'Enable to show FPS and other debug stats', Preferences.debugDisplay, + function(value:Bool):Void { + Preferences.debugDisplay = value; + }); + addPref(pref); + + var pref:CheckboxPreferenceItem = new CheckboxPreferenceItem('Auto Pause', 'Automatically pause the game when it loses focus', Preferences.autoPause, + function(value:Bool):Void { + Preferences.autoPause = value; + }); + addPref(pref); } function changeSelection(change:Int):Void @@ -104,7 +120,7 @@ class PreferencesMenu extends Page pref.x = 0; if (pref.ID == curSelected) { - pref.x = 20; + pref.x = 30; camFollow.y = pref.y; } } @@ -124,7 +140,7 @@ class PreferencesMenu extends Page } var selectedPref:PreferenceItem = prefs.members[curSelected]; - selectedPref.handleInput(elapsed); + selectedPref?.handleInput(elapsed); } } @@ -177,10 +193,10 @@ class NumberedPreferenceItem extends PreferenceItem { super(); - this.valueText = new AtlasText(0, 0, '$defaultValue', AtlasFont.DEFAULT); + this.valueText = new AtlasText(20, 30, '$defaultValue', AtlasFont.DEFAULT); add(this.valueText); - this.preferenceText = new AtlasText(this.valueText.width + 30, 0, '$name', AtlasFont.BOLD); + this.preferenceText = new AtlasText(this.valueText.x + this.valueText.width + 30, 30, '$name', AtlasFont.BOLD); add(this.preferenceText); this.name = name; @@ -215,52 +231,62 @@ class NumberedPreferenceItem extends PreferenceItem function updateText():Void { valueText.text = '$currentValue'; - preferenceText.x = valueText.width + 30; + preferenceText.x = valueText.x + valueText.width + 30; } } -class CheckboxPreferenceItem extends FlxSprite +class CheckboxPreferenceItem extends PreferenceItem { + public var onChange:Bool->Void; + public var currentValue(default, set):Bool; - public function new(x:Float, y:Float, defaultValue:Bool = false) - { - super(x, y); - - frames = Paths.getSparrowAtlas('checkboxThingie'); - animation.addByPrefix('static', 'Check Box unselected', 24, false); - animation.addByPrefix('checked', 'Check Box selecting animation', 24, false); - - setGraphicSize(Std.int(width * 0.7)); - updateHitbox(); - - this.currentValue = defaultValue; - } - - override function update(elapsed:Float) - { - super.update(elapsed); - - switch (animation.curAnim.name) - { - case 'static': - offset.set(); - case 'checked': - offset.set(17, 70); - } - } - function set_currentValue(value:Bool):Bool { if (value) { - animation.play('checked', true); + checkBox.animation.play('checked', true); + checkBox.offset.set(17, 70); } else { - animation.play('static'); + checkBox.animation.play('static'); + checkBox.offset.set(); } + currentValue = value; + onChange(value); + return value; + } - return currentValue = value; + var checkBox:FlxSprite; + var preferenceText:AtlasText; + + public function new(name:String, description:String, defaultValue:Bool, onChange:Bool->Void) + { + super(); + + this.checkBox = new FlxSprite(); + this.checkBox.frames = Paths.getSparrowAtlas('checkboxThingie'); + this.checkBox.animation.addByPrefix('static', 'Check Box unselected', 24, false); + this.checkBox.animation.addByPrefix('checked', 'Check Box selecting animation', 24, false); + this.checkBox.setGraphicSize(Std.int(this.checkBox.width * 0.7)); + this.checkBox.updateHitbox(); + add(this.checkBox); + + this.preferenceText = new AtlasText(120, 30, '$name', AtlasFont.BOLD); + add(this.preferenceText); + + this.name = name; + this.description = description; + this.onChange = onChange; + this.currentValue = defaultValue; + } + + public override function handleInput(elapsed:Float):Void + { + if (PlayerSettings.player1.controls.ACCEPT) + { + currentValue = !currentValue; + } } } From 814d72cb3f241c61896adda8e6f84435ff056f4a Mon Sep 17 00:00:00 2001 From: lemz Date: Sat, 25 May 2024 03:06:27 +0200 Subject: [PATCH 008/120] sounds --- source/funkin/ui/options/PreferencesMenu.hx | 28 ++++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/source/funkin/ui/options/PreferencesMenu.hx b/source/funkin/ui/options/PreferencesMenu.hx index acbb57525..75bc0fdb3 100644 --- a/source/funkin/ui/options/PreferencesMenu.hx +++ b/source/funkin/ui/options/PreferencesMenu.hx @@ -4,13 +4,20 @@ import flixel.FlxCamera; import flixel.FlxObject; import flixel.FlxSprite; import flixel.math.FlxMath; +import flixel.effects.FlxFlicker; import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup; import funkin.ui.AtlasText.AtlasFont; import funkin.ui.options.OptionsState.Page; import funkin.graphics.FunkinCamera; +import funkin.audio.FunkinSound; class PreferencesMenu extends Page { + /** + * Wether you can selected a different option + */ + public static var allowScrolling:Bool = true; + var curSelected:Int = 0; var prefs:FlxTypedSpriteGroup; @@ -130,12 +137,14 @@ class PreferencesMenu extends Page { super.update(elapsed); - if (controls.UI_DOWN_P) + if (controls.UI_DOWN_P && allowScrolling) { + FunkinSound.playOnce(Paths.sound('scrollMenu')); changeSelection(1); } - else if (controls.UI_UP_P) + else if (controls.UI_UP_P && allowScrolling) { + FunkinSound.playOnce(Paths.sound('scrollMenu')); changeSelection(-1); } @@ -220,11 +229,13 @@ class NumberedPreferenceItem extends PreferenceItem { currentValue += changeRate; timeToWait = changeDelay; + // FunkinSound.playOnce(Paths.sound('scrollMenu')); } else if (PlayerSettings.player1.controls.UI_LEFT) { currentValue -= changeRate; timeToWait = changeDelay; + // FunkinSound.playOnce(Paths.sound('scrollMenu')); } } @@ -282,11 +293,20 @@ class CheckboxPreferenceItem extends PreferenceItem this.currentValue = defaultValue; } + var isAccepting:Bool = false; + public override function handleInput(elapsed:Float):Void { - if (PlayerSettings.player1.controls.ACCEPT) + if (PlayerSettings.player1.controls.ACCEPT && !isAccepting) { - currentValue = !currentValue; + isAccepting = true; + PreferencesMenu.allowScrolling = false; + FunkinSound.playOnce(Paths.sound('confirmMenu')); + FlxFlicker.flicker(preferenceText, 1, 0.06, true, false, function(_) { + isAccepting = false; + PreferencesMenu.allowScrolling = true; + currentValue = !currentValue; + }); } } } From 267fd0eadcaceedc69bae06bf3d3344f4251bfdc Mon Sep 17 00:00:00 2001 From: lemz Date: Sat, 25 May 2024 16:30:08 +0200 Subject: [PATCH 009/120] alpha stuff and correct text positioning --- source/funkin/ui/options/PreferencesMenu.hx | 42 +++++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/source/funkin/ui/options/PreferencesMenu.hx b/source/funkin/ui/options/PreferencesMenu.hx index 75bc0fdb3..4e9e0bca8 100644 --- a/source/funkin/ui/options/PreferencesMenu.hx +++ b/source/funkin/ui/options/PreferencesMenu.hx @@ -124,12 +124,15 @@ class PreferencesMenu extends Page for (pref in prefs) { - pref.x = 0; if (pref.ID == curSelected) { - pref.x = 30; + pref.onSelect(true); camFollow.y = pref.y; } + else + { + pref.onSelect(false); + } } } @@ -159,6 +162,8 @@ class PreferenceItem extends FlxTypedSpriteGroup public var description:String = ""; public function handleInput(elapsed:Float):Void {} + + public function onSelect(isSelected:Bool):Void {} } class NumberedPreferenceItem extends PreferenceItem @@ -239,10 +244,27 @@ class NumberedPreferenceItem extends PreferenceItem } } + var isSelected:Bool = false; + + public override function onSelect(isSelected:Bool):Void + { + this.isSelected = isSelected; + if (isSelected) + { + preferenceText.x = valueText.x + valueText.width + 60; + preferenceText.alpha = 1.0; + } + else + { + preferenceText.x = valueText.x + valueText.width + 30; + preferenceText.alpha = 0.6; + } + } + function updateText():Void { valueText.text = '$currentValue'; - preferenceText.x = valueText.x + valueText.width + 30; + preferenceText.x = valueText.x + valueText.width + (isSelected ? 60 : 30); } } @@ -309,4 +331,18 @@ class CheckboxPreferenceItem extends PreferenceItem }); } } + + public override function onSelect(isSelected:Bool):Void + { + if (isSelected) + { + preferenceText.x = 150; + preferenceText.alpha = 1.0; + } + else + { + preferenceText.alpha = 0.6; + preferenceText.x = 120; + } + } } From 4a531888b550f10564f058b8d2155645d33a7867 Mon Sep 17 00:00:00 2001 From: lemz Date: Thu, 30 May 2024 00:22:10 +0200 Subject: [PATCH 010/120] Update PreferencesMenu.hx --- source/funkin/ui/options/PreferencesMenu.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/ui/options/PreferencesMenu.hx b/source/funkin/ui/options/PreferencesMenu.hx index 4e9e0bca8..205ef1809 100644 --- a/source/funkin/ui/options/PreferencesMenu.hx +++ b/source/funkin/ui/options/PreferencesMenu.hx @@ -14,7 +14,7 @@ import funkin.audio.FunkinSound; class PreferencesMenu extends Page { /** - * Wether you can selected a different option + * Wether you can select a different option */ public static var allowScrolling:Bool = true; From ade4aeb3f7c49115591d69f739b41857886edbbc Mon Sep 17 00:00:00 2001 From: Karim Akra <144803230+KarimAkra@users.noreply.github.com> Date: Sun, 9 Jun 2024 01:24:02 +0300 Subject: [PATCH 011/120] get Float instead of Int in cpp (Float is 64-bit in so it works easier than Int64) --- source/funkin/util/MemoryUtil.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/funkin/util/MemoryUtil.hx b/source/funkin/util/MemoryUtil.hx index f5935ed67..18fd41472 100644 --- a/source/funkin/util/MemoryUtil.hx +++ b/source/funkin/util/MemoryUtil.hx @@ -48,11 +48,11 @@ class MemoryUtil * Calculate the total memory usage of the program, in bytes. * @return Int */ - public static function getMemoryUsed():Int + public static function getMemoryUsed():#if cpp Float #else Int #end { #if cpp // There is also Gc.MEM_INFO_RESERVED, MEM_INFO_CURRENT, and MEM_INFO_LARGE. - return cpp.vm.Gc.memInfo(cpp.vm.Gc.MEM_INFO_USAGE); + return cpp.vm.Gc.memInfo64(cpp.vm.Gc.MEM_INFO_USAGE); #else return openfl.system.System.totalMemory; #end From 7904a6a20ff76364f6342578ec7d6849e4b098a0 Mon Sep 17 00:00:00 2001 From: Karim Akra <144803230+KarimAkra@users.noreply.github.com> Date: Sun, 9 Jun 2024 01:25:21 +0300 Subject: [PATCH 012/120] use Math.fround instead of Math.round --- source/funkin/ui/debug/MemoryCounter.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/ui/debug/MemoryCounter.hx b/source/funkin/ui/debug/MemoryCounter.hx index b25b55645..50421f398 100644 --- a/source/funkin/ui/debug/MemoryCounter.hx +++ b/source/funkin/ui/debug/MemoryCounter.hx @@ -36,7 +36,7 @@ class MemoryCounter extends TextField @:noCompletion #if !flash override #end function __enterFrame(deltaTime:Float):Void { - var mem:Float = Math.round(MemoryUtil.getMemoryUsed() / BYTES_PER_MEG / ROUND_TO) * ROUND_TO; + var mem:Float = Math.fround(MemoryUtil.getMemoryUsed() / BYTES_PER_MEG / ROUND_TO) * ROUND_TO; if (mem > memPeak) memPeak = mem; From 73982fbd606051fd6e0f2bf9e78ca174fdab0d88 Mon Sep 17 00:00:00 2001 From: gamerbross <55158797+gamerbross@users.noreply.github.com> Date: Sun, 9 Jun 2024 00:29:55 +0200 Subject: [PATCH 013/120] Fix Stack Overflow if song doesn't have "normal" difficulty --- source/funkin/ui/freeplay/FreeplayState.hx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 5e07fb396..0ef268d31 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -2046,6 +2046,8 @@ class FreeplaySongData function set_currentDifficulty(value:String):String { + if (currentDifficulty == value) return value; + currentDifficulty = value; updateValues(displayedVariations); return value; From 4997bc27fd0473b5b6f3996ac7150b0240cb62c0 Mon Sep 17 00:00:00 2001 From: Karim Akra <144803230+KarimAkra@users.noreply.github.com> Date: Sun, 9 Jun 2024 12:47:17 +0300 Subject: [PATCH 014/120] remove the library strip --- source/funkin/audio/FunkinSound.hx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/funkin/audio/FunkinSound.hx b/source/funkin/audio/FunkinSound.hx index 4f61e70c2..be5cc6931 100644 --- a/source/funkin/audio/FunkinSound.hx +++ b/source/funkin/audio/FunkinSound.hx @@ -491,8 +491,10 @@ class FunkinSound extends FlxSound implements ICloneable var promise:lime.app.Promise> = new lime.app.Promise>(); // split the path and get only after first : - // we are bypassing the openfl/lime asset library fuss + // we are bypassing the openfl/lime asset library fuss on web only + #if web path = Paths.stripLibrary(path); + #end var soundRequest = FlxPartialSound.partialLoadFromFile(path, start, end); From 9618cd2128323889d19246fb519b56494a9d20c7 Mon Sep 17 00:00:00 2001 From: gamerbross <55158797+gamerbross@users.noreply.github.com> Date: Mon, 10 Jun 2024 16:53:32 +0200 Subject: [PATCH 015/120] Fix chart reset when charting and pressing chart key --- source/funkin/play/PlayState.hx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index b3d0a9f8a..1e22e98af 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -2284,7 +2284,7 @@ class PlayState extends MusicBeatSubState health += Constants.HEALTH_HOLD_BONUS_PER_SECOND * elapsed; songScore += Std.int(Constants.SCORE_HOLD_BONUS_PER_SECOND * elapsed); } - + // Make sure the player keeps singing while the note is held by the bot. if (isBotPlayMode && currentStage != null && currentStage.getBoyfriend() != null && currentStage.getBoyfriend().isSinging()) { @@ -2612,10 +2612,18 @@ class PlayState extends MusicBeatSubState { disableKeys = true; persistentUpdate = false; - FlxG.switchState(() -> new ChartEditorState( - { - targetSongId: currentSong.id, - })); + if (isChartingMode) + { + FlxG.sound.music?.pause(); + this.close(); + } + else + { + FlxG.switchState(() -> new ChartEditorState( + { + targetSongId: currentSong.id, + })); + } } #end From fb71f9087d546854d4b44311682d84dcdd44fd32 Mon Sep 17 00:00:00 2001 From: NotHyper-474 Date: Mon, 10 Jun 2024 23:12:28 -0300 Subject: [PATCH 016/120] Fix trace --- source/funkin/ui/transition/LoadingState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/ui/transition/LoadingState.hx b/source/funkin/ui/transition/LoadingState.hx index bc26ad97a..0f2ce1076 100644 --- a/source/funkin/ui/transition/LoadingState.hx +++ b/source/funkin/ui/transition/LoadingState.hx @@ -346,7 +346,7 @@ class LoadingState extends MusicBeatSubState return 'Done precaching ${path}'; }, true); - trace("Queued ${path} for precaching"); + trace('Queued ${path} for precaching'); // FunkinSprite.cacheTexture(path); } From b7eaa238e01ba0003ebd53cf71ecb2930c6c7b76 Mon Sep 17 00:00:00 2001 From: gamerbross <55158797+gamerbross@users.noreply.github.com> Date: Wed, 12 Jun 2024 00:34:04 +0200 Subject: [PATCH 017/120] Revert camCutscene rename --- source/funkin/play/PlayState.hx | 16 ++++++++-------- source/funkin/play/cutscene/VideoCutscene.hx | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 20b9d3661..b88fef188 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -493,7 +493,7 @@ class PlayState extends MusicBeatSubState /** * The camera which contains, and controls visibility of, a video cutscene, dialogue, pause menu and sticker transition. */ - public var camOther:FlxCamera; + public var camCutscene:FlxCamera; /** * The combo popups. Includes the real-time combo counter and the rating. @@ -960,7 +960,7 @@ class PlayState extends MusicBeatSubState FlxTransitionableState.skipNextTransIn = true; FlxTransitionableState.skipNextTransOut = true; - pauseSubState.camera = camOther; + pauseSubState.camera = camCutscene; openSubState(pauseSubState); // boyfriendPos.put(); // TODO: Why is this here? } @@ -1501,12 +1501,12 @@ class PlayState extends MusicBeatSubState camGame.bgColor = BACKGROUND_COLOR; // Show a pink background behind the stage. camHUD = new FlxCamera(); camHUD.bgColor.alpha = 0; // Show the game scene behind the camera. - camOther = new FlxCamera(); - camOther.bgColor.alpha = 0; // Show the game scene behind the camera. + camCutscene = new FlxCamera(); + camCutscene.bgColor.alpha = 0; // Show the game scene behind the camera. FlxG.cameras.reset(camGame); FlxG.cameras.add(camHUD, false); - FlxG.cameras.add(camOther, false); + FlxG.cameras.add(camCutscene, false); // Configure camera follow point. if (previousCameraFollowPoint != null) @@ -1918,7 +1918,7 @@ class PlayState extends MusicBeatSubState if (!currentConversation.alive) currentConversation.revive(); currentConversation.completeCallback = onConversationComplete; - currentConversation.cameras = [camOther]; + currentConversation.cameras = [camCutscene]; currentConversation.zIndex = 1000; add(currentConversation); refresh(); @@ -2750,7 +2750,7 @@ class PlayState extends MusicBeatSubState persistentUpdate = false; FlxTransitionableState.skipNextTransIn = true; FlxTransitionableState.skipNextTransOut = true; - pauseSubState.camera = camOther; + pauseSubState.camera = camCutscene; openSubState(pauseSubState); } } @@ -2766,7 +2766,7 @@ class PlayState extends MusicBeatSubState persistentUpdate = false; FlxTransitionableState.skipNextTransIn = true; FlxTransitionableState.skipNextTransOut = true; - pauseSubState.camera = camOther; + pauseSubState.camera = camCutscene; openSubState(pauseSubState); } } diff --git a/source/funkin/play/cutscene/VideoCutscene.hx b/source/funkin/play/cutscene/VideoCutscene.hx index 2177114aa..7612c3ab6 100644 --- a/source/funkin/play/cutscene/VideoCutscene.hx +++ b/source/funkin/play/cutscene/VideoCutscene.hx @@ -85,7 +85,7 @@ class VideoCutscene // Display a black screen to hide the game while the video is playing. blackScreen = new FlxSprite(-200, -200).makeGraphic(FlxG.width * 2, FlxG.height * 2, FlxColor.BLACK); blackScreen.scrollFactor.set(0, 0); - blackScreen.cameras = [PlayState.instance.camOther]; + blackScreen.cameras = [PlayState.instance.camCutscene]; PlayState.instance.add(blackScreen); VideoCutscene.cutsceneType = cutsceneType; @@ -119,7 +119,7 @@ class VideoCutscene vid.finishCallback = finishVideo.bind(0.5); - vid.cameras = [PlayState.instance.camOther]; + vid.cameras = [PlayState.instance.camCutscene]; PlayState.instance.add(vid); @@ -146,7 +146,7 @@ class VideoCutscene vid.bitmap.onEndReached.add(finishVideo.bind(0.5)); vid.autoPause = false; - vid.cameras = [PlayState.instance.camOther]; + vid.cameras = [PlayState.instance.camCutscene]; PlayState.instance.add(vid); From ba4677857aefbd10def4e03b3def59756deccdba Mon Sep 17 00:00:00 2001 From: gamerbross <55158797+gamerbross@users.noreply.github.com> Date: Sat, 15 Jun 2024 20:23:55 +0200 Subject: [PATCH 018/120] Few animation editor bugfixes --- hmm.json | 2 +- .../ui/debug/anim/DebugBoundingState.hx | 23 ++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/hmm.json b/hmm.json index 68e0c5cb0..d217740db 100644 --- a/hmm.json +++ b/hmm.json @@ -30,7 +30,7 @@ "name": "flixel-ui", "type": "git", "dir": null, - "ref": "719b4f10d94186ed55f6fef1b6618d32abec8c15", + "ref": "d0afed7293c71ffdb1184751317fc709b44c9056", "url": "https://github.com/HaxeFlixel/flixel-ui" }, { diff --git a/source/funkin/ui/debug/anim/DebugBoundingState.hx b/source/funkin/ui/debug/anim/DebugBoundingState.hx index 04784a5b7..d82bcc612 100644 --- a/source/funkin/ui/debug/anim/DebugBoundingState.hx +++ b/source/funkin/ui/debug/anim/DebugBoundingState.hx @@ -1,6 +1,7 @@ package funkin.ui.debug.anim; import flixel.addons.display.FlxGridOverlay; +import flixel.addons.display.FlxBackdrop; import flixel.addons.ui.FlxInputText; import flixel.addons.ui.FlxUIDropDownMenu; import flixel.FlxCamera; @@ -55,7 +56,7 @@ class DebugBoundingState extends FlxState TODAY'S TO-DO - Cleaner UI */ - var bg:FlxSprite; + var bg:FlxBackdrop; var fileInfo:FlxText; var txtGrp:FlxGroup; @@ -80,7 +81,7 @@ class DebugBoundingState extends FlxState { // get the screen position, according to the HUD camera, temp default to FlxG.camera juuust in case? var hudMousePos:FlxPoint = FlxG.mouse.getScreenPosition(hudCam ?? FlxG.camera); - return Screen.instance.hasSolidComponentUnderPoint(hudMousePos.x, hudMousePos.y); + return Screen.instance.hasSolidComponentUnderPoint(hudMousePos.x, hudMousePos.y) || FlxG.mouse.overlaps(animDropDownMenu, hudCam); } override function create() @@ -103,10 +104,7 @@ class DebugBoundingState extends FlxState hudCam = new FlxCamera(); hudCam.bgColor.alpha = 0; - bg = FlxGridOverlay.create(10, 10); - // bg = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.GREEN); - - bg.scrollFactor.set(); + bg = new FlxBackdrop(FlxGridOverlay.createGrid(10, 10, FlxG.width, FlxG.height, true, 0xffe7e6e6, 0xffd9d5d5)); add(bg); // we are setting this as the default draw camera only temporarily, to trick haxeui @@ -289,16 +287,20 @@ class DebugBoundingState extends FlxState public var mouseOffset:FlxPoint = FlxPoint.get(0, 0); public var oldPos:FlxPoint = FlxPoint.get(0, 0); + public var movingCharacter:Bool = false; function mouseOffsetMovement() { if (swagChar != null) { - if (FlxG.mouse.justPressed) + if (FlxG.mouse.justPressed && !haxeUIFocused) { + movingCharacter = true; mouseOffset.set(FlxG.mouse.x - -swagChar.animOffsets[0], FlxG.mouse.y - -swagChar.animOffsets[1]); } + if (!movingCharacter) return; + if (FlxG.mouse.pressed) { swagChar.animOffsets = [(FlxG.mouse.x - mouseOffset.x) * -1, (FlxG.mouse.y - mouseOffset.y) * -1]; @@ -307,6 +309,11 @@ class DebugBoundingState extends FlxState txtOffsetShit.text = 'Offset: ' + swagChar.animOffsets; } + + if (FlxG.mouse.justReleased) + { + movingCharacter = false; + } } } @@ -373,7 +380,7 @@ class DebugBoundingState extends FlxState offsetView.visible = true; offsetView.active = true; offsetControls(); - if (!haxeUIFocused) mouseOffsetMovement(); + mouseOffsetMovement(); } if (FlxG.keys.justPressed.H) hudCam.visible = !hudCam.visible; From 250ec840efa17b323f69748271982659ad61cc06 Mon Sep 17 00:00:00 2001 From: MaybeMaru <97055307+MaybeMaru@users.noreply.github.com> Date: Tue, 18 Jun 2024 15:11:00 +0200 Subject: [PATCH 019/120] Add missing constants --- source/funkin/play/notes/Strumline.hx | 2 +- source/funkin/play/notes/SustainTrail.hx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/funkin/play/notes/Strumline.hx b/source/funkin/play/notes/Strumline.hx index 0e4b6645f..3c114b5e0 100644 --- a/source/funkin/play/notes/Strumline.hx +++ b/source/funkin/play/notes/Strumline.hx @@ -37,7 +37,7 @@ class Strumline extends FlxSpriteGroup static function get_RENDER_DISTANCE_MS():Float { - return FlxG.height / 0.45; + return FlxG.height / Constants.PIXELS_PER_MS; } /** diff --git a/source/funkin/play/notes/SustainTrail.hx b/source/funkin/play/notes/SustainTrail.hx index b358d7f03..f6d43b33f 100644 --- a/source/funkin/play/notes/SustainTrail.hx +++ b/source/funkin/play/notes/SustainTrail.hx @@ -160,7 +160,7 @@ class SustainTrail extends FlxSprite */ public static inline function sustainHeight(susLength:Float, scroll:Float) { - return (susLength * 0.45 * scroll); + return (susLength * Constants.PIXELS_PER_MS * scroll); } function set_sustainLength(s:Float):Float From 73efd963b9e1a98c77fdb6a2a8f57517d08f16d1 Mon Sep 17 00:00:00 2001 From: gamerbross <55158797+gamerbross@users.noreply.github.com> Date: Thu, 20 Jun 2024 07:24:36 +0200 Subject: [PATCH 020/120] Fix crash after pressing F5 and coming back from stickers --- source/funkin/ui/freeplay/FreeplayState.hx | 2 +- source/funkin/ui/story/StoryMenuState.hx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 0caaf4591..949aa4bfe 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -214,7 +214,7 @@ class FreeplayState extends MusicBeatSubState prepForNewRank = true; } - if (stickers != null) + if (stickers?.members != null) { stickerSubState = stickers; } diff --git a/source/funkin/ui/story/StoryMenuState.hx b/source/funkin/ui/story/StoryMenuState.hx index 06a83ab4d..7707850ce 100644 --- a/source/funkin/ui/story/StoryMenuState.hx +++ b/source/funkin/ui/story/StoryMenuState.hx @@ -113,7 +113,7 @@ class StoryMenuState extends MusicBeatState { super(); - if (stickers != null) + if (stickers?.members != null) { stickerSubState = stickers; } From dd7a894b518e6cf6467ad73ee15e277c244217a3 Mon Sep 17 00:00:00 2001 From: Pixel <146671762+JVNpixels@users.noreply.github.com> Date: Fri, 21 Jun 2024 08:42:51 -0700 Subject: [PATCH 021/120] Update StoryMenuState.hx --- source/funkin/ui/story/StoryMenuState.hx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/source/funkin/ui/story/StoryMenuState.hx b/source/funkin/ui/story/StoryMenuState.hx index 06a83ab4d..8623d8f39 100644 --- a/source/funkin/ui/story/StoryMenuState.hx +++ b/source/funkin/ui/story/StoryMenuState.hx @@ -336,6 +336,24 @@ class StoryMenuState extends MusicBeatState changeDifficulty(0); } + #if !html5 + if (FlxG.mouse.wheel != 0) + { + changeLevel(-Math.round(FlxG.mouse.wheel)); + } + #else + if (FlxG.mouse.wheel < 0) + { + changeLevel(-Math.round(FlxG.mouse.wheel / 8)); + } + else if (FlxG.mouse.wheel > 0) + { + changeLevel(-Math.round(FlxG.mouse.wheel / 8)); + } + #end + + // HTML and NON HTML builds mouse fix. + // TODO: Querying UI_RIGHT_P (justPressed) after UI_RIGHT always returns false. Fix it! if (controls.UI_RIGHT_P) { From 0589624d117d52f3ec6224af26b4041205db612c Mon Sep 17 00:00:00 2001 From: Pixel <146671762+JVNpixels@users.noreply.github.com> Date: Fri, 21 Jun 2024 22:46:07 -0700 Subject: [PATCH 022/120] Update source/funkin/ui/story/StoryMenuState.hx Co-authored-by: gamerbross <55158797+gamerbross@users.noreply.github.com> --- source/funkin/ui/story/StoryMenuState.hx | 1 - 1 file changed, 1 deletion(-) diff --git a/source/funkin/ui/story/StoryMenuState.hx b/source/funkin/ui/story/StoryMenuState.hx index 8623d8f39..5f21a9a88 100644 --- a/source/funkin/ui/story/StoryMenuState.hx +++ b/source/funkin/ui/story/StoryMenuState.hx @@ -352,7 +352,6 @@ class StoryMenuState extends MusicBeatState } #end - // HTML and NON HTML builds mouse fix. // TODO: Querying UI_RIGHT_P (justPressed) after UI_RIGHT always returns false. Fix it! if (controls.UI_RIGHT_P) From be38ae6c0003ac63aea38f490b66e07b10f0bd6e Mon Sep 17 00:00:00 2001 From: Pixel <146671762+JVNpixels@users.noreply.github.com> Date: Sat, 22 Jun 2024 19:23:40 -0700 Subject: [PATCH 023/120] Extra newline removal. Removes the extra line in code. --- source/funkin/ui/story/StoryMenuState.hx | 1 - 1 file changed, 1 deletion(-) diff --git a/source/funkin/ui/story/StoryMenuState.hx b/source/funkin/ui/story/StoryMenuState.hx index 5f21a9a88..90786b3f6 100644 --- a/source/funkin/ui/story/StoryMenuState.hx +++ b/source/funkin/ui/story/StoryMenuState.hx @@ -352,7 +352,6 @@ class StoryMenuState extends MusicBeatState } #end - // TODO: Querying UI_RIGHT_P (justPressed) after UI_RIGHT always returns false. Fix it! if (controls.UI_RIGHT_P) { From 3b3b9d97ba08d8e315df0bcd755d79d1e6e27a81 Mon Sep 17 00:00:00 2001 From: lemz Date: Sun, 23 Jun 2024 21:03:30 +0200 Subject: [PATCH 024/120] use different implementation --- source/funkin/ui/AtlasText.hx | 26 ++ source/funkin/ui/options/PreferencesMenu.hx | 371 ++++-------------- .../options/items/CheckboxPreferenceItem.hx | 49 +++ .../ui/options/items/NumberPreferenceItem.hx | 107 +++++ 4 files changed, 258 insertions(+), 295 deletions(-) create mode 100644 source/funkin/ui/options/items/CheckboxPreferenceItem.hx create mode 100644 source/funkin/ui/options/items/NumberPreferenceItem.hx diff --git a/source/funkin/ui/AtlasText.hx b/source/funkin/ui/AtlasText.hx index 186d87c2a..ef74abc1e 100644 --- a/source/funkin/ui/AtlasText.hx +++ b/source/funkin/ui/AtlasText.hx @@ -152,6 +152,32 @@ class AtlasText extends FlxTypedSpriteGroup } } + public function getWidth():Int + { + var width = 0; + for (char in this.text.split("")) + { + switch (char) + { + case " ": + { + width += 40; + } + case "\n": + {} + case char: + { + var sprite = new AtlasChar(atlas, char); + sprite.revive(); + sprite.char = char; + sprite.alpha = 1; + width += Std.int(sprite.width); + } + } + } + return width; + } + override function toString() { return "InputItem, " + FlxStringUtil.getDebugString([ diff --git a/source/funkin/ui/options/PreferencesMenu.hx b/source/funkin/ui/options/PreferencesMenu.hx index 205ef1809..d03fe9073 100644 --- a/source/funkin/ui/options/PreferencesMenu.hx +++ b/source/funkin/ui/options/PreferencesMenu.hx @@ -3,23 +3,18 @@ package funkin.ui.options; import flixel.FlxCamera; import flixel.FlxObject; import flixel.FlxSprite; -import flixel.math.FlxMath; -import flixel.effects.FlxFlicker; import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup; import funkin.ui.AtlasText.AtlasFont; import funkin.ui.options.OptionsState.Page; +import funkin.ui.options.items.CheckboxPreferenceItem; +import funkin.ui.options.items.NumberPreferenceItem; import funkin.graphics.FunkinCamera; -import funkin.audio.FunkinSound; +import funkin.ui.TextMenuList.TextMenuItem; class PreferencesMenu extends Page { - /** - * Wether you can select a different option - */ - public static var allowScrolling:Bool = true; - - var curSelected:Int = 0; - var prefs:FlxTypedSpriteGroup; + var items:TextMenuList; + var preferenceItems:FlxTypedSpriteGroup; var menuCamera:FlxCamera; var camFollow:FlxObject; @@ -33,27 +28,22 @@ class PreferencesMenu extends Page menuCamera.bgColor = 0x0; camera = menuCamera; - prefs = new FlxTypedSpriteGroup(); - add(prefs); + add(items = new TextMenuList()); + add(preferenceItems = new FlxTypedSpriteGroup()); createPrefItems(); camFollow = new FlxObject(FlxG.width / 2, 0, 140, 70); + if (items != null) camFollow.y = items.selectedItem.y; menuCamera.follow(camFollow, null, 0.06); var margin = 160; menuCamera.deadzone.set(0, margin, menuCamera.width, 40); menuCamera.minScrollY = 0; - changeSelection(0); - } - - function addPref(pref:PreferenceItem):Void - { - pref.x = 0; - pref.y = 120 * prefs.length; - pref.ID = prefs.length; - prefs.add(pref); + items.onChange.add(function(selected) { + camFollow.y = selected.y; + }); } /** @@ -62,287 +52,78 @@ class PreferencesMenu extends Page function createPrefItems():Void { #if !web - var pref:NumberedPreferenceItem = new NumberedPreferenceItem("FPS", "The framerate that the game is running on", Preferences.framerate, - function(value:Float):Void { - Preferences.framerate = Std.int(value); - }); - pref.minValue = 60; - pref.maxValue = 360; - pref.changeRate = 1; - pref.changeDelay = 0.05; - addPref(pref); + createPrefItemNumber('FPS', 'The framerate that the game is running on', function(value:Float) { + Preferences.framerate = Std.int(value); + }, Preferences.framerate, 60, 360, 1, 0); #end - - var pref:CheckboxPreferenceItem = new CheckboxPreferenceItem('Naughtyness', 'Toggle displaying raunchy content', Preferences.naughtyness, - function(value:Bool):Void { - Preferences.naughtyness = value; - }); - addPref(pref); - - var pref:CheckboxPreferenceItem = new CheckboxPreferenceItem('Downscroll', 'Enable to make notes move downwards', Preferences.downscroll, - function(value:Bool):Void { - Preferences.downscroll = value; - }); - addPref(pref); - - var pref:CheckboxPreferenceItem = new CheckboxPreferenceItem('Flashing Lights', 'Disable to dampen flashing effects', Preferences.flashingLights, - function(value:Bool):Void { - Preferences.flashingLights = value; - }); - addPref(pref); - - var pref:CheckboxPreferenceItem = new CheckboxPreferenceItem('Camera Zooming on Beat', 'Disable to stop the camera bouncing to the song', - Preferences.zoomCamera, function(value:Bool):Void { - Preferences.zoomCamera = value; - }); - addPref(pref); - - var pref:CheckboxPreferenceItem = new CheckboxPreferenceItem('Debug Display', 'Enable to show FPS and other debug stats', Preferences.debugDisplay, - function(value:Bool):Void { - Preferences.debugDisplay = value; - }); - addPref(pref); - - var pref:CheckboxPreferenceItem = new CheckboxPreferenceItem('Auto Pause', 'Automatically pause the game when it loses focus', Preferences.autoPause, - function(value:Bool):Void { - Preferences.autoPause = value; - }); - addPref(pref); - } - - function changeSelection(change:Int):Void - { - curSelected += change; - if (curSelected < 0) - { - curSelected = prefs.length - 1; - } - else if (curSelected >= prefs.length) - { - curSelected = 0; - } - - for (pref in prefs) - { - if (pref.ID == curSelected) - { - pref.onSelect(true); - camFollow.y = pref.y; - } - else - { - pref.onSelect(false); - } - } + createPrefItemCheckbox('Naughtyness', 'Toggle displaying raunchy content', function(value:Bool):Void { + Preferences.naughtyness = value; + }, Preferences.naughtyness); + createPrefItemCheckbox('Downscroll', 'Enable to make notes move downwards', function(value:Bool):Void { + Preferences.downscroll = value; + }, Preferences.downscroll); + createPrefItemCheckbox('Flashing Lights', 'Disable to dampen flashing effects', function(value:Bool):Void { + Preferences.flashingLights = value; + }, Preferences.flashingLights); + createPrefItemCheckbox('Camera Zooming on Beat', 'Disable to stop the camera bouncing to the song', function(value:Bool):Void { + Preferences.zoomCamera = value; + }, Preferences.zoomCamera); + createPrefItemCheckbox('Debug Display', 'Enable to show FPS and other debug stats', function(value:Bool):Void { + Preferences.debugDisplay = value; + }, Preferences.debugDisplay); + createPrefItemCheckbox('Auto Pause', 'Automatically pause the game when it loses focus', function(value:Bool):Void { + Preferences.autoPause = value; + }, Preferences.autoPause); } override function update(elapsed:Float):Void { super.update(elapsed); - if (controls.UI_DOWN_P && allowScrolling) - { - FunkinSound.playOnce(Paths.sound('scrollMenu')); - changeSelection(1); - } - else if (controls.UI_UP_P && allowScrolling) - { - FunkinSound.playOnce(Paths.sound('scrollMenu')); - changeSelection(-1); - } + // Indent the selected item. + // TODO: Only do this on menu change? + items.forEach(function(daItem:TextMenuItem) { + var thyOffset:Int = 0; + if (Std.isOfType(daItem, NumberPreferenceItem)) thyOffset = cast(daItem, NumberPreferenceItem).lefthandText.getWidth(); - var selectedPref:PreferenceItem = prefs.members[curSelected]; - selectedPref?.handleInput(elapsed); - } -} - -class PreferenceItem extends FlxTypedSpriteGroup -{ - public var name:String = ""; - public var description:String = ""; - - public function handleInput(elapsed:Float):Void {} - - public function onSelect(isSelected:Bool):Void {} -} - -class NumberedPreferenceItem extends PreferenceItem -{ - public var onChange:Float->Void; - public var changeRate:Float = 1.0; - public var changeDelay:Float = 0.1; - - public var minValue(default, set):Null; - - function set_minValue(value:Float):Float - { - minValue = value; - currentValue = currentValue; - return value; - } - - public var maxValue(default, set):Null; - - function set_maxValue(value:Float):Float - { - maxValue = value; - currentValue = currentValue; - return value; - } - - public var currentValue(default, set):Float; - - function set_currentValue(value:Float):Float - { - currentValue = FlxMath.bound(value, minValue, maxValue); - onChange(currentValue); - updateText(); - return currentValue; - } - - var valueText:AtlasText; - var preferenceText:AtlasText; - - public function new(name:String, description:String, defaultValue:Float, onChange:Float->Void) - { - super(); - - this.valueText = new AtlasText(20, 30, '$defaultValue', AtlasFont.DEFAULT); - add(this.valueText); - - this.preferenceText = new AtlasText(this.valueText.x + this.valueText.width + 30, 30, '$name', AtlasFont.BOLD); - add(this.preferenceText); - - this.name = name; - this.description = description; - this.onChange = onChange; - this.currentValue = defaultValue; - } - - var timeToWait:Float = 0; - - public override function handleInput(elapsed:Float):Void - { - timeToWait -= elapsed; - - if (timeToWait > 0) - { - return; - } - - if (PlayerSettings.player1.controls.UI_RIGHT) - { - currentValue += changeRate; - timeToWait = changeDelay; - // FunkinSound.playOnce(Paths.sound('scrollMenu')); - } - else if (PlayerSettings.player1.controls.UI_LEFT) - { - currentValue -= changeRate; - timeToWait = changeDelay; - // FunkinSound.playOnce(Paths.sound('scrollMenu')); - } - } - - var isSelected:Bool = false; - - public override function onSelect(isSelected:Bool):Void - { - this.isSelected = isSelected; - if (isSelected) - { - preferenceText.x = valueText.x + valueText.width + 60; - preferenceText.alpha = 1.0; - } - else - { - preferenceText.x = valueText.x + valueText.width + 30; - preferenceText.alpha = 0.6; - } - } - - function updateText():Void - { - valueText.text = '$currentValue'; - preferenceText.x = valueText.x + valueText.width + (isSelected ? 60 : 30); - } -} - -class CheckboxPreferenceItem extends PreferenceItem -{ - public var onChange:Bool->Void; - - public var currentValue(default, set):Bool; - - function set_currentValue(value:Bool):Bool - { - if (value) - { - checkBox.animation.play('checked', true); - checkBox.offset.set(17, 70); - } - else - { - checkBox.animation.play('static'); - checkBox.offset.set(); - } - currentValue = value; - onChange(value); - return value; - } - - var checkBox:FlxSprite; - var preferenceText:AtlasText; - - public function new(name:String, description:String, defaultValue:Bool, onChange:Bool->Void) - { - super(); - - this.checkBox = new FlxSprite(); - this.checkBox.frames = Paths.getSparrowAtlas('checkboxThingie'); - this.checkBox.animation.addByPrefix('static', 'Check Box unselected', 24, false); - this.checkBox.animation.addByPrefix('checked', 'Check Box selecting animation', 24, false); - this.checkBox.setGraphicSize(Std.int(this.checkBox.width * 0.7)); - this.checkBox.updateHitbox(); - add(this.checkBox); - - this.preferenceText = new AtlasText(120, 30, '$name', AtlasFont.BOLD); - add(this.preferenceText); - - this.name = name; - this.description = description; - this.onChange = onChange; - this.currentValue = defaultValue; - } - - var isAccepting:Bool = false; - - public override function handleInput(elapsed:Float):Void - { - if (PlayerSettings.player1.controls.ACCEPT && !isAccepting) - { - isAccepting = true; - PreferencesMenu.allowScrolling = false; - FunkinSound.playOnce(Paths.sound('confirmMenu')); - FlxFlicker.flicker(preferenceText, 1, 0.06, true, false, function(_) { - isAccepting = false; - PreferencesMenu.allowScrolling = true; - currentValue = !currentValue; - }); - } - } - - public override function onSelect(isSelected:Bool):Void - { - if (isSelected) - { - preferenceText.x = 150; - preferenceText.alpha = 1.0; - } - else - { - preferenceText.alpha = 0.6; - preferenceText.x = 120; - } + // Very messy but it works + if (thyOffset == 0) + { + if (items.selectedItem == daItem) thyOffset += 150; + else + thyOffset += 120; + } + else if (items.selectedItem == daItem) + { + thyOffset += 70; + } + else + { + thyOffset += 25; + } + + daItem.x = thyOffset; + }); + } + + function createPrefItemCheckbox(prefName:String, prefDesc:String, onChange:Bool->Void, defaultValue:Bool):Void + { + var checkbox:CheckboxPreferenceItem = new CheckboxPreferenceItem(0, 120 * (items.length - 1 + 1), defaultValue); + + items.createItem(120, (120 * items.length) + 30, prefName, AtlasFont.BOLD, function() { + var value = !checkbox.currentValue; + onChange(value); + checkbox.currentValue = value; + }); + + preferenceItems.add(checkbox); + } + + function createPrefItemNumber(prefName:String, prefDesc:String, onChange:Float->Void, defaultValue:Float, min:Float, max:Float, step:Float, + precision:Int):Void + { + var item = new NumberPreferenceItem(145, (120 * items.length) + 30, prefName, defaultValue, min, max, step, precision, onChange); + items.addItem(prefName, item); + preferenceItems.add(item.lefthandText); } } diff --git a/source/funkin/ui/options/items/CheckboxPreferenceItem.hx b/source/funkin/ui/options/items/CheckboxPreferenceItem.hx new file mode 100644 index 000000000..88c4fb6b0 --- /dev/null +++ b/source/funkin/ui/options/items/CheckboxPreferenceItem.hx @@ -0,0 +1,49 @@ +package funkin.ui.options.items; + +import flixel.FlxSprite.FlxSprite; + +class CheckboxPreferenceItem extends FlxSprite +{ + public var currentValue(default, set):Bool; + + public function new(x:Float, y:Float, defaultValue:Bool = false) + { + super(x, y); + + frames = Paths.getSparrowAtlas('checkboxThingie'); + animation.addByPrefix('static', 'Check Box unselected', 24, false); + animation.addByPrefix('checked', 'Check Box selecting animation', 24, false); + + setGraphicSize(Std.int(width * 0.7)); + updateHitbox(); + + this.currentValue = defaultValue; + } + + override function update(elapsed:Float) + { + super.update(elapsed); + + switch (animation.curAnim.name) + { + case 'static': + offset.set(); + case 'checked': + offset.set(17, 70); + } + } + + function set_currentValue(value:Bool):Bool + { + if (value) + { + animation.play('checked', true); + } + else + { + animation.play('static'); + } + + return currentValue = value; + } +} diff --git a/source/funkin/ui/options/items/NumberPreferenceItem.hx b/source/funkin/ui/options/items/NumberPreferenceItem.hx new file mode 100644 index 000000000..795b6c994 --- /dev/null +++ b/source/funkin/ui/options/items/NumberPreferenceItem.hx @@ -0,0 +1,107 @@ +package funkin.ui.options.items; + +import funkin.ui.TextMenuList; +import funkin.ui.AtlasText; +import funkin.input.Controls; + +/** + * Preference item that allows the player to pick a value between min and max + */ +class NumberPreferenceItem extends TextMenuItem +{ + function controls():Controls + { + return PlayerSettings.player1.controls; + } + + public var lefthandText:AtlasText; + + public var currentValue:Float; + public var min:Float; + public var max:Float; + public var step:Float; + public var precision:Int; + public var onChangeCallback:NullVoid>; + + public function new(x:Float, y:Float, name:String, defaultValue:Float, min:Float, max:Float, step:Float, precision:Int, ?callback:Float->Void):Void + { + super(x, y, name, function() { + callback(this.currentValue); + }); + lefthandText = new AtlasText(20, y, formatted(defaultValue), AtlasFont.DEFAULT); + + updateHitbox(); + + this.currentValue = defaultValue; + this.min = min; + this.max = max; + this.step = step; + this.precision = precision; + this.onChangeCallback = callback; + } + + static final HOLD_DELAY:Float = 0.5; // seconds + static final CHANGE_RATE:Float = 0.02; // seconds + + var holdDelayTimer:Float = HOLD_DELAY; // seconds + var changeRateTimer:Float = 0.0; // seconds + + override function update(elapsed:Float):Void + { + super.update(elapsed); + + // var fancyTextFancyColor:Color; + if (selected) + { + holdDelayTimer -= elapsed; + if (holdDelayTimer <= 0.0) + { + changeRateTimer -= elapsed; + } + + var jpLeft:Bool = controls().UI_LEFT_P; + var jpRight:Bool = controls().UI_RIGHT_P; + + if (jpLeft || jpRight) + { + holdDelayTimer = HOLD_DELAY; + changeRateTimer = 0.0; + } + + var shouldDecrease:Bool = jpLeft; + var shouldIncrease:Bool = jpRight; + + if (controls().UI_LEFT && holdDelayTimer <= 0.0 && changeRateTimer <= 0.0) + { + shouldDecrease = true; + changeRateTimer = CHANGE_RATE; + } + else if (controls().UI_RIGHT && holdDelayTimer <= 0.0 && changeRateTimer <= 0.0) + { + shouldIncrease = true; + changeRateTimer = CHANGE_RATE; + } + + if (shouldDecrease) currentValue -= step; + else if (shouldIncrease) currentValue += step; + currentValue = currentValue.clamp(min, max); + if (onChangeCallback != null && (shouldIncrease || shouldDecrease)) + { + onChangeCallback(currentValue); + } + } + + lefthandText.text = formatted(currentValue); + } + + function formatted(value:Float):String + { + return '${toFixed(value)}'; + } + + function toFixed(value:Float):Float + { + var multiplier:Float = Math.pow(10, precision); + return Math.floor(value * multiplier) / multiplier; + } +} From ef2885ed0e0b68ddf2e534eef1b5f6269c6700d2 Mon Sep 17 00:00:00 2001 From: AbnormalPoof Date: Mon, 24 Jun 2024 03:55:59 -0500 Subject: [PATCH 025/120] video cutscene autopause magic --- source/funkin/play/PlayState.hx | 16 ++++++++++++++-- source/funkin/play/cutscene/VideoCutscene.hx | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index f55cef388..de8492882 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -1301,12 +1301,18 @@ class PlayState extends MusicBeatSubState super.closeSubState(); } - #if discord_rpc /** * Function called when the game window gains focus. */ public override function onFocus():Void { + if (VideoCutscene.isPlaying() && FlxG.autoPause && isGamePaused) VideoCutscene.pauseVideo(); + #if html5 + else + VideoCutscene.resumeVideo(); + #end + + #if discord_rpc if (health > Constants.HEALTH_MIN && !paused && FlxG.autoPause) { if (Conductor.instance.songPosition > 0.0) DiscordClient.changePresence(detailsText, currentSong.song @@ -1318,6 +1324,7 @@ class PlayState extends MusicBeatSubState else DiscordClient.changePresence(detailsText, currentSong.song + ' (' + storyDifficultyText + ')', iconRPC); } + #end super.onFocus(); } @@ -1327,12 +1334,17 @@ class PlayState extends MusicBeatSubState */ public override function onFocusLost():Void { + #if html5 + if (FlxG.autoPause) VideoCutscene.pauseVideo(); + #end + + #if discord_rpc if (health > Constants.HEALTH_MIN && !paused && FlxG.autoPause) DiscordClient.changePresence(detailsPausedText, currentSong.song + ' (' + storyDifficultyText + ')', iconRPC); + #end super.onFocusLost(); } - #end /** * Removes any references to the current stage, then clears the stage cache, diff --git a/source/funkin/play/cutscene/VideoCutscene.hx b/source/funkin/play/cutscene/VideoCutscene.hx index 01a492a77..abbcd4f54 100644 --- a/source/funkin/play/cutscene/VideoCutscene.hx +++ b/source/funkin/play/cutscene/VideoCutscene.hx @@ -145,7 +145,7 @@ class VideoCutscene { vid.zIndex = 0; vid.bitmap.onEndReached.add(finishVideo.bind(0.5)); - vid.autoPause = false; + vid.autoPause = FlxG.autoPause; vid.cameras = [PlayState.instance.camCutscene]; From f3e04114ebd7418bee7eeada80a57704a13a3cbb Mon Sep 17 00:00:00 2001 From: lemz Date: Tue, 25 Jun 2024 17:05:15 +0200 Subject: [PATCH 026/120] use new offsets --- source/funkin/ui/options/PreferencesMenu.hx | 23 ++++++++++--------- .../ui/options/items/NumberPreferenceItem.hx | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/source/funkin/ui/options/PreferencesMenu.hx b/source/funkin/ui/options/PreferencesMenu.hx index d03fe9073..d004a46c7 100644 --- a/source/funkin/ui/options/PreferencesMenu.hx +++ b/source/funkin/ui/options/PreferencesMenu.hx @@ -84,22 +84,23 @@ class PreferencesMenu extends Page // TODO: Only do this on menu change? items.forEach(function(daItem:TextMenuItem) { var thyOffset:Int = 0; - if (Std.isOfType(daItem, NumberPreferenceItem)) thyOffset = cast(daItem, NumberPreferenceItem).lefthandText.getWidth(); + // Initializing thy text width (if thou text present) + var thyTextWidth:Int = 0; + if (Std.isOfType(daItem, NumberPreferenceItem)) thyTextWidth = cast(daItem, NumberPreferenceItem).lefthandText.getWidth(); - // Very messy but it works - if (thyOffset == 0) + if (thyTextWidth != 0) { - if (items.selectedItem == daItem) thyOffset += 150; - else - thyOffset += 120; + // Magic number because of the weird offset thats being added by default + thyOffset += thyTextWidth - 75; } - else if (items.selectedItem == daItem) + + if (items.selectedItem == daItem) { - thyOffset += 70; + thyOffset += 150; } else { - thyOffset += 25; + thyOffset += 120; } daItem.x = thyOffset; @@ -110,7 +111,7 @@ class PreferencesMenu extends Page { var checkbox:CheckboxPreferenceItem = new CheckboxPreferenceItem(0, 120 * (items.length - 1 + 1), defaultValue); - items.createItem(120, (120 * items.length) + 30, prefName, AtlasFont.BOLD, function() { + items.createItem(0, (120 * items.length) + 30, prefName, AtlasFont.BOLD, function() { var value = !checkbox.currentValue; onChange(value); checkbox.currentValue = value; @@ -122,7 +123,7 @@ class PreferencesMenu extends Page function createPrefItemNumber(prefName:String, prefDesc:String, onChange:Float->Void, defaultValue:Float, min:Float, max:Float, step:Float, precision:Int):Void { - var item = new NumberPreferenceItem(145, (120 * items.length) + 30, prefName, defaultValue, min, max, step, precision, onChange); + var item = new NumberPreferenceItem(0, (120 * items.length) + 30, prefName, defaultValue, min, max, step, precision, onChange); items.addItem(prefName, item); preferenceItems.add(item.lefthandText); } diff --git a/source/funkin/ui/options/items/NumberPreferenceItem.hx b/source/funkin/ui/options/items/NumberPreferenceItem.hx index 795b6c994..eeea3112e 100644 --- a/source/funkin/ui/options/items/NumberPreferenceItem.hx +++ b/source/funkin/ui/options/items/NumberPreferenceItem.hx @@ -28,7 +28,7 @@ class NumberPreferenceItem extends TextMenuItem super(x, y, name, function() { callback(this.currentValue); }); - lefthandText = new AtlasText(20, y, formatted(defaultValue), AtlasFont.DEFAULT); + lefthandText = new AtlasText(15, y, formatted(defaultValue), AtlasFont.DEFAULT); updateHitbox(); From 91bc63004abdd1a669ac6779d83fde5c88b641bd Mon Sep 17 00:00:00 2001 From: gamerbross <55158797+gamerbross@users.noreply.github.com> Date: Thu, 27 Jun 2024 21:00:25 +0200 Subject: [PATCH 027/120] FunkinSound.playOnce return sound --- source/funkin/audio/FunkinSound.hx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/funkin/audio/FunkinSound.hx b/source/funkin/audio/FunkinSound.hx index c70f195d2..8d2ad9a32 100644 --- a/source/funkin/audio/FunkinSound.hx +++ b/source/funkin/audio/FunkinSound.hx @@ -533,11 +533,12 @@ class FunkinSound extends FlxSound implements ICloneable * Play a sound effect once, then destroy it. * @param key * @param volume - * @return static function construct():FunkinSound + * @return A `FunkinSound` object, or `null` if the sound could not be loaded. */ - public static function playOnce(key:String, volume:Float = 1.0, ?onComplete:Void->Void, ?onLoad:Void->Void):Void + public static function playOnce(key:String, volume:Float = 1.0, ?onComplete:Void->Void, ?onLoad:Void->Void):FunkinSound { var result = FunkinSound.load(key, volume, false, true, true, onComplete, onLoad); + return result; } /** From 02dd7e7264ab8c2d9f2136a1e07ff7e0e41e6904 Mon Sep 17 00:00:00 2001 From: gamerbross <55158797+gamerbross@users.noreply.github.com> Date: Thu, 27 Jun 2024 21:05:01 +0200 Subject: [PATCH 028/120] Implement danceEvery for Characters --- source/funkin/play/character/BaseCharacter.hx | 1 + 1 file changed, 1 insertion(+) diff --git a/source/funkin/play/character/BaseCharacter.hx b/source/funkin/play/character/BaseCharacter.hx index 4ef86c6a9..f9e1f00f2 100644 --- a/source/funkin/play/character/BaseCharacter.hx +++ b/source/funkin/play/character/BaseCharacter.hx @@ -180,6 +180,7 @@ class BaseCharacter extends Bopper { this.characterName = _data.name; this.name = _data.name; + this.danceEvery = _data.danceEvery; this.singTimeSteps = _data.singTime; this.globalOffsets = _data.offsets; this.flipX = _data.flipX; From 09c8a2600ee2d36a6ab23cfd4e68b7227bc15a90 Mon Sep 17 00:00:00 2001 From: gamerbross <55158797+gamerbross@users.noreply.github.com> Date: Sat, 29 Jun 2024 22:54:25 +0200 Subject: [PATCH 029/120] Fix null safety compiling --- source/funkin/audio/FunkinSound.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/funkin/audio/FunkinSound.hx b/source/funkin/audio/FunkinSound.hx index 8d2ad9a32..a0175ad4d 100644 --- a/source/funkin/audio/FunkinSound.hx +++ b/source/funkin/audio/FunkinSound.hx @@ -535,9 +535,9 @@ class FunkinSound extends FlxSound implements ICloneable * @param volume * @return A `FunkinSound` object, or `null` if the sound could not be loaded. */ - public static function playOnce(key:String, volume:Float = 1.0, ?onComplete:Void->Void, ?onLoad:Void->Void):FunkinSound + public static function playOnce(key:String, volume:Float = 1.0, ?onComplete:Void->Void, ?onLoad:Void->Void):Null { - var result = FunkinSound.load(key, volume, false, true, true, onComplete, onLoad); + var result:Null = FunkinSound.load(key, volume, false, true, true, onComplete, onLoad); return result; } From 488fc6888f7d8588866ddcc1310c434365eae2d0 Mon Sep 17 00:00:00 2001 From: FlooferLand! <76737186+FlooferLand@users.noreply.github.com> Date: Mon, 1 Jul 2024 14:42:50 +0300 Subject: [PATCH 030/120] Added new settings items --- source/funkin/ui/options/MenuItemEnums.hx | 10 ++ source/funkin/ui/options/PreferencesMenu.hx | 149 +++++++++++------- .../options/items/CheckboxPreferenceItem.hx | 49 ++++++ .../ui/options/items/EnumPreferenceItem.hx | 84 ++++++++++ .../ui/options/items/NumberPreferenceItem.hx | 136 ++++++++++++++++ 5 files changed, 372 insertions(+), 56 deletions(-) create mode 100644 source/funkin/ui/options/MenuItemEnums.hx create mode 100644 source/funkin/ui/options/items/CheckboxPreferenceItem.hx create mode 100644 source/funkin/ui/options/items/EnumPreferenceItem.hx create mode 100644 source/funkin/ui/options/items/NumberPreferenceItem.hx diff --git a/source/funkin/ui/options/MenuItemEnums.hx b/source/funkin/ui/options/MenuItemEnums.hx new file mode 100644 index 000000000..4513a92af --- /dev/null +++ b/source/funkin/ui/options/MenuItemEnums.hx @@ -0,0 +1,10 @@ +package funkin.ui.options; + +// Add enums for use with `EnumPreferenceItem` here! +/* Example: + class MyOptionEnum + { + public static inline var YuhUh = "true"; // "true" is the value's ID + public static inline var NuhUh = "false"; + } + */ diff --git a/source/funkin/ui/options/PreferencesMenu.hx b/source/funkin/ui/options/PreferencesMenu.hx index 783aef0ba..5fbefceed 100644 --- a/source/funkin/ui/options/PreferencesMenu.hx +++ b/source/funkin/ui/options/PreferencesMenu.hx @@ -8,6 +8,11 @@ import funkin.ui.AtlasText.AtlasFont; import funkin.ui.options.OptionsState.Page; import funkin.graphics.FunkinCamera; import funkin.ui.TextMenuList.TextMenuItem; +import funkin.audio.FunkinSound; +import funkin.ui.options.MenuItemEnums; +import funkin.ui.options.items.CheckboxPreferenceItem; +import funkin.ui.options.items.NumberPreferenceItem; +import funkin.ui.options.items.EnumPreferenceItem; class PreferencesMenu extends Page { @@ -69,11 +74,51 @@ class PreferencesMenu extends Page }, Preferences.autoPause); } + override function update(elapsed:Float):Void + { + super.update(elapsed); + + // Indent the selected item. + items.forEach(function(daItem:TextMenuItem) { + var thyOffset:Int = 0; + + // Initializing thy text width (if thou text present) + var thyTextWidth:Int = 0; + if (Std.isOfType(daItem, EnumPreferenceItem)) thyTextWidth = cast(daItem, EnumPreferenceItem).lefthandText.getWidth(); + else if (Std.isOfType(daItem, NumberPreferenceItem)) thyTextWidth = cast(daItem, NumberPreferenceItem).lefthandText.getWidth(); + + if (thyTextWidth != 0) + { + // Magic number because of the weird offset thats being added by default + thyOffset += thyTextWidth - 75; + } + + if (items.selectedItem == daItem) + { + thyOffset += 150; + } + else + { + thyOffset += 120; + } + + daItem.x = thyOffset; + }); + } + + // - Preference item creation methods - + // Should be moved into a separate PreferenceItems class but you can't access PreferencesMenu.items and PreferencesMenu.preferenceItems from outside. + + /** + * Creates a pref item that works with booleans + * @param onChange Gets called every time the player changes the value; use this to apply the value + * @param defaultValue The value that is loaded in when the pref item is created (usually your Preferences.settingVariable) + */ function createPrefItemCheckbox(prefName:String, prefDesc:String, onChange:Bool->Void, defaultValue:Bool):Void { var checkbox:CheckboxPreferenceItem = new CheckboxPreferenceItem(0, 120 * (items.length - 1 + 1), defaultValue); - items.createItem(120, (120 * items.length) + 30, prefName, AtlasFont.BOLD, function() { + items.createItem(0, (120 * items.length) + 30, prefName, AtlasFont.BOLD, function() { var value = !checkbox.currentValue; onChange(value); checkbox.currentValue = value; @@ -82,62 +127,54 @@ class PreferencesMenu extends Page preferenceItems.add(checkbox); } - override function update(elapsed:Float) + /** + * Creates a pref item that works with general numbers + * @param onChange Gets called every time the player changes the value; use this to apply the value + * @param valueFormatter Will get called every time the game needs to display the float value; use this to change how the displayed value looks + * @param defaultValue The value that is loaded in when the pref item is created (usually your Preferences.settingVariable) + * @param min Minimum value (example: 0) + * @param max Maximum value (example: 10) + * @param step The value to increment/decrement by (default = 0.1) + * @param precision Rounds decimals up to a `precision` amount of digits (ex: 4 -> 0.1234, 2 -> 0.12) + */ + function createPrefItemNumber(prefName:String, prefDesc:String, onChange:Float->Void, ?valueFormatter:Float->String, defaultValue:Int, min:Int, max:Int, + step:Float = 0.1, precision:Int):Void { - super.update(elapsed); + var item = new NumberPreferenceItem(0, (120 * items.length) + 30, prefName, defaultValue, min, max, step, precision, onChange, valueFormatter); + items.addItem(prefName, item); + preferenceItems.add(item.lefthandText); + } - // Indent the selected item. - // TODO: Only do this on menu change? - items.forEach(function(daItem:TextMenuItem) { - if (items.selectedItem == daItem) daItem.x = 150; - else - daItem.x = 120; - }); - } -} - -class CheckboxPreferenceItem extends FlxSprite -{ - public var currentValue(default, set):Bool; - - public function new(x:Float, y:Float, defaultValue:Bool = false) - { - super(x, y); - - frames = Paths.getSparrowAtlas('checkboxThingie'); - animation.addByPrefix('static', 'Check Box unselected', 24, false); - animation.addByPrefix('checked', 'Check Box selecting animation', 24, false); - - setGraphicSize(Std.int(width * 0.7)); - updateHitbox(); - - this.currentValue = defaultValue; - } - - override function update(elapsed:Float) - { - super.update(elapsed); - - switch (animation.curAnim.name) - { - case 'static': - offset.set(); - case 'checked': - offset.set(17, 70); - } - } - - function set_currentValue(value:Bool):Bool - { - if (value) - { - animation.play('checked', true); - } - else - { - animation.play('static'); - } - - return currentValue = value; + /** + * Creates a pref item that works with number percentages + * @param onChange Gets called every time the player changes the value; use this to apply the value + * @param defaultValue The value that is loaded in when the pref item is created (usually your Preferences.settingVariable) + * @param min Minimum value (default = 0) + * @param max Maximum value (default = 100) + */ + function createPrefItemPercentage(prefName:String, prefDesc:String, onChange:Int->Void, defaultValue:Int, min:Int = 0, max:Int = 100):Void + { + var newCallback = function(value:Float) { + onChange(Std.int(value)); + }; + var formatter = function(value:Float) { + return '${value}%'; + }; + var item = new NumberPreferenceItem(0, (120 * items.length) + 30, prefName, defaultValue, min, max, 10, 0, newCallback, formatter); + items.addItem(prefName, item); + preferenceItems.add(item.lefthandText); + } + + /** + * Creates a pref item that works with enums + * @param values Maps enum values to display strings _(ex: `NoteHitSoundType.PingPong => "Ping pong"`)_ + * @param onChange Gets called every time the player changes the value; use this to apply the value + * @param defaultValue The value that is loaded in when the pref item is created (usually your Preferences.settingVariable) + */ + function createPrefItemEnum(prefName:String, prefDesc:String, values:Map, onChange:String->Void, defaultValue:String):Void + { + var item = new EnumPreferenceItem(0, (120 * items.length) + 30, prefName, values, defaultValue, onChange); + items.addItem(prefName, item); + preferenceItems.add(item.lefthandText); } } diff --git a/source/funkin/ui/options/items/CheckboxPreferenceItem.hx b/source/funkin/ui/options/items/CheckboxPreferenceItem.hx new file mode 100644 index 000000000..88c4fb6b0 --- /dev/null +++ b/source/funkin/ui/options/items/CheckboxPreferenceItem.hx @@ -0,0 +1,49 @@ +package funkin.ui.options.items; + +import flixel.FlxSprite.FlxSprite; + +class CheckboxPreferenceItem extends FlxSprite +{ + public var currentValue(default, set):Bool; + + public function new(x:Float, y:Float, defaultValue:Bool = false) + { + super(x, y); + + frames = Paths.getSparrowAtlas('checkboxThingie'); + animation.addByPrefix('static', 'Check Box unselected', 24, false); + animation.addByPrefix('checked', 'Check Box selecting animation', 24, false); + + setGraphicSize(Std.int(width * 0.7)); + updateHitbox(); + + this.currentValue = defaultValue; + } + + override function update(elapsed:Float) + { + super.update(elapsed); + + switch (animation.curAnim.name) + { + case 'static': + offset.set(); + case 'checked': + offset.set(17, 70); + } + } + + function set_currentValue(value:Bool):Bool + { + if (value) + { + animation.play('checked', true); + } + else + { + animation.play('static'); + } + + return currentValue = value; + } +} diff --git a/source/funkin/ui/options/items/EnumPreferenceItem.hx b/source/funkin/ui/options/items/EnumPreferenceItem.hx new file mode 100644 index 000000000..02a273353 --- /dev/null +++ b/source/funkin/ui/options/items/EnumPreferenceItem.hx @@ -0,0 +1,84 @@ +package funkin.ui.options.items; + +import funkin.ui.TextMenuList; +import funkin.ui.AtlasText; +import funkin.input.Controls; +import funkin.ui.options.MenuItemEnums; +import haxe.EnumTools; + +/** + * Preference item that allows the player to pick a value from an enum (list of values) + */ +class EnumPreferenceItem extends TextMenuItem +{ + function controls():Controls + { + return PlayerSettings.player1.controls; + } + + public var lefthandText:AtlasText; + + public var currentValue:String; + public var onChangeCallback:NullVoid>; + public var map:Map; + public var keys:Array = []; + + var index = 0; + + public function new(x:Float, y:Float, name:String, map:Map, defaultValue:String, ?callback:String->Void) + { + super(x, y, name, function() { + callback(this.currentValue); + }); + + updateHitbox(); + + this.map = map; + this.currentValue = defaultValue; + this.onChangeCallback = callback; + + var i:Int = 0; + for (key in map.keys()) + { + this.keys.push(key); + if (this.currentValue == key) index = i; + i += 1; + } + + lefthandText = new AtlasText(15, y, formatted(defaultValue), AtlasFont.DEFAULT); + } + + override function update(elapsed:Float):Void + { + super.update(elapsed); + + // var fancyTextFancyColor:Color; + if (selected) + { + var shouldDecrease:Bool = controls().UI_LEFT_P; + var shouldIncrease:Bool = controls().UI_RIGHT_P; + + if (shouldDecrease) index -= 1; + if (shouldIncrease) index += 1; + + if (index > keys.length - 1) index = 0; + if (index < 0) index = keys.length - 1; + + currentValue = keys[index]; + if (onChangeCallback != null && (shouldIncrease || shouldDecrease)) + { + onChangeCallback(currentValue); + } + } + + lefthandText.text = formatted(currentValue); + } + + function formatted(value:String):String + { + // FIXME: Can't add arrows around the text because the font doesn't support < > + // var leftArrow:String = selected ? '<' : ''; + // var rightArrow:String = selected ? '>' : ''; + return '${map.get(value) ?? value}'; + } +} diff --git a/source/funkin/ui/options/items/NumberPreferenceItem.hx b/source/funkin/ui/options/items/NumberPreferenceItem.hx new file mode 100644 index 000000000..f3cd3cd46 --- /dev/null +++ b/source/funkin/ui/options/items/NumberPreferenceItem.hx @@ -0,0 +1,136 @@ +package funkin.ui.options.items; + +import funkin.ui.TextMenuList; +import funkin.ui.AtlasText; +import funkin.input.Controls; + +/** + * Preference item that allows the player to pick a value between min and max + */ +class NumberPreferenceItem extends TextMenuItem +{ + function controls():Controls + { + return PlayerSettings.player1.controls; + } + + // Widgets + public var lefthandText:AtlasText; + + // Constants + static final HOLD_DELAY:Float = 0.3; // seconds + static final CHANGE_RATE:Float = 0.08; // seconds + + // Constructor-initialized variables + public var currentValue:Float; + public var min:Float; + public var max:Float; + public var step:Float; + public var precision:Int; + public var onChangeCallback:NullVoid>; + public var valueFormatter:NullString>; + + // Variables + var holdDelayTimer:Float = HOLD_DELAY; // seconds + var changeRateTimer:Float = 0.0; // seconds + + /** + * @param min Minimum value (example: 0) + * @param max Maximum value (example: 100) + * @param step The value to increment/decrement by (example: 10) + * @param callback Will get called every time the user changes the setting; use this to apply/save the setting. + * @param valueFormatter Will get called every time the game needs to display the float value; use this to change how the displayed string looks + */ + public function new(x:Float, y:Float, name:String, defaultValue:Float, min:Float, max:Float, step:Float, precision:Int, ?callback:Float->Void, + ?valueFormatter:Float->String):Void + { + super(x, y, name, function() { + callback(this.currentValue); + }); + lefthandText = new AtlasText(15, y, formatted(defaultValue), AtlasFont.DEFAULT); + + updateHitbox(); + + this.currentValue = defaultValue; + this.min = min; + this.max = max; + this.step = step; + this.precision = precision; + this.onChangeCallback = callback; + this.valueFormatter = valueFormatter; + } + + override function update(elapsed:Float):Void + { + super.update(elapsed); + + // var fancyTextFancyColor:Color; + if (selected) + { + holdDelayTimer -= elapsed; + if (holdDelayTimer <= 0.0) + { + changeRateTimer -= elapsed; + } + + var jpLeft:Bool = controls().UI_LEFT_P; + var jpRight:Bool = controls().UI_RIGHT_P; + + if (jpLeft || jpRight) + { + holdDelayTimer = HOLD_DELAY; + changeRateTimer = 0.0; + } + + var shouldDecrease:Bool = jpLeft; + var shouldIncrease:Bool = jpRight; + + if (controls().UI_LEFT && holdDelayTimer <= 0.0 && changeRateTimer <= 0.0) + { + shouldDecrease = true; + changeRateTimer = CHANGE_RATE; + } + else if (controls().UI_RIGHT && holdDelayTimer <= 0.0 && changeRateTimer <= 0.0) + { + shouldIncrease = true; + changeRateTimer = CHANGE_RATE; + } + + // Actually increasing/decreasing the value + if (shouldDecrease) + { + var isBelowMin:Bool = currentValue - step < min; + currentValue = (currentValue - step).clamp(min, max); + if (onChangeCallback != null && !isBelowMin) onChangeCallback(currentValue); + } + else if (shouldIncrease) + { + var isAboveMax:Bool = currentValue + step > max; + currentValue = (currentValue + step).clamp(min, max); + if (onChangeCallback != null && !isAboveMax) onChangeCallback(currentValue); + } + } + + lefthandText.text = formatted(currentValue); + } + + /** Turns the float into a string */ + function formatted(value:Float):String + { + var float:Float = toFixed(value); + if (valueFormatter != null) + { + return valueFormatter(float); + } + else + { + return '${float}'; + } + } + + function toFixed(value:Float):Float + { + var multiplier:Float = Math.pow(10, precision); + return Math.floor(value * multiplier) / multiplier; + } +} From be5e0aafeb68b366db11227f72befb99d4e7b2f4 Mon Sep 17 00:00:00 2001 From: FlooferLand! <76737186+FlooferLand@users.noreply.github.com> Date: Mon, 1 Jul 2024 14:44:23 +0300 Subject: [PATCH 031/120] Added getWidth --- source/funkin/ui/AtlasText.hx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/source/funkin/ui/AtlasText.hx b/source/funkin/ui/AtlasText.hx index 186d87c2a..ef74abc1e 100644 --- a/source/funkin/ui/AtlasText.hx +++ b/source/funkin/ui/AtlasText.hx @@ -152,6 +152,32 @@ class AtlasText extends FlxTypedSpriteGroup } } + public function getWidth():Int + { + var width = 0; + for (char in this.text.split("")) + { + switch (char) + { + case " ": + { + width += 40; + } + case "\n": + {} + case char: + { + var sprite = new AtlasChar(atlas, char); + sprite.revive(); + sprite.char = char; + sprite.alpha = 1; + width += Std.int(sprite.width); + } + } + } + return width; + } + override function toString() { return "InputItem, " + FlxStringUtil.getDebugString([ From 927e37b35bda92888f0c0b47256884a0285cadd3 Mon Sep 17 00:00:00 2001 From: lemz Date: Tue, 2 Jul 2024 17:18:46 +0200 Subject: [PATCH 032/120] use new numberpreferenceitem --- source/funkin/ui/options/PreferencesMenu.hx | 8 +-- .../ui/options/items/NumberPreferenceItem.hx | 55 ++++++++++++++----- 2 files changed, 46 insertions(+), 17 deletions(-) diff --git a/source/funkin/ui/options/PreferencesMenu.hx b/source/funkin/ui/options/PreferencesMenu.hx index d004a46c7..80dad0241 100644 --- a/source/funkin/ui/options/PreferencesMenu.hx +++ b/source/funkin/ui/options/PreferencesMenu.hx @@ -54,7 +54,7 @@ class PreferencesMenu extends Page #if !web createPrefItemNumber('FPS', 'The framerate that the game is running on', function(value:Float) { Preferences.framerate = Std.int(value); - }, Preferences.framerate, 60, 360, 1, 0); + }, null, Preferences.framerate, 60, 360, 1, 0); #end createPrefItemCheckbox('Naughtyness', 'Toggle displaying raunchy content', function(value:Bool):Void { Preferences.naughtyness = value; @@ -120,10 +120,10 @@ class PreferencesMenu extends Page preferenceItems.add(checkbox); } - function createPrefItemNumber(prefName:String, prefDesc:String, onChange:Float->Void, defaultValue:Float, min:Float, max:Float, step:Float, - precision:Int):Void + function createPrefItemNumber(prefName:String, prefDesc:String, onChange:Float->Void, ?valueFormatter:Float->String, defaultValue:Int, min:Int, max:Int, + step:Float = 0.1, precision:Int):Void { - var item = new NumberPreferenceItem(0, (120 * items.length) + 30, prefName, defaultValue, min, max, step, precision, onChange); + var item = new NumberPreferenceItem(0, (120 * items.length) + 30, prefName, defaultValue, min, max, step, precision, onChange, valueFormatter); items.addItem(prefName, item); preferenceItems.add(item.lefthandText); } diff --git a/source/funkin/ui/options/items/NumberPreferenceItem.hx b/source/funkin/ui/options/items/NumberPreferenceItem.hx index eeea3112e..f3cd3cd46 100644 --- a/source/funkin/ui/options/items/NumberPreferenceItem.hx +++ b/source/funkin/ui/options/items/NumberPreferenceItem.hx @@ -14,16 +14,35 @@ class NumberPreferenceItem extends TextMenuItem return PlayerSettings.player1.controls; } + // Widgets public var lefthandText:AtlasText; + // Constants + static final HOLD_DELAY:Float = 0.3; // seconds + static final CHANGE_RATE:Float = 0.08; // seconds + + // Constructor-initialized variables public var currentValue:Float; public var min:Float; public var max:Float; public var step:Float; public var precision:Int; public var onChangeCallback:NullVoid>; + public var valueFormatter:NullString>; - public function new(x:Float, y:Float, name:String, defaultValue:Float, min:Float, max:Float, step:Float, precision:Int, ?callback:Float->Void):Void + // Variables + var holdDelayTimer:Float = HOLD_DELAY; // seconds + var changeRateTimer:Float = 0.0; // seconds + + /** + * @param min Minimum value (example: 0) + * @param max Maximum value (example: 100) + * @param step The value to increment/decrement by (example: 10) + * @param callback Will get called every time the user changes the setting; use this to apply/save the setting. + * @param valueFormatter Will get called every time the game needs to display the float value; use this to change how the displayed string looks + */ + public function new(x:Float, y:Float, name:String, defaultValue:Float, min:Float, max:Float, step:Float, precision:Int, ?callback:Float->Void, + ?valueFormatter:Float->String):Void { super(x, y, name, function() { callback(this.currentValue); @@ -38,14 +57,9 @@ class NumberPreferenceItem extends TextMenuItem this.step = step; this.precision = precision; this.onChangeCallback = callback; + this.valueFormatter = valueFormatter; } - static final HOLD_DELAY:Float = 0.5; // seconds - static final CHANGE_RATE:Float = 0.02; // seconds - - var holdDelayTimer:Float = HOLD_DELAY; // seconds - var changeRateTimer:Float = 0.0; // seconds - override function update(elapsed:Float):Void { super.update(elapsed); @@ -82,21 +96,36 @@ class NumberPreferenceItem extends TextMenuItem changeRateTimer = CHANGE_RATE; } - if (shouldDecrease) currentValue -= step; - else if (shouldIncrease) currentValue += step; - currentValue = currentValue.clamp(min, max); - if (onChangeCallback != null && (shouldIncrease || shouldDecrease)) + // Actually increasing/decreasing the value + if (shouldDecrease) { - onChangeCallback(currentValue); + var isBelowMin:Bool = currentValue - step < min; + currentValue = (currentValue - step).clamp(min, max); + if (onChangeCallback != null && !isBelowMin) onChangeCallback(currentValue); + } + else if (shouldIncrease) + { + var isAboveMax:Bool = currentValue + step > max; + currentValue = (currentValue + step).clamp(min, max); + if (onChangeCallback != null && !isAboveMax) onChangeCallback(currentValue); } } lefthandText.text = formatted(currentValue); } + /** Turns the float into a string */ function formatted(value:Float):String { - return '${toFixed(value)}'; + var float:Float = toFixed(value); + if (valueFormatter != null) + { + return valueFormatter(float); + } + else + { + return '${float}'; + } } function toFixed(value:Float):Float From f82f0d3b05f7ec03c4d80fe7a8abdf01667c0973 Mon Sep 17 00:00:00 2001 From: gamerbross <55158797+gamerbross@users.noreply.github.com> Date: Mon, 8 Jul 2024 03:17:28 +0200 Subject: [PATCH 033/120] Remove SustainTrail forced alpha --- source/funkin/play/notes/Strumline.hx | 1 - 1 file changed, 1 deletion(-) diff --git a/source/funkin/play/notes/Strumline.hx b/source/funkin/play/notes/Strumline.hx index 0e4b6645f..5784586ec 100644 --- a/source/funkin/play/notes/Strumline.hx +++ b/source/funkin/play/notes/Strumline.hx @@ -598,7 +598,6 @@ class Strumline extends FlxSpriteGroup { note.holdNoteSprite.hitNote = true; note.holdNoteSprite.missedNote = false; - note.holdNoteSprite.alpha = 1.0; note.holdNoteSprite.sustainLength = (note.holdNoteSprite.strumTime + note.holdNoteSprite.fullSustainLength) - conductorInUse.songPosition; } From 717894300d6041e1a24b10682122d9feffb7d18a Mon Sep 17 00:00:00 2001 From: AppleHair Date: Tue, 9 Jul 2024 19:59:31 +0300 Subject: [PATCH 034/120] [BUGFIX] Fixed `cancelMenu` sound not playing after switching state. --- source/funkin/ui/mainmenu/MainMenuState.hx | 2 +- source/funkin/ui/options/OptionsState.hx | 2 +- source/funkin/ui/story/StoryMenuState.hx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/funkin/ui/mainmenu/MainMenuState.hx b/source/funkin/ui/mainmenu/MainMenuState.hx index d09536eea..a2bdd23f8 100644 --- a/source/funkin/ui/mainmenu/MainMenuState.hx +++ b/source/funkin/ui/mainmenu/MainMenuState.hx @@ -409,8 +409,8 @@ class MainMenuState extends MusicBeatState if (controls.BACK && menuItems.enabled && !menuItems.busy) { - FunkinSound.playOnce(Paths.sound('cancelMenu')); FlxG.switchState(() -> new TitleState()); + FunkinSound.playOnce(Paths.sound('cancelMenu')); } } } diff --git a/source/funkin/ui/options/OptionsState.hx b/source/funkin/ui/options/OptionsState.hx index 40308d96b..a2301e6a3 100644 --- a/source/funkin/ui/options/OptionsState.hx +++ b/source/funkin/ui/options/OptionsState.hx @@ -145,8 +145,8 @@ class Page extends FlxGroup { if (canExit && controls.BACK) { - FunkinSound.playOnce(Paths.sound('cancelMenu')); exit(); + FunkinSound.playOnce(Paths.sound('cancelMenu')); } } diff --git a/source/funkin/ui/story/StoryMenuState.hx b/source/funkin/ui/story/StoryMenuState.hx index 06a83ab4d..04d021256 100644 --- a/source/funkin/ui/story/StoryMenuState.hx +++ b/source/funkin/ui/story/StoryMenuState.hx @@ -374,9 +374,9 @@ class StoryMenuState extends MusicBeatState if (controls.BACK && !exitingMenu && !selectedLevel) { - FunkinSound.playOnce(Paths.sound('cancelMenu')); exitingMenu = true; FlxG.switchState(() -> new MainMenuState()); + FunkinSound.playOnce(Paths.sound('cancelMenu')); } } From 481f7ab61a6e206bc3aadfd2754cdc299116c087 Mon Sep 17 00:00:00 2001 From: gamerbross <55158797+gamerbross@users.noreply.github.com> Date: Wed, 10 Jul 2024 00:23:06 +0200 Subject: [PATCH 035/120] Fix F5 chart not reloading --- source/funkin/play/PlayState.hx | 59 ++----------------- source/funkin/ui/MusicBeatState.hx | 7 +-- source/funkin/ui/MusicBeatSubState.hx | 5 +- .../util/plugins/ReloadAssetsDebugPlugin.hx | 14 ++++- 4 files changed, 17 insertions(+), 68 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index f55cef388..8b6753035 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -1335,64 +1335,13 @@ class PlayState extends MusicBeatSubState #end /** - * Removes any references to the current stage, then clears the stage cache, - * then reloads all the stages. - * - * This is useful for when you want to edit a stage without reloading the whole game. - * Reloading works on both the JSON and the HXC, if applicable. - * * Call this by pressing F5 on a debug build. */ - override function debug_refreshModules():Void + override function reloadAssets():Void { - // Prevent further gameplay updates, which will try to reference dead objects. - criticalFailure = true; - - // Remove the current stage. If the stage gets deleted while it's still in use, - // it'll probably crash the game or something. - if (this.currentStage != null) - { - remove(currentStage); - var event:ScriptEvent = new ScriptEvent(DESTROY, false); - ScriptEventDispatcher.callEvent(currentStage, event); - currentStage = null; - } - - if (!overrideMusic) - { - // Stop the instrumental. - if (FlxG.sound.music != null) - { - FlxG.sound.music.destroy(); - FlxG.sound.music = null; - } - - // Stop the vocals. - if (vocals != null && vocals.exists) - { - vocals.destroy(); - vocals = null; - } - } - else - { - // Stop the instrumental. - if (FlxG.sound.music != null) - { - FlxG.sound.music.stop(); - } - - // Stop the vocals. - if (vocals != null && vocals.exists) - { - vocals.stop(); - } - } - - super.debug_refreshModules(); - - var event:ScriptEvent = new ScriptEvent(CREATE, false); - ScriptEventDispatcher.callEvent(currentSong, event); + funkin.modding.PolymodHandler.forceReloadAssets(); + lastParams.targetSong = SongRegistry.instance.fetchEntry(currentSong.id); + LoadingState.loadPlayState(lastParams); } override function stepHit():Bool diff --git a/source/funkin/ui/MusicBeatState.hx b/source/funkin/ui/MusicBeatState.hx index 92169df75..8668b64c1 100644 --- a/source/funkin/ui/MusicBeatState.hx +++ b/source/funkin/ui/MusicBeatState.hx @@ -78,9 +78,6 @@ class MusicBeatState extends FlxTransitionableState implements IEventHandler { // Emergency exit button. if (FlxG.keys.justPressed.F4) FlxG.switchState(() -> new MainMenuState()); - - // This can now be used in EVERY STATE YAY! - if (FlxG.keys.justPressed.F5) debug_refreshModules(); } override function update(elapsed:Float) @@ -114,12 +111,10 @@ class MusicBeatState extends FlxTransitionableState implements IEventHandler ModuleHandler.callEvent(event); } - function debug_refreshModules() + function reloadAssets() { PolymodHandler.forceReloadAssets(); - this.destroy(); - // Create a new instance of the current state, so old data is cleared. FlxG.resetState(); } diff --git a/source/funkin/ui/MusicBeatSubState.hx b/source/funkin/ui/MusicBeatSubState.hx index 9035d12ff..5c40b37bc 100644 --- a/source/funkin/ui/MusicBeatSubState.hx +++ b/source/funkin/ui/MusicBeatSubState.hx @@ -72,9 +72,6 @@ class MusicBeatSubState extends FlxSubState implements IEventHandler // Emergency exit button. if (FlxG.keys.justPressed.F4) FlxG.switchState(() -> new MainMenuState()); - // This can now be used in EVERY STATE YAY! - if (FlxG.keys.justPressed.F5) debug_refreshModules(); - // Display Conductor info in the watch window. FlxG.watch.addQuick("musicTime", FlxG.sound.music?.time ?? 0.0); Conductor.watchQuick(conductorInUse); @@ -82,7 +79,7 @@ class MusicBeatSubState extends FlxSubState implements IEventHandler dispatchEvent(new UpdateScriptEvent(elapsed)); } - function debug_refreshModules() + function reloadAssets() { PolymodHandler.forceReloadAssets(); diff --git a/source/funkin/util/plugins/ReloadAssetsDebugPlugin.hx b/source/funkin/util/plugins/ReloadAssetsDebugPlugin.hx index f69609531..0e1e238ac 100644 --- a/source/funkin/util/plugins/ReloadAssetsDebugPlugin.hx +++ b/source/funkin/util/plugins/ReloadAssetsDebugPlugin.hx @@ -1,6 +1,9 @@ package funkin.util.plugins; +import flixel.FlxG; import flixel.FlxBasic; +import funkin.ui.MusicBeatState; +import funkin.ui.MusicBeatSubState; /** * A plugin which adds functionality to press `F5` to reload all game assets, then reload the current state. @@ -28,10 +31,15 @@ class ReloadAssetsDebugPlugin extends FlxBasic if (FlxG.keys.justPressed.F5) #end { - funkin.modding.PolymodHandler.forceReloadAssets(); + var state:Dynamic = FlxG.state; + if (state is MusicBeatState || state is MusicBeatSubState) state.reloadAssets(); + else + { + funkin.modding.PolymodHandler.forceReloadAssets(); - // Create a new instance of the current state, so old data is cleared. - FlxG.resetState(); + // Create a new instance of the current state, so old data is cleared. + FlxG.resetState(); + } } } From 9ad2bb35f9b7f73b690a08b421fecd6a1eab0a8d Mon Sep 17 00:00:00 2001 From: gamerbross <55158797+gamerbross@users.noreply.github.com> Date: Wed, 10 Jul 2024 01:26:16 +0200 Subject: [PATCH 036/120] ChartEditor Live Input Code Refactor + 6 key fix --- .../ui/debug/charting/ChartEditorState.hx | 57 ++++++------------- 1 file changed, 18 insertions(+), 39 deletions(-) diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index f72cca77f..5e7493840 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -282,6 +282,21 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState */ public static final WELCOME_MUSIC_FADE_IN_DURATION:Float = 10.0; + /** + * A map of the keys for every live input style. + */ + public static final LIVE_INPUT_KEYS:Map> = [ + NumberKeys => [ + FIVE, SIX, SEVEN, EIGHT, + ONE, TWO, THREE, FOUR + ], + WASDKeys => [ + LEFT, DOWN, UP, RIGHT, + A, S, W, D + ], + None => [] + ]; + /** * INSTANCE DATA */ @@ -5129,46 +5144,10 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState function handlePlayhead():Void { // Place notes at the playhead with the keyboard. - switch (currentLiveInputStyle) + for (note => key in LIVE_INPUT_KEYS[currentLiveInputStyle]) { - case ChartEditorLiveInputStyle.WASDKeys: - if (FlxG.keys.justPressed.A) placeNoteAtPlayhead(4); - if (FlxG.keys.justReleased.A) finishPlaceNoteAtPlayhead(4); - if (FlxG.keys.justPressed.S) placeNoteAtPlayhead(5); - if (FlxG.keys.justReleased.S) finishPlaceNoteAtPlayhead(5); - if (FlxG.keys.justPressed.W) placeNoteAtPlayhead(6); - if (FlxG.keys.justReleased.W) finishPlaceNoteAtPlayhead(6); - if (FlxG.keys.justPressed.D) placeNoteAtPlayhead(7); - if (FlxG.keys.justReleased.D) finishPlaceNoteAtPlayhead(7); - - if (FlxG.keys.justPressed.LEFT) placeNoteAtPlayhead(0); - if (FlxG.keys.justReleased.LEFT) finishPlaceNoteAtPlayhead(0); - if (FlxG.keys.justPressed.DOWN) placeNoteAtPlayhead(1); - if (FlxG.keys.justReleased.DOWN) finishPlaceNoteAtPlayhead(1); - if (FlxG.keys.justPressed.UP) placeNoteAtPlayhead(2); - if (FlxG.keys.justReleased.UP) finishPlaceNoteAtPlayhead(2); - if (FlxG.keys.justPressed.RIGHT) placeNoteAtPlayhead(3); - if (FlxG.keys.justReleased.RIGHT) finishPlaceNoteAtPlayhead(3); - case ChartEditorLiveInputStyle.NumberKeys: - // Flipped because Dad is on the left but represents data 0-3. - if (FlxG.keys.justPressed.ONE) placeNoteAtPlayhead(4); - if (FlxG.keys.justReleased.ONE) finishPlaceNoteAtPlayhead(4); - if (FlxG.keys.justPressed.TWO) placeNoteAtPlayhead(5); - if (FlxG.keys.justReleased.TWO) finishPlaceNoteAtPlayhead(5); - if (FlxG.keys.justPressed.THREE) placeNoteAtPlayhead(6); - if (FlxG.keys.justReleased.THREE) finishPlaceNoteAtPlayhead(6); - if (FlxG.keys.justPressed.FOUR) placeNoteAtPlayhead(7); - if (FlxG.keys.justReleased.FOUR) finishPlaceNoteAtPlayhead(7); - - if (FlxG.keys.justPressed.FIVE) placeNoteAtPlayhead(0); - if (FlxG.keys.justReleased.FIVE) finishPlaceNoteAtPlayhead(0); - if (FlxG.keys.justPressed.SIX) placeNoteAtPlayhead(1); - if (FlxG.keys.justPressed.SEVEN) placeNoteAtPlayhead(2); - if (FlxG.keys.justReleased.SEVEN) finishPlaceNoteAtPlayhead(2); - if (FlxG.keys.justPressed.EIGHT) placeNoteAtPlayhead(3); - if (FlxG.keys.justReleased.EIGHT) finishPlaceNoteAtPlayhead(3); - case ChartEditorLiveInputStyle.None: - // Do nothing. + if (FlxG.keys.checkStatus(key, JUST_PRESSED)) placeNoteAtPlayhead(note) + else if (FlxG.keys.checkStatus(key, JUST_RELEASED)) finishPlaceNoteAtPlayhead(note); } // Place events at playhead. From 2fb55ba3edf4e84a46dc6e451922af0a2ca63326 Mon Sep 17 00:00:00 2001 From: gamerbross <55158797+gamerbross@users.noreply.github.com> Date: Thu, 11 Jul 2024 06:59:22 +0200 Subject: [PATCH 037/120] Fix default health icon not used --- source/funkin/play/components/HealthIcon.hx | 29 +++++++-------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/source/funkin/play/components/HealthIcon.hx b/source/funkin/play/components/HealthIcon.hx index 2442b0dc5..682334db3 100644 --- a/source/funkin/play/components/HealthIcon.hx +++ b/source/funkin/play/components/HealthIcon.hx @@ -33,7 +33,7 @@ class HealthIcon extends FunkinSprite * The character this icon is representing. * Setting this variable will automatically update the graphic. */ - public var characterId(default, set):Null; + public var characterId(default, set):String = Constants.DEFAULT_HEALTH_ICON; /** * Whether this health icon should automatically update its state based on the character's health. @@ -116,7 +116,7 @@ class HealthIcon extends FunkinSprite */ static final POSITION_OFFSET:Int = 26; - public function new(char:String = 'bf', playerId:Int = 0) + public function new(char:Null, playerId:Int = 0) { super(0, 0); this.playerId = playerId; @@ -127,7 +127,7 @@ class HealthIcon extends FunkinSprite initTargetSize(); } - function set_characterId(value:Null):Null + function set_characterId(value:Null):String { if (value == characterId) return value; @@ -380,20 +380,9 @@ class HealthIcon extends FunkinSprite } } - function correctCharacterId(charId:Null):String + function iconExists(charId:String):Bool { - if (charId == null) - { - return Constants.DEFAULT_HEALTH_ICON; - } - - if (!Assets.exists(Paths.image('icons/icon-$charId'))) - { - FlxG.log.warn('No icon for character: $charId : using default placeholder face instead!'); - return Constants.DEFAULT_HEALTH_ICON; - } - - return charId; + return Assets.exists(Paths.image('icons/icon-$charId')); } function isNewSpritesheet(charId:String):Bool @@ -403,11 +392,11 @@ class HealthIcon extends FunkinSprite function loadCharacter(charId:Null):Void { - if (charId == null || correctCharacterId(charId) != charId) + if (charId == null || !iconExists(charId)) { - // This will recursively trigger loadCharacter to be called again. - characterId = correctCharacterId(charId); - return; + FlxG.log.warn('No icon for character: $charId : using default placeholder face instead!'); + characterId = Constants.DEFAULT_HEALTH_ICON; + charId = characterId; } isLegacyStyle = !isNewSpritesheet(charId); From a12b0e6ec36c45f0ec2c1516826cdfde2b8899e6 Mon Sep 17 00:00:00 2001 From: anysad Date: Thu, 11 Jul 2024 18:10:45 +0300 Subject: [PATCH 038/120] Add HEY! song events to Tutorial --- source/funkin/play/PlayState.hx | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index f55cef388..ff55a79fd 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -1489,7 +1489,7 @@ class PlayState extends MusicBeatSubState if (opponentStrumline != null) opponentStrumline.onBeatHit(); // Make the characters dance on the beat - danceOnBeat(); + //danceOnBeat(); return true; } @@ -1509,16 +1509,6 @@ class PlayState extends MusicBeatSubState function danceOnBeat():Void { if (currentStage == null) return; - - // TODO: Add HEY! song events to Tutorial. - if (Conductor.instance.currentBeat % 16 == 15 - && currentStage.getDad().characterId == 'gf' - && Conductor.instance.currentBeat > 16 - && Conductor.instance.currentBeat < 48) - { - currentStage.getBoyfriend().playAnimation('hey', true); - currentStage.getDad().playAnimation('cheer', true); - } } /** From 47a2cf4e5db9a36fb39e49500d85d2aca3961a06 Mon Sep 17 00:00:00 2001 From: anysad Date: Thu, 11 Jul 2024 18:12:50 +0300 Subject: [PATCH 039/120] Add HEY! song events to Tutorial --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 2e1594ee4..9ef18cde0 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 2e1594ee4c04c7148628bae471bdd061c9deb6b7 +Subproject commit 9ef18cde0b9802295118b922b76b851e96af2fbf From 2993e17278f0162b3b86e9c7cf26d8d22cabf93c Mon Sep 17 00:00:00 2001 From: anysad Date: Sat, 13 Jul 2024 22:45:58 +0300 Subject: [PATCH 040/120] custom popups and countdowns yay!!! --- assets | 2 +- source/funkin/play/Countdown.hx | 154 ++++++++++---------- source/funkin/play/PlayState.hx | 6 +- source/funkin/play/components/PopUpStuff.hx | 58 ++++++-- 4 files changed, 124 insertions(+), 96 deletions(-) diff --git a/assets b/assets index 2e1594ee4..514a987ee 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 2e1594ee4c04c7148628bae471bdd061c9deb6b7 +Subproject commit 514a987ee57827b097ed035a1c2fdd1377a53b17 diff --git a/source/funkin/play/Countdown.hx b/source/funkin/play/Countdown.hx index 10636afdf..7686e5b75 100644 --- a/source/funkin/play/Countdown.hx +++ b/source/funkin/play/Countdown.hx @@ -10,6 +10,7 @@ import funkin.modding.events.ScriptEvent; import funkin.modding.events.ScriptEvent.CountdownScriptEvent; import flixel.util.FlxTimer; import funkin.audio.FunkinSound; +import openfl.utils.Assets; class Countdown { @@ -18,6 +19,22 @@ class Countdown */ public static var countdownStep(default, null):CountdownStep = BEFORE; + /** + * Which alternate countdown sound effect to use. + * You can set this via script. + * For example, in Week 6 it is `-pixel`. + */ + public static var soundSuffix:String = ''; + + /** + * Which alternate graphic on countdown to use. + * You can set this via script. + * For example, in Week 6 it is `-pixel`. + */ + public static var graphicSuffix:String = ''; + + + /** * The currently running countdown. This will be null if there is no countdown running. */ @@ -29,7 +46,7 @@ class Countdown * This will automatically stop and restart the countdown if it is already running. * @returns `false` if the countdown was cancelled by a script. */ - public static function performCountdown(isPixelStyle:Bool):Bool + public static function performCountdown():Bool { countdownStep = BEFORE; var cancelled:Bool = propagateCountdownEvent(countdownStep); @@ -64,10 +81,10 @@ class Countdown // PlayState.instance.dispatchEvent(new SongTimeScriptEvent(SONG_BEAT_HIT, 0, 0)); // Countdown graphic. - showCountdownGraphic(countdownStep, isPixelStyle); + showCountdownGraphic(countdownStep, graphicSuffix.toLowerCase().contains('pixel')); // Countdown sound. - playCountdownSound(countdownStep, isPixelStyle); + playCountdownSound(countdownStep); // Event handling bullshit. var cancelled:Bool = propagateCountdownEvent(countdownStep); @@ -176,52 +193,30 @@ class Countdown } /** - * Retrieves the graphic to use for this step of the countdown. - * TODO: Make this less dumb. Unhardcode it? Use modules? Use notestyles? - * - * This is public so modules can do lol funny shit. + * Reset the countdown configuration to the default. */ - public static function showCountdownGraphic(index:CountdownStep, isPixelStyle:Bool):Void + public static function reset() + { + soundSuffix = ''; + graphicSuffix = ''; + } + + /** + * Retrieves the graphic to use for this step of the countdown. + */ + public static function showCountdownGraphic(index:CountdownStep, isGraphicPixel:Bool):Void { var spritePath:String = null; - - if (isPixelStyle) - { - switch (index) - { - case TWO: - spritePath = 'weeb/pixelUI/ready-pixel'; - case ONE: - spritePath = 'weeb/pixelUI/set-pixel'; - case GO: - spritePath = 'weeb/pixelUI/date-pixel'; - default: - // null - } - } - else - { - switch (index) - { - case TWO: - spritePath = 'ready'; - case ONE: - spritePath = 'set'; - case GO: - spritePath = 'go'; - default: - // null - } - } + spritePath = resolveGraphicPath(graphicSuffix, index); if (spritePath == null) return; var countdownSprite:FunkinSprite = FunkinSprite.create(spritePath); countdownSprite.scrollFactor.set(0, 0); - if (isPixelStyle) countdownSprite.setGraphicSize(Std.int(countdownSprite.width * Constants.PIXEL_ART_SCALE)); + if (isGraphicPixel) countdownSprite.setGraphicSize(Std.int(countdownSprite.width * Constants.PIXEL_ART_SCALE)); - countdownSprite.antialiasing = !isPixelStyle; + countdownSprite.antialiasing = !isGraphicPixel; countdownSprite.updateHitbox(); countdownSprite.screenCenter(); @@ -238,52 +233,55 @@ class Countdown PlayState.instance.add(countdownSprite); } + static function resolveGraphicPath(suffix:String, index:CountdownStep):Null + { + var basePath:String = 'ui/countdown/'; + var indexString:String = null; + switch (index) + { + case TWO: + indexString = 'ready'; + case ONE: + indexString = 'set'; + case GO: + indexString = 'go'; + default: + // null + } + basePath += indexString; + var spritePath:String = basePath + suffix; + while (!Assets.exists(Paths.image(spritePath)) && suffix.length > 0) + { + suffix = suffix.split('-').slice(0, -1).join('-'); + spritePath = basePath + suffix; + } + if (!Assets.exists(Paths.image(spritePath))) return null; + trace('Resolved sprite path: ' + Paths.image(spritePath)); + return spritePath; + } + /** * Retrieves the sound file to use for this step of the countdown. - * TODO: Make this less dumb. Unhardcode it? Use modules? Use notestyles? - * - * This is public so modules can do lol funny shit. */ - public static function playCountdownSound(index:CountdownStep, isPixelStyle:Bool):Void + public static function playCountdownSound(index:CountdownStep):Void { - var soundPath:String = null; + FunkinSound.playOnce(resolveSoundPath(soundSuffix, index), Constants.COUNTDOWN_VOLUME); + } - if (isPixelStyle) + static function resolveSoundPath(suffix:String, step:CountdownStep):Null + { + var basePath:String = 'gameplay/countdown/intro'; + if (step != CountdownStep.BEFORE || step != CountdownStep.AFTER) basePath += step; + + var soundPath:String = Paths.sound(basePath + suffix); + while (!Assets.exists(soundPath) && suffix.length > 0) { - switch (index) - { - case THREE: - soundPath = 'intro3-pixel'; - case TWO: - soundPath = 'intro2-pixel'; - case ONE: - soundPath = 'intro1-pixel'; - case GO: - soundPath = 'introGo-pixel'; - default: - // null - } + suffix = suffix.split('-').slice(0, -1).join('-'); + soundPath = Paths.sound(basePath + suffix); } - else - { - switch (index) - { - case THREE: - soundPath = 'intro3'; - case TWO: - soundPath = 'intro2'; - case ONE: - soundPath = 'intro1'; - case GO: - soundPath = 'introGo'; - default: - // null - } - } - - if (soundPath == null) return; - - FunkinSound.playOnce(Paths.sound(soundPath), Constants.COUNTDOWN_VOLUME); + if (!Assets.exists(soundPath)) return null; + trace('Resolved sound path: ' + soundPath); + return soundPath; } public static function decrement(step:CountdownStep):CountdownStep diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index f55cef388..bf401ece2 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -899,7 +899,7 @@ class PlayState extends MusicBeatSubState health = Constants.HEALTH_STARTING; songScore = 0; Highscore.tallies.combo = 0; - Countdown.performCountdown(currentStageId.startsWith('school')); + Countdown.performCountdown(); needsReset = false; } @@ -1920,7 +1920,7 @@ class PlayState extends MusicBeatSubState public function startCountdown():Void { // If Countdown.performCountdown returns false, then the countdown was canceled by a script. - var result:Bool = Countdown.performCountdown(currentStageId.startsWith('school')); + var result:Bool = Countdown.performCountdown(); if (!result) return; isInCutscene = false; @@ -3061,6 +3061,8 @@ class PlayState extends MusicBeatSubState GameOverSubState.reset(); PauseSubState.reset(); + Countdown.reset(); + PopUpStuff.reset(); // Clear the static reference to this state. instance = null; diff --git a/source/funkin/play/components/PopUpStuff.hx b/source/funkin/play/components/PopUpStuff.hx index b7e206e97..ddf24d24b 100644 --- a/source/funkin/play/components/PopUpStuff.hx +++ b/source/funkin/play/components/PopUpStuff.hx @@ -7,25 +7,52 @@ import flixel.util.FlxDirection; import funkin.graphics.FunkinSprite; import funkin.play.PlayState; import funkin.util.TimerUtil; +import openfl.utils.Assets; class PopUpStuff extends FlxTypedGroup { public var offsets:Array = [0, 0]; + /** + * Which alternate graphic on popup to use. + * You can set this via script. + * For example, in Week 6 it is `-pixel`. + */ + public static var graphicSuffix:String = ''; + override public function new() { super(); } + static function resolveGraphicPath(suffix:String, index:String):Null + { + var folder:String; + if (suffix != '') + folder = suffix.substring(0, suffix.indexOf("-")) + suffix.substring(suffix.indexOf("-") + 1); + else + folder = 'normal'; + var basePath:String = 'gameplay/popup/$folder/$index'; + var spritePath:String = basePath + suffix; + trace(spritePath); + while (!Assets.exists(Paths.image(spritePath)) && suffix.length > 0) + { + suffix = suffix.split('-').slice(0, -1).join('-'); + spritePath = basePath + suffix; + } + if (!Assets.exists(Paths.image(spritePath))) return null; + return spritePath; + } + public function displayRating(daRating:String) { var perfStart:Float = TimerUtil.start(); if (daRating == null) daRating = "good"; - var ratingPath:String = daRating; + var ratingPath:String = resolveGraphicPath(graphicSuffix, daRating); - if (PlayState.instance.currentStageId.startsWith('school')) ratingPath = "weeb/pixelUI/" + ratingPath + "-pixel"; + //if (PlayState.instance.currentStageId.startsWith('school')) ratingPath = "weeb/pixelUI/" + ratingPath + "-pixel"; var rating:FunkinSprite = FunkinSprite.create(0, 0, ratingPath); rating.scrollFactor.set(0.2, 0.2); @@ -40,7 +67,7 @@ class PopUpStuff extends FlxTypedGroup add(rating); - if (PlayState.instance.currentStageId.startsWith('school')) + if (graphicSuffix.toLowerCase().contains('pixel')) { rating.setGraphicSize(Std.int(rating.width * Constants.PIXEL_ART_SCALE * 0.7)); rating.antialiasing = false; @@ -73,15 +100,8 @@ class PopUpStuff extends FlxTypedGroup if (combo == null) combo = 0; - var pixelShitPart1:String = ""; - var pixelShitPart2:String = ''; - - if (PlayState.instance.currentStageId.startsWith('school')) - { - pixelShitPart1 = 'weeb/pixelUI/'; - pixelShitPart2 = '-pixel'; - } - var comboSpr:FunkinSprite = FunkinSprite.create(pixelShitPart1 + 'combo' + pixelShitPart2); + var comboPath:String = resolveGraphicPath(graphicSuffix, Std.string(combo)); + var comboSpr:FunkinSprite = FunkinSprite.create(comboPath); comboSpr.y = (FlxG.camera.height * 0.44) + offsets[1]; comboSpr.x = (FlxG.width * 0.507) + offsets[0]; // comboSpr.x -= FlxG.camera.scroll.x * 0.2; @@ -92,7 +112,7 @@ class PopUpStuff extends FlxTypedGroup // add(comboSpr); - if (PlayState.instance.currentStageId.startsWith('school')) + if (graphicSuffix.toLowerCase().contains('pixel')) { comboSpr.setGraphicSize(Std.int(comboSpr.width * Constants.PIXEL_ART_SCALE * 0.7)); comboSpr.antialiasing = false; @@ -129,9 +149,9 @@ class PopUpStuff extends FlxTypedGroup var daLoop:Int = 1; for (i in seperatedScore) { - var numScore:FunkinSprite = FunkinSprite.create(0, comboSpr.y, pixelShitPart1 + 'num' + Std.int(i) + pixelShitPart2); + var numScore:FunkinSprite = FunkinSprite.create(0, comboSpr.y, resolveGraphicPath(graphicSuffix, 'num' + Std.int(i))); - if (PlayState.instance.currentStageId.startsWith('school')) + if (graphicSuffix.toLowerCase().contains('pixel')) { numScore.setGraphicSize(Std.int(numScore.width * Constants.PIXEL_ART_SCALE * 0.7)); numScore.antialiasing = false; @@ -166,4 +186,12 @@ class PopUpStuff extends FlxTypedGroup return combo; } + + /** + * Reset the popup configuration to the default. + */ + public static function reset() + { + graphicSuffix = ''; + } } From 2547fbb8f4033f815d3d8d5cef9eb9ddc02c2832 Mon Sep 17 00:00:00 2001 From: anysad Date: Sat, 13 Jul 2024 23:08:16 +0300 Subject: [PATCH 041/120] remove trace --- assets | 2 +- source/funkin/play/components/PopUpStuff.hx | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/assets b/assets index 514a987ee..e414ee618 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 514a987ee57827b097ed035a1c2fdd1377a53b17 +Subproject commit e414ee618b4fa577dc3c3df4e156488e91c6348d diff --git a/source/funkin/play/components/PopUpStuff.hx b/source/funkin/play/components/PopUpStuff.hx index ddf24d24b..0a4d6b019 100644 --- a/source/funkin/play/components/PopUpStuff.hx +++ b/source/funkin/play/components/PopUpStuff.hx @@ -34,7 +34,6 @@ class PopUpStuff extends FlxTypedGroup folder = 'normal'; var basePath:String = 'gameplay/popup/$folder/$index'; var spritePath:String = basePath + suffix; - trace(spritePath); while (!Assets.exists(Paths.image(spritePath)) && suffix.length > 0) { suffix = suffix.split('-').slice(0, -1).join('-'); From 9d3c043f8ab462973a1e760336581dee89326e42 Mon Sep 17 00:00:00 2001 From: anysad Date: Sat, 13 Jul 2024 23:29:26 +0300 Subject: [PATCH 042/120] cache textures at their new locations! --- source/funkin/ui/transition/LoadingState.hx | 33 ++++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/source/funkin/ui/transition/LoadingState.hx b/source/funkin/ui/transition/LoadingState.hx index bc26ad97a..d0b8cfbe8 100644 --- a/source/funkin/ui/transition/LoadingState.hx +++ b/source/funkin/ui/transition/LoadingState.hx @@ -291,17 +291,28 @@ class LoadingState extends MusicBeatSubState FunkinSprite.preparePurgeCache(); FunkinSprite.cacheTexture(Paths.image('healthBar')); FunkinSprite.cacheTexture(Paths.image('menuDesat')); - FunkinSprite.cacheTexture(Paths.image('combo')); - FunkinSprite.cacheTexture(Paths.image('num0')); - FunkinSprite.cacheTexture(Paths.image('num1')); - FunkinSprite.cacheTexture(Paths.image('num2')); - FunkinSprite.cacheTexture(Paths.image('num3')); - FunkinSprite.cacheTexture(Paths.image('num4')); - FunkinSprite.cacheTexture(Paths.image('num5')); - FunkinSprite.cacheTexture(Paths.image('num6')); - FunkinSprite.cacheTexture(Paths.image('num7')); - FunkinSprite.cacheTexture(Paths.image('num8')); - FunkinSprite.cacheTexture(Paths.image('num9')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/combo')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/num0')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/num1')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/num2')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/num3')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/num4')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/num5')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/num6')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/num7')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/num8')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/num9')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/combo-pixel')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/num0-pixel')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/num1-pixel')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/num2-pixel')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/num3-pixel')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/num4-pixel')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/num5-pixel')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/num6-pixel')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/num7-pixel')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/num8-pixel')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/num9-pixel')); FunkinSprite.cacheTexture(Paths.image('notes', 'shared')); FunkinSprite.cacheTexture(Paths.image('noteSplashes', 'shared')); FunkinSprite.cacheTexture(Paths.image('noteStrumline', 'shared')); From aed100df476df55d38e820cc86f643ed62117284 Mon Sep 17 00:00:00 2001 From: anysad Date: Sat, 13 Jul 2024 23:39:56 +0300 Subject: [PATCH 043/120] how the hell did I miss these? --- source/funkin/ui/transition/LoadingState.hx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/source/funkin/ui/transition/LoadingState.hx b/source/funkin/ui/transition/LoadingState.hx index d0b8cfbe8..a571126fe 100644 --- a/source/funkin/ui/transition/LoadingState.hx +++ b/source/funkin/ui/transition/LoadingState.hx @@ -317,13 +317,20 @@ class LoadingState extends MusicBeatSubState FunkinSprite.cacheTexture(Paths.image('noteSplashes', 'shared')); FunkinSprite.cacheTexture(Paths.image('noteStrumline', 'shared')); FunkinSprite.cacheTexture(Paths.image('NOTE_hold_assets')); - FunkinSprite.cacheTexture(Paths.image('ready', 'shared')); - FunkinSprite.cacheTexture(Paths.image('set', 'shared')); - FunkinSprite.cacheTexture(Paths.image('go', 'shared')); - FunkinSprite.cacheTexture(Paths.image('sick', 'shared')); - FunkinSprite.cacheTexture(Paths.image('good', 'shared')); - FunkinSprite.cacheTexture(Paths.image('bad', 'shared')); - FunkinSprite.cacheTexture(Paths.image('shit', 'shared')); + FunkinSprite.cacheTexture(Paths.image('ui/countdown/ready', 'shared')); + FunkinSprite.cacheTexture(Paths.image('ui/countdown/set', 'shared')); + FunkinSprite.cacheTexture(Paths.image('ui/countdown/go', 'shared')); + FunkinSprite.cacheTexture(Paths.image('ui/countdown/ready-pixel', 'shared')); + FunkinSprite.cacheTexture(Paths.image('ui/countdown/set-pixel', 'shared')); + FunkinSprite.cacheTexture(Paths.image('ui/countdown/go-pixel', 'shared')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/sick')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/good')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/bad')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/shit')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/sick-pixel')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/good-pixel')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/bad-pixel')); + FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/shit-pixel')); FunkinSprite.cacheTexture(Paths.image('miss', 'shared')); // TODO: remove this // List all image assets in the level's library. From f8232911cb114e867448f10c134dc63b202b1e48 Mon Sep 17 00:00:00 2001 From: 7oltan <87986834+7oltan@users.noreply.github.com> Date: Tue, 16 Jul 2024 12:52:51 +0300 Subject: [PATCH 044/120] FIX CHARACTER PATHS ISSUE --- source/funkin/play/character/AnimateAtlasCharacter.hx | 2 +- source/funkin/play/character/MultiSparrowCharacter.hx | 4 ++-- source/funkin/play/character/PackerCharacter.hx | 2 +- source/funkin/play/character/SparrowCharacter.hx | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/funkin/play/character/AnimateAtlasCharacter.hx b/source/funkin/play/character/AnimateAtlasCharacter.hx index ed58b92b5..5b126db6c 100644 --- a/source/funkin/play/character/AnimateAtlasCharacter.hx +++ b/source/funkin/play/character/AnimateAtlasCharacter.hx @@ -131,7 +131,7 @@ class AnimateAtlasCharacter extends BaseCharacter { trace('[ATLASCHAR] Loading sprite atlas for ${characterId}.'); - var sprite:FlxAtlasSprite = new FlxAtlasSprite(0, 0, Paths.animateAtlas(_data.assetPath, 'shared')); + var sprite:FlxAtlasSprite = new FlxAtlasSprite(0, 0, Paths.animateAtlas(_data.assetPath)); sprite.onAnimationFinish.removeAll(); sprite.onAnimationFinish.add(this.onAnimationFinished); diff --git a/source/funkin/play/character/MultiSparrowCharacter.hx b/source/funkin/play/character/MultiSparrowCharacter.hx index 48c5afb58..48a0ec632 100644 --- a/source/funkin/play/character/MultiSparrowCharacter.hx +++ b/source/funkin/play/character/MultiSparrowCharacter.hx @@ -60,7 +60,7 @@ class MultiSparrowCharacter extends BaseCharacter } } - var texture:FlxAtlasFrames = Paths.getSparrowAtlas(_data.assetPath, 'shared'); + var texture:FlxAtlasFrames = Paths.getSparrowAtlas(_data.assetPath); if (texture == null) { @@ -74,7 +74,7 @@ class MultiSparrowCharacter extends BaseCharacter for (asset in assetList) { - var subTexture:FlxAtlasFrames = Paths.getSparrowAtlas(asset, 'shared'); + var subTexture:FlxAtlasFrames = Paths.getSparrowAtlas(asset); // If we don't do this, the unused textures will be removed as soon as they're loaded. if (subTexture == null) diff --git a/source/funkin/play/character/PackerCharacter.hx b/source/funkin/play/character/PackerCharacter.hx index 2bfac800a..b7dda424f 100644 --- a/source/funkin/play/character/PackerCharacter.hx +++ b/source/funkin/play/character/PackerCharacter.hx @@ -30,7 +30,7 @@ class PackerCharacter extends BaseCharacter { trace('[PACKERCHAR] Loading spritesheet ${_data.assetPath} for ${characterId}'); - var tex:FlxFramesCollection = Paths.getPackerAtlas(_data.assetPath, 'shared'); + var tex:FlxFramesCollection = Paths.getPackerAtlas(_data.assetPath); if (tex == null) { trace('Could not load Packer sprite: ${_data.assetPath}'); diff --git a/source/funkin/play/character/SparrowCharacter.hx b/source/funkin/play/character/SparrowCharacter.hx index a36aed84d..90a695ec3 100644 --- a/source/funkin/play/character/SparrowCharacter.hx +++ b/source/funkin/play/character/SparrowCharacter.hx @@ -33,7 +33,7 @@ class SparrowCharacter extends BaseCharacter { trace('[SPARROWCHAR] Loading spritesheet ${_data.assetPath} for ${characterId}'); - var tex:FlxFramesCollection = Paths.getSparrowAtlas(_data.assetPath, 'shared'); + var tex:FlxFramesCollection = Paths.getSparrowAtlas(_data.assetPath); if (tex == null) { trace('Could not load Sparrow sprite: ${_data.assetPath}'); From f8a0627fd270745ba102e8c6a4b0a223e8cf9d3e Mon Sep 17 00:00:00 2001 From: anysad Date: Tue, 16 Jul 2024 20:53:12 +0300 Subject: [PATCH 045/120] goodbye scripts, hello notestyles! --- assets | 2 +- source/funkin/play/Countdown.hx | 101 +++++++++++--------- source/funkin/play/components/PopUpStuff.hx | 75 +++++++-------- source/funkin/ui/transition/LoadingState.hx | 73 +++++++------- source/funkin/util/Constants.hx | 5 + 5 files changed, 132 insertions(+), 124 deletions(-) diff --git a/assets b/assets index e414ee618..ca4d97554 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit e414ee618b4fa577dc3c3df4e156488e91c6348d +Subproject commit ca4d97554f9e3853fda25733f21a5fa108c0b902 diff --git a/source/funkin/play/Countdown.hx b/source/funkin/play/Countdown.hx index 7686e5b75..b97451fa1 100644 --- a/source/funkin/play/Countdown.hx +++ b/source/funkin/play/Countdown.hx @@ -11,6 +11,8 @@ import funkin.modding.events.ScriptEvent.CountdownScriptEvent; import flixel.util.FlxTimer; import funkin.audio.FunkinSound; import openfl.utils.Assets; +import funkin.data.notestyle.NoteStyleRegistry; +import funkin.play.notes.notestyle.NoteStyle; class Countdown { @@ -20,20 +22,13 @@ class Countdown public static var countdownStep(default, null):CountdownStep = BEFORE; /** - * Which alternate countdown sound effect to use. - * You can set this via script. - * For example, in Week 6 it is `-pixel`. + * Which alternate graphic/sound on countdown to use. + * This is set via the current notestyle. + * For example, in Week 6 it is `pixel`. */ - public static var soundSuffix:String = ''; - - /** - * Which alternate graphic on countdown to use. - * You can set this via script. - * For example, in Week 6 it is `-pixel`. - */ - public static var graphicSuffix:String = ''; - + static var noteStyle:NoteStyle; + static var isPixel:Bool = false; /** * The currently running countdown. This will be null if there is no countdown running. @@ -64,6 +59,11 @@ class Countdown // @:privateAccess // PlayState.instance.dispatchEvent(new SongTimeScriptEvent(SONG_BEAT_HIT, 0, 0)); + var fetchedNoteStyle:NoteStyle = NoteStyleRegistry.instance.fetchEntry(PlayState.instance.currentChart.noteStyle); + if (fetchedNoteStyle == null) noteStyle = NoteStyleRegistry.instance.fetchDefault(); + else noteStyle = fetchedNoteStyle; + if (noteStyle._data.assets.note.isPixel) isPixel = true; + // The timer function gets called based on the beat of the song. countdownTimer = new FlxTimer(); @@ -81,10 +81,10 @@ class Countdown // PlayState.instance.dispatchEvent(new SongTimeScriptEvent(SONG_BEAT_HIT, 0, 0)); // Countdown graphic. - showCountdownGraphic(countdownStep, graphicSuffix.toLowerCase().contains('pixel')); + showCountdownGraphic(countdownStep, noteStyle, isPixel); // Countdown sound. - playCountdownSound(countdownStep); + playCountdownSound(countdownStep, noteStyle); // Event handling bullshit. var cancelled:Bool = propagateCountdownEvent(countdownStep); @@ -197,17 +197,31 @@ class Countdown */ public static function reset() { - soundSuffix = ''; - graphicSuffix = ''; + noteStyle = NoteStyleRegistry.instance.fetchDefault(); + isPixel = false; } /** * Retrieves the graphic to use for this step of the countdown. */ - public static function showCountdownGraphic(index:CountdownStep, isGraphicPixel:Bool):Void + public static function showCountdownGraphic(index:CountdownStep, noteStyle:NoteStyle, isGraphicPixel:Bool):Void { + var indexString:String = null; + switch (index) + { + case TWO: + indexString = 'ready'; + case ONE: + indexString = 'set'; + case GO: + indexString = 'go'; + default: + // null + } + if (indexString == null) return; + var spritePath:String = null; - spritePath = resolveGraphicPath(graphicSuffix, index); + spritePath = resolveGraphicPath(noteStyle, indexString); if (spritePath == null) return; @@ -215,12 +229,15 @@ class Countdown countdownSprite.scrollFactor.set(0, 0); if (isGraphicPixel) countdownSprite.setGraphicSize(Std.int(countdownSprite.width * Constants.PIXEL_ART_SCALE)); + else countdownSprite.setGraphicSize(Std.int(countdownSprite.width * 0.7)); countdownSprite.antialiasing = !isGraphicPixel; countdownSprite.updateHitbox(); countdownSprite.screenCenter(); + countdownSprite.cameras = [PlayState.instance.camHUD]; + // Fade sprite in, then out, then destroy it. FlxTween.tween(countdownSprite, {y: countdownSprite.y += 100, alpha: 0}, Conductor.instance.beatLengthMs / 1000, { @@ -233,29 +250,18 @@ class Countdown PlayState.instance.add(countdownSprite); } - static function resolveGraphicPath(suffix:String, index:CountdownStep):Null + static function resolveGraphicPath(noteStyle:NoteStyle, index:String):Null { var basePath:String = 'ui/countdown/'; - var indexString:String = null; - switch (index) + + var spritePath:String = basePath + noteStyle.id + '/$index'; + // If nothing is found, revert it to default notestyle skin + if (!Assets.exists(Paths.image(spritePath))) { - case TWO: - indexString = 'ready'; - case ONE: - indexString = 'set'; - case GO: - indexString = 'go'; - default: - // null + if (!isPixel) spritePath = basePath + Constants.DEFAULT_NOTE_STYLE + '/$index'; + else spritePath = basePath + Constants.DEFAULT_PIXEL_NOTE_STYLE + '/$index'; } - basePath += indexString; - var spritePath:String = basePath + suffix; - while (!Assets.exists(Paths.image(spritePath)) && suffix.length > 0) - { - suffix = suffix.split('-').slice(0, -1).join('-'); - spritePath = basePath + suffix; - } - if (!Assets.exists(Paths.image(spritePath))) return null; + trace('Resolved sprite path: ' + Paths.image(spritePath)); return spritePath; } @@ -263,23 +269,24 @@ class Countdown /** * Retrieves the sound file to use for this step of the countdown. */ - public static function playCountdownSound(index:CountdownStep):Void + public static function playCountdownSound(step:CountdownStep, noteStyle:NoteStyle):Void { - FunkinSound.playOnce(resolveSoundPath(soundSuffix, index), Constants.COUNTDOWN_VOLUME); + return FunkinSound.playOnce(Paths.sound(resolveSoundPath(noteStyle, step)), Constants.COUNTDOWN_VOLUME); } - static function resolveSoundPath(suffix:String, step:CountdownStep):Null + static function resolveSoundPath(noteStyle:NoteStyle, step:CountdownStep):Null { - var basePath:String = 'gameplay/countdown/intro'; - if (step != CountdownStep.BEFORE || step != CountdownStep.AFTER) basePath += step; + if (step == CountdownStep.BEFORE || step == CountdownStep.AFTER) return null; + var basePath:String = 'gameplay/countdown/'; - var soundPath:String = Paths.sound(basePath + suffix); - while (!Assets.exists(soundPath) && suffix.length > 0) + var soundPath:String = basePath + noteStyle.id + '/intro$step'; + // If nothing is found, revert it to default notestyle sound + if (!Assets.exists(Paths.sound(soundPath))) { - suffix = suffix.split('-').slice(0, -1).join('-'); - soundPath = Paths.sound(basePath + suffix); + if (!isPixel) soundPath = basePath + Constants.DEFAULT_NOTE_STYLE + '/intro$step'; + else soundPath = basePath + Constants.DEFAULT_PIXEL_NOTE_STYLE + '/intro$step'; } - if (!Assets.exists(soundPath)) return null; + trace('Resolved sound path: ' + soundPath); return soundPath; } diff --git a/source/funkin/play/components/PopUpStuff.hx b/source/funkin/play/components/PopUpStuff.hx index 0a4d6b019..eb59a9922 100644 --- a/source/funkin/play/components/PopUpStuff.hx +++ b/source/funkin/play/components/PopUpStuff.hx @@ -8,6 +8,8 @@ import funkin.graphics.FunkinSprite; import funkin.play.PlayState; import funkin.util.TimerUtil; import openfl.utils.Assets; +import funkin.data.notestyle.NoteStyleRegistry; +import funkin.play.notes.notestyle.NoteStyle; class PopUpStuff extends FlxTypedGroup { @@ -15,31 +17,35 @@ class PopUpStuff extends FlxTypedGroup /** * Which alternate graphic on popup to use. - * You can set this via script. - * For example, in Week 6 it is `-pixel`. + * This is set via the current notestyle. + * For example, in Week 6 it is `pixel`. */ - public static var graphicSuffix:String = ''; + static var noteStyle:NoteStyle; + + static var isPixel:Bool = false; override public function new() { super(); + + var fetchedNoteStyle:NoteStyle = NoteStyleRegistry.instance.fetchEntry(PlayState.instance.currentChart.noteStyle); + if (fetchedNoteStyle == null) noteStyle = NoteStyleRegistry.instance.fetchDefault(); + else noteStyle = fetchedNoteStyle; + if (noteStyle._data.assets.note.isPixel) isPixel = true; } - static function resolveGraphicPath(suffix:String, index:String):Null + static function resolveGraphicPath(noteStyle:NoteStyle, index:String):Null { - var folder:String; - if (suffix != '') - folder = suffix.substring(0, suffix.indexOf("-")) + suffix.substring(suffix.indexOf("-") + 1); - else - folder = 'normal'; - var basePath:String = 'gameplay/popup/$folder/$index'; - var spritePath:String = basePath + suffix; - while (!Assets.exists(Paths.image(spritePath)) && suffix.length > 0) + var basePath:String = 'ui/popup/'; + + var spritePath:String = basePath + noteStyle.id + '/$index'; + // If nothing is found, revert it to default notestyle skin + if (!Assets.exists(Paths.image(spritePath))) { - suffix = suffix.split('-').slice(0, -1).join('-'); - spritePath = basePath + suffix; + if (!isPixel) spritePath = basePath + Constants.DEFAULT_NOTE_STYLE + '/$index'; + else spritePath = basePath + Constants.DEFAULT_PIXEL_NOTE_STYLE + '/$index'; } - if (!Assets.exists(Paths.image(spritePath))) return null; + return spritePath; } @@ -49,7 +55,7 @@ class PopUpStuff extends FlxTypedGroup if (daRating == null) daRating = "good"; - var ratingPath:String = resolveGraphicPath(graphicSuffix, daRating); + var ratingPath:String = resolveGraphicPath(noteStyle, daRating); //if (PlayState.instance.currentStageId.startsWith('school')) ratingPath = "weeb/pixelUI/" + ratingPath + "-pixel"; @@ -66,7 +72,7 @@ class PopUpStuff extends FlxTypedGroup add(rating); - if (graphicSuffix.toLowerCase().contains('pixel')) + if (isPixel) { rating.setGraphicSize(Std.int(rating.width * Constants.PIXEL_ART_SCALE * 0.7)); rating.antialiasing = false; @@ -99,7 +105,7 @@ class PopUpStuff extends FlxTypedGroup if (combo == null) combo = 0; - var comboPath:String = resolveGraphicPath(graphicSuffix, Std.string(combo)); + var comboPath:String = resolveGraphicPath(noteStyle, 'combo'); var comboSpr:FunkinSprite = FunkinSprite.create(comboPath); comboSpr.y = (FlxG.camera.height * 0.44) + offsets[1]; comboSpr.x = (FlxG.width * 0.507) + offsets[0]; @@ -111,16 +117,10 @@ class PopUpStuff extends FlxTypedGroup // add(comboSpr); - if (graphicSuffix.toLowerCase().contains('pixel')) - { - comboSpr.setGraphicSize(Std.int(comboSpr.width * Constants.PIXEL_ART_SCALE * 0.7)); - comboSpr.antialiasing = false; - } - else - { - comboSpr.setGraphicSize(Std.int(comboSpr.width * 0.7)); - comboSpr.antialiasing = true; - } + if (isPixel) comboSpr.setGraphicSize(Std.int(comboSpr.width * Constants.PIXEL_ART_SCALE * 0.7)); + else comboSpr.setGraphicSize(Std.int(comboSpr.width * 0.7)); + + comboSpr.antialiasing = !isPixel; comboSpr.updateHitbox(); FlxTween.tween(comboSpr, {alpha: 0}, 0.2, @@ -148,18 +148,12 @@ class PopUpStuff extends FlxTypedGroup var daLoop:Int = 1; for (i in seperatedScore) { - var numScore:FunkinSprite = FunkinSprite.create(0, comboSpr.y, resolveGraphicPath(graphicSuffix, 'num' + Std.int(i))); + var numScore:FunkinSprite = FunkinSprite.create(0, comboSpr.y, resolveGraphicPath(noteStyle, 'num' + Std.int(i))); - if (graphicSuffix.toLowerCase().contains('pixel')) - { - numScore.setGraphicSize(Std.int(numScore.width * Constants.PIXEL_ART_SCALE * 0.7)); - numScore.antialiasing = false; - } - else - { - numScore.setGraphicSize(Std.int(numScore.width * 0.45)); - numScore.antialiasing = true; - } + if (isPixel) numScore.setGraphicSize(Std.int(numScore.width * Constants.PIXEL_ART_SCALE * 0.7)); + else numScore.setGraphicSize(Std.int(numScore.width * 0.45)); + + numScore.antialiasing = !isPixel; numScore.updateHitbox(); numScore.x = comboSpr.x - (36 * daLoop) - 65; //- 90; @@ -191,6 +185,7 @@ class PopUpStuff extends FlxTypedGroup */ public static function reset() { - graphicSuffix = ''; + noteStyle = NoteStyleRegistry.instance.fetchDefault(); + isPixel = false; } } diff --git a/source/funkin/ui/transition/LoadingState.hx b/source/funkin/ui/transition/LoadingState.hx index a571126fe..e50032d65 100644 --- a/source/funkin/ui/transition/LoadingState.hx +++ b/source/funkin/ui/transition/LoadingState.hx @@ -291,46 +291,47 @@ class LoadingState extends MusicBeatSubState FunkinSprite.preparePurgeCache(); FunkinSprite.cacheTexture(Paths.image('healthBar')); FunkinSprite.cacheTexture(Paths.image('menuDesat')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/combo')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/num0')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/num1')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/num2')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/num3')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/num4')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/num5')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/num6')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/num7')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/num8')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/num9')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/combo-pixel')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/num0-pixel')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/num1-pixel')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/num2-pixel')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/num3-pixel')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/num4-pixel')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/num5-pixel')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/num6-pixel')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/num7-pixel')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/num8-pixel')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/num9-pixel')); + // Lord have mercy on me and this caching -anysad + FunkinSprite.cacheTexture(Paths.image('ui/popup/funkin/combo')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/funkin/num0')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/funkin/num1')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/funkin/num2')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/funkin/num3')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/funkin/num4')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/funkin/num5')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/funkin/num6')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/funkin/num7')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/funkin/num8')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/funkin/num9')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/pixel/combo')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/pixel/num0')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/pixel/num1')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/pixel/num2')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/pixel/num3')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/pixel/num4')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/pixel/num5')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/pixel/num6')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/pixel/num7')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/pixel/num8')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/pixel/num9')); FunkinSprite.cacheTexture(Paths.image('notes', 'shared')); FunkinSprite.cacheTexture(Paths.image('noteSplashes', 'shared')); FunkinSprite.cacheTexture(Paths.image('noteStrumline', 'shared')); FunkinSprite.cacheTexture(Paths.image('NOTE_hold_assets')); - FunkinSprite.cacheTexture(Paths.image('ui/countdown/ready', 'shared')); - FunkinSprite.cacheTexture(Paths.image('ui/countdown/set', 'shared')); - FunkinSprite.cacheTexture(Paths.image('ui/countdown/go', 'shared')); - FunkinSprite.cacheTexture(Paths.image('ui/countdown/ready-pixel', 'shared')); - FunkinSprite.cacheTexture(Paths.image('ui/countdown/set-pixel', 'shared')); - FunkinSprite.cacheTexture(Paths.image('ui/countdown/go-pixel', 'shared')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/sick')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/good')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/bad')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/normal/shit')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/sick-pixel')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/good-pixel')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/bad-pixel')); - FunkinSprite.cacheTexture(Paths.image('gameplay/popup/pixel/shit-pixel')); + FunkinSprite.cacheTexture(Paths.image('ui/countdown/funkin/ready', 'shared')); + FunkinSprite.cacheTexture(Paths.image('ui/countdown/funkin/set', 'shared')); + FunkinSprite.cacheTexture(Paths.image('ui/countdown/funkin/go', 'shared')); + FunkinSprite.cacheTexture(Paths.image('ui/countdown/pixel/ready', 'shared')); + FunkinSprite.cacheTexture(Paths.image('ui/countdown/pixel/set', 'shared')); + FunkinSprite.cacheTexture(Paths.image('ui/countdown/pixel/go', 'shared')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/normal/sick')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/normal/good')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/normal/bad')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/normal/shit')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/pixel/sick')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/pixel/good')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/pixel/bad')); + FunkinSprite.cacheTexture(Paths.image('ui/popup/pixel/shit')); FunkinSprite.cacheTexture(Paths.image('miss', 'shared')); // TODO: remove this // List all image assets in the level's library. diff --git a/source/funkin/util/Constants.hx b/source/funkin/util/Constants.hx index 1e0978839..79b0e05c5 100644 --- a/source/funkin/util/Constants.hx +++ b/source/funkin/util/Constants.hx @@ -258,6 +258,11 @@ class Constants */ public static final DEFAULT_NOTE_STYLE:String = 'funkin'; + /** + * The default pixel note style for songs. + */ + public static final DEFAULT_PIXEL_NOTE_STYLE:String = 'pixel'; + /** * The default album for songs in Freeplay. */ From 5e1d25e791a14f6b301730043607e14b53f36e8d Mon Sep 17 00:00:00 2001 From: AppleHair <95587502+AppleHair@users.noreply.github.com> Date: Tue, 16 Jul 2024 21:17:53 +0300 Subject: [PATCH 046/120] [BUGFIX] Prevented infinite recursion on freeplay when a song doesn't have the `normal` difficulty Any attempt to create a song without the `normal` difficulty will result in a silent crash when opening freeplay. After some debugging, I discovered that the issue is caused by infinite recursion, which gets triggered at the start of `FreeplaySongData`'s `updateValues`. --- source/funkin/ui/freeplay/FreeplayState.hx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 0caaf4591..9873f3be6 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -2077,7 +2077,11 @@ class FreeplaySongData function updateValues(variations:Array):Void { this.songDifficulties = song.listDifficulties(null, variations, false, false); - if (!this.songDifficulties.contains(currentDifficulty)) currentDifficulty = Constants.DEFAULT_DIFFICULTY; + if (!this.songDifficulties.contains(currentDifficulty) && currentDifficulty != Constants.DEFAULT_DIFFICULTY) + { + currentDifficulty = Constants.DEFAULT_DIFFICULTY; + return; + } var songDifficulty:SongDifficulty = song.getDifficulty(currentDifficulty, null, variations); if (songDifficulty == null) return; From ee449819959ed51b5719f7ebd39493118c307eee Mon Sep 17 00:00:00 2001 From: anysad Date: Tue, 16 Jul 2024 22:02:05 +0300 Subject: [PATCH 047/120] you know what, make countdown sprites a little bigger --- source/funkin/play/Countdown.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/funkin/play/Countdown.hx b/source/funkin/play/Countdown.hx index b97451fa1..ccd478347 100644 --- a/source/funkin/play/Countdown.hx +++ b/source/funkin/play/Countdown.hx @@ -228,8 +228,8 @@ class Countdown var countdownSprite:FunkinSprite = FunkinSprite.create(spritePath); countdownSprite.scrollFactor.set(0, 0); - if (isGraphicPixel) countdownSprite.setGraphicSize(Std.int(countdownSprite.width * Constants.PIXEL_ART_SCALE)); - else countdownSprite.setGraphicSize(Std.int(countdownSprite.width * 0.7)); + if (isGraphicPixel) countdownSprite.setGraphicSize(Std.int(countdownSprite.width * Constants.PIXEL_ART_SCALE * 1.1)); + else countdownSprite.setGraphicSize(Std.int(countdownSprite.width * 0.8)); countdownSprite.antialiasing = !isGraphicPixel; From a93cd05aeb6c30c241c6c8f8211abb953bb65532 Mon Sep 17 00:00:00 2001 From: AppleHair <95587502+AppleHair@users.noreply.github.com> Date: Tue, 16 Jul 2024 22:36:11 +0300 Subject: [PATCH 048/120] Added a comment --- source/funkin/ui/freeplay/FreeplayState.hx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 9873f3be6..51fda0677 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -2080,6 +2080,8 @@ class FreeplaySongData if (!this.songDifficulties.contains(currentDifficulty) && currentDifficulty != Constants.DEFAULT_DIFFICULTY) { currentDifficulty = Constants.DEFAULT_DIFFICULTY; + // This method gets called again by the setter-method, + // so there's no need to continue. return; } From 691da783fc41fc648b760833d4439c4368ef29a3 Mon Sep 17 00:00:00 2001 From: AppleHair <95587502+AppleHair@users.noreply.github.com> Date: Wed, 17 Jul 2024 10:20:48 +0300 Subject: [PATCH 049/120] Updated to extend #2712 --- source/funkin/ui/freeplay/FreeplayState.hx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 51fda0677..a22652586 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -2077,11 +2077,11 @@ class FreeplaySongData function updateValues(variations:Array):Void { this.songDifficulties = song.listDifficulties(null, variations, false, false); - if (!this.songDifficulties.contains(currentDifficulty) && currentDifficulty != Constants.DEFAULT_DIFFICULTY) + if (!this.songDifficulties.contains(currentDifficulty)) { currentDifficulty = Constants.DEFAULT_DIFFICULTY; - // This method gets called again by the setter-method, - // so there's no need to continue. + // This method gets called again by the setter-method + // or the difficulty didn't change, so there's no need to continue. return; } From 4d81aa0fe696a1878d3678209e20c985e1631425 Mon Sep 17 00:00:00 2001 From: AppleHair <95587502+AppleHair@users.noreply.github.com> Date: Wed, 17 Jul 2024 18:00:07 +0300 Subject: [PATCH 050/120] [BUGFIX] Ensure the variation used for the next song is valid. When playing in story mode, `PlayState` assumes all the songs use the same variation, which is usually true, but not guaranteed. This PR makes `PlayState` use the `getFirstValidVariation` method to find the valid variation instead of using the `currentVariation` variable, which might not be valid. --- source/funkin/play/PlayState.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index f55cef388..9b1cc2ed9 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -2963,7 +2963,7 @@ class PlayState extends MusicBeatSubState { targetSong: targetSong, targetDifficulty: PlayStatePlaylist.campaignDifficulty, - targetVariation: currentVariation, + targetVariation: targetSong.getFirstValidVariation(PlayStatePlaylist.campaignDifficulty), cameraFollowPoint: cameraFollowPoint.getPosition(), }); }); @@ -2975,7 +2975,7 @@ class PlayState extends MusicBeatSubState { targetSong: targetSong, targetDifficulty: PlayStatePlaylist.campaignDifficulty, - targetVariation: currentVariation, + targetVariation: targetSong.getFirstValidVariation(PlayStatePlaylist.campaignDifficulty), cameraFollowPoint: cameraFollowPoint.getPosition(), }); } From ff1ab1eb4245092829701e322c1b4dbe27f80590 Mon Sep 17 00:00:00 2001 From: anysad Date: Wed, 17 Jul 2024 23:19:18 +0300 Subject: [PATCH 051/120] welcome fallback note styles! --- source/funkin/play/Countdown.hx | 53 ++++++++++++++----- source/funkin/play/components/PopUpStuff.hx | 21 +++++++- .../funkin/play/notes/notestyle/NoteStyle.hx | 2 +- 3 files changed, 59 insertions(+), 17 deletions(-) diff --git a/source/funkin/play/Countdown.hx b/source/funkin/play/Countdown.hx index ccd478347..25a896317 100644 --- a/source/funkin/play/Countdown.hx +++ b/source/funkin/play/Countdown.hx @@ -28,6 +28,8 @@ class Countdown */ static var noteStyle:NoteStyle; + static var fallbackNoteStyle:Null; + static var isPixel:Bool = false; /** @@ -59,10 +61,7 @@ class Countdown // @:privateAccess // PlayState.instance.dispatchEvent(new SongTimeScriptEvent(SONG_BEAT_HIT, 0, 0)); - var fetchedNoteStyle:NoteStyle = NoteStyleRegistry.instance.fetchEntry(PlayState.instance.currentChart.noteStyle); - if (fetchedNoteStyle == null) noteStyle = NoteStyleRegistry.instance.fetchDefault(); - else noteStyle = fetchedNoteStyle; - if (noteStyle._data.assets.note.isPixel) isPixel = true; + fetchNoteStyle(); // The timer function gets called based on the beat of the song. countdownTimer = new FlxTimer(); @@ -81,7 +80,7 @@ class Countdown // PlayState.instance.dispatchEvent(new SongTimeScriptEvent(SONG_BEAT_HIT, 0, 0)); // Countdown graphic. - showCountdownGraphic(countdownStep, noteStyle, isPixel); + showCountdownGraphic(countdownStep, noteStyle); // Countdown sound. playCountdownSound(countdownStep, noteStyle); @@ -201,10 +200,19 @@ class Countdown isPixel = false; } + static function fetchNoteStyle():Void + { + var fetchedNoteStyle:NoteStyle = NoteStyleRegistry.instance.fetchEntry(PlayState.instance.currentChart.noteStyle); + if (fetchedNoteStyle == null) noteStyle = NoteStyleRegistry.instance.fetchDefault(); + else noteStyle = fetchedNoteStyle; + fallbackNoteStyle = NoteStyleRegistry.instance.fetchEntry(noteStyle.getFallbackID()); + isPixel = false; + } + /** * Retrieves the graphic to use for this step of the countdown. */ - public static function showCountdownGraphic(index:CountdownStep, noteStyle:NoteStyle, isGraphicPixel:Bool):Void + public static function showCountdownGraphic(index:CountdownStep, noteStyle:NoteStyle):Void { var indexString:String = null; switch (index) @@ -228,16 +236,16 @@ class Countdown var countdownSprite:FunkinSprite = FunkinSprite.create(spritePath); countdownSprite.scrollFactor.set(0, 0); - if (isGraphicPixel) countdownSprite.setGraphicSize(Std.int(countdownSprite.width * Constants.PIXEL_ART_SCALE * 1.1)); + if (isPixel) countdownSprite.setGraphicSize(Std.int(countdownSprite.width * Constants.PIXEL_ART_SCALE * 1.1)); else countdownSprite.setGraphicSize(Std.int(countdownSprite.width * 0.8)); - countdownSprite.antialiasing = !isGraphicPixel; + countdownSprite.antialiasing = !isPixel; + + countdownSprite.cameras = [PlayState.instance.camHUD]; countdownSprite.updateHitbox(); countdownSprite.screenCenter(); - countdownSprite.cameras = [PlayState.instance.camHUD]; - // Fade sprite in, then out, then destroy it. FlxTween.tween(countdownSprite, {y: countdownSprite.y += 100, alpha: 0}, Conductor.instance.beatLengthMs / 1000, { @@ -252,10 +260,18 @@ class Countdown static function resolveGraphicPath(noteStyle:NoteStyle, index:String):Null { + fetchNoteStyle(); var basePath:String = 'ui/countdown/'; - var spritePath:String = basePath + noteStyle.id + '/$index'; - // If nothing is found, revert it to default notestyle skin + + while (!Assets.exists(Paths.image(spritePath)) && fallbackNoteStyle != null) { + noteStyle = fallbackNoteStyle; + fallbackNoteStyle = NoteStyleRegistry.instance.fetchEntry(noteStyle.getFallbackID()); + spritePath = basePath + noteStyle.id + '/$index'; + } + if (noteStyle.isHoldNotePixel()) isPixel = true; + + // If ABSOLUTELY nothing is found, revert it to default notestyle skin if (!Assets.exists(Paths.image(spritePath))) { if (!isPixel) spritePath = basePath + Constants.DEFAULT_NOTE_STYLE + '/$index'; @@ -277,10 +293,19 @@ class Countdown static function resolveSoundPath(noteStyle:NoteStyle, step:CountdownStep):Null { if (step == CountdownStep.BEFORE || step == CountdownStep.AFTER) return null; + fetchNoteStyle(); var basePath:String = 'gameplay/countdown/'; - var soundPath:String = basePath + noteStyle.id + '/intro$step'; - // If nothing is found, revert it to default notestyle sound + + while (!Assets.exists(Paths.sound(soundPath)) && fallbackNoteStyle != null) + { + noteStyle = fallbackNoteStyle; + fallbackNoteStyle = NoteStyleRegistry.instance.fetchEntry(noteStyle.getFallbackID()); + soundPath = basePath + noteStyle.id + '/intro$step'; + } + if (noteStyle.isHoldNotePixel()) isPixel = true; + + // If ABSOLUTELY nothing is found, revert it to default notestyle sound if (!Assets.exists(Paths.sound(soundPath))) { if (!isPixel) soundPath = basePath + Constants.DEFAULT_NOTE_STYLE + '/intro$step'; diff --git a/source/funkin/play/components/PopUpStuff.hx b/source/funkin/play/components/PopUpStuff.hx index eb59a9922..6c111c0db 100644 --- a/source/funkin/play/components/PopUpStuff.hx +++ b/source/funkin/play/components/PopUpStuff.hx @@ -22,23 +22,40 @@ class PopUpStuff extends FlxTypedGroup */ static var noteStyle:NoteStyle; + static var fallbackNoteStyle:Null; + static var isPixel:Bool = false; override public function new() { super(); + fetchNoteStyle(); + } + + static function fetchNoteStyle():Void + { var fetchedNoteStyle:NoteStyle = NoteStyleRegistry.instance.fetchEntry(PlayState.instance.currentChart.noteStyle); if (fetchedNoteStyle == null) noteStyle = NoteStyleRegistry.instance.fetchDefault(); else noteStyle = fetchedNoteStyle; - if (noteStyle._data.assets.note.isPixel) isPixel = true; + fallbackNoteStyle = NoteStyleRegistry.instance.fetchEntry(noteStyle.getFallbackID()); + isPixel = false; } static function resolveGraphicPath(noteStyle:NoteStyle, index:String):Null { + fetchNoteStyle(); var basePath:String = 'ui/popup/'; - var spritePath:String = basePath + noteStyle.id + '/$index'; + + while (!Assets.exists(Paths.image(spritePath)) && fallbackNoteStyle != null) + { + noteStyle = fallbackNoteStyle; + fallbackNoteStyle = NoteStyleRegistry.instance.fetchEntry(noteStyle.getFallbackID()); + spritePath = basePath + noteStyle.id + '/$index'; + } + if (noteStyle.isHoldNotePixel()) isPixel = true; + // If nothing is found, revert it to default notestyle skin if (!Assets.exists(Paths.image(spritePath))) { diff --git a/source/funkin/play/notes/notestyle/NoteStyle.hx b/source/funkin/play/notes/notestyle/NoteStyle.hx index d0cc09f6a..edfcff2ee 100644 --- a/source/funkin/play/notes/notestyle/NoteStyle.hx +++ b/source/funkin/play/notes/notestyle/NoteStyle.hx @@ -72,7 +72,7 @@ class NoteStyle implements IRegistryEntry * Get the note style ID of the parent note style. * @return The string ID, or `null` if there is no parent. */ - function getFallbackID():Null + public function getFallbackID():Null { return _data.fallback; } From ba96b111960e2945c14eef0112368a30152d1e7c Mon Sep 17 00:00:00 2001 From: anysad Date: Thu, 18 Jul 2024 17:56:54 +0300 Subject: [PATCH 052/120] hopefully final polish? --- source/funkin/play/Countdown.hx | 26 ++++++++++----------- source/funkin/play/components/PopUpStuff.hx | 10 ++++---- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/source/funkin/play/Countdown.hx b/source/funkin/play/Countdown.hx index 25a896317..1a9605597 100644 --- a/source/funkin/play/Countdown.hx +++ b/source/funkin/play/Countdown.hx @@ -61,8 +61,6 @@ class Countdown // @:privateAccess // PlayState.instance.dispatchEvent(new SongTimeScriptEvent(SONG_BEAT_HIT, 0, 0)); - fetchNoteStyle(); - // The timer function gets called based on the beat of the song. countdownTimer = new FlxTimer(); @@ -80,10 +78,10 @@ class Countdown // PlayState.instance.dispatchEvent(new SongTimeScriptEvent(SONG_BEAT_HIT, 0, 0)); // Countdown graphic. - showCountdownGraphic(countdownStep, noteStyle); + showCountdownGraphic(countdownStep); // Countdown sound. - playCountdownSound(countdownStep, noteStyle); + playCountdownSound(countdownStep); // Event handling bullshit. var cancelled:Bool = propagateCountdownEvent(countdownStep); @@ -212,7 +210,7 @@ class Countdown /** * Retrieves the graphic to use for this step of the countdown. */ - public static function showCountdownGraphic(index:CountdownStep, noteStyle:NoteStyle):Void + public static function showCountdownGraphic(index:CountdownStep):Void { var indexString:String = null; switch (index) @@ -229,25 +227,24 @@ class Countdown if (indexString == null) return; var spritePath:String = null; - spritePath = resolveGraphicPath(noteStyle, indexString); + spritePath = resolveGraphicPath(indexString); if (spritePath == null) return; var countdownSprite:FunkinSprite = FunkinSprite.create(spritePath); countdownSprite.scrollFactor.set(0, 0); - if (isPixel) countdownSprite.setGraphicSize(Std.int(countdownSprite.width * Constants.PIXEL_ART_SCALE * 1.1)); - else countdownSprite.setGraphicSize(Std.int(countdownSprite.width * 0.8)); + if (isPixel) countdownSprite.setGraphicSize(Std.int(countdownSprite.width * Constants.PIXEL_ART_SCALE)); + else countdownSprite.setGraphicSize(Std.int(countdownSprite.width * 0.7)); countdownSprite.antialiasing = !isPixel; countdownSprite.cameras = [PlayState.instance.camHUD]; countdownSprite.updateHitbox(); - countdownSprite.screenCenter(); // Fade sprite in, then out, then destroy it. - FlxTween.tween(countdownSprite, {y: countdownSprite.y += 100, alpha: 0}, Conductor.instance.beatLengthMs / 1000, + FlxTween.tween(countdownSprite, {alpha: 0}, Conductor.instance.beatLengthMs / 1000, { ease: FlxEase.cubeInOut, onComplete: function(twn:FlxTween) { @@ -256,9 +253,10 @@ class Countdown }); PlayState.instance.add(countdownSprite); + countdownSprite.screenCenter(); } - static function resolveGraphicPath(noteStyle:NoteStyle, index:String):Null + static function resolveGraphicPath(index:String):Null { fetchNoteStyle(); var basePath:String = 'ui/countdown/'; @@ -285,12 +283,12 @@ class Countdown /** * Retrieves the sound file to use for this step of the countdown. */ - public static function playCountdownSound(step:CountdownStep, noteStyle:NoteStyle):Void + public static function playCountdownSound(step:CountdownStep):Void { - return FunkinSound.playOnce(Paths.sound(resolveSoundPath(noteStyle, step)), Constants.COUNTDOWN_VOLUME); + return FunkinSound.playOnce(Paths.sound(resolveSoundPath(step)), Constants.COUNTDOWN_VOLUME); } - static function resolveSoundPath(noteStyle:NoteStyle, step:CountdownStep):Null + static function resolveSoundPath(step:CountdownStep):Null { if (step == CountdownStep.BEFORE || step == CountdownStep.AFTER) return null; fetchNoteStyle(); diff --git a/source/funkin/play/components/PopUpStuff.hx b/source/funkin/play/components/PopUpStuff.hx index 6c111c0db..402535878 100644 --- a/source/funkin/play/components/PopUpStuff.hx +++ b/source/funkin/play/components/PopUpStuff.hx @@ -29,8 +29,6 @@ class PopUpStuff extends FlxTypedGroup override public function new() { super(); - - fetchNoteStyle(); } static function fetchNoteStyle():Void @@ -42,7 +40,7 @@ class PopUpStuff extends FlxTypedGroup isPixel = false; } - static function resolveGraphicPath(noteStyle:NoteStyle, index:String):Null + static function resolveGraphicPath(index:String):Null { fetchNoteStyle(); var basePath:String = 'ui/popup/'; @@ -72,7 +70,7 @@ class PopUpStuff extends FlxTypedGroup if (daRating == null) daRating = "good"; - var ratingPath:String = resolveGraphicPath(noteStyle, daRating); + var ratingPath:String = resolveGraphicPath(daRating); //if (PlayState.instance.currentStageId.startsWith('school')) ratingPath = "weeb/pixelUI/" + ratingPath + "-pixel"; @@ -122,7 +120,7 @@ class PopUpStuff extends FlxTypedGroup if (combo == null) combo = 0; - var comboPath:String = resolveGraphicPath(noteStyle, 'combo'); + var comboPath:String = resolveGraphicPath('combo'); var comboSpr:FunkinSprite = FunkinSprite.create(comboPath); comboSpr.y = (FlxG.camera.height * 0.44) + offsets[1]; comboSpr.x = (FlxG.width * 0.507) + offsets[0]; @@ -165,7 +163,7 @@ class PopUpStuff extends FlxTypedGroup var daLoop:Int = 1; for (i in seperatedScore) { - var numScore:FunkinSprite = FunkinSprite.create(0, comboSpr.y, resolveGraphicPath(noteStyle, 'num' + Std.int(i))); + var numScore:FunkinSprite = FunkinSprite.create(0, comboSpr.y, resolveGraphicPath('num' + Std.int(i))); if (isPixel) numScore.setGraphicSize(Std.int(numScore.width * Constants.PIXEL_ART_SCALE * 0.7)); else numScore.setGraphicSize(Std.int(numScore.width * 0.45)); From c8caeb42ded0be5292680db20c5cb99b2a37bf46 Mon Sep 17 00:00:00 2001 From: AppleHair <95587502+AppleHair@users.noreply.github.com> Date: Tue, 23 Jul 2024 11:34:26 +0300 Subject: [PATCH 053/120] A fix requested by Eric --- source/funkin/play/PlayState.hx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 9b1cc2ed9..20b8d784b 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -2959,11 +2959,16 @@ class PlayState extends MusicBeatSubState FunkinSound.playOnce(Paths.sound('Lights_Shut_off'), function() { // no camFollow so it centers on horror tree var targetSong:Song = SongRegistry.instance.fetchEntry(targetSongId); + var targetVariation:String = currentVariation; + if (!targetSong.hasDifficulty(PlayStatePlaylist.campaignDifficulty, currentVariation)) + { + targetVariation = targetSong.getFirstValidVariation(PlayStatePlaylist.campaignDifficulty) ?? Constants.DEFAULT_VARIATION; + } LoadingState.loadPlayState( { targetSong: targetSong, targetDifficulty: PlayStatePlaylist.campaignDifficulty, - targetVariation: targetSong.getFirstValidVariation(PlayStatePlaylist.campaignDifficulty), + targetVariation: targetVariation, cameraFollowPoint: cameraFollowPoint.getPosition(), }); }); @@ -2971,11 +2976,16 @@ class PlayState extends MusicBeatSubState else { var targetSong:Song = SongRegistry.instance.fetchEntry(targetSongId); + var targetVariation:String = currentVariation; + if (!targetSong.hasDifficulty(PlayStatePlaylist.campaignDifficulty, currentVariation)) + { + targetVariation = targetSong.getFirstValidVariation(PlayStatePlaylist.campaignDifficulty) ?? Constants.DEFAULT_VARIATION; + } LoadingState.loadPlayState( { targetSong: targetSong, targetDifficulty: PlayStatePlaylist.campaignDifficulty, - targetVariation: targetSong.getFirstValidVariation(PlayStatePlaylist.campaignDifficulty), + targetVariation: targetVariation, cameraFollowPoint: cameraFollowPoint.getPosition(), }); } From 8778ab1d0ec46556338e60fe0eb84c6d26064d7f Mon Sep 17 00:00:00 2001 From: Burgerballs <107233412+Burgerballs@users.noreply.github.com> Date: Tue, 23 Jul 2024 18:09:39 +0100 Subject: [PATCH 054/120] Update PlayState.hx --- source/funkin/play/PlayState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index f55cef388..f82fd791e 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -2033,7 +2033,7 @@ class PlayState extends MusicBeatSubState vocals.pause(); - FlxG.sound.music.play(FlxG.sound.music.time); + FlxG.sound.music.play(Conductor.instance.songPosition + Conductor.instance.instrumentalOffset); vocals.time = FlxG.sound.music.time; vocals.play(false, FlxG.sound.music.time); From 964f6878c3fb8d13f4faf6723d299997edceaccf Mon Sep 17 00:00:00 2001 From: Burgerballs <107233412+Burgerballs@users.noreply.github.com> Date: Tue, 23 Jul 2024 19:02:09 +0100 Subject: [PATCH 055/120] Update PlayState.hx --- source/funkin/play/PlayState.hx | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index f82fd791e..07e4f0b1d 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -1404,17 +1404,6 @@ class PlayState extends MusicBeatSubState if (isGamePaused) return false; - if (!startingSong - && FlxG.sound.music != null - && (Math.abs(FlxG.sound.music.time - (Conductor.instance.songPosition + Conductor.instance.instrumentalOffset)) > 200 - || Math.abs(vocals.checkSyncError(Conductor.instance.songPosition + Conductor.instance.instrumentalOffset)) > 200)) - { - trace("VOCALS NEED RESYNC"); - if (vocals != null) trace(vocals.checkSyncError(Conductor.instance.songPosition + Conductor.instance.instrumentalOffset)); - trace(FlxG.sound.music.time - (Conductor.instance.songPosition + Conductor.instance.instrumentalOffset)); - resyncVocals(); - } - if (iconP1 != null) iconP1.onStepHit(Std.int(Conductor.instance.currentStep)); if (iconP2 != null) iconP2.onStepHit(Std.int(Conductor.instance.currentStep)); @@ -1436,6 +1425,17 @@ class PlayState extends MusicBeatSubState // activeNotes.sort(SortUtil.byStrumtime, FlxSort.DESCENDING); } + if (!startingSong + && FlxG.sound.music != null + && (Math.abs(FlxG.sound.music.time - (Conductor.instance.songPosition + Conductor.instance.instrumentalOffset)) > 100 + || Math.abs(vocals.checkSyncError(Conductor.instance.songPosition + Conductor.instance.instrumentalOffset)) > 100)) + { + trace("VOCALS NEED RESYNC"); + if (vocals != null) trace(vocals.checkSyncError(Conductor.instance.songPosition + Conductor.instance.instrumentalOffset)); + trace(FlxG.sound.music.time - (Conductor.instance.songPosition + Conductor.instance.instrumentalOffset)); + resyncVocals(); + } + // Only bop camera if zoom level is below 135% if (Preferences.zoomCamera && FlxG.camera.zoom < (1.35 * FlxCamera.defaultZoom) @@ -2030,13 +2030,15 @@ class PlayState extends MusicBeatSubState // Skip this if the music is paused (GameOver, Pause menu, start-of-song offset, etc.) if (!FlxG.sound.music.playing) return; - + var timeToPlayAt:Float = Conductor.instance.songPosition - Conductor.instance.instrumentalOffset; + FlxG.sound.music.pause(); vocals.pause(); - FlxG.sound.music.play(Conductor.instance.songPosition + Conductor.instance.instrumentalOffset); + FlxG.sound.music.time = timeToPlayAt; + FlxG.sound.music.play(false, timeToPlayAt); - vocals.time = FlxG.sound.music.time; - vocals.play(false, FlxG.sound.music.time); + vocals.time = timeToPlayAt; + vocals.play(false, timeToPlayAt); } /** From d43042fd36a74d789a3e439e0ecec5d8f1a07722 Mon Sep 17 00:00:00 2001 From: Hyper_ Date: Mon, 5 Aug 2024 20:02:23 -0300 Subject: [PATCH 056/120] Fix out of bounds note selection --- source/funkin/ui/debug/charting/ChartEditorState.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index f72cca77f..98d8036e9 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -4223,8 +4223,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState } else { - // Minimum of 0. - return 0; + // Minimum of -1. + return -1; } }); From 00c7767f8a82304a7b7595e041ad60dbbc8cb3ca Mon Sep 17 00:00:00 2001 From: cyn Date: Fri, 23 Aug 2024 20:17:10 -0700 Subject: [PATCH 057/120] Update FunkinSound.hx --- source/funkin/audio/FunkinSound.hx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/funkin/audio/FunkinSound.hx b/source/funkin/audio/FunkinSound.hx index c70f195d2..7105a8735 100644 --- a/source/funkin/audio/FunkinSound.hx +++ b/source/funkin/audio/FunkinSound.hx @@ -543,11 +543,12 @@ class FunkinSound extends FlxSound implements ICloneable /** * Stop all sounds in the pool and allow them to be recycled. */ - public static function stopAllAudio(musicToo:Bool = false):Void + public static function stopAllAudio(musicToo:Bool = false, persistToo:Bool = false):Void { for (sound in pool) { if (sound == null) continue; + if (!persistToo && sound.persist) continue; if (!musicToo && sound == FlxG.sound.music) continue; sound.destroy(); } From 77346696f834fa7e628c19c50e0f5e9d974cff33 Mon Sep 17 00:00:00 2001 From: lemz Date: Sat, 7 Sep 2024 19:49:08 +0200 Subject: [PATCH 058/120] Update MusicBeatSubState.hx --- source/funkin/ui/MusicBeatSubState.hx | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/source/funkin/ui/MusicBeatSubState.hx b/source/funkin/ui/MusicBeatSubState.hx index 9035d12ff..614961d70 100644 --- a/source/funkin/ui/MusicBeatSubState.hx +++ b/source/funkin/ui/MusicBeatSubState.hx @@ -37,17 +37,25 @@ class MusicBeatSubState extends FlxSubState implements IEventHandler return _conductorInUse = value; } - public function new(bgColor:FlxColor = FlxColor.TRANSPARENT) - { - super(); - this.bgColor = bgColor; - } - var controls(get, never):Controls; inline function get_controls():Controls return PlayerSettings.player1.controls; + public function new(bgColor:FlxColor = FlxColor.TRANSPARENT) + { + super(); + this.bgColor = bgColor; + + initCallbacks(); + } + + function initCallbacks() + { + subStateOpened.add(onOpenSubStateComplete); + subStateClosed.add(onCloseSubStateComplete); + } + override function create():Void { super.create(); From 16905c8210b0ada422d2552d3908f70cf9c6a2d3 Mon Sep 17 00:00:00 2001 From: Abnormal <86753001+AbnormalPoof@users.noreply.github.com> Date: Sun, 8 Sep 2024 21:48:48 +0000 Subject: [PATCH 059/120] Update ScriptedFunkinSprite.hx --- source/funkin/modding/base/ScriptedFunkinSprite.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/funkin/modding/base/ScriptedFunkinSprite.hx b/source/funkin/modding/base/ScriptedFunkinSprite.hx index dd8d15007..2ce84db3e 100644 --- a/source/funkin/modding/base/ScriptedFunkinSprite.hx +++ b/source/funkin/modding/base/ScriptedFunkinSprite.hx @@ -1,8 +1,8 @@ package funkin.modding.base; /** - * A script that can be tied to an FlxSprite. - * Create a scripted class that extends FlxSprite to use this. + * A script that can be tied to a FunkinSprite. + * Create a scripted class that extends FunkinSprite to use this. */ @:hscriptClass class ScriptedFunkinSprite extends funkin.graphics.FunkinSprite implements HScriptedClass {} From 178389ea0bd00bb7d1822abaff2aa3524f3f3f61 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Thu, 12 Sep 2024 23:28:43 -0400 Subject: [PATCH 060/120] Fix two song credits --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index bc7009b42..c3041be56 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit bc7009b4242691faa5c4552f7ca8a2f28e8cb1d2 +Subproject commit c3041be56396cda92f87d071f74d36113ed25e1f From 3fba55a4229139de0f64925f2bfc77ce1f689b0f Mon Sep 17 00:00:00 2001 From: FabsTheFabs Date: Fri, 13 Sep 2024 21:36:20 +0100 Subject: [PATCH 061/120] assets submod --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 8762fd51c..eaab81b1a 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 8762fd51c26abdc9a45657eab9018aa48e972cd6 +Subproject commit eaab81b1a76d18f356cf0a38f3feed463aed28cb From 517984d1200f0fe43a7a7bec4bd62cd6032a8997 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 13 Sep 2024 18:46:49 -0400 Subject: [PATCH 062/120] Fix a bug where Shit judgement would always display with anti-aliasing. --- source/funkin/play/notes/notestyle/NoteStyle.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/play/notes/notestyle/NoteStyle.hx b/source/funkin/play/notes/notestyle/NoteStyle.hx index ee07703f1..83aae6fcf 100644 --- a/source/funkin/play/notes/notestyle/NoteStyle.hx +++ b/source/funkin/play/notes/notestyle/NoteStyle.hx @@ -575,7 +575,7 @@ class NoteStyle implements IRegistryEntry var result = _data.assets.judgementBad?.isPixel; if (result == null && fallback != null) result = fallback.isJudgementSpritePixel(rating); return result ?? false; - case "GO": + case "shit": var result = _data.assets.judgementShit?.isPixel; if (result == null && fallback != null) result = fallback.isJudgementSpritePixel(rating); return result ?? false; From df87d677e1b155049bc254904a965989b53fa160 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 14 Sep 2024 17:00:41 -0400 Subject: [PATCH 063/120] Typo lol --- source/funkin/modding/PolymodHandler.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/modding/PolymodHandler.hx b/source/funkin/modding/PolymodHandler.hx index 75c69e506..e0b27e744 100644 --- a/source/funkin/modding/PolymodHandler.hx +++ b/source/funkin/modding/PolymodHandler.hx @@ -258,7 +258,7 @@ class PolymodHandler Polymod.blacklistImport('cpp.Lib'); // `Unserializer` - // Unserializerr.DEFAULT_RESOLVER.resolveClass() can access blacklisted packages + // Unserializer.DEFAULT_RESOLVER.resolveClass() can access blacklisted packages Polymod.blacklistImport('Unserializer'); // `lime.system.CFFI` From 0a8719088da94f295481d17a167e1875646a4d92 Mon Sep 17 00:00:00 2001 From: Til Tjardes Date: Sat, 14 Sep 2024 15:06:03 -0600 Subject: [PATCH 064/120] techniktil coming back with another typo lets go --- source/funkin/modding/events/ScriptEvent.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/modding/events/ScriptEvent.hx b/source/funkin/modding/events/ScriptEvent.hx index dd55de23b..cc1d00b58 100644 --- a/source/funkin/modding/events/ScriptEvent.hx +++ b/source/funkin/modding/events/ScriptEvent.hx @@ -103,7 +103,7 @@ class NoteScriptEvent extends ScriptEvent public var comboCount(default, null):Int; /** - * Whether to play the record scratch sound (if this eventn type is `NOTE_MISS`). + * Whether to play the record scratch sound (if this event type is `NOTE_MISS`). */ public var playSound(default, default):Bool; From 688abb557134d6b786628c206db126cfcba6d579 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 14 Sep 2024 20:25:45 -0400 Subject: [PATCH 065/120] Update example mod's API version so it actually loads. --- example_mods/introMod/_polymod_meta.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example_mods/introMod/_polymod_meta.json b/example_mods/introMod/_polymod_meta.json index 4dc0cd804..74c4a2504 100644 --- a/example_mods/introMod/_polymod_meta.json +++ b/example_mods/introMod/_polymod_meta.json @@ -6,7 +6,7 @@ "name": "EliteMasterEric" } ], - "api_version": "0.1.0", + "api_version": "0.5.0", "mod_version": "1.0.0", "license": "Apache-2.0" } From d5c7e4ffdb0076d1c54ee9e9703fb0a3a682fd96 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 14 Sep 2024 20:26:19 -0400 Subject: [PATCH 066/120] Fix bug where Pico would become locked on every game restart. --- source/funkin/save/Save.hx | 20 +++++++--- source/funkin/save/changelog.md | 6 +++ source/funkin/ui/mainmenu/MainMenuState.hx | 43 ++++++++++++---------- source/funkin/ui/title/TitleState.hx | 5 --- 4 files changed, 43 insertions(+), 31 deletions(-) diff --git a/source/funkin/save/Save.hx b/source/funkin/save/Save.hx index 2bbda15c0..eb9f6005e 100644 --- a/source/funkin/save/Save.hx +++ b/source/funkin/save/Save.hx @@ -17,7 +17,7 @@ import thx.semver.Version; @:nullSafety class Save { - public static final SAVE_DATA_VERSION:thx.semver.Version = "2.0.5"; + public static final SAVE_DATA_VERSION:thx.semver.Version = "2.0.4"; public static final SAVE_DATA_VERSION_RULE:thx.semver.VersionRule = "2.0.x"; // We load this version's saves from a new save path, to maintain SOME level of backwards compatibility. @@ -34,19 +34,19 @@ class Save { if (_instance == null) { - _instance = new Save(FlxG.save.data); + return _instance = load(); } return _instance; } var data:RawSaveData; - public static function load():Void + public static function load():Save { trace("[SAVE] Loading save..."); // Bind save data. - loadFromSlot(1); + return loadFromSlot(1); } /** @@ -65,7 +65,9 @@ class Save public static function getDefault():RawSaveData { return { - version: Save.SAVE_DATA_VERSION, + // Version number is an abstract(Array) internally. + // This means it copies by reference, so merging save data overides the version number lol. + version: thx.Dynamics.clone(Save.SAVE_DATA_VERSION), volume: 1.0, mute: false, @@ -433,7 +435,9 @@ class Save { if (!data.unlocks.charactersSeen.contains(character)) { + trace('Character seen: ' + character); data.unlocks.charactersSeen.push(character); + trace('New characters seen list: ' + data.unlocks.charactersSeen); flush(); } } @@ -832,7 +836,7 @@ class Save * If you set slot to `2`, it will load an independe * @param slot */ - static function loadFromSlot(slot:Int):Void + static function loadFromSlot(slot:Int):Save { trace("[SAVE] Loading save from slot " + slot + "..."); @@ -850,12 +854,14 @@ class Save trace('[SAVE] Found legacy save data, converting...'); var gameSave = SaveDataMigrator.migrateFromLegacy(legacySaveData); FlxG.save.mergeData(gameSave.data, true); + return gameSave; } else { trace('[SAVE] No legacy save data found.'); var gameSave = new Save(); FlxG.save.mergeData(gameSave.data, true); + return gameSave; } } else @@ -863,6 +869,8 @@ class Save trace('[SAVE] Found existing save data.'); var gameSave = SaveDataMigrator.migrate(FlxG.save.data); FlxG.save.mergeData(gameSave.data, true); + + return gameSave; } } diff --git a/source/funkin/save/changelog.md b/source/funkin/save/changelog.md index e3038373d..41d6e68ae 100644 --- a/source/funkin/save/changelog.md +++ b/source/funkin/save/changelog.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.0.4] - 2024-09-12 +Note to self: Only update to 2.1.0 when migration is needed. +### Added +- `unlocks.charactersSeen:Array` to `Save` +- `unlocks.oldChar:Bool` to `Save` + ## [2.0.5] - 2024-05-21 ### Fixed - Resolved an issue where HTML5 wouldn't store the semantic version properly, causing the game to fail to load the save. diff --git a/source/funkin/ui/mainmenu/MainMenuState.hx b/source/funkin/ui/mainmenu/MainMenuState.hx index 13d68da6d..a436848d2 100644 --- a/source/funkin/ui/mainmenu/MainMenuState.hx +++ b/source/funkin/ui/mainmenu/MainMenuState.hx @@ -356,7 +356,7 @@ class MainMenuState extends MusicBeatState #if FEATURE_DEBUG_FUNCTIONS // Ctrl+Alt+Shift+P = Character Unlock screen // Ctrl+Alt+Shift+W = Meet requirements for Pico Unlock - // Ctrl+Alt+Shift+L = Revoke requirements for Pico Unlock + // Ctrl+Alt+Shift+M = Revoke requirements for Pico Unlock // Ctrl+Alt+Shift+R = Score/Rank conflict test // Ctrl+Alt+Shift+N = Mark all characters as not seen // Ctrl+Alt+Shift+E = Dump save data @@ -369,7 +369,7 @@ class MainMenuState extends MusicBeatState if (FlxG.keys.pressed.CONTROL && FlxG.keys.pressed.ALT && FlxG.keys.pressed.SHIFT && FlxG.keys.justPressed.W) { FunkinSound.playOnce(Paths.sound('confirmMenu')); - // Give the user a score of 1 point on Weekend 1 story mode. + // Give the user a score of 1 point on Weekend 1 story mode (Easy difficulty). // This makes the level count as cleared and displays the songs in Freeplay. funkin.save.Save.instance.setLevelScore('weekend1', 'easy', { @@ -389,27 +389,30 @@ class MainMenuState extends MusicBeatState }); } - if (FlxG.keys.pressed.CONTROL && FlxG.keys.pressed.ALT && FlxG.keys.pressed.SHIFT && FlxG.keys.justPressed.L) + if (FlxG.keys.pressed.CONTROL && FlxG.keys.pressed.ALT && FlxG.keys.pressed.SHIFT && FlxG.keys.justPressed.M) { FunkinSound.playOnce(Paths.sound('confirmMenu')); - // Give the user a score of 0 points on Weekend 1 story mode. + // Give the user a score of 0 points on Weekend 1 story mode (all difficulties). // This makes the level count as uncleared and no longer displays the songs in Freeplay. - funkin.save.Save.instance.setLevelScore('weekend1', 'easy', - { - score: 1, - tallies: - { - sick: 0, - good: 0, - bad: 0, - shit: 0, - missed: 0, - combo: 0, - maxCombo: 0, - totalNotesHit: 0, - totalNotes: 0, - } - }); + for (diff in ['easy', 'normal', 'hard']) + { + funkin.save.Save.instance.setLevelScore('weekend1', diff, + { + score: 0, + tallies: + { + sick: 0, + good: 0, + bad: 0, + shit: 0, + missed: 0, + combo: 0, + maxCombo: 0, + totalNotesHit: 0, + totalNotes: 0, + } + }); + } } if (FlxG.keys.pressed.CONTROL && FlxG.keys.pressed.ALT && FlxG.keys.pressed.SHIFT && FlxG.keys.justPressed.R) diff --git a/source/funkin/ui/title/TitleState.hx b/source/funkin/ui/title/TitleState.hx index f5c641d0c..10e7dfaae 100644 --- a/source/funkin/ui/title/TitleState.hx +++ b/source/funkin/ui/title/TitleState.hx @@ -273,11 +273,6 @@ class TitleState extends MusicBeatState } #end - if (Save.instance.charactersSeen.contains("pico")) - { - Save.instance.charactersSeen.remove("pico"); - Save.instance.oldChar = false; - } Conductor.instance.update(); /* if (FlxG.onMobile) From fd6ca6e267d5ffbbb63f9e01e7ca92935a6785f4 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 14 Sep 2024 20:26:33 -0400 Subject: [PATCH 067/120] Remove some spammy log traces. --- source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx | 2 +- source/funkin/ui/charSelect/CharSelectPlayer.hx | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx b/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx index 952fa8b71..7ea97e39b 100644 --- a/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx +++ b/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx @@ -184,7 +184,7 @@ class FlxAtlasSprite extends FlxAnimate // Move to the first frame of the animation. // goToFrameLabel(id); - trace('Playing animation $id'); + // trace('Playing animation $id'); if ((id == null || id == "") || this.anim.symbolDictionary.exists(id) || (this.anim.getByName(id) != null)) { this.anim.play(id, restart, false, startFrame); diff --git a/source/funkin/ui/charSelect/CharSelectPlayer.hx b/source/funkin/ui/charSelect/CharSelectPlayer.hx index b6319f16d..1eef52bed 100644 --- a/source/funkin/ui/charSelect/CharSelectPlayer.hx +++ b/source/funkin/ui/charSelect/CharSelectPlayer.hx @@ -47,7 +47,6 @@ class CharSelectPlayer extends FlxAtlasSprite implements IBPMSyncedScriptedClass // if (getCurrentAnimation() == "idle") { - trace('Player beat hit'); playAnimation("idle", true, false, false); } }; From e23a85682a89c049c41cd0b67e434fcce6cc0b29 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 14 Sep 2024 20:26:39 -0400 Subject: [PATCH 068/120] Update some script files. --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index bc7009b42..616551146 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit bc7009b4242691faa5c4552f7ca8a2f28e8cb1d2 +Subproject commit 61655114603807b651109af282c2e2aefa9dccf2 From 9f3af1ab944d41ba56edc7336b6b795fdae89c32 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 14 Sep 2024 20:56:21 -0400 Subject: [PATCH 069/120] Add a separate Gold Perfect animation for modders --- assets | 2 +- source/funkin/data/freeplay/player/PlayerData.hx | 1 + source/funkin/ui/freeplay/charselect/PlayableCharacter.hx | 4 +++- source/funkin/util/Constants.hx | 4 ---- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/assets b/assets index bc7009b42..ef7386d74 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit bc7009b4242691faa5c4552f7ca8a2f28e8cb1d2 +Subproject commit ef7386d741e715bd809c913a7d50dfa7b8176e2d diff --git a/source/funkin/data/freeplay/player/PlayerData.hx b/source/funkin/data/freeplay/player/PlayerData.hx index de293c24e..867fe7113 100644 --- a/source/funkin/data/freeplay/player/PlayerData.hx +++ b/source/funkin/data/freeplay/player/PlayerData.hx @@ -270,6 +270,7 @@ typedef PlayerResultsData = { var music:PlayerResultsMusicData; + var perfectGold:Array; var perfect:Array; var excellent:Array; var great:Array; diff --git a/source/funkin/ui/freeplay/charselect/PlayableCharacter.hx b/source/funkin/ui/freeplay/charselect/PlayableCharacter.hx index 93d643ae4..408a91672 100644 --- a/source/funkin/ui/freeplay/charselect/PlayableCharacter.hx +++ b/source/funkin/ui/freeplay/charselect/PlayableCharacter.hx @@ -113,7 +113,9 @@ class PlayableCharacter implements IRegistryEntry switch (rank) { - case PERFECT | PERFECT_GOLD: + case PERFECT_GOLD: + return _data.results.perfectGold; + case PERFECT: return _data.results.perfect; case EXCELLENT: return _data.results.excellent; diff --git a/source/funkin/util/Constants.hx b/source/funkin/util/Constants.hx index 57fc484b8..cf58d191a 100644 --- a/source/funkin/util/Constants.hx +++ b/source/funkin/util/Constants.hx @@ -481,10 +481,6 @@ class Constants public static final JUDGEMENT_BAD_COMBO_BREAK:Bool = true; public static final JUDGEMENT_SHIT_COMBO_BREAK:Bool = true; - // % Sick - public static final RANK_PERFECT_PLAT_THRESHOLD:Float = 1.0; // % Sick - public static final RANK_PERFECT_GOLD_THRESHOLD:Float = 0.85; // % Sick - // % Hit public static final RANK_PERFECT_THRESHOLD:Float = 1.00; public static final RANK_EXCELLENT_THRESHOLD:Float = 0.90; From 16aff6e7c35152c4b3fd86ec73fc798b75847016 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 14 Sep 2024 21:37:02 -0400 Subject: [PATCH 070/120] Fix bugs with highscore display in Freeplay --- source/funkin/ui/freeplay/FreeplayState.hx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index af0a9b841..15633ff9d 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -586,13 +586,13 @@ class FreeplayState extends MusicBeatSubState } }; - exitMovers.set([fp, txtCompletion, fnfHighscoreSpr, txtCompletion, clearBoxSprite], + exitMovers.set([fp, txtCompletion, fnfHighscoreSpr, clearBoxSprite], { x: FlxG.width, speed: 0.3 }); - exitMoversCharSel.set([fp, txtCompletion, fnfHighscoreSpr, txtCompletion, clearBoxSprite], + exitMoversCharSel.set([fp, txtCompletion, fnfHighscoreSpr, clearBoxSprite], { y: -270, speed: 0.8, @@ -1376,7 +1376,7 @@ class FreeplayState extends MusicBeatSubState #if FEATURE_DEBUG_FUNCTIONS if (FlxG.keys.justPressed.P) { - FlxG.switchState(FreeplayState.build( + FlxG.switchState(() -> FreeplayState.build( { { character: currentCharacterId == "pico" ? Constants.DEFAULT_CHARACTER : "pico", @@ -1777,12 +1777,13 @@ class FreeplayState extends MusicBeatSubState FlxG.log.warn('WARN: could not find song with id (${daSong.songId})'); return; } - var targetVariation:String = targetSong.getFirstValidVariation(currentDifficulty) ?? ''; + var targetVariation:String = targetSong.getFirstValidVariation(currentDifficulty, currentCharacter) ?? ''; // TODO: This line of code makes me sad, but you can't really fix it without a breaking migration. var suffixedDifficulty = (targetVariation != Constants.DEFAULT_VARIATION && targetVariation != 'erect') ? '$currentDifficulty-${targetVariation}' : currentDifficulty; var songScore:Null = Save.instance.getSongScore(daSong.songId, suffixedDifficulty); + trace(songScore); intendedScore = songScore?.score ?? 0; intendedCompletion = songScore == null ? 0.0 : ((songScore.tallies.sick + songScore.tallies.good) / songScore.tallies.totalNotes); rememberedDifficulty = suffixedDifficulty; From 367e3e90083f95a13a5b4e76339f2d4eac534203 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 16 Sep 2024 17:18:42 -0400 Subject: [PATCH 071/120] priv modules --- .gitmodules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index be5e0aaa8..ad8099e60 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "assets"] path = assets - url = https://github.com/FunkinCrew/funkin.assets + url = https://github.com/FunkinCrew/Funkin-assets-secret [submodule "art"] path = art - url = https://github.com/FunkinCrew/funkin.art + url = https://github.com/FunkinCrew/Funkin-art-secret From 0b531c5b21931bc690ebe9f46d7111800e23704f Mon Sep 17 00:00:00 2001 From: Abnormal <86753001+AbnormalPoof@users.noreply.github.com> Date: Mon, 16 Sep 2024 22:13:16 +0000 Subject: [PATCH 072/120] add getPath --- source/funkin/Assets.hx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/funkin/Assets.hx b/source/funkin/Assets.hx index 5351676d4..05423c572 100644 --- a/source/funkin/Assets.hx +++ b/source/funkin/Assets.hx @@ -11,6 +11,11 @@ class Assets return openfl.utils.Assets.getText(path); } + public static function getPath(path:String):String + { + return openfl.utils.Assets.getPath(path); + } + public static function getMusic(path:String):openfl.media.Sound { return openfl.utils.Assets.getMusic(path); From 80fc0cd526d9dc22fe7c6afd141ee5c6814a3b84 Mon Sep 17 00:00:00 2001 From: lemz Date: Tue, 17 Sep 2024 00:16:27 +0200 Subject: [PATCH 073/120] Update Preferences.hx --- source/funkin/Preferences.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/funkin/Preferences.hx b/source/funkin/Preferences.hx index 7a322283d..25bc32163 100644 --- a/source/funkin/Preferences.hx +++ b/source/funkin/Preferences.hx @@ -15,7 +15,7 @@ class Preferences static function get_framerate():Int { - #if web + #if (web || CHEEMS) return 60; #else return Save?.instance?.options?.framerate ?? 60; @@ -24,7 +24,7 @@ class Preferences static function set_framerate(value:Int):Int { - #if web + #if (web || CHEEMS) return 60; #else var save:Save = Save.instance; From f8d0ddef3456b31f729d9110f106b0594baaaf4a Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Mon, 16 Sep 2024 18:17:07 -0400 Subject: [PATCH 074/120] Update troubleshooting guide --- docs/troubleshooting.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 3b93bab64..54ba396c4 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -1,4 +1,4 @@ -# Troubleshooting Common Issues +# Troubleshooting Common Compilation Issues - Weird macro error with a very tall call stack: Restart Visual Studio Code - NOTE: This is caused by Polymod somewhere, and seems to only occur when there is another compile error somewhere in the program. There is a bounty up for it. @@ -13,3 +13,11 @@ - `LINK : fatal error LNK1201: error writing to program database ''; check for insufficient disk space, invalid path, or insufficient privilege` - This error occurs if the PDB file located in your `export` folder is in use or exceeds 4 GB. Try deleting the `export` folder and building again from scratch. + +- `error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)` + - This error can happen during cloning as a result of poor network connectivity. A common fix is to run ` git config --global http.postBuffer 4096M` in your terminal. + +- Repository is missing an `assets` folder, or `assets` folder is empty. + - You did not clone the repository correctly! Copy the path to your `funkin` folder and run `cd the\path\you\copied`. Then follow the compilation guide starting from **Step 4**. + +- Other compilation issues may be caused by installing bad library versions. Try deleting the `.haxelib` folder and following the guide starting from **Step 5**. From 224d930ae6e7b41f8c79b19f842a9175374f87c9 Mon Sep 17 00:00:00 2001 From: lemz Date: Tue, 17 Sep 2024 00:17:56 +0200 Subject: [PATCH 075/120] Update PreferencesMenu.hx --- source/funkin/ui/options/PreferencesMenu.hx | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/funkin/ui/options/PreferencesMenu.hx b/source/funkin/ui/options/PreferencesMenu.hx index ca18c45be..adbe1d356 100644 --- a/source/funkin/ui/options/PreferencesMenu.hx +++ b/source/funkin/ui/options/PreferencesMenu.hx @@ -6,8 +6,6 @@ import flixel.FlxSprite; import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup; import funkin.ui.AtlasText.AtlasFont; import funkin.ui.options.OptionsState.Page; -import funkin.ui.options.items.CheckboxPreferenceItem; -import funkin.ui.options.items.NumberPreferenceItem; import funkin.graphics.FunkinCamera; import funkin.ui.TextMenuList.TextMenuItem; import funkin.audio.FunkinSound; From 535ac0e5283ecd83866907920cac52444fcd0e9c Mon Sep 17 00:00:00 2001 From: Kade <26305836+Kade-github@users.noreply.github.com> Date: Mon, 16 Sep 2024 15:25:13 -0700 Subject: [PATCH 076/120] add milliseconds to the playbar in charting state remove laggy redundant traces Revert "remove laggy redundant traces" This reverts commit 204113840473dd5069f5d508d50e15e21104b45a. --- source/funkin/ui/debug/charting/ChartEditorState.hx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index 811e08e5d..f778b11f3 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -5139,10 +5139,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState } var songPos:Float = Conductor.instance.songPosition + Conductor.instance.instrumentalOffset; + var songPosMilliseconds:String = Std.string(Math.floor(Math.abs(songPos) % 1000)).lpad('0', 2); var songPosSeconds:String = Std.string(Math.floor((Math.abs(songPos) / 1000) % 60)).lpad('0', 2); var songPosMinutes:String = Std.string(Math.floor((Math.abs(songPos) / 1000) / 60)).lpad('0', 2); if (songPos < 0) songPosMinutes = '-' + songPosMinutes; - var songPosString:String = '${songPosMinutes}:${songPosSeconds}'; + var songPosString:String = '${songPosMinutes}:${songPosSeconds}:${songPosMilliseconds}'; if (playbarSongPos.value != songPosString) playbarSongPos.value = songPosString; From 5a877a14a0d468d0592be6edfaa21b05dc8b3ebf Mon Sep 17 00:00:00 2001 From: Kade <26305836+Kade-github@users.noreply.github.com> Date: Mon, 16 Sep 2024 15:39:56 -0700 Subject: [PATCH 077/120] only show last two digits digit --- source/funkin/ui/debug/charting/ChartEditorState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index f778b11f3..024de8ec6 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -5139,7 +5139,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState } var songPos:Float = Conductor.instance.songPosition + Conductor.instance.instrumentalOffset; - var songPosMilliseconds:String = Std.string(Math.floor(Math.abs(songPos) % 1000)).lpad('0', 2); + var songPosMilliseconds:String = Std.string(Math.floor(Math.abs(songPos) % 1000)).lpad('0', 2).substr(0, 2); var songPosSeconds:String = Std.string(Math.floor((Math.abs(songPos) / 1000) % 60)).lpad('0', 2); var songPosMinutes:String = Std.string(Math.floor((Math.abs(songPos) / 1000) / 60)).lpad('0', 2); if (songPos < 0) songPosMinutes = '-' + songPosMinutes; From 7d2b946e9c1f885af6ccc9a937ed5af4774d9599 Mon Sep 17 00:00:00 2001 From: Kade <26305836+Kade-github@users.noreply.github.com> Date: Mon, 16 Sep 2024 16:42:53 -0700 Subject: [PATCH 078/120] depreciated screen X/Y to view X/Y --- .../ui/debug/charting/ChartEditorState.hx | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index 024de8ec6..c0c2e6309 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -700,7 +700,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState function get_isCursorOverHaxeUI():Bool { - return Screen.instance.hasSolidComponentUnderPoint(FlxG.mouse.screenX, FlxG.mouse.screenY); + return Screen.instance.hasSolidComponentUnderPoint(FlxG.mouse.viewX, FlxG.mouse.viewY); } /** @@ -3830,7 +3830,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState function handleScrollKeybinds():Void { // Don't scroll when the user is interacting with the UI, unless a playbar button (the << >> ones) is pressed. - if ((isHaxeUIFocused || isCursorOverHaxeUI) && playbarButtonPressed == null) return; + if ((isHaxeUIFocused || isHaxeUIDialogOpen) && playbarButtonPressed == null) return; var scrollAmount:Float = 0; // Amount to scroll the grid. var playheadAmount:Float = 0; // Amount to scroll the playhead relative to the grid. @@ -3840,7 +3840,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState // Handle scroll anchor if (scrollAnchorScreenPos != null) { - var currentScreenPos = new FlxPoint(FlxG.mouse.screenX, FlxG.mouse.screenY); + var currentScreenPos = new FlxPoint(FlxG.mouse.viewX, FlxG.mouse.viewX); var distance = currentScreenPos - scrollAnchorScreenPos; var verticalDistance = distance.y; @@ -4121,8 +4121,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState var overlapsRenderedEvents:Bool = FlxG.mouse.overlaps(renderedEvents); // Cursor position relative to the grid. - var cursorX:Float = FlxG.mouse.screenX - gridTiledSprite.x; - var cursorY:Float = FlxG.mouse.screenY - gridTiledSprite.y; + var cursorX:Float = FlxG.mouse.viewX - gridTiledSprite.x; + var cursorY:Float = FlxG.mouse.viewY - gridTiledSprite.y; var overlapsSelectionBorder:Bool = overlapsGrid && ((cursorX % 40) < (GRID_SELECTION_BORDER_WIDTH / 2) @@ -4137,7 +4137,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState { if (scrollAnchorScreenPos == null) { - scrollAnchorScreenPos = new FlxPoint(FlxG.mouse.screenX, FlxG.mouse.screenY); + scrollAnchorScreenPos = new FlxPoint(FlxG.mouse.viewX, FlxG.mouse.viewY); selectionBoxStartPos = null; } else @@ -4159,11 +4159,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState else if (notePreview != null && FlxG.mouse.overlaps(notePreview) && !isCursorOverHaxeUI) { // Clicked note preview - notePreviewScrollAreaStartPos = new FlxPoint(FlxG.mouse.screenX, FlxG.mouse.screenY); + notePreviewScrollAreaStartPos = new FlxPoint(FlxG.mouse.viewX, FlxG.mouse.viewY); } else if (!isCursorOverHaxeUI && (!overlapsGrid || overlapsSelectionBorder)) { - selectionBoxStartPos = new FlxPoint(FlxG.mouse.screenX, FlxG.mouse.screenY); + selectionBoxStartPos = new FlxPoint(FlxG.mouse.viewX, FlxG.mouse.viewY); // Drawing selection box. targetCursorMode = Crosshair; } @@ -4188,7 +4188,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState { // Clicked on the playhead scroll area. // Move the playhead to the cursor position. - this.playheadPositionInPixels = FlxG.mouse.screenY - (GRID_INITIAL_Y_POS); + this.playheadPositionInPixels = FlxG.mouse.viewY - (GRID_INITIAL_Y_POS); moveSongToScrollPosition(); // Cursor should be a grabby hand. @@ -4313,27 +4313,27 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState // Clicking and dragging. // Scroll the screen if the mouse is above or below the grid. - if (FlxG.mouse.screenY < MENU_BAR_HEIGHT) + if (FlxG.mouse.viewY < MENU_BAR_HEIGHT) { // Scroll up. - var diff:Float = MENU_BAR_HEIGHT - FlxG.mouse.screenY; + var diff:Float = MENU_BAR_HEIGHT - FlxG.mouse.viewY; scrollPositionInPixels -= diff * 0.5; // Too fast! moveSongToScrollPosition(); } - else if (FlxG.mouse.screenY > (playbarHeadLayout?.y ?? 0.0)) + else if (FlxG.mouse.viewY > (playbarHeadLayout?.y ?? 0.0)) { // Scroll down. - var diff:Float = FlxG.mouse.screenY - (playbarHeadLayout?.y ?? 0.0); + var diff:Float = FlxG.mouse.viewY - (playbarHeadLayout?.y ?? 0.0); scrollPositionInPixels += diff * 0.5; // Too fast! moveSongToScrollPosition(); } // Render the selection box. var selectionRect:FlxRect = new FlxRect(); - selectionRect.x = Math.min(FlxG.mouse.screenX, selectionBoxStartPos.x); - selectionRect.y = Math.min(FlxG.mouse.screenY, selectionBoxStartPos.y); - selectionRect.width = Math.abs(FlxG.mouse.screenX - selectionBoxStartPos.x); - selectionRect.height = Math.abs(FlxG.mouse.screenY - selectionBoxStartPos.y); + selectionRect.x = Math.min(FlxG.mouse.viewX, selectionBoxStartPos.x); + selectionRect.y = Math.min(FlxG.mouse.viewY, selectionBoxStartPos.y); + selectionRect.width = Math.abs(FlxG.mouse.viewX - selectionBoxStartPos.x); + selectionRect.height = Math.abs(FlxG.mouse.viewY - selectionBoxStartPos.y); setSelectionBoxBounds(selectionRect); targetCursorMode = Crosshair; @@ -4461,8 +4461,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState // Player is clicking and holding on note preview to scrub around. targetCursorMode = Grabbing; - var clickedPosInPixels:Float = FlxMath.remapToRange(FlxG.mouse.screenY, (notePreview?.y ?? 0.0), - (notePreview?.y ?? 0.0) + (notePreview?.height ?? 0.0), 0, songLengthInPixels); + var clickedPosInPixels:Float = FlxMath.remapToRange(FlxG.mouse.viewY, (notePreview?.y ?? 0.0), (notePreview?.y ?? 0.0) + (notePreview?.height ?? 0.0), + 0, songLengthInPixels); scrollPositionInPixels = clickedPosInPixels; moveSongToScrollPosition(); @@ -4520,17 +4520,17 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState targetCursorMode = Grabbing; // Scroll the screen if the mouse is above or below the grid. - if (FlxG.mouse.screenY < MENU_BAR_HEIGHT) + if (FlxG.mouse.viewY < MENU_BAR_HEIGHT) { // Scroll up. - var diff:Float = MENU_BAR_HEIGHT - FlxG.mouse.screenY; + var diff:Float = MENU_BAR_HEIGHT - FlxG.mouse.viewY; scrollPositionInPixels -= diff * 0.5; // Too fast! moveSongToScrollPosition(); } - else if (FlxG.mouse.screenY > (playbarHeadLayout?.y ?? 0.0)) + else if (FlxG.mouse.viewY > (playbarHeadLayout?.y ?? 0.0)) { // Scroll down. - var diff:Float = FlxG.mouse.screenY - (playbarHeadLayout?.y ?? 0.0); + var diff:Float = FlxG.mouse.viewY - (playbarHeadLayout?.y ?? 0.0); scrollPositionInPixels += diff * 0.5; // Too fast! moveSongToScrollPosition(); } @@ -4811,11 +4811,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState // Show the context menu connected to the note. if (useSingleNoteContextMenu) { - this.openNoteContextMenu(FlxG.mouse.screenX, FlxG.mouse.screenY, highlightedNote.noteData); + this.openNoteContextMenu(FlxG.mouse.viewX, FlxG.mouse.viewY, highlightedNote.noteData); } else { - this.openSelectionContextMenu(FlxG.mouse.screenX, FlxG.mouse.screenY); + this.openSelectionContextMenu(FlxG.mouse.viewX, FlxG.mouse.viewY); } } else @@ -4835,11 +4835,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState || (isHighlightedEventSelected && currentEventSelection.length == 1); if (useSingleEventContextMenu) { - this.openEventContextMenu(FlxG.mouse.screenX, FlxG.mouse.screenY, highlightedEvent.eventData); + this.openEventContextMenu(FlxG.mouse.viewX, FlxG.mouse.viewY, highlightedEvent.eventData); } else { - this.openSelectionContextMenu(FlxG.mouse.screenX, FlxG.mouse.screenY); + this.openSelectionContextMenu(FlxG.mouse.viewX, FlxG.mouse.viewY); } } else @@ -4860,11 +4860,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState // Show the context menu connected to the note. if (useSingleNoteContextMenu) { - this.openHoldNoteContextMenu(FlxG.mouse.screenX, FlxG.mouse.screenY, highlightedHoldNote.noteData); + this.openHoldNoteContextMenu(FlxG.mouse.viewX, FlxG.mouse.viewY, highlightedHoldNote.noteData); } else { - this.openSelectionContextMenu(FlxG.mouse.screenX, FlxG.mouse.screenY); + this.openSelectionContextMenu(FlxG.mouse.viewX, FlxG.mouse.viewY); } } else From 9624b57e4447925a3f7764ffae8442585221bde3 Mon Sep 17 00:00:00 2001 From: Kade <26305836+Kade-github@users.noreply.github.com> Date: Mon, 16 Sep 2024 17:23:49 -0700 Subject: [PATCH 079/120] This does fix it now --- source/funkin/ui/debug/charting/ChartEditorState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index c0c2e6309..922138a10 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -3830,7 +3830,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState function handleScrollKeybinds():Void { // Don't scroll when the user is interacting with the UI, unless a playbar button (the << >> ones) is pressed. - if ((isHaxeUIFocused || isHaxeUIDialogOpen) && playbarButtonPressed == null) return; + if ((isHaxeUIFocused || isCursorOverHaxeUI) && playbarButtonPressed == null) return; var scrollAmount:Float = 0; // Amount to scroll the grid. var playheadAmount:Float = 0; // Amount to scroll the playhead relative to the grid. From d710318830c73d333fdaf347c8250169dc856857 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Mon, 16 Sep 2024 21:54:24 -0400 Subject: [PATCH 080/120] Update HaxeUI --- hmm.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hmm.json b/hmm.json index d967a69b3..edc0529aa 100644 --- a/hmm.json +++ b/hmm.json @@ -77,14 +77,14 @@ "name": "haxeui-core", "type": "git", "dir": null, - "ref": "22f7c5a8ffca90d4677cffd6e570f53761709fbc", + "ref": "c9d96b168ea2a19274ad7c766ab1a34b57baa793", "url": "https://github.com/haxeui/haxeui-core" }, { "name": "haxeui-flixel", "type": "git", "dir": null, - "ref": "28bb710d0ae5d94b5108787593052165be43b980", + "ref": "013b9d4e56bfe9a034e028a8d685f0b274cb73c4", "url": "https://github.com/haxeui/haxeui-flixel" }, { From 811caf6b704674ffd0c9dd31ed6be5f8575c1b1f Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Mon, 16 Sep 2024 21:54:33 -0400 Subject: [PATCH 081/120] Suppress a spammy log trace --- source/funkin/ui/debug/charting/ChartEditorState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index 922138a10..2e259d3f5 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -5615,7 +5615,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState } else { - trace('Ignoring keybinds for View menu items because we are in live input mode (${currentLiveInputStyle}).'); + // trace('Ignoring keybinds for View menu items because we are in live input mode (${currentLiveInputStyle}).'); } } From b7c3f5ac9f3221efafc65196079a15b6fd435c3e Mon Sep 17 00:00:00 2001 From: Til Tjardes Date: Mon, 16 Sep 2024 20:04:04 -0600 Subject: [PATCH 082/120] Chart Editor Icons are fixed now! --- source/funkin/play/character/CharacterData.hx | 78 ++++++++++++++----- .../ChartEditorCharacterIconSelectorMenu.hx | 2 +- .../toolboxes/ChartEditorMetadataToolbox.hx | 6 +- 3 files changed, 62 insertions(+), 24 deletions(-) diff --git a/source/funkin/play/character/CharacterData.hx b/source/funkin/play/character/CharacterData.hx index bac2c7141..40957818a 100644 --- a/source/funkin/play/character/CharacterData.hx +++ b/source/funkin/play/character/CharacterData.hx @@ -12,6 +12,7 @@ import funkin.util.assets.DataAssets; import funkin.util.VersionUtil; import haxe.Json; import openfl.utils.Assets; +import flixel.graphics.frames.FlxFrame; class CharacterDataParser { @@ -281,41 +282,78 @@ class CharacterDataParser } /** - * TODO: Hardcode this. + * Returns the idle frame of a character. */ - public static function getCharPixelIconAsset(char:String):String + public static function getCharPixelIconAsset(char:String):FlxFrame { - var icon:String = char; + var charPath:String = "freeplay/icons/"; - switch (icon) + // FunkinCrew please dont skin me alive for copying pixelated icon and changing it a tiny bit + switch (char) { - case "bf-christmas" | "bf-car" | "bf-pixel" | "bf-holding-gf": - icon = "bf"; + case "bf-christmas" | "bf-car" | "bf-pixel" | "bf-holding-gf" | "bf-dark": + charPath += "bfpixel"; case "monster-christmas": - icon = "monster"; + charPath += "monsterpixel"; case "mom" | "mom-car": - icon = "mommy"; + charPath += "mommypixel"; case "pico-blazin" | "pico-playable" | "pico-speaker": - icon = "pico"; - case "gf-christmas" | "gf-car" | "gf-pixel" | "gf-tankmen": - icon = "gf"; + charPath += "picopixel"; + case "gf-christmas" | "gf-car" | "gf-pixel" | "gf-tankmen" | "gf-dark": + charPath += "gfpixel"; case "dad": - icon = "daddy"; + charPath += "dadpixel"; case "darnell-blazin": - icon = "darnell"; + charPath += "darnellpixel"; case "senpai-angry": - icon = "senpai"; + charPath += "senpaipixel"; case "spooky-dark": - icon = "spooky"; + charPath += "spookypixel"; case "tankman-atlas": - icon = "tankman"; + charPath += "tankmanpixel"; + case "pico-christmas" | "pico-dark": + charPath += "picopixel"; + default: + charPath += '${char}pixel'; } - var path = Paths.image("freeplay/icons/" + icon + "pixel"); - if (Assets.exists(path)) return path; + if (!Assets.exists(Paths.image(charPath))) + { + trace('[WARN] Character ${char} has no freeplay icon.'); + return null; + } - // TODO: Hardcode some additional behavior or a fallback. - return null; + var isAnimated = Assets.exists(Paths.file('images/$charPath.xml')); + var frame:FlxFrame = null; + + if (isAnimated) + { + var frames = Paths.getSparrowAtlas(charPath); + + var idleFrame:FlxFrame = frames.frames.find(function(frame:FlxFrame):Bool { + return frame.name.startsWith('idle'); + }); + + if (idleFrame == null) + { + trace('[WARN] Character ${char} has no idle in their freeplay icon.'); + return null; + } + + // so, haxe.ui.backend.AssetsImpl uses the parent width and height, which makes the image go crazy when rendered + // so this is a work around so that it uses the actual width and height + var imageGraphic = flixel.graphics.FlxGraphic.fromFrame(idleFrame, false, null, false); + + var imageFrame = flixel.graphics.frames.FlxImageFrame.fromImage(imageGraphic); + frame = imageFrame.frame; + } + else + { + var imageFrame = flixel.graphics.frames.FlxImageFrame.fromImage(Paths.image(charPath)); + frame = imageFrame.frame; + } + + return frame; } /** diff --git a/source/funkin/ui/debug/charting/dialogs/ChartEditorCharacterIconSelectorMenu.hx b/source/funkin/ui/debug/charting/dialogs/ChartEditorCharacterIconSelectorMenu.hx index 1edbb6c00..90d998a02 100644 --- a/source/funkin/ui/debug/charting/dialogs/ChartEditorCharacterIconSelectorMenu.hx +++ b/source/funkin/ui/debug/charting/dialogs/ChartEditorCharacterIconSelectorMenu.hx @@ -95,7 +95,7 @@ class ChartEditorCharacterIconSelectorMenu extends ChartEditorBaseMenu } var LIMIT = 6; - charButton.icon = CharacterDataParser.getCharPixelIconAsset(charId); + charButton.icon = haxe.ui.util.Variant.fromImageData(CharacterDataParser.getCharPixelIconAsset(charId)); charButton.text = charData.name.length > LIMIT ? '${charData.name.substr(0, LIMIT)}.' : '${charData.name}'; charButton.onClick = _ -> { diff --git a/source/funkin/ui/debug/charting/toolboxes/ChartEditorMetadataToolbox.hx b/source/funkin/ui/debug/charting/toolboxes/ChartEditorMetadataToolbox.hx index c97e8142d..f68776cab 100644 --- a/source/funkin/ui/debug/charting/toolboxes/ChartEditorMetadataToolbox.hx +++ b/source/funkin/ui/debug/charting/toolboxes/ChartEditorMetadataToolbox.hx @@ -221,7 +221,7 @@ class ChartEditorMetadataToolbox extends ChartEditorBaseToolbox var charDataOpponent:Null = CharacterDataParser.fetchCharacterData(chartEditorState.currentSongMetadata.playData.characters.opponent); if (charDataOpponent != null) { - buttonCharacterOpponent.icon = CharacterDataParser.getCharPixelIconAsset(chartEditorState.currentSongMetadata.playData.characters.opponent); + buttonCharacterOpponent.icon = haxe.ui.util.Variant.fromImageData(CharacterDataParser.getCharPixelIconAsset(chartEditorState.currentSongMetadata.playData.characters.opponent)); buttonCharacterOpponent.text = charDataOpponent.name.length > LIMIT ? '${charDataOpponent.name.substr(0, LIMIT)}.' : '${charDataOpponent.name}'; } else @@ -233,7 +233,7 @@ class ChartEditorMetadataToolbox extends ChartEditorBaseToolbox var charDataGirlfriend:Null = CharacterDataParser.fetchCharacterData(chartEditorState.currentSongMetadata.playData.characters.girlfriend); if (charDataGirlfriend != null) { - buttonCharacterGirlfriend.icon = CharacterDataParser.getCharPixelIconAsset(chartEditorState.currentSongMetadata.playData.characters.girlfriend); + buttonCharacterGirlfriend.icon = haxe.ui.util.Variant.fromImageData(CharacterDataParser.getCharPixelIconAsset(chartEditorState.currentSongMetadata.playData.characters.girlfriend)); buttonCharacterGirlfriend.text = charDataGirlfriend.name.length > LIMIT ? '${charDataGirlfriend.name.substr(0, LIMIT)}.' : '${charDataGirlfriend.name}'; } else @@ -245,7 +245,7 @@ class ChartEditorMetadataToolbox extends ChartEditorBaseToolbox var charDataPlayer:Null = CharacterDataParser.fetchCharacterData(chartEditorState.currentSongMetadata.playData.characters.player); if (charDataPlayer != null) { - buttonCharacterPlayer.icon = CharacterDataParser.getCharPixelIconAsset(chartEditorState.currentSongMetadata.playData.characters.player); + buttonCharacterPlayer.icon = haxe.ui.util.Variant.fromImageData(CharacterDataParser.getCharPixelIconAsset(chartEditorState.currentSongMetadata.playData.characters.player)); buttonCharacterPlayer.text = charDataPlayer.name.length > LIMIT ? '${charDataPlayer.name.substr(0, LIMIT)}.' : '${charDataPlayer.name}'; } else From e6525d0129ae9e61ddd7941f50d9cd38904efe6e Mon Sep 17 00:00:00 2001 From: Til Tjardes Date: Mon, 16 Sep 2024 20:44:29 -0600 Subject: [PATCH 083/120] stop being on the kickstarter crack me --- source/funkin/play/character/CharacterData.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/play/character/CharacterData.hx b/source/funkin/play/character/CharacterData.hx index 40957818a..052310a7e 100644 --- a/source/funkin/play/character/CharacterData.hx +++ b/source/funkin/play/character/CharacterData.hx @@ -342,7 +342,7 @@ class CharacterDataParser // so, haxe.ui.backend.AssetsImpl uses the parent width and height, which makes the image go crazy when rendered // so this is a work around so that it uses the actual width and height - var imageGraphic = flixel.graphics.FlxGraphic.fromFrame(idleFrame, false, null, false); + var imageGraphic = flixel.graphics.FlxGraphic.fromFrame(idleFrame); var imageFrame = flixel.graphics.frames.FlxImageFrame.fromImage(imageGraphic); frame = imageFrame.frame; From aae7dcdada565307a22c80a82666a8e4e1837d2e Mon Sep 17 00:00:00 2001 From: AbnormalPoof Date: Mon, 16 Sep 2024 23:35:23 -0500 Subject: [PATCH 084/120] fix crash when opening urls --- source/funkin/ui/mainmenu/MainMenuState.hx | 4 ++-- source/funkin/util/WindowUtil.hx | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/funkin/ui/mainmenu/MainMenuState.hx b/source/funkin/ui/mainmenu/MainMenuState.hx index 13d68da6d..588e4cb29 100644 --- a/source/funkin/ui/mainmenu/MainMenuState.hx +++ b/source/funkin/ui/mainmenu/MainMenuState.hx @@ -123,7 +123,7 @@ class MainMenuState extends MusicBeatState })); }); - #if CAN_OPEN_LINKS + #if FEATURE_OPEN_URL // In order to prevent popup blockers from triggering, // we need to open the link as an immediate result of a keypress event, // so we can't wait for the flicker animation to complete. @@ -234,7 +234,7 @@ class MainMenuState extends MusicBeatState camFollow.setPosition(selected.getGraphicMidpoint().x, selected.getGraphicMidpoint().y); } - #if CAN_OPEN_LINKS + #if FEATURE_OPEN_URL function selectDonate() { WindowUtil.openURL(Constants.URL_ITCH); diff --git a/source/funkin/util/WindowUtil.hx b/source/funkin/util/WindowUtil.hx index 0fe63fe32..aabaa495b 100644 --- a/source/funkin/util/WindowUtil.hx +++ b/source/funkin/util/WindowUtil.hx @@ -22,7 +22,7 @@ class WindowUtil */ public static function openURL(targetUrl:String):Void { - #if CAN_OPEN_LINKS + #if FEATURE_OPEN_URL #if linux Sys.command('/usr/bin/xdg-open $targetUrl &'); #else @@ -40,7 +40,7 @@ class WindowUtil */ public static function openFolder(targetPath:String):Void { - #if CAN_OPEN_LINKS + #if FEATURE_OPEN_URL #if windows Sys.command('explorer', [targetPath.replace('/', '\\')]); #elseif mac @@ -59,7 +59,7 @@ class WindowUtil */ public static function openSelectFile(targetPath:String):Void { - #if CAN_OPEN_LINKS + #if FEATURE_OPEN_URL #if windows Sys.command('explorer', ['/select,' + targetPath.replace('/', '\\')]); #elseif mac From 0706192cbe7863954351009a9825adf2bfbdd8c4 Mon Sep 17 00:00:00 2001 From: dombomb64 <49823019+dombomb64@users.noreply.github.com> Date: Tue, 17 Sep 2024 13:50:59 -0400 Subject: [PATCH 085/120] Fix note scaling with one simple trick! --- source/funkin/play/notes/StrumlineNote.hx | 2 +- source/funkin/play/notes/notestyle/NoteStyle.hx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/funkin/play/notes/StrumlineNote.hx b/source/funkin/play/notes/StrumlineNote.hx index d8230aa28..c33c8b578 100644 --- a/source/funkin/play/notes/StrumlineNote.hx +++ b/source/funkin/play/notes/StrumlineNote.hx @@ -85,7 +85,7 @@ class StrumlineNote extends FlxSprite noteStyle.applyStrumlineFrames(this); noteStyle.applyStrumlineAnimations(this, this.direction); - this.setGraphicSize(Std.int(Strumline.STRUMLINE_SIZE * noteStyle.getStrumlineScale())); + this.scale.set(noteStyle.getStrumlineScale()); this.updateHitbox(); noteStyle.applyStrumlineOffsets(this); diff --git a/source/funkin/play/notes/notestyle/NoteStyle.hx b/source/funkin/play/notes/notestyle/NoteStyle.hx index ee07703f1..9079fee64 100644 --- a/source/funkin/play/notes/notestyle/NoteStyle.hx +++ b/source/funkin/play/notes/notestyle/NoteStyle.hx @@ -93,7 +93,7 @@ class NoteStyle implements IRegistryEntry buildNoteAnimations(target); // Set the scale. - target.setGraphicSize(Strumline.STRUMLINE_SIZE * getNoteScale()); + target.scale.set(getNoteScale()); target.updateHitbox(); } From 6e33cac9ec0636333156a308b65438c311bc92be Mon Sep 17 00:00:00 2001 From: dombomb64 <49823019+dombomb64@users.noreply.github.com> Date: Tue, 17 Sep 2024 16:47:16 -0400 Subject: [PATCH 086/120] ...Okay it wasn't that simple --- source/funkin/play/notes/StrumlineNote.hx | 3 ++- source/funkin/play/notes/SustainTrail.hx | 5 +++-- .../funkin/play/notes/notestyle/NoteStyle.hx | 19 +++++++++++++++++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/source/funkin/play/notes/StrumlineNote.hx b/source/funkin/play/notes/StrumlineNote.hx index c33c8b578..16df9f502 100644 --- a/source/funkin/play/notes/StrumlineNote.hx +++ b/source/funkin/play/notes/StrumlineNote.hx @@ -85,7 +85,8 @@ class StrumlineNote extends FlxSprite noteStyle.applyStrumlineFrames(this); noteStyle.applyStrumlineAnimations(this, this.direction); - this.scale.set(noteStyle.getStrumlineScale()); + var scale = noteStyle.getStrumlineScale(); + this.scale.set(scale, scale); this.updateHitbox(); noteStyle.applyStrumlineOffsets(this); diff --git a/source/funkin/play/notes/SustainTrail.hx b/source/funkin/play/notes/SustainTrail.hx index 90b36b009..a9af468b9 100644 --- a/source/funkin/play/notes/SustainTrail.hx +++ b/source/funkin/play/notes/SustainTrail.hx @@ -87,6 +87,7 @@ class SustainTrail extends FlxSprite public var bottomClip:Float = 0.9; public var isPixel:Bool; + public var noteStyleOffsets:Array; var graphicWidth:Float = 0; var graphicHeight:Float = 0; @@ -107,6 +108,7 @@ class SustainTrail extends FlxSprite this.noteDirection = noteDirection; setupHoldNoteGraphic(noteStyle); + noteStyleOffsets = noteStyle.getHoldNoteOffsets(); indices = new DrawData(12, true, TRIANGLE_VERTEX_INDICES); @@ -137,7 +139,6 @@ class SustainTrail extends FlxSprite zoom = 1.0; zoom *= noteStyle.fetchHoldNoteScale(); - zoom *= 0.7; // CALCULATE SIZE graphicWidth = graphic.width / 8 * zoom; // amount of notes * 2 @@ -202,7 +203,7 @@ class SustainTrail extends FlxSprite { width = graphicWidth; height = graphicHeight; - offset.set(0, 0); + offset.set(noteStyleOffsets[0], noteStyleOffsets[1]); origin.set(width * 0.5, height * 0.5); } diff --git a/source/funkin/play/notes/notestyle/NoteStyle.hx b/source/funkin/play/notes/notestyle/NoteStyle.hx index 9079fee64..a5ff19cba 100644 --- a/source/funkin/play/notes/notestyle/NoteStyle.hx +++ b/source/funkin/play/notes/notestyle/NoteStyle.hx @@ -93,7 +93,8 @@ class NoteStyle implements IRegistryEntry buildNoteAnimations(target); // Set the scale. - target.scale.set(getNoteScale()); + var scale = getNoteScale(); + target.scale.set(scale, scale); target.updateHitbox(); } @@ -224,6 +225,13 @@ class NoteStyle implements IRegistryEntry return data?.scale ?? 1.0; } + public function getHoldNoteOffsets():Array + { + var data = _data?.assets?.holdNote; + if (data == null && fallback != null) return fallback.getHoldNoteOffsets(); + return data?.offsets ?? [0.0, 0.0]; + } + public function applyStrumlineFrames(target:StrumlineNote):Void { // TODO: Add support for multi-Sparrow. @@ -304,9 +312,16 @@ class NoteStyle implements IRegistryEntry return thx.Arrays.filterNull(result); } + public function getStrumlineOffsets():Array + { + var data = _data?.assets?.noteStrumline; + if (data == null && fallback != null) return fallback.getStrumlineOffsets(); + return data?.offsets ?? [0.0, 0.0]; + } + public function applyStrumlineOffsets(target:StrumlineNote):Void { - var offsets = _data?.assets?.noteStrumline?.offsets ?? [0.0, 0.0]; + var offsets = getStrumlineOffsets(); target.x += offsets[0]; target.y += offsets[1]; } From f2b3f47e73d4f29590fe1f4fd401a1c81cb9cb50 Mon Sep 17 00:00:00 2001 From: Michael <15317421+ActualMandM@users.noreply.github.com> Date: Tue, 17 Sep 2024 15:46:47 -0700 Subject: [PATCH 087/120] Disable input in CharSelect until stayFunky plays --- source/funkin/ui/charSelect/CharSelectSubState.hx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/source/funkin/ui/charSelect/CharSelectSubState.hx b/source/funkin/ui/charSelect/CharSelectSubState.hx index 3109dc8f1..c2dd18fd8 100644 --- a/source/funkin/ui/charSelect/CharSelectSubState.hx +++ b/source/funkin/ui/charSelect/CharSelectSubState.hx @@ -71,6 +71,7 @@ class CharSelectSubState extends MusicBeatSubState var availableChars:Map = new Map(); var pressedSelect:Bool = false; var selectTimer:FlxTimer = new FlxTimer(); + var allowInput:Bool = false; var selectSound:FunkinSound; var unlockSound:FunkinSound; @@ -430,6 +431,8 @@ class CharSelectSubState extends MusicBeatSubState overrideExisting: true, restartTrack: true, onLoad: function() { + allowInput = true; + @:privateAccess gfChill.analyzer = new SpectralAnalyzer(FlxG.sound.music._channel.__audioSource, 7, 0.1); #if desktop @@ -573,6 +576,8 @@ class CharSelectSubState extends MusicBeatSubState overrideExisting: true, restartTrack: true, onLoad: function() { + allowInput = true; + @:privateAccess gfChill.analyzer = new SpectralAnalyzer(FlxG.sound.music._channel.__audioSource, 7, 0.1); #if desktop @@ -642,6 +647,7 @@ class CharSelectSubState extends MusicBeatSubState function goToFreeplay():Void { + allowInput = false; autoFollow = false; FlxTween.tween(cursor, {alpha: 0}, 0.8, {ease: FlxEase.expoOut}); @@ -695,7 +701,7 @@ class CharSelectSubState extends MusicBeatSubState syncAudio(elapsed); - if (!pressedSelect) + if (allowInput && !pressedSelect) { if (controls.UI_UP) holdTmrUp += elapsed; if (controls.UI_UP_R) @@ -789,7 +795,7 @@ class CharSelectSubState extends MusicBeatSubState gfChill.visible = true; curChar = availableChars.get(getCurrentSelected()); - if (!pressedSelect && controls.ACCEPT) + if (allowInput && !pressedSelect && controls.ACCEPT) { cursorConfirmed.visible = true; cursorConfirmed.x = cursor.x - 2; @@ -817,7 +823,7 @@ class CharSelectSubState extends MusicBeatSubState }); } - if (pressedSelect && controls.BACK) + if (allowInput && pressedSelect && controls.BACK) { cursorConfirmed.visible = false; grpCursors.visible = true; @@ -847,7 +853,7 @@ class CharSelectSubState extends MusicBeatSubState gfChill.visible = false; - if (controls.ACCEPT) + if (allowInput && controls.ACCEPT) { cursorDenied.visible = true; cursorDenied.x = cursor.x - 2; From ea9dab4b73cec21ffa5585b4915d386e6497834c Mon Sep 17 00:00:00 2001 From: Lethrial Date: Wed, 18 Sep 2024 00:25:20 +0100 Subject: [PATCH 088/120] Update Main.hx --- source/Main.hx | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/Main.hx b/source/Main.hx index 724b118f8..56634c86b 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -123,8 +123,6 @@ class Main extends Sprite game.debugger.interaction.addTool(new funkin.util.TrackerToolButtonUtil()); #end - addChild(fpsCounter); - #if hxcpp_debug_server trace('hxcpp_debug_server is enabled! You can now connect to the game with a debugger.'); #else From de07497ae3967b981cc026d26997d717443dc280 Mon Sep 17 00:00:00 2001 From: Kade <26305836+Kade-github@users.noreply.github.com> Date: Tue, 17 Sep 2024 17:29:12 -0700 Subject: [PATCH 089/120] Make addCharacter actually set the characters type --- source/funkin/play/stage/Stage.hx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/funkin/play/stage/Stage.hx b/source/funkin/play/stage/Stage.hx index c42e41cad..ad768769c 100644 --- a/source/funkin/play/stage/Stage.hx +++ b/source/funkin/play/stage/Stage.hx @@ -464,6 +464,9 @@ class Stage extends FlxSpriteGroup implements IPlayStateScriptedClass implements #end } + // Set the characters type + character.characterType = charType; + // Add the character to the scene. this.add(character); From 19e6029fb27ef0c52aeb632d8c0ce941cd133623 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 18 Sep 2024 03:13:10 -0400 Subject: [PATCH 090/120] Fix some compilation errors --- source/funkin/play/PlayState.hx | 1 - source/funkin/play/components/PopUpStuff.hx | 9 --------- source/funkin/ui/debug/anim/DebugBoundingState.hx | 2 +- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index a25d3b231..1c82eb6b1 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -3046,7 +3046,6 @@ class PlayState extends MusicBeatSubState GameOverSubState.reset(); PauseSubState.reset(); Countdown.reset(); - PopUpStuff.reset(); // Clear the static reference to this state. instance = null; diff --git a/source/funkin/play/components/PopUpStuff.hx b/source/funkin/play/components/PopUpStuff.hx index e5e9b4681..a02291e4e 100644 --- a/source/funkin/play/components/PopUpStuff.hx +++ b/source/funkin/play/components/PopUpStuff.hx @@ -125,13 +125,4 @@ class PopUpStuff extends FlxTypedGroup daLoop++; } } - - /** - * Reset the popup configuration to the default. - */ - public static function reset() - { - noteStyle = NoteStyleRegistry.instance.fetchDefault(); - isPixel = false; - } } diff --git a/source/funkin/ui/debug/anim/DebugBoundingState.hx b/source/funkin/ui/debug/anim/DebugBoundingState.hx index 19391f8d9..d2a27999f 100644 --- a/source/funkin/ui/debug/anim/DebugBoundingState.hx +++ b/source/funkin/ui/debug/anim/DebugBoundingState.hx @@ -77,7 +77,7 @@ class DebugBoundingState extends FlxState { // get the screen position, according to the HUD camera, temp default to FlxG.camera juuust in case? var hudMousePos:FlxPoint = FlxG.mouse.getScreenPosition(hudCam ?? FlxG.camera); - return Screen.instance.hasSolidComponentUnderPoint(hudMousePos.x, hudMousePos.y) || FlxG.mouse.overlaps(animDropDownMenu, hudCam); + return Screen.instance.hasSolidComponentUnderPoint(hudMousePos.x, hudMousePos.y); } override function create() From 7b7d5deed5e56613b5ba10f2e2ad7dfe393a1a42 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 18 Sep 2024 03:13:21 -0400 Subject: [PATCH 091/120] Tweaks to framerate preference --- source/funkin/Preferences.hx | 4 ++-- source/funkin/ui/options/PreferencesMenu.hx | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/source/funkin/Preferences.hx b/source/funkin/Preferences.hx index 1eac9f47f..648880ad4 100644 --- a/source/funkin/Preferences.hx +++ b/source/funkin/Preferences.hx @@ -15,7 +15,7 @@ class Preferences static function get_framerate():Int { - #if (web || CHEEMS) + #if web return 60; #else return Save?.instance?.options?.framerate ?? 60; @@ -24,7 +24,7 @@ class Preferences static function set_framerate(value:Int):Int { - #if (web || CHEEMS) + #if web return 60; #else var save:Save = Save.instance; diff --git a/source/funkin/ui/options/PreferencesMenu.hx b/source/funkin/ui/options/PreferencesMenu.hx index adbe1d356..fb4980762 100644 --- a/source/funkin/ui/options/PreferencesMenu.hx +++ b/source/funkin/ui/options/PreferencesMenu.hx @@ -54,11 +54,6 @@ class PreferencesMenu extends Page */ function createPrefItems():Void { - #if !web - createPrefItemNumber('FPS', 'The framerate that the game is running on', function(value:Float) { - Preferences.framerate = Std.int(value); - }, null, Preferences.framerate, 60, 360, 1, 0); - #end createPrefItemCheckbox('Naughtyness', 'Toggle displaying raunchy content', function(value:Bool):Void { Preferences.naughtyness = value; }, Preferences.naughtyness); @@ -82,6 +77,10 @@ class PreferencesMenu extends Page createPrefItemCheckbox('Unlocked Framerate', 'Enable to unlock the framerate', function(value:Bool):Void { Preferences.unlockedFramerate = value; }, Preferences.unlockedFramerate); + #else + createPrefItemNumber('FPS', 'The maximum framerate that the game targets', function(value:Float) { + Preferences.framerate = Std.int(value); + }, null, Preferences.framerate, 30, 300, 5, 0); #end } From d30fe61ca07d9565a2142d5a044f2cd4558e7aa6 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 18 Sep 2024 05:03:04 -0400 Subject: [PATCH 092/120] Add a bunch of other functions to funkin.Assets, and add documentation --- source/funkin/Assets.hx | 150 +++++++++++++++++++++++++++++++++++----- 1 file changed, 134 insertions(+), 16 deletions(-) diff --git a/source/funkin/Assets.hx b/source/funkin/Assets.hx index 05423c572..967e4b0ca 100644 --- a/source/funkin/Assets.hx +++ b/source/funkin/Assets.hx @@ -1,43 +1,161 @@ package funkin; +import openfl.utils.Future; + /** * A wrapper around `openfl.utils.Assets` which disallows access to the harmful functions. * Later we'll add Funkin-specific caching to this. */ class Assets { - public static function getText(path:String):String - { - return openfl.utils.Assets.getText(path); - } - + /** + * Get the file system path for an asset + * @param path The asset path to load from, relative to the assets folder + * @return The path to the asset on the file system + */ public static function getPath(path:String):String { return openfl.utils.Assets.getPath(path); } - public static function getMusic(path:String):openfl.media.Sound - { - return openfl.utils.Assets.getMusic(path); - } - - public static function getBitmapData(path:String):openfl.display.BitmapData - { - return openfl.utils.Assets.getBitmapData(path); - } - + /** + * Load bytes from an asset + * May cause stutters or throw an error if the asset is not cached + * @param path The asset path to load from + * @return The byte contents of the file + */ public static function getBytes(path:String):haxe.io.Bytes { return openfl.utils.Assets.getBytes(path); } + /** + * Load bytes from an asset asynchronously + * @param path The asset path to load from + * @return A future which promises to return the byte contents of the file + */ + public static function loadBytes(path:String):Future + { + return openfl.utils.Assets.loadBytes(path); + } + + /** + * Load text from an asset. + * May cause stutters or throw an error if the asset is not cached + * @param path The asset path to load from + * @return The text contents of the file + */ + public static function getText(path:String):String + { + return openfl.utils.Assets.getText(path); + } + + /** + * Load text from an asset asynchronously + * @param path The asset path to load from + * @return A future which promises to return the text contents of the file + */ + public static function loadText(path:String):Future + { + return openfl.utils.Assets.loadText(path); + } + + /** + * Load a Sound file from an asset + * May cause stutters or throw an error if the asset is not cached + * @param path The asset path to load from + * @return The loaded sound + */ + public static function getSound(path:String):openfl.media.Sound + { + return openfl.utils.Assets.getSound(path); + } + + /** + * Load a Sound file from an asset asynchronously + * @param path The asset path to load from + * @return A future which promises to return the loaded sound + */ + public static function loadSound(path:String):Future + { + return openfl.utils.Assets.loadSound(path); + } + + /** + * Load a Sound file from an asset, with optimizations specific to long-duration music + * May cause stutters or throw an error if the asset is not cached + * @param path The asset path to load from + * @return The loaded sound + */ + public static function getMusic(path:String):openfl.media.Sound + { + return openfl.utils.Assets.getMusic(path); + } + + /** + * Load a Sound file from an asset asynchronously, with optimizations specific to long-duration music + * @param path The asset path to load from + * @return A future which promises to return the loaded sound + */ + public static function loadMusic(path:String):Future + { + return openfl.utils.Assets.loadMusic(path); + } + + /** + * Load a Bitmap from an asset + * May cause stutters or throw an error if the asset is not cached + * @param path The asset path to load from + * @return The loaded Bitmap image + */ + public static function getBitmapData(path:String):openfl.display.BitmapData + { + return openfl.utils.Assets.getBitmapData(path); + } + + /** + * Load a Bitmap from an asset asynchronously + * @param path The asset path to load from + * @return The future which promises to return the loaded Bitmap image + */ + public static function loadBitmapData(path:String):Future + { + return openfl.utils.Assets.loadBitmapData(path); + } + + /** + * Determines whether the given asset of the given type exists. + * @param path The asset path to check + * @param type The asset type to check + * @return Whether the asset exists + */ public static function exists(path:String, ?type:openfl.utils.AssetType):Bool { return openfl.utils.Assets.exists(path, type); } - public static function list(type:openfl.utils.AssetType):Array + /** + * Retrieve a list of all assets of the given type + * @param type The asset type to check + * @return A list of asset paths + */ + public static function list(?type:openfl.utils.AssetType):Array { return openfl.utils.Assets.list(type); } + + public static function hasLibrary(name:String):Bool + { + return openfl.utils.Assets.hasLibrary(name); + } + + public static function getLibrary(name:String):lime.utils.AssetLibrary + { + return openfl.utils.Assets.getLibrary(name); + } + + public static function loadLibrary(name:String):Future + { + return openfl.utils.Assets.loadLibrary(name); + } } From b6b2248aa389143b855eab86c19c656f9edc4376 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 18 Sep 2024 05:04:10 -0400 Subject: [PATCH 093/120] Make funkin.Assets and funkin.Paths default imports for all scripts --- assets | 2 +- source/funkin/modding/PolymodHandler.hx | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/assets b/assets index bc7009b42..16c1d3047 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit bc7009b4242691faa5c4552f7ca8a2f28e8cb1d2 +Subproject commit 16c1d30478875a5acbe92e4ec7d11234d1028286 diff --git a/source/funkin/modding/PolymodHandler.hx b/source/funkin/modding/PolymodHandler.hx index 75c69e506..258491552 100644 --- a/source/funkin/modding/PolymodHandler.hx +++ b/source/funkin/modding/PolymodHandler.hx @@ -228,6 +228,8 @@ class PolymodHandler static function buildImports():Void { // Add default imports for common classes. + Polymod.addDefaultImport(funkin.Assets); + Polymod.addDefaultImport(funkin.Paths); // Add import aliases for certain classes. // NOTE: Scripted classes are automatically aliased to their parent class. From 1beb21e57a2c0ac6d1a04df8fa699b25f1aee504 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 18 Sep 2024 05:04:32 -0400 Subject: [PATCH 094/120] Replace all instances of openfl/lime Assets with funkin.Assets --- source/funkin/Paths.hx | 5 ++--- .../funkin/graphics/adobeanimate/FlxAtlasSprite.hx | 1 - .../funkin/graphics/shaders/AdjustColorShader.hx | 2 -- source/funkin/graphics/shaders/BlendModesShader.hx | 2 -- .../funkin/graphics/shaders/GaussianBlurShader.hx | 2 -- source/funkin/graphics/shaders/Grayscale.hx | 2 -- source/funkin/graphics/shaders/HSVShader.hx | 2 -- source/funkin/graphics/shaders/MosaicEffect.hx | 2 -- .../graphics/shaders/RuntimeCustomBlendShader.hx | 1 - .../funkin/graphics/shaders/RuntimeRainShader.hx | 1 - source/funkin/import.hx | 1 + source/funkin/input/Cursor.hx | 1 - source/funkin/play/Countdown.hx | 1 - source/funkin/play/GameOverSubState.hx | 1 - source/funkin/play/character/CharacterData.hx | 1 - source/funkin/play/components/HealthIcon.hx | 1 - source/funkin/play/components/PopUpStuff.hx | 1 - source/funkin/play/song/Song.hx | 1 - source/funkin/ui/debug/anim/DebugBoundingState.hx | 1 - .../charting/components/ChartEditorEventSprite.hx | 1 - .../charting/handlers/ChartEditorAudioHandler.hx | 1 - source/funkin/ui/freeplay/AlbumRoll.hx | 1 - source/funkin/ui/freeplay/FreeplayState.hx | 3 +-- source/funkin/ui/freeplay/backcards/BackingCard.hx | 1 - .../funkin/ui/freeplay/backcards/BoyfriendCard.hx | 14 +++++++------- .../ui/freeplay/backcards/NewCharacterCard.hx | 1 - source/funkin/ui/freeplay/backcards/PicoCard.hx | 14 +++++++------- source/funkin/ui/options/FunkinSoundTray.hx | 1 - source/funkin/ui/story/StoryMenuState.hx | 1 - source/funkin/ui/transition/LoadingState.hx | 9 ++++----- source/funkin/ui/transition/StickerSubState.hx | 5 ++--- 31 files changed, 24 insertions(+), 57 deletions(-) diff --git a/source/funkin/Paths.hx b/source/funkin/Paths.hx index 285af7ca2..ae77ac2da 100644 --- a/source/funkin/Paths.hx +++ b/source/funkin/Paths.hx @@ -2,7 +2,6 @@ package funkin; import flixel.graphics.frames.FlxAtlasFrames; import openfl.utils.AssetType; -import openfl.utils.Assets as OpenFlAssets; /** * A core class which handles determining asset paths. @@ -44,11 +43,11 @@ class Paths if (currentLevel != null) { var levelPath:String = getLibraryPathForce(file, currentLevel); - if (OpenFlAssets.exists(levelPath, type)) return levelPath; + if (Assets.exists(levelPath, type)) return levelPath; } var levelPath:String = getLibraryPathForce(file, 'shared'); - if (OpenFlAssets.exists(levelPath, type)) return levelPath; + if (Assets.exists(levelPath, type)) return levelPath; return getPreloadPath(file); } diff --git a/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx b/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx index 952fa8b71..8a51e8c8b 100644 --- a/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx +++ b/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx @@ -7,7 +7,6 @@ import flxanimate.frames.FlxAnimateFrames; import flixel.graphics.frames.FlxFrame; import flixel.system.FlxAssets.FlxGraphicAsset; import openfl.display.BitmapData; -import openfl.utils.Assets; import flixel.math.FlxPoint; import flxanimate.animate.FlxKeyFrame; diff --git a/source/funkin/graphics/shaders/AdjustColorShader.hx b/source/funkin/graphics/shaders/AdjustColorShader.hx index 2b0970eeb..a6efc3e65 100644 --- a/source/funkin/graphics/shaders/AdjustColorShader.hx +++ b/source/funkin/graphics/shaders/AdjustColorShader.hx @@ -1,8 +1,6 @@ package funkin.graphics.shaders; import flixel.addons.display.FlxRuntimeShader; -import funkin.Paths; -import openfl.utils.Assets; class AdjustColorShader extends FlxRuntimeShader { diff --git a/source/funkin/graphics/shaders/BlendModesShader.hx b/source/funkin/graphics/shaders/BlendModesShader.hx index b7a405dd1..e6ae45dd7 100644 --- a/source/funkin/graphics/shaders/BlendModesShader.hx +++ b/source/funkin/graphics/shaders/BlendModesShader.hx @@ -1,8 +1,6 @@ package funkin.graphics.shaders; import flixel.addons.display.FlxRuntimeShader; -import funkin.Paths; -import openfl.utils.Assets; import openfl.display.BitmapData; import openfl.display.ShaderInput; diff --git a/source/funkin/graphics/shaders/GaussianBlurShader.hx b/source/funkin/graphics/shaders/GaussianBlurShader.hx index cecfdab80..023a66853 100644 --- a/source/funkin/graphics/shaders/GaussianBlurShader.hx +++ b/source/funkin/graphics/shaders/GaussianBlurShader.hx @@ -1,8 +1,6 @@ package funkin.graphics.shaders; import flixel.addons.display.FlxRuntimeShader; -import funkin.Paths; -import openfl.utils.Assets; /** * Note... not actually gaussian! diff --git a/source/funkin/graphics/shaders/Grayscale.hx b/source/funkin/graphics/shaders/Grayscale.hx index fbd0970e5..6fbdd1881 100644 --- a/source/funkin/graphics/shaders/Grayscale.hx +++ b/source/funkin/graphics/shaders/Grayscale.hx @@ -1,8 +1,6 @@ package funkin.graphics.shaders; import flixel.addons.display.FlxRuntimeShader; -import funkin.Paths; -import openfl.utils.Assets; class Grayscale extends FlxRuntimeShader { diff --git a/source/funkin/graphics/shaders/HSVShader.hx b/source/funkin/graphics/shaders/HSVShader.hx index 587008ce2..dda841ad9 100644 --- a/source/funkin/graphics/shaders/HSVShader.hx +++ b/source/funkin/graphics/shaders/HSVShader.hx @@ -1,8 +1,6 @@ package funkin.graphics.shaders; import flixel.addons.display.FlxRuntimeShader; -import funkin.Paths; -import openfl.utils.Assets; class HSVShader extends FlxRuntimeShader { diff --git a/source/funkin/graphics/shaders/MosaicEffect.hx b/source/funkin/graphics/shaders/MosaicEffect.hx index fc3737aff..76a6b6f3d 100644 --- a/source/funkin/graphics/shaders/MosaicEffect.hx +++ b/source/funkin/graphics/shaders/MosaicEffect.hx @@ -1,8 +1,6 @@ package funkin.graphics.shaders; import flixel.addons.display.FlxRuntimeShader; -import openfl.utils.Assets; -import funkin.Paths; import flixel.math.FlxPoint; class MosaicEffect extends FlxRuntimeShader diff --git a/source/funkin/graphics/shaders/RuntimeCustomBlendShader.hx b/source/funkin/graphics/shaders/RuntimeCustomBlendShader.hx index 3e8dfedd3..74ce7f4ea 100644 --- a/source/funkin/graphics/shaders/RuntimeCustomBlendShader.hx +++ b/source/funkin/graphics/shaders/RuntimeCustomBlendShader.hx @@ -2,7 +2,6 @@ package funkin.graphics.shaders; import openfl.display.BitmapData; import openfl.display.BlendMode; -import openfl.utils.Assets; class RuntimeCustomBlendShader extends RuntimePostEffectShader { diff --git a/source/funkin/graphics/shaders/RuntimeRainShader.hx b/source/funkin/graphics/shaders/RuntimeRainShader.hx index d0c036623..5d8df3f2c 100644 --- a/source/funkin/graphics/shaders/RuntimeRainShader.hx +++ b/source/funkin/graphics/shaders/RuntimeRainShader.hx @@ -5,7 +5,6 @@ import openfl.display.BitmapData; import openfl.display.ShaderParameter; import openfl.display.ShaderParameterType; import flixel.util.FlxColor; -import openfl.utils.Assets; typedef Light = { diff --git a/source/funkin/import.hx b/source/funkin/import.hx index c8431be33..a29e19977 100644 --- a/source/funkin/import.hx +++ b/source/funkin/import.hx @@ -3,6 +3,7 @@ package; #if !macro // Only import these when we aren't in a macro. import funkin.util.Constants; +import funkin.Assets; import funkin.Paths; import funkin.Preferences; import flixel.FlxG; // This one in particular causes a compile error if you're using macros. diff --git a/source/funkin/input/Cursor.hx b/source/funkin/input/Cursor.hx index 39f399465..554a6b2c1 100644 --- a/source/funkin/input/Cursor.hx +++ b/source/funkin/input/Cursor.hx @@ -1,7 +1,6 @@ package funkin.input; import haxe.ui.backend.flixel.CursorHelper; -import openfl.utils.Assets; import lime.app.Future; import openfl.display.BitmapData; diff --git a/source/funkin/play/Countdown.hx b/source/funkin/play/Countdown.hx index 643883a43..94a7548b9 100644 --- a/source/funkin/play/Countdown.hx +++ b/source/funkin/play/Countdown.hx @@ -11,7 +11,6 @@ import funkin.modding.events.ScriptEvent.CountdownScriptEvent; import flixel.util.FlxTimer; import funkin.util.EaseUtil; import funkin.audio.FunkinSound; -import openfl.utils.Assets; import funkin.data.notestyle.NoteStyleRegistry; import funkin.play.notes.notestyle.NoteStyle; diff --git a/source/funkin/play/GameOverSubState.hx b/source/funkin/play/GameOverSubState.hx index f6a7148f8..bf8735647 100644 --- a/source/funkin/play/GameOverSubState.hx +++ b/source/funkin/play/GameOverSubState.hx @@ -15,7 +15,6 @@ import funkin.ui.freeplay.FreeplayState; import funkin.ui.MusicBeatSubState; import funkin.ui.story.StoryMenuState; import funkin.util.MathUtil; -import openfl.utils.Assets; import funkin.effects.RetroCameraFade; import flixel.math.FlxPoint; diff --git a/source/funkin/play/character/CharacterData.hx b/source/funkin/play/character/CharacterData.hx index bac2c7141..3a790bcf2 100644 --- a/source/funkin/play/character/CharacterData.hx +++ b/source/funkin/play/character/CharacterData.hx @@ -11,7 +11,6 @@ import funkin.play.character.ScriptedCharacter.ScriptedSparrowCharacter; import funkin.util.assets.DataAssets; import funkin.util.VersionUtil; import haxe.Json; -import openfl.utils.Assets; class CharacterDataParser { diff --git a/source/funkin/play/components/HealthIcon.hx b/source/funkin/play/components/HealthIcon.hx index c11850b2a..c7854871c 100644 --- a/source/funkin/play/components/HealthIcon.hx +++ b/source/funkin/play/components/HealthIcon.hx @@ -5,7 +5,6 @@ import flixel.FlxSprite; import flixel.math.FlxMath; import flixel.math.FlxPoint; import funkin.play.character.CharacterData.CharacterDataParser; -import openfl.utils.Assets; import funkin.graphics.FunkinSprite; import funkin.util.MathUtil; diff --git a/source/funkin/play/components/PopUpStuff.hx b/source/funkin/play/components/PopUpStuff.hx index a02291e4e..fbc97283f 100644 --- a/source/funkin/play/components/PopUpStuff.hx +++ b/source/funkin/play/components/PopUpStuff.hx @@ -8,7 +8,6 @@ import funkin.graphics.FunkinSprite; import funkin.play.PlayState; import funkin.util.TimerUtil; import funkin.util.EaseUtil; -import openfl.utils.Assets; import funkin.data.notestyle.NoteStyleRegistry; import funkin.play.notes.notestyle.NoteStyle; diff --git a/source/funkin/play/song/Song.hx b/source/funkin/play/song/Song.hx index 9d35902b0..9023b872e 100644 --- a/source/funkin/play/song/Song.hx +++ b/source/funkin/play/song/Song.hx @@ -16,7 +16,6 @@ import funkin.modding.IScriptedClass.IPlayStateScriptedClass; import funkin.modding.events.ScriptEvent; import funkin.ui.freeplay.charselect.PlayableCharacter; import funkin.util.SortUtil; -import openfl.utils.Assets; /** * This is a data structure managing information about the current song. diff --git a/source/funkin/ui/debug/anim/DebugBoundingState.hx b/source/funkin/ui/debug/anim/DebugBoundingState.hx index 7bb42c89e..5ed000e90 100644 --- a/source/funkin/ui/debug/anim/DebugBoundingState.hx +++ b/source/funkin/ui/debug/anim/DebugBoundingState.hx @@ -24,7 +24,6 @@ import haxe.ui.core.Screen; import haxe.ui.events.UIEvent; import haxe.ui.RuntimeComponentBuilder; import lime.utils.Assets as LimeAssets; -import openfl.Assets; import openfl.events.Event; import openfl.events.IOErrorEvent; import openfl.geom.Rectangle; diff --git a/source/funkin/ui/debug/charting/components/ChartEditorEventSprite.hx b/source/funkin/ui/debug/charting/components/ChartEditorEventSprite.hx index c996079bc..4c4a8d200 100644 --- a/source/funkin/ui/debug/charting/components/ChartEditorEventSprite.hx +++ b/source/funkin/ui/debug/charting/components/ChartEditorEventSprite.hx @@ -3,7 +3,6 @@ package funkin.ui.debug.charting.components; import funkin.data.event.SongEventRegistry; import flixel.graphics.frames.FlxAtlasFrames; import openfl.display.BitmapData; -import openfl.utils.Assets; import flixel.FlxObject; import flixel.FlxBasic; import flixel.FlxSprite; diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx index 26e246371..329873d68 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx @@ -13,7 +13,6 @@ import funkin.audio.waveform.WaveformSprite; import flixel.util.FlxColor; import haxe.io.Bytes; import haxe.io.Path; -import openfl.utils.Assets; /** * Functions for loading audio for the chart editor. diff --git a/source/funkin/ui/freeplay/AlbumRoll.hx b/source/funkin/ui/freeplay/AlbumRoll.hx index 4107369d2..81a9fe858 100644 --- a/source/funkin/ui/freeplay/AlbumRoll.hx +++ b/source/funkin/ui/freeplay/AlbumRoll.hx @@ -11,7 +11,6 @@ import funkin.data.freeplay.album.AlbumRegistry; import funkin.util.assets.FlxAnimationUtil; import funkin.graphics.FunkinSprite; import funkin.util.SortUtil; -import openfl.utils.Assets; /** * The graphic for the album roll in the FreeplayState. diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index af0a9b841..c368c6632 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -51,7 +51,6 @@ import funkin.ui.transition.LoadingState; import funkin.ui.transition.StickerSubState; import funkin.util.MathUtil; import funkin.util.SortUtil; -import lime.utils.Assets; import openfl.display.BlendMode; import funkin.data.freeplay.style.FreeplayStyleRegistry; import funkin.data.song.SongData.SongMusicData; @@ -1859,7 +1858,7 @@ class FreeplayState extends MusicBeatSubState albumRoll.setDifficultyStars(daSong?.difficultyRating); } - // Clears the cache of songs, frees up memory, they' ll have to be loaded in later tho function clearDaCache(actualSongTho:String) + // Clears the cache of songs to free up memory, they'll have to be loaded in later tho function clearDaCache(actualSongTho:String):Void { for (song in songs) diff --git a/source/funkin/ui/freeplay/backcards/BackingCard.hx b/source/funkin/ui/freeplay/backcards/BackingCard.hx index bb662cc8d..713b6edcf 100644 --- a/source/funkin/ui/freeplay/backcards/BackingCard.hx +++ b/source/funkin/ui/freeplay/backcards/BackingCard.hx @@ -18,7 +18,6 @@ import funkin.graphics.adobeanimate.FlxAtlasSprite; import funkin.graphics.FunkinSprite; import funkin.ui.freeplay.charselect.PlayableCharacter; import funkin.ui.MusicBeatSubState; -import lime.utils.Assets; import openfl.display.BlendMode; import flixel.group.FlxSpriteGroup; diff --git a/source/funkin/ui/freeplay/backcards/BoyfriendCard.hx b/source/funkin/ui/freeplay/backcards/BoyfriendCard.hx index 597fd1a34..a049c4f42 100644 --- a/source/funkin/ui/freeplay/backcards/BoyfriendCard.hx +++ b/source/funkin/ui/freeplay/backcards/BoyfriendCard.hx @@ -18,7 +18,6 @@ import funkin.graphics.adobeanimate.FlxAtlasSprite; import funkin.graphics.FunkinSprite; import funkin.ui.freeplay.charselect.PlayableCharacter; import funkin.ui.MusicBeatSubState; -import lime.utils.Assets; import openfl.display.BlendMode; import flixel.group.FlxSpriteGroup; @@ -177,20 +176,21 @@ class BoyfriendCard extends BackingCard } var beatFreq:Int = 1; - var beatFreqList:Array = [1,2,4,8]; + var beatFreqList:Array = [1, 2, 4, 8]; - public override function beatHit():Void { + public override function beatHit():Void + { // increases the amount of beats that need to go by to pulse the glow because itd flash like craazy at high bpms..... - beatFreq = beatFreqList[Math.floor(Conductor.instance.bpm/140)]; + beatFreq = beatFreqList[Math.floor(Conductor.instance.bpm / 140)]; - if(Conductor.instance.currentBeat % beatFreq != 0) return; + if (Conductor.instance.currentBeat % beatFreq != 0) return; FlxTween.cancelTweensOf(glow); FlxTween.cancelTweensOf(glowDark); glow.alpha = 0.8; - FlxTween.tween(glow, {alpha: 0}, 16/24, {ease: FlxEase.quartOut}); + FlxTween.tween(glow, {alpha: 0}, 16 / 24, {ease: FlxEase.quartOut}); glowDark.alpha = 0; - FlxTween.tween(glowDark, {alpha: 0.6}, 18/24, {ease: FlxEase.quartOut}); + FlxTween.tween(glowDark, {alpha: 0.6}, 18 / 24, {ease: FlxEase.quartOut}); } public override function introDone():Void diff --git a/source/funkin/ui/freeplay/backcards/NewCharacterCard.hx b/source/funkin/ui/freeplay/backcards/NewCharacterCard.hx index a44ff88a6..1e3d81299 100644 --- a/source/funkin/ui/freeplay/backcards/NewCharacterCard.hx +++ b/source/funkin/ui/freeplay/backcards/NewCharacterCard.hx @@ -20,7 +20,6 @@ import funkin.graphics.adobeanimate.FlxAtlasSprite; import funkin.graphics.FunkinSprite; import funkin.ui.freeplay.charselect.PlayableCharacter; import funkin.ui.MusicBeatSubState; -import lime.utils.Assets; import openfl.display.BlendMode; import flixel.group.FlxSpriteGroup; import funkin.graphics.shaders.AdjustColorShader; diff --git a/source/funkin/ui/freeplay/backcards/PicoCard.hx b/source/funkin/ui/freeplay/backcards/PicoCard.hx index f5db1ccc3..8cfe7756e 100644 --- a/source/funkin/ui/freeplay/backcards/PicoCard.hx +++ b/source/funkin/ui/freeplay/backcards/PicoCard.hx @@ -20,7 +20,6 @@ import funkin.graphics.adobeanimate.FlxAtlasSprite; import funkin.graphics.FunkinSprite; import funkin.ui.freeplay.charselect.PlayableCharacter; import funkin.ui.MusicBeatSubState; -import lime.utils.Assets; import openfl.display.BlendMode; import flixel.group.FlxSpriteGroup; import funkin.graphics.shaders.AdjustColorShader; @@ -233,20 +232,21 @@ class PicoCard extends BackingCard } var beatFreq:Int = 1; - var beatFreqList:Array = [1,2,4,8]; + var beatFreqList:Array = [1, 2, 4, 8]; - public override function beatHit():Void { + public override function beatHit():Void + { // increases the amount of beats that need to go by to pulse the glow because itd flash like craazy at high bpms..... - beatFreq = beatFreqList[Math.floor(Conductor.instance.bpm/140)]; + beatFreq = beatFreqList[Math.floor(Conductor.instance.bpm / 140)]; - if(Conductor.instance.currentBeat % beatFreq != 0) return; + if (Conductor.instance.currentBeat % beatFreq != 0) return; FlxTween.cancelTweensOf(glow); FlxTween.cancelTweensOf(glowDark); glow.alpha = 1; - FlxTween.tween(glow, {alpha: 0}, 16/24, {ease: FlxEase.quartOut}); + FlxTween.tween(glow, {alpha: 0}, 16 / 24, {ease: FlxEase.quartOut}); glowDark.alpha = 0; - FlxTween.tween(glowDark, {alpha: 1}, 18/24, {ease: FlxEase.quartOut}); + FlxTween.tween(glowDark, {alpha: 1}, 18 / 24, {ease: FlxEase.quartOut}); } public override function introDone():Void diff --git a/source/funkin/ui/options/FunkinSoundTray.hx b/source/funkin/ui/options/FunkinSoundTray.hx index 170ad8497..8ae53524a 100644 --- a/source/funkin/ui/options/FunkinSoundTray.hx +++ b/source/funkin/ui/options/FunkinSoundTray.hx @@ -6,7 +6,6 @@ import flixel.system.FlxAssets; import flixel.tweens.FlxEase; import openfl.display.Bitmap; import openfl.display.BitmapData; -import openfl.utils.Assets; import funkin.util.MathUtil; /** diff --git a/source/funkin/ui/story/StoryMenuState.hx b/source/funkin/ui/story/StoryMenuState.hx index 18614d414..c0ed2712a 100644 --- a/source/funkin/ui/story/StoryMenuState.hx +++ b/source/funkin/ui/story/StoryMenuState.hx @@ -23,7 +23,6 @@ import funkin.ui.MusicBeatState; import funkin.ui.transition.LoadingState; import funkin.ui.transition.StickerSubState; import funkin.util.MathUtil; -import openfl.utils.Assets; class StoryMenuState extends MusicBeatState { diff --git a/source/funkin/ui/transition/LoadingState.hx b/source/funkin/ui/transition/LoadingState.hx index 5b82cc741..ef95da6c9 100644 --- a/source/funkin/ui/transition/LoadingState.hx +++ b/source/funkin/ui/transition/LoadingState.hx @@ -3,24 +3,23 @@ package funkin.ui.transition; import flixel.FlxSprite; import flixel.math.FlxMath; import flixel.tweens.FlxEase; -import funkin.graphics.FunkinSprite; import flixel.tweens.FlxTween; import flixel.util.FlxTimer; +import flixel.util.typeLimit.NextState; +import funkin.graphics.FunkinSprite; import funkin.graphics.shaders.ScreenWipeShader; import funkin.play.PlayState; import funkin.play.PlayStatePlaylist; import funkin.play.song.Song.SongDifficulty; import funkin.ui.MusicBeatState; import haxe.io.Path; -import funkin.graphics.FunkinSprite; import lime.app.Future; import lime.app.Promise; import lime.utils.AssetLibrary; import lime.utils.AssetManifest; import lime.utils.Assets as LimeAssets; import openfl.filters.ShaderFilter; -import openfl.utils.Assets; -import flixel.util.typeLimit.NextState; +import openfl.utils.Assets as OpenFLAssets; class LoadingState extends MusicBeatSubState { @@ -98,7 +97,7 @@ class LoadingState extends MusicBeatSubState function checkLoadSong(path:String):Void { - if (!Assets.cache.hasSound(path)) + if (!OpenFLAssets.cache.hasSound(path)) { var library = Assets.getLibrary('songs'); var symbolPath = path.split(':').pop(); diff --git a/source/funkin/ui/transition/StickerSubState.hx b/source/funkin/ui/transition/StickerSubState.hx index e5abef872..e8d6877d8 100644 --- a/source/funkin/ui/transition/StickerSubState.hx +++ b/source/funkin/ui/transition/StickerSubState.hx @@ -2,7 +2,6 @@ package funkin.ui.transition; import flixel.FlxSprite; import haxe.Json; -import lime.utils.Assets; import funkin.graphics.FunkinSprite; // import flxtyped group import funkin.ui.MusicBeatSubState; @@ -56,7 +55,7 @@ class StickerSubState extends MusicBeatSubState // make sure that ONLY plays mp3/ogg files // if there's no mp3/ogg file, then it regenerates/reloads the random folder - var assetsInList = openfl.utils.Assets.list(); + var assetsInList = Assets.list(); var soundFilterFunc = function(a:String) { return a.startsWith('assets/shared/sounds/stickersounds/'); @@ -84,7 +83,7 @@ class StickerSubState extends MusicBeatSubState var filterFunc = function(a:String) { return a.startsWith('assets/shared/sounds/stickersounds/' + soundSelection + '/'); }; - var assetsInList3 = openfl.utils.Assets.list(); + var assetsInList3 = Assets.list(); sounds = assetsInList3.filter(filterFunc); for (i in 0...sounds.length) { From b28af79eb3246b7e540288230a59000654fe4aa5 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 18 Sep 2024 05:18:16 -0400 Subject: [PATCH 095/120] Fix build issues --- source/funkin/play/PlayState.hx | 1 - source/funkin/play/components/PopUpStuff.hx | 9 --------- source/funkin/ui/debug/anim/DebugBoundingState.hx | 2 +- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index a25d3b231..1c82eb6b1 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -3046,7 +3046,6 @@ class PlayState extends MusicBeatSubState GameOverSubState.reset(); PauseSubState.reset(); Countdown.reset(); - PopUpStuff.reset(); // Clear the static reference to this state. instance = null; diff --git a/source/funkin/play/components/PopUpStuff.hx b/source/funkin/play/components/PopUpStuff.hx index e5e9b4681..a02291e4e 100644 --- a/source/funkin/play/components/PopUpStuff.hx +++ b/source/funkin/play/components/PopUpStuff.hx @@ -125,13 +125,4 @@ class PopUpStuff extends FlxTypedGroup daLoop++; } } - - /** - * Reset the popup configuration to the default. - */ - public static function reset() - { - noteStyle = NoteStyleRegistry.instance.fetchDefault(); - isPixel = false; - } } diff --git a/source/funkin/ui/debug/anim/DebugBoundingState.hx b/source/funkin/ui/debug/anim/DebugBoundingState.hx index 19391f8d9..d2a27999f 100644 --- a/source/funkin/ui/debug/anim/DebugBoundingState.hx +++ b/source/funkin/ui/debug/anim/DebugBoundingState.hx @@ -77,7 +77,7 @@ class DebugBoundingState extends FlxState { // get the screen position, according to the HUD camera, temp default to FlxG.camera juuust in case? var hudMousePos:FlxPoint = FlxG.mouse.getScreenPosition(hudCam ?? FlxG.camera); - return Screen.instance.hasSolidComponentUnderPoint(hudMousePos.x, hudMousePos.y) || FlxG.mouse.overlaps(animDropDownMenu, hudCam); + return Screen.instance.hasSolidComponentUnderPoint(hudMousePos.x, hudMousePos.y); } override function create() From b5ed7f40d4621006d5dc906020050095e2733e9c Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 18 Sep 2024 05:24:57 -0400 Subject: [PATCH 096/120] Remove redundant character type assignment --- source/funkin/play/PlayState.hx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 0b2b8846d..b304381cc 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -1612,7 +1612,7 @@ class PlayState extends MusicBeatSubState if (girlfriend != null) { - girlfriend.characterType = CharacterType.GF; + // Don't need to do anything. } else if (currentCharacterData.girlfriend != '') { @@ -1630,8 +1630,6 @@ class PlayState extends MusicBeatSubState if (dad != null) { - dad.characterType = CharacterType.DAD; - // // OPPONENT HEALTH ICON // @@ -1650,8 +1648,6 @@ class PlayState extends MusicBeatSubState if (boyfriend != null) { - boyfriend.characterType = CharacterType.BF; - // // PLAYER HEALTH ICON // @@ -1993,6 +1989,7 @@ class PlayState extends MusicBeatSubState // Skip this if the music is paused (GameOver, Pause menu, start-of-song offset, etc.) if (!(FlxG.sound.music?.playing ?? false)) return; + var timeToPlayAt:Float = Conductor.instance.songPosition - Conductor.instance.instrumentalOffset; FlxG.sound.music.pause(); vocals.pause(); From d54dc6179a305d05d33ebb360410076dcf03a566 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 18 Sep 2024 06:02:13 -0400 Subject: [PATCH 097/120] Add several new Github Actions for issue management --- .github/label-actions.yml | 23 ++++++++ .github/workflows/label-actions.yml | 29 +++++++++++ .github/workflows/label-issue.yml | 52 +++++++++++++++++++ .../{labeler.yml => label-pull-request.yml} | 2 + 4 files changed, 106 insertions(+) create mode 100644 .github/label-actions.yml create mode 100644 .github/workflows/label-actions.yml create mode 100644 .github/workflows/label-issue.yml rename .github/workflows/{labeler.yml => label-pull-request.yml} (84%) diff --git a/.github/label-actions.yml b/.github/label-actions.yml new file mode 100644 index 000000000..00fb390aa --- /dev/null +++ b/.github/label-actions.yml @@ -0,0 +1,23 @@ +# Configuration for Label Actions - https://github.com/dessant/label-actions + +# Automatically close issues and pull requests when the `status: duplicate` label is applied +'status: duplicate': + issues: + # Post a comment + comment: > + This issue is a duplicate. Please direct all discussion to the original issue. + # Close the issue + close: true + # Remove other status labels + unlabel: + - 'status: pending triage' + # Set a close reason + close-reason: 'not planned' + prs: + # Post a comment + comment: > + This pull request is a duplicate. Please direct all discussion to the original pull request. + # Close the pull request + close: true + # Set a close reason + close-reason: 'not planned' diff --git a/.github/workflows/label-actions.yml b/.github/workflows/label-actions.yml new file mode 100644 index 000000000..bc4cf0add --- /dev/null +++ b/.github/workflows/label-actions.yml @@ -0,0 +1,29 @@ +# Perform actions when labels are applied to issues, discussions, or pull requests +# See .github/label-actions.yml +name: 'Label Actions' + +on: + issues: + types: + - labeled + - unlabeled + pull_request_target: + types: + - labeled + - unlabeled + discussion: + types: + - labeled + - unlabeled + +permissions: + contents: read + issues: write + pull-requests: write + discussions: write + +jobs: + action: + runs-on: ubuntu-latest + steps: + - uses: dessant/label-actions@v4 diff --git a/.github/workflows/label-issue.yml b/.github/workflows/label-issue.yml new file mode 100644 index 000000000..eeb83350c --- /dev/null +++ b/.github/workflows/label-issue.yml @@ -0,0 +1,52 @@ +name: "Issue Labeler" +on: + issues: + types: + - opened + - reopened + - edited + +jobs: + # When an issue is opened, perform a similarity check for potential duplicates. + # If some are found, add a label and comment listing the potential duplicate issues. + potential-duplicate: + name: Detect potential duplicate issues + runs-on: ubuntu-latest + steps: + - uses: wow-actions/potential-duplicates@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Issue title filter work with anymatch https://www.npmjs.com/package/anymatch. + # Any matched issue will stop detection immediately. + # You can specify multi filters in each line. + filter: '' + # Exclude keywords in title before detecting. + exclude: '' + # Label to set, when potential duplicates are detected. + label: 'potential duplicate' + # Get issues with state to compare. Supported state: 'all', 'closed', 'open'. + state: all + # If similarity is higher than this threshold([0,1]), issue will be marked as duplicate. + # Turn this up if the detection is too sensitive + threshold: 0.6 + # Reactions to be add to comment when potential duplicates are detected. + # Available reactions: "-1", "+1", "confused", "laugh", "heart", "hooray", "rocket", "eyes" + # reactions: '-1' + # Comment to post when potential duplicates are detected. + comment: > + Potential duplicates: {{#issues}} + - [#{{ number }}] {{ title }} ({{ accuracy }}%) + {{/issues}} + # When an issue is opened, detect if it has an empty body or incomplete issue form. + # If it does, close the issue immediately. + empty-issues: + name: Close empty issues + runs-on: ubuntu-latest + steps: + - name: Run empty issues closer action + uses: rickstaa/empty-issues-closer-action@v1 + env: + github_token: ${{ secrets.GITHUB_TOKEN }} + with: + close_comment: Closing this issue because it appears to be empty. Please update the issue for it to be reopened. + open_comment: Reopening this issue because the author provided more information. diff --git a/.github/workflows/labeler.yml b/.github/workflows/label-pull-request.yml similarity index 84% rename from .github/workflows/labeler.yml rename to .github/workflows/label-pull-request.yml index a861af578..525e1b5a6 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/label-pull-request.yml @@ -3,6 +3,7 @@ on: - pull_request_target jobs: + # Apply labels to pull requests based on which files were edited labeler: permissions: contents: read @@ -13,6 +14,7 @@ jobs: uses: actions/labeler@v5 with: sync-labels: true + # Apply labels to pull requests based on how many lines were edited changed-lines-count-labeler: permissions: contents: read From ba90a6abe04b15058a9c32a0ba1dd5338605c57a Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 18 Sep 2024 06:08:18 -0400 Subject: [PATCH 098/120] Add behavior when setting status: rejected --- .github/label-actions.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/label-actions.yml b/.github/label-actions.yml index 00fb390aa..1234d1526 100644 --- a/.github/label-actions.yml +++ b/.github/label-actions.yml @@ -17,7 +17,28 @@ # Post a comment comment: > This pull request is a duplicate. Please direct all discussion to the original pull request. + # Remove other status labels + unlabel: + - 'status: pending triage' # Close the pull request close: true # Set a close reason close-reason: 'not planned' + +'status: rejected': + issues: + # Close the issue + close: true + # Remove other status labels + unlabel: + - 'status: pending triage' + # Set a close reason + close-reason: 'not planned' + prs: + # Close the pull request + close: true + # Remove other status labels + unlabel: + - 'status: pending triage' + # Set a close reason + close-reason: 'not planned' From a469385cdba4288d166682874938b124fd2b7fcf Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 18 Sep 2024 06:22:02 -0400 Subject: [PATCH 099/120] Resolve merge issues --- source/funkin/play/PlayState.hx | 1 - source/funkin/play/components/PopUpStuff.hx | 9 --------- source/funkin/ui/debug/anim/DebugBoundingState.hx | 2 +- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index a25d3b231..1c82eb6b1 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -3046,7 +3046,6 @@ class PlayState extends MusicBeatSubState GameOverSubState.reset(); PauseSubState.reset(); Countdown.reset(); - PopUpStuff.reset(); // Clear the static reference to this state. instance = null; diff --git a/source/funkin/play/components/PopUpStuff.hx b/source/funkin/play/components/PopUpStuff.hx index e5e9b4681..a02291e4e 100644 --- a/source/funkin/play/components/PopUpStuff.hx +++ b/source/funkin/play/components/PopUpStuff.hx @@ -125,13 +125,4 @@ class PopUpStuff extends FlxTypedGroup daLoop++; } } - - /** - * Reset the popup configuration to the default. - */ - public static function reset() - { - noteStyle = NoteStyleRegistry.instance.fetchDefault(); - isPixel = false; - } } diff --git a/source/funkin/ui/debug/anim/DebugBoundingState.hx b/source/funkin/ui/debug/anim/DebugBoundingState.hx index 19391f8d9..d2a27999f 100644 --- a/source/funkin/ui/debug/anim/DebugBoundingState.hx +++ b/source/funkin/ui/debug/anim/DebugBoundingState.hx @@ -77,7 +77,7 @@ class DebugBoundingState extends FlxState { // get the screen position, according to the HUD camera, temp default to FlxG.camera juuust in case? var hudMousePos:FlxPoint = FlxG.mouse.getScreenPosition(hudCam ?? FlxG.camera); - return Screen.instance.hasSolidComponentUnderPoint(hudMousePos.x, hudMousePos.y) || FlxG.mouse.overlaps(animDropDownMenu, hudCam); + return Screen.instance.hasSolidComponentUnderPoint(hudMousePos.x, hudMousePos.y); } override function create() From 5efbff044b1a04cd28006124e0305671d6b709e7 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 18 Sep 2024 06:32:06 -0400 Subject: [PATCH 100/120] Resolve merge issues --- source/funkin/play/PlayState.hx | 1 - source/funkin/play/components/PopUpStuff.hx | 9 --------- source/funkin/ui/debug/anim/DebugBoundingState.hx | 2 +- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index a25d3b231..1c82eb6b1 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -3046,7 +3046,6 @@ class PlayState extends MusicBeatSubState GameOverSubState.reset(); PauseSubState.reset(); Countdown.reset(); - PopUpStuff.reset(); // Clear the static reference to this state. instance = null; diff --git a/source/funkin/play/components/PopUpStuff.hx b/source/funkin/play/components/PopUpStuff.hx index e5e9b4681..a02291e4e 100644 --- a/source/funkin/play/components/PopUpStuff.hx +++ b/source/funkin/play/components/PopUpStuff.hx @@ -125,13 +125,4 @@ class PopUpStuff extends FlxTypedGroup daLoop++; } } - - /** - * Reset the popup configuration to the default. - */ - public static function reset() - { - noteStyle = NoteStyleRegistry.instance.fetchDefault(); - isPixel = false; - } } diff --git a/source/funkin/ui/debug/anim/DebugBoundingState.hx b/source/funkin/ui/debug/anim/DebugBoundingState.hx index 19391f8d9..d2a27999f 100644 --- a/source/funkin/ui/debug/anim/DebugBoundingState.hx +++ b/source/funkin/ui/debug/anim/DebugBoundingState.hx @@ -77,7 +77,7 @@ class DebugBoundingState extends FlxState { // get the screen position, according to the HUD camera, temp default to FlxG.camera juuust in case? var hudMousePos:FlxPoint = FlxG.mouse.getScreenPosition(hudCam ?? FlxG.camera); - return Screen.instance.hasSolidComponentUnderPoint(hudMousePos.x, hudMousePos.y) || FlxG.mouse.overlaps(animDropDownMenu, hudCam); + return Screen.instance.hasSolidComponentUnderPoint(hudMousePos.x, hudMousePos.y); } override function create() From 9d5cde0bf1889be63b45016b4a292c69697befc8 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 18 Sep 2024 06:48:45 -0400 Subject: [PATCH 101/120] Update assets submodule --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index bc7009b42..68520d9eb 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit bc7009b4242691faa5c4552f7ca8a2f28e8cb1d2 +Subproject commit 68520d9eb9ff9a4e8aa52852eab1ef56db302b91 From a4b59d14bf34270bf04520320eabf3f11b5f2d29 Mon Sep 17 00:00:00 2001 From: Kolo <67389779+JustKolosaki@users.noreply.github.com> Date: Wed, 18 Sep 2024 13:40:02 +0200 Subject: [PATCH 102/120] applySongRank fix fixes the bug with the percent being overriden when the song has the same letter rank but lower percent (eg. E Rank with 99% being overriden by E Rank with 93%) --- source/funkin/save/Save.hx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/funkin/save/Save.hx b/source/funkin/save/Save.hx index 2bbda15c0..74af9994e 100644 --- a/source/funkin/save/Save.hx +++ b/source/funkin/save/Save.hx @@ -598,11 +598,15 @@ class Save return; } + //percent also accounts for different ranks + var oldPerc = (previousScoreData.tallies.sick + previousScoreData.tallies.good) / previousScoreData.tallies.totalNotes; + var newPerc = (newScoreData.tallies.sick + newScoreData.tallies.good) / newScoreData.tallies.totalNotes; + // Set the high score and the high rank separately. var newScore:SaveScoreData = { - score: (previousScoreData.score > newScoreData.score) ? previousScoreData.score : newScoreData.score, - tallies: (previousRank > newRank) ? previousScoreData.tallies : newScoreData.tallies + score: Std.int(Math.max(previousScoreData.score, newScoreData.score)), + tallies: (oldPerc > newPerc ? previousScoreData.tallies : newScoreData.tallies) }; song.set(difficultyId, newScore); From 50a5304ad48b210cba62e8bc756b417b3c69cc96 Mon Sep 17 00:00:00 2001 From: Kolo <67389779+JustKolosaki@users.noreply.github.com> Date: Wed, 18 Sep 2024 17:30:23 +0200 Subject: [PATCH 103/120] Update PlayerData.hx --- source/funkin/data/freeplay/player/PlayerData.hx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/funkin/data/freeplay/player/PlayerData.hx b/source/funkin/data/freeplay/player/PlayerData.hx index de293c24e..a5bf086f6 100644 --- a/source/funkin/data/freeplay/player/PlayerData.hx +++ b/source/funkin/data/freeplay/player/PlayerData.hx @@ -264,6 +264,12 @@ class PlayerCharSelectData */ @:optional public var position:Null; + + /** + * The GF name to assign for this character. + */ + @:optional + public var assignedGF:Null; } typedef PlayerResultsData = From 3bb981adb03371e1be5034d7997dc5135a7d8f04 Mon Sep 17 00:00:00 2001 From: Kolo <67389779+JustKolosaki@users.noreply.github.com> Date: Wed, 18 Sep 2024 17:32:37 +0200 Subject: [PATCH 104/120] Update CharSelectGF.hx --- source/funkin/ui/charSelect/CharSelectGF.hx | 37 ++++++++++++--------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/source/funkin/ui/charSelect/CharSelectGF.hx b/source/funkin/ui/charSelect/CharSelectGF.hx index e8eeded40..79cfb585c 100644 --- a/source/funkin/ui/charSelect/CharSelectGF.hx +++ b/source/funkin/ui/charSelect/CharSelectGF.hx @@ -11,6 +11,7 @@ import funkin.modding.IScriptedClass.IBPMSyncedScriptedClass; import flixel.math.FlxMath; import funkin.modding.events.ScriptEvent; import funkin.vis.dsp.SpectralAnalyzer; +import funkin.data.freeplay.player.PlayerRegistry; class CharSelectGF extends FlxAtlasSprite implements IBPMSyncedScriptedClass { @@ -27,7 +28,7 @@ class CharSelectGF extends FlxAtlasSprite implements IBPMSyncedScriptedClass var analyzer:SpectralAnalyzer; - var curGF:GFChar = GF; + var curGF:String = "gf"; public function new() { @@ -97,7 +98,7 @@ class CharSelectGF extends FlxAtlasSprite implements IBPMSyncedScriptedClass function drawFFT() { - if (curGF == NENE) + if (curGF == "nene") { var levels = analyzer.getLevels(); var frame = anim.curSymbol.timeline.get("VIZ_bars").get(anim.curFrame); @@ -172,16 +173,21 @@ class CharSelectGF extends FlxAtlasSprite implements IBPMSyncedScriptedClass */ public function switchGF(bf:String):Void { - var prevGF:GFChar = curGF; - switch (bf) - { - case "pico": - curGF = NENE; - case "bf": - curGF = GF; - default: - curGF = GF; - } + var prevGF = curGF; + + var bfObj = PlayerRegistry.instance.fetchEntry(bf); + curGF = bfObj?.getCharSelectData()?.assignedGF ?? "gf"; + + /*var prevGF:GFChar = curGF; + switch (bf) + { + case "pico": + curGF = NENE; + case "bf": + curGF = GF; + default: + curGF = GF; + }*/ // We don't need to update any anims if we didn't change GF if (prevGF != curGF) @@ -213,9 +219,8 @@ enum FadeStatus FADE_OUT; FADE_IN; } - -enum abstract GFChar(String) from String to String -{ +/*enum abstract GFChar(String) from String to String + { var GF = "gf"; var NENE = "nene"; -} +}*/ From 99657da1f984ff5842d714b2cde398cca6785e06 Mon Sep 17 00:00:00 2001 From: Kolo <67389779+JustKolosaki@users.noreply.github.com> Date: Wed, 18 Sep 2024 17:46:13 +0200 Subject: [PATCH 105/120] accidentally also put the save changes oops --- source/funkin/save/Save.hx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/source/funkin/save/Save.hx b/source/funkin/save/Save.hx index 74af9994e..2bbda15c0 100644 --- a/source/funkin/save/Save.hx +++ b/source/funkin/save/Save.hx @@ -598,15 +598,11 @@ class Save return; } - //percent also accounts for different ranks - var oldPerc = (previousScoreData.tallies.sick + previousScoreData.tallies.good) / previousScoreData.tallies.totalNotes; - var newPerc = (newScoreData.tallies.sick + newScoreData.tallies.good) / newScoreData.tallies.totalNotes; - // Set the high score and the high rank separately. var newScore:SaveScoreData = { - score: Std.int(Math.max(previousScoreData.score, newScoreData.score)), - tallies: (oldPerc > newPerc ? previousScoreData.tallies : newScoreData.tallies) + score: (previousScoreData.score > newScoreData.score) ? previousScoreData.score : newScoreData.score, + tallies: (previousRank > newRank) ? previousScoreData.tallies : newScoreData.tallies }; song.set(difficultyId, newScore); From ab3b976f3c979d04e713b47de607335a58917db7 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 18 Sep 2024 15:07:15 -0400 Subject: [PATCH 106/120] fix rounding for sound results sfx --- source/funkin/play/ResultState.hx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/funkin/play/ResultState.hx b/source/funkin/play/ResultState.hx index 739df167d..33f3587ea 100644 --- a/source/funkin/play/ResultState.hx +++ b/source/funkin/play/ResultState.hx @@ -472,9 +472,12 @@ class ResultState extends MusicBeatSubState { ease: FlxEase.quartOut, onUpdate: _ -> { + clearPercentLerp = Math.round(clearPercentLerp); + clearPercentCounter.curNumber = Math.round(clearPercentCounter.curNumber); // Only play the tick sound if the number increased. if (clearPercentLerp != clearPercentCounter.curNumber) { + trace('$clearPercentLerp and ${clearPercentCounter.curNumber}'); clearPercentLerp = clearPercentCounter.curNumber; FunkinSound.playOnce(Paths.sound('scrollMenu')); } From 62149aea39687fc84f79e7a7ce4edf636cef416e Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 18 Sep 2024 15:16:56 -0400 Subject: [PATCH 107/120] assets submod --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 616551146..da96dc519 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 61655114603807b651109af282c2e2aefa9dccf2 +Subproject commit da96dc519a00bb8eb24a164bae64a4c6c064e87d From fc6e194d20968d010c5d4c22511cd8fd400d9058 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 18 Sep 2024 15:20:15 -0400 Subject: [PATCH 108/120] assets submod --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index ef7386d74..252d48f4c 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit ef7386d741e715bd809c913a7d50dfa7b8176e2d +Subproject commit 252d48f4c996d5832cb981fb2f3ed945c020f289 From 472d41a893a3610ff6935844ecb50d44949e1851 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 18 Sep 2024 16:15:10 -0400 Subject: [PATCH 109/120] close sys.io.Process stuff when we're done with them --- project.hxp | 6 ++++++ source/funkin/util/macro/GitCommit.hx | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/project.hxp b/project.hxp index 1193a9cd4..ac047ff91 100644 --- a/project.hxp +++ b/project.hxp @@ -941,6 +941,8 @@ class Project extends HXProject { var commitHash:String = process.stdout.readLine(); var commitHashSplice:String = commitHash.substr(0, 7); + process.close(); + return commitHashSplice; } @@ -955,6 +957,8 @@ class Project extends HXProject { var branchName:String = branchProcess.stdout.readLine(); + branchProcess.close(); + return branchName; } @@ -979,6 +983,8 @@ class Project extends HXProject { } } + branchProcess.close(); + return output.length > 0; } diff --git a/source/funkin/util/macro/GitCommit.hx b/source/funkin/util/macro/GitCommit.hx index 161856caa..9e3305c41 100644 --- a/source/funkin/util/macro/GitCommit.hx +++ b/source/funkin/util/macro/GitCommit.hx @@ -23,6 +23,8 @@ class GitCommit var commitHash:String = process.stdout.readLine(); var commitHashSplice:String = commitHash.substr(0, 7); + process.close(); + trace('Git Commit ID: ${commitHashSplice}'); // Generates a string expression @@ -52,6 +54,7 @@ class GitCommit } var branchName:String = branchProcess.stdout.readLine(); + branchProcess.close(); trace('Git Branch Name: ${branchName}'); // Generates a string expression @@ -84,6 +87,7 @@ class GitCommit try { output = branchProcess.stdout.readLine(); + branchProcess.close(); } catch (e) { From 9f0bc2bd521f274f8ad9d214966538d95894277a Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Thu, 19 Sep 2024 04:16:40 -0400 Subject: [PATCH 110/120] Refactor char select GF data handling. --- assets | 2 +- .../funkin/data/freeplay/player/PlayerData.hx | 15 +++++- source/funkin/ui/charSelect/CharSelectGF.hx | 46 +++++++++---------- .../ui/charSelect/CharSelectSubState.hx | 1 - 4 files changed, 36 insertions(+), 28 deletions(-) diff --git a/assets b/assets index bc7009b42..4f7e8bb5c 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit bc7009b4242691faa5c4552f7ca8a2f28e8cb1d2 +Subproject commit 4f7e8bb5cd2e9eb8f68d88c060e9cbe5bccc9e2f diff --git a/source/funkin/data/freeplay/player/PlayerData.hx b/source/funkin/data/freeplay/player/PlayerData.hx index a5bf086f6..9110854c8 100644 --- a/source/funkin/data/freeplay/player/PlayerData.hx +++ b/source/funkin/data/freeplay/player/PlayerData.hx @@ -269,7 +269,20 @@ class PlayerCharSelectData * The GF name to assign for this character. */ @:optional - public var assignedGF:Null; + public var gf:PlayerCharSelectGFData; +} + +typedef PlayerCharSelectGFData = +{ + @:optional + public var assetPath:String; + + @:optional + public var animInfoPath:String; + + @:optional + @:default(false) + public var visualizer:Bool; } typedef PlayerResultsData = diff --git a/source/funkin/ui/charSelect/CharSelectGF.hx b/source/funkin/ui/charSelect/CharSelectGF.hx index 79cfb585c..89fc6deb0 100644 --- a/source/funkin/ui/charSelect/CharSelectGF.hx +++ b/source/funkin/ui/charSelect/CharSelectGF.hx @@ -28,7 +28,8 @@ class CharSelectGF extends FlxAtlasSprite implements IBPMSyncedScriptedClass var analyzer:SpectralAnalyzer; - var curGF:String = "gf"; + var currentGFPath:Null; + var enableVisualizer:Bool = false; public function new() { @@ -98,7 +99,7 @@ class CharSelectGF extends FlxAtlasSprite implements IBPMSyncedScriptedClass function drawFFT() { - if (curGF == "nene") + if (enableVisualizer) { var levels = analyzer.getLevels(); var frame = anim.curSymbol.timeline.get("VIZ_bars").get(anim.curFrame); @@ -173,33 +174,33 @@ class CharSelectGF extends FlxAtlasSprite implements IBPMSyncedScriptedClass */ public function switchGF(bf:String):Void { - var prevGF = curGF; + var previousGFPath = currentGFPath; var bfObj = PlayerRegistry.instance.fetchEntry(bf); - curGF = bfObj?.getCharSelectData()?.assignedGF ?? "gf"; - - /*var prevGF:GFChar = curGF; - switch (bf) - { - case "pico": - curGF = NENE; - case "bf": - curGF = GF; - default: - curGF = GF; - }*/ + var gfData = bfObj?.getCharSelectData()?.gf; + currentGFPath = gfData?.assetPath != null ? Paths.animateAtlas(gfData?.assetPath) : null; // We don't need to update any anims if we didn't change GF - if (prevGF != curGF) + trace('currentGFPath(${currentGFPath})'); + if (currentGFPath == null) { - loadAtlas(Paths.animateAtlas("charSelect/" + curGF + "Chill")); + this.visible = false; + return; + } + else if (previousGFPath != currentGFPath) + { + this.visible = true; + loadAtlas(currentGFPath); - animInInfo = FramesJSFLParser.parse(Paths.file("images/charSelect/" + curGF + "AnimInfo/" + curGF + "In.txt")); - animOutInfo = FramesJSFLParser.parse(Paths.file("images/charSelect/" + curGF + "AnimInfo/" + curGF + "Out.txt")); + enableVisualizer = gfData?.visualizer ?? false; + + var animInfoPath = Paths.file('images/${gfData?.animInfoPath}'); + + animInInfo = FramesJSFLParser.parse(animInfoPath + '/In.txt'); + animOutInfo = FramesJSFLParser.parse(animInfoPath + '/Out.txt'); } playAnimation("idle", true, false, false); - // addFrameCallback(getNextFrameLabel("idle"), () -> playAnimation("idle", true, false, false)); updateHitbox(); } @@ -219,8 +220,3 @@ enum FadeStatus FADE_OUT; FADE_IN; } -/*enum abstract GFChar(String) from String to String - { - var GF = "gf"; - var NENE = "nene"; -}*/ diff --git a/source/funkin/ui/charSelect/CharSelectSubState.hx b/source/funkin/ui/charSelect/CharSelectSubState.hx index 3109dc8f1..e7a87ade6 100644 --- a/source/funkin/ui/charSelect/CharSelectSubState.hx +++ b/source/funkin/ui/charSelect/CharSelectSubState.hx @@ -786,7 +786,6 @@ class CharSelectSubState extends MusicBeatSubState && availableChars.exists(getCurrentSelected()) && Save.instance.charactersSeen.contains(availableChars[getCurrentSelected()])) { - gfChill.visible = true; curChar = availableChars.get(getCurrentSelected()); if (!pressedSelect && controls.ACCEPT) From 25cafe7550304d20581da661948fc480ae82c39b Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Thu, 19 Sep 2024 04:22:05 -0400 Subject: [PATCH 111/120] Resolve merge issues. --- source/funkin/play/PlayState.hx | 1 - source/funkin/play/components/PopUpStuff.hx | 9 --------- source/funkin/ui/debug/anim/DebugBoundingState.hx | 2 +- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index a25d3b231..1c82eb6b1 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -3046,7 +3046,6 @@ class PlayState extends MusicBeatSubState GameOverSubState.reset(); PauseSubState.reset(); Countdown.reset(); - PopUpStuff.reset(); // Clear the static reference to this state. instance = null; diff --git a/source/funkin/play/components/PopUpStuff.hx b/source/funkin/play/components/PopUpStuff.hx index e5e9b4681..a02291e4e 100644 --- a/source/funkin/play/components/PopUpStuff.hx +++ b/source/funkin/play/components/PopUpStuff.hx @@ -125,13 +125,4 @@ class PopUpStuff extends FlxTypedGroup daLoop++; } } - - /** - * Reset the popup configuration to the default. - */ - public static function reset() - { - noteStyle = NoteStyleRegistry.instance.fetchDefault(); - isPixel = false; - } } diff --git a/source/funkin/ui/debug/anim/DebugBoundingState.hx b/source/funkin/ui/debug/anim/DebugBoundingState.hx index 19391f8d9..d2a27999f 100644 --- a/source/funkin/ui/debug/anim/DebugBoundingState.hx +++ b/source/funkin/ui/debug/anim/DebugBoundingState.hx @@ -77,7 +77,7 @@ class DebugBoundingState extends FlxState { // get the screen position, according to the HUD camera, temp default to FlxG.camera juuust in case? var hudMousePos:FlxPoint = FlxG.mouse.getScreenPosition(hudCam ?? FlxG.camera); - return Screen.instance.hasSolidComponentUnderPoint(hudMousePos.x, hudMousePos.y) || FlxG.mouse.overlaps(animDropDownMenu, hudCam); + return Screen.instance.hasSolidComponentUnderPoint(hudMousePos.x, hudMousePos.y); } override function create() From 3cbba8ba29dda790597e29e01c9e7d620953169d Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Thu, 19 Sep 2024 04:22:05 -0400 Subject: [PATCH 112/120] Resolve merge issues. --- source/funkin/play/PlayState.hx | 1 - source/funkin/play/components/PopUpStuff.hx | 9 --------- source/funkin/ui/debug/anim/DebugBoundingState.hx | 2 +- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index a25d3b231..1c82eb6b1 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -3046,7 +3046,6 @@ class PlayState extends MusicBeatSubState GameOverSubState.reset(); PauseSubState.reset(); Countdown.reset(); - PopUpStuff.reset(); // Clear the static reference to this state. instance = null; diff --git a/source/funkin/play/components/PopUpStuff.hx b/source/funkin/play/components/PopUpStuff.hx index e5e9b4681..a02291e4e 100644 --- a/source/funkin/play/components/PopUpStuff.hx +++ b/source/funkin/play/components/PopUpStuff.hx @@ -125,13 +125,4 @@ class PopUpStuff extends FlxTypedGroup daLoop++; } } - - /** - * Reset the popup configuration to the default. - */ - public static function reset() - { - noteStyle = NoteStyleRegistry.instance.fetchDefault(); - isPixel = false; - } } diff --git a/source/funkin/ui/debug/anim/DebugBoundingState.hx b/source/funkin/ui/debug/anim/DebugBoundingState.hx index 19391f8d9..d2a27999f 100644 --- a/source/funkin/ui/debug/anim/DebugBoundingState.hx +++ b/source/funkin/ui/debug/anim/DebugBoundingState.hx @@ -77,7 +77,7 @@ class DebugBoundingState extends FlxState { // get the screen position, according to the HUD camera, temp default to FlxG.camera juuust in case? var hudMousePos:FlxPoint = FlxG.mouse.getScreenPosition(hudCam ?? FlxG.camera); - return Screen.instance.hasSolidComponentUnderPoint(hudMousePos.x, hudMousePos.y) || FlxG.mouse.overlaps(animDropDownMenu, hudCam); + return Screen.instance.hasSolidComponentUnderPoint(hudMousePos.x, hudMousePos.y); } override function create() From 9045ae2d9c65b870bb8079f69e94209050c70127 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 20 Sep 2024 00:25:38 -0400 Subject: [PATCH 113/120] assets submod --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 252d48f4c..b029e0678 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 252d48f4c996d5832cb981fb2f3ed945c020f289 +Subproject commit b029e067835b80be35ee4de149ac3c6cf2bb4c4c From 143ef88e6ff5a680328099e9f253e644ea9b81ac Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 20 Sep 2024 03:42:48 -0400 Subject: [PATCH 114/120] Update assets submodule --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 252d48f4c..2c9025b00 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 252d48f4c996d5832cb981fb2f3ed945c020f289 +Subproject commit 2c9025b007b3823807404b73a11035c41e032e50 From 5f64d89d0e47f7c062f746ed8880b6287748a351 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 20 Sep 2024 16:51:21 -0400 Subject: [PATCH 115/120] assets submod --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 2c9025b00..41980de1c 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 2c9025b007b3823807404b73a11035c41e032e50 +Subproject commit 41980de1c2ec851ce99a33cb397ba0550b68ea2d From 78cde16af29f4f4ef5ef2cc3563592aeb1769528 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 20 Sep 2024 18:10:47 -0400 Subject: [PATCH 116/120] assets submod --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 4f7e8bb5c..2a0bc4f66 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 4f7e8bb5cd2e9eb8f68d88c060e9cbe5bccc9e2f +Subproject commit 2a0bc4f66d79a6f590e7ed2c04884d8c1fa8c45e From a41d3033d5e7f518b3db1cd5943105bb22260052 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 20 Sep 2024 18:20:40 -0400 Subject: [PATCH 117/120] small Assets -> OpenFLAssets fix --- source/funkin/ui/transition/LoadingState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/ui/transition/LoadingState.hx b/source/funkin/ui/transition/LoadingState.hx index 3b4661425..f3620c893 100644 --- a/source/funkin/ui/transition/LoadingState.hx +++ b/source/funkin/ui/transition/LoadingState.hx @@ -276,7 +276,7 @@ class LoadingState extends MusicBeatSubState #if NO_PRELOAD_ALL static function isSoundLoaded(path:String):Bool { - return Assets.cache.hasSound(path); + return OpenFLAssets.cache.hasSound(path); } static function isLibraryLoaded(library:String):Bool From 690f3090b728a84a91e2878412eaf9049c1d8116 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 20 Sep 2024 20:11:12 -0400 Subject: [PATCH 118/120] proper audio scaling for hxcodec / desktop --- .../graphics/video/FunkinVideoSprite.hx | 32 +++++++++++++++++++ source/funkin/play/cutscene/VideoCutscene.hx | 6 ++-- source/funkin/ui/charSelect/IntroSubState.hx | 6 ++-- source/funkin/ui/title/AttractState.hx | 6 ++-- 4 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 source/funkin/graphics/video/FunkinVideoSprite.hx diff --git a/source/funkin/graphics/video/FunkinVideoSprite.hx b/source/funkin/graphics/video/FunkinVideoSprite.hx new file mode 100644 index 000000000..e0086784b --- /dev/null +++ b/source/funkin/graphics/video/FunkinVideoSprite.hx @@ -0,0 +1,32 @@ +package funkin.graphics.video; + +import hxcodec.flixel.FlxVideoSprite; + +/** + * Not to be confused with FlxVideo, this is a hxcodec based video class + * We override it simply to correct/control our volume easier. + */ +class FunkinVideoSprite extends FlxVideoSprite +{ + public var volume(default, set):Float = 1; + + public function new(x:Float = 0, y:Float = 0) + { + super(x, y); + + set_volume(1); + } + + override public function update(elapsed:Float):Void + { + super.update(elapsed); + set_volume(volume); + } + + function set_volume(value:Float):Float + { + volume = value; + bitmap.volume = Std.int((FlxG.sound.muted ? 0 : 1) * (FlxG.sound.logToLinear(FlxG.sound.volume) * 100) * volume); + return volume; + } +} diff --git a/source/funkin/play/cutscene/VideoCutscene.hx b/source/funkin/play/cutscene/VideoCutscene.hx index 60454b881..b6e04004b 100644 --- a/source/funkin/play/cutscene/VideoCutscene.hx +++ b/source/funkin/play/cutscene/VideoCutscene.hx @@ -11,7 +11,7 @@ import flixel.util.FlxTimer; import funkin.graphics.video.FlxVideo; #end #if hxCodec -import hxcodec.flixel.FlxVideoSprite; +import funkin.graphics.video.FunkinVideoSprite; #end /** @@ -26,7 +26,7 @@ class VideoCutscene static var vid:FlxVideo; #end #if hxCodec - static var vid:FlxVideoSprite; + static var vid:FunkinVideoSprite; #end /** @@ -138,7 +138,7 @@ class VideoCutscene static function playVideoNative(filePath:String):Void { // Video displays OVER the FlxState. - vid = new FlxVideoSprite(0, 0); + vid = new FunkinVideoSprite(0, 0); if (vid != null) { diff --git a/source/funkin/ui/charSelect/IntroSubState.hx b/source/funkin/ui/charSelect/IntroSubState.hx index 2c2908473..e731e5e9a 100644 --- a/source/funkin/ui/charSelect/IntroSubState.hx +++ b/source/funkin/ui/charSelect/IntroSubState.hx @@ -4,7 +4,7 @@ package funkin.ui.charSelect; import funkin.graphics.video.FlxVideo; #end #if hxCodec -import hxcodec.flixel.FlxVideoSprite; +import funkin.graphics.video.FunkinVideoSprite; #end import funkin.ui.MusicBeatSubState; import funkin.audio.FunkinSound; @@ -72,12 +72,12 @@ class IntroSubState extends MusicBeatSubState #end #if hxCodec - var vid:FlxVideoSprite; + var vid:FunkinVideoSprite; function playVideoNative(filePath:String):Void { // Video displays OVER the FlxState. - vid = new FlxVideoSprite(0, 0); + vid = new FunkinVideoSprite(0, 0); vid.scrollFactor.set(); diff --git a/source/funkin/ui/title/AttractState.hx b/source/funkin/ui/title/AttractState.hx index c5a3d0504..f5f266b0d 100644 --- a/source/funkin/ui/title/AttractState.hx +++ b/source/funkin/ui/title/AttractState.hx @@ -4,7 +4,7 @@ package funkin.ui.title; import funkin.graphics.video.FlxVideo; #end #if hxCodec -import hxcodec.flixel.FlxVideoSprite; +import funkin.graphics.video.FunkinVideoSprite; #end import funkin.ui.MusicBeatState; @@ -62,12 +62,12 @@ class AttractState extends MusicBeatState #end #if hxCodec - var vid:FlxVideoSprite; + var vid:FunkinVideoSprite; function playVideoNative(filePath:String):Void { // Video displays OVER the FlxState. - vid = new FlxVideoSprite(0, 0); + vid = new FunkinVideoSprite(0, 0); if (vid != null) { From 29a7005d8a5ca63f69531792b86d9ec457efae09 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sun, 22 Sep 2024 00:44:57 -0400 Subject: [PATCH 119/120] Fix a bug where you can hear the game a little when setting the volume to 0 ticks --- source/funkin/ui/options/FunkinSoundTray.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/ui/options/FunkinSoundTray.hx b/source/funkin/ui/options/FunkinSoundTray.hx index 8ae53524a..eea30ae17 100644 --- a/source/funkin/ui/options/FunkinSoundTray.hx +++ b/source/funkin/ui/options/FunkinSoundTray.hx @@ -121,7 +121,7 @@ class FunkinSoundTray extends FlxSoundTray active = true; var globalVolume:Int = Math.round(FlxG.sound.logToLinear(FlxG.sound.volume) * 10); - if (FlxG.sound.muted) + if (FlxG.sound.muted || FlxG.sound.volume == 0) { globalVolume = 0; } From c7238fcfd114352924a6cca436e069523a86cced Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sun, 22 Sep 2024 00:45:30 -0400 Subject: [PATCH 120/120] Stop the volume tray from hiding as long as the game is muted --- source/funkin/ui/options/FunkinSoundTray.hx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/funkin/ui/options/FunkinSoundTray.hx b/source/funkin/ui/options/FunkinSoundTray.hx index eea30ae17..b2fb7fc04 100644 --- a/source/funkin/ui/options/FunkinSoundTray.hx +++ b/source/funkin/ui/options/FunkinSoundTray.hx @@ -79,10 +79,12 @@ class FunkinSoundTray extends FlxSoundTray y = MathUtil.coolLerp(y, lerpYPos, 0.1); alpha = MathUtil.coolLerp(alpha, alphaTarget, 0.25); + var shouldHide = (FlxG.sound.muted == false && FlxG.sound.volume > 0); + // Animate sound tray thing if (_timer > 0) { - _timer -= (MS / 1000); + if (shouldHide) _timer -= (MS / 1000); alphaTarget = 1; } else if (y >= -height)