v0.3.2: added the ability to examine custom tile visuals
This commit is contained in:
parent
d45f2b4573
commit
82cb22f1bf
|
@ -83,9 +83,20 @@ public class MassGravePainter extends Painter {
|
||||||
|
|
||||||
public static class Bones extends CustomTileVisual {
|
public static class Bones extends CustomTileVisual {
|
||||||
{
|
{
|
||||||
|
name = "Mass grave";
|
||||||
|
|
||||||
tx = Assets.PRISON_QUEST;
|
tx = Assets.PRISON_QUEST;
|
||||||
txX = 3;
|
txX = 3;
|
||||||
txY = 0;
|
txY = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String desc() {
|
||||||
|
if (ofsX == 1 && ofsY == 1) {
|
||||||
|
return "bones litter the floor, what happened here?";
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,11 +60,17 @@ public class RitualSitePainter extends Painter {
|
||||||
public static class RitualMarker extends CustomTileVisual{
|
public static class RitualMarker extends CustomTileVisual{
|
||||||
|
|
||||||
{
|
{
|
||||||
|
name = "Ritual marker";
|
||||||
|
|
||||||
tx = Assets.PRISON_QUEST;
|
tx = Assets.PRISON_QUEST;
|
||||||
txX = txY = 0;
|
txX = txY = 0;
|
||||||
tileW = tileH = 3;
|
tileW = tileH = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String desc() {
|
||||||
|
return "A painted marker for some dark ritual. Candles are usually placed on the four corners.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,10 +76,16 @@ public class WeakFloorPainter extends Painter {
|
||||||
public static class HiddenWell extends CustomTileVisual{
|
public static class HiddenWell extends CustomTileVisual{
|
||||||
|
|
||||||
{
|
{
|
||||||
|
name = "Distant well";
|
||||||
|
|
||||||
tx = Assets.WEAK_FLOOR;
|
tx = Assets.WEAK_FLOOR;
|
||||||
txX = Dungeon.depth/5;
|
txX = Dungeon.depth/5;
|
||||||
txY = 0;
|
txY = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String desc() {
|
||||||
|
return "You can just make out a well in the depths below, perhaps there is something down there?";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,14 +32,16 @@ public abstract class CustomTileVisual extends Image implements Bundlable {
|
||||||
|
|
||||||
protected static final int TILE_SIZE = 16;
|
protected static final int TILE_SIZE = 16;
|
||||||
|
|
||||||
|
public String name;
|
||||||
|
|
||||||
protected String tx; //string for resource file
|
protected String tx; //string for resource file
|
||||||
protected int txX, txY; //position(in tiles) within 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
|
//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)
|
//(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
|
public 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 tileW = 1, tileH = 1; //width and height in tiles
|
||||||
|
|
||||||
public void pos(int pos) {
|
public void pos(int pos) {
|
||||||
pos( pos%Level.WIDTH, pos/Level.WIDTH );
|
pos( pos%Level.WIDTH, pos/Level.WIDTH );
|
||||||
|
@ -50,6 +52,10 @@ public abstract class CustomTileVisual extends Image implements Bundlable {
|
||||||
this.tileY = tileY;
|
this.tileY = tileY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String desc(){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public CustomTileVisual create() {
|
public CustomTileVisual create() {
|
||||||
texture(tx);
|
texture(tx);
|
||||||
frame(texture.uvRect((txX + ofsX) * TILE_SIZE, (txY + ofsY) * TILE_SIZE,
|
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;
|
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<CustomTileVisual> CustomTilesForRoom(Room r, Class<?extends CustomTileVisual> c){
|
public static ArrayList<CustomTileVisual> CustomTilesForRoom(Room r, Class<?extends CustomTileVisual> c){
|
||||||
ArrayList<CustomTileVisual> result = new ArrayList<>();
|
ArrayList<CustomTileVisual> result = new ArrayList<>();
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.windows;
|
package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.ui.CustomTileVisual;
|
||||||
import com.watabou.noosa.BitmapTextMultiline;
|
import com.watabou.noosa.BitmapTextMultiline;
|
||||||
import com.watabou.noosa.Image;
|
import com.watabou.noosa.Image;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
|
@ -48,30 +49,53 @@ public class WndInfoCell extends Window {
|
||||||
} else if (Level.pit[cell]) {
|
} else if (Level.pit[cell]) {
|
||||||
tile = Terrain.CHASM;
|
tile = Terrain.CHASM;
|
||||||
}
|
}
|
||||||
|
|
||||||
IconTitle titlebar = new IconTitle();
|
CustomTileVisual vis = null;
|
||||||
if (tile == Terrain.WATER) {
|
int x = cell % Level.WIDTH;
|
||||||
Image water = new Image( Dungeon.level.waterTex() );
|
int y = cell / Level.WIDTH;
|
||||||
water.frame( 0, 0, DungeonTilemap.SIZE, DungeonTilemap.SIZE );
|
for (CustomTileVisual i : Dungeon.level.customTiles){
|
||||||
titlebar.icon( water );
|
if ((x >= i.tileX && x < i.tileX+i.tileW) &&
|
||||||
} else {
|
(y >= i.tileY && y < i.tileY+i.tileH)){
|
||||||
titlebar.icon( DungeonTilemap.tile( tile ) );
|
if (i.desc() != null) {
|
||||||
|
vis = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
titlebar.label( Dungeon.level.tileName( tile ) );
|
|
||||||
titlebar.setRect( 0, 0, WIDTH, 0 );
|
|
||||||
add( titlebar );
|
String desc = "";
|
||||||
|
|
||||||
BitmapTextMultiline info = PixelScene.createMultiline( 6 );
|
IconTitle titlebar = new IconTitle();
|
||||||
add( info );
|
if (vis != null){
|
||||||
|
titlebar.icon(new Image(vis));
|
||||||
StringBuilder desc = new StringBuilder( Dungeon.level.tileDesc( tile ) );
|
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()) {
|
for (Blob blob:Dungeon.level.blobs.values()) {
|
||||||
if (blob.cur[cell] > 0 && blob.tileDesc() != null) {
|
if (blob.cur[cell] > 0 && blob.tileDesc() != null) {
|
||||||
if (desc.length() > 0) {
|
if (desc.length() > 0) {
|
||||||
desc.append( "\n\n" );
|
desc += "\n\n";
|
||||||
}
|
}
|
||||||
desc.append( blob.tileDesc() );
|
desc += blob.tileDesc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user