From 17cc888e61cb6dc55de0b285f533002c1ac05f4a Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Fri, 27 Dec 2024 23:51:42 +0100 Subject: [PATCH 1/5] Add blend mode support for flxanimate --- art/generateDoc.bat | 2 +- source/funkin/backend/FlxAnimate.hx | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/art/generateDoc.bat b/art/generateDoc.bat index 0e430256..595314b1 100644 --- a/art/generateDoc.bat +++ b/art/generateDoc.bat @@ -1,7 +1,7 @@ @ECHO OFF cd .. echo Building Game... -lime build windows --haxeflag="--macro include('scripting')" --haxeflag="-xml docs/doc.xml" -D DOCUMENTATION --no-output +lime build windows --haxeflag="-xml docs/doc.xml" -D doc-gen -D DOCUMENTATION --no-output echo art echo Generated the api xml file at docs/doc.xml diff --git a/source/funkin/backend/FlxAnimate.hx b/source/funkin/backend/FlxAnimate.hx index 5f92e9a4..6624713f 100644 --- a/source/funkin/backend/FlxAnimate.hx +++ b/source/funkin/backend/FlxAnimate.hx @@ -7,14 +7,19 @@ import flixel.math.FlxAngle; import flixel.math.FlxRect; import flixel.graphics.frames.FlxFrame; import flixel.math.FlxPoint; +import openfl.display.BlendMode; class FlxAnimate extends flxanimate.FlxAnimate { static var rMatrix = new FlxMatrix(); - override function drawLimb(limb:FlxFrame, _rMatrix:FlxMatrix, ?colorTransform:ColorTransform) + override function drawLimb(limb:FlxFrame, _rMatrix:FlxMatrix, ?colorTransform:ColorTransform, ?blendMode:BlendMode) { if (alpha == 0 || colorTransform != null && (colorTransform.alphaMultiplier == 0 || colorTransform.alphaOffset == -255) || limb == null || limb.type == EMPTY) return; + + if (blendMode != null) + blendMode = BlendMode.NORMAL; + for (camera in cameras) { rMatrix.identity(); @@ -69,7 +74,7 @@ class FlxAnimate extends flxanimate.FlxAnimate { } rMatrix.translate(_point.x, _point.y); - camera.drawPixels(limb, null, rMatrix, colorTransform, blend, antialiasing, shaderEnabled ? shader : null); + camera.drawPixels(limb, null, rMatrix, colorTransform, blendMode, antialiasing, shaderEnabled ? shader : null); #if FLX_DEBUG FlxBasic.visibleCount++; #end From 76c07cef30bda2e3718f2220cd3931e3fdc7ca75 Mon Sep 17 00:00:00 2001 From: DixNutzzz Date: Sun, 29 Dec 2024 18:15:11 +1100 Subject: [PATCH 2/5] Update FlxAnimate.hx (#512) --- source/funkin/backend/FlxAnimate.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/funkin/backend/FlxAnimate.hx b/source/funkin/backend/FlxAnimate.hx index 6624713f..cd06b514 100644 --- a/source/funkin/backend/FlxAnimate.hx +++ b/source/funkin/backend/FlxAnimate.hx @@ -17,7 +17,7 @@ class FlxAnimate extends flxanimate.FlxAnimate { if (alpha == 0 || colorTransform != null && (colorTransform.alphaMultiplier == 0 || colorTransform.alphaOffset == -255) || limb == null || limb.type == EMPTY) return; - if (blendMode != null) + if (blendMode == null) blendMode = BlendMode.NORMAL; for (camera in cameras) @@ -92,4 +92,4 @@ class FlxAnimate extends flxanimate.FlxAnimate { // TODO: ACTUAL OPTIMISATION return true; } -} \ No newline at end of file +} From 74884854ea2caceeef17edbffcb07cd8898d466e Mon Sep 17 00:00:00 2001 From: TheoDev <132299142+TheoDevelops@users.noreply.github.com> Date: Wed, 1 Jan 2025 19:09:14 -0700 Subject: [PATCH 3/5] Fixes a crash when no mod folders are founded (#515) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixes a crash when no mod folders are founded Hi * lemme --------- Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com> --- source/funkin/backend/assets/ModsFolder.hx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/funkin/backend/assets/ModsFolder.hx b/source/funkin/backend/assets/ModsFolder.hx index cd1704ed..9d575a1e 100644 --- a/source/funkin/backend/assets/ModsFolder.hx +++ b/source/funkin/backend/assets/ModsFolder.hx @@ -93,7 +93,12 @@ class ModsFolder { public static function getModsList():Array { var mods:Array = []; #if MOD_SUPPORT - for(modFolder in FileSystem.readDirectory(modsPath)) { + final modsList:Array = FileSystem.readDirectory(modsPath); + + if (modsList == null || modsList.length <= 0) + return mods; + + for (modFolder in modsList) { if (FileSystem.isDirectory('${modsPath}${modFolder}')) { mods.push(modFolder); } else { @@ -159,4 +164,4 @@ class ModsFolder { return prepareModLibrary(libName, new ZipFolderLibrary(zipPath, libName, modName), force); } #end -} \ No newline at end of file +} From f90782d7123970215324ace99c55584ad78ca028 Mon Sep 17 00:00:00 2001 From: Til <89487150+TechnikTil@users.noreply.github.com> Date: Thu, 2 Jan 2025 07:07:20 -0700 Subject: [PATCH 4/5] make freeplay change bpm so stuff isnt out of sync (#514) --- source/funkin/menus/FreeplayState.hx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/funkin/menus/FreeplayState.hx b/source/funkin/menus/FreeplayState.hx index 96aab829..ec9cbeb9 100644 --- a/source/funkin/menus/FreeplayState.hx +++ b/source/funkin/menus/FreeplayState.hx @@ -2,6 +2,7 @@ package funkin.menus; import funkin.backend.chart.Chart; import funkin.backend.chart.ChartData.ChartMetaData; +import funkin.backend.system.Conductor; import haxe.io.Path; import openfl.text.TextField; import flixel.text.FlxText; @@ -239,7 +240,11 @@ class FreeplayState extends MusicBeatState autoplayElapsed += elapsed; if (!disableAutoPlay && !songInstPlaying && (autoplayElapsed > timeUntilAutoplay || FlxG.keys.justPressed.SPACE)) { if (curPlayingInst != (curPlayingInst = Paths.inst(songs[curSelected].name, songs[curSelected].difficulties[curDifficulty]))) { - var huh:Void->Void = function() FlxG.sound.playMusic(curPlayingInst, 0); + var huh:Void->Void = function() + { + FlxG.sound.playMusic(curPlayingInst, 0); + Conductor.changeBPM(songs[curSelected].bpm, songs[curSelected].beatsPerMeasure, songs[curSelected].stepsPerBeat); + } if(!disableAsyncLoading) Main.execAsync(huh); else huh(); } From 300f38d290bb8c31a5c1e67afdf981c644b27f8a Mon Sep 17 00:00:00 2001 From: Til <89487150+TechnikTil@users.noreply.github.com> Date: Thu, 2 Jan 2025 07:56:33 -0700 Subject: [PATCH 5/5] [ENHANCEMENT] Prevent accidental selecting when tabbing back in (#513) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * prevent accidental selecting * made something better --------- Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com> --- source/funkin/backend/system/Main.hx | 14 ++++++++++++++ source/funkin/options/OptionsScreen.hx | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/source/funkin/backend/system/Main.hx b/source/funkin/backend/system/Main.hx index 78369f60..5795c4a1 100644 --- a/source/funkin/backend/system/Main.hx +++ b/source/funkin/backend/system/Main.hx @@ -49,6 +49,10 @@ class Main extends Sprite public static var game:FunkinGame; + /** + * The time since the game was focused last time in seconds. + */ + public static var timeSinceFocus(get, never):Float; public static var time:Int = 0; // You can pretty much ignore everything from here on - your code should go in your states. @@ -152,6 +156,7 @@ class Main extends Sprite Conductor.init(); AudioSwitchFix.init(); EventManager.init(); + FlxG.signals.focusGained.add(onFocus); FlxG.signals.preStateSwitch.add(onStateSwitch); FlxG.signals.postStateSwitch.add(onStateSwitchPost); @@ -190,6 +195,10 @@ class Main extends Sprite {asset: diamond, width: 32, height: 32}, new FlxRect(-200, -200, FlxG.width * 1.4, FlxG.height * 1.4)); } + public static function onFocus() { + _tickFocused = FlxG.game.ticks; + } + private static function onStateSwitch() { scaleMode.resetSize(); } @@ -209,4 +218,9 @@ class Main extends Sprite MemoryUtil.clearMajor(); } + + private static var _tickFocused:Float = 0; + public static function get_timeSinceFocus():Float { + return (FlxG.game.ticks - _tickFocused) / 1000; + } } diff --git a/source/funkin/options/OptionsScreen.hx b/source/funkin/options/OptionsScreen.hx index 45580821..b703d994 100644 --- a/source/funkin/options/OptionsScreen.hx +++ b/source/funkin/options/OptionsScreen.hx @@ -45,7 +45,7 @@ class OptionsScreen extends FlxTypedSpriteGroup { if (members.length > 0) { members[curSelected].selected = true; - if (controls.ACCEPT || FlxG.mouse.justReleased) + if (controls.ACCEPT || (FlxG.mouse.justReleased && Main.timeSinceFocus > 0.25)) members[curSelected].onSelect(); if (controls.LEFT_P) members[curSelected].onChangeSelection(-1);