change cleaning + orangize a little more

This commit is contained in:
lunarcleint
2024-04-12 22:06:04 -07:00
parent 02092494bd
commit feb787c73e
4 changed files with 13 additions and 21 deletions
@@ -357,15 +357,6 @@ class CharacterEditor extends UIState {
button.anim
]);
// clean
if (charXML.exists("gameOverChar") && character.gameOverCharacter == "bf-dead") charXML.remove("gameOverChar");
if (charXML.exists("camx") && character.cameraOffset.x == 0) charXML.remove("camx");
if (charXML.exists("camy") && character.cameraOffset.y == 0) charXML.remove("camy");
if (charXML.exists("holdTime") && character.holdTime == 4) charXML.remove("holdTime");
if (charXML.exists("flipX") && !character.flipX) charXML.remove("flipX");
if (charXML.exists("scale") && character.scale.x == 1) charXML.remove("scale");
if (charXML.exists("antialiasing") && character.antialiasing) charXML.remove("antialiasing");
return "<!DOCTYPE codename-engine-character>\n" + Printer.print(charXML, true);
}
+11 -10
View File
@@ -39,7 +39,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
public var icon:String = null;
public var iconColor:Null<FlxColor> = null;
public var gameOverCharacter:String = "bf-dead";
public var gameOverCharacter:String = Character.FALLBACK_DEAD_CHARACTER;
public var cameraOffset:FlxPoint = FlxPoint.get();
public var globalOffset:FlxPoint = FlxPoint.get();
@@ -301,23 +301,23 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
var xml:Xml = Xml.createElement("character");
xml.attributeOrder = characterProperties.copy();
xml.set("x", Std.string(FlxMath.roundDecimal(globalOffset.x, 2)));
xml.set("y", Std.string(FlxMath.roundDecimal(globalOffset.y, 2)));
if (globalOffset.x != 0) xml.set("x", Std.string(FlxMath.roundDecimal(globalOffset.x, 2)));
if (globalOffset.y != 0) xml.set("y", Std.string(FlxMath.roundDecimal(globalOffset.y, 2)));
xml.set("camx", Std.string(FlxMath.roundDecimal(cameraOffset.x, 2)));
xml.set("camy", Std.string(FlxMath.roundDecimal(cameraOffset.y, 2)));
if (cameraOffset.x != 0) xml.set("camx", Std.string(FlxMath.roundDecimal(cameraOffset.x, 2)));
if (cameraOffset.y != 0) xml.set("camy", Std.string(FlxMath.roundDecimal(cameraOffset.y, 2)));
xml.set("holdTime", Std.string(FlxMath.roundDecimal(holdTime, 4)));
if (holdTime != 4) xml.set("holdTime", Std.string(FlxMath.roundDecimal(holdTime, 4)));
xml.set("flipX", Std.string(flipX));
if (flipX) xml.set("flipX", Std.string(flipX));
xml.set("icon", getIcon());
xml.set("gameOverChar", gameOverCharacter);
if (gameOverCharacter != Character.FALLBACK_DEAD_CHARACTER) xml.set("gameOverChar", gameOverCharacter);
if (iconColor != null) xml.set("color", iconColor.toWebString());
xml.set("sprite", sprite);
xml.set("scale", Std.string(FlxMath.roundDecimal(scale.x, 4)));
xml.set("antialiasing", antialiasing == true ? "true" : "false");
if (scale.x != 1) xml.set("scale", Std.string(FlxMath.roundDecimal(scale.x, 4)));
if (!antialiasing) xml.set("antialiasing", antialiasing == true ? "true" : "false");
xml.set("isPlayer", playerOffsets == true ? "true" : "false");
@@ -378,6 +378,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset
public static var FALLBACK_CHARACTER:String = "bf";
public static var FALLBACK_DEAD_CHARACTER:String = "bf-dead";
public static function getXMLFromCharName(character:OneOfTwo<String, Character>):Access {
var char:Character = null;
if (character is Character) {
+1 -1
View File
@@ -36,7 +36,7 @@ class GameOverSubstate extends MusicBeatSubstate
public var lossSFX:FlxSound;
public function new(x:Float, y:Float, character:String = "bf-dead", player:Bool = true, gameOverSong:String = "gameOver", lossSFX:String = "gameOverSFX", retrySFX:String = "gameOverEnd")
public function new(x:Float, y:Float, character:String = Character.FALLBACK_DEAD_CHARACTER, player:Bool = true, gameOverSong:String = "gameOver", lossSFX:String = "gameOverSFX", retrySFX:String = "gameOverEnd")
{
super();
this.x = x;
+1 -1
View File
@@ -1389,7 +1389,7 @@ class PlayState extends MusicBeatState
charToUse == null ? 0 : charToUse.x,
charToUse == null ? 0 : charToUse.y,
charToUse,
deathCharID.getDefault(charToUse != null ? charToUse.gameOverCharacter : "bf-dead"),
deathCharID.getDefault(charToUse != null ? charToUse.gameOverCharacter : Character.FALLBACK_DEAD_CHARACTER),
charToUse != null ? charToUse.isPlayer : true,
gameOverSong.getDefault(this.gameOverSong),
lossSFX.getDefault(this.lossSFX),