diff --git a/js/format-c2g.js b/js/format-c2g.js index 35a478d..d31ebb9 100644 --- a/js/format-c2g.js +++ b/js/format-c2g.js @@ -672,10 +672,9 @@ const TILE_ENCODING = { name: 'speed_boots', has_next: true, }, - 0x91: { + 0x92: { name: 'hook', has_next: true, - error: "The hook is not yet implemented, sorry!", }, }; const REVERSE_TILE_ENCODING = {}; diff --git a/js/tileset.js b/js/tileset.js index 66a9e6a..f91b888 100644 --- a/js/tileset.js +++ b/js/tileset.js @@ -105,7 +105,8 @@ export const CC2_TILESET_LAYOUT = { chip: [11, 3], bribe: [12, 3], speed_boots: [13, 3], - // canopy, xray + canopy: [14, 3], + // canopy xray // TODO lit dynamite: [0, 4], @@ -552,6 +553,7 @@ export const CC2_TILESET_LAYOUT = { dirt: [4, 31], no_player2_sign: [5, 31], no_player1_sign: [6, 31], + hook: [7, 31], // misc other stuff }; @@ -848,7 +850,7 @@ export class Tileset { _draw_letter(drawspec, tile, tic, blit) { this._draw_standard(drawspec.base, tile, tic, blit); - let glyph = tile.overlaid_glyph; + let glyph = tile ? tile.overlaid_glyph : "?"; if (drawspec.letter_glyphs[glyph]) { let [x, y] = drawspec.letter_glyphs[glyph]; // XXX size is hardcoded here, but not below, meh diff --git a/js/tiletypes.js b/js/tiletypes.js index dd798b8..0a72d3d 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -640,6 +640,9 @@ const TILE_TYPES = { on_arrive(me, level, other) { level.set_actor_direction(other, 'north'); }, + on_gray_button(me, level) { + level.transmute_tile(me, 'force_floor_s'); + }, }, force_floor_e: { draw_layer: DRAW_LAYERS.terrain, @@ -648,6 +651,9 @@ const TILE_TYPES = { on_arrive(me, level, other) { level.set_actor_direction(other, 'east'); }, + on_gray_button(me, level) { + level.transmute_tile(me, 'force_floor_w'); + }, }, force_floor_s: { draw_layer: DRAW_LAYERS.terrain, @@ -656,6 +662,9 @@ const TILE_TYPES = { on_arrive(me, level, other) { level.set_actor_direction(other, 'south'); }, + on_gray_button(me, level) { + level.transmute_tile(me, 'force_floor_n'); + }, }, force_floor_w: { draw_layer: DRAW_LAYERS.terrain, @@ -664,6 +673,9 @@ const TILE_TYPES = { on_arrive(me, level, other) { level.set_actor_direction(other, 'west'); }, + on_gray_button(me, level) { + level.transmute_tile(me, 'force_floor_e'); + }, }, force_floor_all: { draw_layer: DRAW_LAYERS.terrain, @@ -1710,6 +1722,12 @@ const TILE_TYPES = { is_tool: true, blocks_collision: COLLISION.block_cc1 | COLLISION.monster_solid, }, + hook: { + draw_layer: DRAW_LAYERS.item, + is_item: true, + is_tool: true, + blocks_collision: COLLISION.block_cc1 | COLLISION.monster_solid, + }, // Progression player: {