diff --git a/buildnumber.txt b/buildnumber.txt index 4063cbd0..9606a0dd 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -2223 \ No newline at end of file +2229 \ No newline at end of file diff --git a/source/funkin/game/Character.hx b/source/funkin/game/Character.hx index 4dec02b4..b3486849 100644 --- a/source/funkin/game/Character.hx +++ b/source/funkin/game/Character.hx @@ -73,10 +73,10 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset return new FlxPoint(event.x, event.y); } - public function playSingAnim(direction:Int, suffix:String = "", Context:PlayAnimContext = SING, Reversed:Bool = false, Frame:Int = 0) { + public function playSingAnim(direction:Int, suffix:String = "", Context:PlayAnimContext = SING, Force:Bool = true, Reversed:Bool = false, Frame:Int = 0) { var anims = ["singLEFT", "singDOWN", "singUP", "singRIGHT"]; - var event = EventManager.get(DirectionAnimEvent).recycle('${anims[direction]}$suffix', direction, suffix, Context, Reversed, Frame); + var event = EventManager.get(DirectionAnimEvent).recycle('${anims[direction]}$suffix', direction, suffix, Context, Reversed, Frame, Force); script.call("onPlaySingAnim", [event]); if (!event.cancelled) playAnim(event.animName, event.force, Context, event.reversed, event.frame); } diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index b8431a2c..a90b4d7d 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -52,7 +52,6 @@ import openfl.filters.ShaderFilter; import funkin.system.Conductor; import funkin.system.Song; import funkin.editors.ChartingState; -import funkin.debug.AnimationDebug; import funkin.cutscenes.*; import funkin.menus.*; @@ -1452,7 +1451,7 @@ class PlayState extends MusicBeatState if (event.note.strumLine != null) event.note.strumLine.addHealth(event.healthGain); if (gf != null && combo > 5 && gf.animOffsets.exists('sad')) { - gf.playAnim('sad', true, MISS); + gf.playAnim('sad', event.forceAnim, MISS); } combo = 0; @@ -1615,7 +1614,7 @@ class PlayState extends MusicBeatState if (!event.animCancelled) for(char in event.characters) if (char != null) - char.playSingAnim(event.direction, event.animSuffix); + char.playSingAnim(event.direction, event.animSuffix, SING, event.forceAnim); if (event.note.__strum != null) { if (!event.strumGlowCancelled) event.note.__strum.press(event.note.strumTime); diff --git a/source/funkin/scripting/events/NoteHitEvent.hx b/source/funkin/scripting/events/NoteHitEvent.hx index e7aafb7e..3ad4e198 100644 --- a/source/funkin/scripting/events/NoteHitEvent.hx +++ b/source/funkin/scripting/events/NoteHitEvent.hx @@ -95,6 +95,10 @@ class NoteHitEvent extends CancellableEvent { * Whenever antialiasing should be enabled on ratings. */ public var ratingAntialiasing:Bool = true; + /** + * Whenever the animation should be forced to play. + */ + public var forceAnim:Bool = true; /** * Prevents the default sing animation from being played. diff --git a/source/funkin/system/Main.hx b/source/funkin/system/Main.hx index d2503354..c256e5eb 100644 --- a/source/funkin/system/Main.hx +++ b/source/funkin/system/Main.hx @@ -208,7 +208,8 @@ class Main extends Sprite AudioSwitchFix.init(); WindowsAPI.setDarkMode(true); EventManager.init(); - FlxG.signals.preStateCreate.add(onStateSwitch); + FlxG.signals.preStateSwitch.add(onStateSwitch); + FlxG.signals.postStateSwitch.add(onStateSwitchPost); #if MOD_SUPPORT ModsFolder.switchMod(Options.lastLoadedMod); @@ -235,28 +236,33 @@ class Main extends Sprite {asset: diamond, width: 32, height: 32}, new FlxRect(-200, -200, FlxG.width * 1.4, FlxG.height * 1.4)); } - private static function onStateSwitch(newState:FlxState) { + private static function onStateSwitch() { + scaleMode.resetSize(); + } + + private static function onStateSwitchPost() { // manual asset clearing since base openfl one doesnt clear lime one // doesnt clear bitmaps since flixel fork does it auto @:privateAccess { - // clear uint8 pools since it causes memory leak with openfl textfield + // clear uint8 pools for(length=>pool in openfl.display3D.utils.UInt8Buff._pools) { for(b in pool.clear()) b.destroy(); } openfl.display3D.utils.UInt8Buff._pools.clear(); } - scaleMode.resetSize(); var cache = cast(Assets.cache, AssetCache); - for (key=>font in cache.font) + for (key=>_ in cache.font) cache.removeFont(key); - for (key=>sound in cache.sound) + for (key=>_ in cache.sound) cache.removeSound(key); Paths.assetsTree.clearCache(); MemoryUtil.clearMajor(); + + FlxG.bitmap.dumpCache(); } }