From d20e9e3c376b90baf4b715024f9cb4fef09d1c29 Mon Sep 17 00:00:00 2001 From: Equinoxtic Date: Sat, 23 Aug 2025 16:48:18 +0800 Subject: [PATCH 01/10] Improve the getting of update executables --- .../backend/system/updating/AsyncUpdater.hx | 15 ++------------- .../funkin/backend/system/updating/UpdateUtil.hx | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/source/funkin/backend/system/updating/AsyncUpdater.hx b/source/funkin/backend/system/updating/AsyncUpdater.hx index 36b79ad40..3e1ad894a 100644 --- a/source/funkin/backend/system/updating/AsyncUpdater.hx +++ b/source/funkin/backend/system/updating/AsyncUpdater.hx @@ -25,19 +25,8 @@ class AsyncUpdater { } #end - - #if windows - public static var executableGitHubName:String = "update-windows.exe"; - public static var executableName:String = "CodenameEngine.exe"; - #end - #if linux - public static var executableGitHubName:String = "update-linux"; - public static var executableName:String = "CodenameEngine"; - #end - #if mac - public static var executableGitHubName:String = "update-mac"; - public static var executableName:String = "CodenameEngine"; - #end + public static var executableName:String = UpdateUtil.getExecName(); + public static var executableGitHubName:String = UpdateUtil.getGitExecName(); public var releases:Array; public var progress:UpdaterProgress = new UpdaterProgress(); diff --git a/source/funkin/backend/system/updating/UpdateUtil.hx b/source/funkin/backend/system/updating/UpdateUtil.hx index c3f496540..59998a58b 100644 --- a/source/funkin/backend/system/updating/UpdateUtil.hx +++ b/source/funkin/backend/system/updating/UpdateUtil.hx @@ -30,6 +30,21 @@ class UpdateUtil { __mutex = new Mutex(); Thread.create(checkForUpdates.bind(true, false)); } + + public static function getExecName():String + { + // Since previously, both linux and mac don't have the .exe extension. We might as well just compress this to a '#else' clause. + return #if windows "CodenameEngine.exe" #else "CodenameEngine" #end; // weird syntax??? :skull: haxe is just full of surprises + } + + public static function getGitExecName():String + { + // Only add the suffix of the platform we need to get. + var target:String = #if windows "windows.exe" #end + #if mac "mac" #end + #if linux "linux" #end; + return 'update-${target}'; + } public static function waitForUpdates(force = false, callback:UpdateCheckCallback->Void, lazy = false) { if (__mutex.tryAcquire()) { From cd7843778e92498a87d9802995a7de284b6a2306 Mon Sep 17 00:00:00 2001 From: Equinoxtic Date: Sat, 23 Aug 2025 16:55:38 +0800 Subject: [PATCH 02/10] whitespace :v --- source/funkin/backend/system/updating/UpdateUtil.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/funkin/backend/system/updating/UpdateUtil.hx b/source/funkin/backend/system/updating/UpdateUtil.hx index 59998a58b..27396ea79 100644 --- a/source/funkin/backend/system/updating/UpdateUtil.hx +++ b/source/funkin/backend/system/updating/UpdateUtil.hx @@ -41,8 +41,8 @@ class UpdateUtil { { // Only add the suffix of the platform we need to get. var target:String = #if windows "windows.exe" #end - #if mac "mac" #end - #if linux "linux" #end; + #if mac "mac" #end + #if linux "linux" #end; return 'update-${target}'; } From 24537d1718c5bbf2916412c5415efe37b80dc5d9 Mon Sep 17 00:00:00 2001 From: Equinoxtic Date: Sat, 23 Aug 2025 17:34:01 +0800 Subject: [PATCH 03/10] usin' an array for this one --- .../backend/system/CommandLineHandler.hx | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/source/funkin/backend/system/CommandLineHandler.hx b/source/funkin/backend/system/CommandLineHandler.hx index e6d74007f..b783f8462 100644 --- a/source/funkin/backend/system/CommandLineHandler.hx +++ b/source/funkin/backend/system/CommandLineHandler.hx @@ -3,6 +3,28 @@ package funkin.backend.system; #if sys import sys.FileSystem; final class CommandLineHandler { + @:noPrivateAccess + private static function __showHelpText():Void { + // Just put it all in a string array =) + + final STRINGS:Array = [ + "--- Codename Engine Command Line Help ---", + "", + "-help | Show this help", + #if MOD_SUPPORT + "-mod [mod name] | Load a specific mod", "-modfolder [path] | Sets the mod folder path", + "-addonsfolder [path] | Sets the addons folder path", + #end + "-nocolor | Disables colors in the terminal", + "-nogpubitmap | Forces GPU only bitmaps off", + "-nocwdfix | Turns off automatic working directory fix" + ]; + + for (s in STRINGS) { + Sys.println(s); + } + } + public static function parseCommandLine(cmd:Array) { var i:Int = 0; while(i < cmd.length) { @@ -10,16 +32,7 @@ final class CommandLineHandler { case null: break; case "-h" | "-help" | "help": - Sys.println("-- Codename Engine Command Line help --"); - Sys.println("-help | Show this help"); - #if MOD_SUPPORT - Sys.println("-mod [mod name] | Load a specific mod"); - Sys.println("-modfolder [path] | Sets the mod folder path"); - Sys.println("-addonsfolder [path] | Sets the addons folder path"); - #end - Sys.println("-nocolor | Disables colors in the terminal"); - Sys.println("-nogpubitmap | Forces GPU only bitmaps off"); - Sys.println("-nocwdfix | Turns off automatic working directory fix"); + __showHelpText(); Sys.exit(0); #if MOD_SUPPORT case "-m" | "-mod" | "-currentmod": From ae4ad982870abea1923d0c5be6175c2d05b23192 Mon Sep 17 00:00:00 2001 From: Equinoxtic Date: Sat, 23 Aug 2025 19:49:51 +0800 Subject: [PATCH 04/10] Improve countdown code and create Countdown class --- source/funkin/game/Countdown.hx | 122 ++++++++++++++++++++++++++++++++ source/funkin/game/PlayState.hx | 57 +++++---------- 2 files changed, 138 insertions(+), 41 deletions(-) create mode 100644 source/funkin/game/Countdown.hx diff --git a/source/funkin/game/Countdown.hx b/source/funkin/game/Countdown.hx new file mode 100644 index 000000000..acd814cce --- /dev/null +++ b/source/funkin/game/Countdown.hx @@ -0,0 +1,122 @@ +package funkin.game; + +import flixel.tweens.FlxTween; +import flixel.sound.FlxSound; +import funkin.backend.scripting.events.gameplay.CountdownEvent; + +enum CountdownAnimationPreset { + + // TODO: Documentation + + DEFAULT; + CLASSIC; + PULSING; + +} + +typedef CountdownParams = { + + // TODO: Documentation + + var event:CountdownEvent; + + var enabled:Bool; + + var playSound:Bool; + + var animationPreset:CountdownAnimationPreset; + + var speed:Float; + +} + +class Countdown extends FlxTypedSpriteGroup { + + public var event:CountdownEvent; + public var enabled:Bool; + public var playSound:Bool; + public var animationPreset:CountdownAnimationPreset; + public var speed:Float; + + public function new(params:CountdownParams) { + + super(); + + this.event = params.event; + this.enabled = params.enabled; + this.playSound = params.playSound; + this.animationPreset = params.animationPreset; + this.speed = params.speed; + + this.__createSprite(); + + } + + @:noPrivateAccess + private function __createSprite():Void { + if (!this.enabled) + return; + + var sprite:FlxSprite = null; + var sound:FlxSound = null; + var tween:FlxTween = null; + + if (!this.event.cancelled) { + if (this.event.spritePath != null) { + var spr = this.event.spritePath; + + if (!Assets.exists(spr)) + spr = Paths.image('$spr'); + + sprite = new FunkinSprite().loadAnimatedGraphic(spr); + sprite.scale.set(this.event.scale, this.event.scale); + sprite.scrollFactor.set(); + sprite.antialiasing = this.event.antialiasing; + sprite.updateHitbox(); + sprite.screenCenter(); + + add(sprite); + + switch(this.animationPreset) { + case CLASSIC: + tween = FlxTween.tween(sprite, {alpha: 0}, this.speed, { + ease: FlxEase.cubeInOut, + onComplete: function(twn:FlxTween) { + sprite.destroy(); + remove(sprite, true); + } + }); + case PULSING: + tween = FlxTween.tween(sprite, {alpha: 0}, this.speed, { + ease: FlxEase.cubeInOut, + onComplete: function(twn:FlxTween) { + sprite.destroy(); + remove(sprite, true); + } + }); + default: // DEFAULT + tween = FlxTween.tween(sprite, {y: sprite.y + 100, alpha: 0}, this.speed, { + ease: FlxEase.cubeInOut, + onComplete: function(twn:FlxTween) { + sprite.destroy(); + remove(sprite, true); + } + }); + } + } + + if (this.event.soundPath != null && playSound) { + var sfx = this.event.soundPath; + if (!Assets.exists(sfx)) sfx = Paths.sound(sfx); + sound = FlxG.sound.play(sfx, this.event.volume); + } + + this.event.sprite = sprite; + this.event.sound = sound; + this.event.spriteTween = tween; + this.event.cancelled = false; + } + + } + +} diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 04be79819..089d314f4 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -996,50 +996,25 @@ class PlayState extends MusicBeatState * Creates a fake countdown. */ public function countdown(swagCounter:Int) { - var event:CountdownEvent = gameAndCharsEvent("onCountdown", EventManager.get(CountdownEvent).recycle( - swagCounter, - 1, - introSounds[swagCounter], - introSprites[swagCounter], - 0.6, true, null, null, null)); - var sprite:FlxSprite = null; - var sound:FlxSound = null; - var tween:FlxTween = null; + var countdown:Countdown = new Countdown({ + event: gameAndCharsEvent("onCountdown", EventManager.get(CountdownEvent).recycle( + swagCounter, + 1, + introSounds[swagCounter], + introSprites[swagCounter], + 0.6, true, null, null, null)), + enabled: true, + playSound: true, + animationPreset: DEFAULT, + speed: (Conductor.crochet / 1000) + }); - if (!event.cancelled) { - if (event.spritePath != null) { - var spr = event.spritePath; - if (!Assets.exists(spr)) spr = Paths.image('$spr'); - - sprite = new FunkinSprite().loadAnimatedGraphic(spr); - sprite.scrollFactor.set(); - sprite.scale.set(event.scale, event.scale); - sprite.updateHitbox(); - sprite.screenCenter(); - sprite.antialiasing = event.antialiasing; - add(sprite); - tween = FlxTween.tween(sprite, {y: sprite.y + 100, alpha: 0}, Conductor.crochet / 1000, { - ease: FlxEase.cubeInOut, - onComplete: function(twn:FlxTween) - { - sprite.destroy(); - remove(sprite, true); - } - }); - } - if (event.soundPath != null) { - var sfx = event.soundPath; - if (!Assets.exists(sfx)) sfx = Paths.sound(sfx); - sound = FlxG.sound.play(sfx, event.volume); - } - } - event.sprite = sprite; - event.sound = sound; - event.spriteTween = tween; - event.cancelled = false; + countdown.cameras = [camHUD]; + + add(countdown); - gameAndCharsEvent("onPostCountdown", event); + gameAndCharsEvent("onPostCountdown", countdown.event); } @:dox(hide) function startSong():Void From 18a88a55e222c0743279a91e34e5b247ec15f82e Mon Sep 17 00:00:00 2001 From: Equinoxtic Date: Sat, 23 Aug 2025 20:22:32 +0800 Subject: [PATCH 05/10] Update Countdown.hx - Adjustable Speed - Name change preset: 'PULSING' -> 'BEATING' - lil' bit of code refactoring --- source/funkin/game/Countdown.hx | 66 +++++++++++++++++---------------- source/funkin/game/PlayState.hx | 3 +- 2 files changed, 36 insertions(+), 33 deletions(-) diff --git a/source/funkin/game/Countdown.hx b/source/funkin/game/Countdown.hx index acd814cce..b2513beb6 100644 --- a/source/funkin/game/Countdown.hx +++ b/source/funkin/game/Countdown.hx @@ -1,5 +1,6 @@ package funkin.game; +import flixel.tweens.misc.VarTween; import flixel.tweens.FlxTween; import flixel.sound.FlxSound; import funkin.backend.scripting.events.gameplay.CountdownEvent; @@ -10,7 +11,7 @@ enum CountdownAnimationPreset { DEFAULT; CLASSIC; - PULSING; + BEATING; } @@ -26,36 +27,38 @@ typedef CountdownParams = { var animationPreset:CountdownAnimationPreset; + var duration:Float; + var speed:Float; } class Countdown extends FlxTypedSpriteGroup { - public var event:CountdownEvent; public var enabled:Bool; public var playSound:Bool; public var animationPreset:CountdownAnimationPreset; + public var duration:Float; public var speed:Float; public function new(params:CountdownParams) { - super(); this.event = params.event; this.enabled = params.enabled; this.playSound = params.playSound; this.animationPreset = params.animationPreset; + this.duration = params.duration; this.speed = params.speed; this.__createSprite(); - } @:noPrivateAccess private function __createSprite():Void { - if (!this.enabled) + if (!this.enabled) { return; + } var sprite:FlxSprite = null; var sound:FlxSound = null; @@ -63,51 +66,40 @@ class Countdown extends FlxTypedSpriteGroup { if (!this.event.cancelled) { if (this.event.spritePath != null) { + // Add 1.0 to defaultSize if animationPreset is BEATING. + var defaultSize:Float = this.event.scale; + var isBeatingPreset:Bool = (this.animationPreset == BEATING); + var targetSize:Float = defaultSize + ((!isBeatingPreset) ? 0.0 : 0.25); + var spr = this.event.spritePath; - if (!Assets.exists(spr)) + if (!Assets.exists(spr)) { spr = Paths.image('$spr'); + } sprite = new FunkinSprite().loadAnimatedGraphic(spr); - sprite.scale.set(this.event.scale, this.event.scale); + sprite.scale.set(targetSize, targetSize); sprite.scrollFactor.set(); sprite.antialiasing = this.event.antialiasing; sprite.updateHitbox(); sprite.screenCenter(); - add(sprite); switch(this.animationPreset) { case CLASSIC: - tween = FlxTween.tween(sprite, {alpha: 0}, this.speed, { - ease: FlxEase.cubeInOut, - onComplete: function(twn:FlxTween) { - sprite.destroy(); - remove(sprite, true); - } - }); - case PULSING: - tween = FlxTween.tween(sprite, {alpha: 0}, this.speed, { - ease: FlxEase.cubeInOut, - onComplete: function(twn:FlxTween) { - sprite.destroy(); - remove(sprite, true); - } - }); + tween = __createTween(sprite, {alpha: 0}); + case BEATING: + tween = __createTween(sprite, {alpha: 0, "scale.x": defaultSize, "scale.y": defaultSize}); default: // DEFAULT - tween = FlxTween.tween(sprite, {y: sprite.y + 100, alpha: 0}, this.speed, { - ease: FlxEase.cubeInOut, - onComplete: function(twn:FlxTween) { - sprite.destroy(); - remove(sprite, true); - } - }); + tween = __createTween(sprite, {y: sprite.y + 100, alpha: 0}); } } - if (this.event.soundPath != null && playSound) { + if (this.event.soundPath != null && this.playSound) { var sfx = this.event.soundPath; - if (!Assets.exists(sfx)) sfx = Paths.sound(sfx); + if (!Assets.exists(sfx)) { + sfx = Paths.sound(sfx); + } sound = FlxG.sound.play(sfx, this.event.volume); } @@ -119,4 +111,14 @@ class Countdown extends FlxTypedSpriteGroup { } + @:noPrivateAccess + private function __createTween(sprite:FlxSprite, values:Dynamic):VarTween { + return FlxTween.tween(sprite, values, (this.duration / this.speed), { + ease: FlxEase.cubeInOut, + onComplete: function(twn:FlxTween) { + sprite.destroy(); + remove(sprite, true); + } + }); + } } diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 089d314f4..bbb3fece4 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1007,7 +1007,8 @@ class PlayState extends MusicBeatState enabled: true, playSound: true, animationPreset: DEFAULT, - speed: (Conductor.crochet / 1000) + duration: (Conductor.crochet / 1000), + speed: 1.0 }); countdown.cameras = [camHUD]; From 0f7724efe3f9241c22e02b44e9cd21b34f0bd7a2 Mon Sep 17 00:00:00 2001 From: Equinoxtic Date: Sat, 23 Aug 2025 20:36:41 +0800 Subject: [PATCH 06/10] dampen beating size for countdown and fix easing --- source/funkin/game/Countdown.hx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/funkin/game/Countdown.hx b/source/funkin/game/Countdown.hx index b2513beb6..06c3c6bc2 100644 --- a/source/funkin/game/Countdown.hx +++ b/source/funkin/game/Countdown.hx @@ -69,7 +69,7 @@ class Countdown extends FlxTypedSpriteGroup { // Add 1.0 to defaultSize if animationPreset is BEATING. var defaultSize:Float = this.event.scale; var isBeatingPreset:Bool = (this.animationPreset == BEATING); - var targetSize:Float = defaultSize + ((!isBeatingPreset) ? 0.0 : 0.25); + var targetSize:Float = defaultSize + ((!isBeatingPreset) ? 0.0 : 0.15); var spr = this.event.spritePath; @@ -87,11 +87,11 @@ class Countdown extends FlxTypedSpriteGroup { switch(this.animationPreset) { case CLASSIC: - tween = __createTween(sprite, {alpha: 0}); + tween = __createTween(sprite, {alpha: 0}, FlxEase.cubeInOut); case BEATING: - tween = __createTween(sprite, {alpha: 0, "scale.x": defaultSize, "scale.y": defaultSize}); + tween = __createTween(sprite, {alpha: 0, "scale.x": defaultSize, "scale.y": defaultSize}, FlxEase.expoOut); default: // DEFAULT - tween = __createTween(sprite, {y: sprite.y + 100, alpha: 0}); + tween = __createTween(sprite, {y: sprite.y + 100, alpha: 0}, FlxEase.cubeInOut); } } @@ -112,9 +112,9 @@ class Countdown extends FlxTypedSpriteGroup { } @:noPrivateAccess - private function __createTween(sprite:FlxSprite, values:Dynamic):VarTween { + private function __createTween(sprite:FlxSprite, values:Dynamic, easing:EaseFunction):VarTween { return FlxTween.tween(sprite, values, (this.duration / this.speed), { - ease: FlxEase.cubeInOut, + ease: easing, onComplete: function(twn:FlxTween) { sprite.destroy(); remove(sprite, true); From 5c899eeeace1ab1092e08fa1ecebb5288c533341 Mon Sep 17 00:00:00 2001 From: Equinoxtic Date: Sat, 23 Aug 2025 20:54:20 +0800 Subject: [PATCH 07/10] Create documentation for Countdown.hx --- source/funkin/game/Countdown.hx | 37 +++++++++++++++++++++++++++++---- source/funkin/game/PlayState.hx | 2 -- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/source/funkin/game/Countdown.hx b/source/funkin/game/Countdown.hx index 06c3c6bc2..2da44d00f 100644 --- a/source/funkin/game/Countdown.hx +++ b/source/funkin/game/Countdown.hx @@ -7,28 +7,53 @@ import funkin.backend.scripting.events.gameplay.CountdownEvent; enum CountdownAnimationPreset { - // TODO: Documentation - + /** + * The default animation for Codename Engine's countdown. + */ DEFAULT; + + /** + * The classic animation, similar to Funkin's countdown. + */ CLASSIC; + + /** + * A more enhanced version of Funkin's countdown animation. + */ BEATING; } typedef CountdownParams = { - // TODO: Documentation - + /** + * The CountdownEvent to be used. + */ var event:CountdownEvent; + /** + * Whether the countdown should be visible or not. + */ var enabled:Bool; + /** + * Whether each tick from the countdown should play a sound. + */ var playSound:Bool; + /** + * The animation preset to be used for the countdown. + */ var animationPreset:CountdownAnimationPreset; + /** + * The duration of the countdown's animation. + */ var duration:Float; + /** + * The speed of the countdown's animation. The lower it is, the slower it goes and vice-versa. + */ var speed:Float; } @@ -41,6 +66,10 @@ class Countdown extends FlxTypedSpriteGroup { public var duration:Float; public var speed:Float; + /** + * Create a new Countdown component. + * @param params + */ public function new(params:CountdownParams) { super(); diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index bbb3fece4..1adb92904 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -996,7 +996,6 @@ class PlayState extends MusicBeatState * Creates a fake countdown. */ public function countdown(swagCounter:Int) { - var countdown:Countdown = new Countdown({ event: gameAndCharsEvent("onCountdown", EventManager.get(CountdownEvent).recycle( swagCounter, @@ -1010,7 +1009,6 @@ class PlayState extends MusicBeatState duration: (Conductor.crochet / 1000), speed: 1.0 }); - countdown.cameras = [camHUD]; add(countdown); From 7716ef2f8f609b2a1f2e66efd4eb91318fb981c6 Mon Sep 17 00:00:00 2001 From: Equinoxtic Date: Sat, 23 Aug 2025 21:13:52 +0800 Subject: [PATCH 08/10] finishing touches --- source/funkin/backend/system/CommandLineHandler.hx | 5 +++-- source/funkin/backend/system/updating/UpdateUtil.hx | 4 ++-- source/funkin/game/Countdown.hx | 1 - source/funkin/game/PlayState.hx | 1 - 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/source/funkin/backend/system/CommandLineHandler.hx b/source/funkin/backend/system/CommandLineHandler.hx index b783f8462..4518d3002 100644 --- a/source/funkin/backend/system/CommandLineHandler.hx +++ b/source/funkin/backend/system/CommandLineHandler.hx @@ -12,7 +12,8 @@ final class CommandLineHandler { "", "-help | Show this help", #if MOD_SUPPORT - "-mod [mod name] | Load a specific mod", "-modfolder [path] | Sets the mod folder path", + "-mod [mod name] | Load a specific mod", + "-modfolder [path] | Sets the mod folder path", "-addonsfolder [path] | Sets the addons folder path", #end "-nocolor | Disables colors in the terminal", @@ -24,7 +25,7 @@ final class CommandLineHandler { Sys.println(s); } } - + public static function parseCommandLine(cmd:Array) { var i:Int = 0; while(i < cmd.length) { diff --git a/source/funkin/backend/system/updating/UpdateUtil.hx b/source/funkin/backend/system/updating/UpdateUtil.hx index 27396ea79..53a1f38f1 100644 --- a/source/funkin/backend/system/updating/UpdateUtil.hx +++ b/source/funkin/backend/system/updating/UpdateUtil.hx @@ -30,10 +30,10 @@ class UpdateUtil { __mutex = new Mutex(); Thread.create(checkForUpdates.bind(true, false)); } - + public static function getExecName():String { - // Since previously, both linux and mac don't have the .exe extension. We might as well just compress this to a '#else' clause. + // Since previously, both linux and mac don't have the .exe extension, we might as well just compress this to a '#else' clause. return #if windows "CodenameEngine.exe" #else "CodenameEngine" #end; // weird syntax??? :skull: haxe is just full of surprises } diff --git a/source/funkin/game/Countdown.hx b/source/funkin/game/Countdown.hx index 2da44d00f..88e88ebcc 100644 --- a/source/funkin/game/Countdown.hx +++ b/source/funkin/game/Countdown.hx @@ -137,7 +137,6 @@ class Countdown extends FlxTypedSpriteGroup { this.event.spriteTween = tween; this.event.cancelled = false; } - } @:noPrivateAccess diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 1adb92904..6788d81ec 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1010,7 +1010,6 @@ class PlayState extends MusicBeatState speed: 1.0 }); countdown.cameras = [camHUD]; - add(countdown); gameAndCharsEvent("onPostCountdown", countdown.event); From 892e3ac926b8a3ed515ba27fd8074c82ead02c86 Mon Sep 17 00:00:00 2001 From: Equinoxtic Date: Sun, 24 Aug 2025 12:11:30 +0800 Subject: [PATCH 09/10] Revert back to CNE's implementation + compat with new Countdown class --- source/funkin/game/PlayState.hx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 6788d81ec..a2ddb2244 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -996,13 +996,15 @@ class PlayState extends MusicBeatState * Creates a fake countdown. */ public function countdown(swagCounter:Int) { + var event:CountdownEvent = gameAndCharsEvent("onCountdown", EventManager.get(CountdownEvent).recycle( + swagCounter, + 1, + introSounds[swagCounter], + introSprites[swagCounter], + 0.6, true, null, null, null)); + var countdown:Countdown = new Countdown({ - event: gameAndCharsEvent("onCountdown", EventManager.get(CountdownEvent).recycle( - swagCounter, - 1, - introSounds[swagCounter], - introSprites[swagCounter], - 0.6, true, null, null, null)), + event: event, enabled: true, playSound: true, animationPreset: DEFAULT, @@ -1010,9 +1012,10 @@ class PlayState extends MusicBeatState speed: 1.0 }); countdown.cameras = [camHUD]; + add(countdown); - gameAndCharsEvent("onPostCountdown", countdown.event); + gameAndCharsEvent("onPostCountdown", event); } @:dox(hide) function startSong():Void From ed461213146ad73023603b527bc87844cc4553c4 Mon Sep 17 00:00:00 2001 From: Equinoxtic Date: Thu, 9 Oct 2025 17:23:03 +0800 Subject: [PATCH 10/10] Cleanup --- .../backend/system/updating/AsyncUpdater.hx | 4 ++-- .../funkin/backend/system/updating/UpdateUtil.hx | 8 +++----- source/funkin/game/Countdown.hx | 16 +++++++--------- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/source/funkin/backend/system/updating/AsyncUpdater.hx b/source/funkin/backend/system/updating/AsyncUpdater.hx index 3e1ad894a..8ddc34237 100644 --- a/source/funkin/backend/system/updating/AsyncUpdater.hx +++ b/source/funkin/backend/system/updating/AsyncUpdater.hx @@ -25,8 +25,8 @@ class AsyncUpdater { } #end - public static var executableName:String = UpdateUtil.getExecName(); - public static var executableGitHubName:String = UpdateUtil.getGitExecName(); + public static var executableName:String = UpdateUtil.getNameOfExecutable(); + public static var executableGitHubName:String = UpdateUtil.getNameOfUpdateExecutable(); public var releases:Array; public var progress:UpdaterProgress = new UpdaterProgress(); diff --git a/source/funkin/backend/system/updating/UpdateUtil.hx b/source/funkin/backend/system/updating/UpdateUtil.hx index 53a1f38f1..122dabedd 100644 --- a/source/funkin/backend/system/updating/UpdateUtil.hx +++ b/source/funkin/backend/system/updating/UpdateUtil.hx @@ -31,15 +31,13 @@ class UpdateUtil { Thread.create(checkForUpdates.bind(true, false)); } - public static function getExecName():String + public static function getNameOfExecutable():String { - // Since previously, both linux and mac don't have the .exe extension, we might as well just compress this to a '#else' clause. - return #if windows "CodenameEngine.exe" #else "CodenameEngine" #end; // weird syntax??? :skull: haxe is just full of surprises + return #if windows "CodenameEngine.exe" #else "CodenameEngine" #end; } - public static function getGitExecName():String + public static function getNameOfUpdateExecutable():String { - // Only add the suffix of the platform we need to get. var target:String = #if windows "windows.exe" #end #if mac "mac" #end #if linux "linux" #end; diff --git a/source/funkin/game/Countdown.hx b/source/funkin/game/Countdown.hx index 88e88ebcc..c2f1091b6 100644 --- a/source/funkin/game/Countdown.hx +++ b/source/funkin/game/Countdown.hx @@ -80,11 +80,10 @@ class Countdown extends FlxTypedSpriteGroup { this.duration = params.duration; this.speed = params.speed; - this.__createSprite(); + this.makeSprite(); } - @:noPrivateAccess - private function __createSprite():Void { + public function makeSprite():Void { if (!this.enabled) { return; } @@ -116,11 +115,11 @@ class Countdown extends FlxTypedSpriteGroup { switch(this.animationPreset) { case CLASSIC: - tween = __createTween(sprite, {alpha: 0}, FlxEase.cubeInOut); + tween = makeTween(sprite, {alpha: 0}, FlxEase.cubeInOut); case BEATING: - tween = __createTween(sprite, {alpha: 0, "scale.x": defaultSize, "scale.y": defaultSize}, FlxEase.expoOut); + tween = makeTween(sprite, {alpha: 0, "scale.x": defaultSize, "scale.y": defaultSize}, FlxEase.expoOut); default: // DEFAULT - tween = __createTween(sprite, {y: sprite.y + 100, alpha: 0}, FlxEase.cubeInOut); + tween = makeTween(sprite, {y: sprite.y + 100, alpha: 0}, FlxEase.cubeInOut); } } @@ -138,9 +137,8 @@ class Countdown extends FlxTypedSpriteGroup { this.event.cancelled = false; } } - - @:noPrivateAccess - private function __createTween(sprite:FlxSprite, values:Dynamic, easing:EaseFunction):VarTween { + + public function makeTween(sprite:FlxSprite, values:Dynamic, easing:EaseFunction):VarTween { return FlxTween.tween(sprite, values, (this.duration / this.speed), { ease: easing, onComplete: function(twn:FlxTween) {