mirror of
https://github.com/bryanthaboi/gen1recomp
synced 2026-10-04 16:28:01 -04:00
CLOSES #455, CLOSES #487, CLOSES #501, CLOSES #540, CLOSES #585, CLOSES #591, CLOSES #593, CLOSES #595, CLOSES #597, CLOSES #599, CLOSES #600, CLOSES #606, CLOSES #607, CLOSES #610, CLOSES #613, CLOSES #616, CLOSES #620, CLOSES #626, CLOSES #632, CLOSES #633, CLOSES #647
This commit is contained in:
+13
-1
@@ -7,6 +7,18 @@ local FixedStep = {}
|
||||
FixedStep.STEP = 1 / 60
|
||||
local MAX_ACCUM = 0.25 -- avoid spiral of death after a stall
|
||||
|
||||
-- Phase the accumulator is re-seeded with once an absorbed hitch frame has
|
||||
-- been paid for. Half a step is the balanced point: a frame has to come in
|
||||
-- ~8ms short before it drops a step and ~8ms long before it doubles one up.
|
||||
-- Zero -- what this used to leave behind -- has no margin at all on the long
|
||||
-- side, so the accumulator settles a hair BELOW one step and parks there, and
|
||||
-- ordinary sub-millisecond vsync wobble then flips it between 0 and 2 steps
|
||||
-- every few frames for the rest of the session. That is why pacing stayed
|
||||
-- visibly broken after a route/city seam and nowhere else: crossConnection in
|
||||
-- src/world/OverworldController.lua is the only caller of discardCatchup, and
|
||||
-- warps go through Transition instead (issue #487).
|
||||
local RESEED_PHASE = 0.5
|
||||
|
||||
function FixedStep:init(callback)
|
||||
self.accum = 0
|
||||
self.callback = callback
|
||||
@@ -27,7 +39,7 @@ function FixedStep:update(dt)
|
||||
-- the burst it would otherwise release doesn't play out as a slide.
|
||||
if self.suppressCatchup then
|
||||
self.suppressCatchup = false
|
||||
self.accum = 0
|
||||
self.accum = self.STEP * RESEED_PHASE
|
||||
self.callback(self.STEP)
|
||||
return
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user