From 3e7390ffc02ca92a7aaa9233cdebf874c22cde34 Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Thu, 3 Jun 2021 02:03:25 -0600 Subject: [PATCH] Fix rendering of actors zooming through traps in Lynx --- js/tileset.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/js/tileset.js b/js/tileset.js index 2530d89..b00d0c6 100644 --- a/js/tileset.js +++ b/js/tileset.js @@ -2168,6 +2168,12 @@ export class Tileset { // Rounding smooths out float error (assuming the framerate never exceeds 1000) let chunk_size = 1 / duration; let segment = Math.floor(Math.round(start_time * 1000) / 1000 % chunk_size); + // It's possible for the segment to be negative here in very obscure cases (notably, + // if an actor in Lynx mode starts out on an open trap, it'll be artificially + // accelerated and will appear to have started animating before the first tic) + if (segment < 0) { + segment += chunk_size; + } p = (p + segment) * duration; } else if (duration > 1) {