mirror of
https://github.com/GearsProgress/Poke_Transporter_GB.git
synced 2026-03-21 17:34:42 -05:00
Fixing starting newlines
This commit is contained in:
parent
b4dd515502
commit
e10d4cc044
|
|
@ -166,8 +166,8 @@ void setup(const u16 *debug_charset)
|
|||
text_data_table general_text(general_text_table_buffer);
|
||||
|
||||
general_text.decompress(get_compressed_text_table(GENERAL_INDEX));
|
||||
ptgb_write_textbox(general_text.get_text_entry(GENERAL_connecting), true, true,
|
||||
GENERAL_INDEX, GENERAL_connecting, true);
|
||||
ptgb_write_textbox(general_text.get_text_entry(GENERAL_connecting), true, false,
|
||||
GENERAL_INDEX, GENERAL_connecting, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ int text_loop(int script)
|
|||
if (curr_text != NULL && curr_text[char_index] != 0xFF && curr_text[char_index] != 0xFB)
|
||||
{
|
||||
ptgb_write_textbox(curr_text, false, true,
|
||||
PTGB_INDEX, curr_line.get_text_entry_index(), true);
|
||||
PTGB_INDEX, curr_line.get_text_entry_index(), false);
|
||||
}
|
||||
|
||||
// wait_for_user_to_continue();
|
||||
|
|
@ -149,6 +149,7 @@ int text_loop(int script)
|
|||
if (text_exit)
|
||||
{
|
||||
hide_textbox();
|
||||
erase_textbox_tiles();
|
||||
tte_erase_screen();
|
||||
text_exit = false;
|
||||
return 0;
|
||||
|
|
@ -198,13 +199,13 @@ int text_loop(int script)
|
|||
}
|
||||
if (update_text)
|
||||
{
|
||||
if (text_key > text_section_lengths[text_section])
|
||||
if (text_key >= text_section_lengths[text_section])
|
||||
{
|
||||
text_key = text_section_lengths[text_section];
|
||||
text_key = text_section_lengths[text_section] - 1;
|
||||
}
|
||||
if (text_section > NUM_TEXT_SECTIONS)
|
||||
if (text_section >= NUM_TEXT_SECTIONS)
|
||||
{
|
||||
text_section = NUM_TEXT_SECTIONS;
|
||||
text_section = NUM_TEXT_SECTIONS - 1;
|
||||
}
|
||||
tte_set_pos(0, 0);
|
||||
tte_erase_rect(0, 0, 240, 160);
|
||||
|
|
@ -269,6 +270,7 @@ void set_text_exit()
|
|||
int ptgb_write_textbox(const byte *text, bool instant, bool waitForUser,
|
||||
int text_section, int text_key, bool eraseMainBox)
|
||||
{
|
||||
erase_textbox_tiles();
|
||||
create_textbox_new(text_section, text_key, eraseMainBox);
|
||||
int out = ptgb_write(text, instant, 9999, text_box_type_tables[text_section][text_key]); // This is kinda silly but it'll work.
|
||||
if (waitForUser)
|
||||
|
|
|
|||
|
|
@ -317,13 +317,13 @@ def split_sentence_into_lines(sentence, offset, pixelsPerChar, pixelsInLine, cen
|
|||
elif (sentence == "ɑ" or sentence == "Ω"):
|
||||
if (sentence == "ɑ"):
|
||||
centered = True
|
||||
# If this is the first thing being added to outStr, don't add a newline
|
||||
if (currLineCount != 0):
|
||||
# Only advance when centering starts in the middle of an occupied line.
|
||||
if (currLineCount != 0 and offset != 0):
|
||||
outStr += "Ň"
|
||||
else:
|
||||
centered = False
|
||||
# Only advance if we're not already at the end of the box.
|
||||
if (currLineCount != numLines):
|
||||
# Only advance when centered text actually occupied the current line.
|
||||
if (currLineCount != numLines and offset != 0):
|
||||
outStr += "Ň"
|
||||
currLine = ""
|
||||
offset = 0
|
||||
|
|
@ -411,6 +411,10 @@ def hash_file_bytes(path):
|
|||
return h.digest()
|
||||
|
||||
def apply_escape_sequences(line, arr, escape_list):
|
||||
# Convert structural text controls to the formatter's internal sentinels
|
||||
# before generic escape replacement so layout logic can see them reliably.
|
||||
line = line.replace("{NEW}", 'Ň')
|
||||
|
||||
for token, char_indexes in escape_list:
|
||||
if token in line:
|
||||
escape_string = "".join(arr[idx] for idx in char_indexes)
|
||||
|
|
@ -514,6 +518,7 @@ def convert_item(ogDict, lang):
|
|||
outIndex += 1
|
||||
# Make sure both kinds of newlines are being accounted for
|
||||
box = box.replace('Ş', 'Ň')
|
||||
leading_newlines = len(box) - len(box.lstrip('Ň'))
|
||||
splitLines = box.split('Ň')
|
||||
outBox = ""
|
||||
i = 1
|
||||
|
|
@ -528,6 +533,10 @@ def convert_item(ogDict, lang):
|
|||
outBox += split + breakChar
|
||||
outIndex += 1
|
||||
i += 1
|
||||
if leading_newlines:
|
||||
existing_leading_newlines = len(outBox) - len(outBox.lstrip('Ň'))
|
||||
if existing_leading_newlines < leading_newlines:
|
||||
outBox = ('Ň' * (leading_newlines - existing_leading_newlines)) + outBox
|
||||
if (outBox and (outBox[:-1] == 'ȼ') or (outBox[:-1] == 'Ň')):
|
||||
newStr += f'{outBox[:-1]}ȼ'
|
||||
elif (outBox):
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue
Block a user