Mercurial > mm7
comparison mm7_1.cpp @ 1293:557c0c3cc314
m
author | Ritor1 |
---|---|
date | Mon, 17 Jun 2013 09:09:03 +0600 |
parents | 24bc24b64ec2 |
children | 6bbd50bda571 |
comparison
equal
deleted
inserted
replaced
1292:24bc24b64ec2 | 1293:557c0c3cc314 |
---|---|
38 #include "Time.h" | 38 #include "Time.h" |
39 #include "IconFrameTable.h" | 39 #include "IconFrameTable.h" |
40 #include "TurnEngine.h" | 40 #include "TurnEngine.h" |
41 #include "texts.h" | 41 #include "texts.h" |
42 #include "UIHouses.h" | 42 #include "UIHouses.h" |
43 #include "mm7_data.h" | |
43 #include "stru367.h" | 44 #include "stru367.h" |
44 | 45 |
45 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam); | 46 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam); |
46 int __stdcall InsertMM7CDDialogFunc(HWND hDlg, int a2, __int16 a3, int a4); | 47 int __stdcall InsertMM7CDDialogFunc(HWND hDlg, int a2, __int16 a3, int a4); |
47 bool __fastcall FindMM7CD(HWND hWnd, char *pCDDrive); | 48 bool __fastcall FindMM7CD(HWND hWnd, char *pCDDrive); |
1508 //signed __int64 v18; // qtt@14 | 1509 //signed __int64 v18; // qtt@14 |
1509 //signed int v19; // edx@15 | 1510 //signed int v19; // edx@15 |
1510 //signed int v20; // edx@17 | 1511 //signed int v20; // edx@17 |
1511 //signed int v21; // ebx@19 | 1512 //signed int v21; // ebx@19 |
1512 //signed int v22; // esi@20 | 1513 //signed int v22; // esi@20 |
1513 int v23; // edi@21 | 1514 //int v23; // edi@21 |
1514 int v24; // eax@21 | 1515 int v24; // eax@21 |
1515 //int v25; // eax@22 | 1516 //int v25; // eax@22 |
1516 int v26; // eax@22 | 1517 int v26; // eax@22 |
1517 //signed int v27; // ST30_4@24 | 1518 //signed int v27; // ST30_4@24 |
1518 //signed __int64 v28; // qtt@24 | 1519 //signed __int64 v28; // qtt@24 |
1577 //signed int iz; // [sp+24h] [bp-4h]@41 | 1578 //signed int iz; // [sp+24h] [bp-4h]@41 |
1578 //signed int iy; // [sp+24h] [bp-4h]@51 | 1579 //signed int iy; // [sp+24h] [bp-4h]@51 |
1579 //signed int iw; // [sp+24h] [bp-4h]@61 | 1580 //signed int iw; // [sp+24h] [bp-4h]@61 |
1580 | 1581 |
1581 pFace = &pIndoor->pFaces[uFaceID]; | 1582 pFace = &pIndoor->pFaces[uFaceID]; |
1583 memset(&stru_50B700, 0, sizeof(stru367)); | |
1582 | 1584 |
1583 if ( pFace->pFacePlane.vNormal.x * (pIndoor->pVertices[pFace->pVertexIDs[0]].x - pBLVRenderParams->vPartyPos.x)//check the angle of the vector and the plane | 1585 if ( pFace->pFacePlane.vNormal.x * (pIndoor->pVertices[pFace->pVertexIDs[0]].x - pBLVRenderParams->vPartyPos.x)//check the angle of the vector and the plane |
1584 + pFace->pFacePlane.vNormal.y * (pIndoor->pVertices[pFace->pVertexIDs[0]].y - pBLVRenderParams->vPartyPos.y) | 1586 + pFace->pFacePlane.vNormal.y * (pIndoor->pVertices[pFace->pVertexIDs[0]].y - pBLVRenderParams->vPartyPos.y) |
1585 + pFace->pFacePlane.vNormal.z * (pIndoor->pVertices[pFace->pVertexIDs[0]].z - pBLVRenderParams->vPartyPos.z) < 0 ) | 1587 + pFace->pFacePlane.vNormal.z * (pIndoor->pVertices[pFace->pVertexIDs[0]].z - pBLVRenderParams->vPartyPos.z) < 0 ) |
1586 { | 1588 { |
1620 stru_50B700._view_transformed_zs[pFace->uNumVertices] = stru_50B700._view_transformed_zs[0]; | 1622 stru_50B700._view_transformed_zs[pFace->uNumVertices] = stru_50B700._view_transformed_zs[0]; |
1621 stru_50B700._view_transformed_ys[pFace->uNumVertices] = stru_50B700._view_transformed_ys[0]; | 1623 stru_50B700._view_transformed_ys[pFace->uNumVertices] = stru_50B700._view_transformed_ys[0]; |
1622 | 1624 |
1623 //maybe for near clip plane | 1625 //maybe for near clip plane |
1624 current_vertices_flag = stru_50B700._view_transformed_xs[0] >= (signed int)0x80000u;//координата у первой вершины >= ближней границы | 1626 current_vertices_flag = stru_50B700._view_transformed_xs[0] >= (signed int)0x80000u;//координата у первой вершины >= ближней границы |
1627 //if (pFace->uNumVertices >= 24 ) | |
1628 //__debugbreak(); | |
1625 for ( uint i = 1; i <= pFace->uNumVertices; ++i) | 1629 for ( uint i = 1; i <= pFace->uNumVertices; ++i) |
1626 { | 1630 { |
1627 next_vertices_flag = stru_50B700._view_transformed_xs[i] >= (signed int)0x80000u;//координата у i-ой вершины >= ближней границы | 1631 next_vertices_flag = stru_50B700._view_transformed_xs[i] >= (signed int)0x80000u;//координата у i-ой вершины >= ближней границы |
1628 if ( current_vertices_flag ^ next_vertices_flag )//первая или вторая координаты > ближней границы | 1632 if ( current_vertices_flag ^ next_vertices_flag )//первая или вторая координаты > ближней границы |
1629 { | 1633 { |
1630 if ( stru_50B700._view_transformed_xs[i] >= (signed int)0x80000u )//если координата у thisa < ближней границы, a i-ой вершины >= ближней границы | 1634 if ( stru_50B700._view_transformed_xs[i] >= (signed int)0x80000u )//если координата у thisa < ближней границы, a i-ой вершины >= ближней границы |
1631 { | 1635 { |
1632 //t = (near_clip - v0.x)/(v1.x - v0.x) | 1636 //t = (near_clip - v0.x)/(v1.x - v0.x) |
1633 t = (0x80000 - stru_50B700._view_transformed_xs[i - 1]) / (stru_50B700._view_transformed_xs[i] - stru_50B700._view_transformed_xs[i - 1]); | 1637 t = (0x80000 - stru_50B700._view_transformed_xs[i - 1]) / (stru_50B700._view_transformed_xs[i] - stru_50B700._view_transformed_xs[i - 1]); |
1634 //z = (v1.z - v0.z)*t + v0.z | 1638 //z = (v1.z - v0.z)*t + v0.z |
1635 stru_50B700._view_transformed_zs[i] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i] - stru_50B700._view_transformed_zs[i - 1]) | 1639 stru_50B700._view_transformed_zs[length_num_vertices] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i] - stru_50B700._view_transformed_zs[i - 1]) |
1636 * t)) + stru_50B700._view_transformed_zs[i - 1]; | 1640 * t)) + stru_50B700._view_transformed_zs[i - 1]; |
1637 //y = (v1.y -v0.y)*(near_clip - v0.x)/(v1.x - v0.x) | 1641 //y = (v1.y -v0.y)*(near_clip - v0.x)/(v1.x - v0.x) |
1638 stru_50B700._view_transformed_ys[i] = (unsigned __int64)((stru_50B700._view_transformed_ys[i] - stru_50B700._view_transformed_ys[i - 1]) | 1642 stru_50B700._view_transformed_ys[length_num_vertices] = (unsigned __int64)((stru_50B700._view_transformed_ys[i] - stru_50B700._view_transformed_ys[i - 1]) |
1639 * t) + stru_50B700._view_transformed_ys[i]; | 1643 * t) + stru_50B700._view_transformed_ys[i]; |
1644 stru_50B700._view_transformed_xs[length_num_vertices] = 0x80000u;//z координата новой точки = 8.0 | |
1640 //stru_50B700._view_transformed_ys[i] = stru_50B700.field_38[new_point]; | 1645 //stru_50B700._view_transformed_ys[i] = stru_50B700.field_38[new_point]; |
1641 //stru_50B700._view_transformed_zs[i] = stru_50B700.field_128[new_point]; | 1646 //stru_50B700._view_transformed_zs[i] = stru_50B700.field_128[new_point]; |
1642 } | 1647 } |
1643 else//если координата у thisa вершины >= ближней границы | 1648 else//если координата у thisa вершины >= ближней границы |
1644 { | 1649 { |
1645 t = (0x80000 - stru_50B700._view_transformed_xs[i]) / (stru_50B700._view_transformed_xs[i - 1] - stru_50B700._view_transformed_xs[i]); | 1650 t = (0x80000 - stru_50B700._view_transformed_xs[i]) / (stru_50B700._view_transformed_xs[i - 1] - stru_50B700._view_transformed_xs[i]); |
1646 //z = (v0.z - v1.z)*(near_clip - v1.x)/(v0.x - v1.x) + v1.z | 1651 //z = (v0.z - v1.z)*(near_clip - v1.x)/(v0.x - v1.x) + v1.z |
1647 stru_50B700._view_transformed_zs[i] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i - 1] - stru_50B700._view_transformed_zs[i]) | 1652 stru_50B700._view_transformed_zs[length_num_vertices + 1] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i - 1] - stru_50B700._view_transformed_zs[i]) |
1648 * t)) + stru_50B700._view_transformed_zs[i]; | 1653 * t)) + stru_50B700._view_transformed_zs[i]; |
1649 //y = (v0.y - v1.y)*(near_clip - v1.x)/(v0.x - v1.x) | 1654 //y = (v0.y - v1.y)*(near_clip - v1.x)/(v0.x - v1.x) |
1650 stru_50B700._view_transformed_ys[i] = (unsigned __int64)((stru_50B700._view_transformed_ys[i - 1] - stru_50B700._view_transformed_ys[i]) | 1655 stru_50B700._view_transformed_ys[length_num_vertices + 1] = (unsigned __int64)((stru_50B700._view_transformed_ys[i - 1] - stru_50B700._view_transformed_ys[i]) |
1651 * t) + stru_50B700._view_transformed_ys[i]; | 1656 * t) + stru_50B700._view_transformed_ys[i]; |
1657 stru_50B700._view_transformed_xs[length_num_vertices + 1] = 0x80000u;//z координата новой точки = 8.0 | |
1652 //stru_50B700._view_transformed_ys[i] = stru_50B700.field_38[new_point]; | 1658 //stru_50B700._view_transformed_ys[i] = stru_50B700.field_38[new_point]; |
1653 //stru_50B700._view_transformed_zs[i] = stru_50B700.field_128[new_point]; | 1659 //stru_50B700._view_transformed_zs[i] = stru_50B700.field_128[new_point]; |
1654 } | 1660 } |
1655 //stru_50B700.field_218[new_point] | 1661 //stru_50B700.field_218[new_point] |
1656 //stru_50B700._view_transformed_xs[i] = 0x80000u;//z координата новой точки = 8.0 | 1662 //stru_50B700._view_transformed_xs[i] = 0x80000u;//z координата новой точки = 8.0 |
1657 stru_50B700._view_transformed_xs[i] = 0x80000u;//z координата новой точки = 8.0 | |
1658 length_num_vertices++; | 1663 length_num_vertices++; |
1659 //new_point++; | 1664 //new_point++; |
1660 } | 1665 } |
1661 /*if ( next_vertices_flag ) | 1666 if ( next_vertices_flag ) |
1662 { | 1667 { |
1663 //v20 = v79++; | 1668 //v20 = v79++; |
1664 stru_50B700.field_218[length_num_vertices] = stru_50B700._view_transformed_xs[i]; | 1669 //stru_50B700.field_38[length_num_vertices] = stru_50B700._view_transformed_ys[i]; |
1665 stru_50B700.field_128[length_num_vertices] = stru_50B700._view_transformed_zs[i]; | 1670 //stru_50B700.field_128[length_num_vertices] = stru_50B700._view_transformed_zs[i]; |
1666 stru_50B700.field_38[length_num_vertices] = stru_50B700._view_transformed_ys[i]; | 1671 //stru_50B700.field_218[length_num_vertices] = stru_50B700._view_transformed_xs[i]; |
1667 length_num_vertices++; | 1672 length_num_vertices++; |
1668 }*/ | 1673 } |
1669 /*else | 1674 /*else |
1670 length_num_vertices++; | 1675 length_num_vertices++; |
1671 stru_50B700.field_218[0] = stru_50B700._view_transformed_xs[i]; | 1676 stru_50B700.field_218[0] = stru_50B700._view_transformed_xs[i]; |
1672 stru_50B700.field_128[0] = stru_50B700._view_transformed_zs[i]; | 1677 stru_50B700.field_128[0] = stru_50B700._view_transformed_zs[i]; |
1673 stru_50B700.field_38[0] = stru_50B700._view_transformed_ys[i];*/ | 1678 stru_50B700.field_38[0] = stru_50B700._view_transformed_ys[i];*/ |
1674 current_vertices_flag = next_vertices_flag;//i-ная передвигается вправо | 1679 current_vertices_flag = next_vertices_flag;//i-ная передвигается вправо |
1675 length_num_vertices++; | |
1676 } | 1680 } |
1677 //v21 = v79; | 1681 //v21 = v79; |
1678 /*stru_50B700.field_218[length_num_vertices] = stru_50B700.field_218[0];//новые точки пересечения(t1, t2) по х | 1682 //stru_50B700.field_218[length_num_vertices] = stru_50B700.field_218[0];//новые точки пересечения(t1, t2) по х |
1679 stru_50B700.field_128[length_num_vertices] = stru_50B700.field_128[0]; | 1683 //stru_50B700.field_128[length_num_vertices] = stru_50B700.field_128[0]; |
1680 stru_50B700.field_38[length_num_vertices] = stru_50B700.field_38[0];*/ | 1684 //stru_50B700.field_38[length_num_vertices] = stru_50B700.field_38[0]; |
1681 | 1685 |
1682 //maybe for far clip plane | 1686 //maybe for far clip plane |
1683 for ( uint i = 0; i < length_num_vertices; ++i ) | 1687 for ( uint i = 0; i < length_num_vertices; ++i ) |
1684 { | 1688 { |
1685 if ( abs(stru_50B700._view_transformed_zs[i]) <= abs(stru_50B700._view_transformed_xs[i]) ) | 1689 if ( abs(stru_50B700._view_transformed_zs[i]) <= abs(stru_50B700._view_transformed_xs[i]) ) |
1686 { | 1690 { |
1687 //LODWORD(v28) = stru_50B700.field_128[i] << 16; | 1691 //LODWORD(v28) = stru_50B700.field_128[i] << 16; |
1688 //HIDWORD(v28) = stru_50B700.field_128[i] >> 16; | 1692 //HIDWORD(v28) = stru_50B700.field_128[i] >> 16; |
1689 v26 = stru_50B700._view_transformed_zs[i] / stru_50B700._view_transformed_xs[i]; | 1693 v26 = stru_50B700._view_transformed_zs[i] / stru_50B700._view_transformed_xs[i]; |
1690 v23 = 0; | 1694 //v23 = 0; |
1691 } | 1695 } |
1692 else | 1696 else |
1693 { | 1697 { |
1694 v23 = 0; | 1698 //v23 = 0; |
1695 v24 = 0; | 1699 v24 = 0; |
1696 if ( stru_50B700._view_transformed_zs[i] >= 0 ) | 1700 if ( stru_50B700._view_transformed_zs[i] >= 0 ) |
1697 { | 1701 { |
1698 LOBYTE(v24) = stru_50B700._view_transformed_xs[i] >= 0; | 1702 LOBYTE(v24) = stru_50B700._view_transformed_xs[i] >= 0; |
1699 v26 = ((v24 - 1) & 0xFF800000) + 0x400000; | 1703 v26 = ((v24 - 1) & 0xFF800000) + 0x400000;//((v24 - 1) & -127) + 64.0 |
1700 } | 1704 } |
1701 else | 1705 else |
1702 { | 1706 { |
1703 LOBYTE(v24) = stru_50B700._view_transformed_xs[i] >= 0; | 1707 LOBYTE(v24) = stru_50B700._view_transformed_xs[i] >= 0; |
1704 v26 = ((v24 - 1) & 0x800000) - 0x400000; | 1708 v26 = ((v24 - 1) & 0x800000) - 0x400000;//((v24 - 1) & 128) - 64.0 |
1705 } | 1709 } |
1706 } | 1710 } |
1707 stru_50B700._xs3[i] = v26;//дальняя координата вершины от камеры | 1711 stru_50B700._xs3[i] = v26;//дальняя координата z вершины от камеры |
1708 if ( abs(stru_50B700._view_transformed_ys[i]) <= abs(stru_50B700._view_transformed_xs[i]) ) | 1712 if ( abs(stru_50B700._view_transformed_ys[i]) <= abs(stru_50B700._view_transformed_xs[i]) ) |
1709 { | 1713 { |
1710 //LODWORD(v34) = stru_50B700.field_38[i] << 16; | 1714 //LODWORD(v34) = stru_50B700.field_38[i] << 16; |
1711 //HIDWORD(v34) = stru_50B700.field_38[i] >> 16; | 1715 //HIDWORD(v34) = stru_50B700.field_38[i] >> 16; |
1712 v32 = stru_50B700._view_transformed_ys[i] / stru_50B700._view_transformed_xs[i]; | 1716 v32 = stru_50B700._view_transformed_ys[i] / stru_50B700._view_transformed_xs[i]; |
1713 } | 1717 } |
1714 else | 1718 else |
1715 { | 1719 { |
1716 v30 = 0; | 1720 v30 = 0; |
1717 if ( stru_50B700._view_transformed_ys[i] >= v23 ) | 1721 if ( stru_50B700._view_transformed_ys[i] >= 0 ) |
1718 { | 1722 { |
1719 LOBYTE(v30) = stru_50B700._view_transformed_xs[i] >= v23; | 1723 LOBYTE(v30) = stru_50B700._view_transformed_xs[i] >= 0; |
1720 v32 = ((v30 - 1) & 0xFF800000) + 0x400000; | 1724 v32 = ((v30 - 1) & 0xFF800000) + 0x400000; |
1721 } | 1725 } |
1722 else | 1726 else |
1723 { | 1727 { |
1724 LOBYTE(v30) = stru_50B700._view_transformed_xs[i] >= v23; | 1728 LOBYTE(v30) = stru_50B700._view_transformed_xs[i] >= 0; |
1725 v32 = ((v30 - 1) & 0x800000) - 0x400000; | 1729 v32 = ((v30 - 1) & 0x800000) - 0x400000; |
1726 } | 1730 } |
1727 } | 1731 } |
1728 stru_50B700._ys2[i] = v32; | 1732 //stru_50B700._ys2[i] = v32; |
1729 stru_50B700._xs3[i] = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)stru_50B700._xs3[i]); | 1733 stru_50B700._xs3[i] = pBLVRenderParams->uViewportCenterX -(unsigned __int64)(SHIWORD(pBLVRenderParams->field_40)//maybe screen space x |
1730 stru_50B700._xs3[i] = pBLVRenderParams->uViewportCenterX - stru_50B700._xs3[i]; | 1734 * (signed __int64)stru_50B700._xs3[i]); |
1731 stru_50B700._ys2[i] = pBLVRenderParams->uViewportCenterY - (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) | 1735 //stru_50B700._xs3[i] = pBLVRenderParams->uViewportCenterX - stru_50B700._xs3[i]; |
1732 * (signed __int64)stru_50B700._ys2[i]); | 1736 stru_50B700._ys2[i] = pBLVRenderParams->uViewportCenterY - (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40)//screen space y |
1737 * (signed __int64)v32); | |
1733 } | 1738 } |
1734 | 1739 |
1735 for_x_num_vertices = 0; | 1740 for_x_num_vertices = 0; |
1736 stru_50B700._xs3[length_num_vertices] = stru_50B700._xs3[0]; | 1741 stru_50B700._xs3[length_num_vertices] = stru_50B700._xs3[0]; |
1737 stru_50B700._ys2[length_num_vertices] = stru_50B700._ys2[0]; | 1742 stru_50B700._ys2[length_num_vertices] = stru_50B700._ys2[0]; |