Skip to content

[CHORE] Null safety to 10 ui.charSelect classes #5118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions source/funkin/ui/charSelect/CharIcon.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package funkin.ui.charSelect;

import flixel.FlxSprite;

@:nullSafety
class CharIcon extends FlxSprite
{
public var locked:Bool = false;
Expand Down
13 changes: 7 additions & 6 deletions source/funkin/ui/charSelect/CharIconCharacter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import openfl.filters.DropShadowFilter;
import openfl.filters.ConvolutionFilter;
import funkin.graphics.shaders.StrokeShader;

@:nullSafety
class CharIconCharacter extends CharIcon
{
public var dropShadowFilter:DropShadowFilter;
// public var dropShadowFilter:DropShadowFilter;

var matrixFilter:Array<Float> = [
1, 1, 1,
Expand All @@ -17,12 +18,12 @@ class CharIconCharacter extends CharIcon

var divisor:Int = 1;
var bias:Int = 0;
var convolutionFilter:ConvolutionFilter;
// var convolutionFilter:ConvolutionFilter;

public var noDropShadow:BitmapData;
public var withDropShadow:BitmapData;
// public var noDropShadow:BitmapData;
// public var withDropShadow:BitmapData;

var strokeShader:StrokeShader;
// var strokeShader:StrokeShader;

public function new(path:String)
{
Expand All @@ -33,7 +34,7 @@ class CharIconCharacter extends CharIcon
updateHitbox();
antialiasing = false;

strokeShader = new StrokeShader();
// strokeShader = new StrokeShader();
// shader = strokeShader;

// noDropShadow = pixels.clone();
Expand Down
1 change: 1 addition & 0 deletions source/funkin/ui/charSelect/CharIconLocked.hx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
package funkin.ui.charSelect;

@:nullSafety
class CharIconLocked extends CharIcon {}
20 changes: 11 additions & 9 deletions source/funkin/ui/charSelect/CharSelectGF.hx
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@ import funkin.modding.events.ScriptEvent;
import funkin.vis.dsp.SpectralAnalyzer;
import funkin.data.freeplay.player.PlayerRegistry;

@:nullSafety
class CharSelectGF extends FlxAtlasSprite implements IBPMSyncedScriptedClass
{
var fadeTimer:Float = 0;
var fadingStatus:FadeStatus = OFF;
var fadeAnimIndex:Int = 0;

var animInInfo:FramesJSFLInfo;
var animOutInfo:FramesJSFLInfo;
var animInInfo:Null<FramesJSFLInfo>;
var animOutInfo:Null<FramesJSFLInfo>;

var intendedYPos:Float = 0;
var intendedAlpha:Float = 0;
var list:Array<String> = [];
var list:Array<Null<String>> = [];

var analyzer:SpectralAnalyzer;
var analyzer:Null<SpectralAnalyzer>;

var currentGFPath:Null<String>;
var enableVisualizer:Bool = false;
Expand All @@ -34,7 +35,7 @@ class CharSelectGF extends FlxAtlasSprite implements IBPMSyncedScriptedClass

list = anim.curSymbol.getFrameLabelNames();

switchGF("bf");
switchGF(Constants.DEFAULT_CHARACTER);
}

override public function update(elapsed:Float):Void
Expand All @@ -49,9 +50,9 @@ class CharSelectGF extends FlxAtlasSprite implements IBPMSyncedScriptedClass
// maybe reset timers?
resetFadeAnimParams();
case FADE_OUT:
doFade(animOutInfo);
if (animOutInfo != null) doFade(animOutInfo);
case FADE_IN:
doFade(animInInfo);
if (animInInfo != null) doFade(animInInfo);
default:
}
}
Expand Down Expand Up @@ -82,10 +83,11 @@ class CharSelectGF extends FlxAtlasSprite implements IBPMSyncedScriptedClass

function drawFFT()
{
if (enableVisualizer)
if (enableVisualizer && analyzer != null)
{
var levels = analyzer.getLevels();
var frame = anim.curSymbol.timeline.get("VIZ_bars").get(anim.curFrame);
if (frame == null) return;
var elements = frame.getList();
var len:Int = cast Math.min(elements.length, 7);

Expand Down Expand Up @@ -161,7 +163,7 @@ class CharSelectGF extends FlxAtlasSprite implements IBPMSyncedScriptedClass

var bfObj = PlayerRegistry.instance.fetchEntry(bf);
var gfData = bfObj?.getCharSelectData()?.gf;
currentGFPath = gfData?.assetPath != null ? Paths.animateAtlas(gfData?.assetPath) : null;
if (gfData != null && gfData.assetPath != null) currentGFPath = Paths.animateAtlas(gfData.assetPath);

// We don't need to update any anims if we didn't change GF
trace('currentGFPath(${currentGFPath})');
Expand Down
1 change: 1 addition & 0 deletions source/funkin/ui/charSelect/CharSelectPlayer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import funkin.graphics.adobeanimate.FlxAtlasSprite;
import funkin.modding.IScriptedClass.IBPMSyncedScriptedClass;
import funkin.modding.events.ScriptEvent;

@:nullSafety
class CharSelectPlayer extends FlxAtlasSprite implements IBPMSyncedScriptedClass
{
public function new(x:Float, y:Float)
Expand Down
Loading
Loading