v0.6.0: code cleanup relating to weak floor rooms
This commit is contained in:
committed by
Evan Debenham
parent
3a78b0e978
commit
ac04546efe
@@ -156,10 +156,6 @@ public abstract class Level implements Bundlable {
|
|||||||
public int color1 = 0x004400;
|
public int color1 = 0x004400;
|
||||||
public int color2 = 0x88CC44;
|
public int color2 = 0x88CC44;
|
||||||
|
|
||||||
//FIXME this is sloppy. Should be able to keep track of this without static variables
|
|
||||||
public static boolean pitRoomNeeded = false;
|
|
||||||
public static boolean weakFloorCreated = false;
|
|
||||||
|
|
||||||
private static final String VERSION = "version";
|
private static final String VERSION = "version";
|
||||||
private static final String MAP = "map";
|
private static final String MAP = "map";
|
||||||
private static final String VISITED = "visited";
|
private static final String VISITED = "visited";
|
||||||
@@ -242,11 +238,7 @@ public abstract class Level implements Bundlable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean pitNeeded = Dungeon.depth > 1 && weakFloorCreated;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
pitRoomNeeded = pitNeeded;
|
|
||||||
weakFloorCreated = false;
|
|
||||||
width = height = length = 0;
|
width = height = length = 0;
|
||||||
|
|
||||||
mobs = new HashSet<>();
|
mobs = new HashSet<>();
|
||||||
@@ -321,7 +313,6 @@ public abstract class Level implements Bundlable {
|
|||||||
setSize( bundle.getInt("width"), bundle.getInt("height"));
|
setSize( bundle.getInt("width"), bundle.getInt("height"));
|
||||||
} else
|
} else
|
||||||
setSize( 32, 32); //default sizes
|
setSize( 32, 32); //default sizes
|
||||||
PathFinder.setMapSize(width(), height());
|
|
||||||
|
|
||||||
mobs = new HashSet<>();
|
mobs = new HashSet<>();
|
||||||
heaps = new SparseArray<>();
|
heaps = new SparseArray<>();
|
||||||
@@ -340,8 +331,6 @@ public abstract class Level implements Bundlable {
|
|||||||
exit = bundle.getInt( EXIT );
|
exit = bundle.getInt( EXIT );
|
||||||
|
|
||||||
locked = bundle.getBoolean( LOCKED );
|
locked = bundle.getBoolean( LOCKED );
|
||||||
|
|
||||||
weakFloorCreated = false;
|
|
||||||
|
|
||||||
//for pre-0.4.3 saves
|
//for pre-0.4.3 saves
|
||||||
if (version <= ShatteredPixelDungeon.v0_4_2b){
|
if (version <= ShatteredPixelDungeon.v0_4_2b){
|
||||||
|
|||||||
@@ -397,10 +397,6 @@ public abstract class RegularLevel extends Level {
|
|||||||
|
|
||||||
rooms = new ArrayList<>( (Collection<Room>) ((Collection<?>) bundle.getCollection( "rooms" )) );
|
rooms = new ArrayList<>( (Collection<Room>) ((Collection<?>) bundle.getCollection( "rooms" )) );
|
||||||
for (Room r : rooms) {
|
for (Room r : rooms) {
|
||||||
if (r instanceof WeakFloorRoom || r.legacyType.equals("WEAK_FLOOR")) {
|
|
||||||
weakFloorCreated = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (r instanceof EntranceRoom || r.legacyType.equals("ENTRANCE")){
|
if (r instanceof EntranceRoom || r.legacyType.equals("ENTRANCE")){
|
||||||
roomEntrance = r;
|
roomEntrance = r;
|
||||||
} else if (r instanceof ExitRoom || r.legacyType.equals("EXIT")){
|
} else if (r instanceof ExitRoom || r.legacyType.equals("EXIT")){
|
||||||
|
|||||||
+4
-1
@@ -31,7 +31,6 @@ import com.watabou.utils.Random;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
|
||||||
|
|
||||||
public class SpecialRoom extends Room {
|
public class SpecialRoom extends Room {
|
||||||
|
|
||||||
@@ -98,6 +97,10 @@ public class SpecialRoom extends Room {
|
|||||||
runSpecials.add( type );
|
runSpecials.add( type );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void resetPitRoom(int depth){
|
||||||
|
if (pitNeededDepth == depth) pitNeededDepth = Integer.MAX_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
public static void disableGaranteedWell(){
|
public static void disableGaranteedWell(){
|
||||||
guaranteedWellDepth = Integer.MAX_VALUE;
|
guaranteedWellDepth = Integer.MAX_VALUE;
|
||||||
|
|||||||
+3
-3
@@ -28,7 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.RegularLevel;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.SpecialRoom;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.GameLog;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.GameLog;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndError;
|
import com.shatteredpixel.shatteredpixeldungeon.windows.WndError;
|
||||||
@@ -290,10 +290,10 @@ public class InterlevelScene extends PixelScene {
|
|||||||
|
|
||||||
Actor.fixTime();
|
Actor.fixTime();
|
||||||
|
|
||||||
|
SpecialRoom.resetPitRoom(Dungeon.depth+1);
|
||||||
|
|
||||||
Dungeon.depth--;
|
Dungeon.depth--;
|
||||||
Level level = Dungeon.newLevel();
|
Level level = Dungeon.newLevel();
|
||||||
//FIXME this only partially addresses issues regarding weak floors.
|
|
||||||
RegularLevel.weakFloorCreated = false;
|
|
||||||
Dungeon.switchLevel( level, level.entrance );
|
Dungeon.switchLevel( level, level.entrance );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user