use of util.UltimaTiledMapLoader in project ultimate-java by pantinor.
the class GameScreen method loadNextMap.
public void loadNextMap(Maps m, int x, int y, int dngx, int dngy, int dngLevel, Direction orientation, boolean restoreSG) {
log("Entering " + m.getLabel() + "!");
BaseMap baseMap = m.getMap();
if (baseMap.getType() == MapType.dungeon) {
if (m != Maps.DELVE_SORROWS) {
DungeonScreen sc = new DungeonScreen(this, context, m);
if (restoreSG) {
sc.restoreSaveGameLocation(dngx, dngy, dngLevel, orientation);
}
mainGame.setScreen(sc);
} else {
StaticGeneratedDungeonScreen sc = new StaticGeneratedDungeonScreen(this, context, m);
if (restoreSG) {
sc.restoreSaveGameLocation(dngx, dngy, dngLevel, orientation);
}
mainGame.setScreen(sc);
}
} else if (baseMap.getType() == MapType.shrine) {
map = new UltimaTiledMapLoader(m, Ultima4.standardAtlas, baseMap.getWidth(), baseMap.getHeight(), tilePixelWidth, tilePixelHeight).load();
context.setCurrentTiledMap(map);
Virtue virtue = Virtue.get(baseMap.getId() - 25);
ShrineScreen sc = new ShrineScreen(this, context.getParty(), virtue, map, Ultima4.standardAtlas, Ultima4.standardAtlas);
mainGame.setScreen(sc);
} else {
context.setCurrentMap(baseMap);
baseMap.removeJoinedPartyMemberFromPeopleList(context.getParty());
map = new UltimaTiledMapLoader(m, Ultima4.standardAtlas, m.getMap().getWidth(), m.getMap().getHeight(), tilePixelWidth, tilePixelHeight).load();
context.setCurrentTiledMap(map);
if (renderer != null) {
renderer.dispose();
}
renderer = new UltimaMapRenderer(context, Ultima4.standardAtlas, baseMap, map, 1f);
mapBatch = renderer.getBatch();
MapProperties prop = map.getProperties();
mapPixelHeight = prop.get("height", Integer.class) * tilePixelHeight;
baseMap.initObjects(this, Ultima4.standardAtlas, Ultima4.standardAtlas);
renderer.getFOV().calculateFOV(baseMap.getShadownMap(), x, y, 17f);
newMapPixelCoords = getMapPixelCoords(x, y);
}
if (Ultima4.playMusic) {
if (Ultima4.music != null) {
Ultima4.music.stop();
}
Sound snd = Sound.valueOf(baseMap.getMusic());
Ultima4.music = Sounds.play(snd, Ultima4.musicVolume);
}
}
Aggregations