Mercurial > mm7
comparison mm7_4.cpp @ 693:e0a1fccc89b1
map render fixes
author | Gloval |
---|---|
date | Sun, 17 Mar 2013 01:50:34 +0400 |
parents | 26dfde53decd |
children | 2dfb67633b01 |
comparison
equal
deleted
inserted
replaced
692:066e2b29b30f | 693:e0a1fccc89b1 |
---|---|
1378 Edge *v26; // [sp+18h] [bp-8h]@8 | 1378 Edge *v26; // [sp+18h] [bp-8h]@8 |
1379 unsigned int v27; // [sp+1Ch] [bp-4h]@1 | 1379 unsigned int v27; // [sp+1Ch] [bp-4h]@1 |
1380 | 1380 |
1381 v0 = pSpans; | 1381 v0 = pSpans; |
1382 stru_80C9D8.pSurf = &stru_80C980; | 1382 stru_80C9D8.pSurf = &stru_80C980; |
1383 stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportX; | 1383 stru_80C9D8.field_0 = (double)(signed int)pViewport->uViewportTL_X; |
1384 stru_80C9A4.pSurf = &stru_80C980; | 1384 stru_80C9A4.pSurf = &stru_80C980; |
1385 stru_80C980.pPrev = &stru_80C980; | 1385 stru_80C980.pPrev = &stru_80C980; |
1386 stru_80C980.pNext = &stru_80C980; | 1386 stru_80C980.pNext = &stru_80C980; |
1387 stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportZ; | 1387 stru_80C9A4.field_0 = (double)(signed int)pViewport->uViewportBR_X; |
1388 stru_80C980.field_8 = 0.0; | 1388 stru_80C980.field_8 = 0.0; |
1389 stru_80C980.field_4 = 0.0; | 1389 stru_80C980.field_4 = 0.0; |
1390 stru_80C9D8.pNext = &stru_80C9A4; | 1390 stru_80C9D8.pNext = &stru_80C9A4; |
1391 stru_80C9D8.pPrev = 0; | 1391 stru_80C9D8.pPrev = 0; |
1392 stru_80C9D8.field_8 = 1; | 1392 stru_80C9D8.field_8 = 1; |
1393 stru_80C9A4.pNext = 0; | 1393 stru_80C9A4.pNext = 0; |
1394 stru_80C9A4.pPrev = &stru_80C9D8; | 1394 stru_80C9A4.pPrev = &stru_80C9D8; |
1395 stru_80C9A4.field_8 = 0; | 1395 stru_80C9A4.field_8 = 0; |
1396 LODWORD(stru_80C980.field_0) = 0xC97423F0u; | 1396 LODWORD(stru_80C980.field_0) = 0xC97423F0u; |
1397 v27 = pViewport->uViewportY; | 1397 v27 = pViewport->uViewportTL_Y; |
1398 if ( (signed int)pViewport->uViewportY > (signed int)pViewport->uViewportW ) | 1398 if ( (signed int)pViewport->uViewportTL_Y > (signed int)pViewport->uViewportBR_Y ) |
1399 { | 1399 { |
1400 LABEL_51: | 1400 LABEL_51: |
1401 v0->field_8 = -1; | 1401 v0->field_8 = -1; |
1402 } | 1402 } |
1403 else | 1403 else |
1404 { | 1404 { |
1405 v1 = 52 * pViewport->uViewportY; | 1405 v1 = 52 * pViewport->uViewportTL_Y; |
1406 v24 = 52 * pViewport->uViewportY; | 1406 v24 = 52 * pViewport->uViewportTL_Y; |
1407 while ( 1 ) | 1407 while ( 1 ) |
1408 { | 1408 { |
1409 v2 = *(Edge **)((char *)&pNewEdges->pNext + v1); | 1409 v2 = *(Edge **)((char *)&pNewEdges->pNext + v1); |
1410 v3 = &stru_80C9D8; | 1410 v3 = &stru_80C9D8; |
1411 v25 = (double)(signed int)v27; | 1411 v25 = (double)(signed int)v27; |
1558 break; | 1558 break; |
1559 LABEL_50: | 1559 LABEL_50: |
1560 ++v27; | 1560 ++v27; |
1561 v1 = v24 + 52; | 1561 v1 = v24 + 52; |
1562 v24 += 52; | 1562 v24 += 52; |
1563 if ( (signed int)v27 > (signed int)pViewport->uViewportW ) | 1563 if ( (signed int)v27 > (signed int)pViewport->uViewportBR_Y ) |
1564 goto LABEL_51; | 1564 goto LABEL_51; |
1565 } | 1565 } |
1566 while ( 1 ) | 1566 while ( 1 ) |
1567 { | 1567 { |
1568 v21 = v20->pNext; | 1568 v21 = v20->pNext; |
6500 signed int v23; // [sp+20h] [bp+Ch]@1 | 6500 signed int v23; // [sp+20h] [bp+Ch]@1 |
6501 | 6501 |
6502 v5 = a4; | 6502 v5 = a4; |
6503 v23 = _z >> 16; | 6503 v23 = _z >> 16; |
6504 z = x + v5; | 6504 z = x + v5; |
6505 if ( z >= (signed int)pViewport->uViewportX | 6505 if ( z >= (signed int)pViewport->uViewportTL_X |
6506 && (signed int)x <= (signed int)pViewport->uViewportZ | 6506 && (signed int)x <= (signed int)pViewport->uViewportBR_X |
6507 && y >= (signed int)pViewport->uViewportY | 6507 && y >= (signed int)pViewport->uViewportTL_Y |
6508 && y <= (signed int)pViewport->uViewportW ) | 6508 && y <= (signed int)pViewport->uViewportBR_Y ) |
6509 { | 6509 { |
6510 if ( (signed int)x < (signed int)pViewport->uViewportX ) | 6510 if ( (signed int)x < (signed int)pViewport->uViewportTL_X ) |
6511 x = pViewport->uViewportX; | 6511 x = pViewport->uViewportTL_X; |
6512 if ( z > (signed int)pViewport->uViewportZ ) | 6512 if ( z > (signed int)pViewport->uViewportBR_X ) |
6513 z = pViewport->uViewportZ; | 6513 z = pViewport->uViewportBR_X; |
6514 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; | 6514 pTarget = &pRenderer->pTargetSurface[x + y * pRenderer->uTargetSurfacePitch]; |
6515 v22 = z - x; | 6515 v22 = z - x; |
6516 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; | 6516 pTargetZ = &pRenderer->pActiveZBuffer[x + 640 * y]; |
6517 v7 = lightColor >> 3; | 6517 v7 = lightColor >> 3; |
6518 v8 = lightColor & 0xF0; | 6518 v8 = lightColor & 0xF0; |
6629 | 6629 |
6630 if ( !pRenderer->uNumSceneBegins ) | 6630 if ( !pRenderer->uNumSceneBegins ) |
6631 { | 6631 { |
6632 if ( pRenderer->field_40110 ) | 6632 if ( pRenderer->field_40110 ) |
6633 { | 6633 { |
6634 a2.bottom = pViewport->uViewportY; | 6634 a2.bottom = pViewport->uViewportTL_Y; |
6635 a2.left = 0; | 6635 a2.left = 0; |
6636 a2.top = 0; | 6636 a2.top = 0; |
6637 a2.right = 640; | 6637 a2.right = 640; |
6638 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); | 6638 ErrD3D(pRenderer->pBackBuffer4->BltFast(0, 0, pRenderer->pColorKeySurface4, &a2, 16u)); |
6639 a2.right = 640; | 6639 a2.right = 640; |
6640 a2.left = 0; | 6640 a2.left = 0; |
6641 a2.top = pViewport->uViewportW + 1; | 6641 a2.top = pViewport->uViewportBR_Y + 1; |
6642 a2.bottom = 480; | 6642 a2.bottom = 480; |
6643 ErrD3D(pRenderer->pBackBuffer4->BltFast( | 6643 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
6644 0, | 6644 0, |
6645 pViewport->uViewportW + 1, | 6645 pViewport->uViewportBR_Y + 1, |
6646 pRenderer->pColorKeySurface4, | 6646 pRenderer->pColorKeySurface4, |
6647 &a2, | 6647 &a2, |
6648 16u)); | 6648 16u)); |
6649 a2.right = pViewport->uViewportX; | 6649 a2.right = pViewport->uViewportTL_X; |
6650 a2.bottom = pViewport->uViewportW + 1; | 6650 a2.bottom = pViewport->uViewportBR_Y + 1; |
6651 a2.left = 0; | 6651 a2.left = 0; |
6652 a2.top = pViewport->uViewportY; | 6652 a2.top = pViewport->uViewportTL_Y; |
6653 ErrD3D(pRenderer->pBackBuffer4->BltFast( | 6653 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
6654 0, | 6654 0, |
6655 pViewport->uViewportY, | 6655 pViewport->uViewportTL_Y, |
6656 pRenderer->pColorKeySurface4, | 6656 pRenderer->pColorKeySurface4, |
6657 &a2, | 6657 &a2, |
6658 16u)); | 6658 16u)); |
6659 a2.left = pViewport->uViewportZ; | 6659 a2.left = pViewport->uViewportBR_X; |
6660 a2.top = pViewport->uViewportY; | 6660 a2.top = pViewport->uViewportTL_Y; |
6661 a2.right = 640; | 6661 a2.right = 640; |
6662 a2.bottom = pViewport->uViewportW + 1; | 6662 a2.bottom = pViewport->uViewportBR_Y + 1; |
6663 ErrD3D(pRenderer->pBackBuffer4->BltFast( | 6663 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
6664 pViewport->uViewportZ, | 6664 pViewport->uViewportBR_X, |
6665 pViewport->uViewportY, | 6665 pViewport->uViewportTL_Y, |
6666 pRenderer->pColorKeySurface4, | 6666 pRenderer->pColorKeySurface4, |
6667 &a2, | 6667 &a2, |
6668 16u)); | 6668 16u)); |
6669 a2.right = pViewport->uViewportZ; | 6669 a2.right = pViewport->uViewportBR_X; |
6670 a2.bottom = pViewport->uViewportW + 1; | 6670 a2.bottom = pViewport->uViewportBR_Y + 1; |
6671 a2.left = pViewport->uViewportX; | 6671 a2.left = pViewport->uViewportTL_X; |
6672 a2.top = pViewport->uViewportY; | 6672 a2.top = pViewport->uViewportTL_Y; |
6673 ErrD3D(pRenderer->pBackBuffer4->BltFast( | 6673 ErrD3D(pRenderer->pBackBuffer4->BltFast( |
6674 pViewport->uViewportX, | 6674 pViewport->uViewportTL_X, |
6675 pViewport->uViewportY, | 6675 pViewport->uViewportTL_Y, |
6676 pRenderer->pColorKeySurface4, | 6676 pRenderer->pColorKeySurface4, |
6677 &a2, | 6677 &a2, |
6678 17u)); | 6678 17u)); |
6679 } | 6679 } |
6680 } | 6680 } |
6754 for (uint y = 352; y < 480; ++y) | 6754 for (uint y = 352; y < 480; ++y) |
6755 memcpy(pDst + y * Dst.lPitch / 2, | 6755 memcpy(pDst + y * Dst.lPitch / 2, |
6756 pSrc + y * 640, 640 * sizeof(__int16)); | 6756 pSrc + y * 640, 640 * sizeof(__int16)); |
6757 | 6757 |
6758 | 6758 |
6759 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportY + pViewport->uViewportX; | 6759 auto pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
6760 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; | 6760 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)]; |
6761 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportY + pViewport->uViewportX; | 6761 auto pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X; |
6762 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); | 6762 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY)); |
6763 v9 = ((signed int)pViewport->uViewportX >> 1) - ((signed int)pViewport->uViewportZ >> 1); | 6763 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1); |
6764 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); | 6764 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1); |
6765 v22 = 4 * ((Dst.lPitch / 4) + v9); | 6765 v22 = 4 * ((Dst.lPitch / 4) + v9); |
6766 v21 = 4 * v9 + 1280; | 6766 v21 = 4 * v9 + 1280; |
6767 | 6767 |
6768 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; | 6768 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1; |
6769 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); | 6769 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1); |
6770 v10 = (int)pSrc_x1y1; | 6770 v10 = (int)pSrc_x1y1; |
6771 v11 = (int)pDst_x1y1; | 6771 v11 = (int)pDst_x1y1; |
6772 auto uHalfWidth = v20 = (pViewport->uViewportZ - pViewport->uViewportX) / 2; | 6772 auto uHalfWidth = v20 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; |
6773 v13 = v24; | 6773 v13 = v24; |
6774 | 6774 |
6775 for (uint y = pViewport->uViewportY; y < pViewport->uViewportW + 1; ++y) | 6775 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y) |
6776 { | 6776 { |
6777 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, | 6777 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2, |
6778 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); | 6778 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16)); |
6779 for (uint x = pViewport->uViewportX; x < pViewport->uViewportZ; ++x) | 6779 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x) |
6780 { | 6780 { |
6781 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) | 6781 if (pSrc[y * 640 + x] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask)) |
6782 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; | 6782 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x]; |
6783 } | 6783 } |
6784 } | 6784 } |