mirror of
https://github.com/bryanthaboi/gen1recomp
synced 2026-10-09 18:07:27 -04:00
updates to online
This commit is contained in:
@@ -67,6 +67,7 @@ function FixedStep:init(callback)
|
||||
self.suppressCatchup = false
|
||||
self.dtHistory, self.dtSum = nil, 0
|
||||
self.phasedFor = nil
|
||||
self.frameBreak = false
|
||||
end
|
||||
|
||||
FixedStep.maxAccum = MAX_ACCUM
|
||||
@@ -102,11 +103,13 @@ function FixedStep:update(dt, speed)
|
||||
-- called (the hitch itself already ran inside the current step); absorb
|
||||
-- that one frame as a single step instead of the normal accumulator so
|
||||
-- the burst it would otherwise release doesn't play out as a slide.
|
||||
self.frameBreak = false
|
||||
if self.suppressCatchup then
|
||||
self.suppressCatchup = false
|
||||
self.dtHistory, self.dtSum = nil, 0
|
||||
self.accum = self.STEP * RESEED_PHASE
|
||||
self.callback(self.STEP)
|
||||
self.frameBreak = false
|
||||
return
|
||||
end
|
||||
-- Snap/smooth against the wall-clock frame dt first. Game speed is a
|
||||
@@ -155,6 +158,11 @@ function FixedStep:update(dt, speed)
|
||||
while self.accum >= self.STEP - STEP_EPS do
|
||||
self.accum = self.accum - self.STEP
|
||||
self.callback(self.STEP)
|
||||
if self.frameBreak then
|
||||
self.frameBreak = false
|
||||
self.accum = self.accum % self.STEP
|
||||
break
|
||||
end
|
||||
if deadline and self.accum >= self.STEP - STEP_EPS and clock() >= deadline then
|
||||
self.accum = self.accum % self.STEP
|
||||
break
|
||||
@@ -162,6 +170,10 @@ function FixedStep:update(dt, speed)
|
||||
end
|
||||
end
|
||||
|
||||
function FixedStep:endFrame()
|
||||
self.frameBreak = true
|
||||
end
|
||||
|
||||
-- Drop any pending catch-up steps and arm the one-frame clamp above. A
|
||||
-- hitch inside one logic step (map seam setMap / song start) makes the
|
||||
-- next real-time dt huge; without this the while-loop above would advance
|
||||
|
||||
Reference in New Issue
Block a user