v0.4.3: removed visual-only tile types
This commit is contained in:
parent
1565030825
commit
2a73678529
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.shatteredpixel.shatteredpixeldungeon"
|
||||
android:versionCode="129"
|
||||
android:versionName="0.4.2b"
|
||||
android:versionCode="130"
|
||||
android:versionName="0.4.3-INDEV"
|
||||
android:installLocation="auto">
|
||||
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
|
|
|
@ -334,6 +334,11 @@ public abstract class Level implements Bundlable {
|
|||
map = Terrain.convertTrapsFrom43( map, traps );
|
||||
}
|
||||
|
||||
//for pre-0.4.3 saves
|
||||
if (version < 130){
|
||||
map = Terrain.convertTilesFrom129( map );
|
||||
}
|
||||
|
||||
Collection<Bundlable> collection = bundle.getCollection( HEAPS );
|
||||
for (Bundlable h : collection) {
|
||||
Heap heap = (Heap)h;
|
||||
|
@ -587,41 +592,6 @@ public abstract class Level implements Bundlable {
|
|||
passable[i] = avoid[i] = false;
|
||||
passable[i + width()-1] = avoid[i + width()-1] = false;
|
||||
}
|
||||
|
||||
for (int i=width(); i < length() - width(); i++) {
|
||||
|
||||
if (water[i]) {
|
||||
map[i] = getWaterTile( i );
|
||||
}
|
||||
|
||||
if (pit[i]) {
|
||||
if (!pit[i - width()]) {
|
||||
int c = map[i - width()];
|
||||
if (c == Terrain.EMPTY_SP || c == Terrain.STATUE_SP) {
|
||||
map[i] = Terrain.CHASM_FLOOR_SP;
|
||||
} else if (water[i - width()]) {
|
||||
map[i] = Terrain.CHASM_WATER;
|
||||
} else if ((Terrain.flags[c] & Terrain.UNSTITCHABLE) != 0) {
|
||||
map[i] = Terrain.CHASM_WALL;
|
||||
} else {
|
||||
map[i] = Terrain.CHASM_FLOOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//FIXME this is a temporary fix here to avoid changing the tiles texture
|
||||
//This logic will be changed in 0.4.3 anyway
|
||||
private static int[] N4Indicies = new int[]{0, 2, 3, 1};
|
||||
private int getWaterTile( int pos ) {
|
||||
int t = Terrain.WATER_TILES;
|
||||
for (int j=0; j < PathFinder.NEIGHBOURS4.length; j++) {
|
||||
if ((Terrain.flags[map[pos + PathFinder.NEIGHBOURS4[N4Indicies[j]]]] & Terrain.UNSTITCHABLE) != 0) {
|
||||
t += 1 << j;
|
||||
}
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
public void destroy( int pos ) {
|
||||
|
@ -638,7 +608,7 @@ public abstract class Level implements Bundlable {
|
|||
}
|
||||
}
|
||||
if (flood) {
|
||||
set( pos, getWaterTile( pos ) );
|
||||
set( pos, Terrain.WATER );
|
||||
} else {
|
||||
set( pos, Terrain.EMBERS );
|
||||
}
|
||||
|
@ -691,7 +661,7 @@ public abstract class Level implements Bundlable {
|
|||
solid[cell] = (flags & Terrain.SOLID) != 0;
|
||||
avoid[cell] = (flags & Terrain.AVOID) != 0;
|
||||
pit[cell] = (flags & Terrain.PIT) != 0;
|
||||
water[cell] = terrain == Terrain.WATER || terrain >= Terrain.WATER_TILES;
|
||||
water[cell] = terrain == Terrain.WATER;
|
||||
}
|
||||
|
||||
public Heap drop( Item item, int cell ) {
|
||||
|
@ -1021,14 +991,6 @@ public abstract class Level implements Bundlable {
|
|||
|
||||
public String tileName( int tile ) {
|
||||
|
||||
if (tile >= Terrain.WATER_TILES) {
|
||||
return tileName( Terrain.WATER );
|
||||
}
|
||||
|
||||
if (tile != Terrain.CHASM && (Terrain.flags[tile] & Terrain.PIT) != 0) {
|
||||
return tileName( Terrain.CHASM );
|
||||
}
|
||||
|
||||
switch (tile) {
|
||||
case Terrain.CHASM:
|
||||
return Messages.get(Level.class, "chasm_name");
|
||||
|
@ -1121,12 +1083,6 @@ public abstract class Level implements Bundlable {
|
|||
case Terrain.EMPTY_WELL:
|
||||
return Messages.get(Level.class, "empty_well_desc");
|
||||
default:
|
||||
if (tile >= Terrain.WATER_TILES) {
|
||||
return tileDesc( Terrain.WATER );
|
||||
}
|
||||
if ((Terrain.flags[tile] & Terrain.PIT) != 0) {
|
||||
return tileDesc( Terrain.CHASM );
|
||||
}
|
||||
return Messages.get(Level.class, "default_desc");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -249,7 +249,7 @@ public class SewerBossLevel extends RegularLevel {
|
|||
|
||||
super.seal();
|
||||
|
||||
set( entrance, Terrain.WATER_TILES );
|
||||
set( entrance, Terrain.WATER );
|
||||
GameScene.updateMap( entrance );
|
||||
GameScene.ripple( entrance );
|
||||
|
||||
|
|
|
@ -65,13 +65,7 @@ public class Terrain {
|
|||
public static final int BOOKSHELF = 27;
|
||||
public static final int ALCHEMY = 28;
|
||||
|
||||
public static final int CHASM_FLOOR = 29;
|
||||
public static final int CHASM_FLOOR_SP = 30;
|
||||
public static final int CHASM_WALL = 31;
|
||||
public static final int CHASM_WATER = 32;
|
||||
|
||||
public static final int WATER_TILES = 48;
|
||||
public static final int WATER = 63;
|
||||
public static final int WATER = 29;
|
||||
|
||||
public static final int PASSABLE = 0x01;
|
||||
public static final int LOS_BLOCKING = 0x02;
|
||||
|
@ -119,14 +113,6 @@ public class Terrain {
|
|||
flags[BOOKSHELF] = flags[BARRICADE] | UNSTITCHABLE;
|
||||
flags[ALCHEMY] = PASSABLE;
|
||||
|
||||
flags[CHASM_WALL] = flags[CHASM];
|
||||
flags[CHASM_FLOOR] = flags[CHASM];
|
||||
flags[CHASM_FLOOR_SP] = flags[CHASM];
|
||||
flags[CHASM_WATER] = flags[CHASM];
|
||||
|
||||
for (int i=WATER_TILES; i < WATER_TILES + 16; i++) {
|
||||
flags[i] = flags[WATER];
|
||||
}
|
||||
};
|
||||
|
||||
public static int discover( int terr ) {
|
||||
|
@ -140,6 +126,27 @@ public class Terrain {
|
|||
}
|
||||
}
|
||||
|
||||
//converts terrain values from pre versioncode 120 (0.4.3) saves
|
||||
//TODO: remove when no longer supporting saves from 0.4.2b and under
|
||||
public static int[] convertTilesFrom129(int[] map){
|
||||
for (int i = 0; i < map.length; i++){
|
||||
|
||||
int c = map[i];
|
||||
|
||||
if (c >= 29){
|
||||
if (c <= 32){
|
||||
c = 0; //chasm tiles
|
||||
} else {
|
||||
c = 29; //water tiles
|
||||
}
|
||||
}
|
||||
|
||||
map[i] = c;
|
||||
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
//converts terrain values from pre versioncode 44 (0.3.0c) saves
|
||||
//TODO: remove when no longer supporting saves from 0.3.0b and under
|
||||
public static int[] convertTrapsFrom43( int[] map, SparseArray<Trap> traps){
|
||||
|
|
|
@ -70,14 +70,7 @@ public class PitfallTrap extends Trap {
|
|||
if (!(Dungeon.level.solid[pos - Dungeon.level.width()] && Dungeon.level.solid[pos + Dungeon.level.width()])
|
||||
&& !(Dungeon.level.solid[pos - 1]&& Dungeon.level.solid[pos + 1])){
|
||||
|
||||
int c = Dungeon.level.map[pos - Dungeon.level.width()];
|
||||
|
||||
if (c == Terrain.WALL || c == Terrain.WALL_DECO) {
|
||||
Level.set(pos, Terrain.CHASM_WALL);
|
||||
} else {
|
||||
Level.set( pos, Terrain.CHASM_FLOOR );
|
||||
}
|
||||
|
||||
Level.set(pos, Terrain.CHASM);
|
||||
sprite.parent.add(new WindParticle.Wind(pos));
|
||||
sprite.kill();
|
||||
GameScene.updateMap( pos );
|
||||
|
|
Loading…
Reference in New Issue
Block a user