Merge branch 'justkolosaki/char-select-gf' into rewrite/master
This commit is contained in:
+1
-1
Submodule assets updated: 41980de1c2...2a0bc4f66d
@@ -264,6 +264,25 @@ class PlayerCharSelectData
|
||||
*/
|
||||
@:optional
|
||||
public var position:Null<Int>;
|
||||
|
||||
/**
|
||||
* 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 =
|
||||
|
||||
@@ -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<String>;
|
||||
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";
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user