diff --git a/source/funkin/data/character/CharacterRegistry.hx b/source/funkin/data/character/CharacterRegistry.hx index 7c10a62692..061ad06f2a 100644 --- a/source/funkin/data/character/CharacterRegistry.hx +++ b/source/funkin/data/character/CharacterRegistry.hx @@ -69,6 +69,7 @@ class CharacterRegistry try { var charData:CharacterData = parseCharacterData(charId); + charData = validateCharacterData(charId, charData); if (charData != null) { trace(' Loaded character data: ${charId}'); diff --git a/source/funkin/ui/debug/char/CharCreatorCharacter.hx b/source/funkin/ui/debug/char/CharCreatorCharacter.hx index 8228608604..99d314a39e 100644 --- a/source/funkin/ui/debug/char/CharCreatorCharacter.hx +++ b/source/funkin/ui/debug/char/CharCreatorCharacter.hx @@ -32,6 +32,7 @@ class CharCreatorCharacter extends Bopper public var holdTimer:Float = 0; public var characterCameraOffsets:Array = [0.0, 0.0]; public var animations:Array = []; + public var deathData:DeathData = null; public var characterFlipX:Bool = false; public var characterScale:Float = 1.0; // character scale to be used in the data, ghosts need one @@ -303,6 +304,11 @@ class CharCreatorCharacter extends Bopper renderType: generatedParams.renderType, healthIcon: healthIcon, animations: animations, + offsets: globalOffsets, + isPixel: isPixel, + cameraOffsets: characterCameraOffsets, + singTime: holdTimer, + death: deathData }; } diff --git a/source/funkin/ui/debug/char/components/dialogs/CharMetadataDialog.hx b/source/funkin/ui/debug/char/components/dialogs/CharMetadataDialog.hx new file mode 100644 index 0000000000..291996fbcd --- /dev/null +++ b/source/funkin/ui/debug/char/components/dialogs/CharMetadataDialog.hx @@ -0,0 +1,143 @@ +package funkin.ui.debug.char.components.dialogs; + +@:xml(' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +') +class CharMetadataDialog extends DefaultPageDialog +{ + override public function new(daPage:CharCreatorGameplayPage, char:CharCreatorCharacter) + { + super(daPage); + + charOffsetsX.pos = char.globalOffsets[0]; + charOffsetsY.pos = char.globalOffsets[1]; + charCamOffsetsX.pos = char.characterCameraOffsets[0]; + charCamOffsetsY.pos = char.characterCameraOffsets[1]; + charScale.pos = char.characterScale; + charHoldTimer.pos = char.holdTimer; + charFlipX.selected = char.characterFlipX; + charIsPixel.selected = char.isPixel; + charHasDeathData.selected = (char.deathData != null); + charDeathBox.disabled = !charHasDeathData.selected; + + charDeathCamOffsetX.pos = char.deathData?.cameraOffsets[0] ?? 0; + charDeathCamOffsetY.pos = char.deathData?.cameraOffsets[1] ?? 0; + charDeathCamZoom.pos = char.deathData?.cameraZoom ?? 1; + charDeathTransDelay.pos = char.deathData?.preTransitionDelay ?? 0; + + // callbaccd + charOffsetsX.onChange = charOffsetsY.onChange = function(_) { + char.globalOffsets = [charOffsetsX.pos, charOffsetsY.pos]; + daPage.updateCharPerStageData(char.characterType); + } + + charCamOffsetsX.onChange = charCamOffsetsY.onChange = function(_) char.characterCameraOffsets = [charCamOffsetsX.pos, charCamOffsetsY.pos]; + + charScale.onChange = function(_) { + char.characterScale = charScale.pos; + daPage.updateCharPerStageData(char.characterType); + } + + charHoldTimer.onChange = function(_) char.holdTimer = charHoldTimer.pos; + + charFlipX.onChange = function(_) { + char.characterFlipX = charFlipX.selected; + daPage.updateCharPerStageData(char.characterType); + } + + charIsPixel.onChange = function(_) { + char.isPixel = charIsPixel.selected; + + char.antialiasing = !char.isPixel; + char.pixelPerfectRender = char.isPixel; + char.pixelPerfectPosition = char.isPixel; + } + + // death + charHasDeathData.onChange = function(_) { + char.deathData = charHasDeathData.selected ? + { + cameraOffsets: [charDeathCamOffsetX.pos, charDeathCamOffsetY.pos], + cameraZoom: charDeathCamZoom.pos, + preTransitionDelay: charDeathTransDelay.pos + } : null; + + charDeathBox.disabled = !charHasDeathData.selected; + } + + charDeathCamOffsetX.onChange = charDeathCamOffsetY.onChange = function(_) { + if (char.deathData != null) char.deathData.cameraOffsets = [charDeathCamOffsetX.pos, charDeathCamOffsetY.pos]; + } + + charDeathCamZoom.onChange = function(_) { + if (char.deathData != null) char.deathData.cameraZoom = charDeathCamZoom.pos; + } + + charDeathTransDelay.onChange = function(_) { + if (char.deathData != null) char.deathData.preTransitionDelay = charDeathTransDelay.pos; + } + } +} diff --git a/source/funkin/ui/debug/char/pages/CharCreatorGameplayPage.hx b/source/funkin/ui/debug/char/pages/CharCreatorGameplayPage.hx index 07c0cf4aa0..e3912a793c 100644 --- a/source/funkin/ui/debug/char/pages/CharCreatorGameplayPage.hx +++ b/source/funkin/ui/debug/char/pages/CharCreatorGameplayPage.hx @@ -56,6 +56,7 @@ class CharCreatorGameplayPage extends CharCreatorDefaultPage updateCharPerStageData(); dialogMap.set(Animation, new AddAnimDialog(this, currentCharacter)); + dialogMap.set(Data, new CharMetadataDialog(this, currentCharacter)); dialogMap.set(Ghost, new GhostSettingsDialog(this)); dialogMap.set(Health, new HealthIconDialog(this, currentCharacter)); @@ -147,12 +148,14 @@ class CharCreatorGameplayPage extends CharCreatorDefaultPage } var checkAnim:MenuCheckBox = new MenuCheckBox(); + var checkData:MenuCheckBox = new MenuCheckBox(); var checkHealth:MenuCheckBox = new MenuCheckBox(); var checkGhost:MenuCheckBox = new MenuCheckBox(); override public function fillUpPageSettings(item:haxe.ui.containers.menus.Menu) { item.addComponent(checkAnim); + item.addComponent(checkData); item.addComponent(checkHealth); item.addComponent(checkGhost); } @@ -246,6 +249,7 @@ class CharCreatorGameplayPage extends CharCreatorDefaultPage stageDropdown.dataSource.add({text: aught}); checkAnim.text = "Animation Data"; + checkData.text = "Character Metadata"; checkHealth.text = "Health Icon Data"; checkGhost.text = "Ghost Settings"; @@ -299,6 +303,9 @@ class CharCreatorGameplayPage extends CharCreatorDefaultPage checkAnim.onChange = function(_) { dialogMap[Animation].hidden = !checkAnim.selected; } + checkData.onChange = function(_) { + dialogMap[Data].hidden = !checkData.selected; + } checkHealth.onChange = function(_) { dialogMap[Health].hidden = !checkHealth.selected; } diff --git a/source/funkin/ui/debug/char/util/CharacterUtil.hx b/source/funkin/ui/debug/char/util/CharacterUtil.hx index be5d46e622..4f2426f515 100644 --- a/source/funkin/ui/debug/char/util/CharacterUtil.hx +++ b/source/funkin/ui/debug/char/util/CharacterUtil.hx @@ -58,7 +58,11 @@ class CharacterUtil default: // nothing, what the fuck are you even doing } + char.characterCameraOffsets = other.characterCameraOffsets.copy(); char.globalOffsets = other.globalOffsets.copy(); + char.characterFlipX = other.characterFlipX; + char.characterScale = other.characterScale; + char.deathData = other.deathData; for (anim in other.animations) { @@ -109,9 +113,12 @@ class CharacterUtil default: // nuthin } + char.characterCameraOffsets = data.cameraOffsets ?? [0, 0]; char.globalOffsets = data.offsets ?? [0, 0]; char.characterFlipX = data.flipX ?? false; char.characterScale = data.scale ?? 1; + char.deathData = data.death; + char.holdTimer = data.singTime; for (anim in data.animations) {