From b97f99cbafd878c7e9dd70a017422c4438a27691 Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Thu, 4 Feb 2021 21:43:31 -0700 Subject: [PATCH] Fix Lexy loop to update wiring thrice per tic, not twice --- js/game.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/js/game.js b/js/game.js index 26f89f3..3885a3c 100644 --- a/js/game.js +++ b/js/game.js @@ -884,6 +884,8 @@ export class Level extends LevelInterface { this._swap_players(); + this._do_wire_phase(); + this._do_wire_phase(); this._do_wire_phase(); // TODO should this also happen three times? this._do_static_phase(); @@ -894,15 +896,14 @@ export class Level extends LevelInterface { // Lexy-style loop, similar to Lynx but with some things split out into separate phases _begin_tic_lexy() { // CC2 wiring runs every frame, not every tic, so we need to do it three times, but dealing - // with it is delicate. We want the result of a button press to draw, but not last longer - // than intended, so we only want one update between the end of the cooldown pass and the - // end of the tic. That means the other two have to go here. When a level starts, there - // are only two wiring updates before everything gets its first chance to move, so we skip - // the very first one here. - if (this.tic_counter !== 0) { + // with it is delicate. Ideally the player would see the current state of the game when + // they move, so all the wire updates should be at the end, BUT under CC2 rules, there are + // two wire updates at the start of the game before any movement can actually happen. + // Do those here, then otherwise do three wire phases when finishing. + if (this.tic_counter === 0) { + this._do_wire_phase(); this._do_wire_phase(); } - this._do_wire_phase(); } // Lynx-style loop: everyone decides, then everyone moves/cools.