real match RenderText
This commit is contained in:
+25
-23
@@ -83,7 +83,16 @@
|
|||||||
#define TEXT_COLOR_DARK_GREY 0x2
|
#define TEXT_COLOR_DARK_GREY 0x2
|
||||||
|
|
||||||
// battle placeholders are located in battle_message.h
|
// battle placeholders are located in battle_message.h
|
||||||
|
#define EXT_CTRL_CODE_COLOR 0x1
|
||||||
|
#define EXT_CTRL_CODE_HIGHLIGHT 0x2
|
||||||
|
#define EXT_CTRL_CODE_SHADOW 0x3
|
||||||
|
//
|
||||||
|
#define EXT_CTRL_CODE_UNKNOWN_7 0x7
|
||||||
|
//
|
||||||
|
#define EXT_CTRL_CODE_CLEAR 0x11
|
||||||
|
//
|
||||||
|
#define EXT_CTRL_CODE_CLEAR_TO 0x13
|
||||||
|
#define EXT_CTRL_CODE_MIN_LETTER_SPACING 0x14
|
||||||
#define EXT_CTRL_CODE_JPN 0x15
|
#define EXT_CTRL_CODE_JPN 0x15
|
||||||
#define EXT_CTRL_CODE_ENG 0x16
|
#define EXT_CTRL_CODE_ENG 0x16
|
||||||
|
|
||||||
@@ -105,18 +114,13 @@ enum
|
|||||||
|
|
||||||
struct TextPrinterSubStruct
|
struct TextPrinterSubStruct
|
||||||
{
|
{
|
||||||
u8 font_type:4; // 0x14
|
u8 glyphId:4; // 0x14
|
||||||
u8 font_type_upper:1;
|
bool8 hasPrintBeenSpedUp:1;
|
||||||
u8 font_type_5:3;
|
u8 font_type_5:3;
|
||||||
u8 field_1:5;
|
u8 downArrowDelay:5;
|
||||||
u8 field_1_upmid:2;
|
u8 downArrowYPosIdx:2;
|
||||||
u8 field_1_top:1;
|
u8 hasGlyphIdBeenSet:1;
|
||||||
u8 frames_visible_counter;
|
u8 autoScrollDelay;
|
||||||
u8 field_3;
|
|
||||||
u8 field_4; // 0x18
|
|
||||||
u8 field_5;
|
|
||||||
u8 field_6;
|
|
||||||
u8 active;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TextPrinterTemplate // TODO: Better name
|
struct TextPrinterTemplate // TODO: Better name
|
||||||
@@ -138,18 +142,15 @@ struct TextPrinterTemplate // TODO: Better name
|
|||||||
|
|
||||||
struct TextPrinter
|
struct TextPrinter
|
||||||
{
|
{
|
||||||
struct TextPrinterTemplate subPrinter;
|
struct TextPrinterTemplate printerTemplate;
|
||||||
|
|
||||||
void (*callback)(struct TextPrinterTemplate *, u16); // 0x10
|
void (*callback)(struct TextPrinterTemplate *, u16); // 0x10
|
||||||
|
union __attribute__((packed)) {
|
||||||
union {
|
|
||||||
struct TextPrinterSubStruct sub;
|
struct TextPrinterSubStruct sub;
|
||||||
|
u8 fields[7];
|
||||||
u8 sub_fields[8];
|
} subUnion;
|
||||||
} sub_union;
|
u8 active;
|
||||||
|
|
||||||
u8 state; // 0x1C
|
u8 state; // 0x1C
|
||||||
u8 text_speed;
|
u8 textSpeed;
|
||||||
u8 delayCounter;
|
u8 delayCounter;
|
||||||
u8 scrollDistance;
|
u8 scrollDistance;
|
||||||
u8 minLetterSpacing; // 0x20
|
u8 minLetterSpacing; // 0x20
|
||||||
@@ -173,13 +174,13 @@ extern const struct FontInfo *gFonts;
|
|||||||
|
|
||||||
struct GlyphWidthFunc
|
struct GlyphWidthFunc
|
||||||
{
|
{
|
||||||
u32 font_id;
|
u32 fontId;
|
||||||
s32 (*func)(u16 glyphId, bool32 isJapanese);
|
s32 (*func)(u16 glyphId, bool32 isJapanese);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct KeypadIcon
|
struct KeypadIcon
|
||||||
{
|
{
|
||||||
u16 tile_offset;
|
u16 tileOffset;
|
||||||
u8 width;
|
u8 width;
|
||||||
u8 height;
|
u8 height;
|
||||||
};
|
};
|
||||||
@@ -262,5 +263,6 @@ s32 GetGlyphWidthFont5(u16 glyphId, bool32 isJapanese);
|
|||||||
void sub_80062B0(struct Sprite *sprite);
|
void sub_80062B0(struct Sprite *sprite);
|
||||||
u8 CreateTextCursorSpriteForOakSpeech(u8 sheetId, u16 x, u16 y, u8 priority, u8 subpriority);
|
u8 CreateTextCursorSpriteForOakSpeech(u8 sheetId, u16 x, u16 y, u8 priority, u8 subpriority);
|
||||||
void sub_8006398(u8 spriteId);
|
void sub_8006398(u8 spriteId);
|
||||||
|
s32 GetGlyphWidthFont6(u16 font_type, bool32 isJapanese);
|
||||||
|
|
||||||
#endif // GUARD_TEXT_H
|
#endif // GUARD_TEXT_H
|
||||||
|
|||||||
+43
-43
@@ -17,20 +17,20 @@ u16 Font6Func(struct TextPrinter *textPrinter)
|
|||||||
u16 char_;
|
u16 char_;
|
||||||
struct TextPrinterSubStruct *sub;
|
struct TextPrinterSubStruct *sub;
|
||||||
|
|
||||||
sub = &textPrinter->sub_union.sub;
|
sub = &textPrinter->subUnion.sub;
|
||||||
switch (textPrinter->state)
|
switch (textPrinter->state)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
if (gMain.heldKeys & (A_BUTTON | B_BUTTON) && sub->font_type_upper)
|
if (gMain.heldKeys & (A_BUTTON | B_BUTTON) && sub->hasPrintBeenSpedUp)
|
||||||
{
|
{
|
||||||
textPrinter->delayCounter = 0;
|
textPrinter->delayCounter = 0;
|
||||||
}
|
}
|
||||||
if (textPrinter->delayCounter && textPrinter->text_speed)
|
if (textPrinter->delayCounter && textPrinter->textSpeed)
|
||||||
{
|
{
|
||||||
textPrinter->delayCounter --;
|
textPrinter->delayCounter --;
|
||||||
if (gTextFlags.canABSpeedUpPrint && gMain.newKeys & (A_BUTTON | B_BUTTON))
|
if (gTextFlags.canABSpeedUpPrint && gMain.newKeys & (A_BUTTON | B_BUTTON))
|
||||||
{
|
{
|
||||||
sub->font_type_upper = TRUE;
|
sub->hasPrintBeenSpedUp = TRUE;
|
||||||
textPrinter->delayCounter = 0;
|
textPrinter->delayCounter = 0;
|
||||||
}
|
}
|
||||||
return 3;
|
return 3;
|
||||||
@@ -41,62 +41,62 @@ u16 Font6Func(struct TextPrinter *textPrinter)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
textPrinter->delayCounter = textPrinter->text_speed;
|
textPrinter->delayCounter = textPrinter->textSpeed;
|
||||||
}
|
}
|
||||||
char_ = *textPrinter->subPrinter.currentChar++;
|
char_ = *textPrinter->printerTemplate.currentChar++;
|
||||||
switch (char_)
|
switch (char_)
|
||||||
{
|
{
|
||||||
case EOS:
|
case EOS:
|
||||||
return 1;
|
return 1;
|
||||||
case CHAR_NEWLINE:
|
case CHAR_NEWLINE:
|
||||||
textPrinter->subPrinter.currentX = textPrinter->subPrinter.x;
|
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
|
||||||
textPrinter->subPrinter.currentY += gFonts[textPrinter->subPrinter.fontId].maxLetterHeight + textPrinter->subPrinter.lineSpacing;
|
textPrinter->printerTemplate.currentY += gFonts[textPrinter->printerTemplate.fontId].maxLetterHeight + textPrinter->printerTemplate.lineSpacing;
|
||||||
return 2;
|
return 2;
|
||||||
case PLACEHOLDER_BEGIN:
|
case PLACEHOLDER_BEGIN:
|
||||||
textPrinter->subPrinter.currentChar++;
|
textPrinter->printerTemplate.currentChar++;
|
||||||
return 2;
|
return 2;
|
||||||
case EXT_CTRL_CODE_BEGIN:
|
case EXT_CTRL_CODE_BEGIN:
|
||||||
char_ = *textPrinter->subPrinter.currentChar++;
|
char_ = *textPrinter->printerTemplate.currentChar++;
|
||||||
switch (char_)
|
switch (char_)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
textPrinter->subPrinter.fgColor = *textPrinter->subPrinter.currentChar++;
|
textPrinter->printerTemplate.fgColor = *textPrinter->printerTemplate.currentChar++;
|
||||||
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
|
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
|
||||||
return 2;
|
return 2;
|
||||||
case 2:
|
case 2:
|
||||||
textPrinter->subPrinter.bgColor = *textPrinter->subPrinter.currentChar++;
|
textPrinter->printerTemplate.bgColor = *textPrinter->printerTemplate.currentChar++;
|
||||||
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
|
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
|
||||||
return 2;
|
return 2;
|
||||||
case 3:
|
case 3:
|
||||||
textPrinter->subPrinter.shadowColor = *textPrinter->subPrinter.currentChar++;
|
textPrinter->printerTemplate.shadowColor = *textPrinter->printerTemplate.currentChar++;
|
||||||
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
|
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
|
||||||
return 2;
|
return 2;
|
||||||
case 4:
|
case 4:
|
||||||
textPrinter->subPrinter.fgColor = *textPrinter->subPrinter.currentChar;
|
textPrinter->printerTemplate.fgColor = *textPrinter->printerTemplate.currentChar;
|
||||||
textPrinter->subPrinter.bgColor = *++textPrinter->subPrinter.currentChar;
|
textPrinter->printerTemplate.bgColor = *++textPrinter->printerTemplate.currentChar;
|
||||||
textPrinter->subPrinter.shadowColor = *++textPrinter->subPrinter.currentChar;
|
textPrinter->printerTemplate.shadowColor = *++textPrinter->printerTemplate.currentChar;
|
||||||
textPrinter->subPrinter.currentChar++;
|
textPrinter->printerTemplate.currentChar++;
|
||||||
|
|
||||||
GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor);
|
GenerateFontHalfRowLookupTable(textPrinter->printerTemplate.fgColor, textPrinter->printerTemplate.bgColor, textPrinter->printerTemplate.shadowColor);
|
||||||
return 2;
|
return 2;
|
||||||
case 5:
|
case 5:
|
||||||
textPrinter->subPrinter.currentChar++;
|
textPrinter->printerTemplate.currentChar++;
|
||||||
return 2;
|
return 2;
|
||||||
case 6:
|
case 6:
|
||||||
sub->font_type = *textPrinter->subPrinter.currentChar;
|
sub->glyphId = *textPrinter->printerTemplate.currentChar;
|
||||||
textPrinter->subPrinter.currentChar++;
|
textPrinter->printerTemplate.currentChar++;
|
||||||
return 2;
|
return 2;
|
||||||
case 7:
|
case 7:
|
||||||
return 2;
|
return 2;
|
||||||
case 8:
|
case 8:
|
||||||
textPrinter->delayCounter = *textPrinter->subPrinter.currentChar++;
|
textPrinter->delayCounter = *textPrinter->printerTemplate.currentChar++;
|
||||||
textPrinter->state = 6;
|
textPrinter->state = 6;
|
||||||
return 2;
|
return 2;
|
||||||
case 9:
|
case 9:
|
||||||
textPrinter->state = 1;
|
textPrinter->state = 1;
|
||||||
if (gTextFlags.autoScroll)
|
if (gTextFlags.autoScroll)
|
||||||
{
|
{
|
||||||
sub->frames_visible_counter = 0;
|
sub->autoScrollDelay = 0;
|
||||||
}
|
}
|
||||||
return 3;
|
return 3;
|
||||||
case 10:
|
case 10:
|
||||||
@@ -104,19 +104,19 @@ u16 Font6Func(struct TextPrinter *textPrinter)
|
|||||||
return 3;
|
return 3;
|
||||||
case 11:
|
case 11:
|
||||||
case 16:
|
case 16:
|
||||||
textPrinter->subPrinter.currentChar += 2;
|
textPrinter->printerTemplate.currentChar += 2;
|
||||||
return 2;
|
return 2;
|
||||||
case 12:
|
case 12:
|
||||||
char_ = *++textPrinter->subPrinter.currentChar;
|
char_ = *++textPrinter->printerTemplate.currentChar;
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
textPrinter->subPrinter.currentX = textPrinter->subPrinter.x + *textPrinter->subPrinter.currentChar++;
|
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x + *textPrinter->printerTemplate.currentChar++;
|
||||||
return 2;
|
return 2;
|
||||||
case 14:
|
case 14:
|
||||||
textPrinter->subPrinter.currentY = textPrinter->subPrinter.y + *textPrinter->subPrinter.currentChar++;
|
textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y + *textPrinter->printerTemplate.currentChar++;
|
||||||
return 2;
|
return 2;
|
||||||
case 15:
|
case 15:
|
||||||
FillWindowPixelBuffer(textPrinter->subPrinter.windowId, PIXEL_FILL(textPrinter->subPrinter.bgColor));
|
FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, PIXEL_FILL(textPrinter->printerTemplate.bgColor));
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -129,15 +129,15 @@ u16 Font6Func(struct TextPrinter *textPrinter)
|
|||||||
TextPrinterInitDownArrowCounters(textPrinter);
|
TextPrinterInitDownArrowCounters(textPrinter);
|
||||||
return 3;
|
return 3;
|
||||||
case 0xF9:
|
case 0xF9:
|
||||||
char_ = *textPrinter->subPrinter.currentChar++| 0x100;
|
char_ = *textPrinter->printerTemplate.currentChar++| 0x100;
|
||||||
break;
|
break;
|
||||||
case 0xF8:
|
case 0xF8:
|
||||||
textPrinter->subPrinter.currentChar++;
|
textPrinter->printerTemplate.currentChar++;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
DecompressGlyphFont6(char_);
|
DecompressGlyphFont6(char_);
|
||||||
CopyGlyphToWindow(textPrinter);
|
CopyGlyphToWindow(textPrinter);
|
||||||
textPrinter->subPrinter.currentX += gGlyphInfo[0x80] + textPrinter->subPrinter.letterSpacing;
|
textPrinter->printerTemplate.currentX += gGlyphInfo[0x80] + textPrinter->printerTemplate.letterSpacing;
|
||||||
return 0;
|
return 0;
|
||||||
case 1:
|
case 1:
|
||||||
if (TextPrinterWait(textPrinter))
|
if (TextPrinterWait(textPrinter))
|
||||||
@@ -148,9 +148,9 @@ u16 Font6Func(struct TextPrinter *textPrinter)
|
|||||||
case 2:
|
case 2:
|
||||||
if (TextPrinterWaitWithDownArrow(textPrinter))
|
if (TextPrinterWaitWithDownArrow(textPrinter))
|
||||||
{
|
{
|
||||||
FillWindowPixelBuffer(textPrinter->subPrinter.windowId, PIXEL_FILL(textPrinter->subPrinter.bgColor));
|
FillWindowPixelBuffer(textPrinter->printerTemplate.windowId, PIXEL_FILL(textPrinter->printerTemplate.bgColor));
|
||||||
textPrinter->subPrinter.currentX = textPrinter->subPrinter.x;
|
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
|
||||||
textPrinter->subPrinter.currentY = textPrinter->subPrinter.y;
|
textPrinter->printerTemplate.currentY = textPrinter->printerTemplate.y;
|
||||||
textPrinter->state = 0;
|
textPrinter->state = 0;
|
||||||
}
|
}
|
||||||
return 3;
|
return 3;
|
||||||
@@ -158,8 +158,8 @@ u16 Font6Func(struct TextPrinter *textPrinter)
|
|||||||
if (TextPrinterWaitWithDownArrow(textPrinter))
|
if (TextPrinterWaitWithDownArrow(textPrinter))
|
||||||
{
|
{
|
||||||
TextPrinterClearDownArrow(textPrinter);
|
TextPrinterClearDownArrow(textPrinter);
|
||||||
textPrinter->scrollDistance = gFonts[textPrinter->subPrinter.fontId].maxLetterHeight + textPrinter->subPrinter.lineSpacing;
|
textPrinter->scrollDistance = gFonts[textPrinter->printerTemplate.fontId].maxLetterHeight + textPrinter->printerTemplate.lineSpacing;
|
||||||
textPrinter->subPrinter.currentX = textPrinter->subPrinter.x;
|
textPrinter->printerTemplate.currentX = textPrinter->printerTemplate.x;
|
||||||
textPrinter->state = 4;
|
textPrinter->state = 4;
|
||||||
}
|
}
|
||||||
return 3;
|
return 3;
|
||||||
@@ -168,15 +168,15 @@ u16 Font6Func(struct TextPrinter *textPrinter)
|
|||||||
{
|
{
|
||||||
if (textPrinter->scrollDistance < gUnknown_846FB08[gSaveBlock2Ptr->optionsTextSpeed])
|
if (textPrinter->scrollDistance < gUnknown_846FB08[gSaveBlock2Ptr->optionsTextSpeed])
|
||||||
{
|
{
|
||||||
ScrollWindow(textPrinter->subPrinter.windowId, 0, textPrinter->scrollDistance, PIXEL_FILL(textPrinter->subPrinter.bgColor));
|
ScrollWindow(textPrinter->printerTemplate.windowId, 0, textPrinter->scrollDistance, PIXEL_FILL(textPrinter->printerTemplate.bgColor));
|
||||||
textPrinter->scrollDistance = 0;
|
textPrinter->scrollDistance = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ScrollWindow(textPrinter->subPrinter.windowId, 0, gUnknown_846FB08[gSaveBlock2Ptr->optionsTextSpeed], PIXEL_FILL(textPrinter->subPrinter.bgColor));
|
ScrollWindow(textPrinter->printerTemplate.windowId, 0, gUnknown_846FB08[gSaveBlock2Ptr->optionsTextSpeed], PIXEL_FILL(textPrinter->printerTemplate.bgColor));
|
||||||
textPrinter->scrollDistance -= gUnknown_846FB08[gSaveBlock2Ptr->optionsTextSpeed];
|
textPrinter->scrollDistance -= gUnknown_846FB08[gSaveBlock2Ptr->optionsTextSpeed];
|
||||||
}
|
}
|
||||||
CopyWindowToVram(textPrinter->subPrinter.windowId, 2);
|
CopyWindowToVram(textPrinter->printerTemplate.windowId, 2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -216,7 +216,7 @@ static void DecompressGlyphFont6(u16 glyph)
|
|||||||
gGlyphInfo[0x81] = 0x10;
|
gGlyphInfo[0x81] = 0x10;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 GetGlyphWidthFont6(u16 font_type, bool32 isJapanese)
|
s32 GetGlyphWidthFont6(u16 font_type, bool32 isJapanese)
|
||||||
{
|
{
|
||||||
return 0x10;
|
return 0x10;
|
||||||
}
|
}
|
||||||
|
|||||||
+351
-833
File diff suppressed because it is too large
Load Diff
+30
-30
@@ -45,27 +45,27 @@ void DeactivateAllTextPrinters (void)
|
|||||||
{
|
{
|
||||||
int printer;
|
int printer;
|
||||||
for (printer = 0; printer < NUM_TEXT_PRINTERS; ++printer)
|
for (printer = 0; printer < NUM_TEXT_PRINTERS; ++printer)
|
||||||
sTextPrinters[printer].sub_union.sub.active = 0;
|
sTextPrinters[printer].active = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16))
|
u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16))
|
||||||
{
|
{
|
||||||
struct TextPrinterTemplate subPrinter;
|
struct TextPrinterTemplate printerTemplate;
|
||||||
|
|
||||||
subPrinter.currentChar = str;
|
printerTemplate.currentChar = str;
|
||||||
subPrinter.windowId = windowId;
|
printerTemplate.windowId = windowId;
|
||||||
subPrinter.fontId = fontId;
|
printerTemplate.fontId = fontId;
|
||||||
subPrinter.x = x;
|
printerTemplate.x = x;
|
||||||
subPrinter.y = y;
|
printerTemplate.y = y;
|
||||||
subPrinter.currentX = x;
|
printerTemplate.currentX = x;
|
||||||
subPrinter.currentY = y;
|
printerTemplate.currentY = y;
|
||||||
subPrinter.letterSpacing = gFonts[fontId].letterSpacing;
|
printerTemplate.letterSpacing = gFonts[fontId].letterSpacing;
|
||||||
subPrinter.lineSpacing = gFonts[fontId].lineSpacing;
|
printerTemplate.lineSpacing = gFonts[fontId].lineSpacing;
|
||||||
subPrinter.unk = gFonts[fontId].unk;
|
printerTemplate.unk = gFonts[fontId].unk;
|
||||||
subPrinter.fgColor = gFonts[fontId].fgColor;
|
printerTemplate.fgColor = gFonts[fontId].fgColor;
|
||||||
subPrinter.bgColor = gFonts[fontId].bgColor;
|
printerTemplate.bgColor = gFonts[fontId].bgColor;
|
||||||
subPrinter.shadowColor = gFonts[fontId].shadowColor;
|
printerTemplate.shadowColor = gFonts[fontId].shadowColor;
|
||||||
return AddTextPrinter(&subPrinter, speed, callback);
|
return AddTextPrinter(&printerTemplate, speed, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool16 AddTextPrinter(struct TextPrinterTemplate *textSubPrinter, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16))
|
bool16 AddTextPrinter(struct TextPrinterTemplate *textSubPrinter, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16))
|
||||||
@@ -76,18 +76,18 @@ bool16 AddTextPrinter(struct TextPrinterTemplate *textSubPrinter, u8 speed, void
|
|||||||
if (!gFonts)
|
if (!gFonts)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
sTempTextPrinter.sub_union.sub.active = 1;
|
sTempTextPrinter.active = 1;
|
||||||
sTempTextPrinter.state = 0;
|
sTempTextPrinter.state = 0;
|
||||||
sTempTextPrinter.text_speed = speed;
|
sTempTextPrinter.textSpeed = speed;
|
||||||
sTempTextPrinter.delayCounter = 0;
|
sTempTextPrinter.delayCounter = 0;
|
||||||
sTempTextPrinter.scrollDistance = 0;
|
sTempTextPrinter.scrollDistance = 0;
|
||||||
|
|
||||||
for (i = 0; i < 7; ++i)
|
for (i = 0; i < 7; ++i)
|
||||||
{
|
{
|
||||||
sTempTextPrinter.sub_union.sub_fields[i] = 0;
|
sTempTextPrinter.subUnion.fields[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sTempTextPrinter.subPrinter = *textSubPrinter;
|
sTempTextPrinter.printerTemplate = *textSubPrinter;
|
||||||
sTempTextPrinter.callback = callback;
|
sTempTextPrinter.callback = callback;
|
||||||
sTempTextPrinter.minLetterSpacing = 0;
|
sTempTextPrinter.minLetterSpacing = 0;
|
||||||
sTempTextPrinter.japanese = 0;
|
sTempTextPrinter.japanese = 0;
|
||||||
@@ -95,12 +95,12 @@ bool16 AddTextPrinter(struct TextPrinterTemplate *textSubPrinter, u8 speed, void
|
|||||||
GenerateFontHalfRowLookupTable(textSubPrinter->fgColor, textSubPrinter->bgColor, textSubPrinter->shadowColor);
|
GenerateFontHalfRowLookupTable(textSubPrinter->fgColor, textSubPrinter->bgColor, textSubPrinter->shadowColor);
|
||||||
if (speed != TEXT_SPEED_FF && speed != 0x0)
|
if (speed != TEXT_SPEED_FF && speed != 0x0)
|
||||||
{
|
{
|
||||||
--sTempTextPrinter.text_speed;
|
--sTempTextPrinter.textSpeed;
|
||||||
sTextPrinters[textSubPrinter->windowId] = sTempTextPrinter;
|
sTextPrinters[textSubPrinter->windowId] = sTempTextPrinter;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sTempTextPrinter.text_speed = 0;
|
sTempTextPrinter.textSpeed = 0;
|
||||||
for (j = 0; j < 0x400; ++j)
|
for (j = 0; j < 0x400; ++j)
|
||||||
{
|
{
|
||||||
if ((u32)RenderFont(&sTempTextPrinter) == 1)
|
if ((u32)RenderFont(&sTempTextPrinter) == 1)
|
||||||
@@ -108,8 +108,8 @@ bool16 AddTextPrinter(struct TextPrinterTemplate *textSubPrinter, u8 speed, void
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (speed != TEXT_SPEED_FF)
|
if (speed != TEXT_SPEED_FF)
|
||||||
CopyWindowToVram(sTempTextPrinter.subPrinter.windowId, 2);
|
CopyWindowToVram(sTempTextPrinter.printerTemplate.windowId, 2);
|
||||||
sTextPrinters[textSubPrinter->windowId].sub_union.sub.active = 0;
|
sTextPrinters[textSubPrinter->windowId].active = 0;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -121,18 +121,18 @@ void RunTextPrinters(void)
|
|||||||
|
|
||||||
for (i = 0; i < 0x20; ++i)
|
for (i = 0; i < 0x20; ++i)
|
||||||
{
|
{
|
||||||
if (sTextPrinters[i].sub_union.sub.active != 0)
|
if (sTextPrinters[i].active != 0)
|
||||||
{
|
{
|
||||||
temp = RenderFont(&sTextPrinters[i]);
|
temp = RenderFont(&sTextPrinters[i]);
|
||||||
switch (temp) {
|
switch (temp) {
|
||||||
case 0:
|
case 0:
|
||||||
CopyWindowToVram(sTextPrinters[i].subPrinter.windowId, 2);
|
CopyWindowToVram(sTextPrinters[i].printerTemplate.windowId, 2);
|
||||||
case 3:
|
case 3:
|
||||||
if (sTextPrinters[i].callback != 0)
|
if (sTextPrinters[i].callback != 0)
|
||||||
sTextPrinters[i].callback(&sTextPrinters[i].subPrinter, temp);
|
sTextPrinters[i].callback(&sTextPrinters[i].printerTemplate, temp);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
sTextPrinters[i].sub_union.sub.active = 0;
|
sTextPrinters[i].active = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -141,7 +141,7 @@ void RunTextPrinters(void)
|
|||||||
|
|
||||||
bool16 IsTextPrinterActive(u8 id)
|
bool16 IsTextPrinterActive(u8 id)
|
||||||
{
|
{
|
||||||
return sTextPrinters[id].sub_union.sub.active;
|
return sTextPrinters[id].active;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 RenderFont(struct TextPrinter *textPrinter)
|
u32 RenderFont(struct TextPrinter *textPrinter)
|
||||||
@@ -149,7 +149,7 @@ u32 RenderFont(struct TextPrinter *textPrinter)
|
|||||||
u32 ret;
|
u32 ret;
|
||||||
while (TRUE)
|
while (TRUE)
|
||||||
{
|
{
|
||||||
ret = gFonts[textPrinter->subPrinter.fontId].fontFunction(textPrinter);
|
ret = gFonts[textPrinter->printerTemplate.fontId].fontFunction(textPrinter);
|
||||||
if (ret != 2)
|
if (ret != 2)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user