Correctly identify DAT files; don't render editor when not in use
This commit is contained in:
parent
bd526059f7
commit
b01601fab6
13
js/main.js
13
js/main.js
@ -897,14 +897,17 @@ class PrimaryView {
|
|||||||
constructor(conductor, root) {
|
constructor(conductor, root) {
|
||||||
this.conductor = conductor;
|
this.conductor = conductor;
|
||||||
this.root = root;
|
this.root = root;
|
||||||
|
this.active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
activate() {
|
activate() {
|
||||||
this.root.removeAttribute('hidden');
|
this.root.removeAttribute('hidden');
|
||||||
|
this.active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
deactivate() {
|
deactivate() {
|
||||||
this.root.setAttribute('hidden', '');
|
this.root.setAttribute('hidden', '');
|
||||||
|
this.active = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1496,6 +1499,11 @@ class Editor extends PrimaryView {
|
|||||||
this.select_palette('floor');
|
this.select_palette('floor');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
activate() {
|
||||||
|
super.activate();
|
||||||
|
this.renderer.draw();
|
||||||
|
}
|
||||||
|
|
||||||
load_game(stored_game) {
|
load_game(stored_game) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1515,8 +1523,10 @@ class Editor extends PrimaryView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.renderer.set_level(stored_level);
|
this.renderer.set_level(stored_level);
|
||||||
|
if (this.active) {
|
||||||
this.renderer.draw();
|
this.renderer.draw();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
select_palette(name) {
|
select_palette(name) {
|
||||||
if (name === this.palette_selection)
|
if (name === this.palette_selection)
|
||||||
@ -1613,12 +1623,11 @@ class Splash extends PrimaryView {
|
|||||||
// TODO ah, there's more metadata in CCX, crapola
|
// TODO ah, there's more metadata in CCX, crapola
|
||||||
let magic = String.fromCharCode.apply(null, new Uint8Array(buf.slice(0, 4)));
|
let magic = String.fromCharCode.apply(null, new Uint8Array(buf.slice(0, 4)));
|
||||||
let stored_game;
|
let stored_game;
|
||||||
console.log(magic);
|
|
||||||
if (magic === 'CC2M' || magic === 'CCS ') {
|
if (magic === 'CC2M' || magic === 'CCS ') {
|
||||||
stored_game = new format_util.StoredGame;
|
stored_game = new format_util.StoredGame;
|
||||||
stored_game.levels.push(c2m.parse_level(buf));
|
stored_game.levels.push(c2m.parse_level(buf));
|
||||||
}
|
}
|
||||||
else if (magic === '\xac\x2a\x02\x00' || magic == '\xac\x2a\x02\x01') {
|
else if (magic === '\xac\xaa\x02\x00' || magic == '\xac\xaa\x02\x01') {
|
||||||
stored_game = dat.parse_game(buf);
|
stored_game = dat.parse_game(buf);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@ -503,7 +503,8 @@ export class Tileset {
|
|||||||
coords = coords[Math.floor((tile.animation_progress + level.tic_offset) / tile.animation_speed * coords.length)];
|
coords = coords[Math.floor((tile.animation_progress + level.tic_offset) / tile.animation_speed * coords.length)];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
coords = coords[Math.floor((level.tic_counter % 5 + level.tic_offset) / 5 * coords.length)];
|
// FIXME tic_counter doesn't exist on stored levels...
|
||||||
|
coords = coords[Math.floor(((level.tic_counter ?? 0) % 5 + level.tic_offset) / 5 * coords.length)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user