LADX: Fix hints generation for longer location names #2099
This commit is contained in:
parent
8d6b2dfc9c
commit
d5474128e3
|
@ -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:
|
||||
|
@ -267,10 +268,15 @@ def generateRom(args, settings, ap_settings, auth, seed_name, logic, rnd=None, m
|
|||
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)
|
||||
|
|
|
@ -59,12 +59,14 @@ class PointerTable:
|
|||
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)
|
||||
|
|
|
@ -13,6 +13,7 @@ class Texts(PointerTable):
|
|||
"pointers_bank": 0x1C,
|
||||
"banks_addr": 0x741,
|
||||
"banks_bank": 0x1C,
|
||||
"expand_to_end_of_bank": {0x09}
|
||||
})
|
||||
|
||||
|
||||
|
@ -185,6 +186,7 @@ class ROMWithTables(ROM):
|
|||
|
||||
# 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)
|
||||
|
@ -202,6 +204,9 @@ class ROMWithTables(ROM):
|
|||
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)
|
||||
|
|
Loading…
Reference in New Issue