From 2b087dc96ef31a5b76a7225972bd0c35d33c00a9 Mon Sep 17 00:00:00 2001 From: TheZoroForce240 <86524550+TheZoroForce240@users.noreply.github.com> Date: Mon, 5 May 2025 17:53:43 +0100 Subject: [PATCH] floating point fixes (hopefully) --- source/funkin/backend/system/Conductor.hx | 6 +++--- source/funkin/editors/charter/CharterEventTypeSelection.hx | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/funkin/backend/system/Conductor.hx b/source/funkin/backend/system/Conductor.hx index 01281ef8..10bc8a42 100644 --- a/source/funkin/backend/system/Conductor.hx +++ b/source/funkin/backend/system/Conductor.hx @@ -203,7 +203,7 @@ final class Conductor var events:Array = []; for (e in song.events) if (e.params != null && (e.name == "BPM Change" || e.name == "Time Signature Change" || e.name == "Continuous BPM Change")) events.push(e); events.sort(function(a, b) { - if (a.time == b.time) { + if (MathUtil.equal(a.time, b.time)) { if (a.name == "Continuous BPM Change") return 1; if (b.name == "Continuous BPM Change") return -1; } @@ -217,7 +217,7 @@ final class Conductor private static function mapEvent(e:ChartEvent, curChange:BPMChangeEvent) { var name = e.name, params = e.params, time = e.time; - if (curChange.continuous && time < curChange.endSongTime) { //ensure that you cannot place any conductor events during a continuous change + if (curChange.continuous && MathUtil.lessThan(time, curChange.endSongTime)) { //ensure that you cannot place any conductor events during a continuous change invalidEvents.push(e); Logs.trace('Invalid Conductor event "${e.name}" at ${e.time} (Intersecting continuous change!)', WARNING); return curChange; @@ -268,7 +268,7 @@ final class Conductor for(event in Charter.instance.eventsGroup.members) { event.events.sort(function(a, b) { - if (a.time == b.time) { + if (MathUtil.equal(a.time, b.time)) { if (a.name == "Continuous BPM Change") return 1; if (b.name == "Continuous BPM Change") return -1; } diff --git a/source/funkin/editors/charter/CharterEventTypeSelection.hx b/source/funkin/editors/charter/CharterEventTypeSelection.hx index 0e836e77..1b1754c6 100644 --- a/source/funkin/editors/charter/CharterEventTypeSelection.hx +++ b/source/funkin/editors/charter/CharterEventTypeSelection.hx @@ -38,8 +38,8 @@ class CharterEventTypeSelection extends UISubstateWindow { var disableConductorEvents:Bool = false; var disableOnlyContinuousChanges:Bool = false; for (change in Conductor.bpmChangeMap) { - if (change.continuous && eventStepTime >= change.stepTime && eventStepTime < change.endStepTime) { - disableOnlyContinuousChanges = eventStepTime == change.stepTime; //allow time sig and instant bpm changes on the same event + if (change.continuous && MathUtil.greaterThanEqual(eventStepTime, change.stepTime) && MathUtil.lessThan(eventStepTime, change.endStepTime)) { + disableOnlyContinuousChanges = MathUtil.equal(eventStepTime, change.stepTime); //allow time sig and instant bpm changes on the same event disableConductorEvents = !disableOnlyContinuousChanges; } }