fix this weird replay timer bug and also fix friction_high

This commit is contained in:
RandomityGuy 2025-04-18 14:00:59 +05:30
parent 35f3983dcd
commit 6d286c722d
2 changed files with 19 additions and 16 deletions

View file

@ -118,7 +118,11 @@ class DifBuilder {
restitution: 0.5 restitution: 0.5
}, },
"friction_high" => { "friction_high" => {
friction: 1.5, friction: 4.5,
restitution: 0.5
},
"friction_high_shadow" => {
friction: 4.5,
restitution: 0.5 restitution: 0.5
}, },
"friction_ramp_yellow" => { "friction_ramp_yellow" => {
@ -210,10 +214,6 @@ class DifBuilder {
friction: 6, friction: 6,
restitution: 0.3 restitution: 0.3
}, },
"friction_high_shadow" => {
friction: 6,
restitution: 0.3
},
"friction_bouncy" => { "friction_bouncy" => {
friction: 0.2, friction: 0.2,
restitution: 2.0, restitution: 2.0,

View file

@ -52,6 +52,7 @@ class ReplayFrame {
var t = (time - this.time) / (next.time - this.time); var t = (time - this.time) / (next.time - this.time);
var dt = time - this.time; var dt = time - this.time;
var clockDt = next.clockTime - this.clockTime;
var interpFrame = new ReplayFrame(); var interpFrame = new ReplayFrame();
@ -59,18 +60,20 @@ class ReplayFrame {
interpFrame.time = time; interpFrame.time = time;
interpFrame.bonusTime = this.bonusTime; interpFrame.bonusTime = this.bonusTime;
interpFrame.clockTime = this.clockTime; interpFrame.clockTime = this.clockTime;
if (interpFrame.bonusTime != 0 && time >= 3.5) { if (clockDt > 0) {
if (dt <= this.bonusTime) { if (interpFrame.bonusTime != 0 && time >= 3.5) {
interpFrame.bonusTime -= dt; if (dt <= this.bonusTime) {
interpFrame.bonusTime -= dt;
} else {
interpFrame.clockTime += dt - this.bonusTime;
interpFrame.bonusTime = 0;
}
} else { } else {
interpFrame.clockTime += dt - this.bonusTime; if (this.time >= 3.5)
interpFrame.bonusTime = 0; interpFrame.clockTime += dt;
} else if (this.time + dt >= 3.5) {
} else { 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;
} }
} }