v2.3.0: updated version info, removed support for saves prior to v1.4.3
This commit is contained in:
@@ -521,6 +521,7 @@ public class Bundle {
|
|||||||
try {
|
try {
|
||||||
json = new JSONTokener(jsonString).nextValue();
|
json = new JSONTokener(jsonString).nextValue();
|
||||||
} catch (Exception e){
|
} 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.
|
//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.
|
// 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
|
// We read them in with the libGDX JSON code, fix duplicates, write as full JSON
|
||||||
|
|||||||
@@ -222,9 +222,7 @@ public class Badges {
|
|||||||
|
|
||||||
private static final HashSet<String> removedBadges = new HashSet<>();
|
private static final HashSet<String> removedBadges = new HashSet<>();
|
||||||
static{
|
static{
|
||||||
//v1.3.0 (These were removed and re-added internally as new unlock reqs were added)
|
//no removed badges currently
|
||||||
removedBadges.add("YASD");
|
|
||||||
removedBadges.add("DEATH_FROM_GLYPH");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final HashMap<String, String> renamedBadges = new HashMap<>();
|
private static final HashMap<String, String> renamedBadges = new HashMap<>();
|
||||||
|
|||||||
@@ -107,8 +107,8 @@ public class GamesInProgress {
|
|||||||
info.slot = slot;
|
info.slot = slot;
|
||||||
Dungeon.preview(info, bundle);
|
Dungeon.preview(info, bundle);
|
||||||
|
|
||||||
//saves from before v1.2.3 are not supported
|
//saves from before v1.4.3 are not supported
|
||||||
if (info.version < ShatteredPixelDungeon.v1_2_3) {
|
if (info.version < ShatteredPixelDungeon.v1_4_3) {
|
||||||
info = null;
|
info = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,14 +34,14 @@ import com.watabou.utils.PlatformSupport;
|
|||||||
public class ShatteredPixelDungeon extends Game {
|
public class ShatteredPixelDungeon extends Game {
|
||||||
|
|
||||||
//variable constants for specific older versions of shattered, used for data conversion
|
//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; //v1.2.3 is kept for now, for old rankings score logic
|
||||||
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 v2_0_2 = 700;
|
//savegames from versions older than v1.4.3 are no longer supported, and data from them is ignored
|
||||||
public static final int v2_1_4 = 737; //iOS was 737, other platforms were 736
|
public static final int v1_4_3 = 668;
|
||||||
public static final int v2_2_0 = 753;
|
|
||||||
|
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 ) {
|
public ShatteredPixelDungeon( PlatformSupport platform ) {
|
||||||
super( sceneClass == null ? WelcomeScene.class : sceneClass, platform );
|
super( sceneClass == null ? WelcomeScene.class : sceneClass, platform );
|
||||||
@@ -68,24 +68,6 @@ public class ShatteredPixelDungeon extends Game {
|
|||||||
com.watabou.utils.Bundle.addAlias(
|
com.watabou.utils.Bundle.addAlias(
|
||||||
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.quest.RotGardenRoom.class,
|
com.shatteredpixel.shatteredpixeldungeon.levels.rooms.quest.RotGardenRoom.class,
|
||||||
"com.shatteredpixel.shatteredpixeldungeon.levels.rooms.special.RotGardenRoom" );
|
"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
|
@Override
|
||||||
|
|||||||
@@ -459,7 +459,6 @@ public enum Talent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class CachedRationsDropped extends CounterBuff{{revivePersists = true;}};
|
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 class NatureBerriesDropped extends CounterBuff{{revivePersists = true;}};
|
||||||
|
|
||||||
public static void onFoodEaten( Hero hero, float foodVal, Item foodSource ){
|
public static void onFoodEaten( Hero hero, float foodVal, Item foodSource ){
|
||||||
@@ -939,8 +938,6 @@ public enum Talent {
|
|||||||
static{
|
static{
|
||||||
//v2.2.0
|
//v2.2.0
|
||||||
removedTalents.add("EMPOWERING_SCROLLS");
|
removedTalents.add("EMPOWERING_SCROLLS");
|
||||||
//v1.4.0
|
|
||||||
removedTalents.add("BERSERKING_STAMINA");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final HashMap<String, String> renamedTalents = new HashMap<>();
|
private static final HashMap<String, String> renamedTalents = new HashMap<>();
|
||||||
|
|||||||
@@ -118,11 +118,6 @@ public class ItemStatusHandler<T extends Item> {
|
|||||||
Class<? extends T> item = items[i];
|
Class<? extends T> item = items[i];
|
||||||
String itemName = item.getSimpleName();
|
String itemName = item.getSimpleName();
|
||||||
|
|
||||||
//pre-1.4.0 saves
|
|
||||||
if (!bundle.contains( itemName + PFX_LABEL )){
|
|
||||||
itemName = item.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bundle.contains( itemName + PFX_LABEL )) {
|
if (bundle.contains( itemName + PFX_LABEL )) {
|
||||||
|
|
||||||
String label = bundle.getString( itemName + PFX_LABEL );
|
String label = bundle.getString( itemName + PFX_LABEL );
|
||||||
|
|||||||
@@ -189,13 +189,6 @@ public class CavesBossLevel extends Level {
|
|||||||
public void restoreFromBundle(Bundle bundle) {
|
public void restoreFromBundle(Bundle bundle) {
|
||||||
super.restoreFromBundle(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){
|
for (CustomTilemap c : customTiles){
|
||||||
if (c instanceof ArenaVisuals){
|
if (c instanceof ArenaVisuals){
|
||||||
customArenaVisuals = (ArenaVisuals) c;
|
customArenaVisuals = (ArenaVisuals) c;
|
||||||
|
|||||||
@@ -123,12 +123,6 @@ public class CityBossLevel extends Level {
|
|||||||
@Override
|
@Override
|
||||||
public void restoreFromBundle( Bundle bundle ) {
|
public void restoreFromBundle( Bundle bundle ) {
|
||||||
super.restoreFromBundle( 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 );
|
impShop = (ImpShopRoom) bundle.get( IMP_SHOP );
|
||||||
if (map[topDoor] != Terrain.LOCKED_DOOR && Imp.Quest.isCompleted() && !impShop.shopSpawned()){
|
if (map[topDoor] != Terrain.LOCKED_DOOR && Imp.Quest.isCompleted() && !impShop.shopSpawned()){
|
||||||
spawnShop();
|
spawnShop();
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ package com.shatteredpixel.shatteredpixeldungeon.levels;
|
|||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Bones;
|
import com.shatteredpixel.shatteredpixeldungeon.Bones;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||||
@@ -323,8 +322,6 @@ public class HallsBossLevel extends Level {
|
|||||||
@Override
|
@Override
|
||||||
public boolean activateTransition(Hero hero, LevelTransition transition) {
|
public boolean activateTransition(Hero hero, LevelTransition transition) {
|
||||||
if (transition.type == LevelTransition.Type.REGULAR_ENTRANCE
|
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.belongings.getItem(Amulet.class) != null
|
||||||
&& hero.buff(AscensionChallenge.class) == null) {
|
&& hero.buff(AscensionChallenge.class) == null) {
|
||||||
|
|
||||||
|
|||||||
@@ -229,9 +229,6 @@ public class LastLevel extends Level {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void restoreFromBundle(Bundle bundle) {
|
public void restoreFromBundle(Bundle bundle) {
|
||||||
//pre-1.3.0 saves, deletes unneeded exit
|
|
||||||
if (bundle.contains("exit")) bundle.remove("exit");
|
|
||||||
|
|
||||||
super.restoreFromBundle(bundle);
|
super.restoreFromBundle(bundle);
|
||||||
for (int i=0; i < length(); i++) {
|
for (int i=0; i < length(); i++) {
|
||||||
int flags = Terrain.flags[map[i]];
|
int flags = Terrain.flags[map[i]];
|
||||||
|
|||||||
@@ -327,8 +327,8 @@ public abstract class Level implements Bundlable {
|
|||||||
|
|
||||||
version = bundle.getInt( VERSION );
|
version = bundle.getInt( VERSION );
|
||||||
|
|
||||||
//saves from before v1.2.3 are not supported
|
//saves from before v1.4.3 are not supported
|
||||||
if (version < ShatteredPixelDungeon.v1_2_3){
|
if (version < ShatteredPixelDungeon.v1_4_3){
|
||||||
throw new RuntimeException("old save");
|
throw new RuntimeException("old save");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,21 +348,8 @@ public abstract class Level implements Bundlable {
|
|||||||
mapped = bundle.getBooleanArray( MAPPED );
|
mapped = bundle.getBooleanArray( MAPPED );
|
||||||
|
|
||||||
transitions = new ArrayList<>();
|
transitions = new ArrayList<>();
|
||||||
if (bundle.contains(TRANSITIONS)){
|
for (Bundlable b : bundle.getCollection( TRANSITIONS )){
|
||||||
for (Bundlable b : bundle.getCollection( TRANSITIONS )){
|
transitions.add((LevelTransition) b);
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
locked = bundle.getBoolean( LOCKED );
|
locked = bundle.getBoolean( LOCKED );
|
||||||
|
|||||||
@@ -132,20 +132,6 @@ public class PrisonBossLevel extends Level {
|
|||||||
public void restoreFromBundle( Bundle bundle ) {
|
public void restoreFromBundle( Bundle bundle ) {
|
||||||
super.restoreFromBundle(bundle);
|
super.restoreFromBundle(bundle);
|
||||||
state = bundle.getEnum( STATE, State.class );
|
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.
|
//in some states tengu won't be in the world, in others he will be.
|
||||||
if (state == State.START || state == State.FIGHT_PAUSE) {
|
if (state == State.START || state == State.FIGHT_PAUSE) {
|
||||||
|
|||||||
@@ -222,11 +222,6 @@ public class SewerBossLevel extends SewerLevel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void restoreFromBundle( Bundle bundle ) {
|
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 );
|
super.restoreFromBundle( bundle );
|
||||||
roomExit = roomEntrance;
|
roomExit = roomEntrance;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,13 +88,6 @@ public class HighGrass {
|
|||||||
if (ch instanceof Hero && ((Hero) ch).hasTalent(Talent.NATURES_BOUNTY)){
|
if (ch instanceof Hero && ((Hero) ch).hasTalent(Talent.NATURES_BOUNTY)){
|
||||||
int berriesAvailable = 2 + 2*((Hero) ch).pointsInTalent(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);
|
Talent.NatureBerriesDropped dropped = Buff.affect(ch, Talent.NatureBerriesDropped.class);
|
||||||
berriesAvailable -= dropped.count();
|
berriesAvailable -= dropped.count();
|
||||||
|
|
||||||
|
|||||||
@@ -654,9 +654,9 @@ public class HeroSelectScene extends PixelScene {
|
|||||||
if (diff <= 0) {
|
if (diff <= 0) {
|
||||||
long time = Game.realTime - (Game.realTime % DAY);
|
long time = Game.realTime - (Game.realTime % DAY);
|
||||||
|
|
||||||
//earliest possible daily for v1.4.0 is Sept 10 2022
|
//earliest possible daily for v2.2.X is Oct 05 2023
|
||||||
//which is 19,245 days after Jan 1 1970
|
//which is 19,635 days after Jan 1 1970
|
||||||
time = Math.max(time, 19_245 * DAY);
|
time = Math.max(time, 19_635 * DAY);
|
||||||
|
|
||||||
SPDSettings.lastDaily(time);
|
SPDSettings.lastDaily(time);
|
||||||
Dungeon.dailyReplay = false;
|
Dungeon.dailyReplay = false;
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ import java.util.Collections;
|
|||||||
|
|
||||||
public class WelcomeScene extends PixelScene {
|
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
|
//used so that the game does not keep showing the window forever if cleaning fails
|
||||||
private static boolean triedCleaningTemp = false;
|
private static boolean triedCleaningTemp = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user