Skip to content

Commit

Permalink
CV64: Fix items with weird characters landing on Renon's shop crashing (
Browse files Browse the repository at this point in the history
  • Loading branch information
LiquidCat64 authored and AustinSumigray committed Jan 4, 2025
1 parent 4865a3b commit 4bb9ab2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions worlds/cv64/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def cv64_string_to_bytearray(cv64text: str, a_advance: bool = False, append_end:
if char in cv64_char_dict:
text_bytes.extend([0x00, cv64_char_dict[char][0]])
else:
text_bytes.extend([0x00, 0x41])
text_bytes.extend([0x00, 0x21])

if a_advance:
text_bytes.extend([0xA3, 0x00])
Expand All @@ -45,7 +45,10 @@ def cv64_text_truncate(cv64text: str, textbox_len_limit: int) -> str:
line_len = 0

for i in range(len(cv64text)):
line_len += cv64_char_dict[cv64text[i]][1]
if cv64text[i] in cv64_char_dict:
line_len += cv64_char_dict[cv64text[i]][1]
else:
line_len += 5

if line_len > textbox_len_limit:
return cv64text[0x00:i]
Expand Down

0 comments on commit 4bb9ab2

Please sign in to comment.