diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/MassGravePainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/MassGravePainter.java index c03d427b2..49df26a8f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/MassGravePainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/MassGravePainter.java @@ -83,9 +83,20 @@ public class MassGravePainter extends Painter { public static class Bones extends CustomTileVisual { { + name = "Mass grave"; + tx = Assets.PRISON_QUEST; txX = 3; txY = 0; } + + @Override + public String desc() { + if (ofsX == 1 && ofsY == 1) { + return "bones litter the floor, what happened here?"; + } else { + return null; + } + } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/RitualSitePainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/RitualSitePainter.java index fbda13131..1ca99589d 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/RitualSitePainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/RitualSitePainter.java @@ -60,11 +60,17 @@ public class RitualSitePainter extends Painter { public static class RitualMarker extends CustomTileVisual{ { + name = "Ritual marker"; + tx = Assets.PRISON_QUEST; txX = txY = 0; tileW = tileH = 3; } + @Override + public String desc() { + return "A painted marker for some dark ritual. Candles are usually placed on the four corners."; + } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/WeakFloorPainter.java b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/WeakFloorPainter.java index 2ab22ba9b..ee58a84fb 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/WeakFloorPainter.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/levels/painters/WeakFloorPainter.java @@ -76,10 +76,16 @@ public class WeakFloorPainter extends Painter { public static class HiddenWell extends CustomTileVisual{ { + name = "Distant well"; + tx = Assets.WEAK_FLOOR; txX = Dungeon.depth/5; txY = 0; } + @Override + public String desc() { + return "You can just make out a well in the depths below, perhaps there is something down there?"; + } } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/CustomTileVisual.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/CustomTileVisual.java index 87ce6175c..41cfa5304 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/CustomTileVisual.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/CustomTileVisual.java @@ -32,14 +32,16 @@ public abstract class CustomTileVisual extends Image implements Bundlable { protected static final int TILE_SIZE = 16; + public String name; + protected String tx; //string for resource file protected int txX, txY; //position(in tiles) within resource file //bundleable offsets from the standard texture xy, useful for mapping larger than 1x1 textures to many tiles //(e.g. mapping a 3x3 texture to a room, where the corners are walls and the center is the floor) - private int ofsX = 0, ofsY = 0; + protected int ofsX = 0, ofsY = 0; - protected int tileX, tileY; //x and y coords for texture within a level - protected int tileW = 1, tileH = 1; //width and height in tiles + public int tileX, tileY; //x and y coords for texture within a level + public int tileW = 1, tileH = 1; //width and height in tiles public void pos(int pos) { pos( pos%Level.WIDTH, pos/Level.WIDTH ); @@ -50,6 +52,10 @@ public abstract class CustomTileVisual extends Image implements Bundlable { this.tileY = tileY; } + public String desc(){ + return null; + } + public CustomTileVisual create() { texture(tx); frame(texture.uvRect((txX + ofsX) * TILE_SIZE, (txY + ofsY) * TILE_SIZE, @@ -61,7 +67,7 @@ public abstract class CustomTileVisual extends Image implements Bundlable { return this; } - // + //returns a number of 1x1 tiles to fill a room, based on a 3x3 texture, not dissimilar to a ninepatch. public static ArrayList CustomTilesForRoom(Room r, Class c){ ArrayList result = new ArrayList<>(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoCell.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoCell.java index 9b5c03945..36fad5a2b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoCell.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoCell.java @@ -20,6 +20,7 @@ */ package com.shatteredpixel.shatteredpixeldungeon.windows; +import com.shatteredpixel.shatteredpixeldungeon.ui.CustomTileVisual; import com.watabou.noosa.BitmapTextMultiline; import com.watabou.noosa.Image; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; @@ -48,30 +49,53 @@ public class WndInfoCell extends Window { } else if (Level.pit[cell]) { tile = Terrain.CHASM; } - - IconTitle titlebar = new IconTitle(); - if (tile == Terrain.WATER) { - Image water = new Image( Dungeon.level.waterTex() ); - water.frame( 0, 0, DungeonTilemap.SIZE, DungeonTilemap.SIZE ); - titlebar.icon( water ); - } else { - titlebar.icon( DungeonTilemap.tile( tile ) ); + + CustomTileVisual vis = null; + int x = cell % Level.WIDTH; + int y = cell / Level.WIDTH; + for (CustomTileVisual i : Dungeon.level.customTiles){ + if ((x >= i.tileX && x < i.tileX+i.tileW) && + (y >= i.tileY && y < i.tileY+i.tileH)){ + if (i.desc() != null) { + vis = i; + break; + } + } } - titlebar.label( Dungeon.level.tileName( tile ) ); - titlebar.setRect( 0, 0, WIDTH, 0 ); - add( titlebar ); - - BitmapTextMultiline info = PixelScene.createMultiline( 6 ); - add( info ); - - StringBuilder desc = new StringBuilder( Dungeon.level.tileDesc( tile ) ); + + + String desc = ""; + + IconTitle titlebar = new IconTitle(); + if (vis != null){ + titlebar.icon(new Image(vis)); + titlebar.label(vis.name); + desc += vis.desc(); + } else { + + if (tile == Terrain.WATER) { + Image water = new Image(Dungeon.level.waterTex()); + water.frame(0, 0, DungeonTilemap.SIZE, DungeonTilemap.SIZE); + titlebar.icon(water); + } else { + titlebar.icon(DungeonTilemap.tile(tile)); + } + titlebar.label(Dungeon.level.tileName(tile)); + desc += Dungeon.level.tileDesc(tile); + + } + titlebar.setRect(0, 0, WIDTH, 0); + add(titlebar); + + BitmapTextMultiline info = PixelScene.createMultiline(6); + add(info); for (Blob blob:Dungeon.level.blobs.values()) { if (blob.cur[cell] > 0 && blob.tileDesc() != null) { if (desc.length() > 0) { - desc.append( "\n\n" ); + desc += "\n\n"; } - desc.append( blob.tileDesc() ); + desc += blob.tileDesc(); } }