From d3e60b88faa3b79071527d924d11d1b1aa4f9612 Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Thu, 10 Sep 2020 21:21:30 -0600 Subject: [PATCH] Stub out enough for CC2's Lesson 3 to load --- js/format-c2m.js | 26 ++++++------ js/main.js | 3 ++ js/tileset.js | 27 +++++++++--- js/tiletypes.js | 105 ++++++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 138 insertions(+), 23 deletions(-) diff --git a/js/format-c2m.js b/js/format-c2m.js index 8847238..d38ec81 100644 --- a/js/format-c2m.js +++ b/js/format-c2m.js @@ -81,12 +81,12 @@ const TILE_ENCODING = { 0x0d: 'force_floor_w', 0x0e: 'green_wall', 0x0f: 'green_floor', - //0x10: 'teleport_red', + 0x10: 'teleport_red', 0x11: 'teleport_blue', - //0x12: 'teleport_yellow', - //0x13: 'teleport_green', + 0x12: 'teleport_yellow', + 0x13: 'teleport_green', 0x14: 'exit', - //0x15: 'slime', + 0x15: 'slime', 0x16: ['player', '#direction', '#next'], 0x17: ['dirt_block', '#direction', '#next'], 0x18: ['walker', '#direction', '#next'], @@ -145,20 +145,20 @@ const TILE_ENCODING = { 0x4d: ['stopwatch_toggle', '#next'], // 0x4e: Transmogrifier : // 0x4f: Railroad track (Modifier required, see section below) : - // 0x50: Steel wall : - // 0x51: Time bomb : '#next' + 0x50: ['steel'], + 0x51: ['dynamite', '#next'], // 0x52: Helmet : '#next' - // 0x56: Melinda : '#direction', '#next' + 0x56: ['player2', '#direction', '#next'], // 0x57: Timid teeth : '#direction', '#next' // 0x58: Explosion animation (unused in main levels) : '#direction', '#next' - // 0x59: Hiking boots : '#next' + 0x59: ['hiking_boots', '#next'], // 0x5a: Male-only sign : // 0x5b: Female-only sign : // 0x5c: Inverter gate (N) : Modifier allows other gates, see below // 0x5e: Logic switch (ON) : - // 0x5f: Flame jet (OFF) : - // 0x60: Flame jet (ON) : - // 0x61: Orange button : + 0x5f: 'flame_jet_off', + 0x60: 'flame_jet_on', + 0x61: 'button_orange', // 0x62: Lightning bolt : '#next' // 0x63: Yellow tank : '#direction', '#next' // 0x64: Yellow tank button : @@ -180,8 +180,8 @@ const TILE_ENCODING = { 0x7a: ['score_10', '#next'], 0x7b: ['score_100', '#next'], 0x7c: ['score_1000', '#next'], - // 0x7d: Solid green wall : - // 0x7e: False green wall : + 0x7d: ['popdown_wall'], + 0x7e: ['popdown_floor'], 0x7f: ['forbidden', '#next'], 0x80: ['score_2x', '#next'], // 0x81: Directional block : '#direction', Directional Arrows Bitmask, '#next' diff --git a/js/main.js b/js/main.js index dd79448..942775e 100644 --- a/js/main.js +++ b/js/main.js @@ -680,6 +680,9 @@ const EDITOR_TOOLS = [{ name: "Wire", desc: "Draw CC2 wiring", // TODO text tool; thin walls tool; ice tool; map generator?; subtools for select tool (copy, paste, crop) + // TODO interesting option: rotate an actor as you draw it by dragging? or hold a key like in + // slade when you have some selected? + // TODO ah, railroads... }]; // Tiles the "adjust" tool will turn into each other const EDITOR_ADJUST_TOGGLES = { diff --git a/js/tileset.js b/js/tileset.js index 968fa71..9717ffc 100644 --- a/js/tileset.js +++ b/js/tileset.js @@ -68,10 +68,11 @@ export const CC2_TILESET_LAYOUT = { // mercury boot // canopy, xray - // tnt + // TODO lit + dynamite: [0, 4], bomb: [5, 4], green_bomb: [6, 4], - // ??? tiny fireworks + // TODO bomb fuse tile, ugh floor_custom_green: [8, 4], floor_custom_pink: [9, 4], floor_custom_yellow: [10, 4], @@ -83,8 +84,11 @@ export const CC2_TILESET_LAYOUT = { explosion: [[0, 5], [1, 5], [2, 5], [3, 5]], splash: [[4, 5], [5, 5], [6, 5], [7, 5]], - // flame jet - // green walls...? + flame_jet_off: [8, 5], + flame_jet_on: [[9, 5], [10, 5], [11, 5]], + popdown_wall: [12, 5], + popdown_floor: [12, 5], + popdown_floor_visible: [13, 5], forbidden: [14, 5], // directional block frame, i think? @@ -269,7 +273,20 @@ export const CC2_TILESET_LAYOUT = { [15, 24], ], - // TODO melinda, same layout as chip + player2: { + moving: { + north: [[0, 27], [1, 27], [2, 27], [3, 27], [4, 27], [5, 27], [6, 27], [7, 27]], + south: [[0, 28], [1, 28], [2, 28], [3, 28], [4, 28], [5, 28], [6, 28], [7, 28]], + west: [[8, 28], [9, 28], [10, 28], [11, 28], [12, 28], [13, 28], [14, 28], [15, 28]], + east: [[8, 27], [9, 27], [10, 27], [11, 27], [12, 27], [13, 27], [14, 27], [15, 27]], + }, + standing: { + north: [0, 27], + south: [0, 28], + west: [8, 28], + east: [8, 27], + }, + }, fire: [ [12, 29], [13, 29], diff --git a/js/tiletypes.js b/js/tiletypes.js index 13bc935..bc04298 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -52,7 +52,7 @@ const TILE_TYPES = { }, wall_invisible: { draw_layer: LAYER_TERRAIN, - // TODO cc2 seems to make these flicker briefly + // FIXME cc2 seems to make these flicker briefly blocks_all: true, }, wall_appearing: { @@ -105,6 +105,28 @@ const TILE_TYPES = { level.transmute_tile(me, 'floor'); }, }, + popdown_wall: { + draw_layer: LAYER_TERRAIN, + blocks_all: true, + }, + popdown_floor: { + draw_layer: LAYER_TERRAIN, + on_arrive(me, level, other) { + // FIXME could probably do this with state? or, eh + level.transmute_tile(me, 'popdown_floor_visible'); + }, + }, + popdown_floor_visible: { + draw_layer: LAYER_TERRAIN, + on_depart(me, level, other) { + // FIXME possibly changes back too fast, not even visible for a tic for me (much like stepping on a button oops) + level.transmute_tile(me, 'popdown_floor'); + }, + }, + steel: { + draw_layer: LAYER_TERRAIN, + blocks_all: true, + }, canopy: { draw_layer: LAYER_OVERLAY, }, @@ -367,6 +389,16 @@ const TILE_TYPES = { level.set_actor_direction(other, level.get_force_floor_direction()); }, }, + slime: { + draw_layer: LAYER_TERRAIN, + // FIXME kills everything except ghosts, blobs, blocks + // FIXME blobs spread slime onto floor tiles, even destroying wiring + on_arrive(me, level, other) { + if (other.type.name === 'dirt_block' || other.type.name === 'clone_block' || other.type.name === 'ice_block') { + level.transmute_tile(me, 'floor'); + } + }, + }, bomb: { draw_layer: LAYER_ITEM, // TODO explode @@ -519,7 +551,34 @@ const TILE_TYPES = { connects_to: 'teleport_blue', connect_order: 'backward', is_teleporter: true, - // TODO to make this work, i need to be able to check if a spot is blocked /ahead of time/ + }, + teleport_red: { + draw_layer: LAYER_TERRAIN, + connects_to: 'teleport_red', + connect_order: 'forward', + is_teleporter: true, + }, + teleport_green: { + draw_layer: LAYER_TERRAIN, + // connects_to: 'teleport_red', + // connect_order: 'forward', + // is_teleporter: true, + // FIXME completely different behavior from other teleporters + }, + teleport_yellow: { + draw_layer: LAYER_TERRAIN, + connects_to: 'teleport_yellow', + connect_order: 'backward', + is_teleporter: true, + // FIXME special pickup behavior + }, + // FIXME do i want these as separate objects? what would they do, turn into each other? or should it be one with state? + flame_jet_off: { + draw_layer: LAYER_TERRAIN, + }, + flame_jet_on: { + draw_layer: LAYER_TERRAIN, + // FIXME every tic, kills every actor in the cell }, // Buttons button_blue: { @@ -601,7 +660,12 @@ const TILE_TYPES = { } }, }, - // Time alternation + button_orange: { + draw_layer: LAYER_TERRAIN, + // FIXME toggles flame jets, connected somehow, ??? + }, + + // Time alteration stopwatch_bonus: { draw_layer: LAYER_ITEM, blocks_monsters: true, @@ -747,7 +811,7 @@ const TILE_TYPES = { blocks_monsters: true, blocks_blocks: true, }, - // Tools + // Boots // TODO note: ms allows blocks to pass over tools cleats: { draw_layer: LAYER_ITEM, @@ -787,6 +851,23 @@ const TILE_TYPES = { blocks_blocks: true, item_ignores: new Set(['water']), }, + hiking_boots: { + draw_layer: LAYER_ITEM, + is_item: true, + is_tool: true, + blocks_monsters: true, + blocks_blocks: true, + // FIXME uhh these "ignore" that dirt and gravel block us, but they don't ignore the on_arrive, so, uhhhh + }, + // Other tools + dynamite: { + draw_layer: LAYER_ITEM, + is_item: true, + is_tool: true, + blocks_monsters: true, + blocks_blocks: true, + // FIXME does a thing when dropped, but that isn't implemented at all yet + }, // Progression player: { @@ -800,11 +881,25 @@ const TILE_TYPES = { clone_block: true, ice_block: true, }, - // FIXME this prevents thief from taking green key infinite_items: { key_green: true, }, }, + player2: { + draw_layer: LAYER_ACTOR, + is_actor: true, + is_player: true, + has_inventory: true, + movement_speed: 4, + pushes: { + dirt_block: true, + clone_block: true, + ice_block: true, + }, + infinite_items: { + key_yellow: true, + }, + }, player_drowned: { draw_layer: LAYER_ACTOR, },