From 2b867c98c28fc1eae17be7f2a41900bc74b5cfac Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 29 Jan 2019 14:00:19 -0500 Subject: [PATCH] v0.7.2: removed support for save data from v0.6.0 and v0.6.1 --- .../shatteredpixeldungeon/Dungeon.java | 29 +------------- .../GamesInProgress.java | 4 +- .../ShatteredPixelDungeon.java | 38 +------------------ .../actors/blobs/Alchemy.java | 12 ------ .../actors/hero/Belongings.java | 27 ------------- .../items/Generator.java | 17 ++------- .../items/artifacts/CloakOfShadows.java | 6 --- .../items/artifacts/HornOfPlenty.java | 11 +----- .../shatteredpixeldungeon/levels/Level.java | 9 +---- 9 files changed, 12 insertions(+), 141 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java index 463d1f385..dd03a0ec1 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/Dungeon.java @@ -149,26 +149,6 @@ public class Dungeon { } } - //for saves prior to 0.6.1 - public static void legacyRestore( int[] counts ){ - STRENGTH_POTIONS.count = counts[0]; - UPGRADE_SCROLLS.count = counts[1]; - ARCANE_STYLI.count = counts[2]; - SWARM_HP.count = counts[3]; - BAT_HP.count = counts[4]; - WARLOCK_HP.count = counts[5]; - SCORPIO_HP.count = counts[6]; - COOKING_HP.count = counts[7]; - BLANDFRUIT_SEED.count = counts[8]; - THIEVES_ARMBAND.count = counts[9]; - DEW_VIAL.count = counts[10]; - VELVET_POUCH.count = counts[11]; - SCROLL_HOLDER.count = counts[12]; - POTION_BANDOLIER.count = counts[13]; - MAGICAL_HOLSTER.count = counts[14]; - GUARD_HP.count = counts[15]; - } - } public static int challenges; @@ -615,13 +595,8 @@ public class Dungeon { quickslot.restorePlaceholders( bundle ); if (fullLoad) { - - //pre-0.6.1 - if( bundle.contains("limiteddrops") ){ - LimitedDrops.legacyRestore( bundle.getIntArray("limiteddrops") ); - } else { - LimitedDrops.restore( bundle.getBundle(LIMDROPS) ); - } + + LimitedDrops.restore( bundle.getBundle(LIMDROPS) ); chapters = new HashSet(); int ids[] = bundle.getIntArray( CHAPTERS ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/GamesInProgress.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/GamesInProgress.java index 488d9b603..1994de382 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/GamesInProgress.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/GamesInProgress.java @@ -103,8 +103,8 @@ public class GamesInProgress { info.slot = slot; Dungeon.preview(info, bundle); - //saves from before 0.6.0b are not supported - if (info.version < ShatteredPixelDungeon.v0_6_0b) { + //saves from before 0.6.2e are not supported + if (info.version < ShatteredPixelDungeon.v0_6_2e) { info = null; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java index dd0995a02..401acd9ef 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java @@ -40,9 +40,7 @@ import javax.microedition.khronos.opengles.GL10; public class ShatteredPixelDungeon extends Game { //variable constants for specific older versions of shattered, used for data conversion - //versions older than v0.6.0b are no longer supported, and data from them is ignored - public static final int v0_6_0b = 185; - public static final int v0_6_1b = 209; + //versions older than v0.6.2e are no longer supported, and data from them is ignored public static final int v0_6_2e = 229; public static final int v0_6_3b = 245; public static final int v0_6_4a = 252; @@ -54,40 +52,6 @@ public class ShatteredPixelDungeon extends Game { public ShatteredPixelDungeon() { super( WelcomeScene.class ); - //v0.6.2 - com.watabou.utils.Bundle.addAlias( - com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret.RatKingRoom.class, - "com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.RatKingRoom" ); - com.watabou.utils.Bundle.addAlias( - com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.PlantsRoom.class, - "com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.GardenRoom" ); - com.watabou.utils.Bundle.addAlias( - com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.GardenRoom.class, - "com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.FoliageRoom" ); - - com.watabou.utils.Bundle.addAlias( - com.shatteredpixel.shatteredpixeldungeon.levels.traps.WornDartTrap.class, - "com.shatteredpixel.shatteredpixeldungeon.levels.traps.WornTrap" ); - com.watabou.utils.Bundle.addAlias( - com.shatteredpixel.shatteredpixeldungeon.levels.traps.PoisonDartTrap.class, - "com.shatteredpixel.shatteredpixeldungeon.levels.traps.PoisonTrap" ); - com.watabou.utils.Bundle.addAlias( - com.shatteredpixel.shatteredpixeldungeon.levels.traps.ShockingTrap.class, - "com.shatteredpixel.shatteredpixeldungeon.levels.traps.ParalyticTrap" ); - com.watabou.utils.Bundle.addAlias( - com.shatteredpixel.shatteredpixeldungeon.levels.traps.ShockingTrap.class, - "com.shatteredpixel.shatteredpixeldungeon.levels.traps.LightningTrap" ); - com.watabou.utils.Bundle.addAlias( - com.shatteredpixel.shatteredpixeldungeon.levels.traps.GrippingTrap.class, - "com.shatteredpixel.shatteredpixeldungeon.levels.traps.SpearTrap" ); - com.watabou.utils.Bundle.addAlias( - com.shatteredpixel.shatteredpixeldungeon.levels.traps.BurningTrap.class, - "com.shatteredpixel.shatteredpixeldungeon.levels.traps.FireTrap" ); - - com.watabou.utils.Bundle.addAlias( - com.shatteredpixel.shatteredpixeldungeon.actors.buffs.BlobImmunity.class, - "com.shatteredpixel.shatteredpixeldungeon.actors.buffs.GasesImmunity" ); - //v0.6.3 com.watabou.utils.Bundle.addAlias( com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.Tomahawk.class, diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Alchemy.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Alchemy.java index f2a96d314..4493d7cc5 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Alchemy.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/blobs/Alchemy.java @@ -26,8 +26,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.BlobEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; import com.shatteredpixel.shatteredpixeldungeon.scenes.AlchemyScene; -import com.watabou.utils.PathFinder; -import com.watabou.utils.Random; public class Alchemy extends Blob implements AlchemyScene.AlchemyProvider { @@ -45,16 +43,6 @@ public class Alchemy extends Blob implements AlchemyScene.AlchemyProvider { if (off[cell] > 0 && Dungeon.level.heroFOV[cell]){ Notes.add( Notes.Landmark.ALCHEMY ); } - - //for pre-0.6.2 saves - while (off[cell] > 0 && Dungeon.level.heaps.get(cell) != null){ - - int n; - do { - n = cell + PathFinder.NEIGHBOURS8[Random.Int( 8 )]; - } while (!Dungeon.level.passable[n]); - Dungeon.level.drop( Dungeon.level.heaps.get(cell).pickUp(), n ).sprite.drop( pos ); - } } } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Belongings.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Belongings.java index 862b4faee..e395edf33 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Belongings.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Belongings.java @@ -29,13 +29,9 @@ import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon; import com.shatteredpixel.shatteredpixeldungeon.items.KindofMisc; import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor; import com.shatteredpixel.shatteredpixeldungeon.items.bags.Bag; -import com.shatteredpixel.shatteredpixeldungeon.items.keys.GoldenKey; -import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey; import com.shatteredpixel.shatteredpixeldungeon.items.keys.Key; -import com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfRemoveCurse; import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand; -import com.shatteredpixel.shatteredpixeldungeon.journal.Notes; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.watabou.utils.Bundle; import com.watabou.utils.Random; @@ -82,29 +78,6 @@ public class Belongings implements Iterable { } public void restoreFromBundle( Bundle bundle ) { - - //moving keys to Notes, for pre-0.6.1 saves - if (bundle.contains("ironKeys")) { - int[] ironKeys = bundle.getIntArray( "ironKeys" ); - for (int i = 0; i < ironKeys.length; i++){ - if (ironKeys[i] > 0){ - Notes.add((Key) new IronKey(i).quantity(ironKeys[i])); - } - } - } - - if (bundle.contains("specialKeys")) { - int[] specialKeys = bundle.getIntArray( "specialKeys" ); - for (int i = 0; i < specialKeys.length; i++){ - if (specialKeys[i] > 0){ - if (i % 5 == 0){ - Notes.add((Key) new SkeletonKey(i).quantity(specialKeys[i])); - } else { - Notes.add((Key) new GoldenKey(i).quantity(specialKeys[i])); - } - } - } - } backpack.clear(); backpack.restoreFromBundle( bundle ); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java index d385018cd..4b6122861 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/Generator.java @@ -661,19 +661,10 @@ public class Generator { } initArtifacts(); - if (bundle.contains(SPAWNED_ARTIFACTS)){ - for ( Class artifact : bundle.getClassArray(SPAWNED_ARTIFACTS) ){ - removeArtifact(artifact); - } - //pre-0.6.1 saves - } else if (bundle.contains("artifacts")) { - String[] names = bundle.getStringArray("artifacts"); - Category cat = Category.ARTIFACT; - - for (String artifact : names) - for (int i = 0; i < cat.classes.length; i++) - if (cat.classes[i].getSimpleName().equals(artifact)) - cat.probs[i] = 0; + + for ( Class artifact : bundle.getClassArray(SPAWNED_ARTIFACTS) ){ + removeArtifact(artifact); } + } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java index 62f8b1c39..d179e8175 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/CloakOfShadows.java @@ -165,12 +165,6 @@ public class CloakOfShadows extends Artifact { public void restoreFromBundle( Bundle bundle ) { super.restoreFromBundle(bundle); stealthed = bundle.getBoolean( STEALTHED ); - // pre-0.6.2 saves - if (bundle.contains("cooldown")){ - exp = 0; - level((int)Math.ceil(level()*0.7f)); - charge = chargeCap = Math.min(3 + level(), 10); - } } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java index e06b298f6..83d656efc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/HornOfPlenty.java @@ -200,16 +200,7 @@ public class HornOfPlenty extends Artifact { @Override public void restoreFromBundle(Bundle bundle) { super.restoreFromBundle(bundle); - - if (bundle.contains(STORED)){ - storedFoodEnergy = bundle.getInt(STORED); - - //logic for pre-0.6.1 saves - } else { - //keep partial levels - storedFoodEnergy = (int)(level()%3 * Hunger.HUNGRY/3); - level(level()/3); - } + storedFoodEnergy = bundle.getInt(STORED); if (charge >= 15) image = ItemSpriteSheet.ARTIFACT_HORN4; else if (charge >= 10) image = ItemSpriteSheet.ARTIFACT_HORN3; 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 11c06c12d..09341257f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -300,8 +300,8 @@ public abstract class Level implements Bundlable { version = bundle.getInt( VERSION ); - //saves from before 0.6.0b are not supported - if (version < ShatteredPixelDungeon.v0_6_0b){ + //saves from before 0.6.2e are not supported + if (version < ShatteredPixelDungeon.v0_6_2e){ throw new RuntimeException("old save"); } @@ -324,11 +324,6 @@ public abstract class Level implements Bundlable { exit = bundle.getInt( EXIT ); locked = bundle.getBoolean( LOCKED ); - - // pre-0.6.1 saves - if (version <= ShatteredPixelDungeon.v0_6_0b){ - map = Terrain.convertTilesFrom0_6_0b( map ); - } Collection collection = bundle.getCollection( HEAPS ); for (Bundlable h : collection) {