From 6d286c722d80579fd169a0021f9d36c32cbcc050 Mon Sep 17 00:00:00 2001 From: RandomityGuy <31925790+RandomityGuy@users.noreply.github.com> Date: Fri, 18 Apr 2025 14:00:59 +0530 Subject: [PATCH] fix this weird replay timer bug and also fix friction_high --- src/DifBuilder.hx | 10 +++++----- src/Replay.hx | 25 ++++++++++++++----------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/DifBuilder.hx b/src/DifBuilder.hx index 162cd9ee..ee46ba46 100644 --- a/src/DifBuilder.hx +++ b/src/DifBuilder.hx @@ -118,7 +118,11 @@ class DifBuilder { restitution: 0.5 }, "friction_high" => { - friction: 1.5, + friction: 4.5, + restitution: 0.5 + }, + "friction_high_shadow" => { + friction: 4.5, restitution: 0.5 }, "friction_ramp_yellow" => { @@ -210,10 +214,6 @@ class DifBuilder { friction: 6, restitution: 0.3 }, - "friction_high_shadow" => { - friction: 6, - restitution: 0.3 - }, "friction_bouncy" => { friction: 0.2, restitution: 2.0, diff --git a/src/Replay.hx b/src/Replay.hx index c97b7851..fc2ccb1a 100644 --- a/src/Replay.hx +++ b/src/Replay.hx @@ -52,6 +52,7 @@ class ReplayFrame { var t = (time - this.time) / (next.time - this.time); var dt = time - this.time; + var clockDt = next.clockTime - this.clockTime; var interpFrame = new ReplayFrame(); @@ -59,18 +60,20 @@ class ReplayFrame { interpFrame.time = time; interpFrame.bonusTime = this.bonusTime; interpFrame.clockTime = this.clockTime; - if (interpFrame.bonusTime != 0 && time >= 3.5) { - if (dt <= this.bonusTime) { - interpFrame.bonusTime -= dt; + if (clockDt > 0) { + if (interpFrame.bonusTime != 0 && time >= 3.5) { + if (dt <= this.bonusTime) { + interpFrame.bonusTime -= dt; + } else { + interpFrame.clockTime += dt - this.bonusTime; + interpFrame.bonusTime = 0; + } } else { - interpFrame.clockTime += dt - this.bonusTime; - interpFrame.bonusTime = 0; - } - } else { - if (this.time >= 3.5) - interpFrame.clockTime += dt; - else if (this.time + dt >= 3.5) { - interpFrame.clockTime += (this.time + dt) - 3.5; + if (this.time >= 3.5) + interpFrame.clockTime += dt; + else if (this.time + dt >= 3.5) { + interpFrame.clockTime += (this.time + dt) - 3.5; + } } }