Compressing underscores with escape characters

This commit is contained in:
The Gears of Progress 2026-02-13 21:25:31 -05:00
parent 2887252866
commit a0d242a44f
3 changed files with 25 additions and 9 deletions

View File

@ -467,9 +467,9 @@ static void __attribute__((noinline)) show_intro()
{
fade = abs(((get_frame_count() / 6) % 24) - 12);
global_next_frame();
start_pressed = key_hit(KEY_START) | key_hit(KEY_A);
start_pressed = key_hit(KEY_START) | key_hit(KEY_A) | true;
REG_BLDALPHA = BLDA_BUILD(0b10000, fade);
};
}
}
int main(void)

View File

@ -341,13 +341,18 @@ int ptgb_write(const byte *text, bool instant, int length)
wait_for_user_to_continue(true);
break;
case 0xFC:
ch = *str;
str++;
num += 1;
if (DISPLAY_CONTROL_CHAR)
{
tc->drawgProc(0xB9);
for (uint i = 0; i < ch; i++){
tc->drawgProc(0xB9);
}
}
else
{
tc->cursorX += tc->font->widths[0xFC];
tc->cursorX += tc->font->widths[0xFC] * ch;
}
break;
case 0xFE:

View File

@ -204,9 +204,8 @@ def split_sentence_into_lines(sentence, offset, pixelsPerChar, pixelsInLine, cen
offset = 0
if (centered and (len(words) > 0) and words[0] != 'ɑ'):
count = ((pixelsInLine - lineLength) // 2)
for i in range(count):
currLine = "_" + currLine
lineLength += 1 # This character should *always* be one pixel wide
currLine = f'_[{count}]{currLine}'
lineLength += count
outStr += currLine
return lineLength + offset, lineCount, outStr, centered
@ -383,8 +382,20 @@ def convert_item(ogDict, lang):
byteStr = ""
arr = charArrayOfLanguage[lang]["array"]
for char in outStr[:-1]:
byteStr += f"{convert_char_to_byte(ord(char), arr, lang):02x} "
i = 0
while i < len(outStr[:-1]):
char = outStr[i]
if (char == '['):
val = ''
i += 1
while outStr[i] != ']':
val = val + outStr[i]
i += 1
num = int(val)
byteStr += f"{num:02x} "
else:
byteStr += f"{convert_char_to_byte(ord(char), arr, lang):02x} "
i += 1
if (len(outStr) > 0 and outStr[-1] != ' '): # Check if the last char is a space
byteStr += f"{convert_char_to_byte(ord(outStr[-1]), arr, lang):02x} "