diff --git a/core/src/main/assets/tiles0.png b/core/src/main/assets/tiles0.png index f32632a0a..fdc2848ee 100644 Binary files a/core/src/main/assets/tiles0.png and b/core/src/main/assets/tiles0.png differ diff --git a/core/src/main/assets/tiles1.png b/core/src/main/assets/tiles1.png index 91b6a4c07..bed35b437 100644 Binary files a/core/src/main/assets/tiles1.png and b/core/src/main/assets/tiles1.png differ diff --git a/core/src/main/assets/tiles2.png b/core/src/main/assets/tiles2.png index fa1adbc6a..5e96de266 100644 Binary files a/core/src/main/assets/tiles2.png and b/core/src/main/assets/tiles2.png differ diff --git a/core/src/main/assets/tiles3.png b/core/src/main/assets/tiles3.png index 445f5363c..9e47c588a 100644 Binary files a/core/src/main/assets/tiles3.png and b/core/src/main/assets/tiles3.png differ diff --git a/core/src/main/assets/tiles4.png b/core/src/main/assets/tiles4.png index 22177651c..bf801f036 100644 Binary files a/core/src/main/assets/tiles4.png and b/core/src/main/assets/tiles4.png differ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/DungeonTilemap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/DungeonTilemap.java index ee6fe881d..a75260514 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/DungeonTilemap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/DungeonTilemap.java @@ -31,6 +31,7 @@ import com.watabou.noosa.tweeners.AlphaTweener; import com.watabou.utils.PathFinder; import com.watabou.utils.Point; import com.watabou.utils.PointF; +import com.watabou.utils.Random; import java.util.Arrays; import java.util.List; @@ -44,7 +45,6 @@ public class DungeonTilemap extends Tilemap { //Used to map dungeon tiles to their default visual values public static SparseIntArray defaultVisuals = new SparseIntArray(32); static { - defaultVisuals = new SparseIntArray(32); defaultVisuals.put(Terrain.CHASM, 0); defaultVisuals.put(Terrain.EMPTY, 1); defaultVisuals.put(Terrain.GRASS, 2); @@ -80,6 +80,26 @@ public class DungeonTilemap extends Tilemap { defaultVisuals.put(Terrain.WATER, 63); } + //These alt visuals will trigger 50% of the time + public static SparseIntArray commonAltVisuals = new SparseIntArray(32); + static { + commonAltVisuals.put(1, 38); + commonAltVisuals.put(2, 39); + commonAltVisuals.put(4, 40); + commonAltVisuals.put(9, 41); + commonAltVisuals.put(12, 42); + commonAltVisuals.put(14, 43); + commonAltVisuals.put(15, 44); + commonAltVisuals.put(16, 45); + commonAltVisuals.put(23, 46); + } + + //These alt visuals trigger 10% of the time (and also override common alts when they show up) + public static SparseIntArray rareAltVisuals = new SparseIntArray(32); + static { + rareAltVisuals.put(1, 47); + } + //These tiles can stitch with water public static List waterStitcheable = Arrays.asList( Terrain.EMPTY, Terrain.GRASS, Terrain.EMPTY_WELL, @@ -118,11 +138,19 @@ public class DungeonTilemap extends Tilemap { } private int[] map; + private float[] tileVariance; public DungeonTilemap() { super( Dungeon.level.tilesTex(), new TextureFilm( Dungeon.level.tilesTex(), SIZE, SIZE ) ); + + Random.seed( Dungeon.seedCurDepth()); + tileVariance = new float[Dungeon.level.map.length]; + for (int i = 0; i < tileVariance.length; i++) + tileVariance[i] = Random.Float(); + Random.seed(); + map( Dungeon.level.map, Dungeon.level.width() ); instance = this; @@ -153,19 +181,30 @@ public class DungeonTilemap extends Tilemap { } private int setCellVisuals(int pos, int tile){ + int visual = defaultVisuals.get(tile); + if (tile == Terrain.WATER){ - tile = defaultVisuals.get(tile); for (int i = 0; i < PathFinder.CIRCLE4.length; i++){ if (waterStitcheable.contains(map[pos + PathFinder.CIRCLE4[i]])) { //equivalent to: cell -= 2^i - tile -= (1 << i); + visual -= (1 << i); } } - return tile; - } else if (tile == Terrain.CHASM && pos >= mapWidth){ - return chasmStitcheable.get(map[pos - mapWidth], defaultVisuals.get(tile)); + return visual; + + } else if (tile == Terrain.CHASM && pos >= mapWidth) { + return chasmStitcheable.get(map[pos - mapWidth], visual); + + } else if (tileVariance[pos] > 0.9f + && rareAltVisuals.indexOfKey(visual) >= 0){ + return rareAltVisuals.get(visual); + + } else if (tileVariance[pos] > 0.5f + && commonAltVisuals.indexOfKey(visual) >= 0) { + return commonAltVisuals.get(visual); } - return defaultVisuals.get(tile); + + return visual; } public int screenToTile(int x, int y ) {