Fix loading of initial RFF direction from Tile World solutions

This commit is contained in:
Eevee (Evelyn Woods) 2021-03-08 21:33:03 -07:00
parent dd10236b22
commit 2dcd73d44a

View File

@ -1,4 +1,4 @@
import { INPUT_BITS } from './defs.js'; import { DIRECTIONS, INPUT_BITS } from './defs.js';
import * as format_base from './format-base.js'; import * as format_base from './format-base.js';
@ -65,12 +65,16 @@ export function parse_solutions(bytes) {
else { else {
// Long record // Long record
let number = view.getUint16(p, true); let number = view.getUint16(p, true);
// Password is 25 but we don't care // 2-5: password, don't care
let flags = bytes[p + 6]; // 6: flags, always zero
let initial_state = bytes[p + 7]; let initial_state = bytes[p + 7];
let step_parity = initial_state >> 3; let step_parity = initial_state >> 3;
let initial_rff = ['north', 'west', 'south', 'east'][initial_state & 0x7]; let initial_rff = ['north', 'west', 'south', 'east'][initial_state & 0x7];
let initial_rng = view.getUint32(p + 8, true); // FIXME how is this four bytes?? lynx rng doesn't even have four bytes of STATE // In CC2 replays, the initial RFF direction is the one you'll actually start with;
// however, in Lynx, the direction is rotated BEFORE it takes effect, so to compensate
// we have to rotate this once ahead of time
initial_rff = DIRECTIONS[initial_rff].right;
let initial_rng = view.getUint32(p + 8, true);
let total_duration = view.getUint32(p + 12, true); let total_duration = view.getUint32(p + 12, true);
// TODO split this off though // TODO split this off though