diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index bde68461b..934e0b403 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -2281,11 +2281,6 @@ class PlayState extends MusicBeatSubState if (FlxG.keys.justPressed.H) camHUD.visible = !camHUD.visible; #end - // Eject button - if (FlxG.keys.justPressed.F4) FlxG.switchState(() -> new MainMenuState()); - - if (FlxG.keys.justPressed.F5) debug_refreshModules(); - // Open the stage editor overlaying the current state. if (controls.DEBUG_STAGE) { diff --git a/source/funkin/play/notes/NoteSplash.hx b/source/funkin/play/notes/NoteSplash.hx index 0ff8076c8..2411e5615 100644 --- a/source/funkin/play/notes/NoteSplash.hx +++ b/source/funkin/play/notes/NoteSplash.hx @@ -35,6 +35,7 @@ class NoteSplash extends FlxSprite */ function setup():Void { + if (frameCollection?.parent?.isDestroyed ?? false) frameCollection = null; if (frameCollection == null) preloadFrames(); this.frames = frameCollection; @@ -75,6 +76,8 @@ class NoteSplash extends FlxSprite this.playAnimation('splash${variant}Right'); } + if (animation.curAnim == null) return; + // Vary the speed of the animation a bit. animation.curAnim.frameRate = FRAMERATE_DEFAULT + FlxG.random.int(-FRAMERATE_VARIANCE, FRAMERATE_VARIANCE); diff --git a/source/funkin/play/notes/notestyle/NoteStyle.hx b/source/funkin/play/notes/notestyle/NoteStyle.hx index f560396e8..d0cc09f6a 100644 --- a/source/funkin/play/notes/notestyle/NoteStyle.hx +++ b/source/funkin/play/notes/notestyle/NoteStyle.hx @@ -106,6 +106,9 @@ class NoteStyle implements IRegistryEntry FlxG.log.warn('Note texture is not cached: ${getNoteAssetPath()}'); } + // Purge the note frames if the cached atlas is invalid. + if (noteFrames?.parent?.isDestroyed ?? false) noteFrames = null; + if (noteFrames != null && !force) return noteFrames; noteFrames = Paths.getSparrowAtlas(getNoteAssetPath(), getNoteAssetLibrary()); @@ -115,8 +118,6 @@ class NoteStyle implements IRegistryEntry throw 'Could not load note frames for note style: $id'; } - noteFrames.parent.persist = true; - return noteFrames; } diff --git a/source/funkin/ui/transition/LoadingState.hx b/source/funkin/ui/transition/LoadingState.hx index 3a41340a6..5f755872f 100644 --- a/source/funkin/ui/transition/LoadingState.hx +++ b/source/funkin/ui/transition/LoadingState.hx @@ -225,6 +225,10 @@ class LoadingState extends MusicBeatState FunkinSprite.cacheTexture(Paths.image('num7')); FunkinSprite.cacheTexture(Paths.image('num8')); FunkinSprite.cacheTexture(Paths.image('num9')); + FunkinSprite.cacheTexture(Paths.image('notes', 'shared')); + FunkinSprite.cacheTexture(Paths.image('noteSplashes', 'shared')); + FunkinSprite.cacheTexture(Paths.image('noteStrumline', 'shared')); + FunkinSprite.cacheTexture(Paths.image('NOTE_hold_assets')); FunkinSprite.cacheTexture(Paths.image('ready', 'shared')); FunkinSprite.cacheTexture(Paths.image('set', 'shared')); FunkinSprite.cacheTexture(Paths.image('go', 'shared')); @@ -232,7 +236,14 @@ class LoadingState extends MusicBeatState FunkinSprite.cacheTexture(Paths.image('good', 'shared')); FunkinSprite.cacheTexture(Paths.image('bad', 'shared')); FunkinSprite.cacheTexture(Paths.image('shit', 'shared')); - FunkinSprite.cacheTexture(Paths.image('miss', 'shared')); // TODO: Remove + FunkinSprite.cacheTexture(Paths.image('miss', 'shared')); // TODO: remove this + + // FunkinSprite.cacheAllNoteStyleTextures(noteStyle) // This will replace the stuff above! + // FunkinSprite.cacheAllCharacterTextures(player) + // FunkinSprite.cacheAllCharacterTextures(girlfriend) + // FunkinSprite.cacheAllCharacterTextures(opponent) + // FunkinSprite.cacheAllStageTextures(stage) + FunkinSprite.purgeCache(); FlxG.switchState(playStateCtor); diff --git a/source/funkin/ui/transition/StickerSubState.hx b/source/funkin/ui/transition/StickerSubState.hx index fda7d1d5d..40fce6f7d 100644 --- a/source/funkin/ui/transition/StickerSubState.hx +++ b/source/funkin/ui/transition/StickerSubState.hx @@ -246,6 +246,10 @@ class StickerSubState extends MusicBeatSubState FlxTransitionableState.skipNextTransIn = true; FlxTransitionableState.skipNextTransOut = true; + // TODO: Rework this asset caching stuff + FunkinSprite.preparePurgeCache(); + FunkinSprite.purgeCache(); + // I think this grabs the screen and puts it under the stickers? // Leaving this commented out rather than stripping it out because it's cool... /*