diff --git a/source/funkin/editors/character/CharacterAnimsWindow.hx b/source/funkin/editors/character/CharacterAnimsWindow.hx index d2f2de04..2cb4f9c6 100644 --- a/source/funkin/editors/character/CharacterAnimsWindow.hx +++ b/source/funkin/editors/character/CharacterAnimsWindow.hx @@ -114,8 +114,7 @@ class CharacterAnimsWindow extends UIButtonList { } public function findValid():Null { - for (button in buttons) - if (button.valid) return button.anim; + for (button in buttons) if (button.valid) return button.anim; return null; } } \ No newline at end of file diff --git a/source/funkin/editors/character/CharacterEditor.hx b/source/funkin/editors/character/CharacterEditor.hx index a207a3e2..b90abb21 100644 --- a/source/funkin/editors/character/CharacterEditor.hx +++ b/source/funkin/editors/character/CharacterEditor.hx @@ -672,7 +672,7 @@ class CharacterEditor extends UIState { function _animation_play(_) { if (character.getNameList().length != 0) - playAnimation(character.getAnimName()); + playAnimation(characterFakeAnim); } function _animation_stop(_) { @@ -698,12 +698,11 @@ class CharacterEditor extends UIState { // The animation thats playing regardless if its valid or not public var characterFakeAnim:String = ""; - public function playAnimation(anim:String) { + public function playAnimation(anim:String) @:privateAccess { characterFakeAnim = anim; if (characterAnimsWindow.animButtons[anim] != null && characterAnimsWindow.animButtons[anim].valid) { character.playAnim(anim, true); - character.colorTransform.redMultiplier = character.colorTransform.greenMultiplier = character.colorTransform.blueMultiplier = character.colorTransform.alphaMultiplier = 1; - character.colorTransform.redOffset = character.colorTransform.greenOffset = character.colorTransform.blueOffset = character.colorTransform.alphaOffset = 0; + character.colorTransform.__identity(); } else { var validAnimation:String = characterAnimsWindow.findValid(); if (validAnimation != null) character.playAnim(validAnimation, true); diff --git a/source/funkin/editors/character/CharacterGhost.hx b/source/funkin/editors/character/CharacterGhost.hx index bb9509b9..1ef69bec 100644 --- a/source/funkin/editors/character/CharacterGhost.hx +++ b/source/funkin/editors/character/CharacterGhost.hx @@ -6,13 +6,35 @@ import funkin.game.Character; class CharacterGhost extends Character { public var ghosts:Array = []; - public override function draw() { + public override function draw() @:privateAccess { ghostDraw = true; - if (animateAtlas != null) {} + var wasInvalidFrame:Bool = !colorTransform.__isDefault(false); + colorTransform.__identity(); + + if (animateAtlas != null) { + var ogFrame:Int = animateAtlas.anim.curFrame; + var oldTick:Float = animateAtlas.anim._tick; + var oldPlaying:Bool = animateAtlas.anim.isPlaying; + + for (anim in ghosts) { + animateAtlas.anim.play(anim, true, false, 0); + setAnimOffset(anim); + + alpha = 0.4; color = 0xFFAEAEAE; + super.draw(); + } + + if (ghosts.length > 0) { + trace(atlasPlayingAnim, ogFrame, oldTick, oldPlaying); + animateAtlas.anim.play(atlasPlayingAnim, true, false, ogFrame); + animateAtlas.anim._tick = oldTick; + animateAtlas.anim.isPlaying = oldPlaying; + } + } else { for (anim in ghosts) @:privateAccess { - alpha = 0.4; color = 0xFFAEAEAE; + alpha = 0.4; color = 0xFFAEAEAE; var flxanim:FlxAnimation = animation._animations.get(anim); var frameIndex:Int = flxanim.frames.getDefault([0])[0]; @@ -22,12 +44,18 @@ class CharacterGhost extends Character { super.draw(); } - frame = frames.frames[animation.frameIndex]; - setAnimOffset(animation.name); - alpha = 1; color = 0xFFFFFFFF; + if (ghosts.length > 0) + frame = frames.frames[animation.frameIndex]; } ghostDraw = false; - + + alpha = 1; color = 0xFFFFFFFF; + if (wasInvalidFrame) { + frameOffset.set(0, 0); + offset.set(globalOffset.x * (isPlayer != playerOffsets ? 1 : -1), -globalOffset.y); + colorTransform.color = 0xFFEF0202; + } else + setAnimOffset(animateAtlas != null ? atlasPlayingAnim : animation.name); super.draw(); }