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