From 098f7474622b3ffd67ab97fea07067d177a2fdc5 Mon Sep 17 00:00:00 2001 From: NyxieFemboy <132237065+SenDoesStuff@users.noreply.github.com> Date: Tue, 4 Mar 2025 01:39:06 -0500 Subject: [PATCH] working on fixing camera beat timing, only issue is time sig changes on curBeat 0 now --- source/funkin/game/PlayState.hx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index e26e2e3a..4c9834ae 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -232,6 +232,14 @@ class PlayState extends MusicBeatState * How strong the cam zooms should be (defaults to 1) */ public var camZoomingStrength:Float = 1; + /** + * Number of Beats since the last Time Signature Change + */ + public var beatsSinceChange:Float = 0; + /** + * The curBeat position of the last Time Signature Change that occured + */ + public var lastTimeSigBeat:Float = 0; /** * Maximum amount of zoom for the camera. */ @@ -1405,7 +1413,9 @@ class PlayState extends MusicBeatState if (strumLines.members[event.params[0]] != null && strumLines.members[event.params[0]].characters != null) for (char in strumLines.members[event.params[0]].characters) if (char != null) char.playAnim(event.params[1], event.params[2], null); - case "Time Signature Change": // automatically handled by conductor + case "Time Signature Change": + lastTimeSigBeat = Conductor.curBeat; + // the rest is automatically handled by conductor case "Unknown": // nothing } } @@ -1817,10 +1827,10 @@ class PlayState extends MusicBeatState override function beatHit(curBeat:Int) { super.beatHit(curBeat); + + beatsSinceChange = curBeat - lastTimeSigBeat; - if (camZoomingInterval < 1) camZoomingInterval = 1; - if (Options.camZoomOnBeat && camZooming && FlxG.camera.zoom < maxCamZoom && curBeat % camZoomingInterval == 0) - { + if (Options.camZoomOnBeat && camZooming && FlxG.camera.zoom < maxCamZoom && beatsSinceChange % camZoomingInterval == 0) { FlxG.camera.zoom += 0.015 * camZoomingStrength; camHUD.zoom += 0.03 * camZoomingStrength; }