diff --git a/graphics/fonts/test.png b/graphics/fonts/test.png new file mode 100644 index 000000000..b6cba25f3 Binary files /dev/null and b/graphics/fonts/test.png differ diff --git a/include/text.h b/include/text.h index 800ebef28..7090a029b 100644 --- a/include/text.h +++ b/include/text.h @@ -189,8 +189,7 @@ void DecompressGlyph_Small(u16 glyphId, bool32 isJapanese); void DecompressGlyph_Normal(u16 glyphId, bool32 isJapanese); void DecompressGlyph_Female(u16 glyphId, bool32 isJapanese); s32 GetGlyphWidth_Braille(u16 font_type, bool32 isJapanese); -void sub_80062B0(struct Sprite *sprite); -u8 CreateTextCursorSpriteForOakSpeech(u8 sheetId, u16 x, u16 y, u8 priority, u8 subpriority); +u8 CreateTextCursorSprite(u8 sheetId, u16 x, u16 y, u8 priority, u8 subpriority); void DestroyTextCursorSprite(u8 spriteId); #endif // GUARD_TEXT_H diff --git a/src/braille_text.c b/src/braille_text.c index 823a62ad5..d4afdf87f 100644 --- a/src/braille_text.c +++ b/src/braille_text.c @@ -4,6 +4,9 @@ #include "text.h" #include "sound.h" +// This file handles the braille font. +// For printing braille messages, see ScrCmd_braillemessage + static const u8 sScrollDistances[] = { [OPTIONS_TEXT_SPEED_SLOW] = 1, [OPTIONS_TEXT_SPEED_MID] = 2, @@ -16,192 +19,178 @@ static void DecompressGlyph_Braille(u16); u16 FontFunc_Braille(struct TextPrinter *textPrinter) { u16 char_; - struct TextPrinterSubStruct *sub; + struct TextPrinterSubStruct *sub = &textPrinter->subUnion.sub; - sub = &textPrinter->subUnion.sub; switch (textPrinter->state) { - case 0: - if (gMain.heldKeys & (A_BUTTON | B_BUTTON) && sub->hasPrintBeenSpedUp) + case RENDER_STATE_HANDLE_CHAR: + 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; } - if (textPrinter->delayCounter && textPrinter->textSpeed) - { - textPrinter->delayCounter --; - if (gTextFlags.canABSpeedUpPrint && gMain.newKeys & (A_BUTTON | B_BUTTON)) - { - sub->hasPrintBeenSpedUp = TRUE; - textPrinter->delayCounter = 0; - } - return 3; - } - if (gTextFlags.autoScroll) - { - textPrinter->delayCounter = 1; - } - else - { - textPrinter->delayCounter = textPrinter->textSpeed; - } + return RENDER_UPDATE; + } + if (gTextFlags.autoScroll) + textPrinter->delayCounter = 1; + 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 1: - textPrinter->printerTemplate.fgColor = *textPrinter->printerTemplate.currentChar++; - GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor); - return 2; - 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++; + 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 5: - textPrinter->printerTemplate.currentChar++; - return 2; - case 6: - sub->glyphId = *textPrinter->printerTemplate.currentChar; - textPrinter->printerTemplate.currentChar++; - return 2; - case 7: - return 2; - case 8: - textPrinter->delayCounter = *textPrinter->printerTemplate.currentChar++; - textPrinter->state = 6; - return 2; - case 9: - textPrinter->state = 1; - if (gTextFlags.autoScroll) - { - sub->autoScrollDelay = 0; - } - return 3; - case 10: - textPrinter->state = 5; - return 3; - case 11: - case 16: - textPrinter->printerTemplate.currentChar += 2; - return 2; - case 12: - char_ = *++textPrinter->printerTemplate.currentChar; - break; - case 13: - textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x + *textPrinter->printerTemplate.currentChar++; - return 2; - case 14: - textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y + *textPrinter->printerTemplate.currentChar++; - 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)) - { + 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: + sub->glyphId = *textPrinter->printerTemplate.currentChar; + textPrinter->printerTemplate.currentChar++; + return RENDER_REPEAT; + case EXT_CTRL_CODE_RESET_FONT: + 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) + sub->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_RIGHT: + 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 += 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); - 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) @@ -213,8 +202,8 @@ static void DecompressGlyph_Braille(u16 glyph) DecompressGlyphTile(glyphs + 0x8, (u16 *)(gGlyphInfo.pixels + 0x20)); DecompressGlyphTile(glyphs + 0x80, (u16 *)(gGlyphInfo.pixels + 0x40)); DecompressGlyphTile(glyphs + 0x88, (u16 *)(gGlyphInfo.pixels + 0x60)); - gGlyphInfo.width = 0x10; - gGlyphInfo.height = 0x10; + gGlyphInfo.width = 16; + gGlyphInfo.height = 16; } s32 GetGlyphWidth_Braille(u16 font_type, bool32 isJapanese) diff --git a/src/field_specials.c b/src/field_specials.c index 3bf282cda..5af58cab2 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -2487,7 +2487,7 @@ void BrailleCursorToggle(void) { x = gSpecialVar_0x8004 + 27; if (gSpecialVar_0x8006 == 0) - sBrailleTextCursorSpriteID = CreateTextCursorSpriteForOakSpeech(0, x, gSpecialVar_0x8005, 0, 0); + sBrailleTextCursorSpriteID = CreateTextCursorSprite(0, x, gSpecialVar_0x8005, 0, 0); else DestroyTextCursorSprite(sBrailleTextCursorSpriteID); } diff --git a/src/oak_speech.c b/src/oak_speech.c index f16fd35a6..7f10528f6 100644 --- a/src/oak_speech.c +++ b/src/oak_speech.c @@ -569,7 +569,7 @@ static void Task_OaksSpeech1(u8 taskId) FillBgTilemapBufferRect_Palette0(1, 0xD00E, 0, 19, 30, 1); CreateHelpDocsPage1(); 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); break; case 10: @@ -748,7 +748,7 @@ static void Task_OakSpeech6(u8 taskId) gMain.state = 0; data[15] = 16; 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.priority = 0; CreatePikaOrGrassPlatformSpriteAndLinkToCurrentTask(taskId, 0); diff --git a/src/text.c b/src/text.c index d1f5429a4..76739f8c6 100644 --- a/src/text.c +++ b/src/text.c @@ -6,6 +6,10 @@ #include "dynamic_placeholder_text_util.h" #include "constants/songs.h" +#define TAG_CURSOR 0x8000 + +#define CURSOR_DELAY 8 + extern const struct OamData gOamData_AffineOff_ObjNormal_16x16; 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_Male(u16 glyphId, bool32 isJapanese); static s32 GetGlyphWidth_Female(u16 glyphId, bool32 isJapanese); +static void SpriteCB_TextCursor(struct Sprite *sprite); TextFlags gTextFlags; @@ -45,28 +50,28 @@ static const struct GlyphWidthFunc sGlyphWidthFuncs[] = { { FONT_BRAILLE, GetGlyphWidth_Braille } }; -static const struct SpriteSheet sUnknown_81EA68C[] = +static const struct SpriteSheet sSpriteSheets_TextCursor[] = { - {sDoubleArrowTiles1, sizeof(sDoubleArrowTiles1), 0x8000}, - {sDoubleArrowTiles2, sizeof(sDoubleArrowTiles2), 0x8000}, + {sDoubleArrowTiles1, sizeof(sDoubleArrowTiles1), TAG_CURSOR}, + {sDoubleArrowTiles2, sizeof(sDoubleArrowTiles2), TAG_CURSOR}, {NULL} }; -static const struct SpritePalette sUnknown_81EA6A4[] = +static const struct SpritePalette sSpritePalettes_TextCursor[] = { - {gStandardMenuPalette, 0x8000}, + {gStandardMenuPalette, TAG_CURSOR}, {NULL} }; -static const struct SpriteTemplate sUnknown_81EA6B4 = +static const struct SpriteTemplate sSpriteTemplate_TextCursor = { - .tileTag = 0x8000, - .paletteTag = 0x8000, + .tileTag = TAG_CURSOR, + .paletteTag = TAG_CURSOR, .oam = &gOamData_AffineOff_ObjNormal_16x16, .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80062B0, + .callback = SpriteCB_TextCursor, }; struct @@ -509,7 +514,7 @@ void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter) 12); CopyWindowToVram(textPrinter->printerTemplate.windowId, 0x2); - subStruct->downArrowDelay = 0x8; + subStruct->downArrowDelay = CURSOR_DELAY; 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, 12); CopyWindowToVram(windowId, 0x2); - *counter = 8; + *counter = CURSOR_DELAY; ++*yCoordIndex; } } @@ -1277,7 +1282,7 @@ u8 RenderTextHandleBold(u8 *pixels, u8 fontId, u8 *str, int a3, int a4, int a5, #define sDelay data[0] #define sState data[1] -void sub_80062B0(struct Sprite *sprite) +static void SpriteCB_TextCursor(struct Sprite *sprite) { if (sprite->sDelay) { @@ -1285,7 +1290,7 @@ void sub_80062B0(struct Sprite *sprite) } else { - sprite->sDelay = 8; + sprite->sDelay = CURSOR_DELAY; switch(sprite->sState) { case 0: @@ -1306,28 +1311,28 @@ void sub_80062B0(struct Sprite *sprite) } } -#undef sDelay -#undef sState - -u8 CreateTextCursorSpriteForOakSpeech(u8 sheetId, u16 x, u16 y, u8 priority, u8 subpriority) +u8 CreateTextCursorSprite(u8 sheetId, u16 x, u16 y, u8 priority, u8 subpriority) { u8 spriteId; - LoadSpriteSheet(&sUnknown_81EA68C[sheetId & 1]); - LoadSpritePalette(sUnknown_81EA6A4); - spriteId = CreateSprite(&sUnknown_81EA6B4, x + 3, y + 4, subpriority); + LoadSpriteSheet(&sSpriteSheets_TextCursor[sheetId & 1]); + LoadSpritePalette(&sSpritePalettes_TextCursor[0]); + spriteId = CreateSprite(&sSpriteTemplate_TextCursor, x + 3, y + 4, subpriority); gSprites[spriteId].oam.priority = (priority & 3); gSprites[spriteId].oam.matrixNum = 0; - gSprites[spriteId].data[0] = 8; + gSprites[spriteId].sDelay = CURSOR_DELAY; return spriteId; } void DestroyTextCursorSprite(u8 spriteId) { DestroySprite(&gSprites[spriteId]); - FreeSpriteTilesByTag(0x8000); - FreeSpritePaletteByTag(0x8000); + FreeSpriteTilesByTag(TAG_CURSOR); + FreeSpritePaletteByTag(TAG_CURSOR); } +#undef sDelay +#undef sState + u8 DrawKeypadIcon(u8 windowId, u8 keypadIconId, u16 x, u16 y) { BlitBitmapRectToWindow( @@ -1429,9 +1434,9 @@ void DecompressGlyph_Normal(u16 glyphId, bool32 isJapanese) int i; u8 lastColor; - if(isJapanese == TRUE) + if (isJapanese == TRUE) { - if(glyphId == 0) + if (glyphId == 0) { lastColor = GetLastTextColor(2); @@ -1456,7 +1461,7 @@ void DecompressGlyph_Normal(u16 glyphId, bool32 isJapanese) } else { - if(glyphId == 0) + if (glyphId == 0) { lastColor = GetLastTextColor(2); @@ -1485,7 +1490,7 @@ static s32 GetGlyphWidth_Normal(u16 glyphId, bool32 isJapanese) { if (isJapanese == TRUE) { - if(glyphId == 0) + if (glyphId == 0) return 10; return sFontNormalJapaneseGlyphWidths[glyphId]; @@ -1502,9 +1507,9 @@ static void DecompressGlyph_NormalCopy2(u16 glyphId, bool32 isJapanese) int i; u8 lastColor; - if(isJapanese == TRUE) + if (isJapanese == TRUE) { - if(glyphId == 0) + if (glyphId == 0) { lastColor = GetLastTextColor(2); @@ -1533,7 +1538,7 @@ static void DecompressGlyph_NormalCopy2(u16 glyphId, bool32 isJapanese) static s32 GetGlyphWidth_NormalCopy2(u16 glyphId, bool32 isJapanese) { - if(isJapanese == TRUE) + if (isJapanese == TRUE) return 10; else return sFontNormalLatinGlyphWidths[glyphId]; @@ -1545,9 +1550,9 @@ static void DecompressGlyph_Male(u16 glyphId, bool32 isJapanese) int i; u8 lastColor; - if(isJapanese == TRUE) + if (isJapanese == TRUE) { - if(glyphId == 0) + if (glyphId == 0) { lastColor = GetLastTextColor(2); @@ -1572,7 +1577,7 @@ static void DecompressGlyph_Male(u16 glyphId, bool32 isJapanese) } else { - if(glyphId == 0) + if (glyphId == 0) { lastColor = GetLastTextColor(2); @@ -1599,9 +1604,9 @@ static void DecompressGlyph_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 sFontMaleJapaneseGlyphWidths[glyphId]; @@ -1616,9 +1621,9 @@ void DecompressGlyph_Female(u16 glyphId, bool32 isJapanese) int i; u8 lastColor; - if(isJapanese == TRUE) + if (isJapanese == TRUE) { - if(glyphId == 0) + if (glyphId == 0) { lastColor = GetLastTextColor(2); @@ -1643,7 +1648,7 @@ void DecompressGlyph_Female(u16 glyphId, bool32 isJapanese) } else { - if(glyphId == 0) + if (glyphId == 0) { lastColor = GetLastTextColor(2); @@ -1670,9 +1675,9 @@ void DecompressGlyph_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 sFontFemaleJapaneseGlyphWidths[glyphId];