From 31d5b85b7230436360ff4f29f21d13f62c2775aa Mon Sep 17 00:00:00 2001 From: MaybeMaru <97055307+MaybeMaru@users.noreply.github.com> Date: Wed, 10 Apr 2024 16:23:34 +0200 Subject: [PATCH] fix broken transition exit animation --- source/funkin/states/MusicBeatState.hx | 4 ++-- source/funkin/util/CoolUtil.hx | 7 +++++++ source/funkin/util/backend/AssetManager.hx | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/source/funkin/states/MusicBeatState.hx b/source/funkin/states/MusicBeatState.hx index e7502f1b..3e46a1fe 100644 --- a/source/funkin/states/MusicBeatState.hx +++ b/source/funkin/states/MusicBeatState.hx @@ -50,8 +50,8 @@ class MusicBeatState extends FlxUIState implements IMusicGetter { ModdingUtil.addCall('stateCreate'); } - if (Main.transition != null) - Main.transition.exitTrans(); + if (Main.transition != null) // Make sure it runs after all of create is loaded in + FlxG.signals.postUpdate.addOnce(() -> Main.transition.exitTrans()); } // Only for backwards compatibility diff --git a/source/funkin/util/CoolUtil.hx b/source/funkin/util/CoolUtil.hx index 164fbb08..830277bb 100644 --- a/source/funkin/util/CoolUtil.hx +++ b/source/funkin/util/CoolUtil.hx @@ -120,6 +120,13 @@ class CoolUtil { gc(true); } + + inline public static function enableGc(enable:Bool = true) + { + #if (cpp || hl) + Gc.enable(enable); + #end + } inline public static function gc(major:Bool = false) { #if (cpp || hl || neko) diff --git a/source/funkin/util/backend/AssetManager.hx b/source/funkin/util/backend/AssetManager.hx index 31c00f7d..f67491a7 100644 --- a/source/funkin/util/backend/AssetManager.hx +++ b/source/funkin/util/backend/AssetManager.hx @@ -265,6 +265,8 @@ class AssetManager } } + CoolUtil.enableGc(false); + if (stageImages.length > 0) FunkThread.run(() -> cacheImages(stageImages)); @@ -305,6 +307,7 @@ class AssetManager sounds.clear(); sounds = null; + CoolUtil.enableGc(true); CoolUtil.gc(true); if (onComplete != null)