comparison Indoor.cpp @ 50:fde5c5acb66e

BLV render
author Nomad
date Tue, 23 Oct 2012 23:38:05 +0200
parents bcc051713d20
children fd2fd234a66c
comparison
equal deleted inserted replaced
47:8a8dd0164b12 50:fde5c5acb66e
112 } 112 }
113 PrepareWallsRenderList_BLV(); 113 PrepareWallsRenderList_BLV();
114 PrepareItemsRenderList_BLV(); 114 PrepareItemsRenderList_BLV();
115 PrepareActorRenderList_BLV(); 115 PrepareActorRenderList_BLV();
116 v6 = 0; 116 v6 = 0;
117 for ( i = 0; i < pStru170->field_53730; ++i ) 117 for ( i = 0; i < pStru170->uNumVisibleNotEmptySectors; ++i )
118 { 118 {
119 v7 = pStru170->pSectorIDs_toDrawDecorationsFrom[v6]; 119 v7 = pStru170->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v6];
120 v12 = 0; 120 v12 = 0;
121 v8 = &pIndoor->pSectors[pStru170->pSectorIDs_toDrawDecorationsFrom[v6]]; 121 v8 = &pIndoor->pSectors[pStru170->pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v6]];
122 v9 = v8->pDecorationIDs; 122 v9 = v8->pDecorationIDs;
123 if ( v8->uNumDecorations > 0 ) 123 if ( v8->uNumDecorations > 0 )
124 { 124 {
125 do 125 do
126 PrepareDecorationsRenderList_BLV(v9[v12++], v7); 126 PrepareDecorationsRenderList_BLV(v9[v12++], v7);
259 pBLVRenderParams->field_94 = 6; 259 pBLVRenderParams->field_94 = 6;
260 return result; 260 return result;
261 } 261 }
262 262
263 //----- (00440B44) -------------------------------------------------------- 263 //----- (00440B44) --------------------------------------------------------
264 void IndoorLocation::ExecDraw(char a1) 264 void IndoorLocation::ExecDraw(bool bD3D)
265 { 265 {
266 signed int i; // esi@2
267 int v2; // eax@3 266 int v2; // eax@3
268 IndoorCameraD3D_Vec4 *v3; // edx@4 267 IndoorCameraD3D_Vec4 *v3; // edx@4
269 signed int j; // esi@8
270 unsigned int v5; // ecx@9 268 unsigned int v5; // ecx@9
271 RenderVertexSoft *v6; // [sp-4h] [bp-8h]@4 269 RenderVertexSoft *v6; // [sp-4h] [bp-8h]@4
272 270
273 if ( a1 ) 271 if (bD3D)
274 { 272 {
275 pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.z, pParty->vPosition.y); 273 pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.z, pParty->vPosition.y);
276 for ( i = 0; i < (signed int)pStru170->uNumFaceIDs; ++i ) 274 for (uint i = 0; i < pStru170->uNumFaceIDs; ++i)
277 { 275 {
278 v2 = pStru170->pFaceIDs[2 * i + 1]; 276 v2 = pStru170->pFaceIDs[2 * i + 1];
279 if ( pStru170->field_FA8[v2].std__vector_0007A8 == -1 ) 277 if ( pStru170->field_FA8[v2].std__vector_0007A8 == -1 )
280 { 278 {
281 v6 = 0; 279 v6 = 0;
284 else 282 else
285 { 283 {
286 v3 = pStru170->field_FA8[v2].std__vector_0007AC; 284 v3 = pStru170->field_FA8[v2].std__vector_0007AC;
287 v6 = pStru170->field_FA8[v2].pVertices; 285 v6 = pStru170->field_FA8[v2].pVertices;
288 } 286 }
289 IndoorLocation::ExecDraw_sub0(pStru170->pFaceIDs[2 * i], v3, 4u, v6); 287 IndoorLocation::ExecDraw_d3d(pStru170->pFaceIDs[2 * i], v3, 4u, v6);
290 } 288 }
291 } 289 }
292 else 290 else
293 { 291 {
294 for ( j = 0; j < (signed int)pStru170->uNumFaceIDs; ++j ) 292 for (uint j = 0; j < pStru170->uNumFaceIDs; ++j )
295 { 293 {
296 v5 = pStru170->pFaceIDs[2 * j]; 294 v5 = pStru170->pFaceIDs[2 * j];
297 pBLVRenderParams->field_7C = &pStru170->field_FA8[pStru170->pFaceIDs[2 * j + 1]].field_C; 295 pBLVRenderParams->field_7C = &pStru170->field_FA8[pStru170->pFaceIDs[2 * j + 1]].field_C;
298 IndoorLocation::ExecDraw_sub1(v5); 296 IndoorLocation::ExecDraw_sw(v5);
299 } 297 }
300 } 298 }
301 } 299 }
302 300
303 //----- (00440BED) -------------------------------------------------------- 301 //----- (00440BED) --------------------------------------------------------
430 this->uBitmapID = a2->uTextureID; 428 this->uBitmapID = a2->uTextureID;
431 this->pVertexIDs = a2->pVertexIDs; 429 this->pVertexIDs = a2->pVertexIDs;
432 } 430 }
433 431
434 //----- (004B0A25) -------------------------------------------------------- 432 //----- (004B0A25) --------------------------------------------------------
435 void IndoorLocation::ExecDraw_sub0(unsigned int uFaceID, IndoorCameraD3D_Vec4 *pVertices, unsigned int uNumVertices, RenderVertexSoft *a4) 433 void IndoorLocation::ExecDraw_d3d(unsigned int uFaceID, IndoorCameraD3D_Vec4 *pVertices, unsigned int uNumVertices, RenderVertexSoft *a4)
436 { 434 {
437 unsigned int v4; // esi@1 435 //unsigned int v4; // esi@1
438 char *v5; // eax@4 436 char *v5; // eax@4
439 signed int v6; // ecx@4 437 signed int v6; // ecx@4
440 char *v7; // eax@8 438 char *v7; // eax@8
441 signed int v8; // ecx@8 439 signed int v8; // ecx@8
442 BLVFace *v9; // esi@13 440 //BLVFace *v9; // esi@13
443 IndoorCameraD3D *v10; // edi@16 441 //IndoorCameraD3D *v10; // edi@16
444 int v11; // ebx@17 442 //int v11; // ebx@17
445 Vec3_short_ *v12; // ecx@18 443 //Vec3_short_ *v12; // ecx@18
446 char *v13; // edx@18 444 //char *v13; // edx@18
447 int v14; // eax@19 445 //int v14; // eax@19
448 unsigned __int8 v15; // sf@19 446 //unsigned __int8 v15; // sf@19
449 unsigned __int8 v16; // of@19 447 //unsigned __int8 v16; // of@19
450 int v17; // ebx@25 448 int v17; // ebx@25
451 double v18; // st7@27 449 double v18; // st7@27
452 double v19; // st6@27 450 double v19; // st6@27
453 double v20; // st5@27 451 double v20; // st5@27
454 char v21; // dl@27 452 char v21; // dl@27
458 int v25; // eax@38 456 int v25; // eax@38
459 char *v26; // edi@38 457 char *v26; // edi@38
460 IDirect3DTexture2 *v27; // eax@42 458 IDirect3DTexture2 *v27; // eax@42
461 Texture *v28; // [sp+Ch] [bp-1Ch]@15 459 Texture *v28; // [sp+Ch] [bp-1Ch]@15
462 int i; // [sp+10h] [bp-18h]@38 460 int i; // [sp+10h] [bp-18h]@38
463 LightmapBuilder *pStru4; // [sp+14h] [bp-14h]@16 461 //LightmapBuilder *pStru4; // [sp+14h] [bp-14h]@16
464 IndoorCameraD3D *v31; // [sp+18h] [bp-10h]@16 462 //IndoorCameraD3D *v31; // [sp+18h] [bp-10h]@16
465 IndoorCameraD3D_Vec4 *a7; // [sp+1Ch] [bp-Ch]@1 463 //IndoorCameraD3D_Vec4 *a7; // [sp+1Ch] [bp-Ch]@1
466 unsigned int uFaceID_; // [sp+20h] [bp-8h]@1 464 //unsigned int uFaceID_; // [sp+20h] [bp-8h]@1
467 unsigned int uNumVerticesa; // [sp+24h] [bp-4h]@17 465 unsigned int uNumVerticesa; // [sp+24h] [bp-4h]@17
468 int a4a; // [sp+34h] [bp+Ch]@25 466 int a4a; // [sp+34h] [bp+Ch]@25
469 unsigned int a4b; // [sp+34h] [bp+Ch]@38 467 unsigned int a4b; // [sp+34h] [bp+Ch]@38
470 468
471 v4 = uFaceID; 469 //v4 = uFaceID;
472 a7 = pVertices; 470 //a7 = pVertices;
473 uFaceID_ = uFaceID; 471 //uFaceID_ = uFaceID;
474 if ( (uFaceID & 0x80000000u) == 0 && (signed int)uFaceID < (signed int)pIndoor->uNumFaces ) 472 if (uFaceID >= pIndoor->uNumFaces)
475 { 473 return;
476 474
477 static RenderVertexSoft static_vertices_F7C228[64]; 475 static RenderVertexSoft static_vertices_F7C228[64];
478 static bool __init_flag1 = false; 476 static RenderVertexSoft static_vertices_F7B628[64];
479 if (!__init_flag1) 477 static stru154 stru_F7B60C; // idb
480 { 478
481 __init_flag1 = true; 479 //v9 = &pIndoor->pFaces[uFaceID];
482 480 auto pFace = &pIndoor->pFaces[uFaceID];
483 for (uint i = 0; i < 64; ++i) 481 if (pFace->uNumVertices < 3)
484 static_vertices_F7C228[i].flt_2C = 0.0f; 482 return;
485 } 483
486 484
487 static RenderVertexSoft static_vertices_F7B628[64]; 485 if ( !(pFace->uAttributes & 0x2000) )
488 static bool __init_flag2 = false;
489 if (!__init_flag2)
490 {
491 __init_flag2 = true;
492
493 for (uint i = 0; i < 64; ++i)
494 static_vertices_F7B628[i].flt_2C = 0.0f;
495 }
496
497 static stru154 stru_F7B60C; // idb
498 /*static bool __init_flag3 = false;
499 if (!__init_flag3)
500 {
501 __init_flag3 = true;
502
503 stru154::stru154(&stru_F7B60C);
504 }*/
505
506 v9 = &pIndoor->pFaces[v4];
507 if ( v9->uNumVertices >= 3u )
508 {
509 if ( !(BYTE1(v9->uAttributes) & 0x20) )
510 { 486 {
511 ++pBLVRenderParams->field_80; 487 ++pBLVRenderParams->field_80;
512 LOBYTE(v9->uAttributes) |= 0x80u; 488 LOBYTE(pFace->uAttributes) |= 0x80u;
513 v28 = v9->GetTexture(); 489 v28 = pFace->GetTexture();
514 if ( v28 ) 490 if ( v28 )
515 { 491 {
516 v10 = pGame->pIndoorCameraD3D; 492 //v10 = pGame->pIndoorCameraD3D;
517 v31 = pGame->pIndoorCameraD3D; 493 //v31 = pGame->pIndoorCameraD3D;
518 pStru4 = pGame->pLightmapBuilder; 494 //pStru4 = pGame->pLightmapBuilder;
519 if ( !pGame->pIndoorCameraD3D->IsFaceFacedTowardsCamera(v9) ) 495 if ( !pGame->pIndoorCameraD3D->IsFaceFacedTowardsCamera(pFace) )
520 { 496 {
521 v11 = 0; 497 //v11 = 0;
522 uNumVerticesa = v9->uNumVertices; 498 //uNumVerticesa = pFace->uNumVertices;
523 if ( (signed int)uNumVerticesa > 0 ) 499 //v12 = pIndoor->pVertices;
500 //v13 = (char *)&static_vertices_F7C228[0].vWorldPosition.z;
501 for (uint i = 0; i < pFace->uNumVertices; ++i)
524 { 502 {
525 v12 = pIndoor->pVertices; 503 static_vertices_F7C228[i].vWorldPosition.x = pIndoor->pVertices[pFace->pVertexIDs[i]].x;
526 v13 = (char *)&static_vertices_F7C228[0].vWorldPosition.z; 504 static_vertices_F7C228[i].vWorldPosition.y = pIndoor->pVertices[pFace->pVertexIDs[i]].y;
527 do 505 static_vertices_F7C228[i].vWorldPosition.z = pIndoor->pVertices[pFace->pVertexIDs[i]].z;
528 { 506 static_vertices_F7C228[i].u = pFace->pVertexUIDs[i];
529 v14 = v11++; 507 static_vertices_F7C228[i].v = pFace->pVertexUIDs[i];
530 *((float *)v13 - 2) = (double)v12[v9->pVertexIDs[v14]].x; 508 //v14 = v11++;
531 *((float *)v13 - 1) = (double)v12[v9->pVertexIDs[v14]].y; 509 //*((float *)v13 - 2) = (double)v12[v9->pVertexIDs[v14]].x;
532 *(float *)v13 = (double)v12[v9->pVertexIDs[v14]].z; 510 //*((float *)v13 - 1) = (double)v12[v9->pVertexIDs[v14]].y;
533 v13 += 48; 511 //*(float *)v13 = (double)v12[v9->pVertexIDs[v14]].z;
534 v16 = __OFSUB__(v11, uNumVerticesa); 512 //v13 += 48;
535 v15 = ((v11 - uNumVerticesa) & 0x80000000u) != 0; 513 //v16 = __OFSUB__(v11, uNumVerticesa);
536 *((float *)v13 - 5) = (double)v9->pVertexUIDs[v14]; 514 //v15 = ((v11 - uNumVerticesa) & 0x80000000u) != 0;
537 *((float *)v13 - 4) = (double)v9->pVertexVIDs[v14]; 515 //*((float *)v13 - 5) = (double)v9->pVertexUIDs[v14];
538 } 516 //*((float *)v13 - 4) = (double)v9->pVertexVIDs[v14];
539 while ( v15 ^ v16 ); 517 //while ( v15 ^ v16 );
540 v10 = v31; 518 //v10 = v31;
541 } 519 }
542 if ( !a7 520 if ( !pVertices
543 || (pGame->pStru9Instance->_498377(a4, 4u, a7, static_vertices_F7C228, &uNumVerticesa), uNumVerticesa) ) 521 || (pGame->pStru9Instance->_498377(a4, 4u, pVertices, static_vertices_F7C228, &uNumVerticesa), uNumVerticesa) )
544 { 522 {
545 if ( v10->_437285_prolly_colide_vertices_against_frustrum( 523 if ( pGame->pIndoorCameraD3D->_437285_prolly_colide_vertices_against_frustrum(
546 static_vertices_F7C228, 524 static_vertices_F7C228,
547 &uNumVerticesa, 525 &uNumVerticesa,
548 static_vertices_F7B628, 526 static_vertices_F7B628,
549 v10->std__vector_000034_prolly_frustrum, 527 pGame->pIndoorCameraD3D->std__vector_000034_prolly_frustrum,
550 4, 528 4,
551 0, 529 0,
552 0) != 1 530 0) != 1
553 || uNumVerticesa ) 531 || uNumVerticesa )
554 { 532 {
555 a4a = SHIWORD(stru_F8AD28.field_2C); 533 a4a = SHIWORD(stru_F8AD28.field_2C);
556 v17 = (248 - 8 * SHIWORD(stru_F8AD28.field_2C)) | (((248 - 8 * SHIWORD(stru_F8AD28.field_2C)) | ((248 - 8 * SHIWORD(stru_F8AD28.field_2C)) << 8)) << 8); 534 v17 = (248 - 8 * SHIWORD(stru_F8AD28.field_2C)) | (((248 - 8 * SHIWORD(stru_F8AD28.field_2C)) | ((248 - 8 * SHIWORD(stru_F8AD28.field_2C)) << 8)) << 8);
557 sub_4B0E07(uFaceID_); 535 sub_4B0E07(uFaceID);
558 pStru4->ApplyLights_IndoorFace(uFaceID_); 536 pGame->pLightmapBuilder->ApplyLights_IndoorFace(uFaceID);
559 pDecalBuilder->ApplyBloodsplatDecals_IndoorFace(uFaceID_); 537 pDecalBuilder->ApplyBloodsplatDecals_IndoorFace(uFaceID);
560 v31->_4364C5(static_vertices_F7B628, uNumVerticesa, array_507D30, &stru_F8AD28); 538 pGame->pIndoorCameraD3D->_4364C5(static_vertices_F7B628, uNumVerticesa, array_507D30, &stru_F8AD28);
561 v31->_436BB7_project_and_stuff(array_507D30, uNumVerticesa, 0); 539 pGame->pIndoorCameraD3D->_436BB7_project_and_stuff(array_507D30, uNumVerticesa, 0);
562 pStru4->std__vector_000004_size = 0; 540 pGame->pLightmapBuilder->std__vector_000004_size = 0;
563 if ( stru_F8AD28.field_AC > 0 || pDecalBuilder->uNumDecals > 0 ) 541 if ( stru_F8AD28.field_AC > 0 || pDecalBuilder->uNumDecals > 0 )
564 { 542 {
565 v18 = v9->pFacePlane.dist; 543 v18 = pFace->pFacePlane.dist;
566 v19 = v9->pFacePlane.vNormal.z; 544 v19 = pFace->pFacePlane.vNormal.z;
567 v20 = v9->pFacePlane.vNormal.y; 545 v20 = pFace->pFacePlane.vNormal.y;
568 v21 = v9->uPolygonType; 546 v21 = pFace->uPolygonType;
569 stru_F7B60C.vNormal.x = v9->pFacePlane.vNormal.x; 547 stru_F7B60C.vNormal.x = pFace->pFacePlane.vNormal.x;
570 stru_F7B60C.field_14 = v21; 548 stru_F7B60C.field_14 = v21;
571 stru_F7B60C.vNormal.y = v20; 549 stru_F7B60C.vNormal.y = v20;
572 stru_F7B60C.vNormal.z = v19; 550 stru_F7B60C.vNormal.z = v19;
573 stru_F7B60C.field_10 = v18; 551 stru_F7B60C.field_10 = v18;
574 } 552 }
575 if ( stru_F8AD28.field_AC > 0 && !(BYTE2(v9->uAttributes) & 0x40) ) 553 if ( stru_F8AD28.field_AC > 0 && !(BYTE2(pFace->uAttributes) & 0x40) )
576 pStru4->ApplyLights( 554 pGame->pLightmapBuilder->ApplyLights(
577 &stru_F8AD28, 555 &stru_F8AD28,
578 &stru_F7B60C, 556 &stru_F7B60C,
579 uNumVerticesa, 557 uNumVerticesa,
580 array_507D30, 558 array_507D30,
581 *(float *)&a7, 559 pVertices,
582 0); 560 0);
583 if ( pDecalBuilder->uNumDecals > 0 ) 561 if ( pDecalBuilder->uNumDecals > 0 )
584 pDecalBuilder->ApplyDecals( 562 pDecalBuilder->ApplyDecals(
585 a4a, 563 a4a,
586 1, 564 1,
587 &stru_F7B60C, 565 &stru_F7B60C,
588 uNumVerticesa, 566 uNumVerticesa,
589 array_507D30, 567 array_507D30,
590 (int)a7, 568 pVertices,
591 0, 569 0,
592 v9->uSectorID); 570 pFace->uSectorID);
593 if ( v9->uAttributes & 0x10 && v9->uBitmapID == pRenderer->field_1036AC_bitmapid ) 571 if (pFace->uAttributes & 0x10 &&
572 pFace->uBitmapID == pRenderer->field_1036AC_bitmapid )
594 { 573 {
595 v23 = pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid]; 574 v23 = pRenderer->pHDWaterBitmapIDs[pRenderer->field_1036A8_bitmapid];
596 goto LABEL_42; 575 goto LABEL_42;
597 } 576 }
598 if ( v9->uAttributes & 0x10 ) 577 if ( pFace->uAttributes & 0x10 )
599 { 578 {
600 v24 = GetTickCount() >> 2; 579 v24 = GetTickCount() >> 2;
601 if ( (signed int)uNumVerticesa > 0 ) 580 if ( (signed int)uNumVerticesa > 0 )
602 { 581 {
603 v25 = v24 - stru_5C6E00->uIntegerHalfPi; 582 v25 = v24 - stru_5C6E00->uIntegerHalfPi;
604 v26 = (char *)&array_507D30[0].v; 583 v26 = (char *)&array_507D30[0].v;
605 a4b = uNumVerticesa; 584 a4b = uNumVerticesa;
606 for ( i = v25; ; v25 = i ) 585 for ( i = v25; ; v25 = i )
607 { 586 {
608 *(float *)v26 = (double)(pBitmaps_LOD->pTextures[v9->uBitmapID].uHeightMinus1 & (unsigned int)(stru_5C6E00->SinCos(v25) >> 8)) 587 *(float *)v26 = (double)(pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 & (unsigned int)(stru_5C6E00->SinCos(v25) >> 8))
609 + *(float *)v26; 588 + *(float *)v26;
610 v26 += 48; 589 v26 += 48;
611 --a4b; 590 --a4b;
612 if ( !a4b ) 591 if ( !a4b )
613 break; 592 break;
614 } 593 }
615 } 594 }
616 } 595 }
617 else 596 else
618 { 597 {
619 v22 = v9->uAttributes; 598 v22 = pFace->uAttributes;
620 if ( BYTE1(v22) & 0x40 ) 599 if ( BYTE1(v22) & 0x40 )
621 { 600 {
622 v23 = pTextureFrameTable->GetFrameTexture( 601 v23 = pTextureFrameTable->GetFrameTexture(
623 v9->uBitmapID, 602 pFace->uBitmapID,
624 pBLVRenderParams->field_0_timer_); 603 pBLVRenderParams->field_0_timer_);
625 LABEL_42: 604 LABEL_42:
626 v27 = pBitmaps_LOD->pHardwareTextures[v23]; 605 v27 = pBitmaps_LOD->pHardwareTextures[v23];
627 if ( BYTE2(v9->uAttributes) & 0x40 ) 606 if ( BYTE2(pFace->uAttributes) & 0x40 )
628 sub_479A53(uNumVerticesa, uFaceID_); 607 sub_479A53(uNumVerticesa, uFaceID);
629 else 608 else
630 pRenderer->DrawIndoorPolygon(uNumVerticesa, v9, v27, v28, 8 * uFaceID_ | 6, v17, 0); 609 pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, 8 * uFaceID | 6, v17, 0);
631 return; 610 return;
632 } 611 }
633 } 612 }
634 v23 = v9->uBitmapID; 613 v23 = pFace->uBitmapID;
635 goto LABEL_42; 614 goto LABEL_42;
636 } 615 }
637 } 616 }
638 } 617 }
639 } 618 }
640 } 619 }
641 }
642 }
643 } 620 }
644 // F7CE28: using guessed type char static_init_flag__F7C228_bit1__F7B628_bit2__F7B60C_bit3;
645
646
647 621
648 //----- (004AFF79) -------------------------------------------------------- 622 //----- (004AFF79) --------------------------------------------------------
649 void IndoorLocation::ExecDraw_sub1(unsigned int uFaceID) 623 void IndoorLocation::ExecDraw_sw(unsigned int uFaceID)
650 { 624 {
651 unsigned int v1; // ebx@1 625 unsigned int v1; // ebx@1
652 BLVFace *v2; // esi@3 626 BLVFace *v2; // esi@3
653 unsigned int v3; // eax@3 627 unsigned int v3; // eax@3
654 Texture *v4; // eax@8 628 Texture *v4; // eax@8
1304 } 1278 }
1305 1279
1306 1280
1307 1281
1308 //----- (004B0EA8) -------------------------------------------------------- 1282 //----- (004B0EA8) --------------------------------------------------------
1309 void stru170::_4B0EA8(signed int a2, unsigned int uFaceID) 1283 void stru170::PrepareFaceRenderList_d3d(int a2, unsigned int uFaceID)
1310 { 1284 {
1311 unsigned int v3; // edx@1 1285 //unsigned int v3; // edx@1
1312 stru170 *v4; // ebx@1 1286 //stru170 *v4; // ebx@1
1313 BLVFace *v5; // eax@1 1287 //BLVFace *v5; // eax@1
1314 int v6; // ecx@2 1288 //int v6; // ecx@2
1315 unsigned __int16 v7; // ax@11 1289 unsigned __int16 v7; // ax@11
1316 Vec3_short_ *v8; // esi@15 1290 Vec3_short_ *v8; // esi@15
1317 int v9; // edx@15 1291 int v9; // edx@15
1318 signed int v10; // eax@18 1292 signed int v10; // eax@18
1319 signed int v11; // edi@19 1293 signed int v11; // edi@19
1320 signed int v12; // ecx@19 1294 signed int v12; // ecx@19
1321 signed int v13; // esi@19 1295 signed int v13; // esi@19
1322 signed int v14; // edx@20 1296 signed int v14; // edx@20
1323 int v15; // edx@24 1297 int v15; // edx@24
1324 int v16; // esi@29 1298 //int v16; // esi@29
1325 BLVFace *v17; // edi@34 1299 //BLVFace *v17; // edi@34
1326 unsigned __int16 v18; // ax@34 1300 unsigned __int16 v18; // ax@34
1327 char *v19; // eax@38 1301 char *v19; // eax@38
1328 signed int v20; // ecx@38 1302 signed int v20; // ecx@38
1329 char *v21; // eax@42 1303 char *v21; // eax@42
1330 signed int v22; // ecx@42 1304 signed int v22; // ecx@42
1331 signed int v23; // edx@45 1305 //signed int v23; // edx@45
1332 char *v24; // ecx@46 1306 //char *v24; // ecx@46
1333 int v25; // eax@47 1307 //int v25; // eax@47
1334 Vec3_short_ *v26; // eax@47 1308 //Vec3_short_ *v26; // eax@47
1335 double v27; // st7@47 1309 //double v27; // st7@47
1336 signed int v28; // ST28_4@47 1310 //signed int v28; // ST28_4@47
1337 char v29; // al@48 1311 char v29; // al@48
1338 signed int v30; // eax@51 1312 signed int v30; // eax@51
1339 int v31; // eax@52 1313 int v31; // eax@52
1340 unsigned int v32; // eax@55 1314 //unsigned int v32; // eax@55
1341 __int16 v33; // cx@56 1315 //__int16 v33; // cx@56
1342 signed int v34; // [sp+Ch] [bp-14h]@18 1316 signed int v34; // [sp+Ch] [bp-14h]@18
1343 int a0; // [sp+14h] [bp-Ch]@2 1317 //int a0; // [sp+14h] [bp-Ch]@2
1344 IndoorCameraD3D *a0a; // [sp+14h] [bp-Ch]@36 1318 //IndoorCameraD3D *a0a; // [sp+14h] [bp-Ch]@36
1345 signed int v37; // [sp+18h] [bp-8h]@19 1319 signed int v37; // [sp+18h] [bp-8h]@19
1346 stru10 *v38; // [sp+18h] [bp-8h]@36 1320 //stru10 *v38; // [sp+18h] [bp-8h]@36
1347 BLVFace *v39; // [sp+1Ch] [bp-4h]@1 1321 //BLVFace *v39; // [sp+1Ch] [bp-4h]@1
1348 1322
1349 v3 = uFaceID; 1323 //v3 = uFaceID;
1350 v4 = this; 1324 //v4 = this;
1351 v5 = &pIndoor->pFaces[uFaceID]; 1325 //v5 = &pIndoor->pFaces[uFaceID];
1352 this->field_FA8[this->std__vector_000FA8].std__vector_0007A8 = -1; 1326 field_FA8[std__vector_000FA8].std__vector_0007A8 = -1;
1353 v39 = v5; 1327 //v39 = &pIndoor->pFaces[uFaceID];
1354 if ( v5->uAttributes & 1 ) 1328
1355 { 1329 auto pFace = &pIndoor->pFaces[uFaceID];
1356 v6 = (int)((char *)this + 2252 * a2); 1330
1357 a0 = v6; 1331 if (pFace->uAttributes & 1)
1358 if ( v3 == *(short *)(v6 + 5964) ) // stru170_stru0[a2]::uFaceID 1332 {
1333 auto p = &field_FA8[a2];
1334 //v6 = (int)((char *)this + 2252 * a2);
1335 //a0 = v6;
1336 if (p->uFaceID == uFaceID)
1359 return; 1337 return;
1360 if ( !a2 1338 if (!a2 &&
1361 && pBLVRenderParams->vPartyPos.x >= v5->pBounding.x1 - 16 1339 pBLVRenderParams->vPartyPos.x >= pFace->pBounding.x1 - 16 &&
1362 && pBLVRenderParams->vPartyPos.x <= v5->pBounding.x2 + 16 1340 pBLVRenderParams->vPartyPos.x <= pFace->pBounding.x2 + 16 &&
1363 && pBLVRenderParams->vPartyPos.y >= v5->pBounding.y1 - 16 1341 pBLVRenderParams->vPartyPos.y >= pFace->pBounding.y1 - 16 &&
1364 && pBLVRenderParams->vPartyPos.y <= v5->pBounding.y2 + 16 1342 pBLVRenderParams->vPartyPos.y <= pFace->pBounding.y2 + 16 &&
1365 && pBLVRenderParams->vPartyPos.z >= v5->pBounding.z1 - 16 1343 pBLVRenderParams->vPartyPos.z >= pFace->pBounding.z1 - 16 &&
1366 && pBLVRenderParams->vPartyPos.z <= v5->pBounding.z2 + 16 ) 1344 pBLVRenderParams->vPartyPos.z <= pFace->pBounding.z2 + 16 )
1367 { 1345 {
1368 if ( abs(v5->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * v5->pFacePlane_old.vNormal.x 1346 if ( abs(pFace->pFacePlane_old.dist + pBLVRenderParams->vPartyPos.x * pFace->pFacePlane_old.vNormal.x
1369 + pBLVRenderParams->vPartyPos.y * v5->pFacePlane_old.vNormal.y 1347 + pBLVRenderParams->vPartyPos.y * pFace->pFacePlane_old.vNormal.y
1370 + pBLVRenderParams->vPartyPos.z * v5->pFacePlane_old.vNormal.z) <= 589824 ) 1348 + pBLVRenderParams->vPartyPos.z * pFace->pFacePlane_old.vNormal.z) <= 589824 )
1371 { 1349 {
1372 v7 = v39->uSectorID; 1350 v7 = pFace->uSectorID;
1373 if ( v4->field_FA8[0].uSectorID == v7 ) 1351 if ( field_FA8[0].uSectorID == v7 )
1374 v7 = v39->uBackSectorID; 1352 v7 = pFace->uBackSectorID;
1375 v4->field_FA8[v4->std__vector_000FA8].uSectorID = v7; 1353 field_FA8[std__vector_000FA8].uSectorID = v7;
1376 v4->field_FA8[v4->std__vector_000FA8].uFaceID = uFaceID; 1354 field_FA8[std__vector_000FA8].uFaceID = uFaceID;
1377 v4->field_FA8[v4->std__vector_000FA8].uViewportX = LOWORD(pBLVRenderParams->uViewportX); 1355 field_FA8[std__vector_000FA8].uViewportX = pBLVRenderParams->uViewportX;
1378 v4->field_FA8[v4->std__vector_000FA8].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ); 1356 field_FA8[std__vector_000FA8].uViewportZ = pBLVRenderParams->uViewportZ;
1379 v4->field_FA8[v4->std__vector_000FA8].uViewportY = LOWORD(pBLVRenderParams->uViewportY); 1357 field_FA8[std__vector_000FA8].uViewportY = pBLVRenderParams->uViewportY;
1380 v4->field_FA8[v4->std__vector_000FA8].uViewportW = LOWORD(pBLVRenderParams->uViewportW); 1358 field_FA8[std__vector_000FA8].uViewportW = pBLVRenderParams->uViewportW;
1381 v4->field_FA8[v4->std__vector_000FA8++].field_C._43F9E1( 1359 field_FA8[std__vector_000FA8++].field_C._43F9E1(
1382 SLOWORD(pBLVRenderParams->uViewportX), 1360 pBLVRenderParams->uViewportX,
1383 pBLVRenderParams->uViewportY, 1361 pBLVRenderParams->uViewportY,
1384 SLOWORD(pBLVRenderParams->uViewportZ), 1362 pBLVRenderParams->uViewportZ,
1385 pBLVRenderParams->uViewportW); 1363 pBLVRenderParams->uViewportW);
1386 sub_440639(v4->std__vector_000FA8 - 1); 1364 sub_440639(std__vector_000FA8 - 1);
1387 return; 1365 return;
1388 } 1366 }
1389 v5 = v39; 1367 //v5 = v39;
1390 v6 = a0; 1368 //v6 = a0;
1391 } 1369 }
1392 v8 = &pIndoor->pVertices[*v5->pVertexIDs]; 1370 v8 = &pIndoor->pVertices[pFace->pVertexIDs[0]];
1393 v9 = v5->pFacePlane_old.vNormal.x * ((signed __int16)*(int *)&v8->x - pBLVRenderParams->vPartyPos.x) 1371 v9 = pFace->pFacePlane_old.vNormal.x * (v8->x - pBLVRenderParams->vPartyPos.x)
1394 + v5->pFacePlane_old.vNormal.y * ((signed __int16)(*(int *)&v8->x >> 16) - pBLVRenderParams->vPartyPos.y) 1372 + pFace->pFacePlane_old.vNormal.y * (v8->y - pBLVRenderParams->vPartyPos.y)
1395 + v5->pFacePlane_old.vNormal.z * (v8->z - pBLVRenderParams->vPartyPos.z); 1373 + pFace->pFacePlane_old.vNormal.z * (v8->z - pBLVRenderParams->vPartyPos.z);
1396 if ( *(short *)(v6 + 4008) != v5->uSectorID )// stru170_stru0[a2]::uSectorID 1374 if (p->uSectorID != pFace->uSectorID)
1397 v9 = -v9; 1375 v9 = -v9;
1398 if ( v9 < 0 ) 1376 if ( v9 < 0 )
1399 { 1377 {
1400 v10 = sub_423B5D(uFaceID); 1378 v10 = sub_423B5D(uFaceID);
1401 v34 = v10; 1379 v34 = v10;
1423 v10 = v34; 1401 v10 = v34;
1424 ++v13; 1402 ++v13;
1425 } 1403 }
1426 while ( v13 < v34 ); 1404 while ( v13 < v34 );
1427 } 1405 }
1428 v16 = a0; 1406 //v16 = a0;
1429 if ( v11 >= *(short *)(a0 + 4010) // stru170_stru0[a2]::uViewportX 1407 if (v11 >= p->uViewportX &&
1430 && a2 <= *(short *)(a0 + 4014) // stru170_stru0[a2]::uViewportZ 1408 a2 <= p->uViewportZ &&
1431 && v12 >= *(short *)(a0 + 4012) // stru170_stru0[a2]::uViewportY 1409 v12 >= p->uViewportY &&
1432 && v37 <= *(short *)(a0 + 4016) // stru170_stru0[a2]::uViewportW 1410 v37 <= p->uViewportW &&
1433 && sub_424829(v10, &v4->field_FA8[v4->std__vector_000FA8].field_C, (stru170_stru2 *)(a0 + 4020), uFaceID) ) 1411 sub_424829(v10, &field_FA8[std__vector_000FA8].field_C, &p->field_C, uFaceID))
1434 { 1412 {
1435 v17 = v39; 1413 //v17 = v39;
1436 v18 = v39->uSectorID; 1414 v18 = pFace->uSectorID;
1437 if ( *(short *)(a0 + 4008) == v18 ) 1415 if (p->uSectorID == v18 )
1438 v18 = v39->uBackSectorID; 1416 v18 = pFace->uBackSectorID;
1439 v4->field_FA8[v4->std__vector_000FA8].uSectorID = v18; 1417 field_FA8[std__vector_000FA8].uSectorID = v18;
1440 v4->field_FA8[v4->std__vector_000FA8].uFaceID = uFaceID; 1418 field_FA8[std__vector_000FA8].uFaceID = uFaceID;
1441 v4->field_FA8[v4->std__vector_000FA8].uViewportX = LOWORD(pBLVRenderParams->uViewportX); 1419 field_FA8[std__vector_000FA8].uViewportX = pBLVRenderParams->uViewportX;
1442 v4->field_FA8[v4->std__vector_000FA8].uViewportZ = LOWORD(pBLVRenderParams->uViewportZ); 1420 field_FA8[std__vector_000FA8].uViewportZ = pBLVRenderParams->uViewportZ;
1443 v4->field_FA8[v4->std__vector_000FA8].uViewportY = LOWORD(pBLVRenderParams->uViewportY); 1421 field_FA8[std__vector_000FA8].uViewportY = pBLVRenderParams->uViewportY;
1444 v4->field_FA8[v4->std__vector_000FA8].uViewportW = LOWORD(pBLVRenderParams->uViewportW); 1422 field_FA8[std__vector_000FA8].uViewportW = pBLVRenderParams->uViewportW;
1445 v38 = pGame->pStru10Instance; 1423 //v38 = pGame->pStru10Instance;
1446 a0a = pGame->pIndoorCameraD3D; 1424 //a0a = pGame->pIndoorCameraD3D;
1447 if ( *(int *)(v16 + 5968) == -1 ) // [a2]::std__vector_0007A8 1425 if (p->std__vector_0007A8 == -1 )
1448 { 1426 {
1449 v29 = pGame->pStru10Instance->_49C681( 1427 v29 = pGame->pStru10Instance->_49C681_DrawDebugStuff(
1450 v39, 1428 pFace,
1451 v4->field_FA8[v4->std__vector_000FA8].std__vector_0007AC, 1429 field_FA8[std__vector_000FA8].std__vector_0007AC,
1452 v4->field_FA8[v4->std__vector_000FA8].pVertices); 1430 field_FA8[std__vector_000FA8].pVertices);
1453 } 1431 }
1454 else 1432 else
1455 { 1433 {
1456 1434 static RenderVertexSoft static_subPrepareFaceRenderList_d3d_stru_F7AA08[64];
1457 static RenderVertexSoft static_sub_4B0EA8_stru_F7AA08[64]; 1435 static RenderVertexSoft static_subPrepareFaceRenderList_d3d_stru_F79E08[64];
1458 static bool __init_flag1 = false; 1436
1459 if (!__init_flag1) 1437 //v23 = 0;
1438 a2 = pFace->uNumVertices;
1439 for (uint k = 0; k < pFace->uNumVertices; ++k)
1460 { 1440 {
1461 __init_flag1 = true; 1441 //v24 = (char *)&static_subPrepareFaceRenderList_d3d_stru_F7AA08[0].vWorldPosition.z;
1462 1442 //do
1463 for (uint i = 0; i < 64; ++i) 1443 //{
1464 static_sub_4B0EA8_stru_F7AA08[i].flt_2C = 0.0f; 1444 //v25 = pFace->pVertexIDs[k];
1445 //v26 = &pIndoor->pVertices[pFace->pVertexIDs[k]];
1446 auto pVertex = &pIndoor->pVertices[pFace->pVertexIDs[k]];
1447 //v27 = (double)v26->z;
1448 //v28 = v26->y;
1449 //v17 = v39;
1450 static_subPrepareFaceRenderList_d3d_stru_F7AA08[k].vWorldPosition.x = pVertex->x;
1451 static_subPrepareFaceRenderList_d3d_stru_F7AA08[k].vWorldPosition.y = pVertex->y;
1452 static_subPrepareFaceRenderList_d3d_stru_F7AA08[k].vWorldPosition.z = pVertex->z;
1453 //v24 += 48;
1454 //}
1455 //while ( v23 < a2 );
1465 } 1456 }
1466 1457 pGame->pIndoorCameraD3D->_437285_prolly_colide_vertices_against_frustrum(
1467 static RenderVertexSoft static_sub_4B0EA8_stru_F79E08[64]; 1458 static_subPrepareFaceRenderList_d3d_stru_F7AA08,
1468 static bool __init_flag2 = false;
1469 if (!__init_flag2)
1470 {
1471 __init_flag2 = true;
1472
1473 for (uint i = 0; i < 64; ++i)
1474 static_sub_4B0EA8_stru_F79E08[i].flt_2C = 0.0f;
1475 }
1476
1477 v23 = 0;
1478 a2 = v39->uNumVertices;
1479 if ( a2 > 0 )
1480 {
1481 v24 = (char *)&static_sub_4B0EA8_stru_F7AA08[0].vWorldPosition.z;
1482 do
1483 {
1484 v25 = v17->pVertexIDs[v23++];
1485 v26 = &pIndoor->pVertices[v25];
1486 v27 = (double)v26->z;
1487 v28 = v26->y;
1488 v17 = v39;
1489 *((float *)v24 - 2) = (double)v26->x;
1490 *((float *)v24 - 1) = (double)v28;
1491 *(float *)v24 = v27;
1492 v24 += 48;
1493 }
1494 while ( v23 < a2 );
1495 }
1496 a0a->_437285_prolly_colide_vertices_against_frustrum(
1497 static_sub_4B0EA8_stru_F7AA08,
1498 (unsigned int *)&a2, 1459 (unsigned int *)&a2,
1499 static_sub_4B0EA8_stru_F79E08, 1460 static_subPrepareFaceRenderList_d3d_stru_F79E08,
1500 (IndoorCameraD3D_Vec4 *)(v16 + 5972), 1461 p->std__vector_0007AC,
1501 4, 1462 4,
1502 0, 1463 0,
1503 0); 1464 0);
1504 v29 = v38->_49C5DA( 1465 v29 = pGame->pStru10Instance->_49C5DA(
1505 v17, 1466 pFace,
1506 static_sub_4B0EA8_stru_F79E08, 1467 static_subPrepareFaceRenderList_d3d_stru_F79E08,
1507 &a2, 1468 &a2,
1508 v4->field_FA8[v4->std__vector_000FA8].std__vector_0007AC, 1469 field_FA8[std__vector_000FA8].std__vector_0007AC,
1509 v4->field_FA8[v4->std__vector_000FA8].pVertices); 1470 field_FA8[std__vector_000FA8].pVertices);
1510 } 1471 }
1511 if ( v29 ) 1472 if ( v29 )
1512 { 1473 {
1513 v4->field_FA8[v4->std__vector_000FA8].std__vector_0007A8 = uFaceID; 1474 field_FA8[std__vector_000FA8].std__vector_0007A8 = uFaceID;
1514 v30 = v4->std__vector_000FA8; 1475 v30 = std__vector_000FA8;
1515 if ( v30 < 150 ) 1476 if ( v30 < 150 )
1516 { 1477 {
1517 v31 = v30 + 1; 1478 v31 = v30 + 1;
1518 v4->std__vector_000FA8 = v31; 1479 std__vector_000FA8 = v31;
1519 sub_440639(v31 - 1); 1480 sub_440639(v31 - 1);
1520 } 1481 }
1521 } 1482 }
1522 if ( pBLVRenderParams->uFlags & 1 ) 1483 if ( pBLVRenderParams->uFlags & 1 )
1523 a0a->PrepareAndDrawDebugOutline(v17, 0x1E1EFFu); 1484 pGame->pIndoorCameraD3D->PrepareAndDrawDebugOutline(pFace, 0x1E1EFF);
1524 } 1485 }
1525 } 1486 }
1526 } 1487 }
1527 } 1488 }
1528 else 1489 else
1529 { 1490 {
1530 v32 = this->uNumFaceIDs; 1491 if (uNumFaceIDs < 1000 )
1531 if ( (signed int)this->uNumFaceIDs < 1000 )
1532 { 1492 {
1533 v33 = a2; 1493 pFaceIDs[2 * uNumFaceIDs] = uFaceID;
1534 v4->pFaceIDs[2 * v32] = v3; 1494 pFaceIDs[2 * uNumFaceIDs++ + 1] = a2;
1535 v4->pFaceIDs[2 * v4->uNumFaceIDs++ + 1] = v33;
1536 } 1495 }
1537 } 1496 }
1538 } 1497 }
1539 // F7B608: using guessed type char static_sub_4B0EA8_byte_F7B608_init_flags;
1540 1498
1541 1499
1542 //----- (004AFB86) -------------------------------------------------------- 1500 //----- (004AFB86) --------------------------------------------------------
1543 void stru170::_4AFB86(int a2, unsigned int uFaceID) 1501 void stru170::PrepareFaceRenderList_sw(int a2, unsigned int uFaceID)
1544 { 1502 {
1545 stru170 *v3; // ebx@1 1503 stru170 *v3; // ebx@1
1546 BLVFace *v4; // eax@1 1504 BLVFace *v4; // eax@1
1547 char *v5; // ecx@2 1505 char *v5; // ecx@2
1548 unsigned __int16 v6; // ax@11 1506 unsigned __int16 v6; // ax@11
3216 3174
3217 //----- (0049AC17) -------------------------------------------------------- 3175 //----- (0049AC17) --------------------------------------------------------
3218 int IndoorLocation::GetSector(int sX, int sY, int sZ) 3176 int IndoorLocation::GetSector(int sX, int sY, int sZ)
3219 { 3177 {
3220 int v4; // esi@1 3178 int v4; // esi@1
3221 unsigned __int8 v5; // zf@1 3179 //unsigned __int8 v5; // zf@1
3222 unsigned __int8 v6; // sf@1 3180 //unsigned __int8 v6; // sf@1
3223 unsigned __int8 v7; // of@1 3181 //unsigned __int8 v7; // of@1
3224 BLVSector *v8; // eax@3 3182 BLVSector *v8; // eax@3
3225 int v9; // edi@9 3183 int v9; // edi@9
3226 int v10; // eax@9 3184 int v10; // eax@9
3227 int v11; // edx@9 3185 int v11; // edx@9
3228 int v12; // eax@10 3186 int v12; // eax@10
3272 int v57; // [sp+108h] [bp-Ch]@16 3230 int v57; // [sp+108h] [bp-Ch]@16
3273 Vec3_short_ *v58; // [sp+10Ch] [bp-8h]@20 3231 Vec3_short_ *v58; // [sp+10Ch] [bp-8h]@20
3274 int v59; // [sp+110h] [bp-4h]@16 3232 int v59; // [sp+110h] [bp-4h]@16
3275 3233
3276 v4 = 0; 3234 v4 = 0;
3277 v7 = __OFSUB__(this->uNumSectors, 1); 3235 //v7 = __OFSUB__(this->uNumSectors, 1);
3278 v5 = this->uNumSectors == 1; 3236 //v5 = this->uNumSectors == 1;
3279 v6 = this->uNumSectors - 1 < 0; 3237 //v6 = this->uNumSectors - 1 < 0;
3280 v55 = 0; 3238 v55 = 0;
3281 v43[0] = 0; 3239 v43[0] = 0;
3282 v56 = 1; 3240 v56 = 1;
3283 if ( (unsigned __int8)(v6 ^ v7) | v5 ) 3241 if (uNumSectors < 2)
3284 return 0; 3242 return 0;
3243
3285 v52 = 116; 3244 v52 = 116;
3286 do 3245 do
3287 { 3246 {
3288 v8 = &this->pSectors[v52 / 0x74]; 3247 v8 = &this->pSectors[v52 / 0x74];
3289 if ( v8->pBounding.x1 <= sX ) 3248 if ( v8->pBounding.x1 <= sX )
3326 pVertexIDs = v16->pVertexIDs; 3285 pVertexIDs = v16->pVertexIDs;
3327 v19 = this->pVertices; 3286 v19 = this->pVertices;
3328 v20 = v19[*pVertexIDs].y; 3287 v20 = v19[*pVertexIDs].y;
3329 v54 = 0; 3288 v54 = 0;
3330 v57 = 0; 3289 v57 = 0;
3331 v5 = v16->uNumVertices == 0; 3290 //v5 = v16->uNumVertices == 0;
3332 v59 = v20 >= sY; 3291 v59 = v20 >= sY;
3333 if ( !v5 ) 3292 if (v16->uNumVertices)
3334 { 3293 {
3335 v21 = pVertexIDs + 1; 3294 v21 = pVertexIDs + 1;
3336 do 3295 do
3337 { 3296 {
3338 if ( v54 >= 2 ) 3297 if ( v54 >= 2 )
3393 } 3352 }
3394 } 3353 }
3395 } 3354 }
3396 v11 = v48 + 1; 3355 v11 = v48 + 1;
3397 v12 = v53 + 2; 3356 v12 = v53 + 2;
3398 v7 = __OFSUB__(v48 + 1, v51); 3357 //v7 = __OFSUB__(v48 + 1, v51);
3399 v6 = v48++ + 1 - v51 < 0; 3358 //v6 = v48++ + 1 - v51 < 0;
3400 v53 += 2; 3359 v53 += 2;
3401 } 3360 }
3402 while ( v6 ^ v7 ); 3361 while ( ++v48 < v51 );
3403 v4 = v43[0]; 3362 v4 = v43[0];
3404 } 3363 }
3405 } 3364 }
3406 } 3365 }
3407 } 3366 }