v3.0.1: dropped support for save games prior to v2.3.2

This commit is contained in:
Evan Debenham
2025-03-02 13:28:35 -05:00
parent 049aa52886
commit b7b32bfb14
7 changed files with 30 additions and 103 deletions

View File

@@ -174,14 +174,6 @@ public class Dungeon {
}
}
//pre-v2.2.0 saves
if (Dungeon.version < 750
&& Dungeon.isChallenged(Challenges.NO_SCROLLS)
&& UPGRADE_SCROLLS.count > 0){
//we now count SOU fully, and just don't drop every 2nd one
UPGRADE_SCROLLS.count += UPGRADE_SCROLLS.count-1;
}
}
}
@@ -725,13 +717,7 @@ public class Dungeon {
Bundle bundle = FileUtils.bundleFromFile( GamesInProgress.gameFile( save ) );
//pre-1.3.0 saves
if (bundle.contains(INIT_VER)){
initialVersion = bundle.getInt( INIT_VER );
} else {
initialVersion = bundle.getInt( VERSION );
}
initialVersion = bundle.getInt( INIT_VER );
version = bundle.getInt( VERSION );
seed = bundle.contains( SEED ) ? bundle.getLong( SEED ) : DungeonSeed.randomSeed();
@@ -785,6 +771,26 @@ public class Dungeon {
SpecialRoom.restoreRoomsFromBundle(bundle);
SecretRoom.restoreRoomsFromBundle(bundle);
generatedLevels.clear();
for (int i : bundle.getIntArray(GENERATED_LEVELS)){
generatedLevels.add(i);
}
droppedItems = new SparseArray<>();
for (int i=1; i <= 26; i++) {
//dropped items
ArrayList<Item> items = new ArrayList<>();
if (bundle.contains(Messages.format( DROPPED, i )))
for (Bundlable b : bundle.getCollection( Messages.format( DROPPED, i ) ) ) {
items.add( (Item)b );
}
if (!items.isEmpty()) {
droppedItems.put( i, items );
}
}
}
Bundle badges = bundle.getBundle(BADGES);
@@ -808,32 +814,6 @@ public class Dungeon {
Statistics.restoreFromBundle( bundle );
Generator.restoreFromBundle( bundle );
generatedLevels.clear();
if (bundle.contains(GENERATED_LEVELS)){
for (int i : bundle.getIntArray(GENERATED_LEVELS)){
generatedLevels.add(i);
}
//pre-v2.1.1 saves
} else {
for (int i = 1; i <= Statistics.deepestFloor; i++){
generatedLevels.add(i);
}
}
droppedItems = new SparseArray<>();
for (int i=1; i <= 26; i++) {
//dropped items
ArrayList<Item> items = new ArrayList<>();
if (bundle.contains(Messages.format( DROPPED, i )))
for (Bundlable b : bundle.getCollection( Messages.format( DROPPED, i ) ) ) {
items.add( (Item)b );
}
if (!items.isEmpty()) {
droppedItems.put( i, items );
}
}
}
public static Level loadLevel( int save ) throws IOException {

View File

@@ -112,7 +112,7 @@ public class GamesInProgress {
Bundle bundle = FileUtils.bundleFromFile(gameFile(slot));
if (bundle.getInt( "version" ) < ShatteredPixelDungeon.v1_4_3) {
if (bundle.getInt( "version" ) < ShatteredPixelDungeon.v2_3_2) {
info = null;
} else {

View File

@@ -33,15 +33,10 @@ import com.watabou.utils.PlatformSupport;
public class ShatteredPixelDungeon extends Game {
//variable constants for specific older versions of shattered, used for data conversion
public static final int v1_2_3 = 628; //v1.2.3 is kept for now, for old rankings score logic
//rankings from v1.2.3 and older use a different score formula, so this reference is kept
public static final int v1_2_3 = 628;
//savegames from versions older than v1.4.3 are no longer supported, and data from them is ignored
public static final int v1_4_3 = 668;
public static final int v2_0_2 = 700;
public static final int v2_1_4 = 737; //iOS was 737, other platforms were 736
public static final int v2_2_1 = 755; //iOS was 755 (also called v2.2.2), other platforms were 754
//savegames from versions older than v2.3.2 are no longer supported, and data from them is ignored
public static final int v2_3_2 = 768;
public static final int v2_4_2 = 782;
public static final int v2_5_4 = 802;
@@ -90,34 +85,6 @@ public class ShatteredPixelDungeon extends Game {
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.exit.ExitRoom.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.ExitRoom" );
//pre-v2.3.0
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.bombs.Bomb.ConjuredBomb.class,
"com.shatteredpixel.shatteredpixeldungeon.items.bombs.Bomb$MagicalBomb" );
//pre-v2.2.0
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.quest.BlacksmithRoom.QuestEntrance.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.BlacksmithRoom$QuestEntrance" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.quest.BlacksmithRoom.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.BlacksmithRoom" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.quest.MassGraveRoom.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.MassGraveRoom" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.quest.MassGraveRoom.Bones.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.MassGraveRoom$Bones" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.quest.RitualSiteRoom.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.RitualSiteRoom" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.quest.RitualSiteRoom.RitualMarker.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard.RitualSiteRoom$RitualMarker" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.quest.RotGardenRoom.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.RotGardenRoom" );
}
@Override

View File

@@ -1149,27 +1149,12 @@ public enum Talent {
//v2.4.0
removedTalents.add("TEST_SUBJECT");
removedTalents.add("TESTED_HYPOTHESIS");
//v2.2.0
removedTalents.add("EMPOWERING_SCROLLS");
}
private static final HashMap<String, String> renamedTalents = new HashMap<>();
static{
//v2.4.0
renamedTalents.put("SECONDARY_CHARGE", "VARIED_CHARGE");
//v2.2.0
renamedTalents.put("RESTORED_WILLPOWER", "LIQUID_WILLPOWER");
renamedTalents.put("ENERGIZING_UPGRADE", "INSCRIBED_POWER");
renamedTalents.put("MYSTICAL_UPGRADE", "INSCRIBED_STEALTH");
renamedTalents.put("RESTORED_NATURE", "LIQUID_NATURE");
renamedTalents.put("RESTORED_AGILITY", "LIQUID_AGILITY");
//v2.1.0
renamedTalents.put("LIGHTWEIGHT_CHARGE", "PRECISE_ASSAULT");
//v2.0.0 BETA
renamedTalents.put("LIGHTLY_ARMED", "UNENCUMBERED_SPIRIT");
//v2.0.0
renamedTalents.put("ARMSMASTERS_INTUITION", "VETERANS_INTUITION");
}
public static void restoreTalentsFromBundle( Bundle bundle, Hero hero ){

View File

@@ -262,11 +262,6 @@ public class HornOfPlenty extends Artifact {
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
//pre-2.0.0 saves
if (partialCharge > 1){
partialCharge /= Hunger.STARVING/5f;
}
storedFoodEnergy = bundle.getInt(STORED);
if (charge >= 8) image = ItemSpriteSheet.ARTIFACT_HORN4;

View File

@@ -360,8 +360,8 @@ public abstract class Level implements Bundlable {
version = bundle.getInt( VERSION );
//saves from before v1.4.3 are not supported
if (version < ShatteredPixelDungeon.v1_4_3){
//saves from before v2.3.2 are not supported
if (version < ShatteredPixelDungeon.v2_3_2){
throw new RuntimeException("old save");
}

View File

@@ -696,9 +696,9 @@ public class HeroSelectScene extends PixelScene {
if (diff <= 0) {
long time = Game.realTime - (Game.realTime % DAY);
//earliest possible daily for v2.3.2 is Jan 30 2024
//which is 19,752 days after Jan 1 1970
time = Math.max(time, 19_752 * DAY);
//earliest possible daily for v3.0.1 is Mar 01 2025
//which is 20,148 days days after Jan 1 1970
time = Math.max(time, 20_148 * DAY);
SPDSettings.lastDaily(time);
Dungeon.dailyReplay = false;