diff options
author | tom-overton <tom.overton@outlook.com> | 2021-09-09 20:58:00 -0700 |
---|---|---|
committer | tom-overton <tom.overton@outlook.com> | 2021-09-09 20:58:00 -0700 |
commit | faba29f447ac4796569c89310d8f6a7b2b2fa65f (patch) | |
tree | e63a038705ccf9229671d68f15f5f4c31c9fddb5 /src/com/dabomstew/pkrandom/romhandlers/Gen6RomHandler.java | |
parent | 0a1b55cb7d0e85b58b3d95f0334534278476b7be (diff) |
Gen 6: Add support for randomizing items obtained via Pickup
Diffstat (limited to 'src/com/dabomstew/pkrandom/romhandlers/Gen6RomHandler.java')
-rw-r--r-- | src/com/dabomstew/pkrandom/romhandlers/Gen6RomHandler.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/com/dabomstew/pkrandom/romhandlers/Gen6RomHandler.java b/src/com/dabomstew/pkrandom/romhandlers/Gen6RomHandler.java index 263e0c7..26894fe 100644 --- a/src/com/dabomstew/pkrandom/romhandlers/Gen6RomHandler.java +++ b/src/com/dabomstew/pkrandom/romhandlers/Gen6RomHandler.java @@ -216,6 +216,7 @@ public class Gen6RomHandler extends Abstract3DSRomHandler { private List<String> shopNames; private int shopItemsOffset; private ItemList allowedItems, nonBadItems; + private int pickupItemsTableOffset; private GARCArchive pokeGarc, moveGarc, stringsGarc, storyTextGarc; @@ -3593,6 +3594,36 @@ public class Gen6RomHandler extends Abstract3DSRomHandler { } @Override + public List<Integer> getPickupItems() { + List<Integer> pickupItems = new ArrayList<>(); + if (pickupItemsTableOffset == 0) { + int offset = find(code, Gen6Constants.pickupTableLocator); + if (offset > 0) { + pickupItemsTableOffset = offset; + } + } + if (pickupItemsTableOffset > 0) { + for (int i = 0; i < Gen6Constants.numberOfPickupItems; i++) { + int itemOffset = pickupItemsTableOffset + (2 * i); + int item = FileFunctions.read2ByteInt(code, itemOffset); + pickupItems.add(item); + } + } + return pickupItems; + } + + @Override + public void setPickupItems(List<Integer> pickupItems) { + if (pickupItemsTableOffset > 0) { + for (int i = 0; i < Gen6Constants.numberOfPickupItems; i++) { + int itemOffset = pickupItemsTableOffset + (2 * i); + int item = pickupItems.get(i); + FileFunctions.write2ByteInt(code, itemOffset, item); + } + } + } + + @Override public BufferedImage getMascotImage() { try { GARCArchive pokespritesGARC = this.readGARC(romEntry.getString("PokemonGraphics"),false); |