Support the remaining invalid tile, which slipped into CCLXP2

This commit is contained in:
Eevee (Evelyn Woods) 2020-09-25 04:51:59 -06:00
parent 537e011f2a
commit 26f9e917a8
3 changed files with 42 additions and 19 deletions

View File

@ -56,9 +56,9 @@ const TILE_ENCODING = {
0x30: 'thinwall_se',
0x31: 'cloner',
0x32: 'force_floor_all',
0x33: 'player_drowned',
0x34: 'player_burned',
//0x35: player_burned, XXX is this burned off a tile or?
0x33: 'bogus_player_drowned',
0x34: 'bogus_player_burned_fire',
0x35: 'bogus_player_burned',
0x36: 'wall_invisible', // unused
0x37: 'wall_invisible', // unused
0x38: 'wall_invisible', // unused
@ -159,9 +159,10 @@ function parse_level(buf, number) {
let spec = TILE_ENCODING[tile_byte];
// TODO could be more forgiving for goofy levels doing goofy things
if (! spec)
// TODO doesn't say what level or where in the file, come on
throw new Error(`Invalid tile byte: 0x${tile_byte.toString(16)}`);
if (! spec) {
let [x, y] = level.scalar_to_coords(c);
throw new Error(`Invalid tile byte 0x${tile_byte.toString(16)} at (${x}, ${y}) in level ${number}`);
}
let name, direction;
if (spec instanceof Array) {

View File

@ -342,6 +342,18 @@ export const CC2_TILESET_LAYOUT = {
south: [[4, 24], [5, 24]],
west: [[6, 24], [7, 24]],
},
bogus_player_drowned: {
overlay: [3, 3], // splash
base: 'water',
},
bogus_player_burned_fire: {
overlay: [2, 5], // explosion frame 3
base: 'fire',
},
bogus_player_burned: {
overlay: [2, 5], // explosion frame 3
base: 'floor',
},
water: [
[12, 24],
[13, 24],
@ -373,10 +385,6 @@ export const CC2_TILESET_LAYOUT = {
[15, 29],
],
// TODO these shouldn't loop and also seem to be more general
player_drowned: [[4, 5], [5, 5], [6, 5], [7, 5]],
player_burned: [[0, 5], [1, 5], [2, 5], [3, 5]],
// TODO handle train tracks! this is gonna be complicated.
railroad: [9, 10],
railroad_sign: [4, 31],
@ -449,9 +457,9 @@ export const TILE_WORLD_TILESET_LAYOUT = {
cloner: [3, 1],
force_floor_all: [3, 2],
splash: [3, 3],
player_drowned: [3, 3],
player_burned: [3, 4],
player_bombed: [3, 5],
bogus_player_drowned: [3, 3],
bogus_player_burned_fire: [3, 4],
bogus_player_burned: [3, 5],
explosion: [3, 6],
explosion_other: [3, 7], // TODO ???
// 3, 8 unused
@ -573,6 +581,14 @@ export const LL_TILESET_LAYOUT = Object.assign({}, CC2_TILESET_LAYOUT, {
west: [7, 33],
},
}),
bogus_player_burned_fire: {
overlay: [6, 33],
base: 'fire',
},
bogus_player_burned: {
overlay: [6, 33],
base: 'floor',
},
});
export class Tileset {

View File

@ -1176,12 +1176,6 @@ const TILE_TYPES = {
key_yellow: true,
},
},
player_drowned: {
draw_layer: LAYER_ACTOR,
},
player_burned: {
draw_layer: LAYER_ACTOR,
},
chip: {
draw_layer: LAYER_ITEM,
is_chip: true,
@ -1307,6 +1301,18 @@ const TILE_TYPES = {
draw_layer: LAYER_TERRAIN,
blocks_all: true,
},
bogus_player_drowned: {
draw_layer: LAYER_TERRAIN,
blocks_all: true,
},
bogus_player_burned_fire: {
draw_layer: LAYER_TERRAIN,
blocks_all: true,
},
bogus_player_burned: {
draw_layer: LAYER_TERRAIN,
blocks_all: true,
},
};
// Tell them all their own names