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) {
|
||||
this.conductor = conductor;
|
||||
this.root = root;
|
||||
this.active = false;
|
||||
}
|
||||
|
||||
activate() {
|
||||
this.root.removeAttribute('hidden');
|
||||
this.active = true;
|
||||
}
|
||||
|
||||
deactivate() {
|
||||
this.root.setAttribute('hidden', '');
|
||||
this.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1496,6 +1499,11 @@ class Editor extends PrimaryView {
|
||||
this.select_palette('floor');
|
||||
}
|
||||
|
||||
activate() {
|
||||
super.activate();
|
||||
this.renderer.draw();
|
||||
}
|
||||
|
||||
load_game(stored_game) {
|
||||
}
|
||||
|
||||
@ -1515,8 +1523,10 @@ class Editor extends PrimaryView {
|
||||
}
|
||||
|
||||
this.renderer.set_level(stored_level);
|
||||
if (this.active) {
|
||||
this.renderer.draw();
|
||||
}
|
||||
}
|
||||
|
||||
select_palette(name) {
|
||||
if (name === this.palette_selection)
|
||||
@ -1613,12 +1623,11 @@ class Splash extends PrimaryView {
|
||||
// TODO ah, there's more metadata in CCX, crapola
|
||||
let magic = String.fromCharCode.apply(null, new Uint8Array(buf.slice(0, 4)));
|
||||
let stored_game;
|
||||
console.log(magic);
|
||||
if (magic === 'CC2M' || magic === 'CCS ') {
|
||||
stored_game = new format_util.StoredGame;
|
||||
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);
|
||||
}
|
||||
else {
|
||||
|
||||
@ -503,7 +503,8 @@ export class Tileset {
|
||||
coords = coords[Math.floor((tile.animation_progress + level.tic_offset) / tile.animation_speed * coords.length)];
|
||||
}
|
||||
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 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user