Skip to content

Commit

Permalink
Pokemon Crystal: Fix non-local locations being added to phone traps
Browse files Browse the repository at this point in the history
  • Loading branch information
AliceMousie committed Jul 20, 2024
1 parent 0a07c18 commit a599fce
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions worlds/pokemon_crystal/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,13 @@ async def game_watcher(self, ctx: "BizHawkClientContext") -> None:
if not len(self.phone_trap_locations):
phone_result = await bizhawk.guarded_read(
ctx.bizhawk_ctx,
[(data.rom_addresses["AP_Setting_Phone_Trap_Locations"], 0x80, "ROM")],
[(data.rom_addresses["AP_Setting_Phone_Trap_Locations"], 0x20, "ROM")],
[overworld_guard]
)
if phone_result is not None:
read_locations = []
for i in range(0, 16):
loc = int.from_bytes(phone_result[0][i * 8:(i + 1) * 8], "little")
loc = int.from_bytes(phone_result[0][i * 2:(i + 1) * 2], "little")
read_locations.append(loc)
self.phone_trap_locations = read_locations
else:
Expand Down
2 changes: 1 addition & 1 deletion worlds/pokemon_crystal/phone.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def generate_phone_traps(world: "PokemonCrystalWorld"):
else:
psychic_location = world.multiworld.get_location(data.locations["TM29_PSYCHIC"].label, world.player)
remote_locs = []
for location in world.multiworld.get_locations():
for location in world.multiworld.get_locations(world.player):
if len(remote_locs) > 3:
break
if (location.address is not None and location.item and location.item.player != world.player
Expand Down
2 changes: 1 addition & 1 deletion worlds/pokemon_crystal/rom.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def generate_output(world: "PokemonCrystalWorld", output_directory: str, patch:

phone_location_bytes = []
for loc in world.generated_phone_indices:
phone_location_bytes += list(loc.to_bytes(8, "little"))
phone_location_bytes += list(loc.to_bytes(2, "little"))
phone_location_address = data.rom_addresses["AP_Setting_Phone_Trap_Locations"]
write_bytes(patch, phone_location_bytes, phone_location_address)

Expand Down

0 comments on commit a599fce

Please sign in to comment.