mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-23 19:32:03 -04:00
Fixed the surface to not restore state until it's done dropping frames.
This commit is contained in:
parent
332f4700f6
commit
b89a6c41a7
1 changed files with 10 additions and 6 deletions
|
@ -177,6 +177,7 @@ module.exports = Surface = class Surface extends CocoClass
|
||||||
oldFrame = @currentFrame
|
oldFrame = @currentFrame
|
||||||
oldWorldFrame = Math.floor oldFrame
|
oldWorldFrame = Math.floor oldFrame
|
||||||
lastFrame = @world.frames.length - 1
|
lastFrame = @world.frames.length - 1
|
||||||
|
framesDropped = 0
|
||||||
while true
|
while true
|
||||||
Dropper.tick()
|
Dropper.tick()
|
||||||
@trailmaster.tick() if @trailmaster
|
@trailmaster.tick() if @trailmaster
|
||||||
|
@ -191,12 +192,15 @@ module.exports = Surface = class Surface extends CocoClass
|
||||||
@currentFrame += advanceBy
|
@currentFrame += advanceBy
|
||||||
@currentFrame = Math.min @currentFrame, lastFrame
|
@currentFrame = Math.min @currentFrame, lastFrame
|
||||||
newWorldFrame = Math.floor @currentFrame
|
newWorldFrame = Math.floor @currentFrame
|
||||||
worldFrameAdvanced = newWorldFrame isnt oldWorldFrame
|
if Dropper.drop()
|
||||||
if worldFrameAdvanced
|
framesDropped += 1
|
||||||
# Only restore world state when it will correspond to an integer WorldFrame, not interpolated frame.
|
else
|
||||||
@restoreWorldState()
|
worldFrameAdvanced = newWorldFrame isnt oldWorldFrame
|
||||||
oldWorldFrame = newWorldFrame
|
if worldFrameAdvanced
|
||||||
break unless Dropper.drop()
|
# Only restore world state when it will correspond to an integer WorldFrame, not interpolated frame.
|
||||||
|
@restoreWorldState()
|
||||||
|
oldWorldFrame = newWorldFrame
|
||||||
|
break
|
||||||
if frameAdvanced and not worldFrameAdvanced
|
if frameAdvanced and not worldFrameAdvanced
|
||||||
# We didn't end the above loop on an integer frame, so do the world state update.
|
# We didn't end the above loop on an integer frame, so do the world state update.
|
||||||
@restoreWorldState()
|
@restoreWorldState()
|
||||||
|
|
Loading…
Add table
Reference in a new issue