From 29a66fa0c94d52bdc89164022b1fab08bdb9cf3d Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 23 Nov 2025 12:52:00 -0500 Subject: [PATCH] v3.3.0: removed support for saves prior to v2.5.4 --- .../GamesInProgress.java | 2 +- .../ShatteredPixelDungeon.java | 23 +--- .../items/stones/StoneOfDisarming.java | 105 ------------------ .../items/weapon/melee/Sai.java | 15 +-- .../shatteredpixeldungeon/levels/Level.java | 4 +- .../levels/PrisonBossLevel.java | 8 -- .../scenes/GameScene.java | 3 - 7 files changed, 6 insertions(+), 154 deletions(-) delete mode 100644 core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfDisarming.java diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/GamesInProgress.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/GamesInProgress.java index a3686b49d..072d181dc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/GamesInProgress.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/GamesInProgress.java @@ -113,7 +113,7 @@ public class GamesInProgress { Bundle bundle = FileUtils.bundleFromFile(gameFile(slot)); - if (bundle.getInt( "version" ) < ShatteredPixelDungeon.v2_4_2) { + if (bundle.getInt( "version" ) < ShatteredPixelDungeon.v2_5_4) { info = null; } else { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java index 43175fdd5..eb7a71fda 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ShatteredPixelDungeon.java @@ -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 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 - public static final int v2_4_2 = 782; + //savegames from versions older than v2.5.4 are no longer supported, and data from them is ignored public static final int v2_5_4 = 802; 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.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 diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfDisarming.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfDisarming.java deleted file mode 100644 index a46de678e..000000000 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/stones/StoneOfDisarming.java +++ /dev/null @@ -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 - */ - -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 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() { - @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 ); - } -} diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Sai.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Sai.java index 6e076390e..80b75336a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Sai.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Sai.java @@ -200,19 +200,8 @@ public class Sai extends MeleeWeapon { @Override public void restoreFromBundle(Bundle bundle) { super.restoreFromBundle(bundle); - if (bundle.contains(TIME)){ - comboTime = bundle.getInt(TIME); - 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; - } - } - } + comboTime = bundle.getInt(TIME); + hits = bundle.getInt(RECENT_HITS); } } 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 4a90091c0..34e0a8e9e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/Level.java @@ -363,8 +363,8 @@ public abstract class Level implements Bundlable { version = bundle.getInt( VERSION ); - //saves from before v2.3.2 are not supported - if (version < ShatteredPixelDungeon.v2_4_2){ + //saves from before v2.5.4 are not supported + if (version < ShatteredPixelDungeon.v2_5_4){ throw new RuntimeException("old save"); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java index 311d2a06d..b5c72876e 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/levels/PrisonBossLevel.java @@ -317,14 +317,6 @@ public class PrisonBossLevel extends Level { 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(); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index 0c53406b6..c139faaee 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -1029,9 +1029,6 @@ public class GameScene extends PixelScene { 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 ) { ItemSprite sprite = heap.sprite = (ItemSprite)heaps.recycle( ItemSprite.class ); sprite.revive();