diff options
Diffstat (limited to 'src/text.c')
-rw-r--r-- | src/text.c | 1184 |
1 files changed, 351 insertions, 833 deletions
diff --git a/src/text.c b/src/text.c index d36a448ad..5b88e9f75 100644 --- a/src/text.c +++ b/src/text.c @@ -6,19 +6,18 @@ #include "text.h" #include "sprite.h" #include "blit.h" +#include "sound.h" +#include "m4a.h" +#include "quest_log.h" +#include "window.h" +#include "graphics.h" +#include "dynamic_placeholder_text_util.h" extern u8 gGlyphInfo[0x90]; -extern u8 gUnknown_203ADFA; -extern u16 gTMCaseMainWindowPalette[]; extern const struct OamData gOamData_83AC9D0; -extern void FillWindowPixelRect(u8 windowId, u8 fillValue, u16 x, u16 y, u16 width, u16 height); -extern void BlitBitmapRectToWindow(u8 windowId, const u8 *pixels, u16 srcX, u16 srcY, u16 srcWidth, int srcHeight, u16 destX, u16 destY, u16 rectWidth, u16 rectHeight); -extern u8 GetKeypadIconWidth(u8 keypadIconId); -extern void CopyWindowToVram(u8 windowId, u8 mode); -extern s32 GetGlyphWidthFont6(u16 glyphId, bool32 isJapanese); -extern void PlaySE(u16 songNum); -extern u8* DynamicPlaceholderTextUtil_GetPlaceholderPtr(u8 a1); +static void DecompressGlyphFont3(u16 glyphId, bool32 isJapanese); +static void DecompressGlyphFont4(u16 glyphId, bool32 isJapanese); TextFlags gTextFlags; @@ -378,107 +377,107 @@ const u16 gFont9JapaneseGlyphs[] = INCBIN_U16("data/graphics/fonts/font9_jap.fwj u16 Font0Func(struct TextPrinter *textPrinter) { - struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; + struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub; - if (subStruct->field_1_top == 0) + if (subStruct->hasGlyphIdBeenSet == 0) { - textPrinter->sub_union.sub.font_type = 0; - subStruct->field_1_top = 1; + textPrinter->subUnion.sub.glyphId = 0; + subStruct->hasGlyphIdBeenSet = 1; } return RenderText(textPrinter); } u16 Font1Func(struct TextPrinter *textPrinter) { - struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; + struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub; - if (subStruct->field_1_top == 0) + if (subStruct->hasGlyphIdBeenSet == 0) { - textPrinter->sub_union.sub.font_type = 1; - subStruct->field_1_top = 1; + textPrinter->subUnion.sub.glyphId = 1; + subStruct->hasGlyphIdBeenSet = 1; } return RenderText(textPrinter); } u16 Font2Func(struct TextPrinter *textPrinter) { - struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; + struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub; - if (subStruct->field_1_top == 0) + if (subStruct->hasGlyphIdBeenSet == 0) { - textPrinter->sub_union.sub.font_type = 2; - subStruct->field_1_top = 1; + textPrinter->subUnion.sub.glyphId = 2; + subStruct->hasGlyphIdBeenSet = 1; } return RenderText(textPrinter); } u16 Font3Func(struct TextPrinter *textPrinter) { - struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; + struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub; - if (subStruct->field_1_top == 0) + if (subStruct->hasGlyphIdBeenSet == 0) { - textPrinter->sub_union.sub.font_type = 3; - subStruct->field_1_top = 1; + textPrinter->subUnion.sub.glyphId = 3; + subStruct->hasGlyphIdBeenSet = 1; } return RenderText(textPrinter); } u16 Font4Func(struct TextPrinter *textPrinter) { - struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; + struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub; - if (subStruct->field_1_top == 0) + if (subStruct->hasGlyphIdBeenSet == 0) { - textPrinter->sub_union.sub.font_type = 4; - subStruct->field_1_top = 1; + textPrinter->subUnion.sub.glyphId = 4; + subStruct->hasGlyphIdBeenSet = 1; } return RenderText(textPrinter); } u16 Font5Func(struct TextPrinter *textPrinter) { - struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; + struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub; - if (subStruct->field_1_top == 0) + if (subStruct->hasGlyphIdBeenSet == 0) { - textPrinter->sub_union.sub.font_type = 5; - subStruct->field_1_top = 1; + textPrinter->subUnion.sub.glyphId = 5; + subStruct->hasGlyphIdBeenSet = 1; } return RenderText(textPrinter); } void TextPrinterInitDownArrowCounters(struct TextPrinter *textPrinter) { - struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; + struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub; if (gTextFlags.autoScroll == 1) - subStruct->frames_visible_counter = 0; + subStruct->autoScrollDelay = 0; else { - subStruct->field_1_upmid = 0; - subStruct->field_1 = 0; + subStruct->downArrowYPosIdx = 0; + subStruct->downArrowDelay = 0; } } void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter) { - struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; + struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub; const u8 *arrowTiles; if (gTextFlags.autoScroll == 0) { - if (subStruct->field_1 != 0) + if (subStruct->downArrowDelay != 0) { - subStruct->field_1 = ((*(u32*)&textPrinter->sub_union.sub) << 19 >> 27) - 1; // convoluted way of getting field_1, necessary to match + subStruct->downArrowDelay = ((*(u32*)&textPrinter->subUnion.sub) << 19 >> 27) - 1; // convoluted way of getting field_1, necessary to match } else { FillWindowPixelRect( - textPrinter->subPrinter.windowId, - textPrinter->subPrinter.bgColor << 4 | textPrinter->subPrinter.bgColor, - textPrinter->subPrinter.currentX, - textPrinter->subPrinter.currentY, + textPrinter->printerTemplate.windowId, + textPrinter->printerTemplate.bgColor << 4 | textPrinter->printerTemplate.bgColor, + textPrinter->printerTemplate.currentX, + textPrinter->printerTemplate.currentY, 10, 12); @@ -494,20 +493,20 @@ void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter) } BlitBitmapRectToWindow( - textPrinter->subPrinter.windowId, + textPrinter->printerTemplate.windowId, arrowTiles, - gDownArrowYCoords[*(u32*)subStruct << 17 >> 30], // subStruct->field_1_upmid but again, stupidly retrieved + gDownArrowYCoords[*(u32*)subStruct << 17 >> 30], // subStruct->downArrowYPosIdx but again, stupidly retrieved 0, 0x80, 0x10, - textPrinter->subPrinter.currentX, - textPrinter->subPrinter.currentY, + textPrinter->printerTemplate.currentX, + textPrinter->printerTemplate.currentY, 10, 12); - CopyWindowToVram(textPrinter->subPrinter.windowId, 0x2); + CopyWindowToVram(textPrinter->printerTemplate.windowId, 0x2); - subStruct->field_1 = 0x8; - subStruct->field_1_upmid = (*(u32*)subStruct << 17 >> 30) + 1; + subStruct->downArrowDelay = 0x8; + subStruct->downArrowYPosIdx = (*(u32*)subStruct << 17 >> 30) + 1; } } } @@ -515,27 +514,27 @@ void TextPrinterDrawDownArrow(struct TextPrinter *textPrinter) void TextPrinterClearDownArrow(struct TextPrinter *textPrinter) { FillWindowPixelRect( - textPrinter->subPrinter.windowId, - textPrinter->subPrinter.bgColor << 4 | textPrinter->subPrinter.bgColor, - textPrinter->subPrinter.currentX, - textPrinter->subPrinter.currentY, + textPrinter->printerTemplate.windowId, + textPrinter->printerTemplate.bgColor << 4 | textPrinter->printerTemplate.bgColor, + textPrinter->printerTemplate.currentX, + textPrinter->printerTemplate.currentY, 10, 12); - CopyWindowToVram(textPrinter->subPrinter.windowId, 0x2); + CopyWindowToVram(textPrinter->printerTemplate.windowId, 0x2); } bool8 TextPrinterWaitAutoMode(struct TextPrinter *textPrinter) { - struct TextPrinterSubStruct *subStruct = &textPrinter->sub_union.sub; + struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub; u8 delay = (gUnknown_203ADFA == 2) ? 50 : 120; - if (subStruct->frames_visible_counter == delay) + if (subStruct->autoScrollDelay == delay) { return TRUE; } else { - subStruct->frames_visible_counter++; + subStruct->autoScrollDelay++; return FALSE; } } @@ -550,7 +549,7 @@ bool16 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter) else { TextPrinterDrawDownArrow(textPrinter); - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) { result = TRUE; PlaySE(5); @@ -568,7 +567,7 @@ bool16 TextPrinterWait(struct TextPrinter *textPrinter) } else { - if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + if (JOY_NEW(A_BUTTON | B_BUTTON)) { result = TRUE; PlaySE(5); @@ -619,772 +618,291 @@ void DrawDownArrow(u8 windowId, u16 x, u16 y, u8 bgColor, bool8 drawArrow, u8 *c } } -__attribute__((naked)) u16 RenderText(struct TextPrinter *textPrinter) { - asm(".syntax unified\n\ - push {r4-r6,lr}\n\ - adds r6, r0, 0\n\ - adds r4, r6, 0\n\ - adds r4, 0x14\n\ - ldrb r0, [r6, 0x1C]\n\ - cmp r0, 0x6\n\ - bls _080057A0\n\ - b _08005D68\n\ -_080057A0:\n\ - lsls r0, 2\n\ - ldr r1, _080057AC @ =_080057B0\n\ - adds r0, r1\n\ - ldr r0, [r0]\n\ - mov pc, r0\n\ - .align 2, 0\n\ -_080057AC: .4byte _080057B0\n\ - .align 2, 0\n\ -_080057B0:\n\ - .4byte _080057CC\n\ - .4byte _08005C58\n\ - .4byte _08005C6C\n\ - .4byte _08005C98\n\ - .4byte _08005CD0\n\ - .4byte _08005D44\n\ - .4byte _08005D56\n\ -_080057CC:\n\ - ldr r2, _08005820 @ =gMain\n\ - ldrh r1, [r2, 0x2C]\n\ - movs r0, 0x3\n\ - ands r0, r1\n\ - cmp r0, 0\n\ - beq _080057E6\n\ - ldrb r1, [r4]\n\ - movs r0, 0x10\n\ - ands r0, r1\n\ - cmp r0, 0\n\ - beq _080057E6\n\ - movs r0, 0\n\ - strb r0, [r6, 0x1E]\n\ -_080057E6:\n\ - ldrb r1, [r6, 0x1E]\n\ - cmp r1, 0\n\ - beq _08005828\n\ - ldrb r0, [r6, 0x1D]\n\ - cmp r0, 0\n\ - beq _08005828\n\ - subs r0, r1, 0x1\n\ - strb r0, [r6, 0x1E]\n\ - ldr r0, _08005824 @ =gTextFlags\n\ - ldrb r1, [r0]\n\ - movs r0, 0x1\n\ - ands r0, r1\n\ - cmp r0, 0\n\ - bne _08005804\n\ - b _08005B30\n\ -_08005804:\n\ - ldrh r1, [r2, 0x2E]\n\ - movs r0, 0x3\n\ - ands r0, r1\n\ - cmp r0, 0\n\ - bne _08005810\n\ - b _08005B30\n\ -_08005810:\n\ - ldrb r0, [r4]\n\ - movs r1, 0x10\n\ - orrs r0, r1\n\ - strb r0, [r4]\n\ - movs r0, 0\n\ - strb r0, [r6, 0x1E]\n\ - b _08005B30\n\ - .align 2, 0\n\ -_08005820: .4byte gMain\n\ -_08005824: .4byte gTextFlags\n\ -_08005828:\n\ - ldr r2, _08005838 @ =gTextFlags\n\ - ldrb r1, [r2]\n\ - movs r0, 0x4\n\ - ands r0, r1\n\ - cmp r0, 0\n\ - beq _0800583C\n\ - movs r0, 0x1\n\ - b _0800583E\n\ - .align 2, 0\n\ -_08005838: .4byte gTextFlags\n\ -_0800583C:\n\ - ldrb r0, [r6, 0x1D]\n\ -_0800583E:\n\ - strb r0, [r6, 0x1E]\n\ - ldr r0, [r6]\n\ - ldrb r3, [r0]\n\ - adds r0, 0x1\n\ - str r0, [r6]\n\ - adds r0, r3, 0\n\ - subs r0, 0xF8\n\ - cmp r0, 0x7\n\ - bls _08005852\n\ - b _08005B6C\n\ -_08005852:\n\ - lsls r0, 2\n\ - ldr r1, _0800585C @ =_08005860\n\ - adds r0, r1\n\ - ldr r0, [r0]\n\ - mov pc, r0\n\ - .align 2, 0\n\ -_0800585C: .4byte _08005860\n\ - .align 2, 0\n\ -_08005860:\n\ - .4byte _08005B46\n\ - .4byte _08005B34\n\ - .4byte _08005B26\n\ - .4byte _08005B22\n\ - .4byte _080058AC\n\ - .4byte _080058A8\n\ - .4byte _08005880\n\ - .4byte _08005D68\n\ -_08005880:\n\ - ldrb r0, [r6, 0x6]\n\ - strb r0, [r6, 0x8]\n\ - ldrb r1, [r6, 0x5]\n\ - ldr r0, _080058A4 @ =gFonts\n\ - ldr r2, [r0]\n\ - lsls r0, r1, 1\n\ - adds r0, r1\n\ - lsls r0, 2\n\ - adds r0, r2\n\ - ldrb r1, [r6, 0xB]\n\ - ldrb r0, [r0, 0x5]\n\ - adds r1, r0\n\ - ldrb r0, [r6, 0x9]\n\ - adds r0, r1\n\ - strb r0, [r6, 0x9]\n\ -_0800589E:\n\ - movs r0, 0x2\n\ - b _08005D6A\n\ - .align 2, 0\n\ -_080058A4: .4byte gFonts\n\ -_080058A8:\n\ - ldr r0, [r6]\n\ - b _08005B0A\n\ -_080058AC:\n\ - ldr r0, [r6]\n\ - ldrb r3, [r0]\n\ - adds r0, 0x1\n\ - str r0, [r6]\n\ - subs r0, r3, 0x1\n\ - cmp r0, 0x17\n\ - bls _080058BC\n\ - b _08005B6C\n\ -_080058BC:\n\ - lsls r0, 2\n\ - ldr r1, _080058C8 @ =_080058CC\n\ - adds r0, r1\n\ - ldr r0, [r0]\n\ - mov pc, r0\n\ - .align 2, 0\n\ -_080058C8: .4byte _080058CC\n\ - .align 2, 0\n\ -_080058CC:\n\ - .4byte _0800592C\n\ - .4byte _0800594E\n\ - .4byte _08005972\n\ - .4byte _0800598C\n\ - .4byte _080059D8\n\ - .4byte _080059DC\n\ - .4byte _0800589E\n\ - .4byte _080059F4\n\ - .4byte _08005A04\n\ - .4byte _08005A1A\n\ - .4byte _08005A1E\n\ - .4byte _08005A66\n\ - .4byte _08005A70\n\ - .4byte _08005A78\n\ - .4byte _08005A84\n\ - .4byte _08005A4C\n\ - .4byte _08005AB0\n\ - .4byte _08005ACC\n\ - .4byte _08005ADC\n\ - .4byte _08005B00\n\ - .4byte _08005B10\n\ - .4byte _08005B18\n\ - .4byte _08005A96\n\ - .4byte _08005AA4\n\ -_0800592C:\n\ - ldr r2, [r6]\n\ - ldrb r1, [r2]\n\ - lsls r1, 4\n\ - ldrb r3, [r6, 0xC]\n\ - movs r0, 0xF\n\ - ands r0, r3\n\ - orrs r0, r1\n\ - strb r0, [r6, 0xC]\n\ - adds r2, 0x1\n\ - str r2, [r6]\n\ - lsls r0, 24\n\ - lsrs r0, 28\n\ - ldrb r2, [r6, 0xD]\n\ - lsls r1, r2, 28\n\ - lsrs r1, 28\n\ - lsrs r2, 4\n\ - b _080059D2\n\ -_0800594E:\n\ - ldr r1, [r6]\n\ - ldrb r2, [r1]\n\ - movs r0, 0xF\n\ - ands r0, r2\n\ - ldrb r3, [r6, 0xD]\n\ - movs r2, 0x10\n\ - negs r2, r2\n\ - ands r2, r3\n\ - orrs r2, r0\n\ - strb r2, [r6, 0xD]\n\ - adds r1, 0x1\n\ - str r1, [r6]\n\ - ldrb r0, [r6, 0xC]\n\ - lsrs r0, 4\n\ - lsls r1, r2, 28\n\ - lsrs r1, 28\n\ - lsrs r2, 4\n\ - b _080059D2\n\ -_08005972:\n\ - ldr r1, [r6]\n\ - ldrb r0, [r1]\n\ - lsls r0, 4\n\ - ldrb r3, [r6, 0xD]\n\ - movs r2, 0xF\n\ - ands r2, r3\n\ - orrs r2, r0\n\ - strb r2, [r6, 0xD]\n\ - adds r1, 0x1\n\ - str r1, [r6]\n\ - ldrb r0, [r6, 0xC]\n\ - lsrs r0, 4\n\ - b _080059CA\n\ -_0800598C:\n\ - ldr r3, [r6]\n\ - ldrb r1, [r3]\n\ - lsls r1, 4\n\ - ldrb r4, [r6, 0xC]\n\ - movs r2, 0xF\n\ - adds r0, r2, 0\n\ - ands r0, r4\n\ - orrs r0, r1\n\ - strb r0, [r6, 0xC]\n\ - adds r5, r3, 0x1\n\ - str r5, [r6]\n\ - ldrb r3, [r3, 0x1]\n\ - adds r1, r2, 0\n\ - ands r1, r3\n\ - ldrb r4, [r6, 0xD]\n\ - movs r3, 0x10\n\ - negs r3, r3\n\ - ands r3, r4\n\ - orrs r3, r1\n\ - strb r3, [r6, 0xD]\n\ - adds r4, r5, 0x1\n\ - str r4, [r6]\n\ - ldrb r1, [r5, 0x1]\n\ - lsls r1, 4\n\ - ands r2, r3\n\ - orrs r2, r1\n\ - strb r2, [r6, 0xD]\n\ - adds r4, 0x1\n\ - str r4, [r6]\n\ - lsls r0, 24\n\ - lsrs r0, 28\n\ -_080059CA:\n\ - lsls r1, r2, 28\n\ - lsrs r1, 28\n\ - lsls r2, 24\n\ - lsrs r2, 28\n\ -_080059D2:\n\ - bl GenerateFontHalfRowLookupTable\n\ - b _0800589E\n\ -_080059D8:\n\ - ldr r0, [r6]\n\ - b _08005B0A\n\ -_080059DC:\n\ - ldr r0, [r6]\n\ - ldrb r0, [r0]\n\ - movs r1, 0xF\n\ - ands r1, r0\n\ - ldrb r2, [r4]\n\ - movs r0, 0x10\n\ - negs r0, r0\n\ - ands r0, r2\n\ - orrs r0, r1\n\ - strb r0, [r4]\n\ - ldr r0, [r6]\n\ - b _08005B0A\n\ -_080059F4:\n\ - ldr r0, [r6]\n\ - ldrb r1, [r0]\n\ - strb r1, [r6, 0x1E]\n\ - adds r0, 0x1\n\ - str r0, [r6]\n\ - movs r0, 0x6\n\ - strb r0, [r6, 0x1C]\n\ - b _0800589E\n\ -_08005A04:\n\ - movs r0, 0x1\n\ - strb r0, [r6, 0x1C]\n\ - ldrb r1, [r2]\n\ - movs r0, 0x4\n\ - ands r0, r1\n\ - cmp r0, 0\n\ - bne _08005A14\n\ - b _08005B30\n\ -_08005A14:\n\ - movs r0, 0\n\ - strb r0, [r4, 0x2]\n\ - b _08005B30\n\ -_08005A1A:\n\ - movs r0, 0x5\n\ - b _08005D52\n\ -_08005A1E:\n\ - ldr r0, [r6]\n\ - ldrb r3, [r0]\n\ - adds r1, r0, 0x1\n\ - str r1, [r6]\n\ - ldrb r0, [r0, 0x1]\n\ - lsls r0, 8\n\ - orrs r3, r0\n\ - adds r1, 0x1\n\ - str r1, [r6]\n\ - ldr r0, _08005A48 @ =gUnknown_203ADFA\n\ - ldrb r0, [r0]\n\ - subs r0, 0x2\n\ - lsls r0, 24\n\ - lsrs r0, 24\n\ - cmp r0, 0x1\n\ - bhi _08005A40\n\ - b _0800589E\n\ -_08005A40:\n\ - adds r0, r3, 0\n\ - bl PlayBGM\n\ - b _0800589E\n\ - .align 2, 0\n\ -_08005A48: .4byte gUnknown_203ADFA\n\ -_08005A4C:\n\ - ldr r0, [r6]\n\ - ldrb r3, [r0]\n\ - adds r1, r0, 0x1\n\ - str r1, [r6]\n\ - ldrb r0, [r0, 0x1]\n\ - lsls r0, 8\n\ - orrs r3, r0\n\ - adds r1, 0x1\n\ - str r1, [r6]\n\ - adds r0, r3, 0\n\ - bl PlaySE\n\ - b _0800589E\n\ -_08005A66:\n\ - ldr r1, [r6]\n\ - adds r0, r1, 0x1\n\ - str r0, [r6]\n\ - ldrb r3, [r1, 0x1]\n\ - b _08005B6C\n\ -_08005A70:\n\ - ldr r1, [r6]\n\ - ldrb r0, [r1]\n\ - ldrb r2, [r6, 0x6]\n\ - b _08005AD2\n\ -_08005A78:\n\ - ldr r1, [r6]\n\ - ldrb r0, [r1]\n\ - ldrb r3, [r6, 0x7]\n\ - adds r0, r3\n\ - strb r0, [r6, 0x9]\n\ - b _08005AD6\n\ -_08005A84:\n\ - ldrb r0, [r6, 0x4]\n\ - ldrb r2, [r6, 0xD]\n\ - lsls r2, 28\n\ - lsrs r1, r2, 4\n\ - orrs r1, r2\n\ - lsrs r1, 24\n\ - bl FillWindowPixelBuffer\n\ - b _0800589E\n\ -_08005A96:\n\ - ldr r0, _08005AA0 @ =gMPlayInfo_BGM\n\ - bl m4aMPlayStop\n\ - b _0800589E\n\ - .align 2, 0\n\ -_08005AA0: .4byte gMPlayInfo_BGM\n\ -_08005AA4:\n\ - ldr r0, _08005AAC @ =gMPlayInfo_BGM\n\ - bl m4aMPlayContinue\n\ - b _0800589E\n\ - .align 2, 0\n\ -_08005AAC: .4byte gMPlayInfo_BGM\n\ -_08005AB0:\n\ - ldr r0, [r6]\n\ - ldrb r4, [r0]\n\ - adds r0, 0x1\n\ - str r0, [r6]\n\ - cmp r4, 0\n\ - bgt _08005ABE\n\ - b _0800589E\n\ -_08005ABE:\n\ - adds r0, r6, 0\n\ - adds r1, r4, 0\n\ - bl ClearTextSpan\n\ - ldrb r0, [r6, 0x8]\n\ - adds r0, r4\n\ - b _08005C4E\n\ -_08005ACC:\n\ - ldr r1, [r6]\n\ - ldrb r0, [r6, 0x6]\n\ - ldrb r2, [r1]\n\ -_08005AD2:\n\ - adds r0, r2\n\ - strb r0, [r6, 0x8]\n\ -_08005AD6:\n\ - adds r1, 0x1\n\ - str r1, [r6]\n\ - b _0800589E\n\ -_08005ADC:\n\ - ldr r0, [r6]\n\ - ldrb r2, [r0]\n\ - ldrb r1, [r6, 0x6]\n\ - adds r2, r1\n\ - adds r0, 0x1\n\ - str r0, [r6]\n\ - ldrb r0, [r6, 0x8]\n\ - subs r4, r2, r0\n\ - cmp r4, 0\n\ - bgt _08005AF2\n\ - b _0800589E\n\ -_08005AF2:\n\ - adds r0, r6, 0\n\ - adds r1, r4, 0\n\ - bl ClearTextSpan\n\ - ldrb r0, [r6, 0x8]\n\ - adds r0, r4\n\ - b _08005C4E\n\ -_08005B00:\n\ - ldr r0, [r6]\n\ - ldrb r2, [r0]\n\ - adds r1, r6, 0\n\ - adds r1, 0x20\n\ - strb r2, [r1]\n\ -_08005B0A:\n\ - adds r0, 0x1\n\ - str r0, [r6]\n\ - b _0800589E\n\ -_08005B10:\n\ - adds r1, r6, 0\n\ - adds r1, 0x21\n\ - movs r0, 0x1\n\ - b _08005B1E\n\ -_08005B18:\n\ - adds r1, r6, 0\n\ - adds r1, 0x21\n\ - movs r0, 0\n\ -_08005B1E:\n\ - strb r0, [r1]\n\ - b _0800589E\n\ -_08005B22:\n\ - movs r0, 0x2\n\ - b _08005B28\n\ -_08005B26:\n\ - movs r0, 0x3\n\ -_08005B28:\n\ - strb r0, [r6, 0x1C]\n\ - adds r0, r6, 0\n\ - bl TextPrinterInitDownArrowCounters\n\ -_08005B30:\n\ - movs r0, 0x3\n\ - b _08005D6A\n\ -_08005B34:\n\ - ldr r0, [r6]\n\ - ldrb r3, [r0]\n\ - movs r2, 0x80\n\ - lsls r2, 1\n\ - adds r1, r2, 0\n\ - orrs r3, r1\n\ - adds r0, 0x1\n\ - str r0, [r6]\n\ - b _08005B6C\n\ -_08005B46:\n\ - ldr r0, [r6]\n\ - ldrb r3, [r0]\n\ - adds r0, 0x1\n\ - str r0, [r6]\n\ - ldrb r0, [r6, 0x4]\n\ - adds r1, r3, 0\n\ - ldrb r2, [r6, 0x8]\n\ - ldrb r3, [r6, 0x9]\n\ - bl DrawKeypadIcon\n\ - ldr r1, _08005B68 @ =gGlyphInfo\n\ - adds r1, 0x80\n\ - strb r0, [r1]\n\ - ldrb r3, [r6, 0xA]\n\ - adds r0, r3\n\ - b _08005C4A\n\ - .align 2, 0\n\ -_08005B68: .4byte gGlyphInfo\n\ -_08005B6C:\n\ - ldr r0, [r4]\n\ - lsls r0, 28\n\ - lsrs r0, 28\n\ - cmp r0, 0x5\n\ - bhi _08005BEE\n\ - lsls r0, 2\n\ - ldr r1, _08005B80 @ =_08005B84\n\ - adds r0, r1\n\ - ldr r0, [r0]\n\ - mov pc, r0\n\ - .align 2, 0\n\ -_08005B80: .4byte _08005B84\n\ - .align 2, 0\n\ -_08005B84:\n\ - .4byte _08005B9C\n\ - .4byte _08005BAA\n\ - .4byte _08005BB8\n\ - .4byte _08005BC6\n\ - .4byte _08005BD4\n\ - .4byte _08005BE2\n\ -_08005B9C:\n\ - adds r0, r6, 0\n\ - adds r0, 0x21\n\ - ldrb r1, [r0]\n\ - adds r0, r3, 0\n\ - bl DecompressGlyphFont0\n\ - b _08005BEE\n\ -_08005BAA:\n\ - adds r0, r6, 0\n\ - adds r0, 0x21\n\ - ldrb r1, [r0]\n\ - adds r0, r3, 0\n\ - bl DecompressGlyphFont1\n\ - b _08005BEE\n\ -_08005BB8:\n\ - adds r0, r6, 0\n\ - adds r0, 0x21\n\ - ldrb r1, [r0]\n\ - adds r0, r3, 0\n\ - bl DecompressGlyphFont2\n\ - b _08005BEE\n\ -_08005BC6:\n\ - adds r0, r6, 0\n\ - adds r0, 0x21\n\ - ldrb r1, [r0]\n\ - adds r0, r3, 0\n\ - bl DecompressGlyphFont3\n\ - b _08005BEE\n\ -_08005BD4:\n\ - adds r0, r6, 0\n\ - adds r0, 0x21\n\ - ldrb r1, [r0]\n\ - adds r0, r3, 0\n\ - bl DecompressGlyphFont4\n\ - b _08005BEE\n\ -_08005BE2:\n\ - adds r0, r6, 0\n\ - adds r0, 0x21\n\ - ldrb r1, [r0]\n\ - adds r0, r3, 0\n\ - bl DecompressGlyphFont5\n\ -_08005BEE:\n\ - adds r0, r6, 0\n\ - bl CopyGlyphToWindow\n\ - adds r2, r6, 0\n\ - adds r2, 0x20\n\ - ldrb r0, [r2]\n\ - cmp r0, 0\n\ - beq _08005C28\n\ - ldr r1, _08005C24 @ =gGlyphInfo\n\ - adds r1, 0x80\n\ - ldrb r0, [r1]\n\ - ldrb r3, [r6, 0x8]\n\ - adds r0, r3\n\ - strb r0, [r6, 0x8]\n\ - ldrb r2, [r2]\n\ - ldrb r0, [r1]\n\ - subs r4, r2, r0\n\ - cmp r4, 0\n\ - ble _08005C50\n\ - adds r0, r6, 0\n\ - adds r1, r4, 0\n\ - bl ClearTextSpan\n\ - ldrb r0, [r6, 0x8]\n\ - adds r0, r4\n\ - b _08005C4E\n\ - .align 2, 0\n\ -_08005C24: .4byte gGlyphInfo\n\ -_08005C28:\n\ - adds r0, r6, 0\n\ - adds r0, 0x21\n\ - ldrb r0, [r0]\n\ - cmp r0, 0\n\ - beq _08005C44\n\ - ldr r0, _08005C40 @ =gGlyphInfo\n\ - adds r0, 0x80\n\ - ldrb r1, [r6, 0xA]\n\ - ldrb r0, [r0]\n\ - adds r1, r0\n\ - ldrb r0, [r6, 0x8]\n\ - b _08005C4C\n\ - .align 2, 0\n\ -_08005C40: .4byte gGlyphInfo\n\ -_08005C44:\n\ - ldr r0, _08005C54 @ =gGlyphInfo\n\ - adds r0, 0x80\n\ - ldrb r0, [r0]\n\ -_08005C4A:\n\ - ldrb r1, [r6, 0x8]\n\ -_08005C4C:\n\ - adds r0, r1\n\ -_08005C4E:\n\ - strb r0, [r6, 0x8]\n\ -_08005C50:\n\ - movs r0, 0\n\ - b _08005D6A\n\ - .align 2, 0\n\ -_08005C54: .4byte gGlyphInfo\n\ -_08005C58:\n\ - adds r0, r6, 0\n\ - bl TextPrinterWait\n\ - lsls r0, 16\n\ - cmp r0, 0\n\ - bne _08005C66\n\ - b _08005B30\n\ -_08005C66:\n\ - movs r0, 0\n\ - strb r0, [r6, 0x1C]\n\ - b _08005B30\n\ -_08005C6C:\n\ - adds r0, r6, 0\n\ - bl TextPrinterWaitWithDownArrow\n\ - lsls r0, 16\n\ - cmp r0, 0\n\ - bne _08005C7A\n\ - b _08005B30\n\ -_08005C7A:\n\ - ldrb r0, [r6, 0x4]\n\ - ldrb r2, [r6, 0xD]\n\ - lsls r2, 28\n\ - lsrs r1, r2, 4\n\ - orrs r1, r2\n\ - lsrs r1, 24\n\ - bl FillWindowPixelBuffer\n\ - ldrb r0, [r6, 0x6]\n\ - movs r1, 0\n\ - strb r0, [r6, 0x8]\n\ - ldrb r0, [r6, 0x7]\n\ - strb r0, [r6, 0x9]\n\ - strb r1, [r6, 0x1C]\n\ - b _08005B30\n\ -_08005C98:\n\ - adds r0, r6, 0\n\ - bl TextPrinterWaitWithDownArrow\n\ - lsls r0, 16\n\ - cmp r0, 0\n\ - bne _08005CA6\n\ - b _08005B30\n\ -_08005CA6:\n\ - adds r0, r6, 0\n\ - bl TextPrinterClearDownArrow\n\ - ldrb r1, [r6, 0x5]\n\ - ldr r0, _08005CCC @ =gFonts\n\ - ldr r2, [r0]\n\ - lsls r0, r1, 1\n\ - adds r0, r1\n\ - lsls r0, 2\n\ - adds r0, r2\n\ - ldrb r1, [r6, 0xB]\n\ - ldrb r0, [r0, 0x5]\n\ - adds r1, r0\n\ - strb r1, [r6, 0x1F]\n\ - ldrb r0, [r6, 0x6]\n\ - strb r0, [r6, 0x8]\n\ - movs r0, 0x4\n\ - strb r0, [r6, 0x1C]\n\ - b _08005B30\n\ - .align 2, 0\n\ -_08005CCC: .4byte gFonts\n\ -_08005CD0:\n\ - ldrb r2, [r6, 0x1F]\n\ - cmp r2, 0\n\ - beq _08005D40\n\ - ldr r4, _08005D04 @ =gWindowVerticalScrollSpeeds\n\ - ldr r5, _08005D08 @ =gSaveBlock2Ptr\n\ - ldr r0, [r5]\n\ - ldrb r0, [r0, 0x14]\n\ - lsls r1, r0, 29\n\ - lsrs r0, r1, 29\n\ - adds r0, r4\n\ - ldrb r0, [r0]\n\ - cmp r2, r0\n\ - bcs _08005D0C\n\ - ldrb r0, [r6, 0x4]\n\ - ldrb r1, [r6, 0xD]\n\ - lsls r1, 28\n\ - lsrs r3, r1, 4\n\ - orrs r3, r1\n\ - lsrs r3, 24\n\ - movs r1, 0\n\ - bl ScrollWindow\n\ - movs r0, 0\n\ - strb r0, [r6, 0x1F]\n\ - b _08005D36\n\ - .align 2, 0\n\ -_08005D04: .4byte gWindowVerticalScrollSpeeds\n\ -_08005D08: .4byte gSaveBlock2Ptr\n\ -_08005D0C:\n\ - ldrb r0, [r6, 0x4]\n\ - lsrs r1, 29\n\ - adds r1, r4\n\ - ldrb r2, [r1]\n\ - ldrb r1, [r6, 0xD]\n\ - lsls r1, 28\n\ - lsrs r3, r1, 4\n\ - orrs r3, r1\n\ - lsrs r3, 24\n\ - movs r1, 0\n\ - bl ScrollWindow\n\ - ldr r0, [r5]\n\ - ldrb r0, [r0, 0x14]\n\ - lsls r0, 29\n\ - lsrs r0, 29\n\ - adds r0, r4\n\ - ldrb r1, [r6, 0x1F]\n\ - ldrb r0, [r0]\n\ - subs r1, r0\n\ - strb r1, [r6, 0x1F]\n\ -_08005D36:\n\ - ldrb r0, [r6, 0x4]\n\ - movs r1, 0x2\n\ - bl CopyWindowToVram\n\ - b _08005B30\n\ -_08005D40:\n\ - strb r2, [r6, 0x1C]\n\ - b _08005B30\n\ -_08005D44:\n\ - bl IsSEPlaying\n\ - lsls r0, 24\n\ - lsrs r0, 24\n\ - cmp r0, 0\n\ - beq _08005D52\n\ - b _08005B30\n\ -_08005D52:\n\ - strb r0, [r6, 0x1C]\n\ - b _08005B30\n\ -_08005D56:\n\ - ldrb r0, [r6, 0x1E]\n\ - adds r1, r0, 0\n\ - cmp r1, 0\n\ - beq _08005D64\n\ - subs r0, 0x1\n\ - strb r0, [r6, 0x1E]\n\ - b _08005B30\n\ -_08005D64:\n\ - strb r1, [r6, 0x1C]\n\ - b _08005B30\n\ -_08005D68:\n\ - movs r0, 0x1\n\ -_08005D6A:\n\ - pop {r4-r6}\n\ - pop {r1}\n\ - bx r1\n\ - .syntax divided"); + struct TextPrinterSubStruct *subStruct = &textPrinter->subUnion.sub; + u16 currChar; + s32 width; + s32 widthHelper; + + switch (textPrinter->state) + { + case 0: + 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; + } + return 3; + } + + if (gTextFlags.autoScroll) + textPrinter->delayCounter = 1; + else + textPrinter->delayCounter = textPrinter->textSpeed; + + currChar = *textPrinter->printerTemplate.currentChar; + textPrinter->printerTemplate.currentChar++; + + switch (currChar) + { + 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: + currChar = *textPrinter->printerTemplate.currentChar; + textPrinter->printerTemplate.currentChar++; + switch (currChar) + { + case 1: + textPrinter->printerTemplate.fgColor = *textPrinter->printerTemplate.currentChar; + textPrinter->printerTemplate.currentChar++; + GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor); + return 2; + case 2: + textPrinter->printerTemplate.bgColor = *textPrinter->printerTemplate.currentChar; + textPrinter->printerTemplate.currentChar++; + GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor); + return 2; + case 3: + textPrinter->printerTemplate.shadowColor = *textPrinter->printerTemplate.currentChar; + 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.currentChar++; + textPrinter->printerTemplate.bgColor = *textPrinter->printerTemplate.currentChar; + 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: + subStruct->glyphId = *textPrinter->printerTemplate.currentChar; + textPrinter->printerTemplate.currentChar++; + return 2; + case EXT_CTRL_CODE_UNKNOWN_7: + return 2; + case 8: + textPrinter->delayCounter = *textPrinter->printerTemplate.currentChar; + textPrinter->printerTemplate.currentChar++; + textPrinter->state = 6; + return 2; + case 9: + textPrinter->state = 1; + if (gTextFlags.autoScroll) + subStruct->autoScrollDelay = 0; + return 3; + case 10: + textPrinter->state = 5; + return 3; + case 11: + currChar = *textPrinter->printerTemplate.currentChar; + textPrinter->printerTemplate.currentChar++; + currChar |= *textPrinter->printerTemplate.currentChar << 8; + textPrinter->printerTemplate.currentChar++; + if ((u8)(gUnknown_203ADFA - 2u) > 1) + PlayBGM(currChar); + return 2; + case 16: + currChar = *textPrinter->printerTemplate.currentChar; + textPrinter->printerTemplate.currentChar++; + currChar |= (*textPrinter->printerTemplate.currentChar << 8); + textPrinter->printerTemplate.currentChar++; + PlaySE(currChar); + return 2; + case 12: + textPrinter->printerTemplate.currentChar++; + currChar = *textPrinter->printerTemplate.currentChar; + break; + case 13: + textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x + *textPrinter->printerTemplate.currentChar; + textPrinter->printerTemplate.currentChar++; + return 2; + case 14: + textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y + *textPrinter->printerTemplate.currentChar; + textPrinter->printerTemplate.currentChar++; + return 2; + case 15: + FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, PIXEL_FILL(textPrinter->printerTemplate.bgColor)); + return 2; + case 23: + m4aMPlayStop(&gMPlayInfo_BGM); + return 2; + case 24: + m4aMPlayContinue(&gMPlayInfo_BGM); + return 2; + case EXT_CTRL_CODE_CLEAR: + width = *textPrinter->printerTemplate.currentChar; + textPrinter->printerTemplate.currentChar++; + if (width > 0) + { + ClearTextSpan(textPrinter, width); + textPrinter->printerTemplate.currentX += width; + return 0; + } + return 2; + case 18: + textPrinter->printerTemplate.currentX = *textPrinter->printerTemplate.currentChar + textPrinter->printerTemplate.x; + textPrinter->printerTemplate.currentChar++; + return 2; + case EXT_CTRL_CODE_CLEAR_TO: + { + widthHelper = *textPrinter->printerTemplate.currentChar; + widthHelper += textPrinter->printerTemplate.x; + textPrinter->printerTemplate.currentChar++; + width = widthHelper - textPrinter->printerTemplate.currentX; + if (width > 0) + { + ClearTextSpan(textPrinter, width); + textPrinter->printerTemplate.currentX += width; + return 0; + } + } + return 2; + case EXT_CTRL_CODE_MIN_LETTER_SPACING: + textPrinter->minLetterSpacing = *textPrinter->printerTemplate.currentChar++; + return 2; + case EXT_CTRL_CODE_JPN: + textPrinter->japanese = 1; + return 2; + case EXT_CTRL_CODE_ENG: + textPrinter->japanese = 0; + 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_EMOJI: + currChar = *textPrinter->printerTemplate.currentChar | 0x100; + textPrinter->printerTemplate.currentChar++; + break; + case CHAR_KEYPAD_ICON: + currChar = *textPrinter->printerTemplate.currentChar++; + gGlyphInfo[0x80] = DrawKeypadIcon(textPrinter->printerTemplate.windowId, currChar, textPrinter->printerTemplate.currentX, textPrinter->printerTemplate.currentY); + textPrinter->printerTemplate.currentX += gGlyphInfo[0x80] + textPrinter->printerTemplate.letterSpacing; + return 0; + case EOS: + return 1; + } + + switch (subStruct->glyphId) + { + case 0: + DecompressGlyphFont0(currChar, textPrinter->japanese); + break; + case 1: + DecompressGlyphFont1(currChar, textPrinter->japanese); + break; + case 2: + DecompressGlyphFont2(currChar, textPrinter->japanese); + break; + case 3: + DecompressGlyphFont3(currChar, textPrinter->japanese); + break; + case 4: + DecompressGlyphFont4(currChar, textPrinter->japanese); + break; + case 5: + DecompressGlyphFont5(currChar, textPrinter->japanese); + } + + CopyGlyphToWindow(textPrinter); + + if (textPrinter->minLetterSpacing) + { + textPrinter->printerTemplate.currentX += gGlyphInfo[0x80]; + width = textPrinter->minLetterSpacing - gGlyphInfo[0x80]; + if (width > 0) + { + ClearTextSpan(textPrinter, width); + textPrinter->printerTemplate.currentX += width; + } + } + else + { + if (textPrinter->japanese) + textPrinter->printerTemplate.currentX += (gGlyphInfo[0x80] + textPrinter->printerTemplate.letterSpacing); + else + textPrinter->printerTemplate.currentX += gGlyphInfo[0x80]; + } + 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)); + textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x; + textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y; + textPrinter->state = 0; + } + return 3; + case 3: + if (TextPrinterWaitWithDownArrow(textPrinter)) + { + 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 < gWindowVerticalScrollSpeeds[gSaveBlock2Ptr->optionsTextSpeed]) + { + ScrollWindow(textPrinter->printerTemplate.windowId, 0, textPrinter->scrollDistance, PIXEL_FILL(textPrinter->printerTemplate.bgColor)); + textPrinter->scrollDistance = 0; + } + else + { + ScrollWindow(textPrinter->printerTemplate.windowId, 0, gWindowVerticalScrollSpeeds[gSaveBlock2Ptr->optionsTextSpeed], PIXEL_FILL(textPrinter->printerTemplate.bgColor)); + textPrinter->scrollDistance -= gWindowVerticalScrollSpeeds[gSaveBlock2Ptr->optionsTextSpeed]; + } + CopyWindowToVram(textPrinter->printerTemplate.windowId, 2); + } + else + { + textPrinter->state = 0; + } + return 3; + case 5: + if (!IsSEPlaying()) + textPrinter->state = 0; + return 3; + case 6: + if (textPrinter->delayCounter != 0) + textPrinter->delayCounter--; + else + textPrinter->state = 0; + return 3; + } + + return 1; } s32 GetStringWidthFixedWidthFont(const u8 *str, u8 fontId, u8 letterSpacing) @@ -1484,7 +1002,7 @@ s32 (*GetFontWidthFunc(u8 glyphId))(u16 _glyphId, bool32 _isJapanese) for (i = 0; i < 7; ++i) { - if (glyphId == gGlyphWidthFuncs[i].font_id) + if (glyphId == gGlyphWidthFuncs[i].fontId) return *gGlyphWidthFuncs[i].func; } @@ -1498,7 +1016,7 @@ s32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing) s32 (*func)(u16 glyphId, bool32 isJapanese); int localLetterSpacing; register u32 lineWidth asm("r5"); - u8 *bufferPointer; + const u8 *bufferPointer; int glyphWidth; u32 width; @@ -1516,7 +1034,7 @@ s32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing) width = 0; lineWidth = 0; - bufferPointer = 0; + bufferPointer = NULL; while (*str != 0xFF) { @@ -1559,7 +1077,7 @@ s32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing) } lineWidth += glyphWidth; } - bufferPointer = 0; + bufferPointer = NULL; break; case 0xFC: switch (*++str) @@ -1813,7 +1331,7 @@ u8 DrawKeypadIcon(u8 windowId, u8 keypadIconId, u16 x, u16 y) { BlitBitmapRectToWindow( windowId, - gKeypadIconTiles + (gKeypadIcons[keypadIconId].tile_offset * 0x20), + gKeypadIconTiles + (gKeypadIcons[keypadIconId].tileOffset * 0x20), 0, 0, 0x80, @@ -1827,7 +1345,7 @@ u8 DrawKeypadIcon(u8 windowId, u8 keypadIconId, u16 x, u16 y) u8 GetKeypadIconTileOffset(u8 keypadIconId) { - return gKeypadIcons[keypadIconId].tile_offset; + return gKeypadIcons[keypadIconId].tileOffset; } u8 GetKeypadIconWidth(u8 keypadIconId) @@ -1976,7 +1494,7 @@ s32 GetGlyphWidthFont2(u16 glyphId, bool32 isJapanese) } } -void DecompressGlyphFont3(u16 glyphId, bool32 isJapanese) +static void DecompressGlyphFont3(u16 glyphId, bool32 isJapanese) { const u16* glyphs; int i; @@ -2019,7 +1537,7 @@ s32 GetGlyphWidthFont3(u16 glyphId, bool32 isJapanese) return gFont2LatinGlyphWidths[glyphId]; } -void DecompressGlyphFont4(u16 glyphId, bool32 isJapanese) +static void DecompressGlyphFont4(u16 glyphId, bool32 isJapanese) { const u16* glyphs; int i; |