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