summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arm9/asm/unk_0201BCBC.s47
-rw-r--r--arm9/src/text.c24
-rw-r--r--arm9/src/text_02054590.c16
-rw-r--r--include/text.h26
-rw-r--r--include/text_02054590.h6
5 files changed, 49 insertions, 70 deletions
diff --git a/arm9/asm/unk_0201BCBC.s b/arm9/asm/unk_0201BCBC.s
index 1f8efdda..777ebe72 100644
--- a/arm9/asm/unk_0201BCBC.s
+++ b/arm9/asm/unk_0201BCBC.s
@@ -11,53 +11,6 @@
.text
- thumb_func_start AddTextPrinterParameterized
-AddTextPrinterParameterized: ; 0x0201BD84
- push {r3, lr}
- sub sp, #0x18
- str r0, [sp, #0x4]
- lsl r0, r3, #0x18
- lsr r3, r0, #0x18
- ldr r0, [sp, #0x20]
- str r2, [sp, #0x0]
- add r2, sp, #0x0
- strb r1, [r2, #0x9]
- lsl r0, r0, #0x18
- strb r3, [r2, #0xa]
- lsr r0, r0, #0x18
- strb r0, [r2, #0xb]
- strb r3, [r2, #0xc]
- strb r0, [r2, #0xd]
- ldr r0, _0201BDDC ; =gFonts
- lsl r1, r1, #0x3
- ldr r0, [r0, #0x0]
- add r1, r0, r1
- ldrb r0, [r1, #0x2]
- strb r0, [r2, #0xe]
- ldrb r0, [r1, #0x3]
- strb r0, [r2, #0xf]
- ldrb r0, [r1, #0x4]
- strb r0, [r2, #0x10]
- ldrb r0, [r1, #0x5]
- strb r0, [r2, #0x11]
- ldrb r0, [r1, #0x6]
- strb r0, [r2, #0x12]
- ldrb r0, [r1, #0x7]
- ldr r1, [sp, #0x24]
- strb r0, [r2, #0x13]
- mov r0, #0x0
- strh r0, [r2, #0x14]
- strb r0, [r2, #0x16]
- mov r0, #0xff
- strb r0, [r2, #0x17]
- ldr r2, [sp, #0x28]
- add r0, sp, #0x0
- bl AddTextPrinter
- add sp, #0x18
- pop {r3, pc}
- nop
-_0201BDDC: .word gFonts
-
thumb_func_start AddTextPrinterParameterized2
AddTextPrinterParameterized2: ; 0x0201BDE0
push {r3, lr}
diff --git a/arm9/src/text.c b/arm9/src/text.c
index cd846135..1a62608d 100644
--- a/arm9/src/text.c
+++ b/arm9/src/text.c
@@ -8,6 +8,7 @@ u32 UNK_021C5714[8];
u8 UNK_021C570C[8];
extern u32 FUN_0200CA7C(void *param0, u32 param1, u32 param2);
+extern u16 AddTextPrinter(struct TextPrinterTemplate *template, u32 speed, void (*callback)(void *, u16));
extern void *FUN_0201B6C8(void);
extern void FUN_0200CAB4(u32 param0);
@@ -83,3 +84,26 @@ THUMB_FUNC void FUN_0201BD7C(u32 param0)
{
FUN_0201BCFC(param0);
}
+
+THUMB_FUNC u16 AddTextPrinterParameterized(u32 windowId, u8 fontId, const u8 *str, u32 x, u32 y, u32 speed, void (*callback)(void *, u16))
+{
+ struct TextPrinterTemplate printerTemplate;
+
+ printerTemplate.windowId = windowId;
+ printerTemplate.currentChar = str;
+ printerTemplate.fontId = fontId;
+ printerTemplate.x = (u8)x;
+ printerTemplate.y = (u8)y;
+ printerTemplate.currentX = (u8)x;
+ printerTemplate.currentY = (u8)y;
+ printerTemplate.letterSpacing = gFonts[fontId].letterSpacing;
+ printerTemplate.lineSpacing = gFonts[fontId].lineSpacing;
+ printerTemplate.unk = gFonts[fontId].unk;
+ printerTemplate.fgColor = gFonts[fontId].fgColor;
+ printerTemplate.bgColor = gFonts[fontId].bgColor;
+ printerTemplate.shadowColor = gFonts[fontId].shadowColor;
+ printerTemplate.unk2 = 0;
+ printerTemplate.unk3 = 0;
+ printerTemplate.unk4 = 255;
+ return AddTextPrinter(&printerTemplate, speed, callback);
+}
diff --git a/arm9/src/text_02054590.c b/arm9/src/text_02054590.c
index f0c63a2b..393ac3b2 100644
--- a/arm9/src/text_02054590.c
+++ b/arm9/src/text_02054590.c
@@ -1,4 +1,5 @@
#include "text_02054590.h"
+#include "text.h"
extern void FUN_0201BD5C(void);
extern void FUN_02002ED0(u32 param0, u32 param1, u32 param2);
@@ -15,9 +16,6 @@ extern void FUN_02019620(u32 *param0, u32 param1);
extern void FUN_02002B60(u8 param0);
extern void FUN_02002B7C(u32 param0);
extern void FUN_02002BB8(u32 param0);
-extern void AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u32 speed, void (*callback)(void *, u16));
-
-extern u32 FUN_0201BD70(void);
extern void FUN_0200D300(u32 param0, u32 param1, u32 param2, u32 param3, u8 param4, u32 param5, u32 param6);
extern void FUN_0200D6F8(u32 *param0, u32 param1, u32 param2, u32 param3, u8 param4);
@@ -57,25 +55,25 @@ THUMB_FUNC void FUN_0205464C(u32 *param0)
FUN_02019620(param0, 15);
}
-THUMB_FUNC void FUN_02054658(u8 windowId, const u8 *str, struct Options *options, u8 param3)
+THUMB_FUNC u16 FUN_02054658(u8 windowId, const u8 *str, struct Options *options, u8 param3)
{
FUN_02002B60(param3);
FUN_02002B7C(0);
FUN_02002BB8(0);
- AddTextPrinterParameterized(windowId, 1, str, 0, 0, (u32)Options_GetTextFrameDelay(options), NULL);
+ return AddTextPrinterParameterized(windowId, 1, str, 0, 0, (u32)Options_GetTextFrameDelay(options), NULL);
}
-THUMB_FUNC void DrawFieldMessage(u8 windowId, const u8 *str, u8 fontId, u32 speed, u8 a4, u32 a5)
+THUMB_FUNC u16 DrawFieldMessage(u8 windowId, const u8 *str, u8 fontId, u32 speed, u8 a4, u32 a5)
{
FUN_02002B60(a4);
FUN_02002B7C(a5);
FUN_02002BB8(0);
- AddTextPrinterParameterized(windowId, fontId, str, 0, 0, speed, NULL);
+ return AddTextPrinterParameterized(windowId, fontId, str, 0, 0, speed, NULL);
}
-THUMB_FUNC u8 FUN_020546C8(void) //bool8?
+THUMB_FUNC u8 FUN_020546C8(u32 param0) //bool8?
{
- return !FUN_0201BD70();
+ return !FUN_0201BD70(param0);
}
THUMB_FUNC void FUN_020546E0(u32 param0, u32 param1, u32 param2, u32 param3)
diff --git a/include/text.h b/include/text.h
index fb31b86b..ca7ea133 100644
--- a/include/text.h
+++ b/include/text.h
@@ -6,18 +6,22 @@
struct TextPrinterTemplate
{
const u8* currentChar;
- u8 windowId;
+ u32 windowId;
+ u8 padding[1];
u8 fontId;
u8 x;
u8 y;
- u8 currentX; // 0x8
+ u8 currentX;
u8 currentY;
u8 letterSpacing;
u8 lineSpacing;
- u8 unk:4; // 0xC
- u8 fgColor:4;
- u8 bgColor:4;
- u8 shadowColor:4;
+ u8 unk;
+ u8 fgColor;
+ u8 bgColor;
+ u8 shadowColor;
+ u16 unk2;
+ u8 unk3;
+ u8 unk4;
};
struct TextPrinter
@@ -38,15 +42,14 @@ struct TextPrinter
struct FontInfo
{
- u16 (*fontFunction)(struct TextPrinter *x);
u8 maxLetterWidth;
u8 maxLetterHeight;
u8 letterSpacing;
u8 lineSpacing;
- u8 unk:4;
- u8 fgColor:4;
- u8 bgColor:4;
- u8 shadowColor:4;
+ u8 unk;
+ u8 fgColor;
+ u8 bgColor;
+ u8 shadowColor;
};
void SetFontsPointer(const struct FontInfo *fonts);
@@ -56,5 +59,6 @@ BOOL FUN_0201BD44(u32 param0);
void FUN_0201BD5C(void);
u8 FUN_0201BD70(u32 param0);
void FUN_0201BCFC(u32 param0);
+u16 AddTextPrinterParameterized(u32 windowId, u8 fontId, const u8 *str, u32 x, u32 y, u32 speed, void (*callback)(void *, u16));
#endif //POKEDIAMOND_TEXT_H
diff --git a/include/text_02054590.h b/include/text_02054590.h
index 37b286f3..401fa11f 100644
--- a/include/text_02054590.h
+++ b/include/text_02054590.h
@@ -8,9 +8,9 @@ void FUN_02054590(u32 param0, u32 param1);
void FUN_020545B8(u32 param0, u32 param1, u32 param2);
void FUN_02054608(u32 *param0, struct Options *options);
void FUN_0205464C(u32 *param0);
-void FUN_02054658(u8 windowId, const u8 *str, struct Options *options, u8 param3);
-void DrawFieldMessage(u8 windowId, const u8 *str, u8 fontId, u32 speed, u8 a4, u32 a5);
-u8 FUN_020546C8(void);
+u16 FUN_02054658(u8 windowId, const u8 *str, struct Options *options, u8 param3);
+u16 DrawFieldMessage(u8 windowId, const u8 *str, u8 fontId, u32 speed, u8 a4, u32 a5);
+u8 FUN_020546C8(u32 param0);
void FUN_020546E0(u32 param0, u32 param1, u32 param2, u32 param3);
void FUN_02054744(u32 *param0, u32 param1, u32 param2);