Mercurial > mm7
annotate PaletteManager.cpp @ 2335:6e3ca612f132
int -> uint
author | Ritor1 |
---|---|
date | Wed, 02 Apr 2014 22:05:35 +0600 |
parents | ddb803517a48 |
children | d6887ee81068 |
rev | line source |
---|---|
2253
aff7a7b072b7
adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents:
2153
diff
changeset
|
1 #define _CRT_SECURE_NO_WARNINGS |
0 | 2 #include "PaletteManager.h" |
3 #include "Texture.h" | |
4 #include "Game.h" | |
5 #include "LOD.h" | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
6 #include "Log.h" |
0 | 7 |
8 #include "mm7_data.h" | |
9 | |
10 | |
11 | |
12 | |
13 PaletteManager *pPaletteManager = new PaletteManager; | |
14 | |
15 | |
16 | |
2152 | 17 //----- (00452AE2) -------------------------------------------------------- |
18 int __fastcall MakeColorMaskFromBitDepth(int a1) | |
19 { | |
20 signed __int64 v1; // qax@1 | |
21 | |
22 v1 = 4294967296i64; | |
23 if ( a1 > 0 ) | |
24 { | |
25 do | |
26 { | |
27 LODWORD(v1) = HIDWORD(v1) + v1; | |
28 HIDWORD(v1) *= 2; | |
29 --a1; | |
30 } | |
31 while ( a1 ); | |
32 } | |
33 return v1; | |
34 } | |
0 | 35 |
36 //----- (0048A643) -------------------------------------------------------- | |
37 bool __fastcall HSV2RGB(float *a1, float *a2, float *a3, float a4, float a5, float a6) | |
38 { | |
39 float *v6; // ebx@1 | |
40 float *v7; // edi@1 | |
41 float *v8; // esi@1 | |
42 double v9; // st7@5 | |
43 signed __int64 v10; // qax@5 | |
44 double v11; // st7@5 | |
45 double v12; // st5@5 | |
46 int v13; // eax@6 | |
47 int v14; // eax@7 | |
48 int v15; // eax@8 | |
49 int v16; // eax@9 | |
50 float v17; // eax@11 | |
51 float a3a; // [sp+1Ch] [bp+8h]@14 | |
52 float a4b; // [sp+20h] [bp+Ch]@5 | |
53 float a4c; // [sp+20h] [bp+Ch]@5 | |
54 float a4a; // [sp+20h] [bp+Ch]@5 | |
55 | |
56 v6 = a3; | |
57 v7 = a2; | |
58 v8 = a1; | |
59 if ( a5 == 0.0 ) | |
60 { | |
61 *a3 = a6; | |
62 *a2 = a6; | |
63 *a1 = a6; | |
64 goto LABEL_20; | |
65 } | |
66 if ( a4 == 360.0 ) | |
67 a4 = 0.0; | |
68 v9 = a4 * 0.01666666666666667; | |
69 a4b = v9; | |
70 floor(v9); | |
71 v10 = (signed __int64)v9; | |
72 a4c = a4b - (double)(signed int)(signed __int64)v9; | |
73 v11 = (1.0 - a5) * a6; | |
74 v12 = (1.0 - a4c * a5) * a6; | |
75 a4a = (1.0 - (1.0 - a4c) * a5) * a6; | |
76 if ( (int)v10 ) | |
77 { | |
78 v13 = v10 - 1; | |
79 if ( v13 ) | |
80 { | |
81 v14 = v13 - 1; | |
82 if ( v14 ) | |
83 { | |
84 v15 = v14 - 1; | |
85 if ( v15 ) | |
86 { | |
87 v16 = v15 - 1; | |
88 if ( v16 ) | |
89 { | |
90 if ( v16 != 1 ) | |
91 goto LABEL_20; | |
92 *v8 = a6; | |
93 v17 = v12; | |
94 *v7 = v11; | |
95 goto LABEL_12; | |
96 } | |
97 *(int *)v8 = LODWORD(a4a); | |
98 *v7 = v11; | |
99 } | |
100 else | |
101 { | |
102 *v8 = v11; | |
103 a3a = v12; | |
104 *(int *)v7 = LODWORD(a3a); | |
105 } | |
106 v17 = a6; | |
107 } | |
108 else | |
109 { | |
110 *v8 = v11; | |
111 *(int *)v7 = LODWORD(a6); | |
112 v17 = a4a; | |
113 } | |
114 LABEL_12: | |
115 *(int *)v6 = LODWORD(v17); | |
116 goto LABEL_20; | |
117 } | |
118 *v8 = v12; | |
119 *v7 = a6; | |
120 } | |
121 else | |
122 { | |
123 *v8 = a6; | |
124 *(int *)v7 = LODWORD(a4a); | |
125 } | |
126 *a3 = v11; | |
127 LABEL_20: | |
128 if ( *v8 > 1.0 ) | |
129 *v8 = 1.0; | |
130 if ( *v7 > 1.0 ) | |
131 *v7 = 1.0; | |
132 if ( *v6 > 1.0 ) | |
133 *v6 = 1.0; | |
134 if ( *v8 < 0.0 ) | |
135 *v8 = 0.0; | |
136 if ( *v7 < 0.0 ) | |
137 *v7 = 0.0; | |
138 if ( *v6 < 0.0 ) | |
139 *v6 = 0.0; | |
140 return 1; | |
141 } | |
142 | |
143 //----- (0048A7AA) -------------------------------------------------------- | |
144 void __fastcall RGB2HSV(float *a1, float *a2, float a3, float a4, float a5, float *a6) | |
145 { | |
146 double v6; // st7@2 | |
147 double v7; // st6@7 | |
148 double v8; // st5@12 | |
149 double v9; // st7@15 | |
150 double v10; // st7@17 | |
2334 | 151 // double v11; // st7@21 |
152 // __int16 v12; // fps@21 | |
153 // unsigned __int8 v13; // c0@21 | |
154 // unsigned __int8 v14; // c2@21 | |
0 | 155 float a6a; // [sp+14h] [bp+14h]@16 |
156 | |
157 if ( a3 <= (double)a4 ) | |
158 v6 = a4; | |
159 else | |
160 v6 = a3; | |
161 if ( v6 < a5 ) | |
162 v6 = a5; | |
163 if ( a3 <= (double)a4 ) | |
164 v7 = a3; | |
165 else | |
166 v7 = a4; | |
167 if ( v7 > a5 ) | |
168 v7 = a5; | |
169 *a6 = v6; | |
170 if ( v6 == 0.0 ) | |
171 v8 = 0.0; | |
172 else | |
173 v8 = (v6 - v7) / v6; | |
174 *a2 = v8; | |
175 if ( v8 == 0.0 ) | |
176 { | |
177 v9 = 0.0; | |
2334 | 178 //LABEL_23: |
0 | 179 *a1 = v9; |
180 return; | |
181 } | |
182 a6a = v6 - v7; | |
183 if ( a3 == v6 ) | |
184 { | |
185 v10 = (a4 - a5) / a6a; | |
186 } | |
187 else | |
188 { | |
189 if ( a4 == v6 ) | |
190 v10 = (a5 - a3) / a6a + 2.0; | |
191 else | |
192 v10 = (a3 - a4) / a6a + 4.0; | |
193 } | |
194 //*a1 = v10; | |
195 //v11 = *a1 * 60.0; | |
196 //UNDEF(v12); | |
197 *a1 = v10 * 60.0; | |
198 if (*a1 < 0) | |
199 { | |
200 *a1 += 360.0; | |
201 } | |
202 } | |
203 | |
204 | |
205 | |
206 //----- (0048A8A3) -------------------------------------------------------- | |
207 int PaletteManager::LockAll() | |
208 { | |
209 int *v1; // edx@1 | |
210 signed int v2; // eax@1 | |
211 | |
212 v1 = &this->pPaletteIDs[1]; | |
213 v2 = 1; | |
214 do | |
215 { | |
216 if ( *v1 ) | |
217 this->_num_locked = v2 + 1; | |
218 ++v2; | |
219 ++v1; | |
220 } | |
221 while ( v2 < 50 ); | |
222 return this->_num_locked; | |
223 } | |
224 | |
225 //----- (0048A8CC) -------------------------------------------------------- | |
226 int PaletteManager::LockTestAll() | |
227 { | |
228 char *v1; // edx@1 | |
229 signed int v2; // eax@1 | |
230 | |
231 v1 = (char *)&this->pPaletteIDs[1]; | |
232 v2 = 1; | |
233 do | |
234 { | |
235 if ( *(int *)v1 ) | |
236 this->_pal_lock_test = v2 + 1; | |
237 ++v2; | |
238 v1 += 4; | |
239 } | |
240 while ( v2 < 50 ); | |
241 return this->_pal_lock_test; | |
242 } | |
243 | |
244 | |
245 //----- (0048A8F5) -------------------------------------------------------- | |
246 void PaletteManager::SetColorChannelInfo(int uNumRBits, int uNumGBits, int uNumBBits) | |
247 { | |
248 PaletteManager *v4; // esi@1 | |
249 int v5; // edi@1 | |
250 int v6; // eax@1 | |
251 int v7; // ebx@1 | |
252 | |
253 v4 = this; | |
254 this->uNumTargetRBits = uNumRBits; | |
255 this->uNumTargetGBits = uNumGBits; | |
256 v5 = this->uNumTargetGBits; | |
257 this->uNumTargetBBits = uNumBBits; | |
258 v6 = MakeColorMaskFromBitDepth(uNumRBits); | |
259 v7 = v4->uNumTargetBBits; | |
260 v4->uTargetRMask = v6 << (v5 + v4->uNumTargetBBits); | |
261 v4->uTargetGMask = MakeColorMaskFromBitDepth(v5) << v7; | |
262 v4->uTargetBMask = MakeColorMaskFromBitDepth(v7); | |
263 } | |
264 | |
265 | |
266 //----- (00489BE0) -------------------------------------------------------- | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
267 void PaletteManager::CalcPalettes_LUT(int a2) |
0 | 268 { |
269 PaletteManager *v2; // esi@1 | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
270 //char *v3; // edi@1 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
271 //signed int v4; // ebx@4 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
272 //float v5; // ST08_4@5 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
273 //float v6; // ST04_4@5 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
274 //float v7; // ST00_4@5 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
275 //int v8; // eax@7 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
276 //float *v9; // edx@8 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
277 //float *v10; // ST0C_4@8 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
278 //float *v11; // ecx@8 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
279 //int v12; // ebx@8 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
280 //int v13; // eax@8 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
281 //float v14; // ebx@8 |
2334 | 282 // float v15; // ST08_4@8 |
283 // float v16; // ST04_4@8 | |
284 // float v17; // ST00_4@8 | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
285 //unsigned __int8 v18; // sf@8 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
286 //unsigned __int8 v19; // of@8 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
287 //int v20; // eax@10 |
0 | 288 double v21; // st5@11 |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
289 //float v22; // ST0C_4@13 |
0 | 290 unsigned int v23; // eax@13 |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
291 //__int16 v24; // bx@16 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
292 //int v25; // eax@16 |
0 | 293 double v26; // st7@20 |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
294 //float v27; // ST0C_4@22 |
0 | 295 unsigned int v28; // eax@22 |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
296 //__int16 v29; // bx@25 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
297 //__int16 *v30; // eax@25 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
298 //int v31; // eax@27 |
0 | 299 double v32; // st5@28 |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
300 //float v33; // ST0C_4@30 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
301 //float v34; // ST08_4@30 |
0 | 302 unsigned int v35; // ebx@30 |
303 signed __int64 v36; // qax@33 | |
304 signed int v37; // edx@33 | |
305 char v38; // cl@33 | |
306 unsigned int v39; // ebx@33 | |
307 signed int v40; // edi@33 | |
308 unsigned int v41; // ecx@33 | |
309 unsigned int v42; // ecx@35 | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
310 //int v43; // eax@39 |
0 | 311 signed int v44; // edx@39 |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
312 //unsigned __int8 v45; // al@40 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
313 //double v46; // st6@43 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
314 //signed int v47; // eax@43 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
315 //int v48; // eax@45 |
0 | 316 double v49; // st6@47 |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
317 //float v50; // ST08_4@49 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
318 //unsigned int v51; // ebx@49 |
0 | 319 int v52; // edi@55 |
320 int v53; // ebx@55 | |
321 signed __int64 v54; // qax@55 | |
322 double v55; // st7@56 | |
323 unsigned int v56; // ecx@57 | |
324 unsigned int v57; // ecx@59 | |
325 //int v58; // edx@61 | |
326 unsigned int v59; // ecx@61 | |
327 unsigned int v60; // eax@63 | |
328 char v61; // cl@63 | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
329 //int result; // eax@63 |
0 | 330 float v63[256]; // [sp+1Ch] [bp-C38h]@5 |
331 float v64[256]; // [sp+41Ch] [bp-838h]@5 | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
332 float a6[256]; // [sp+81Ch] [bp-438h]@5 |
2334 | 333 // int v66; // [sp+C1Ch] [bp-38h]@43 |
0 | 334 float v67; // [sp+C20h] [bp-34h]@43 |
335 float v68; // [sp+C24h] [bp-30h]@43 | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
336 //PaletteManager *v69; // [sp+C28h] [bp-2Ch]@9 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
337 //float v70; // [sp+C2Ch] [bp-28h]@43 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
338 //double v71; // [sp+C30h] [bp-24h]@10 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
339 //int v72; // [sp+C38h] [bp-1Ch]@9 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
340 //int v73; // [sp+C3Ch] [bp-18h]@9 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
341 //int i; // [sp+C40h] [bp-14h]@7 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
342 //float v75; // [sp+C44h] [bp-10h]@5 |
0 | 343 float a2a; // [sp+C48h] [bp-Ch]@13 |
344 float a1; // [sp+C4Ch] [bp-8h]@13 | |
345 float a3; // [sp+C50h] [bp-4h]@13 | |
346 signed int v79; // [sp+C5Ch] [bp+8h]@33 | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
347 //signed int v80; // [sp+C5Ch] [bp+8h]@43 |
0 | 348 int v81; // [sp+C5Ch] [bp+8h]@57 |
349 | |
350 v2 = this; | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
351 //v3 = (char *)pBaseColors[a2]; |
0 | 352 if (pPalette_tintColor[0] || pPalette_tintColor[1] || pPalette_tintColor[2]) |
353 { | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
354 //v8 = 0; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
355 //i = 0; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
356 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
357 for (uint i = 0; i < 256; ++i) |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
358 RGB2HSV(&v64[i], &v63[i], (pBaseColors[a2][i][0] + pPalette_tintColor[0]) / (255.0f + 255.0f), |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
359 (pBaseColors[a2][i][1] + pPalette_tintColor[1]) / (255.0f + 255.0f), |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
360 (pBaseColors[a2][i][2] + pPalette_tintColor[2]) / (255.0f + 255.0f), &a6[i]); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
361 //do |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
362 //{ |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
363 //v9 = (float *)((char *)v63 + v8); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
364 //v10 = (float *)((char *)a6 + v8); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
365 //v11 = (float *)((char *)v64 + v8); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
366 //v12 = pPalette_tintColor[1]; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
367 //LODWORD(v75) = pPalette_tintColor[2] + (unsigned __int8)v3[2]; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
368 //v13 = pPalette_tintColor[1] + (unsigned __int8)v3[1]; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
369 //LODWORD(v14) = (unsigned __int8)*v3; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
370 //v15 = (double)((unsigned __int8)v3[2] + pPalette_tintColor[2]) / (2.0f * 255.0f); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
371 //LODWORD(v75) = v13; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
372 //LODWORD(v75) = (unsigned __int8)*v3 + pPalette_tintColor[0]; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
373 //v16 = (double)((unsigned __int8)v3[1] + pPalette_tintColor[1]) / 510.0f; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
374 //v17 = (double)((unsigned __int8)*v3 + pPalette_tintColor[0]) / 510.0f; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
375 //RGB2HSV(&v64[i], &v63[i], v17, v16, v15, &a6[i]); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
376 //v3 += 3; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
377 //v8 = i + 4; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
378 //v19 = __OFSUB__(i + 4, 1024); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
379 //v18 = i - 1020 < 0; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
380 //i += 4; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
381 //} |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
382 //while ( i < ); |
0 | 383 } |
384 else | |
385 { | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
386 for (uint i = 0; i < 256; ++i) |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
387 RGB2HSV(&v64[i], &v63[i], pBaseColors[a2][i][0] / 255.0f, |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
388 pBaseColors[a2][i][1] / 255.0f, |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
389 pBaseColors[a2][i][2] / 255.0f, &a6[i]); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
390 /*v4 = 0; |
0 | 391 do |
392 { | |
393 LODWORD(v75) = (unsigned __int8)v3[2]; | |
394 v5 = (double)SLODWORD(v75) * 0.00392156862745098; | |
395 LODWORD(v75) = (unsigned __int8)v3[1]; | |
396 v6 = (double)SLODWORD(v75) * 0.00392156862745098; | |
397 LODWORD(v75) = (unsigned __int8)*v3; | |
398 v7 = (double)SLODWORD(v75) * 0.00392156862745098; | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
399 RGB2HSV(&v64[v4], &v63[v4], v7, v6, v5, &a6[v4]); |
0 | 400 ++v4; |
401 v3 += 3; | |
402 } | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
403 while ( v4 < 256 );*/ |
0 | 404 } |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
405 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
406 //v69 = (PaletteManager *)((char *)v2 + 16384 * a2); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
407 //v72 = 0; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
408 //v73 = (int)pPalette1[a2]; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
409 for (uint i = 0; i < 32; ++i) |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
410 //do |
0 | 411 { |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
412 //v20 = 0; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
413 //i = 0; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
414 //v71 = 1.0 - (double)v72 / 31.0f; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
415 //do |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
416 for (uint j = 0; j < 256; ++j) |
0 | 417 { |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
418 v21 = a6[j] * (1.0f - i / 32.0f); |
0 | 419 if ( v21 < 0.0 ) |
420 v21 = 0.0; | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
421 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
422 //v22 = v21; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
423 HSV2RGB(&a1, &a2a, &a3, v64[j], v63[j], v21); |
0 | 424 v23 = v2->uNumTargetGBits; |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
425 if ( v23 == 6 ) // r5g6b5 |
0 | 426 { |
427 a1 = a1 * 31.0; | |
428 a2a = a2a * 62.0; | |
429 a3 = a3 * 31.0; | |
430 } | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
431 else if (v23 == 5) // r5g5b5 |
0 | 432 { |
433 a1 = a1 * 31.0; | |
434 a2a = a2a * 31.0; | |
435 a3 = a3 * 31.0; | |
436 } | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
437 else if (v23 == 0) |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
438 Log::Warning(L"Calling palette manager with num_target_bits == 0"); |
1545 | 439 else Error("(%u)", v23); |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
440 //v24 = (unsigned __int32)a3 | ((unsigned __int32)a2a << v2->uNumTargetBBits) | ((unsigned __int32)a1 << (v2->uNumTargetBBits + v2->uNumTargetGBits)); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
441 //v25 = v73; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
442 //v73 += 2; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
443 //*(short *)v25 = v24; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
444 pPalette1[a2][i][j] = (unsigned __int32)a3 | |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
445 ((unsigned __int32)a2a << v2->uNumTargetBBits) | |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
446 ((unsigned __int32)a1 << (v2->uNumTargetBBits + v2->uNumTargetGBits)); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
447 //v20 = i + 4; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
448 //v19 = __OFSUB__(i + 4, 1024); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
449 //v18 = i - 1020 < 0; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
450 //i += 4; |
0 | 451 } |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
452 //while ( v18 ^ v19 ); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
453 //++v72; |
0 | 454 } |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
455 //while ( v72 < 32 ); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
456 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
457 //v72 = 0; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
458 //v73 = (int)v69->field_199600_palettes; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
459 //do |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
460 for (uint i = 0; i < 32; ++i) |
0 | 461 { |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
462 //i = 0; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
463 //v71 = 1.0 - (double)v72 / 31.0f; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
464 //do |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
465 for (uint j = 0; j < 256; ++j) |
0 | 466 { |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
467 v26 = a6[j] * (1.0 - i / 31.0f); |
0 | 468 if ( v26 < 0.0 ) |
469 v26 = 0.0; | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
470 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
471 //v27 = v26; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
472 HSV2RGB(&a1, &a2a, &a3, 1.0, 1.0, v26); |
0 | 473 v28 = v2->uNumTargetGBits; |
474 if ( v28 == 6 ) | |
475 { | |
476 a1 = a1 * 31.0; | |
477 a2a = a2a * 62.0; | |
478 a3 = a3 * 31.0; | |
479 } | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
480 else if (v28 == 5) |
0 | 481 { |
482 a1 = a1 * 31.0; | |
483 a2a = a2a * 31.0; | |
484 a3 = a3 * 31.0; | |
485 } | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
486 else if (v23 == 0) |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
487 Log::Warning(L"Calling palette manager with num_target_bits == 0"); |
1545 | 488 else Error("(%u)", v23); |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
489 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
490 //v29 = (unsigned __int64)(signed __int64)a3 | ((unsigned __int16)(signed __int64)a2a << v2->uNumTargetBBits) | (unsigned __int16)((unsigned __int16)(signed __int64)a1 << (v2->uNumTargetBBits + v28)); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
491 //v30 = (__int16 *)v73; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
492 //++i; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
493 //v73 += 2; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
494 //v19 = __OFSUB__(i, 256); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
495 //v18 = i - 256 < 0; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
496 //*v30 = v29; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
497 field_199600_palettes[a2][i][j] = (unsigned __int64)(signed __int64)a3 | ((unsigned __int16)(signed __int64)a2a << v2->uNumTargetBBits) | (unsigned __int16)((unsigned __int16)(signed __int64)a1 << (v2->uNumTargetBBits + v28)); |
0 | 498 } |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
499 //while ( v18 ^ v19 ); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
500 //++v72; |
0 | 501 } |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
502 //while ( v72 < 32 ); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
503 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
504 //v73 = (int)((char *)v2 + 512 * (a2 + 4875)); // field_261600[a2] |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
505 //v31 = 0; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
506 //i = 0; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
507 for (uint i = 0; i < 256; ++i) |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
508 //do |
0 | 509 { |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
510 //v32 = (*(float *)((char *)a6 + v31) - 0.8) * 0.8387096774193549 + 0.8; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
511 v32 = (a6[i] - 0.8f) * 0.8387096774193549 + 0.8; |
0 | 512 if ( v32 < 0.0 ) |
513 v32 = 0.0; | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
514 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
515 //v33 = v32; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
516 //v34 = v63[i] * 0.7034339229968783; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
517 HSV2RGB(&a1, &a2a, &a3, v64[i], v63[i] * 0.7034339229968783, v32); |
0 | 518 v35 = v2->uNumTargetGBits; |
519 if ( v35 == 6 ) | |
520 { | |
521 a1 = a1 * 31.0; | |
522 a2a = a2a * 62.0; | |
523 a3 = a3 * 31.0; | |
524 } | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
525 else if (v35 == 5) |
0 | 526 { |
527 a1 = a1 * 31.0; | |
528 a2a = a2a * 31.0; | |
529 a3 = a3 * 31.0; | |
530 } | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
531 else if (v23 == 0) |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
532 Log::Warning(L"Calling palette manager with num_target_bits == 0"); |
1545 | 533 else Error("(%u)", v23); |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
534 |
0 | 535 v36 = (signed __int64)((a1 + a2a + a3) * 0.3333333333333333 * 8.0); |
536 v37 = (signed int)v36 >> (8 - v2->uNumTargetRBits); | |
537 v38 = 8 - v35; | |
538 v39 = v2->uNumTargetBBits; | |
539 v40 = (signed int)v36 >> v38; | |
540 v41 = v2->uNumTargetRBits; | |
541 v79 = (signed int)v36 >> (8 - v39); | |
542 if ( v37 > (1 << v41) - 1 ) | |
543 v37 = (1 << v41) - 1; | |
544 v42 = v2->uNumTargetGBits; | |
545 if ( v40 > (1 << v42) - 1 ) | |
546 v40 = (1 << v42) - 1; | |
547 if ( v79 > (1 << v39) - 1 ) | |
548 v79 = (1 << v39) - 1; | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
549 //v43 = v73; |
0 | 550 v44 = v37 << (v39 + v2->uNumTargetGBits); |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
551 //v73 += 2; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
552 //*(short *)v43 = v79 | ((short)v40 << v39) | (unsigned __int16)v44; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
553 field_261600[a2][i] = v79 | ((unsigned short)v40 << v39) | (unsigned __int16)v44; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
554 //v31 = i + 4; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
555 //v19 = __OFSUB__(i + 4, 1024); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
556 //v18 = i - 1020 < 0; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
557 //i += 4; |
0 | 558 } |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
559 //while ( v18 ^ v19 ); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
560 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
561 //v45 = pPalette_mistColor[0]; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
562 float mist_a, mist_b, mist_c; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
563 if (pPalette_mistColor[0] || pPalette_mistColor[1] || pPalette_mistColor[2]) |
0 | 564 { |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
565 //v46 = (double)v45; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
566 //v80 = pPalette_mistColor[1]; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
567 //v47 = pPalette_mistColor[2]; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
568 //v70 = v46 * 0.00392156862745098; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
569 //*((float *)&v71 + 1) = (double)v80 * 0.00392156862745098; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
570 //v75 = (double)v47 * 0.00392156862745098; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
571 mist_a = pPalette_mistColor[0] / 255.0f; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
572 mist_b = pPalette_mistColor[1] / 255.0f; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
573 mist_c = pPalette_mistColor[2] / 255.0f; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
574 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
575 float unused; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
576 RGB2HSV(&v68, &v67, mist_a, mist_b, mist_c, &unused); |
0 | 577 } |
578 | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
579 //v72 = 0; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
580 //v73 = (int)v69->field_D1600; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
581 //do |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
582 for (uint i = 0; i < 32; ++i) |
0 | 583 { |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
584 //v48 = 0; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
585 //for ( i = 0; ; v48 = i ) |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
586 for (uint j = 0; j < 256; ++j) |
0 | 587 { |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
588 v49 = v63[j]; |
0 | 589 if ( v49 < 0.0 ) |
590 v49 = 0.0; | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
591 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
592 //v50 = v49; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
593 HSV2RGB(&a1, &a2a, &a3, v64[j], v49, a6[j]); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
594 //v51 = v2->uNumTargetGBits; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
595 if ( v2->uNumTargetGBits == 6 ) |
0 | 596 { |
597 a1 = a1 * 31.0; | |
598 a2a = a2a * 62.0; | |
599 a3 = a3 * 31.0; | |
600 } | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
601 else if (v2->uNumTargetGBits == 5) |
0 | 602 { |
603 a1 = a1 * 31.0; | |
604 a2a = a2a * 31.0; | |
605 a3 = a3 * 31.0; | |
606 } | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
607 else if (v23 == 0) |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
608 Log::Warning(L"Calling palette manager with num_target_bits == 0"); |
1545 | 609 else Error("(%u)", v23); |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
610 |
0 | 611 if (pPalette_mistColor[0] || pPalette_mistColor[1] || pPalette_mistColor[2]) |
612 { | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
613 v55 = (double)i / 31.0f; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
614 v52 = (signed __int64)((double)(1 << v2->uNumTargetRBits) * mist_a * v55 + a1 * (1.0 - v55)); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
615 v53 = (signed __int64)((double)(1 << v2->uNumTargetGBits) * mist_b * v55 + a2a * (1.0 - v55)); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
616 v54 = (signed __int64)((double)(1 << v2->uNumTargetBBits) * mist_c * v55 + a3 * (1.0 - v55)); |
0 | 617 } |
618 else | |
619 { | |
620 v52 = (signed __int64)a1; | |
621 v53 = (signed __int64)a2a; | |
622 v54 = (signed __int64)a3; | |
623 } | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
624 |
0 | 625 v56 = v2->uNumTargetRBits; |
626 v81 = v54; | |
627 if ( v52 > (1 << v56) - 1 ) | |
628 v52 = (1 << v56) - 1; | |
629 v57 = v2->uNumTargetGBits; | |
630 if ( v53 > (1 << v57) - 1 ) | |
631 v53 = (1 << v57) - 1; | |
632 HIDWORD(v54) = v2->uNumTargetBBits; | |
633 v59 = v2->uNumTargetBBits; | |
634 if ( (signed int)v54 > (1 << v59) - 1 ) | |
635 v81 = (1 << v59) - 1; | |
636 v60 = v2->uNumTargetGBits; | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
637 //i += 4; |
0 | 638 v61 = uNumTargetBBits + v60; |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
639 //result = v73; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
640 //v73 += 2; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
641 //v19 = __OFSUB__(i, 1024); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
642 //v18 = i - 1024 < 0; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
643 //*(short *)result = v81 | ((short)v53 << uNumTargetBBits) | (v52 << v61); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
644 field_D1600[a2][i][j] = v81 | ((short)v53 << uNumTargetBBits) | (v52 << v61); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
645 //if ( !(v18 ^ v19) ) |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
646 // break; |
0 | 647 } |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
648 //++v72; |
0 | 649 } |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
650 //while ( v72 < 32 ); |
0 | 651 } |
652 | |
653 | |
654 //----- (0048A300) -------------------------------------------------------- | |
655 PaletteManager::PaletteManager(): | |
670 | 656 uNumTargetRBits(0), uNumTargetGBits(0),uNumTargetBBits(0),_num_locked(0) |
0 | 657 { |
658 for (uint i = 0; i < 256; ++i) | |
659 { | |
660 pBaseColors[0][i][0] = i; | |
661 pBaseColors[0][i][1] = i; | |
662 pBaseColors[0][i][2] = i; | |
663 } | |
664 | |
665 CalcPalettes_LUT(0); | |
666 memset(pPaletteIDs, 0, sizeof(pPaletteIDs)); | |
667 } | |
668 | |
669 //----- (0048A336) -------------------------------------------------------- | |
670 // make grayscale palette at 0, clear all palettes ids that aren't locked | |
671 int PaletteManager::ResetNonLocked() | |
672 { | |
673 PaletteManager *v1; // esi@1 | |
674 signed int v2; // ecx@1 | |
675 int v3; // eax@1 | |
676 signed int result; // eax@3 | |
677 void *v5; // edi@4 | |
678 int v6; // ecx@4 | |
679 | |
680 v1 = this; | |
681 v2 = 0; | |
682 v3 = (int)&v1->pBaseColors[0][0][1]; | |
683 do | |
684 { | |
685 *(char *)(v3 + 1) = v2; | |
686 *(char *)v3 = v2; | |
687 *(char *)(v3 - 1) = v2++; | |
688 v3 += 3; | |
689 } | |
690 while ( v2 < 256 ); | |
691 CalcPalettes_LUT(0); | |
692 result = v1->_num_locked; | |
693 if ( result < 50 ) | |
694 { | |
695 v5 = &v1->pPaletteIDs[result]; | |
696 v6 = 50 - result; | |
697 result = 0; | |
698 memset(v5, 0, 4 * v6); | |
699 } | |
700 return result; | |
701 } | |
702 | |
703 //----- (0048A379) -------------------------------------------------------- | |
704 // make grayscale palette at 0, clear all palettes ids that aren't in "lock_test" | |
705 int PaletteManager::ResetNonTestLocked() | |
706 { | |
707 PaletteManager *v1; // esi@1 | |
708 signed int v2; // ecx@1 | |
709 int v3; // eax@1 | |
710 signed int result; // eax@3 | |
711 void *v5; // edi@4 | |
712 int v6; // ecx@4 | |
713 | |
714 v1 = this; | |
715 v2 = 0; | |
716 v3 = (int)&v1->pBaseColors[0][0][1]; | |
717 do | |
718 { | |
719 *(char *)(v3 + 1) = v2; | |
720 *(char *)v3 = v2; | |
721 *(char *)(v3 - 1) = v2++; | |
722 v3 += 3; | |
723 } | |
724 while ( v2 < 256 ); | |
725 CalcPalettes_LUT(0); | |
726 result = v1->_pal_lock_test; | |
727 if ( result < 50 ) | |
728 { | |
729 v5 = &v1->pPaletteIDs[result]; | |
730 v6 = 50 - result; | |
731 result = 0; | |
732 memset(v5, 0, 4 * v6); | |
733 } | |
734 return result; | |
735 } | |
736 | |
737 //----- (0048A3BC) -------------------------------------------------------- | |
738 int PaletteManager::LoadPalette(unsigned int uPaletteID) | |
739 { | |
740 unsigned int *v2; // ecx@1 | |
741 signed int result; // eax@1 | |
742 signed int v4; // esi@6 | |
743 double v5; // st7@7 | |
744 double v6; // st7@12 | |
745 double v7; // st6@17 | |
746 signed __int64 v8; // qax@17 | |
747 double v9; // st6@17 | |
748 char v10[768]; // [sp+18h] [bp-388h]@6 | |
749 //char v11; // [sp+19h] [bp-387h]@17 | |
750 //char v12[766]; // [sp+1Ah] [bp-386h]@17 | |
751 char Source[32]; // [sp+360h] [bp-40h]@4 | |
2335 | 752 //PaletteManager *v15; // [sp+380h] [bp-20h]@1 |
0 | 753 float v16; // [sp+384h] [bp-1Ch]@7 |
754 int v17; // [sp+388h] [bp-18h]@6 | |
755 float v18; // [sp+38Ch] [bp-14h]@7 | |
756 float a2a; // [sp+390h] [bp-10h]@7 | |
757 float a1; // [sp+394h] [bp-Ch]@7 | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
758 float a6; // [sp+398h] [bp-8h]@7 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
759 float a3; // [sp+39Ch] [bp-4h]@7 |
0 | 760 |
2335 | 761 //v15 = this; |
0 | 762 v2 = (unsigned int *)&this->pPaletteIDs[1]; |
763 result = 1; | |
764 while ( *v2 != uPaletteID ) | |
765 { | |
766 ++result; | |
767 ++v2; | |
768 if ( result >= 50 ) | |
769 { | |
770 sprintf(Source, "pal%03i", uPaletteID); | |
771 | |
772 Texture tex; // [sp+318h] [bp-88h]@4 | |
773 //Texture::Texture(&tex); | |
774 | |
775 if ( pBitmaps_LOD->LoadTextureFromLOD(&tex, Source, TEXTURE_24BIT_PALETTE) == 1 ) | |
776 { | |
777 v4 = 0; | |
778 v17 = 1 - (int)&v10; | |
779 do | |
780 { | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
781 //LODWORD(a1) = tex.pPalette24[v4]; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
782 a1 = (double)tex.pPalette24[v4] / 255.0f; |
0 | 783 LODWORD(a2a) = (unsigned __int8)*(&v10 + v4 + v17 + (unsigned int)tex.pPalette24); |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
784 a2a = (double)tex.pPalette24[v4 + 1] / 255.0f; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
785 //a3 = tex.pPalette24[v4 + 2]; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
786 a3 = (double)tex.pPalette24[v4 + 2] / 255.0f; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
787 RGB2HSV(&v16, &v18, a1, a2a, a3, &a6); |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
788 v5 = a6 * 1.1; |
0 | 789 if ( v5 >= 0.0 && v5 >= 1.0 ) |
790 v5 = 1.0; | |
791 else | |
792 { | |
793 if ( v5 < 0.0 ) | |
794 v5 = 0.0; | |
795 } | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
796 a6 = v5; |
0 | 797 v6 = v18 * 0.64999998; |
798 if ( v6 >= 0.0 && v6 >= 1.0 ) | |
799 v6 = 1.0; | |
800 else | |
801 { | |
802 if ( v6 < 0.0 ) | |
803 v6 = 0.0; | |
804 } | |
805 v18 = v6; | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
806 HSV2RGB(&a1, &a2a, &a3, v16, v18, a6); |
0 | 807 v7 = a2a * 255.0; |
808 v10[v4] = (signed __int64)(a1 * 255.0); | |
809 v8 = (signed __int64)v7; | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
810 v9 = a3 * 255.0; |
0 | 811 v10[v4 + 1] = v8; |
812 v10[v4 + 2] = (signed __int64)v9; | |
813 v4 += 3; | |
814 } | |
815 while ( v4 < 768 ); | |
816 tex.Release(); | |
2335 | 817 result = this->MakeBasePaletteLut(uPaletteID, v10); |
0 | 818 } |
819 else | |
820 result = 0; | |
821 return result; | |
822 } | |
823 } | |
824 return result; | |
825 } | |
826 // 48A3BC: using guessed type char var_386[766]; | |
827 | |
828 //----- (0048A5A4) -------------------------------------------------------- | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
829 int PaletteManager::MakeBasePaletteLut(int idx, char *entries) |
0 | 830 { |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
831 //PaletteManager *v3; // edi@1 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
832 //signed int result; // eax@1 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
833 //int *v5; // ecx@1 |
0 | 834 int v6; // eax@4 |
835 int v7; // esi@4 | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
836 //int v8; // eax@9 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
837 //signed int v9; // ecx@9 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
838 //int v10; // edx@9 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
839 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
840 //v3 = this; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
841 //result = 0; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
842 //v5 = this->pPaletteIDs; |
0 | 843 |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
844 for (uint i = 0; i < 50; ++i) |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
845 if (pPaletteIDs[i] == idx) |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
846 return i; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
847 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
848 v6 = (int)&pPaletteIDs[1]; |
0 | 849 v7 = 1; |
850 while ( *(int *)v6 ) | |
851 { | |
852 ++v7; | |
853 v6 += 4; | |
854 if ( v7 >= 50 ) | |
855 return 0; | |
856 } | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
857 /*v8 = (int)pBaseColors[v7];//(int)((char *)v3 + 768 * v7); |
0 | 858 v9 = 768; |
859 v10 = (int)(entries - v8); | |
860 do | |
861 { | |
862 *(char *)v8 = *(char *)(v10 + v8); | |
863 ++v8; | |
864 --v9; | |
865 } | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
866 while ( v9 );*/ |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
867 unsigned __int8 *dst = (unsigned __int8 *)pBaseColors[v7]; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
868 for (uint i = 0; i < 768; ++i) |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
869 dst[i] = entries[i]; |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
870 |
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
871 pPaletteIDs[v7] = idx; |
0 | 872 CalcPalettes_LUT(v7); |
873 return v7; | |
700
1d05543f522d
Some occasional crashes in PaletteManager and sprite loading fixed.
Nomad
parents:
670
diff
changeset
|
874 |
0 | 875 } |
876 | |
762 | 877 // inlined |
878 //----- (mm6c::0045C610) --------------------------------------------------- | |
879 void PaletteManager::SetMistColor(unsigned char r, unsigned char g, unsigned char b) | |
880 { | |
881 pPalette_mistColor[0] = r; | |
882 pPalette_mistColor[1] = g; | |
883 pPalette_mistColor[2] = b; | |
884 } | |
885 | |
0 | 886 //----- (0048A614) -------------------------------------------------------- |
887 void PaletteManager::RecalculateAll() | |
888 { | |
889 CalcPalettes_LUT(0); | |
890 | |
891 for (uint i = 1; i < 50; ++i) | |
892 if (pPaletteIDs[i]) | |
893 CalcPalettes_LUT(i); | |
894 } | |
895 | |
896 | |
897 //----- (0047BE67) -------------------------------------------------------- | |
898 unsigned __int16 *PaletteManager::Get(int a1) | |
899 { | |
900 return (unsigned __int16 *)pPaletteManager->field_199600_palettes[a1]; | |
901 } | |
902 | |
903 //----- (0047BE72) -------------------------------------------------------- | |
904 unsigned __int16 *PaletteManager::Get_Mist_or_Red_LUT(int a1, int a2, char a3) | |
905 { | |
906 int v3; // eax@4 | |
907 | |
908 if ( a3 & 2 || byte_4D864C && BYTE2(pGame->uFlags) & 4 ) | |
909 v3 = 32 * a1 + a2 + 3275; | |
910 else | |
911 v3 = 32 * a1 + a2 + 1675; | |
912 return (unsigned __int16 *)((char *)&pPaletteManager + 512 * v3); | |
913 } | |
914 // 4D864C: using guessed type char byte_4D864C; | |
915 | |
916 | |
917 //----- (0041F50D) -------------------------------------------------------- | |
918 unsigned __int16 *PaletteManager::Get_Dark_or_Red_LUT(int a1, int a2, char a3) | |
919 { | |
920 int v3; // eax@4 | |
921 | |
922 if ( a3 & 2 || byte_4D864C && BYTE2(pGame->uFlags) & 4 ) | |
923 v3 = 32 * a1 + a2 + 3275; | |
924 else | |
925 v3 = 32 * a1 + a2 + 75; | |
926 return (unsigned __int16 *)((char *)&pPaletteManager + 512 * v3); | |
927 } | |
928 // 4D864C: using guessed type char byte_4D864C; | |
929 | |
930 | |
931 //----- (0047C30E) -------------------------------------------------------- | |
932 unsigned __int16 *PaletteManager::_47C30E_get_palette(int a1, char a2) | |
933 { | |
934 char *result; // eax@4 | |
935 | |
936 if ( a2 & 2 || byte_4D864C && BYTE2(pGame->uFlags) & 4 ) | |
937 result = (char *)pPaletteManager->field_199600_palettes[a1]; | |
938 else | |
939 result = (char *)pPaletteManager->field_D1600[a1]; | |
940 return (unsigned __int16 *)result; | |
941 } | |
942 | |
943 | |
944 //----- (0047C33F) -------------------------------------------------------- | |
945 unsigned __int16 *PaletteManager::_47C33F_get_palette(int a1, char a2) | |
946 { | |
947 unsigned __int16 *result; // eax@4 | |
948 | |
949 if ( a2 & 2 || byte_4D864C && BYTE2(pGame->uFlags) & 4 ) | |
950 result = (unsigned __int16 *)pPaletteManager->field_199600_palettes[a1]; | |
951 else | |
952 result = (unsigned __int16 *)pPaletteManager->pPalette1[a1]; | |
953 return result; | |
954 } | |
955 // 4D864C: using guessed type char byte_4D864C; |