diff --git a/assets b/assets index 41980de1c..2a0bc4f66 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 41980de1c2ec851ce99a33cb397ba0550b68ea2d +Subproject commit 2a0bc4f66d79a6f590e7ed2c04884d8c1fa8c45e diff --git a/source/funkin/data/freeplay/player/PlayerData.hx b/source/funkin/data/freeplay/player/PlayerData.hx index 867fe7113..91df7a232 100644 --- a/source/funkin/data/freeplay/player/PlayerData.hx +++ b/source/funkin/data/freeplay/player/PlayerData.hx @@ -264,6 +264,25 @@ class PlayerCharSelectData */ @:optional public var position:Null; + + /** + * The GF name to assign for this character. + */ + @:optional + public var gf:PlayerCharSelectGFData; +} + +typedef PlayerCharSelectGFData = +{ + @:optional + public var assetPath:String; + + @:optional + public var animInfoPath:String; + + @:optional + @:default(false) + public var visualizer:Bool; } typedef PlayerResultsData = diff --git a/source/funkin/ui/charSelect/CharSelectGF.hx b/source/funkin/ui/charSelect/CharSelectGF.hx index e8eeded40..89fc6deb0 100644 --- a/source/funkin/ui/charSelect/CharSelectGF.hx +++ b/source/funkin/ui/charSelect/CharSelectGF.hx @@ -11,6 +11,7 @@ import funkin.modding.IScriptedClass.IBPMSyncedScriptedClass; import flixel.math.FlxMath; import funkin.modding.events.ScriptEvent; import funkin.vis.dsp.SpectralAnalyzer; +import funkin.data.freeplay.player.PlayerRegistry; class CharSelectGF extends FlxAtlasSprite implements IBPMSyncedScriptedClass { @@ -27,7 +28,8 @@ class CharSelectGF extends FlxAtlasSprite implements IBPMSyncedScriptedClass var analyzer:SpectralAnalyzer; - var curGF:GFChar = GF; + var currentGFPath:Null; + var enableVisualizer:Bool = false; public function new() { @@ -97,7 +99,7 @@ class CharSelectGF extends FlxAtlasSprite implements IBPMSyncedScriptedClass function drawFFT() { - if (curGF == NENE) + if (enableVisualizer) { var levels = analyzer.getLevels(); var frame = anim.curSymbol.timeline.get("VIZ_bars").get(anim.curFrame); @@ -172,28 +174,33 @@ class CharSelectGF extends FlxAtlasSprite implements IBPMSyncedScriptedClass */ public function switchGF(bf:String):Void { - var prevGF:GFChar = curGF; - switch (bf) - { - case "pico": - curGF = NENE; - case "bf": - curGF = GF; - default: - curGF = GF; - } + var previousGFPath = currentGFPath; + + var bfObj = PlayerRegistry.instance.fetchEntry(bf); + var gfData = bfObj?.getCharSelectData()?.gf; + currentGFPath = gfData?.assetPath != null ? Paths.animateAtlas(gfData?.assetPath) : null; // We don't need to update any anims if we didn't change GF - if (prevGF != curGF) + trace('currentGFPath(${currentGFPath})'); + if (currentGFPath == null) { - loadAtlas(Paths.animateAtlas("charSelect/" + curGF + "Chill")); + this.visible = false; + return; + } + else if (previousGFPath != currentGFPath) + { + this.visible = true; + loadAtlas(currentGFPath); - animInInfo = FramesJSFLParser.parse(Paths.file("images/charSelect/" + curGF + "AnimInfo/" + curGF + "In.txt")); - animOutInfo = FramesJSFLParser.parse(Paths.file("images/charSelect/" + curGF + "AnimInfo/" + curGF + "Out.txt")); + enableVisualizer = gfData?.visualizer ?? false; + + var animInfoPath = Paths.file('images/${gfData?.animInfoPath}'); + + animInInfo = FramesJSFLParser.parse(animInfoPath + '/In.txt'); + animOutInfo = FramesJSFLParser.parse(animInfoPath + '/Out.txt'); } playAnimation("idle", true, false, false); - // addFrameCallback(getNextFrameLabel("idle"), () -> playAnimation("idle", true, false, false)); updateHitbox(); } @@ -213,9 +220,3 @@ enum FadeStatus FADE_OUT; FADE_IN; } - -enum abstract GFChar(String) from String to String -{ - var GF = "gf"; - var NENE = "nene"; -} diff --git a/source/funkin/ui/charSelect/CharSelectSubState.hx b/source/funkin/ui/charSelect/CharSelectSubState.hx index c2dd18fd8..70731ac2e 100644 --- a/source/funkin/ui/charSelect/CharSelectSubState.hx +++ b/source/funkin/ui/charSelect/CharSelectSubState.hx @@ -792,7 +792,6 @@ class CharSelectSubState extends MusicBeatSubState && availableChars.exists(getCurrentSelected()) && Save.instance.charactersSeen.contains(availableChars[getCurrentSelected()])) { - gfChill.visible = true; curChar = availableChars.get(getCurrentSelected()); if (allowInput && !pressedSelect && controls.ACCEPT)