annotate GUIFont.cpp @ 190:d7bd52a35e52

24.12.12
author Ritor1
date Mon, 24 Dec 2012 07:48:44 +0600
parents 540178ef9b18
children
rev   line source
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
1 #include <string>
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
3 #include "GUIFont.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
4 #include "GUIWindow.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
5 #include "Render.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
7 #include "mm7_data.h"
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
13 struct GUIFont *pAutonoteFont;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
14 struct GUIFont *pSpellFont;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
15 struct GUIFont *pFontArrus;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
16 struct GUIFont *pFontLucida;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
17 struct GUIFont *pBook2Font;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
18 struct GUIFont *pBookFont;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
19 struct GUIFont *pFontCreate;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
20 struct GUIFont *pFontCChar;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
21 struct GUIFont *pFontComic;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
22 struct GUIFont *pFontSmallnum;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
23
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
24
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
25
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
26
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
27 //----- (0044D2FD) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
28 void GUIFont::_44D2FD_prolly_draw_credits_entry(GUIFont *pFont, int Str, int a4, unsigned int w, unsigned int h, unsigned __int16 a7, unsigned __int16 a8, const char *pString, unsigned __int16 *pPixels, unsigned int uPixelsWidth)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
29 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
30 int v11; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
31 int v12; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
32 char *v13; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
33 char *v14; // eax@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
34 unsigned __int16 *v15; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
35 GUIFont *v16; // edi@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
36 signed int v17; // ecx@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
37 signed int v18; // eax@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
38 int v19; // [sp+Ch] [bp-5Ch]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
39 int v20; // [sp+10h] [bp-58h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
40 unsigned int v21; // [sp+14h] [bp-54h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
41 unsigned int v22; // [sp+18h] [bp-50h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
42 unsigned int v23; // [sp+1Ch] [bp-4Ch]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
43 unsigned int v24; // [sp+20h] [bp-48h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
44 GUIFont *v25; // [sp+60h] [bp-8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
45 GUIFont *v26; // [sp+64h] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
46 char *Stra; // [sp+70h] [bp+8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
47 int a4a; // [sp+74h] [bp+Ch]@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
48 int a7a; // [sp+80h] [bp+18h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
49
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
50 v11 = a7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
51 v22 = h;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
52 v12 = Str;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
53 v26 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
54 v24 = a4 + h - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
55 v21 = w;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
56 v25 = pFont;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
57 v23 = Str + w - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
58 ui_current_text_color = a7;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
59 v19 = Str;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
60 v20 = a4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
61 v13 = GUIFont::_44C933(pString, this, pFont, (int)&v19, 0, 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
62 v14 = strtok(v13, "\n");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
63 Stra = v14;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
64 v15 = &pPixels[uPixelsWidth * a4];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
65 if ( v14 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
66 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
67 a7a = v12 >> 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
68 while ( 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
69 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
70 v16 = v26;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
71 ui_current_text_color = v11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
72 v17 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
73 a4a = v11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
74 if ( *v14 == '_' )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
75 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
76 v16 = v25;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
77 a4a = a8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
78 ui_current_text_color = a8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
79 v17 = 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
80 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
81 v18 = (signed int)(w - v16->GetLineWidth(&v14[v17])) >> 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
82 if ( v18 < 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
83 v18 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
84 v16->_44D0B5(a4a, a8, (int)&v15[v18 + a7a], Stra, uPixelsWidth);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
85 v15 += uPixelsWidth * (LOBYTE(v16->uFontHeight) - 3);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
86 Stra = strtok(0, "\n");
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
87 if ( !Stra )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
88 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
89 v14 = Stra;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
90 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
91 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
92 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
93 // 5C6DB4: using guessed type int ui_current_text_color;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
94
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
95
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
96 //----- (0044D1E7) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
97 void GUIFont::DrawTextLine(unsigned int uDefaultColor, signed int uX, signed int uY, const char *Str, int a6)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
98 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
99 size_t v6; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
100 GUIFont *v7; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
101 signed int v8; // edi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
102 unsigned __int8 v9; // cl@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
103 int v10; // eax@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
104 int v11; // ecx@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
105 int v12; // ecx@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
106 int v13; // ecx@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
107 int v14; // ecx@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
108 unsigned int v15; // edx@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
109 unsigned __int16 v16; // cx@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
110 unsigned __int8 *v17; // eax@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
111 char Dest; // [sp+Ch] [bp-1Ch]@16
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
112 char v19; // [sp+11h] [bp-17h]@16
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
113 size_t v20; // [sp+20h] [bp-8h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
114 int v21; // [sp+24h] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
115 int uXa; // [sp+30h] [bp+8h]@9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
116
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
117 v6 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
118 v21 = uDefaultColor;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
119 v7 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
120 if ( Str )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
121 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
122 v21 = ui_current_text_color;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
123 v20 = strlen(Str);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
124 if ( (signed int)v20 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
125 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
126 v8 = uX;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
127 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
128 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
129 if ( v7->IsCharValid(v9 = Str[v6]) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
130 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
131 v10 = v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
132 v11 = v9 - 9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
133 if ( v11 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
134 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
135 v12 = v11 - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
136 if ( !v12 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
137 return;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
138 v13 = v12 - 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
139 if ( v13 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
140 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
141 if ( v13 != 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
142 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
143 v14 = 3 * v10 + 9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
144 v15 = *((int *)&v7->cFirstChar + v14);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
145 uXa = *((int *)&v7->cFirstChar + v14);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
146 if ( v15 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
147 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
148 if ( (signed int)v6 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
149 v8 += v7->pMetrics[v10].uLeftSpacing;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
150 v16 = v21;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
151 v17 = (unsigned __int8 *)((char *)&v7[1] + v7->field_C20[v10]);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
152 if ( !v21 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
153 v16 = -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
154 pRenderer->DrawText(v8, uY, v17, v15, LOBYTE(v7->uFontHeight), v7->pFontPalettes[0], v16, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
155 v8 += uXa;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
156 if ( (signed int)v6 < (signed int)v20 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
157 v8 += v7->pMetrics[(unsigned __int8)Str[v6]].uRightSpacing;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
158 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
159 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
160 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
161 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
162 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
163 strncpy(&Dest, &Str[v6 + 1], 5u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
164 v19 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
165 v21 = atoi(&Dest);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
166 ui_current_text_color = v21;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
167 v6 += 5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
168 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
169 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
170 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
171 ++v6;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
172 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
173 while ( (signed int)v6 < (signed int)v20 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
174 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
175 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
176 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
177 // 5C6DB4: using guessed type int ui_current_text_color;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
178
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
179
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
180 //----- (0044D0B5) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
181 void GUIFont::_44D0B5(int a2, int a3, int a4, const char *pString, int a6)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
182 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
183 int v6; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
184 GUIFont *v7; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
185 int v8; // edi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
186 unsigned __int8 v9; // cl@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
187 int v10; // eax@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
188 int v11; // ecx@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
189 int v12; // ecx@6
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
190 int v13; // ecx@7
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
191 int v14; // ecx@8
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
192 int v15; // ebx@10
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
193 int v16; // edx@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
194 __int16 v17; // ax@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
195 char Dest; // [sp+Ch] [bp-20h]@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
196 char v19; // [sp+11h] [bp-1Bh]@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
197 size_t v20; // [sp+20h] [bp-Ch]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
198 int v21; // [sp+24h] [bp-8h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
199 int v22; // [sp+28h] [bp-4h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
200 const char *v23; // [sp+38h] [bp+Ch]@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
201
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
202 v6 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
203 v21 = a2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
204 v7 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
205 if ( pString )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
206 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
207 v21 = ui_current_text_color;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
208 v20 = strlen(pString);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
209 v22 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
210 if ( (signed int)v20 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
211 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
212 v8 = a4;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
213 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
214 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
215 v23 = &pString[v6];
3
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
216 if ( v7->IsCharValid(v9 = pString[v6]) )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
217 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
218 v10 = v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
219 v11 = v9 - 9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
220 if ( v11 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
221 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
222 v12 = v11 - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
223 if ( !v12 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
224 return;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
225 v13 = v12 - 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
226 if ( v13 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
227 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
228 v14 = v13 - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
229 if ( v14 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
230 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
231 if ( v14 != 82 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
232 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
233 v15 = *((int *)&v7->cFirstChar + 3 * v10 + 9);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
234 if ( v15 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
235 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
236 if ( v22 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
237 v8 += 2 * v7->pMetrics[v10].uLeftSpacing;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
238 v16 = (int)((char *)&v7[1] + v7->field_C20[v10]);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
239 v17 = v21;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
240 if ( !v21 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
241 v17 = -1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
242 sub_40F845(v8, v16, v15, LOBYTE(v7->uFontHeight), (int)v7->pFontPalettes[0], v17, 2 * a6);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
243 v8 += 2 * v15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
244 if ( v22 < (signed int)v20 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
245 v8 += 2 * v7->pMetrics[(unsigned __int8)*v23].uRightSpacing;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
246 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
247 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
248 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
249 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
250 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
251 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
252 strncpy(&Dest, &pString[v6 + 1], 5u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
253 v19 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
254 v21 = atoi(&Dest);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
255 ui_current_text_color = v21;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
256 v22 = v6 + 5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
257 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
258 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
259 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
260 v6 = v22++ + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
261 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
262 while ( v22 < (signed int)v20 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
263 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
264 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
265 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
266 // 5C6DB4: using guessed type int ui_current_text_color;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
267
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
268
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
269 //----- (0044C933) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
270 char *__fastcall GUIFont::_44C933(const char *pString, GUIFont *pFont, GUIFont *a3, int a4, int a5, int a6)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
271 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
272 const char *v6; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
273 size_t v8; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
274 size_t v9; // edi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
275 int v10; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
276 GUIFont *v11; // esi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
277 int v12; // ebx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
278 char v13; // cl@5
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
279 int v14; // edx@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
280 int v15; // ecx@11
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
281 int v16; // edx@12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
282 int v17; // edx@13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
283 int v18; // edx@14
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
284 int v19; // edx@15
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
285 int v20; // edi@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
286 int v21; // edx@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
287 int v22; // ecx@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
288 int v23; // edi@18
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
289 char v24; // zf@18
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
290 int v25; // ecx@19
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
291 int v26; // eax@19
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
292 char v27; // dl@24
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
293 int v28; // eax@46
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
294 std::string v29; // [sp-18h] [bp-48h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
295 const char *v30; // [sp-8h] [bp-38h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
296 int v31; // [sp-4h] [bp-34h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
297 const char *v32; // [sp+Ch] [bp-24h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
298 char Str; // [sp+10h] [bp-20h]@46
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
299 char v34; // [sp+13h] [bp-1Dh]@46
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
300 GUIFont *v35; // [sp+14h] [bp-1Ch]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
301 int v36; // [sp+18h] [bp-18h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
302 int v37; // [sp+1Ch] [bp-14h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
303 int v38; // [sp+20h] [bp-10h]@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
304 int v39; // [sp+24h] [bp-Ch]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
305 int v40; // [sp+28h] [bp-8h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
306 int i; // [sp+2Ch] [bp-4h]@17
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
307 std::string *v42; // [sp+38h] [bp+8h]@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
308
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
309 v6 = pString;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
310 v35 = pFont;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
311 v32 = pString;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
312 if ( !pString )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
313 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
314 MessageBoxW(nullptr, L"Invalid string passed !", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Font.cpp:558", 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
315 return 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
316 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
317 v8 = strlen(pString);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
318 v9 = v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
319 v39 = v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
320 strcpy(pTmpBuf3, v6);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
321 v10 = a5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
322 v11 = v35;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
323 v12 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
324 v40 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
325 v37 = a5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
326 v36 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
327 if ( (signed int)v9 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
328 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
329 v38 = v9 - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
330 do
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
331 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
332 v13 = pTmpBuf3[v12];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
333 if ( (unsigned __int8)v13 >= v11->cFirstChar && (unsigned __int8)v13 <= v11->cLastChar
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
334 || v13 == '\f'
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
335 || v13 == '\r'
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
336 || v13 == '\t'
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
337 || v13 == '\n' )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
338 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
339 v14 = (unsigned __int8)v13 - 9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
340 v15 = (int)&v11->pMetrics[(unsigned __int8)v13];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
341 if ( v14 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
342 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
343 v16 = v14 - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
344 if ( v16 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
345 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
346 v17 = v16 - 2;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
347 if ( v17 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
348 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
349 v18 = v17 - 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
350 if ( v18 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
351 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
352 v19 = v18 - 19;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
353 if ( v19 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
354 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
355 if ( v19 == 63 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
356 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
357 v11 = a3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
358 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
359 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
360 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
361 v20 = *(int *)(v15 + 8);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
362 v21 = *(int *)(v15 + 4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
363 v22 = *(int *)v15;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
364 i = v20;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
365 if ( (unsigned int)(v10 + v20 + v22 + v21) < *(int *)(a4 + 8) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
366 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
367 v12 = v36;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
368 if ( v36 > v40 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
369 v10 += v22;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
370 v10 += v21;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
371 if ( v36 < v39 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
372 v10 += i;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
373 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
374 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
375 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
376 v23 = v40;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
377 v24 = v11 == a3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
378 pTmpBuf3[v40] = 10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
379 if ( v24 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
380 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
381 v25 = v38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
382 v26 = v23 + 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
383 while ( v25 >= v26 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
384 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
385 pTmpBuf3[v25] = byte_5C45AF[v25];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
386 --v25;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
387 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
388 ++v39;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
389 ++v38;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
390 pTmpBuf3[v23++ + 1] = 95;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
391 v40 = v26;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
392 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
393 v12 = v36;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
394 v10 = v37;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
395 for ( i = v23; i <= v36; ++i )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
396 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
397 v27 = pTmpBuf3[i];
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
398 if ( (unsigned __int8)v27 >= v11->cFirstChar && (unsigned __int8)v27 <= v11->cLastChar
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
399 || v27 == 12
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
400 || v27 == 13
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
401 || v27 == 9
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
402 || v27 == 10 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
403 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
404 if ( i > v23 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
405 v10 += v11->pMetrics[(unsigned __int8)v27].uLeftSpacing;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
406 v10 += *((int *)&v11->cFirstChar + 3 * (unsigned __int8)v27 + 9);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
407 if ( i < v36 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
408 v10 += v11->pMetrics[(unsigned __int8)v27].uRightSpacing;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
409 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
410 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
411 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
412 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
413 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
414 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
415 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
416 v10 += *(int *)(v15 + 4);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
417 v40 = v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
418 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
419 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
420 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
421 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
422 if ( !a6 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
423 return (char *)v32;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
424 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
425 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
426 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
427 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
428 v12 += 5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
429 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
430 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
431 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
432 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
433 v10 = v37;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
434 v11 = v35;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
435 v40 = v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
436 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
437 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
438 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
439 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
440 strncpy(&Str, &pTmpBuf3[v12 + 1], 3u);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
441 v34 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
442 v28 = atoi(&Str);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
443 v10 = a5 + v28;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
444 v12 += 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
445 v37 = v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
446 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
447 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
448 ++v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
449 v36 = v12;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
450 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
451 while ( v12 < v39 );
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
452 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
453 return pTmpBuf3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
454 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
455
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
456
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
457 //----- (0044C6C2) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
458 int GUIFont::_44C6C2(const char *pInString, GUIWindow *pWindow, unsigned int uX, int a5)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
459 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
460 const char *v5; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
461 int v6; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
462 unsigned __int8 *v8; // ebx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
463 size_t v9; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
464 signed int v10; // esi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
465 int v11; // edx@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
466 unsigned __int8 v12; // cl@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
467 GUIFont *v13; // [sp+Ch] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
468 size_t uXa; // [sp+1Ch] [bp+Ch]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
469
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
470 auto pFont = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
471 v5 = pInString;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
472 v6 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
473 v13 = pFont;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
474 if ( !pInString )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
475 return 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
476 v8 = (unsigned __int8 *)FitTextInAWindow(pInString, pFont, pWindow, uX, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
477 v9 = strlen(v5);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
478 v10 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
479 uXa = v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
480 if ( (signed int)v9 > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
481 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
482 while ( !IsCharValid(*v8) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
483 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
484 LABEL_11:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
485 ++v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
486 ++v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
487 if ( v10 >= (signed int)uXa )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
488 return (int)v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
489 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
490 if ( v12 != 9 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
491 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
492 if ( v12 == 10 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
493 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
494 v6 = v6 + *(char *)(v11 + 5) - 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
495 if ( v6 >= (signed int)(a5 * pWindow->uFrameHeight) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
496 return (int)(v8 + 1);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
497 goto LABEL_10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
498 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
499 if ( v12 == 12 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
500 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
501 v8 += 5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
502 v10 += 5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
503 LABEL_10:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
504 if ( v6 >= (signed int)(a5 * pWindow->uFrameHeight) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
505 return (int)v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
506 goto LABEL_11;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
507 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
508 if ( v12 != 13 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
509 goto LABEL_10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
510 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
511 v8 += 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
512 v10 += 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
513 goto LABEL_10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
514 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
515 return (int)v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
516 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
517
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
518
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
519
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
520 //----- (0044C62E) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
521 int GUIFont::GetStringHeight2(GUIFont *a2, const char *Str, int a4, int a5, int a6)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
522 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
523 GUIFont *v6; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
524 int v8; // esi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
525 unsigned __int8 *v9; // ebx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
526 size_t v10; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
527 unsigned __int8 v11; // cl@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
528 signed int Stra; // [sp+Ch] [bp+8h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
529 size_t v13; // [sp+14h] [bp+10h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
530
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
531 auto a1 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
532 v6 = a1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
533 if ( !Str )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
534 return 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
535 v8 = LOBYTE(a1->uFontHeight) - 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
536 v9 = (unsigned __int8 *)GUIFont::_44C933(Str, a1, a2, a4, a5, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
537 v10 = strlen(Str);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
538 Stra = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
539 v13 = v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
540 while ( Stra < (signed int)v13 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
541 {
3
540178ef9b18 Main menu functionality
Nomad
parents: 0
diff changeset
542 if ( GUIFont::IsCharValid(v11 = *v9) )
0
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
543 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
544 if ( v11 == 9 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
545 goto LABEL_9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
546 switch ( v11 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
547 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
548 case 0xAu:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
549 v8 = v8 + LOBYTE(v6->uFontHeight) - 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
550 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
551 case 0xCu:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
552 v9 += 5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
553 Stra += 5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
554 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
555 case 0xDu:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
556 LABEL_9:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
557 if ( a6 != 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
558 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
559 v9 += 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
560 Stra += 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
561 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
562 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
563 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
564 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
565 ++Stra;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
566 ++v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
567 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
568 return v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
569 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
570
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
571 //----- (0044C59D) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
572 int GUIFont::CalcTextHeight(const char *pString, GUIWindow *pWindow, int a4, int a5)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
573 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
574 const char *v5; // ebx@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
575 GUIFont *v6; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
576 int v8; // esi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
577 size_t v9; // eax@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
578 signed int v10; // ebx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
579 unsigned __int8 v11; // cl@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
580 size_t pWindowa; // [sp+10h] [bp+8h]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
581 unsigned __int8 *uX; // [sp+14h] [bp+Ch]@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
582
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
583 v5 = pString;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
584 v6 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
585 if ( !pString )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
586 return 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
587 v8 = LOBYTE(this->uFontHeight) - 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
588 uX = (unsigned __int8 *)FitTextInAWindow(pString, this, pWindow, a4, 0);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
589 v9 = strlen(v5);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
590 v10 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
591 pWindowa = v9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
592 while ( v10 < (signed int)pWindowa )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
593 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
594 if ( v6->IsCharValid(v11 = *uX) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
595 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
596 if ( v11 == 9 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
597 goto LABEL_9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
598 switch ( v11 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
599 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
600 case 0xAu:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
601 v8 = v8 + LOBYTE(v6->uFontHeight) - 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
602 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
603 case 0xCu:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
604 uX += 5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
605 v10 += 5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
606 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
607 case 0xDu:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
608 LABEL_9:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
609 if ( a5 != 1 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
610 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
611 uX += 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
612 v10 += 3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
613 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
614 break;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
615 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
616 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
617 ++v10;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
618 ++uX;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
619 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
620 return v8;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
621 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
622
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
623
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
624 //----- (0044C51E) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
625 int GUIFont::GetLineWidth(const char *pString)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
626 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
627 GUIFont *v2; // edi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
628 size_t v4; // ebp@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
629 int v5; // esi@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
630 signed int i; // ebx@3
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
631 unsigned __int8 v7; // cl@4
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
632 const char *v8; // [sp+0h] [bp-4h]@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
633
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
634 v8 = pString;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
635 v2 = this;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
636 if ( !pString )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
637 return 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
638 v4 = strlen(pString);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
639 v5 = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
640 for ( i = 0; i < (signed int)v4; ++i )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
641 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
642 if ( IsCharValid(v7 = v8[i]) )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
643 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
644 if ( v7 < 9u )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
645 goto LABEL_9;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
646 if ( v7 <= 0xAu )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
647 return v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
648 if ( v7 != '\f' )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
649 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
650 if ( v7 == '\r' )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
651 return v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
652 LABEL_9:
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
653 if ( i > 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
654 v5 += v2->pMetrics[v7].uLeftSpacing;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
655 v5 += *((int *)&v2->cFirstChar + 3 * v7 + 9);
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
656 if ( i < (signed int)v4 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
657 v5 += v2->pMetrics[v7].uRightSpacing;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
658 continue;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
659 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
660 i += 5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
661 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
662 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
663 return v5;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
664 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
665
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
666
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
667
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
668
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
669 //----- (0044C502) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
670 int GUIFont::AlignText_Center(unsigned int uCenterX, const char *pString)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
671 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
672 signed int v3; // esi@1
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
673 signed int result; // eax@2
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
674
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
675 v3 = (signed int)(uCenterX - GetLineWidth(pString)) >> 1;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
676 if ( v3 >= 0 )
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
677 result = v3;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
678 else
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
679 result = 0;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
680 return result;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
681 }
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
682
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
683
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
684 //----- (0044C4DE) --------------------------------------------------------
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
685 bool GUIFont::IsCharValid(char _c)
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
686 {
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
687 unsigned char c = _c;
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
688 return c >= cFirstChar && c <= cLastChar || c == '\f' || c == '\r' || c == '\t' || c == '\n';
8b8875f5b359 Initial commit
Nomad
parents:
diff changeset
689 }