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