From 72a44429affa8682e9250a29f70302498dcbdb42 Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Sun, 20 Sep 2020 00:02:08 -0600 Subject: [PATCH] Animate CC2 force floors --- js/tileset.js | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/js/tileset.js b/js/tileset.js index a8c9849..0759022 100644 --- a/js/tileset.js +++ b/js/tileset.js @@ -261,10 +261,22 @@ export const CC2_TILESET_LAYOUT = { west: [15, 18], }, - force_floor_n: [[0, 19], [0, 20]], - force_floor_e: [[2, 19], [3, 19]], - force_floor_s: [[1, 19], [1, 20]], - force_floor_w: [[2, 20], [3, 20]], + force_floor_n: { + base: [0, 19], + animate_height: 1, + }, + force_floor_e: { + base: [3, 19], + animate_width: -1, + }, + force_floor_s: { + base: [1, 20], + animate_height: -1, + }, + force_floor_w: { + base: [2, 20], + animate_width: 1, + }, teleport_green: [[4, 19], [5, 19], [6, 19], [7, 19]], teleport_yellow: [[8, 19], [9, 19], [10, 19], [11, 19]], transmogrifier: [[12, 19], [13, 19], [14, 19], [15, 19]], @@ -642,6 +654,24 @@ export class Tileset { } } } + else if (drawspec.animate_width) { + // Force floors animate their... cutout, I guess? + let [x, y] = drawspec.base; + let duration = 3 * this.animation_slowdown; + x += drawspec.animate_width * (tic % duration / duration); + // Round to tile width + x = Math.floor(x * this.size_x + 0.5) / this.size_x; + coords = [x, y]; + } + else if (drawspec.animate_height) { + // Same, but along the other axis + let [x, y] = drawspec.base; + let duration = 3 * this.animation_slowdown; + y += drawspec.animate_height * (tic % duration / duration); + // Round to tile height + y = Math.floor(y * this.size_y + 0.5) / this.size_y; + coords = [x, y]; + } // Apply custom per-type visual states if (TILE_TYPES[name].visual_state) {