From ac04546efe3eb7675cf6c57e47dca2d0a845f461 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 16 Apr 2017 14:49:29 -0400 Subject: [PATCH] v0.6.0: code cleanup relating to weak floor rooms --- .../shatteredpixeldungeon/levels/Level.java | 11 ----------- .../shatteredpixeldungeon/levels/RegularLevel.java | 4 ---- .../levels/rooms/special/SpecialRoom.java | 5 ++++- .../shatteredpixeldungeon/scenes/InterlevelScene.java | 6 +++--- 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java index b076179b7..240dd06e8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -156,10 +156,6 @@ public abstract class Level implements Bundlable { public int color1 = 0x004400; 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 MAP = "map"; private static final String VISITED = "visited"; @@ -242,11 +238,7 @@ public abstract class Level implements Bundlable { } } - boolean pitNeeded = Dungeon.depth > 1 && weakFloorCreated; - do { - pitRoomNeeded = pitNeeded; - weakFloorCreated = false; width = height = length = 0; mobs = new HashSet<>(); @@ -321,7 +313,6 @@ public abstract class Level implements Bundlable { setSize( bundle.getInt("width"), bundle.getInt("height")); } else setSize( 32, 32); //default sizes - PathFinder.setMapSize(width(), height()); mobs = new HashSet<>(); heaps = new SparseArray<>(); @@ -340,8 +331,6 @@ public abstract class Level implements Bundlable { exit = bundle.getInt( EXIT ); locked = bundle.getBoolean( LOCKED ); - - weakFloorCreated = false; //for pre-0.4.3 saves if (version <= ShatteredPixelDungeon.v0_4_2b){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java index e69b75559..e76156caf 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/RegularLevel.java @@ -397,10 +397,6 @@ public abstract class RegularLevel extends Level { rooms = new ArrayList<>( (Collection) ((Collection) bundle.getCollection( "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")){ roomEntrance = r; } else if (r instanceof ExitRoom || r.legacyType.equals("EXIT")){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/SpecialRoom.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/SpecialRoom.java index cbf7978dc..b089b5c6c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/SpecialRoom.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/rooms/special/SpecialRoom.java @@ -31,7 +31,6 @@ import com.watabou.utils.Random; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; public class SpecialRoom extends Room { @@ -98,6 +97,10 @@ public class SpecialRoom extends Room { runSpecials.add( type ); } } + + public static void resetPitRoom(int depth){ + if (pitNeededDepth == depth) pitNeededDepth = Integer.MAX_VALUE; + } public static void disableGaranteedWell(){ guaranteedWellDepth = Integer.MAX_VALUE; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/InterlevelScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/InterlevelScene.java index fe0cd7173..0000dd64b 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/InterlevelScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/InterlevelScene.java @@ -28,7 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.items.Generator; 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.ui.GameLog; import com.shatteredpixel.shatteredpixeldungeon.windows.WndError; @@ -290,10 +290,10 @@ public class InterlevelScene extends PixelScene { Actor.fixTime(); + SpecialRoom.resetPitRoom(Dungeon.depth+1); + Dungeon.depth--; Level level = Dungeon.newLevel(); - //FIXME this only partially addresses issues regarding weak floors. - RegularLevel.weakFloorCreated = false; Dungeon.switchLevel( level, level.entrance ); }