diff --git a/source/funkin/editors/character/CharacterEditor.hx b/source/funkin/editors/character/CharacterEditor.hx index a5646b89..c4273799 100644 --- a/source/funkin/editors/character/CharacterEditor.hx +++ b/source/funkin/editors/character/CharacterEditor.hx @@ -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 "\n" + Printer.print(charXML, true); } diff --git a/source/funkin/game/Character.hx b/source/funkin/game/Character.hx index 3b36a362..680e0f81 100644 --- a/source/funkin/game/Character.hx +++ b/source/funkin/game/Character.hx @@ -39,7 +39,7 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset public var icon:String = null; public var iconColor:Null = 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):Access { var char:Character = null; if (character is Character) { diff --git a/source/funkin/game/GameOverSubstate.hx b/source/funkin/game/GameOverSubstate.hx index af36ff29..4d7093c5 100644 --- a/source/funkin/game/GameOverSubstate.hx +++ b/source/funkin/game/GameOverSubstate.hx @@ -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; diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index a4de7511..ce926247 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -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),