From 6d0d69f3a5c83ae44fbbc5d29e384306ea031ab4 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sun, 4 Nov 2018 23:09:10 +0100 Subject: Match Render Text --- include/text.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include/text.h') diff --git a/include/text.h b/include/text.h index f677f2ced..23873ce54 100644 --- a/include/text.h +++ b/include/text.h @@ -120,7 +120,7 @@ enum { FONTATTR_COLOR_SHADOW }; -struct TextPrinterSubStruct +struct TextPrinterSubSubStruct { u8 font_type:4; // 0x14 u8 font_type_upper:1; @@ -130,6 +130,11 @@ struct TextPrinterSubStruct u8 field_1_top:1; u8 frames_visible_counter; u8 field_3; +}; + +struct TextPrinterSubStruct +{ + struct TextPrinterSubSubStruct sub; u8 field_4; // 0x18 u8 field_5; u8 field_6; @@ -216,7 +221,7 @@ extern u8 gStringVar3[]; extern u8 gStringVar4[]; u8 gUnknown_03002F84; -u8 gUnknown_03002F90[0x20]; +u8 gUnknown_03002F90[]; u8 gUnknown_03002FB0[0x20]; u8 gUnknown_03002FD0[0x20]; u8 gUnknown_03002FF0[0x20]; -- cgit v1.2.3 From 487a6c2b2c641a9b022ec47f809ac4a3e68f8ac7 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 5 Nov 2018 21:42:12 +0100 Subject: this file is --- include/text.h | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) (limited to 'include/text.h') diff --git a/include/text.h b/include/text.h index 23873ce54..db0d48bfc 100644 --- a/include/text.h +++ b/include/text.h @@ -120,7 +120,7 @@ enum { FONTATTR_COLOR_SHADOW }; -struct TextPrinterSubSubStruct +struct TextPrinterSubStruct { u8 font_type:4; // 0x14 u8 font_type_upper:1; @@ -129,16 +129,6 @@ struct TextPrinterSubSubStruct u8 field_1_upmid:2; u8 field_1_top:1; u8 frames_visible_counter; - u8 field_3; -}; - -struct TextPrinterSubStruct -{ - struct TextPrinterSubSubStruct sub; - u8 field_4; // 0x18 - u8 field_5; - u8 field_6; - u8 active; }; struct TextSubPrinter // TODO: Better name @@ -164,14 +154,14 @@ struct TextPrinter void (*callback)(struct TextSubPrinter *, u16); // 0x10 - union { + union __attribute__((packed)) { struct TextPrinterSubStruct sub; - - u8 sub_fields[8]; + u8 sub_fields[7]; } sub_union; + u8 active; u8 state; // 0x1C - u8 text_speed; + u8 textSpeed; u8 delayCounter; u8 scrollDistance; u8 minLetterSpacing; // 0x20 @@ -213,6 +203,16 @@ typedef struct { u8 flag_3:1; } TextFlags; +struct Struct_03002F90 +{ + u8 unk0[0x20]; + u8 unk20[0x20]; + u8 unk40[0x20]; + u8 unk60[0x20]; + u8 unk80; + u8 unk81; +}; + extern TextFlags gTextFlags; extern u8 gStringVar1[]; @@ -220,12 +220,8 @@ extern u8 gStringVar2[]; extern u8 gStringVar3[]; extern u8 gStringVar4[]; -u8 gUnknown_03002F84; -u8 gUnknown_03002F90[]; -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); -- cgit v1.2.3 From 6d38431c330a79d97bfb72fdaaaa65901ce0fa64 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Tue, 6 Nov 2018 10:44:48 -0600 Subject: Begin cleaning text.c --- include/text.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'include/text.h') diff --git a/include/text.h b/include/text.h index db0d48bfc..658a32147 100644 --- a/include/text.h +++ b/include/text.h @@ -122,18 +122,18 @@ enum { struct TextPrinterSubStruct { - u8 font_type:4; // 0x14 - u8 font_type_upper:1; + u8 glyphId:4; // 0x14 + bool8 hasPrintBeenSpedUp:1; u8 font_type_5:3; - u8 field_1:5; - u8 field_1_upmid:2; - u8 field_1_top:1; + u8 downArrowDelay:5; + u8 downArrowYPosIdx:2; + bool8 hasGlyphIdBeenSet:1; u8 frames_visible_counter; }; -struct TextSubPrinter // TODO: Better name +struct TextPrinterTemplate { - const u8* current_text_offset; + const u8* currentChar; u8 windowId; u8 fontId; u8 x; @@ -150,9 +150,9 @@ 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 __attribute__((packed)) { struct TextPrinterSubStruct sub; @@ -197,7 +197,7 @@ struct KeypadIcon }; typedef struct { - u8 flag_0:1; + u8 canABSpeedUpPrint:1; u8 flag_1:1; u8 flag_2:1; u8 flag_3:1; @@ -225,8 +225,8 @@ 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); -- cgit v1.2.3 From f8d337e491f531285f6067e2e7f39a8d606036d6 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Tue, 6 Nov 2018 11:30:21 -0600 Subject: Finish cleaning up text.c --- include/text.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'include/text.h') diff --git a/include/text.h b/include/text.h index 658a32147..4946f1c5f 100644 --- a/include/text.h +++ b/include/text.h @@ -114,7 +114,7 @@ enum { 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 @@ -124,11 +124,11 @@ struct TextPrinterSubStruct { u8 glyphId:4; // 0x14 bool8 hasPrintBeenSpedUp:1; - u8 font_type_5:3; + u8 unk:3; u8 downArrowDelay:5; u8 downArrowYPosIdx:2; bool8 hasGlyphIdBeenSet:1; - u8 frames_visible_counter; + u8 autoScrollDelay; }; struct TextPrinterTemplate @@ -142,7 +142,7 @@ struct TextPrinterTemplate u8 currentY; u8 letterSpacing; u8 lineSpacing; - u8 fontColor_l:4; // 0xC + u8 unk:4; // 0xC u8 fgColor:4; u8 bgColor:4; u8 shadowColor:4; @@ -156,8 +156,8 @@ struct TextPrinter union __attribute__((packed)) { struct TextPrinterSubStruct sub; - u8 sub_fields[7]; - } sub_union; + u8 fields[7]; + } subUnion; u8 active; u8 state; // 0x1C @@ -175,7 +175,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; @@ -185,22 +185,22 @@ 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 canABSpeedUpPrint: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; struct Struct_03002F90 -- cgit v1.2.3