working on fixing camera beat timing, only issue is time sig changes on curBeat 0 now

This commit is contained in:
NyxieFemboy
2025-03-04 01:39:06 -05:00
parent c81aaf171a
commit 098f747462
+14 -4
View File
@@ -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;
}