comparison mm7_6.cpp @ 1449:27b7ee003c7c

Merge
author Gloval
date Tue, 06 Aug 2013 00:56:33 +0400
parents 5a5d0c713d47 9a1adf08f4ed
children 8ff3c675a726
comparison
equal deleted inserted replaced
1448:5a5d0c713d47 1449:27b7ee003c7c
125 { 125 {
126 if ( v2 == *((float *)v7 - 7) && *(float *)v5 == *((float *)v7 - 6) ) 126 if ( v2 == *((float *)v7 - 7) && *(float *)v5 == *((float *)v7 - 6) )
127 { 127 {
128 v11 = 0; 128 v11 = 0;
129 v12 = *(float *)v4 == *((float *)v7 - 5); 129 v12 = *(float *)v4 == *((float *)v7 - 5);
130 goto LABEL_19; 130 if ( ! (v12 | v11) )
131 {
132 v26 += 48;
133 ++v24;
134 v25 += 48;
135 v27 += 48;
136 v28 += 48;
137 v5 += 48;
138 v4 += 48;
139 ++v22;
140 v23 += 48;
141 v21 = v5;
142 v20 = v4;
143 }
131 } 144 }
132 } 145 }
133 else 146 else
134 { 147 {
135 if ( v2 == *((float *)v7 + 5) && *(float *)v5 == *((float *)v7 + 6) ) 148 if ( v2 == *((float *)v7 + 5) && *(float *)v5 == *((float *)v7 + 6) )
136 { 149 {
137 v11 = 0; 150 v11 = 0;
138 v12 = *(float *)v4 == *((float *)v7 + 7); 151 v12 = *(float *)v4 == *((float *)v7 + 7);
139 LABEL_19: 152 if ( !(v12 | v11) )
140 if ( v12 | v11 ) 153 {
141 goto LABEL_21; 154 v26 += 48;
142 goto LABEL_20; 155 ++v24;
156 v25 += 48;
157 v27 += 48;
158 v28 += 48;
159 v5 += 48;
160 v4 += 48;
161 ++v22;
162 v23 += 48;
163 v21 = v5;
164 v20 = v4;
165 }
143 } 166 }
144 } 167 }
145 LABEL_20:
146 v26 += 48; 168 v26 += 48;
147 ++v24; 169 ++v24;
148 v25 += 48; 170 v25 += 48;
149 v27 += 48; 171 v27 += 48;
150 v28 += 48; 172 v28 += 48;
153 ++v22; 175 ++v22;
154 v23 += 48; 176 v23 += 48;
155 v21 = v5; 177 v21 = v5;
156 v20 = v4; 178 v20 = v4;
157 } 179 }
158 LABEL_21:
159 if ( v19 ) 180 if ( v19 )
160 { 181 {
161 v13 = v24; 182 v13 = v24;
162 v14 = v26; 183 v14 = v26;
163 v21 += 48; 184 v21 += 48;
186 if ( v22 < 3 ) 207 if ( v22 < 3 )
187 return 0; 208 return 0;
188 return result; 209 return result;
189 } 210 }
190 211
191 //----- (004250FE) --------------------------------------------------------
192 signed int __fastcall sr_4250FE(unsigned int uVertexID)
193 {
194 unsigned int v1; // edx@1
195 char *v2; // edi@5
196 char *v3; // esi@5
197 char *v4; // ecx@5
198 int v5; // ebx@6
199 double v6; // st6@11
200 double v7; // st5@11
201 double v8; // st6@12
202 unsigned __int8 v9; // c2@16
203 unsigned __int8 v10; // c3@16
204 void *v11; // edi@23
205 double v12; // st6@23
206 char *v13; // ecx@23
207 char v14; // zf@24
208 signed int result; // eax@25
209 unsigned int v16; // [sp+8h] [bp-28h]@5
210 bool v17; // [sp+Ch] [bp-24h]@2
211 bool v18; // [sp+10h] [bp-20h]@7
212 char *v19; // [sp+14h] [bp-1Ch]@5
213 char *v20; // [sp+18h] [bp-18h]@5
214 signed int v21; // [sp+1Ch] [bp-14h]@1
215 RenderVertexSoft *v22; // [sp+20h] [bp-10h]@5
216 char *v23; // [sp+24h] [bp-Ch]@5
217 char *v24; // [sp+28h] [bp-8h]@5
218 char *v25; // [sp+2Ch] [bp-4h]@5
219
220 v1 = uVertexID;
221 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID]));
222 v21 = 0;
223 v17 = array_50AC10[0].vWorldViewPosition.x >= 8.0;
224 if ( (signed int)(uVertexID + 1) <= 1 )
225 return 0;
226 v2 = (char *)&array_507D30[0].vWorldViewPosition.z;
227 v3 = (char *)&array_507D30[0].vWorldViewPosition.y;
228 v24 = (char *)&array_507D30[0]._rhw;
229 v22 = array_507D30;
230 v19 = (char *)&array_507D30[0].vWorldViewPosition.z;
231 v20 = (char *)&array_507D30[0].vWorldViewPosition.y;
232 v23 = (char *)&array_507D30[0].vWorldViewPosition;
233 v25 = (char *)&array_507D30[0].flt_2C;
234 v4 = (char *)&array_50AC10[0].vWorldViewPosition;
235 v16 = v1;
236 do
237 {
238 v5 = (int)(v4 + 48);
239 v18 = *((float *)v4 + 12) >= 8.0;
240 if ( v17 != v18 )
241 {
242 if ( v18 )
243 {
244 v6 = (8.0 - *(float *)v4) / (*(float *)v5 - *(float *)v4);
245 *(float *)v3 = (*((float *)v4 + 13) - *((float *)v4 + 1)) * v6 + *((float *)v4 + 1);
246 *(float *)v2 = (*((float *)v4 + 14) - *((float *)v4 + 2)) * v6 + *((float *)v4 + 2);
247 v7 = (*((float *)v4 + 20) - *((float *)v4 + 8)) * v6 + *((float *)v4 + 8);
248 }
249 else
250 {
251 v8 = (8.0 - *(float *)v5) / (*(float *)v4 - *(float *)v5);
252 *(float *)v3 = (*((float *)v4 + 1) - *((float *)v4 + 13)) * v8 + *((float *)v4 + 13);
253 *(float *)v2 = (*((float *)v4 + 2) - *((float *)v4 + 14)) * v8 + *((float *)v4 + 14);
254 v7 = (*((float *)v4 + 8) - *((float *)v4 + 20)) * v8 + *((float *)v4 + 20);
255 }
256 *(float *)v25 = v7;
257 *(float *)v23 = 8.0;
258 *(int *)v24 = 0x3E000000u;
259 if ( v17 )
260 {
261 if ( 8.0 == *(float *)v4 && *(float *)v3 == *((float *)v4 + 1) )
262 {
263 v9 = 0;
264 v10 = *(float *)v2 == *((float *)v4 + 2);
265 goto LABEL_20;
266 }
267 }
268 else
269 {
270 if ( 8.0 == *(float *)v5 && *(float *)v3 == *((float *)v4 + 13) )
271 {
272 v9 = 0;
273 v10 = *(float *)v2 == *((float *)v4 + 14);
274 LABEL_20:
275 if ( v10 | v9 )
276 goto LABEL_22;
277 goto LABEL_21;
278 }
279 }
280 LABEL_21:
281 ++v22;
282 v23 += 48;
283 v25 += 48;
284 v3 += 48;
285 v2 += 48;
286 ++v21;
287 v24 += 48;
288 v20 = v3;
289 v19 = v2;
290 }
291 LABEL_22:
292 if ( v18 )
293 {
294 v11 = v22;
295 v20 += 48;
296 v19 += 48;
297 v12 = 1.0 / (*(float *)v5 + 0.0000001);
298 ++v21;
299 v25 += 48;
300 v23 += 48;
301 ++v22;
302 memcpy(v11, v4 + 36, 0x30u);
303 v13 = v24;
304 v24 += 48;
305 v3 = v20;
306 v2 = v19;
307 *(float *)v13 = v12;
308 }
309 v14 = v16-- == 1;
310 v17 = v18;
311 v4 = (char *)v5;
312 }
313 while ( !v14 );
314 result = v21;
315 if ( v21 < 3 )
316 return 0;
317 return result;
318 }
319
320 //----- (004252E8) --------------------------------------------------------
321 signed int __fastcall sr_4252E8(unsigned int uVertexID)
322 {
323 unsigned int v1; // edx@1
324 double v2; // st7@1
325 char *v3; // edi@5
326 char *v4; // esi@5
327 char *v5; // ecx@5
328 int v6; // ebx@6
329 double v7; // st6@11
330 double v8; // st5@11
331 double v9; // st6@12
332 unsigned __int8 v10; // c2@16
333 unsigned __int8 v11; // c3@16
334 void *v12; // edi@23
335 double v13; // st6@23
336 char *v14; // ecx@23
337 char v15; // zf@24
338 signed int result; // eax@25
339 unsigned int v17; // [sp+8h] [bp-28h]@5
340 bool v18; // [sp+Ch] [bp-24h]@2
341 bool v19; // [sp+10h] [bp-20h]@7
342 char *v20; // [sp+14h] [bp-1Ch]@5
343 char *v21; // [sp+18h] [bp-18h]@5
344 signed int v22; // [sp+1Ch] [bp-14h]@1
345 RenderVertexSoft *v23; // [sp+20h] [bp-10h]@5
346 char *v24; // [sp+24h] [bp-Ch]@5
347 char *v25; // [sp+28h] [bp-8h]@5
348 char *v26; // [sp+2Ch] [bp-4h]@5
349
350 v1 = uVertexID;
351 v2 = (double)pOutdoorCamera->shading_dist_mist;
352 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID]));
353 v22 = 0;
354 v18 = array_50AC10[0].vWorldViewPosition.x <= v2;
355 if ( (signed int)(uVertexID + 1) <= 1 )
356 return 0;
357 v3 = (char *)&array_507D30[0].vWorldViewPosition.z;
358 v4 = (char *)&array_507D30[0].vWorldViewPosition.y;
359 v25 = (char *)&array_507D30[0]._rhw;
360 v23 = array_507D30;
361 v20 = (char *)&array_507D30[0].vWorldViewPosition.z;
362 v21 = (char *)&array_507D30[0].vWorldViewPosition.y;
363 v24 = (char *)&array_507D30[0].vWorldViewPosition;
364 v26 = (char *)&array_507D30[0].flt_2C;
365 v5 = (char *)&array_50AC10[0].vWorldViewPosition;
366 v17 = v1;
367 do
368 {
369 v6 = (int)(v5 + 48);
370 v19 = v2 >= *((float *)v5 + 12);
371 if ( v18 != v19 )
372 {
373 if ( v19 )
374 {
375 v7 = (v2 - *(float *)v5) / (*(float *)v6 - *(float *)v5);
376 *(float *)v4 = (*((float *)v5 + 13) - *((float *)v5 + 1)) * v7 + *((float *)v5 + 1);
377 *(float *)v3 = (*((float *)v5 + 14) - *((float *)v5 + 2)) * v7 + *((float *)v5 + 2);
378 v8 = (*((float *)v5 + 20) - *((float *)v5 + 8)) * v7 + *((float *)v5 + 8);
379 }
380 else
381 {
382 v9 = (v2 - *(float *)v6) / (*(float *)v5 - *(float *)v6);
383 *(float *)v4 = (*((float *)v5 + 1) - *((float *)v5 + 13)) * v9 + *((float *)v5 + 13);
384 *(float *)v3 = (*((float *)v5 + 2) - *((float *)v5 + 14)) * v9 + *((float *)v5 + 14);
385 v8 = (*((float *)v5 + 8) - *((float *)v5 + 20)) * v9 + *((float *)v5 + 20);
386 }
387 *(float *)v26 = v8;
388 *(float *)v24 = v2;
389 *(float *)v25 = 1.0 / v2;
390 if ( v18 )
391 {
392 if ( v2 == *(float *)v5 && *(float *)v4 == *((float *)v5 + 1) )
393 {
394 v10 = 0;
395 v11 = *(float *)v3 == *((float *)v5 + 2);
396 goto LABEL_20;
397 }
398 }
399 else
400 {
401 if ( v2 == *(float *)v6 && *(float *)v4 == *((float *)v5 + 13) )
402 {
403 v10 = 0;
404 v11 = *(float *)v3 == *((float *)v5 + 14);
405 LABEL_20:
406 if ( v11 | v10 )
407 goto LABEL_22;
408 goto LABEL_21;
409 }
410 }
411 LABEL_21:
412 ++v23;
413 v24 += 48;
414 v26 += 48;
415 v4 += 48;
416 v3 += 48;
417 ++v22;
418 v25 += 48;
419 v21 = v4;
420 v20 = v3;
421 }
422 LABEL_22:
423 if ( v19 )
424 {
425 v12 = v23;
426 v21 += 48;
427 v20 += 48;
428 v13 = 1.0 / (*(float *)v6 + 0.0000001);
429 ++v22;
430 v26 += 48;
431 v24 += 48;
432 ++v23;
433 memcpy(v12, v5 + 36, 0x30u);
434 v14 = v25;
435 v25 += 48;
436 v4 = v21;
437 v3 = v20;
438 *(float *)v14 = v13;
439 }
440 v15 = v17-- == 1;
441 v18 = v19;
442 v5 = (char *)v6;
443 }
444 while ( !v15 );
445 result = v22;
446 if ( v22 < 3 )
447 return 0;
448 return result;
449 }
450
451 //----- (004254D2) --------------------------------------------------------
452 int __fastcall sr_4254D2(signed int a1)
453 {
454 signed int v1; // ebx@2
455 int v2; // ecx@2
456 int result; // eax@11
457 double v4; // ST74_8@12
458 bool v5; // edi@12
459 char *v6; // esi@13
460 char *v7; // ebx@13
461 double v8; // st7@15
462 double v9; // st7@16
463 double v10; // st6@16
464 double v11; // st7@17
465 float v12; // eax@18
466 double v13; // ST4C_8@19
467 double v14; // ST10_8@19
468 double v15; // ST28_8@20
469 double v16; // ST34_8@20
470 char v17; // zf@20
471 double v18; // ST18_8@21
472 double v19; // ST3C_8@21
473 double v20; // ST44_8@22
474 double v21; // ST54_8@22
475 void *v22; // edi@26
476 double v23; // ST54_8@29
477 bool v24; // esi@29
478 char *v25; // edi@30
479 char *v26; // ebx@30
480 bool v27; // ecx@32
481 double v28; // st7@33
482 double v29; // st7@34
483 double v30; // st6@34
484 double v31; // st7@35
485 double v32; // ST44_8@37
486 double v33; // ST3C_8@37
487 double v34; // ST18_8@38
488 double v35; // ST34_8@38
489 char v36; // zf@38
490 double v37; // ST28_8@39
491 double v38; // ST10_8@39
492 double v39; // ST20_8@40
493 double v40; // ST5C_8@40
494 void *v41; // edi@44
495 double v42; // ST5C_8@47
496 bool v43; // edi@47
497 char *v44; // esi@48
498 char *v45; // ebx@48
499 bool v46; // ecx@49
500 double v47; // st6@50
501 double v48; // st6@51
502 double v49; // st5@51
503 double v50; // st6@52
504 double v51; // ST20_8@54
505 double v52; // ST54_8@54
506 double v53; // ST44_8@55
507 double v54; // ST3C_8@55
508 char v55; // zf@55
509 double v56; // ST18_8@56
510 double v57; // ST34_8@56
511 double v58; // ST28_8@57
512 double v59; // ST10_8@57
513 void *v60; // edi@61
514 double v61; // ST5C_8@64
515 bool v62; // edi@64
516 char *v63; // esi@65
517 char *v64; // ebx@65
518 bool v65; // ecx@66
519 double v66; // st6@67
520 double v67; // st6@68
521 double v68; // st5@68
522 double v69; // st6@69
523 double v70; // ST20_8@71
524 double v71; // ST54_8@71
525 double v72; // ST44_8@72
526 double v73; // ST3C_8@72
527 char v74; // zf@72
528 double v75; // ST18_8@73
529 double v76; // ST34_8@73
530 double v77; // ST28_8@74
531 double v78; // ST10_8@74
532 void *v79; // edi@78
533 int v80; // ebx@81
534 char *v81; // ecx@82
535 signed int v82; // esi@82
536 float v83; // ST78_4@83
537 double v84; // ST5C_8@83
538 float v85; // eax@84
539 double v86; // ST20_8@85
540 double v87; // ST54_8@88
541 float v88; // eax@89
542 double v89; // ST44_8@90
543 unsigned __int8 v90; // sf@94
544 unsigned __int8 v91; // of@94
545 int v92; // edx@97
546 int v93; // esi@97
547 int v94; // edi@97
548 int v95; // eax@97
549 int v96; // eax@104
550 double v97; // [sp+4Ch] [bp-8Ch]@32
551 double v98; // [sp+54h] [bp-84h]@49
552 double v99; // [sp+54h] [bp-84h]@66
553 float v100; // [sp+5Ch] [bp-7Ch]@1
554 float v101; // [sp+60h] [bp-78h]@1
555 float v102; // [sp+64h] [bp-74h]@1
556 double v103; // [sp+6Ch] [bp-6Ch]@14
557 float v104; // [sp+A8h] [bp-30h]@1
558 signed int v105; // [sp+A8h] [bp-30h]@96
559 bool v106; // [sp+ACh] [bp-2Ch]@14
560 bool v107; // [sp+ACh] [bp-2Ch]@32
561 bool v108; // [sp+ACh] [bp-2Ch]@49
562 bool v109; // [sp+ACh] [bp-2Ch]@66
563 signed int v110; // [sp+B0h] [bp-28h]@12
564 char *v111; // [sp+B8h] [bp-20h]@30
565 signed int v112; // [sp+B8h] [bp-20h]@48
566 signed int v113; // [sp+B8h] [bp-20h]@65
567 char *v114; // [sp+BCh] [bp-1Ch]@13
568 signed int v115; // [sp+BCh] [bp-1Ch]@29
569 signed int v116; // [sp+BCh] [bp-1Ch]@64
570 signed int v117; // [sp+C0h] [bp-18h]@1
571 char *v118; // [sp+C0h] [bp-18h]@30
572 char *v119; // [sp+C0h] [bp-18h]@48
573 char *v120; // [sp+C0h] [bp-18h]@65
574 char *v121; // [sp+C4h] [bp-14h]@13
575 char *v122; // [sp+C4h] [bp-14h]@30
576 signed int v123; // [sp+C4h] [bp-14h]@47
577 char *v124; // [sp+C8h] [bp-10h]@30
578 char *v125; // [sp+C8h] [bp-10h]@48
579 char *v126; // [sp+C8h] [bp-10h]@65
580 signed int v127; // [sp+CCh] [bp-Ch]@2
581 char *v128; // [sp+CCh] [bp-Ch]@13
582 char *v129; // [sp+CCh] [bp-Ch]@30
583 RenderVertexSoft *v130; // [sp+CCh] [bp-Ch]@48
584 RenderVertexSoft *v131; // [sp+CCh] [bp-Ch]@65
585 RenderVertexSoft *v132; // [sp+D0h] [bp-8h]@13
586 char *v133; // [sp+D0h] [bp-8h]@30
587 char *v134; // [sp+D0h] [bp-8h]@48
588 char *v135; // [sp+D0h] [bp-8h]@65
589 signed int v136; // [sp+D4h] [bp-4h]@1
590 char *v137; // [sp+D4h] [bp-4h]@13
591 RenderVertexSoft *v138; // [sp+D4h] [bp-4h]@30
592 char *v139; // [sp+D4h] [bp-4h]@48
593 char *v140; // [sp+D4h] [bp-4h]@65
594
595 v101 = (double)(signed int)pViewport->uViewportTL_X;
596 v100 = (double)(signed int)pViewport->uViewportBR_X;
597 v117 = a1;
598 v136 = 1;
599 v104 = (double)(signed int)pViewport->uViewportTL_Y;
600 v102 = (double)(pViewport->uViewportBR_Y + 1);
601 if ( a1 <= 0 )
602 return v117;
603 v127 = a1;
604 v1 = a1;
605 memcpy(array_508690, array_50AC10, 4 * ((unsigned int)(48 * a1) >> 2));
606 v2 = 0;
607 do
608 {
609 if ( array_50AC10[v2].vWorldViewProjX < (double)v101 || array_50AC10[v2].vWorldViewProjX > (double)v100 )
610 v136 = 0;
611 if ( *(float *)(v2 * 48 + 5286956) < (double)v104 || *(float *)(v2 * 48 + 5286956) > (double)v102 )
612 v136 = 0;
613 ++v2;
614 --v127;
615 }
616 while ( v127 );
617 if ( v136 )
618 return v117;
619 v110 = 0;
620 memcpy(&array_50AC10[v1], array_50AC10, sizeof(array_50AC10[v1]));
621 v4 = array_50AC10[0].vWorldViewProjX + 6.7553994e15;
622 v5 = SLODWORD(v4) >= (signed int)pViewport->uViewportTL_X;
623 if ( v117 < 1 )
624 goto LABEL_112;
625 v6 = (char *)&array_50A2B0[0].vWorldViewProjY;
626 v132 = array_50A2B0;
627 v137 = (char *)&array_50A2B0[0].vWorldViewProjX;
628 v128 = (char *)&array_50A2B0[0].vWorldViewProjY;
629 v121 = (char *)&array_50A2B0[0].flt_2C;
630 v114 = (char *)&array_50A2B0[0]._rhw;
631 v7 = (char *)&array_50AC10[0].flt_2C;
632 do
633 {
634 v103 = *((float *)v7 + 7) + 6.7553994e15;
635 v106 = SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X;
636 if ( !(v5 ^ v106) )
637 goto LABEL_25;
638 v8 = v101;
639 if ( SLODWORD(v103) >= (signed int)pViewport->uViewportTL_X )
640 {
641 v9 = (v8 - *((float *)v7 - 5)) / (*((float *)v7 + 7) - *((float *)v7 - 5));
642 *(float *)v6 = (*((float *)v7 + 8) - *((float *)v7 - 4)) * v9 + *((float *)v7 - 4);
643 *(float *)v114 = (*((float *)v7 + 9) - *((float *)v7 - 3)) * v9 + *((float *)v7 - 3);
644 v10 = (*((float *)v7 + 12) - *(float *)v7) * v9 + *(float *)v7;
645 }
646 else
647 {
648 v11 = (v8 - *((float *)v7 + 7)) / (*((float *)v7 - 5) - *((float *)v7 + 7));
649 *(float *)v6 = (*((float *)v7 - 4) - *((float *)v7 + 8)) * v11 + *((float *)v7 + 8);
650 *(float *)v114 = (*((float *)v7 - 3) - *((float *)v7 + 9)) * v11 + *((float *)v7 + 9);
651 v10 = (*(float *)v7 - *((float *)v7 + 12)) * v11 + *((float *)v7 + 12);
652 }
653 *(float *)v121 = v10;
654 *(int *)v137 = LODWORD(v101);
655 LODWORD(v12) = *(int *)v6;
656 if ( v5 )
657 {
658 v13 = v12 + 6.7553994e15;
659 v14 = *((float *)v7 - 4) + 6.7553994e15;
660 if ( LODWORD(v13) == LODWORD(v14) )
661 {
662 v15 = *(float *)v137 + 6.7553994e15;
663 v16 = *((float *)v7 - 5) + 6.7553994e15;
664 v17 = LODWORD(v15) == LODWORD(v16);
665 goto LABEL_23;
666 }
667 }
668 else
669 {
670 v18 = v12 + 6.7553994e15;
671 v19 = *((float *)v7 + 8) + 6.7553994e15;
672 if ( LODWORD(v18) == LODWORD(v19) )
673 {
674 v20 = *(float *)v137 + 6.7553994e15;
675 v21 = *((float *)v7 + 7) + 6.7553994e15;
676 v17 = LODWORD(v20) == LODWORD(v21);
677 LABEL_23:
678 if ( v17 )
679 goto LABEL_25;
680 goto LABEL_24;
681 }
682 }
683 LABEL_24:
684 v121 += 48;
685 v114 += 48;
686 v6 += 48;
687 ++v110;
688 ++v132;
689 v128 = v6;
690 v137 += 48;
691 LABEL_25:
692 if ( v106 )
693 {
694 v22 = v132;
695 v128 += 48;
696 ++v110;
697 v114 += 48;
698 v121 += 48;
699 v137 += 48;
700 ++v132;
701 memcpy(v22, v7 + 4, 0x30u);
702 v6 = v128;
703 }
704 v5 = v106;
705 v7 += 48;
706 --v117;
707 }
708 while ( v117 );
709 if ( v110 < 3
710 || (v115 = 0,
711 memcpy(&array_50A2B0[v110], array_50A2B0, sizeof(array_50A2B0[v110])),
712 v23 = array_50A2B0[0].vWorldViewProjX + 6.7553994e15,
713 v24 = SLODWORD(v23) <= (signed int)pViewport->uViewportBR_X,
714 v110 < 1) )
715 goto LABEL_112;
716 v25 = (char *)&array_509950[0]._rhw;
717 v138 = array_509950;
718 v129 = (char *)&array_50A2B0[0].vWorldViewProjX;
719 v118 = (char *)&array_50A2B0[0].vWorldViewProjY;
720 v133 = (char *)&array_509950[0].vWorldViewProjX;
721 v122 = (char *)&array_509950[0].vWorldViewProjY;
722 v124 = (char *)&array_509950[0].flt_2C;
723 v111 = (char *)&array_509950[0]._rhw;
724 v26 = (char *)&array_50A2B0[0].flt_2C;
725 while ( 2 )
726 {
727 v97 = *((float *)v26 + 7) + 6.7553994e15;
728 v27 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X;
729 v107 = SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X;
730 if ( v24 != v27 )
731 {
732 v28 = v100;
733 if ( SLODWORD(v97) <= (signed int)pViewport->uViewportBR_X )
734 {
735 v29 = (v28 - *((float *)v26 - 5)) / (*((float *)v26 + 7) - *((float *)v26 - 5));
736 *(float *)v122 = (*((float *)v26 + 8) - *((float *)v26 - 4)) * v29 + *((float *)v26 - 4);
737 *(float *)v25 = (*((float *)v26 + 9) - *((float *)v26 - 3)) * v29 + *((float *)v26 - 3);
738 v30 = (*((float *)v26 + 12) - *(float *)v26) * v29 + *(float *)v26;
739 }
740 else
741 {
742 v31 = (v28 - *((float *)v26 + 7)) / (*((float *)v26 - 5) - *((float *)v26 + 7));
743 *(float *)v122 = (*((float *)v26 - 4) - *((float *)v26 + 8)) * v31 + *((float *)v26 + 8);
744 *(float *)v25 = (*((float *)v26 - 3) - *((float *)v26 + 9)) * v31 + *((float *)v26 + 9);
745 v30 = (*(float *)v26 - *((float *)v26 + 12)) * v31 + *((float *)v26 + 12);
746 }
747 *(float *)v124 = v30;
748 *(int *)v133 = LODWORD(v100);
749 if ( v24 )
750 {
751 v32 = *(float *)v122 + 6.7553994e15;
752 v33 = *((float *)v26 - 4) + 6.7553994e15;
753 if ( LODWORD(v32) == LODWORD(v33) )
754 {
755 v34 = *(float *)v133 + 6.7553994e15;
756 v35 = *((float *)v26 - 5) + 6.7553994e15;
757 v36 = LODWORD(v34) == LODWORD(v35);
758 goto LABEL_41;
759 }
760 goto LABEL_42;
761 }
762 v37 = *(float *)v118 + 6.7553994e15;
763 v38 = *((float *)v26 + 8) + 6.7553994e15;
764 if ( LODWORD(v37) != LODWORD(v38) )
765 goto LABEL_42;
766 v39 = *(float *)v129 + 6.7553994e15;
767 v40 = *((float *)v26 + 7) + 6.7553994e15;
768 v36 = LODWORD(v39) == LODWORD(v40);
769 LABEL_41:
770 if ( !v36 )
771 {
772 LABEL_42:
773 v129 += 48;
774 v118 += 48;
775 v133 += 48;
776 v122 += 48;
777 v124 += 48;
778 v111 += 48;
779 ++v115;
780 ++v138;
781 }
782 }
783 if ( v27 )
784 {
785 v41 = v138;
786 ++v115;
787 v111 += 48;
788 v124 += 48;
789 v122 += 48;
790 v133 += 48;
791 v118 += 48;
792 v129 += 48;
793 ++v138;
794 memcpy(v41, v26 + 4, 0x30u);
795 }
796 v24 = v107;
797 v26 += 48;
798 --v110;
799 if ( v110 )
800 {
801 v25 = v111;
802 continue;
803 }
804 break;
805 }
806 if ( v115 < 3
807 || (v123 = 0,
808 memcpy(&array_509950[v115], array_509950, sizeof(array_509950[v115])),
809 v42 = array_509950[0].vWorldViewProjY + 6.7553994e15,
810 v43 = SLODWORD(v42) >= (signed int)pViewport->uViewportTL_Y,
811 v115 < 1) )
812 goto LABEL_112;
813 v44 = (char *)&array_508FF0[0].vWorldViewProjX;
814 v130 = array_508FF0;
815 v119 = (char *)&array_508FF0[0].vWorldViewProjX;
816 v139 = (char *)&array_508FF0[0].vWorldViewProjY;
817 v125 = (char *)&array_508FF0[0].flt_2C;
818 v134 = (char *)&array_508FF0[0]._rhw;
819 v45 = (char *)&array_509950[0].flt_2C;
820 v112 = v115;
821 while ( 2 )
822 {
823 v98 = *((float *)v45 + 8) + 6.7553994e15;
824 v46 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y;
825 v108 = SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y;
826 if ( v43 != v46 )
827 {
828 v47 = v104;
829 if ( SLODWORD(v98) >= (signed int)pViewport->uViewportTL_Y )
830 {
831 v48 = (v47 - *((float *)v45 - 4)) / (*((float *)v45 + 8) - *((float *)v45 - 4));
832 *(float *)v44 = (*((float *)v45 + 7) - *((float *)v45 - 5)) * v48 + *((float *)v45 - 5);
833 *(float *)v134 = (*((float *)v45 + 9) - *((float *)v45 - 3)) * v48 + *((float *)v45 - 3);
834 v49 = (*((float *)v45 + 12) - *(float *)v45) * v48 + *(float *)v45;
835 }
836 else
837 {
838 v50 = (v47 - *((float *)v45 + 8)) / (*((float *)v45 - 4) - *((float *)v45 + 8));
839 *(float *)v44 = (*((float *)v45 - 5) - *((float *)v45 + 7)) * v50 + *((float *)v45 + 7);
840 *(float *)v134 = (*((float *)v45 - 3) - *((float *)v45 + 9)) * v50 + *((float *)v45 + 9);
841 v49 = (*(float *)v45 - *((float *)v45 + 12)) * v50 + *((float *)v45 + 12);
842 }
843 *(float *)v125 = v49;
844 *(float *)v139 = v104;
845 if ( v43 )
846 {
847 v51 = v104 + 6.7553994e15;
848 v52 = *((float *)v45 - 4) + 6.7553994e15;
849 if ( LODWORD(v51) == LODWORD(v52) )
850 {
851 v53 = *(float *)v44 + 6.7553994e15;
852 v54 = *((float *)v45 - 5) + 6.7553994e15;
853 v55 = LODWORD(v53) == LODWORD(v54);
854 goto LABEL_58;
855 }
856 goto LABEL_59;
857 }
858 v56 = v104 + 6.7553994e15;
859 v57 = *((float *)v45 + 8) + 6.7553994e15;
860 if ( LODWORD(v56) != LODWORD(v57) )
861 goto LABEL_59;
862 v58 = *(float *)v44 + 6.7553994e15;
863 v59 = *((float *)v45 + 7) + 6.7553994e15;
864 v55 = LODWORD(v58) == LODWORD(v59);
865 LABEL_58:
866 if ( !v55 )
867 {
868 LABEL_59:
869 v139 += 48;
870 v125 += 48;
871 v134 += 48;
872 v44 += 48;
873 ++v123;
874 ++v130;
875 v119 = v44;
876 }
877 }
878 if ( v46 )
879 {
880 v60 = v130;
881 v119 += 48;
882 ++v123;
883 v134 += 48;
884 v125 += 48;
885 v139 += 48;
886 ++v130;
887 memcpy(v60, v45 + 4, 0x30u);
888 v44 = v119;
889 }
890 v43 = v108;
891 v45 += 48;
892 --v112;
893 if ( v112 )
894 continue;
895 break;
896 }
897 if ( v123 < 3
898 || (v116 = 0,
899 memcpy(&array_508FF0[v123], array_508FF0, sizeof(array_508FF0[v123])),
900 v61 = array_508FF0[0].vWorldViewProjY + 6.7553994e15,
901 v62 = SLODWORD(v61) <= (signed int)pViewport->uViewportBR_Y,
902 v123 < 1) )
903 goto LABEL_112;
904 v63 = (char *)&array_508690[0].vWorldViewProjX;
905 v131 = array_508690;
906 v120 = (char *)&array_508690[0].vWorldViewProjX;
907 v140 = (char *)&array_508690[0].vWorldViewProjY;
908 v126 = (char *)&array_508690[0].flt_2C;
909 v135 = (char *)&array_508690[0]._rhw;
910 v64 = (char *)&array_508FF0[0].flt_2C;
911 v113 = v123;
912 while ( 2 )
913 {
914 v99 = *((float *)v64 + 8) + 6.7553994e15;
915 v65 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y;
916 v109 = SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y;
917 if ( v62 != v65 )
918 {
919 v66 = v102;
920 if ( SLODWORD(v99) <= (signed int)pViewport->uViewportBR_Y )
921 {
922 v67 = (v66 - *((float *)v64 - 4)) / (*((float *)v64 + 8) - *((float *)v64 - 4));
923 *(float *)v63 = (*((float *)v64 + 7) - *((float *)v64 - 5)) * v67 + *((float *)v64 - 5);
924 *(float *)v135 = (*((float *)v64 + 9) - *((float *)v64 - 3)) * v67 + *((float *)v64 - 3);
925 v68 = (*((float *)v64 + 12) - *(float *)v64) * v67 + *(float *)v64;
926 }
927 else
928 {
929 v69 = (v66 - *((float *)v64 + 8)) / (*((float *)v64 - 4) - *((float *)v64 + 8));
930 *(float *)v63 = (*((float *)v64 - 5) - *((float *)v64 + 7)) * v69 + *((float *)v64 + 7);
931 *(float *)v135 = (*((float *)v64 - 3) - *((float *)v64 + 9)) * v69 + *((float *)v64 + 9);
932 v68 = (*(float *)v64 - *((float *)v64 + 12)) * v69 + *((float *)v64 + 12);
933 }
934 *(float *)v126 = v68;
935 *(float *)v140 = v102;
936 if ( v62 )
937 {
938 v70 = v102 + 6.7553994e15;
939 v71 = *((float *)v64 - 4) + 6.7553994e15;
940 if ( LODWORD(v70) == LODWORD(v71) )
941 {
942 v72 = *(float *)v63 + 6.7553994e15;
943 v73 = *((float *)v64 - 5) + 6.7553994e15;
944 v74 = LODWORD(v72) == LODWORD(v73);
945 goto LABEL_75;
946 }
947 goto LABEL_76;
948 }
949 v75 = v102 + 6.7553994e15;
950 v76 = *((float *)v64 + 8) + 6.7553994e15;
951 if ( LODWORD(v75) != LODWORD(v76) )
952 goto LABEL_76;
953 v77 = *(float *)v63 + 6.7553994e15;
954 v78 = *((float *)v64 + 7) + 6.7553994e15;
955 v74 = LODWORD(v77) == LODWORD(v78);
956 LABEL_75:
957 if ( !v74 )
958 {
959 LABEL_76:
960 v140 += 48;
961 v126 += 48;
962 v135 += 48;
963 v63 += 48;
964 ++v116;
965 ++v131;
966 v120 = v63;
967 }
968 }
969 if ( v65 )
970 {
971 v79 = v131;
972 v120 += 48;
973 ++v116;
974 v135 += 48;
975 v126 += 48;
976 v140 += 48;
977 ++v131;
978 memcpy(v79, v64 + 4, 0x30u);
979 v63 = v120;
980 }
981 v62 = v109;
982 v64 += 48;
983 --v113;
984 if ( v113 )
985 continue;
986 break;
987 }
988 if ( v116 < 3 )
989 goto LABEL_112;
990 v80 = v116;
991 memcpy(&array_508690[v116], array_508690, sizeof(array_508690[v116]));
992 if ( v116 > 0 )
993 {
994 v81 = (char *)&array_508690[0].vWorldViewProjX;
995 v82 = v116;
996 do
997 {
998 LODWORD(v83) = *(int *)v81;
999 *((float *)v81 - 3) = 1.0 / *((float *)v81 + 2);
1000 v84 = v83 + 6.7553994e15;
1001 if ( SLODWORD(v84) <= (signed int)pViewport->uViewportBR_X )
1002 {
1003 v86 = *(float *)v81 + 6.7553994e15;
1004 if ( SLODWORD(v86) >= (signed int)pViewport->uViewportTL_X )
1005 goto LABEL_88;
1006 v85 = v101;
1007 }
1008 else
1009 {
1010 v85 = v100;
1011 }
1012 *(int *)v81 = LODWORD(v85);
1013 LABEL_88:
1014 v87 = *((float *)v81 + 1) + 6.7553994e15;
1015 if ( SLODWORD(v87) > (signed int)pViewport->uViewportBR_Y )
1016 {
1017 v88 = v102;
1018 LABEL_92:
1019 *((int *)v81 + 1) = LODWORD(v88);
1020 goto LABEL_93;
1021 }
1022 v89 = *((float *)v81 + 1) + 6.7553994e15;
1023 if ( SLODWORD(v89) < (signed int)pViewport->uViewportTL_Y )
1024 {
1025 v88 = v104;
1026 goto LABEL_92;
1027 }
1028 LABEL_93:
1029 v81 += 48;
1030 --v82;
1031 }
1032 while ( v82 );
1033 }
1034 v91 = __OFSUB__(v116, 3);
1035 v90 = v116 - 3 < 0;
1036 if ( v116 > 3 )
1037 {
1038 memcpy(&array_508690[v116 + 1], &array_508690[1], sizeof(array_508690[v116 + 1]));
1039 if ( v116 > 0 )
1040 {
1041 v105 = 1;
1042 do
1043 {
1044 v92 = v105;
1045 v93 = v105 - 1;
1046 v94 = v105 + 1;
1047 v95 = v105 + 1;
1048 if ( v105 - 1 >= v80 )
1049 v93 -= v80;
1050 if ( v105 >= v80 )
1051 v92 = v105 - v80;
1052 if ( v94 >= v80 )
1053 v95 = v94 - v80;
1054 if ( (array_508690[v92].vWorldViewProjX - array_508690[v93].vWorldViewProjX)
1055 * (array_508690[v95].vWorldViewProjY - array_508690[v93].vWorldViewProjY)
1056 - (array_508690[v95].vWorldViewProjX - array_508690[v93].vWorldViewProjX)
1057 * (array_508690[v92].vWorldViewProjY - array_508690[v93].vWorldViewProjY) < 0.0 )
1058 {
1059 ++v105;
1060 }
1061 else
1062 {
1063 v96 = v105;
1064 if ( v105 < v80 || (v96 = v105 - v80, v105 - v80 < v80) )
1065 memcpy(&array_508690[v96], &array_508690[v96 + 1], 4 * ((unsigned int)(48 * v80 - 48 * v96) >> 2));
1066 --v80;
1067 }
1068 }
1069 while ( v105 - 1 < v80 );
1070 }
1071 v91 = __OFSUB__(v80, 3);
1072 v90 = v80 - 3 < 0;
1073 }
1074 if ( v90 ^ v91 )
1075 LABEL_112:
1076 result = 0;
1077 else
1078 result = v80;
1079 return result;
1080 }
1081
1082 //----- (0042620A) -------------------------------------------------------- 212 //----- (0042620A) --------------------------------------------------------
1083 bool __thiscall sr_42620A(RenderVertexSoft *p) 213 bool sr_42620A(RenderVertexSoft *p)
1084 { 214 {
1085 __int16 v1; // fps@1 215 __int16 v1; // fps@1
1086 unsigned __int8 v2; // c0@2 216 unsigned __int8 v2; // c0@2
1087 char v3; // c2@2 217 char v3; // c2@2
1088 unsigned __int8 v4; // c3@2 218 unsigned __int8 v4; // c3@2
1217 v3 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes) == 0; 347 v3 = ((unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes) == 0;
1218 v13 = 0; 348 v13 = 0;
1219 v14 = 0; 349 v14 = 0;
1220 if ( v3 ) 350 if ( v3 )
1221 { 351 {
1222 if ( !pActor->pMonsterInfo.uTreasureDiceRolls ) 352 if ( pActor->pMonsterInfo.uTreasureDiceRolls )
1223 goto LABEL_9; 353 {
1224 do 354 do
1225 { 355 {
1226 ++v2; 356 ++v2;
1227 v14 += rand() % pActor->pMonsterInfo.uTreasureDiceSides + 1; 357 v14 += rand() % pActor->pMonsterInfo.uTreasureDiceSides + 1;
1228 } 358 }
1229 while ( v2 < pActor->pMonsterInfo.uTreasureDiceRolls ); 359 while ( v2 < pActor->pMonsterInfo.uTreasureDiceRolls );
360 if ( v14 )
361 {
362 party_finds_gold(v14, 0);
363 viewparams->bRedrawGameUI = 1;
364 }
365 }
1230 } 366 }
1231 else 367 else
1232 { 368 {
1233 if ( pItemsTable->pItems[pActor->array_000234[3].uItemID].uEquipType != 18 ) 369 if ( pItemsTable->pItems[pActor->array_000234[3].uItemID].uEquipType == 18 )
1234 goto LABEL_9; 370 {
1235 v14 = pActor->array_000234[3].uSpecEnchantmentType; 371 v14 = pActor->array_000234[3].uSpecEnchantmentType;
1236 pActor->array_000234[3].Reset(); 372 pActor->array_000234[3].Reset();
1237 } 373 if ( v14 )
1238 if ( v14 ) 374 {
1239 { 375 party_finds_gold(v14, 0);
1240 party_finds_gold(v14, 0); 376 viewparams->bRedrawGameUI = 1;
1241 viewparams->bRedrawGameUI = 1; 377 }
1242 } 378 }
1243 LABEL_9: 379 }
1244 if ( pActor->uCarriedItemID ) 380 if ( pActor->uCarriedItemID )
1245 { 381 {
1246 Dst.Reset(); 382 Dst.Reset();
1247 Dst.uItemID = pActor->uCarriedItemID; 383 Dst.uItemID = pActor->uCarriedItemID;
1248 v9 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName; 384 v9 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
1283 sub_421B2C_PlaceInInventory_or_DropPickedItem(); 419 sub_421B2C_PlaceInInventory_or_DropPickedItem();
1284 pParty->SetHoldingItem(&pActor->array_000234[1]); 420 pParty->SetHoldingItem(&pActor->array_000234[1]);
1285 } 421 }
1286 pActor->array_000234[1].Reset(); 422 pActor->array_000234[1].Reset();
1287 } 423 }
1288 LABEL_55:
1289 pActor->Remove(); 424 pActor->Remove();
1290 return; 425 return;
1291 } 426 }
1292 if ( (unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes ) 427 if ( (unsigned int)&array_77EC08[1975].pEdgeList1[1] & pActor->uAttributes )
1293 { 428 {
1344 v13 = 1; 479 v13 = 1;
1345 } 480 }
1346 pActor->array_000234[1].Reset(); 481 pActor->array_000234[1].Reset();
1347 } 482 }
1348 if ( !v13 || rand() % 100 < 90 ) 483 if ( !v13 || rand() % 100 < 90 )
1349 goto LABEL_55; 484 {
485 pActor->Remove();
486 }
1350 } 487 }
1351 488
1352 //----- (00426E10) -------------------------------------------------------- 489 //----- (00426E10) --------------------------------------------------------
1353 int stru319::which_player_would_attack(Actor *pActor) 490 int stru319::which_player_would_attack(Actor *pActor)
1354 { 491 {
1513 v18 = __OFSUB__(v24 + 1, 15); 650 v18 = __OFSUB__(v24 + 1, 15);
1514 v17 = v24++ - 14 < 0; 651 v17 = v24++ - 14 < 0;
1515 } 652 }
1516 while ( v17 ^ v18 ); 653 while ( v17 ^ v18 );
1517 if ( v2 ) 654 if ( v2 )
1518 goto LABEL_61; 655 return v23[rand() % v2];
1519 } 656 }
1520 v19 = 0; 657 v19 = 0;
1521 do 658 do
1522 { 659 {
1523 v20 = pPlayers[v19 + 1]; 660 v20 = pPlayers[v19 + 1];
1525 v23[v2++] = v19; 662 v23[v2++] = v19;
1526 ++v19; 663 ++v19;
1527 } 664 }
1528 while ( v19 < 4 ); 665 while ( v19 < 4 );
1529 if ( v2 ) 666 if ( v2 )
1530 LABEL_61:
1531 result = v23[rand() % v2]; 667 result = v23[rand() % v2];
1532 else 668 else
1533 result = 0; 669 result = 0;
1534 return result; 670 return result;
1535 } 671 }
1749 v9 = rand() % (v7 + 2 * v8 + 30); 885 v9 = rand() % (v7 + 2 * v8 + 30);
1750 if ( a3 == 2 ) 886 if ( a3 == 2 )
1751 { 887 {
1752 v14 = a4 + v9; 888 v14 = a4 + v9;
1753 v15 = ((v7 + 15) >> 1) + v7 + 15; 889 v15 = ((v7 + 15) >> 1) + v7 + 15;
890 v13 = __OFSUB__(v14, v15);
891 v12 = v14 - v15 < 0;
1754 } 892 }
1755 else 893 else
1756 { 894 {
1757 if ( a3 != 3 ) 895 if ( a3 != 3 )
1758 { 896 {
1759 v10 = a4 + v9; 897 v10 = a4 + v9;
1760 v11 = v7 + 15; 898 v11 = v7 + 15;
1761 v13 = __OFSUB__(v10, v11); 899 v13 = __OFSUB__(v10, v11);
1762 v12 = v10 - v11 < 0; 900 v12 = v10 - v11 < 0;
1763 goto LABEL_16; 901 }
1764 } 902 else
1765 v14 = a4 + v9; 903 {
1766 v15 = 2 * v7 + 30; 904 v14 = a4 + v9;
1767 } 905 v15 = 2 * v7 + 30;
1768 v13 = __OFSUB__(v14, v15); 906 v13 = __OFSUB__(v14, v15);
1769 v12 = v14 - v15 < 0; 907 v12 = v14 - v15 < 0;
1770 LABEL_16: 908 }
909 }
1771 if ( v12 ^ v13 ) 910 if ( v12 ^ v13 )
1772 result = 0; 911 result = 0;
1773 else 912 else
1774 result = 1; 913 result = 1;
1775 return result; 914 return result;
1870 case 4: 1009 case 4:
1871 v6 = pActor->pMonsterInfo.uResPhysical; 1010 v6 = pActor->pMonsterInfo.uResPhysical;
1872 break; 1011 break;
1873 case 0: 1012 case 0:
1874 v6 = pActor->pMonsterInfo.uResFire; 1013 v6 = pActor->pMonsterInfo.uResFire;
1875 goto LABEL_12; 1014 v4 = v5;
1015 break;
1876 case 1: 1016 case 1:
1877 v6 = pActor->pMonsterInfo.uResAir; 1017 v6 = pActor->pMonsterInfo.uResAir;
1878 goto LABEL_12; 1018 v4 = v5;
1019 break;
1879 case 2: 1020 case 2:
1880 v6 = pActor->pMonsterInfo.uResWater; 1021 v6 = pActor->pMonsterInfo.uResWater;
1881 goto LABEL_12; 1022 v4 = v5;
1023 break;
1882 case 3: 1024 case 3:
1883 v6 = pActor->pMonsterInfo.uResEarth; 1025 v6 = pActor->pMonsterInfo.uResEarth;
1884 goto LABEL_12; 1026 v4 = v5;
1027 break;
1885 case 6: 1028 case 6:
1886 v6 = pActor->pMonsterInfo.uResSpirit; 1029 v6 = pActor->pMonsterInfo.uResSpirit;
1887 break; 1030 break;
1888 case 7: 1031 case 7:
1889 v6 = pActor->pMonsterInfo.uResMind; 1032 v6 = pActor->pMonsterInfo.uResMind;
1890 goto LABEL_12; 1033 v4 = v5;
1034 break;
1891 case 8: 1035 case 8:
1892 v6 = pActor->pMonsterInfo.uResBody; 1036 v6 = pActor->pMonsterInfo.uResBody;
1893 LABEL_12:
1894 v4 = v5; 1037 v4 = v5;
1895 break; 1038 break;
1896 case 9: 1039 case 9:
1897 v6 = pActor->pMonsterInfo.uResLight; 1040 v6 = pActor->pMonsterInfo.uResLight;
1898 break; 1041 break;
1939 switch ( uType ) 1082 switch ( uType )
1940 { 1083 {
1941 case 0u: 1084 case 0u:
1942 v3 = pActor; 1085 v3 = pActor;
1943 v4 = pActor->pMonsterInfo.uResFire; 1086 v4 = pActor->pMonsterInfo.uResFire;
1944 goto LABEL_12;
1945 case 1u: 1087 case 1u:
1946 v3 = pActor; 1088 v3 = pActor;
1947 v4 = pActor->pMonsterInfo.uResAir; 1089 v4 = pActor->pMonsterInfo.uResAir;
1948 goto LABEL_12;
1949 case 2u: 1090 case 2u:
1950 v3 = pActor; 1091 v3 = pActor;
1951 v4 = pActor->pMonsterInfo.uResWater; 1092 v4 = pActor->pMonsterInfo.uResWater;
1952 goto LABEL_12;
1953 case 3u: 1093 case 3u:
1954 v3 = pActor; 1094 v3 = pActor;
1955 v4 = pActor->pMonsterInfo.uResEarth; 1095 v4 = pActor->pMonsterInfo.uResEarth;
1956 goto LABEL_12;
1957 case 7u: 1096 case 7u:
1958 v3 = pActor; 1097 v3 = pActor;
1959 v4 = pActor->pMonsterInfo.uResMind; 1098 v4 = pActor->pMonsterInfo.uResMind;
1960 goto LABEL_12;
1961 case 6u: 1099 case 6u:
1962 v3 = pActor; 1100 v3 = pActor;
1963 v4 = pActor->pMonsterInfo.uResSpirit; 1101 v4 = pActor->pMonsterInfo.uResSpirit;
1964 goto LABEL_12;
1965 case 8u: 1102 case 8u:
1966 v3 = pActor; 1103 v3 = pActor;
1967 v4 = pActor->pMonsterInfo.uResBody; 1104 v4 = pActor->pMonsterInfo.uResBody;
1968 goto LABEL_12;
1969 case 9u: 1105 case 9u:
1970 v3 = pActor; 1106 v3 = pActor;
1971 v4 = pActor->pMonsterInfo.uResLight; 1107 v4 = pActor->pMonsterInfo.uResLight;
1972 goto LABEL_12;
1973 case 0xAu: 1108 case 0xAu:
1974 v3 = pActor; 1109 v3 = pActor;
1975 v4 = pActor->pMonsterInfo.uResDark; 1110 v4 = pActor->pMonsterInfo.uResDark;
1976 goto LABEL_12;
1977 case 4u: 1111 case 4u:
1978 v3 = pActor; 1112 v3 = pActor;
1979 v4 = pActor->pMonsterInfo.uResPhysical; 1113 v4 = pActor->pMonsterInfo.uResPhysical;
1980 LABEL_12:
1981 if ( v4 < 200 )
1982 result = rand() % (signed int)(((unsigned int)v3->pMonsterInfo.uLevel >> 2) + v4 + 30) < 30;
1983 else
1984 result = 0;
1985 break; 1114 break;
1986 default: 1115 default:
1987 result = 1; 1116 return 1;
1988 break; 1117 }
1989 } 1118 if ( v4 < 200 )
1119 result = rand() % (signed int)(((unsigned int)v3->pMonsterInfo.uLevel >> 2) + v4 + 30) < 30;
1120 else
1121 result = 0;
1990 return result; 1122 return result;
1991 } 1123 }
1992 1124
1993 //----- (0042EB8D) -------------------------------------------------------- 1125 //----- (0042EB8D) --------------------------------------------------------
1994 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line) 1126 void GUIMessageQueue::AddMessageImpl(UIMessageType msg, int param, unsigned int a4, const char *file, int line)
2071 if (pParty->Invisible()) 1203 if (pParty->Invisible())
2072 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); 1204 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
2073 1205
2074 //v31 = player->pEquipment.uBow; 1206 //v31 = player->pEquipment.uBow;
2075 int bow_idx = player->pEquipment.uBow; 1207 int bow_idx = player->pEquipment.uBow;
2076 if (bow_idx && player->pInventoryItems[bow_idx - 1].Broken()) 1208 if (bow_idx && player->pInventoryItemList[bow_idx - 1].Broken())
2077 bow_idx = 0; 1209 bow_idx = 0;
2078 1210
2079 //v32 = 0; 1211 //v32 = 0;
2080 int wand_item_id = 0; 1212 int wand_item_id = 0;
2081 //v33 = 0; 1213 //v33 = 0;
2083 int laser_weapon_item_id = 0; 1215 int laser_weapon_item_id = 0;
2084 1216
2085 int main_hand_idx = player->pEquipment.uMainHand; 1217 int main_hand_idx = player->pEquipment.uMainHand;
2086 if (main_hand_idx) 1218 if (main_hand_idx)
2087 { 1219 {
2088 auto item = &player->pInventoryItems[main_hand_idx - 1]; 1220 auto item = &player->pInventoryItemList[main_hand_idx - 1];
2089 //v5 = (char *)v1 + 36 * v4; 1221 //v5 = (char *)v1 + 36 * v4;
2090 if (!item->Broken()) 1222 if (!item->Broken())
2091 { 1223 {
2092 //v28b = &v1->pInventoryItems[v4].uItemID; 1224 //v28b = &v1->pInventoryItems[v4].uItemID;
2093 //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124); 1225 //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124);
2142 else if (wand_item_id) 1274 else if (wand_item_id)
2143 { 1275 {
2144 shooting_wand = true; 1276 shooting_wand = true;
2145 1277
2146 int main_hand_idx = player->pEquipment.uMainHand; 1278 int main_hand_idx = player->pEquipment.uMainHand;
2147 _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItems[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); 1279 _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItemList[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8);
2148 1280
2149 if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges) 1281 if (!--player->pInventoryItemList[main_hand_idx - 1].uNumCharges)
2150 player->pEquipment.uMainHand = 0; 1282 player->pEquipment.uMainHand = 0;
2151 } 1283 }
2152 else if (target_type == OBJECT_Actor && actor_distance <= 407.2) 1284 else if (target_type == OBJECT_Actor && actor_distance <= 407.2)
2153 { 1285 {
2154 melee_attack = true; 1286 melee_attack = true;
2199 v34 = 7; 1331 v34 = 7;
2200 else 1332 else
2201 { 1333 {
2202 int main_hand_idx = player->pEquipment.uMainHand; 1334 int main_hand_idx = player->pEquipment.uMainHand;
2203 if (player->HasItemEquipped(EQUIP_MAIN_HAND)) 1335 if (player->HasItemEquipped(EQUIP_MAIN_HAND))
2204 v34 = pItemsTable->pItems[*(int *)&player->pInventoryItems[main_hand_idx - 1]].uSkillType; 1336 v34 = pItemsTable->pItems[*(int *)&player->pInventoryItemList[main_hand_idx - 1]].uSkillType;
2205 pTurnEngine->ApplyPlayerAction(); 1337 pTurnEngine->ApplyPlayerAction();
2206 } 1338 }
2207 1339
2208 switch (v34) 1340 switch (v34)
2209 { 1341 {
2438 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) 1570 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
2439 v0 = 2560; 1571 v0 = 2560;
2440 v13 = 0; 1572 v13 = 0;
2441 if ( (signed int)uNumActors <= 0 ) 1573 if ( (signed int)uNumActors <= 0 )
2442 { 1574 {
2443 LABEL_20:
2444 result = 0; 1575 result = 0;
2445 } 1576 }
2446 else 1577 else
2447 { 1578 {
2448 v1 = pActors.data(); 1579 v1 = pActors.data();
2486 } 1617 }
2487 } 1618 }
2488 ++v13; 1619 ++v13;
2489 ++v1; 1620 ++v1;
2490 if ( v13 >= (signed int)uNumActors ) 1621 if ( v13 >= (signed int)uNumActors )
2491 goto LABEL_20; 1622 return 0;
2492 } 1623 }
2493 result = 1; 1624 result = 1;
2494 } 1625 }
2495 return result; 1626 return result;
2496 } 1627 }
2497 1628
2498 //----- (0042F7EB) -------------------------------------------------------- 1629 //----- (0042F7EB) --------------------------------------------------------
2499 bool __fastcall sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9) 1630 bool __fastcall sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9)
2500 { 1631 {
2501 unsigned int v9; // edi@1 1632 unsigned __int16 pObjectDescID; // ax@7
2502 signed int v10; // edx@3 1633 SpriteObject pSpellObject; // [sp+Ch] [bp-78h]@1
2503 char *v11; // ecx@4 1634
2504 unsigned __int16 v12; // ax@7 1635 pSpellObject.stru_24.Reset();
2505 unsigned int v13; // edx@9
2506 char *v14; // ecx@10
2507 int v15; // esi@17
2508 int v16; // eax@18
2509 int v17; // edi@20
2510 int v18; // esi@20
2511 //SpriteObject a1a; // [sp+Ch] [bp-78h]@1
2512 int v21; // [sp+7Ch] [bp-8h]@1
2513 unsigned int v22; // [sp+80h] [bp-4h]@1
2514
2515 v9 = uSpriteID;
2516 v21 = x;
2517 v22 = uSpriteID;
2518
2519 SpriteObject a1a; // [sp+Ch] [bp-78h]@1
2520 //SpriteObject::SpriteObject(&a1a);
2521 a1a.stru_24.Reset();
2522
2523 if ( a9 ) 1636 if ( a9 )
2524 { 1637 memcpy(&pSpellObject.stru_24, a9, sizeof(pSpellObject.stru_24));
2525 memcpy(&a1a.stru_24, a9, sizeof(a1a.stru_24)); 1638 pSpellObject.spell_skill = 0;
2526 v9 = v22; 1639 pSpellObject.spell_level = 0;
2527 } 1640 pSpellObject.spell_id = 0;
2528 v10 = 0; 1641 pSpellObject.field_54 = 0;
2529 a1a.spell_skill = 0; 1642 pSpellObject.uType = uSpriteID;
2530 a1a.spell_level = 0;
2531 a1a.spell_id = 0;
2532 a1a.field_54 = 0;
2533 a1a.uType = v9;
2534 if ( (signed int)pObjectList->uNumObjects <= 0 ) 1643 if ( (signed int)pObjectList->uNumObjects <= 0 )
2535 { 1644 pObjectDescID = 0;
2536 LABEL_7:
2537 v12 = 0;
2538 }
2539 else 1645 else
2540 { 1646 {
2541 v11 = (char *)&pObjectList->pObjects->uObjectID; 1647 pObjectDescID = 0;
2542 while ( (short)v9 != *(short *)v11 ) 1648 for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i )
2543 { 1649 {
2544 ++v10; 1650 if ( (short)uSpriteID == pObjectList->pObjects[i].uObjectID )
2545 v11 += 56; 1651 pObjectDescID = i;
2546 if ( v10 >= (signed int)pObjectList->uNumObjects ) 1652 }
2547 goto LABEL_7; 1653 }
2548 } 1654 pSpellObject.uObjectDescID = pObjectDescID;
2549 v12 = v10; 1655 pSpellObject.vPosition.x = x;
2550 } 1656 pSpellObject.vPosition.y = y;
2551 a1a.uObjectDescID = v12; 1657 pSpellObject.vPosition.z = z;
2552 a1a.vPosition.z = z; 1658 pSpellObject.uSoundID = 0;
2553 a1a.vPosition.x = v21; 1659 pSpellObject.uAttributes = attributes;
2554 a1a.vPosition.y = y; 1660 pSpellObject.uSectorID = pIndoor->GetSector(x, y, z);
2555 a1a.uSoundID = 0; 1661 pSpellObject.uSpriteFrameID = 0;
2556 a1a.uAttributes = attributes; 1662 pSpellObject.spell_caster_pid = 0;
2557 a1a.uSectorID = pIndoor->GetSector(v21, y, z); 1663 pSpellObject.spell_target_pid = 0;
2558 a1a.uSpriteFrameID = 0; 1664 if ( !(pSpellObject.uAttributes & 0x10) )
2559 a1a.spell_caster_pid = 0; 1665 {
2560 a1a.spell_target_pid = 0; 1666 if ( pItemsTable->uAllItemsCount )
2561 if ( !(a1a.uAttributes & 0x10) ) 1667 {
2562 { 1668 for ( uint i = 0; i < pItemsTable->uAllItemsCount; ++i )
2563 v13 = 0; 1669 {
2564 if ( (signed int)pItemsTable->uAllItemsCount > 0 ) 1670 if ( pItemsTable->pItems[i].uSpriteID == uSpriteID )
2565 { 1671 pSpellObject.stru_24.uItemID = i;
2566 v14 = (char *)&pItemsTable->pItems[0].uSpriteID; 1672 }
2567 while ( *(short *)v14 != v9 ) 1673 }
2568 { 1674 }
2569 ++v13;
2570 v14 += 48;
2571 if ( (signed int)v13 >= (signed int)pItemsTable->uAllItemsCount )
2572 goto LABEL_16;
2573 }
2574 a1a.stru_24.uItemID = v13;
2575 }
2576 }
2577 LABEL_16:
2578 if ( a7 ) 1675 if ( a7 )
2579 { 1676 {
2580 v15 = count;
2581 if ( count > 0 ) 1677 if ( count > 0 )
2582 { 1678 {
2583 do 1679 for ( uint i = count; i; --i )
2584 { 1680 {
2585 a1a.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; 1681 pSpellObject.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi;
2586 v16 = rand(); 1682 pSpellObject.Create((signed __int16)pSpellObject.uFacing,
2587 a1a.Create( 1683 ((signed int)stru_5C6E00->uIntegerHalfPi / 2) + (rand() % ((signed int)stru_5C6E00->uIntegerHalfPi / 2)), a4, 0);
2588 (signed __int16)a1a.uFacing, 1684
2589 ((signed int)stru_5C6E00->uIntegerHalfPi >> 1) + (v16 % (signed int)stru_5C6E00->uIntegerHalfPi >> 1), 1685 }
2590 a4,
2591 0);
2592 --v15;
2593 }
2594 while ( v15 );
2595 } 1686 }
2596 } 1687 }
2597 else 1688 else
2598 { 1689 {
2599 v17 = count; 1690 pSpellObject.uFacing = 0;
2600 v18 = stru_5C6E00->uIntegerHalfPi;
2601 a1a.uFacing = 0;
2602 if ( count > 0 ) 1691 if ( count > 0 )
2603 { 1692 {
2604 do 1693 for ( uint i = count; i; --i )
2605 { 1694 {
2606 a1a.Create((signed __int16)a1a.uFacing, v18, a4, 0); 1695 pSpellObject.Create((signed __int16)pSpellObject.uFacing, stru_5C6E00->uIntegerHalfPi, a4, 0);
2607 --v17; 1696 }
2608 } 1697 }
2609 while ( v17 ); 1698 }
2610 } 1699 return true;
2611 }
2612 return 1;
2613 } 1700 }
2614 1701
2615 //----- (0042F960) -------------------------------------------------------- 1702 //----- (0042F960) --------------------------------------------------------
2616 void __fastcall sub_42F960_create_object(int x, int y, int z) 1703 void __fastcall sub_42F960_create_object(int x, int y, int z)
2617 { 1704 {