use of util.DungeonTileModelInstance in project ultimate-java by pantinor.
the class StaticGeneratedDungeonScreen method render.
@Override
public void render(float delta) {
Gdx.gl.glClearColor(0, 0, 0, 0);
Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT | GL30.GL_DEPTH_BUFFER_BIT);
lightFactor += Gdx.graphics.getDeltaTime();
float lightSize = 4.75f + 0.25f * (float) Math.sin(lightFactor) + .2f * MathUtils.random();
Vector3 ll = isTorchOn ? nll : vdll;
ll = isTorchOn ? nll2 : vdll;
fixedLight.set(ll.x, ll.y, ll.z, currentPos.x, currentPos.y + .35f, currentPos.z, lightSize);
Gdx.gl.glViewport(32, 64, Ultima4.MAP_WIDTH, Ultima4.MAP_HEIGHT);
camera.update();
modelBatch.begin(camera);
for (DungeonTileModelInstance i : modelInstances) {
if (i.getLevel() == currentLevel) {
modelBatch.render(i.getInstance(), environment[currentLevel]);
}
}
modelBatch.end();
for (Creature cr : dngMap.getMap().getCreatures()) {
if (cr.currentLevel != this.currentLevel) {
continue;
}
decalBatch.add(cr.getDecal());
}
decalBatch.flush();
Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
batch.begin();
batch.draw(Ultima4.backGround, 0, 0);
Ultima4.hud.render(batch, context.getParty());
Ultima4.font.draw(batch, "Level " + (currentLevel + 1) + " facing " + currentDir, 305, Ultima4.SCREEN_HEIGHT - 7);
if (showZstats > 0) {
context.getParty().getSaveGame().renderZstats(showZstats, Ultima4.font, batch, Ultima4.SCREEN_HEIGHT);
}
batch.end();
stage.act();
stage.draw();
}
use of util.DungeonTileModelInstance in project ultimate-java by pantinor.
the class SpellUtil method spellDispel.
public static void spellDispel(BaseScreen screen, Context context, PartyMember caster, Direction dir) {
if (screen.scType == ScreenType.MAIN) {
GameScreen gameScreen = (GameScreen) screen;
Vector3 v = gameScreen.getCurrentMapCoords();
int x = (int) v.x;
int y = (int) v.y;
if (dir == Direction.NORTH) {
y--;
}
if (dir == Direction.SOUTH) {
y++;
}
if (dir == Direction.EAST) {
x++;
}
if (dir == Direction.WEST) {
x--;
}
Tile dispellable = context.getCurrentMap().getTile(x, y);
if (dispellable.getRule() == null || !dispellable.getRule().has(TileAttrib.dispelable)) {
return;
}
gameScreen.replaceTile("grass", x, y);
} else if (screen.scType == ScreenType.COMBAT) {
CombatScreen combatScreen = (CombatScreen) screen;
int x = caster.combatCr.currentX;
int y = caster.combatCr.currentY;
if (dir == Direction.NORTH) {
y--;
}
if (dir == Direction.SOUTH) {
y++;
}
if (dir == Direction.EAST) {
x++;
}
if (dir == Direction.WEST) {
x--;
}
Tile dispellable = combatScreen.combatMap.getTile(x, y);
if (dispellable.getRule() == null || !dispellable.getRule().has(TileAttrib.dispelable)) {
return;
}
combatScreen.replaceTile("dungeon_floor", x, y);
} else if (screen.scType == ScreenType.DUNGEON) {
DungeonScreen dngScreen = (DungeonScreen) screen;
int x = (Math.round(dngScreen.currentPos.x) - 1);
int y = (Math.round(dngScreen.currentPos.z) - 1);
if (dngScreen.currentDir == Direction.NORTH) {
y = y - 1 < 0 ? DungeonScreen.DUNGEON_MAP - 1 : y - 1;
}
if (dngScreen.currentDir == Direction.SOUTH) {
y = y + 1 >= DungeonScreen.DUNGEON_MAP ? 0 : y + 1;
}
if (dngScreen.currentDir == Direction.EAST) {
x = x + 1 >= DungeonScreen.DUNGEON_MAP ? 0 : x + 1;
}
if (dngScreen.currentDir == Direction.WEST) {
x = x - 1 < 0 ? DungeonScreen.DUNGEON_MAP - 1 : x - 1;
}
DungeonTileModelInstance dispellable = null;
for (DungeonTileModelInstance dmi : dngScreen.modelInstances) {
if (dmi.getTile().getValue() >= DungeonTile.FIELD_POISON.getValue() && dmi.getTile().getValue() <= DungeonTile.FIELD_SLEEP.getValue()) {
if (dmi.x == x && dmi.y == y && dmi.getLevel() == dngScreen.currentLevel) {
dispellable = dmi;
break;
}
}
}
if (dispellable != null) {
dngScreen.modelInstances.remove(dispellable);
dngScreen.dungeonTiles[dngScreen.currentLevel][x][y] = DungeonTile.NOTHING;
dngScreen.createMiniMap();
}
}
}
Aggregations