diff --git a/src/mightypork/gamecore/control/events/input/KeyEvent.java b/src/mightypork/gamecore/control/events/input/KeyEvent.java index c5a8a2e..7895446 100644 --- a/src/mightypork/gamecore/control/events/input/KeyEvent.java +++ b/src/mightypork/gamecore/control/events/input/KeyEvent.java @@ -2,6 +2,7 @@ package mightypork.gamecore.control.events.input; import mightypork.util.control.eventbus.BusEvent; +import mightypork.util.control.eventbus.event_flags.UnloggedEvent; import org.lwjgl.input.Keyboard; @@ -11,6 +12,7 @@ import org.lwjgl.input.Keyboard; * * @author MightyPork */ +@UnloggedEvent public class KeyEvent extends BusEvent { private final int key; diff --git a/src/mightypork/gamecore/control/events/input/MouseButtonEvent.java b/src/mightypork/gamecore/control/events/input/MouseButtonEvent.java index 9694aaf..a24dc6a 100644 --- a/src/mightypork/gamecore/control/events/input/MouseButtonEvent.java +++ b/src/mightypork/gamecore/control/events/input/MouseButtonEvent.java @@ -2,6 +2,7 @@ package mightypork.gamecore.control.events.input; import mightypork.util.control.eventbus.BusEvent; +import mightypork.util.control.eventbus.event_flags.UnloggedEvent; import mightypork.util.math.constraints.rect.proxy.RectBound; import mightypork.util.math.constraints.vect.Vect; import mightypork.util.math.constraints.vect.VectConst; @@ -12,6 +13,7 @@ import mightypork.util.math.constraints.vect.VectConst; * * @author MightyPork */ +@UnloggedEvent public class MouseButtonEvent extends BusEvent { public static final int BUTTON_LEFT = 0; diff --git a/src/mightypork/rogue/screens/gamescreen/HudLayer.java b/src/mightypork/rogue/screens/gamescreen/HudLayer.java index 96cccf0..f2f418a 100644 --- a/src/mightypork/rogue/screens/gamescreen/HudLayer.java +++ b/src/mightypork/rogue/screens/gamescreen/HudLayer.java @@ -85,7 +85,7 @@ public class HudLayer extends ScreenLayer { @Override public int getEventPriority() { - return 100; + return 200; } } diff --git a/src/mightypork/rogue/screens/gamescreen/ScreenGame.java b/src/mightypork/rogue/screens/gamescreen/ScreenGame.java index 6b18bd3..513503b 100644 --- a/src/mightypork/rogue/screens/gamescreen/ScreenGame.java +++ b/src/mightypork/rogue/screens/gamescreen/ScreenGame.java @@ -24,8 +24,8 @@ public class ScreenGame extends LayeredScreen { this.world = obtainWorld(); - addLayer(new WorldLayer(this, world)); addLayer(new HudLayer(this, world)); + addLayer(new WorldLayer(this, world)); } diff --git a/src/mightypork/rogue/screens/gamescreen/WorldLayer.java b/src/mightypork/rogue/screens/gamescreen/WorldLayer.java index dd0bdb8..9f82606 100644 --- a/src/mightypork/rogue/screens/gamescreen/WorldLayer.java +++ b/src/mightypork/rogue/screens/gamescreen/WorldLayer.java @@ -39,7 +39,7 @@ public class WorldLayer extends ScreenLayer { @Override public int getZIndex() { - return -1; // stay down + return 0; // stay down } diff --git a/src/mightypork/rogue/screens/gamescreen/world/Minimap.java b/src/mightypork/rogue/screens/gamescreen/world/Minimap.java index 3819662..3d744e3 100644 --- a/src/mightypork/rogue/screens/gamescreen/world/Minimap.java +++ b/src/mightypork/rogue/screens/gamescreen/world/Minimap.java @@ -6,12 +6,14 @@ import mightypork.gamecore.control.events.input.MouseButtonListener; import mightypork.gamecore.gui.components.InputComponent; import mightypork.gamecore.render.Render; import mightypork.rogue.world.Coord; -import mightypork.rogue.world.EntityPos; import mightypork.rogue.world.World; import mightypork.rogue.world.entity.Entity; +import mightypork.rogue.world.entity.EntityPos; import mightypork.rogue.world.level.Level; import mightypork.rogue.world.tile.Tile; import mightypork.util.math.color.Color; +import mightypork.util.math.color.RGB; +import mightypork.util.math.constraints.num.Num; import mightypork.util.math.constraints.rect.Rect; import mightypork.util.math.constraints.rect.mutable.RectMutable; import mightypork.util.math.constraints.vect.Vect; @@ -24,12 +26,11 @@ public class Minimap extends InputComponent implements MouseButtonListener { private final World world; private final RectMutable bounds = Rect.makeVar(); private int unit = 0; - private final Color back = Color.rgba(0, 0.2, 0.2, 0.4); - private final Color back2 = Color.rgba(0, 0.5, 0.5, 0.5); + private final Num translucency = Num.make(0.8); + private final Color playerColor = RGB.RED; - public Minimap(World w) - { + public Minimap(World w) { this.world = w; } @@ -37,9 +38,10 @@ public class Minimap extends InputComponent implements MouseButtonListener { @Override protected void renderComponent() { + Color.pushAlpha(translucency); final Level lvl = world.getCurrentLevel(); - unit = (int) Math.min(Math.max(2, Math.ceil(height().value() / (lvl.getHeight() + 2))), 8); + unit = (int) Math.min(Math.max(2, Math.ceil((height().value()/2) / (lvl.getHeight() + 2))), 6); final World w = lvl.getWorld(); final Entity e = w.getPlayerEntity(); @@ -52,12 +54,12 @@ public class Minimap extends InputComponent implements MouseButtonListener { bounds.setTo(tl, unit * lw, unit * lh); - Render.quad(bounds.grow(unit * 0.5), back); - Render.quad(bounds, back2); - final Coord point = new Coord(tl.xi(), tl.yi()); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glBegin(GL11.GL_QUADS); + for (final Coord pos = Coord.zero(); pos.y < lh; pos.y++, point.y += unit) { for (pos.x = 0, point.x = tl.xi(); pos.x < lw; pos.x++, point.x += unit) { @@ -66,7 +68,7 @@ public class Minimap extends InputComponent implements MouseButtonListener { final Color clr = t.getMapColor(); - GL11.glColor4d(clr.r(), clr.g(), clr.b(), clr.a() * 0.9); + Render.setColor(clr); GL11.glVertex2i(point.x, point.y); GL11.glVertex2i(point.x + unit, point.y); @@ -76,7 +78,7 @@ public class Minimap extends InputComponent implements MouseButtonListener { } // player - GL11.glColor3d(1, 0, 0); + Render.setColor(playerColor); final double plx = tl.xi() + plCoord.visualX() * unit; final double ply = tl.yi() + plCoord.visualY() * unit; @@ -87,19 +89,25 @@ public class Minimap extends InputComponent implements MouseButtonListener { GL11.glVertex2d(plx, ply + unit); GL11.glEnd(); + + Color.popAlpha(); } @Override public void receive(MouseButtonEvent event) { - if (event.isOver(bounds) && event.isUp()) { - final Vect relative = event.getPos().sub(bounds.origin()); - final Coord actual = Coord.make(relative.xi() / unit, relative.yi() / unit); - - if (!world.getCurrentLevel().getTile(actual).data.explored) return; // unexplored + if (event.isOver(bounds)) { + if (event.isUp()) { + final Vect relative = event.getPos().sub(bounds.origin()); + final Coord actual = Coord.make(relative.xi() / unit, relative.yi() / unit); + final Entity player = world.getPlayerEntity(); + + if (player.getLevel().getTile(actual).isExplored()) { + player.navigateTo(actual); + } + } - world.getPlayerEntity().navigateTo(actual); event.consume(); } } diff --git a/src/mightypork/rogue/world/PlayerControl.java b/src/mightypork/rogue/world/PlayerControl.java index 49fee64..ba329f0 100644 --- a/src/mightypork/rogue/world/PlayerControl.java +++ b/src/mightypork/rogue/world/PlayerControl.java @@ -2,6 +2,8 @@ package mightypork.rogue.world; import mightypork.rogue.world.entity.Entity; +import mightypork.rogue.world.entity.EntityPos; +import mightypork.rogue.world.entity.PathStep; import mightypork.rogue.world.entity.models.EntityMoveListener; import mightypork.rogue.world.level.Level; diff --git a/src/mightypork/rogue/world/World.java b/src/mightypork/rogue/world/World.java index 4263ea1..14781e1 100644 --- a/src/mightypork/rogue/world/World.java +++ b/src/mightypork/rogue/world/World.java @@ -104,8 +104,8 @@ public class World implements IonBundled, Updateable { final int playerEid = getNewEID(); playerEntity = Entities.PLAYER.createEntity(playerEid); - levels.get(level).addEntity(playerEntity); playerEntity.setPosition(levels.get(level).getEnterPoint()); + levels.get(level).addEntity(playerEntity); playerInfo.setLevel(level); playerInfo.setEID(playerEid); diff --git a/src/mightypork/rogue/world/WorldCreator.java b/src/mightypork/rogue/world/WorldCreator.java index 7731ad6..8d6a14e 100644 --- a/src/mightypork/rogue/world/WorldCreator.java +++ b/src/mightypork/rogue/world/WorldCreator.java @@ -23,7 +23,7 @@ public class WorldCreator { Level l; // first level - l = LevelGenerator.build(rand.nextLong(), 16, LevelGenerator.DUNGEON_THEME); // + l = LevelGenerator.build(rand.nextLong(), 30, LevelGenerator.DUNGEON_THEME); // w.addLevel(l); w.createPlayer(0); diff --git a/src/mightypork/rogue/world/WorldRenderer.java b/src/mightypork/rogue/world/WorldRenderer.java index fde0531..350956a 100644 --- a/src/mightypork/rogue/world/WorldRenderer.java +++ b/src/mightypork/rogue/world/WorldRenderer.java @@ -4,6 +4,7 @@ package mightypork.rogue.world; import mightypork.gamecore.render.Render; import mightypork.rogue.Res; import mightypork.rogue.world.entity.Entity; +import mightypork.rogue.world.entity.EntityPos; import mightypork.rogue.world.level.Level; import mightypork.rogue.world.level.render.TileRenderContext; import mightypork.util.math.color.RGB; diff --git a/src/mightypork/rogue/world/entity/Entity.java b/src/mightypork/rogue/world/entity/Entity.java index 39ab464..5e8f676 100644 --- a/src/mightypork/rogue/world/entity/Entity.java +++ b/src/mightypork/rogue/world/entity/Entity.java @@ -6,8 +6,6 @@ import java.util.ArrayList; import java.util.List; import mightypork.rogue.world.Coord; -import mightypork.rogue.world.EntityPos; -import mightypork.rogue.world.PathStep; import mightypork.rogue.world.World; import mightypork.rogue.world.entity.models.EntityModel; import mightypork.rogue.world.entity.models.EntityMoveListener; @@ -27,7 +25,7 @@ import mightypork.util.files.ion.IonOutput; * * @author MightyPork */ -public final class Entity implements IonBinary, EntityMoveListener { +public final class Entity implements IonBinary { public static final int ION_MARK = 52; @@ -188,11 +186,15 @@ public final class Entity implements IonBinary, EntityMoveListener { if (walking && data.position.isFinished()) { walking = false; level.freeTile(lastPosition.getCoord()); - - onStepFinished(this); + + for (final EntityMoveListener l : moveListeners) { + l.onStepFinished(this); + } if (data.path.isEmpty()) { - onPathFinished(this); + for (final EntityMoveListener l : moveListeners) { + l.onPathFinished(this); + } } } @@ -206,7 +208,11 @@ public final class Entity implements IonBinary, EntityMoveListener { if (!level.canWalkInto(planned)) { cancelPath(); - onPathInterrupted(this); + + for (final EntityMoveListener l : moveListeners) { + l.onPathInterrupted(this); + } + walking = false; } else { @@ -252,6 +258,8 @@ public final class Entity implements IonBinary, EntityMoveListener { public boolean navigateTo(Coord pos) { + if(pos.equals(getCoord())) return true; + final List path = PathFinder.findPathRelative(pfc, getPosition().getCoord(), pos); if (path == null) return false; @@ -262,33 +270,6 @@ public final class Entity implements IonBinary, EntityMoveListener { } - @Override - public void onStepFinished(Entity entity) - { - for (final EntityMoveListener l : moveListeners) { - l.onStepFinished(entity); - } - } - - - @Override - public void onPathFinished(Entity entity) - { - for (final EntityMoveListener l : moveListeners) { - l.onStepFinished(entity); - } - } - - - @Override - public void onPathInterrupted(Entity entity) - { - for (final EntityMoveListener l : moveListeners) { - l.onPathInterrupted(entity); - } - } - - public void addMoveListener(EntityMoveListener listener) { moveListeners.add(listener); @@ -304,6 +285,7 @@ public final class Entity implements IonBinary, EntityMoveListener { public void setLevel(Level level) { this.level = level; + model.onEnteredLevel(this); } @@ -311,4 +293,10 @@ public final class Entity implements IonBinary, EntityMoveListener { { return data.position.getCoord(); } + + + public EntityModel getModel() + { + return model; + } } diff --git a/src/mightypork/rogue/world/entity/EntityData.java b/src/mightypork/rogue/world/entity/EntityData.java index 5be9d5d..e3f0f85 100644 --- a/src/mightypork/rogue/world/entity/EntityData.java +++ b/src/mightypork/rogue/world/entity/EntityData.java @@ -5,8 +5,6 @@ import java.io.IOException; import java.util.LinkedList; import java.util.Queue; -import mightypork.rogue.world.EntityPos; -import mightypork.rogue.world.PathStep; import mightypork.util.files.ion.IonBundle; import mightypork.util.files.ion.IonBundled; diff --git a/src/mightypork/rogue/world/EntityPos.java b/src/mightypork/rogue/world/entity/EntityPos.java similarity index 97% rename from src/mightypork/rogue/world/EntityPos.java rename to src/mightypork/rogue/world/entity/EntityPos.java index a90c5aa..0203369 100644 --- a/src/mightypork/rogue/world/EntityPos.java +++ b/src/mightypork/rogue/world/entity/EntityPos.java @@ -1,8 +1,9 @@ -package mightypork.rogue.world; +package mightypork.rogue.world.entity; import java.io.IOException; +import mightypork.rogue.world.Coord; import mightypork.util.files.ion.IonBundle; import mightypork.util.files.ion.IonBundled; import mightypork.util.math.Easing; diff --git a/src/mightypork/rogue/world/PathStep.java b/src/mightypork/rogue/world/entity/PathStep.java similarity index 95% rename from src/mightypork/rogue/world/PathStep.java rename to src/mightypork/rogue/world/entity/PathStep.java index 0676872..7381ca3 100644 --- a/src/mightypork/rogue/world/PathStep.java +++ b/src/mightypork/rogue/world/entity/PathStep.java @@ -1,8 +1,9 @@ -package mightypork.rogue.world; +package mightypork.rogue.world.entity; import java.io.IOException; +import mightypork.rogue.world.Coord; import mightypork.util.files.ion.IonBinary; import mightypork.util.files.ion.IonInput; import mightypork.util.files.ion.IonOutput; diff --git a/src/mightypork/rogue/world/entity/models/EntityModel.java b/src/mightypork/rogue/world/entity/models/EntityModel.java index 94cec4b..641f573 100644 --- a/src/mightypork/rogue/world/entity/models/EntityModel.java +++ b/src/mightypork/rogue/world/entity/models/EntityModel.java @@ -8,6 +8,7 @@ import mightypork.rogue.world.entity.EntityData; import mightypork.rogue.world.entity.renderers.EntityRenderer; import mightypork.rogue.world.pathfinding.Heuristic; import mightypork.rogue.world.pathfinding.PathFinder; +import mightypork.util.annotations.DefaultImpl; /** @@ -22,8 +23,7 @@ public abstract class EntityModel implements EntityMoveListener { public EntityRenderer renderer = EntityRenderer.NONE; - public EntityModel(int id) - { + public EntityModel(int id) { Entities.register(id, this); this.id = id; } @@ -69,24 +69,28 @@ public abstract class EntityModel implements EntityMoveListener { public abstract void onPathInterrupted(Entity entity); + @DefaultImpl public boolean canWalkInto(Entity entity, Coord pos) { return entity.getLevel().canWalkInto(pos); } + @DefaultImpl public int getPathMinCost() { return 10; } + @DefaultImpl public Heuristic getPathHeuristic() { return PathFinder.DIAGONAL_HEURISTIC; } + @DefaultImpl public int getPathCost(Entity entity, Coord from, Coord to) { return 10; @@ -95,4 +99,10 @@ public abstract class EntityModel implements EntityMoveListener { public abstract void initMetadata(EntityData metadata); + + @DefaultImpl + public void onEnteredLevel(Entity entity) + { + } + } diff --git a/src/mightypork/rogue/world/entity/models/PlayerModel.java b/src/mightypork/rogue/world/entity/models/PlayerModel.java index ab5dc73..6e6f15c 100644 --- a/src/mightypork/rogue/world/entity/models/PlayerModel.java +++ b/src/mightypork/rogue/world/entity/models/PlayerModel.java @@ -19,8 +19,7 @@ public class PlayerModel extends EntityModel { private static final double STEP_TIME = 0.25; - public PlayerModel(int id) - { + public PlayerModel(int id) { super(id); setRenderer(new PlayerRenderer("player")); } @@ -42,9 +41,20 @@ public class PlayerModel extends EntityModel { @Override public void onStepFinished(Entity entity) { - final Level l = entity.getLevel(); - - l.markExplored(entity.getCoord(), 4.5); + exploreSurroundings(entity); + } + + + private void exploreSurroundings(Entity entity) + { + entity.getLevel().markExplored(entity.getCoord(), 4.5); + } + + + @Override + public void onEnteredLevel(Entity entity) + { + exploreSurroundings(entity); } @@ -70,6 +80,17 @@ public class PlayerModel extends EntityModel { public boolean canWalkInto(Entity entity, Coord pos) { final Tile t = entity.getLevel().getTile(pos); - return (t.data.explored || pos.dist(entity.getCoord()) < 6) && t.isWalkable(); + return t.isWalkable(); + } + + + @Override + public int getPathCost(Entity entity, Coord from, Coord to) + { + if (!entity.getLevel().getTile(entity.getCoord()).data.explored) { + return 1000; + } + + return super.getPathCost(entity, from, to); } } diff --git a/src/mightypork/rogue/world/entity/renderers/PlayerRenderer.java b/src/mightypork/rogue/world/entity/renderers/PlayerRenderer.java index 15704dd..8d3f0a6 100644 --- a/src/mightypork/rogue/world/entity/renderers/PlayerRenderer.java +++ b/src/mightypork/rogue/world/entity/renderers/PlayerRenderer.java @@ -5,8 +5,8 @@ import mightypork.gamecore.render.Render; import mightypork.gamecore.render.textures.TxQuad; import mightypork.gamecore.render.textures.TxSheet; import mightypork.rogue.Res; -import mightypork.rogue.world.EntityPos; import mightypork.rogue.world.entity.Entity; +import mightypork.rogue.world.entity.EntityPos; import mightypork.rogue.world.level.render.MapRenderContext; import mightypork.util.math.Calc; import mightypork.util.math.constraints.rect.Rect; diff --git a/src/mightypork/rogue/world/gen/LevelGenerator.java b/src/mightypork/rogue/world/gen/LevelGenerator.java index bc85b47..6a41ed8 100644 --- a/src/mightypork/rogue/world/gen/LevelGenerator.java +++ b/src/mightypork/rogue/world/gen/LevelGenerator.java @@ -22,18 +22,18 @@ public class LevelGenerator { { final Random rand = new Random(seed + 13); - final int max_size = 256; + final int max_size = 128; final ScratchMap map = new ScratchMap(max_size, theme, rand); // start map.addRoom(ROOM_SQUARE); - for (int i = 0; i < 2 + rand.nextInt(1 + complexity + (int) Math.pow(complexity, 1.6)); i++) { + for (int i = 0; i < 1+complexity/4 + rand.nextInt(3 + complexity); i++) { map.addRoom(ROOM_SQUARE); } - for (int i = 0; i < 2 + rand.nextInt(1 + complexity / 3 + (int) Math.pow(complexity, 1.2)); i++) { + for (int i = 0; i < 1 + complexity/8 + rand.nextInt(1 + complexity); i++) { map.addRoom(DEAD_END); } diff --git a/src/mightypork/rogue/world/gen/ScratchMap.java b/src/mightypork/rogue/world/gen/ScratchMap.java index 50b9c32..798fbc4 100644 --- a/src/mightypork/rogue/world/gen/ScratchMap.java +++ b/src/mightypork/rogue/world/gen/ScratchMap.java @@ -2,8 +2,10 @@ package mightypork.rogue.world.gen; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import java.util.Random; +import java.util.Set; import mightypork.rogue.world.Coord; import mightypork.rogue.world.level.Level; @@ -14,6 +16,7 @@ import mightypork.rogue.world.tile.Tile; import mightypork.rogue.world.tile.TileModel; import mightypork.rogue.world.tile.Tiles; import mightypork.util.logging.Log; +import mightypork.util.math.Calc; public class ScratchMap { @@ -56,7 +59,7 @@ public class ScratchMap { if (t.isDoor()) return 10; // door if (t.isFloor()) return 20; // floor - + if (t.isWall() && t.genData.isProtected) return 1000; return 100; // wall @@ -91,8 +94,7 @@ public class ScratchMap { private static final boolean FIX_GLITCHES = true; - public ScratchMap(int max_size, Theme theme, Random rand) - { + public ScratchMap(int max_size, Theme theme, Random rand) { map = new Tile[max_size][max_size]; genMin = Coord.make((max_size / 2) - 1, (max_size / 2) - 1); @@ -174,7 +176,9 @@ public class ScratchMap { public Tile get(Coord pos) { - if (!isIn(pos)) { throw new IndexOutOfBoundsException("Tile not in map: " + pos); } + if (!isIn(pos)) { + throw new IndexOutOfBoundsException("Tile not in map: " + pos); + } return map[pos.y][pos.x]; } @@ -188,7 +192,9 @@ public class ScratchMap { public boolean set(Coord pos, Tile tile) { - if (!isIn(pos)) { throw new IndexOutOfBoundsException("Tile not in map: " + pos); } + if (!isIn(pos)) { + throw new IndexOutOfBoundsException("Tile not in map: " + pos); + } map[pos.y][pos.x] = tile; return true; @@ -256,17 +262,25 @@ public class ScratchMap { public void buildCorridors() { Log.f3("Building corridors."); - for (int i = 0; i < nodes.size(); i++) { - for (int j = i + 1; j < nodes.size(); j++) { - buildCorridor(nodes.get(i), nodes.get(j)); + + Coord start = nodes.get(0); + Set starts = new HashSet<>(); + + for (int i = 0; i < 1+rooms.size()/8; i++) { + if (!starts.contains(start)) { + for (int j = 0; j < nodes.size(); j++) { + buildCorridor(start, nodes.get(j)); + } } + starts.add(start); + start = Calc.pick(nodes); } } private void buildCorridor(Coord node1, Coord node2) { - //Log.f3("Finding path " + node1 + " -> " + node2); + Log.f3("Building corridor " + node1 + " -> " + node2); final List steps = PathFinder.findPath(pfc, node1, node2); if (steps == null) { @@ -296,7 +310,7 @@ public class ScratchMap { final Tile current = get(c); if (!current.isNull() && (current.isPotentiallyWalkable())) continue; // floor already, let it be - + if (i == 0 && j == 0) { set(c, theme.floor()); } else { diff --git a/src/mightypork/rogue/world/pathfinding/PathFinder.java b/src/mightypork/rogue/world/pathfinding/PathFinder.java index 74bda8e..755be29 100644 --- a/src/mightypork/rogue/world/pathfinding/PathFinder.java +++ b/src/mightypork/rogue/world/pathfinding/PathFinder.java @@ -8,7 +8,7 @@ import java.util.LinkedList; import java.util.List; import mightypork.rogue.world.Coord; -import mightypork.rogue.world.PathStep; +import mightypork.rogue.world.entity.PathStep; /** diff --git a/src/mightypork/rogue/world/tile/Tile.java b/src/mightypork/rogue/world/tile/Tile.java index 99a455b..bfe0126 100644 --- a/src/mightypork/rogue/world/tile/Tile.java +++ b/src/mightypork/rogue/world/tile/Tile.java @@ -39,20 +39,17 @@ public final class Tile implements IonBinary { private boolean occupied; - public Tile(int id) - { + public Tile(int id) { this(Tiles.get(id)); } - public Tile(TileModel model) - { + public Tile(TileModel model) { setModel(model); } - public Tile() - { + public Tile() { } @@ -210,4 +207,16 @@ public final class Tile implements IonBinary { { return model.getMapColor(this); } + + + public boolean isExplored() + { + return data.explored; + } + + + public void explore() + { + data.explored = true; + } } diff --git a/src/mightypork/rogue/world/tile/models/Floor.java b/src/mightypork/rogue/world/tile/models/Floor.java index 7c1fbf1..515a025 100644 --- a/src/mightypork/rogue/world/tile/models/Floor.java +++ b/src/mightypork/rogue/world/tile/models/Floor.java @@ -4,6 +4,8 @@ package mightypork.rogue.world.tile.models; import mightypork.rogue.world.tile.Tile; import mightypork.util.math.color.COMMODORE; import mightypork.util.math.color.Color; +import mightypork.util.math.color.PAL16; +import mightypork.util.math.color.RGB; public class Floor extends AbstractTile { @@ -45,6 +47,6 @@ public class Floor extends AbstractTile { @Override public Color getMapColor(Tile tile) { - return COMMODORE.GRAY_DARK; + return RGB.GRAY_DARK; } } diff --git a/src/mightypork/rogue/world/tile/models/SimpleDoor.java b/src/mightypork/rogue/world/tile/models/SimpleDoor.java index 470859e..0accaeb 100644 --- a/src/mightypork/rogue/world/tile/models/SimpleDoor.java +++ b/src/mightypork/rogue/world/tile/models/SimpleDoor.java @@ -5,6 +5,8 @@ import mightypork.rogue.world.tile.Tile; import mightypork.rogue.world.tile.renderers.DoorRenderer; import mightypork.util.math.color.COMMODORE; import mightypork.util.math.color.Color; +import mightypork.util.math.color.PAL16; +import mightypork.util.math.color.RGB; public class SimpleDoor extends AbstractTile { @@ -60,6 +62,6 @@ public class SimpleDoor extends AbstractTile { @Override public Color getMapColor(Tile tile) { - return COMMODORE.BROWN; + return PAL16.NEWPOOP; } } diff --git a/src/mightypork/rogue/world/tile/models/Wall.java b/src/mightypork/rogue/world/tile/models/Wall.java index 8433661..906120c 100644 --- a/src/mightypork/rogue/world/tile/models/Wall.java +++ b/src/mightypork/rogue/world/tile/models/Wall.java @@ -4,6 +4,7 @@ package mightypork.rogue.world.tile.models; import mightypork.rogue.world.tile.Tile; import mightypork.util.math.color.COMMODORE; import mightypork.util.math.color.Color; +import mightypork.util.math.color.RGB; /** @@ -50,6 +51,6 @@ public class Wall extends AbstractTile { @Override public Color getMapColor(Tile tile) { - return COMMODORE.GRAY_LIGHT; + return RGB.GRAY_LIGHT; } } diff --git a/src/mightypork/util/control/eventbus/BusEvent.java b/src/mightypork/util/control/eventbus/BusEvent.java index 7de36f3..b9aa37e 100644 --- a/src/mightypork/util/control/eventbus/BusEvent.java +++ b/src/mightypork/util/control/eventbus/BusEvent.java @@ -85,7 +85,7 @@ public abstract class BusEvent { * * @return true if consumed */ - final boolean isConsumed() + public final boolean isConsumed() { return consumed; } diff --git a/src/mightypork/util/math/Calc.java b/src/mightypork/util/math/Calc.java index b4b66bd..562c94e 100644 --- a/src/mightypork/util/math/Calc.java +++ b/src/mightypork/util/math/Calc.java @@ -616,7 +616,7 @@ public class Calc { * @param list list of choices * @return picked element */ - public static Object pick(List list) + public static T pick(List list) { if (list.size() == 0) return null; return list.get(rand.nextInt(list.size()));