From 535e702bc2449188bbff8248baaf0ab78a0f7ab5 Mon Sep 17 00:00:00 2001 From: Jurta <29545237+Jurtaa@users.noreply.github.com> Date: Tue, 18 Nov 2025 00:51:30 +0000 Subject: [PATCH] Expand animation swapping function to support all variants (#822) * Expanding animation swapping function to support all variants * More straight-forward variable names, switching to string interpolation --- source/funkin/game/Character.hx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/source/funkin/game/Character.hx b/source/funkin/game/Character.hx index bd489e61..76383906 100644 --- a/source/funkin/game/Character.hx +++ b/source/funkin/game/Character.hx @@ -108,11 +108,19 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset } public function swapLeftRightAnimations() { - CoolUtil.switchAnimFrames(animation.getByName('singRIGHT'), animation.getByName('singLEFT')); - CoolUtil.switchAnimFrames(animation.getByName('singRIGHTmiss'), animation.getByName('singLEFTmiss')); + // Find all "alternate" poses + var variants = ['']; // Pre-fill with empty string + var pose = 'singRIGHT'; // Any "sing" animation string could work, really + for (a in xml.nodes.anim) { + if (a.att.name != pose && StringTools.startsWith(a.att.name, pose)) { + variants.push(a.att.name.substring(pose.length)); + } + } - switchOffset('singLEFT', 'singRIGHT'); - switchOffset('singLEFTmiss', 'singRIGHTmiss'); + for (i in variants) { + CoolUtil.switchAnimFrames(animation.getByName('singRIGHT$i'), animation.getByName('singLEFT$i')); + switchOffset('singLEFT$i', 'singRIGHT$i'); + } __swappedLeftRightAnims = true; }