1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
#include "global.h"
#include "font.h"
#include "gf_gfx_loader.h"
#include "render_text.h"
#include "string16.h"
#include "text.h"
#include "graphic/font.naix"
struct UnkStruct_02002C14 *UNK_02106FC8;
struct UnkStruct_02002C14 UNK_02106FCC;
const u16 UNK_020ECB54[4][2] = { {0, 0}, {1, 0}, {2, 0}, {3, 0} };
const struct FontInfo gFontInfos[5] = {
{ 0x0B, 0x10, 0x00, 0x00, 0x00, 0x01, 0x0F, 0x02 },
{ 0x0B, 0x10, 0x00, 0x00, 0x00, 0x01, 0x0F, 0x02 },
{ 0x0B, 0x10, 0x00, 0x00, 0x00, 0x01, 0x0F, 0x02 },
{ 0x0B, 0x10, 0x00, 0x00, 0x00, 0x01, 0x0F, 0x02 },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
};
extern struct UnkStruct_0202199C *FUN_02021590(u32, u16, u32, u16, u32);
extern void FUN_020215E0(struct UnkStruct_0202199C *, u32, u32);
extern void FUN_020215C8(struct UnkStruct_0202199C *param0);
extern void FUN_02021750(struct UnkStruct_0202199C *, u32);
extern u32 FUN_020218D8(struct UnkStruct_0202199C *, u16 *str, u32);
THUMB_FUNC void FUN_02002C14()
{
UNK_02106FC8 = &UNK_02106FCC;
for (u32 i = 0; i < 4; i++)
{
UNK_02106FC8->unk84[i] = NULL;
UNK_02106FC8->unk94[i] = NULL;
}
SetFontsPointer(&gFontInfos[0]);
}
THUMB_FUNC void FUN_02002C50(u32 param0, u32 param1)
{
UNK_02106FC8->unk94[param0] =
FUN_02021590(14, UNK_020ECB54[param0][0], 1, UNK_020ECB54[param0][1], param1);
}
THUMB_FUNC void FUN_02002C84(s32 param0, u32 param1)
{
GF_ASSERT(param0 < 4);
GF_ASSERT(UNK_02106FC8->unk94[param0] != NULL);
FUN_020215E0(UNK_02106FC8->unk94[param0], 0, param1);
}
THUMB_FUNC void FUN_02002CC0(s32 param0)
{
GF_ASSERT(param0 < 4);
GF_ASSERT(UNK_02106FC8->unk94[param0] != NULL);
FUN_020215E0(UNK_02106FC8->unk94[param0], 1, 0);
}
THUMB_FUNC void FUN_02002CF8(int param0)
{
GF_ASSERT(param0 < 4);
if (UNK_02106FC8->unk84[param0] != NULL)
{
u32 i;
for (i = 0; i < 4; i++)
{
if (i != param0 && UNK_020ECB54[i][0] == UNK_020ECB54[param0][0] &&
UNK_02106FC8->unk94[i] != NULL)
{
UNK_02106FC8->unk84[i] = UNK_02106FC8->unk84[param0];
break;
}
}
if (i == 4)
{
FreeToHeap(UNK_02106FC8->unk84[param0]);
UNK_02106FC8->unk84[param0] = NULL;
}
}
if (UNK_02106FC8->unk94[param0] != NULL)
{
FUN_020215C8(UNK_02106FC8->unk94[param0]);
UNK_02106FC8->unk94[param0] = NULL;
}
}
THUMB_FUNC struct UnkStruct_02002C14 *FUN_02002D94(u32 param0, u32 param1)
{
FUN_02021750(UNK_02106FC8->unk94[param0], param1);
return UNK_02106FC8;
}
THUMB_FUNC u32 FontFunc(u32 fontId, struct TextPrinter *printer)
{
struct TextPrinterSubStruct *subStruct =
(struct TextPrinterSubStruct *)(&printer->subStructFields);
if (subStruct->hasGlyphIdBeenSet == 0)
{
subStruct->glyphId = fontId;
subStruct->hasGlyphIdBeenSet = 1;
}
return RenderText(printer);
}
THUMB_FUNC u32 FUN_02002DE0(u32 param0, u16 *str, u32 param2)
{
GF_ASSERT(UNK_02106FC8->unk94[param0] != NULL);
FUN_020218D8(UNK_02106FC8->unk94[param0], str, param2);
}
THUMB_FUNC u32 FUN_02002E14(u32 param0, struct String *str, u32 param2)
{
GF_ASSERT(UNK_02106FC8->unk94[param0] != NULL);
FUN_020218D8(UNK_02106FC8->unk94[param0], String_c_str(str), param2);
}
THUMB_FUNC s32 GetFontAttribute(u8 fontId, s32 attr)
{
u8 ret = 0;
switch (attr)
{
case 0:
ret = gFontInfos[fontId].maxLetterWidth;
break;
case 1:
ret = gFontInfos[fontId].maxLetterHeight;
break;
case 2:
ret = gFontInfos[fontId].letterSpacing;
break;
case 3:
ret = gFontInfos[fontId].lineSpacing;
break;
case 4:
ret = gFontInfos[fontId].unk;
break;
case 5:
ret = gFontInfos[fontId].fgColor;
break;
case 6:
ret = gFontInfos[fontId].bgColor;
break;
case 7:
ret = gFontInfos[fontId].shadowColor;
break;
}
return ret;
}
THUMB_FUNC void FUN_02002ED0(u32 layer, u32 baseAddr, u32 heap_id)
{
GfGfxLoader_GXLoadPal(NARC_GRAPHIC_FONT, NARC_font_narc_0006_NCLR, layer, baseAddr, 0x20, heap_id);
}
THUMB_FUNC void FUN_02002EEC(u32 layer, u32 baseAddr, u32 heap_id)
{
GfGfxLoader_GXLoadPal(NARC_GRAPHIC_FONT, NARC_font_narc_0007_NCLR, layer, baseAddr, 0x20, heap_id);
}
|