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