From b3aee374a6b51cc93d8da7a3232deb7ed3a576bd Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Tue, 18 Apr 2023 20:15:52 +0200 Subject: [PATCH] fixed dumb caching issue --- source/funkin/backend/system/GraphicCacheSprite.hx | 6 ++++-- source/funkin/game/PlayState.hx | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/source/funkin/backend/system/GraphicCacheSprite.hx b/source/funkin/backend/system/GraphicCacheSprite.hx index 78419ed3..4f0fe98f 100644 --- a/source/funkin/backend/system/GraphicCacheSprite.hx +++ b/source/funkin/backend/system/GraphicCacheSprite.hx @@ -29,15 +29,17 @@ class GraphicCacheSprite extends FlxSprite { if (graphic != null) { // make their useCount one time higher to prevent them from auto being cleared from cache graphic.useCount++; + graphic.destroyOnNoUse = false; cachedGraphics.push(graphic); nonRenderedCachedGraphics.push(graphic); } } public override function destroy() { - for(g in cachedGraphics) - // make their usecount 1 time lower so that it can be cleared again + for(g in cachedGraphics) { + g.destroyOnNoUse = true; g.useCount--; + } graphic = null; super.destroy(); } diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index c14a2f7a..1724ae38 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -570,7 +570,7 @@ class PlayState extends MusicBeatState // PRECACHING #if REGION for(content in Paths.getFolderContent('images/game/score/', true, true)) - graphicCache.cache(content); + graphicCache.cache(Paths.getPath(content)); for(i in 1...4) { FlxG.sound.load(Paths.sound('missnote' + Std.string(i)));