Fully adding scroll support

This commit is contained in:
The Gears of Progress
2026-01-28 17:34:30 -05:00
parent 304880f7d0
commit aff5709717
5 changed files with 84 additions and 17 deletions

View File

@@ -62,9 +62,9 @@ static __attribute__((noinline)) const u8 *read_dialogue_text_entry(uint8_t inde
// Maybe combine Japanese and Latin into one larger font?
#if PTGB_BUILD_LANGUAGE == 1
#define BUILD_FONT &japanese_normalFont
#define BUILD_FONT &japanese_normalFont
#else
#define BUILD_FONT &latin_normalFont
#define BUILD_FONT &latin_normalFont
#endif
void init_text_engine()
@@ -134,6 +134,7 @@ int text_loop(int script)
{
tte_set_pos(LEFT, TOP);
tte_erase_rect(LEFT, TOP, RIGHT, BOTTOM);
REG_BG3VOFS = 0;
ptgb_write(curr_text, false);
}
@@ -238,12 +239,14 @@ int text_loop(int script)
}
show_text_box();
tte_erase_rect(0, 0, 240, 160);
ptgb_write(curr_text, true);
ptgb_write(curr_text, false);
}
wait_for_user_to_continue(false);
update_text = true;
hide_text_box();
REG_BG3VOFS = 0;
if (text_exit)
{
@@ -323,6 +326,16 @@ int ptgb_write(const byte *text, bool instant, int length)
str++;
switch (ch)
{
case 0xFA:
if (DISPLAY_CONTROL_CHAR)
{
tc->drawgProc(0x79);
}
wait_for_user_to_continue(false);
scroll_text(text, instant, length, num, tc);
tc->cursorY += tc->font->charH;
tc->cursorX = tc->marginLeft;
break;
case 0xFB:
if (DISPLAY_CONTROL_CHAR)
{
@@ -428,5 +441,26 @@ void wait_for_user_to_continue(bool clear_text)
{
tte_erase_rect(LEFT, TOP, RIGHT, BOTTOM);
tte_set_pos(LEFT, TOP);
REG_BG3VOFS = 0;
}
}
}
void scroll_text(const byte *text, bool instant, int length, int curr_index, TTC *tc)
{
for (int i = 1; i <= tc->font->charH; i++)
{
REG_BG3VOFS = i;
tte_erase_rect(LEFT, TOP - tc->font->charH, RIGHT, TOP + i);
global_next_frame();
}
//wait_for_user_to_continue(true);
// Remove current text
//tte_erase_rect(LEFT, TOP, RIGHT, BOTTOM);
// Write old text offset up one line
//tte_set_pos(LEFT, TOP - tc->font->charH);
//ptgb_write(text, true, curr_index);
// Remove text that went outside of the box
tte_erase_rect(LEFT, TOP - tc->font->charH, RIGHT, TOP);
// Prepare to continue
//tte_set_pos(LEFT, TOP);
}