diff options
Diffstat (limited to 'include/text.h')
-rw-r--r-- | include/text.h | 97 |
1 files changed, 49 insertions, 48 deletions
diff --git a/include/text.h b/include/text.h index f677f2ced..69cbb87ed 100644 --- a/include/text.h +++ b/include/text.h @@ -89,6 +89,13 @@ #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_JPN 0x15 +#define EXT_CTRL_CODE_ENG 0x16 #define TEXT_COLOR_TRANSPARENT 0x0 #define TEXT_COLOR_WHITE 0x1 @@ -102,19 +109,17 @@ // battle placeholders are located in battle_message.h -#define EXT_CTRL_CODE_JPN 0x15 -#define EXT_CTRL_CODE_ENG 0x16 - #define NUM_TEXT_PRINTERS 32 #define TEXT_SPEED_FF 0xFF -enum { +enum +{ FONTATTR_MAX_LETTER_WIDTH, FONTATTR_MAX_LETTER_HEIGHT, FONTATTR_LETTER_SPACING, FONTATTR_LINE_SPACING, - FONTATTR_COLOR_LOWNIBBLE, // dunno what this is yet + FONTATTR_UNKNOWN, // dunno what this is yet FONTATTR_COLOR_FOREGROUND, FONTATTR_COLOR_BACKGROUND, FONTATTR_COLOR_SHADOW @@ -122,23 +127,18 @@ enum { struct TextPrinterSubStruct { - u8 font_type:4; // 0x14 - u8 font_type_upper:1; - u8 font_type_5:3; - u8 field_1:5; - u8 field_1_upmid:2; - u8 field_1_top:1; - u8 frames_visible_counter; - u8 field_3; - u8 field_4; // 0x18 - u8 field_5; - u8 field_6; - u8 active; + u8 glyphId:4; // 0x14 + bool8 hasPrintBeenSpedUp:1; + u8 unk:3; + u8 downArrowDelay:5; + u8 downArrowYPosIdx:2; + bool8 hasGlyphIdBeenSet:1; + u8 autoScrollDelay; }; -struct TextSubPrinter // TODO: Better name +struct TextPrinterTemplate { - const u8* current_text_offset; + const u8* currentChar; u8 windowId; u8 fontId; u8 x; @@ -147,7 +147,7 @@ struct TextSubPrinter // TODO: Better name u8 currentY; u8 letterSpacing; u8 lineSpacing; - u8 fontColor_l:4; // 0xC + u8 unk:4; // 0xC u8 fgColor:4; u8 bgColor:4; u8 shadowColor:4; @@ -155,18 +155,18 @@ struct TextSubPrinter // TODO: Better name struct TextPrinter { - struct TextSubPrinter subPrinter; + struct TextPrinterTemplate printerTemplate; - void (*callback)(struct TextSubPrinter *, u16); // 0x10 + void (*callback)(struct TextPrinterTemplate *, u16); // 0x10 - union { + union __attribute__((packed)) { struct TextPrinterSubStruct sub; + u8 fields[7]; + } subUnion; - u8 sub_fields[8]; - } sub_union; - + u8 active; u8 state; // 0x1C - u8 text_speed; + u8 textSpeed; u8 delayCounter; u8 scrollDistance; u8 minLetterSpacing; // 0x20 @@ -180,7 +180,7 @@ struct FontInfo u8 maxLetterHeight; u8 letterSpacing; u8 lineSpacing; - u8 fontColor_l:4; + u8 unk:4; u8 fgColor:4; u8 bgColor:4; u8 shadowColor:4; @@ -190,49 +190,50 @@ extern const struct FontInfo *gFonts; struct GlyphWidthFunc { - u32 font_id; + u32 fontId; u32 (*func)(u16 glyphId, bool32 isJapanese); }; struct KeypadIcon { - u16 tile_offset; + u16 tileOffset; u8 width; u8 height; }; typedef struct { - u8 flag_0:1; - u8 flag_1:1; - u8 flag_2:1; - u8 flag_3:1; + bool8 canABSpeedUpPrint:1; + bool8 useAlternateDownArrow:1; + bool8 autoScroll:1; + bool8 forceMidTextSpeed:1; } TextFlags; -extern TextFlags gTextFlags; +struct Struct_03002F90 +{ + u32 unk0[8]; + u32 unk20[8]; + u32 unk40[8]; + u32 unk60[8]; + u8 unk80; + u8 unk81; +}; -extern u8 gStringVar1[]; -extern u8 gStringVar2[]; -extern u8 gStringVar3[]; -extern u8 gStringVar4[]; +extern TextFlags gTextFlags; -u8 gUnknown_03002F84; -u8 gUnknown_03002F90[0x20]; -u8 gUnknown_03002FB0[0x20]; -u8 gUnknown_03002FD0[0x20]; -u8 gUnknown_03002FF0[0x20]; -u8 gGlyphDimensions[0x2]; +extern u8 gUnknown_03002F84; +extern struct Struct_03002F90 gUnknown_03002F90; void SetFontsPointer(const struct FontInfo *fonts); void DeactivateAllTextPrinters(void); -u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextSubPrinter *, u16)); -bool16 AddTextPrinter(struct TextSubPrinter *textSubPrinter, u8 speed, void (*callback)(struct TextSubPrinter *, u16)); +u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16)); +bool16 AddTextPrinter(struct TextPrinterTemplate *template, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16)); void RunTextPrinters(void); bool16 IsTextPrinterActive(u8 id); u32 RenderFont(struct TextPrinter *textPrinter); void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor); void SaveTextColors(u8 *fgColor, u8 *bgColor, u8 *shadowColor); void RestoreTextColors(u8 *fgColor, u8 *bgColor, u8 *shadowColor); -void DecompressGlyphTile(const u16 *src, u16 *dest); +void DecompressGlyphTile(const void *src_, void *dest_); u8 GetLastTextColor(u8 colorType); void CopyGlyphToWindow(struct TextPrinter *x); void ClearTextSpan(struct TextPrinter *textPrinter, u32 width); |