import metamap from "./metamap.txt?raw"; import {Architecture, LoadedNewMap, NewMap} from "../../newmap.ts"; import {Grid, Point} from "../../engine/datatypes.ts"; import mapZoo from "../zoo/map.ts"; import mapOptometrist from "../optometrist/map.ts"; import mapBloodBank from "../bloodBank/map.ts"; import mapCoffeeShop from "../coffeeShop/map.ts"; import mapClub from "../club/map.ts"; import mapManor from "../manor/map.ts"; import mapLibrary from "../library/map.ts"; const mapHub: NewMap = () => { let metamapLayer = Grid.createGridFromMultilineString(metamap); // NOTE: We could deduce this from the file -- // BUT, for now, let's just use the maps directly let blits = [ {at: new Point(2, 0), map: mapOptometrist()}, {at: new Point(0, 12), map: mapZoo()}, {at: new Point(13, 9), map: mapBloodBank()}, {at: new Point(24, 9), map: mapCoffeeShop()}, {at: new Point(0, 22), map: mapClub()}, {at: new Point(13, 22), map: mapManor(), useEntrance: true}, {at: new Point(26, 22), map: mapLibrary()}, ]; let metamapContent = new LoadedNewMap("hub", metamapLayer.size); for (let y = 0; y < metamapLayer.size.h; y++) { for (let x = 0; x < metamapLayer.size.w; x++) { let src = new Point(x, y); let cell = metamapContent.get(src); if (metamapLayer.get(src) == "#") { cell.architecture = Architecture.Wall; } else if (metamapLayer.get(src) == " ") { cell.architecture = Architecture.Floor; } } } for (let {at, map, useEntrance} of blits.values()) { for (let srcY = 0; srcY < map.size.h; srcY++) { for (let srcX = 0; srcX < map.size.w; srcX++) { let src = new Point(srcX, srcY); let dst = at.offset(new Point(srcX, srcY)); metamapContent.get(dst).copyFrom(map.get(src)) } } if (useEntrance ?? false) { console.log("beep"); metamapContent.entrance = at.offset(map.entrance); } } return metamapContent; } export default mapHub;