Skip to content

Commit

Permalink
Pepper, Treasures, and Anchor randomized. Added fix for guild.exe wei…
Browse files Browse the repository at this point in the history
…rdness. Brought over some bits of code for upcoming shop randomization expansion.
  • Loading branch information
thezerothcat committed Aug 11, 2017
1 parent 3a6da02 commit b1138a4
Show file tree
Hide file tree
Showing 10 changed files with 283 additions and 44 deletions.
3 changes: 2 additions & 1 deletion misc/assigned_flags.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ Dragon Bone world flag: b55
Pepper world flag: b56
Book of the Dead world flag: b57
Fake Silver Shield world flag: b58

guild.exe replacement world flag: b59
Anchor world flag: b60



Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>lmr.randomizer</groupId>
<artifactId>randomizer</artifactId>
<version>1.4.2</version>
<version>1.4.3</version>
<name>La-Mulana Remake Randomizer</name>
<description>La-Mulana Remake Randomizer</description>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/lmr/randomizer/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ private static void doTheThing() {
List<Block> datInfo = DatReader.getDatScriptInfo();
outputLocations(itemRandomizer, shopRandomizer, attempt);
itemRandomizer.updateFiles();
shopRandomizer.updateFiles(datInfo);
shopRandomizer.updateFiles(datInfo, random);
RcdWriter.writeRcd(rcdData);
DatWriter.writeDat(datInfo);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public void outputLocations(int attemptNumber) throws IOException {
writer.close();
}

public void updateFiles(List<Block> blocks) {
public void updateFiles(List<Block> blocks, Random random) {
String shopItem1;
String shopItem2;
String shopItem3;
Expand All @@ -163,7 +163,7 @@ public void updateFiles(List<Block> blocks) {
shopItem1 = mapOfShopInventoryItemToContents.get(String.format("%s Item 1", shopName));
shopItem2 = mapOfShopInventoryItemToContents.get(String.format("%s Item 2", shopName));
shopItem3 = mapOfShopInventoryItemToContents.get(String.format("%s Item 3", shopName));
GameDataTracker.writeShopInventory(shopBlock, shopItem1, shopItem2, shopItem3);
GameDataTracker.writeShopInventory(shopBlock, shopItem1, shopItem2, shopItem3, null);
}
}
}
16 changes: 14 additions & 2 deletions src/main/java/lmr/randomizer/random/ItemRandomizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,22 @@ public String getItem(String location) {
}

public void removeItemFromUnplacedItems(String originalShopItem) {
unplacedItems.remove(originalShopItem); // todo: this method may not actually be needed
unplacedItems.remove(originalShopItem);
}

public void placeNonRandomizedItems() {
// mapOfItemLocationToItem.put("Shell Horn", "Fruit of Eden");
// unassignedNonShopItemLocations.remove("Shell Horn");
// unplacedItems.remove("Fruit of Eden");
// mapOfItemLocationToItem.put("Shuriken", "Treasures");
// unassignedNonShopItemLocations.remove("Shuriken");
// unplacedItems.remove("Treasures");
// mapOfItemLocationToItem.put("Sacred Orb (Gate of Guidance)", "Pepper");
// unassignedNonShopItemLocations.remove("Sacred Orb (Gate of Guidance)");
// unplacedItems.remove("Pepper");
// mapOfItemLocationToItem.put("Map (Surface)", "mekuri.exe");
// unassignedNonShopItemLocations.remove("Map (Surface)");
// unplacedItems.remove("mekuri.exe");
for(String item : DataFromFile.getNonRandomizedItems()) {
mapOfItemLocationToItem.put(item, item);
if(!unassignedNonShopItemLocations.contains(item)) {
Expand Down Expand Up @@ -192,7 +204,7 @@ public void setAccessChecker(AccessChecker accessChecker) {
}

public void updateFiles() throws Exception{
List<String> locationsRelatedToBlocks = Arrays.asList("Map (Surface)", "mekuri.exe", "Mini Doll"); // todo: not hardcode this, eventually
List<String> locationsRelatedToBlocks = Arrays.asList("Map (Surface)", "mekuri.exe", "Mini Doll", "Pepper", "Anchor"); // todo: not hardcode this, eventually

for(Map.Entry<String, String> locationAndItem : mapOfItemLocationToItem.entrySet()) {
if(!locationAndItem.getKey().equals(locationAndItem.getValue())) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/lmr/randomizer/random/ShopRandomizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public void setAccessChecker(AccessChecker accessChecker) {
this.accessChecker = accessChecker;
}

public void updateFiles(List<Block> blocks) {
public void updateFiles(List<Block> blocks, Random random) {
// List<String> locationsRelatedToBlocks = Arrays.asList("Map (Surface)", "mekuri.exe", "Mini Doll"); // todo: not hardcode this, eventually
//
// for(String shopName : allShops) {
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/lmr/randomizer/rcd/RcdReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ private static ByteBuffer getField(byte[] mainArray, int startIndex, int length)
return ByteBuffer.wrap(getByteArraySlice(mainArray, startIndex, length)).order(ByteOrder.BIG_ENDIAN);
}

/**
* Reads in an object from the rcd file, adds it to the given ObjectContainer (unless we don't want to keep it),
* and then notifies GameObjectManager of the object.
* @param objectContainer the container (zone, room, or screen) we're adding this object to
* @param rcdBytes all the bytes from the rcd file
* @param rcdByteIndex byte index when starting to read this object
* @param hasPosition whether or not this object includes position data
* @return new rcdByteIndex after building this object
*/
private static int addObject(ObjectContainer objectContainer, byte[] rcdBytes, int rcdByteIndex, boolean hasPosition) {
GameObject obj = new GameObject(objectContainer);

Expand Down
Loading

0 comments on commit b1138a4

Please sign in to comment.