Bug Fixes + Cleanup

This commit is contained in:
Ne_Eo
2024-11-30 00:44:52 +01:00
parent 96b98513b3
commit 85b50c7cce
11 changed files with 26 additions and 38 deletions
@@ -9,7 +9,7 @@ class DefinesMacro {
/**
* Returns the defined values
*/
public static var defines(get, null):Map<String, Dynamic>;
public static var defines(get, never):Map<String, Dynamic>;
// GETTERS
#if REGION
@@ -51,11 +51,9 @@ class FunkinSaveMacro {
expr: EConst(CIdent(f))
}}
];
var saveFuncBlocks:Array<Expr> = [for(f in fieldNames) macro $i{saveFieldName}.data.$f = $i{f}];
saveFuncBlocks.push(macro ${{
pos: Context.currentPos(),
expr: EConst(CIdent(saveFieldName))
}}.flush());
saveFuncBlocks.push(macro $i{saveFieldName}.flush());
fields.push({
pos: Context.currentPos(),
@@ -81,16 +79,8 @@ class FunkinSaveMacro {
expr: {
pos: Context.currentPos(),
expr: EBlock([for(f in fieldNames)
macro if (${{
pos: Context.currentPos(),
expr: EConst(CIdent(saveFieldName))
}}.data.$f != null) ${{
pos: Context.currentPos(),
expr: EConst(CIdent(f))
}} = ${{
pos: Context.currentPos(),
expr: EConst(CIdent(saveFieldName))
}}.data.$f
macro if ($i{saveFieldName}.data.$f != null)
$i{f} = $i{saveFieldName}.data.$f
])
}
}),
@@ -24,14 +24,8 @@ class OptionsMacro {
var ptwoname = 'P2_$name';
var newFuncExpr:Expr = macro {
var a:Array<FlxKey> = [];
for(e in ${{
pos: Context.currentPos(),
expr: EConst(CIdent(ponename))
}}) a.push(e);
for(e in ${{
pos: Context.currentPos(),
expr: EConst(CIdent(ptwoname))
}}) a.push(e);
for(e in $i{ponename}) a.push(e);
for(e in $i{ptwoname}) a.push(e);
return a;
};
+1 -1
View File
@@ -218,7 +218,7 @@ class ZipProgress {
public var curFile:Int = 0;
public var fileCount:Int = 0;
public var done:Bool = false;
public var percentage(get, null):Float;
public var percentage(get, never):Float;
private function get_percentage() {
return fileCount <= 0 ? 0 : curFile / fileCount;
@@ -14,7 +14,7 @@ class CharacterEditor extends UIState {
public var ghosts:CharacterGhostsHandler;
public static var instance(get, null):CharacterEditor;
public static var instance(get, never):CharacterEditor;
private static inline function get_instance()
return FlxG.state is CharacterEditor ? cast FlxG.state : null;
+2 -2
View File
@@ -22,11 +22,11 @@ class Charter extends UIState {
static var __diff:String;
static var __reload:Bool;
var chart(get, null):ChartData;
var chart(get, never):ChartData;
private function get_chart()
return PlayState.SONG;
public static var instance(get, null):Charter;
public static var instance(get, never):Charter;
private static inline function get_instance()
return FlxG.state is Charter ? cast FlxG.state : null;
+4 -4
View File
@@ -13,7 +13,10 @@ import openfl.ui.MouseCursor;
class UIState extends MusicBeatState {
public var curContextMenu:UIContextMenu = null;
public static var state(get, null):UIState;
public static var state(get, never):UIState;
private inline static function get_state()
return FlxG.state is UIState ? cast FlxG.state : null;
public var buttonHandler:Void->Void = null;
public var hoveredSprite:UISprite = null;
@@ -24,9 +27,6 @@ class UIState extends MusicBeatState {
private var __rect:FlxRect;
private var __mousePos:FlxPoint;
private inline static function get_state()
return FlxG.state is UIState ? cast FlxG.state : null;
public override function create() {
__rect = new FlxRect();
__mousePos = FlxPoint.get();
+1 -1
View File
@@ -75,7 +75,7 @@ class Note extends FlxSprite
public var scrollSpeed:Null<Float> = null;
public var noteAngle:Null<Float> = null;
public var noteType(get, null):String;
public var noteType(get, never):String;
@:dox(hide) public var __strumCameras:Array<FlxCamera> = null;
@:dox(hide) public var __strum:Strum = null;
+7 -3
View File
@@ -189,11 +189,11 @@ class PlayState extends MusicBeatState
/**
* Player strums.
*/
public var playerStrums(get, null):StrumLine;
public var playerStrums(get, set):StrumLine;
/**
* CPU strums.
*/
public var cpuStrums(get, null):StrumLine;
public var cpuStrums(get, set):StrumLine;
/**
* Shortcut to `playerStrums`.
*/
@@ -360,7 +360,7 @@ class PlayState extends MusicBeatState
/**
* Accuracy for the current week
*/
public static var campaignAccuracy(get, null):Float;
public static var campaignAccuracy(get, never):Float;
public static var campaignAccuracyTotal:Float = 0;
public static var campaignAccuracyCount:Float = 0;
@@ -1943,8 +1943,12 @@ class PlayState extends MusicBeatState
}
private inline function get_cpuStrums():StrumLine
return strumLines.members[0];
private inline function set_cpuStrums(v:StrumLine):StrumLine
return strumLines.members[0] = v;
private inline function get_playerStrums():StrumLine
return strumLines.members[1];
private inline function set_playerStrums(v:StrumLine):StrumLine
return strumLines.members[1] = v;
private inline function get_gfSpeed():Int
return (strumLines.members[2] != null && strumLines.members[2].characters[0] != null) ? strumLines.members[2].characters[0].beatInterval : 1;
private inline function set_gfSpeed(v:Int):Int {
@@ -125,7 +125,7 @@ class ScriptedCutscene extends Cutscene {
}));
}
public var isVideoPlaying(get, null):Bool;
public var isVideoPlaying(get, never):Bool;
private inline function get_isVideoPlaying()
return subState is VideoCutscene;
@@ -141,7 +141,7 @@ class ScriptedCutscene extends Cutscene {
}));
}
public var isDialoguePlaying(get, null):Bool;
public var isDialoguePlaying(get, never):Bool;
private inline function get_isDialoguePlaying()
return subState is DialogueCutscene;
+1 -1
View File
@@ -4,7 +4,7 @@ import flixel.group.FlxSpriteGroup;
import funkin.backend.system.Controls;
class OptionType extends FlxSpriteGroup {
public var controls(get, null):Controls;
public var controls(get, never):Controls;
public var selected:Bool = false;
public var desc:String;