From 5da3a0f47357c071a2cc16b3ce3405f62d6fa742 Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Thu, 10 Sep 2020 18:22:50 -0600 Subject: [PATCH] Load random force floors from c2m; read the initial direction from replays --- js/format-c2m.js | 7 +++++-- js/main.js | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/js/format-c2m.js b/js/format-c2m.js index da4dd46..8847238 100644 --- a/js/format-c2m.js +++ b/js/format-c2m.js @@ -17,7 +17,10 @@ class CC2Demo { this.bytes = new Uint8Array(buf); // byte 0 is unknown, always 0? - this.force_floor_seed = this.bytes[1]; + // Force floor seed can apparently be anything; my best guess, based on the Desert Oasis + // replay, is that it's just incremented and allowed to overflow, so taking it mod 4 gives + // the correct starting direction + this.initial_force_floor_direction = ['north', 'east', 'south', 'west'][this.bytes[1] % 4]; this.blob_seed = this.bytes[2]; } @@ -132,7 +135,7 @@ const TILE_ENCODING = { 0x43: 'cloner', //0x44: Clone machine : Modifier required, see below 0x45: 'hint', - //0x46: 'force_floor_all', + 0x46: 'force_floor_all', // 0x47: 'button_gray', 0x48: ['swivel_sw', 'swivel_floor'], 0x49: ['swivel_nw', 'swivel_floor'], diff --git a/js/main.js b/js/main.js index 46e5167..f3511f8 100644 --- a/js/main.js +++ b/js/main.js @@ -383,6 +383,7 @@ class Player extends PrimaryView { play_demo() { this.demo_faucet = this.level.stored_level.demo[Symbol.iterator](); this.restart_level(); + this.level.force_floor_direction = this.level.stored_level.demo.initial_force_floor_direction; // FIXME should probably start playback on first real input this.set_state('playing'); }