lexys-labyrinth/js/format-util.js
Eevee (Evelyn Woods) 9b873764fb Shim around several compat issues that affect CCLP levels
- CCLP1 #81 requires pushing blocks off of blue walls, which is
  impossible in CC2 but allowed in TW Lynx (unclear if this is a lynx
  behavior or a tw bug)

- CCLP1 #89 has a tank start on a recessed wall and drive off of it,
  expecting the recessed wall to be left alone, but under CC2 rules it
  becomes a wall; such walls are now automatically converted to a new
  tile, the "doubly recessed wall", which restores the expected behavior
  without changing how recessed walls work in general

- CCLP4 #135 expects pressing a blue button to not affect blue tanks
  that are currently in mid-slide

In addition, the behavior of blue buttons now matches the Lynx/Steam
behavior: the press is stored as a flag and queued until the tank is
next able to move.
2020-10-01 03:08:25 -06:00

55 lines
1.3 KiB
JavaScript

export function string_from_buffer_ascii(buf) {
return String.fromCharCode.apply(null, new Uint8Array(buf));
}
export class StoredCell extends Array {
}
export class StoredLevel {
constructor(number) {
// TODO still not sure this belongs here
this.number = number; // one-based
this.title = '';
this.password = null;
this.hint = '';
this.chips_required = 0;
this.time_limit = 0;
this.viewport_size = 9;
this.extra_chunks = [];
this.use_cc1_boots = false;
this.use_ccl_compat = false;
this.size_x = 0;
this.size_y = 0;
this.linear_cells = [];
// Maps of button positions to trap/cloner positions, as scalar indexes
// in the linear cell list
// TODO merge these imo
this.has_custom_connections = false;
this.custom_trap_wiring = {};
this.custom_cloner_wiring = {};
// New LL feature: custom camera regions, as lists of {x, y, width, height}
this.camera_regions = [];
}
scalar_to_coords(n) {
return [n % this.size_x, Math.floor(n / this.size_x)];
}
coords_to_scalar(x, y) {
return x + y * this.size_x;
}
check() {
}
}
export class StoredGame {
constructor(identifier) {
this.identifier = identifier;
this.levels = [];
}
}