From a5c208f4d311a25f637e7ae4ad58529e138218d8 Mon Sep 17 00:00:00 2001 From: Ralty <78720179+Raltyro@users.noreply.github.com> Date: Sat, 5 Jul 2025 18:20:21 +0700 Subject: [PATCH] Try to fix the characters dancing fast? --- source/funkin/backend/FunkinSprite.hx | 5 +++-- source/funkin/game/Character.hx | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/source/funkin/backend/FunkinSprite.hx b/source/funkin/backend/FunkinSprite.hx index 2f999e0d..d8e2af50 100644 --- a/source/funkin/backend/FunkinSprite.hx +++ b/source/funkin/backend/FunkinSprite.hx @@ -15,6 +15,7 @@ import flixel.math.FlxRect; import flixel.math.FlxPoint; import flixel.util.typeLimit.OneOfTwo; import funkin.backend.system.interfaces.IBeatReceiver; +import funkin.backend.system.Conductor; enum abstract XMLAnimType(Int) { @@ -140,9 +141,9 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I private var countedBeat = 0; public function beatHit(curBeat:Int) { - if (beatAnims.length > 0 && (curBeat + beatOffset) % beatInterval == 0) + if (Conductor.curBeat != curBeat || (skipNegativeBeats && curBeat < 0)) return; + if (beatAnims.length > 0 && (curBeat + beatOffset - Conductor.lastBeatChange) % (beatInterval * CoolUtil.minInt(Math.floor(4 / Conductor.stepsPerBeat), 1)) == 0) { - if(skipNegativeBeats && curBeat < 0) return; // TODO: find a solution without countedBeat var anim = beatAnims[FlxMath.wrap(countedBeat++, 0, beatAnims.length - 1)]; if (anim.name != null && anim.name != "null" && anim.name != "none") diff --git a/source/funkin/game/Character.hx b/source/funkin/game/Character.hx index 456dcae3..5d9643ce 100644 --- a/source/funkin/game/Character.hx +++ b/source/funkin/game/Character.hx @@ -167,13 +167,14 @@ class Character extends FunkinSprite implements IBeatReceiver implements IOffset } /** - * Whenever the character should dance on beat or not. Set to false for `gf`, since the dance animation is automatically handled by PlayState. + * Whenever the character should dance on beat or not. */ public var danceOnBeat:Bool = true; public override function beatHit(curBeat:Int) { scripts.call("beatHit", [curBeat]); - if (danceOnBeat && (curBeat + beatOffset) % beatInterval == 0 && !__lockAnimThisFrame) + if (Conductor.curBeat != curBeat || (skipNegativeBeats && curBeat < 0)) return; + if (danceOnBeat && (curBeat + beatOffset - Conductor.lastBeatChange) % (beatInterval * CoolUtil.minInt(Math.floor(4 / Conductor.stepsPerBeat), 1)) == 0 && !__lockAnimThisFrame) tryDance(); }