comparison Indoor.cpp @ 1999:079f2abf54e4

DrawIndoorSky() fix
author Ritor1
date Tue, 05 Nov 2013 12:58:19 +0600
parents 7e2dd49832b5
children 30c2b575d25c
comparison
equal deleted inserted replaced
1998:1175adbf8c58 1999:079f2abf54e4
485 unsigned int v23; // eax@35 485 unsigned int v23; // eax@35
486 //DWORD v24; // eax@37 486 //DWORD v24; // eax@37
487 //int v25; // eax@38 487 //int v25; // eax@38
488 //char *v26; // edi@38 488 //char *v26; // edi@38
489 IDirect3DTexture2 *v27; // eax@42 489 IDirect3DTexture2 *v27; // eax@42
490 Texture *v28; // [sp+Ch] [bp-1Ch]@15 490 //Texture *v28; // [sp+Ch] [bp-1Ch]@15
491 //int i; // [sp+10h] [bp-18h]@38 491 //int i; // [sp+10h] [bp-18h]@38
492 //LightmapBuilder *pStru4; // [sp+14h] [bp-14h]@16 492 //LightmapBuilder *pStru4; // [sp+14h] [bp-14h]@16
493 //IndoorCameraD3D *v31; // [sp+18h] [bp-10h]@16 493 //IndoorCameraD3D *v31; // [sp+18h] [bp-10h]@16
494 //IndoorCameraD3D_Vec4 *a7; // [sp+1Ch] [bp-Ch]@1 494 //IndoorCameraD3D_Vec4 *a7; // [sp+1Ch] [bp-Ch]@1
495 //unsigned int uFaceID_; // [sp+20h] [bp-8h]@1 495 //unsigned int uFaceID_; // [sp+20h] [bp-8h]@1
496 unsigned int uNumVerticesa; // [sp+24h] [bp-4h]@17 496 unsigned int uNumVerticesa; // [sp+24h] [bp-4h]@17
497 int a4a; // [sp+34h] [bp+Ch]@25 497 int a4a; // [sp+34h] [bp+Ch]@25
498 //unsigned int a4b; // [sp+34h] [bp+Ch]@38 498 //unsigned int a4b; // [sp+34h] [bp+Ch]@38
499 499
500 //v4 = uFaceID;
501 //a7 = pVertices;
502 //uFaceID_ = uFaceID;
503 if (uFaceID >= pIndoor->uNumFaces) 500 if (uFaceID >= pIndoor->uNumFaces)
504 return; 501 return;
505 502
506 static RenderVertexSoft static_vertices_F7C228[64]; 503 static RenderVertexSoft static_vertices_F7C228[64];
507 static RenderVertexSoft static_vertices_F7B628[64]; 504 static RenderVertexSoft static_vertices_F7B628[64];
508 static stru154 stru_F7B60C; // idb 505 static stru154 stru_F7B60C; // idb
509 506
510 //v9 = &pIndoor->pFaces[uFaceID];
511 BLVFace* pFace = &pIndoor->pFaces[uFaceID]; 507 BLVFace* pFace = &pIndoor->pFaces[uFaceID];
512 if (pFace->uNumVertices < 3) 508 if (pFace->uNumVertices < 3)
513 return; 509 return;
514 510
515 511
519 ++pBLVRenderParams->uNumFacesRenderedThisFrame; 515 ++pBLVRenderParams->uNumFacesRenderedThisFrame;
520 pFace->uAttributes |= 0x80u; 516 pFace->uAttributes |= 0x80u;
521 517
522 if (!pFace->GetTexture()) 518 if (!pFace->GetTexture())
523 return; 519 return;
524
525 v28 = pFace->GetTexture();
526 520
527 if (!pGame->pIndoorCameraD3D->IsCulled(pFace)) 521 if (!pGame->pIndoorCameraD3D->IsCulled(pFace))
528 { 522 {
529 uNumVerticesa = pFace->uNumVertices; 523 uNumVerticesa = pFace->uNumVertices;
530 for (uint i = 0; i < pFace->uNumVertices; ++i) 524 for (uint i = 0; i < pFace->uNumVertices; ++i)
549 pGame->pLightmapBuilder->ApplyLights_IndoorFace(uFaceID); 543 pGame->pLightmapBuilder->ApplyLights_IndoorFace(uFaceID);
550 pDecalBuilder->ApplyBloodsplatDecals_IndoorFace(uFaceID); 544 pDecalBuilder->ApplyBloodsplatDecals_IndoorFace(uFaceID);
551 pGame->pIndoorCameraD3D->ViewTransfrom_OffsetUV(static_vertices_F7B628, uNumVerticesa, array_507D30, &stru_F8AD28); 545 pGame->pIndoorCameraD3D->ViewTransfrom_OffsetUV(static_vertices_F7B628, uNumVerticesa, array_507D30, &stru_F8AD28);
552 pGame->pIndoorCameraD3D->Project(array_507D30, uNumVerticesa, 0); 546 pGame->pIndoorCameraD3D->Project(array_507D30, uNumVerticesa, 0);
553 pGame->pLightmapBuilder->std__vector_000004_size = 0; 547 pGame->pLightmapBuilder->std__vector_000004_size = 0;
554 if (stru_F8AD28.uNumLightsApplied > 0 || 548 if (stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0)
555 pDecalBuilder->uNumDecals > 0)
556 { 549 {
557 stru_F7B60C.face_plane.vNormal.x = pFace->pFacePlane.vNormal.x; 550 stru_F7B60C.face_plane.vNormal.x = pFace->pFacePlane.vNormal.x;
558 stru_F7B60C.polygonType = pFace->uPolygonType; 551 stru_F7B60C.polygonType = pFace->uPolygonType;
559 stru_F7B60C.face_plane.vNormal.y = pFace->pFacePlane.vNormal.y; 552 stru_F7B60C.face_plane.vNormal.y = pFace->pFacePlane.vNormal.y;
560 stru_F7B60C.face_plane.vNormal.z = pFace->pFacePlane.vNormal.z; 553 stru_F7B60C.face_plane.vNormal.z = pFace->pFacePlane.vNormal.z;
568 pDecalBuilder->ApplyDecals(a4a, 1, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0, pFace->uSectorID); 561 pDecalBuilder->ApplyDecals(a4a, 1, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0, pFace->uSectorID);
569 562
570 if (pFace->Fluid()) 563 if (pFace->Fluid())
571 { 564 {
572 if (pFace->uBitmapID == pRenderer->hd_water_tile_id) 565 if (pFace->uBitmapID == pRenderer->hd_water_tile_id)
573 { 566 v27 = pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]];
574 v23 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame];
575 v27 = pBitmaps_LOD->pHardwareTextures[v23];
576 }
577 else 567 else
578 { 568 {
579 //auto v24 = GetTickCount() / 4; 569 //auto v24 = GetTickCount() / 4;
580 //auto v25 = v24 - stru_5C6E00->uIntegerHalfPi; 570 //auto v25 = v24 - stru_5C6E00->uIntegerHalfPi;
581 uint eightSeconds = GetTickCount() % 8000; 571 uint eightSeconds = GetTickCount() % 8000;
583 573
584 //animte lava back and forth 574 //animte lava back and forth
585 for (uint i = 0; i < uNumVerticesa; ++i) 575 for (uint i = 0; i < uNumVerticesa; ++i)
586 //array_507D30[i].v += (double)(pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 & (unsigned int)(stru_5C6E00->SinCos(v25) >> 8)); 576 //array_507D30[i].v += (double)(pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 & (unsigned int)(stru_5C6E00->SinCos(v25) >> 8));
587 array_507D30[i].v += pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 * cosf(angle); 577 array_507D30[i].v += pBitmaps_LOD->pTextures[pFace->uBitmapID].uHeightMinus1 * cosf(angle);
588 v23 = pFace->uBitmapID; 578 v27 = pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID];
589 v27 = pBitmaps_LOD->pHardwareTextures[v23];
590 } 579 }
591 } 580 }
592 else if (pFace->uAttributes & 0x4000) 581 else if (pFace->uAttributes & 0x4000)
593 { 582 v27 = pBitmaps_LOD->pHardwareTextures[pTextureFrameTable->GetFrameTexture(pFace->uBitmapID, pBLVRenderParams->field_0_timer_)];
594 v23 = pTextureFrameTable->GetFrameTexture(pFace->uBitmapID, pBLVRenderParams->field_0_timer_);
595 v27 = pBitmaps_LOD->pHardwareTextures[v23];
596 }
597 else 583 else
598 { 584 {
599 v17 = 0xFF808080; 585 v17 = 0xFF808080;
600 v23 = pFace->uBitmapID; 586 v27 = pBitmaps_LOD->pHardwareTextures[pFace->uBitmapID];
601 v27 = pBitmaps_LOD->pHardwareTextures[v23];
602 } 587 }
603 588
604 if (pFace->uAttributes & FACE_INDOOR_SKY) 589 if (pFace->uAttributes & FACE_INDOOR_SKY)
605 pRenderer->DrawIndoorSky(uNumVerticesa, uFaceID); 590 pRenderer->DrawIndoorSky(uNumVerticesa, uFaceID);
606 else 591 else
607 pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, PID(OBJECT_BModel, uFaceID), v17, 0); 592 pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, pFace->GetTexture(), PID(OBJECT_BModel, uFaceID), v17, 0);
608 return; 593 return;
609 } 594 }
610 } 595 }
611 } 596 }
612 } 597 }
613
614
615
616 598
617 //----- (004B0E07) -------------------------------------------------------- 599 //----- (004B0E07) --------------------------------------------------------
618 unsigned int __fastcall sub_4B0E07(unsigned int uFaceID) 600 unsigned int __fastcall sub_4B0E07(unsigned int uFaceID)
619 { 601 {
620 BLVFace *v1; // edi@1
621 BLVFaceExtra *v2; // ecx@1
622 Texture *v3; // esi@1
623 unsigned int v4; // eax@1
624 unsigned int v5; // ecx@1
625 unsigned int result; // eax@1 602 unsigned int result; // eax@1
626 unsigned int v7; // ecx@5 603
627 604 stru_F8AD28.pDeltaUV[0] = pIndoor->pFaceExtras[pIndoor->pFaces[uFaceID].uFaceExtraID].sTextureDeltaU;
628 v1 = &pIndoor->pFaces[uFaceID]; 605 stru_F8AD28.pDeltaUV[1] = pIndoor->pFaceExtras[pIndoor->pFaces[uFaceID].uFaceExtraID].sTextureDeltaV;
629 v2 = &pIndoor->pFaceExtras[v1->uFaceExtraID]; 606 result = GetTickCount() >> 3;
630 v3 = pBitmaps_LOD->GetTexture(v1->uBitmapID); 607 if ( pIndoor->pFaces[uFaceID].uAttributes & 4 )
631 stru_F8AD28.pDeltaUV[0] = v2->sTextureDeltaU; 608 {
632 stru_F8AD28.pDeltaUV[1] = v2->sTextureDeltaV; 609 stru_F8AD28.pDeltaUV[1] -= result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uHeightMinus1;
633 v4 = GetTickCount();
634 v5 = v1->uAttributes;
635 result = v4 >> 3;
636 if ( v5 & 4 )
637 {
638 stru_F8AD28.pDeltaUV[1] -= result & v3->uHeightMinus1;
639 } 610 }
640 else 611 else
641 { 612 {
642 if ( v5 & 0x20 ) 613 if ( pIndoor->pFaces[uFaceID].uAttributes & 0x20 )
643 stru_F8AD28.pDeltaUV[1] += result & v3->uHeightMinus1; 614 stru_F8AD28.pDeltaUV[1] += result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uHeightMinus1;
644 } 615 }
645 v7 = v1->uAttributes; 616 if ( BYTE1(pIndoor->pFaces[uFaceID].uAttributes) & 8 )
646 if ( BYTE1(v7) & 8 ) 617 {
647 { 618 stru_F8AD28.pDeltaUV[0] -= result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uWidthMinus1;
648 stru_F8AD28.pDeltaUV[0] -= result & v3->uWidthMinus1;
649 } 619 }
650 else 620 else
651 { 621 {
652 if ( v7 & 0x40 ) 622 if ( pIndoor->pFaces[uFaceID].uAttributes & 0x40 )
653 stru_F8AD28.pDeltaUV[0] += result & v3->uWidthMinus1; 623 stru_F8AD28.pDeltaUV[0] += result & pBitmaps_LOD->GetTexture(pIndoor->pFaces[uFaceID].uBitmapID)->uWidthMinus1;
654 } 624 }
655 return result; 625 return result;
656 } 626 }
657 627
658 //----- (004B0EA8) -------------------------------------------------------- 628 //----- (004B0EA8) --------------------------------------------------------