Text clean-up, TEXT_SPEED_FF to TEXT_SKIP_DRAW
This commit is contained in:
319
src/braille.c
319
src/braille.c
@@ -21,187 +21,174 @@ u16 FontFunc_Braille(struct TextPrinter *textPrinter)
|
||||
|
||||
switch (textPrinter->state)
|
||||
{
|
||||
case 0:
|
||||
if (JOY_HELD(A_BUTTON | B_BUTTON) && subStruct->hasPrintBeenSpedUp)
|
||||
case RENDER_STATE_HANDLE_CHAR:
|
||||
if (JOY_HELD(A_BUTTON | B_BUTTON) && subStruct->hasPrintBeenSpedUp)
|
||||
{
|
||||
textPrinter->delayCounter = 0;
|
||||
}
|
||||
if (textPrinter->delayCounter && textPrinter->textSpeed)
|
||||
{
|
||||
textPrinter->delayCounter --;
|
||||
if (gTextFlags.canABSpeedUpPrint && JOY_NEW(A_BUTTON | B_BUTTON))
|
||||
{
|
||||
subStruct->hasPrintBeenSpedUp = TRUE;
|
||||
textPrinter->delayCounter = 0;
|
||||
}
|
||||
if (textPrinter->delayCounter && textPrinter->textSpeed)
|
||||
{
|
||||
textPrinter->delayCounter --;
|
||||
if (gTextFlags.canABSpeedUpPrint && JOY_NEW(A_BUTTON | B_BUTTON))
|
||||
{
|
||||
subStruct->hasPrintBeenSpedUp = TRUE;
|
||||
textPrinter->delayCounter = 0;
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
if (gTextFlags.autoScroll)
|
||||
{
|
||||
textPrinter->delayCounter = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
textPrinter->delayCounter = textPrinter->textSpeed;
|
||||
}
|
||||
return RENDER_UPDATE;
|
||||
}
|
||||
if (gTextFlags.autoScroll)
|
||||
textPrinter->delayCounter = 3;
|
||||
else
|
||||
textPrinter->delayCounter = textPrinter->textSpeed;
|
||||
|
||||
char_ = *textPrinter->printerTemplate.currentChar++;
|
||||
switch (char_)
|
||||
{
|
||||
case EOS:
|
||||
return RENDER_FINISH;
|
||||
case CHAR_NEWLINE:
|
||||
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
|
||||
textPrinter->printerTemplate.currentY += gFonts[textPrinter->printerTemplate.fontId].maxLetterHeight + textPrinter->printerTemplate.lineSpacing;
|
||||
return RENDER_REPEAT;
|
||||
case PLACEHOLDER_BEGIN:
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
return RENDER_REPEAT;
|
||||
case EXT_CTRL_CODE_BEGIN:
|
||||
char_ = *textPrinter->printerTemplate.currentChar++;
|
||||
switch (char_)
|
||||
{
|
||||
case EOS:
|
||||
return 1;
|
||||
case CHAR_NEWLINE:
|
||||
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
|
||||
textPrinter->printerTemplate.currentY += gFonts[textPrinter->printerTemplate.fontId].maxLetterHeight + textPrinter->printerTemplate.lineSpacing;
|
||||
return 2;
|
||||
case PLACEHOLDER_BEGIN:
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
return 2;
|
||||
case EXT_CTRL_CODE_BEGIN:
|
||||
char_ = *textPrinter->printerTemplate.currentChar++;
|
||||
switch (char_)
|
||||
{
|
||||
case EXT_CTRL_CODE_COLOR:
|
||||
textPrinter->printerTemplate.fgColor = *textPrinter->printerTemplate.currentChar++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
|
||||
return 2;
|
||||
case EXT_CTRL_CODE_HIGHLIGHT:
|
||||
textPrinter->printerTemplate.bgColor = *textPrinter->printerTemplate.currentChar++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
|
||||
return 2;
|
||||
case EXT_CTRL_CODE_SHADOW:
|
||||
textPrinter->printerTemplate.shadowColor = *textPrinter->printerTemplate.currentChar++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
|
||||
return 2;
|
||||
case EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW:
|
||||
textPrinter->printerTemplate.fgColor = *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.bgColor = *++textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.shadowColor = *++textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
case EXT_CTRL_CODE_COLOR:
|
||||
textPrinter->printerTemplate.fgColor = *textPrinter->printerTemplate.currentChar++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
|
||||
return RENDER_REPEAT;
|
||||
case EXT_CTRL_CODE_HIGHLIGHT:
|
||||
textPrinter->printerTemplate.bgColor = *textPrinter->printerTemplate.currentChar++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
|
||||
return RENDER_REPEAT;
|
||||
case EXT_CTRL_CODE_SHADOW:
|
||||
textPrinter->printerTemplate.shadowColor = *textPrinter->printerTemplate.currentChar++;
|
||||
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
|
||||
return RENDER_REPEAT;
|
||||
case EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW:
|
||||
textPrinter->printerTemplate.fgColor = *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.bgColor = *++textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.shadowColor = *++textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
|
||||
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
|
||||
return 2;
|
||||
case EXT_CTRL_CODE_PALETTE:
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
return 2;
|
||||
case EXT_CTRL_CODE_FONT:
|
||||
subStruct->fontId = *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
return 2;
|
||||
case EXT_CTRL_CODE_RESET_SIZE:
|
||||
return 2;
|
||||
case EXT_CTRL_CODE_PAUSE:
|
||||
textPrinter->delayCounter = *textPrinter->printerTemplate.currentChar++;
|
||||
textPrinter->state = 6;
|
||||
return 2;
|
||||
case EXT_CTRL_CODE_PAUSE_UNTIL_PRESS:
|
||||
textPrinter->state = 1;
|
||||
if (gTextFlags.autoScroll)
|
||||
{
|
||||
subStruct->autoScrollDelay = 0;
|
||||
}
|
||||
return 3;
|
||||
case EXT_CTRL_CODE_WAIT_SE:
|
||||
textPrinter->state = 5;
|
||||
return 3;
|
||||
case EXT_CTRL_CODE_PLAY_BGM:
|
||||
case EXT_CTRL_CODE_PLAY_SE:
|
||||
textPrinter->printerTemplate.currentChar += 2;
|
||||
return 2;
|
||||
case EXT_CTRL_CODE_ESCAPE:
|
||||
char_ = *++textPrinter->printerTemplate.currentChar;
|
||||
break;
|
||||
case EXT_CTRL_CODE_SHIFT_TEXT:
|
||||
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x + *textPrinter->printerTemplate.currentChar++;
|
||||
return 2;
|
||||
case EXT_CTRL_CODE_SHIFT_DOWN:
|
||||
textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y + *textPrinter->printerTemplate.currentChar++;
|
||||
return 2;
|
||||
case EXT_CTRL_CODE_FILL_WINDOW:
|
||||
FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, PIXEL_FILL(textPrinter->printerTemplate.bgColor));
|
||||
return 2;
|
||||
}
|
||||
break;
|
||||
case CHAR_PROMPT_CLEAR:
|
||||
textPrinter->state = 2;
|
||||
TextPrinterInitDownArrowCounters(textPrinter);
|
||||
return 3;
|
||||
case CHAR_PROMPT_SCROLL:
|
||||
textPrinter->state = 3;
|
||||
TextPrinterInitDownArrowCounters(textPrinter);
|
||||
return 3;
|
||||
case CHAR_EXTRA_SYMBOL:
|
||||
char_ = *textPrinter->printerTemplate.currentChar++| 0x100;
|
||||
break;
|
||||
case CHAR_KEYPAD_ICON:
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
return 0;
|
||||
}
|
||||
DecompressGlyph_Braille(char_);
|
||||
CopyGlyphToWindow(textPrinter);
|
||||
textPrinter->printerTemplate.currentX += gCurGlyph.width + textPrinter->printerTemplate.letterSpacing;
|
||||
return 0;
|
||||
case 1:
|
||||
if (TextPrinterWait(textPrinter))
|
||||
{
|
||||
textPrinter->state = 0;
|
||||
}
|
||||
return 3;
|
||||
case 2:
|
||||
if (TextPrinterWaitWithDownArrow(textPrinter))
|
||||
{
|
||||
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
|
||||
return RENDER_REPEAT;
|
||||
case EXT_CTRL_CODE_PALETTE:
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
return RENDER_REPEAT;
|
||||
case EXT_CTRL_CODE_FONT:
|
||||
subStruct->fontId = *textPrinter->printerTemplate.currentChar;
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
return RENDER_REPEAT;
|
||||
case EXT_CTRL_CODE_RESET_SIZE:
|
||||
return RENDER_REPEAT;
|
||||
case EXT_CTRL_CODE_PAUSE:
|
||||
textPrinter->delayCounter = *textPrinter->printerTemplate.currentChar++;
|
||||
textPrinter->state = RENDER_STATE_PAUSE;
|
||||
return RENDER_REPEAT;
|
||||
case EXT_CTRL_CODE_PAUSE_UNTIL_PRESS:
|
||||
textPrinter->state = RENDER_STATE_WAIT;
|
||||
if (gTextFlags.autoScroll)
|
||||
subStruct->autoScrollDelay = 0;
|
||||
return RENDER_UPDATE;
|
||||
case EXT_CTRL_CODE_WAIT_SE:
|
||||
textPrinter->state = RENDER_STATE_WAIT_SE;
|
||||
return RENDER_UPDATE;
|
||||
case EXT_CTRL_CODE_PLAY_BGM:
|
||||
case EXT_CTRL_CODE_PLAY_SE:
|
||||
textPrinter->printerTemplate.currentChar += 2;
|
||||
return RENDER_REPEAT;
|
||||
case EXT_CTRL_CODE_ESCAPE:
|
||||
char_ = *++textPrinter->printerTemplate.currentChar;
|
||||
break;
|
||||
case EXT_CTRL_CODE_SHIFT_TEXT:
|
||||
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x + *textPrinter->printerTemplate.currentChar++;
|
||||
return RENDER_REPEAT;
|
||||
case EXT_CTRL_CODE_SHIFT_DOWN:
|
||||
textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y + *textPrinter->printerTemplate.currentChar++;
|
||||
return RENDER_REPEAT;
|
||||
case EXT_CTRL_CODE_FILL_WINDOW:
|
||||
FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, PIXEL_FILL(textPrinter->printerTemplate.bgColor));
|
||||
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
|
||||
textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y;
|
||||
textPrinter->state = 0;
|
||||
return RENDER_REPEAT;
|
||||
}
|
||||
return 3;
|
||||
case 3:
|
||||
if (TextPrinterWaitWithDownArrow(textPrinter))
|
||||
break;
|
||||
case CHAR_PROMPT_CLEAR:
|
||||
textPrinter->state = RENDER_STATE_CLEAR;
|
||||
TextPrinterInitDownArrowCounters(textPrinter);
|
||||
return RENDER_UPDATE;
|
||||
case CHAR_PROMPT_SCROLL:
|
||||
textPrinter->state = RENDER_STATE_SCROLL_START;
|
||||
TextPrinterInitDownArrowCounters(textPrinter);
|
||||
return RENDER_UPDATE;
|
||||
case CHAR_EXTRA_SYMBOL:
|
||||
char_ = *textPrinter->printerTemplate.currentChar++| 0x100;
|
||||
break;
|
||||
case CHAR_KEYPAD_ICON:
|
||||
textPrinter->printerTemplate.currentChar++;
|
||||
return RENDER_PRINT;
|
||||
}
|
||||
DecompressGlyph_Braille(char_);
|
||||
CopyGlyphToWindow(textPrinter);
|
||||
textPrinter->printerTemplate.currentX += gCurGlyph.width + textPrinter->printerTemplate.letterSpacing;
|
||||
return RENDER_PRINT;
|
||||
case RENDER_STATE_WAIT:
|
||||
if (TextPrinterWait(textPrinter))
|
||||
textPrinter->state = RENDER_STATE_HANDLE_CHAR;
|
||||
return RENDER_UPDATE;
|
||||
case RENDER_STATE_CLEAR:
|
||||
if (TextPrinterWaitWithDownArrow(textPrinter))
|
||||
{
|
||||
FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, PIXEL_FILL(textPrinter->printerTemplate.bgColor));
|
||||
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
|
||||
textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y;
|
||||
textPrinter->state = RENDER_STATE_HANDLE_CHAR;
|
||||
}
|
||||
return RENDER_UPDATE;
|
||||
case RENDER_STATE_SCROLL_START:
|
||||
if (TextPrinterWaitWithDownArrow(textPrinter))
|
||||
{
|
||||
TextPrinterClearDownArrow(textPrinter);
|
||||
textPrinter->scrollDistance = gFonts[textPrinter->printerTemplate.fontId].maxLetterHeight + textPrinter->printerTemplate.lineSpacing;
|
||||
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
|
||||
textPrinter->state = RENDER_STATE_SCROLL;
|
||||
}
|
||||
return RENDER_UPDATE;
|
||||
case RENDER_STATE_SCROLL:
|
||||
if (textPrinter->scrollDistance)
|
||||
{
|
||||
if (textPrinter->scrollDistance < sScrollDistances[gSaveBlock2Ptr->optionsTextSpeed])
|
||||
{
|
||||
TextPrinterClearDownArrow(textPrinter);
|
||||
textPrinter->scrollDistance = gFonts[textPrinter->printerTemplate.fontId].maxLetterHeight + textPrinter->printerTemplate.lineSpacing;
|
||||
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
|
||||
textPrinter->state = 4;
|
||||
}
|
||||
return 3;
|
||||
case 4:
|
||||
if (textPrinter->scrollDistance)
|
||||
{
|
||||
if (textPrinter->scrollDistance < sScrollDistances[gSaveBlock2Ptr->optionsTextSpeed])
|
||||
{
|
||||
ScrollWindow(textPrinter->printerTemplate.windowId, 0, textPrinter->scrollDistance, PIXEL_FILL(textPrinter->printerTemplate.bgColor));
|
||||
textPrinter->scrollDistance = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ScrollWindow(textPrinter->printerTemplate.windowId, 0, sScrollDistances[gSaveBlock2Ptr->optionsTextSpeed], PIXEL_FILL(textPrinter->printerTemplate.bgColor));
|
||||
textPrinter->scrollDistance -= sScrollDistances[gSaveBlock2Ptr->optionsTextSpeed];
|
||||
}
|
||||
CopyWindowToVram(textPrinter->printerTemplate.windowId, COPYWIN_GFX);
|
||||
ScrollWindow(textPrinter->printerTemplate.windowId, 0, textPrinter->scrollDistance, PIXEL_FILL(textPrinter->printerTemplate.bgColor));
|
||||
textPrinter->scrollDistance = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
textPrinter->state = 0;
|
||||
ScrollWindow(textPrinter->printerTemplate.windowId, 0, sScrollDistances[gSaveBlock2Ptr->optionsTextSpeed], PIXEL_FILL(textPrinter->printerTemplate.bgColor));
|
||||
textPrinter->scrollDistance -= sScrollDistances[gSaveBlock2Ptr->optionsTextSpeed];
|
||||
}
|
||||
return 3;
|
||||
case 5:
|
||||
if (!IsSEPlaying())
|
||||
{
|
||||
textPrinter->state = 0;
|
||||
}
|
||||
return 3;
|
||||
case 6:
|
||||
if (textPrinter->delayCounter)
|
||||
{
|
||||
textPrinter->delayCounter --;
|
||||
}
|
||||
else
|
||||
{
|
||||
textPrinter->state = 0;
|
||||
}
|
||||
return 3;
|
||||
CopyWindowToVram(textPrinter->printerTemplate.windowId, COPYWIN_GFX);
|
||||
}
|
||||
else
|
||||
{
|
||||
textPrinter->state = RENDER_STATE_HANDLE_CHAR;
|
||||
}
|
||||
return RENDER_UPDATE;
|
||||
case RENDER_STATE_WAIT_SE:
|
||||
if (!IsSEPlaying())
|
||||
textPrinter->state = RENDER_STATE_HANDLE_CHAR;
|
||||
return RENDER_UPDATE;
|
||||
case RENDER_STATE_PAUSE:
|
||||
if (textPrinter->delayCounter)
|
||||
textPrinter->delayCounter --;
|
||||
else
|
||||
textPrinter->state = RENDER_STATE_HANDLE_CHAR;
|
||||
return RENDER_UPDATE;
|
||||
}
|
||||
return 1;
|
||||
return RENDER_FINISH;
|
||||
}
|
||||
|
||||
static void DecompressGlyph_Braille(u16 glyph)
|
||||
|
||||
Reference in New Issue
Block a user