use of util.DungeonRoomTiledMapLoader in project ultimate-java by pantinor.
the class DungeonScreen method enterRoom.
public void enterRoom(RoomLocater loc, Direction entryDir) {
if (loc == null) {
return;
}
Maps contextMap = Maps.get(dngMap.getId());
TiledMap tiledMap = new DungeonRoomTiledMapLoader(loc.room, entryDir, Ultima4.standardAtlas).load();
BaseMap baseMap = new BaseMap();
baseMap.setTiles(loc.room.tiles);
baseMap.setWidth(11);
baseMap.setHeight(11);
baseMap.setType(MapType.dungeon);
baseMap.setPortals(dngMap.getMap().getPortals(loc.x, loc.y, loc.z));
CombatScreen sc = new CombatScreen(this, context, contextMap, baseMap, tiledMap, null, Ultima4.creatures, Ultima4.standardAtlas);
if (loc.room.hasAltar) {
sc.log("The Altar Room of " + loc.room.altarRoomVirtue.toString());
}
MapLayer mLayer = tiledMap.getLayers().get("Monster Positions");
Iterator<MapObject> iter = mLayer.getObjects().iterator();
while (iter.hasNext()) {
MapObject obj = iter.next();
int tile = (Integer) obj.getProperties().get("tile");
int startX = (Integer) obj.getProperties().get("startX");
int startY = (Integer) obj.getProperties().get("startY");
if (tile == 0) {
continue;
}
Tile t = Ultima4.baseTileSet.getTileByIndex(tile);
Creature c = Ultima4.creatures.getInstance(CreatureType.get(t.getName()), Ultima4.standardAtlas);
c.currentX = startX;
c.currentY = startY;
c.currentPos = sc.getMapPixelCoords(startX, startY);
baseMap.addCreature(c);
}
mainGame.setScreen(sc);
}