Mercurial > mm7
comparison _deleted.cpp @ 1391:cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
stru148 -> struct Polygon
author | Nomad |
---|---|
date | Thu, 18 Jul 2013 14:42:54 +0200 |
parents | 93287fb98441 |
children | 38df78aba732 |
comparison
equal
deleted
inserted
replaced
1390:613c77e51e38 | 1391:cc9a3a24d61d |
---|---|
1 | |
2 /* | 1 /* |
2 | |
3 | |
4 // 128 | |
5 #pragma pack(push, 1) | |
6 struct stru11 | |
7 { | |
8 | |
9 stru11(); | |
10 | |
11 void CheckCPU(); | |
12 void RunCPUID(); | |
13 void RunCPUID_op1(); | |
14 void RunCPUID_op2(); | |
15 void RunCPUID_ext2_3_4(); | |
16 | |
17 int cpuid_00000000_eax_numops; | |
18 int cpuid_00000000_ebx_vendorstr1; | |
19 int cpuid_00000000_edx_vendorstr2; | |
20 int cpuid_00000000_ecx_vendorstr3; | |
21 char pCPUString[16]; | |
22 int cpuid_00000001_eax; | |
23 int cpuid_00000001_edx; | |
24 int cpuid_00000002_eax; | |
25 int cpuid_00000002_ebx; | |
26 int cpuid_00000002_ecx; | |
27 int cpuid_00000002_edx; | |
28 int field_38; | |
29 int field_3C; | |
30 int field_40[8]; | |
31 int cpuid_80000000_edx; | |
32 int cpuid_80000001_eax; | |
33 int cpuid_80000001_edx; | |
34 int cpuid_80000002_registers[4]; | |
35 int cpuid_80000003_registers[4]; | |
36 int cpuid_80000004_registers[4]; | |
37 int cpuid_80000005_ebx; | |
38 int cpuid_80000005_ecx; | |
39 int cpuid_80000005_edx; | |
40 int cpuid_80000006_ecx; | |
41 int field_AC; | |
42 int uProcessorManufacturer; | |
43 int cpuid_80000002_registers2[4]; | |
44 int cpuid_80000003_registers2[4]; | |
45 int cpuid_80000004_registers2[4]; | |
46 int field_E4; | |
47 }; | |
48 #pragma pack(pop) | |
49 | |
50 | |
51 | |
52 // 130 | |
53 #pragma pack(push, 1) | |
54 struct stru12_MemoryBlock | |
55 { | |
56 stru12_MemoryBlock(int a2); | |
57 ~stru12_MemoryBlock(); | |
58 | |
59 | |
60 void *pAlignedBlock; | |
61 void *pBlockBase; | |
62 }; | |
63 #pragma pack(pop) | |
64 | |
65 // 129 | |
66 #pragma pack(push, 1) | |
67 struct stru12 | |
68 { | |
69 stru12(stru11 *pStru11); | |
70 ~stru12(); | |
71 | |
72 void _4898E6(); | |
73 | |
74 void (__thiscall *vdestructor_ptr)(stru12 *); | |
75 int field_4[16]; | |
76 int field_44; | |
77 int field_48; | |
78 int field_4C; | |
79 int field_50; | |
80 int field_54; | |
81 int field_58; | |
82 stru12_MemoryBlock *pMemBlocks[12]; | |
83 int field_8C; | |
84 }; | |
85 #pragma pack(pop) | |
86 | |
87 | |
88 | |
89 | |
90 //----- (00438526) -------------------------------------------------------- | |
91 stru11::stru11() | |
92 { | |
93 stru11 *v1; // esi@1 | |
94 signed int v2; // eax@1 | |
95 char *v3; // edx@1 | |
96 | |
97 v1 = this; | |
98 v2 = 0; | |
99 this->cpuid_00000000_eax_numops = 0; | |
100 this->cpuid_00000001_eax = 0; | |
101 this->cpuid_00000001_edx = 0; | |
102 this->field_38 = 0; | |
103 this->field_3C = 0; | |
104 this->cpuid_80000000_edx = 0; | |
105 this->cpuid_80000001_eax = 0; | |
106 this->cpuid_80000001_edx = 0; | |
107 this->cpuid_80000005_ebx = 0; | |
108 this->cpuid_80000005_ecx = 0; | |
109 this->cpuid_80000005_edx = 0; | |
110 this->cpuid_80000006_ecx = 0; | |
111 this->field_AC = 0; | |
112 this->uProcessorManufacturer = 0; | |
113 LOBYTE(this->cpuid_80000002_registers2[0]) = 0; | |
114 v3 = (char *)&this->cpuid_00000002_eax; | |
115 do | |
116 { | |
117 if ( v2 < 3 ) | |
118 *((int *)v3 - 9) = 0; | |
119 if ( v2 < 4 ) | |
120 *(int *)v3 = 0; | |
121 if ( v2 < 12 ) | |
122 *((int *)v3 + 17) = 0; | |
123 if ( v2 < 13 ) | |
124 this->pCPUString[v2] = 0; | |
125 if ( v2 < 30 ) | |
126 *((char *)this->field_40 + v2) = 0; | |
127 *((char *)&this->cpuid_80000002_registers2[0] + v2++ + 1) = 0; | |
128 v3 += 4; | |
129 } | |
130 while ( v2 < 48 ); | |
131 CheckCPU(); | |
132 } | |
133 | |
134 //----- (004385B5) -------------------------------------------------------- | |
135 void stru11::CheckCPU() | |
136 { | |
137 int v5; // [sp-4h] [bp-10h]@0 | |
138 signed int v6; // [sp+4h] [bp-8h]@1 | |
139 signed int v7; // [sp+8h] [bp-4h]@1 | |
140 | |
141 _CF = 0; | |
142 _OF = 0; | |
143 _ZF = 1; | |
144 _SF = 0; | |
145 v7 = 0; | |
146 __asm { pushf } | |
147 v6 = 3; | |
148 if ( v5 != (v5 ^ 0x40000) ) | |
149 { | |
150 __asm { popf } | |
151 v6 = 4; | |
152 __asm { pushf } | |
153 if ( v5 != (v5 ^ 0x200000) ) | |
154 { | |
155 v7 = 1; | |
156 v6 = 0; | |
157 } | |
158 } | |
159 if ( v6 == 3 ) | |
160 { | |
161 this->field_AC = 1; | |
162 } | |
163 else | |
164 { | |
165 if ( v6 == 4 ) | |
166 { | |
167 this->field_AC = 2; | |
168 } | |
169 else | |
170 { | |
171 if ( v7 ) | |
172 { | |
173 this->field_AC = 2; | |
174 RunCPUID(); | |
175 } | |
176 else | |
177 { | |
178 this->field_AC = 0; | |
179 } | |
180 } | |
181 } | |
182 } | |
183 | |
184 //----- (00438659) -------------------------------------------------------- | |
185 void stru11::RunCPUID() | |
186 { | |
187 stru11 *v6; // esi@1 | |
188 unsigned int uNumOps; // edi@1 | |
189 int uNumExtOps; // edi@16 | |
190 char pCyrixString[16]; // [sp+Ch] [bp-60h]@1 | |
191 char pCentaurString[16]; // [sp+1Ch] [bp-50h]@1 | |
192 char pAMDString[16]; // [sp+2Ch] [bp-40h]@1 | |
193 char pIntelString[16]; // [sp+3Ch] [bp-30h]@1 | |
194 char pCPUString[16]; // [sp+4Ch] [bp-20h]@1 | |
195 stru11 *thisa; // [sp+5Ch] [bp-10h]@1 | |
196 char *v35; // [sp+60h] [bp-Ch]@1 | |
197 int v36; // [sp+64h] [bp-8h]@1 | |
198 int v37; // [sp+68h] [bp-4h]@1 | |
199 | |
200 thisa = this; | |
201 *(int *)pIntelString = *(int *)"GenuineIntel"; | |
202 *(int *)&pIntelString[4] = *(int *)"ineIntel"; | |
203 *(int *)&pIntelString[8] = *(int *)"ntel"; | |
204 pIntelString[12] = aGenuineintel[12]; | |
205 *(int *)pAMDString = *(int *)"AuthenticAMD"; | |
206 *(int *)&pAMDString[4] = *(int *)"enticAMD"; | |
207 *(int *)&pAMDString[8] = *(int *)"cAMD"; | |
208 pAMDString[12] = aAuthenticamd[12]; | |
209 *(int *)pCyrixString = *(int *)"CyrixInstead"; | |
210 *(int *)&pCyrixString[4] = *(int *)"xInstead"; | |
211 *(int *)&pCyrixString[8] = *(int *)"tead"; | |
212 pCyrixString[12] = aCyrixinstead[12]; | |
213 *(int *)pCentaurString = *(int *)"CentaurHauls"; | |
214 *(int *)&pCentaurString[4] = *(int *)"aurHauls"; | |
215 *(int *)&pCentaurString[8] = *(int *)"auls"; | |
216 v37 = 0; | |
217 v36 = 0; | |
218 pCentaurString[12] = aCentaurhauls[12]; | |
219 v35 = pCPUString; | |
220 pCPUString[12] = 0; | |
221 _EAX = 0; | |
222 __asm { cpuid } | |
223 v37 = _EAX; | |
224 *(int *)pCPUString = _EBX; | |
225 *(int *)&pCPUString[4] = _EDX; | |
226 *(int *)&pCPUString[8] = _ECX; | |
227 v6 = thisa; | |
228 uNumOps = _EAX; | |
229 thisa->cpuid_00000000_ebx_vendorstr1 = _EBX; | |
230 v6->cpuid_00000000_edx_vendorstr2 = *(int *)&pCPUString[4]; | |
231 v6->cpuid_00000000_ecx_vendorstr3 = *(int *)&pCPUString[8]; | |
232 v6->cpuid_00000000_eax_numops = _EAX; | |
233 strcpy(v6->pCPUString, pCPUString); | |
234 if ( strcmp(pIntelString, pCPUString) ) | |
235 { | |
236 if ( strcmp(pAMDString, pCPUString) ) | |
237 { | |
238 if ( strcmp(pCyrixString, pCPUString) ) | |
239 { | |
240 if ( strcmp(pCentaurString, pCPUString) ) | |
241 v6->uProcessorManufacturer = 0; | |
242 else | |
243 v6->uProcessorManufacturer = 4; | |
244 } | |
245 else | |
246 { | |
247 v6->uProcessorManufacturer = 3; | |
248 } | |
249 } | |
250 else | |
251 { | |
252 v6->uProcessorManufacturer = 2; | |
253 } | |
254 } | |
255 else | |
256 { | |
257 v6->uProcessorManufacturer = 1; | |
258 } | |
259 if ( uNumOps >= 1 ) | |
260 RunCPUID_op1(); | |
261 if ( uNumOps >= 2 ) | |
262 RunCPUID_op2(); | |
263 _EAX = 0x80000000u; | |
264 __asm { cpuid } | |
265 if ( !(_EAX & 0x80000000) ) | |
266 _EAX = 0x80000000u; | |
267 v36 = _EAX; | |
268 v6->cpuid_80000000_edx = _EAX; | |
269 uNumExtOps = _EAX ^ 0x80000000; | |
270 if ( (_EAX ^ 0x80000000u) >= 1 ) | |
271 { | |
272 _EAX = 0x80000001u; | |
273 __asm { cpuid } | |
274 thisa = (stru11 *)_EAX; | |
275 v35 = (char *)_EDX; | |
276 v6->cpuid_80000001_eax = _EAX; | |
277 v6->cpuid_80000001_edx = (int)v35; | |
278 } | |
279 if ( (unsigned int)uNumExtOps >= 4 ) | |
280 RunCPUID_ext2_3_4(); | |
281 if ( (unsigned int)uNumExtOps >= 5 ) | |
282 { | |
283 _EAX = 0x80000005u; | |
284 __asm { cpuid } | |
285 thisa = (stru11 *)_EBX; | |
286 v35 = (char *)_ECX; | |
287 v36 = _EDX; | |
288 v6->cpuid_80000005_ebx = _EBX; | |
289 v6->cpuid_80000005_ecx = (int)v35; | |
290 v6->cpuid_80000005_edx = v36; | |
291 } | |
292 if ( (unsigned int)uNumExtOps >= 6 ) | |
293 { | |
294 _EAX = 0x80000006u; | |
295 __asm { cpuid } | |
296 v6->cpuid_80000006_ecx = _ECX; | |
297 } | |
298 } | |
299 | |
300 //----- (00438821) -------------------------------------------------------- | |
301 void stru11::RunCPUID_op1() | |
302 { | |
303 stru11 *v1; // esi@1 | |
304 unsigned int v7; // ecx@1 | |
305 int v8; // eax@3 | |
306 int v9; // eax@10 | |
307 signed int v10; // eax@11 | |
308 int v11; // ecx@11 | |
309 int v12; // eax@15 | |
310 signed int v13; // eax@19 | |
311 int v14; // ecx@19 | |
312 signed int v15; // eax@25 | |
313 int v16; // ecx@25 | |
314 signed int v17; // eax@34 | |
315 int v18; // ecx@34 | |
316 | |
317 v1 = this; | |
318 _EAX = 1; | |
319 __asm { cpuid } | |
320 v7 = _EAX; | |
321 v1->cpuid_00000001_edx = _EDX; | |
322 v1->cpuid_00000001_eax = _EAX; | |
323 if ( (_EAX & 0x3000) == 8192 ) | |
324 { | |
325 LOBYTE(v1->cpuid_80000002_registers2[0]) = 1; | |
326 v7 = 0; | |
327 } | |
328 v8 = (v7 >> 8) & 0xF; | |
329 switch ( v8 ) | |
330 { | |
331 case 4: | |
332 v1->field_AC = 2; | |
333 break; | |
334 case 5: | |
335 v1->field_AC = 15; | |
336 break; | |
337 case 6: | |
338 v1->field_AC = 36; | |
339 break; | |
340 default: | |
341 v1->field_AC = 49; | |
342 break; | |
343 } | |
344 v9 = v1->uProcessorManufacturer; | |
345 if ( v9 == 1 ) | |
346 { | |
347 v10 = 0; | |
348 v11 = v7 & 0x3FF0; | |
349 while ( v11 != dword_4E4948[2 * v10] ) | |
350 { | |
351 ++v10; | |
352 if ( v10 >= 17 ) | |
353 return; | |
354 } | |
355 v12 = dword_4E494C[2 * v10]; | |
356 goto LABEL_39; | |
357 } | |
358 if ( v9 == 2 ) | |
359 { | |
360 if ( (v7 & 0xF00) == dword_4E49D0[0] ) | |
361 { | |
362 v12 = dword_4E49D4[0]; | |
363 } | |
364 else | |
365 { | |
366 v13 = 1; | |
367 v14 = v7 & 0x3FF0; | |
368 while ( v14 != dword_4E49D0[2 * v13] ) | |
369 { | |
370 ++v13; | |
371 if ( v13 >= 9 ) | |
372 return; | |
373 } | |
374 v12 = dword_4E49D4[2 * v13]; | |
375 } | |
376 goto LABEL_39; | |
377 } | |
378 if ( v9 != 3 ) | |
379 { | |
380 if ( v9 != 4 ) | |
381 return; | |
382 v17 = 0; | |
383 v18 = v7 & 0x3FF0; | |
384 while ( v18 != dword_4E4A40[2 * v17] ) | |
385 { | |
386 ++v17; | |
387 if ( v17 >= 2 ) | |
388 return; | |
389 } | |
390 v12 = dword_4E4A44[2 * v17]; | |
391 goto LABEL_39; | |
392 } | |
393 v15 = 1; | |
394 v16 = v7 & 0x3FF0; | |
395 while ( v16 != dword_4E4A18[2 * v15] ) | |
396 { | |
397 ++v15; | |
398 if ( v15 >= 5 ) | |
399 goto LABEL_30; | |
400 } | |
401 v1->field_AC = dword_4E4A1C[2 * v15]; | |
402 LABEL_30: | |
403 v12 = 24; | |
404 if ( v1->field_AC == 24 ) | |
405 { | |
406 if ( _EDX != 1 ) | |
407 v12 = (((_EDX != 261) - 1) & 0xA) + 15; | |
408 LABEL_39: | |
409 v1->field_AC = v12; | |
410 } | |
411 } | |
412 | |
413 //----- (00438992) -------------------------------------------------------- | |
414 void stru11::RunCPUID_op2() | |
415 { | |
416 stru11 *v1; // edi@1 | |
417 int v7; // eax@1 | |
418 signed int v8; // ecx@2 | |
419 unsigned __int8 v9; // al@3 | |
420 signed int v10; // ecx@14 | |
421 unsigned __int8 v11; // al@15 | |
422 int v12; // [sp+Ch] [bp-14h]@1 | |
423 int v13; // [sp+10h] [bp-10h]@1 | |
424 int v14; // [sp+14h] [bp-Ch]@1 | |
425 int v15; // [sp+18h] [bp-8h]@1 | |
426 int *v16; // [sp+1Ch] [bp-4h]@1 | |
427 | |
428 v1 = this; | |
429 v16 = &v12; | |
430 _EAX = 2; | |
431 __asm { cpuid } | |
432 v12 = _EAX; | |
433 v13 = _EBX; | |
434 v14 = _ECX; | |
435 v15 = _EDX; | |
436 v1->cpuid_00000002_eax = _EAX; | |
437 v1->cpuid_00000002_ebx = v13; | |
438 v1->cpuid_00000002_ecx = v14; | |
439 v1->cpuid_00000002_edx = v15; | |
440 v7 = v1->field_AC; | |
441 if ( v7 == 40 ) | |
442 { | |
443 v8 = 0; | |
444 while ( 1 ) | |
445 { | |
446 v9 = *((char *)&v12 + v8); | |
447 if ( v9 == 64 ) | |
448 { | |
449 v1->field_AC = 43; | |
450 return; | |
451 } | |
452 if ( v9 >= 0x41u && v9 <= 0x43u ) | |
453 { | |
454 v1->field_AC = 41; | |
455 return; | |
456 } | |
457 if ( v9 >= 0x44u && v9 <= 0x45u ) | |
458 break; | |
459 ++v8; | |
460 if ( v8 >= 16 ) | |
461 return; | |
462 } | |
463 v1->field_AC = 42; | |
464 } | |
465 else | |
466 { | |
467 if ( v7 == 45 ) | |
468 { | |
469 v10 = 0; | |
470 while ( 1 ) | |
471 { | |
472 v11 = *((char *)&v12 + v10); | |
473 if ( v11 >= 0x40u && v11 <= 0x43u ) | |
474 { | |
475 v1->field_AC = 46; | |
476 return; | |
477 } | |
478 if ( v11 >= 0x44u && v11 <= 0x45u ) | |
479 break; | |
480 ++v10; | |
481 if ( v10 >= 16 ) | |
482 return; | |
483 } | |
484 v1->field_AC = 47; | |
485 } | |
486 } | |
487 } | |
488 | |
489 //----- (00438A67) -------------------------------------------------------- | |
490 void stru11::RunCPUID_ext2_3_4() | |
491 { | |
492 stru11 *v1; // edi@1 | |
493 stru11 *v17; // eax@1 | |
494 int v18[3][4]; // [sp+Ch] [bp-38h]@1 | |
495 stru11 *v19; // [sp+3Ch] [bp-8h]@1 | |
496 | |
497 v1 = this; | |
498 v19 = this; | |
499 _EAX = 0x80000002u; | |
500 __asm { cpuid } | |
501 v18[0][0] = _EAX; | |
502 *(_QWORD *)&v18[0][1] = __PAIR__(_ECX, _EBX); | |
503 v18[0][3] = _EDX; | |
504 _EAX = 0x80000003u; | |
505 __asm { cpuid } | |
506 v18[1][0] = _EAX; | |
507 *(_QWORD *)&v18[1][1] = __PAIR__(_ECX, _EBX); | |
508 v18[1][3] = _EDX; | |
509 _EAX = 0x80000004u; | |
510 __asm { cpuid } | |
511 v18[2][0] = _EAX; | |
512 *(_QWORD *)&v18[2][1] = __PAIR__(_ECX, _EBX); | |
513 v18[2][3] = _EDX; | |
514 v17 = v19; | |
515 memcpy(v1->cpuid_80000002_registers, v18, 0x30u); | |
516 memcpy((char *)&v17->cpuid_80000002_registers2[0] + 1, v18, 0x30u); | |
517 } | |
518 | |
519 | |
520 | |
521 //----- (0048958E) -------------------------------------------------------- | |
522 stru12_MemoryBlock::stru12_MemoryBlock(int a2) | |
523 { | |
524 stru12_MemoryBlock *v2; // esi@1 | |
525 void *v3; // eax@1 | |
526 void *v4; // ecx@1 | |
527 stru12_MemoryBlock *result; // eax@1 | |
528 | |
529 v2 = this; | |
530 v3 = operator new(8 * a2 + 16); | |
531 v2->pBlockBase = v3; | |
532 v4 = (char *)v3 + PID_TYPE(-(signed int)v3); | |
533 result = v2; | |
534 v2->pAlignedBlock = v4; | |
535 } | |
536 | |
537 //----- (004895B7) -------------------------------------------------------- | |
538 stru12::stru12(stru11 *pStru11) | |
539 { | |
540 stru12 *v2; // esi@1 | |
541 | |
542 v2 = this; | |
543 this->field_44 = 0x41000000u; | |
544 this->field_4C = 0x46000000u; | |
545 //this->vdestructor_ptr = stru12::_4898E6; | |
546 this->field_48 = 0; | |
547 this->field_50 = 0; | |
548 this->field_54 = 0x33D6BF95u; | |
549 this->field_58 = 0; | |
550 | |
551 for (int i = 0; i < 12; ++i) | |
552 v2->pMemBlocks[i] = new stru12_MemoryBlock(640); | |
553 } | |
554 | |
555 //----- (00489810) -------------------------------------------------------- | |
556 stru12::~stru12() | |
557 { | |
558 for (int i = 0; i < 12; ++i) | |
559 delete pMemBlocks[i]; | |
560 } | |
561 | |
562 //----- (004898BF) -------------------------------------------------------- | |
563 stru12_MemoryBlock::~stru12_MemoryBlock() | |
564 { | |
565 stru12_MemoryBlock *v2; // esi@1 | |
566 void *v3; // ST00_4@1 | |
567 | |
568 v2 = this; | |
569 v3 = this->pBlockBase; | |
570 this->pAlignedBlock = 0; | |
571 free(v3); | |
572 v2->pBlockBase = 0; | |
573 //if ( a2 & 1 ) | |
574 // free(v2); | |
575 } | |
576 | |
577 //----- (004898E6) -------------------------------------------------------- | |
578 void stru12::_4898E6() | |
579 { | |
580 void *v1; // eax@1 | |
581 void *v2; // edx@1 | |
582 char *v3; // edi@2 | |
583 double v4; // st7@2 | |
584 char *v5; // ebx@2 | |
585 double v6; // st6@3 | |
586 double v7; // st5@3 | |
587 double v8; // st4@3 | |
588 int v9; // esi@3 | |
589 double v10; // st3@3 | |
590 float v11; // ST34_4@5 | |
591 double v12; // st6@10 | |
592 double v13; // ST0C_8@10 | |
593 char *v14; // [sp+14h] [bp-44h]@2 | |
594 char *v15; // [sp+18h] [bp-40h]@2 | |
595 char *v16; // [sp+1Ch] [bp-3Ch]@2 | |
596 char *v17; // [sp+20h] [bp-38h]@2 | |
597 char *v18; // [sp+24h] [bp-34h]@2 | |
598 float v19; // [sp+30h] [bp-28h]@3 | |
599 float v20; // [sp+38h] [bp-20h]@3 | |
600 char *v21; // [sp+3Ch] [bp-1Ch]@2 | |
601 int v22; // [sp+40h] [bp-18h]@1 | |
602 char *v23; // [sp+44h] [bp-14h]@2 | |
603 char *v24; // [sp+48h] [bp-10h]@2 | |
604 int v25; // [sp+4Ch] [bp-Ch]@2 | |
605 float v26; // [sp+50h] [bp-8h]@3 | |
606 float v27; // [sp+54h] [bp-4h]@3 | |
607 | |
608 __debugbreak(); | |
609 v22 = 0; | |
610 v1 = this->pMemBlocks[1]->pAlignedBlock; | |
611 v2 = this->pMemBlocks[6]->pAlignedBlock; | |
612 if ( this->field_8C > 0 ) | |
613 { | |
614 v24 = (char *)((char *)pMemBlocks[0]->pAlignedBlock - v1); | |
615 v23 = (char *)((char *)pMemBlocks[2]->pAlignedBlock - v1); | |
616 v18 = (char *)((char *)pMemBlocks[7]->pAlignedBlock - v2); | |
617 v17 = (char *)((char *)pMemBlocks[8]->pAlignedBlock - v2); | |
618 v25 = (int)v1 - (int)v2; | |
619 v16 = (char *)((char *)pMemBlocks[9]->pAlignedBlock - v2); | |
620 v3 = (char *)((char *)pMemBlocks[4]->pAlignedBlock - v2); | |
621 v15 = (char *)((char *)pMemBlocks[10]->pAlignedBlock - v2); | |
622 v4 = 1.0; | |
623 v5 = (char *)((char *)pMemBlocks[5]->pAlignedBlock - v2); | |
624 v21 = (char *)((char *)pMemBlocks[3]->pAlignedBlock - v2); | |
625 v14 = (char *)((char *)pMemBlocks[11]->pAlignedBlock - v2); | |
626 do | |
627 { | |
628 v26 = *(float *)&v24[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.x; | |
629 v27 = *(float *)((char *)v2 + v25) - (double)pIndoorCamera->pos.y; | |
630 v6 = *(float *)&v23[(int)((char *)v2 + v25)] - (double)pIndoorCamera->pos.z; | |
631 v7 = pIndoorCamera->fRotationYCosine; | |
632 v8 = pIndoorCamera->fRotationYSine; | |
633 v20 = pIndoorCamera->fRotationXCosine; | |
634 v19 = pIndoorCamera->fRotationXSine; | |
635 v9 = (int)((char *)v2 + (int)v21); | |
636 v10 = v27 * pIndoorCamera->fRotationYSine + pIndoorCamera->fRotationYCosine * v26; | |
637 if ( pIndoorCamera->sRotationX ) | |
638 { | |
639 v11 = v10; | |
640 *(float *)v9 = v11 * pIndoorCamera->fRotationXCosine + pIndoorCamera->fRotationXSine * v6; | |
641 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
642 *(float *)((char *)v2 + (int)v5) = v20 * v6 - v11 * v19; | |
643 } | |
644 else | |
645 { | |
646 *(float *)v9 = v10; | |
647 *(float *)((char *)v2 + (int)v3) = v7 * v27 - v8 * v26; | |
648 *(float *)((char *)v2 + (int)v5) = v6; | |
649 } | |
650 if ( *(float *)v9 >= 8.0 ) | |
651 { | |
652 if ( (double)pOutdoorCamera->shading_dist_mist >= *(float *)v9 ) | |
653 { | |
654 *(int *)v2 = 0; | |
655 v12 = v4 / (*(float *)v9 + 0.0000001) * (double)pOutdoorCamera->int_fov_rad; | |
656 *(float *)((char *)v2 + (int)v18) = (double)pViewport->uScreenCenterX | |
657 - v12 * *(float *)((char *)v2 + (int)v3); | |
658 *(float *)((char *)v2 + (int)v17) = (double)pViewport->uScreenCenterY | |
659 - v12 * *(float *)((char *)v2 + (int)v5); | |
660 *(float *)((char *)v2 + (int)v16) = v4 | |
661 - v4 / (*(float *)v9 * 1000.0 / (double)pOutdoorCamera->shading_dist_mist); | |
662 *(float *)((char *)v2 + (int)v15) = v4 / (*(float *)v9 + 0.0000001); | |
663 v13 = *(float *)v9 + 6.7553994e15; | |
664 v4 = 1.0; | |
665 *(int *)((char *)v2 + (int)v14) = LODWORD(v13); | |
666 } | |
667 else | |
668 { | |
669 *(int *)v2 = 2; | |
670 } | |
671 } | |
672 else | |
673 { | |
674 *(int *)v2 = 1; | |
675 } | |
676 ++v22; | |
677 v2 = (char *)v2 + 4; | |
678 } | |
679 while ( v22 < this->field_8C ); | |
680 } | |
681 this->field_8C = 0; | |
682 } | |
683 | |
684 | |
685 //----- (0048276F) -------------------------------------------------------- | |
686 void Polygon::_48276F_sr() | |
687 { | |
688 unsigned int v1; // ebx@1 | |
689 float v2; // edx@2 | |
690 double v3; // st7@2 | |
691 char *v4; // ecx@3 | |
692 float v5; // eax@5 | |
693 float v6; // eax@7 | |
694 float v7; // eax@9 | |
695 float v8; // ecx@13 | |
696 int i; // eax@16 | |
697 int v10; // edx@20 | |
698 RenderVertexSoft *v11; // ecx@22 | |
699 RenderVertexSoft *v12; // edx@22 | |
700 RenderVertexSoft *v13; // esi@22 | |
701 int v14; // ebx@26 | |
702 RenderVertexSoft *v15; // ebx@27 | |
703 double v16; // st6@28 | |
704 double v17; // st5@28 | |
705 double v18; // st4@28 | |
706 int v19; // [sp+4h] [bp-2Ch]@20 | |
707 int v20; // [sp+8h] [bp-28h]@22 | |
708 int v21; // [sp+Ch] [bp-24h]@22 | |
709 Polygon *v22; // [sp+10h] [bp-20h]@1 | |
710 float v23; // [sp+14h] [bp-1Ch]@11 | |
711 float v24; // [sp+18h] [bp-18h]@7 | |
712 float v25; // [sp+1Ch] [bp-14h]@5 | |
713 float v26; // [sp+20h] [bp-10h]@2 | |
714 float v27; // [sp+24h] [bp-Ch]@2 | |
715 float v28; // [sp+28h] [bp-8h]@2 | |
716 float v29; // [sp+2Ch] [bp-4h]@9 | |
717 | |
718 v1 = this->uNumVertices; | |
719 v22 = this; | |
720 if ( (signed int)v1 >= 3 ) | |
721 { | |
722 LODWORD(v2) = 0; | |
723 v26 = 10000.0; | |
724 v28 = 10000.0; | |
725 v3 = -10000.0; | |
726 v27 = -10000.0; | |
727 if ( (signed int)v1 > 0 ) | |
728 { | |
729 v4 = (char *)&array_508690[0].vWorldViewProjY; | |
730 do | |
731 { | |
732 if ( *((float *)v4 - 1) < (double)v26 ) | |
733 { | |
734 LODWORD(v5) = *((int *)v4 - 1); | |
735 v25 = v2; | |
736 v26 = v5; | |
737 } | |
738 if ( *((float *)v4 - 1) > (double)v27 ) | |
739 { | |
740 LODWORD(v6) = *((int *)v4 - 1); | |
741 v24 = v2; | |
742 v27 = v6; | |
743 } | |
744 if ( *(float *)v4 < (double)v28 ) | |
745 { | |
746 LODWORD(v7) = *(int *)v4; | |
747 v29 = v2; | |
748 v28 = v7; | |
749 } | |
750 if ( v3 < *(float *)v4 ) | |
751 { | |
752 v3 = *(float *)v4; | |
753 v23 = v2; | |
754 } | |
755 ++LODWORD(v2); | |
756 v4 += 48; | |
757 } | |
758 while ( SLODWORD(v2) < (signed int)v1 ); | |
759 } | |
760 v8 = v29; | |
761 if ( LODWORD(v29) == LODWORD(v25) || LODWORD(v29) == LODWORD(v24) ) | |
762 v8 = v23; | |
763 v29 = 0.0; | |
764 for ( i = 0; i < (signed int)v1; ++i ) | |
765 { | |
766 if ( i == LODWORD(v25) || i == LODWORD(v24) || i == LODWORD(v8) ) | |
767 { | |
768 v10 = LODWORD(v29)++; | |
769 *(&v19 + v10) = i; | |
770 } | |
771 } | |
772 v11 = &array_508690[v19]; | |
773 v12 = &array_508690[v20]; | |
774 v13 = &array_508690[v21]; | |
775 if ( LODWORD(v29) != 3 ) | |
776 { | |
777 v11 = array_508690; | |
778 v13 = (RenderVertexSoft *)((char *)array_508690 + 16 * (3 * v1 - 3)); | |
779 v12 = &array_508690[1]; | |
780 v28 = array_508690[1].vWorldPosition.x - array_508690[0].vWorldPosition.x; | |
781 v27 = array_508690[1].vWorldPosition.y - array_508690[0].vWorldPosition.y; | |
782 v29 = array_508690[1].vWorldPosition.z - array_508690[0].vWorldPosition.z; | |
783 v26 = v13->vWorldPosition.x - array_508690[0].vWorldPosition.x; | |
784 v25 = v13->vWorldPosition.y - array_508690[0].vWorldPosition.y; | |
785 v24 = v13->vWorldPosition.z - array_508690[0].vWorldPosition.z; | |
786 if ( v24 * v27 - v25 * v29 == 0.0 ) | |
787 { | |
788 if ( v26 * v29 - v24 * v28 == 0.0 ) | |
789 { | |
790 if ( v25 * v28 - v26 * v27 == 0.0 ) | |
791 { | |
792 v14 = v1 - 2; | |
793 LODWORD(v26) = v14; | |
794 if ( v14 >= 2 ) | |
795 { | |
796 v15 = &array_508690[v14]; | |
797 do | |
798 { | |
799 v16 = v15->vWorldPosition.x - array_508690[0].vWorldPosition.x; | |
800 v17 = v15->vWorldPosition.y - array_508690[0].vWorldPosition.y; | |
801 v18 = v15->vWorldPosition.z - array_508690[0].vWorldPosition.z; | |
802 v13 = v15; | |
803 if ( v27 * v18 - v17 * v29 != 0.0 ) | |
804 break; | |
805 if ( v16 * v29 - v18 * v28 != 0.0 ) | |
806 break; | |
807 if ( v28 * v17 - v16 * v27 != 0.0 ) | |
808 break; | |
809 --LODWORD(v26); | |
810 --v15; | |
811 } | |
812 while ( SLODWORD(v26) >= 2 ); | |
813 } | |
814 } | |
815 } | |
816 } | |
817 } | |
818 sr_sub_4829B9(v11, v12, v13, v22, 1); | |
819 } | |
820 } | |
821 | |
822 | |
823 //----- (004829B9) -------------------------------------------------------- | |
824 Polygon *__fastcall sr_sub_4829B9(RenderVertexSoft *a1, RenderVertexSoft *a2, RenderVertexSoft *a3, Polygon *a4, int a5) | |
825 { | |
826 double v5; // st7@1 | |
827 RenderVertexSoft *v6; // esi@1 | |
828 double v7; // st6@1 | |
829 Polygon *result; // eax@3 | |
830 double v9; // st6@3 | |
831 double v10; // st5@3 | |
832 float v11; // ST0C_4@3 | |
833 float v12; // ST04_4@3 | |
834 double v13; // st4@3 | |
835 float v14; // [sp+8h] [bp-Ch]@1 | |
836 float v15; // [sp+10h] [bp-4h]@1 | |
837 float v16; // [sp+1Ch] [bp+8h]@1 | |
838 float v17; // [sp+1Ch] [bp+8h]@3 | |
839 | |
840 v5 = a2->vWorldViewProjX - a1->vWorldViewProjX; | |
841 v6 = a3; | |
842 v16 = a3->vWorldViewProjY - a1->vWorldViewProjY; | |
843 v15 = a2->vWorldViewProjY - a1->vWorldViewProjY; | |
844 v14 = v6->vWorldViewProjX - a1->vWorldViewProjX; | |
845 v7 = v16 * v5 - v14 * v15; | |
846 if ( v7 == 0.0 ) | |
847 v7 = 0.0000001; | |
848 result = a4; | |
849 v9 = 1.0 / v7; | |
850 v10 = 1.0 / a1->vWorldViewPosition.x; | |
851 v11 = 1.0 / a2->vWorldViewPosition.x - v10; | |
852 v12 = 1.0 / v6->vWorldViewPosition.x - v10; | |
853 v13 = (v11 * v16 - v12 * v15) * v9; | |
854 v17 = (v11 * v14 - v12 * v5) * -v9; | |
855 a4->field_C = a1->vWorldViewProjX; | |
856 a4->field_10 = a1->vWorldViewProjY; | |
857 a4->field_0 = v10; | |
858 a4->field_8 = v17; | |
859 a4->field_4 = v13; | |
860 return result; | |
861 } | |
862 | |
863 //----- (00481DB2) -------------------------------------------------------- | |
864 char __fastcall sr_sub_481DB2(RenderVertexSoft *a1, signed int a2, Polygon *a3) | |
865 { | |
866 int v3; // eax@2 | |
867 int v4; // esi@2 | |
868 signed int v5; // esi@2 | |
869 char *v6; // edi@3 | |
870 double v7; // ST14_8@4 | |
871 double v8; // ST0C_8@4 | |
872 char result; // al@5 | |
873 | |
874 if ( a2 >= 3 ) | |
875 { | |
876 v3 = a3->uTileBitmapID; | |
877 v4 = a3->uTileBitmapID; | |
878 a3->ptr_38 = &stru_8019C8; | |
879 a3->pTexture = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0); | |
880 v5 = 0; | |
881 if ( (signed int)a3->uNumVertices > 0 ) | |
882 { | |
883 v6 = (char *)&array_508690[0].vWorldViewProjY; | |
884 do | |
885 { | |
886 v7 = *((float *)v6 - 1) + 6.7553994e15; | |
887 dword_50B638[v5] = LODWORD(v7); | |
888 v8 = *(float *)v6 + 6.7553994e15; | |
889 v6 += 48; | |
890 dword_50B570[v5++] = LODWORD(v8); | |
891 } | |
892 while ( v5 < (signed int)a3->uNumVertices ); | |
893 } | |
894 result = sr_sub_486B4E_push_outdoor_edges(a1, dword_50B638.data(), dword_50B570.data(), a3); | |
895 } | |
896 return result; | |
897 } | |
898 | |
899 //----- (00486B4E) -------------------------------------------------------- | |
900 char __fastcall sr_sub_486B4E_push_outdoor_edges(RenderVertexSoft *a1, int *a2, int *a3, Polygon *a4)//maybe DrawPolygonSW | |
901 { | |
902 Polygon *v4; // esi@1 | |
903 RenderVertexSoft *v5; // edi@1 | |
904 char v6; // zf@1 | |
905 unsigned int v7; // eax@3 | |
906 int v8; // ebx@3 | |
907 int *v9; // ecx@7 | |
908 int v10; // ebx@8 | |
909 int v11; // eax@10 | |
910 double v12; // st7@14 | |
911 int *v13; // edx@14 | |
912 double v14; // st6@14 | |
913 double v15; // st7@16 | |
914 int v16; // edi@16 | |
915 double v17; // st7@16 | |
916 double v18; // st7@16 | |
917 int v19; // edi@18 | |
918 double v20; // st7@18 | |
919 double v21; // st7@18 | |
920 Edge *i; // edx@20 | |
921 double v23; // st7@28 | |
922 Edge *v24; // eax@28 | |
923 std::string v26; // [sp-18h] [bp-98h]@2 | |
924 const char *v27; // [sp-8h] [bp-88h]@2 | |
925 int v28; // [sp-4h] [bp-84h]@2 | |
926 double v29; // [sp+Ch] [bp-74h]@28 | |
927 double v30; // [sp+14h] [bp-6Ch]@28 | |
928 double v31; // [sp+1Ch] [bp-64h]@20 | |
929 double v32; // [sp+24h] [bp-5Ch]@16 | |
930 double v33; // [sp+2Ch] [bp-54h]@14 | |
931 unsigned int v34; // [sp+34h] [bp-4Ch]@2 | |
932 unsigned __int64 v35; // [sp+38h] [bp-48h]@28 | |
933 int v36; // [sp+40h] [bp-40h]@28 | |
934 int v37; // [sp+44h] [bp-3Ch]@20 | |
935 float v38; // [sp+48h] [bp-38h]@18 | |
936 int v39; // [sp+4Ch] [bp-34h]@16 | |
937 int v40; // [sp+50h] [bp-30h]@14 | |
938 int v41; // [sp+54h] [bp-2Ch]@3 | |
939 RenderVertexSoft *v42; // [sp+58h] [bp-28h]@1 | |
940 int v43; // [sp+5Ch] [bp-24h]@14 | |
941 int v44; // [sp+60h] [bp-20h]@6 | |
942 int v45; // [sp+64h] [bp-1Ch]@6 | |
943 unsigned int v46; // [sp+68h] [bp-18h]@7 | |
944 int *v47; // [sp+6Ch] [bp-14h]@1 | |
945 int v48; // [sp+70h] [bp-10h]@7 | |
946 float *v49; // [sp+74h] [bp-Ch]@7 | |
947 float v50; // [sp+78h] [bp-8h]@10 | |
948 float v51; // [sp+7Ch] [bp-4h]@14 | |
949 | |
950 v4 = a4; | |
951 v5 = a1; | |
952 v47 = a2; | |
953 v6 = (HIBYTE(a4->flags) & 0x40) == 0; | |
954 v42 = a1; | |
955 if ( !v6 ) | |
956 { | |
957 MessageBoxW(nullptr, L"The Texture Frame Table is not a supported feature.", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odspan.cpp:162", 0); | |
958 } | |
959 LOBYTE(v7) = v4->field_108; | |
960 v8 = v4->uNumVertices; | |
961 v4->field_108 = 0; | |
962 BYTE3(a4) = v7; | |
963 v41 = v8; | |
964 if ( v8 > 0 ) | |
965 { | |
966 if ( (signed int)pOutdoorCamera->uNumSurfs < 1999 ) | |
967 { | |
968 v7 = pOutdoorCamera->uNumEdges; | |
969 if ( (signed int)pOutdoorCamera->uNumEdges < 5979 ) | |
970 { | |
971 v4->uEdgeList1Size = 0; | |
972 v4->uEdgeList2Size = 0; | |
973 v45 = -1; | |
974 v34 = v7; | |
975 v28 = v8; | |
976 v27 = (const char *)v5; | |
977 v44 = 10000; | |
978 pGame->pLightmapBuilder->_45CB89(v5, v8); | |
979 if ( v8 > 0 ) | |
980 { | |
981 v9 = a3; | |
982 v48 = 1; | |
983 v49 = &v5->flt_2C; | |
984 v46 = (char *)v47 - (char *)a3; | |
985 do | |
986 { | |
987 v10 = v48; | |
988 ++pOutdoorCamera->uNumEdges; | |
989 if ( v48 >= v41 ) | |
990 v10 = 0; | |
991 v11 = *v9; | |
992 LODWORD(v50) = *v9; | |
993 if ( SLODWORD(v50) > v45 ) | |
994 v45 = v11; | |
995 if ( v11 < v44 ) | |
996 v44 = v11; | |
997 v12 = (double)SLODWORD(v50); | |
998 v13 = &a3[v10]; | |
999 v51 = v12; | |
1000 v14 = (double)*v13; | |
1001 v50 = v14; | |
1002 *(float *)&v40 = v14 - v12; | |
1003 v33 = *(float *)&v40 + 6.7553994e15; | |
1004 v43 = LODWORD(v33); | |
1005 if ( LODWORD(v33) ) | |
1006 { | |
1007 if ( SLODWORD(v33) >= 0 ) | |
1008 { | |
1009 v19 = (int)((char *)v9 + v46); | |
1010 ptr_80C978_Edges->field_8 = 1; | |
1011 LODWORD(v38) = (int)&v47[v10]; | |
1012 v40 = *(unsigned int *)LODWORD(v38) - *(int *)v19; | |
1013 v6 = BYTE3(a4) == 0; | |
1014 v20 = (double)v40; | |
1015 v40 = *v13 - *v9; | |
1016 v21 = v20 / (double)v40; | |
1017 ptr_80C978_Edges->field_4 = v21; | |
1018 ptr_80C978_Edges->field_0 = (v51 - (double)*v9) * v21 + (double)*(signed int *)v19; | |
1019 if ( !v6 ) | |
1020 { | |
1021 ptr_80C978_Edges->field_1C = *v49; | |
1022 ptr_80C978_Edges->field_20 = v42[v10].flt_2C; | |
1023 ptr_80C978_Edges->field_24 = (double)*(signed int *)v19; | |
1024 ptr_80C978_Edges->field_28 = (double)(signed int)*(unsigned int *)LODWORD(v38); | |
1025 ptr_80C978_Edges->field_2C = (double)*v9; | |
1026 ptr_80C978_Edges->field_30 = (double)*v13; | |
1027 v4->pEdgeList1[v4->uEdgeList1Size++] = ptr_80C978_Edges; | |
1028 } | |
1029 } | |
1030 else | |
1031 { | |
1032 v32 = v51 + 6.7553994e15; | |
1033 v39 = LODWORD(v32); | |
1034 v51 = v50; | |
1035 v15 = (double)SLODWORD(v32); | |
1036 ptr_80C978_Edges->field_8 = 0; | |
1037 v16 = (int)&v47[v10]; | |
1038 v50 = v15; | |
1039 v40 = *(int *)((char *)v9 + v46) - *(int *)v16; | |
1040 v6 = BYTE3(a4) == 0; | |
1041 v17 = (double)v40; | |
1042 v40 = *v9 - *v13; | |
1043 v18 = v17 / (double)v40; | |
1044 ptr_80C978_Edges->field_4 = v18; | |
1045 ptr_80C978_Edges->field_0 = (v51 - (double)*v13) * v18 + (double)*(signed int *)v16; | |
1046 if ( !v6 ) | |
1047 { | |
1048 ptr_80C978_Edges->field_1C = v42[v10].flt_2C; | |
1049 ptr_80C978_Edges->field_20 = *v49; | |
1050 ptr_80C978_Edges->field_24 = (double)*(signed int *)v16; | |
1051 ptr_80C978_Edges->field_28 = (double)*(int *)((char *)v9 + v46); | |
1052 ptr_80C978_Edges->field_2C = (double)*v13; | |
1053 ptr_80C978_Edges->field_30 = (double)*v9; | |
1054 v4->pEdgeList2[v4->uEdgeList2Size++] = ptr_80C978_Edges; | |
1055 } | |
1056 } | |
1057 v31 = v51 + 6.7553994e15; | |
1058 v37 = LODWORD(v31); | |
1059 for ( i = &pNewEdges[LODWORD(v31)]; i->pNext->field_0 < (double)ptr_80C978_Edges->field_0; i = i->pNext ) | |
1060 ; | |
1061 if ( i->field_0 != ptr_80C978_Edges->field_0 || i->field_8 || ptr_80C978_Edges->field_8 != 1 ) | |
1062 { | |
1063 ptr_80C978_Edges->pNext = i->pNext; | |
1064 i->pNext = ptr_80C978_Edges; | |
1065 } | |
1066 else | |
1067 { | |
1068 ptr_80C978_Edges->pNext = i; | |
1069 i->pPrev->pNext = ptr_80C978_Edges; | |
1070 } | |
1071 v23 = v50 - 1.0; | |
1072 *(float *)&v40 = v23; | |
1073 v38 = v23; | |
1074 v30 = v38 + 6.7553994e15; | |
1075 v36 = LODWORD(v30); | |
1076 ptr_80C978_Edges->ptr_18 = ptr_80CA10[LODWORD(v30)]; | |
1077 v29 = *(float *)&v40 + 6.7553994e15; | |
1078 v35 = __PAIR__(v40, LODWORD(v29)); | |
1079 v24 = ptr_80C978_Edges; | |
1080 ptr_80CA10[LODWORD(v29)] = ptr_80C978_Edges; | |
1081 v24->pSurf = ptr_80C97C_Surfs; | |
1082 if ( ptr_80C978_Edges < &pEdges[5999] ) | |
1083 ++ptr_80C978_Edges; | |
1084 } | |
1085 ++v48; | |
1086 v49 += 12; | |
1087 ++v9; | |
1088 } | |
1089 while ( v48 - 1 < v41 ); | |
1090 } | |
1091 LOBYTE(v7) = v34; | |
1092 if ( pOutdoorCamera->uNumEdges != v34 ) | |
1093 { | |
1094 v4->ptr_48 = 0; | |
1095 ptr_80C97C_Surfs->field_22 = 0; | |
1096 ptr_80C97C_Surfs->pParent = v4; | |
1097 ptr_80C97C_Surfs->field_4 = v4->field_4; | |
1098 ptr_80C97C_Surfs->field_8 = v4->field_8; | |
1099 ptr_80C97C_Surfs->field_0 = v4->field_0; | |
1100 ptr_80C97C_Surfs->field_C = v4->field_C; | |
1101 ptr_80C97C_Surfs->field_10 = v4->field_10; | |
1102 LOBYTE(v7) = (char)pSurfs + 28; | |
1103 if ( ptr_80C97C_Surfs < &pSurfs[1999] ) | |
1104 { | |
1105 ++ptr_80C97C_Surfs; | |
1106 ++pOutdoorCamera->uNumSurfs; | |
1107 } | |
1108 if ( BYTE3(a4) ) | |
1109 v4->field_108 = 1; | |
1110 } | |
1111 } | |
1112 } | |
1113 } | |
1114 return v7; | |
1115 } | |
1116 | |
1117 //----- (00482A94) -------------------------------------------------------- | |
1118 int sr_sub_482A94(Span *_this) | |
1119 { | |
1120 stru315 *v1; // ebp@0 | |
1121 Span *v2; // edi@1 | |
1122 Polygon *v3; // esi@1 | |
1123 int v4; // ecx@1 | |
1124 stru149 *v5; // eax@1 | |
1125 stru149 *v6; // eax@1 | |
1126 int v7; // edx@1 | |
1127 int v8; // eax@1 | |
1128 int v9; // ecx@1 | |
1129 int v10; // edx@1 | |
1130 int v11; // ebx@1 | |
1131 int v12; // eax@1 | |
1132 signed int v13; // ebx@1 | |
1133 int v14; // ebx@2 | |
1134 signed __int64 v15; // qtt@3 | |
1135 stru149 *v16; // eax@3 | |
1136 signed int v17; // ebx@3 | |
1137 Texture *v18; // eax@14 | |
1138 unsigned __int16 *v19; // eax@15 | |
1139 stru149 *v20; // eax@21 | |
1140 signed int v21; // eax@21 | |
1141 int v22; // eax@21 | |
1142 int v23; // ecx@21 | |
1143 Texture *v24; // edx@21 | |
1144 signed int v25; // eax@21 | |
1145 signed int v27; // [sp-4h] [bp-A4h]@8 | |
1146 int v28; // [sp+Ch] [bp-94h]@1 | |
1147 int v29; // [sp+10h] [bp-90h]@1 | |
1148 stru316 a2; // [sp+14h] [bp-8Ch]@21 | |
1149 stru315 a1; // [sp+3Ch] [bp-64h]@1 | |
1150 int v32; // [sp+80h] [bp-20h]@1 | |
1151 int v33; // [sp+84h] [bp-1Ch]@1 | |
1152 int v34; // [sp+88h] [bp-18h]@1 | |
1153 int v35; // [sp+8Ch] [bp-14h]@1 | |
1154 int v36; // [sp+90h] [bp-10h]@1 | |
1155 int v37; // [sp+94h] [bp-Ch]@1 | |
1156 int v38; // [sp+98h] [bp-8h]@1 | |
1157 int X; // [sp+9Ch] [bp-4h]@1 | |
1158 | |
1159 v2 = _this; | |
1160 v3 = _this->pParent; | |
1161 v4 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - _this->field_A); | |
1162 v5 = v3->ptr_38; | |
1163 v38 = v4; | |
1164 v37 = v5->field_14; | |
1165 v38 = (unsigned __int64)(v37 * (signed __int64)v4) >> 16; | |
1166 v6 = v3->ptr_38; | |
1167 v7 = v38 + v6->field_C; | |
1168 v37 = v6->field_20; | |
1169 v33 = v7; | |
1170 v8 = ((unsigned __int64)(v37 * (signed __int64)v4) >> 16) + v3->ptr_38->field_18; | |
1171 v38 = v4; | |
1172 v34 = v8; | |
1173 v37 = v3->v_18.z; | |
1174 v38 = (unsigned __int64)(v37 * (signed __int64)v4) >> 16; | |
1175 v9 = v3->v_18.x; | |
1176 v28 = v3->sTextureDeltaU << 16; | |
1177 v35 = v3->sTextureDeltaV << 16; | |
1178 v10 = v2->field_8; | |
1179 v29 = pOutdoorCamera->camera_rotation_y_int_sine; | |
1180 v32 = pOutdoorCamera->camera_rotation_y_int_cosine; | |
1181 a1.field_28 = v2->field_C; | |
1182 v11 = v3->field_24; | |
1183 v37 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v10); | |
1184 v12 = v3->v_18.y; | |
1185 v13 = -v11; | |
1186 v36 = v13; | |
1187 X = ((unsigned __int64)(v37 * (signed __int64)v12) >> 16) + v38 + v9; | |
1188 if ( !X || (v14 = abs(v13 >> 14), v14 > abs(X)) ) | |
1189 return 0; | |
1190 LODWORD(v15) = v36 << 16; | |
1191 HIDWORD(v15) = v36 >> 16; | |
1192 v38 = v15 / X; | |
1193 v16 = v3->ptr_38; | |
1194 X = v37; | |
1195 v36 = v16->field_10; | |
1196 X = v37; | |
1197 v36 = v33 + ((unsigned __int64)(v36 * (signed __int64)v37) >> 16); | |
1198 v33 = v3->ptr_38->field_1C; | |
1199 X = (unsigned __int64)(v33 * (signed __int64)v37) >> 16; | |
1200 v34 += (unsigned __int64)(v33 * (signed __int64)v37) >> 16; | |
1201 v17 = 2; | |
1202 a1.pTextureLOD = (unsigned __int16 *)v3->pTexture->pLevelOfDetail2; | |
1203 if ( v38 >= mipmapping_building_mm1 << 16 ) | |
1204 { | |
1205 if ( v38 >= mipmapping_building_mm2 << 16 ) | |
1206 { | |
1207 if ( v38 >= mipmapping_building_mm3 << 16 ) | |
1208 { | |
1209 if ( bUseLoResSprites ) | |
1210 goto LABEL_12; | |
1211 v27 = 3; | |
1212 } | |
1213 else | |
1214 { | |
1215 v27 = 2; | |
1216 } | |
1217 v17 = v27; | |
1218 goto LABEL_12; | |
1219 } | |
1220 v17 = 1; | |
1221 } | |
1222 else | |
1223 { | |
1224 v17 = 0; | |
1225 } | |
1226 LABEL_12: | |
1227 if ( v17 < (signed int)v3->ptr_48 ) | |
1228 v17 = (signed int)v3->ptr_48; | |
1229 v18 = v3->pTexture; | |
1230 if ( v17 ) | |
1231 { | |
1232 if ( v17 == 1 ) | |
1233 { | |
1234 v19 = (unsigned __int16 *)v18->pLevelOfDetail1; | |
1235 } | |
1236 else | |
1237 { | |
1238 if ( v17 == 2 ) | |
1239 v19 = (unsigned __int16 *)v18->pLevelOfDetail2; | |
1240 else | |
1241 v19 = (unsigned __int16 *)v18->pLevelOfDetail3; | |
1242 } | |
1243 } | |
1244 else | |
1245 { | |
1246 v19 = (unsigned __int16 *)v18->pLevelOfDetail0_prolly_alpha_mask; | |
1247 } | |
1248 a1.pTextureLOD = v19; | |
1249 X = (unsigned __int64)(v36 * (signed __int64)v38) >> 16; | |
1250 v20 = v3->ptr_38; | |
1251 X = v38; | |
1252 a1.field_30 = v28 + ((unsigned __int64)(v36 * (signed __int64)v38) >> 16) - v20->field_24; | |
1253 X = (unsigned __int64)(v34 * (signed __int64)v38) >> 16; | |
1254 v21 = X - v3->ptr_38->field_28 - v35; | |
1255 a1.field_30 >>= v17 + bUseLoResSprites; | |
1256 a1.field_2C = v21 >> (v17 + bUseLoResSprites); | |
1257 v35 = pOutdoorCamera->int_fov_rad_inv; | |
1258 v37 = (signed int)((unsigned __int64)(pOutdoorCamera->int_fov_rad_inv * (signed __int64)v38) >> 16) >> (v17 + bUseLoResSprites); | |
1259 a1.field_4 = (unsigned __int64)(v37 * (signed __int64)v29) >> 16; | |
1260 X = (unsigned __int64)(v37 * (signed __int64)v32) >> 16; | |
1261 a1.field_0 = -(signed int)((unsigned __int64)(v37 * (signed __int64)v32) >> 16); | |
1262 v22 = v2->field_A; | |
1263 a1.pColorBuffer = &pRenderer->pTargetSurface[v2->field_8 + pRenderer->uTargetSurfacePitch * v2->field_A]; | |
1264 HIWORD(v23) = HIWORD(v38); | |
1265 a1.pDepthBuffer = (unsigned int *)&pRenderer->pActiveZBuffer[v2->field_8 + 640 * v22]; | |
1266 LOWORD(v23) = 0; | |
1267 a1.field_24 = v23 | v3->field_50; | |
1268 v24 = v3->pTexture; | |
1269 v32 = (signed int)v24->uTextureWidth >> v17; | |
1270 v25 = (signed int)v24->uTextureHeight >> v17; | |
1271 a1.field_10 = v17 - v24->uWidthLn2 + 16; | |
1272 a1.field_C = v32 - 1; | |
1273 a1.field_8 = (v25 << 16) - 65536; | |
1274 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v2, v38, v3, pOutdoorCamera->building_gamme, 1u, 1); | |
1275 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
1276 sr_sub_485975(&a1, (stru315 *)&a2); | |
1277 else | |
1278 sr_sub_4D6FB0(v1); | |
1279 return 1; | |
1280 } | |
1281 | |
1282 //----- (004789DE) -------------------------------------------------------- | |
1283 BSPModel *Render::DrawBuildingsSW() | |
1284 { | |
1285 BSPModel *result; // eax@1 | |
1286 BSPModel *v1; // ebx@2 | |
1287 int v2; // eax@4 | |
1288 ODMFace *v3; // edi@4 | |
1289 int v4; // ecx@6 | |
1290 int v5; // eax@6 | |
1291 int v6; // ecx@6 | |
1292 int v7; // ecx@6 | |
1293 double v8; // st7@7 | |
1294 char *v9; // ebx@7 | |
1295 int v10; // eax@9 | |
1296 double v11; // st7@9 | |
1297 Polygon *v12; // ebx@19 | |
1298 double v13; // st7@21 | |
1299 double v14; // ST4C_8@23 | |
1300 int v15; // eax@23 | |
1301 int v16; // eax@27 | |
1302 int v17; // ecx@29 | |
1303 unsigned __int8 v18; // sf@29 | |
1304 unsigned __int8 v19; // of@29 | |
1305 int v20; // ecx@30 | |
1306 int v21; // eax@31 | |
1307 int v22; // eax@31 | |
1308 int v23; // eax@35 | |
1309 int v24; // eax@39 | |
1310 Texture *v25; // eax@43 | |
1311 int v26; // esi@43 | |
1312 signed int v27; // ecx@43 | |
1313 double v28; // st6@43 | |
1314 double v29; // st5@43 | |
1315 unsigned short *v30; // edx@44 | |
1316 int v31; // eax@44 | |
1317 double v32; // st4@45 | |
1318 int v33; // ecx@45 | |
1319 char v34; // zf@45 | |
1320 BSPVertexBuffer *v35; // eax@50 | |
1321 unsigned int v36; // eax@53 | |
1322 signed int v37; // esi@53 | |
1323 int v38; // eax@54 | |
1324 signed int v39; // edx@55 | |
1325 char *v40; // ecx@56 | |
1326 double v41; // ST1C_8@57 | |
1327 double v42; // ST24_8@57 | |
1328 signed int v43; // eax@60 | |
1329 signed int v44; // esi@60 | |
1330 int v45; // eax@61 | |
1331 signed int v46; // edx@62 | |
1332 char *v47; // ecx@63 | |
1333 double v48; // ST34_8@64 | |
1334 double v49; // ST44_8@64 | |
1335 int v50; // eax@66 | |
1336 signed int v51; // ecx@67 | |
1337 char *v52; // edx@68 | |
1338 double v53; // ST3C_8@69 | |
1339 double v54; // ST2C_8@69 | |
1340 float v55; // [sp+44h] [bp-7Ch]@50 | |
1341 float v56; // [sp+48h] [bp-78h]@50 | |
1342 float v57; // [sp+4Ch] [bp-74h]@50 | |
1343 float v58; // [sp+50h] [bp-70h]@64 | |
1344 int v59; // [sp+54h] [bp-6Ch]@64 | |
1345 int v60; // [sp+58h] [bp-68h]@69 | |
1346 float v61; // [sp+5Ch] [bp-64h]@64 | |
1347 float v62; // [sp+60h] [bp-60h]@69 | |
1348 float v63; // [sp+64h] [bp-5Ch]@57 | |
1349 float v64; // [sp+68h] [bp-58h]@57 | |
1350 int v65; // [sp+6Ch] [bp-54h]@64 | |
1351 int v66; // [sp+70h] [bp-50h]@1 | |
1352 int v67; // [sp+74h] [bp-4Ch]@6 | |
1353 int v68; // [sp+78h] [bp-48h]@4 | |
1354 int v69; // [sp+7Ch] [bp-44h]@57 | |
1355 int v70; // [sp+80h] [bp-40h]@69 | |
1356 int v71; // [sp+84h] [bp-3Ch]@23 | |
1357 float v72; // [sp+88h] [bp-38h]@69 | |
1358 int v73; // [sp+8Ch] [bp-34h]@57 | |
1359 int v74; // [sp+90h] [bp-30h]@6 | |
1360 int v75; // [sp+94h] [bp-2Ch]@6 | |
1361 ODMFace *v76; // [sp+98h] [bp-28h]@4 | |
1362 int v77; // [sp+9Ch] [bp-24h]@6 | |
1363 BSPModel *v78; // [sp+A0h] [bp-20h]@2 | |
1364 int v79; // [sp+A4h] [bp-1Ch]@4 | |
1365 int a1; // [sp+A8h] [bp-18h]@1 | |
1366 unsigned short *v81; // [sp+ACh] [bp-14h]@7 | |
1367 int v82; // [sp+B0h] [bp-10h]@6 | |
1368 int v83; // [sp+B4h] [bp-Ch]@6 | |
1369 signed int v84; // [sp+B8h] [bp-8h]@7 | |
1370 int a2; // [sp+BCh] [bp-4h]@1 | |
1371 | |
1372 a2 = 0; | |
1373 a1 = 0; | |
1374 result = (BSPModel *)pOutdoor->pBModels; | |
1375 v66 = pOutdoor->uNumBModels; | |
1376 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
1377 { | |
1378 v1 = pOutdoor->pBModels; | |
1379 v78 = pOutdoor->pBModels; | |
1380 while ( 1 ) | |
1381 { | |
1382 if ( IsBModelVisible(a1, &a2) ) | |
1383 { | |
1384 v1->field_40 |= 1u; | |
1385 v2 = v1->uNumFaces; | |
1386 v3 = v1->pFaces; | |
1387 v74 = 0; | |
1388 v76 = v3; | |
1389 v68 = v2; | |
1390 if ( v2 > 0 ) | |
1391 break; | |
1392 } | |
1393 LABEL_73: | |
1394 ++a1; | |
1395 ++v1; | |
1396 result = (BSPModel *)a1; | |
1397 v78 = v1; | |
1398 if ( a1 >= v66 ) | |
1399 return result; | |
1400 } | |
1401 while ( 1 ) | |
1402 { | |
1403 if ( !v3->Invisible() ) | |
1404 { | |
1405 v4 = 3 * v3->pVertexIDs[0]; | |
1406 v5 = (int)((char *)v1 - 8); | |
1407 v67 = (int)((char *)v1 - 8); | |
1408 v6 = *(_DWORD *)(*(&v1->uNumConvexFaces - 2) + 4 * v4 + 8) + 4; | |
1409 v82 = 0; | |
1410 v83 = v6; | |
1411 v74 = 0; | |
1412 v7 = v3->uNumVertices; | |
1413 v75 = 0; | |
1414 v77 = v7; | |
1415 if ( v7 > 0 ) | |
1416 { | |
1417 v8 = (double)v83; | |
1418 v9 = (char *)&array_73D150[0].vWorldViewPosition; | |
1419 v81 = v3->pVertexIDs; | |
1420 v83 = v7; | |
1421 *(float *)&v84 = v8; | |
1422 while ( 1 ) | |
1423 { | |
1424 v10 = *(int *)(v5 + 4) + 12 * *(short *)v81; | |
1425 *((float *)v9 - 3) = (double)*(signed int *)v10 + 4.0; | |
1426 *((float *)v9 - 2) = (double)*(signed int *)(v10 + 4) + 4.0; | |
1427 v11 = (double)*(signed int *)(v10 + 8) + 4.0; | |
1428 *((float *)v9 - 1) = v11; | |
1429 if ( *(float *)&v84 == v11 ) | |
1430 ++v82; | |
1431 pGame->pIndoorCameraD3D->ViewTransform((RenderVertexSoft *)(v9 - 12), 1u); | |
1432 if ( *(float *)v9 < 8.0 || (double)pOutdoorCamera->shading_dist_mist < *(float *)v9 ) | |
1433 { | |
1434 if ( *(float *)v9 >= 8.0 ) | |
1435 v75 = 1; | |
1436 else | |
1437 v74 = 1; | |
1438 } | |
1439 else | |
1440 { | |
1441 pGame->pIndoorCameraD3D->Project((RenderVertexSoft *)(v9 - 12), 1u, 0); | |
1442 } | |
1443 v81 += 2; | |
1444 v9 += 48; | |
1445 --v83; | |
1446 if ( !v83 ) | |
1447 break; | |
1448 v5 = v67; | |
1449 } | |
1450 v7 = v77; | |
1451 } | |
1452 v12 = &array_77EC08[pOutdoorCamera->uNumPolygons]; | |
1453 *(int *)&v12->flags = 0; | |
1454 if ( v82 == v7 ) | |
1455 *(int *)&v12->flags = 65536; | |
1456 v12->pODMFace = v3; | |
1457 v12->uNumVertices = v7; | |
1458 v12->field_59 = 5; | |
1459 v84 = v3->pFacePlane.vNormal.x; | |
1460 v83 = (unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.x) >> 16; | |
1461 v82 = -pOutdoor->vSunlight.y; | |
1462 v84 = v3->pFacePlane.vNormal.y; | |
1463 v82 = (unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.y) >> 16; | |
1464 v81 = (unsigned __int16 *)-pOutdoor->vSunlight.z; | |
1465 v84 = v3->pFacePlane.vNormal.z; | |
1466 v81 = (unsigned __int16 *)((unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.z) >> 16); | |
1467 v84 = v83 + v82 + ((unsigned __int64)(v84 * (signed __int64)-pOutdoor->vSunlight.z) >> 16); | |
1468 v13 = (double)v84 * 0.000015258789; | |
1469 if ( v13 < 0.0 ) | |
1470 v13 = 0.0; | |
1471 *(float *)&v84 = v13 * 31.0; | |
1472 v14 = *(float *)&v84 + 6.7553994e15; | |
1473 v71 = LODWORD(v14); | |
1474 v15 = (int)&v12->dimming_level; | |
1475 v12->dimming_level = 31 - LOBYTE(v14); | |
1476 if ( (char)(31 - LOBYTE(v14)) < 0 ) | |
1477 *(char *)v15 = 0; | |
1478 if ( *(char *)v15 > 31 ) | |
1479 *(char *)v15 = 31; | |
1480 v16 = v3->uTextureID; | |
1481 if ( BYTE1(v3->uAttributes) & 0x40 ) | |
1482 v16 = pTextureFrameTable->GetFrameTexture(v16, pEventTimer->uTotalGameTimeElapsed); | |
1483 v17 = v16; | |
1484 result = (BSPModel *)&pBitmaps_LOD->pTextures[v16]; | |
1485 v19 = __OFSUB__(pOutdoorCamera->uNumPolygons, 1999); | |
1486 v18 = pOutdoorCamera->uNumPolygons - 1999 < 0; | |
1487 v12->pTexture = (Texture *)(v17 != -1 ? (int)result : 0); | |
1488 if ( !(v18 ^ v19) ) | |
1489 return result; | |
1490 ++pOutdoorCamera->uNumPolygons; | |
1491 ++pOutdoorCamera->field_44; | |
1492 if ( !ODMFace::IsBackfaceCulled(v3, array_73D150, v12) ) | |
1493 { | |
1494 LABEL_71: | |
1495 --pOutdoorCamera->uNumPolygons; | |
1496 --pOutdoorCamera->field_44; | |
1497 goto LABEL_72; | |
1498 } | |
1499 LOBYTE(v20) = v79; | |
1500 v21 = a1; | |
1501 v3->bVisible = 1; | |
1502 v12->uBModelFaceID = v20; | |
1503 LOWORD(v20) = (unsigned __int8)v20; | |
1504 v12->uBModelID = v21; | |
1505 v22 = 8 * (v20 | (v21 << 6)); | |
1506 LOBYTE(v22) = v22 | 6; | |
1507 v12->field_50 = v22; | |
1508 if ( v3->uAttributes & 0x10 ) | |
1509 *(int *)&v12->flags |= 2u; | |
1510 if ( BYTE2(v3->uAttributes) & 0x40 ) | |
1511 HIBYTE(v12->flags) |= 4u; | |
1512 v23 = v3->uAttributes; | |
1513 if ( v23 & 4 ) | |
1514 { | |
1515 HIBYTE(v12->flags) |= 4u; | |
1516 } | |
1517 else | |
1518 { | |
1519 if ( v23 & 0x20 ) | |
1520 HIBYTE(v12->flags) |= 8u; | |
1521 } | |
1522 v24 = v3->uAttributes; | |
1523 if ( BYTE1(v24) & 8 ) | |
1524 { | |
1525 HIBYTE(v12->flags) |= 0x20u; | |
1526 } | |
1527 else | |
1528 { | |
1529 if ( v24 & 0x40 ) | |
1530 HIBYTE(v12->flags) |= 0x10u; | |
1531 } | |
1532 v25 = v12->pTexture; | |
1533 v26 = v77; | |
1534 v27 = v25->uTextureWidth; | |
1535 v84 = v25->uTextureHeight; | |
1536 v28 = 1.0 / (double)v27; | |
1537 v29 = 1.0 / (double)v84; | |
1538 if ( v77 > 0 ) | |
1539 { | |
1540 v30 = v3->pTextureVIDs; | |
1541 v31 = 0; | |
1542 v83 = v77; | |
1543 do | |
1544 { | |
1545 v32 = 1.0 / (*(float *)(v31 * 48 + 7590236) + 0.0000001); | |
1546 memcpy(&array_50AC10[v31], &array_73D150[v31], sizeof(array_50AC10[v31])); | |
1547 ++v31; | |
1548 array_50A2B0[v31 + 49]._rhw = v32; | |
1549 v84 = v12->sTextureDeltaU + *(short *)(v30 - 40); | |
1550 array_50A2B0[v31 + 49].u = (double)v84 * v28; | |
1551 v33 = v12->sTextureDeltaV + *(short *)v30; | |
1552 v30 += 2; | |
1553 v34 = v83-- == 1; | |
1554 v84 = v33; | |
1555 array_50A2B0[v31 + 49].v = (double)v33 * v29; | |
1556 } | |
1557 while ( !v34 ); | |
1558 v3 = v76; | |
1559 v26 = v77; | |
1560 } | |
1561 | |
1562 static stru154 static_sub_004789DE_stru_73C818; // idb | |
1563 | |
1564 pGame->pLightmapBuilder->ApplyLights_OutdoorFace((ODMFace *)v3); | |
1565 if ( stru_F8AD28.uNumLightsApplied <= 0 ) | |
1566 { | |
1567 v12->field_108 = 0; | |
1568 } | |
1569 else | |
1570 { | |
1571 v35 = (BSPVertexBuffer *)(v78 - 2); | |
1572 v12->field_108 = 1; | |
1573 | |
1574 static_sub_004789DE_stru_73C818.GetFacePlaneAndClassify((ODMFace *)v3, v35); | |
1575 v55 = static_sub_004789DE_stru_73C818.face_plane.vNormal.x; | |
1576 v56 = static_sub_004789DE_stru_73C818.face_plane.vNormal.y; | |
1577 v57 = static_sub_004789DE_stru_73C818.face_plane.vNormal.z; | |
1578 pGame->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10, v26, (Vec3_float_ *)&v55); | |
1579 } | |
1580 if ( v74 ) | |
1581 { | |
1582 v36 = sr_4250FE(v26); | |
1583 v37 = v36; | |
1584 if ( !v36 || (OutdoorCamera::Project(v36), v38 = sr_4254D2(v37), (v12->uNumVertices = v38) == 0) ) | |
1585 goto LABEL_71; | |
1586 v12->_48276F_sr(); | |
1587 v39 = 0; | |
1588 if ( (signed int)v12->uNumVertices > 0 ) | |
1589 { | |
1590 v40 = (char *)&array_508690[0].vWorldViewProjY; | |
1591 do | |
1592 { | |
1593 LODWORD(v64) = *((int *)v40 - 1); | |
1594 v41 = v64 + 6.7553994e15; | |
1595 v69 = LODWORD(v41); | |
1596 dword_50B638[v39] = LODWORD(v41); | |
1597 LODWORD(v63) = *(int *)v40; | |
1598 v42 = v63 + 6.7553994e15; | |
1599 v73 = LODWORD(v42); | |
1600 v40 += 48; | |
1601 dword_50B570[v39++] = LODWORD(v42); | |
1602 } | |
1603 while ( v39 < (signed int)v12->uNumVertices ); | |
1604 } | |
1605 } | |
1606 else | |
1607 { | |
1608 if ( v75 ) | |
1609 { | |
1610 v43 = sr_4252E8(v26); | |
1611 v44 = v43; | |
1612 if ( !v43 || (OutdoorCamera::Project(v43), v45 = sr_4254D2(v44), (v12->uNumVertices = v45) == 0) ) | |
1613 goto LABEL_71; | |
1614 v12->_48276F_sr(); | |
1615 v46 = 0; | |
1616 if ( (signed int)v12->uNumVertices > 0 ) | |
1617 { | |
1618 v47 = (char *)&array_508690[0].vWorldViewProjY; | |
1619 do | |
1620 { | |
1621 LODWORD(v61) = *((int *)v47 - 1); | |
1622 v48 = v61 + 6.7553994e15; | |
1623 v65 = LODWORD(v48); | |
1624 dword_50B638[v46] = LODWORD(v48); | |
1625 LODWORD(v58) = *(int *)v47; | |
1626 v49 = v58 + 6.7553994e15; | |
1627 v59 = LODWORD(v49); | |
1628 v47 += 48; | |
1629 dword_50B570[v46++] = LODWORD(v49); | |
1630 } | |
1631 while ( v46 < (signed int)v12->uNumVertices ); | |
1632 } | |
1633 } | |
1634 else | |
1635 { | |
1636 v50 = sr_4254D2(v26); | |
1637 v12->uNumVertices = v50; | |
1638 if ( !v50 ) | |
1639 goto LABEL_71; | |
1640 sr_sub_4829B9( | |
1641 &array_73D150[v3->uGradientVertex1], | |
1642 &array_73D150[v3->uGradientVertex2], | |
1643 &array_73D150[v3->uGradientVertex3], | |
1644 v12, | |
1645 0); | |
1646 v51 = 0; | |
1647 if ( (signed int)v12->uNumVertices > 0 ) | |
1648 { | |
1649 v52 = (char *)&array_508690[0].vWorldViewProjY; | |
1650 do | |
1651 { | |
1652 LODWORD(v62) = *((int *)v52 - 1); | |
1653 v53 = v62 + 6.7553994e15; | |
1654 v60 = LODWORD(v53); | |
1655 dword_50B638[v51] = LODWORD(v53); | |
1656 LODWORD(v72) = *(int *)v52; | |
1657 v54 = v72 + 6.7553994e15; | |
1658 v70 = LODWORD(v54); | |
1659 v52 += 48; | |
1660 dword_50B570[v51++] = LODWORD(v54); | |
1661 } | |
1662 while ( v51 < (signed int)v12->uNumVertices ); | |
1663 } | |
1664 } | |
1665 } | |
1666 sr_sub_486B4E_push_outdoor_edges(array_508690, dword_50B638.data(), dword_50B570.data(), v12); | |
1667 } | |
1668 LABEL_72: | |
1669 ++v79; | |
1670 v1 = v78; | |
1671 ++v3; | |
1672 v76 = v3; | |
1673 if ( v79 >= v68 ) | |
1674 goto LABEL_73; | |
1675 } | |
1676 } | |
1677 return result; | |
1678 } | |
1679 | |
1680 //----- (00487389) -------------------------------------------------------- | |
1681 void Render::ExecOutdoorDrawSW() | |
1682 { | |
1683 unsigned __int16 *v0; // ebx@1 | |
1684 unsigned int v1; // esi@1 | |
1685 Polygon *v2; // eax@1 | |
1686 Span *v3; // edi@6 | |
1687 Polygon *v4; // esi@9 | |
1688 Texture *v5; // ebp@10 | |
1689 int v6; // esi@16 | |
1690 unsigned int v7; // edx@16 | |
1691 char *v8; // ecx@17 | |
1692 unsigned int v9; // edi@22 | |
1693 int v10; // eax@26 | |
1694 int v11; // eax@27 | |
1695 unsigned int v12; // ebp@32 | |
1696 Span *v13; // esi@33 | |
1697 int v14; // ecx@37 | |
1698 int v15; // eax@40 | |
1699 Texture *v16; // ebp@51 | |
1700 //unsigned int v17; // eax@51 | |
1701 int v18; // eax@54 | |
1702 char v19; // al@56 | |
1703 unsigned int v20; // eax@57 | |
1704 int v21; // ecx@57 | |
1705 unsigned int v22; // eax@57 | |
1706 stru149 *v23; // eax@65 | |
1707 int v24; // eax@67 | |
1708 ODMFace *v25; // eax@78 | |
1709 signed int v26; // edx@79 | |
1710 signed int v27; // ecx@79 | |
1711 unsigned int v28; // eax@106 | |
1712 unsigned int v29; // ebp@117 | |
1713 Span *v30; // esi@118 | |
1714 unsigned int v31; // ST04_4@124 | |
1715 int v33; // [sp+18h] [bp-44h]@80 | |
1716 signed int v34; // [sp+1Ch] [bp-40h]@3 | |
1717 signed int v35; // [sp+20h] [bp-3Ch]@79 | |
1718 Span **v36; // [sp+24h] [bp-38h]@4 | |
1719 unsigned int v37; // [sp+28h] [bp-34h]@1 | |
1720 unsigned __int16 *a1; // [sp+2Ch] [bp-30h]@1 | |
1721 int a1a; // [sp+2Ch] [bp-30h]@26 | |
1722 unsigned int a1b; // [sp+2Ch] [bp-30h]@116 | |
1723 char v41; // [sp+30h] [bp-2Ch]@57 | |
1724 | |
1725 v0 = pRenderer->pTargetSurface; | |
1726 v1 = pOutdoorCamera->uNumPolygons; | |
1727 a1 = pRenderer->pTargetSurface; | |
1728 v2 = array_77EC08.data(); | |
1729 v37 = pOutdoorCamera->uNumPolygons; | |
1730 if ( !(pParty->uFlags & 2) ) | |
1731 { | |
1732 v1 = uNumElementsIn80AA28; | |
1733 v2 = ptr_80AA28[0]; | |
1734 v37 = uNumElementsIn80AA28; | |
1735 } | |
1736 v34 = 0; | |
1737 if ( (signed int)v1 > 0 ) | |
1738 { | |
1739 v36 = &v2->prolly_head; | |
1740 do | |
1741 { | |
1742 if ( pParty->uFlags & 2 ) | |
1743 v3 = *v36; | |
1744 else | |
1745 v3 = ptr_80AA28[v34]->prolly_head; | |
1746 if ( v3 ) | |
1747 { | |
1748 v4 = v3->pParent; | |
1749 if ( v4 ) | |
1750 { | |
1751 v5 = v4->pTexture; | |
1752 if ( v5 ) | |
1753 { | |
1754 if ( v3->field_8 >= (signed int)pViewport->uViewportTL_X || v3->field_C != pViewport->uViewportTL_X ) | |
1755 { | |
1756 LOBYTE(v4->field_32) |= 2u; | |
1757 v14 = *(int *)&v4->flags; | |
1758 if ( v14 & 0x10 && v4->field_59 != 5 ) | |
1759 { | |
1760 dword_80AA20 = (v4->terrain_grid_z - 64) << 25; | |
1761 dword_80AA1C = dword_80AA20 + 0x1FF0000; | |
1762 dword_80AA14 = (v4->terrain_grid_x << 25) + 0x7FFF0000; | |
1763 dword_80AA18 = dword_80AA14 - 0x1FF0000; | |
1764 byte_80AA10 = ((unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo( | |
1765 v4->terrain_grid_z, | |
1766 v4->terrain_grid_x - 1) >> 9) & 1; | |
1767 if ( *(int *)&v4->flags & 2 || (v15 = *(int *)&v4->flags, BYTE1(v15) & 1) ) | |
1768 { | |
1769 if ( *(int *)&v4->flags & 2 ) | |
1770 { | |
1771 while ( 1 ) | |
1772 { | |
1773 if ( pOutdoorCamera->outdoor_no_wavy_water ) | |
1774 sr_sub_48408A_prolly_odm_water_no_waves(v3); | |
1775 else | |
1776 sr_sub_485407_prolly_odm_water_wavy(v3); | |
1777 v3->field_E = LOWORD(sr_6BE060[1]); | |
1778 if ( v4->prolly_tail == v3 ) | |
1779 break; | |
1780 v3 = v3->pNext; | |
1781 } | |
1782 } | |
1783 else | |
1784 { | |
1785 while ( 1 ) | |
1786 { | |
1787 v16 = v4->pTexture; | |
1788 v4->pTexture = pBitmaps_LOD->LoadTexturePtr("wtrtyl"); | |
1789 if ( pOutdoorCamera->outdoor_no_wavy_water ) | |
1790 sr_sub_48408A_prolly_odm_water_no_waves(v3); | |
1791 else | |
1792 sr_sub_485407_prolly_odm_water_wavy(v3); | |
1793 v18 = v4->terrain_grid_z - 64; | |
1794 v4->pTexture = v16; | |
1795 dword_80AA20 = v18 << 25; | |
1796 dword_80AA1C = (v18 << 25) + 0x1FF0000; | |
1797 dword_80AA14 = (v4->terrain_grid_x << 25) + 0x7FFF0000; | |
1798 dword_80AA18 = dword_80AA14 - 0x1FF0000; | |
1799 byte_80AA10 = ((unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo( | |
1800 v4->terrain_grid_z, | |
1801 v4->terrain_grid_x - 1) >> 9) & 1; | |
1802 sr_sub_484442(v3); | |
1803 v3->field_E = LOWORD(sr_6BE060[1]); | |
1804 if ( v4->prolly_tail == v3 ) | |
1805 break; | |
1806 v3 = v3->pNext; | |
1807 } | |
1808 } | |
1809 } | |
1810 else | |
1811 { | |
1812 while ( sr_sub_48408A_prolly_odm_water_no_waves(v3) ) | |
1813 { | |
1814 v3->field_E = LOWORD(sr_6BE060[1]); | |
1815 if ( v4->prolly_tail == v3 ) | |
1816 break; | |
1817 v3 = v3->pNext; | |
1818 } | |
1819 } | |
1820 } | |
1821 else | |
1822 { | |
1823 v19 = v4->field_59; | |
1824 if ( v19 != 5 ) | |
1825 { | |
1826 if ( v14 & 2 ) | |
1827 { | |
1828 while ( 1 ) | |
1829 { | |
1830 v28 = pBitmaps_LOD->LoadTexture("wtrtyla"); | |
1831 v4->pTexture = (Texture *)(v28 != -1 ? &pBitmaps_LOD->pTextures[v28] : 0); | |
1832 if ( !sr_sub_4847EB(v3) ) | |
1833 break; | |
1834 v4->pTexture = v5; | |
1835 if ( !sr_sub_484442(v3) ) | |
1836 break; | |
1837 v3->field_E = LOWORD(sr_6BE060[1]); | |
1838 if ( v4->prolly_tail == v3 ) | |
1839 break; | |
1840 v3 = v3->pNext; | |
1841 v5 = v4->pTexture; | |
1842 } | |
1843 } | |
1844 else | |
1845 { | |
1846 if ( v19 == 1 ) | |
1847 { | |
1848 dword_80AA20 = (v4->terrain_grid_z - 64) << 25; | |
1849 dword_80AA1C = dword_80AA20 + 33488896; | |
1850 dword_80AA14 = (v4->terrain_grid_x << 25) + 0x7FFF0000; | |
1851 dword_80AA18 = dword_80AA14 - 33488896; | |
1852 byte_80AA10 = ((unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo( | |
1853 v4->terrain_grid_z, | |
1854 v4->terrain_grid_x - 1) >> 9) & 1; | |
1855 while ( 1 ) | |
1856 { | |
1857 if ( !sr_sub_4847EB(v3) ) | |
1858 sr_sub_48585C_mb_DrawSpan(v3, &pRenderer->pTargetSurface[v3->field_8 + 640 * v3->field_A], 0); | |
1859 v3->field_E = LOWORD(sr_6BE060[1]); | |
1860 if ( v4->prolly_tail == v3 ) | |
1861 break; | |
1862 v3 = v3->pNext; | |
1863 } | |
1864 } | |
1865 } | |
1866 goto LABEL_14; | |
1867 } | |
1868 v4->ptr_38 = (stru149 *)&v41; | |
1869 v4->_479295(); | |
1870 v20 = GetTickCount(); | |
1871 v21 = *(int *)&v4->flags; | |
1872 v22 = v20 >> 3; | |
1873 if ( BYTE1(v21) & 4 ) | |
1874 { | |
1875 v4->sTextureDeltaV -= v22 & v4->pTexture->uHeightMinus1; | |
1876 } | |
1877 else | |
1878 { | |
1879 if ( BYTE1(v21) & 8 ) | |
1880 v4->sTextureDeltaV += v22 & v4->pTexture->uHeightMinus1; | |
1881 } | |
1882 if ( BYTE1(v21) & 0x10 ) | |
1883 { | |
1884 v4->sTextureDeltaU -= v22 & v4->pTexture->uWidthMinus1; | |
1885 } | |
1886 else | |
1887 { | |
1888 if ( BYTE1(v21) & 0x20 ) | |
1889 v4->sTextureDeltaU += v22 & v4->pTexture->uWidthMinus1; | |
1890 } | |
1891 v23 = v4->ptr_38; | |
1892 v4->field_52 = 32; | |
1893 v4->field_5A = 5; | |
1894 if ( (double)abs(v23->field_C) > 52428.8 ) | |
1895 { | |
1896 v4->field_52 = 8; | |
1897 v4->field_5A = 3; | |
1898 } | |
1899 v24 = *(int *)&v4->flags; | |
1900 if ( !(v24 & 0x10000) ) | |
1901 { | |
1902 if ( !(v24 & 2) ) | |
1903 { | |
1904 v25 = v4->pODMFace; | |
1905 if ( v25->uPolygonType == 1 ) | |
1906 { | |
1907 v26 = v25->pTextureUIDs[0]; | |
1908 dword_80AA1C = v26; | |
1909 dword_80AA20 = v26; | |
1910 v27 = v25->pTextureVIDs[0]; | |
1911 dword_80AA14 = v27; | |
1912 dword_80AA18 = v27; | |
1913 v35 = 1; | |
1914 if ( v25->uNumVertices > 1u ) | |
1915 { | |
1916 v33 = (int)&v25->pTextureVIDs[1]; | |
1917 do | |
1918 { | |
1919 if ( dword_80AA20 > *(short *)(v33 - 40) ) | |
1920 dword_80AA20 = *(short *)(v33 - 40); | |
1921 if ( v26 < *(short *)(v33 - 40) ) | |
1922 { | |
1923 v26 = *(short *)(v33 - 40); | |
1924 dword_80AA1C = *(short *)(v33 - 40); | |
1925 } | |
1926 if ( dword_80AA18 > *(short *)v33 ) | |
1927 dword_80AA18 = *(short *)v33; | |
1928 if ( v27 < *(short *)v33 ) | |
1929 { | |
1930 v27 = *(short *)v33; | |
1931 dword_80AA14 = *(short *)v33; | |
1932 } | |
1933 ++v35; | |
1934 v33 += 2; | |
1935 } | |
1936 while ( v35 < v25->uNumVertices ); | |
1937 v0 = a1; | |
1938 } | |
1939 dword_80AA20 = (dword_80AA20 + v4->sTextureDeltaU) << 16; | |
1940 dword_80AA1C = ((v26 + v4->sTextureDeltaU) << 16) - 65536; | |
1941 dword_80AA18 = (dword_80AA18 + v4->sTextureDeltaV) << 16; | |
1942 dword_80AA14 = ((v27 + v4->sTextureDeltaV) << 16) - 65536; | |
1943 } | |
1944 while ( 1 ) | |
1945 { | |
1946 if ( !sr_sub_482E07(v3, v0) ) | |
1947 sr_sub_48585C_mb_DrawSpan(v3, &v0[v3->field_8 + 640 * v3->field_A], 0); | |
1948 v3->field_E = LOWORD(sr_6BE060[1]); | |
1949 if ( v4->prolly_tail == v3 ) | |
1950 break; | |
1951 v3 = v3->pNext; | |
1952 } | |
1953 goto LABEL_14; | |
1954 } | |
1955 while ( 1 ) | |
1956 { | |
1957 LABEL_74: | |
1958 if ( !sr_sub_4839BD(v3, v0) ) | |
1959 sr_sub_48585C_mb_DrawSpan(v3, &v0[v3->field_8 + 640 * v3->field_A], 0); | |
1960 v3->field_E = LOWORD(sr_6BE060[1]); | |
1961 if ( v4->prolly_tail == v3 ) | |
1962 break; | |
1963 v3 = v3->pNext; | |
1964 } | |
1965 goto LABEL_14; | |
1966 } | |
1967 if ( v24 & 2 ) | |
1968 goto LABEL_74; | |
1969 while ( 1 ) | |
1970 { | |
1971 if ( !sr_sub_482A94(v3) ) | |
1972 sr_sub_48585C_mb_DrawSpan(v3, &v0[v3->field_8 + 640 * v3->field_A], 0); | |
1973 v3->field_E = LOWORD(sr_6BE060[1]); | |
1974 if ( v4->prolly_tail == v3 ) | |
1975 break; | |
1976 v3 = v3->pNext; | |
1977 } | |
1978 } | |
1979 } | |
1980 else | |
1981 { | |
1982 v3->field_E = LOWORD(sr_6BE060[1]); | |
1983 } | |
1984 } | |
1985 } | |
1986 } | |
1987 LABEL_14: | |
1988 ++v34; | |
1989 LOWORD(v2) = v34; | |
1990 v36 += 67; | |
1991 } | |
1992 while ( v34 < (signed int)v37 ); | |
1993 } | |
1994 if ( pParty->uFlags & 2 ) | |
1995 { | |
1996 v6 = pOutdoorCamera->uNumPolygons; | |
1997 v7 = 0; | |
1998 uNumElementsIn80AA28 = 0; | |
1999 if ( pOutdoorCamera->uNumPolygons > 0 ) | |
2000 { | |
2001 v8 = (char *)&array_77EC08[0].flags; | |
2002 do | |
2003 { | |
2004 v2 = *(Polygon **)v8; | |
2005 if ( (unsigned int)v2 & 0x20000 ) | |
2006 { | |
2007 ++v7; | |
2008 *(int *)v8 = (unsigned int)v2 & 0xFFFDFFFF; | |
2009 LOWORD(v2) = (short)v8 - 48; | |
2010 *(&uNumElementsIn80AA28 + v7) = (unsigned int)(v8 - 48); | |
2011 } | |
2012 v8 += 268; | |
2013 --v6; | |
2014 } | |
2015 while ( v6 ); | |
2016 uNumElementsIn80AA28 = v7; | |
2017 } | |
2018 } | |
2019 v9 = pOutdoorCamera->uNumSpans; | |
2020 sr_6BE060[0] = pOutdoorCamera->uNumSpans; | |
2021 if (pOutdoorCamera->uNumPolygons >= 1999) | |
2022 return; | |
2023 | |
2024 array_77EC08[1999]._48607B(&stru_8019C8); | |
2025 array_77EC08[1999].ptr_38->sky_48694B(); | |
2026 | |
2027 if (pOutdoor->uMainTile_BitmapID == -1) | |
2028 { | |
2029 array_77EC08[1999].pTexture = nullptr; | |
2030 return; | |
2031 } | |
2032 else | |
2033 array_77EC08[1999].pTexture = pBitmaps_LOD->GetTexture(pOutdoor->uMainTile_BitmapID); | |
2034 array_77EC08[1999].dimming_level = 23 - (-20 * pOutdoor->vSunlight.z >> 16); | |
2035 if ( array_77EC08[1999].dimming_level > 20 ) | |
2036 array_77EC08[1999].dimming_level = 20; | |
2037 v10 = stru_5C6E00->Sin(pIndoorCamera->sRotationX); | |
2038 array_77EC08[1999].v_18.y = 0; | |
2039 array_77EC08[1999].v_18.x = v10; | |
2040 array_77EC08[1999].v_18.z = stru_5C6E00->Cos(pIndoorCamera->sRotationX); | |
2041 array_77EC08[1999].field_24 = 2048 - (pIndoorCamera->pos.z << 16); | |
2042 a1a = (signed __int64)((double)(pIndoorCamera->pos.z * pOutdoorCamera->int_fov_rad) | |
2043 / ((double)pOutdoorCamera->int_fov_rad + 8192.0) | |
2044 + (double)pViewport->uScreenCenterY); | |
2045 cos((double)pIndoorCamera->sRotationX * 0.0030664064); | |
2046 sin((double)pIndoorCamera->sRotationX * 0.0030664064); | |
2047 array_77EC08[1999]._48607B(&stru_8019C8); | |
2048 array_77EC08[1999].ptr_38->sky_48694B(); | |
2049 | |
2050 if (pOutdoor->uSky_TextureID == -1) | |
2051 { | |
2052 array_77EC08[1999].pTexture = nullptr; | |
2053 return; | |
2054 } | |
2055 else | |
2056 array_77EC08[1999].pTexture = pBitmaps_LOD->GetTexture(pOutdoor->uSky_TextureID); | |
2057 array_77EC08[1999].dimming_level = 0; | |
2058 v11 = stru_5C6E00->Sin(pIndoorCamera->sRotationX + 16); | |
2059 array_77EC08[1999].v_18.y = 0; | |
2060 array_77EC08[1999].v_18.x = -v11; | |
2061 array_77EC08[1999].v_18.z = -stru_5C6E00->Cos(pIndoorCamera->sRotationX + 16); | |
2062 LOWORD(v2) = 224 * LOWORD(pMiscTimer->uTotalGameTimeElapsed); | |
2063 array_77EC08[1999].field_24 = 0x2000000u; | |
2064 array_77EC08[1999].sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed; | |
2065 array_77EC08[1999].sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed; | |
2066 if ( day_attrib & DAY_ATTRIB_FOG | |
2067 && (LOWORD(v2) = LOWORD(pParty->uCurrentHour), pParty->uCurrentHour >= 5) | |
2068 && pParty->uCurrentHour < 0x15 | |
2069 || bUnderwater ) | |
2070 { | |
2071 v2 = (Polygon *)*(short *)PaletteManager::Get_Mist_or_Red_LUT(array_77EC08[1999].pTexture->palette_id2, 31, 1); | |
2072 a1b = (unsigned int)v2; | |
2073 if ( (signed int)v9 <= 0 ) | |
2074 return; | |
2075 v29 = v9; | |
2076 while ( 1 ) | |
2077 { | |
2078 v30 = &pSpans[v29 - 1]; | |
2079 v2 = (Polygon *)v30->field_E; | |
2080 if ( v2 != (Polygon *)sr_6BE060[1] ) | |
2081 { | |
2082 LOWORD(v2) = LOWORD(pViewport->uViewportTL_X); | |
2083 if ( v30->field_8 >= (signed int)pViewport->uViewportTL_X ) | |
2084 goto LABEL_124; | |
2085 if ( v30->field_C == pViewport->uViewportTL_X ) | |
2086 { | |
2087 v30->field_E = LOWORD(sr_6BE060[1]); | |
2088 } | |
2089 else | |
2090 { | |
2091 v30->field_8 = LOWORD(pViewport->uViewportTL_X); | |
2092 v30->field_C -= LOWORD(pViewport->uViewportTL_X); | |
2093 if ( v30->field_C >= 0 ) | |
2094 { | |
2095 LABEL_124: | |
2096 v31 = v30->field_C; | |
2097 v30->pParent = &array_77EC08[1999]; | |
2098 fill_pixels_fast( | |
2099 a1b, | |
2100 &pRenderer->pTargetSurface[v30->field_8 + pRenderer->uTargetSurfacePitch * v30->field_A], | |
2101 v31); | |
2102 j_memset32(-65536, &pRenderer->pActiveZBuffer[v30->field_8 + 640 * v30->field_A], v30->field_C); | |
2103 goto LABEL_125; | |
2104 } | |
2105 LOWORD(v2) = LOWORD(sr_6BE060[1]); | |
2106 v30->field_E = LOWORD(sr_6BE060[1]); | |
2107 } | |
2108 } | |
2109 LABEL_125: | |
2110 --v29; | |
2111 --v9; | |
2112 if ( !v9 ) | |
2113 return; | |
2114 } | |
2115 } | |
2116 if ( (signed int)v9 > 0 ) | |
2117 { | |
2118 v12 = v9; | |
2119 do | |
2120 { | |
2121 v13 = &pSpans[v12 - 1]; | |
2122 v2 = (Polygon *)v13->field_E; | |
2123 if ( v2 != (Polygon *)sr_6BE060[1] ) | |
2124 { | |
2125 LOWORD(v2) = LOWORD(pViewport->uViewportTL_X); | |
2126 if ( v13->field_8 >= (signed int)pViewport->uViewportTL_X ) | |
2127 goto LABEL_109; | |
2128 if ( v13->field_C != pViewport->uViewportTL_X ) | |
2129 { | |
2130 v13->field_8 = LOWORD(pViewport->uViewportTL_X); | |
2131 v13->field_C -= LOWORD(pViewport->uViewportTL_X); | |
2132 if ( v13->field_C >= 0 ) | |
2133 { | |
2134 LABEL_109: | |
2135 if ( pOutdoorCamera->bNoSky ) | |
2136 { | |
2137 const_1_0(); | |
2138 } | |
2139 else | |
2140 { | |
2141 v13->pParent = &array_77EC08[1999]; | |
2142 if ( !Render::DrawSkySW(v13, &array_77EC08[1999], a1a) ) | |
2143 j_memset32(-65536, &pRenderer->pActiveZBuffer[v13->field_8 + 640 * v13->field_A], v13->field_C); | |
2144 } | |
2145 } | |
2146 LOWORD(v2) = LOWORD(sr_6BE060[1]); | |
2147 v13->field_E = LOWORD(sr_6BE060[1]); | |
2148 goto LABEL_114; | |
2149 } | |
2150 v13->field_E = LOWORD(sr_6BE060[1]); | |
2151 } | |
2152 LABEL_114: | |
2153 --v12; | |
2154 --v9; | |
2155 } | |
2156 while ( v9 ); | |
2157 } | |
2158 } | |
2159 | |
2160 //----- (00485044) -------------------------------------------------------- | |
2161 int Render::DrawSkySW(Span *a1, Polygon *a2, int a3) | |
2162 { | |
2163 Polygon *v3; // esi@1 | |
2164 Span *v4; // edi@1 | |
2165 float v5; // ST2C_4@1 | |
2166 signed int result; // eax@2 | |
2167 int v7; // ST40_4@3 | |
2168 stru149 *v8; // eax@3 | |
2169 int v9; // ebx@3 | |
2170 int v10; // ecx@3 | |
2171 int v11; // edx@3 | |
2172 int v12; // eax@3 | |
2173 int v13; // ST28_4@5 | |
2174 int v14; // eax@5 | |
2175 signed __int64 v15; // qtt@11 | |
2176 int v16; // ST28_4@11 | |
2177 int v17; // eax@11 | |
2178 signed int v18; // ecx@11 | |
2179 int v19; // ST40_4@11 | |
2180 int v20; // ST3C_4@11 | |
2181 int v21; // ST30_4@11 | |
2182 void *v22; // eax@11 | |
2183 Texture *v23; // esi@11 | |
2184 int v24; // ecx@11 | |
2185 unsigned int v25; // esi@11 | |
2186 int v26; // edi@11 | |
2187 unsigned __int16 *v27; // eax@11 | |
2188 int *v28; // ebx@12 | |
2189 int v29; // edx@13 | |
2190 unsigned __int16 v30; // cx@13 | |
2191 int v31; // edx@14 | |
2192 unsigned __int16 v32; // cx@14 | |
2193 unsigned __int8 v33; // sf@15 | |
2194 unsigned __int8 v34; // of@15 | |
2195 double v35; // [sp+14h] [bp-38h]@1 | |
2196 int v36; // [sp+18h] [bp-34h]@3 | |
2197 signed int v37; // [sp+18h] [bp-34h]@11 | |
2198 int v38; // [sp+1Ch] [bp-30h]@3 | |
2199 signed int v39; // [sp+1Ch] [bp-30h]@11 | |
2200 int v40; // [sp+20h] [bp-2Ch]@3 | |
2201 void *v41; // [sp+20h] [bp-2Ch]@11 | |
2202 int v42; // [sp+24h] [bp-28h]@3 | |
2203 unsigned __int8 *v43; // [sp+24h] [bp-28h]@11 | |
2204 int v44; // [sp+28h] [bp-24h]@11 | |
2205 int v45; // [sp+2Ch] [bp-20h]@3 | |
2206 signed int v46; // [sp+30h] [bp-1Ch]@3 | |
2207 __int16 v47; // [sp+30h] [bp-1Ch]@11 | |
2208 signed int v48; // [sp+34h] [bp-18h]@3 | |
2209 int v49; // [sp+34h] [bp-18h]@11 | |
2210 int v50; // [sp+38h] [bp-14h]@3 | |
2211 unsigned __int16 *v51; // [sp+38h] [bp-14h]@11 | |
2212 int v52; // [sp+3Ch] [bp-10h]@4 | |
2213 int a1a; // [sp+40h] [bp-Ch]@3 | |
2214 int v54; // [sp+44h] [bp-8h]@3 | |
2215 int v55; // [sp+48h] [bp-4h]@3 | |
2216 int v56; // [sp+54h] [bp+8h]@11 | |
2217 int *v57; // [sp+54h] [bp+8h]@11 | |
2218 | |
2219 v3 = a2; | |
2220 v4 = a1; | |
2221 v5 = (double)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) * 0.5 / tan(0.6457717418670654) + 0.5; | |
2222 v35 = v5 + 6.7553994e15; | |
2223 if ( LODWORD(v35) ) | |
2224 { | |
2225 v55 = 65536 / SLODWORD(v35); | |
2226 v7 = 65536 / SLODWORD(v35) * (a3 - v4->field_A); | |
2227 v8 = v3->ptr_38; | |
2228 v42 = ((unsigned __int64)(v3->ptr_38->field_14 * (signed __int64)v7) >> 16) + v8->field_C; | |
2229 v40 = ((unsigned __int64)(v8->field_20 * (signed __int64)v7) >> 16) + v3->ptr_38->field_18; | |
2230 v38 = pOutdoorCamera->camera_rotation_y_int_sine; | |
2231 HIDWORD(v35) = pOutdoorCamera->camera_rotation_y_int_cosine; | |
2232 v45 = v4->field_C; | |
2233 v9 = ((unsigned __int64)(v3->v_18.z * (signed __int64)v7) >> 16) + v3->v_18.x; | |
2234 v10 = 65536 / SLODWORD(v35) * (pViewport->uScreenCenterX - v4->field_8); | |
2235 v48 = 0; | |
2236 v50 = 65536 / SLODWORD(v35) * (pViewport->uScreenCenterX - v4->field_8); | |
2237 v46 = -v3->field_24; | |
2238 v11 = v4->field_A - 1; | |
2239 v54 = v11; | |
2240 v12 = 65536 / SLODWORD(v35) * (a3 - v11); | |
2241 a1a = 65536 / SLODWORD(v35) * (a3 - v11); | |
2242 while ( 1 ) | |
2243 { | |
2244 v52 = v9; | |
2245 if ( v9 ) | |
2246 { | |
2247 v13 = abs(v46 >> 14); | |
2248 v14 = abs(v9); | |
2249 v11 = v54; | |
2250 v10 = v50; | |
2251 if ( v13 <= v14 ) | |
2252 break; | |
2253 v12 = a1a; | |
2254 } | |
2255 if ( v11 <= (signed int)pViewport->uViewportTL_Y ) | |
2256 break; | |
2257 v9 = ((unsigned __int64)(v3->v_18.z * (signed __int64)v12) >> 16) + v3->v_18.x; | |
2258 --v54; | |
2259 a1a += v55; | |
2260 v12 = a1a; | |
2261 v11 = v54; | |
2262 v48 = 1; | |
2263 } | |
2264 if ( v48 ) | |
2265 v52 = ((unsigned __int64)(v3->v_18.z * (signed __int64)(v55 * (a3 + (signed int)v4->field_A - 2 * v11))) >> 16) | |
2266 + v3->v_18.x; | |
2267 LODWORD(v15) = v46 << 16; | |
2268 HIDWORD(v15) = v46 >> 16; | |
2269 v16 = v42 + ((unsigned __int64)(v3->ptr_38->field_10 * (signed __int64)v10) >> 16); | |
2270 v17 = v40 + ((unsigned __int64)(v3->ptr_38->field_1C * (signed __int64)v10) >> 16); | |
2271 v18 = v15 / v52; | |
2272 v43 = v3->pTexture->pLevelOfDetail0_prolly_alpha_mask; | |
2273 v19 = v3->sTextureDeltaU + ((signed int)((unsigned __int64)(v16 * v15 / v52) >> 16) >> 3); | |
2274 v56 = v15 / v52; | |
2275 v20 = v3->sTextureDeltaV + ((signed int)((unsigned __int64)(v17 * v15 / v52) >> 16) >> 3); | |
2276 v21 = (unsigned __int64)(v55 * (signed __int64)v56) >> 16; | |
2277 v39 = (signed int)((unsigned __int64)(v21 * (signed __int64)v38) >> 16) >> 3; | |
2278 v37 = (signed int)((unsigned __int64)(v21 * (signed __int64)v36) >> 16) >> 3; | |
2279 v22 = sr_sub_47C178(v18, v3, 0, 1); | |
2280 v23 = v3->pTexture; | |
2281 v41 = v22; | |
2282 v47 = 16 - v23->uWidthLn2; | |
2283 v44 = v23->uTextureWidth - 1; | |
2284 v49 = (v23->uTextureHeight << 16) - 65536; | |
2285 v24 = v4->field_8; | |
2286 v51 = &pRenderer->pTargetSurface[v24 + pRenderer->uTargetSurfacePitch * v4->field_A]; | |
2287 v57 = &pRenderer->pActiveZBuffer[v24 + 640 * v4->field_A]; | |
2288 v25 = v19; | |
2289 v26 = v20; | |
2290 v27 = v51; | |
2291 if ( !(v45 & 1) ) | |
2292 goto LABEL_15; | |
2293 --v45; | |
2294 v27 = v51 - 1; | |
2295 v28 = v57; | |
2296 ++v57; | |
2297 while ( 1 ) | |
2298 { | |
2299 *v28 = -65536; | |
2300 v31 = v44 & (v25 >> 16); | |
2301 v27 += 2; | |
2302 v25 += v39; | |
2303 v32 = *((short *)v41 + *(&v43[v31] + ((v49 & (unsigned int)v26) >> v47))); | |
2304 v26 += v37; | |
2305 *(v27 - 1) = v32; | |
2306 LABEL_15: | |
2307 v34 = __OFSUB__(v45, 2); | |
2308 v33 = v45 - 2 < 0; | |
2309 v45 -= 2; | |
2310 if ( v33 ^ v34 ) | |
2311 break; | |
2312 v29 = v44 & (v25 >> 16); | |
2313 v25 += v39; | |
2314 v30 = *((short *)v41 + *(&v43[v29] + ((v49 & (unsigned int)v26) >> v47))); | |
2315 v26 += v37; | |
2316 v28 = v57; | |
2317 *v27 = v30; | |
2318 v57 += 2; | |
2319 v28[1] = -65536; | |
2320 } | |
2321 result = 1; | |
2322 } | |
2323 else | |
2324 { | |
2325 result = 0; | |
2326 } | |
2327 return result; | |
2328 } | |
2329 | |
2330 //----- (0047F5C6) -------------------------------------------------------- | |
2331 float Render::DrawBezierTerrain() | |
2332 { | |
2333 unsigned int pDirectionIndicator1; // ebx@1 | |
2334 unsigned int pDirectionIndicator2; // edi@1 | |
2335 unsigned int v2; // eax@1 | |
2336 int v3; // eax@3 | |
2337 int v4; // edi@3 | |
2338 int v5; // ebx@3 | |
2339 int v6; // esi@3 | |
2340 unsigned int v7; // eax@3 | |
2341 int v8; // eax@4 | |
2342 unsigned int v9; // eax@6 | |
2343 int v10; // eax@7 | |
2344 //int v11; // ebx@9 | |
2345 //int v12; // edi@9 | |
2346 int v13; // eax@21 | |
2347 int v14; // eax@31 | |
2348 int v15; // edi@33 | |
2349 int v16; // eax@34 | |
2350 int v17; // edx@34 | |
2351 int v18; // ebx@34 | |
2352 int v19; // eax@36 | |
2353 int v20; // eax@39 | |
2354 int v21; // ecx@43 | |
2355 //char v22; // zf@44 | |
2356 int v23; // ecx@47 | |
2357 //int v24; // edi@52 | |
2358 int v25; // eax@54 | |
2359 int v26; // ecx@54 | |
2360 int v27; // eax@56 | |
2361 int v28; // edx@60 | |
2362 int v29; // ecx@61 | |
2363 int v30; // ecx@64 | |
2364 int v31; // ecx@68 | |
2365 int v32; // eax@70 | |
2366 //int v33; // ecx@71 | |
2367 int v34; // eax@73 | |
2368 int v35; // ecx@77 | |
2369 int v36; // ecx@81 | |
2370 int v37; // ecx@86 | |
2371 int v38; // eax@88 | |
2372 int v39; // ecx@88 | |
2373 int v40; // eax@90 | |
2374 int v41; // edx@94 | |
2375 //int v42; // ecx@95 | |
2376 int v43; // ecx@98 | |
2377 int v44; // ecx@102 | |
2378 int v45; // eax@104 | |
2379 int v46; // eax@107 | |
2380 int v47; // ecx@111 | |
2381 int v48; // ecx@115 | |
2382 int v49; // edi@120 | |
2383 int v50; // eax@122 | |
2384 int v51; // ecx@122 | |
2385 int v52; // eax@124 | |
2386 int v53; // edx@128 | |
2387 int v54; // ecx@129 | |
2388 int v55; // ecx@132 | |
2389 int v56; // eax@139 | |
2390 int v57; // ecx@140 | |
2391 int v58; // eax@142 | |
2392 int v59; // ecx@146 | |
2393 //int v60; // ecx@147 | |
2394 int v61; // ecx@150 | |
2395 int v62; // ecx@155 | |
2396 int v63; // eax@157 | |
2397 int v64; // ecx@157 | |
2398 int v65; // eax@159 | |
2399 int v66; // edx@163 | |
2400 int v67; // ecx@164 | |
2401 int v68; // ecx@167 | |
2402 //int v69; // eax@173 | |
2403 int v70; // edi@178 | |
2404 //int v71; // eax@178 | |
2405 //int v72; // ecx@178 | |
2406 //int x; // ebx@180 | |
2407 //int v74; // eax@182 | |
2408 //int v75; // eax@184 | |
2409 IndoorCameraD3D *pIndoorCameraD3D_3; // ecx@184 | |
2410 int uStartZ; // ecx@184 | |
2411 int v79; // ebx@185 | |
2412 int v127; // esi@185 | |
2413 int v86; // edi@196 | |
2414 //int v87; // eax@196 | |
2415 //int v88; // ecx@196 | |
2416 //int v89; // eax@198 | |
2417 //int v90; // ecx@200 | |
2418 int v92; // ebx@203 | |
2419 //int v93; // ST08_4@204 | |
2420 int v97; // ST08_4@204 | |
2421 float result; // eax@212 | |
2422 //struct | |
2423 //{ | |
2424 int v106; // [sp+Ch] [bp-68h]@191 | |
2425 int v103; // [sp+10h] [bp-64h]@190 | |
2426 int v104; // [sp+12h] [bp-62h]@190 | |
2427 //} v102; | |
2428 int v105; // [sp+1Ch] [bp-58h]@1 | |
2429 int v107; // [sp+20h] [bp-54h]@3 | |
2430 int uEndZ; // [sp+24h] [bp-50h]@3 | |
2431 int v108; // [sp+28h] [bp-4Ch]@9 | |
2432 int v109; // [sp+2Ch] [bp-48h]@9 | |
2433 int v110; // [sp+30h] [bp-44h]@9 | |
2434 int v111; // [sp+34h] [bp-40h]@3 | |
2435 int v112; // [sp+38h] [bp-3Ch]@6 | |
2436 IndoorCameraD3D *pIndoorCameraD3D_4; // [sp+3Ch] [bp-38h]@9 | |
2437 int v114; // [sp+40h] [bp-34h]@9 | |
2438 int v115; // [sp+44h] [bp-30h]@9 | |
2439 int v116; // [sp+48h] [bp-2Ch]@9 | |
2440 //int v117; // [sp+4Ch] [bp-28h]@9 | |
2441 int v118; // [sp+50h] [bp-24h]@9 | |
2442 int v119; // [sp+54h] [bp-20h]@1 | |
2443 int v120; // [sp+58h] [bp-1Ch]@1 | |
2444 int i; // [sp+5Ch] [bp-18h]@1 | |
2445 int v122; // [sp+60h] [bp-14h]@1 | |
2446 int v123; // [sp+64h] [bp-10h]@1 | |
2447 int v124; // [sp+68h] [bp-Ch]@1 | |
2448 int v125; // [sp+6Ch] [bp-8h]@9 | |
2449 int v126; // [sp+70h] [bp-4h]@9 | |
2450 | |
2451 v105 = pIndoorCamera->sRotationY / ((signed int)stru_5C6E00->uIntegerHalfPi / 2);//2 | |
2452 pDirectionIndicator1 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerDoublePi - pIndoorCamera->sRotationY);//1536 | |
2453 pDirectionIndicator2 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1);//512 | |
2454 v124 = ((pIndoorCamera->uMapGridCellX << 16) + 3 * stru_5C6E00->Cos(stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1))) >> 16;//88 | |
2455 v123 = ((pIndoorCamera->uMapGridCellZ << 16) + 3 * stru_5C6E00->Sin(pDirectionIndicator2)) >> 16;// 66 | |
2456 v120 = pOutdoorCamera->outdoor_grid_band_3 + v124;//+- range X | |
2457 v119 = pOutdoorCamera->outdoor_grid_band_3 + v123; | |
2458 v2 = pOutdoorCamera->uCameraFovInDegrees + 15;//90 | |
2459 i = v124 - pOutdoorCamera->outdoor_grid_band_3; | |
2460 v122 = v123 - pOutdoorCamera->outdoor_grid_band_3; | |
2461 | |
2462 if ( v2 > 90 ) | |
2463 v2 = 90; | |
2464 v3 = (v2 << 11) / 720; | |
2465 v4 = stru_5C6E00->uDoublePiMask & (pDirectionIndicator1 - v3); | |
2466 v5 = stru_5C6E00->uDoublePiMask & (v3 + pDirectionIndicator1); | |
2467 | |
2468 v106 = stru_5C6E00->Cos(v4); | |
2469 uEndZ = stru_5C6E00->Sin(v4); | |
2470 | |
2471 v111 = stru_5C6E00->Cos(v5); | |
2472 v6 = stru_5C6E00->Sin(v5); | |
2473 | |
2474 v7 = v4 & stru_5C6E00->uPiMask; | |
2475 if ( (v4 & stru_5C6E00->uPiMask) >= stru_5C6E00->uIntegerHalfPi ) | |
2476 v8 = -stru_5C6E00->pTanTable[stru_5C6E00->uIntegerPi - v7]; | |
2477 else | |
2478 v8 = stru_5C6E00->pTanTable[v7]; | |
2479 v112 = abs(v8); | |
2480 | |
2481 v9 = v5 & stru_5C6E00->uPiMask; | |
2482 if ( (v5 & stru_5C6E00->uPiMask) >= stru_5C6E00->uIntegerHalfPi ) | |
2483 v10 = -stru_5C6E00->pTanTable[stru_5C6E00->uIntegerPi - v9]; | |
2484 else | |
2485 v10 = stru_5C6E00->pTanTable[v9]; | |
2486 v108 = abs(v10); | |
2487 | |
2488 //v11 = v124; | |
2489 //v12 = v123; | |
2490 v114 = 0; | |
2491 v115 = 0; | |
2492 pIndoorCameraD3D_4 = 0; | |
2493 v125 = 0; | |
2494 v126 = v124; | |
2495 v118 = v123; | |
2496 | |
2497 v110 = (v106 >= 0 ? 1: -1);//2 * (v106 >= 0) - 1; | |
2498 v109 = (uEndZ >= 0 ? 1: -1);//2 * (v107 >= 0) - 1; | |
2499 uEndZ = (v111 >= 0 ? 1: -1);//2 * (v111 >= 0) - 1; | |
2500 v106 = (v6 >= 0 ? 1: -1);//2 * (v6 >= 0) - 1; | |
2501 | |
2502 uint _i = 1; | |
2503 uint j = 1; | |
2504 | |
2505 terrain_76DDC8[0] = -1; | |
2506 terrain_76DFC8[0] = -1; | |
2507 terrain_76E1C8[0] = -1; | |
2508 terrain_76E3C8[0] = -1; | |
2509 | |
2510 for( uint _i = 1; _i < 128; _i++) | |
2511 { | |
2512 if ( v112 >= 0x10000 ) | |
2513 { | |
2514 int v1, v2; | |
2515 //v111 = 4294967296i64 / v112; | |
2516 //v114 += v111; | |
2517 //if ( v114 >= 65536 ) | |
2518 //{ | |
2519 // v11 += v110; | |
2520 // v114 = (unsigned __int16)v114; | |
2521 //} | |
2522 //v12 += v109; | |
2523 } | |
2524 else | |
2525 { | |
2526 v124 += v110; | |
2527 v115 += v112; | |
2528 if ( v112 + v115 >= 65536 ) | |
2529 { | |
2530 v123 += v109; | |
2531 v115 = (unsigned __int16)v115; | |
2532 } | |
2533 } | |
2534 if ( v124 < _i || v124 > v120 || v123 < v122 || v123 > v119 ) | |
2535 break; | |
2536 //v13 = v116++; | |
2537 terrain_76E3C8[_i] = v124; | |
2538 terrain_76E1C8[_i] = v123; | |
2539 } | |
2540 | |
2541 for( j = 1; j < 128; j++ ) | |
2542 { | |
2543 if ( v108 >= 65536 ) | |
2544 { | |
2545 v111 = 4294967296i64 / v108; | |
2546 v114 += v111;// | |
2547 if ( v111 + v114 >= 65536 ) | |
2548 { | |
2549 v126 += uEndZ; | |
2550 v114 = (unsigned __int16)v114;// | |
2551 } | |
2552 v118 += v106; | |
2553 } | |
2554 else | |
2555 { | |
2556 v125 += v108; | |
2557 v126 += uEndZ; | |
2558 if ( v125 >= 65536 ) | |
2559 { | |
2560 v118 += v106; | |
2561 v125 = (unsigned __int16)v125; | |
2562 } | |
2563 } | |
2564 //if ( v117 >= 128 ) | |
2565 //break; | |
2566 if ( v126 < _i ) | |
2567 break; | |
2568 if ( v126 > v120 ) | |
2569 break; | |
2570 v14 = v118; | |
2571 if ( v118 < v122 ) | |
2572 break; | |
2573 if ( v118 > v119 ) | |
2574 break; | |
2575 terrain_76DFC8[j] = v126; | |
2576 terrain_76DDC8[j] = v14; | |
2577 } | |
2578 v16 = 0; | |
2579 v126 = 0; | |
2580 v17 = j - 1; | |
2581 v18 = _i - 1; | |
2582 | |
2583 switch ( v105 ) | |
2584 { | |
2585 case 0: | |
2586 case 7: | |
2587 { | |
2588 //v116 = terrain_76DFC8[v17]; | |
2589 if ( v120 > terrain_76DFC8[v17] ) | |
2590 { | |
2591 v125 = v120; | |
2592 memset32(terrain_76D9C8.data(), v119 + 1, 4 * (v120 - terrain_76DFC8[v17] + 1)); | |
2593 v19 = v120; | |
2594 do | |
2595 terrain_76DBC8[v126++] = v19--; | |
2596 while ( v19 >= terrain_76DFC8[v17] ); | |
2597 if ( terrain_76DFC8[v17] == terrain_76DDC8[v17 + 127] ) | |
2598 { | |
2599 do | |
2600 v20 = terrain_76DDC8[v17-- -1]; | |
2601 while ( v20 == terrain_76DDC8[v17 -1] ); | |
2602 } | |
2603 v16 = v126; | |
2604 --v17; | |
2605 } | |
2606 if ( v17 < 0 ) | |
2607 v17 = 0; | |
2608 v21 = terrain_76DFC8[v17]; | |
2609 while ( 1 ) | |
2610 { | |
2611 v125 = terrain_76DFC8[v17]; | |
2612 if ( v21 < v124 ) | |
2613 break; | |
2614 terrain_76DBC8[v16] = v21; | |
2615 //v22 = terrain_76DDC8[v17] == 65535; | |
2616 terrain_76D9C8[v16] = terrain_76DDC8[v17] + 1; | |
2617 if ( terrain_76DDC8[v17] == 65535 ) | |
2618 { | |
2619 terrain_76D9C8[v16] = v123 + 1; | |
2620 break; | |
2621 } | |
2622 if ( !v17 ) | |
2623 break; | |
2624 if ( terrain_76DFC8[v17] == terrain_76DDC8[v17 - 1] ) | |
2625 { | |
2626 do | |
2627 v23 = terrain_76DDC8[v17-- -1]; | |
2628 while ( v23 == terrain_76DDC8[v17 -1] ); | |
2629 } | |
2630 --v17; | |
2631 v21 = v125 - 1; | |
2632 ++v16; | |
2633 } | |
2634 v16 = 0; | |
2635 //v24 = terrain_76E3C8[v18]; | |
2636 v126 = 0; | |
2637 if ( v120 > terrain_76E3C8[v18] ) | |
2638 { | |
2639 v125 = v120; | |
2640 memset32(terrain_76D5C8.data(), v122, 4 * (v120 - terrain_76E3C8[v18] + 1)); | |
2641 do | |
2642 { | |
2643 v25 = v126; | |
2644 v26 = v125--; | |
2645 ++v126; | |
2646 terrain_76D7C8[v25] = v26; | |
2647 } | |
2648 while ( v125 >= terrain_76E3C8[v18] ); | |
2649 if ( terrain_76E3C8[v18] == terrain_76E1C8[v18 -1] ) | |
2650 { | |
2651 do | |
2652 v27 = terrain_76E1C8[v18-- -1]; | |
2653 while ( v27 == terrain_76E1C8[v18 -1] ); | |
2654 } | |
2655 v16 = v126; | |
2656 --v18; | |
2657 } | |
2658 if ( v18 < 0 ) | |
2659 v18 = 0; | |
2660 v28 = terrain_76E3C8[v18]; | |
2661 while ( v28 >= v124 ) | |
2662 { | |
2663 v29 = terrain_76E1C8[v18]; | |
2664 terrain_76D7C8[v16] = v28; | |
2665 terrain_76D5C8[v16] = v29; | |
2666 if ( v29 == 65535 ) | |
2667 { | |
2668 v31 = v123; | |
2669 terrain_76D5C8[v16] = v31; | |
2670 break; | |
2671 } | |
2672 if ( !v18 ) | |
2673 break; | |
2674 if ( terrain_76E3C8[v18] == terrain_76E1C8[v18 -1] ) | |
2675 { | |
2676 do | |
2677 v30 = terrain_76E1C8[v18-- -1]; | |
2678 while ( v30 == terrain_76E1C8[v18 -1] ); | |
2679 } | |
2680 --v18; | |
2681 --v28; | |
2682 ++v16; | |
2683 } | |
2684 break; | |
2685 } | |
2686 case 1: | |
2687 case 2: | |
2688 { | |
2689 //v116 = terrain_76DDC8[v17]; | |
2690 if ( v122 < terrain_76DDC8[v17] ) | |
2691 { | |
2692 v106 = v122; | |
2693 memset32(terrain_76DBC8.data(), v120 + 1, 4 * (terrain_76DDC8[v17] - v122 + 1)); | |
2694 for ( v32 = v122; v32 <= terrain_76DDC8[v17]; v32++) | |
2695 terrain_76D9C8[v126++] = v32; | |
2696 if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] ) | |
2697 { | |
2698 do | |
2699 v34 = terrain_76DBC8[v17-- -1]; | |
2700 while ( v34 == terrain_76DBC8[v17 -1] ); | |
2701 } | |
2702 v16 = v126; | |
2703 --v17; | |
2704 } | |
2705 if ( v17 < 0 ) | |
2706 v17 = 0; | |
2707 v35 = terrain_76DDC8[v17]; | |
2708 v125 = terrain_76DDC8[v17]; | |
2709 while ( v35 <= v123 ) | |
2710 { | |
2711 //v22 = terrain_76DFC8[v17] == 65535; | |
2712 terrain_76DBC8[v16] = terrain_76DFC8[v17] + 1; | |
2713 terrain_76D9C8[v16] = v125; | |
2714 if ( terrain_76DFC8[v17] == 65535 ) | |
2715 { | |
2716 terrain_76DBC8[v16] = v124 + 1; | |
2717 break; | |
2718 } | |
2719 if ( !v17 ) | |
2720 break; | |
2721 if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] ) | |
2722 { | |
2723 do | |
2724 v36 = terrain_76DBC8[v17-- -1]; | |
2725 while ( v36 == terrain_76DBC8[v17 -1] ); | |
2726 } | |
2727 --v17; | |
2728 ++v125; | |
2729 v35 = v125; | |
2730 ++v16; | |
2731 } | |
2732 v16 = 0; | |
2733 v126 = 0; | |
2734 v37 = terrain_76E1C8[v18]; | |
2735 if ( v122 < v37 ) | |
2736 { | |
2737 v114 = v122; | |
2738 memset32(terrain_76D7C8.data(), i, 4 * (v37 - v122 + 1)); | |
2739 do | |
2740 { | |
2741 v38 = v126; | |
2742 v39 = v114; | |
2743 ++v126; | |
2744 ++v114; | |
2745 terrain_76D5C8[v38] = v39; | |
2746 } | |
2747 while ( v114 <= terrain_76E1C8[v18] ); | |
2748 if ( terrain_76E1C8[v18] == terrain_76DFC8[v18 -1] ) | |
2749 { | |
2750 do | |
2751 v40 = terrain_76DFC8[v18-- -1]; | |
2752 while ( v40 == terrain_76DFC8[v18 -1] ); | |
2753 } | |
2754 v16 = v126; | |
2755 --v18; | |
2756 } | |
2757 if ( v18 < 0 ) | |
2758 v18 = 0; | |
2759 v41 = terrain_76E1C8[v18]; | |
2760 while ( v41 <= v123 ) | |
2761 { | |
2762 terrain_76D5C8[v16] = v41; | |
2763 terrain_76D7C8[v16] = terrain_76E3C8[v18]; | |
2764 if ( terrain_76E3C8[v18] == 65535 ) | |
2765 { | |
2766 terrain_76D7C8[v16] = v124; | |
2767 break; | |
2768 } | |
2769 if ( !v18 ) | |
2770 break; | |
2771 if ( terrain_76E1C8[v18] == terrain_76DFC8[v18 -1] ) | |
2772 { | |
2773 do | |
2774 v43 = terrain_76DFC8[v18-- -1]; | |
2775 while ( v43 == terrain_76DFC8[v18 -1] ); | |
2776 } | |
2777 --v18; | |
2778 ++v41; | |
2779 ++v16; | |
2780 } | |
2781 break; | |
2782 } | |
2783 case 5: | |
2784 case 6: | |
2785 { | |
2786 //v116 = terrain_76DDC8[v17]; | |
2787 if ( v119 > terrain_76DDC8[v17] ) | |
2788 { | |
2789 v106 = v119; | |
2790 memset32(terrain_76DBC8.data(), i, 4 * (v119 - terrain_76DDC8[v17] + 1)); | |
2791 for ( v45 = v119; v45 >= terrain_76DDC8[v17]; v45--) | |
2792 terrain_76D9C8[v126++] = v45; | |
2793 if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] ) | |
2794 { | |
2795 do | |
2796 v46 = terrain_76DBC8[v17-- -1]; | |
2797 while ( v46 == terrain_76DBC8[v17 -1] ); | |
2798 } | |
2799 v16 = v126; | |
2800 --v17; | |
2801 } | |
2802 if ( v17 < 0 ) | |
2803 v17 = 0; | |
2804 v47 = terrain_76DDC8[v17]; | |
2805 v125 = terrain_76DDC8[v17]; | |
2806 while ( v47 >= v123 ) | |
2807 { | |
2808 //v22 = terrain_76DFC8[v17] == 65535; | |
2809 terrain_76DBC8[v16] = terrain_76DFC8[v17]; | |
2810 terrain_76D9C8[v16] = v125; | |
2811 if ( terrain_76DFC8[v17] == 65535 ) | |
2812 { | |
2813 terrain_76DBC8[v16] = v124; | |
2814 break; | |
2815 } | |
2816 if ( !v17 ) | |
2817 break; | |
2818 if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] ) | |
2819 { | |
2820 do | |
2821 v48 = terrain_76DBC8[v17-- -1]; | |
2822 while ( v48 == terrain_76DBC8[v17 -1] ); | |
2823 } | |
2824 --v17; | |
2825 --v125; | |
2826 v47 = v125; | |
2827 ++v16; | |
2828 } | |
2829 v16 = 0; | |
2830 v49 = terrain_76E1C8[v18]; | |
2831 v126 = 0; | |
2832 if ( v119 > v49 ) | |
2833 { | |
2834 v125 = v119; | |
2835 memset32(terrain_76D7C8.data(), v120 + 1, 4 * (v119 - v49 + 1)); | |
2836 do | |
2837 { | |
2838 v50 = v126; | |
2839 v51 = v125--; | |
2840 ++v126; | |
2841 terrain_76D5C8[v50] = v51; | |
2842 } | |
2843 while ( v125 >= terrain_76E1C8[v18] ); | |
2844 if ( terrain_76E1C8[v18] == terrain_76DFC8[v18 -1] ) | |
2845 { | |
2846 do | |
2847 v52 = terrain_76DFC8[v18-- -1]; | |
2848 while ( v52 == terrain_76DFC8[v18 -1] ); | |
2849 } | |
2850 v16 = v126; | |
2851 --v18; | |
2852 } | |
2853 if ( v18 < 0 ) | |
2854 v18 = 0; | |
2855 v53 = terrain_76E1C8[v18]; | |
2856 while ( v53 >= v123 ) | |
2857 { | |
2858 v54 = terrain_76E3C8[v18]; | |
2859 terrain_76D5C8[v16] = v53; | |
2860 terrain_76D7C8[v16] = v54 + 1; | |
2861 if ( v54 == 65535 ) | |
2862 { | |
2863 terrain_76D7C8[v16] = v124 + 1; | |
2864 break; | |
2865 } | |
2866 if ( !v18 ) | |
2867 break; | |
2868 if ( terrain_76E1C8[v18] == terrain_76DFC8[v18 -1] ) | |
2869 { | |
2870 do | |
2871 v55 = terrain_76DFC8[v18-- -1]; | |
2872 while ( v55 == terrain_76DFC8[v18 -1] ); | |
2873 } | |
2874 --v18; | |
2875 --v53; | |
2876 ++v16; | |
2877 } | |
2878 break; | |
2879 } | |
2880 case 3: | |
2881 case 4: | |
2882 { | |
2883 //v116 = terrain_76DFC8[v17]; | |
2884 if ( i < terrain_76DFC8[v17] ) | |
2885 { | |
2886 v106 = i; | |
2887 memset32(terrain_76D9C8.data(), v122, 4 * (terrain_76DFC8[v17] - i + 1)); | |
2888 v56 = i; | |
2889 do | |
2890 { | |
2891 v57 = v126++; | |
2892 terrain_76DBC8[v57] = v56++; | |
2893 } | |
2894 while ( v56 <= terrain_76DFC8[v17] ); | |
2895 if ( terrain_76DFC8[v17] == terrain_76DDC8[v17 -1] ) | |
2896 { | |
2897 do | |
2898 v58 = terrain_76DDC8[v17-- -1]; | |
2899 while ( v58 == terrain_76DDC8[v17 -1] ); | |
2900 } | |
2901 v16 = v126; | |
2902 --v17; | |
2903 } | |
2904 if ( v17 < 0 ) | |
2905 v17 = 0; | |
2906 v59 = terrain_76DFC8[v17]; | |
2907 while ( 1 ) | |
2908 { | |
2909 v125 = v59; | |
2910 if ( v59 > v124 ) | |
2911 break; | |
2912 terrain_76DBC8[v16] = v59; | |
2913 //v60 = terrain_76DDC8[v17]; | |
2914 terrain_76D9C8[v16] = terrain_76DDC8[v17]; | |
2915 if ( terrain_76DDC8[v17] == 65535 ) | |
2916 { | |
2917 terrain_76D9C8[v16] = v123; | |
2918 break; | |
2919 } | |
2920 if ( !v17 ) | |
2921 break; | |
2922 if ( terrain_76DFC8[v17] == terrain_76DDC8[v17 -1] ) | |
2923 { | |
2924 do | |
2925 v61 = terrain_76DDC8[v17-- -1]; | |
2926 while ( v61 == terrain_76DDC8[v17 -1] ); | |
2927 } | |
2928 --v17; | |
2929 v59 = v125 + 1; | |
2930 ++v16; | |
2931 } | |
2932 v16 = 0; | |
2933 v126 = 0; | |
2934 v62 = terrain_76E3C8[v18]; | |
2935 if ( i < v62 ) | |
2936 { | |
2937 v114 = i; | |
2938 memset32(terrain_76D5C8.data(), v119 + 1, 4 * (v62 - i + 1)); | |
2939 do | |
2940 { | |
2941 v63 = v126; | |
2942 v64 = v114; | |
2943 ++v126; | |
2944 ++v114; | |
2945 terrain_76D7C8[v63] = v64; | |
2946 } | |
2947 while ( v114 <= terrain_76E3C8[v18] ); | |
2948 if ( terrain_76E3C8[v18] == terrain_76E1C8[v18 -1] ) | |
2949 { | |
2950 do | |
2951 v65 = terrain_76E1C8[v18-- -1]; | |
2952 while ( v65 == terrain_76E1C8[v18 -1] ); | |
2953 } | |
2954 v16 = v126; | |
2955 --v18; | |
2956 } | |
2957 if ( v18 < 0 ) | |
2958 v18 = 0; | |
2959 v66 = terrain_76E3C8[v18]; | |
2960 while ( v66 <= v124 ) | |
2961 { | |
2962 v67 = terrain_76E1C8[v18]; | |
2963 terrain_76D7C8[v16] = v66; | |
2964 terrain_76D5C8[v16] = v67 + 1; | |
2965 if ( terrain_76E1C8[v18] == 65535 ) | |
2966 { | |
2967 v31 = v123 + 1; | |
2968 terrain_76D5C8[v16] = v31; | |
2969 break; | |
2970 } | |
2971 if ( !v18 ) | |
2972 break; | |
2973 if ( terrain_76E3C8[v18] == terrain_76E1C8[v18 -1] ) | |
2974 { | |
2975 do | |
2976 v68 = terrain_76E1C8[v18-- -1]; | |
2977 while ( v68 == terrain_76E1C8[v18 -1] ); | |
2978 } | |
2979 --v18; | |
2980 ++v66; | |
2981 ++v16; | |
2982 } | |
2983 break; | |
2984 } | |
2985 default: | |
2986 break; | |
2987 } | |
2988 //v69 = v16 - 1; | |
2989 ptr_801A08 = pVerticesSR_806210; | |
2990 ptr_801A04 = pVerticesSR_801A10; | |
2991 //v126 = v69; | |
2992 | |
2993 if ( v105 && v105 != 7 && v105 != 3 && v105 != 4 )//áëîê | |
2994 { | |
2995 for ( i = v16 - 1; i >= 1; --i ) | |
2996 { | |
2997 //v70 = i; | |
2998 //v71 = terrain_76D7C8[i];//88 | |
2999 //v72 = terrain_76DBC8[i];//0 | |
3000 if ( terrain_76D7C8[i] < terrain_76DBC8[i] )//swap | |
3001 { | |
3002 terrain_76DBC8[i] = terrain_76D7C8[i]; | |
3003 terrain_76D7C8[i] = terrain_76DBC8[i]; | |
3004 } | |
3005 //x = terrain_76DBC8[i];//0 | |
3006 v111 = 0; | |
3007 if ( terrain_76DBC8[i] <= 0 ) | |
3008 terrain_76DBC8[i] = -terrain_76DBC8[i]; | |
3009 //v74 = terrain_76D7C8[i]; | |
3010 if ( terrain_76D7C8[i] <= 0 ) | |
3011 terrain_76D7C8[i] = -terrain_76D7C8[i]; | |
3012 uEndZ = terrain_76D7C8[i] + 2; | |
3013 //pIndoorCameraD3D_3 = pGame->pIndoorCameraD3D; | |
3014 //uEndZ = v75; | |
3015 //pIndoorCameraD3D_4 = pIndoorCameraD3D_3; | |
3016 uStartZ = terrain_76DBC8[i] - 2; | |
3017 if ( terrain_76DBC8[i] - 2 < uEndZ ) | |
3018 { | |
3019 v127 = 0; | |
3020 //v79 = (v73 - 66) << 9; | |
3021 //v116 = v77; | |
3022 //pHeight = v79; | |
3023 v111 = uEndZ - uStartZ; | |
3024 for (int z = uStartZ; z < uEndZ; ++z) | |
3025 { | |
3026 ptr_801A08[v127].vWorldPosition.x = (-64 + terrain_76DBC8[i]) * 512;//pTerrainVertices[z * 128 + x].vWorldPosition.x = (-64 + (signed)x) * 512; | |
3027 ptr_801A08[v127].vWorldPosition.y = (64 - terrain_76D9C8[i]) * 512; | |
3028 ptr_801A08[v127].vWorldPosition.z = pOutdoor->GetHeightOnTerrain( z, terrain_76D9C8[i]); | |
3029 | |
3030 ptr_801A04[v127].vWorldPosition.x = (-64 + terrain_76DBC8[i]) * 512; | |
3031 ptr_801A04[v127].vWorldPosition.y = (63 - terrain_76D9C8[i]) * 512; | |
3032 ptr_801A04[v127].vWorldPosition.z = pOutdoor->GetHeightOnTerrain( z, terrain_76D9C8[i] + 1); | |
3033 | |
3034 if ( !byte_4D864C || !(pGame->uFlags & 0x80) ) | |
3035 { | |
3036 pIndoorCameraD3D_4->ViewTransform(&ptr_801A08[v127], 1); | |
3037 pIndoorCameraD3D_4->ViewTransform(&ptr_801A04[v127], 1); | |
3038 | |
3039 pIndoorCameraD3D_4->Project(&ptr_801A08[v127], 1, 0); | |
3040 pIndoorCameraD3D_4->Project(&ptr_801A04[v127], 1, 0); | |
3041 } | |
3042 //v79 += 512; | |
3043 v127 ++; | |
3044 //++v116; | |
3045 //pHeight = v79; | |
3046 } | |
3047 //while ( v116 < v107 ); | |
3048 } | |
3049 v103 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[i]); | |
3050 v104 = abs((int)pIndoorCamera->uMapGridCellX - terrain_76DBC8[i]); | |
3051 if ( pRenderer->pRenderD3D )//Ritor1: do comment to test | |
3052 Render::DrawTerrainD3D(v111, 0, v103, v104); | |
3053 //Render::RenderTerrainD3D(); | |
3054 else | |
3055 Render::DrawTerrainSW(v111, 0, v103, v104); | |
3056 } | |
3057 } | |
3058 else | |
3059 { | |
3060 for ( i = v16 - 1; i >= 1; --i ) | |
3061 { | |
3062 //v86 = i; | |
3063 //v87 = terrain_76D5C8[i]; | |
3064 //v88 = terrain_76D9C8[i]; | |
3065 if ( terrain_76D5C8[i] < terrain_76D9C8[i] ) | |
3066 { | |
3067 terrain_76D9C8[i] = terrain_76D5C8[i]; | |
3068 terrain_76D5C8[i] = terrain_76D9C8[i]; | |
3069 } | |
3070 //v89 = terrain_76D9C8[i]; | |
3071 v111 = 0; | |
3072 if ( terrain_76D9C8[i] <= 0 ) | |
3073 terrain_76D9C8[i] = -terrain_76D9C8[i]; | |
3074 //v90 = terrain_76D5C8[i]; | |
3075 if ( terrain_76D5C8[i] <= 0 ) | |
3076 terrain_76D5C8[i] = -terrain_76D5C8[i]; | |
3077 pIndoorCameraD3D_4 = pGame->pIndoorCameraD3D; | |
3078 v107 = terrain_76D5C8[i] + 2; | |
3079 if ( terrain_76D9C8[i] - 2 < terrain_76D5C8[i] + 2 ) | |
3080 { | |
3081 v86 = 0; | |
3082 //v116 = terrain_76D9C8[i] - 2; | |
3083 v92 = (66 - terrain_76D9C8[i]) << 9; | |
3084 //pHeight = (66 - terrain_76D9C8[i]) << 9; | |
3085 v111 = terrain_76D5C8[i] + 2 - (terrain_76D9C8[i] - 2); | |
3086 //do | |
3087 for ( v116 = terrain_76D9C8[i] - 2; v116 < v107; ++v116 ) | |
3088 { | |
3089 ptr_801A08[v86].vWorldPosition.x = (terrain_76DBC8[v86] - 64) << 9; | |
3090 ptr_801A08[v86].vWorldPosition.y = v92; | |
3091 ptr_801A08[v86].vWorldPosition.z = pOutdoor->GetHeightOnTerrain(terrain_76DBC8[v86], v116); | |
3092 | |
3093 ptr_801A04[v86].vWorldPosition.x = (terrain_76DBC8[v86] - 63) << 9; | |
3094 ptr_801A04[v86].vWorldPosition.y = v92; | |
3095 ptr_801A04[v86].vWorldPosition.z = pOutdoor->GetHeightOnTerrain(terrain_76DBC8[v86] + 1, v116); | |
3096 if ( !byte_4D864C || !(pGame->uFlags & 0x80) ) | |
3097 { | |
3098 pIndoorCameraD3D_4->ViewTransform((RenderVertexSoft *)(char *)ptr_801A08 + v86, 1); | |
3099 pIndoorCameraD3D_4->ViewTransform((RenderVertexSoft *)(char *)ptr_801A04 + v86, 1); | |
3100 pIndoorCameraD3D_4->Project((RenderVertexSoft *)(char *)ptr_801A08 + v86, 1, 0); | |
3101 pIndoorCameraD3D_4->Project((RenderVertexSoft *)(char *)ptr_801A04 + v86, 1, 0); | |
3102 } | |
3103 v92 -= 512; | |
3104 v86 += 48; | |
3105 //++v116; | |
3106 //pHeight = v92; | |
3107 } | |
3108 //while ( v116 < v107 ); | |
3109 } | |
3110 v103 = abs((int)pIndoorCamera->uMapGridCellX - terrain_76DBC8[v86]); | |
3111 v104 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[v86]); | |
3112 if ( pRenderer->pRenderD3D ) | |
3113 Render::DrawTerrainD3D(v111, 1, v103, v104); | |
3114 else | |
3115 Render::DrawTerrainSW(v111, 1, v103, v104); | |
3116 } | |
3117 } | |
3118 result = v126; | |
3119 pOutdoorCamera->field_40 = v126; | |
3120 return result; | |
3121 } | |
3122 //----- (00482E07) -------------------------------------------------------- | |
3123 signed int __fastcall sr_sub_482E07(Span *ecx0, unsigned __int16 *pRenderTarget) | |
3124 { | |
3125 stru315 *v2; // ebp@0 | |
3126 Polygon *v3; // esi@1 | |
3127 int v4; // edi@1 | |
3128 int v5; // edi@1 | |
3129 stru149 *v6; // eax@1 | |
3130 stru149 *v7; // eax@1 | |
3131 int v8; // edx@1 | |
3132 int v9; // eax@1 | |
3133 int v10; // edi@1 | |
3134 int v11; // eax@1 | |
3135 unsigned __int64 v12; // qax@1 | |
3136 int v13; // eax@1 | |
3137 signed __int64 v14; // qtt@3 | |
3138 int v15; // ebx@4 | |
3139 signed __int64 v16; // qtt@5 | |
3140 int v17; // eax@5 | |
3141 unsigned __int16 *v18; // eax@7 | |
3142 Texture *v19; // eax@8 | |
3143 Texture *v20; // eax@10 | |
3144 Texture *v21; // eax@12 | |
3145 Texture *v22; // eax@14 | |
3146 int v23; // ecx@17 | |
3147 Texture *v24; // ebx@17 | |
3148 signed int v25; // edx@17 | |
3149 signed int v26; // eax@17 | |
3150 char v27; // bl@17 | |
3151 stru149 *v28; // eax@18 | |
3152 stru149 *v29; // eax@18 | |
3153 int v30; // eax@18 | |
3154 int v31; // eax@18 | |
3155 unsigned int v32; // edx@18 | |
3156 int v33; // edi@21 | |
3157 signed __int64 v34; // qtt@22 | |
3158 signed int v35; // ecx@22 | |
3159 int v36; // eax@24 | |
3160 stru149 *v37; // eax@24 | |
3161 int v38; // edi@24 | |
3162 int v39; // eax@24 | |
3163 int v40; // edi@35 | |
3164 signed __int64 v41; // qtt@36 | |
3165 int v42; // edx@36 | |
3166 stru149 *v43; // eax@36 | |
3167 int v44; // edi@36 | |
3168 int v45; // eax@36 | |
3169 Span *v46; // edi@44 | |
3170 stru149 *v47; // eax@44 | |
3171 stru149 *v48; // eax@44 | |
3172 int v49; // eax@44 | |
3173 int v50; // ecx@44 | |
3174 unsigned int v51; // edx@44 | |
3175 int v52; // edi@46 | |
3176 signed __int64 v53; // qtt@47 | |
3177 unsigned int v54; // ecx@47 | |
3178 int v55; // eax@49 | |
3179 stru149 *v56; // eax@49 | |
3180 int v57; // edi@49 | |
3181 int v58; // eax@49 | |
3182 int v59; // edi@60 | |
3183 signed __int64 v60; // qtt@61 | |
3184 int v61; // edx@61 | |
3185 stru149 *v62; // eax@61 | |
3186 int v63; // edi@61 | |
3187 int v64; // eax@61 | |
3188 int v66; // [sp+Ch] [bp-B8h]@1 | |
3189 int v67; // [sp+10h] [bp-B4h]@1 | |
3190 int v68; // [sp+14h] [bp-B0h]@1 | |
3191 int v69; // [sp+18h] [bp-ACh]@1 | |
3192 int v70; // [sp+1Ch] [bp-A8h]@5 | |
3193 int v71; // [sp+20h] [bp-A4h]@1 | |
3194 signed int v72; // [sp+24h] [bp-A0h]@1 | |
3195 stru316 a2; // [sp+28h] [bp-9Ch]@18 | |
3196 int v74; // [sp+50h] [bp-74h]@17 | |
3197 stru315 a1; // [sp+54h] [bp-70h]@5 | |
3198 Span *v76; // [sp+98h] [bp-2Ch]@1 | |
3199 unsigned __int16 *v77; // [sp+9Ch] [bp-28h]@1 | |
3200 int v78; // [sp+A0h] [bp-24h]@17 | |
3201 int v79; // [sp+A4h] [bp-20h]@3 | |
3202 int v80; // [sp+A8h] [bp-1Ch]@3 | |
3203 int v81; // [sp+ACh] [bp-18h]@1 | |
3204 int X; // [sp+B0h] [bp-14h]@2 | |
3205 int v83; // [sp+B4h] [bp-10h]@1 | |
3206 int v84; // [sp+B8h] [bp-Ch]@1 | |
3207 int v85; // [sp+BCh] [bp-8h]@1 | |
3208 int v86; // [sp+C0h] [bp-4h]@18 | |
3209 | |
3210 v85 = ecx0->field_C; | |
3211 v3 = ecx0->pParent; | |
3212 v4 = pViewport->uScreenCenterY - ecx0->field_A; | |
3213 v77 = pRenderTarget; | |
3214 v5 = pOutdoorCamera->int_fov_rad_inv * v4; | |
3215 v6 = v3->ptr_38; | |
3216 v76 = ecx0; | |
3217 v81 = v5; | |
3218 v83 = v6->field_14; | |
3219 v81 = (unsigned __int64)(v83 * (signed __int64)v5) >> 16; | |
3220 v7 = v3->ptr_38; | |
3221 v8 = v81 + v7->field_C; | |
3222 v83 = v7->field_20; | |
3223 v67 = v8; | |
3224 v9 = ((unsigned __int64)(v83 * (signed __int64)v5) >> 16) + v3->ptr_38->field_18; | |
3225 v81 = v5; | |
3226 v71 = v9; | |
3227 v83 = v3->v_18.z; | |
3228 v81 = (unsigned __int64)(v83 * (signed __int64)v5) >> 16; | |
3229 v68 = v3->sTextureDeltaU << 16; | |
3230 v69 = v3->sTextureDeltaV << 16; | |
3231 v72 = -v3->field_24; | |
3232 v10 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - ecx0->field_8); | |
3233 v11 = v3->v_18.y; | |
3234 v66 = v81 + v3->v_18.x; | |
3235 v83 = v10; | |
3236 v12 = v10 * (signed __int64)v11; | |
3237 v81 = v12 >> 16; | |
3238 v13 = v66 + (v12 >> 16); | |
3239 v84 = v13; | |
3240 if ( !v13 | |
3241 || (X = v72 >> 15, v83 = abs(v13), abs(v72 >> 15) >= v83) | |
3242 || (LODWORD(v14) = v72 << 16, | |
3243 HIDWORD(v14) = v72 >> 16, | |
3244 v79 = v14 / v84, | |
3245 v80 = v10 - v85 * pOutdoorCamera->int_fov_rad_inv, | |
3246 v81 = (unsigned __int64)(v80 * (signed __int64)v3->v_18.y) >> 16, | |
3247 (v84 = v66 + v81) == 0) | |
3248 || (v15 = abs(v66 + v81), abs(X) >= v15) ) | |
3249 return 0; | |
3250 LODWORD(v16) = v72 << 16; | |
3251 HIDWORD(v16) = v72 >> 16; | |
3252 v70 = v16 / v84; | |
3253 v17 = v16 / v84; | |
3254 a1.field_24 = v79; | |
3255 if ( v79 >= v17 ) | |
3256 a1.field_24 = v17; | |
3257 v18 = (unsigned __int16 *)v3->pTexture->pLevelOfDetail2; | |
3258 a1.pTextureLOD = (unsigned __int16 *)v3->pTexture->pLevelOfDetail2; | |
3259 v84 = 2; | |
3260 if ( a1.field_24 >= mipmapping_building_mm1 << 16 ) | |
3261 { | |
3262 if ( a1.field_24 >= mipmapping_building_mm2 << 16 ) | |
3263 { | |
3264 if ( a1.field_24 >= mipmapping_building_mm3 << 16 ) | |
3265 { | |
3266 if ( bUseLoResSprites ) | |
3267 goto LABEL_16; | |
3268 v22 = v3->pTexture; | |
3269 v84 = 3; | |
3270 v18 = (unsigned __int16 *)v22->pLevelOfDetail3; | |
3271 } | |
3272 else | |
3273 { | |
3274 v21 = v3->pTexture; | |
3275 v84 = 2; | |
3276 v18 = (unsigned __int16 *)v21->pLevelOfDetail2; | |
3277 } | |
3278 } | |
3279 else | |
3280 { | |
3281 v20 = v3->pTexture; | |
3282 v84 = 1; | |
3283 v18 = (unsigned __int16 *)v20->pLevelOfDetail1; | |
3284 } | |
3285 } | |
3286 else | |
3287 { | |
3288 v19 = v3->pTexture; | |
3289 v84 = 0; | |
3290 v18 = (unsigned __int16 *)v19->pLevelOfDetail0_prolly_alpha_mask; | |
3291 } | |
3292 a1.pTextureLOD = v18; | |
3293 LABEL_16: | |
3294 if ( v18 ) | |
3295 { | |
3296 v23 = v3->field_5A; | |
3297 v83 = v3->field_52; | |
3298 v24 = v3->pTexture; | |
3299 v74 = v23; | |
3300 v78 = v85 >> v23; | |
3301 v25 = v24->uTextureWidth; | |
3302 v81 = v85 - (v85 >> v23 << v23); | |
3303 v26 = (signed int)v24->uTextureHeight >> v84; | |
3304 a1.field_10 = v84 - v24->uWidthLn2 + 16; | |
3305 v27 = v84 + bUseLoResSprites; | |
3306 a1.field_8 = (v26 << 16) - 65536; | |
3307 a1.field_C = (v25 >> v84) - 1; | |
3308 if ( v79 >= v70 ) | |
3309 { | |
3310 v46 = v76; | |
3311 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v76, v70, v3, pOutdoorCamera->building_gamme, 0, 1); | |
3312 v47 = v3->ptr_38; | |
3313 v79 = v80; | |
3314 v86 = v47->field_10; | |
3315 v79 = v80; | |
3316 v84 = v67 + ((unsigned __int64)(v86 * (signed __int64)v80) >> 16); | |
3317 v86 = v3->ptr_38->field_1C; | |
3318 v86 = v71 + ((unsigned __int64)(v86 * (signed __int64)v80) >> 16); | |
3319 v79 = (unsigned __int64)(v84 * (signed __int64)v70) >> 16; | |
3320 v48 = v3->ptr_38; | |
3321 v79 = v70; | |
3322 a1.field_30 = v68 + ((unsigned __int64)(v84 * (signed __int64)v70) >> 16) - v48->field_24; | |
3323 v79 = (unsigned __int64)(v86 * (signed __int64)v70) >> 16; | |
3324 v49 = ((unsigned __int64)(v86 * (signed __int64)v70) >> 16) - v3->ptr_38->field_28; | |
3325 a1.field_30 >>= v27; | |
3326 a1.field_2C = (v69 + v49) >> v27; | |
3327 a1.field_14 = dword_80AA20 >> v27; | |
3328 a1.field_18 = dword_80AA1C >> v27; | |
3329 a1.field_1C = dword_80AA18 >> v27; | |
3330 v50 = v46->field_8; | |
3331 a1.field_20 = dword_80AA14 >> v27; | |
3332 v51 = v50 + pRenderer->uTargetSurfacePitch * v46->field_A; | |
3333 a1.pDepthBuffer = (unsigned int *)(&pRenderer->pActiveZBuffer[640 * v46->field_A - 1] + v85 + v50); | |
3334 a1.pColorBuffer = &v77[v85 - 1] + v51; | |
3335 v80 += pOutdoorCamera->int_fov_rad_inv << v74; | |
3336 if ( v78 > 0 ) | |
3337 { | |
3338 do | |
3339 { | |
3340 v77 = (unsigned __int16 *)v3->v_18.y; | |
3341 v86 = (unsigned __int64)((signed int)v77 * (signed __int64)v80) >> 16; | |
3342 v84 = v66 + ((unsigned __int64)((signed int)v77 * (signed __int64)v80) >> 16); | |
3343 if ( v66 + (unsigned int)((unsigned __int64)((signed int)v77 * (signed __int64)v80) >> 16) | |
3344 && (v52 = abs((signed __int64)v66 + ((__int64)((signed int)v77 * (signed __int64)v80) >> 16)), abs((signed __int64)X) < v52) ) | |
3345 { | |
3346 LODWORD(v53) = v72 << 16; | |
3347 HIDWORD(v53) = v72 >> 16; | |
3348 v86 = v53 / v84; | |
3349 v54 = v53 / v84; | |
3350 v84 = v53 / v84; | |
3351 } | |
3352 else | |
3353 { | |
3354 v84 = 0x40000000u; | |
3355 v54 = 0x40000000u; | |
3356 } | |
3357 HIWORD(v55) = HIWORD(v54); | |
3358 LOWORD(v55) = 0; | |
3359 a1.field_24 = v3->field_50 | v55; | |
3360 v77 = (unsigned __int16 *)v3->ptr_38->field_10; | |
3361 v77 = (unsigned __int16 *)(v67 + ((unsigned __int64)((signed int)v77 * (signed __int64)v80) >> 16)); | |
3362 v86 = (unsigned __int64)((signed int)v77 * (signed __int64)(signed int)v54) >> 16; | |
3363 v56 = v3->ptr_38; | |
3364 v57 = ((unsigned __int64)((signed int)v77 * (signed __int64)(signed int)v54) >> 16) - v56->field_24; | |
3365 v77 = (unsigned __int16 *)v56->field_1C; | |
3366 v77 = (unsigned __int16 *)(v71 + ((unsigned __int64)((signed int)v77 * (signed __int64)v80) >> 16)); | |
3367 v86 = (unsigned __int64)((signed int)v77 * (signed __int64)(signed int)v54) >> 16; | |
3368 v58 = (((v69 + v86 - v3->ptr_38->field_28) >> v27) - a1.field_2C) >> v74; | |
3369 a1.field_4 = (((v68 + v57) >> v27) - a1.field_30) >> v74; | |
3370 a1.field_0 = v58; | |
3371 a1.field_28 = v83; | |
3372 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
3373 { | |
3374 if ( v3->pODMFace->uPolygonType == 1 ) | |
3375 sr_sub_485BAE(&a1, &a2); | |
3376 else | |
3377 sr_sub_485AFF(&a1, &a2); | |
3378 } | |
3379 else | |
3380 { | |
3381 if ( v3->pODMFace->uPolygonType == 1 ) | |
3382 sr_sub_4D71F8(&a1); | |
3383 else | |
3384 sr_sub_4D714C(&a1); | |
3385 } | |
3386 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F( | |
3387 &a2, | |
3388 v76, | |
3389 v84, | |
3390 v3, | |
3391 pOutdoorCamera->building_gamme, | |
3392 0, | |
3393 0); | |
3394 v80 += pOutdoorCamera->int_fov_rad_inv << v74; | |
3395 --v78; | |
3396 } | |
3397 while ( v78 ); | |
3398 } | |
3399 if ( !v81 ) | |
3400 return 1; | |
3401 v83 = v3->v_18.y; | |
3402 v86 = (unsigned __int64)(v83 * (signed __int64)v80) >> 16; | |
3403 v84 = v66 + ((unsigned __int64)(v83 * (signed __int64)v80) >> 16); | |
3404 if ( v66 + (unsigned int)((unsigned __int64)(v83 * (signed __int64)v80) >> 16) ) | |
3405 { | |
3406 v59 = abs((signed __int64)v66 + ((__int64)(v83 * (signed __int64)v80) >> 16)); | |
3407 if ( abs(X) < v59 ) | |
3408 { | |
3409 LODWORD(v60) = v72 << 16; | |
3410 HIDWORD(v60) = v72 >> 16; | |
3411 v86 = v60 / v84; | |
3412 HIWORD(v61) = (unsigned int)(v60 / v84) >> 16; | |
3413 LOWORD(v61) = 0; | |
3414 a1.field_24 = v61 | v3->field_50; | |
3415 v83 = v3->ptr_38->field_10; | |
3416 v83 = v67 + ((unsigned __int64)(v83 * (signed __int64)v80) >> 16); | |
3417 v86 = (unsigned __int64)(v83 * v60 / v84) >> 16; | |
3418 v62 = v3->ptr_38; | |
3419 v63 = ((unsigned __int64)(v83 * v60 / v84) >> 16) - v62->field_24; | |
3420 v83 = v62->field_1C; | |
3421 v83 = v71 + ((unsigned __int64)(v83 * (signed __int64)v80) >> 16); | |
3422 v86 = (unsigned __int64)(v83 * v60 / v84) >> 16; | |
3423 v64 = (((signed int)(v69 + ((unsigned __int64)(v83 * v60 / v84) >> 16) - v3->ptr_38->field_28) >> v27) | |
3424 - a1.field_2C) >> v74; | |
3425 a1.field_4 = (((v68 + v63) >> v27) - a1.field_30) >> v74; | |
3426 a1.field_0 = v64; | |
3427 a1.field_28 = v81; | |
3428 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
3429 { | |
3430 if ( v3->pODMFace->uPolygonType == 1 ) | |
3431 sr_sub_485BAE(&a1, &a2); | |
3432 else | |
3433 sr_sub_485AFF(&a1, &a2); | |
3434 } | |
3435 else | |
3436 { | |
3437 if ( v3->pODMFace->uPolygonType == 1 ) | |
3438 sr_sub_4D71F8(&a1); | |
3439 else | |
3440 sr_sub_4D714C(&a1); | |
3441 } | |
3442 return 1; | |
3443 } | |
3444 } | |
3445 } | |
3446 else | |
3447 { | |
3448 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v76, v79, v3, pOutdoorCamera->building_gamme, 1u, 1); | |
3449 v28 = v3->ptr_38; | |
3450 v85 = v10; | |
3451 v86 = v28->field_10; | |
3452 v85 = v10; | |
3453 v84 = v67 + ((unsigned __int64)(v86 * (signed __int64)v10) >> 16); | |
3454 v86 = v3->ptr_38->field_1C; | |
3455 v86 = v71 + ((unsigned __int64)(v86 * (signed __int64)v10) >> 16); | |
3456 v85 = (unsigned __int64)(v84 * (signed __int64)v79) >> 16; | |
3457 v29 = v3->ptr_38; | |
3458 v85 = v79; | |
3459 a1.field_30 = v68 + ((unsigned __int64)(v84 * (signed __int64)v79) >> 16) - v29->field_24; | |
3460 v85 = (unsigned __int64)(v86 * (signed __int64)v79) >> 16; | |
3461 v30 = ((unsigned __int64)(v86 * (signed __int64)v79) >> 16) - v3->ptr_38->field_28; | |
3462 a1.field_30 >>= v27; | |
3463 a1.field_2C = (v69 + v30) >> v27; | |
3464 a1.field_14 = dword_80AA20 >> v27; | |
3465 a1.field_18 = dword_80AA1C >> v27; | |
3466 a1.field_1C = dword_80AA18 >> v27; | |
3467 a1.field_20 = dword_80AA14 >> v27; | |
3468 v31 = v76->field_A; | |
3469 v32 = pRenderer->uTargetSurfacePitch * v76->field_A; | |
3470 v86 = v76->field_8; | |
3471 a1.pColorBuffer = &v77[v86 + v32]; | |
3472 a1.pDepthBuffer = (unsigned int *)&pRenderer->pActiveZBuffer[v86 + 640 * v31]; | |
3473 v80 = v10 - (pOutdoorCamera->int_fov_rad_inv << v74); | |
3474 if ( v78 > 0 ) | |
3475 { | |
3476 v86 = v78; | |
3477 do | |
3478 { | |
3479 v78 = v3->v_18.y; | |
3480 v85 = (unsigned __int64)(v78 * (signed __int64)v80) >> 16; | |
3481 v84 = v66 + ((unsigned __int64)(v78 * (signed __int64)v80) >> 16); | |
3482 if ( v66 + (unsigned int)((unsigned __int64)(v78 * (signed __int64)v80) >> 16) | |
3483 && (v33 = abs((signed __int64)v66 + ((__int64)(v78 * (signed __int64)v80) >> 16)), abs((signed __int64)X) < v33) ) | |
3484 { | |
3485 LODWORD(v34) = v72 << 16; | |
3486 HIDWORD(v34) = v72 >> 16; | |
3487 v85 = v34 / v84; | |
3488 v35 = v34 / v84; | |
3489 v84 = v34 / v84; | |
3490 } | |
3491 else | |
3492 { | |
3493 v84 = 1073741824; | |
3494 v35 = 1073741824; | |
3495 } | |
3496 HIWORD(v36) = HIWORD(v35); | |
3497 LOWORD(v36) = 0; | |
3498 a1.field_24 = v3->field_50 | v36; | |
3499 v78 = v3->ptr_38->field_10; | |
3500 v78 = v67 + ((unsigned __int64)(v78 * (signed __int64)v80) >> 16); | |
3501 v85 = (unsigned __int64)(v78 * (signed __int64)v35) >> 16; | |
3502 v37 = v3->ptr_38; | |
3503 v38 = ((unsigned __int64)(v78 * (signed __int64)v35) >> 16) - v37->field_24; | |
3504 v78 = v37->field_1C; | |
3505 v78 = v71 + ((unsigned __int64)(v78 * (signed __int64)v80) >> 16); | |
3506 v85 = (unsigned __int64)(v78 * (signed __int64)v35) >> 16; | |
3507 v39 = (((v69 + v85 - v3->ptr_38->field_28) >> v27) - a1.field_2C) >> v74; | |
3508 a1.field_4 = (((v68 + v38) >> v27) - a1.field_30) >> v74; | |
3509 a1.field_0 = v39; | |
3510 a1.field_28 = v83; | |
3511 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
3512 { | |
3513 if ( v3->pODMFace->uPolygonType == 1 ) | |
3514 sr_sub_485A24(&a1, (stru315 *)&a2); | |
3515 else | |
3516 sr_sub_485975(&a1, (stru315 *)&a2); | |
3517 } | |
3518 else | |
3519 { | |
3520 if ( v3->pODMFace->uPolygonType == 1 ) | |
3521 sr_sub_4D705A(v2); | |
3522 else | |
3523 sr_sub_4D6FB0(v2); | |
3524 } | |
3525 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F( | |
3526 &a2, | |
3527 v76, | |
3528 v84, | |
3529 v3, | |
3530 pOutdoorCamera->building_gamme, | |
3531 1u, | |
3532 0); | |
3533 v80 -= pOutdoorCamera->int_fov_rad_inv << v74; | |
3534 --v86; | |
3535 } | |
3536 while ( v86 ); | |
3537 } | |
3538 if ( !v81 ) | |
3539 return 1; | |
3540 v83 = v3->v_18.y; | |
3541 v76 = (Span *)((unsigned __int64)(v83 * (signed __int64)v80) >> 16); | |
3542 v84 = v66 + ((unsigned __int64)(v83 * (signed __int64)v80) >> 16); | |
3543 if ( v66 + (unsigned int)((unsigned __int64)(v83 * (signed __int64)v80) >> 16) ) | |
3544 { | |
3545 v40 = abs((signed __int64)v66 + ((__int64)(v83 * (signed __int64)v80) >> 16)); | |
3546 if ( abs(X) < v40 ) | |
3547 { | |
3548 LODWORD(v41) = v72 << 16; | |
3549 HIDWORD(v41) = v72 >> 16; | |
3550 X = v41 / v84; | |
3551 HIWORD(v42) = (unsigned int)(v41 / v84) >> 16; | |
3552 LOWORD(v42) = 0; | |
3553 a1.field_24 = v42 | v3->field_50; | |
3554 v83 = v3->ptr_38->field_10; | |
3555 v83 = v67 + ((unsigned __int64)(v83 * (signed __int64)v80) >> 16); | |
3556 X = (unsigned __int64)(v83 * v41 / v84) >> 16; | |
3557 v43 = v3->ptr_38; | |
3558 v44 = ((unsigned __int64)(v83 * v41 / v84) >> 16) - v43->field_24; | |
3559 v83 = v43->field_1C; | |
3560 v83 = v71 + ((unsigned __int64)(v83 * (signed __int64)v80) >> 16); | |
3561 X = (unsigned __int64)(v83 * v41 / v84) >> 16; | |
3562 v45 = (((signed int)(v69 + ((unsigned __int64)(v83 * v41 / v84) >> 16) - v3->ptr_38->field_28) >> v27) | |
3563 - a1.field_2C) >> v74; | |
3564 a1.field_4 = (((v68 + v44) >> v27) - a1.field_30) >> v74; | |
3565 a1.field_0 = v45; | |
3566 a1.field_28 = v81; | |
3567 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
3568 { | |
3569 if ( v3->pODMFace->uPolygonType == 1 ) | |
3570 sr_sub_485A24(&a1, (stru315 *)&a2); | |
3571 else | |
3572 sr_sub_485975(&a1, (stru315 *)&a2); | |
3573 } | |
3574 else | |
3575 { | |
3576 if ( v3->pODMFace->uPolygonType == 1 ) | |
3577 sr_sub_4D705A(v2); | |
3578 else | |
3579 sr_sub_4D6FB0(v2); | |
3580 } | |
3581 return 1; | |
3582 } | |
3583 } | |
3584 } | |
3585 } | |
3586 return 0; | |
3587 } | |
3588 | |
3589 //----- (00485AFF) -------------------------------------------------------- | |
3590 stru315 *__fastcall sr_sub_485AFF(stru315 *a1, stru316 *a2) | |
3591 { | |
3592 stru315 *result; // eax@1 | |
3593 int i; // ecx@1 | |
3594 int v4; // esi@2 | |
3595 int v5; // esi@2 | |
3596 int v6; // ecx@2 | |
3597 int v7; // esi@3 | |
3598 int v8; // edi@3 | |
3599 int v9; // ebx@3 | |
3600 int v10; // ecx@8 | |
3601 unsigned __int16 *v11; // esi@10 | |
3602 unsigned int *v12; // ecx@12 | |
3603 int v13; // esi@12 | |
3604 int v14; // [sp+0h] [bp-4h]@2 | |
3605 | |
3606 result = a1; | |
3607 for ( i = a1->field_28; i; i = result->field_28 ) | |
3608 { | |
3609 v4 = result->field_8 & result->field_2C; | |
3610 result->field_28 = i - 1; | |
3611 v5 = (result->field_C & HIWORD(result->field_30)) + (v4 >> result->field_10); | |
3612 v6 = *((char *)result->pTextureLOD + v5); | |
3613 v14 = *((char *)result->pTextureLOD + v5); | |
3614 if ( a2->field_20 ) | |
3615 { | |
3616 v7 = HIWORD(a2->field_14); | |
3617 v8 = a2->field_C; | |
3618 v9 = v7; | |
3619 if ( v7 >= v8 ) | |
3620 v9 = a2->field_C; | |
3621 if ( a2->field_8 - v9 <= 0 ) | |
3622 { | |
3623 v10 = 0; | |
3624 } | |
3625 else | |
3626 { | |
3627 if ( v7 >= v8 ) | |
3628 v7 = a2->field_C; | |
3629 v10 = a2->field_8 - v7; | |
3630 } | |
3631 v11 = a2->field_24_palette; | |
3632 v6 = v14 + (v10 << 8); | |
3633 } | |
3634 else | |
3635 { | |
3636 v11 = result->field_34_palette; | |
3637 } | |
3638 *result->pColorBuffer = v11[v6]; | |
3639 v12 = result->pDepthBuffer; | |
3640 v13 = result->field_24; | |
3641 --result->pColorBuffer; | |
3642 *v12 = v13; | |
3643 --result->pDepthBuffer; | |
3644 a2->field_14 -= a2->field_18; | |
3645 result->field_30 += result->field_4; | |
3646 result->field_2C += result->field_0; | |
3647 } | |
3648 --result->field_28; | |
3649 return result; | |
3650 } | |
3651 | |
3652 //----- (00481212) -------------------------------------------------------- | |
3653 void Render::DrawTerrainSW(int a1, int a2, int a3, int a4) | |
3654 { | |
3655 int v3; // esi@1 | |
3656 int v4; // ecx@1 | |
3657 int v5; // ST10_4@1 | |
3658 int v6; // edi@1 | |
3659 int v7; // ebx@2 | |
3660 int v8; // eax@2 | |
3661 int v9; // eax@3 | |
3662 RenderVertexSoft *v10; // edi@3 | |
3663 RenderVertexSoft *v11; // ebx@4 | |
3664 RenderVertexSoft *v12; // ecx@4 | |
3665 float v13; // eax@6 | |
3666 int v14; // eax@6 | |
3667 double v15; // st7@6 | |
3668 double v16; // st7@6 | |
3669 Polygon *v17; // ebx@12 | |
3670 unsigned __int16 v18; // ax@12 | |
3671 int v19; // eax@13 | |
3672 float v20; // ecx@13 | |
3673 stru220 *v21; // eax@13 | |
3674 int v22; // eax@13 | |
3675 signed int v23; // eax@13 | |
3676 Vec3_float_ *v24; // eax@15 | |
3677 double v25; // st7@18 | |
3678 double v26; // st5@24 | |
3679 double v27; // st5@24 | |
3680 double v28; // st5@24 | |
3681 double v29; // st5@24 | |
3682 Game *v30; // eax@25 | |
3683 RenderVertexSoft *v31; // edi@29 | |
3684 double v32; // st7@31 | |
3685 int v33; // esi@35 | |
3686 RenderVertexSoft *v34; // edx@36 | |
3687 RenderVertexSoft *v35; // ecx@36 | |
3688 signed int v36; // eax@39 | |
3689 signed int v37; // esi@40 | |
3690 Polygon *v38; // ebx@43 | |
3691 unsigned __int16 v39; // ax@43 | |
3692 int v40; // eax@44 | |
3693 float v41; // ecx@44 | |
3694 stru220 *v42; // eax@44 | |
3695 int v43; // eax@44 | |
3696 int v44; // eax@44 | |
3697 signed int v45; // eax@44 | |
3698 Vec3_float_ *v46; // eax@46 | |
3699 double v47; // st7@49 | |
3700 double v48; // st5@57 | |
3701 double v49; // st5@57 | |
3702 double v50; // st5@57 | |
3703 Game *v51; // eax@58 | |
3704 RenderVertexSoft *v52; // edi@62 | |
3705 double v53; // st7@63 | |
3706 int v54; // esi@66 | |
3707 signed int v55; // eax@69 | |
3708 signed int v56; // esi@71 | |
3709 unsigned __int16 v57; // ax@75 | |
3710 stru220 *v58; // eax@76 | |
3711 signed int v59; // eax@76 | |
3712 Vec3_float_ *v60; // eax@77 | |
3713 double v61; // st7@80 | |
3714 double v62; // st5@88 | |
3715 double v63; // st5@88 | |
3716 double v64; // st5@88 | |
3717 Game *v65; // eax@89 | |
3718 double v66; // st7@94 | |
3719 RenderVertexSoft *v67; // [sp-Ch] [bp-C4h]@36 | |
3720 Polygon *v68; // [sp-8h] [bp-C0h]@36 | |
3721 int v69; // [sp-4h] [bp-BCh]@36 | |
3722 float v70; // [sp+Ch] [bp-ACh]@88 | |
3723 double v71; // [sp+10h] [bp-A8h]@6 | |
3724 double v72; // [sp+18h] [bp-A0h]@82 | |
3725 double v73; // [sp+20h] [bp-98h]@6 | |
3726 double v74; // [sp+28h] [bp-90h]@51 | |
3727 double v75; // [sp+30h] [bp-88h]@6 | |
3728 double v76; // [sp+38h] [bp-80h]@20 | |
3729 double v77; // [sp+40h] [bp-78h]@6 | |
3730 float v78; // [sp+48h] [bp-70h]@57 | |
3731 float v79; // [sp+4Ch] [bp-6Ch]@6 | |
3732 float v80; // [sp+50h] [bp-68h]@6 | |
3733 int v81; // [sp+54h] [bp-64h]@1 | |
3734 int v82; // [sp+58h] [bp-60h]@6 | |
3735 int v83; // [sp+5Ch] [bp-5Ch]@82 | |
3736 int v84; // [sp+60h] [bp-58h]@20 | |
3737 int v85; // [sp+64h] [bp-54h]@1 | |
3738 int v86; // [sp+68h] [bp-50h]@1 | |
3739 int v87; // [sp+6Ch] [bp-4Ch]@51 | |
3740 float v88; // [sp+70h] [bp-48h]@51 | |
3741 int v89; // [sp+74h] [bp-44h]@6 | |
3742 int v90; // [sp+78h] [bp-40h]@1 | |
3743 float a3a; // [sp+7Ch] [bp-3Ch]@24 | |
3744 stru220 *v92; // [sp+80h] [bp-38h]@2 | |
3745 float v93; // [sp+84h] [bp-34h]@44 | |
3746 int v94; // [sp+88h] [bp-30h]@6 | |
3747 float v95; // [sp+8Ch] [bp-2Ch]@1 | |
3748 float v96; // [sp+90h] [bp-28h]@1 | |
3749 float v97; // [sp+94h] [bp-24h]@1 | |
3750 int X; // [sp+98h] [bp-20h]@1 | |
3751 float v99; // [sp+9Ch] [bp-1Ch]@6 | |
3752 int v100; // [sp+A0h] [bp-18h]@6 | |
3753 unsigned __int64 v101; // [sp+A4h] [bp-14h]@6 | |
3754 RenderVertexSoft *v102; // [sp+ACh] [bp-Ch]@6 | |
3755 RenderVertexSoft *v103; // [sp+B0h] [bp-8h]@6 | |
3756 RenderVertexSoft *v104; // [sp+B4h] [bp-4h]@3 | |
3757 float pNormalc; // [sp+C0h] [bp+8h]@6 | |
3758 float pNormald; // [sp+C0h] [bp+8h]@6 | |
3759 Vec3_float_ *pNormal; // [sp+C0h] [bp+8h]@17 | |
3760 Vec3_float_ *pNormala; // [sp+C0h] [bp+8h]@48 | |
3761 Vec3_float_ *pNormalb; // [sp+C0h] [bp+8h]@77 | |
3762 | |
3763 v3 = a1; | |
3764 //v4 = *(short *)(a3 + 4); | |
3765 //v5 = *(short *)(a3 + 6); | |
3766 v85 = a2; | |
3767 v86 = a3; //v4; | |
3768 X = abs(a4); //v5 | |
3769 v6 = 0; | |
3770 v90 = 0; | |
3771 v81 = v3 - 1; | |
3772 v95 = (double)pOutdoor->vSunlight.x / 65536.0; | |
3773 v96 = (double)pOutdoor->vSunlight.y / 65536.0; | |
3774 v97 = (double)pOutdoor->vSunlight.z / 65536.0; | |
3775 if ( v3 - 1 > 0 ) | |
3776 { | |
3777 while ( 1 ) | |
3778 { | |
3779 v7 = abs(X); | |
3780 v8 = abs(v86); | |
3781 --X; | |
3782 v92 = &stru_76E5C8[(v7 << 7) + v8]; | |
3783 if ( !v92->field_0 | |
3784 || ((v9 = v6, v10 = &pVerticesSR_806210[v6], v104 = v10, !v85) ? (v11 = &pVerticesSR_801A10[v9], | |
3785 v12 = &pVerticesSR_806210[v9 + 1]) : (v11 = &pVerticesSR_806210[v9 + 1], v12 = &pVerticesSR_801A10[v9]), | |
3786 ((v103 = &pVerticesSR_801A10[v9 + 1], | |
3787 v13 = v10->vWorldPosition.x, | |
3788 v102 = v12, | |
3789 v80 = v13, | |
3790 v73 = v13 + 6.7553994e15, | |
3791 v101 = __PAIR__((unsigned int)v11, LODWORD(v73)), | |
3792 v79 = v10->vWorldPosition.y, | |
3793 v75 = v79 + 6.7553994e15, | |
3794 v100 = LODWORD(v75), | |
3795 pNormalc = (v12->vWorldPosition.x + v10->vWorldPosition.x) * 0.5, | |
3796 v71 = pNormalc + 6.7553994e15, | |
3797 v89 = LODWORD(v71), | |
3798 v14 = WorldPosToGridCellX(COERCE_UNSIGNED_INT64(pNormalc + 6.7553994e15)), | |
3799 v15 = v11->vWorldPosition.y + v10->vWorldPosition.y, | |
3800 v94 = v14, | |
3801 pNormald = v15 * 0.5, | |
3802 v16 = pNormald + 6.7553994e15, | |
3803 v77 = v16, | |
3804 v82 = LODWORD(v77), | |
3805 LODWORD(v99) = WorldPosToGridCellZ(LODWORD(v16)), | |
3806 WorldPosToGridCellX(v101), | |
3807 WorldPosToGridCellZ(v100), | |
3808 !byte_4D864C) | |
3809 || !(pGame->uFlags & 0x80)) | |
3810 && !sub_481EFA(v10, v11, v102, v103, 1)) ) | |
3811 goto LABEL_105; | |
3812 if ( v10->vWorldPosition.z != v11->vWorldPosition.z | |
3813 || v11->vWorldPosition.z != v103->vWorldPosition.z | |
3814 || v103->vWorldPosition.z != v102->vWorldPosition.z ) | |
3815 break; | |
3816 v17 = &array_77EC08[pOutdoorCamera->uNumPolygons]; | |
3817 v18 = pOutdoor->GetTileTexture(v101, v100); | |
3818 v17->uTileBitmapID = v18; | |
3819 if ( v18 != -1 ) | |
3820 { | |
3821 v19 = pOutdoor->GetSomeOtherTileInfo(v101, v100); | |
3822 LOWORD(v19) = v19 | 0x8010; | |
3823 v20 = v99; | |
3824 *(int *)&v17->flags = v19; | |
3825 v21 = v92; | |
3826 v17->field_59 = 1; | |
3827 v17->terrain_grid_x = LOBYTE(v20); | |
3828 v17->field_34 = v21->distance; | |
3829 v22 = v94; | |
3830 v17->terrain_grid_z = v94; | |
3831 v23 = pTerrainNormalIndices[2 * (LODWORD(v20) + (v22 << 7)) + 1]; | |
3832 if ( v23 < 0 || v23 > (signed int)(uNumTerrainNormals - 1) ) | |
3833 v24 = 0; | |
3834 else | |
3835 v24 = &pTerrainNormals[v23]; | |
3836 pNormal = v24; | |
3837 if ( v24 ) | |
3838 { | |
3839 v25 = -(v97 * v24->z + v96 * v24->y + v95 * v24->x); | |
3840 if ( v25 < 0.0 ) | |
3841 v25 = 0.0; | |
3842 v99 = v25 * 31.0; | |
3843 v76 = v99 + 6.7553994e15; | |
3844 v84 = LODWORD(v76); | |
3845 v17->dimming_level = 31 - LOBYTE(v76); | |
3846 } | |
3847 else | |
3848 { | |
3849 v17->dimming_level = 0; | |
3850 } | |
3851 if ( pOutdoorCamera->uNumPolygons >= 1999 ) | |
3852 return; | |
3853 ++pOutdoorCamera->uNumPolygons; | |
3854 if ( !sub_481FC9(v10, (RenderVertexSoft *)HIDWORD(v101), v102, v17) ) | |
3855 goto LABEL_104; | |
3856 v26 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001); | |
3857 memcpy(array_50AC10, v104, 0x30u); | |
3858 array_50AC10[0]._rhw = v26; | |
3859 array_50AC10[0].u = 0.0; | |
3860 array_50AC10[0].v = 0.0; | |
3861 v27 = *(float *)(HIDWORD(v101) + 12) + 0.0000001; | |
3862 memcpy(&array_50AC10[1], (void *)HIDWORD(v101), sizeof(array_50AC10[1])); | |
3863 array_50AC10[1]._rhw = 1.0 / v27; | |
3864 array_50AC10[1].u = 0.0; | |
3865 array_50AC10[1].v = 1.0; | |
3866 v28 = v103->vWorldViewPosition.x + 0.0000001; | |
3867 memcpy(&array_50AC10[2], v103, sizeof(array_50AC10[2])); | |
3868 array_50AC10[2]._rhw = 1.0 / v28; | |
3869 array_50AC10[2].u = 1.0; | |
3870 array_50AC10[2].v = 1.0; | |
3871 v29 = v102->vWorldViewPosition.x + 0.0000001; | |
3872 memcpy(&array_50AC10[3], v102, sizeof(array_50AC10[3])); | |
3873 array_50AC10[3]._rhw = 1.0 / v29; | |
3874 array_50AC10[3].u = 1.0; | |
3875 array_50AC10[3].v = 0.0; | |
3876 pGame->pLightmapBuilder->StackLights_TerrainFace(pNormal, &a3a, array_50AC10, 4u, 1); | |
3877 if ( stru_F8AD28.uNumLightsApplied <= 0 ) | |
3878 { | |
3879 v17->field_108 = 0; | |
3880 } | |
3881 else | |
3882 { | |
3883 v30 = pGame; | |
3884 v17->field_108 = 1; | |
3885 pGame->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10, 4, pNormal); | |
3886 } | |
3887 if ( v104->vWorldViewPosition.x < 8.0 | |
3888 || *(float *)(HIDWORD(v101) + 12) < 8.0 | |
3889 || (v31 = v102, v102->vWorldViewPosition.x < 8.0) | |
3890 || v103->vWorldViewPosition.x < 8.0 ) | |
3891 { | |
3892 v36 = sr_4250FE(4u); | |
3893 } | |
3894 else | |
3895 { | |
3896 v32 = (double)pOutdoorCamera->shading_dist_mist; | |
3897 if ( v32 >= v104->vWorldViewPosition.x | |
3898 && v32 >= *(float *)(HIDWORD(v101) + 12) | |
3899 && v32 >= v102->vWorldViewPosition.x | |
3900 && v32 >= v103->vWorldViewPosition.x ) | |
3901 { | |
3902 v33 = sr_4254D2(4); | |
3903 v17->uNumVertices = v33; | |
3904 if ( !v33 ) | |
3905 goto LABEL_104; | |
3906 v34 = (RenderVertexSoft *)HIDWORD(v101); | |
3907 v35 = v104; | |
3908 v69 = 0; | |
3909 v68 = v17; | |
3910 v67 = v31; | |
3911 goto LABEL_37; | |
3912 } | |
3913 v36 = sr_4252E8(4u); | |
3914 } | |
3915 v37 = v36; | |
3916 if ( !v36 ) | |
3917 goto LABEL_104; | |
3918 LABEL_41: | |
3919 OutdoorCamera::Project(v37); | |
3920 LABEL_102: | |
3921 v33 = sr_4254D2(v37); | |
3922 v17->uNumVertices = v33; | |
3923 if ( !v33 ) | |
3924 goto LABEL_104; | |
3925 v17->_48276F_sr(); | |
3926 goto LABEL_38; | |
3927 } | |
3928 LABEL_105: | |
3929 v6 = v90++ + 1; | |
3930 if ( v90 >= v81 ) | |
3931 return; | |
3932 } | |
3933 v38 = &array_77EC08[pOutdoorCamera->uNumPolygons]; | |
3934 v39 = pOutdoor->GetTileTexture(v101, v100); | |
3935 v38->uTileBitmapID = v39; | |
3936 if ( v39 == -1 ) | |
3937 goto LABEL_105; | |
3938 v40 = pOutdoor->GetSomeOtherTileInfo(v101, v100); | |
3939 BYTE1(v40) |= 0x80u; | |
3940 v41 = v99; | |
3941 *(int *)&v38->flags = v40; | |
3942 v42 = v92; | |
3943 v38->field_59 = 1; | |
3944 v38->terrain_grid_x = LOBYTE(v41); | |
3945 v38->field_34 = v42->distance; | |
3946 v43 = v94; | |
3947 v38->terrain_grid_z = v94; | |
3948 v44 = 2 * (LODWORD(v41) + (v43 << 7)); | |
3949 LODWORD(v93) = v44 * 2; | |
3950 v45 = pTerrainNormalIndices[v44 + 1]; | |
3951 if ( v45 < 0 || v45 > (signed int)(uNumTerrainNormals - 1) ) | |
3952 v46 = 0; | |
3953 else | |
3954 v46 = &pTerrainNormals[v45]; | |
3955 pNormala = v46; | |
3956 if ( v46 ) | |
3957 { | |
3958 v47 = -(v97 * v46->z + v96 * v46->y + v95 * v46->x); | |
3959 if ( v47 < 0.0 ) | |
3960 v47 = 0.0; | |
3961 v88 = v47 * 31.0; | |
3962 v74 = v88 + 6.7553994e15; | |
3963 v87 = LODWORD(v74); | |
3964 v38->dimming_level = 31 - LOBYTE(v74); | |
3965 } | |
3966 else | |
3967 { | |
3968 v38->dimming_level = 0; | |
3969 } | |
3970 if ( v38->dimming_level < 0 ) | |
3971 v38->dimming_level = 0; | |
3972 if ( pOutdoorCamera->uNumPolygons >= 1999 ) | |
3973 return; | |
3974 ++pOutdoorCamera->uNumPolygons; | |
3975 if ( !sub_481FC9((RenderVertexSoft *)HIDWORD(v101), v103, v104, v38) ) | |
3976 goto LABEL_74; | |
3977 v48 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001); | |
3978 memcpy(array_50AC10, v104, 0x30u); | |
3979 array_50AC10[0]._rhw = v48; | |
3980 array_50AC10[0].u = 0.0; | |
3981 array_50AC10[0].v = 0.0; | |
3982 v49 = *(float *)(HIDWORD(v101) + 12) + 0.0000001; | |
3983 memcpy(&array_50AC10[1], (void *)HIDWORD(v101), sizeof(array_50AC10[1])); | |
3984 array_50AC10[1]._rhw = 1.0 / v49; | |
3985 array_50AC10[1].u = 0.0; | |
3986 array_50AC10[1].v = 1.0; | |
3987 v50 = v103->vWorldViewPosition.x + 0.0000001; | |
3988 memcpy(&array_50AC10[2], v103, sizeof(array_50AC10[2])); | |
3989 array_50AC10[2]._rhw = 1.0 / v50; | |
3990 array_50AC10[2].u = 1.0; | |
3991 array_50AC10[2].v = 1.0; | |
3992 pGame->pLightmapBuilder->StackLights_TerrainFace(pNormala, &v78, array_50AC10, 3u, 0); | |
3993 if ( stru_F8AD28.uNumLightsApplied <= 0 ) | |
3994 { | |
3995 v38->field_108 = 0; | |
3996 } | |
3997 else | |
3998 { | |
3999 v51 = pGame; | |
4000 v38->field_108 = 1; | |
4001 pGame->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10, 3, pNormala); | |
4002 } | |
4003 if ( v104->vWorldViewPosition.x < 8.0 | |
4004 || *(float *)(HIDWORD(v101) + 12) < 8.0 | |
4005 || (v52 = v103, v103->vWorldViewPosition.x < 8.0) ) | |
4006 { | |
4007 v55 = sr_4250FE(3u); | |
4008 } | |
4009 else | |
4010 { | |
4011 v53 = (double)pOutdoorCamera->shading_dist_mist; | |
4012 if ( v53 >= v104->vWorldViewPosition.x | |
4013 && v53 >= *(float *)(HIDWORD(v101) + 12) | |
4014 && v53 >= v103->vWorldViewPosition.x ) | |
4015 { | |
4016 v54 = sr_4254D2(3); | |
4017 v38->uNumVertices = v54; | |
4018 if ( v54 ) | |
4019 { | |
4020 sr_sub_4829B9((RenderVertexSoft *)HIDWORD(v101), v52, v104, v38, 0); | |
4021 LABEL_68: | |
4022 sr_sub_481DB2(array_508690, v54, v38); | |
4023 LABEL_75: | |
4024 v17 = &array_77EC08[pOutdoorCamera->uNumPolygons]; | |
4025 v57 = pOutdoor->GetTileTexture(v101, v100); | |
4026 v17->uTileBitmapID = v57; | |
4027 if ( v57 == -1 ) | |
4028 goto LABEL_105; | |
4029 *(int *)&v17->flags = pOutdoor->GetSomeOtherTileInfo(v101, v100); | |
4030 v58 = v92; | |
4031 v17->field_59 = 1; | |
4032 v17->field_34 = v58->distance; | |
4033 v17->terrain_grid_z = v94; | |
4034 v17->terrain_grid_x = LOBYTE(v99); | |
4035 v59 = *(unsigned __int16 *)((char *)pTerrainNormalIndices.data() + LODWORD(v93)); | |
4036 if ( v59 > (signed int)(uNumTerrainNormals - 1) ) | |
4037 { | |
4038 pNormalb = 0; | |
4039 v60 = 0; | |
4040 } | |
4041 else | |
4042 { | |
4043 v60 = &pTerrainNormals[v59]; | |
4044 pNormalb = v60; | |
4045 } | |
4046 if ( v60 ) | |
4047 { | |
4048 v61 = -(v97 * v60->z + v96 * v60->y + v95 * v60->x); | |
4049 if ( v61 < 0.0 ) | |
4050 v61 = 0.0; | |
4051 v93 = v61 * 31.0; | |
4052 v72 = v93 + 6.7553994e15; | |
4053 v83 = LODWORD(v72); | |
4054 v17->dimming_level = 31 - LOBYTE(v72); | |
4055 } | |
4056 else | |
4057 { | |
4058 v17->dimming_level = 0; | |
4059 } | |
4060 if ( v17->dimming_level < 0 ) | |
4061 v17->dimming_level = 0; | |
4062 if ( pOutdoorCamera->uNumPolygons >= 1999 ) | |
4063 return; | |
4064 ++pOutdoorCamera->uNumPolygons; | |
4065 if ( !sub_481FC9(v102, v104, v103, v17) ) | |
4066 { | |
4067 LABEL_104: | |
4068 --pOutdoorCamera->uNumPolygons; | |
4069 goto LABEL_105; | |
4070 } | |
4071 v62 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001); | |
4072 memcpy(array_50AC10, v104, 0x30u); | |
4073 array_50AC10[0]._rhw = v62; | |
4074 array_50AC10[0].u = 0.0; | |
4075 array_50AC10[0].v = 0.0; | |
4076 v63 = v103->vWorldViewPosition.x + 0.0000001; | |
4077 memcpy(&array_50AC10[1], v103, sizeof(array_50AC10[1])); | |
4078 array_50AC10[1]._rhw = 1.0 / v63; | |
4079 array_50AC10[1].u = 1.0; | |
4080 array_50AC10[1].v = 1.0; | |
4081 v64 = v102->vWorldViewPosition.x + 0.0000001; | |
4082 memcpy(&array_50AC10[2], v102, sizeof(array_50AC10[2])); | |
4083 array_50AC10[2]._rhw = 1.0 / v64; | |
4084 array_50AC10[2].u = 1.0; | |
4085 array_50AC10[2].v = 0.0; | |
4086 pGame->pLightmapBuilder->StackLights_TerrainFace(pNormalb, &v70, array_50AC10, 3u, 1); | |
4087 if ( stru_F8AD28.uNumLightsApplied <= 0 ) | |
4088 { | |
4089 v17->field_108 = 0; | |
4090 } | |
4091 else | |
4092 { | |
4093 v65 = pGame; | |
4094 v17->field_108 = 1; | |
4095 pGame->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10, 3, pNormalb); | |
4096 } | |
4097 if ( v104->vWorldViewPosition.x < 8.0 || v103->vWorldViewPosition.x < 8.0 || v102->vWorldViewPosition.x < 8.0 ) | |
4098 { | |
4099 v37 = sr_4250FE(3u); | |
4100 OutdoorCamera::Project(v37); | |
4101 if ( !v37 ) | |
4102 goto LABEL_104; | |
4103 goto LABEL_102; | |
4104 } | |
4105 v66 = (double)pOutdoorCamera->shading_dist_mist; | |
4106 if ( v66 < v104->vWorldViewPosition.x || v66 < v103->vWorldViewPosition.x || v66 < v102->vWorldViewPosition.x ) | |
4107 { | |
4108 v37 = sr_4252E8(3u); | |
4109 if ( !v37 ) | |
4110 goto LABEL_105; | |
4111 goto LABEL_41; | |
4112 } | |
4113 v33 = sr_4254D2(3); | |
4114 v17->uNumVertices = v33; | |
4115 if ( !v33 ) | |
4116 goto LABEL_104; | |
4117 v34 = v104; | |
4118 v35 = v102; | |
4119 v69 = 0; | |
4120 v68 = v17; | |
4121 v67 = v103; | |
4122 LABEL_37: | |
4123 sr_sub_4829B9(v35, v34, v67, v68, v69); | |
4124 LABEL_38: | |
4125 sr_sub_481DB2(array_508690, v33, v17); | |
4126 goto LABEL_105; | |
4127 } | |
4128 goto LABEL_74; | |
4129 } | |
4130 v55 = sr_4252E8(3u); | |
4131 } | |
4132 v56 = v55; | |
4133 if ( v55 ) | |
4134 { | |
4135 OutdoorCamera::Project(v55); | |
4136 v54 = sr_4254D2(v56); | |
4137 v38->uNumVertices = v54; | |
4138 if ( v54 ) | |
4139 { | |
4140 v38->_48276F_sr(); | |
4141 goto LABEL_68; | |
4142 } | |
4143 } | |
4144 LABEL_74: | |
4145 --pOutdoorCamera->uNumPolygons; | |
4146 goto LABEL_75; | |
4147 } | |
4148 } | |
4149 | |
4150 //----- (00438250) -------------------------------------------------------- | |
4151 void IndoorCameraD3D::sr_Reset_list_0037C() | |
4152 { | |
4153 this->list_0037C_size = 0; | |
4154 } | |
4155 | |
4156 //----- (00438240) -------------------------------------------------------- | |
4157 void IndoorCameraD3D::sr_438240_draw_lits() | |
4158 { | |
4159 IndoorCameraD3D *v1; // ebp@1 | |
4160 int v2; // edi@2 | |
4161 int v3; // ebx@3 | |
4162 int v4; // esi@4 | |
4163 double v5; // st7@6 | |
4164 float v6; // ST00_4@8 | |
4165 IndoorCameraD3D *v7; // esi@1 | |
4166 float v8; // [sp+4h] [bp-28h]@6 | |
4167 float v9; // [sp+8h] [bp-24h]@6 | |
4168 unsigned int v10; // [sp+Ch] [bp-20h]@6 | |
4169 char v11; // [sp+10h] [bp-1Ch]@6 | |
4170 float v12; // [sp+14h] [bp-18h]@6 | |
4171 int v13; // [sp+28h] [bp-4h]@1 | |
4172 | |
4173 v7 = this; | |
4174 sr_438141_draw_list_0037C(); | |
4175 v13 = 0; | |
4176 v1 = v7; | |
4177 if ( v7->list_E0380_size > 0 ) | |
4178 { | |
4179 v2 = (int)&v7->list_E0380[0].field_C04; | |
4180 do | |
4181 { | |
4182 v3 = 0; | |
4183 if ( *(int *)v2 > 0 ) | |
4184 { | |
4185 v4 = v2 - 3048; | |
4186 do | |
4187 { | |
4188 if ( *(char *)(v2 - 3076) & 1 ) | |
4189 { | |
4190 LODWORD(v12) = 1; | |
4191 v11 = 1; | |
4192 v10 = *(int *)(v2 + 4); | |
4193 v9 = 0.0; | |
4194 v8 = *(float *)(v4 + 4); | |
4195 v5 = *(float *)v4; | |
4196 } | |
4197 else | |
4198 { | |
4199 LODWORD(v12) = 0; | |
4200 v11 = 1; | |
4201 v10 = *(int *)(v2 + 4); | |
4202 v9 = *(float *)(v4 - 16); | |
4203 v8 = *(float *)(v4 - 20); | |
4204 v5 = *(float *)(v4 - 24); | |
4205 } | |
4206 v6 = v5; | |
4207 sr_437D4A_draw_some_vertices(v6, v8, v9, v10, v11, v12); | |
4208 ++v3; | |
4209 v4 += 48; | |
4210 } | |
4211 while ( v3 < *(int *)v2 ); | |
4212 } | |
4213 ++v13; | |
4214 v2 += 3088; | |
4215 } | |
4216 while ( v13 < v1->list_E0380_size ); | |
4217 } | |
4218 } | |
4219 | |
4220 //----- (00437D4A) -------------------------------------------------------- | |
4221 void IndoorCameraD3D::sr_437D4A_draw_some_vertices(float x, float y, float z, unsigned int a5, char a6, float a7) | |
4222 { | |
4223 IndoorCameraD3D *v7; // edx@1 | |
4224 char *v8; // eax@1 | |
4225 signed int v9; // ecx@1 | |
4226 signed int v10; // edx@10 | |
4227 char *v11; // ecx@10 | |
4228 signed int uNumD3DVertices; // edi@16 | |
4229 char *v13; // ecx@24 | |
4230 unsigned int v14; // edx@25 | |
4231 unsigned int v15; // eax@25 | |
4232 int v16; // ebx@25 | |
4233 int v17; // eax@26 | |
4234 int v18; // edx@26 | |
4235 IDirect3DDevice3 *v19; // ST24_4@27 | |
4236 HRESULT v20; // eax@27 | |
4237 RenderVertexSoft vert[20]; // [sp+0h] [bp-680h]@1 | |
4238 RenderVertexD3D3 pD3DVertices[5]; // [sp+3C0h] [bp-2C0h]@15 | |
4239 RenderVertexSoft a1; // [sp+640h] [bp-40h]@1 | |
4240 //double v24; // [sp+670h] [bp-10h]@25 | |
4241 //double v25; // [sp+678h] [bp-8h]@1 | |
4242 | |
4243 v7 = this; | |
4244 a1.flt_2C = 0.0; | |
4245 //HIDWORD(v25) = (int)this; | |
4246 v8 = (char *)&vert[0].flt_2C; | |
4247 v9 = 20; | |
4248 do | |
4249 { | |
4250 *(float *)v8 = 0.0; | |
4251 v8 += 48; | |
4252 --v9; | |
4253 } | |
4254 while ( v9 ); | |
4255 if ( LOBYTE(a7) ) | |
4256 { | |
4257 vert[0].vWorldViewProjX = x; | |
4258 vert[0].vWorldViewProjY = y; | |
4259 goto LABEL_15; | |
4260 } | |
4261 a1.vWorldPosition.x = x; | |
4262 a1.vWorldPosition.y = y; | |
4263 a1.vWorldPosition.z = z; | |
4264 if ( pRenderer->pRenderD3D ) | |
4265 { | |
4266 LODWORD(a7) = 1; | |
4267 if ( v7->CalcPortalShape( | |
4268 &a1, | |
4269 (unsigned int *)&a7, | |
4270 vert, | |
4271 v7->std__vector_000034_prolly_frustrum, | |
4272 4, | |
4273 1, | |
4274 0) == 1 | |
4275 && SLODWORD(a7) < 1 ) | |
4276 return; | |
4277 } | |
4278 else | |
4279 { | |
4280 vert[0].vWorldPosition.x = x; | |
4281 vert[0].vWorldPosition.y = y; | |
4282 vert[0].vWorldPosition.z = z; | |
4283 } | |
4284 ViewTransform(vert, 1u); | |
4285 v10 = 0; | |
4286 v11 = (char *)&vert[0].vWorldViewPosition; | |
4287 do | |
4288 { | |
4289 if ( *(float *)v11 >= 8.0 ) | |
4290 break; | |
4291 ++v10; | |
4292 v11 += 48; | |
4293 } | |
4294 while ( v10 < 1 ); | |
4295 if ( v10 < 1 ) | |
4296 { | |
4297 Project(vert, 1u, 0); | |
4298 LABEL_15: | |
4299 pD3DVertices[0].pos.x = vert[0].vWorldViewProjX; | |
4300 pD3DVertices[0].pos.y = vert[0].vWorldViewProjY; | |
4301 pD3DVertices[0].specular = 0; | |
4302 pD3DVertices[0].diffuse = a5; | |
4303 if ( a6 ) | |
4304 { | |
4305 pD3DVertices[0].pos.z = 0.000099999997; | |
4306 pD3DVertices[1].pos.x = vert[0].vWorldViewProjX; | |
4307 pD3DVertices[2].pos.x = vert[0].vWorldViewProjX; | |
4308 pD3DVertices[0].rhw = 0.001; | |
4309 uNumD3DVertices = 5; | |
4310 pD3DVertices[0].texcoord.x = 0.0; | |
4311 pD3DVertices[1].diffuse = a5; | |
4312 pD3DVertices[1].specular = 0; | |
4313 pD3DVertices[0].texcoord.y = 0.0; | |
4314 pD3DVertices[2].diffuse = a5; | |
4315 pD3DVertices[2].specular = 0; | |
4316 pD3DVertices[3].pos.y = vert[0].vWorldViewProjY; | |
4317 pD3DVertices[3].diffuse = a5; | |
4318 pD3DVertices[3].specular = 0; | |
4319 pD3DVertices[4].pos.y = vert[0].vWorldViewProjY; | |
4320 pD3DVertices[1].pos.y = vert[0].vWorldViewProjY - 1.0; | |
4321 pD3DVertices[4].diffuse = a5; | |
4322 pD3DVertices[4].specular = 0; | |
4323 pD3DVertices[1].pos.z = 0.000099999997; | |
4324 pD3DVertices[1].rhw = 0.001; | |
4325 pD3DVertices[1].texcoord.x = 0.0; | |
4326 pD3DVertices[1].texcoord.y = 0.0; | |
4327 pD3DVertices[2].pos.y = vert[0].vWorldViewProjY + 1.0; | |
4328 pD3DVertices[2].pos.z = 0.000099999997; | |
4329 pD3DVertices[2].rhw = 0.001; | |
4330 pD3DVertices[2].texcoord.x = 0.0; | |
4331 pD3DVertices[2].texcoord.y = 0.0; | |
4332 pD3DVertices[3].pos.x = vert[0].vWorldViewProjX - 1.0; | |
4333 pD3DVertices[3].pos.z = 0.000099999997; | |
4334 pD3DVertices[3].rhw = 0.001; | |
4335 pD3DVertices[3].texcoord.x = 0.0; | |
4336 pD3DVertices[3].texcoord.y = 0.0; | |
4337 pD3DVertices[4].pos.x = vert[0].vWorldViewProjX + 1.0; | |
4338 pD3DVertices[4].pos.z = 0.000099999997; | |
4339 pD3DVertices[4].rhw = 0.001; | |
4340 pD3DVertices[4].texcoord.x = 0.0; | |
4341 pD3DVertices[4].texcoord.y = 0.0; | |
4342 } | |
4343 else | |
4344 { | |
4345 uNumD3DVertices = 1; | |
4346 __debugbreak(); // make things right | |
4347 *(unsigned int *)(&pD3DVertices[0].pos.z) = 0x38D1B717u; | |
4348 pD3DVertices[0].texcoord.x = 0.0; | |
4349 *(unsigned int *)(&pD3DVertices[0].rhw) = 0x3A83126Fu; | |
4350 pD3DVertices[0].texcoord.y = 0.0; | |
4351 } | |
4352 if ( pRenderer->pRenderD3D ) | |
4353 { | |
4354 __debugbreak(); // decompilation bug | |
4355 //v19 = pRenderer->pRenderD3D->pDevice; | |
4356 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, nullptr)); | |
4357 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_POINTLIST, | |
4358 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
4359 pD3DVertices, | |
4360 uNumD3DVertices, | |
4361 16)); | |
4362 } | |
4363 else | |
4364 { | |
4365 if ( (double)(signed int)pViewport->uViewportTL_X <= vert[0].vWorldViewProjX - 1.0 | |
4366 && (double)(signed int)pViewport->uViewportBR_X > vert[0].vWorldViewProjX + 2.0 | |
4367 && (double)(signed int)pViewport->uViewportTL_Y <= vert[0].vWorldViewProjY - 1.0 | |
4368 && (double)(signed int)pViewport->uViewportBR_Y > vert[0].vWorldViewProjY + 2.0 | |
4369 && uNumD3DVertices > 0 ) | |
4370 { | |
4371 v13 = (char *)&pD3DVertices[0].diffuse; | |
4372 do | |
4373 { | |
4374 LODWORD(a7) = *((int *)v13 - 3); | |
4375 //v25 = a7 + 6.7553994e15; | |
4376 auto _v25 = floorf(a7 + 0.5f); | |
4377 | |
4378 //v24 = *((float *)v13 - 4) + 6.7553994e15; | |
4379 auto _v24 = floorf(*((float *)v13 - 4) + 0.5f); | |
4380 | |
4381 v14 = *(int *)v13; | |
4382 v15 = *(int *)v13; | |
4383 v16 = (*(int *)v13 >> 3) & 0x1F; | |
4384 if ( pRenderer->uTargetGBits == 5 ) | |
4385 { | |
4386 v17 = (v15 >> 6) & 0x3E0; | |
4387 v18 = (v14 >> 9) & 0x7C00; | |
4388 } | |
4389 else | |
4390 { | |
4391 v17 = (v15 >> 5) & 0x7E0; | |
4392 v18 = (v14 >> 8) & 0xF800; | |
4393 } | |
4394 v13 += 32; | |
4395 --uNumD3DVertices; | |
4396 pRenderer->pTargetSurface[(uint)_v24 + pRenderer->uTargetSurfacePitch * (uint)_v25] = v18 | v16 | (unsigned __int16)v17; | |
4397 } | |
4398 while ( uNumD3DVertices ); | |
4399 } | |
4400 } | |
4401 } | |
4402 } | |
4403 | |
4404 //----- (0047BEB1) -------------------------------------------------------- | |
4405 int __fastcall sr_sub_47BEB1(signed int a1, Polygon *a2, int terrain_gamma, int a4, int *a5, int *a6, int a7, int a8) | |
4406 { | |
4407 Polygon *v8; // ebx@1 | |
4408 signed int v9; // edx@1 | |
4409 int v10; // eax@5 | |
4410 signed int v11; // eax@9 | |
4411 signed int v12; // eax@15 | |
4412 signed __int64 v13; // qtt@21 | |
4413 int *v14; // ecx@30 | |
4414 int *v15; // edi@30 | |
4415 int v16; // ebx@32 | |
4416 signed __int64 v17; // qtt@37 | |
4417 double v18; // ST10_8@37 | |
4418 double v19; // ST10_8@38 | |
4419 int v20; // edi@39 | |
4420 int result; // eax@46 | |
4421 int *v22; // eax@48 | |
4422 signed int v23; // edx@51 | |
4423 signed __int64 v24; // qtt@51 | |
4424 int v25; // ecx@51 | |
4425 signed int v26; // [sp+14h] [bp-4h]@1 | |
4426 float v27; // [sp+28h] [bp+10h]@37 | |
4427 float v28; // [sp+28h] [bp+10h]@38 | |
4428 int v29; // [sp+2Ch] [bp+14h]@37 | |
4429 | |
4430 v8 = a2; | |
4431 v9 = a1; | |
4432 v26 = a1; | |
4433 if ( pParty->armageddon_timer ) | |
4434 { | |
4435 *a5 = -1; | |
4436 *a6 = -1; | |
4437 *(char *)a7 = 1; | |
4438 LABEL_46: | |
4439 result = a8; | |
4440 *(char *)a8 = 0; | |
4441 return result; | |
4442 } | |
4443 if ( a1 < 0 ) | |
4444 { | |
4445 v26 = v8->field_34 << 16; | |
4446 v9 = v8->field_34 << 16; | |
4447 } | |
4448 v10 = pWeather->bNight; | |
4449 if ( bUnderwater == 1 ) | |
4450 v10 = 0; | |
4451 if ( !v10 ) | |
4452 { | |
4453 if ( !(day_attrib & DAY_ATTRIB_FOG) && !bUnderwater ) | |
4454 { | |
4455 v14 = a5; | |
4456 v15 = a6; | |
4457 if ( !v9 ) | |
4458 { | |
4459 *a5 = 31; | |
4460 *a6 = -1; | |
4461 } | |
4462 v16 = v8->dimming_level - terrain_gamma; | |
4463 if ( v16 >= 0 ) | |
4464 { | |
4465 if ( v16 > 27 ) | |
4466 v16 = 27; | |
4467 } | |
4468 else | |
4469 { | |
4470 v16 = 0; | |
4471 } | |
4472 *a6 = 27; | |
4473 if ( a4 ) | |
4474 { | |
4475 v28 = pOutdoor->fFogDensity * 27.0; | |
4476 v19 = v28 + 6.7553994e15; | |
4477 v29 = LODWORD(v19); | |
4478 } | |
4479 else | |
4480 { | |
4481 LODWORD(v17) = v9 << 16; | |
4482 HIDWORD(v17) = v9 >> 16; | |
4483 v27 = (double)(signed int)(((unsigned __int64)(v17 / (pOutdoorCamera->shading_dist_shade << 16) * (31 - *a6)) >> 16) | |
4484 + *a6) | |
4485 * pOutdoor->fFogDensity; | |
4486 v18 = v27 + 6.7553994e15; | |
4487 v29 = LODWORD(v18); | |
4488 } | |
4489 *v14 = v16 + v29; | |
4490 v20 = *v15; | |
4491 if ( v16 + v29 > v20 ) | |
4492 *v14 = v20; | |
4493 if ( *v14 < v16 ) | |
4494 *v14 = v16; | |
4495 if ( *v14 > pOutdoor->max_terrain_dimming_level ) | |
4496 *v14 = pOutdoor->max_terrain_dimming_level; | |
4497 goto LABEL_45; | |
4498 } | |
4499 if ( v9 >= day_fogrange_1 << 16 ) | |
4500 { | |
4501 if ( v9 <= day_fogrange_2 << 16 ) | |
4502 { | |
4503 v23 = v9 - (day_fogrange_1 << 16); | |
4504 LODWORD(v24) = v23 << 16; | |
4505 HIDWORD(v24) = v23 >> 16; | |
4506 v25 = (unsigned __int64)(27 * v24 / ((day_fogrange_2 - day_fogrange_1) << 16)) >> 16; | |
4507 v22 = a5; | |
4508 *a5 = v25; | |
4509 if ( v25 > 27 ) | |
4510 goto LABEL_54; | |
4511 v9 = v26; | |
4512 } | |
4513 else | |
4514 { | |
4515 v22 = a5; | |
4516 *a5 = 27; | |
4517 } | |
4518 } | |
4519 else | |
4520 { | |
4521 v22 = a5; | |
4522 *a5 = 0; | |
4523 } | |
4524 if ( v9 ) | |
4525 { | |
4526 LABEL_55: | |
4527 if ( a4 ) | |
4528 *v22 = 31; | |
4529 *a6 = 31; | |
4530 *(char *)a7 = 0; | |
4531 goto LABEL_59; | |
4532 } | |
4533 LABEL_54: | |
4534 *v22 = 27; | |
4535 goto LABEL_55; | |
4536 } | |
4537 if ( v10 == 1 ) | |
4538 { | |
4539 v11 = 1; | |
4540 if ( byte_4D864C && BYTE1(pGame->uFlags) & 0x10 ) | |
4541 { | |
4542 v12 = 0; | |
4543 } | |
4544 else | |
4545 { | |
4546 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime > 0 ) | |
4547 { | |
4548 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime <= 0 ) | |
4549 v11 = 0; | |
4550 else | |
4551 v11 = pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower; | |
4552 } | |
4553 v12 = v11 << 26; | |
4554 } | |
4555 if ( a4 ) | |
4556 goto LABEL_24; | |
4557 if ( v9 <= v12 ) | |
4558 { | |
4559 if ( v9 > 0 ) | |
4560 { | |
4561 LODWORD(v13) = v9 << 16; | |
4562 HIDWORD(v13) = v9 >> 16; | |
4563 v9 = v26; | |
4564 *a5 = (unsigned __int64)(27 * v13 / v12) >> 16; | |
4565 } | |
4566 if ( *a5 > 27 ) | |
4567 goto LABEL_24; | |
4568 } | |
4569 else | |
4570 { | |
4571 *a5 = 27; | |
4572 } | |
4573 if ( v9 ) | |
4574 { | |
4575 LABEL_25: | |
4576 if ( v8->field_32 & 4 ) | |
4577 *a5 = 27; | |
4578 *a6 = 27; | |
4579 LABEL_45: | |
4580 *(char *)a7 = 0; | |
4581 goto LABEL_46; | |
4582 } | |
4583 LABEL_24: | |
4584 *a5 = 27; | |
4585 goto LABEL_25; | |
4586 } | |
4587 *a5 = -1; | |
4588 *a6 = -1; | |
4589 *(char *)a7 = 1; | |
4590 LABEL_59: | |
4591 result = a8; | |
4592 *(char *)a8 = 1; | |
4593 return result; | |
4594 } | |
4595 //----- (0047C24C) -------------------------------------------------------- | |
4596 unsigned __int16 *__fastcall sr_sub_47C24C_get_palette(BLVFace *a1, int a2, int a3, char a4) | |
4597 { | |
4598 int v4; // esi@1 | |
4599 int v5; // eax@2 | |
4600 int a3a; // [sp+4h] [bp-4h]@1 | |
4601 | |
4602 v4 = a2; | |
4603 a3a = 1; | |
4604 if ( a4 ) | |
4605 { | |
4606 v5 = pGame->_44ED0A(a1, &a3a, 31); | |
4607 if ( v5 != -1 ) | |
4608 a3 = v5; | |
4609 } | |
4610 return PaletteManager::Get_Dark_or_Red_LUT(v4, a3, a3a); | |
4611 } | |
4612 //----- (00438141) -------------------------------------------------------- | |
4613 void IndoorCameraD3D::sr_438141_draw_list_0037C() | |
4614 { | |
4615 IndoorCameraD3D *v1; // edi@1 | |
4616 signed int v2; // ebx@1 | |
4617 char *v3; // esi@2 | |
4618 double v4; // st7@4 | |
4619 float v5; // ST00_4@6 | |
4620 float v6; // [sp+4h] [bp-20h]@4 | |
4621 float v7; // [sp+8h] [bp-1Ch]@4 | |
4622 unsigned int v8; // [sp+Ch] [bp-18h]@4 | |
4623 char v9; // [sp+10h] [bp-14h]@4 | |
4624 float v10; // [sp+14h] [bp-10h]@4 | |
4625 | |
4626 v1 = this; | |
4627 v2 = 0; | |
4628 if ( (signed int)this->list_0037C_size > 0 ) | |
4629 { | |
4630 v3 = (char *)&this->list_0037C[0].field_20; | |
4631 do | |
4632 { | |
4633 if ( *(v3 - 32) & 1 ) | |
4634 { | |
4635 LODWORD(v10) = 1; | |
4636 v9 = 1; | |
4637 v8 = *((int *)v3 + 5); | |
4638 v7 = 0.0; | |
4639 v6 = *(float *)v3; | |
4640 v4 = *((float *)v3 - 1); | |
4641 } | |
4642 else | |
4643 { | |
4644 LODWORD(v10) = 0; | |
4645 v9 = 1; | |
4646 v8 = *((int *)v3 + 5); | |
4647 v7 = *((float *)v3 - 5); | |
4648 v6 = *((float *)v3 - 6); | |
4649 v4 = *((float *)v3 - 7); | |
4650 } | |
4651 v5 = v4; | |
4652 sr_437D4A_draw_some_vertices(v5, v6, v7, v8, v9, v10); | |
4653 ++v2; | |
4654 v3 += 56; | |
4655 } | |
4656 while ( v2 < (signed int)v1->list_0037C_size ); | |
4657 } | |
4658 } | |
4659 //----- (00485BAE) -------------------------------------------------------- | |
4660 stru315 *__fastcall sr_sub_485BAE(stru315 *a1, stru316 *a2) | |
4661 { | |
4662 stru315 *result; // eax@1 | |
4663 int i; // ecx@1 | |
4664 int v4; // ecx@2 | |
4665 int v5; // ecx@4 | |
4666 int v6; // ecx@6 | |
4667 int v7; // ecx@8 | |
4668 int v8; // esi@10 | |
4669 int v9; // ecx@10 | |
4670 int v10; // esi@11 | |
4671 int v11; // edi@11 | |
4672 int v12; // ebx@11 | |
4673 int v13; // ecx@16 | |
4674 unsigned __int16 *v14; // esi@18 | |
4675 unsigned int *v15; // ecx@20 | |
4676 int v16; // esi@20 | |
4677 int v17; // [sp+0h] [bp-4h]@10 | |
4678 | |
4679 result = a1; | |
4680 for ( i = a1->field_28; i; i = result->field_28 ) | |
4681 { | |
4682 result->field_28 = i - 1; | |
4683 v4 = result->field_18; | |
4684 if ( result->field_30 > v4 ) | |
4685 result->field_30 = v4; | |
4686 v5 = result->field_20; | |
4687 if ( result->field_2C > v5 ) | |
4688 result->field_2C = v5; | |
4689 v6 = result->field_14; | |
4690 if ( result->field_30 < v6 ) | |
4691 result->field_30 = v6; | |
4692 v7 = result->field_1C; | |
4693 if ( result->field_2C < v7 ) | |
4694 result->field_2C = v7; | |
4695 v8 = (result->field_C & HIWORD(result->field_30)) + ((result->field_2C & result->field_8) >> result->field_10); | |
4696 v9 = *((char *)result->pTextureLOD + v8); | |
4697 v17 = *((char *)result->pTextureLOD + v8); | |
4698 if ( a2->field_20 ) | |
4699 { | |
4700 v10 = HIWORD(a2->field_14); | |
4701 v11 = a2->field_C; | |
4702 v12 = v10; | |
4703 if ( v10 >= v11 ) | |
4704 v12 = a2->field_C; | |
4705 if ( a2->field_8 - v12 <= 0 ) | |
4706 { | |
4707 v13 = 0; | |
4708 } | |
4709 else | |
4710 { | |
4711 if ( v10 >= v11 ) | |
4712 v10 = a2->field_C; | |
4713 v13 = a2->field_8 - v10; | |
4714 } | |
4715 v14 = a2->field_24_palette; | |
4716 v9 = v17 + (v13 << 8); | |
4717 } | |
4718 else | |
4719 { | |
4720 v14 = result->field_34_palette; | |
4721 } | |
4722 *result->pColorBuffer = v14[v9]; | |
4723 v15 = result->pDepthBuffer; | |
4724 v16 = result->field_24; | |
4725 --result->pColorBuffer; | |
4726 *v15 = v16; | |
4727 --result->pDepthBuffer; | |
4728 a2->field_14 -= a2->field_18; | |
4729 result->field_30 += result->field_4; | |
4730 result->field_2C += result->field_0; | |
4731 } | |
4732 --result->field_28; | |
4733 return result; | |
4734 } | |
4735 | |
4736 //----- (00485C89) -------------------------------------------------------- | |
4737 stru315 *__fastcall sr_sub_485C89(stru315 *a1, stru316 *a2) | |
4738 { | |
4739 stru315 *result; // eax@1 | |
4740 int i; // ecx@1 | |
4741 int v4; // esi@2 | |
4742 int v5; // esi@2 | |
4743 int v6; // ecx@2 | |
4744 int v7; // esi@4 | |
4745 int v8; // edi@4 | |
4746 int v9; // ecx@9 | |
4747 unsigned __int16 *v10; // esi@11 | |
4748 unsigned int *v11; // ecx@14 | |
4749 int v12; // esi@14 | |
4750 int v13; // [sp+0h] [bp-4h]@2 | |
4751 | |
4752 result = a1; | |
4753 for ( i = a1->field_28; i; i = result->field_28 ) | |
4754 { | |
4755 v4 = result->field_8 & result->field_2C; | |
4756 result->field_28 = i - 1; | |
4757 v5 = (result->field_C & HIWORD(result->field_30)) + (v4 >> result->field_10); | |
4758 v6 = *((char *)result->pTextureLOD + v5); | |
4759 v13 = *((char *)result->pTextureLOD + v5); | |
4760 if ( *((char *)result->pTextureLOD + v5) ) | |
4761 { | |
4762 if ( a2->field_20 ) | |
4763 { | |
4764 v7 = HIWORD(a2->field_10); | |
4765 v8 = v7; | |
4766 if ( v7 >= a2->field_C ) | |
4767 v8 = a2->field_C; | |
4768 if ( a2->field_8 - v8 <= 0 ) | |
4769 { | |
4770 v9 = 0; | |
4771 } | |
4772 else | |
4773 { | |
4774 if ( v7 >= a2->field_C ) | |
4775 v7 = a2->field_C; | |
4776 v9 = a2->field_8 - v7; | |
4777 } | |
4778 v10 = a2->field_24_palette; | |
4779 v6 = v13 + (v9 << 8); | |
4780 } | |
4781 else | |
4782 { | |
4783 v10 = result->field_34_palette; | |
4784 } | |
4785 *result->pColorBuffer = v10[v6]; | |
4786 } | |
4787 v11 = result->pDepthBuffer; | |
4788 v12 = result->field_24; | |
4789 ++result->pColorBuffer; | |
4790 *v11 = v12; | |
4791 ++result->pDepthBuffer; | |
4792 a2->field_10 += a2->field_18; | |
4793 result->field_30 += result->field_4; | |
4794 result->field_2C += result->field_0; | |
4795 } | |
4796 --result->field_28; | |
4797 return result; | |
4798 } | |
4799 | |
4800 //----- (00485D3E) -------------------------------------------------------- | |
4801 stru315 *__fastcall sr_sub_485D3E(stru315 *a1, stru316 *a2) | |
4802 { | |
4803 stru315 *result; // eax@1 | |
4804 int i; // ecx@1 | |
4805 int v4; // ecx@2 | |
4806 int v5; // ecx@4 | |
4807 int v6; // ecx@6 | |
4808 int v7; // ecx@8 | |
4809 int v8; // esi@10 | |
4810 int v9; // ecx@10 | |
4811 int v10; // esi@12 | |
4812 int v11; // edi@12 | |
4813 int v12; // ecx@17 | |
4814 unsigned __int16 *v13; // esi@19 | |
4815 unsigned int *v14; // ecx@22 | |
4816 int v15; // esi@22 | |
4817 int v16; // [sp+0h] [bp-4h]@10 | |
4818 | |
4819 result = a1; | |
4820 for ( i = a1->field_28; i; i = result->field_28 ) | |
4821 { | |
4822 result->field_28 = i - 1; | |
4823 v4 = result->field_18; | |
4824 if ( result->field_30 > v4 ) | |
4825 result->field_30 = v4; | |
4826 v5 = result->field_20; | |
4827 if ( result->field_2C > v5 ) | |
4828 result->field_2C = v5; | |
4829 v6 = result->field_14; | |
4830 if ( result->field_30 < v6 ) | |
4831 result->field_30 = v6; | |
4832 v7 = result->field_1C; | |
4833 if ( result->field_2C < v7 ) | |
4834 result->field_2C = v7; | |
4835 v8 = (result->field_C & HIWORD(result->field_30)) + ((result->field_2C & result->field_8) >> result->field_10); | |
4836 v9 = *((char *)result->pTextureLOD + v8); | |
4837 v16 = *((char *)result->pTextureLOD + v8); | |
4838 if ( *((char *)result->pTextureLOD + v8) ) | |
4839 { | |
4840 if ( a2->field_20 ) | |
4841 { | |
4842 v10 = HIWORD(a2->field_10); | |
4843 v11 = v10; | |
4844 if ( v10 >= a2->field_C ) | |
4845 v11 = a2->field_C; | |
4846 if ( a2->field_8 - v11 <= 0 ) | |
4847 { | |
4848 v12 = 0; | |
4849 } | |
4850 else | |
4851 { | |
4852 if ( v10 >= a2->field_C ) | |
4853 v10 = a2->field_C; | |
4854 v12 = a2->field_8 - v10; | |
4855 } | |
4856 v13 = a2->field_24_palette; | |
4857 v9 = v16 + (v12 << 8); | |
4858 } | |
4859 else | |
4860 { | |
4861 v13 = result->field_34_palette; | |
4862 } | |
4863 *result->pColorBuffer = v13[v9]; | |
4864 } | |
4865 v14 = result->pDepthBuffer; | |
4866 v15 = result->field_24; | |
4867 ++result->pColorBuffer; | |
4868 *v14 = v15; | |
4869 ++result->pDepthBuffer; | |
4870 a2->field_10 += a2->field_18; | |
4871 result->field_30 += result->field_4; | |
4872 result->field_2C += result->field_0; | |
4873 } | |
4874 --result->field_28; | |
4875 return result; | |
4876 } | |
4877 | |
4878 //----- (0047C178) -------------------------------------------------------- | |
4879 void *__fastcall sr_sub_47C178(signed int a1, Polygon *a2, int terrain_gamma, int a4) | |
4880 { | |
4881 Polygon *v4; // esi@1 | |
4882 void *result; // eax@2 | |
4883 int v6; // [sp+4h] [bp-8h]@3 | |
4884 int v7; // [sp+8h] [bp-4h]@3 | |
4885 | |
4886 v4 = a2; | |
4887 if ( pParty->armageddon_timer ) | |
4888 { | |
4889 result = PaletteManager::Get(a2->pTexture->palette_id2); | |
4890 } | |
4891 else | |
4892 { | |
4893 sr_sub_47BEB1(a1, a2, terrain_gamma, a4, &v6, &v7, (int)((char *)&terrain_gamma + 3), (int)((char *)&a4 + 3)); | |
4894 result = sr_sub_47C1CA(v4, SBYTE3(a4), v6, v7); | |
4895 } | |
4896 return result; | |
4897 } | |
4898 | |
4899 //----- (0047C1CA) -------------------------------------------------------- | |
4900 void *__fastcall sr_sub_47C1CA(Polygon *a1, char a2, int a3, signed int a4) | |
4901 { | |
4902 Polygon *v4; // esi@1 | |
4903 void *result; // eax@2 | |
4904 int v6; // edx@3 | |
4905 int v7; // ecx@8 | |
4906 int a3a; // [sp+4h] [bp-8h]@1 | |
4907 char v9; // [sp+8h] [bp-4h]@1 | |
4908 | |
4909 v9 = a2; | |
4910 v4 = a1; | |
4911 a3a = 1; | |
4912 if ( pParty->armageddon_timer ) | |
4913 { | |
4914 result = PaletteManager::Get(a1->pTexture->palette_id2); | |
4915 } | |
4916 else | |
4917 { | |
4918 v6 = pGame->_44EC23(a1, &a3a, a4); | |
4919 if ( v6 == -1 ) | |
4920 v6 = a3; | |
4921 if ( v9 == 1 ) | |
4922 { | |
4923 if ( v6 != -1 || a4 != -1 ) | |
4924 { | |
4925 v7 = v4->pTexture->palette_id2; | |
4926 } | |
4927 else | |
4928 { | |
4929 v6 = 0; | |
4930 v7 = 0; | |
4931 } | |
4932 result = PaletteManager::Get_Mist_or_Red_LUT(v7, v6, a3a); | |
4933 } | |
4934 else | |
4935 { | |
4936 result = PaletteManager::Get_Dark_or_Red_LUT(v4->pTexture->palette_id2, v6, a3a); | |
4937 } | |
4938 } | |
4939 return result; | |
4940 } | |
4941 | |
4942 //----- (0047C28C) -------------------------------------------------------- | |
4943 char *__fastcall sr_sub_47C28C_get_palette(Polygon *a1, char a2, signed int a3, signed int a4) | |
4944 { | |
4945 Polygon *v4; // esi@1 | |
4946 char *result; // eax@2 | |
4947 signed int v6; // eax@3 | |
4948 int v7; // ecx@8 | |
4949 int a2a; // [sp+4h] [bp-8h]@1 | |
4950 char v9; // [sp+8h] [bp-4h]@1 | |
4951 | |
4952 v9 = a2; | |
4953 v4 = a1; | |
4954 a2a = 1; | |
4955 if ( pParty->armageddon_timer ) | |
4956 { | |
4957 result = (char *)pPaletteManager->field_199600_palettes[a1->pTexture->palette_id2]; | |
4958 } | |
4959 else | |
4960 { | |
4961 v6 = pGame->_44EC23(a1, &a2a, a4); | |
4962 if ( v6 != -1 ) | |
4963 a3 = v6; | |
4964 if ( v9 == 1 ) | |
4965 { | |
4966 if ( a3 != -1 || a4 != -1 ) | |
4967 v7 = v4->pTexture->palette_id2; | |
4968 else | |
4969 v7 = 0; | |
4970 result = (char *)PaletteManager::_47C30E_get_palette(v7, a2a); | |
4971 } | |
4972 else | |
4973 { | |
4974 result = (char *)PaletteManager::_47C33F_get_palette(v4->pTexture->palette_id2, a2a); | |
4975 } | |
4976 } | |
4977 return result; | |
4978 } | |
4979 | |
4980 //----- (004AFF79) -------------------------------------------------------- | |
4981 void IndoorLocation::ExecDraw_sw(unsigned int uFaceID) | |
4982 { | |
4983 unsigned int v1; // ebx@1 | |
4984 BLVFace *v2; // esi@3 | |
4985 unsigned int v3; // eax@3 | |
4986 Texture *v4; // eax@8 | |
4987 Texture *v5; // edi@8 | |
4988 int v6; // eax@9 | |
4989 int v7; // eax@9 | |
4990 int v8; // ecx@17 | |
4991 int v9; // ebx@17 | |
4992 int v10; // eax@17 | |
4993 int v11; // esi@17 | |
4994 unsigned int v12; // eax@17 | |
4995 int j; // ecx@19 | |
4996 int v14; // edx@20 | |
4997 int v15; // eax@20 | |
4998 int v16; // edx@20 | |
4999 int i; // ebx@22 | |
5000 int v18; // ecx@23 | |
5001 int v19; // eax@23 | |
5002 int v20; // eax@23 | |
5003 int v21; // eax@24 | |
5004 unsigned __int8 *v22; // ecx@24 | |
5005 int v23; // ebx@24 | |
5006 int v24; // esi@25 | |
5007 int v25; // eax@28 | |
5008 unsigned __int16 *v26; // eax@28 | |
5009 unsigned int v27; // eax@29 | |
5010 int v28; // eax@30 | |
5011 char *v29; // esi@31 | |
5012 int v30; // eax@33 | |
5013 int v31; // eax@33 | |
5014 int v32; // eax@35 | |
5015 int v33; // edx@35 | |
5016 signed int v34; // ebx@35 | |
5017 int v35; // eax@35 | |
5018 int v36; // ebx@35 | |
5019 signed int v37; // ebx@35 | |
5020 signed int v38; // edi@35 | |
5021 unsigned int v39; // edi@36 | |
5022 int v40; // edx@40 | |
5023 int v41; // ecx@40 | |
5024 signed int v42; // edx@40 | |
5025 int v43; // edx@42 | |
5026 int v44; // eax@42 | |
5027 unsigned __int16 *v45; // eax@43 | |
5028 int *v46; // esi@44 | |
5029 unsigned __int16 *v47; // edi@44 | |
5030 unsigned int v48; // edx@44 | |
5031 int v49; // ebx@44 | |
5032 char v50; // cl@44 | |
5033 char v51; // ch@44 | |
5034 unsigned int v52; // ebx@46 | |
5035 int v53; // edx@46 | |
5036 unsigned int v54; // ebx@46 | |
5037 int v55; // edx@46 | |
5038 unsigned int v56; // ebx@47 | |
5039 int v57; // edx@47 | |
5040 int v58; // ebx@47 | |
5041 int v59; // edx@47 | |
5042 unsigned __int16 *v60; // eax@50 | |
5043 int *v61; // esi@51 | |
5044 unsigned __int16 *v62; // edi@51 | |
5045 unsigned int v63; // edx@51 | |
5046 int v64; // ebx@51 | |
5047 char v65; // cl@51 | |
5048 char v66; // ch@51 | |
5049 unsigned int v67; // ebx@53 | |
5050 int v68; // edx@53 | |
5051 unsigned int v69; // ebx@53 | |
5052 int v70; // edx@53 | |
5053 unsigned int v71; // ebx@54 | |
5054 int v72; // edx@54 | |
5055 int v73; // ebx@54 | |
5056 int v74; // edx@54 | |
5057 unsigned __int16 *v75; // eax@58 | |
5058 int *v76; // esi@59 | |
5059 int v77; // edi@59 | |
5060 unsigned int v78; // edx@59 | |
5061 int v79; // ebx@59 | |
5062 char v80; // cl@59 | |
5063 char v81; // ch@59 | |
5064 int v82; // ebx@61 | |
5065 int v83; // edx@61 | |
5066 unsigned int v84; // ebx@62 | |
5067 int v85; // edx@62 | |
5068 unsigned __int16 *v86; // eax@65 | |
5069 int *v87; // esi@66 | |
5070 int v88; // edi@66 | |
5071 unsigned int v89; // edx@66 | |
5072 int v90; // ebx@66 | |
5073 char v91; // cl@66 | |
5074 char v92; // ch@66 | |
5075 int v93; // ebx@68 | |
5076 int v94; // edx@68 | |
5077 unsigned __int16 v95; // bx@69 | |
5078 int v96; // edx@69 | |
5079 unsigned __int8 *v97; // [sp+Ch] [bp-9Ch]@24 | |
5080 unsigned __int8 *v98; // [sp+10h] [bp-98h]@24 | |
5081 unsigned __int8 *v99; // [sp+14h] [bp-94h]@24 | |
5082 unsigned __int8 *v100; // [sp+18h] [bp-90h]@24 | |
5083 int v101; // [sp+1Ch] [bp-8Ch]@40 | |
5084 int v102; // [sp+20h] [bp-88h]@31 | |
5085 BLVFace *v103; // [sp+24h] [bp-84h]@3 | |
5086 unsigned __int16 *v104; // [sp+28h] [bp-80h]@24 | |
5087 int v105; // [sp+2Ch] [bp-7Ch]@30 | |
5088 int v106; // [sp+30h] [bp-78h]@24 | |
5089 int v107; // [sp+34h] [bp-74h]@9 | |
5090 Texture *v108; // [sp+38h] [bp-70h]@8 | |
5091 int v109; // [sp+3Ch] [bp-6Ch]@9 | |
5092 unsigned int v110; // [sp+40h] [bp-68h]@24 | |
5093 unsigned int v111; // [sp+44h] [bp-64h]@1 | |
5094 int *k; // [sp+48h] [bp-60h]@31 | |
5095 int v113; // [sp+4Ch] [bp-5Ch]@35 | |
5096 int v114; // [sp+50h] [bp-58h]@35 | |
5097 int v115; // [sp+54h] [bp-54h]@42 | |
5098 unsigned __int8 *v116; // [sp+58h] [bp-50h]@35 | |
5099 int v117; // [sp+5Ch] [bp-4Ch]@33 | |
5100 int a1; // [sp+60h] [bp-48h]@27 | |
5101 int v119; // [sp+64h] [bp-44h]@17 | |
5102 int v120; // [sp+68h] [bp-40h]@23 | |
5103 unsigned int v121; // [sp+6Ch] [bp-3Ch]@40 | |
5104 unsigned int v122; // [sp+70h] [bp-38h]@35 | |
5105 int v123; // [sp+74h] [bp-34h]@30 | |
5106 int v124; // [sp+78h] [bp-30h]@17 | |
5107 int v125; // [sp+7Ch] [bp-2Ch]@35 | |
5108 unsigned int v126; // [sp+80h] [bp-28h]@9 | |
5109 int v127; // [sp+84h] [bp-24h]@17 | |
5110 int v128; // [sp+88h] [bp-20h]@9 | |
5111 int *pZPixel; // [sp+8Ch] [bp-1Ch]@28 | |
5112 int a2; // [sp+90h] [bp-18h]@16 | |
5113 unsigned int v131; // [sp+94h] [bp-14h]@17 | |
5114 unsigned __int16 *pColorPixel; // [sp+98h] [bp-10h]@28 | |
5115 int v133; // [sp+9Ch] [bp-Ch]@17 | |
5116 int v134; // [sp+A0h] [bp-8h]@17 | |
5117 int v135; // [sp+A4h] [bp-4h]@24 | |
5118 | |
5119 v1 = uFaceID; | |
5120 v111 = pRenderer->uTargetSurfacePitch; | |
5121 if ( (uFaceID & 0x80000000u) == 0 ) | |
5122 { | |
5123 if ( (signed int)uFaceID < (signed int)pIndoor->uNumFaces ) | |
5124 { | |
5125 v2 = &pIndoor->pFaces[uFaceID]; | |
5126 v103 = v2; | |
5127 v3 = v2->uAttributes; | |
5128 if ( !(BYTE1(v3) & 0x20) ) | |
5129 { | |
5130 if ( v3 & 0x400000 ) | |
5131 { | |
5132 sr_4ADD1D(uFaceID); | |
5133 return; | |
5134 } | |
5135 if ( !(v3 & 0x10) || (sr_4AD504(uFaceID), pRenderer->pRenderD3D) ) | |
5136 { | |
5137 v4 = v2->GetTexture(); | |
5138 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
5139 v5 = v4; | |
5140 v108 = v4; | |
5141 if ( v4 ) | |
5142 { | |
5143 v6 = v4->palette_id2; | |
5144 LOBYTE(v2->uAttributes) |= 0x80u; | |
5145 v109 = v6; | |
5146 sr_4AE5F1(v1); | |
5147 v126 = stru_F8AD28.pDeltaUV[0]; | |
5148 v128 = stru_F8AD28.pDeltaUV[1]; | |
5149 v107 = bUseLoResSprites; | |
5150 v7 = GetPortalScreenCoord(v1); | |
5151 if ( v7 ) | |
5152 { | |
5153 if ( PortalFrustrum(v7, &stru_F8A590, pBLVRenderParams->field_7C, v1) ) | |
5154 { | |
5155 if ( v2->uPolygonType == 1 ) | |
5156 { | |
5157 for ( i = 0; i < stru_F8AD28.uNumLightsApplied; stru_F8AD28._blv_lights_ys[v18] = v20 ) | |
5158 { | |
5159 v18 = i; | |
5160 v120 = stru_F8AD28._blv_lights_xs[i]; | |
5161 v134 = (unsigned __int64)(v120 * (signed __int64)-stru_F8AD28.plane_4.vNormal.y) >> 16; | |
5162 v133 = stru_F8AD28.plane_4.vNormal.x; | |
5163 v120 = stru_F8AD28._blv_lights_ys[i]; | |
5164 v133 = (unsigned __int64)(v120 * (signed __int64)stru_F8AD28.plane_4.vNormal.x) >> 16; | |
5165 v19 = v128; | |
5166 stru_F8AD28._blv_lights_xs[i] = v126 | |
5167 + v134 | |
5168 + ((unsigned __int64)(v120 | |
5169 * (signed __int64)stru_F8AD28.plane_4.vNormal.x) >> 16); | |
5170 v20 = v19 - stru_F8AD28._blv_lights_zs[i++]; | |
5171 } | |
5172 } | |
5173 else | |
5174 { | |
5175 if ( v2->uPolygonType != 3 ) | |
5176 { | |
5177 if ( v2->uPolygonType == 4 ) | |
5178 { | |
5179 LABEL_16: | |
5180 a2 = 0; | |
5181 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
5182 { | |
5183 do | |
5184 { | |
5185 v8 = a2; | |
5186 v9 = stru_F8AD28._blv_lights_xs[a2]; | |
5187 v131 = stru_F8AD28._blv_lights_ys[a2]; | |
5188 v10 = stru_F8AD28._blv_lights_zs[a2]; | |
5189 v11 = (signed int)(v10 * stru_F8AD28.plane_4.vNormal.z | |
5190 + stru_F8AD28.plane_4.dist | |
5191 + v9 * stru_F8AD28.plane_4.vNormal.x | |
5192 + v131 * stru_F8AD28.plane_4.vNormal.y) >> 16; | |
5193 v119 = v9 | |
5194 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
5195 * (signed __int64)((signed int)(v10 * stru_F8AD28.plane_4.vNormal.z | |
5196 + stru_F8AD28.plane_4.dist | |
5197 + v9 * stru_F8AD28.plane_4.vNormal.x | |
5198 + v131 * stru_F8AD28.plane_4.vNormal.y) >> 16)) >> 16); | |
5199 v131 -= (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)v11) >> 16; | |
5200 v127 = v10 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)v11) >> 16); | |
5201 stru_F8AD28._blv_lights_xs[a2] = ((unsigned __int64)(v119 | |
5202 * (signed __int64)stru_F8AD28.vec_14.x) >> 16) | |
5203 + ((unsigned __int64)((signed int)v131 | |
5204 * (signed __int64)stru_F8AD28.vec_14.y) >> 16); | |
5205 v124 = (unsigned __int64)(v119 * (signed __int64)stru_F8AD28.vec_20.x) >> 16; | |
5206 v134 = (unsigned __int64)((signed int)v131 * (signed __int64)stru_F8AD28.vec_20.y) >> 16; | |
5207 v133 = (unsigned __int64)(v127 * (signed __int64)stru_F8AD28.vec_20.z) >> 16; | |
5208 v12 = v126; | |
5209 stru_F8AD28._blv_lights_ys[v8] = v124 | |
5210 + ((unsigned __int64)((signed int)v131 | |
5211 * (signed __int64)stru_F8AD28.vec_20.y) >> 16) | |
5212 + ((unsigned __int64)(v127 | |
5213 * (signed __int64)stru_F8AD28.vec_20.z) >> 16); | |
5214 stru_F8AD28._blv_lights_xs[v8] += v12; | |
5215 stru_F8AD28._blv_lights_ys[v8] += v128; | |
5216 ++a2; | |
5217 } | |
5218 while ( a2 < stru_F8AD28.uNumLightsApplied ); | |
5219 v2 = v103; | |
5220 } | |
5221 goto LABEL_24; | |
5222 } | |
5223 if ( v2->uPolygonType != 5 ) | |
5224 { | |
5225 if ( v2->uPolygonType != 6 ) | |
5226 goto LABEL_24; | |
5227 goto LABEL_16; | |
5228 } | |
5229 } | |
5230 for ( j = 0; j < stru_F8AD28.uNumLightsApplied; *(int *)v15 = v16 ) | |
5231 { | |
5232 v14 = v128; | |
5233 stru_F8AD28._blv_lights_xs[j] += v126; | |
5234 v15 = 4 * j + 16297672; | |
5235 v16 = v14 - stru_F8AD28._blv_lights_ys[j++]; | |
5236 } | |
5237 } | |
5238 LABEL_24: | |
5239 v135 = 1; | |
5240 pGame->_44ED0A(v2, &v135, 31); | |
5241 v104 = sr_sub_47C24C_get_palette(v2, v109, 0, 1); | |
5242 v134 = stru_F8AD28.field_44; | |
5243 v106 = stru_F8AD28.field_48; | |
5244 v21 = stru_F8A590._viewport_space_y; | |
5245 a2 = stru_F8A590._viewport_space_y; | |
5246 v110 = v111 * stru_F8A590._viewport_space_y; | |
5247 v97 = v5->pLevelOfDetail0_prolly_alpha_mask; | |
5248 v98 = v5->pLevelOfDetail1; | |
5249 v99 = v5->pLevelOfDetail2; | |
5250 v22 = v5->pLevelOfDetail3; | |
5251 v23 = 640 * stru_F8A590._viewport_space_y; | |
5252 v119 = 640 * stru_F8A590._viewport_space_y; | |
5253 v100 = v22; | |
5254 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
5255 { | |
5256 v24 = 2 * stru_F8A590._viewport_space_y; | |
5257 v120 = 2 * stru_F8A590._viewport_space_y; | |
5258 while ( 1 ) | |
5259 { | |
5260 a1 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v24); | |
5261 sr_4AE313(a1, v21, &stru_F81018.field_0); | |
5262 if ( LOBYTE(viewparams->field_20) ) | |
5263 { | |
5264 v27 = v111 * (v24 - pBLVRenderParams->uViewportY); | |
5265 pZPixel = &pBLVRenderParams->pTargetZBuffer[2 | |
5266 * (*(__int16 *)((char *)stru_F8A590.viewport_left_side + v24) | |
5267 + 320 * (v24 - pBLVRenderParams->uViewportY)) | |
5268 - pBLVRenderParams->uViewportX]; | |
5269 pColorPixel = &pBLVRenderParams->pRenderTarget[v27 | |
5270 + 2 * *(__int16 *)((char *)stru_F8A590.viewport_left_side + v24) | |
5271 - pBLVRenderParams->uViewportX]; | |
5272 v26 = &pBLVRenderParams->pRenderTarget[v27 | |
5273 + 2 * *(__int16 *)((char *)stru_F8A590.viewport_right_side + v24) | |
5274 - pBLVRenderParams->uViewportX]; | |
5275 v23 = v119; | |
5276 } | |
5277 else | |
5278 { | |
5279 v25 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v24); | |
5280 pZPixel = &pBLVRenderParams->pTargetZBuffer[v25 + v23]; | |
5281 pColorPixel = &pBLVRenderParams->pRenderTarget[v25 + v110]; | |
5282 v26 = &pBLVRenderParams->pRenderTarget[v110 + *(__int16 *)((char *)stru_F8A590.viewport_right_side + v24)]; | |
5283 } | |
5284 v131 = (unsigned int)v26; | |
5285 HIWORD(v28) = HIWORD(stru_F81018.field_0.field_0); | |
5286 LOWORD(v28) = 0; | |
5287 v105 = stru_F8AD28.field_0 | v28; | |
5288 v123 = sr_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); | |
5289 if ( (unsigned int)pColorPixel < v131 ) | |
5290 { | |
5291 v102 = v107 + v106; | |
5292 v29 = (char *)&stru_F81018.field_34.field_8; | |
5293 a1 += v134; | |
5294 for ( k = &stru_F81018.field_34.field_8; ; v29 = (char *)k ) | |
5295 { | |
5296 sr_4AE313(a1, a2, (stru337_stru0 *)(v29 - 8)); | |
5297 v30 = *((int *)v29 - 2); | |
5298 LOWORD(v30) = 0; | |
5299 v117 = v105; | |
5300 v31 = stru_F8AD28.field_0 | v30; | |
5301 if ( v105 <= (unsigned int)v31 ) | |
5302 v117 = v31; | |
5303 v105 = v31; | |
5304 v32 = *((int *)v29 - 14); | |
5305 v122 = *((int *)v29 - 14) >> v107; | |
5306 v33 = *((int *)v29 - 13); | |
5307 v125 = *((int *)v29 - 13) >> v107; | |
5308 v34 = *((int *)v29 - 1) - v32; | |
5309 v113 = (*(int *)v29 - v33) >> v102; | |
5310 v35 = *((int *)v29 - 11); | |
5311 v114 = v34 >> v102; | |
5312 v116 = (&v97)[4 * v35]; | |
5313 v36 = v35 + 16 - v5->uWidthLn2; | |
5314 v133 = v35 + 16; | |
5315 v127 = v35 + v36; | |
5316 v37 = v5->uWidthMinus1 >> v35; | |
5317 v38 = v5->uHeightMinus1 >> v35 << (v35 + 16); | |
5318 v128 = v37; | |
5319 v126 = v38; | |
5320 v39 = (unsigned int)(LOBYTE(viewparams->field_20) ? &pColorPixel[2 * v134] : &pColorPixel[v134]); | |
5321 if ( v39 > v131 ) | |
5322 v39 = v131; | |
5323 v40 = *((short *)v29 + 1); | |
5324 v41 = *((short *)v29 - 1); | |
5325 v121 = v39; | |
5326 v42 = sr_4AE491(v41, v40); | |
5327 v101 = v42; | |
5328 v124 = (signed int)(v39 - (int)pColorPixel) >> 1; | |
5329 if ( v123 >> 16 == v42 >> 16 || v135 & 2 ) | |
5330 { | |
5331 v123 = (int)sr_sub_47C24C_get_palette(v103, v109, v123 >> 16, 1); | |
5332 if ( LOBYTE(viewparams->field_20) ) | |
5333 { | |
5334 v86 = pColorPixel; | |
5335 if ( (unsigned int)pColorPixel < v121 ) | |
5336 { | |
5337 v87 = pZPixel; | |
5338 v88 = v123; | |
5339 v89 = v122; | |
5340 v90 = v125; | |
5341 v91 = v133; | |
5342 v92 = v127; | |
5343 if ( v124 & 2 ) | |
5344 { | |
5345 *pZPixel = v117; | |
5346 v87 -= 2; | |
5347 v86 = pColorPixel + 2; | |
5348 goto LABEL_69; | |
5349 } | |
5350 do | |
5351 { | |
5352 v86 += 4; | |
5353 v93 = *(&v116[v128 & (v89 >> v91)] + ((v126 & v90) >> v92)); | |
5354 v94 = v117; | |
5355 LOWORD(v93) = *(short *)(v88 + 2 * v93); | |
5356 *v87 = v117; | |
5357 v87[1] = v94; | |
5358 v87[640] = v94; | |
5359 v87[641] = v94; | |
5360 *(v86 - 4) = v93; | |
5361 *(v86 - 3) = v93; | |
5362 v86[636] = v93; | |
5363 v86[637] = v93; | |
5364 v87[2] = v94; | |
5365 v87[3] = v94; | |
5366 v87[642] = v94; | |
5367 v87[643] = v94; | |
5368 v122 += v114; | |
5369 v125 += v113; | |
5370 v89 = v122; | |
5371 v90 = v125; | |
5372 LABEL_69: | |
5373 v87 += 4; | |
5374 v95 = *(short *)(v88 + 2 * *(&v116[v128 & (v89 >> v91)] + ((v126 & v90) >> v92))); | |
5375 v96 = v114; | |
5376 *(v86 - 2) = v95; | |
5377 *(v86 - 1) = v95; | |
5378 v86[638] = v95; | |
5379 v86[639] = v95; | |
5380 v122 += v96; | |
5381 v125 += v113; | |
5382 v89 = v122; | |
5383 v90 = v125; | |
5384 } | |
5385 while ( (unsigned int)v86 < v121 ); | |
5386 pColorPixel = v86; | |
5387 pZPixel = v87; | |
5388 } | |
5389 } | |
5390 else | |
5391 { | |
5392 v75 = pColorPixel; | |
5393 if ( (unsigned int)pColorPixel < v121 ) | |
5394 { | |
5395 v76 = pZPixel; | |
5396 v77 = v123; | |
5397 v78 = v122; | |
5398 v79 = v125; | |
5399 v80 = v133; | |
5400 v81 = v127; | |
5401 if ( v124 & 1 ) | |
5402 { | |
5403 *pZPixel = v117; | |
5404 --v76; | |
5405 v75 = pColorPixel + 1; | |
5406 goto LABEL_62; | |
5407 } | |
5408 do | |
5409 { | |
5410 v75 += 2; | |
5411 v82 = *(&v116[v128 & (v78 >> v80)] + ((v126 & v79) >> v81)); | |
5412 v83 = v117; | |
5413 LOWORD(v82) = *(short *)(v77 + 2 * v82); | |
5414 *v76 = v117; | |
5415 *(v75 - 2) = v82; | |
5416 v76[1] = v83; | |
5417 v122 += v114; | |
5418 v125 += v113; | |
5419 v78 = v122; | |
5420 v79 = v125; | |
5421 LABEL_62: | |
5422 v84 = (unsigned int)(&v116[v128 & (v78 >> v80)] + ((v126 & v79) >> v81)); | |
5423 v76 += 2; | |
5424 v85 = v114; | |
5425 *(v75 - 1) = *(short *)(v77 + 2 * *(char *)v84); | |
5426 v122 += v85; | |
5427 v125 += v113; | |
5428 v78 = v122; | |
5429 v79 = v125; | |
5430 } | |
5431 while ( (unsigned int)v75 < v121 ); | |
5432 pColorPixel = v75; | |
5433 pZPixel = v76; | |
5434 } | |
5435 } | |
5436 } | |
5437 else | |
5438 { | |
5439 v43 = (v42 - v123) >> v106; | |
5440 v44 = v123 - v43; | |
5441 v123 = v43; | |
5442 v115 = v44; | |
5443 if ( LOBYTE(viewparams->field_20) ) | |
5444 { | |
5445 v60 = pColorPixel; | |
5446 if ( (unsigned int)pColorPixel < v121 ) | |
5447 { | |
5448 v61 = pZPixel; | |
5449 v62 = v104; | |
5450 v63 = v122; | |
5451 v64 = v125; | |
5452 v65 = v133; | |
5453 v66 = v127; | |
5454 if ( v124 & 2 ) | |
5455 { | |
5456 *pZPixel = v117; | |
5457 v61 += 2; | |
5458 v60 = pColorPixel + 2; | |
5459 goto LABEL_54; | |
5460 } | |
5461 do | |
5462 { | |
5463 v67 = (v128 & (v63 >> v65)) + ((v126 & v64) >> v66); | |
5464 v68 = v123 + v115; | |
5465 v60 += 4; | |
5466 v115 = v68; | |
5467 v69 = ((v68 & 0xFFFF0000u) >> 8) + v116[v67]; | |
5468 v70 = v117; | |
5469 LOWORD(v69) = v62[v69]; | |
5470 *v61 = v117; | |
5471 v61[1] = v70; | |
5472 v61[640] = v70; | |
5473 v61[641] = v70; | |
5474 *(v60 - 4) = v69; | |
5475 *(v60 - 3) = v69; | |
5476 v60[636] = v69; | |
5477 v60[637] = v69; | |
5478 v61[2] = v70; | |
5479 v61[3] = v70; | |
5480 v61[642] = v70; | |
5481 v61[643] = v70; | |
5482 v122 += v114; | |
5483 v125 += v113; | |
5484 v63 = v122; | |
5485 v64 = v125; | |
5486 v61 += 4; | |
5487 LABEL_54: | |
5488 v71 = (v128 & (v63 >> v65)) + ((v126 & v64) >> v66); | |
5489 v72 = v123 + v115; | |
5490 v73 = v116[v71]; | |
5491 v115 = v72; | |
5492 LOWORD(v73) = v62[((v72 & 0xFFFF0000u) >> 8) + v73]; | |
5493 v74 = v114; | |
5494 *(v60 - 2) = v73; | |
5495 *(v60 - 1) = v73; | |
5496 v60[638] = v73; | |
5497 v60[639] = v73; | |
5498 v122 += v74; | |
5499 v125 += v113; | |
5500 v63 = v122; | |
5501 v64 = v125; | |
5502 } | |
5503 while ( (unsigned int)v60 < v121 ); | |
5504 pColorPixel = v60; | |
5505 pZPixel = v61; | |
5506 } | |
5507 } | |
5508 else | |
5509 { | |
5510 v45 = pColorPixel; | |
5511 if ( (unsigned int)pColorPixel < v121 ) | |
5512 { | |
5513 v46 = pZPixel; | |
5514 v47 = v104; | |
5515 v48 = v122; | |
5516 v49 = v125; | |
5517 v50 = v133; | |
5518 v51 = v127; | |
5519 if ( v124 & 1 ) | |
5520 { | |
5521 *pZPixel = v117; | |
5522 ++v46; | |
5523 v45 = pColorPixel + 1; | |
5524 goto LABEL_47; | |
5525 } | |
5526 do | |
5527 { | |
5528 v52 = (v128 & (v48 >> v50)) + ((v126 & v49) >> v51); | |
5529 v53 = v123 + v115; | |
5530 v45 += 2; | |
5531 v115 = v53; | |
5532 v54 = ((v53 & 0xFFFF0000u) >> 8) + v116[v52]; | |
5533 v55 = v117; | |
5534 LOWORD(v54) = v47[v54]; | |
5535 *v46 = v117; | |
5536 *(v45 - 2) = v54; | |
5537 v46[1] = v55; | |
5538 v122 += v114; | |
5539 v125 += v113; | |
5540 v48 = v122; | |
5541 v49 = v125; | |
5542 v46 += 2; | |
5543 LABEL_47: | |
5544 v56 = (v128 & (v48 >> v50)) + ((v126 & v49) >> v51); | |
5545 v57 = v123 + v115; | |
5546 v58 = v116[v56]; | |
5547 v115 = v57; | |
5548 LOWORD(v58) = v47[((v57 & 0xFFFF0000u) >> 8) + v58]; | |
5549 v59 = v114; | |
5550 *(v45 - 1) = v58; | |
5551 v122 += v59; | |
5552 v125 += v113; | |
5553 v48 = v122; | |
5554 v49 = v125; | |
5555 } | |
5556 while ( (unsigned int)v45 < v121 ); | |
5557 pColorPixel = v45; | |
5558 pZPixel = v46; | |
5559 } | |
5560 } | |
5561 } | |
5562 k += 13; | |
5563 v5 = v108; | |
5564 v123 = v101; | |
5565 a1 += v134; | |
5566 if ( (unsigned int)pColorPixel >= v131 ) | |
5567 break; | |
5568 } | |
5569 v23 = v119; | |
5570 v24 = v120; | |
5571 } | |
5572 ++a2; | |
5573 v110 += v111; | |
5574 v23 += 640; | |
5575 v24 += 2; | |
5576 v120 = v24; | |
5577 v119 = v23; | |
5578 if ( a2 > stru_F8A590._viewport_space_w ) | |
5579 break; | |
5580 v21 = a2; | |
5581 } | |
5582 } | |
5583 return; | |
5584 } | |
5585 } | |
5586 } | |
5587 } | |
5588 } | |
5589 } | |
5590 } | |
5591 } | |
5592 //----- (00485E1F) -------------------------------------------------------- | |
5593 void *__fastcall sr_sub_485E1F(stru316 *a1, Span *a2, int a3, Polygon *a4, int a5, unsigned __int8 a6, char a7) | |
5594 { | |
5595 stru316 *v7; // esi@1 | |
5596 signed int *v8; // edi@1 | |
5597 signed int *v9; // ebx@1 | |
5598 char v10; // zf@1 | |
5599 int v11; // eax@1 | |
5600 Span *v12; // ecx@3 | |
5601 double v13; // ST24_8@3 | |
5602 double v14; // ST24_8@3 | |
5603 int v15; // eax@3 | |
5604 signed int v16; // ST14_4@4 | |
5605 char v17; // dl@4 | |
5606 signed int v18; // ST10_4@4 | |
5607 void *v19; // eax@4 | |
5608 signed int v20; // ST14_4@5 | |
5609 char v21; // dl@5 | |
5610 int v22; // ST10_4@5 | |
5611 signed int v23; // ST14_4@6 | |
5612 char v24; // dl@6 | |
5613 Span *v26; // [sp+10h] [bp-8h]@1 | |
5614 char v27; // [sp+16h] [bp-2h]@1 | |
5615 char v28; // [sp+17h] [bp-1h]@1 | |
5616 float v29; // [sp+30h] [bp+18h]@3 | |
5617 float v30; // [sp+30h] [bp+18h]@3 | |
5618 | |
5619 v7 = a1; | |
5620 v26 = a2; | |
5621 v8 = &a1->field_C; | |
5622 v9 = &a1->field_8; | |
5623 v10 = a1->field_0 == 0; | |
5624 v27 = a1->field_4 != 0; | |
5625 v28 = !v10; | |
5626 sr_sub_47BEB1(a3, a4, a5, 0, &a1->field_8, &a1->field_C, (int)&v27, (int)&v28); | |
5627 v7->field_24_palette = (unsigned __int16 *)sr_sub_47C28C_get_palette(a4, v28, *v9, *v8); | |
5628 v11 = a4->field_108; | |
5629 v7->field_20 = v11; | |
5630 if ( v11 ) | |
5631 { | |
5632 if ( a7 ) | |
5633 { | |
5634 v12 = v26; | |
5635 v29 = v26->field_10 * 31.0; | |
5636 v13 = v29 + 6.7553994e15; | |
5637 v7->field_10 = LODWORD(v13) << 16; | |
5638 v30 = v12->field_14 * 31.0; | |
5639 v14 = v30 + 6.7553994e15; | |
5640 v15 = v7->field_10; | |
5641 v7->field_14 = LODWORD(v14) << 16; | |
5642 v7->field_18 = -((v15 - (LODWORD(v14) << 16)) / v12->field_C); | |
5643 } | |
5644 v16 = *v8; | |
5645 v17 = v28; | |
5646 v18 = *v9; | |
5647 v7->field_1C = a6; | |
5648 v19 = sr_sub_47C28C_get_palette(a4, v17, v18, v16); | |
5649 } | |
5650 else | |
5651 { | |
5652 v20 = *v8; | |
5653 v21 = v28; | |
5654 v7->field_10 = 0; | |
5655 v7->field_14 = 0; | |
5656 v22 = *v9; | |
5657 v7->field_18 = 0; | |
5658 v7->field_1C = 0; | |
5659 v19 = sr_sub_47C1CA(a4, v21, v22, v20); | |
5660 } | |
5661 v23 = *v8; | |
5662 v24 = v28; | |
5663 v7->field_24_palette = (unsigned __int16 *)v19; | |
5664 return sr_sub_47C1CA(a4, v24, *v9, v23); | |
5665 } | |
5666 | |
5667 //----- (00486F92) -------------------------------------------------------- | |
5668 void __cdecl sr_sub_486F92_MessWithEdgesAndSpans() | |
5669 { | |
5670 Span *v0; // ebx@1 | |
5671 int v1; // eax@2 | |
5672 Edge *v2; // ecx@3 | |
5673 Edge *v3; // edx@3 | |
5674 Edge *v4; // esi@6 | |
5675 Edge *v5; // eax@7 | |
5676 Edge *v6; // ecx@8 | |
5677 Surf *v7; // esi@11 | |
5678 double v8; // st7@13 | |
5679 Surf *v9; // edi@13 | |
5680 double v10; // st6@13 | |
5681 double v11; // st7@14 | |
5682 signed __int64 v12; // qax@14 | |
5683 Polygon *v13; // eax@15 | |
5684 Span *v14; // ecx@17 | |
5685 double v15; // st7@28 | |
5686 signed __int64 v16; // qax@28 | |
5687 Polygon *v17; // eax@29 | |
5688 Span *v18; // ecx@31 | |
5689 Edge *i; // eax@40 | |
5690 Edge *v20; // ecx@43 | |
5691 Edge *v21; // esi@44 | |
5692 double v22; // st7@45 | |
5693 Edge *v23; // edx@48 | |
5694 unsigned int v24; // [sp+10h] [bp-10h]@2 | |
5695 float v25; // [sp+14h] [bp-Ch]@3 | |
5696 Edge *v26; // [sp+18h] [bp-8h]@8 | |
5697 unsigned int v27; // [sp+1Ch] [bp-4h]@1 | |
5698 | |
5699 v0 = pSpans; | |
5700 stru_80C9D8.pSurf = &stru_80C980; | |
5701 stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportTL_X; | |
5702 stru_80C9A4.pSurf = &stru_80C980; | |
5703 stru_80C980.pPrev = &stru_80C980; | |
5704 stru_80C980.pNext = &stru_80C980; | |
5705 stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportBR_X; | |
5706 stru_80C980.field_8 = 0.0; | |
5707 stru_80C980.field_4 = 0.0; | |
5708 stru_80C9D8.pNext = &stru_80C9A4; | |
5709 stru_80C9D8.pPrev = 0; | |
5710 stru_80C9D8.field_8 = 1; | |
5711 stru_80C9A4.pNext = 0; | |
5712 stru_80C9A4.pPrev = &stru_80C9D8; | |
5713 stru_80C9A4.field_8 = 0; | |
5714 LODWORD(stru_80C980.field_0) = 0xC97423F0u; | |
5715 v27 = pViewport->uViewportTL_Y; | |
5716 if ( (signed int)pViewport->uViewportTL_Y > (signed int)pViewport->uViewportBR_Y ) | |
5717 { | |
5718 LABEL_51: | |
5719 v0->field_8 = -1; | |
5720 } | |
5721 else | |
5722 { | |
5723 v1 = 52 * pViewport->uViewportTL_Y; | |
5724 v24 = 52 * pViewport->uViewportTL_Y; | |
5725 while ( 1 ) | |
5726 { | |
5727 v2 = *(Edge **)((char *)&pNewEdges->pNext + v1); | |
5728 v3 = &stru_80C9D8; | |
5729 v25 = (double)(signed int)v27; | |
5730 if ( v2 != &defaultEdge ) | |
5731 { | |
5732 do | |
5733 { | |
5734 while ( 1 ) | |
5735 { | |
5736 v4 = v3->pNext; | |
5737 if ( v2->field_0 <= (double)v4->field_0 ) | |
5738 break; | |
5739 v3 = v3->pNext; | |
5740 } | |
5741 v5 = v2->pNext; | |
5742 v2->pNext = v4; | |
5743 v2->pPrev = v3; | |
5744 v3->pNext->pPrev = v2; | |
5745 v3->pNext = v2; | |
5746 v3 = v2; | |
5747 v2 = v5; | |
5748 } | |
5749 while ( v5 != &defaultEdge ); | |
5750 } | |
5751 v6 = stru_80C9D8.pNext; | |
5752 stru_80C980.field_20 = 0; | |
5753 stru_80C980.field_22 = 1; | |
5754 v26 = stru_80C9D8.pNext; | |
5755 if ( stru_80C9D8.pNext ) | |
5756 { | |
5757 while ( 1 ) | |
5758 { | |
5759 v7 = v6->pSurf; | |
5760 if ( v6->field_8 ) | |
5761 { | |
5762 ++v7->field_22; | |
5763 if ( v7->field_22 == 1 ) | |
5764 { | |
5765 v8 = v6->field_0 + 2.0; | |
5766 v9 = stru_80C980.pNext; | |
5767 v10 = (v8 - v7->field_C) * v7->field_4 + (v25 - v7->field_10) * v7->field_8 + v7->field_0; | |
5768 if ( v10 <= (v8 - stru_80C980.pNext->field_C) * stru_80C980.pNext->field_4 | |
5769 + (v25 - stru_80C980.pNext->field_10) * stru_80C980.pNext->field_8 | |
5770 + stru_80C980.pNext->field_0 ) | |
5771 { | |
5772 do | |
5773 v9 = v9->pNext; | |
5774 while ( v10 <= (v8 - v9->field_C) * v9->field_4 + (v25 - v9->field_10) * v9->field_8 + v9->field_0 ); | |
5775 v7->pNext = v9; | |
5776 v7->pPrev = v9->pPrev; | |
5777 v9->pPrev->pNext = v7; | |
5778 v9->pPrev = v7; | |
5779 } | |
5780 else | |
5781 { | |
5782 v11 = v6->field_0 + 0.5; | |
5783 v12 = (signed __int64)(v11 - (double)stru_80C980.pNext->field_20); | |
5784 v0->field_C = v12; | |
5785 if ( (signed __int16)v12 > 0 ) | |
5786 { | |
5787 v0->field_A = v27; | |
5788 v0->field_8 = v9->field_20; | |
5789 v13 = v9->pParent; | |
5790 v0->pParent = v13; | |
5791 if ( v13 ) | |
5792 { | |
5793 if ( v13->prolly_head ) | |
5794 { | |
5795 v14 = v13->prolly_tail; | |
5796 if ( !v14 ) | |
5797 return; | |
5798 v14->pNext = v0; | |
5799 } | |
5800 else | |
5801 { | |
5802 v13->prolly_head = v0; | |
5803 } | |
5804 v13->prolly_tail = v0; | |
5805 } | |
5806 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
5807 return; | |
5808 ++v0; | |
5809 ++pOutdoorCamera->uNumSpans; | |
5810 } | |
5811 v6 = v26; | |
5812 v7->field_20 = (signed __int64)v11; | |
5813 v7->pNext = v9; | |
5814 v9->pPrev = v7; | |
5815 stru_80C980.pNext = v7; | |
5816 v7->pPrev = &stru_80C980; | |
5817 } | |
5818 } | |
5819 } | |
5820 else | |
5821 { | |
5822 --v7->field_22; | |
5823 if ( !v7->field_22 ) | |
5824 { | |
5825 if ( stru_80C980.pNext == v7 ) | |
5826 { | |
5827 v15 = v6->field_0 + 0.5; | |
5828 v16 = (signed __int64)(v15 - (double)v7->field_20); | |
5829 v0->field_C = v16; | |
5830 if ( (signed __int16)v16 > 0 ) | |
5831 { | |
5832 v0->field_A = v27; | |
5833 v0->field_8 = v7->field_20; | |
5834 v17 = v7->pParent; | |
5835 v0->pParent = v17; | |
5836 if ( v17 ) | |
5837 { | |
5838 if ( v17->prolly_head ) | |
5839 { | |
5840 v18 = v17->prolly_tail; | |
5841 if ( !v18 ) | |
5842 return; | |
5843 v18->pNext = v0; | |
5844 } | |
5845 else | |
5846 { | |
5847 v17->prolly_head = v0; | |
5848 } | |
5849 v17->prolly_tail = v0; | |
5850 } | |
5851 if ( (signed int)pOutdoorCamera->uNumSpans >= 12499 ) | |
5852 return; | |
5853 ++v0; | |
5854 ++pOutdoorCamera->uNumSpans; | |
5855 } | |
5856 v7->pNext->field_20 = (signed __int64)v15; | |
5857 v6 = v26; | |
5858 } | |
5859 v7->pNext->pPrev = v7->pPrev; | |
5860 v7->pPrev->pNext = v7->pNext; | |
5861 } | |
5862 } | |
5863 v26 = v6->pNext; | |
5864 if ( !v26 ) | |
5865 break; | |
5866 v6 = v6->pNext; | |
5867 } | |
5868 } | |
5869 for ( i = ptr_80CA10[v27]; i; i = i->ptr_18 ) | |
5870 { | |
5871 i->pPrev->pNext = i->pNext; | |
5872 i->pNext->pPrev = i->pPrev; | |
5873 } | |
5874 v20 = stru_80C9D8.pNext; | |
5875 if ( stru_80C9D8.pNext != &stru_80C9A4 ) | |
5876 break; | |
5877 LABEL_50: | |
5878 ++v27; | |
5879 v1 = v24 + 52; | |
5880 v24 += 52; | |
5881 if ( (signed int)v27 > (signed int)pViewport->uViewportBR_Y ) | |
5882 goto LABEL_51; | |
5883 } | |
5884 while ( 1 ) | |
5885 { | |
5886 v21 = v20->pNext; | |
5887 if ( !v21 ) | |
5888 break; | |
5889 v22 = v20->field_4 + v20->field_0; | |
5890 v20->field_0 = v22; | |
5891 if ( v22 < stru_80C9D8.field_0 ) | |
5892 v20->field_0 = stru_80C9D8.field_0 + 0.0000001; | |
5893 while ( 1 ) | |
5894 { | |
5895 v23 = v20->pPrev; | |
5896 if ( v20->field_0 >= (double)v23->field_0 ) | |
5897 break; | |
5898 v23->pNext = v20->pNext; | |
5899 v20->pNext->pPrev = v23; | |
5900 v23->pPrev->pNext = v20; | |
5901 v20->pPrev = v23->pPrev; | |
5902 v20->pNext = v23; | |
5903 v23->pPrev = v20; | |
5904 } | |
5905 v20 = v21; | |
5906 if ( v21 == &stru_80C9A4 ) | |
5907 goto LABEL_50; | |
5908 } | |
5909 } | |
5910 } | |
5911 | |
5912 //----- (00487355) -------------------------------------------------------- | |
5913 bool OutdoorCamera::_487355() | |
5914 { | |
5915 int v0; // esi@1 | |
5916 Polygon *v1; // edi@2 | |
5917 bool result; // eax@3 | |
5918 | |
5919 v0 = 0; | |
5920 if ( pOutdoorCamera->uNumPolygons > 0 ) | |
5921 { | |
5922 v1 = array_77EC08.data(); | |
5923 do | |
5924 { | |
5925 result = pGame->pLightmapBuilder->_45D3C7(v1); | |
5926 ++v0; | |
5927 ++v1; | |
5928 } | |
5929 while ( v0 < pOutdoorCamera->uNumPolygons ); | |
5930 } | |
5931 return result; | |
5932 } | |
5933 | |
5934 //----- (00479332) -------------------------------------------------------- | |
5935 int Render::OnOutdoorRedrawSW() | |
5936 { | |
5937 signed int result; // eax@1 | |
5938 unsigned int v1; // edi@1 | |
5939 char *v2; // esi@2 | |
5940 char v3; // cl@3 | |
5941 double v4; // st7@4 | |
5942 float v5; // ST34_4@6 | |
5943 double v6; // ST24_8@6 | |
5944 int v7; // eax@6 | |
5945 unsigned int v8; // eax@11 | |
5946 signed int v9; // eax@13 | |
5947 Vec3_float_ *v10; // eax@14 | |
5948 double v11; // st7@17 | |
5949 float v12; // ST34_4@19 | |
5950 double v13; // ST1C_8@19 | |
5951 float v14; // [sp+4h] [bp-34h]@1 | |
5952 float v15; // [sp+8h] [bp-30h]@1 | |
5953 float v16; // [sp+Ch] [bp-2Ch]@1 | |
5954 | |
5955 v14 = (double)pOutdoor->vSunlight.x / 65536.0; | |
5956 result = 0; | |
5957 v1 = (unsigned int)&array_77EC08[pOutdoorCamera->uNumPolygons]; | |
5958 v15 = (double)pOutdoor->vSunlight.y / 65536.0; | |
5959 v16 = (double)pOutdoor->vSunlight.z / 65536.0; | |
5960 if ( v1 > (unsigned int)array_77EC08.data() ) | |
5961 { | |
5962 v2 = (char *)&array_77EC08[0].pODMFace; | |
5963 while ( 1 ) | |
5964 { | |
5965 v3 = v2[5]; | |
5966 if ( v3 == 5 ) | |
5967 break; | |
5968 if ( v3 == 1 ) | |
5969 { | |
5970 v9 = pTerrainNormalIndices[((*((int *)v2 - 9) >> 15) & 1) | |
5971 + 2 * ((unsigned __int8)v2[9] + ((unsigned __int8)v2[8] << 7))]; | |
5972 if ( v9 > (signed int)(uNumTerrainNormals - 1) ) | |
5973 v10 = 0; | |
5974 else | |
5975 v10 = &pTerrainNormals[v9]; | |
5976 if ( v10 ) | |
5977 { | |
5978 v11 = -(v16 * v10->z + v15 * v10->y + v14 * v10->x); | |
5979 if ( v11 < 0.0 ) | |
5980 v11 = 0.0; | |
5981 v12 = v11 * 31.0; | |
5982 v13 = v12 + 6.7553994e15; | |
5983 v2[4] = 31 - LOBYTE(v13); | |
5984 } | |
5985 else | |
5986 { | |
5987 v2[4] = 0; | |
5988 } | |
5989 if ( v2[4] < 0 ) | |
5990 v2[4] = 0; | |
5991 goto LABEL_23; | |
5992 } | |
5993 LABEL_24: | |
5994 v2 += 268; | |
5995 if ( (unsigned int)(v2 - 84) >= v1 ) | |
5996 return result; | |
5997 } | |
5998 v4 = (double)(signed int)(((unsigned __int64)(**(int **)v2 * (signed __int64)-pOutdoor->vSunlight.x) >> 16) | |
5999 + ((unsigned __int64)(*(int *)(*(int *)v2 + 4) * (signed __int64)-pOutdoor->vSunlight.y) >> 16) | |
6000 + ((unsigned __int64)(*(int *)(*(int *)v2 + 8) * (signed __int64)-pOutdoor->vSunlight.z) >> 16)) | |
6001 * 0.000015258789; | |
6002 if ( v4 < 0.0 ) | |
6003 v4 = 0.0; | |
6004 v5 = v4 * 31.0; | |
6005 v6 = v5 + 6.7553994e15; | |
6006 v7 = (int)(v2 + 4); | |
6007 v2[4] = 31 - LOBYTE(v6); | |
6008 if ( (char)(31 - LOBYTE(v6)) < 0 ) | |
6009 *(char *)v7 = 0; | |
6010 if ( *(char *)v7 > 31 ) | |
6011 *(char *)v7 = 31; | |
6012 if ( *(char *)(*(int *)v2 + 29) & 0x40 ) | |
6013 { | |
6014 v8 = pTextureFrameTable->GetFrameTexture( | |
6015 *((short *)v2 - 4), | |
6016 pEventTimer->uTotalGameTimeElapsed); | |
6017 *((int *)v2 - 6) = v8 != -1 ? (int)&pBitmaps_LOD->pTextures[v8] : 0; | |
6018 } | |
6019 LABEL_23: | |
6020 result = 1; | |
6021 goto LABEL_24; | |
6022 } | |
6023 return result; | |
6024 } | |
6025 //----- (00485A24) -------------------------------------------------------- | |
6026 stru315 *__fastcall sr_sub_485A24(stru315 *a1, stru315 *a2) | |
6027 { | |
6028 stru315 *result; // eax@1 | |
6029 int i; // ecx@1 | |
6030 int v4; // ecx@2 | |
6031 int v5; // ecx@4 | |
6032 int v6; // ecx@6 | |
6033 int v7; // ecx@8 | |
6034 int v8; // esi@10 | |
6035 int v9; // ecx@10 | |
6036 int v10; // esi@11 | |
6037 int v11; // edi@11 | |
6038 int v12; // ebx@11 | |
6039 int v13; // ecx@16 | |
6040 unsigned __int16 *v14; // esi@18 | |
6041 unsigned int *v15; // ecx@20 | |
6042 int v16; // esi@20 | |
6043 int v17; // [sp+0h] [bp-4h]@10 | |
6044 | |
6045 result = a1; | |
6046 for ( i = a1->field_28; i; i = result->field_28 ) | |
6047 { | |
6048 result->field_28 = i - 1; | |
6049 v4 = result->field_18; | |
6050 if ( result->field_30 > v4 ) | |
6051 result->field_30 = v4; | |
6052 v5 = result->field_20; | |
6053 if ( result->field_2C > v5 ) | |
6054 result->field_2C = v5; | |
6055 v6 = result->field_14; | |
6056 if ( result->field_30 < v6 ) | |
6057 result->field_30 = v6; | |
6058 v7 = result->field_1C; | |
6059 if ( result->field_2C < v7 ) | |
6060 result->field_2C = v7; | |
6061 v8 = (result->field_C & HIWORD(result->field_30)) + ((result->field_2C & result->field_8) >> result->field_10); | |
6062 v9 = *((char *)result->pTextureLOD + v8); | |
6063 v17 = *((char *)result->pTextureLOD + v8); | |
6064 if ( a2->field_20 ) | |
6065 { | |
6066 v10 = HIWORD(a2->field_10); | |
6067 v11 = a2->field_C; | |
6068 v12 = v10; | |
6069 if ( v10 >= v11 ) | |
6070 v12 = a2->field_C; | |
6071 if ( a2->field_8 - v12 <= 0 ) | |
6072 { | |
6073 v13 = 0; | |
6074 } | |
6075 else | |
6076 { | |
6077 if ( v10 >= v11 ) | |
6078 v10 = a2->field_C; | |
6079 v13 = a2->field_8 - v10; | |
6080 } | |
6081 v14 = (unsigned __int16 *)a2->field_24; | |
6082 v9 = v17 + (v13 << 8); | |
6083 } | |
6084 else | |
6085 { | |
6086 v14 = result->field_34_palette; | |
6087 } | |
6088 *result->pColorBuffer = v14[v9]; | |
6089 v15 = result->pDepthBuffer; | |
6090 v16 = result->field_24; | |
6091 ++result->pColorBuffer; | |
6092 *v15 = v16; | |
6093 ++result->pDepthBuffer; | |
6094 a2->field_10 += a2->field_18; | |
6095 result->field_30 += result->field_4; | |
6096 result->field_2C += result->field_0; | |
6097 } | |
6098 --result->field_28; | |
6099 return result; | |
6100 } | |
6101 //----- (00485975) -------------------------------------------------------- | |
6102 stru315 *__fastcall sr_sub_485975(stru315 *a1, stru315 *a2) | |
6103 { | |
6104 stru315 *result; // eax@1 | |
6105 int i; // ecx@1 | |
6106 int v4; // esi@2 | |
6107 int v5; // esi@2 | |
6108 int v6; // ecx@2 | |
6109 int v7; // esi@3 | |
6110 int v8; // edi@3 | |
6111 int v9; // ebx@3 | |
6112 int v10; // ecx@8 | |
6113 unsigned __int16 *v11; // esi@10 | |
6114 unsigned int *v12; // ecx@12 | |
6115 int v13; // esi@12 | |
6116 int v14; // [sp+0h] [bp-4h]@2 | |
6117 | |
6118 result = a1; | |
6119 for ( i = a1->field_28; i; i = result->field_28 ) | |
6120 { | |
6121 v4 = result->field_8 & result->field_2C; | |
6122 result->field_28 = i - 1; | |
6123 v5 = (result->field_C & HIWORD(result->field_30)) + (v4 >> result->field_10); | |
6124 v6 = *((char *)result->pTextureLOD + v5); | |
6125 v14 = *((char *)result->pTextureLOD + v5); | |
6126 if ( a2->field_20 ) | |
6127 { | |
6128 v7 = HIWORD(a2->field_10); | |
6129 v8 = a2->field_C; | |
6130 v9 = v7; | |
6131 if ( v7 >= v8 ) | |
6132 v9 = a2->field_C; | |
6133 if ( a2->field_8 - v9 <= 0 ) | |
6134 { | |
6135 v10 = 0; | |
6136 } | |
6137 else | |
6138 { | |
6139 if ( v7 >= v8 ) | |
6140 v7 = a2->field_C; | |
6141 v10 = a2->field_8 - v7; | |
6142 } | |
6143 v11 = (unsigned __int16 *)a2->field_24; | |
6144 v6 = v14 + (v10 << 8); | |
6145 } | |
6146 else | |
6147 { | |
6148 v11 = result->field_34_palette; | |
6149 } | |
6150 *result->pColorBuffer = v11[v6]; | |
6151 v12 = result->pDepthBuffer; | |
6152 v13 = result->field_24; | |
6153 ++result->pColorBuffer; | |
6154 *v12 = v13; | |
6155 ++result->pDepthBuffer; | |
6156 a2->field_10 += a2->field_18; | |
6157 result->field_30 += result->field_4; | |
6158 result->field_2C += result->field_0; | |
6159 } | |
6160 --result->field_28; | |
6161 return result; | |
6162 } | |
6163 //----- (004839BD) -------------------------------------------------------- | |
6164 signed int __fastcall sr_sub_4839BD(Span *ecx0, unsigned __int16 *pTargetSurface) | |
6165 { | |
6166 stru315 *v2; // ebp@0 | |
6167 int v3; // eax@1 | |
6168 int v4; // edi@1 | |
6169 Polygon *v5; // esi@1 | |
6170 unsigned int v6; // ebx@1 | |
6171 int v7; // ecx@1 | |
6172 int v8; // ebx@1 | |
6173 int v9; // ecx@1 | |
6174 int v10; // eax@1 | |
6175 stru149 *v11; // eax@1 | |
6176 int v12; // edx@1 | |
6177 int v13; // eax@1 | |
6178 int v14; // edi@1 | |
6179 int v15; // ecx@1 | |
6180 int v16; // eax@1 | |
6181 signed int v17; // edi@1 | |
6182 int v18; // edi@2 | |
6183 signed __int64 v19; // qtt@3 | |
6184 int v20; // edi@3 | |
6185 unsigned __int16 *v21; // eax@3 | |
6186 Texture *v22; // eax@4 | |
6187 Texture *v23; // eax@6 | |
6188 Texture *v24; // eax@8 | |
6189 Texture *v25; // eax@10 | |
6190 stru149 *v26; // eax@13 | |
6191 int v27; // edi@13 | |
6192 signed int v28; // edx@13 | |
6193 Texture *v29; // ebx@13 | |
6194 int v30; // edi@13 | |
6195 signed int v31; // edx@13 | |
6196 signed int v32; // eax@13 | |
6197 signed int v33; // eax@13 | |
6198 int v34; // ebx@13 | |
6199 int v35; // eax@15 | |
6200 int v36; // ebx@15 | |
6201 int v37; // eax@16 | |
6202 signed __int64 v38; // qtt@17 | |
6203 int v39; // ecx@17 | |
6204 int v40; // eax@19 | |
6205 stru149 *v41; // eax@21 | |
6206 int v42; // ebx@21 | |
6207 int v43; // ebx@21 | |
6208 int v44; // eax@21 | |
6209 char v45; // zf@25 | |
6210 int v46; // eax@28 | |
6211 int v47; // eax@28 | |
6212 int v48; // ebx@28 | |
6213 int v49; // eax@29 | |
6214 signed __int64 v50; // qtt@30 | |
6215 int v51; // ecx@30 | |
6216 int v52; // eax@30 | |
6217 int v53; // edx@31 | |
6218 stru149 *v54; // eax@33 | |
6219 int v55; // ebx@33 | |
6220 signed int v56; // ebx@33 | |
6221 int v57; // eax@33 | |
6222 unsigned __int64 v58; // qax@33 | |
6223 int v60; // [sp+Ch] [bp-BCh]@1 | |
6224 Span *v61; // [sp+10h] [bp-B8h]@1 | |
6225 int v62; // [sp+14h] [bp-B4h]@2 | |
6226 int v63; // [sp+18h] [bp-B0h]@1 | |
6227 stru315 a1; // [sp+1Ch] [bp-ACh]@1 | |
6228 stru316 a2; // [sp+60h] [bp-68h]@13 | |
6229 int v66; // [sp+88h] [bp-40h]@13 | |
6230 int v67; // [sp+8Ch] [bp-3Ch]@1 | |
6231 int v68; // [sp+90h] [bp-38h]@13 | |
6232 int v69; // [sp+94h] [bp-34h]@3 | |
6233 int v70; // [sp+98h] [bp-30h]@1 | |
6234 int v71; // [sp+9Ch] [bp-2Ch]@1 | |
6235 int v72; // [sp+A0h] [bp-28h]@1 | |
6236 int v73; // [sp+A4h] [bp-24h]@13 | |
6237 int v74; // [sp+A8h] [bp-20h]@1 | |
6238 int v75; // [sp+ACh] [bp-1Ch]@3 | |
6239 int v76; // [sp+B0h] [bp-18h]@1 | |
6240 int v77; // [sp+B4h] [bp-14h]@1 | |
6241 int X; // [sp+B8h] [bp-10h]@1 | |
6242 int v79; // [sp+BCh] [bp-Ch]@21 | |
6243 int v80; // [sp+C0h] [bp-8h]@13 | |
6244 unsigned int v81; // [sp+C4h] [bp-4h]@1 | |
6245 | |
6246 v3 = ecx0->field_A; | |
6247 v4 = ecx0->field_8; | |
6248 v5 = ecx0->pParent; | |
6249 v6 = v4 + pRenderer->uTargetSurfacePitch * ecx0->field_A; | |
6250 v61 = ecx0; | |
6251 v7 = ecx0->field_C; | |
6252 a1.pColorBuffer = &pTargetSurface[v6]; | |
6253 v74 = v7; | |
6254 a1.pDepthBuffer = (unsigned int *)&pRenderer->pActiveZBuffer[v4 + 640 * v3]; | |
6255 v8 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v4); | |
6256 v9 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v3); | |
6257 v10 = v5->ptr_38->field_14; | |
6258 v76 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v4); | |
6259 v72 = v10; | |
6260 v81 = (unsigned __int64)(v10 * (signed __int64)v9) >> 16; | |
6261 v11 = v5->ptr_38; | |
6262 v12 = v81 + v11->field_C; | |
6263 v72 = v11->field_20; | |
6264 v67 = v12; | |
6265 v13 = ((unsigned __int64)(v72 * (signed __int64)v9) >> 16) + v5->ptr_38->field_18; | |
6266 v81 = v9; | |
6267 v70 = v13; | |
6268 v72 = v5->v_18.z; | |
6269 v81 = (unsigned __int64)(v72 * (signed __int64)v9) >> 16; | |
6270 v14 = v5->field_24; | |
6271 v15 = v81 + v5->v_18.x; | |
6272 v71 = v5->sTextureDeltaU << 16; | |
6273 v63 = v5->sTextureDeltaV << 16; | |
6274 v16 = v5->v_18.y; | |
6275 v17 = -v14; | |
6276 v60 = v15; | |
6277 v77 = v17; | |
6278 v81 = (unsigned __int64)(v76 * (signed __int64)v16) >> 16; | |
6279 X = v81 + v15; | |
6280 if ( !(v81 + v15) || (v62 = v17 >> 14, v18 = abs(v17 >> 14), v18 > abs(X)) ) | |
6281 return 0; | |
6282 LODWORD(v19) = v77 << 16; | |
6283 HIDWORD(v19) = v77 >> 16; | |
6284 v69 = v19 / X; | |
6285 v20 = v19 / X; | |
6286 v21 = (unsigned __int16 *)v5->pTexture->pLevelOfDetail2; | |
6287 a1.pTextureLOD = (unsigned __int16 *)v5->pTexture->pLevelOfDetail2; | |
6288 v75 = 2; | |
6289 if ( v20 >= mipmapping_building_mm1 << 16 ) | |
6290 { | |
6291 if ( v20 >= mipmapping_building_mm2 << 16 ) | |
6292 { | |
6293 if ( v20 >= mipmapping_building_mm3 << 16 ) | |
6294 { | |
6295 if ( bUseLoResSprites ) | |
6296 goto LABEL_12; | |
6297 v25 = v5->pTexture; | |
6298 v75 = 3; | |
6299 v21 = (unsigned __int16 *)v25->pLevelOfDetail3; | |
6300 } | |
6301 else | |
6302 { | |
6303 v24 = v5->pTexture; | |
6304 v75 = 2; | |
6305 v21 = (unsigned __int16 *)v24->pLevelOfDetail2; | |
6306 } | |
6307 } | |
6308 else | |
6309 { | |
6310 v23 = v5->pTexture; | |
6311 v75 = 1; | |
6312 v21 = (unsigned __int16 *)v23->pLevelOfDetail1; | |
6313 } | |
6314 } | |
6315 else | |
6316 { | |
6317 v22 = v5->pTexture; | |
6318 v75 = 0; | |
6319 v21 = (unsigned __int16 *)v22->pLevelOfDetail0_prolly_alpha_mask; | |
6320 } | |
6321 a1.pTextureLOD = v21; | |
6322 LABEL_12: | |
6323 if ( v21 ) | |
6324 { | |
6325 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v61, v20, v5, pOutdoorCamera->building_gamme, 1u, 1); | |
6326 a1.field_28 = 16; | |
6327 v66 = v74 >> 4; | |
6328 v81 = v8; | |
6329 v26 = v5->ptr_38; | |
6330 v72 = v74 - 16 * (v74 >> 4); | |
6331 v76 = v26->field_10; | |
6332 v81 = v8; | |
6333 v74 = v67 + ((unsigned __int64)(v76 * (signed __int64)v8) >> 16); | |
6334 v76 = v5->ptr_38->field_1C; | |
6335 v76 = v70 + ((unsigned __int64)(v76 * (signed __int64)v8) >> 16); | |
6336 v81 = (unsigned __int64)(v74 * (signed __int64)v20) >> 16; | |
6337 v27 = ((unsigned __int64)(v74 * (signed __int64)v20) >> 16) - v5->ptr_38->field_24; | |
6338 v81 = (unsigned __int64)(v76 * (signed __int64)v69) >> 16; | |
6339 v28 = v63 + ((unsigned __int64)(v76 * (signed __int64)v69) >> 16) - v5->ptr_38->field_28; | |
6340 v76 = v75 + bUseLoResSprites; | |
6341 v73 = v8 - 16 * pOutdoorCamera->int_fov_rad_inv; | |
6342 v29 = v5->pTexture; | |
6343 v30 = (v71 + v27) >> v76; | |
6344 v31 = v28 >> v76; | |
6345 v32 = (signed int)v29->uTextureWidth >> v75; | |
6346 v74 = (signed __int16)v75; | |
6347 v68 = v31; | |
6348 v80 = v32; | |
6349 v33 = (signed int)v29->uTextureHeight >> v75; | |
6350 v34 = v75 - v29->uWidthLn2; | |
6351 a1.field_8 = (v33 << 16) - 65536; | |
6352 v81 = 2 * pMiscTimer->uTotalGameTimeElapsed; | |
6353 a1.field_10 = v34 + 16; | |
6354 a1.field_C = v80 - 1; | |
6355 if ( v66 > 0 ) | |
6356 { | |
6357 v74 = v66; | |
6358 v66 = 12 - v75; | |
6359 do | |
6360 { | |
6361 v80 = v5->v_18.y; | |
6362 v35 = (unsigned __int64)(v80 * (signed __int64)v73) >> 16; | |
6363 v36 = v35 + v60; | |
6364 X = v35 + v60; | |
6365 if ( v35 + v60 && (v80 = abs(v62), v37 = abs(v36), v80 <= v37) ) | |
6366 { | |
6367 LODWORD(v38) = v77 << 16; | |
6368 HIDWORD(v38) = v77 >> 16; | |
6369 v80 = v38 / X; | |
6370 v39 = v38 / X; | |
6371 X = v38 / X; | |
6372 } | |
6373 else | |
6374 { | |
6375 X = 0x40000000u; | |
6376 v39 = 0x40000000u; | |
6377 } | |
6378 HIWORD(v40) = HIWORD(v39); | |
6379 if ( v39 <= v69 ) | |
6380 HIWORD(v40) = HIWORD(v69); | |
6381 LOWORD(v40) = 0; | |
6382 a1.field_24 = v5->field_50 | v40; | |
6383 v79 = v5->ptr_38->field_10; | |
6384 v79 = v67 + ((unsigned __int64)(v79 * (signed __int64)v73) >> 16); | |
6385 v80 = (unsigned __int64)(v79 * (signed __int64)v39) >> 16; | |
6386 v41 = v5->ptr_38; | |
6387 v42 = ((unsigned __int64)(v79 * (signed __int64)v39) >> 16) - v41->field_24; | |
6388 v79 = v41->field_1C; | |
6389 v79 = v70 + ((unsigned __int64)(v79 * (signed __int64)v73) >> 16); | |
6390 v80 = (unsigned __int64)(v79 * (signed __int64)v39) >> 16; | |
6391 v43 = (v71 + v42) >> v76; | |
6392 v79 = (signed int)(v63 + ((unsigned __int64)(v79 * (signed __int64)v39) >> 16) - v5->ptr_38->field_28) >> v76; | |
6393 a1.field_4 = (v43 - v30) >> 4; | |
6394 a1.field_0 = (v79 - v68) >> 4; | |
6395 a1.field_30 = v30 + 4 * stru_5C6E00->Cos(v81 + (v68 >> v66)); | |
6396 v44 = stru_5C6E00->Sin(v81 + (v30 >> v66)); | |
6397 a1.field_2C = v68 + 4 * v44; | |
6398 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
6399 sr_sub_485975(&a1, (stru315 *)&a2); | |
6400 else | |
6401 sr_sub_4D6FB0(v2); | |
6402 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v61, X, v5, pOutdoorCamera->building_gamme, 1u, 0); | |
6403 v73 -= 16 * pOutdoorCamera->int_fov_rad_inv; | |
6404 v45 = v74-- == 1; | |
6405 a1.field_28 = 16; | |
6406 v30 = v43; | |
6407 v68 = v79; | |
6408 } | |
6409 while ( !v45 ); | |
6410 v31 = v79; | |
6411 } | |
6412 if ( !v72 ) | |
6413 return 1; | |
6414 v66 = 12 - v75; | |
6415 a1.field_30 = v30 + 4 * stru_5C6E00->Cos(v81 + (v31 >> (12 - v75))); | |
6416 v46 = stru_5C6E00->Sin(v81 + (v30 >> v66)); | |
6417 a1.field_2C = v68 + 4 * v46; | |
6418 v79 = v5->v_18.y; | |
6419 v80 = (unsigned __int64)(v79 * (signed __int64)v73) >> 16; | |
6420 v47 = (unsigned __int64)(v79 * (signed __int64)v73) >> 16; | |
6421 v48 = v47 + v60; | |
6422 X = v47 + v60; | |
6423 if ( v47 + v60 ) | |
6424 { | |
6425 v79 = abs(v62); | |
6426 v49 = abs(v48); | |
6427 if ( v79 <= v49 ) | |
6428 { | |
6429 LODWORD(v50) = v77 << 16; | |
6430 HIDWORD(v50) = v77 >> 16; | |
6431 v77 = v50 / X; | |
6432 v51 = v50 / X; | |
6433 HIWORD(v52) = HIWORD(v69); | |
6434 if ( v51 <= v69 ) | |
6435 { | |
6436 LOWORD(v52) = 0; | |
6437 a1.field_24 = v52 | v5->field_50; | |
6438 } | |
6439 else | |
6440 { | |
6441 HIWORD(v53) = HIWORD(v51); | |
6442 LOWORD(v53) = 0; | |
6443 a1.field_24 = v53 | v5->field_50; | |
6444 } | |
6445 v79 = v5->ptr_38->field_10; | |
6446 v77 = (unsigned __int64)(v79 * (signed __int64)v73) >> 16; | |
6447 v79 = v67 + ((unsigned __int64)(v79 * (signed __int64)v73) >> 16); | |
6448 v67 = (unsigned __int64)(v79 * (signed __int64)v51) >> 16; | |
6449 v54 = v5->ptr_38; | |
6450 v55 = v67 - v54->field_24; | |
6451 v79 = v54->field_1C; | |
6452 v56 = v71 + v55; | |
6453 v71 = (unsigned __int64)(v79 * (signed __int64)v73) >> 16; | |
6454 v57 = v70 + ((unsigned __int64)(v79 * (signed __int64)v73) >> 16); | |
6455 v79 = v57; | |
6456 v58 = v57 * (signed __int64)v51; | |
6457 v70 = v58 >> 16; | |
6458 LODWORD(v58) = (signed int)(v63 + (v58 >> 16) - v5->ptr_38->field_28) >> v76; | |
6459 a1.field_4 = ((v56 >> v76) - v30) >> 4; | |
6460 a1.field_0 = ((signed int)v58 - v68) >> 4; | |
6461 a1.field_28 = v72; | |
6462 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
6463 sr_sub_485975(&a1, (stru315 *)&a2); | |
6464 else | |
6465 sr_sub_4D6FB0(v2); | |
6466 return 1; | |
6467 } | |
6468 } | |
6469 } | |
6470 return 0; | |
6471 } | |
6472 | |
6473 //----- (0048408A) -------------------------------------------------------- | |
6474 signed int sr_sub_48408A_prolly_odm_water_no_waves(Span *_this) | |
6475 { | |
6476 stru315 *v1; // ebp@0 | |
6477 Span *v2; // edi@1 | |
6478 Polygon *v3; // esi@1 | |
6479 int v4; // ecx@1 | |
6480 stru149 *v5; // eax@1 | |
6481 stru149 *v6; // eax@1 | |
6482 int v7; // edx@1 | |
6483 int v8; // eax@1 | |
6484 int v9; // ebx@1 | |
6485 int v10; // eax@1 | |
6486 int v11; // ecx@1 | |
6487 int v12; // eax@1 | |
6488 int v13; // ecx@1 | |
6489 int v14; // eax@1 | |
6490 signed int v15; // ecx@1 | |
6491 int v16; // ebx@1 | |
6492 signed __int64 v17; // qtt@3 | |
6493 stru149 *v18; // eax@3 | |
6494 int v19; // ebx@3 | |
6495 Texture *v20; // eax@4 | |
6496 unsigned __int16 *v21; // eax@4 | |
6497 Texture *v22; // eax@6 | |
6498 Texture *v23; // ecx@8 | |
6499 Texture *v24; // eax@10 | |
6500 stru149 *v25; // eax@12 | |
6501 signed int v26; // eax@12 | |
6502 int v27; // ecx@12 | |
6503 int v28; // eax@14 | |
6504 int v29; // edx@14 | |
6505 int v30; // ecx@14 | |
6506 Texture *v31; // esi@14 | |
6507 int v32; // edx@14 | |
6508 int v33; // eax@14 | |
6509 int v35; // [sp+Ch] [bp-8Ch]@1 | |
6510 int v36; // [sp+10h] [bp-88h]@1 | |
6511 stru316 a2; // [sp+14h] [bp-84h]@14 | |
6512 stru315 a1; // [sp+3Ch] [bp-5Ch]@1 | |
6513 int v39; // [sp+80h] [bp-18h]@1 | |
6514 int v40; // [sp+84h] [bp-14h]@1 | |
6515 int v41; // [sp+88h] [bp-10h]@1 | |
6516 int v42; // [sp+8Ch] [bp-Ch]@1 | |
6517 int v43; // [sp+90h] [bp-8h]@2 | |
6518 int v44; // [sp+94h] [bp-4h]@1 | |
6519 | |
6520 v2 = _this; | |
6521 v3 = _this->pParent; | |
6522 v4 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - _this->field_A); | |
6523 v5 = v3->ptr_38; | |
6524 v44 = v4; | |
6525 v42 = v5->field_14; | |
6526 v44 = (unsigned __int64)(v42 * (signed __int64)v4) >> 16; | |
6527 v6 = v3->ptr_38; | |
6528 v7 = v44 + v6->field_C; | |
6529 v42 = v6->field_20; | |
6530 v39 = v7; | |
6531 v8 = ((unsigned __int64)(v42 * (signed __int64)v4) >> 16) + v3->ptr_38->field_18; | |
6532 v44 = v4; | |
6533 v41 = v8; | |
6534 v42 = v3->v_18.z; | |
6535 v44 = (unsigned __int64)(v42 * (signed __int64)v4) >> 16; | |
6536 v9 = v44 + v3->v_18.x; | |
6537 v35 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); | |
6538 v10 = stru_5C6E00->Cos(pIndoorCamera->sRotationY); | |
6539 v11 = v2->field_8; | |
6540 v36 = v10; | |
6541 a1.field_28 = v2->field_C; | |
6542 v12 = pViewport->uScreenCenterX - v11; | |
6543 v13 = v3->field_24; | |
6544 v42 = pOutdoorCamera->int_fov_rad_inv * v12; | |
6545 v14 = v3->v_18.y; | |
6546 v15 = -v13; | |
6547 v40 = v15; | |
6548 v16 = ((unsigned __int64)(v42 * (signed __int64)v14) >> 16) + v9; | |
6549 v44 = v16; | |
6550 if ( !v16 || (v43 = abs(v15 >> 14), v43 > abs(v16)) ) | |
6551 return 0; | |
6552 LODWORD(v17) = v40 << 16; | |
6553 HIDWORD(v17) = v40 >> 16; | |
6554 v43 = v17 / v44; | |
6555 v18 = v3->ptr_38; | |
6556 v44 = v42; | |
6557 v40 = v18->field_10; | |
6558 v44 = v42; | |
6559 v40 = v39 + ((unsigned __int64)(v40 * (signed __int64)v42) >> 16); | |
6560 v39 = v3->ptr_38->field_1C; | |
6561 v44 = (unsigned __int64)(v39 * (signed __int64)v42) >> 16; | |
6562 v19 = v43; | |
6563 v41 += (unsigned __int64)(v39 * (signed __int64)v42) >> 16; | |
6564 a1.pTextureLOD = (unsigned __int16 *)v3->pTexture->pLevelOfDetail2; | |
6565 v44 = 2; | |
6566 if ( v43 < mipmapping_terrain_mm1 << 16 ) | |
6567 { | |
6568 v20 = v3->pTexture; | |
6569 v44 = 0; | |
6570 v21 = (unsigned __int16 *)v20->pLevelOfDetail0_prolly_alpha_mask; | |
6571 LABEL_11: | |
6572 a1.pTextureLOD = v21; | |
6573 goto LABEL_12; | |
6574 } | |
6575 if ( v43 < mipmapping_terrain_mm2 << 16 ) | |
6576 { | |
6577 v22 = v3->pTexture; | |
6578 v44 = 1; | |
6579 v21 = (unsigned __int16 *)v22->pLevelOfDetail1; | |
6580 goto LABEL_11; | |
6581 } | |
6582 if ( v43 >= mipmapping_terrain_mm3 << 16 ) | |
6583 { | |
6584 if ( !bUseLoResSprites ) | |
6585 { | |
6586 v24 = v3->pTexture; | |
6587 v44 = 3; | |
6588 v21 = (unsigned __int16 *)v24->pLevelOfDetail3; | |
6589 goto LABEL_11; | |
6590 } | |
6591 } | |
6592 else | |
6593 { | |
6594 v23 = v3->pTexture; | |
6595 v44 = 2; | |
6596 a1.pTextureLOD = (unsigned __int16 *)v23->pLevelOfDetail2; | |
6597 } | |
6598 LABEL_12: | |
6599 v43 = (unsigned __int64)(v40 * (signed __int64)v43) >> 16; | |
6600 v25 = v3->ptr_38; | |
6601 v43 = v19; | |
6602 a1.field_30 = ((unsigned __int64)(v40 * (signed __int64)v19) >> 16) - v25->field_24; | |
6603 v43 = (unsigned __int64)(v41 * (signed __int64)v19) >> 16; | |
6604 v26 = ((unsigned __int64)(v41 * (signed __int64)v19) >> 16) - v3->ptr_38->field_28; | |
6605 v27 = bUseLoResSprites + v44 + 2; | |
6606 a1.field_30 >>= v27; | |
6607 v41 = bUseLoResSprites + v44 + 2; | |
6608 a1.field_2C = v26 >> v27; | |
6609 if ( byte_80AA10 ) | |
6610 { | |
6611 a1.field_14 = dword_80AA20 >> v27; | |
6612 a1.field_18 = dword_80AA1C >> v27; | |
6613 a1.field_1C = dword_80AA18 >> v27; | |
6614 a1.field_20 = dword_80AA14 >> v27; | |
6615 } | |
6616 v41 = pOutdoorCamera->int_fov_rad_inv; | |
6617 v42 = (signed int)((unsigned __int64)(pOutdoorCamera->int_fov_rad_inv * (signed __int64)v19) >> 16) >> v27; | |
6618 a1.field_4 = (unsigned __int64)(v42 * (signed __int64)v35) >> 16; | |
6619 v43 = (unsigned __int64)(v42 * (signed __int64)v36) >> 16; | |
6620 a1.field_0 = (unsigned __int64)(v42 * (signed __int64)v36) >> 16; | |
6621 a1.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v2, v19, v3, pOutdoorCamera->terrain_gamma, 1u, 1); | |
6622 LOWORD(v19) = 0; | |
6623 v28 = v2->field_A; | |
6624 v29 = v2->field_A; | |
6625 a1.field_24 = v19; | |
6626 v30 = v2->field_8; | |
6627 a1.pColorBuffer = &pRenderer->pTargetSurface[v30 + pRenderer->uTargetSurfacePitch * v29]; | |
6628 a1.pDepthBuffer = (unsigned int *)&pRenderer->pActiveZBuffer[v30 + 640 * v28]; | |
6629 v31 = v3->pTexture; | |
6630 v32 = ((signed int)v31->uTextureWidth >> v44) - 1; | |
6631 v33 = ((signed int)v31->uTextureHeight >> v44 << 16) - 65536; | |
6632 a1.field_10 = v44 - v31->uWidthLn2 + 16; | |
6633 a1.field_C = v32; | |
6634 a1.field_8 = v33; | |
6635 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
6636 { | |
6637 if ( byte_80AA10 ) | |
6638 sr_sub_485A24(&a1, (stru315 *)&a2); | |
6639 else | |
6640 sr_sub_485975(&a1, (stru315 *)&a2); | |
6641 } | |
6642 else | |
6643 { | |
6644 if ( byte_80AA10 ) | |
6645 sr_sub_4D705A(v1); | |
6646 else | |
6647 sr_sub_4D6FB0(v1); | |
6648 } | |
6649 return 1; | |
6650 } | |
6651 | |
6652 //----- (00484442) -------------------------------------------------------- | |
6653 signed int sr_sub_484442(Span *_this) | |
6654 { | |
6655 int v1; // ebp@0 | |
6656 Span *v2; // edi@1 | |
6657 Polygon *v3; // esi@1 | |
6658 int v4; // ecx@1 | |
6659 stru149 *v5; // eax@1 | |
6660 stru149 *v6; // eax@1 | |
6661 int v7; // edx@1 | |
6662 int v8; // eax@1 | |
6663 int v9; // ebx@1 | |
6664 int v10; // eax@1 | |
6665 int v11; // ecx@1 | |
6666 int v12; // eax@1 | |
6667 int v13; // ecx@1 | |
6668 signed int v14; // ecx@1 | |
6669 int v15; // ebx@1 | |
6670 signed __int64 v16; // qtt@3 | |
6671 int v17; // ecx@3 | |
6672 int v18; // ebx@3 | |
6673 int v19; // eax@3 | |
6674 signed int v20; // ebx@3 | |
6675 unsigned __int16 *v21; // eax@4 | |
6676 stru149 *v22; // eax@12 | |
6677 signed int v23; // eax@12 | |
6678 int v24; // ecx@12 | |
6679 int v25; // ecx@14 | |
6680 unsigned int *v26; // eax@14 | |
6681 Texture *v27; // esi@14 | |
6682 signed int v28; // edi@14 | |
6683 signed int v29; // eax@14 | |
6684 signed int v31; // [sp+Ch] [bp-90h]@1 | |
6685 int v32; // [sp+10h] [bp-8Ch]@1 | |
6686 int v33; // [sp+14h] [bp-88h]@1 | |
6687 stru316 v34; // [sp+18h] [bp-84h]@14 | |
6688 stru315 v35; // [sp+40h] [bp-5Ch]@1 | |
6689 int v36; // [sp+84h] [bp-18h]@1 | |
6690 int v37; // [sp+88h] [bp-14h]@1 | |
6691 int v38; // [sp+8Ch] [bp-10h]@1 | |
6692 int v39; // [sp+90h] [bp-Ch]@1 | |
6693 int v40; // [sp+94h] [bp-8h]@1 | |
6694 int v41; // [sp+98h] [bp-4h]@1 | |
6695 | |
6696 v2 = _this; | |
6697 v3 = _this->pParent; | |
6698 v4 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - _this->field_A); | |
6699 v5 = v3->ptr_38; | |
6700 v40 = v4; | |
6701 v39 = v5->field_14; | |
6702 v40 = (unsigned __int64)(v39 * (signed __int64)v4) >> 16; | |
6703 v6 = v3->ptr_38; | |
6704 v7 = v40 + v6->field_C; | |
6705 v39 = v6->field_20; | |
6706 v36 = v7; | |
6707 v8 = ((unsigned __int64)(v39 * (signed __int64)v4) >> 16) + v3->ptr_38->field_18; | |
6708 v40 = v4; | |
6709 v38 = v8; | |
6710 v39 = v3->v_18.z; | |
6711 v40 = (unsigned __int64)(v39 * (signed __int64)v4) >> 16; | |
6712 v9 = v40 + v3->v_18.x; | |
6713 v32 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); | |
6714 v10 = stru_5C6E00->Cos(pIndoorCamera->sRotationY); | |
6715 v11 = v2->field_8; | |
6716 v33 = v10; | |
6717 v35.field_28 = v2->field_C; | |
6718 v12 = pViewport->uScreenCenterX - v11; | |
6719 v13 = v3->field_24; | |
6720 v41 = pOutdoorCamera->int_fov_rad_inv * v12; | |
6721 v14 = -v13; | |
6722 v31 = v14; | |
6723 v15 = ((unsigned __int64)(pOutdoorCamera->int_fov_rad_inv * v12 * (signed __int64)v3->v_18.y) >> 16) + v9; | |
6724 v37 = v15; | |
6725 if ( !v15 || (v39 = abs(v14 >> 14), v39 > abs(v15)) ) | |
6726 return 0; | |
6727 LODWORD(v16) = v31 << 16; | |
6728 HIDWORD(v16) = v31 >> 16; | |
6729 v40 = v16 / v37; | |
6730 v17 = v16 / v37; | |
6731 v18 = v41; | |
6732 HIWORD(v19) = (unsigned int)(v16 / v37) >> 16; | |
6733 LOWORD(v19) = 0; | |
6734 v35.field_24 = v19; | |
6735 v37 = v36 + ((unsigned __int64)(v3->ptr_38->field_10 * (signed __int64)v41) >> 16); | |
6736 v36 = v3->ptr_38->field_1C; | |
6737 v41 = (unsigned __int64)(v36 * (signed __int64)v41) >> 16; | |
6738 v38 += (unsigned __int64)(v36 * (signed __int64)v18) >> 16; | |
6739 v20 = 2; | |
6740 v35.pTextureLOD = (unsigned __int16 *)v3->pTexture->pLevelOfDetail2; | |
6741 if ( v17 < mipmapping_terrain_mm1 << 16 ) | |
6742 { | |
6743 v20 = 0; | |
6744 v21 = (unsigned __int16 *)v3->pTexture->pLevelOfDetail0_prolly_alpha_mask; | |
6745 LABEL_11: | |
6746 v35.pTextureLOD = v21; | |
6747 goto LABEL_12; | |
6748 } | |
6749 if ( v17 < mipmapping_terrain_mm2 << 16 ) | |
6750 { | |
6751 v20 = 1; | |
6752 v21 = (unsigned __int16 *)v3->pTexture->pLevelOfDetail1; | |
6753 goto LABEL_11; | |
6754 } | |
6755 if ( v17 < mipmapping_terrain_mm3 << 16 ) | |
6756 { | |
6757 v21 = (unsigned __int16 *)v3->pTexture->pLevelOfDetail2; | |
6758 goto LABEL_11; | |
6759 } | |
6760 if ( !bUseLoResSprites ) | |
6761 { | |
6762 v20 = 3; | |
6763 v21 = (unsigned __int16 *)v3->pTexture->pLevelOfDetail3; | |
6764 goto LABEL_11; | |
6765 } | |
6766 LABEL_12: | |
6767 v41 = (unsigned __int64)(v37 * (signed __int64)v17) >> 16; | |
6768 v22 = v3->ptr_38; | |
6769 v41 = v17; | |
6770 v35.field_30 = ((unsigned __int64)(v37 * (signed __int64)v17) >> 16) - v22->field_24; | |
6771 v23 = ((unsigned __int64)(v38 * (signed __int64)v17) >> 16) - v3->ptr_38->field_28; | |
6772 v24 = bUseLoResSprites + v20 + 2; | |
6773 v35.field_30 >>= v24; | |
6774 v38 = bUseLoResSprites + v20 + 2; | |
6775 v35.field_2C = v23 >> v24; | |
6776 if ( byte_80AA10 ) | |
6777 { | |
6778 v35.field_14 = dword_80AA20 >> v24; | |
6779 v35.field_18 = dword_80AA1C >> v24; | |
6780 v35.field_1C = dword_80AA18 >> v24; | |
6781 v35.field_20 = dword_80AA14 >> v24; | |
6782 } | |
6783 v38 = pOutdoorCamera->int_fov_rad_inv; | |
6784 v39 = (signed int)((unsigned __int64)(pOutdoorCamera->int_fov_rad_inv * (signed __int64)v40) >> 16) >> v24; | |
6785 v35.field_4 = (unsigned __int64)(v39 * (signed __int64)v32) >> 16; | |
6786 v41 = (unsigned __int64)(v39 * (signed __int64)v33) >> 16; | |
6787 v35.field_0 = (unsigned __int64)(v39 * (signed __int64)v33) >> 16; | |
6788 v35.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&v34, v2, v40, v3, pOutdoorCamera->terrain_gamma, 1u, 1); | |
6789 v25 = v2->field_8; | |
6790 v26 = (unsigned int *)&pRenderer->pActiveZBuffer[v25 + 640 * v2->field_A]; | |
6791 v35.pColorBuffer = &pRenderer->pTargetSurface[v25 + pRenderer->uTargetSurfacePitch * v2->field_A]; | |
6792 v35.pDepthBuffer = v26; | |
6793 v27 = v3->pTexture; | |
6794 v28 = (signed int)v27->uTextureWidth >> v20; | |
6795 v29 = (signed int)v27->uTextureHeight >> v20; | |
6796 v35.field_10 = v20 - v27->uWidthLn2 + 16; | |
6797 v35.field_C = v28 - 1; | |
6798 v35.field_8 = (v29 << 16) - 65536; | |
6799 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
6800 { | |
6801 if ( byte_80AA10 ) | |
6802 sr_sub_485D3E(&v35, &v34); | |
6803 else | |
6804 sr_sub_485C89(&v35, &v34); | |
6805 } | |
6806 else | |
6807 { | |
6808 if ( byte_80AA10 ) | |
6809 sr_sub_4D72EC(v1); | |
6810 else | |
6811 sr_sub_4D73DF(v1); | |
6812 } | |
6813 return 1; | |
6814 } | |
6815 | |
6816 //----- (004847EB) -------------------------------------------------------- | |
6817 int sr_sub_4847EB(Span *_this) | |
6818 { | |
6819 stru315 *v1; // ebp@0 | |
6820 int v2; // ebx@1 | |
6821 int v3; // edx@1 | |
6822 Polygon *v4; // esi@1 | |
6823 int v5; // eax@1 | |
6824 signed int v6; // eax@3 | |
6825 int v7; // edi@3 | |
6826 stru149 *v8; // eax@3 | |
6827 stru149 *v9; // eax@3 | |
6828 int v10; // edx@3 | |
6829 int v11; // eax@3 | |
6830 signed int v12; // ebx@3 | |
6831 int v13; // ebx@4 | |
6832 signed __int64 v14; // qtt@5 | |
6833 int v15; // eax@5 | |
6834 signed int v16; // ebx@5 | |
6835 unsigned __int16 *v17; // ecx@6 | |
6836 stru149 *v18; // eax@14 | |
6837 stru149 *v19; // eax@14 | |
6838 signed int v20; // eax@14 | |
6839 int v21; // ecx@14 | |
6840 Texture *v22; // edx@16 | |
6841 signed int v23; // eax@16 | |
6842 int v24; // ebx@16 | |
6843 int v25; // edi@17 | |
6844 int v26; // ebx@17 | |
6845 int v27; // eax@17 | |
6846 int v28; // edi@17 | |
6847 int v29; // eax@18 | |
6848 signed __int64 v30; // qtt@19 | |
6849 int v31; // ecx@19 | |
6850 int v32; // eax@19 | |
6851 stru149 *v33; // eax@21 | |
6852 signed int v34; // edi@21 | |
6853 int v35; // ebx@21 | |
6854 signed int v36; // edi@21 | |
6855 signed __int64 v37; // qtt@21 | |
6856 signed int v38; // ebx@21 | |
6857 int v39; // ebx@29 | |
6858 int v40; // eax@32 | |
6859 unsigned __int64 v41; // qax@32 | |
6860 int v42; // edi@32 | |
6861 int v43; // eax@33 | |
6862 signed __int64 v44; // qtt@34 | |
6863 int v45; // ecx@34 | |
6864 int v46; // eax@34 | |
6865 stru149 *v47; // eax@36 | |
6866 signed int v48; // edi@36 | |
6867 int v49; // eax@36 | |
6868 int v50; // eax@47 | |
6869 unsigned __int64 v51; // qax@47 | |
6870 int v52; // edi@47 | |
6871 int v53; // eax@48 | |
6872 signed __int64 v54; // qtt@49 | |
6873 int v55; // ecx@49 | |
6874 int v56; // eax@49 | |
6875 stru149 *v57; // eax@51 | |
6876 signed int v58; // edi@51 | |
6877 int v59; // eax@51 | |
6878 Span *v61; // [sp+Ch] [bp-B0h]@1 | |
6879 int v62; // [sp+10h] [bp-ACh]@3 | |
6880 int v63; // [sp+14h] [bp-A8h]@3 | |
6881 int v64; // [sp+18h] [bp-A4h]@3 | |
6882 int v65; // [sp+1Ch] [bp-A0h]@3 | |
6883 signed int v66; // [sp+20h] [bp-9Ch]@3 | |
6884 signed int v67; // [sp+24h] [bp-98h]@3 | |
6885 int v68; // [sp+28h] [bp-94h]@1 | |
6886 char v69; // [sp+2Ch] [bp-90h]@1 | |
6887 stru315 sr; // [sp+30h] [bp-8Ch]@1 | |
6888 stru316 sr2; // [sp+74h] [bp-48h]@14 | |
6889 int v72; // [sp+9Ch] [bp-20h]@5 | |
6890 int v73; // [sp+A0h] [bp-1Ch]@1 | |
6891 int v74; // [sp+A4h] [bp-18h]@3 | |
6892 int v75; // [sp+A8h] [bp-14h]@21 | |
6893 int v76; // [sp+ACh] [bp-10h]@1 | |
6894 int v77; // [sp+B0h] [bp-Ch]@14 | |
6895 int v78; // [sp+B4h] [bp-8h]@3 | |
6896 int v79; // [sp+B8h] [bp-4h]@3 | |
6897 | |
6898 v2 = _this->field_A; | |
6899 v3 = _this->field_8; | |
6900 v4 = _this->pParent; | |
6901 v73 = 0; | |
6902 v61 = _this; | |
6903 sr.pDepthBuffer = (unsigned int *)&pRenderer->pActiveZBuffer[v3 + 640 * v2]; | |
6904 v76 = v3; | |
6905 v5 = _this->field_C; | |
6906 sr.pColorBuffer = &pRenderer->pTargetSurface[v3 + pRenderer->uTargetSurfacePitch * v2]; | |
6907 v68 = texmapping_terrain_subdivsize; | |
6908 v69 = texmapping_terrain_subdivpow2; | |
6909 if ( v5 >= texmapping_terrain_subdivsize ) | |
6910 v73 = texmapping_terrain_subdivsize - (v3 & (texmapping_terrain_subdivsize - 1)); | |
6911 v6 = v5 - v73; | |
6912 v67 = v6 >> texmapping_terrain_subdivpow2; | |
6913 v62 = v6 - (v6 >> texmapping_terrain_subdivpow2 << texmapping_terrain_subdivpow2); | |
6914 v7 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v76); | |
6915 v8 = v4->ptr_38; | |
6916 v79 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v76); | |
6917 v78 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2); | |
6918 v76 = v8->field_14; | |
6919 v78 = (unsigned __int64)(v76 * (signed __int64)(pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2))) >> 16; | |
6920 v9 = v4->ptr_38; | |
6921 v10 = v78 + v9->field_C; | |
6922 v76 = v9->field_20; | |
6923 v65 = v10; | |
6924 v11 = ((unsigned __int64)(v76 * (signed __int64)(pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2))) >> 16) | |
6925 + v4->ptr_38->field_18; | |
6926 v78 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2); | |
6927 v64 = v11; | |
6928 v76 = v4->v_18.z; | |
6929 v78 = (unsigned __int64)(v76 * (signed __int64)(pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2))) >> 16; | |
6930 v12 = -v4->field_24; | |
6931 v63 = v78 + v4->v_18.x; | |
6932 v66 = -v4->field_24; | |
6933 v78 = (unsigned __int64)(v79 * (signed __int64)v4->v_18.y) >> 16; | |
6934 v74 = v78 + v63; | |
6935 if ( !(v78 + v63) || (v76 = v12 >> 14, v13 = abs(v12 >> 14), v13 > abs(v74)) ) | |
6936 return 0; | |
6937 LODWORD(v14) = v66 << 16; | |
6938 HIDWORD(v14) = v66 >> 16; | |
6939 v72 = v14 / v74; | |
6940 sr.pTextureLOD = (unsigned __int16 *)v4->pTexture->pLevelOfDetail2; | |
6941 v15 = v14 / v74; | |
6942 v16 = 2; | |
6943 if ( v15 >= mipmapping_terrain_mm1 << 16 ) | |
6944 { | |
6945 if ( v15 >= mipmapping_terrain_mm2 << 16 ) | |
6946 { | |
6947 if ( v15 >= mipmapping_terrain_mm3 << 16 ) | |
6948 { | |
6949 if ( bUseLoResSprites ) | |
6950 goto LABEL_14; | |
6951 v16 = 3; | |
6952 v17 = (unsigned __int16 *)v4->pTexture->pLevelOfDetail3; | |
6953 } | |
6954 else | |
6955 { | |
6956 v17 = (unsigned __int16 *)v4->pTexture->pLevelOfDetail2; | |
6957 } | |
6958 } | |
6959 else | |
6960 { | |
6961 v16 = 1; | |
6962 v17 = (unsigned __int16 *)v4->pTexture->pLevelOfDetail1; | |
6963 } | |
6964 } | |
6965 else | |
6966 { | |
6967 v16 = 0; | |
6968 v17 = (unsigned __int16 *)v4->pTexture->pLevelOfDetail0_prolly_alpha_mask; | |
6969 } | |
6970 sr.pTextureLOD = v17; | |
6971 LABEL_14: | |
6972 sr.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&sr2, v61, v15, v4, pOutdoorCamera->terrain_gamma, 1u, 1); | |
6973 v18 = v4->ptr_38; | |
6974 v78 = v7; | |
6975 v79 = v18->field_10; | |
6976 v78 = v7; | |
6977 v77 = v65 + ((unsigned __int64)(v79 * (signed __int64)v7) >> 16); | |
6978 v79 = v4->ptr_38->field_1C; | |
6979 v79 = v64 + ((unsigned __int64)(v79 * (signed __int64)v7) >> 16); | |
6980 v78 = (unsigned __int64)(v77 * (signed __int64)v72) >> 16; | |
6981 v19 = v4->ptr_38; | |
6982 v78 = v72; | |
6983 sr.field_30 = ((unsigned __int64)(v77 * (signed __int64)v72) >> 16) - v19->field_24; | |
6984 v78 = (unsigned __int64)(v79 * (signed __int64)v72) >> 16; | |
6985 v20 = ((unsigned __int64)(v79 * (signed __int64)v72) >> 16) - v4->ptr_38->field_28; | |
6986 v21 = bUseLoResSprites + v16 + 2; | |
6987 sr.field_30 >>= v21; | |
6988 v78 = bUseLoResSprites + v16 + 2; | |
6989 sr.field_2C = v20 >> v21; | |
6990 if ( byte_80AA10 ) | |
6991 { | |
6992 sr.field_14 = dword_80AA20 >> v21; | |
6993 sr.field_18 = dword_80AA1C >> v21; | |
6994 sr.field_1C = dword_80AA18 >> v21; | |
6995 sr.field_20 = dword_80AA14 >> v21; | |
6996 } | |
6997 v22 = v4->pTexture; | |
6998 v79 = (signed int)v22->uTextureWidth >> v16; | |
6999 v23 = (signed int)v22->uTextureHeight >> v16; | |
7000 v24 = v16 - v22->uWidthLn2 + 16; | |
7001 sr.field_8 = (v23 << 16) - 65536; | |
7002 sr.field_10 = v24; | |
7003 sr.field_C = v79 - 1; | |
7004 if ( v73 ) | |
7005 { | |
7006 v25 = v7 - v73 * pOutdoorCamera->int_fov_rad_inv; | |
7007 v26 = v25; | |
7008 v77 = v4->v_18.y; | |
7009 v79 = v25; | |
7010 v27 = (unsigned __int64)(v77 * (signed __int64)v25) >> 16; | |
7011 v28 = v27 + v63; | |
7012 v74 = v27 + v63; | |
7013 if ( !(v27 + v63) || (v77 = abs(v76), v29 = abs(v28), v77 > v29) ) | |
7014 return 0; | |
7015 LODWORD(v30) = v66 << 16; | |
7016 HIDWORD(v30) = v66 >> 16; | |
7017 v77 = v30 / v74; | |
7018 v31 = v30 / v74; | |
7019 HIWORD(v32) = HIWORD(v72); | |
7020 if ( v72 <= v31 ) | |
7021 HIWORD(v32) = HIWORD(v31); | |
7022 LOWORD(v32) = 0; | |
7023 v77 = v26; | |
7024 sr.field_24 = v32; | |
7025 v74 = v4->ptr_38->field_10; | |
7026 v74 = v65 + ((unsigned __int64)(v74 * (signed __int64)v26) >> 16); | |
7027 v77 = (unsigned __int64)(v74 * (signed __int64)v31) >> 16; | |
7028 v33 = v4->ptr_38; | |
7029 v77 = v26; | |
7030 v34 = ((unsigned __int64)(v74 * (signed __int64)v31) >> 16) - v33->field_24; | |
7031 v74 = v33->field_1C; | |
7032 v74 = v64 + ((unsigned __int64)(v74 * (signed __int64)v26) >> 16); | |
7033 v77 = (unsigned __int64)(v74 * (signed __int64)v31) >> 16; | |
7034 v35 = (v77 - v4->ptr_38->field_28) >> v78; | |
7035 v74 = v73 << 16; | |
7036 v36 = (v34 >> v78) - sr.field_30; | |
7037 LODWORD(v37) = v36 << 16; | |
7038 HIDWORD(v37) = v36 >> 16; | |
7039 v38 = v35 - sr.field_2C; | |
7040 sr.field_4 = v37 / (v73 << 16); | |
7041 v75 = v73 << 16; | |
7042 LODWORD(v37) = v38 << 16; | |
7043 HIDWORD(v37) = v38 >> 16; | |
7044 v77 = v37 / (v73 << 16); | |
7045 sr.field_0 = v37 / (v73 << 16); | |
7046 sr.field_28 = v73; | |
7047 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
7048 { | |
7049 if ( byte_80AA10 ) | |
7050 sr_sub_485A24(&sr, (stru315 *)&sr2); | |
7051 else | |
7052 sr_sub_485975(&sr, (stru315 *)&sr2); | |
7053 } | |
7054 else | |
7055 { | |
7056 if ( byte_80AA10 ) | |
7057 sr_sub_4D705A(v1); | |
7058 else | |
7059 sr_sub_4D6FB0(v1); | |
7060 } | |
7061 v39 = v79 - (pOutdoorCamera->int_fov_rad_inv << v69); | |
7062 } | |
7063 else | |
7064 { | |
7065 v79 = v7 - (pOutdoorCamera->int_fov_rad_inv << v69); | |
7066 v39 = v7 - (pOutdoorCamera->int_fov_rad_inv << v69); | |
7067 } | |
7068 sr.field_28 = v68; | |
7069 while ( v67 > 0 ) | |
7070 { | |
7071 v40 = v4->v_18.y; | |
7072 --v67; | |
7073 v75 = v40; | |
7074 v41 = v40 * (signed __int64)v39; | |
7075 v79 = v41 >> 16; | |
7076 LODWORD(v41) = v41 >> 16; | |
7077 v42 = v41 + v63; | |
7078 v74 = v41 + v63; | |
7079 if ( !((int)v41 + v63) || (v75 = abs(v76), v43 = abs(v42), v75 > v43) ) | |
7080 return 0; | |
7081 LODWORD(v44) = v66 << 16; | |
7082 HIDWORD(v44) = v66 >> 16; | |
7083 v73 = v44 / v74; | |
7084 v45 = v44 / v74; | |
7085 HIWORD(v46) = HIWORD(v72); | |
7086 if ( v72 <= v45 ) | |
7087 HIWORD(v46) = HIWORD(v45); | |
7088 LOWORD(v46) = 0; | |
7089 v79 = v39; | |
7090 sr.field_24 = v46; | |
7091 v75 = v4->ptr_38->field_10; | |
7092 v75 = v65 + ((unsigned __int64)(v75 * (signed __int64)v39) >> 16); | |
7093 v79 = (unsigned __int64)(v75 * (signed __int64)v45) >> 16; | |
7094 v47 = v4->ptr_38; | |
7095 v79 = v39; | |
7096 v48 = ((unsigned __int64)(v75 * (signed __int64)v45) >> 16) - v47->field_24; | |
7097 v75 = v47->field_1C; | |
7098 v75 = v64 + ((unsigned __int64)(v75 * (signed __int64)v39) >> 16); | |
7099 v79 = (unsigned __int64)(v75 * (signed __int64)v45) >> 16; | |
7100 v49 = (((v79 - v4->ptr_38->field_28) >> v78) - sr.field_2C) >> v69; | |
7101 sr.field_4 = ((v48 >> v78) - sr.field_30) >> v69; | |
7102 sr.field_0 = v49; | |
7103 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
7104 { | |
7105 if ( byte_80AA10 ) | |
7106 sr_sub_485A24(&sr, (stru315 *)&sr2); | |
7107 else | |
7108 sr_sub_485975(&sr, (stru315 *)&sr2); | |
7109 } | |
7110 else | |
7111 { | |
7112 if ( byte_80AA10 ) | |
7113 sr_sub_4D705A(v1); | |
7114 else | |
7115 sr_sub_4D6FB0(v1); | |
7116 } | |
7117 sr.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&sr2, v61, v73, v4, pOutdoorCamera->terrain_gamma, 1u, 0); | |
7118 sr.field_28 = v68; | |
7119 v39 -= pOutdoorCamera->int_fov_rad_inv << v69; | |
7120 } | |
7121 if ( !v62 ) | |
7122 return 1; | |
7123 v50 = v4->v_18.y; | |
7124 v75 = v50; | |
7125 v51 = v50 * (signed __int64)v39; | |
7126 v79 = v51 >> 16; | |
7127 LODWORD(v51) = v51 >> 16; | |
7128 v52 = v51 + v63; | |
7129 v74 = v51 + v63; | |
7130 if ( (int)v51 + v63 ) | |
7131 { | |
7132 v75 = abs(v76); | |
7133 v53 = abs(v52); | |
7134 if ( v75 <= v53 ) | |
7135 { | |
7136 LODWORD(v54) = v66 << 16; | |
7137 HIDWORD(v54) = v66 >> 16; | |
7138 v76 = v54 / v74; | |
7139 v55 = v54 / v74; | |
7140 HIWORD(v56) = HIWORD(v72); | |
7141 if ( v72 <= v55 ) | |
7142 HIWORD(v56) = HIWORD(v55); | |
7143 LOWORD(v56) = 0; | |
7144 v76 = v39; | |
7145 sr.field_24 = v56; | |
7146 v75 = v4->ptr_38->field_10; | |
7147 v75 = v65 + ((unsigned __int64)(v75 * (signed __int64)v39) >> 16); | |
7148 v76 = (unsigned __int64)(v75 * (signed __int64)v55) >> 16; | |
7149 v57 = v4->ptr_38; | |
7150 v76 = v39; | |
7151 v58 = ((unsigned __int64)(v75 * (signed __int64)v55) >> 16) - v57->field_24; | |
7152 v75 = v57->field_1C; | |
7153 v75 = v64 + ((unsigned __int64)(v75 * (signed __int64)v39) >> 16); | |
7154 v76 = (unsigned __int64)(v75 * (signed __int64)v55) >> 16; | |
7155 v59 = (((v76 - v4->ptr_38->field_28) >> v78) - sr.field_2C) >> v69; | |
7156 sr.field_4 = ((v58 >> v78) - sr.field_30) >> v69; | |
7157 sr.field_0 = v59; | |
7158 sr.field_28 = v62; | |
7159 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
7160 { | |
7161 if ( byte_80AA10 ) | |
7162 sr_sub_485A24(&sr, (stru315 *)&sr2); | |
7163 else | |
7164 sr_sub_485975(&sr, (stru315 *)&sr2); | |
7165 } | |
7166 else | |
7167 { | |
7168 if ( byte_80AA10 ) | |
7169 sr_sub_4D705A(v1); | |
7170 else | |
7171 sr_sub_4D6FB0(v1); | |
7172 } | |
7173 return 1; | |
7174 } | |
7175 } | |
7176 return 0; | |
7177 } | |
7178 | |
7179 //----- (00485407) -------------------------------------------------------- | |
7180 signed int __fastcall sr_sub_485407_prolly_odm_water_wavy(Span *a1) | |
7181 { | |
7182 stru315 *v1; // ebp@0 | |
7183 int v2; // eax@1 | |
7184 int v3; // edx@1 | |
7185 unsigned int v4; // edi@1 | |
7186 Polygon *v5; // esi@1 | |
7187 int v6; // ecx@1 | |
7188 int v7; // ebx@1 | |
7189 int v8; // ecx@1 | |
7190 stru149 *v9; // eax@1 | |
7191 stru149 *v10; // eax@1 | |
7192 int v11; // edx@1 | |
7193 int v12; // eax@1 | |
7194 int v13; // eax@1 | |
7195 int v14; // ecx@1 | |
7196 signed int v15; // edi@1 | |
7197 int v16; // edi@2 | |
7198 signed __int64 v17; // qtt@3 | |
7199 int v18; // edi@3 | |
7200 int v19; // eax@3 | |
7201 unsigned __int8 *pLOD; // eax@3 | |
7202 Texture *v21; // eax@4 | |
7203 Texture *v22; // eax@6 | |
7204 Texture *v23; // eax@8 | |
7205 Texture *v24; // eax@10 | |
7206 stru149 *v25; // eax@13 | |
7207 stru149 *v26; // eax@13 | |
7208 signed int v27; // ebx@13 | |
7209 stru149 *v28; // eax@13 | |
7210 Texture *v29; // esi@13 | |
7211 signed int v30; // ebx@13 | |
7212 signed int v31; // edi@13 | |
7213 signed int v32; // edx@13 | |
7214 signed int v33; // eax@13 | |
7215 int v34; // esi@13 | |
7216 int v35; // eax@13 | |
7217 unsigned __int64 v36; // qax@13 | |
7218 int v37; // eax@13 | |
7219 unsigned __int64 v38; // qax@13 | |
7220 char v39; // cl@14 | |
7221 stru316 a2; // [sp+Ch] [bp-90h]@13 | |
7222 stru315 a1a; // [sp+34h] [bp-68h]@1 | |
7223 Span *v43; // [sp+78h] [bp-24h]@1 | |
7224 int v44; // [sp+7Ch] [bp-20h]@1 | |
7225 int v45; // [sp+80h] [bp-1Ch]@1 | |
7226 int v46; // [sp+84h] [bp-18h]@1 | |
7227 Span *v47; // [sp+88h] [bp-14h]@1 | |
7228 int v48; // [sp+8Ch] [bp-10h]@1 | |
7229 int v49; // [sp+90h] [bp-Ch]@3 | |
7230 int i; // [sp+94h] [bp-8h]@3 | |
7231 int X; // [sp+98h] [bp-4h]@1 | |
7232 | |
7233 v2 = a1->field_A; | |
7234 v3 = a1->field_8; | |
7235 v4 = v3 + pRenderer->uTargetSurfacePitch * a1->field_A; | |
7236 v5 = a1->pParent; | |
7237 v43 = a1; | |
7238 v6 = a1->field_C; | |
7239 a1a.pColorBuffer = &pRenderer->pTargetSurface[v4]; | |
7240 v46 = v6; | |
7241 v7 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterX - v3); | |
7242 v8 = pOutdoorCamera->int_fov_rad_inv * (pViewport->uScreenCenterY - v2); | |
7243 a1a.pDepthBuffer = (unsigned int *)&pRenderer->pActiveZBuffer[v3 + 640 * v2]; | |
7244 v9 = v5->ptr_38; | |
7245 v47 = (Span *)v7; | |
7246 X = v8; | |
7247 v48 = v9->field_14; | |
7248 X = (unsigned __int64)(v48 * (signed __int64)v8) >> 16; | |
7249 v10 = v5->ptr_38; | |
7250 v11 = X + v10->field_C; | |
7251 v48 = v10->field_20; | |
7252 v44 = v11; | |
7253 v12 = ((unsigned __int64)(v48 * (signed __int64)v8) >> 16) + v5->ptr_38->field_18; | |
7254 X = v8; | |
7255 v45 = v12; | |
7256 v48 = v5->v_18.z; | |
7257 X = (unsigned __int64)(v48 * (signed __int64)v8) >> 16; | |
7258 v13 = v5->v_18.y; | |
7259 v14 = X + v5->v_18.x; | |
7260 v15 = -v5->field_24; | |
7261 v48 = -v5->field_24; | |
7262 X = ((unsigned __int64)(v7 * (signed __int64)v13) >> 16) + v14; | |
7263 if ( !X || (v16 = abs(v15 >> 14), v16 > abs(X)) ) | |
7264 return 0; | |
7265 LODWORD(v17) = v48 << 16; | |
7266 HIDWORD(v17) = v48 >> 16; | |
7267 i = v17 / X; | |
7268 v18 = v17 / X; | |
7269 HIWORD(v19) = (unsigned int)(v17 / X) >> 16; | |
7270 LOWORD(v19) = 0; | |
7271 a1a.field_24 = v19; | |
7272 pLOD = v5->pTexture->pLevelOfDetail2; | |
7273 a1a.pTextureLOD = (unsigned __int16 *)v5->pTexture->pLevelOfDetail2; | |
7274 v49 = 2; | |
7275 if ( v18 >= mipmapping_terrain_mm1 << 16 ) | |
7276 { | |
7277 if ( v18 >= mipmapping_terrain_mm2 << 16 ) | |
7278 { | |
7279 if ( v18 >= mipmapping_terrain_mm3 << 16 ) | |
7280 { | |
7281 if ( bUseLoResSprites ) | |
7282 goto LABEL_12; | |
7283 v24 = v5->pTexture; | |
7284 v49 = 3; | |
7285 pLOD = v24->pLevelOfDetail3; | |
7286 } | |
7287 else | |
7288 { | |
7289 v23 = v5->pTexture; | |
7290 v49 = 2; | |
7291 pLOD = v23->pLevelOfDetail2; | |
7292 } | |
7293 } | |
7294 else | |
7295 { | |
7296 v22 = v5->pTexture; | |
7297 v49 = 1; | |
7298 pLOD = v22->pLevelOfDetail1; | |
7299 } | |
7300 } | |
7301 else | |
7302 { | |
7303 v21 = v5->pTexture; | |
7304 v49 = 0; | |
7305 pLOD = v21->pLevelOfDetail0_prolly_alpha_mask; | |
7306 } | |
7307 a1a.pTextureLOD = (unsigned __int16 *)pLOD; | |
7308 LABEL_12: | |
7309 if ( !pLOD ) | |
7310 return 0; | |
7311 a1a.field_34_palette = (unsigned __int16 *)sr_sub_485E1F(&a2, v43, v18, v5, pOutdoorCamera->terrain_gamma, 1u, 1); | |
7312 a1a.field_28 = 16; | |
7313 v43 = (Span *)(v46 >> 4); | |
7314 X = v7; | |
7315 v25 = v5->ptr_38; | |
7316 v48 = v46 - 16 * (v46 >> 4); | |
7317 v46 = v25->field_10; | |
7318 X = v7; | |
7319 v46 = v44 + ((unsigned __int64)(v46 * (signed __int64)v7) >> 16); | |
7320 v44 = v5->ptr_38->field_1C; | |
7321 v45 += (unsigned __int64)(v44 * (signed __int64)v7) >> 16; | |
7322 X = (unsigned __int64)(v46 * (signed __int64)v18) >> 16; | |
7323 v26 = v5->ptr_38; | |
7324 X = v18; | |
7325 v27 = ((unsigned __int64)(v46 * (signed __int64)v18) >> 16) - v26->field_24; | |
7326 X = (unsigned __int64)(v45 * (signed __int64)v18) >> 16; | |
7327 v28 = v5->ptr_38; | |
7328 v29 = v5->pTexture; | |
7329 v44 = bUseLoResSprites + v49 + 2; | |
7330 v30 = v27 >> v44; | |
7331 v31 = (signed int)(((unsigned __int64)(v45 * (signed __int64)v18) >> 16) - v28->field_28) >> v44; | |
7332 v32 = (signed int)v29->uTextureWidth >> v49; | |
7333 v33 = (signed int)v29->uTextureHeight >> v49; | |
7334 v34 = v49 - v29->uWidthLn2; | |
7335 a1a.field_8 = (v33 << 16) - 65536; | |
7336 X = 2 * pMiscTimer->uTotalGameTimeElapsed; | |
7337 v45 = pOutdoorCamera->int_fov_rad_inv; | |
7338 a1a.field_10 = v34 + 16; | |
7339 a1a.field_C = v32 - 1; | |
7340 i = (unsigned __int64)(pOutdoorCamera->int_fov_rad_inv * (signed __int64)i) >> 16; | |
7341 v47 = (Span *)(i >> v44); | |
7342 v35 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); | |
7343 v36 = (signed int)v47 * (signed __int64)v35; | |
7344 i = v36 >> 16; | |
7345 a1a.field_4 = v36 >> 16; | |
7346 v37 = stru_5C6E00->Cos(pIndoorCamera->sRotationY); | |
7347 v38 = (signed int)v47 * (signed __int64)v37; | |
7348 i = v38 >> 16; | |
7349 a1a.field_0 = v38 >> 16; | |
7350 if ( (signed int)v43 > 0 ) | |
7351 { | |
7352 v47 = v43; | |
7353 v39 = 12 - v49; | |
7354 for ( i = 12 - v49; ; v39 = i ) | |
7355 { | |
7356 a1a.field_30 = v30 + 4 * stru_5C6E00->Cos(X + (v31 >> v39)); | |
7357 a1a.field_2C = v31 + 4 * stru_5C6E00->Sin(X + (v30 >> i)); | |
7358 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
7359 sr_sub_485975(&a1a, (stru315 *)&a2); | |
7360 else | |
7361 sr_sub_4D6FB0(v1); | |
7362 a1a.field_28 = 16; | |
7363 v30 += 16 * a1a.field_4; | |
7364 v31 += 16 * a1a.field_0; | |
7365 v47 = (Span *)((char *)v47 - 1); | |
7366 if ( !v47 ) | |
7367 break; | |
7368 } | |
7369 } | |
7370 if ( v48 ) | |
7371 { | |
7372 i = 12 - v49; | |
7373 a1a.field_30 = v30 + 4 * stru_5C6E00->Cos(X + (v31 >> (12 - v49))); | |
7374 a1a.field_2C = v31 + 4 * stru_5C6E00->Sin(X + (v30 >> i)); | |
7375 a1a.field_28 = v48; | |
7376 if ( byte_4D864C && BYTE1(pGame->uFlags) & 8 ) | |
7377 sr_sub_485975(&a1a, (stru315 *)&a2); | |
7378 else | |
7379 sr_sub_4D6FB0(v1); | |
7380 } | |
7381 return 1; | |
7382 } | |
7383 | |
7384 //----- (0048585C) -------------------------------------------------------- | |
7385 signed int __fastcall sr_sub_48585C_mb_DrawSpan(Span *a1, unsigned __int16 *pRenderTarget, int a4) | |
7386 { | |
7387 Span *v3; // esi@1 | |
7388 Polygon *v4; // edi@1 | |
7389 int v5; // ebx@2 | |
7390 signed __int64 v6; // qtt@3 | |
7391 int v7; // ebx@3 | |
7392 signed int v8; // ecx@3 | |
7393 void *v9; // eax@5 | |
7394 int v10; // ecx@5 | |
7395 unsigned __int16 *pPixels; // [sp+Ch] [bp-14h]@1 | |
7396 signed int v13; // [sp+10h] [bp-10h]@1 | |
7397 int X; // [sp+18h] [bp-8h]@1 | |
7398 | |
7399 v3 = a1; | |
7400 pPixels = pRenderTarget; | |
7401 v4 = a1->pParent; | |
7402 v13 = -v4->field_24; | |
7403 X = ((unsigned __int64)(pOutdoorCamera->int_fov_rad_inv | |
7404 * (pViewport->uScreenCenterX - (signed int)a1->field_8) | |
7405 * (signed __int64)v4->v_18.y) >> 16) | |
7406 + ((unsigned __int64)(v4->v_18.z | |
7407 * (signed __int64)(pOutdoorCamera->int_fov_rad_inv | |
7408 * (pViewport->uScreenCenterY - (signed int)a1->field_A))) >> 16) | |
7409 + v4->v_18.x; | |
7410 if ( X && (v5 = abs(-v4->field_24 >> 14), v5 <= abs(X)) ) | |
7411 { | |
7412 LODWORD(v6) = v13 << 16; | |
7413 HIDWORD(v6) = v13 >> 16; | |
7414 v7 = v6 / X; | |
7415 v8 = v6 / X; | |
7416 } | |
7417 else | |
7418 { | |
7419 v7 = pOutdoorCamera->shading_dist_mist << 16; | |
7420 v8 = pOutdoorCamera->shading_dist_mist << 16; | |
7421 } | |
7422 v9 = sr_sub_47C178(v8, v4, pOutdoorCamera->terrain_gamma, a4); | |
7423 fill_pixels_fast(*((short *)v9 + v4->pTexture->uDecompressedSize), pPixels, v3->field_C); | |
7424 HIWORD(v10) = HIWORD(v7); | |
7425 LOWORD(v10) = 0; | |
7426 j_memset32(v10, &pRenderer->pActiveZBuffer[v3->field_8 + 640 * v3->field_A], v3->field_C); | |
7427 return 1; | |
7428 } | |
7429 //----- (004252E8) -------------------------------------------------------- | |
7430 signed int __fastcall sr_4252E8(unsigned int uVertexID) | |
7431 { | |
7432 unsigned int v1; // edx@1 | |
7433 double v2; // st7@1 | |
7434 char *v3; // edi@5 | |
7435 char *v4; // esi@5 | |
7436 char *v5; // ecx@5 | |
7437 int v6; // ebx@6 | |
7438 double v7; // st6@11 | |
7439 double v8; // st5@11 | |
7440 double v9; // st6@12 | |
7441 unsigned __int8 v10; // c2@16 | |
7442 unsigned __int8 v11; // c3@16 | |
7443 void *v12; // edi@23 | |
7444 double v13; // st6@23 | |
7445 char *v14; // ecx@23 | |
7446 char v15; // zf@24 | |
7447 signed int result; // eax@25 | |
7448 unsigned int v17; // [sp+8h] [bp-28h]@5 | |
7449 bool v18; // [sp+Ch] [bp-24h]@2 | |
7450 bool v19; // [sp+10h] [bp-20h]@7 | |
7451 char *v20; // [sp+14h] [bp-1Ch]@5 | |
7452 char *v21; // [sp+18h] [bp-18h]@5 | |
7453 signed int v22; // [sp+1Ch] [bp-14h]@1 | |
7454 RenderVertexSoft *v23; // [sp+20h] [bp-10h]@5 | |
7455 char *v24; // [sp+24h] [bp-Ch]@5 | |
7456 char *v25; // [sp+28h] [bp-8h]@5 | |
7457 char *v26; // [sp+2Ch] [bp-4h]@5 | |
7458 | |
7459 v1 = uVertexID; | |
7460 v2 = (double)pOutdoorCamera->shading_dist_mist; | |
7461 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
7462 v22 = 0; | |
7463 v18 = array_50AC10[0].vWorldViewPosition.x <= v2; | |
7464 if ( (signed int)(uVertexID + 1) <= 1 ) | |
7465 return 0; | |
7466 v3 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
7467 v4 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
7468 v25 = (char *)&array_507D30[0]._rhw; | |
7469 v23 = array_507D30; | |
7470 v20 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
7471 v21 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
7472 v24 = (char *)&array_507D30[0].vWorldViewPosition; | |
7473 v26 = (char *)&array_507D30[0].flt_2C; | |
7474 v5 = (char *)&array_50AC10[0].vWorldViewPosition; | |
7475 v17 = v1; | |
7476 do | |
7477 { | |
7478 v6 = (int)(v5 + 48); | |
7479 v19 = v2 >= *((float *)v5 + 12); | |
7480 if ( v18 != v19 ) | |
7481 { | |
7482 if ( v19 ) | |
7483 { | |
7484 v7 = (v2 - *(float *)v5) / (*(float *)v6 - *(float *)v5); | |
7485 *(float *)v4 = (*((float *)v5 + 13) - *((float *)v5 + 1)) * v7 + *((float *)v5 + 1); | |
7486 *(float *)v3 = (*((float *)v5 + 14) - *((float *)v5 + 2)) * v7 + *((float *)v5 + 2); | |
7487 v8 = (*((float *)v5 + 20) - *((float *)v5 + 8)) * v7 + *((float *)v5 + 8); | |
7488 } | |
7489 else | |
7490 { | |
7491 v9 = (v2 - *(float *)v6) / (*(float *)v5 - *(float *)v6); | |
7492 *(float *)v4 = (*((float *)v5 + 1) - *((float *)v5 + 13)) * v9 + *((float *)v5 + 13); | |
7493 *(float *)v3 = (*((float *)v5 + 2) - *((float *)v5 + 14)) * v9 + *((float *)v5 + 14); | |
7494 v8 = (*((float *)v5 + 8) - *((float *)v5 + 20)) * v9 + *((float *)v5 + 20); | |
7495 } | |
7496 *(float *)v26 = v8; | |
7497 *(float *)v24 = v2; | |
7498 *(float *)v25 = 1.0 / v2; | |
7499 if ( v18 ) | |
7500 { | |
7501 if ( v2 == *(float *)v5 && *(float *)v4 == *((float *)v5 + 1) ) | |
7502 { | |
7503 v10 = 0; | |
7504 v11 = *(float *)v3 == *((float *)v5 + 2); | |
7505 goto LABEL_20; | |
7506 } | |
7507 } | |
7508 else | |
7509 { | |
7510 if ( v2 == *(float *)v6 && *(float *)v4 == *((float *)v5 + 13) ) | |
7511 { | |
7512 v10 = 0; | |
7513 v11 = *(float *)v3 == *((float *)v5 + 14); | |
7514 LABEL_20: | |
7515 if ( v11 | v10 ) | |
7516 goto LABEL_22; | |
7517 goto LABEL_21; | |
7518 } | |
7519 } | |
7520 LABEL_21: | |
7521 ++v23; | |
7522 v24 += 48; | |
7523 v26 += 48; | |
7524 v4 += 48; | |
7525 v3 += 48; | |
7526 ++v22; | |
7527 v25 += 48; | |
7528 v21 = v4; | |
7529 v20 = v3; | |
7530 } | |
7531 LABEL_22: | |
7532 if ( v19 ) | |
7533 { | |
7534 v12 = v23; | |
7535 v21 += 48; | |
7536 v20 += 48; | |
7537 v13 = 1.0 / (*(float *)v6 + 0.0000001); | |
7538 ++v22; | |
7539 v26 += 48; | |
7540 v24 += 48; | |
7541 ++v23; | |
7542 memcpy(v12, v5 + 36, 0x30u); | |
7543 v14 = v25; | |
7544 v25 += 48; | |
7545 v4 = v21; | |
7546 v3 = v20; | |
7547 *(float *)v14 = v13; | |
7548 } | |
7549 v15 = v17-- == 1; | |
7550 v18 = v19; | |
7551 v5 = (char *)v6; | |
7552 } | |
7553 while ( !v15 ); | |
7554 result = v22; | |
7555 if ( v22 < 3 ) | |
7556 return 0; | |
7557 return result; | |
7558 } | |
7559 | |
7560 //----- (004250FE) -------------------------------------------------------- | |
7561 signed int __fastcall sr_4250FE(unsigned int uVertexID) | |
7562 { | |
7563 unsigned int v1; // edx@1 | |
7564 char *v2; // edi@5 | |
7565 char *v3; // esi@5 | |
7566 char *v4; // ecx@5 | |
7567 int v5; // ebx@6 | |
7568 double v6; // st6@11 | |
7569 double v7; // st5@11 | |
7570 double v8; // st6@12 | |
7571 unsigned __int8 v9; // c2@16 | |
7572 unsigned __int8 v10; // c3@16 | |
7573 void *v11; // edi@23 | |
7574 double v12; // st6@23 | |
7575 char *v13; // ecx@23 | |
7576 char v14; // zf@24 | |
7577 signed int result; // eax@25 | |
7578 unsigned int v16; // [sp+8h] [bp-28h]@5 | |
7579 bool v17; // [sp+Ch] [bp-24h]@2 | |
7580 bool v18; // [sp+10h] [bp-20h]@7 | |
7581 char *v19; // [sp+14h] [bp-1Ch]@5 | |
7582 char *v20; // [sp+18h] [bp-18h]@5 | |
7583 signed int v21; // [sp+1Ch] [bp-14h]@1 | |
7584 RenderVertexSoft *v22; // [sp+20h] [bp-10h]@5 | |
7585 char *v23; // [sp+24h] [bp-Ch]@5 | |
7586 char *v24; // [sp+28h] [bp-8h]@5 | |
7587 char *v25; // [sp+2Ch] [bp-4h]@5 | |
7588 | |
7589 v1 = uVertexID; | |
7590 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
7591 v21 = 0; | |
7592 v17 = array_50AC10[0].vWorldViewPosition.x >= 8.0; | |
7593 if ( (signed int)(uVertexID + 1) <= 1 ) | |
7594 return 0; | |
7595 v2 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
7596 v3 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
7597 v24 = (char *)&array_507D30[0]._rhw; | |
7598 v22 = array_507D30; | |
7599 v19 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
7600 v20 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
7601 v23 = (char *)&array_507D30[0].vWorldViewPosition; | |
7602 v25 = (char *)&array_507D30[0].flt_2C; | |
7603 v4 = (char *)&array_50AC10[0].vWorldViewPosition; | |
7604 v16 = v1; | |
7605 do | |
7606 { | |
7607 v5 = (int)(v4 + 48); | |
7608 v18 = *((float *)v4 + 12) >= 8.0; | |
7609 if ( v17 != v18 ) | |
7610 { | |
7611 if ( v18 ) | |
7612 { | |
7613 v6 = (8.0 - *(float *)v4) / (*(float *)v5 - *(float *)v4); | |
7614 *(float *)v3 = (*((float *)v4 + 13) - *((float *)v4 + 1)) * v6 + *((float *)v4 + 1); | |
7615 *(float *)v2 = (*((float *)v4 + 14) - *((float *)v4 + 2)) * v6 + *((float *)v4 + 2); | |
7616 v7 = (*((float *)v4 + 20) - *((float *)v4 + 8)) * v6 + *((float *)v4 + 8); | |
7617 } | |
7618 else | |
7619 { | |
7620 v8 = (8.0 - *(float *)v5) / (*(float *)v4 - *(float *)v5); | |
7621 *(float *)v3 = (*((float *)v4 + 1) - *((float *)v4 + 13)) * v8 + *((float *)v4 + 13); | |
7622 *(float *)v2 = (*((float *)v4 + 2) - *((float *)v4 + 14)) * v8 + *((float *)v4 + 14); | |
7623 v7 = (*((float *)v4 + 8) - *((float *)v4 + 20)) * v8 + *((float *)v4 + 20); | |
7624 } | |
7625 *(float *)v25 = v7; | |
7626 *(float *)v23 = 8.0; | |
7627 *(int *)v24 = 0x3E000000u; | |
7628 if ( v17 ) | |
7629 { | |
7630 if ( 8.0 == *(float *)v4 && *(float *)v3 == *((float *)v4 + 1) ) | |
7631 { | |
7632 v9 = 0; | |
7633 v10 = *(float *)v2 == *((float *)v4 + 2); | |
7634 goto LABEL_20; | |
7635 } | |
7636 } | |
7637 else | |
7638 { | |
7639 if ( 8.0 == *(float *)v5 && *(float *)v3 == *((float *)v4 + 13) ) | |
7640 { | |
7641 v9 = 0; | |
7642 v10 = *(float *)v2 == *((float *)v4 + 14); | |
7643 LABEL_20: | |
7644 if ( v10 | v9 ) | |
7645 goto LABEL_22; | |
7646 goto LABEL_21; | |
7647 } | |
7648 } | |
7649 LABEL_21: | |
7650 ++v22; | |
7651 v23 += 48; | |
7652 v25 += 48; | |
7653 v3 += 48; | |
7654 v2 += 48; | |
7655 ++v21; | |
7656 v24 += 48; | |
7657 v20 = v3; | |
7658 v19 = v2; | |
7659 } | |
7660 LABEL_22: | |
7661 if ( v18 ) | |
7662 { | |
7663 v11 = v22; | |
7664 v20 += 48; | |
7665 v19 += 48; | |
7666 v12 = 1.0 / (*(float *)v5 + 0.0000001); | |
7667 ++v21; | |
7668 v25 += 48; | |
7669 v23 += 48; | |
7670 ++v22; | |
7671 memcpy(v11, v4 + 36, 0x30u); | |
7672 v13 = v24; | |
7673 v24 += 48; | |
7674 v3 = v20; | |
7675 v2 = v19; | |
7676 *(float *)v13 = v12; | |
7677 } | |
7678 v14 = v16-- == 1; | |
7679 v17 = v18; | |
7680 v4 = (char *)v5; | |
7681 } | |
7682 while ( !v14 ); | |
7683 result = v21; | |
7684 if ( v21 < 3 ) | |
7685 return 0; | |
7686 return result; | |
7687 } | |
7688 | |
7689 | |
7690 //----- (004254D2) -------------------------------------------------------- | |
7691 int __fastcall sr_4254D2(signed int a1) | |
7692 { | |
7693 signed int v1; // ebx@2 | |
7694 int v2; // ecx@2 | |
7695 int result; // eax@11 | |
7696 double v4; // ST74_8@12 | |
7697 bool v5; // edi@12 | |
7698 char *v6; // esi@13 | |
7699 char *v7; // ebx@13 | |
7700 double v8; // st7@15 | |
7701 double v9; // st7@16 | |
7702 double v10; // st6@16 | |
7703 double v11; // st7@17 | |
7704 float v12; // eax@18 | |
7705 double v13; // ST4C_8@19 | |
7706 double v14; // ST10_8@19 | |
7707 double v15; // ST28_8@20 | |
7708 double v16; // ST34_8@20 | |
7709 char v17; // zf@20 | |
7710 double v18; // ST18_8@21 | |
7711 double v19; // ST3C_8@21 | |
7712 double v20; // ST44_8@22 | |
7713 double v21; // ST54_8@22 | |
7714 void *v22; // edi@26 | |
7715 double v23; // ST54_8@29 | |
7716 bool v24; // esi@29 | |
7717 char *v25; // edi@30 | |
7718 char *v26; // ebx@30 | |
7719 bool v27; // ecx@32 | |
7720 double v28; // st7@33 | |
7721 double v29; // st7@34 | |
7722 double v30; // st6@34 | |
7723 double v31; // st7@35 | |
7724 double v32; // ST44_8@37 | |
7725 double v33; // ST3C_8@37 | |
7726 double v34; // ST18_8@38 | |
7727 double v35; // ST34_8@38 | |
7728 char v36; // zf@38 | |
7729 double v37; // ST28_8@39 | |
7730 double v38; // ST10_8@39 | |
7731 double v39; // ST20_8@40 | |
7732 double v40; // ST5C_8@40 | |
7733 void *v41; // edi@44 | |
7734 double v42; // ST5C_8@47 | |
7735 bool v43; // edi@47 | |
7736 char *v44; // esi@48 | |
7737 char *v45; // ebx@48 | |
7738 bool v46; // ecx@49 | |
7739 double v47; // st6@50 | |
7740 double v48; // st6@51 | |
7741 double v49; // st5@51 | |
7742 double v50; // st6@52 | |
7743 double v51; // ST20_8@54 | |
7744 double v52; // ST54_8@54 | |
7745 double v53; // ST44_8@55 | |
7746 double v54; // ST3C_8@55 | |
7747 char v55; // zf@55 | |
7748 double v56; // ST18_8@56 | |
7749 double v57; // ST34_8@56 | |
7750 double v58; // ST28_8@57 | |
7751 double v59; // ST10_8@57 | |
7752 void *v60; // edi@61 | |
7753 double v61; // ST5C_8@64 | |
7754 bool v62; // edi@64 | |
7755 char *v63; // esi@65 | |
7756 char *v64; // ebx@65 | |
7757 bool v65; // ecx@66 | |
7758 double v66; // st6@67 | |
7759 double v67; // st6@68 | |
7760 double v68; // st5@68 | |
7761 double v69; // st6@69 | |
7762 double v70; // ST20_8@71 | |
7763 double v71; // ST54_8@71 | |
7764 double v72; // ST44_8@72 | |
7765 double v73; // ST3C_8@72 | |
7766 char v74; // zf@72 | |
7767 double v75; // ST18_8@73 | |
7768 double v76; // ST34_8@73 | |
7769 double v77; // ST28_8@74 | |
7770 double v78; // ST10_8@74 | |
7771 void *v79; // edi@78 | |
7772 int v80; // ebx@81 | |
7773 char *v81; // ecx@82 | |
7774 signed int v82; // esi@82 | |
7775 float v83; // ST78_4@83 | |
7776 double v84; // ST5C_8@83 | |
7777 float v85; // eax@84 | |
7778 double v86; // ST20_8@85 | |
7779 double v87; // ST54_8@88 | |
7780 float v88; // eax@89 | |
7781 double v89; // ST44_8@90 | |
7782 unsigned __int8 v90; // sf@94 | |
7783 unsigned __int8 v91; // of@94 | |
7784 int v92; // edx@97 | |
7785 int v93; // esi@97 | |
7786 int v94; // edi@97 | |
7787 int v95; // eax@97 | |
7788 int v96; // eax@104 | |
7789 double v97; // [sp+4Ch] [bp-8Ch]@32 | |
7790 double v98; // [sp+54h] [bp-84h]@49 | |
7791 double v99; // [sp+54h] [bp-84h]@66 | |
7792 float v100; // [sp+5Ch] [bp-7Ch]@1 | |
7793 float v101; // [sp+60h] [bp-78h]@1 | |
7794 float v102; // [sp+64h] [bp-74h]@1 | |
7795 double v103; // [sp+6Ch] [bp-6Ch]@14 | |
7796 float v104; // [sp+A8h] [bp-30h]@1 | |
7797 signed int v105; // [sp+A8h] [bp-30h]@96 | |
7798 bool v106; // [sp+ACh] [bp-2Ch]@14 | |
7799 bool v107; // [sp+ACh] [bp-2Ch]@32 | |
7800 bool v108; // [sp+ACh] [bp-2Ch]@49 | |
7801 bool v109; // [sp+ACh] [bp-2Ch]@66 | |
7802 signed int v110; // [sp+B0h] [bp-28h]@12 | |
7803 char *v111; // [sp+B8h] [bp-20h]@30 | |
7804 signed int v112; // [sp+B8h] [bp-20h]@48 | |
7805 signed int v113; // [sp+B8h] [bp-20h]@65 | |
7806 char *v114; // [sp+BCh] [bp-1Ch]@13 | |
7807 signed int v115; // [sp+BCh] [bp-1Ch]@29 | |
7808 signed int v116; // [sp+BCh] [bp-1Ch]@64 | |
7809 signed int v117; // [sp+C0h] [bp-18h]@1 | |
7810 char *v118; // [sp+C0h] [bp-18h]@30 | |
7811 char *v119; // [sp+C0h] [bp-18h]@48 | |
7812 char *v120; // [sp+C0h] [bp-18h]@65 | |
7813 char *v121; // [sp+C4h] [bp-14h]@13 | |
7814 char *v122; // [sp+C4h] [bp-14h]@30 | |
7815 signed int v123; // [sp+C4h] [bp-14h]@47 | |
7816 char *v124; // [sp+C8h] [bp-10h]@30 | |
7817 char *v125; // [sp+C8h] [bp-10h]@48 | |
7818 char *v126; // [sp+C8h] [bp-10h]@65 | |
7819 signed int v127; // [sp+CCh] [bp-Ch]@2 | |
7820 char *v128; // [sp+CCh] [bp-Ch]@13 | |
7821 char *v129; // [sp+CCh] [bp-Ch]@30 | |
7822 RenderVertexSoft *v130; // [sp+CCh] [bp-Ch]@48 | |
7823 RenderVertexSoft *v131; // [sp+CCh] [bp-Ch]@65 | |
7824 RenderVertexSoft *v132; // [sp+D0h] [bp-8h]@13 | |
7825 char *v133; // [sp+D0h] [bp-8h]@30 | |
7826 char *v134; // [sp+D0h] [bp-8h]@48 | |
7827 char *v135; // [sp+D0h] [bp-8h]@65 | |
7828 signed int v136; // [sp+D4h] [bp-4h]@1 | |
7829 char *v137; // [sp+D4h] [bp-4h]@13 | |
7830 RenderVertexSoft *v138; // [sp+D4h] [bp-4h]@30 | |
7831 char *v139; // [sp+D4h] [bp-4h]@48 | |
7832 char *v140; // [sp+D4h] [bp-4h]@65 | |
7833 | |
7834 v101 = (double)(signed int)pViewport->uViewportTL_X; | |
7835 v100 = (double)(signed int)pViewport->uViewportBR_X; | |
7836 v117 = a1; | |
7837 v136 = 1; | |
7838 v104 = (double)(signed int)pViewport->uViewportTL_Y; | |
7839 v102 = (double)(pViewport->uViewportBR_Y + 1); | |
7840 if ( a1 <= 0 ) | |
7841 return v117; | |
7842 v127 = a1; | |
7843 v1 = a1; | |
7844 memcpy(array_508690, array_50AC10, 4 * ((unsigned int)(48 * a1) >> 2)); | |
7845 v2 = 0; | |
7846 do | |
7847 { | |
7848 if ( array_50AC10[v2].vWorldViewProjX < (double)v101 || array_50AC10[v2].vWorldViewProjX > (double)v100 ) | |
7849 v136 = 0; | |
7850 if ( *(float *)(v2 * 48 + 5286956) < (double)v104 || *(float *)(v2 * 48 + 5286956) > (double)v102 ) | |
7851 v136 = 0; | |
7852 ++v2; | |
7853 --v127; | |
7854 } | |
7855 while ( v127 ); | |
7856 if ( v136 ) | |
7857 return v117; | |
7858 v110 = 0; | |
7859 memcpy(&array_50AC10[v1], array_50AC10, sizeof(array_50AC10[v1])); | |
7860 v4 = array_50AC10[0].vWorldViewProjX + 6.7553994e15; | |
7861 v5 = SLODWORD(v4) >= (signed int)pViewport->uViewportTL_X; | |
7862 if ( v117 < 1 ) | |
7863 goto LABEL_112; | |
7864 v6 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
7865 v132 = array_50A2B0; | |
7866 v137 = (char *)&array_50A2B0[0].vWorldViewProjX; | |
7867 v128 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
7868 v121 = (char *)&array_50A2B0[0].flt_2C; | |
7869 v114 = (char *)&array_50A2B0[0]._rhw; | |
7870 v7 = (char *)&array_50AC10[0].flt_2C; | |
7871 do | |
7872 { | |
7873 v103 = *((float *)v7 + 7) + 6.7553994e15; | |
7874 v106 = SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X; | |
7875 if ( !(v5 ^ v106) ) | |
7876 goto LABEL_25; | |
7877 v8 = v101; | |
7878 if ( SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X ) | |
7879 { | |
7880 v9 = (v8 - *((float *)v7 - 5)) / (*((float *)v7 + 7) - *((float *)v7 - 5)); | |
7881 *(float *)v6 = (*((float *)v7 + 8) - *((float *)v7 - 4)) * v9 + *((float *)v7 - 4); | |
7882 *(float *)v114 = (*((float *)v7 + 9) - *((float *)v7 - 3)) * v9 + *((float *)v7 - 3); | |
7883 v10 = (*((float *)v7 + 12) - *(float *)v7) * v9 + *(float *)v7; | |
7884 } | |
7885 else | |
7886 { | |
7887 v11 = (v8 - *((float *)v7 + 7)) / (*((float *)v7 - 5) - *((float *)v7 + 7)); | |
7888 *(float *)v6 = (*((float *)v7 - 4) - *((float *)v7 + 8)) * v11 + *((float *)v7 + 8); | |
7889 *(float *)v114 = (*((float *)v7 - 3) - *((float *)v7 + 9)) * v11 + *((float *)v7 + 9); | |
7890 v10 = (*(float *)v7 - *((float *)v7 + 12)) * v11 + *((float *)v7 + 12); | |
7891 } | |
7892 *(float *)v121 = v10; | |
7893 *(int *)v137 = LODWORD(v101); | |
7894 LODWORD(v12) = *(int *)v6; | |
7895 if ( v5 ) | |
7896 { | |
7897 v13 = v12 + 6.7553994e15; | |
7898 v14 = *((float *)v7 - 4) + 6.7553994e15; | |
7899 if ( LODWORD(v13) == LODWORD(v14) ) | |
7900 { | |
7901 v15 = *(float *)v137 + 6.7553994e15; | |
7902 v16 = *((float *)v7 - 5) + 6.7553994e15; | |
7903 v17 = LODWORD(v15) == LODWORD(v16); | |
7904 goto LABEL_23; | |
7905 } | |
7906 } | |
7907 else | |
7908 { | |
7909 v18 = v12 + 6.7553994e15; | |
7910 v19 = *((float *)v7 + 8) + 6.7553994e15; | |
7911 if ( LODWORD(v18) == LODWORD(v19) ) | |
7912 { | |
7913 v20 = *(float *)v137 + 6.7553994e15; | |
7914 v21 = *((float *)v7 + 7) + 6.7553994e15; | |
7915 v17 = LODWORD(v20) == LODWORD(v21); | |
7916 LABEL_23: | |
7917 if ( v17 ) | |
7918 goto LABEL_25; | |
7919 goto LABEL_24; | |
7920 } | |
7921 } | |
7922 LABEL_24: | |
7923 v121 += 48; | |
7924 v114 += 48; | |
7925 v6 += 48; | |
7926 ++v110; | |
7927 ++v132; | |
7928 v128 = v6; | |
7929 v137 += 48; | |
7930 LABEL_25: | |
7931 if ( v106 ) | |
7932 { | |
7933 v22 = v132; | |
7934 v128 += 48; | |
7935 ++v110; | |
7936 v114 += 48; | |
7937 v121 += 48; | |
7938 v137 += 48; | |
7939 ++v132; | |
7940 memcpy(v22, v7 + 4, 0x30u); | |
7941 v6 = v128; | |
7942 } | |
7943 v5 = v106; | |
7944 v7 += 48; | |
7945 --v117; | |
7946 } | |
7947 while ( v117 ); | |
7948 if ( v110 < 3 | |
7949 || (v115 = 0, | |
7950 memcpy(&array_50A2B0[v110], array_50A2B0, sizeof(array_50A2B0[v110])), | |
7951 v23 = array_50A2B0[0].vWorldViewProjX + 6.7553994e15, | |
7952 v24 = SLODWORD(v23) <= (signed int)pViewport->uViewportBR_X, | |
7953 v110 < 1) ) | |
7954 goto LABEL_112; | |
7955 v25 = (char *)&array_509950[0]._rhw; | |
7956 v138 = array_509950; | |
7957 v129 = (char *)&array_50A2B0[0].vWorldViewProjX; | |
7958 v118 = (char *)&array_50A2B0[0].vWorldViewProjY; | |
7959 v133 = (char *)&array_509950[0].vWorldViewProjX; | |
7960 v122 = (char *)&array_509950[0].vWorldViewProjY; | |
7961 v124 = (char *)&array_509950[0].flt_2C; | |
7962 v111 = (char *)&array_509950[0]._rhw; | |
7963 v26 = (char *)&array_50A2B0[0].flt_2C; | |
7964 while ( 2 ) | |
7965 { | |
7966 v97 = *((float *)v26 + 7) + 6.7553994e15; | |
7967 v27 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; | |
7968 v107 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X; | |
7969 if ( v24 != v27 ) | |
7970 { | |
7971 v28 = v100; | |
7972 if ( SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X ) | |
7973 { | |
7974 v29 = (v28 - *((float *)v26 - 5)) / (*((float *)v26 + 7) - *((float *)v26 - 5)); | |
7975 *(float *)v122 = (*((float *)v26 + 8) - *((float *)v26 - 4)) * v29 + *((float *)v26 - 4); | |
7976 *(float *)v25 = (*((float *)v26 + 9) - *((float *)v26 - 3)) * v29 + *((float *)v26 - 3); | |
7977 v30 = (*((float *)v26 + 12) - *(float *)v26) * v29 + *(float *)v26; | |
7978 } | |
7979 else | |
7980 { | |
7981 v31 = (v28 - *((float *)v26 + 7)) / (*((float *)v26 - 5) - *((float *)v26 + 7)); | |
7982 *(float *)v122 = (*((float *)v26 - 4) - *((float *)v26 + 8)) * v31 + *((float *)v26 + 8); | |
7983 *(float *)v25 = (*((float *)v26 - 3) - *((float *)v26 + 9)) * v31 + *((float *)v26 + 9); | |
7984 v30 = (*(float *)v26 - *((float *)v26 + 12)) * v31 + *((float *)v26 + 12); | |
7985 } | |
7986 *(float *)v124 = v30; | |
7987 *(int *)v133 = LODWORD(v100); | |
7988 if ( v24 ) | |
7989 { | |
7990 v32 = *(float *)v122 + 6.7553994e15; | |
7991 v33 = *((float *)v26 - 4) + 6.7553994e15; | |
7992 if ( LODWORD(v32) == LODWORD(v33) ) | |
7993 { | |
7994 v34 = *(float *)v133 + 6.7553994e15; | |
7995 v35 = *((float *)v26 - 5) + 6.7553994e15; | |
7996 v36 = LODWORD(v34) == LODWORD(v35); | |
7997 goto LABEL_41; | |
7998 } | |
7999 goto LABEL_42; | |
8000 } | |
8001 v37 = *(float *)v118 + 6.7553994e15; | |
8002 v38 = *((float *)v26 + 8) + 6.7553994e15; | |
8003 if ( LODWORD(v37) != LODWORD(v38) ) | |
8004 goto LABEL_42; | |
8005 v39 = *(float *)v129 + 6.7553994e15; | |
8006 v40 = *((float *)v26 + 7) + 6.7553994e15; | |
8007 v36 = LODWORD(v39) == LODWORD(v40); | |
8008 LABEL_41: | |
8009 if ( !v36 ) | |
8010 { | |
8011 LABEL_42: | |
8012 v129 += 48; | |
8013 v118 += 48; | |
8014 v133 += 48; | |
8015 v122 += 48; | |
8016 v124 += 48; | |
8017 v111 += 48; | |
8018 ++v115; | |
8019 ++v138; | |
8020 } | |
8021 } | |
8022 if ( v27 ) | |
8023 { | |
8024 v41 = v138; | |
8025 ++v115; | |
8026 v111 += 48; | |
8027 v124 += 48; | |
8028 v122 += 48; | |
8029 v133 += 48; | |
8030 v118 += 48; | |
8031 v129 += 48; | |
8032 ++v138; | |
8033 memcpy(v41, v26 + 4, 0x30u); | |
8034 } | |
8035 v24 = v107; | |
8036 v26 += 48; | |
8037 --v110; | |
8038 if ( v110 ) | |
8039 { | |
8040 v25 = v111; | |
8041 continue; | |
8042 } | |
8043 break; | |
8044 } | |
8045 if ( v115 < 3 | |
8046 || (v123 = 0, | |
8047 memcpy(&array_509950[v115], array_509950, sizeof(array_509950[v115])), | |
8048 v42 = array_509950[0].vWorldViewProjY + 6.7553994e15, | |
8049 v43 = SLODWORD(v42) >= (signed int)pViewport->uViewportTL_Y, | |
8050 v115 < 1) ) | |
8051 goto LABEL_112; | |
8052 v44 = (char *)&array_508FF0[0].vWorldViewProjX; | |
8053 v130 = array_508FF0; | |
8054 v119 = (char *)&array_508FF0[0].vWorldViewProjX; | |
8055 v139 = (char *)&array_508FF0[0].vWorldViewProjY; | |
8056 v125 = (char *)&array_508FF0[0].flt_2C; | |
8057 v134 = (char *)&array_508FF0[0]._rhw; | |
8058 v45 = (char *)&array_509950[0].flt_2C; | |
8059 v112 = v115; | |
8060 while ( 2 ) | |
8061 { | |
8062 v98 = *((float *)v45 + 8) + 6.7553994e15; | |
8063 v46 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; | |
8064 v108 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y; | |
8065 if ( v43 != v46 ) | |
8066 { | |
8067 v47 = v104; | |
8068 if ( SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y ) | |
8069 { | |
8070 v48 = (v47 - *((float *)v45 - 4)) / (*((float *)v45 + 8) - *((float *)v45 - 4)); | |
8071 *(float *)v44 = (*((float *)v45 + 7) - *((float *)v45 - 5)) * v48 + *((float *)v45 - 5); | |
8072 *(float *)v134 = (*((float *)v45 + 9) - *((float *)v45 - 3)) * v48 + *((float *)v45 - 3); | |
8073 v49 = (*((float *)v45 + 12) - *(float *)v45) * v48 + *(float *)v45; | |
8074 } | |
8075 else | |
8076 { | |
8077 v50 = (v47 - *((float *)v45 + 8)) / (*((float *)v45 - 4) - *((float *)v45 + 8)); | |
8078 *(float *)v44 = (*((float *)v45 - 5) - *((float *)v45 + 7)) * v50 + *((float *)v45 + 7); | |
8079 *(float *)v134 = (*((float *)v45 - 3) - *((float *)v45 + 9)) * v50 + *((float *)v45 + 9); | |
8080 v49 = (*(float *)v45 - *((float *)v45 + 12)) * v50 + *((float *)v45 + 12); | |
8081 } | |
8082 *(float *)v125 = v49; | |
8083 *(float *)v139 = v104; | |
8084 if ( v43 ) | |
8085 { | |
8086 v51 = v104 + 6.7553994e15; | |
8087 v52 = *((float *)v45 - 4) + 6.7553994e15; | |
8088 if ( LODWORD(v51) == LODWORD(v52) ) | |
8089 { | |
8090 v53 = *(float *)v44 + 6.7553994e15; | |
8091 v54 = *((float *)v45 - 5) + 6.7553994e15; | |
8092 v55 = LODWORD(v53) == LODWORD(v54); | |
8093 goto LABEL_58; | |
8094 } | |
8095 goto LABEL_59; | |
8096 } | |
8097 v56 = v104 + 6.7553994e15; | |
8098 v57 = *((float *)v45 + 8) + 6.7553994e15; | |
8099 if ( LODWORD(v56) != LODWORD(v57) ) | |
8100 goto LABEL_59; | |
8101 v58 = *(float *)v44 + 6.7553994e15; | |
8102 v59 = *((float *)v45 + 7) + 6.7553994e15; | |
8103 v55 = LODWORD(v58) == LODWORD(v59); | |
8104 LABEL_58: | |
8105 if ( !v55 ) | |
8106 { | |
8107 LABEL_59: | |
8108 v139 += 48; | |
8109 v125 += 48; | |
8110 v134 += 48; | |
8111 v44 += 48; | |
8112 ++v123; | |
8113 ++v130; | |
8114 v119 = v44; | |
8115 } | |
8116 } | |
8117 if ( v46 ) | |
8118 { | |
8119 v60 = v130; | |
8120 v119 += 48; | |
8121 ++v123; | |
8122 v134 += 48; | |
8123 v125 += 48; | |
8124 v139 += 48; | |
8125 ++v130; | |
8126 memcpy(v60, v45 + 4, 0x30u); | |
8127 v44 = v119; | |
8128 } | |
8129 v43 = v108; | |
8130 v45 += 48; | |
8131 --v112; | |
8132 if ( v112 ) | |
8133 continue; | |
8134 break; | |
8135 } | |
8136 if ( v123 < 3 | |
8137 || (v116 = 0, | |
8138 memcpy(&array_508FF0[v123], array_508FF0, sizeof(array_508FF0[v123])), | |
8139 v61 = array_508FF0[0].vWorldViewProjY + 6.7553994e15, | |
8140 v62 = SLODWORD(v61) <= (signed int)pViewport->uViewportBR_Y, | |
8141 v123 < 1) ) | |
8142 goto LABEL_112; | |
8143 v63 = (char *)&array_508690[0].vWorldViewProjX; | |
8144 v131 = array_508690; | |
8145 v120 = (char *)&array_508690[0].vWorldViewProjX; | |
8146 v140 = (char *)&array_508690[0].vWorldViewProjY; | |
8147 v126 = (char *)&array_508690[0].flt_2C; | |
8148 v135 = (char *)&array_508690[0]._rhw; | |
8149 v64 = (char *)&array_508FF0[0].flt_2C; | |
8150 v113 = v123; | |
8151 while ( 2 ) | |
8152 { | |
8153 v99 = *((float *)v64 + 8) + 6.7553994e15; | |
8154 v65 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; | |
8155 v109 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y; | |
8156 if ( v62 != v65 ) | |
8157 { | |
8158 v66 = v102; | |
8159 if ( SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y ) | |
8160 { | |
8161 v67 = (v66 - *((float *)v64 - 4)) / (*((float *)v64 + 8) - *((float *)v64 - 4)); | |
8162 *(float *)v63 = (*((float *)v64 + 7) - *((float *)v64 - 5)) * v67 + *((float *)v64 - 5); | |
8163 *(float *)v135 = (*((float *)v64 + 9) - *((float *)v64 - 3)) * v67 + *((float *)v64 - 3); | |
8164 v68 = (*((float *)v64 + 12) - *(float *)v64) * v67 + *(float *)v64; | |
8165 } | |
8166 else | |
8167 { | |
8168 v69 = (v66 - *((float *)v64 + 8)) / (*((float *)v64 - 4) - *((float *)v64 + 8)); | |
8169 *(float *)v63 = (*((float *)v64 - 5) - *((float *)v64 + 7)) * v69 + *((float *)v64 + 7); | |
8170 *(float *)v135 = (*((float *)v64 - 3) - *((float *)v64 + 9)) * v69 + *((float *)v64 + 9); | |
8171 v68 = (*(float *)v64 - *((float *)v64 + 12)) * v69 + *((float *)v64 + 12); | |
8172 } | |
8173 *(float *)v126 = v68; | |
8174 *(float *)v140 = v102; | |
8175 if ( v62 ) | |
8176 { | |
8177 v70 = v102 + 6.7553994e15; | |
8178 v71 = *((float *)v64 - 4) + 6.7553994e15; | |
8179 if ( LODWORD(v70) == LODWORD(v71) ) | |
8180 { | |
8181 v72 = *(float *)v63 + 6.7553994e15; | |
8182 v73 = *((float *)v64 - 5) + 6.7553994e15; | |
8183 v74 = LODWORD(v72) == LODWORD(v73); | |
8184 goto LABEL_75; | |
8185 } | |
8186 goto LABEL_76; | |
8187 } | |
8188 v75 = v102 + 6.7553994e15; | |
8189 v76 = *((float *)v64 + 8) + 6.7553994e15; | |
8190 if ( LODWORD(v75) != LODWORD(v76) ) | |
8191 goto LABEL_76; | |
8192 v77 = *(float *)v63 + 6.7553994e15; | |
8193 v78 = *((float *)v64 + 7) + 6.7553994e15; | |
8194 v74 = LODWORD(v77) == LODWORD(v78); | |
8195 LABEL_75: | |
8196 if ( !v74 ) | |
8197 { | |
8198 LABEL_76: | |
8199 v140 += 48; | |
8200 v126 += 48; | |
8201 v135 += 48; | |
8202 v63 += 48; | |
8203 ++v116; | |
8204 ++v131; | |
8205 v120 = v63; | |
8206 } | |
8207 } | |
8208 if ( v65 ) | |
8209 { | |
8210 v79 = v131; | |
8211 v120 += 48; | |
8212 ++v116; | |
8213 v135 += 48; | |
8214 v126 += 48; | |
8215 v140 += 48; | |
8216 ++v131; | |
8217 memcpy(v79, v64 + 4, 0x30u); | |
8218 v63 = v120; | |
8219 } | |
8220 v62 = v109; | |
8221 v64 += 48; | |
8222 --v113; | |
8223 if ( v113 ) | |
8224 continue; | |
8225 break; | |
8226 } | |
8227 if ( v116 < 3 ) | |
8228 goto LABEL_112; | |
8229 v80 = v116; | |
8230 memcpy(&array_508690[v116], array_508690, sizeof(array_508690[v116])); | |
8231 if ( v116 > 0 ) | |
8232 { | |
8233 v81 = (char *)&array_508690[0].vWorldViewProjX; | |
8234 v82 = v116; | |
8235 do | |
8236 { | |
8237 LODWORD(v83) = *(int *)v81; | |
8238 *((float *)v81 - 3) = 1.0 / *((float *)v81 + 2); | |
8239 v84 = v83 + 6.7553994e15; | |
8240 if ( SLODWORD(v84) <= (signed int)pViewport->uViewportBR_X ) | |
8241 { | |
8242 v86 = *(float *)v81 + 6.7553994e15; | |
8243 if ( SLODWORD(v86) >= (signed int)pViewport->uViewportTL_X ) | |
8244 goto LABEL_88; | |
8245 v85 = v101; | |
8246 } | |
8247 else | |
8248 { | |
8249 v85 = v100; | |
8250 } | |
8251 *(int *)v81 = LODWORD(v85); | |
8252 LABEL_88: | |
8253 v87 = *((float *)v81 + 1) + 6.7553994e15; | |
8254 if ( SLODWORD(v87) > (signed int)pViewport->uViewportBR_Y ) | |
8255 { | |
8256 v88 = v102; | |
8257 LABEL_92: | |
8258 *((int *)v81 + 1) = LODWORD(v88); | |
8259 goto LABEL_93; | |
8260 } | |
8261 v89 = *((float *)v81 + 1) + 6.7553994e15; | |
8262 if ( SLODWORD(v89) < (signed int)pViewport->uViewportTL_Y ) | |
8263 { | |
8264 v88 = v104; | |
8265 goto LABEL_92; | |
8266 } | |
8267 LABEL_93: | |
8268 v81 += 48; | |
8269 --v82; | |
8270 } | |
8271 while ( v82 ); | |
8272 } | |
8273 v91 = __OFSUB__(v116, 3); | |
8274 v90 = v116 - 3 < 0; | |
8275 if ( v116 > 3 ) | |
8276 { | |
8277 memcpy(&array_508690[v116 + 1], &array_508690[1], sizeof(array_508690[v116 + 1])); | |
8278 if ( v116 > 0 ) | |
8279 { | |
8280 v105 = 1; | |
8281 do | |
8282 { | |
8283 v92 = v105; | |
8284 v93 = v105 - 1; | |
8285 v94 = v105 + 1; | |
8286 v95 = v105 + 1; | |
8287 if ( v105 - 1 >= v80 ) | |
8288 v93 -= v80; | |
8289 if ( v105 >= v80 ) | |
8290 v92 = v105 - v80; | |
8291 if ( v94 >= v80 ) | |
8292 v95 = v94 - v80; | |
8293 if ( (array_508690[v92].vWorldViewProjX - array_508690[v93].vWorldViewProjX) | |
8294 * (array_508690[v95].vWorldViewProjY - array_508690[v93].vWorldViewProjY) | |
8295 - (array_508690[v95].vWorldViewProjX - array_508690[v93].vWorldViewProjX) | |
8296 * (array_508690[v92].vWorldViewProjY - array_508690[v93].vWorldViewProjY) < 0.0 ) | |
8297 { | |
8298 ++v105; | |
8299 } | |
8300 else | |
8301 { | |
8302 v96 = v105; | |
8303 if ( v105 < v80 || (v96 = v105 - v80, v105 - v80 < v80) ) | |
8304 memcpy(&array_508690[v96], &array_508690[v96 + 1], 4 * ((unsigned int)(48 * v80 - 48 * v96) >> 2)); | |
8305 --v80; | |
8306 } | |
8307 } | |
8308 while ( v105 - 1 < v80 ); | |
8309 } | |
8310 v91 = __OFSUB__(v80, 3); | |
8311 v90 = v80 - 3 < 0; | |
8312 } | |
8313 if ( v90 ^ v91 ) | |
8314 LABEL_112: | |
8315 result = 0; | |
8316 else | |
8317 result = v80; | |
8318 return result; | |
8319 } | |
8320 | |
8321 | |
8322 //----- (00424579) -------------------------------------------------------- | |
8323 int __fastcall sr_424579(int uFaceID, stru320 *a2) | |
8324 { | |
8325 BLVFace *v2; // eax@1 | |
8326 Vec3_short_ *v3; // ebx@1 | |
8327 Vec3_short_ *v4; // esi@1 | |
8328 unsigned int v5; // esi@3 | |
8329 int v7; // ST1C_4@5 | |
8330 int v8; // ST1C_4@5 | |
8331 int v9; // ST1C_4@5 | |
8332 int v10; // ST1C_4@5 | |
8333 int v11; // esi@5 | |
8334 int v12; // ST1C_4@5 | |
8335 unsigned int v15; // ecx@8 | |
8336 unsigned int v19; // ecx@13 | |
8337 signed int v20; // ecx@16 | |
8338 signed int result; // eax@20 | |
8339 signed int v24; // edx@22 | |
8340 unsigned int v25; // [sp+Ch] [bp-1Ch]@3 | |
8341 float v26; // [sp+14h] [bp-14h]@3 | |
8342 float v27; // [sp+1Ch] [bp-Ch]@3 | |
8343 float v28; // [sp+20h] [bp-8h]@3 | |
8344 signed int v29; // [sp+24h] [bp-4h]@3 | |
8345 | |
8346 v2 = &pIndoor->pFaces[uFaceID]; | |
8347 v3 = pIndoor->pVertices; | |
8348 v4 = &pIndoor->pVertices[*v2->pVertexIDs]; | |
8349 if ( v2->pFacePlane_old.vNormal.x * ((signed __int16)*(int *)&v4->x - pBLVRenderParams->vPartyPos.x) | |
8350 + v2->pFacePlane_old.vNormal.y * ((signed __int16)(*(int *)&v4->x >> 16) - pBLVRenderParams->vPartyPos.y) | |
8351 + v2->pFacePlane_old.vNormal.z * (v4->z - pBLVRenderParams->vPartyPos.z) < 0 ) | |
8352 { | |
8353 PortalFace.field_0 = 1; | |
8354 } | |
8355 else | |
8356 { | |
8357 PortalFace.field_0 = 0; | |
8358 if ( !(v2->uAttributes & 1) ) | |
8359 return 0; | |
8360 } | |
8361 v29 = 0; | |
8362 v5 = v2->uNumVertices; | |
8363 __asm { fld pBLVRenderParams->fCosineY } | |
8364 v28 = pBLVRenderParams->fSineY; | |
8365 v26 = pBLVRenderParams->fCosineNegX; | |
8366 v27 = pBLVRenderParams->fSineNegX; | |
8367 v25 = v5; | |
8368 if ( (signed int)v5 > 0 ) | |
8369 { | |
8370 _ECX = (char *)&array_50AC10[0].vWorldPosition.z; | |
8371 do | |
8372 { | |
8373 v7 = v3[v2->pVertexIDs[v29]].x; | |
8374 __asm | |
8375 { | |
8376 fild [ebp+var_10] | |
8377 fstp dword ptr [ecx-8] | |
8378 } | |
8379 v8 = v3[v2->pVertexIDs[v29]].y; | |
8380 __asm | |
8381 { | |
8382 fild [ebp+var_10] | |
8383 fstp dword ptr [ecx-4] | |
8384 } | |
8385 v9 = v3[v2->pVertexIDs[v29]].z; | |
8386 __asm | |
8387 { | |
8388 fild [ebp+var_10] | |
8389 fstp dword ptr [ecx] | |
8390 } | |
8391 _ECX += 48; | |
8392 v10 = a2->pDeltaUV[0] + v2->pVertexUIDs[v29]; | |
8393 __asm | |
8394 { | |
8395 fild [ebp+var_10] | |
8396 fstp dword ptr [ecx-14h] | |
8397 } | |
8398 v11 = a2->pDeltaUV[1] + v2->pVertexVIDs[v29++]; | |
8399 v12 = v11; | |
8400 v5 = v25; | |
8401 __asm | |
8402 { | |
8403 fild [ebp+var_10] | |
8404 fstp dword ptr [ecx-10h] | |
8405 } | |
8406 } | |
8407 while ( v29 < (signed int)v25 ); | |
8408 } | |
8409 _EDX = (char *)&array_50AC10[0].vWorldViewPosition; | |
8410 if ( pBLVRenderParams->sPartyRotX ) | |
8411 { | |
8412 if ( (signed int)v5 > 0 ) | |
8413 { | |
8414 __asm | |
8415 { | |
8416 fild pBLVRenderParams->vPartyPos.x | |
8417 fild pBLVRenderParams->vPartyPos.y | |
8418 fild pBLVRenderParams->vPartyPos.z | |
8419 } | |
8420 _EAX = (char *)&array_50AC10[0].vWorldPosition.z; | |
8421 v15 = v5; | |
8422 do | |
8423 { | |
8424 __asm | |
8425 { | |
8426 fld dword ptr [eax-8] | |
8427 fsub st, st(3) | |
8428 fld dword ptr [eax-4] | |
8429 fsub st, st(3) | |
8430 fld st(1) | |
8431 fmul st, st(6) | |
8432 fld st(1) | |
8433 fmul [ebp+var_8] | |
8434 fsubp st(1), st | |
8435 fstp [ebp+var_4] | |
8436 fld dword ptr [eax] | |
8437 fsub st, st(3) | |
8438 } | |
8439 _EAX += 48; | |
8440 --v15; | |
8441 __asm | |
8442 { | |
8443 fstp [ebp+var_10] | |
8444 fld [ebp+var_4] | |
8445 fmul [ebp+var_14] | |
8446 fld [ebp+var_10] | |
8447 fmul [ebp+var_C] | |
8448 fsubp st(1), st | |
8449 fstp dword ptr [eax-2Ch] | |
8450 fld st(1) | |
8451 fmul [ebp+var_8] | |
8452 fld st(1) | |
8453 fmul st, st(7) | |
8454 faddp st(1), st | |
8455 fstp dword ptr [eax-28h] | |
8456 fstp st | |
8457 fstp st | |
8458 fld [ebp+var_4] | |
8459 fmul [ebp+var_C] | |
8460 fld [ebp+var_10] | |
8461 fmul [ebp+var_14] | |
8462 faddp st(1), st | |
8463 fstp dword ptr [eax-24h] | |
8464 } | |
8465 } | |
8466 while ( v15 ); | |
8467 LABEL_15: | |
8468 __asm | |
8469 { | |
8470 fstp st | |
8471 fstp st | |
8472 fstp st | |
8473 } | |
8474 goto LABEL_16; | |
8475 } | |
8476 } | |
8477 else | |
8478 { | |
8479 if ( (signed int)v5 > 0 ) | |
8480 { | |
8481 __asm | |
8482 { | |
8483 fild pBLVRenderParams->vPartyPos.x | |
8484 fild pBLVRenderParams->vPartyPos.y | |
8485 fild pBLVRenderParams->vPartyPos.z | |
8486 } | |
8487 _EAX = (char *)&array_50AC10[0].vWorldViewPosition; | |
8488 v19 = v5; | |
8489 do | |
8490 { | |
8491 __asm | |
8492 { | |
8493 fld dword ptr [eax-0Ch] | |
8494 fsub st, st(3) | |
8495 fld dword ptr [eax-8] | |
8496 fsub st, st(3) | |
8497 fld st(1) | |
8498 fmul st, st(6) | |
8499 fld st(1) | |
8500 fmul [ebp+var_8] | |
8501 fsubp st(1), st | |
8502 fstp dword ptr [eax] | |
8503 fld st(1) | |
8504 fmul [ebp+var_8] | |
8505 fld st(1) | |
8506 fmul st, st(7) | |
8507 } | |
8508 _EAX += 48; | |
8509 --v19; | |
8510 __asm | |
8511 { | |
8512 faddp st(1), st | |
8513 fstp dword ptr [eax-2Ch] | |
8514 fstp st | |
8515 fstp st | |
8516 fld dword ptr [eax-34h] | |
8517 fsub st, st(1) | |
8518 fstp dword ptr [eax-28h] | |
8519 } | |
8520 } | |
8521 while ( v19 ); | |
8522 goto LABEL_15; | |
8523 } | |
8524 } | |
8525 LABEL_16: | |
8526 v20 = 0; | |
8527 __asm { fstp st } | |
8528 if ( (signed int)v5 <= 0 ) | |
8529 return 0; | |
8530 do | |
8531 { | |
8532 __asm | |
8533 { | |
8534 fld dword ptr [edx] | |
8535 fcomp ds:flt_4D8524 | |
8536 fnstsw ax | |
8537 } | |
8538 if ( !(HIBYTE(_AX) & 1) ) | |
8539 break; | |
8540 ++v20; | |
8541 _EDX += 48; | |
8542 } | |
8543 while ( v20 < (signed int)v5 ); | |
8544 if ( v20 >= (signed int)v5 ) | |
8545 return 0; | |
8546 result = sr_424CD7(v5); | |
8547 if ( result > 0 ) | |
8548 { | |
8549 __asm { fild pBLVRenderParams->field_40 } | |
8550 _ECX = (char *)&array_507D30[0].vWorldViewPosition; | |
8551 v24 = result; | |
8552 __asm | |
8553 { | |
8554 fmul ds:flt_4D84A4 | |
8555 fild pBLVRenderParams->uViewportCenterX | |
8556 fild pBLVRenderParams->uViewportCenterY | |
8557 } | |
8558 do | |
8559 { | |
8560 __asm | |
8561 { | |
8562 fld1 | |
8563 fdiv dword ptr [ecx] | |
8564 } | |
8565 _ECX += 48; | |
8566 --v24; | |
8567 __asm | |
8568 { | |
8569 fld st | |
8570 fmul dword ptr [ecx-2Ch] | |
8571 fmul st, st(4) | |
8572 fsubr st, st(3) | |
8573 fstp dword ptr [ecx-24h] | |
8574 fmul dword ptr [ecx-28h] | |
8575 fmul st, st(3) | |
8576 fsubr st, st(1) | |
8577 fstp dword ptr [ecx-20h] | |
8578 } | |
8579 } | |
8580 while ( v24 ); | |
8581 __asm | |
8582 { | |
8583 fstp st | |
8584 fstp st | |
8585 fstp st | |
8586 } | |
8587 } | |
8588 memcpy(&array_507D30[result], array_507D30, sizeof(array_507D30[result])); | |
8589 return result; | |
8590 } | |
8591 | |
8592 //----- (00423B4A) -------------------------------------------------------- | |
8593 void __cdecl sub_423B4A() | |
8594 { | |
8595 float *v0; // eax@1 | |
8596 signed int v1; // ecx@1 | |
8597 | |
8598 v0 = &array_507D30[0].flt_2C; | |
8599 v1 = 50; | |
8600 do | |
8601 { | |
8602 *v0 = 0.0; | |
8603 v0 += 12; | |
8604 --v1; | |
8605 } | |
8606 while ( v1 ); | |
8607 } | |
8608 | |
8609 //----- (004AD504) -------------------------------------------------------- | |
8610 int __fastcall sr_4AD504(signed int sFaceID) | |
8611 { | |
8612 int result; // eax@1 | |
8613 signed int v2; // ebx@1 | |
8614 BLVFace *v3; // esi@3 | |
8615 Texture *v4; // edi@6 | |
8616 int v5; // eax@7 | |
8617 int v6; // edx@7 | |
8618 int v7; // ecx@7 | |
8619 int v8; // ebx@8 | |
8620 int v9; // eax@8 | |
8621 int v10; // ebx@8 | |
8622 unsigned int v11; // ebx@9 | |
8623 int v12; // esi@10 | |
8624 int v13; // eax@13 | |
8625 unsigned __int16 *v14; // eax@13 | |
8626 unsigned int v15; // eax@14 | |
8627 unsigned __int16 *v16; // ebx@14 | |
8628 int v17; // eax@15 | |
8629 int v18; // ebx@15 | |
8630 int v19; // esi@15 | |
8631 int v20; // ecx@15 | |
8632 int v21; // eax@15 | |
8633 stru193_math *v22; // ebx@15 | |
8634 int v23; // eax@15 | |
8635 char *v24; // esi@16 | |
8636 int v25; // eax@18 | |
8637 int v26; // eax@18 | |
8638 int v27; // eax@20 | |
8639 signed int v28; // esi@20 | |
8640 signed int v29; // edx@20 | |
8641 signed int v30; // esi@20 | |
8642 signed int v31; // edi@20 | |
8643 int v32; // esi@20 | |
8644 int v33; // eax@26 | |
8645 int *v34; // esi@27 | |
8646 unsigned __int16 *v35; // edi@27 | |
8647 unsigned int v36; // edx@27 | |
8648 int v37; // ebx@27 | |
8649 char v38; // cl@27 | |
8650 char v39; // ch@27 | |
8651 int v40; // ebx@29 | |
8652 int v41; // edx@29 | |
8653 unsigned int v42; // ebx@30 | |
8654 int v43; // edx@30 | |
8655 int v44; // eax@33 | |
8656 int *v45; // esi@34 | |
8657 unsigned __int16 *v46; // edi@34 | |
8658 unsigned int v47; // edx@34 | |
8659 int v48; // ebx@34 | |
8660 char v49; // cl@34 | |
8661 char v50; // ch@34 | |
8662 int v51; // ebx@36 | |
8663 int v52; // edx@36 | |
8664 unsigned __int16 v53; // bx@37 | |
8665 int v54; // edx@37 | |
8666 int v55; // eax@40 | |
8667 int v56; // eax@41 | |
8668 int *v57; // esi@42 | |
8669 unsigned __int16 *v58; // edi@42 | |
8670 unsigned int v59; // edx@42 | |
8671 int v60; // ebx@42 | |
8672 char v61; // cl@42 | |
8673 char v62; // ch@42 | |
8674 unsigned int v63; // ebx@44 | |
8675 int v64; // edx@44 | |
8676 unsigned int v65; // ebx@44 | |
8677 int v66; // edx@44 | |
8678 unsigned int v67; // ebx@45 | |
8679 int v68; // edx@45 | |
8680 int v69; // ebx@45 | |
8681 int v70; // edx@45 | |
8682 int v71; // eax@48 | |
8683 int *v72; // esi@49 | |
8684 unsigned __int16 *v73; // edi@49 | |
8685 unsigned int v74; // edx@49 | |
8686 int v75; // ebx@49 | |
8687 char v76; // cl@49 | |
8688 char v77; // ch@49 | |
8689 unsigned int v78; // ebx@51 | |
8690 int v79; // edx@51 | |
8691 unsigned int v80; // ebx@51 | |
8692 int v81; // edx@51 | |
8693 unsigned int v82; // ebx@52 | |
8694 int v83; // edx@52 | |
8695 int v84; // ebx@52 | |
8696 int v85; // edx@52 | |
8697 unsigned __int8 *v86; // [sp+Ch] [bp-98h]@9 | |
8698 unsigned __int8 *v87; // [sp+10h] [bp-94h]@9 | |
8699 unsigned __int8 *v88; // [sp+14h] [bp-90h]@9 | |
8700 unsigned __int8 *v89; // [sp+18h] [bp-8Ch]@9 | |
8701 int v90; // [sp+1Ch] [bp-88h]@20 | |
8702 BLVFace *v91; // [sp+20h] [bp-84h]@3 | |
8703 int v92; // [sp+24h] [bp-80h]@7 | |
8704 int i; // [sp+28h] [bp-7Ch]@7 | |
8705 unsigned __int16 *v94; // [sp+2Ch] [bp-78h]@9 | |
8706 unsigned int v95; // [sp+30h] [bp-74h]@1 | |
8707 Texture *v96; // [sp+34h] [bp-70h]@6 | |
8708 int v97; // [sp+38h] [bp-6Ch]@15 | |
8709 unsigned int v98; // [sp+3Ch] [bp-68h]@9 | |
8710 int v99; // [sp+40h] [bp-64h]@9 | |
8711 int v100; // [sp+44h] [bp-60h]@24 | |
8712 int v101; // [sp+48h] [bp-5Ch]@10 | |
8713 int v102; // [sp+4Ch] [bp-58h]@20 | |
8714 int v103; // [sp+50h] [bp-54h]@20 | |
8715 int v104; // [sp+54h] [bp-50h]@9 | |
8716 unsigned __int8 *v105; // [sp+58h] [bp-4Ch]@20 | |
8717 int v106; // [sp+5Ch] [bp-48h]@24 | |
8718 int v107; // [sp+60h] [bp-44h]@20 | |
8719 int v108; // [sp+64h] [bp-40h]@20 | |
8720 int v109; // [sp+68h] [bp-3Ch]@20 | |
8721 int v110; // [sp+6Ch] [bp-38h]@15 | |
8722 int v111; // [sp+70h] [bp-34h]@20 | |
8723 int a1; // [sp+74h] [bp-30h]@12 | |
8724 int a2; // [sp+78h] [bp-2Ch]@9 | |
8725 int *v114; // [sp+7Ch] [bp-28h]@16 | |
8726 int v115; // [sp+80h] [bp-24h]@18 | |
8727 int v116; // [sp+84h] [bp-20h]@7 | |
8728 unsigned int v117; // [sp+88h] [bp-1Ch]@15 | |
8729 unsigned int v118; // [sp+8Ch] [bp-18h]@24 | |
8730 int *v119; // [sp+90h] [bp-14h]@13 | |
8731 int v120; // [sp+94h] [bp-10h]@15 | |
8732 unsigned int v121; // [sp+98h] [bp-Ch]@15 | |
8733 unsigned __int16 *v122; // [sp+9Ch] [bp-8h]@15 | |
8734 unsigned int v123; // [sp+A0h] [bp-4h]@13 | |
8735 | |
8736 result = pRenderer->uTargetSurfacePitch; | |
8737 v2 = sFaceID; | |
8738 v95 = pRenderer->uTargetSurfacePitch; | |
8739 if ( sFaceID >= 0 ) | |
8740 { | |
8741 if ( sFaceID < (signed int)pIndoor->uNumFaces ) | |
8742 { | |
8743 v3 = &pIndoor->pFaces[sFaceID]; | |
8744 v91 = &pIndoor->pFaces[sFaceID]; | |
8745 if ( !pRenderer->pRenderD3D ) | |
8746 { | |
8747 result = GetPortalScreenCoord(sFaceID); | |
8748 if ( result ) | |
8749 { | |
8750 result = PortalFrustrum(result, &stru_F8A590, pBLVRenderParams->field_7C, v2); | |
8751 if ( result ) | |
8752 { | |
8753 result = (int)v3->GetTexture(); | |
8754 v4 = (Texture *)result; | |
8755 v96 = (Texture *)result; | |
8756 if ( result ) | |
8757 { | |
8758 v5 = *(short *)(result + 38); | |
8759 LOBYTE(v3->uAttributes) |= 0x80u; | |
8760 v92 = v5; | |
8761 sr_4AE5F1(v2); | |
8762 ++pBLVRenderParams->field_84; | |
8763 v6 = stru_F8AD28.pDeltaUV[0]; | |
8764 v116 = stru_F8AD28.pDeltaUV[1]; | |
8765 v7 = 0; | |
8766 for ( i = bUseLoResSprites; v7 < stru_F8AD28.uNumLightsApplied; *(int *)v9 = v10 ) | |
8767 { | |
8768 v8 = v116; | |
8769 stru_F8AD28._blv_lights_xs[v7] += v6; | |
8770 v9 = 4 * v7 + 16297672; | |
8771 v10 = v8 - stru_F8AD28._blv_lights_ys[v7++]; | |
8772 } | |
8773 v94 = sr_sub_47C24C_get_palette(v3, v92, 0, 1); | |
8774 result = stru_F8A590._viewport_space_y; | |
8775 a2 = stru_F8A590._viewport_space_y; | |
8776 v11 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
8777 v99 = 640 * stru_F8A590._viewport_space_y; | |
8778 v86 = v4->pLevelOfDetail0_prolly_alpha_mask; | |
8779 v87 = v4->pLevelOfDetail1; | |
8780 v88 = v4->pLevelOfDetail2; | |
8781 v89 = v4->pLevelOfDetail3; | |
8782 v98 = stru_F8A590._viewport_space_y * pRenderer->uTargetSurfacePitch; | |
8783 v104 = 2 * pBLVRenderParams->field_0_timer_; | |
8784 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
8785 { | |
8786 v12 = 2 * stru_F8A590._viewport_space_y; | |
8787 v101 = 2 * stru_F8A590._viewport_space_y; | |
8788 while ( 1 ) | |
8789 { | |
8790 a1 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v12); | |
8791 sr_4AE313(a1, result, &stru_F81018.field_0); | |
8792 if ( LOBYTE(viewparams->field_20) ) | |
8793 { | |
8794 v15 = v95 * (v12 - pBLVRenderParams->uViewportY); | |
8795 v119 = &pBLVRenderParams->pTargetZBuffer[2 | |
8796 * (*(__int16 *)((char *)stru_F8A590.viewport_left_side + v12) | |
8797 + 320 * (v12 - pBLVRenderParams->uViewportY)) | |
8798 - pBLVRenderParams->uViewportX]; | |
8799 v16 = &pBLVRenderParams->pRenderTarget[v15 | |
8800 + 2 * *(__int16 *)((char *)stru_F8A590.viewport_left_side + v12) | |
8801 - pBLVRenderParams->uViewportX]; | |
8802 v14 = &pBLVRenderParams->pRenderTarget[v15 | |
8803 + 2 * *(__int16 *)((char *)stru_F8A590.viewport_right_side + v12) | |
8804 - pBLVRenderParams->uViewportX]; | |
8805 v123 = (unsigned int)v16; | |
8806 } | |
8807 else | |
8808 { | |
8809 v13 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v12); | |
8810 v119 = &pBLVRenderParams->pTargetZBuffer[v13 + v99]; | |
8811 v123 = (unsigned int)&pBLVRenderParams->pRenderTarget[v13 + v11]; | |
8812 v14 = &pBLVRenderParams->pRenderTarget[v11 + *(__int16 *)((char *)stru_F8A590.viewport_right_side + v12)]; | |
8813 } | |
8814 v117 = (unsigned int)v14; | |
8815 HIWORD(v17) = HIWORD(stru_F81018.field_0.field_0); | |
8816 v18 = stru_F81018.field_0.field_10; | |
8817 LOWORD(v17) = 0; | |
8818 v97 = stru_F8AD28.field_0 | v17; | |
8819 v110 = sr_4AE491(SHIWORD(stru_F81018.field_0.field_4), SHIWORD(stru_F81018.field_0.field_8)); | |
8820 v19 = stru_F81018.field_0.field_4 >> i; | |
8821 v20 = 11 - v18; | |
8822 v116 = stru_F81018.field_0.field_8 >> i; | |
8823 v21 = stru_F81018.field_0.field_8 >> i >> (11 - v18); | |
8824 v22 = stru_5C6E00; | |
8825 v122 = (unsigned __int16 *)v20; | |
8826 v121 = (stru_F81018.field_0.field_4 >> i) + 4 * stru_5C6E00->Cos(v104 + v21); | |
8827 v23 = stru_5C6E00->Sin(v104 + (v19 >> (char)v122)); | |
8828 v120 = v116 + 4 * v23; | |
8829 if ( v123 < v117 ) | |
8830 { | |
8831 v24 = (char *)&stru_F81018.field_34.field_8; | |
8832 v114 = &stru_F81018.field_34.field_8; | |
8833 a1 += 16; | |
8834 while ( 1 ) | |
8835 { | |
8836 sr_4AE313(a1, a2, (stru337_stru0 *)(v24 - 8)); | |
8837 v25 = *((int *)v24 - 2); | |
8838 LOWORD(v25) = 0; | |
8839 v115 = v97; | |
8840 v26 = stru_F8AD28.field_0 | v25; | |
8841 if ( v97 <= (unsigned int)v26 ) | |
8842 v115 = v26; | |
8843 v97 = v26; | |
8844 v27 = *((int *)v24 - 11); | |
8845 v28 = *((int *)v24 - 1); | |
8846 v105 = (&v86)[4 * v27]; | |
8847 v111 = v27 + 16; | |
8848 v29 = v4->uWidthMinus1; | |
8849 v109 = v27 + v27 + 16 - v4->uWidthLn2; | |
8850 v107 = v29 >> v27; | |
8851 v30 = v28 >> i; | |
8852 v102 = v4->uHeightMinus1 >> v27 << (v27 + 16); | |
8853 v31 = *v114 >> i; | |
8854 v122 = (unsigned __int16 *)(11 - v27); | |
8855 v116 = v30 + 4 * stru_5C6E00->Cos(v104 + (v31 >> (11 - v27))); | |
8856 v90 = v31 + 4 * stru_5C6E00->Sin(v104 + (v30 >> (char)v122)); | |
8857 v108 = (signed int)(v116 - v121) >> 4; | |
8858 v103 = (v90 - v120) >> 4; | |
8859 v32 = v123 + 32; | |
8860 if ( LOBYTE(viewparams->field_20) ) | |
8861 v32 = v123 + 64; | |
8862 if ( v32 > v117 ) | |
8863 v32 = v117; | |
8864 v118 = v32; | |
8865 v100 = sr_4AE491(*((short *)v114 - 1), *((short *)v114 + 1)); | |
8866 v106 = (signed int)(v32 - v123) >> 1; | |
8867 if ( v110 >> 16 == v100 >> 16 ) | |
8868 { | |
8869 v122 = sr_sub_47C24C_get_palette(v91, v92, v110 >> 16, 1); | |
8870 if ( LOBYTE(viewparams->field_20) ) | |
8871 { | |
8872 v44 = v123; | |
8873 if ( v123 < v118 ) | |
8874 { | |
8875 v45 = v119; | |
8876 v46 = v122; | |
8877 v47 = v121; | |
8878 v48 = v120; | |
8879 v49 = v111; | |
8880 v50 = v109; | |
8881 if ( v106 & 2 ) | |
8882 { | |
8883 *v119 = v115; | |
8884 v45 -= 2; | |
8885 v44 = v123 + 4; | |
8886 goto LABEL_37; | |
8887 } | |
8888 do | |
8889 { | |
8890 v44 += 8; | |
8891 v51 = *(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50)); | |
8892 v52 = v115; | |
8893 LOWORD(v51) = v46[v51]; | |
8894 *v45 = v115; | |
8895 v45[1] = v52; | |
8896 v45[640] = v52; | |
8897 v45[641] = v52; | |
8898 *(short *)(v44 - 8) = v51; | |
8899 *(short *)(v44 - 6) = v51; | |
8900 *(short *)(v44 + 1272) = v51; | |
8901 *(short *)(v44 + 1274) = v51; | |
8902 v45[2] = v52; | |
8903 v45[3] = v52; | |
8904 v45[642] = v52; | |
8905 v45[643] = v52; | |
8906 v121 += v108; | |
8907 v120 += v103; | |
8908 v47 = v121; | |
8909 v48 = v120; | |
8910 LABEL_37: | |
8911 v45 += 4; | |
8912 v53 = v46[*(&v105[v107 & (v47 >> v49)] + ((v102 & (unsigned int)v48) >> v50))]; | |
8913 v54 = v108; | |
8914 *(short *)(v44 - 4) = v53; | |
8915 *(short *)(v44 - 2) = v53; | |
8916 *(short *)(v44 + 1276) = v53; | |
8917 *(short *)(v44 + 1278) = v53; | |
8918 v121 += v54; | |
8919 v120 += v103; | |
8920 v47 = v121; | |
8921 v48 = v120; | |
8922 } | |
8923 while ( v44 < v118 ); | |
8924 v123 = v44; | |
8925 v119 = v45; | |
8926 } | |
8927 } | |
8928 else | |
8929 { | |
8930 v33 = v123; | |
8931 if ( v123 < v118 ) | |
8932 { | |
8933 v34 = v119; | |
8934 v35 = v122; | |
8935 v36 = v121; | |
8936 v37 = v120; | |
8937 v38 = v111; | |
8938 v39 = v109; | |
8939 if ( v106 & 1 ) | |
8940 { | |
8941 *v119 = v115; | |
8942 --v34; | |
8943 v33 = v123 + 2; | |
8944 goto LABEL_30; | |
8945 } | |
8946 do | |
8947 { | |
8948 v33 += 4; | |
8949 v40 = *(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
8950 v41 = v115; | |
8951 LOWORD(v40) = v35[v40]; | |
8952 *v34 = v115; | |
8953 *(short *)(v33 - 4) = v40; | |
8954 v34[1] = v41; | |
8955 v121 += v108; | |
8956 v120 += v103; | |
8957 v36 = v121; | |
8958 v37 = v120; | |
8959 LABEL_30: | |
8960 v42 = (unsigned int)(&v105[v107 & (v36 >> v38)] + ((v102 & (unsigned int)v37) >> v39)); | |
8961 v34 += 2; | |
8962 v43 = v108; | |
8963 *(short *)(v33 - 2) = v35[*(char *)v42]; | |
8964 v121 += v43; | |
8965 v120 += v103; | |
8966 v36 = v121; | |
8967 v37 = v120; | |
8968 } | |
8969 while ( v33 < v118 ); | |
8970 v123 = v33; | |
8971 v119 = v34; | |
8972 } | |
8973 } | |
8974 } | |
8975 else | |
8976 { | |
8977 v55 = v110 - ((v100 - v110) >> 4); | |
8978 v110 = (v100 - v110) >> 4; | |
8979 v122 = (unsigned __int16 *)v55; | |
8980 if ( LOBYTE(viewparams->field_20) ) | |
8981 { | |
8982 v71 = v123; | |
8983 if ( v123 < v118 ) | |
8984 { | |
8985 v72 = v119; | |
8986 v73 = v94; | |
8987 v74 = v121; | |
8988 v75 = v120; | |
8989 v76 = v111; | |
8990 v77 = v109; | |
8991 if ( v106 & 2 ) | |
8992 { | |
8993 *v119 = v115; | |
8994 v72 += 2; | |
8995 v71 = v123 + 4; | |
8996 goto LABEL_52; | |
8997 } | |
8998 do | |
8999 { | |
9000 v78 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
9001 v79 = (int)((char *)v122 + v110); | |
9002 v71 += 8; | |
9003 v122 = (unsigned __int16 *)v79; | |
9004 v80 = ((v79 & 0xFFFF0000u) >> 8) + v105[v78]; | |
9005 v81 = v115; | |
9006 LOWORD(v80) = v73[v80]; | |
9007 *v72 = v115; | |
9008 v72[1] = v81; | |
9009 v72[640] = v81; | |
9010 v72[641] = v81; | |
9011 *(short *)(v71 - 8) = v80; | |
9012 *(short *)(v71 - 6) = v80; | |
9013 *(short *)(v71 + 1272) = v80; | |
9014 *(short *)(v71 + 1274) = v80; | |
9015 v72[2] = v81; | |
9016 v72[3] = v81; | |
9017 v72[642] = v81; | |
9018 v72[643] = v81; | |
9019 v121 += v108; | |
9020 v120 += v103; | |
9021 v74 = v121; | |
9022 v75 = v120; | |
9023 v72 += 4; | |
9024 LABEL_52: | |
9025 v82 = (v107 & (v74 >> v76)) + ((v102 & (unsigned int)v75) >> v77); | |
9026 v83 = (int)((char *)v122 + v110); | |
9027 v84 = v105[v82]; | |
9028 v122 = (unsigned __int16 *)v83; | |
9029 LOWORD(v84) = v73[((v83 & 0xFFFF0000u) >> 8) + v84]; | |
9030 v85 = v108; | |
9031 *(short *)(v71 - 4) = v84; | |
9032 *(short *)(v71 - 2) = v84; | |
9033 *(short *)(v71 + 1276) = v84; | |
9034 *(short *)(v71 + 1278) = v84; | |
9035 v121 += v85; | |
9036 v120 += v103; | |
9037 v74 = v121; | |
9038 v75 = v120; | |
9039 } | |
9040 while ( v71 < v118 ); | |
9041 v123 = v71; | |
9042 v119 = v72; | |
9043 } | |
9044 } | |
9045 else | |
9046 { | |
9047 v56 = v123; | |
9048 if ( v123 < v118 ) | |
9049 { | |
9050 v57 = v119; | |
9051 v58 = v94; | |
9052 v59 = v121; | |
9053 v60 = v120; | |
9054 v61 = v111; | |
9055 v62 = v109; | |
9056 if ( v106 & 1 ) | |
9057 { | |
9058 *v119 = v115; | |
9059 ++v57; | |
9060 v56 = v123 + 2; | |
9061 goto LABEL_45; | |
9062 } | |
9063 do | |
9064 { | |
9065 v63 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
9066 v64 = (int)((char *)v122 + v110); | |
9067 v56 += 4; | |
9068 v122 = (unsigned __int16 *)v64; | |
9069 v65 = ((v64 & 0xFFFF0000u) >> 8) + v105[v63]; | |
9070 v66 = v115; | |
9071 LOWORD(v65) = v58[v65]; | |
9072 *v57 = v115; | |
9073 *(short *)(v56 - 4) = v65; | |
9074 v57[1] = v66; | |
9075 v121 += v108; | |
9076 v120 += v103; | |
9077 v59 = v121; | |
9078 v60 = v120; | |
9079 v57 += 2; | |
9080 LABEL_45: | |
9081 v67 = (v107 & (v59 >> v61)) + ((v102 & (unsigned int)v60) >> v62); | |
9082 v68 = (int)((char *)v122 + v110); | |
9083 v69 = v105[v67]; | |
9084 v122 = (unsigned __int16 *)v68; | |
9085 LOWORD(v69) = v58[((v68 & 0xFFFF0000u) >> 8) + v69]; | |
9086 v70 = v108; | |
9087 *(short *)(v56 - 2) = v69; | |
9088 v121 += v70; | |
9089 v120 += v103; | |
9090 v59 = v121; | |
9091 v60 = v120; | |
9092 } | |
9093 while ( v56 < v118 ); | |
9094 v123 = v56; | |
9095 v119 = v57; | |
9096 } | |
9097 } | |
9098 } | |
9099 v114 += 13; | |
9100 v110 = v100; | |
9101 a1 += 16; | |
9102 v4 = v96; | |
9103 v121 = v116; | |
9104 v120 = v90; | |
9105 if ( v123 >= v117 ) | |
9106 break; | |
9107 v24 = (char *)v114; | |
9108 v22 = stru_5C6E00; | |
9109 } | |
9110 } | |
9111 ++a2; | |
9112 v98 += v95; | |
9113 result = a2; | |
9114 v101 += 2; | |
9115 v99 += 640; | |
9116 if ( a2 > stru_F8A590._viewport_space_w ) | |
9117 break; | |
9118 v12 = v101; | |
9119 result = a2; | |
9120 v11 = v98; | |
9121 } | |
9122 } | |
9123 } | |
9124 } | |
9125 } | |
9126 } | |
9127 } | |
9128 } | |
9129 return result; | |
9130 } | |
9131 | |
9132 //----- (004AE313) -------------------------------------------------------- | |
9133 int __fastcall sr_4AE313(int viewport_space_x, int viewport_space_y, stru337_stru0 *p) | |
9134 { | |
9135 int _dy; // ebx@1 | |
9136 int _dx; // edi@1 | |
9137 int v5; // ecx@1 | |
9138 int v6; // esi@1 | |
9139 int v7; // ST18_4@2 | |
9140 signed __int64 v8; // qtt@3 | |
9141 unsigned int v9; // ecx@3 | |
9142 int result; // eax@8 | |
9143 int v11; // [sp+Ch] [bp-8h]@1 | |
9144 | |
9145 _dy = pBLVRenderParams->uViewportCenterY - viewport_space_y; | |
9146 _dx = pBLVRenderParams->uViewportCenterX - viewport_space_x; | |
9147 ++pBLVRenderParams->field_88; | |
9148 v5 = (pBLVRenderParams->uViewportCenterY - viewport_space_y) * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C; | |
9149 v6 = v5 + _dx * stru_F8AD28.vec_80.x; | |
9150 v11 = v5 + _dx * stru_F8AD28.vec_80.x; | |
9151 if ( v5 + _dx * stru_F8AD28.vec_80.x && (v7 = abs(stru_F8AD28.vec_80.z) >> 14, v7 <= abs(v6)) ) | |
9152 { | |
9153 LODWORD(v8) = stru_F8AD28.vec_80.z << 16; | |
9154 HIDWORD(v8) = stru_F8AD28.vec_80.z >> 16; | |
9155 v9 = v8 / v11; | |
9156 } | |
9157 else | |
9158 { | |
9159 v9 = 0x40000000u; | |
9160 } | |
9161 if ( (signed int)v9 >= stru_F8AD28.field_34 ) | |
9162 p->field_0 = v9; | |
9163 else | |
9164 p->field_0 = stru_F8AD28.field_34; | |
9165 p->field_4 = ((unsigned __int64)((_dy * stru_F8AD28.vec_8C.z + stru_F8AD28.vec_8C.x + _dx * stru_F8AD28.vec_8C.y) | |
9166 * (signed __int64)(signed int)v9) >> 16) | |
9167 + stru_F8AD28.field_98 | |
9168 + (stru_F8AD28.pDeltaUV[0] << 16); | |
9169 p->field_8 = ((unsigned __int64)((_dy * stru_F8AD28.vec_9C.z + stru_F8AD28.vec_9C.x + _dx * stru_F8AD28.vec_9C.y) | |
9170 * (signed __int64)(signed int)v9) >> 16) | |
9171 + stru_F8AD28.field_A8 | |
9172 + (stru_F8AD28.pDeltaUV[1] << 16); | |
9173 result = abs((__int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)(signed int)v9) >> 16); | |
9174 if ( result < 369620 || bUseLoResSprites ) | |
9175 { | |
9176 if ( result < 184810 ) | |
9177 p->field_10 = result > 92405; | |
9178 else | |
9179 p->field_10 = 2; | |
9180 } | |
9181 else | |
9182 { | |
9183 p->field_10 = 3; | |
9184 } | |
9185 return result; | |
9186 } | |
9187 //----- (004AE491) -------------------------------------------------------- | |
9188 int __fastcall sr_4AE491(signed int a1, signed int a2) | |
9189 { | |
9190 signed int v2; // eax@1 | |
9191 signed int v3; // edi@1 | |
9192 int v4; // ecx@1 | |
9193 int v5; // esi@2 | |
9194 int v6; // eax@2 | |
9195 int v7; // ebx@2 | |
9196 unsigned int v8; // ecx@2 | |
9197 int v9; // edx@5 | |
9198 int v10; // edx@7 | |
9199 unsigned int v11; // eax@8 | |
9200 int v13; // [sp+4h] [bp-18h]@2 | |
9201 int v14; // [sp+8h] [bp-14h]@2 | |
9202 signed int v15; // [sp+Ch] [bp-10h]@1 | |
9203 int v16; // [sp+14h] [bp-8h]@1 | |
9204 int v17; // [sp+18h] [bp-4h]@1 | |
9205 | |
9206 v2 = a1 >> SLOBYTE(stru_F8AD28.field_38); | |
9207 v3 = a2 >> SLOBYTE(stru_F8AD28.field_38); | |
9208 v17 = stru_F8AD28.uCurrentAmbientLightLevel; | |
9209 v4 = 0; | |
9210 v15 = v2; | |
9211 v16 = 0; | |
9212 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
9213 { | |
9214 do | |
9215 { | |
9216 v5 = v16; | |
9217 v13 = abs(v2 - stru_F8AD28._blv_lights_xs[v16]); | |
9218 v14 = abs(v3 - stru_F8AD28._blv_lights_ys[v16]); | |
9219 v6 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
9220 v7 = v13; | |
9221 v8 = v14; | |
9222 if ( v6 < v13 ) | |
9223 { | |
9224 v6 = v13; | |
9225 v7 = stru_F8AD28._blv_lights_light_dot_faces[v16]; | |
9226 } | |
9227 if ( v6 < v14 ) | |
9228 { | |
9229 v9 = v6; | |
9230 v6 = v14; | |
9231 v8 = v9; | |
9232 } | |
9233 if ( v7 < (signed int)v8 ) | |
9234 { | |
9235 v10 = v8; | |
9236 v8 = v7; | |
9237 v7 = v10; | |
9238 } | |
9239 v11 = ((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6; | |
9240 if ( (signed int)v11 < stru_F8AD28._blv_lights_radii[v5] ) | |
9241 v17 += 30 * (v11 * stru_F8AD28._blv_lights_inv_radii[v5] - 65536); | |
9242 ++v16; | |
9243 v2 = v15; | |
9244 } | |
9245 while ( v16 < stru_F8AD28.uNumLightsApplied ); | |
9246 v4 = 0; | |
9247 } | |
9248 if ( stru_F8AD28.field_3E4 != v4 ) | |
9249 v17 -= stru_F8AD28.field_3E8 * (v2 - stru_F8AD28.field_3F0) + stru_F8AD28.field_3EC * (v3 - stru_F8AD28.field_3F4); | |
9250 if ( v17 >= v4 ) | |
9251 { | |
9252 if ( v17 > 2031616 ) | |
9253 v17 = 2031616; | |
9254 } | |
9255 else | |
9256 { | |
9257 v17 = v4; | |
9258 } | |
9259 ++pBLVRenderParams->field_8C; | |
9260 return v17; | |
9261 } | |
9262 | |
9263 //----- (004AE5F1) -------------------------------------------------------- | |
9264 void __fastcall sr_4AE5F1(unsigned int uFaceID) | |
9265 { | |
9266 BLVFace *v1; // esi@1 | |
9267 BLVFaceExtra *v2; // ebx@1 | |
9268 int v3; // eax@1 | |
9269 int v4; // edi@1 | |
9270 Texture *v5; // edi@1 | |
9271 int v6; // eax@1 | |
9272 unsigned int v7; // eax@1 | |
9273 unsigned int v8; // ecx@1 | |
9274 unsigned int v9; // eax@1 | |
9275 unsigned int v10; // ecx@5 | |
9276 int v11; // edi@10 | |
9277 int v12; // ecx@10 | |
9278 int v13; // eax@10 | |
9279 int v14; // edx@10 | |
9280 int v15; // ebx@12 | |
9281 double v16; // st7@16 | |
9282 int v17; // eax@16 | |
9283 char *v18; // ebx@17 | |
9284 int v19; // ecx@19 | |
9285 int v20; // eax@19 | |
9286 int v21; // edx@21 | |
9287 int v22; // eax@23 | |
9288 int v23; // ST04_4@26 | |
9289 int v24; // edi@26 | |
9290 double v25; // st6@26 | |
9291 int v26; // eax@26 | |
9292 double v27; // st6@26 | |
9293 int v28; // ecx@26 | |
9294 char v29; // al@26 | |
9295 int v30; // edx@28 | |
9296 int v31; // ecx@28 | |
9297 BLVLightMM7 *v32; // ecx@32 | |
9298 int v33; // edi@33 | |
9299 int v34; // edx@33 | |
9300 int v35; // eax@33 | |
9301 int v36; // edi@35 | |
9302 int v37; // edx@37 | |
9303 int v38; // ebx@39 | |
9304 int v39; // edi@42 | |
9305 int v40; // eax@42 | |
9306 char *v41; // ebx@45 | |
9307 signed int v42; // ecx@47 | |
9308 int v43; // edi@47 | |
9309 int v44; // eax@49 | |
9310 int v45; // edx@51 | |
9311 int v46; // eax@53 | |
9312 int v47; // ST04_4@55 | |
9313 int v48; // edi@55 | |
9314 double v49; // st6@55 | |
9315 int v50; // eax@55 | |
9316 double v51; // st6@55 | |
9317 int v52; // eax@55 | |
9318 int v53; // ecx@57 | |
9319 int v54; // ecx@58 | |
9320 int v55; // ecx@59 | |
9321 int v56; // edx@62 | |
9322 int v57; // ecx@62 | |
9323 int v58; // eax@63 | |
9324 int v59; // edx@64 | |
9325 int v60; // ecx@67 | |
9326 int v61; // edx@67 | |
9327 int v62; // eax@68 | |
9328 int v63; // edx@69 | |
9329 signed int v64; // ecx@72 | |
9330 double v65; // st7@75 | |
9331 Vec3_int_ v66; // [sp+Ch] [bp-34h]@9 | |
9332 Vec3_int_ v67; // [sp+18h] [bp-28h]@9 | |
9333 BLVFaceExtra *v68; // [sp+24h] [bp-1Ch]@1 | |
9334 int v69; // [sp+28h] [bp-18h]@10 | |
9335 int v70; // [sp+2Ch] [bp-14h]@10 | |
9336 int X; // [sp+30h] [bp-10h]@10 | |
9337 int v72; // [sp+34h] [bp-Ch]@10 | |
9338 int v73; // [sp+38h] [bp-8h]@10 | |
9339 int v74; // [sp+3Ch] [bp-4h]@10 | |
9340 | |
9341 v1 = &pIndoor->pFaces[uFaceID]; | |
9342 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; | |
9343 v3 = v1->uBitmapID; | |
9344 v4 = v1->uBitmapID; | |
9345 v68 = v2; | |
9346 v5 = (Texture *)(v4 != -1 ? (int)&pBitmaps_LOD->pTextures[v3] : 0); | |
9347 v6 = 8 * uFaceID; | |
9348 LOBYTE(v6) = PID(OBJECT_BModel,uFaceID); | |
9349 stru_F8AD28.field_0 = v6; | |
9350 stru_F8AD28.plane_4.vNormal.x = v1->pFacePlane_old.vNormal.x; | |
9351 stru_F8AD28.plane_4.vNormal.y = v1->pFacePlane_old.vNormal.y; | |
9352 stru_F8AD28.plane_4.vNormal.z = v1->pFacePlane_old.vNormal.z; | |
9353 stru_F8AD28.plane_4.dist = v1->pFacePlane_old.dist; | |
9354 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; | |
9355 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; | |
9356 v7 = GetTickCount(); | |
9357 v8 = v1->uAttributes; | |
9358 v9 = v7 >> 3; | |
9359 if ( v8 & 4 ) | |
9360 { | |
9361 stru_F8AD28.pDeltaUV[1] -= v9 & v5->uHeightMinus1; | |
9362 } | |
9363 else | |
9364 { | |
9365 if ( v8 & 0x20 ) | |
9366 stru_F8AD28.pDeltaUV[1] += v9 & v5->uHeightMinus1; | |
9367 } | |
9368 v10 = v1->uAttributes; | |
9369 if ( BYTE1(v10) & 8 ) | |
9370 { | |
9371 stru_F8AD28.pDeltaUV[0] -= v9 & v5->uWidthMinus1; | |
9372 } | |
9373 else | |
9374 { | |
9375 if ( v10 & 0x40 ) | |
9376 stru_F8AD28.pDeltaUV[0] += v9 & v5->uWidthMinus1; | |
9377 } | |
9378 v1->_get_normals(&v67, &v66); | |
9379 stru_F8AD28.vec_14.x = v67.x; | |
9380 stru_F8AD28.vec_14.y = v67.y; | |
9381 stru_F8AD28.vec_14.z = v67.z; | |
9382 stru_F8AD28.vec_20.x = v66.x; | |
9383 stru_F8AD28.vec_20.y = v66.y; | |
9384 stru_F8AD28.vec_20.z = v66.z; | |
9385 stru_F8AD28.uDefaultAmbientLightLevel = v2->field_22; | |
9386 if ( pBLVRenderParams->sPartyRotX ) | |
9387 { | |
9388 v74 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
9389 v74 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v74; | |
9390 X = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
9391 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - X; | |
9392 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
9393 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
9394 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
9395 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
9396 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
9397 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
9398 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
9399 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
9400 v74 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
9401 v70 = (unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
9402 stru_F8AD28.vec_60.y = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
9403 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
9404 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
9405 stru_F8AD28.field_6C = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
9406 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
9407 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
9408 v74 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v70; | |
9409 X = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
9410 v72 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
9411 v70 = (unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
9412 stru_F8AD28.vec_70.x = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
9413 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
9414 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
9415 stru_F8AD28.vec_70.z = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
9416 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
9417 v74 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
9418 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
9419 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
9420 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
9421 v73 = -65536 * pBLVRenderParams->vPartyPos.z; | |
9422 v70 = (unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
9423 v12 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v70; | |
9424 v69 = (unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; | |
9425 v13 = pBLVRenderParams->vPartyPos.y; | |
9426 v70 = ((unsigned __int64)(v74 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
9427 + ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
9428 v14 = pBLVRenderParams->vPartyPos.x; | |
9429 } | |
9430 else | |
9431 { | |
9432 v70 = (unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
9433 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
9434 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
9435 - v70; | |
9436 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
9437 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
9438 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
9439 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
9440 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
9441 v70 = (unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
9442 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
9443 - v70; | |
9444 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
9445 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
9446 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
9447 v70 = (unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
9448 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
9449 - v70; | |
9450 v69 = (unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16; | |
9451 v14 = pBLVRenderParams->vPartyPos.x; | |
9452 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
9453 v13 = pBLVRenderParams->vPartyPos.y; | |
9454 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
9455 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
9456 v12 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
9457 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
9458 v11 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
9459 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
9460 v70 = -65536 * pBLVRenderParams->vPartyPos.z; | |
9461 } | |
9462 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
9463 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.z * pBLVRenderParams->vPartyPos.z | |
9464 + stru_F8AD28.plane_4.dist | |
9465 + stru_F8AD28.plane_4.vNormal.y * v13 | |
9466 + stru_F8AD28.plane_4.vNormal.x * v14; | |
9467 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
9468 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
9469 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
9470 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
9471 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
9472 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
9473 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
9474 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
9475 X = (unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v12) >> 16; | |
9476 v15 = v70; | |
9477 v70 = (unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v70) >> 16; | |
9478 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
9479 stru_F8AD28.field_98 = -(X + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v11) >> 16) + v70); | |
9480 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
9481 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
9482 X = (unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v12) >> 16; | |
9483 v69 = (unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16; | |
9484 v70 = (unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16; | |
9485 stru_F8AD28.field_38 = 0; | |
9486 stru_F8AD28.field_A8 = -(X | |
9487 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v11) >> 16) | |
9488 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v15) >> 16)); | |
9489 if ( *(int *)&v68->field_4 || *(int *)&v68->field_8 ) | |
9490 { | |
9491 stru_F8AD28.field_3E4 = 1; | |
9492 stru_F8AD28.field_3E8 = *(int *)&v68->field_4; | |
9493 stru_F8AD28.field_3EC = *(int *)&v68->field_8; | |
9494 stru_F8AD28.field_3F0 = v68->field_1E; | |
9495 stru_F8AD28.field_3F4 = v68->field_20; | |
9496 } | |
9497 else | |
9498 { | |
9499 stru_F8AD28.field_3E4 = 0; | |
9500 } | |
9501 v16 = 0.0039215689; | |
9502 v17 = 116 * v1->uSectorID; | |
9503 v69 = v17; | |
9504 v74 = 0; | |
9505 v73 = 0; | |
9506 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + *(__int16 *)((char *)&pIndoor->pSectors->uMinAmbientLightLevel + v17)) << 16; | |
9507 v70 = pMobileLightsStack->uNumLightsActive; | |
9508 if ( pMobileLightsStack->uNumLightsActive > 0 ) | |
9509 { | |
9510 v18 = (char *)&pMobileLightsStack->pLights[0].vPosition.y; | |
9511 do | |
9512 { | |
9513 if ( v74 >= 20 ) | |
9514 break; | |
9515 v19 = *((short *)v18 + 2); | |
9516 v20 = *((short *)v18 - 1); | |
9517 if ( v20 > v1->pBounding.x1 - v19 ) | |
9518 { | |
9519 if ( v20 < v19 + v1->pBounding.x2 ) | |
9520 { | |
9521 v21 = *(short *)v18; | |
9522 if ( v21 > v1->pBounding.y1 - v19 ) | |
9523 { | |
9524 if ( v21 < v19 + v1->pBounding.y2 ) | |
9525 { | |
9526 v22 = *((short *)v18 + 1); | |
9527 if ( v22 > v1->pBounding.z1 - v19 ) | |
9528 { | |
9529 if ( v22 < v19 + v1->pBounding.z2 ) | |
9530 { | |
9531 X = (v1->pFacePlane_old.dist | |
9532 + *((short *)v18 + 1) * v1->pFacePlane_old.vNormal.z | |
9533 + v21 * v1->pFacePlane_old.vNormal.y | |
9534 + *((short *)v18 - 1) * v1->pFacePlane_old.vNormal.x) >> 16; | |
9535 if ( X <= v19 ) | |
9536 { | |
9537 v23 = X; | |
9538 v24 = v74; | |
9539 stru_F8AD28._blv_lights_radii[v74] = v19; | |
9540 stru_F8AD28._blv_lights_inv_radii[v24] = 65536 / v19; | |
9541 *(int *)((char *)&stru_F8AD28.field_240 + v24 * 4) = *((short *)v18 + 5) << 16; | |
9542 stru_F8AD28._blv_lights_xs[v24] = *((short *)v18 - 1); | |
9543 stru_F8AD28._blv_lights_ys[v24] = *(short *)v18; | |
9544 stru_F8AD28._blv_lights_zs[v24] = *((short *)v18 + 1); | |
9545 v68 = (BLVFaceExtra *)(unsigned __int8)v18[6]; | |
9546 v25 = (double)(signed int)v68 * v16; | |
9547 v68 = (BLVFaceExtra *)(unsigned __int8)v18[7]; | |
9548 v26 = (unsigned __int8)v18[8]; | |
9549 *(float *)(v24 * 4 + 16297992) = v25; | |
9550 v27 = (double)(signed int)v68; | |
9551 v68 = (BLVFaceExtra *)v26; | |
9552 *(float *)(v24 * 4 + 16298072) = v27 * v16; | |
9553 *(float *)(v24 * 4 + 16298152) = (double)(signed int)v68 * v16; | |
9554 v16 = 0.0039215689; | |
9555 stru_F8AD28._blv_lights_light_dot_faces[v24] = abs(v23); | |
9556 v28 = v74; | |
9557 v29 = v18[9]; | |
9558 ++v74; | |
9559 stru_F8AD28._blv_lights_types[v28] = v29; | |
9560 } | |
9561 } | |
9562 } | |
9563 } | |
9564 } | |
9565 } | |
9566 } | |
9567 ++v73; | |
9568 v18 += 18; | |
9569 v17 = v69; | |
9570 } | |
9571 while ( v73 < v70 ); | |
9572 } | |
9573 v30 = 0; | |
9574 v73 = 0; | |
9575 v31 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
9576 v70 = *(__int16 *)((char *)&pIndoor->pSectors->uNumLights + v17); | |
9577 if ( v31 > 0 ) | |
9578 { | |
9579 while ( v74 < 20 ) | |
9580 { | |
9581 v32 = &pIndoor->pLights[*(&(*(BLVLightMM7 **)((char *)&pIndoor->pSectors->pLights + v17))->vPosition.x + v30)]; | |
9582 if ( !(v32->uAtributes & 8) ) | |
9583 { | |
9584 v33 = v1->pBounding.x1; | |
9585 v34 = v32->vPosition.x; | |
9586 X = v32->uBrightness; | |
9587 v35 = v32->uRadius; | |
9588 v68 = (BLVFaceExtra *)v32->uRadius; | |
9589 if ( v34 > v33 - v35 ) | |
9590 { | |
9591 if ( v34 < v35 + v1->pBounding.x2 ) | |
9592 { | |
9593 v36 = v32->vPosition.y; | |
9594 if ( v36 > v1->pBounding.y1 - v35 ) | |
9595 { | |
9596 if ( v36 < v35 + v1->pBounding.y2 ) | |
9597 { | |
9598 v37 = v32->vPosition.z; | |
9599 if ( v37 > v1->pBounding.z1 - v35 ) | |
9600 { | |
9601 if ( v37 < v35 + v1->pBounding.z2 ) | |
9602 { | |
9603 v38 = (v1->pFacePlane_old.dist | |
9604 + v32->vPosition.x * v1->pFacePlane_old.vNormal.x | |
9605 + v37 * v1->pFacePlane_old.vNormal.z | |
9606 + v36 * v1->pFacePlane_old.vNormal.y) >> 16; | |
9607 if ( v38 >= 0 ) | |
9608 { | |
9609 if ( v38 <= v35 && v35 ) | |
9610 { | |
9611 v39 = v74; | |
9612 stru_F8AD28._blv_lights_radii[v74] = v35; | |
9613 stru_F8AD28._blv_lights_inv_radii[v39] = 65536 / (signed int)v68; | |
9614 *(int *)((char *)&stru_F8AD28.field_240 + v39 * 4) = X << 16; | |
9615 stru_F8AD28._blv_lights_xs[v39] = v32->vPosition.x; | |
9616 stru_F8AD28._blv_lights_ys[v39] = v32->vPosition.y; | |
9617 stru_F8AD28._blv_lights_zs[v39] = v32->vPosition.z; | |
9618 v68 = (BLVFaceExtra *)v32->uRed; | |
9619 stru_F8AD28._blv_lights_rs[v39] = (double)(signed int)v68 * v16; | |
9620 v68 = (BLVFaceExtra *)v32->uGreen; | |
9621 stru_F8AD28._blv_lights_gs[v39] = (double)(signed int)v68 * v16; | |
9622 v68 = (BLVFaceExtra *)v32->uBlue; | |
9623 stru_F8AD28._blv_lights_bs[v39] = (double)(signed int)v68 * v16; | |
9624 v16 = 0.0039215689; | |
9625 stru_F8AD28._blv_lights_light_dot_faces[v39] = abs(v38); | |
9626 v40 = v74++; | |
9627 stru_F8AD28._blv_lights_types[v40] = 1; | |
9628 } | |
9629 } | |
9630 } | |
9631 } | |
9632 } | |
9633 } | |
9634 } | |
9635 } | |
9636 } | |
9637 v30 = v73++ + 1; | |
9638 if ( v73 >= v70 ) | |
9639 break; | |
9640 v17 = v69; | |
9641 } | |
9642 } | |
9643 v73 = 0; | |
9644 if ( pStationaryLightsStack->uNumLightsActive > 0 ) | |
9645 { | |
9646 v41 = (char *)&pStationaryLightsStack->pLights[0].vPosition.y; | |
9647 do | |
9648 { | |
9649 if ( v74 >= 20 ) | |
9650 break; | |
9651 v42 = *((short *)v41 + 2); | |
9652 v43 = *((short *)v41 - 1); | |
9653 if ( v43 > v1->pBounding.x1 - v42 ) | |
9654 { | |
9655 if ( v43 < v42 + v1->pBounding.x2 ) | |
9656 { | |
9657 v44 = *(short *)v41; | |
9658 if ( v44 > v1->pBounding.y1 - v42 ) | |
9659 { | |
9660 if ( v44 < v42 + v1->pBounding.y2 ) | |
9661 { | |
9662 v45 = *((short *)v41 + 1); | |
9663 if ( v45 > v1->pBounding.z1 - v42 ) | |
9664 { | |
9665 if ( v45 < v42 + v1->pBounding.z2 ) | |
9666 { | |
9667 v46 = (v1->pFacePlane_old.dist | |
9668 + *(short *)v41 * v1->pFacePlane_old.vNormal.y | |
9669 + v43 * v1->pFacePlane_old.vNormal.x | |
9670 + v45 * v1->pFacePlane_old.vNormal.z) >> 16; | |
9671 v69 = v46; | |
9672 if ( v46 >= 0 ) | |
9673 { | |
9674 if ( v46 <= v42 ) | |
9675 { | |
9676 v47 = v69; | |
9677 v48 = v74; | |
9678 stru_F8AD28._blv_lights_radii[v74] = v42; | |
9679 stru_F8AD28._blv_lights_inv_radii[v48] = 65536 / v42; | |
9680 stru_F8AD28._blv_lights_xs[v48] = *((short *)v41 - 1); | |
9681 stru_F8AD28._blv_lights_ys[v48] = *(short *)v41; | |
9682 stru_F8AD28._blv_lights_zs[v48] = *((short *)v41 + 1); | |
9683 v68 = (BLVFaceExtra *)(unsigned __int8)v41[6]; | |
9684 v49 = (double)(signed int)v68 * v16; | |
9685 v68 = (BLVFaceExtra *)(unsigned __int8)v41[7]; | |
9686 v50 = (unsigned __int8)v41[8]; | |
9687 stru_F8AD28._blv_lights_rs[v48] = v49; | |
9688 v51 = (double)(signed int)v68; | |
9689 v68 = (BLVFaceExtra *)v50; | |
9690 stru_F8AD28._blv_lights_gs[v48] = v51 * v16; | |
9691 stru_F8AD28._blv_lights_bs[v48] = (double)(signed int)v68 * v16; | |
9692 v16 = 0.0039215689; | |
9693 stru_F8AD28._blv_lights_light_dot_faces[v48] = abs(v47); | |
9694 v52 = v74++; | |
9695 stru_F8AD28._blv_lights_types[v52] = 1; | |
9696 } | |
9697 } | |
9698 } | |
9699 } | |
9700 } | |
9701 } | |
9702 } | |
9703 } | |
9704 ++v73; | |
9705 v41 += 12; | |
9706 } | |
9707 while ( v73 < pStationaryLightsStack->uNumLightsActive ); | |
9708 } | |
9709 stru_F8AD28.uNumLightsApplied = v74; | |
9710 v53 = v1->pBounding.x2; | |
9711 if ( pBLVRenderParams->vPartyPos.x <= v53 ) | |
9712 { | |
9713 v55 = v1->pBounding.x1; | |
9714 if ( pBLVRenderParams->vPartyPos.x >= v55 ) | |
9715 v54 = 0; | |
9716 else | |
9717 v54 = v55 - pBLVRenderParams->vPartyPos.x; | |
9718 } | |
9719 else | |
9720 { | |
9721 v54 = pBLVRenderParams->vPartyPos.x - v53; | |
9722 } | |
9723 v56 = v1->pBounding.y2; | |
9724 v57 = v54 * v54; | |
9725 if ( pBLVRenderParams->vPartyPos.y <= v56 ) | |
9726 { | |
9727 v59 = v1->pBounding.y1; | |
9728 if ( pBLVRenderParams->vPartyPos.y >= v59 ) | |
9729 v58 = 0; | |
9730 else | |
9731 v58 = v59 - pBLVRenderParams->vPartyPos.y; | |
9732 } | |
9733 else | |
9734 { | |
9735 v58 = pBLVRenderParams->vPartyPos.y - v56; | |
9736 } | |
9737 v60 = v58 * v58 + v57; | |
9738 v61 = v1->pBounding.z2; | |
9739 if ( pBLVRenderParams->vPartyPos.z <= v61 ) | |
9740 { | |
9741 v63 = v1->pBounding.z1; | |
9742 if ( pBLVRenderParams->vPartyPos.z >= v63 ) | |
9743 v62 = 0; | |
9744 else | |
9745 v62 = v63 - pBLVRenderParams->vPartyPos.z; | |
9746 } | |
9747 else | |
9748 { | |
9749 v62 = pBLVRenderParams->vPartyPos.z - v61; | |
9750 } | |
9751 v64 = v62 * v62 + v60; | |
9752 if ( v64 ) | |
9753 stru_F8AD28.field_34 = integer_sqrt(v64) << 16; | |
9754 else | |
9755 stru_F8AD28.field_34 = 0; | |
9756 v68 = (BLVFaceExtra *)abs(stru_F8AD28.rotated_normal.y); | |
9757 v65 = (double)(signed int)v68; | |
9758 if ( v65 >= 655.36 ) | |
9759 { | |
9760 if ( v65 >= 26214.4 ) | |
9761 { | |
9762 if ( v65 >= 45875.2 ) | |
9763 { | |
9764 stru_F8AD28.field_44 = 8; | |
9765 stru_F8AD28.field_48 = 3; | |
9766 } | |
9767 else | |
9768 { | |
9769 stru_F8AD28.field_44 = 16; | |
9770 stru_F8AD28.field_48 = 4; | |
9771 } | |
9772 } | |
9773 else | |
9774 { | |
9775 stru_F8AD28.field_44 = 32; | |
9776 stru_F8AD28.field_48 = 5; | |
9777 } | |
9778 } | |
9779 else | |
9780 { | |
9781 stru_F8AD28.field_44 = 64; | |
9782 stru_F8AD28.field_48 = 6; | |
9783 } | |
9784 } | |
9785 | |
9786 //----- (004AF412) -------------------------------------------------------- | |
9787 int __cdecl sr_4AF412() | |
9788 { | |
9789 int v0; // ST20_4@2 | |
9790 int v1; // ST20_4@2 | |
9791 int v2; // ST20_4@2 | |
9792 int v3; // esi@2 | |
9793 int v4; // ST20_4@2 | |
9794 int v5; // ecx@2 | |
9795 int v6; // ebx@2 | |
9796 int v7; // edi@2 | |
9797 int v8; // edx@2 | |
9798 int v9; // eax@2 | |
9799 int result; // eax@4 | |
9800 | |
9801 stru_F8AD28.plane_4.vNormal.z = -65536; | |
9802 stru_F8AD28.vec_20.y = -65536; | |
9803 stru_F8AD28.plane_4.vNormal.x = 0; | |
9804 stru_F8AD28.plane_4.vNormal.y = 0; | |
9805 stru_F8AD28.plane_4.dist = (pBLVRenderParams->vPartyPos.z + 800) << 16; | |
9806 stru_F8AD28.vec_14.x = 65536; | |
9807 stru_F8AD28.vec_14.y = 0; | |
9808 stru_F8AD28.vec_14.z = 0; | |
9809 stru_F8AD28.vec_20.x = 0; | |
9810 stru_F8AD28.vec_20.z = 0; | |
9811 stru_F8AD28.uDefaultAmbientLightLevel = 0; | |
9812 if ( pBLVRenderParams->sPartyRotX ) | |
9813 { | |
9814 v0 = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
9815 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
9816 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
9817 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
9818 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
9819 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
9820 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
9821 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
9822 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
9823 stru_F8AD28.rotated_normal.z = ((unsigned __int64)(v0 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
9824 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.z | |
9825 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
9826 v1 = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
9827 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
9828 stru_F8AD28.vec_60.y = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
9829 - ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
9830 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
9831 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
9832 stru_F8AD28.field_6C = ((unsigned __int64)(v1 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
9833 + ((unsigned __int64)(stru_F8AD28.vec_14.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
9834 v2 = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
9835 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
9836 stru_F8AD28.vec_70.x = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
9837 - ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
9838 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
9839 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
9840 stru_F8AD28.vec_70.z = ((unsigned __int64)(v2 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16) | |
9841 + ((unsigned __int64)(stru_F8AD28.vec_20.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16); | |
9842 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
9843 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
9844 v4 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
9845 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
9846 v5 = ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
9847 - ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
9848 v6 = pBLVRenderParams->vPartyPos.z; | |
9849 v7 = ((unsigned __int64)(-65536 * pBLVRenderParams->vPartyPos.z * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) | |
9850 + ((unsigned __int64)(v4 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); | |
9851 v8 = pBLVRenderParams->vPartyPos.y; | |
9852 v9 = pBLVRenderParams->vPartyPos.x; | |
9853 } | |
9854 else | |
9855 { | |
9856 stru_F8AD28.rotated_normal.x = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
9857 * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
9858 - ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
9859 * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
9860 stru_F8AD28.rotated_normal.z = stru_F8AD28.plane_4.vNormal.z; | |
9861 stru_F8AD28.rotated_normal.y = ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.x | |
9862 * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
9863 + ((unsigned __int64)(stru_F8AD28.plane_4.vNormal.y | |
9864 * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
9865 stru_F8AD28.vec_60.y = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
9866 - ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
9867 stru_F8AD28.field_6C = stru_F8AD28.vec_14.z; | |
9868 stru_F8AD28.vec_60.z = ((unsigned __int64)(stru_F8AD28.vec_14.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
9869 + ((unsigned __int64)(stru_F8AD28.vec_14.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
9870 stru_F8AD28.vec_70.x = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sCosineY) >> 16) | |
9871 - ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sSineY) >> 16); | |
9872 v8 = pBLVRenderParams->vPartyPos.y; | |
9873 stru_F8AD28.vec_70.y = ((unsigned __int64)(stru_F8AD28.vec_20.x * (signed __int64)pBLVRenderParams->sSineY) >> 16) | |
9874 + ((unsigned __int64)(stru_F8AD28.vec_20.y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); | |
9875 stru_F8AD28.vec_70.z = stru_F8AD28.vec_20.z; | |
9876 v9 = pBLVRenderParams->vPartyPos.x; | |
9877 v5 = pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.y | |
9878 - pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.x; | |
9879 v6 = pBLVRenderParams->vPartyPos.z; | |
9880 v3 = -(pBLVRenderParams->sCosineY * pBLVRenderParams->vPartyPos.y | |
9881 + pBLVRenderParams->sSineY * pBLVRenderParams->vPartyPos.x); | |
9882 v7 = -65536 * pBLVRenderParams->vPartyPos.z; | |
9883 } | |
9884 stru_F8AD28.field_7C = stru_F8AD28.rotated_normal.x; | |
9885 stru_F8AD28.vec_60.x = stru_F8AD28.plane_4.vNormal.y * v8 | |
9886 + stru_F8AD28.plane_4.dist | |
9887 + stru_F8AD28.plane_4.vNormal.x * v9 | |
9888 + stru_F8AD28.plane_4.vNormal.z * v6; | |
9889 stru_F8AD28.vec_80.x = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
9890 * (signed __int64)stru_F8AD28.rotated_normal.y) >> 16; | |
9891 stru_F8AD28.vec_80.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) | |
9892 * (signed __int64)stru_F8AD28.rotated_normal.z) >> 16; | |
9893 stru_F8AD28.vec_80.z = -stru_F8AD28.vec_60.x; | |
9894 stru_F8AD28.vec_8C.x = stru_F8AD28.vec_60.y; | |
9895 stru_F8AD28.vec_8C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_60.z) >> 16; | |
9896 stru_F8AD28.vec_8C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.field_6C) >> 16; | |
9897 stru_F8AD28.vec_9C.x = stru_F8AD28.vec_70.x; | |
9898 stru_F8AD28.field_98 = -(((unsigned __int64)(stru_F8AD28.vec_60.y * (signed __int64)v5) >> 16) | |
9899 + ((unsigned __int64)(stru_F8AD28.vec_60.z * (signed __int64)v3) >> 16) | |
9900 + ((unsigned __int64)(stru_F8AD28.field_6C * (signed __int64)v7) >> 16)); | |
9901 stru_F8AD28.vec_9C.y = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.y) >> 16; | |
9902 stru_F8AD28.vec_9C.z = (unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)stru_F8AD28.vec_70.z) >> 16; | |
9903 result = 0; | |
9904 stru_F8AD28.field_A8 = -(((unsigned __int64)(stru_F8AD28.vec_70.x * (signed __int64)v5) >> 16) | |
9905 + ((unsigned __int64)(stru_F8AD28.vec_70.y * (signed __int64)v3) >> 16) | |
9906 + ((unsigned __int64)(stru_F8AD28.vec_70.z * (signed __int64)v7) >> 16)); | |
9907 stru_F8AD28.field_38 = 0; | |
9908 stru_F8AD28.field_3E4 = 0; | |
9909 stru_F8AD28.uCurrentAmbientLightLevel = 0; | |
9910 stru_F8AD28.uNumLightsApplied = 0; | |
9911 stru_F8AD28.field_34 = 0; | |
9912 return result; | |
9913 } | |
9914 //----- (004ADD1D) -------------------------------------------------------- | |
9915 void __fastcall sr_4ADD1D(int uFaceID) | |
9916 { | |
9917 int v1; // edi@1 | |
9918 BLVFace *v2; // esi@3 | |
9919 signed int v3; // ebx@4 | |
9920 Texture *v4; // edi@9 | |
9921 signed int v5; // eax@9 | |
9922 char *v6; // edi@12 | |
9923 signed int v7; // eax@15 | |
9924 unsigned int v8; // eax@16 | |
9925 __int16 v9; // cx@19 | |
9926 unsigned __int8 *v10; // eax@19 | |
9927 unsigned __int16 *v11; // eax@19 | |
9928 int v12; // edi@19 | |
9929 int v13; // ebx@20 | |
9930 stru352 *v14; // esi@20 | |
9931 DWORD v15; // eax@22 | |
9932 signed int v16; // ecx@22 | |
9933 signed int v17; // ST68_4@22 | |
9934 int v18; // eax@22 | |
9935 int v19; // ecx@22 | |
9936 unsigned int v20; // esi@23 | |
9937 int v21; // edi@23 | |
9938 int v22; // eax@23 | |
9939 int *v23; // ebx@24 | |
9940 int v24; // edx@24 | |
9941 int v25; // ebx@25 | |
9942 unsigned __int16 v26; // cx@25 | |
9943 int v27; // edx@26 | |
9944 unsigned __int16 v28; // cx@26 | |
9945 unsigned __int8 v29; // sf@27 | |
9946 unsigned __int8 v30; // of@27 | |
9947 unsigned int v31; // esi@29 | |
9948 int v32; // edi@29 | |
9949 unsigned __int16 *v33; // eax@29 | |
9950 int *v34; // ebx@30 | |
9951 int v35; // edx@30 | |
9952 int v36; // ebx@31 | |
9953 unsigned __int16 v37; // cx@31 | |
9954 int v38; // edx@32 | |
9955 unsigned __int16 v39; // cx@32 | |
9956 Texture *v40; // [sp-10h] [bp-6Ch]@16 | |
9957 int v41; // [sp-Ch] [bp-68h]@15 | |
9958 unsigned int v42; // [sp+10h] [bp-4Ch]@1 | |
9959 signed int v43; // [sp+14h] [bp-48h]@12 | |
9960 signed int v44; // [sp+14h] [bp-48h]@22 | |
9961 int v45; // [sp+1Ch] [bp-40h]@22 | |
9962 int v46; // [sp+20h] [bp-3Ch]@22 | |
9963 int v47; // [sp+24h] [bp-38h]@19 | |
9964 char v48; // [sp+28h] [bp-34h]@19 | |
9965 int v49; // [sp+2Ch] [bp-30h]@19 | |
9966 unsigned __int8 *v50; // [sp+30h] [bp-2Ch]@19 | |
9967 unsigned __int16 *v51; // [sp+34h] [bp-28h]@19 | |
9968 int v52; // [sp+38h] [bp-24h]@22 | |
9969 int v53; // [sp+3Ch] [bp-20h]@22 | |
9970 signed int v54; // [sp+40h] [bp-1Ch]@12 | |
9971 int v55; // [sp+40h] [bp-1Ch]@20 | |
9972 int v56; // [sp+44h] [bp-18h]@20 | |
9973 stru352 *i; // [sp+48h] [bp-14h]@20 | |
9974 unsigned __int16 *v58; // [sp+4Ch] [bp-10h]@23 | |
9975 int v59; // [sp+50h] [bp-Ch]@4 | |
9976 int v60; // [sp+50h] [bp-Ch]@19 | |
9977 int v61; // [sp+54h] [bp-8h]@22 | |
9978 int *v62; // [sp+58h] [bp-4h]@23 | |
9979 int *v63; // [sp+58h] [bp-4h]@29 | |
9980 | |
9981 v1 = uFaceID; | |
9982 v42 = pRenderer->uTargetSurfacePitch; | |
9983 if ( uFaceID >= 0 && uFaceID < (signed int)pIndoor->uNumFaces ) | |
9984 { | |
9985 v2 = &pIndoor->pFaces[uFaceID]; | |
9986 if ( pRenderer->pRenderD3D ) | |
9987 { | |
9988 v3 = sr_424579(uFaceID, &stru_F8AD28); | |
9989 v59 = v3; | |
9990 } | |
9991 else | |
9992 { | |
9993 v59 = GetPortalScreenCoord(uFaceID); | |
9994 v3 = v59; | |
9995 } | |
9996 if ( v3 && (pRenderer->pRenderD3D || PortalFrustrum(v3, &stru_F8A590, pBLVRenderParams->field_7C, v1)) ) | |
9997 { | |
9998 v4 = v2->GetTexture(); | |
9999 v5 = 0; | |
10000 if ( v4 ) | |
10001 { | |
10002 if ( pRenderer->pRenderD3D ) | |
10003 { | |
10004 if ( v3 > 0 ) | |
10005 { | |
10006 v54 = v3; | |
10007 v43 = v3; | |
10008 v6 = (char *)&array_507D30[0].v; | |
10009 do | |
10010 { | |
10011 *((float *)v6 - 1) = (double)((GetTickCount() >> 5) - pBLVRenderParams->vPartyPos.x) + *((float *)v6 - 1); | |
10012 *(float *)v6 = (double)(pBLVRenderParams->vPartyPos.y + (GetTickCount() >> 5)) + *(float *)v6; | |
10013 v6 += 48; | |
10014 --v54; | |
10015 } | |
10016 while ( v54 ); | |
10017 v3 = v59; | |
10018 v5 = v43; | |
10019 } | |
10020 v7 = v5; | |
10021 v41 = stru_F8AD28.field_0; | |
10022 array_507D30[v7].u = array_507D30[v7].u * 0.25; | |
10023 array_507D30[v7].v = array_507D30[v7].v * 0.25; | |
10024 if ( BYTE1(v2->uAttributes) & 0x40 ) | |
10025 { | |
10026 v40 = v2->GetTexture(); | |
10027 v8 = pTextureFrameTable->GetFrameTexture(v2->uBitmapID, pBLVRenderParams->field_0_timer_); | |
10028 } | |
10029 else | |
10030 { | |
10031 v40 = v2->GetTexture(); | |
10032 v8 = v2->uBitmapID; | |
10033 } | |
10034 pRenderer->DrawIndoorPolygon(v3, v2, pBitmaps_LOD->pHardwareTextures[v8], v40, v41, -1, 0); | |
10035 } | |
10036 else | |
10037 { | |
10038 v49 = v4->uWidthMinus1; | |
10039 v47 = v4->uHeightMinus1 << 16; | |
10040 v9 = 16 - v4->uWidthLn2; | |
10041 v10 = v4->pLevelOfDetail0_prolly_alpha_mask; | |
10042 LOBYTE(v2->uAttributes) |= 0x80u; | |
10043 v48 = v9; | |
10044 v50 = v10; | |
10045 sr_4AF412(); | |
10046 ++pBLVRenderParams->uNumFacesRenderedThisFrame; | |
10047 v11 = sr_sub_47C24C_get_palette(v2, v4->palette_id2, 0, 1); | |
10048 v12 = stru_F8A590._viewport_space_y; | |
10049 v51 = v11; | |
10050 v60 = stru_F8A590._viewport_space_y; | |
10051 if ( stru_F8A590._viewport_space_y <= stru_F8A590._viewport_space_w ) | |
10052 { | |
10053 v13 = 2 * stru_F8A590._viewport_space_y; | |
10054 v14 = &stru_F83B80[stru_F8A590._viewport_space_y]; | |
10055 v55 = 2 * stru_F8A590._viewport_space_y; | |
10056 v56 = 640 * stru_F8A590._viewport_space_y; | |
10057 for ( i = &stru_F83B80[stru_F8A590._viewport_space_y]; ; v14 = i ) | |
10058 { | |
10059 sr_4AE1E7(v12, *(__int16 *)((char *)stru_F8A590.viewport_left_side + v13), v12); | |
10060 v14->field_0 += (GetTickCount() << 11) - (pBLVRenderParams->vPartyPos.x << 16); | |
10061 v15 = GetTickCount(); | |
10062 v16 = v14->field_0; | |
10063 v14->field_4 += (32 * pBLVRenderParams->vPartyPos.y + v15) << 11; | |
10064 v45 = v14->field_4 >> 3; | |
10065 v44 = v16 >> 3; | |
10066 v17 = (signed int)((unsigned __int64)(SLODWORD(pBLVRenderParams->field_44) * (signed __int64)v14->field_28) >> 16) >> 3; | |
10067 v52 = (unsigned __int64)(v17 * (signed __int64)-pBLVRenderParams->sSineY) >> 16; | |
10068 v53 = (unsigned __int64)(v17 * (signed __int64)pBLVRenderParams->sCosineY) >> 16; | |
10069 v18 = v14->field_28; | |
10070 v19 = *(__int16 *)((char *)stru_F8A590.viewport_left_side + v13); | |
10071 LOWORD(v18) = 0; | |
10072 v46 = stru_F8AD28.field_0 | v18; | |
10073 v61 = *(__int16 *)((char *)stru_F8A590.viewport_right_side + v13) - v19; | |
10074 if ( LOBYTE(viewparams->field_20) ) | |
10075 { | |
10076 v63 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
10077 - pBLVRenderParams->uViewportX]; | |
10078 v31 = v44; | |
10079 v32 = v45; | |
10080 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
10081 + 2 * v19 | |
10082 - pBLVRenderParams->uViewportX]; | |
10083 if ( v61 & 1 ) | |
10084 { | |
10085 --v61; | |
10086 v33 = &pBLVRenderParams->pRenderTarget[v42 * (v13 - pBLVRenderParams->uViewportY) | |
10087 + 2 * v19 | |
10088 - pBLVRenderParams->uViewportX | |
10089 - 2]; | |
10090 v34 = &pBLVRenderParams->pTargetZBuffer[2 * (v19 + 320 * (v13 - pBLVRenderParams->uViewportY)) | |
10091 - pBLVRenderParams->uViewportX]; | |
10092 v35 = v46; | |
10093 v63 += 2; | |
10094 goto LABEL_32; | |
10095 } | |
10096 while ( 1 ) | |
10097 { | |
10098 v30 = __OFSUB__(v61, 2); | |
10099 v29 = v61 - 2 < 0; | |
10100 v61 -= 2; | |
10101 if ( v29 ^ v30 ) | |
10102 break; | |
10103 v36 = *(&v50[v49 & (v31 >> 16)] + ((v47 & (unsigned int)v32) >> v48)); | |
10104 v31 += v52; | |
10105 v37 = v51[v36]; | |
10106 v32 += v53; | |
10107 v34 = v63; | |
10108 v35 = v46; | |
10109 *v33 = v37; | |
10110 v33[1] = v37; | |
10111 v33[640] = v37; | |
10112 v33[641] = v37; | |
10113 v63 += 4; | |
10114 v34[2] = v46; | |
10115 v34[3] = v46; | |
10116 v34[642] = v46; | |
10117 v34[643] = v46; | |
10118 LABEL_32: | |
10119 *v34 = v35; | |
10120 v34[1] = v35; | |
10121 v34[640] = v35; | |
10122 v34[641] = v35; | |
10123 v38 = v49 & (v31 >> 16); | |
10124 v33 += 4; | |
10125 v31 += v52; | |
10126 v39 = v51[*(&v50[v38] + ((v47 & (unsigned int)v32) >> v48))]; | |
10127 v32 += v53; | |
10128 *(v33 - 2) = v39; | |
10129 *(v33 - 1) = v39; | |
10130 v33[638] = v39; | |
10131 v33[639] = v39; | |
10132 } | |
10133 } | |
10134 else | |
10135 { | |
10136 v58 = &pBLVRenderParams->pRenderTarget[v19 + v12 * pRenderer->uTargetSurfacePitch]; | |
10137 v62 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
10138 v20 = v44; | |
10139 v21 = v45; | |
10140 v22 = (int)v58; | |
10141 if ( v61 & 1 ) | |
10142 { | |
10143 --v61; | |
10144 v22 = (int)(v58 - 1); | |
10145 v23 = &pBLVRenderParams->pTargetZBuffer[v56 + v19]; | |
10146 v24 = v46; | |
10147 ++v62; | |
10148 goto LABEL_26; | |
10149 } | |
10150 while ( 1 ) | |
10151 { | |
10152 v30 = __OFSUB__(v61, 2); | |
10153 v29 = v61 - 2 < 0; | |
10154 v61 -= 2; | |
10155 if ( v29 ^ v30 ) | |
10156 break; | |
10157 v25 = *(&v50[v49 & (v20 >> 16)] + ((v47 & (unsigned int)v21) >> v48)); | |
10158 v20 += v52; | |
10159 v26 = v51[v25]; | |
10160 v21 += v53; | |
10161 v23 = v62; | |
10162 v24 = v46; | |
10163 *(short *)v22 = v26; | |
10164 v62 += 2; | |
10165 v23[1] = v46; | |
10166 LABEL_26: | |
10167 *v23 = v24; | |
10168 v27 = v49 & (v20 >> 16); | |
10169 v22 += 4; | |
10170 v20 += v52; | |
10171 v28 = v51[*(&v50[v27] + ((v47 & (unsigned int)v21) >> v48))]; | |
10172 v21 += v53; | |
10173 *(short *)(v22 - 2) = v28; | |
10174 } | |
10175 } | |
10176 ++v60; | |
10177 ++i; | |
10178 v56 += 640; | |
10179 v55 += 2; | |
10180 if ( v60 > stru_F8A590._viewport_space_w ) | |
10181 break; | |
10182 v13 = v55; | |
10183 v12 = v60; | |
10184 } | |
10185 } | |
10186 } | |
10187 } | |
10188 } | |
10189 } | |
10190 } | |
10191 //----- (004AE1E7) -------------------------------------------------------- | |
10192 int __fastcall sr_4AE1E7(int a1, int a2, int a3) | |
10193 { | |
10194 int v3; // ebx@1 | |
10195 int v4; // edi@1 | |
10196 int v5; // esi@1 | |
10197 signed __int64 v6; // qtt@3 | |
10198 int v7; // esi@3 | |
10199 int v8; // eax@5 | |
10200 int result; // eax@5 | |
10201 int v10; // edx@5 | |
10202 int v11; // [sp+Ch] [bp-8h]@1 | |
10203 int v12; // [sp+1Ch] [bp+8h]@2 | |
10204 | |
10205 v3 = pBLVRenderParams->uViewportCenterY - a3; | |
10206 v4 = pBLVRenderParams->uViewportCenterX - a2; | |
10207 v11 = a1; | |
10208 v5 = (pBLVRenderParams->uViewportCenterY - a3) * stru_F8AD28.vec_80.y | |
10209 + stru_F8AD28.field_7C | |
10210 + (pBLVRenderParams->uViewportCenterX - a2) * stru_F8AD28.vec_80.x; | |
10211 if ( v5 && (v12 = abs(stru_F8AD28.vec_80.z) >> 14, v12 <= abs(v5)) ) | |
10212 { | |
10213 LODWORD(v6) = stru_F8AD28.vec_80.z << 16; | |
10214 HIDWORD(v6) = stru_F8AD28.vec_80.z >> 16; | |
10215 v7 = v6 / (v3 * stru_F8AD28.vec_80.y + stru_F8AD28.field_7C + v4 * stru_F8AD28.vec_80.x); | |
10216 } | |
10217 else | |
10218 { | |
10219 v7 = 1073741824; | |
10220 } | |
10221 v8 = stru_F8AD28.vec_9C.z; | |
10222 stru_F83B80[v11].field_0 = ((unsigned __int64)((v3 * stru_F8AD28.vec_8C.z | |
10223 + stru_F8AD28.vec_8C.x | |
10224 + v4 * stru_F8AD28.vec_8C.y) | |
10225 * (signed __int64)v7) >> 16) | |
10226 + stru_F8AD28.field_98; | |
10227 result = (unsigned __int64)((v3 * v8 + stru_F8AD28.vec_9C.x + v4 * stru_F8AD28.vec_9C.y) * (signed __int64)v7) >> 16; | |
10228 v10 = result + stru_F8AD28.field_A8; | |
10229 stru_F83B80[v11].field_28 = v7; | |
10230 stru_F83B80[v11].field_4 = v10; | |
10231 return result; | |
10232 } | |
3 //----- (004AC1C9) -------------------------------------------------------- | 10233 //----- (004AC1C9) -------------------------------------------------------- |
4 int __thiscall _4AC1C9_get_cpu_speed(unsigned int _this, Vec4_int_ *a2) | 10234 int __thiscall _4AC1C9_get_cpu_speed(unsigned int _this, Vec4_int_ *a2) |
5 { | 10235 { |
6 unsigned int v2; // esi@1 | 10236 unsigned int v2; // esi@1 |
7 __int16 v3; // di@1 | 10237 __int16 v3; // di@1 |
489 a2->x = Dst.x; | 10719 a2->x = Dst.x; |
490 a2->y = Dst.y; | 10720 a2->y = Dst.y; |
491 a2->z = Dst.z; | 10721 a2->z = Dst.z; |
492 a2->w = Dst.w; | 10722 a2->w = Dst.w; |
493 return result; | 10723 return result; |
494 }*/ | 10724 } |
10725 | |
10726 //----- (004D714C) -------------------------------------------------------- | |
10727 int __cdecl sr_sub_4D714C(stru315 *a1) | |
10728 { | |
10729 stru315 *v1; // ebp@0 | |
10730 stru315 *v2; // ebp@1 | |
10731 unsigned int v3; // esi@1 | |
10732 int v4; // edi@1 | |
10733 int result; // eax@1 | |
10734 unsigned int *v6; // ebx@2 | |
10735 int v7; // edx@2 | |
10736 int v8; // ebx@3 | |
10737 unsigned __int16 v9; // cx@3 | |
10738 unsigned int *v10; // ebx@3 | |
10739 int v11; // edx@3 | |
10740 int v12; // ebx@4 | |
10741 unsigned __int8 v13; // sf@5 | |
10742 unsigned __int8 v14; // of@5 | |
10743 | |
10744 v2 = (stru315 *)v1->field_8; | |
10745 v3 = v2->field_30; | |
10746 v4 = v2->field_2C; | |
10747 result = (int)v2->pColorBuffer; | |
10748 if ( !(v2->field_28 & 1) ) | |
10749 goto LABEL_5; | |
10750 --v2->field_28; | |
10751 result += 2; | |
10752 v6 = v2->pDepthBuffer; | |
10753 v7 = v2->field_24; | |
10754 --v2->pDepthBuffer; | |
10755 *v6 = v7; | |
10756 while ( 1 ) | |
10757 { | |
10758 v12 = *((char *)v2->pTextureLOD | |
10759 + (v2->field_C & (v3 >> 16)) | |
10760 + ((v2->field_8 & (unsigned int)v4) >> LOBYTE(v2->field_10))); | |
10761 result -= 4; | |
10762 v3 += v2->field_4; | |
10763 v4 += v2->field_0; | |
10764 *(short *)(result + 2) = v2->field_34_palette[v12]; | |
10765 LABEL_5: | |
10766 v14 = __OFSUB__(v2->field_28, 2); | |
10767 v13 = v2->field_28 - 2 < 0; | |
10768 v2->field_28 -= 2; | |
10769 if ( v13 ^ v14 ) | |
10770 break; | |
10771 v8 = *((char *)v2->pTextureLOD | |
10772 + (v2->field_C & (v3 >> 16)) | |
10773 + ((v2->field_8 & (unsigned int)v4) >> LOBYTE(v2->field_10))); | |
10774 v3 += v2->field_4; | |
10775 v9 = v2->field_34_palette[v8]; | |
10776 v4 += v2->field_0; | |
10777 v10 = v2->pDepthBuffer; | |
10778 v11 = v2->field_24; | |
10779 *(short *)result = v9; | |
10780 v2->pDepthBuffer -= 2; | |
10781 *v10 = v11; | |
10782 *(v10 - 1) = v11; | |
10783 } | |
10784 v2->pColorBuffer = (unsigned __int16 *)result; | |
10785 v2->field_30 = v3; | |
10786 v2->field_2C = v4; | |
10787 return result; | |
10788 } | |
10789 | |
10790 //----- (004D6FB0) -------------------------------------------------------- | |
10791 int sr_sub_4D6FB0(stru315 *a1) | |
10792 { | |
10793 int v1; // ebp@1 | |
10794 unsigned int v2; // esi@1 | |
10795 unsigned int v3; // edi@1 | |
10796 int result; // eax@1 | |
10797 int v5; // ebx@2 | |
10798 int v6; // edx@2 | |
10799 int v7; // ebx@3 | |
10800 __int16 v8; // cx@3 | |
10801 int v9; // ebx@4 | |
10802 unsigned __int8 v10; // sf@5 | |
10803 unsigned __int8 v11; // of@5 | |
10804 | |
10805 v1 = a1->field_8; | |
10806 v2 = *(int *)(v1 + 48); | |
10807 v3 = *(int *)(v1 + 44); | |
10808 result = *(int *)(v1 + 64); | |
10809 if ( !(*(int *)(v1 + 40) & 1) ) | |
10810 goto LABEL_5; | |
10811 --*(int *)(v1 + 40); | |
10812 result -= 2; | |
10813 v5 = *(int *)(v1 + 60); | |
10814 v6 = *(int *)(v1 + 36); | |
10815 *(int *)(v1 + 60) += 4; | |
10816 while ( 1 ) | |
10817 { | |
10818 *(int *)v5 = v6; | |
10819 v9 = *(char *)(*(int *)(v1 + 56) | |
10820 + (*(int *)(v1 + 12) & (v2 >> 16)) | |
10821 + ((*(int *)(v1 + 8) & v3) >> *(char *)(v1 + 16))); | |
10822 result += 4; | |
10823 v2 += *(int *)(v1 + 4); | |
10824 v3 += *(int *)v1; | |
10825 *(short *)(result - 2) = *(short *)(*(int *)(v1 + 52) + 2 * v9); | |
10826 LABEL_5: | |
10827 v11 = __OFSUB__(*(int *)(v1 + 40), 2); | |
10828 v10 = *(int *)(v1 + 40) - 2 < 0; | |
10829 *(int *)(v1 + 40) -= 2; | |
10830 if ( v10 ^ v11 ) | |
10831 break; | |
10832 v7 = *(char *)(*(int *)(v1 + 56) | |
10833 + (*(int *)(v1 + 12) & (v2 >> 16)) | |
10834 + ((*(int *)(v1 + 8) & v3) >> *(char *)(v1 + 16))); | |
10835 v2 += *(int *)(v1 + 4); | |
10836 v8 = *(short *)(*(int *)(v1 + 52) + 2 * v7); | |
10837 v3 += *(int *)v1; | |
10838 v5 = *(int *)(v1 + 60); | |
10839 v6 = *(int *)(v1 + 36); | |
10840 *(short *)result = v8; | |
10841 *(int *)(v1 + 60) += 8; | |
10842 *(int *)(v5 + 4) = v6; | |
10843 } | |
10844 *(int *)(v1 + 64) = result; | |
10845 *(int *)(v1 + 48) = v2; | |
10846 *(int *)(v1 + 44) = v3; | |
10847 return result; | |
10848 } | |
10849 | |
10850 //----- (004D705A) -------------------------------------------------------- | |
10851 int sr_sub_4D705A(stru315 *a1) | |
10852 { | |
10853 int v1; // ebp@1 | |
10854 unsigned int v2; // esi@1 | |
10855 unsigned int v3; // edi@1 | |
10856 int result; // eax@1 | |
10857 int v5; // ebx@2 | |
10858 int v6; // edx@2 | |
10859 unsigned int v7; // ebx@3 | |
10860 unsigned int v8; // edx@3 | |
10861 __int16 v9; // cx@11 | |
10862 unsigned int v10; // ebx@12 | |
10863 unsigned int v11; // edx@12 | |
10864 unsigned __int8 v12; // sf@21 | |
10865 unsigned __int8 v13; // of@21 | |
10866 | |
10867 v1 = a1->field_8; | |
10868 v2 = *(int *)(v1 + 48); | |
10869 v3 = *(int *)(v1 + 44); | |
10870 result = *(int *)(v1 + 64); | |
10871 if ( !(*(int *)(v1 + 40) & 1) ) | |
10872 goto LABEL_21; | |
10873 --*(int *)(v1 + 40); | |
10874 result -= 2; | |
10875 v5 = *(int *)(v1 + 60); | |
10876 v6 = *(int *)(v1 + 36); | |
10877 *(int *)(v1 + 60) += 4; | |
10878 while ( 1 ) | |
10879 { | |
10880 *(int *)v5 = v6; | |
10881 v10 = v3; | |
10882 v11 = v2; | |
10883 if ( (signed int)v2 < *(int *)(v1 + 20) ) | |
10884 v11 = *(int *)(v1 + 20); | |
10885 if ( (signed int)v3 < *(int *)(v1 + 28) ) | |
10886 v10 = *(int *)(v1 + 28); | |
10887 if ( (signed int)v11 > *(int *)(v1 + 24) ) | |
10888 v11 = *(int *)(v1 + 24); | |
10889 if ( (signed int)v10 > *(int *)(v1 + 32) ) | |
10890 v10 = *(int *)(v1 + 32); | |
10891 result += 4; | |
10892 v2 += *(int *)(v1 + 4); | |
10893 v3 += *(int *)v1; | |
10894 *(short *)(result - 2) = *(short *)(*(int *)(v1 + 52) | |
10895 + 2 | |
10896 * *(char *)(*(int *)(v1 + 56) | |
10897 + (*(int *)(v1 + 12) & (v11 >> 16)) | |
10898 + ((*(int *)(v1 + 8) & v10) >> *(char *)(v1 + 16)))); | |
10899 LABEL_21: | |
10900 v13 = __OFSUB__(*(int *)(v1 + 40), 2); | |
10901 v12 = *(int *)(v1 + 40) - 2 < 0; | |
10902 *(int *)(v1 + 40) -= 2; | |
10903 if ( v12 ^ v13 ) | |
10904 break; | |
10905 v7 = v3; | |
10906 v8 = v2; | |
10907 if ( (signed int)v2 < *(int *)(v1 + 20) ) | |
10908 v8 = *(int *)(v1 + 20); | |
10909 if ( (signed int)v3 < *(int *)(v1 + 28) ) | |
10910 v7 = *(int *)(v1 + 28); | |
10911 if ( (signed int)v8 > *(int *)(v1 + 24) ) | |
10912 v8 = *(int *)(v1 + 24); | |
10913 if ( (signed int)v7 > *(int *)(v1 + 32) ) | |
10914 v7 = *(int *)(v1 + 32); | |
10915 v2 += *(int *)(v1 + 4); | |
10916 v9 = *(short *)(*(int *)(v1 + 52) | |
10917 + 2 | |
10918 * *(char *)(*(int *)(v1 + 56) | |
10919 + (*(int *)(v1 + 12) & (v8 >> 16)) | |
10920 + ((*(int *)(v1 + 8) & v7) >> *(char *)(v1 + 16)))); | |
10921 v3 += *(int *)v1; | |
10922 v5 = *(int *)(v1 + 60); | |
10923 v6 = *(int *)(v1 + 36); | |
10924 *(short *)result = v9; | |
10925 *(int *)(v1 + 60) += 8; | |
10926 *(int *)(v5 + 4) = v6; | |
10927 } | |
10928 *(int *)(v1 + 64) = result; | |
10929 *(int *)(v1 + 48) = v2; | |
10930 *(int *)(v1 + 44) = v3; | |
10931 return result; | |
10932 } | |
10933 | |
10934 //----- (004D71F8) -------------------------------------------------------- | |
10935 int __cdecl sr_sub_4D71F8(stru315 *a1) | |
10936 { | |
10937 stru315 *v1; // ebp@0 | |
10938 stru315 *v2; // ebp@1 | |
10939 int v3; // esi@1 | |
10940 int v4; // edi@1 | |
10941 int result; // eax@1 | |
10942 unsigned int *v6; // ebx@2 | |
10943 int v7; // edx@2 | |
10944 int v8; // ebx@3 | |
10945 unsigned int v9; // edx@3 | |
10946 unsigned __int16 v10; // cx@11 | |
10947 unsigned int *v11; // ebx@11 | |
10948 int v12; // edx@11 | |
10949 int v13; // ebx@12 | |
10950 unsigned int v14; // edx@12 | |
10951 unsigned __int8 v15; // sf@21 | |
10952 unsigned __int8 v16; // of@21 | |
10953 | |
10954 v2 = (stru315 *)v1->field_8; | |
10955 v3 = v2->field_30; | |
10956 v4 = v2->field_2C; | |
10957 result = (int)v2->pColorBuffer; | |
10958 if ( !(v2->field_28 & 1) ) | |
10959 goto LABEL_21; | |
10960 --v2->field_28; | |
10961 result += 2; | |
10962 v6 = v2->pDepthBuffer; | |
10963 v7 = v2->field_24; | |
10964 --v2->pDepthBuffer; | |
10965 *v6 = v7; | |
10966 while ( 1 ) | |
10967 { | |
10968 v13 = v4; | |
10969 v14 = v3; | |
10970 if ( v3 < v2->field_14 ) | |
10971 v14 = v2->field_14; | |
10972 if ( v4 < v2->field_1C ) | |
10973 v13 = v2->field_1C; | |
10974 if ( (signed int)v14 > v2->field_18 ) | |
10975 v14 = v2->field_18; | |
10976 if ( v13 > v2->field_20 ) | |
10977 v13 = v2->field_20; | |
10978 result -= 4; | |
10979 v3 += v2->field_4; | |
10980 v4 += v2->field_0; | |
10981 *(short *)(result + 2) = v2->field_34_palette[*((char *)v2->pTextureLOD | |
10982 + (v2->field_C & (v14 >> 16)) | |
10983 + ((v2->field_8 & (unsigned int)v13) >> LOBYTE(v2->field_10)))]; | |
10984 LABEL_21: | |
10985 v16 = __OFSUB__(v2->field_28, 2); | |
10986 v15 = v2->field_28 - 2 < 0; | |
10987 v2->field_28 -= 2; | |
10988 if ( v15 ^ v16 ) | |
10989 break; | |
10990 v8 = v4; | |
10991 v9 = v3; | |
10992 if ( v3 < v2->field_14 ) | |
10993 v9 = v2->field_14; | |
10994 if ( v4 < v2->field_1C ) | |
10995 v8 = v2->field_1C; | |
10996 if ( (signed int)v9 > v2->field_18 ) | |
10997 v9 = v2->field_18; | |
10998 if ( v8 > v2->field_20 ) | |
10999 v8 = v2->field_20; | |
11000 v3 += v2->field_4; | |
11001 v10 = v2->field_34_palette[*((char *)v2->pTextureLOD | |
11002 + (v2->field_C & (v9 >> 16)) | |
11003 + ((v2->field_8 & (unsigned int)v8) >> LOBYTE(v2->field_10)))]; | |
11004 v4 += v2->field_0; | |
11005 v11 = v2->pDepthBuffer; | |
11006 v12 = v2->field_24; | |
11007 *(short *)result = v10; | |
11008 v2->pDepthBuffer -= 2; | |
11009 *v11 = v12; | |
11010 *(v11 - 1) = v12; | |
11011 } | |
11012 v2->pColorBuffer = (unsigned __int16 *)result; | |
11013 v2->field_30 = v3; | |
11014 v2->field_2C = v4; | |
11015 return result; | |
11016 } | |
11017 | |
11018 //----- (004D754B) -------------------------------------------------------- | |
11019 void __cdecl sr_sub_4D754B(stru315 *a1, stru316 *a2) | |
11020 { | |
11021 int v2; // ecx@1 | |
11022 unsigned int v3; // eax@2 | |
11023 int v4; // ecx@2 | |
11024 int v5; // eax@10 | |
11025 unsigned __int16 *v6; // edx@10 | |
11026 int v7; // ebx@11 | |
11027 int v8; // ecx@13 | |
11028 unsigned __int16 v9; // bx@16 | |
11029 int v10; // ecx@16 | |
11030 unsigned __int16 *v11; // eax@16 | |
11031 unsigned int *v12; // edx@16 | |
11032 int v13; // ecx@16 | |
11033 int v14; // eax@16 | |
11034 int v15; // ebx@16 | |
11035 int v16; // [sp-4h] [bp-Ch]@2 | |
11036 | |
11037 v2 = a1->field_28; | |
11038 if ( v2 ) | |
11039 { | |
11040 do | |
11041 { | |
11042 v16 = v2; | |
11043 v3 = a1->field_30; | |
11044 v4 = a1->field_2C; | |
11045 if ( (signed int)v3 >= a1->field_18 ) | |
11046 v3 = a1->field_18; | |
11047 if ( (signed int)v3 <= a1->field_14 ) | |
11048 v3 = a1->field_14; | |
11049 if ( v4 >= a1->field_20 ) | |
11050 v4 = a1->field_20; | |
11051 if ( v4 <= a1->field_1C ) | |
11052 v4 = a1->field_1C; | |
11053 v5 = *((char *)a1->pTextureLOD + (a1->field_C & (v3 >> 16)) + (((unsigned int)v4 & a1->field_8) >> a1->field_10)); | |
11054 v6 = a1->field_34_palette; | |
11055 if ( a2->field_20 ) | |
11056 { | |
11057 v7 = (unsigned int)a2->field_10 >> 16; | |
11058 if ( v7 >= a2->field_C ) | |
11059 v7 = a2->field_C; | |
11060 v8 = 0; | |
11061 if ( a2->field_8 - v7 >= 0 ) | |
11062 v8 = a2->field_8 - v7; | |
11063 v5 += v8 << 8; | |
11064 v6 = a2->field_24_palette; | |
11065 } | |
11066 v9 = v6[v5]; | |
11067 v10 = a1->field_24; | |
11068 v11 = a1->pColorBuffer; | |
11069 v12 = a1->pDepthBuffer; | |
11070 *v11 = v9; | |
11071 *v12 = v10; | |
11072 a1->pColorBuffer = v11 + 1; | |
11073 a1->pDepthBuffer = v12 + 1; | |
11074 v13 = a1->field_30; | |
11075 a2->field_10 += a2->field_18; | |
11076 v14 = a1->field_2C; | |
11077 v15 = a1->field_0; | |
11078 a1->field_30 = a1->field_4 + v13; | |
11079 a1->field_2C = v15 + v14; | |
11080 v2 = v16 - 1; | |
11081 } | |
11082 while ( v16 != 1 ); | |
11083 } | |
11084 } | |
11085 //----- (004D73DF) -------------------------------------------------------- | |
11086 int sr_sub_4D73DF(int a1) | |
11087 { | |
11088 int v1; // ebp@1 | |
11089 unsigned int v2; // esi@1 | |
11090 unsigned int v3; // edi@1 | |
11091 int result; // eax@1 | |
11092 int v5; // ebx@2 | |
11093 int v6; // edx@2 | |
11094 int v7; // edx@3 | |
11095 int v8; // edx@6 | |
11096 unsigned __int8 v9; // sf@9 | |
11097 unsigned __int8 v10; // of@9 | |
11098 | |
11099 v1 = *(int *)(a1 + 8); | |
11100 v2 = *(int *)(v1 + 48); | |
11101 v3 = *(int *)(v1 + 44); | |
11102 result = *(int *)(v1 + 64); | |
11103 if ( !(*(int *)(v1 + 40) & 1) ) | |
11104 goto LABEL_9; | |
11105 --*(int *)(v1 + 40); | |
11106 result -= 2; | |
11107 v5 = *(int *)(v1 + 60); | |
11108 v6 = *(int *)(v1 + 36); | |
11109 *(int *)(v1 + 60) += 4; | |
11110 while ( 1 ) | |
11111 { | |
11112 *(int *)v5 = v6; | |
11113 v8 = *(int *)(v1 + 12) & (v2 >> 16); | |
11114 result += 4; | |
11115 v2 += *(int *)(v1 + 4); | |
11116 if ( *(char *)(*(int *)(v1 + 56) + v8 + ((*(int *)(v1 + 8) & v3) >> *(char *)(v1 + 16))) ) | |
11117 *(short *)(result - 2) = *(short *)(*(int *)(v1 + 52) | |
11118 + 2 | |
11119 * *(char *)(*(int *)(v1 + 56) | |
11120 + v8 | |
11121 + ((*(int *)(v1 + 8) & v3) >> *(char *)(v1 + 16)))); | |
11122 v3 += *(int *)v1; | |
11123 LABEL_9: | |
11124 v10 = __OFSUB__(*(int *)(v1 + 40), 2); | |
11125 v9 = *(int *)(v1 + 40) - 2 < 0; | |
11126 *(int *)(v1 + 40) -= 2; | |
11127 if ( v9 ^ v10 ) | |
11128 break; | |
11129 v7 = *(int *)(v1 + 12) & (v2 >> 16); | |
11130 v2 += *(int *)(v1 + 4); | |
11131 if ( *(char *)(*(int *)(v1 + 56) + v7 + ((*(int *)(v1 + 8) & v3) >> *(char *)(v1 + 16))) ) | |
11132 *(short *)result = *(short *)(*(int *)(v1 + 52) | |
11133 + 2 | |
11134 * *(char *)(*(int *)(v1 + 56) | |
11135 + v7 | |
11136 + ((*(int *)(v1 + 8) & v3) >> *(char *)(v1 + 16)))); | |
11137 v3 += *(int *)v1; | |
11138 v5 = *(int *)(v1 + 60); | |
11139 v6 = *(int *)(v1 + 36); | |
11140 *(int *)(v1 + 60) += 8; | |
11141 *(int *)(v5 + 4) = v6; | |
11142 } | |
11143 return result; | |
11144 } | |
11145 | |
11146 //----- (004D72EC) -------------------------------------------------------- | |
11147 int sr_sub_4D72EC(int a1) | |
11148 { | |
11149 int v1; // ebp@1 | |
11150 unsigned int v2; // esi@1 | |
11151 unsigned int v3; // edi@1 | |
11152 int result; // eax@1 | |
11153 int v5; // ebx@2 | |
11154 int v6; // edx@2 | |
11155 unsigned int v7; // edx@3 | |
11156 unsigned int v8; // ebx@3 | |
11157 int v9; // ebx@11 | |
11158 unsigned int v10; // edx@14 | |
11159 unsigned int v11; // ebx@14 | |
11160 int v12; // ebx@22 | |
11161 unsigned __int8 v13; // sf@25 | |
11162 unsigned __int8 v14; // of@25 | |
11163 | |
11164 v1 = *(int *)(a1 + 8); | |
11165 v2 = *(int *)(v1 + 48); | |
11166 v3 = *(int *)(v1 + 44); | |
11167 result = *(int *)(v1 + 64); | |
11168 if ( !(*(int *)(v1 + 40) & 1) ) | |
11169 goto LABEL_25; | |
11170 --*(int *)(v1 + 40); | |
11171 result -= 2; | |
11172 v5 = *(int *)(v1 + 60); | |
11173 v6 = *(int *)(v1 + 36); | |
11174 *(int *)(v1 + 60) += 4; | |
11175 while ( 1 ) | |
11176 { | |
11177 *(int *)v5 = v6; | |
11178 v10 = v2; | |
11179 v11 = v3; | |
11180 if ( (signed int)v2 < *(int *)(v1 + 20) ) | |
11181 v10 = *(int *)(v1 + 20); | |
11182 if ( (signed int)v3 < *(int *)(v1 + 28) ) | |
11183 v11 = *(int *)(v1 + 28); | |
11184 if ( (signed int)v10 > *(int *)(v1 + 24) ) | |
11185 v10 = *(int *)(v1 + 24); | |
11186 if ( (signed int)v11 > *(int *)(v1 + 32) ) | |
11187 v11 = *(int *)(v1 + 32); | |
11188 v12 = *(char *)(*(int *)(v1 + 56) | |
11189 + (*(int *)(v1 + 12) & (v10 >> 16)) | |
11190 + ((*(int *)(v1 + 8) & v11) >> *(char *)(v1 + 16))); | |
11191 result += 4; | |
11192 v2 += *(int *)(v1 + 4); | |
11193 if ( v12 ) | |
11194 *(short *)(result - 2) = *(short *)(*(int *)(v1 + 52) + 2 * v12); | |
11195 v3 += *(int *)v1; | |
11196 LABEL_25: | |
11197 v14 = __OFSUB__(*(int *)(v1 + 40), 2); | |
11198 v13 = *(int *)(v1 + 40) - 2 < 0; | |
11199 *(int *)(v1 + 40) -= 2; | |
11200 if ( v13 ^ v14 ) | |
11201 break; | |
11202 v7 = v2; | |
11203 v8 = v3; | |
11204 if ( (signed int)v2 < *(int *)(v1 + 20) ) | |
11205 v7 = *(int *)(v1 + 20); | |
11206 if ( (signed int)v3 < *(int *)(v1 + 28) ) | |
11207 v8 = *(int *)(v1 + 28); | |
11208 if ( (signed int)v7 > *(int *)(v1 + 24) ) | |
11209 v7 = *(int *)(v1 + 24); | |
11210 if ( (signed int)v8 > *(int *)(v1 + 32) ) | |
11211 v8 = *(int *)(v1 + 32); | |
11212 v9 = *(char *)(*(int *)(v1 + 56) | |
11213 + (*(int *)(v1 + 12) & (v7 >> 16)) | |
11214 + ((*(int *)(v1 + 8) & v8) >> *(char *)(v1 + 16))); | |
11215 v2 += *(int *)(v1 + 4); | |
11216 if ( v9 ) | |
11217 *(short *)result = *(short *)(*(int *)(v1 + 52) + 2 * v9); | |
11218 v3 += *(int *)v1; | |
11219 v5 = *(int *)(v1 + 60); | |
11220 v6 = *(int *)(v1 + 36); | |
11221 *(int *)(v1 + 60) += 8; | |
11222 *(int *)(v5 + 4) = v6; | |
11223 } | |
11224 return result; | |
11225 } | |
11226 | |
11227 //----- (004D7630) -------------------------------------------------------- | |
11228 void __cdecl sr_sub_4D7630(stru315 *a1, stru316 *a2) | |
11229 { | |
11230 int v2; // ecx@1 | |
11231 int v3; // eax@2 | |
11232 unsigned __int16 *v4; // edx@2 | |
11233 int v5; // ebx@3 | |
11234 int v6; // ecx@5 | |
11235 unsigned __int16 v7; // bx@8 | |
11236 int v8; // ecx@8 | |
11237 unsigned __int16 *v9; // eax@8 | |
11238 unsigned int *v10; // edx@8 | |
11239 int v11; // ecx@8 | |
11240 int v12; // eax@8 | |
11241 int v13; // ebx@8 | |
11242 int v14; // [sp-4h] [bp-Ch]@2 | |
11243 | |
11244 v2 = a1->field_28; | |
11245 if ( v2 ) | |
11246 { | |
11247 do | |
11248 { | |
11249 v14 = v2; | |
11250 v3 = *((char *)a1->pTextureLOD | |
11251 + (a1->field_C & ((unsigned int)a1->field_30 >> 16)) | |
11252 + ((unsigned int)(a1->field_2C & a1->field_8) >> a1->field_10)); | |
11253 v4 = a1->field_34_palette; | |
11254 if ( a2->field_20 ) | |
11255 { | |
11256 v5 = (unsigned int)a2->field_14 >> 16; | |
11257 if ( v5 >= a2->field_C ) | |
11258 v5 = a2->field_C; | |
11259 v6 = 0; | |
11260 if ( a2->field_8 - v5 >= 0 ) | |
11261 v6 = a2->field_8 - v5; | |
11262 v3 += v6 << 8; | |
11263 v4 = a2->field_24_palette; | |
11264 } | |
11265 v7 = v4[v3]; | |
11266 v8 = a1->field_24; | |
11267 v9 = a1->pColorBuffer; | |
11268 v10 = a1->pDepthBuffer; | |
11269 *v9 = v7; | |
11270 *v10 = v8; | |
11271 a1->pColorBuffer = v9 - 1; | |
11272 a1->pDepthBuffer = v10 - 1; | |
11273 v11 = a1->field_30; | |
11274 a2->field_14 -= a2->field_18; | |
11275 v12 = a1->field_2C; | |
11276 v13 = a1->field_0; | |
11277 a1->field_30 = a1->field_4 + v11; | |
11278 a1->field_2C = v13 + v12; | |
11279 v2 = v14 - 1; | |
11280 } | |
11281 while ( v14 != 1 ); | |
11282 } | |
11283 } | |
11284 | |
11285 //----- (004D76ED) -------------------------------------------------------- | |
11286 void __cdecl sr_sub_4D76ED(stru315 *a1, stru316 *a2) | |
11287 { | |
11288 int v2; // ecx@1 | |
11289 unsigned int v3; // eax@2 | |
11290 int v4; // ecx@2 | |
11291 int v5; // eax@10 | |
11292 unsigned __int16 *v6; // edx@10 | |
11293 int v7; // ebx@11 | |
11294 int v8; // ecx@13 | |
11295 unsigned __int16 v9; // bx@16 | |
11296 int v10; // ecx@16 | |
11297 unsigned __int16 *v11; // eax@16 | |
11298 unsigned int *v12; // edx@16 | |
11299 int v13; // ecx@16 | |
11300 int v14; // eax@16 | |
11301 int v15; // ebx@16 | |
11302 int v16; // [sp-4h] [bp-Ch]@2 | |
11303 | |
11304 v2 = a1->field_28; | |
11305 if ( v2 ) | |
11306 { | |
11307 do | |
11308 { | |
11309 v16 = v2; | |
11310 v3 = a1->field_30; | |
11311 v4 = a1->field_2C; | |
11312 if ( (signed int)v3 >= a1->field_18 ) | |
11313 v3 = a1->field_18; | |
11314 if ( (signed int)v3 <= a1->field_14 ) | |
11315 v3 = a1->field_14; | |
11316 if ( v4 >= a1->field_20 ) | |
11317 v4 = a1->field_20; | |
11318 if ( v4 <= a1->field_1C ) | |
11319 v4 = a1->field_1C; | |
11320 v5 = *((char *)a1->pTextureLOD + (a1->field_C & (v3 >> 16)) + (((unsigned int)v4 & a1->field_8) >> a1->field_10)); | |
11321 v6 = a1->field_34_palette; | |
11322 if ( a2->field_20 ) | |
11323 { | |
11324 v7 = (unsigned int)a2->field_14 >> 16; | |
11325 if ( v7 >= a2->field_C ) | |
11326 v7 = a2->field_C; | |
11327 v8 = 0; | |
11328 if ( a2->field_8 - v7 >= 0 ) | |
11329 v8 = a2->field_8 - v7; | |
11330 v5 += v8 << 8; | |
11331 v6 = a2->field_24_palette; | |
11332 } | |
11333 v9 = v6[v5]; | |
11334 v10 = a1->field_24; | |
11335 v11 = a1->pColorBuffer; | |
11336 v12 = a1->pDepthBuffer; | |
11337 *v11 = v9; | |
11338 *v12 = v10; | |
11339 a1->pColorBuffer = v11 - 1; | |
11340 a1->pDepthBuffer = v12 - 1; | |
11341 v13 = a1->field_30; | |
11342 a2->field_14 -= a2->field_18; | |
11343 v14 = a1->field_2C; | |
11344 v15 = a1->field_0; | |
11345 a1->field_30 = a1->field_4 + v13; | |
11346 a1->field_2C = v15 + v14; | |
11347 v2 = v16 - 1; | |
11348 } | |
11349 while ( v16 != 1 ); | |
11350 } | |
11351 } | |
11352 | |
11353 //----- (004D77D2) -------------------------------------------------------- | |
11354 void __cdecl sr_sub_4D77D2(stru315 *a1, stru316 *a2) | |
11355 { | |
11356 int v2; // ecx@1 | |
11357 unsigned __int16 *v3; // ebx@2 | |
11358 int v4; // eax@2 | |
11359 unsigned __int16 *v5; // edx@2 | |
11360 int v6; // ebx@4 | |
11361 int v7; // ecx@6 | |
11362 unsigned __int16 v8; // bx@9 | |
11363 int v9; // ecx@9 | |
11364 unsigned int *v10; // edx@9 | |
11365 unsigned int *v11; // edx@10 | |
11366 int v12; // ecx@10 | |
11367 int v13; // eax@10 | |
11368 int v14; // ebx@10 | |
11369 int v15; // [sp-4h] [bp-Ch]@2 | |
11370 | |
11371 v2 = a1->field_28; | |
11372 if ( v2 ) | |
11373 { | |
11374 do | |
11375 { | |
11376 v15 = v2; | |
11377 v3 = a1->pTextureLOD; | |
11378 v4 = *((char *)v3 | |
11379 + (a1->field_C & ((unsigned int)a1->field_30 >> 16)) | |
11380 + ((unsigned int)(a1->field_2C & a1->field_8) >> a1->field_10)); | |
11381 v5 = a1->field_34_palette; | |
11382 if ( *((char *)v3 | |
11383 + (a1->field_C & ((unsigned int)a1->field_30 >> 16)) | |
11384 + ((unsigned int)(a1->field_2C & a1->field_8) >> a1->field_10)) ) | |
11385 { | |
11386 if ( a2->field_20 ) | |
11387 { | |
11388 v6 = (unsigned int)a2->field_10 >> 16; | |
11389 if ( v6 >= a2->field_C ) | |
11390 v6 = a2->field_C; | |
11391 v7 = 0; | |
11392 if ( a2->field_8 - v6 >= 0 ) | |
11393 v7 = a2->field_8 - v6; | |
11394 v4 += v7 << 8; | |
11395 v5 = a2->field_24_palette; | |
11396 } | |
11397 v8 = v5[v4]; | |
11398 v9 = a1->field_24; | |
11399 v10 = a1->pDepthBuffer; | |
11400 *a1->pColorBuffer = v8; | |
11401 *v10 = v9; | |
11402 } | |
11403 v11 = a1->pDepthBuffer + 1; | |
11404 ++a1->pColorBuffer; | |
11405 a1->pDepthBuffer = v11; | |
11406 v12 = a1->field_30; | |
11407 a2->field_10 += a2->field_18; | |
11408 v13 = a1->field_2C; | |
11409 v14 = a1->field_0; | |
11410 a1->field_30 = a1->field_4 + v12; | |
11411 a1->field_2C = v14 + v13; | |
11412 v2 = v15 - 1; | |
11413 } | |
11414 while ( v15 != 1 ); | |
11415 } | |
11416 } | |
11417 //----- (004D789A) -------------------------------------------------------- | |
11418 void __cdecl sr_sub_4D789A(stru315 *a1, stru316 *a2) | |
11419 { | |
11420 int v2; // ecx@1 | |
11421 unsigned int v3; // eax@2 | |
11422 int v4; // ecx@2 | |
11423 int v5; // eax@10 | |
11424 unsigned __int16 *v6; // edx@10 | |
11425 int v7; // ebx@12 | |
11426 int v8; // ecx@14 | |
11427 unsigned __int16 v9; // bx@17 | |
11428 int v10; // ecx@17 | |
11429 unsigned int *v11; // edx@17 | |
11430 unsigned int *v12; // edx@18 | |
11431 int v13; // ecx@18 | |
11432 int v14; // eax@18 | |
11433 int v15; // ebx@18 | |
11434 int v16; // [sp-4h] [bp-Ch]@2 | |
11435 | |
11436 v2 = a1->field_28; | |
11437 if ( v2 ) | |
11438 { | |
11439 do | |
11440 { | |
11441 v16 = v2; | |
11442 v3 = a1->field_30; | |
11443 v4 = a1->field_2C; | |
11444 if ( (signed int)v3 >= a1->field_18 ) | |
11445 v3 = a1->field_18; | |
11446 if ( (signed int)v3 <= a1->field_14 ) | |
11447 v3 = a1->field_14; | |
11448 if ( v4 >= a1->field_20 ) | |
11449 v4 = a1->field_20; | |
11450 if ( v4 <= a1->field_1C ) | |
11451 v4 = a1->field_1C; | |
11452 v5 = *((char *)a1->pTextureLOD + (a1->field_C & (v3 >> 16)) + (((unsigned int)v4 & a1->field_8) >> a1->field_10)); | |
11453 v6 = a1->field_34_palette; | |
11454 if ( v5 ) | |
11455 { | |
11456 if ( a2->field_20 ) | |
11457 { | |
11458 v7 = (unsigned int)a2->field_10 >> 16; | |
11459 if ( v7 >= a2->field_C ) | |
11460 v7 = a2->field_C; | |
11461 v8 = 0; | |
11462 if ( a2->field_8 - v7 >= 0 ) | |
11463 v8 = a2->field_8 - v7; | |
11464 v5 += v8 << 8; | |
11465 v6 = a2->field_24_palette; | |
11466 } | |
11467 v9 = v6[v5]; | |
11468 v10 = a1->field_24; | |
11469 v11 = a1->pDepthBuffer; | |
11470 *a1->pColorBuffer = v9; | |
11471 *v11 = v10; | |
11472 } | |
11473 v12 = a1->pDepthBuffer + 1; | |
11474 ++a1->pColorBuffer; | |
11475 a1->pDepthBuffer = v12; | |
11476 v13 = a1->field_30; | |
11477 a2->field_10 += a2->field_18; | |
11478 v14 = a1->field_2C; | |
11479 v15 = a1->field_0; | |
11480 a1->field_30 = a1->field_4 + v13; | |
11481 a1->field_2C = v15 + v14; | |
11482 v2 = v16 - 1; | |
11483 } | |
11484 while ( v16 != 1 ); | |
11485 } | |
11486 } | |
11487 */ |