mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-27 01:55:52 -05:00
New pre-caching techniques should reduce stuttering on Weekend 1.
This commit is contained in:
parent
ddfb0c6a61
commit
e349b0bb49
5 changed files with 22 additions and 8 deletions
|
@ -2281,11 +2281,6 @@ class PlayState extends MusicBeatSubState
|
||||||
if (FlxG.keys.justPressed.H) camHUD.visible = !camHUD.visible;
|
if (FlxG.keys.justPressed.H) camHUD.visible = !camHUD.visible;
|
||||||
#end
|
#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.
|
// Open the stage editor overlaying the current state.
|
||||||
if (controls.DEBUG_STAGE)
|
if (controls.DEBUG_STAGE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,6 +35,7 @@ class NoteSplash extends FlxSprite
|
||||||
*/
|
*/
|
||||||
function setup():Void
|
function setup():Void
|
||||||
{
|
{
|
||||||
|
if (frameCollection?.parent?.isDestroyed ?? false) frameCollection = null;
|
||||||
if (frameCollection == null) preloadFrames();
|
if (frameCollection == null) preloadFrames();
|
||||||
|
|
||||||
this.frames = frameCollection;
|
this.frames = frameCollection;
|
||||||
|
@ -75,6 +76,8 @@ class NoteSplash extends FlxSprite
|
||||||
this.playAnimation('splash${variant}Right');
|
this.playAnimation('splash${variant}Right');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (animation.curAnim == null) return;
|
||||||
|
|
||||||
// Vary the speed of the animation a bit.
|
// Vary the speed of the animation a bit.
|
||||||
animation.curAnim.frameRate = FRAMERATE_DEFAULT + FlxG.random.int(-FRAMERATE_VARIANCE, FRAMERATE_VARIANCE);
|
animation.curAnim.frameRate = FRAMERATE_DEFAULT + FlxG.random.int(-FRAMERATE_VARIANCE, FRAMERATE_VARIANCE);
|
||||||
|
|
||||||
|
|
|
@ -106,6 +106,9 @@ class NoteStyle implements IRegistryEntry<NoteStyleData>
|
||||||
FlxG.log.warn('Note texture is not cached: ${getNoteAssetPath()}');
|
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;
|
if (noteFrames != null && !force) return noteFrames;
|
||||||
|
|
||||||
noteFrames = Paths.getSparrowAtlas(getNoteAssetPath(), getNoteAssetLibrary());
|
noteFrames = Paths.getSparrowAtlas(getNoteAssetPath(), getNoteAssetLibrary());
|
||||||
|
@ -115,8 +118,6 @@ class NoteStyle implements IRegistryEntry<NoteStyleData>
|
||||||
throw 'Could not load note frames for note style: $id';
|
throw 'Could not load note frames for note style: $id';
|
||||||
}
|
}
|
||||||
|
|
||||||
noteFrames.parent.persist = true;
|
|
||||||
|
|
||||||
return noteFrames;
|
return noteFrames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -225,6 +225,10 @@ class LoadingState extends MusicBeatState
|
||||||
FunkinSprite.cacheTexture(Paths.image('num7'));
|
FunkinSprite.cacheTexture(Paths.image('num7'));
|
||||||
FunkinSprite.cacheTexture(Paths.image('num8'));
|
FunkinSprite.cacheTexture(Paths.image('num8'));
|
||||||
FunkinSprite.cacheTexture(Paths.image('num9'));
|
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('ready', 'shared'));
|
||||||
FunkinSprite.cacheTexture(Paths.image('set', 'shared'));
|
FunkinSprite.cacheTexture(Paths.image('set', 'shared'));
|
||||||
FunkinSprite.cacheTexture(Paths.image('go', '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('good', 'shared'));
|
||||||
FunkinSprite.cacheTexture(Paths.image('bad', 'shared'));
|
FunkinSprite.cacheTexture(Paths.image('bad', 'shared'));
|
||||||
FunkinSprite.cacheTexture(Paths.image('shit', '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();
|
FunkinSprite.purgeCache();
|
||||||
|
|
||||||
FlxG.switchState(playStateCtor);
|
FlxG.switchState(playStateCtor);
|
||||||
|
|
|
@ -246,6 +246,10 @@ class StickerSubState extends MusicBeatSubState
|
||||||
FlxTransitionableState.skipNextTransIn = true;
|
FlxTransitionableState.skipNextTransIn = true;
|
||||||
FlxTransitionableState.skipNextTransOut = 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?
|
// 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...
|
// Leaving this commented out rather than stripping it out because it's cool...
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue