Search in sources :

Example 6 with UltimaTiledMapLoader

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);
    }
}
Also used : UltimaTiledMapLoader(util.UltimaTiledMapLoader) UltimaMapRenderer(util.UltimaMapRenderer) MapProperties(com.badlogic.gdx.maps.MapProperties) StaticGeneratedDungeonScreen(generator.StaticGeneratedDungeonScreen) BaseMap(objects.BaseMap) StaticGeneratedDungeonScreen(generator.StaticGeneratedDungeonScreen)

Aggregations

UltimaTiledMapLoader (util.UltimaTiledMapLoader)6 TiledMap (com.badlogic.gdx.maps.tiled.TiledMap)5 BaseMap (objects.BaseMap)2 CombatScreen (ultima.CombatScreen)2 Animation (com.badlogic.gdx.graphics.g2d.Animation)1 SpriteBatch (com.badlogic.gdx.graphics.g2d.SpriteBatch)1 TextureAtlas (com.badlogic.gdx.graphics.g2d.TextureAtlas)1 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)1 MapProperties (com.badlogic.gdx.maps.MapProperties)1 SequenceAction (com.badlogic.gdx.scenes.scene2d.actions.SequenceAction)1 StaticGeneratedDungeonScreen (generator.StaticGeneratedDungeonScreen)1 Random (java.util.Random)1 Party (objects.Party)1 PartyMember (objects.Party.PartyMember)1 Person (objects.Person)1 SaveGame (objects.SaveGame)1 Context (ultima.Context)1 Ultima4 (ultima.Ultima4)1 UltimaMapRenderer (util.UltimaMapRenderer)1 XORShiftRandom (util.XORShiftRandom)1