v3.3.0: removed support for saves prior to v2.5.4
This commit is contained in:
@@ -113,7 +113,7 @@ public class GamesInProgress {
|
|||||||
|
|
||||||
Bundle bundle = FileUtils.bundleFromFile(gameFile(slot));
|
Bundle bundle = FileUtils.bundleFromFile(gameFile(slot));
|
||||||
|
|
||||||
if (bundle.getInt( "version" ) < ShatteredPixelDungeon.v2_4_2) {
|
if (bundle.getInt( "version" ) < ShatteredPixelDungeon.v2_5_4) {
|
||||||
info = null;
|
info = null;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,7 @@ public class ShatteredPixelDungeon extends Game {
|
|||||||
//rankings from v1.2.3 and older use a different score formula, so this reference is kept
|
//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;
|
public static final int v1_2_3 = 628;
|
||||||
|
|
||||||
//savegames from versions older than v2.4.2 are no longer supported, and data from them is ignored
|
//savegames from versions older than v2.5.4 are no longer supported, and data from them is ignored
|
||||||
public static final int v2_4_2 = 782;
|
|
||||||
public static final int v2_5_4 = 802;
|
public static final int v2_5_4 = 802;
|
||||||
|
|
||||||
public static final int v3_0_2 = 833;
|
public static final int v3_0_2 = 833;
|
||||||
@@ -52,26 +51,6 @@ public class ShatteredPixelDungeon extends Game {
|
|||||||
com.shatteredpixel.shatteredpixeldungeon.items.keys.WornKey.class,
|
com.shatteredpixel.shatteredpixeldungeon.items.keys.WornKey.class,
|
||||||
"com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey" );
|
"com.shatteredpixel.shatteredpixeldungeon.items.keys.SkeletonKey" );
|
||||||
|
|
||||||
//pre-v2.5.3
|
|
||||||
com.watabou.utils.Bundle.addAlias(
|
|
||||||
com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDetectMagic.class,
|
|
||||||
"com.shatteredpixel.shatteredpixeldungeon.items.stones.StoneOfDisarming" );
|
|
||||||
|
|
||||||
//pre-v2.5.2
|
|
||||||
com.watabou.utils.Bundle.addAlias(
|
|
||||||
com.shatteredpixel.shatteredpixeldungeon.items.bombs.FlashBangBomb.class,
|
|
||||||
"com.shatteredpixel.shatteredpixeldungeon.items.bombs.ShockBomb" );
|
|
||||||
com.watabou.utils.Bundle.addAlias(
|
|
||||||
com.shatteredpixel.shatteredpixeldungeon.items.bombs.SmokeBomb.class,
|
|
||||||
"com.shatteredpixel.shatteredpixeldungeon.items.bombs.Flashbang" );
|
|
||||||
|
|
||||||
//pre-v2.5.0
|
|
||||||
com.watabou.utils.Bundle.addAlias(
|
|
||||||
com.shatteredpixel.shatteredpixeldungeon.actors.mobs.MobSpawner.class,
|
|
||||||
"com.shatteredpixel.shatteredpixeldungeon.levels.Level$Respawner" );
|
|
||||||
com.watabou.utils.Bundle.addAlias(
|
|
||||||
com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invulnerability.class,
|
|
||||||
"com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AnkhInvulnerability" );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,105 +0,0 @@
|
|||||||
/*
|
|
||||||
* Pixel Dungeon
|
|
||||||
* Copyright (C) 2012-2015 Oleg Dolya
|
|
||||||
*
|
|
||||||
* Shattered Pixel Dungeon
|
|
||||||
* Copyright (C) 2014-2025 Evan Debenham
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.items.stones;
|
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.mechanics.ShadowCaster;
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
|
||||||
import com.watabou.noosa.audio.Sample;
|
|
||||||
import com.watabou.utils.Point;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
|
|
||||||
//for pre-v2.5.3 saves, add a conversion in v3.0 and remove entirely later
|
|
||||||
public class StoneOfDisarming extends Runestone {
|
|
||||||
|
|
||||||
private static final int DIST = 8;
|
|
||||||
|
|
||||||
{
|
|
||||||
image = ItemSpriteSheet.STONE_DETECT;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void activate(final int cell) {
|
|
||||||
boolean[] FOV = new boolean[Dungeon.level.length()];
|
|
||||||
Point c = Dungeon.level.cellToPoint(cell);
|
|
||||||
ShadowCaster.castShadow(c.x, c.y, Dungeon.level.width(), FOV, Dungeon.level.losBlocking, DIST);
|
|
||||||
|
|
||||||
int sX = Math.max(0, c.x - DIST);
|
|
||||||
int eX = Math.min(Dungeon.level.width()-1, c.x + DIST);
|
|
||||||
|
|
||||||
int sY = Math.max(0, c.y - DIST);
|
|
||||||
int eY = Math.min(Dungeon.level.height()-1, c.y + DIST);
|
|
||||||
|
|
||||||
ArrayList<Trap> disarmCandidates = new ArrayList<>();
|
|
||||||
|
|
||||||
for (int y = sY; y <= eY; y++){
|
|
||||||
int curr = y*Dungeon.level.width() + sX;
|
|
||||||
for ( int x = sX; x <= eX; x++){
|
|
||||||
|
|
||||||
if (FOV[curr]){
|
|
||||||
|
|
||||||
Trap t = Dungeon.level.traps.get(curr);
|
|
||||||
if (t != null && t.active){
|
|
||||||
disarmCandidates.add(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
curr++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Collections.shuffle(disarmCandidates);
|
|
||||||
Collections.sort(disarmCandidates, new Comparator<Trap>() {
|
|
||||||
@Override
|
|
||||||
public int compare(Trap o1, Trap o2) {
|
|
||||||
float diff = Dungeon.level.trueDistance(cell, o1.pos) - Dungeon.level.trueDistance(cell, o2.pos);
|
|
||||||
if (diff < 0){
|
|
||||||
return -1;
|
|
||||||
} else if (diff == 0){
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//disarms at most nine traps
|
|
||||||
while (disarmCandidates.size() > 9){
|
|
||||||
disarmCandidates.remove(9);
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( Trap t : disarmCandidates){
|
|
||||||
t.reveal();
|
|
||||||
t.disarm();
|
|
||||||
CellEmitter.get(t.pos).burst(Speck.factory(Speck.STEAM), 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
Sample.INSTANCE.play( Assets.Sounds.TELEPORT );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -200,19 +200,8 @@ public class Sai extends MeleeWeapon {
|
|||||||
@Override
|
@Override
|
||||||
public void restoreFromBundle(Bundle bundle) {
|
public void restoreFromBundle(Bundle bundle) {
|
||||||
super.restoreFromBundle(bundle);
|
super.restoreFromBundle(bundle);
|
||||||
if (bundle.contains(TIME)){
|
comboTime = bundle.getInt(TIME);
|
||||||
comboTime = bundle.getInt(TIME);
|
hits = bundle.getInt(RECENT_HITS);
|
||||||
hits = bundle.getInt(RECENT_HITS);
|
|
||||||
} else {
|
|
||||||
//pre-2.4.0 saves
|
|
||||||
comboTime = 5f;
|
|
||||||
hits = 0;
|
|
||||||
if (bundle.contains(RECENT_HITS)) {
|
|
||||||
for (int i : bundle.getIntArray(RECENT_HITS)) {
|
|
||||||
hits += i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -363,8 +363,8 @@ public abstract class Level implements Bundlable {
|
|||||||
|
|
||||||
version = bundle.getInt( VERSION );
|
version = bundle.getInt( VERSION );
|
||||||
|
|
||||||
//saves from before v2.3.2 are not supported
|
//saves from before v2.5.4 are not supported
|
||||||
if (version < ShatteredPixelDungeon.v2_4_2){
|
if (version < ShatteredPixelDungeon.v2_5_4){
|
||||||
throw new RuntimeException("old save");
|
throw new RuntimeException("old save");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -317,14 +317,6 @@ public class PrisonBossLevel extends Level {
|
|||||||
cell += width();
|
cell += width();
|
||||||
}
|
}
|
||||||
|
|
||||||
//pre-2.5.1 saves, if exit wasn't already added
|
|
||||||
if (exit() == entrance()) {
|
|
||||||
LevelTransition exit = new LevelTransition(this, pointToCell(levelExit), LevelTransition.Type.REGULAR_EXIT);
|
|
||||||
exit.right += 2;
|
|
||||||
exit.bottom += 3;
|
|
||||||
transitions.add(exit);
|
|
||||||
}
|
|
||||||
|
|
||||||
addCagesToCells();
|
addCagesToCells();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1029,9 +1029,6 @@ public class GameScene extends PixelScene {
|
|||||||
customWalls.add( visual.create() );
|
customWalls.add( visual.create() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//FIXME added a sync check here in v3.2.5, which caused deadlocks
|
|
||||||
// what I really need to do is have these queue additions that then happen on render thread
|
|
||||||
// this can also apply to adding mob sprites
|
|
||||||
private void addHeapSprite( Heap heap ) {
|
private void addHeapSprite( Heap heap ) {
|
||||||
ItemSprite sprite = heap.sprite = (ItemSprite)heaps.recycle( ItemSprite.class );
|
ItemSprite sprite = heap.sprite = (ItemSprite)heaps.recycle( ItemSprite.class );
|
||||||
sprite.revive();
|
sprite.revive();
|
||||||
|
|||||||
Reference in New Issue
Block a user