mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
CV64: Fix some textbox message truncation issues #4157
This commit is contained in:
@@ -944,13 +944,19 @@ def write_patch(world: "CV64World", patch: CV64ProcedurePatch, offset_data: Dict
|
||||
for loc in active_locations:
|
||||
if loc.address is None or get_location_info(loc.name, "type") == "shop" or loc.item.player == world.player:
|
||||
continue
|
||||
if len(loc.item.name) > 67:
|
||||
item_name = loc.item.name[0x00:0x68]
|
||||
# If the Item's name is longer than 104 characters, truncate the name to inject at 104.
|
||||
if len(loc.item.name) > 104:
|
||||
item_name = loc.item.name[0:104]
|
||||
else:
|
||||
item_name = loc.item.name
|
||||
# Get the item's player's name. If it's longer than 16 characters (which can happen if it's an ItemLinked item),
|
||||
# truncate it at 16.
|
||||
player_name = world.multiworld.get_player_name(loc.item.player)
|
||||
if len(player_name) > 16:
|
||||
player_name = player_name[0:16]
|
||||
|
||||
inject_address = 0xBB7164 + (256 * (loc.address & 0xFFF))
|
||||
wrapped_name, num_lines = cv64_text_wrap(item_name + "\nfor " +
|
||||
world.multiworld.get_player_name(loc.item.player), 96)
|
||||
wrapped_name, num_lines = cv64_text_wrap(item_name + "\nfor " + player_name, 96)
|
||||
patch.write_token(APTokenTypes.WRITE, inject_address, bytes(get_item_text_color(loc) +
|
||||
cv64_string_to_bytearray(wrapped_name)))
|
||||
patch.write_token(APTokenTypes.WRITE, inject_address + 255, bytes([num_lines]))
|
||||
|
||||
Reference in New Issue
Block a user