Remaining text sync/doc

This commit is contained in:
GriffinR
2022-11-22 14:32:58 -05:00
parent e78094de85
commit 94560af99c
6 changed files with 208 additions and 215 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

+1 -2
View File
@@ -189,8 +189,7 @@ void DecompressGlyph_Small(u16 glyphId, bool32 isJapanese);
void DecompressGlyph_Normal(u16 glyphId, bool32 isJapanese); void DecompressGlyph_Normal(u16 glyphId, bool32 isJapanese);
void DecompressGlyph_Female(u16 glyphId, bool32 isJapanese); void DecompressGlyph_Female(u16 glyphId, bool32 isJapanese);
s32 GetGlyphWidth_Braille(u16 font_type, bool32 isJapanese); s32 GetGlyphWidth_Braille(u16 font_type, bool32 isJapanese);
void sub_80062B0(struct Sprite *sprite); u8 CreateTextCursorSprite(u8 sheetId, u16 x, u16 y, u8 priority, u8 subpriority);
u8 CreateTextCursorSpriteForOakSpeech(u8 sheetId, u16 x, u16 y, u8 priority, u8 subpriority);
void DestroyTextCursorSprite(u8 spriteId); void DestroyTextCursorSprite(u8 spriteId);
#endif // GUARD_TEXT_H #endif // GUARD_TEXT_H
+159 -170
View File
@@ -4,6 +4,9 @@
#include "text.h" #include "text.h"
#include "sound.h" #include "sound.h"
// This file handles the braille font.
// For printing braille messages, see ScrCmd_braillemessage
static const u8 sScrollDistances[] = { static const u8 sScrollDistances[] = {
[OPTIONS_TEXT_SPEED_SLOW] = 1, [OPTIONS_TEXT_SPEED_SLOW] = 1,
[OPTIONS_TEXT_SPEED_MID] = 2, [OPTIONS_TEXT_SPEED_MID] = 2,
@@ -16,192 +19,178 @@ static void DecompressGlyph_Braille(u16);
u16 FontFunc_Braille(struct TextPrinter *textPrinter) u16 FontFunc_Braille(struct TextPrinter *textPrinter)
{ {
u16 char_; u16 char_;
struct TextPrinterSubStruct *sub; struct TextPrinterSubStruct *sub = &textPrinter->subUnion.sub;
sub = &textPrinter->subUnion.sub;
switch (textPrinter->state) switch (textPrinter->state)
{ {
case 0: case RENDER_STATE_HANDLE_CHAR:
if (gMain.heldKeys & (A_BUTTON | B_BUTTON) && sub->hasPrintBeenSpedUp) if (JOY_HELD(A_BUTTON | B_BUTTON) && sub->hasPrintBeenSpedUp)
{
textPrinter->delayCounter = 0;
}
if (textPrinter->delayCounter && textPrinter->textSpeed)
{
textPrinter->delayCounter--;
if (gTextFlags.canABSpeedUpPrint && JOY_NEW(A_BUTTON | B_BUTTON))
{ {
sub->hasPrintBeenSpedUp = TRUE;
textPrinter->delayCounter = 0; textPrinter->delayCounter = 0;
} }
if (textPrinter->delayCounter && textPrinter->textSpeed) return RENDER_UPDATE;
{ }
textPrinter->delayCounter --; if (gTextFlags.autoScroll)
if (gTextFlags.canABSpeedUpPrint && gMain.newKeys & (A_BUTTON | B_BUTTON)) textPrinter->delayCounter = 1;
{ else
sub->hasPrintBeenSpedUp = TRUE; textPrinter->delayCounter = textPrinter->textSpeed;
textPrinter->delayCounter = 0;
} char_ = *textPrinter->printerTemplate.currentChar++;
return 3; switch (char_)
} {
if (gTextFlags.autoScroll) case EOS:
{ return RENDER_FINISH;
textPrinter->delayCounter = 1; case CHAR_NEWLINE:
} textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
else textPrinter->printerTemplate.currentY += gFonts[textPrinter->printerTemplate.fontId].maxLetterHeight + textPrinter->printerTemplate.lineSpacing;
{ return RENDER_REPEAT;
textPrinter->delayCounter = textPrinter->textSpeed; case PLACEHOLDER_BEGIN:
} textPrinter->printerTemplate.currentChar++;
return RENDER_REPEAT;
case EXT_CTRL_CODE_BEGIN:
char_ = *textPrinter->printerTemplate.currentChar++; char_ = *textPrinter->printerTemplate.currentChar++;
switch (char_) switch (char_)
{ {
case EOS: case EXT_CTRL_CODE_COLOR:
return 1; textPrinter->printerTemplate.fgColor = *textPrinter->printerTemplate.currentChar++;
case CHAR_NEWLINE: GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x; return RENDER_REPEAT;
textPrinter->printerTemplate.currentY += gFonts[textPrinter->printerTemplate.fontId].maxLetterHeight + textPrinter->printerTemplate.lineSpacing; case EXT_CTRL_CODE_HIGHLIGHT:
return 2; textPrinter->printerTemplate.bgColor = *textPrinter->printerTemplate.currentChar++;
case PLACEHOLDER_BEGIN: GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
textPrinter->printerTemplate.currentChar++; return RENDER_REPEAT;
return 2; case EXT_CTRL_CODE_SHADOW:
case EXT_CTRL_CODE_BEGIN: textPrinter->printerTemplate.shadowColor = *textPrinter->printerTemplate.currentChar++;
char_ = *textPrinter->printerTemplate.currentChar++; GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
switch (char_) return RENDER_REPEAT;
{ case EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW:
case 1: textPrinter->printerTemplate.fgColor = *textPrinter->printerTemplate.currentChar;
textPrinter->printerTemplate.fgColor = *textPrinter->printerTemplate.currentChar++; textPrinter->printerTemplate.bgColor = *++textPrinter->printerTemplate.currentChar;
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor); textPrinter->printerTemplate.shadowColor = *++textPrinter->printerTemplate.currentChar;
return 2; textPrinter->printerTemplate.currentChar++;
case 2:
textPrinter->printerTemplate.bgColor = *textPrinter->printerTemplate.currentChar++;
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
return 2;
case 3:
textPrinter->printerTemplate.shadowColor = *textPrinter->printerTemplate.currentChar++;
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
return 2;
case 4:
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); GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
return 2; return RENDER_REPEAT;
case 5: case EXT_CTRL_CODE_PALETTE:
textPrinter->printerTemplate.currentChar++; textPrinter->printerTemplate.currentChar++;
return 2; return RENDER_REPEAT;
case 6: case EXT_CTRL_CODE_FONT:
sub->glyphId = *textPrinter->printerTemplate.currentChar; sub->glyphId = *textPrinter->printerTemplate.currentChar;
textPrinter->printerTemplate.currentChar++; textPrinter->printerTemplate.currentChar++;
return 2; return RENDER_REPEAT;
case 7: case EXT_CTRL_CODE_RESET_FONT:
return 2; return RENDER_REPEAT;
case 8: case EXT_CTRL_CODE_PAUSE:
textPrinter->delayCounter = *textPrinter->printerTemplate.currentChar++; textPrinter->delayCounter = *textPrinter->printerTemplate.currentChar++;
textPrinter->state = 6; textPrinter->state = RENDER_STATE_PAUSE;
return 2; return RENDER_REPEAT;
case 9: case EXT_CTRL_CODE_PAUSE_UNTIL_PRESS:
textPrinter->state = 1; textPrinter->state = RENDER_STATE_WAIT;
if (gTextFlags.autoScroll) if (gTextFlags.autoScroll)
{ sub->autoScrollDelay = 0;
sub->autoScrollDelay = 0; return RENDER_UPDATE;
} case EXT_CTRL_CODE_WAIT_SE:
return 3; textPrinter->state = RENDER_STATE_WAIT_SE;
case 10: return RENDER_UPDATE;
textPrinter->state = 5; case EXT_CTRL_CODE_PLAY_BGM:
return 3; case EXT_CTRL_CODE_PLAY_SE:
case 11: textPrinter->printerTemplate.currentChar += 2;
case 16: return RENDER_REPEAT;
textPrinter->printerTemplate.currentChar += 2; case EXT_CTRL_CODE_ESCAPE:
return 2; char_ = *++textPrinter->printerTemplate.currentChar;
case 12: break;
char_ = *++textPrinter->printerTemplate.currentChar; case EXT_CTRL_CODE_SHIFT_RIGHT:
break; textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x + *textPrinter->printerTemplate.currentChar++;
case 13: return RENDER_REPEAT;
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x + *textPrinter->printerTemplate.currentChar++; case EXT_CTRL_CODE_SHIFT_DOWN:
return 2; textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y + *textPrinter->printerTemplate.currentChar++;
case 14: return RENDER_REPEAT;
textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y + *textPrinter->printerTemplate.currentChar++; case EXT_CTRL_CODE_FILL_WINDOW:
return 2;
case 15:
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 += gGlyphInfo.width + textPrinter->printerTemplate.letterSpacing;
return 0;
case 1:
if (TextPrinterWait(textPrinter))
{
textPrinter->state = 0;
}
return 3;
case 2:
if (TextPrinterWaitWithDownArrow(textPrinter))
{
FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, PIXEL_FILL(textPrinter->printerTemplate.bgColor)); FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, PIXEL_FILL(textPrinter->printerTemplate.bgColor));
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x; return RENDER_REPEAT;
textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y;
textPrinter->state = 0;
} }
return 3; break;
case 3: case CHAR_PROMPT_CLEAR:
if (TextPrinterWaitWithDownArrow(textPrinter)) 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 += gGlyphInfo.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); ScrollWindow(textPrinter->printerTemplate.windowId, 0, textPrinter->scrollDistance, PIXEL_FILL(textPrinter->printerTemplate.bgColor));
textPrinter->scrollDistance = gFonts[textPrinter->printerTemplate.fontId].maxLetterHeight + textPrinter->printerTemplate.lineSpacing; textPrinter->scrollDistance = 0;
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);
} }
else else
{ {
textPrinter->state = 0; ScrollWindow(textPrinter->printerTemplate.windowId, 0, sScrollDistances[gSaveBlock2Ptr->optionsTextSpeed], PIXEL_FILL(textPrinter->printerTemplate.bgColor));
textPrinter->scrollDistance -= sScrollDistances[gSaveBlock2Ptr->optionsTextSpeed];
} }
return 3; CopyWindowToVram(textPrinter->printerTemplate.windowId, COPYWIN_GFX);
case 5: }
if (!IsSEPlaying()) else
{ {
textPrinter->state = 0; textPrinter->state = RENDER_STATE_HANDLE_CHAR;
} }
return 3; return RENDER_UPDATE;
case 6: case RENDER_STATE_WAIT_SE:
if (textPrinter->delayCounter) if (!IsSEPlaying())
{ textPrinter->state = RENDER_STATE_HANDLE_CHAR;
textPrinter->delayCounter --; return RENDER_UPDATE;
} case RENDER_STATE_PAUSE:
else if (textPrinter->delayCounter)
{ textPrinter->delayCounter--;
textPrinter->state = 0; else
} textPrinter->state = RENDER_STATE_HANDLE_CHAR;
return 3; return RENDER_UPDATE;
} }
return 1; return RENDER_FINISH;
} }
static void DecompressGlyph_Braille(u16 glyph) static void DecompressGlyph_Braille(u16 glyph)
@@ -213,8 +202,8 @@ static void DecompressGlyph_Braille(u16 glyph)
DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo.pixels + 0x20)); DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo.pixels + 0x20));
DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo.pixels + 0x40)); DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo.pixels + 0x40));
DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo.pixels + 0x60)); DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo.pixels + 0x60));
gGlyphInfo.width = 0x10; gGlyphInfo.width = 16;
gGlyphInfo.height = 0x10; gGlyphInfo.height = 16;
} }
s32 GetGlyphWidth_Braille(u16 font_type, bool32 isJapanese) s32 GetGlyphWidth_Braille(u16 font_type, bool32 isJapanese)
+1 -1
View File
@@ -2487,7 +2487,7 @@ void BrailleCursorToggle(void)
{ {
x = gSpecialVar_0x8004 + 27; x = gSpecialVar_0x8004 + 27;
if (gSpecialVar_0x8006 == 0) if (gSpecialVar_0x8006 == 0)
sBrailleTextCursorSpriteID = CreateTextCursorSpriteForOakSpeech(0, x, gSpecialVar_0x8005, 0, 0); sBrailleTextCursorSpriteID = CreateTextCursorSprite(0, x, gSpecialVar_0x8005, 0, 0);
else else
DestroyTextCursorSprite(sBrailleTextCursorSpriteID); DestroyTextCursorSprite(sBrailleTextCursorSpriteID);
} }
+2 -2
View File
@@ -569,7 +569,7 @@ static void Task_OaksSpeech1(u8 taskId)
FillBgTilemapBufferRect_Palette0(1, 0xD00E, 0, 19, 30, 1); FillBgTilemapBufferRect_Palette0(1, 0xD00E, 0, 19, 30, 1);
CreateHelpDocsPage1(); CreateHelpDocsPage1();
gPaletteFade.bufferTransferDisabled = FALSE; gPaletteFade.bufferTransferDisabled = FALSE;
gTasks[taskId].data[5] = CreateTextCursorSpriteForOakSpeech(0, 0xE6, 0x95, 0, 0); gTasks[taskId].data[5] = CreateTextCursorSprite(0, 0xE6, 0x95, 0, 0);
BlendPalettes(PALETTES_ALL, 0x10, 0x00); BlendPalettes(PALETTES_ALL, 0x10, 0x00);
break; break;
case 10: case 10:
@@ -748,7 +748,7 @@ static void Task_OakSpeech6(u8 taskId)
gMain.state = 0; gMain.state = 0;
data[15] = 16; data[15] = 16;
AddTextPrinterParameterized4(data[14], FONT_NORMAL, 3, 5, 1, 0, sTextColor_OakSpeech, 0, sNewGameAdventureIntroTextPointers[0]); AddTextPrinterParameterized4(data[14], FONT_NORMAL, 3, 5, 1, 0, sTextColor_OakSpeech, 0, sNewGameAdventureIntroTextPointers[0]);
data[5] = CreateTextCursorSpriteForOakSpeech(0, 0xe2, 0x91, 0, 0); data[5] = CreateTextCursorSprite(0, 0xe2, 0x91, 0, 0);
gSprites[data[5]].oam.objMode = ST_OAM_OBJ_BLEND; gSprites[data[5]].oam.objMode = ST_OAM_OBJ_BLEND;
gSprites[data[5]].oam.priority = 0; gSprites[data[5]].oam.priority = 0;
CreatePikaOrGrassPlatformSpriteAndLinkToCurrentTask(taskId, 0); CreatePikaOrGrassPlatformSpriteAndLinkToCurrentTask(taskId, 0);
+45 -40
View File
@@ -6,6 +6,10 @@
#include "dynamic_placeholder_text_util.h" #include "dynamic_placeholder_text_util.h"
#include "constants/songs.h" #include "constants/songs.h"
#define TAG_CURSOR 0x8000
#define CURSOR_DELAY 8
extern const struct OamData gOamData_AffineOff_ObjNormal_16x16; extern const struct OamData gOamData_AffineOff_ObjNormal_16x16;
static void DecompressGlyph_NormalCopy1(u16 glyphId, bool32 isJapanese); static void DecompressGlyph_NormalCopy1(u16 glyphId, bool32 isJapanese);
@@ -18,6 +22,7 @@ static s32 GetGlyphWidth_Normal(u16 glyphId, bool32 isJapanese);
static s32 GetGlyphWidth_NormalCopy2(u16 glyphId, bool32 isJapanese); static s32 GetGlyphWidth_NormalCopy2(u16 glyphId, bool32 isJapanese);
static s32 GetGlyphWidth_Male(u16 glyphId, bool32 isJapanese); static s32 GetGlyphWidth_Male(u16 glyphId, bool32 isJapanese);
static s32 GetGlyphWidth_Female(u16 glyphId, bool32 isJapanese); static s32 GetGlyphWidth_Female(u16 glyphId, bool32 isJapanese);
static void SpriteCB_TextCursor(struct Sprite *sprite);
TextFlags gTextFlags; TextFlags gTextFlags;
@@ -45,28 +50,28 @@ static const struct GlyphWidthFunc sGlyphWidthFuncs[] = {
{ FONT_BRAILLE, GetGlyphWidth_Braille } { FONT_BRAILLE, GetGlyphWidth_Braille }
}; };
static const struct SpriteSheet sUnknown_81EA68C[] = static const struct SpriteSheet sSpriteSheets_TextCursor[] =
{ {
{sDoubleArrowTiles1, sizeof(sDoubleArrowTiles1), 0x8000}, {sDoubleArrowTiles1, sizeof(sDoubleArrowTiles1), TAG_CURSOR},
{sDoubleArrowTiles2, sizeof(sDoubleArrowTiles2), 0x8000}, {sDoubleArrowTiles2, sizeof(sDoubleArrowTiles2), TAG_CURSOR},
{NULL} {NULL}
}; };
static const struct SpritePalette sUnknown_81EA6A4[] = static const struct SpritePalette sSpritePalettes_TextCursor[] =
{ {
{gStandardMenuPalette, 0x8000}, {gStandardMenuPalette, TAG_CURSOR},
{NULL} {NULL}
}; };
static const struct SpriteTemplate sUnknown_81EA6B4 = static const struct SpriteTemplate sSpriteTemplate_TextCursor =
{ {
.tileTag = 0x8000, .tileTag = TAG_CURSOR,
.paletteTag = 0x8000, .paletteTag = TAG_CURSOR,
.oam = &gOamData_AffineOff_ObjNormal_16x16, .oam = &gOamData_AffineOff_ObjNormal_16x16,
.anims = gDummySpriteAnimTable, .anims = gDummySpriteAnimTable,
.images = NULL, .images = NULL,
.affineAnims = gDummySpriteAffineAnimTable, .affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_80062B0, .callback = SpriteCB_TextCursor,
}; };
struct struct
@@ -509,7 +514,7 @@ void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter)
12); 12);
CopyWindowToVram(textPrinter->printerTemplate.windowId, 0x2); CopyWindowToVram(textPrinter->printerTemplate.windowId, 0x2);
subStruct->downArrowDelay = 0x8; subStruct->downArrowDelay = CURSOR_DELAY;
subStruct->downArrowYPosIdx = (*(u32 *)subStruct << 17 >> 30) + 1; subStruct->downArrowYPosIdx = (*(u32 *)subStruct << 17 >> 30) + 1;
} }
} }
@@ -616,7 +621,7 @@ void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *c
10, 10,
12); 12);
CopyWindowToVram(windowId, 0x2); CopyWindowToVram(windowId, 0x2);
*counter = 8; *counter = CURSOR_DELAY;
++*yCoordIndex; ++*yCoordIndex;
} }
} }
@@ -1277,7 +1282,7 @@ u8 RenderTextHandleBold(u8 *pixels, u8 fontId, u8 *str, int a3, int a4, int a5,
#define sDelay data[0] #define sDelay data[0]
#define sState data[1] #define sState data[1]
void sub_80062B0(struct Sprite *sprite) static void SpriteCB_TextCursor(struct Sprite *sprite)
{ {
if (sprite->sDelay) if (sprite->sDelay)
{ {
@@ -1285,7 +1290,7 @@ void sub_80062B0(struct Sprite *sprite)
} }
else else
{ {
sprite->sDelay = 8; sprite->sDelay = CURSOR_DELAY;
switch(sprite->sState) switch(sprite->sState)
{ {
case 0: case 0:
@@ -1306,28 +1311,28 @@ void sub_80062B0(struct Sprite *sprite)
} }
} }
#undef sDelay u8 CreateTextCursorSprite(u8 sheetId, u16 x, u16 y, u8 priority, u8 subpriority)
#undef sState
u8 CreateTextCursorSpriteForOakSpeech(u8 sheetId, u16 x, u16 y, u8 priority, u8 subpriority)
{ {
u8 spriteId; u8 spriteId;
LoadSpriteSheet(&sUnknown_81EA68C[sheetId & 1]); LoadSpriteSheet(&sSpriteSheets_TextCursor[sheetId & 1]);
LoadSpritePalette(sUnknown_81EA6A4); LoadSpritePalette(&sSpritePalettes_TextCursor[0]);
spriteId = CreateSprite(&sUnknown_81EA6B4, x + 3, y + 4, subpriority); spriteId = CreateSprite(&sSpriteTemplate_TextCursor, x + 3, y + 4, subpriority);
gSprites[spriteId].oam.priority = (priority & 3); gSprites[spriteId].oam.priority = (priority & 3);
gSprites[spriteId].oam.matrixNum = 0; gSprites[spriteId].oam.matrixNum = 0;
gSprites[spriteId].data[0] = 8; gSprites[spriteId].sDelay = CURSOR_DELAY;
return spriteId; return spriteId;
} }
void DestroyTextCursorSprite(u8 spriteId) void DestroyTextCursorSprite(u8 spriteId)
{ {
DestroySprite(&gSprites[spriteId]); DestroySprite(&gSprites[spriteId]);
FreeSpriteTilesByTag(0x8000); FreeSpriteTilesByTag(TAG_CURSOR);
FreeSpritePaletteByTag(0x8000); FreeSpritePaletteByTag(TAG_CURSOR);
} }
#undef sDelay
#undef sState
u8 DrawKeypadIcon(u8 windowId, u8 keypadIconId, u16 x, u16 y) u8 DrawKeypadIcon(u8 windowId, u8 keypadIconId, u16 x, u16 y)
{ {
BlitBitmapRectToWindow( BlitBitmapRectToWindow(
@@ -1429,9 +1434,9 @@ void DecompressGlyph_Normal(u16 glyphId, bool32 isJapanese)
int i; int i;
u8 lastColor; u8 lastColor;
if(isJapanese == TRUE) if (isJapanese == TRUE)
{ {
if(glyphId == 0) if (glyphId == 0)
{ {
lastColor = GetLastTextColor(2); lastColor = GetLastTextColor(2);
@@ -1456,7 +1461,7 @@ void DecompressGlyph_Normal(u16 glyphId, bool32 isJapanese)
} }
else else
{ {
if(glyphId == 0) if (glyphId == 0)
{ {
lastColor = GetLastTextColor(2); lastColor = GetLastTextColor(2);
@@ -1485,7 +1490,7 @@ static s32 GetGlyphWidth_Normal(u16 glyphId, bool32 isJapanese)
{ {
if (isJapanese == TRUE) if (isJapanese == TRUE)
{ {
if(glyphId == 0) if (glyphId == 0)
return 10; return 10;
return sFontNormalJapaneseGlyphWidths[glyphId]; return sFontNormalJapaneseGlyphWidths[glyphId];
@@ -1502,9 +1507,9 @@ static void DecompressGlyph_NormalCopy2(u16 glyphId, bool32 isJapanese)
int i; int i;
u8 lastColor; u8 lastColor;
if(isJapanese == TRUE) if (isJapanese == TRUE)
{ {
if(glyphId == 0) if (glyphId == 0)
{ {
lastColor = GetLastTextColor(2); lastColor = GetLastTextColor(2);
@@ -1533,7 +1538,7 @@ static void DecompressGlyph_NormalCopy2(u16 glyphId, bool32 isJapanese)
static s32 GetGlyphWidth_NormalCopy2(u16 glyphId, bool32 isJapanese) static s32 GetGlyphWidth_NormalCopy2(u16 glyphId, bool32 isJapanese)
{ {
if(isJapanese == TRUE) if (isJapanese == TRUE)
return 10; return 10;
else else
return sFontNormalLatinGlyphWidths[glyphId]; return sFontNormalLatinGlyphWidths[glyphId];
@@ -1545,9 +1550,9 @@ static void DecompressGlyph_Male(u16 glyphId, bool32 isJapanese)
int i; int i;
u8 lastColor; u8 lastColor;
if(isJapanese == TRUE) if (isJapanese == TRUE)
{ {
if(glyphId == 0) if (glyphId == 0)
{ {
lastColor = GetLastTextColor(2); lastColor = GetLastTextColor(2);
@@ -1572,7 +1577,7 @@ static void DecompressGlyph_Male(u16 glyphId, bool32 isJapanese)
} }
else else
{ {
if(glyphId == 0) if (glyphId == 0)
{ {
lastColor = GetLastTextColor(2); lastColor = GetLastTextColor(2);
@@ -1599,9 +1604,9 @@ static void DecompressGlyph_Male(u16 glyphId, bool32 isJapanese)
static s32 GetGlyphWidth_Male(u16 glyphId, bool32 isJapanese) static s32 GetGlyphWidth_Male(u16 glyphId, bool32 isJapanese)
{ {
if(isJapanese == TRUE) if (isJapanese == TRUE)
{ {
if(glyphId == 0) if (glyphId == 0)
return 10; return 10;
return sFontMaleJapaneseGlyphWidths[glyphId]; return sFontMaleJapaneseGlyphWidths[glyphId];
@@ -1616,9 +1621,9 @@ void DecompressGlyph_Female(u16 glyphId, bool32 isJapanese)
int i; int i;
u8 lastColor; u8 lastColor;
if(isJapanese == TRUE) if (isJapanese == TRUE)
{ {
if(glyphId == 0) if (glyphId == 0)
{ {
lastColor = GetLastTextColor(2); lastColor = GetLastTextColor(2);
@@ -1643,7 +1648,7 @@ void DecompressGlyph_Female(u16 glyphId, bool32 isJapanese)
} }
else else
{ {
if(glyphId == 0) if (glyphId == 0)
{ {
lastColor = GetLastTextColor(2); lastColor = GetLastTextColor(2);
@@ -1670,9 +1675,9 @@ void DecompressGlyph_Female(u16 glyphId, bool32 isJapanese)
static s32 GetGlyphWidth_Female(u16 glyphId, bool32 isJapanese) static s32 GetGlyphWidth_Female(u16 glyphId, bool32 isJapanese)
{ {
if(isJapanese == TRUE) if (isJapanese == TRUE)
{ {
if(glyphId == 0) if (glyphId == 0)
return 10; return 10;
return sFontFemaleJapaneseGlyphWidths[glyphId]; return sFontFemaleJapaneseGlyphWidths[glyphId];