Skip to content

Commit

Permalink
LADX: Fix hints generation for longer location names ArchipelagoMW#2099
Browse files Browse the repository at this point in the history
  • Loading branch information
zig-for authored and kl3cks7r committed Aug 11, 2023
1 parent 0c34527 commit a351ec7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
6 changes: 6 additions & 0 deletions worlds/ladx/LADXR/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ def generateRom(args, settings, ap_settings, auth, seed_name, logic, rnd=None, m
all_items = multiworld.get_items()
our_items = [item for item in all_items if item.player == player_id and item.location and item.code is not None and item.location.show_in_spoiler]
our_useful_items = [item for item in our_items if ItemClassification.progression in item.classification]

def gen_hint():
chance = rnd.uniform(0, 1)
if chance < JUNK_HINT:
Expand All @@ -267,10 +268,15 @@ def gen_hint():
location_name = location.ladxr_item.metadata.name
else:
location_name = location.name

hint = f"{name} {location.item} is at {location_name}"
if location.player != player_id:
hint += f" in {multiworld.player_name[location.player]}'s world"

# Cap hint size at 85
# Realistically we could go bigger but let's be safe instead
hint = hint[:85]

return hint

hints.addHints(rom, rnd, gen_hint)
Expand Down
14 changes: 8 additions & 6 deletions worlds/ladx/LADXR/pointerTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,14 @@ def __init__(self, rom, info):
self.__storage = [{"bank": self.__storage[0]["bank"], "start": self.__storage[0]["start"], "end": self.__storage[-1]["end"]}]
if "expand_to_end_of_bank" in info and info["expand_to_end_of_bank"]:
for st in self.__storage:
expand = True
for st2 in self.__storage:
if st["bank"] == st2["bank"] and st["end"] < st2["end"]:
expand = False
if expand:
st["end"] = 0x4000
if info["expand_to_end_of_bank"] == True or st["bank"] in info["expand_to_end_of_bank"]:
expand = True
for st2 in self.__storage:
if st["bank"] == st2["bank"] and st["end"] < st2["end"]:
expand = False
if expand:
st["end"] = 0x4000
self.storage = self.__storage

# for s in sorted(self.__storage, key=lambda s: (s["bank"], s["start"])):
# print(self.__class__.__name__, s)
Expand Down
5 changes: 5 additions & 0 deletions worlds/ladx/LADXR/romTables.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def __init__(self, rom):
"pointers_bank": 0x1C,
"banks_addr": 0x741,
"banks_bank": 0x1C,
"expand_to_end_of_bank": {0x09}
})


Expand Down Expand Up @@ -185,6 +186,7 @@ def __init__(self, filename, patches=None):

# Ability to patch any text in the game with different text
self.texts = Texts(self)

# Ability to modify rooms
self.entities = Entities(self)
self.rooms_overworld_top = RoomsOverworldTop(self)
Expand All @@ -202,6 +204,9 @@ def __init__(self, filename, patches=None):
self.itemNames = {}

def save(self, filename, *, name=None):
# Assert special handling of bank 9 expansion is fine
for i in range(0x3d42, 0x4000):
assert self.banks[9][i] == 0, self.banks[9][i]
self.texts.store(self)
self.entities.store(self)
self.rooms_overworld_top.store(self)
Expand Down

0 comments on commit a351ec7

Please sign in to comment.