v2.3.0: updated version info, removed support for saves prior to v1.4.3

This commit is contained in:
Evan Debenham
2023-11-13 14:57:55 -05:00
parent aded03d7a6
commit 7a49a1b887
16 changed files with 19 additions and 104 deletions

View File

@@ -521,6 +521,7 @@ public class Bundle {
try {
json = new JSONTokener(jsonString).nextValue();
} catch (Exception e){
//TODO support for v1.1.X saves has been dropped, can probably remove this soon
//if the string can't be tokenized, it may be written by v1.1.X, which used libGDX JSON.
// Some of these are written in a 'minified' format, some have duplicate keys.
// We read them in with the libGDX JSON code, fix duplicates, write as full JSON

View File

@@ -222,9 +222,7 @@ public class Badges {
private static final HashSet<String> removedBadges = new HashSet<>();
static{
//v1.3.0 (These were removed and re-added internally as new unlock reqs were added)
removedBadges.add("YASD");
removedBadges.add("DEATH_FROM_GLYPH");
//no removed badges currently
}
private static final HashMap<String, String> renamedBadges = new HashMap<>();

View File

@@ -107,8 +107,8 @@ public class GamesInProgress {
info.slot = slot;
Dungeon.preview(info, bundle);
//saves from before v1.2.3 are not supported
if (info.version < ShatteredPixelDungeon.v1_2_3) {
//saves from before v1.4.3 are not supported
if (info.version < ShatteredPixelDungeon.v1_4_3) {
info = null;
}

View File

@@ -34,14 +34,14 @@ import com.watabou.utils.PlatformSupport;
public class ShatteredPixelDungeon extends Game {
//variable constants for specific older versions of shattered, used for data conversion
//versions older than v1.2.3 are no longer supported, and data from them is ignored
public static final int v1_2_3 = 628;
public static final int v1_3_2 = 648;
public static final int v1_4_3 = 668;
public static final int v1_2_3 = 628; //v1.2.3 is kept for now, for old rankings score logic
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_0 = 753;
//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
public ShatteredPixelDungeon( PlatformSupport platform ) {
super( sceneClass == null ? WelcomeScene.class : sceneClass, platform );
@@ -68,24 +68,6 @@ public class ShatteredPixelDungeon extends Game {
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.quest.RotGardenRoom.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.RotGardenRoom" );
//pre-v1.3.0
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bleeding.class,
"com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm$FallBleed" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.plants.Mageroyal.class,
"com.shatteredpixel.shatteredpixeldungeon.plants.Dreamfoil" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.plants.Mageroyal.Seed.class,
"com.shatteredpixel.shatteredpixeldungeon.plants.Dreamfoil$Seed" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Dazzling.class,
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Exhausting" );
com.watabou.utils.Bundle.addAlias(
com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Explosive.class,
"com.shatteredpixel.shatteredpixeldungeon.items.weapon.curses.Fragile" );
}
@Override

View File

@@ -459,7 +459,6 @@ public enum Talent {
}
public static class CachedRationsDropped extends CounterBuff{{revivePersists = true;}};
public static class NatureBerriesAvailable extends CounterBuff{{revivePersists = true;}}; //for pre-1.3.0 saves
public static class NatureBerriesDropped extends CounterBuff{{revivePersists = true;}};
public static void onFoodEaten( Hero hero, float foodVal, Item foodSource ){
@@ -939,8 +938,6 @@ public enum Talent {
static{
//v2.2.0
removedTalents.add("EMPOWERING_SCROLLS");
//v1.4.0
removedTalents.add("BERSERKING_STAMINA");
}
private static final HashMap<String, String> renamedTalents = new HashMap<>();

View File

@@ -118,11 +118,6 @@ public class ItemStatusHandler<T extends Item> {
Class<? extends T> item = items[i];
String itemName = item.getSimpleName();
//pre-1.4.0 saves
if (!bundle.contains( itemName + PFX_LABEL )){
itemName = item.toString();
}
if (bundle.contains( itemName + PFX_LABEL )) {
String label = bundle.getString( itemName + PFX_LABEL );

View File

@@ -189,13 +189,6 @@ public class CavesBossLevel extends Level {
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
//pre-1.3.0 saves, modifies exit transition with custom size
if (bundle.contains("exit")){
LevelTransition exit = getTransition(LevelTransition.Type.REGULAR_EXIT);
exit.set(14, 0, 18, 2);
transitions.add(exit);
}
for (CustomTilemap c : customTiles){
if (c instanceof ArenaVisuals){
customArenaVisuals = (ArenaVisuals) c;

View File

@@ -123,12 +123,6 @@ public class CityBossLevel extends Level {
@Override
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle( bundle );
//pre-1.3.0 saves, modifies exit transition with custom size
if (bundle.contains("exit")){
LevelTransition exit = getTransition(LevelTransition.Type.REGULAR_EXIT);
exit.set(end.left+4, end.top+4, end.left+4+6, end.top+4+4);
transitions.add(exit);
}
impShop = (ImpShopRoom) bundle.get( IMP_SHOP );
if (map[topDoor] != Terrain.LOCKED_DOOR && Imp.Quest.isCompleted() && !impShop.shopSpawned()){
spawnShop();

View File

@@ -24,7 +24,6 @@ package com.shatteredpixel.shatteredpixeldungeon.levels;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Bones;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
@@ -323,8 +322,6 @@ public class HallsBossLevel extends Level {
@Override
public boolean activateTransition(Hero hero, LevelTransition transition) {
if (transition.type == LevelTransition.Type.REGULAR_ENTRANCE
//ascension challenge only works on runs started on v1.3+
&& Dungeon.initialVersion > ShatteredPixelDungeon.v1_2_3
&& hero.belongings.getItem(Amulet.class) != null
&& hero.buff(AscensionChallenge.class) == null) {

View File

@@ -229,9 +229,6 @@ public class LastLevel extends Level {
@Override
public void restoreFromBundle(Bundle bundle) {
//pre-1.3.0 saves, deletes unneeded exit
if (bundle.contains("exit")) bundle.remove("exit");
super.restoreFromBundle(bundle);
for (int i=0; i < length(); i++) {
int flags = Terrain.flags[map[i]];

View File

@@ -327,8 +327,8 @@ public abstract class Level implements Bundlable {
version = bundle.getInt( VERSION );
//saves from before v1.2.3 are not supported
if (version < ShatteredPixelDungeon.v1_2_3){
//saves from before v1.4.3 are not supported
if (version < ShatteredPixelDungeon.v1_4_3){
throw new RuntimeException("old save");
}
@@ -348,21 +348,8 @@ public abstract class Level implements Bundlable {
mapped = bundle.getBooleanArray( MAPPED );
transitions = new ArrayList<>();
if (bundle.contains(TRANSITIONS)){
for (Bundlable b : bundle.getCollection( TRANSITIONS )){
transitions.add((LevelTransition) b);
}
//pre-1.3.0 saves, converts old entrance/exit to new transitions
} else {
if (bundle.contains("entrance")){
transitions.add(new LevelTransition(
this,
bundle.getInt("entrance"),
Dungeon.depth == 1 ? LevelTransition.Type.SURFACE : LevelTransition.Type.REGULAR_ENTRANCE));
}
if (bundle.contains("exit")){
transitions.add(new LevelTransition(this, bundle.getInt("exit"), LevelTransition.Type.REGULAR_EXIT));
}
for (Bundlable b : bundle.getCollection( TRANSITIONS )){
transitions.add((LevelTransition) b);
}
locked = bundle.getBoolean( LOCKED );

View File

@@ -132,20 +132,6 @@ public class PrisonBossLevel extends Level {
public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle(bundle);
state = bundle.getEnum( STATE, State.class );
//pre-1.3.0 saves, recreates custom exit and entrance transitions
if (bundle.contains("entrance")){
transitions.clear();
if (state == State.START || state == State.WON){
transitions.add(new LevelTransition(this, ENTRANCE_POS, LevelTransition.Type.REGULAR_ENTRANCE));
}
if (state == State.WON){
LevelTransition exit = new LevelTransition(this, pointToCell(levelExit), LevelTransition.Type.REGULAR_EXIT);
exit.right+=2;
exit.bottom+=3;
transitions.add(exit);
}
}
//in some states tengu won't be in the world, in others he will be.
if (state == State.START || state == State.FIGHT_PAUSE) {

View File

@@ -222,11 +222,6 @@ public class SewerBossLevel extends SewerLevel {
@Override
public void restoreFromBundle( Bundle bundle ) {
//pre-1.3.0 saves
if (bundle.getInt("stairs") != 0){
bundle.put("entrance", bundle.getInt("stairs"));
bundle.remove("stairs");
}
super.restoreFromBundle( bundle );
roomExit = roomEntrance;
}

View File

@@ -88,13 +88,6 @@ public class HighGrass {
if (ch instanceof Hero && ((Hero) ch).hasTalent(Talent.NATURES_BOUNTY)){
int berriesAvailable = 2 + 2*((Hero) ch).pointsInTalent(Talent.NATURES_BOUNTY);
//pre-1.3.0 saves
Talent.NatureBerriesAvailable oldAvailable = ch.buff(Talent.NatureBerriesAvailable.class);
if (oldAvailable != null){
Buff.affect(ch, Talent.NatureBerriesDropped.class).countUp(berriesAvailable - oldAvailable.count());
oldAvailable.detach();
}
Talent.NatureBerriesDropped dropped = Buff.affect(ch, Talent.NatureBerriesDropped.class);
berriesAvailable -= dropped.count();

View File

@@ -654,9 +654,9 @@ public class HeroSelectScene extends PixelScene {
if (diff <= 0) {
long time = Game.realTime - (Game.realTime % DAY);
//earliest possible daily for v1.4.0 is Sept 10 2022
//which is 19,245 days after Jan 1 1970
time = Math.max(time, 19_245 * DAY);
//earliest possible daily for v2.2.X is Oct 05 2023
//which is 19,635 days after Jan 1 1970
time = Math.max(time, 19_635 * DAY);
SPDSettings.lastDaily(time);
Dungeon.dailyReplay = false;

View File

@@ -53,7 +53,7 @@ import java.util.Collections;
public class WelcomeScene extends PixelScene {
private static final int LATEST_UPDATE = ShatteredPixelDungeon.v2_2_0;
private static final int LATEST_UPDATE = ShatteredPixelDungeon.v2_2_1;
//used so that the game does not keep showing the window forever if cleaning fails
private static boolean triedCleaningTemp = false;