preparations for entity system rewrite

v5stable
ondra 11 years ago
parent e8ed1ef94d
commit ab1c3b3a74
  1. 14
      src/mightypork/rogue/world/tile/Tile.java
  2. 4
      src/mightypork/rogue/world/tile/Tiles.java
  3. 6
      src/mightypork/rogue/world/tile/tiles/DoorTile.java
  4. 5
      src/mightypork/rogue/world/tile/tiles/FloorTile.java
  5. 7
      src/mightypork/rogue/world/tile/tiles/GroundTile.java
  6. 11
      src/mightypork/rogue/world/tile/tiles/LockedDoorTile.java
  7. 5
      src/mightypork/rogue/world/tile/tiles/NullTile.java
  8. 6
      src/mightypork/rogue/world/tile/tiles/SolidTile.java
  9. 5
      src/mightypork/rogue/world/tile/tiles/WallTile.java

@ -27,17 +27,15 @@ public abstract class Tile implements IonBinaryHeadless {
protected final TileRenderer renderer;
public final int id;
protected final Stack<Item> items = new Stack<>();
public final TileModel model;
// temporary flag for map.
protected boolean occupied;
protected boolean explored;
public Tile(int id, TileRenderer renderer) {
this.id = id;
public Tile(TileModel model, TileRenderer renderer) {
this.model = model;
this.renderer = renderer;
}
@ -176,6 +174,12 @@ public abstract class Tile implements IonBinaryHeadless {
}
public final TileModel getModel()
{
return model;
}
/**
* Drop item onto this tile
*

@ -61,9 +61,9 @@ public final class Tiles {
public static void saveTile(IonOutput out, Tile tile) throws IOException
{
out.writeIntByte(tile.id);
TileModel model = tile.getModel();
TileModel model = get(tile.id);
out.writeIntByte(model.id);
model.saveTile(out, tile);
}

@ -1,14 +1,16 @@
package mightypork.rogue.world.tile.tiles;
import mightypork.rogue.world.tile.TileModel;
import mightypork.rogue.world.tile.TileRenderer;
import mightypork.rogue.world.tile.TileType;
public class DoorTile extends SolidTile {
public DoorTile(int id, TileRenderer renderer) {
super(id, renderer);
public DoorTile(TileModel model, TileRenderer renderer)
{
super(model, renderer);
}
@Override

@ -1,15 +1,16 @@
package mightypork.rogue.world.tile.tiles;
import mightypork.rogue.world.tile.TileModel;
import mightypork.rogue.world.tile.TileRenderer;
import mightypork.rogue.world.tile.TileType;
public class FloorTile extends GroundTile {
public FloorTile(int id, TileRenderer renderer)
public FloorTile(TileModel model, TileRenderer renderer)
{
super(id, renderer);
super(model, renderer);
}

@ -2,12 +2,14 @@ package mightypork.rogue.world.tile.tiles;
import java.io.IOException;
import java.util.Stack;
import mightypork.rogue.world.item.Item;
import mightypork.rogue.world.level.Level;
import mightypork.rogue.world.level.render.TileRenderContext;
import mightypork.rogue.world.tile.DroppedItemRenderer;
import mightypork.rogue.world.tile.Tile;
import mightypork.rogue.world.tile.TileModel;
import mightypork.rogue.world.tile.TileRenderer;
import mightypork.util.files.ion.IonInput;
import mightypork.util.files.ion.IonOutput;
@ -17,10 +19,11 @@ public abstract class GroundTile extends Tile {
private DroppedItemRenderer itemRenderer = new DroppedItemRenderer();
protected final Stack<Item> items = new Stack<>();
public GroundTile(int id, TileRenderer renderer)
public GroundTile(TileModel model, TileRenderer renderer)
{
super(id, renderer);
super(model, renderer);
}

@ -3,6 +3,7 @@ package mightypork.rogue.world.tile.tiles;
import java.io.IOException;
import mightypork.rogue.world.tile.TileModel;
import mightypork.rogue.world.tile.TileRenderer;
import mightypork.util.files.ion.IonInput;
import mightypork.util.files.ion.IonOutput;
@ -13,9 +14,15 @@ public class LockedDoorTile extends DoorTile {
public boolean locked = true;
public LockedDoorTile(int id, TileRenderer renderer)
public LockedDoorTile(TileModel model, TileRenderer renderer)
{
super(id, renderer);
super(model, renderer);
}
@Override
public boolean isWalkable()
{
return !locked;
}

@ -5,15 +5,16 @@ import mightypork.rogue.world.item.Item;
import mightypork.rogue.world.level.Level;
import mightypork.rogue.world.level.render.TileRenderContext;
import mightypork.rogue.world.tile.Tile;
import mightypork.rogue.world.tile.TileModel;
import mightypork.rogue.world.tile.TileRenderer;
import mightypork.rogue.world.tile.TileType;
public class NullTile extends Tile {
public NullTile(int id, TileRenderer renderer)
public NullTile(TileModel model, TileRenderer renderer)
{
super(id, renderer);
super(model, renderer);
}

@ -2,13 +2,15 @@ package mightypork.rogue.world.tile.tiles;
import mightypork.rogue.world.item.Item;
import mightypork.rogue.world.tile.Tile;
import mightypork.rogue.world.tile.TileModel;
import mightypork.rogue.world.tile.TileRenderer;
public abstract class SolidTile extends Tile {
public SolidTile(int id, TileRenderer renderer) {
super(id, renderer);
public SolidTile(TileModel model, TileRenderer renderer)
{
super(model, renderer);
}
@Override

@ -1,14 +1,15 @@
package mightypork.rogue.world.tile.tiles;
import mightypork.rogue.world.tile.TileModel;
import mightypork.rogue.world.tile.TileRenderer;
import mightypork.rogue.world.tile.TileType;
public class WallTile extends SolidTile {
public WallTile(int id, TileRenderer renderer)
public WallTile(TileModel model, TileRenderer renderer)
{
super(id, renderer);
super(model, renderer);
}
@Override

Loading…
Cancel
Save