Mercurial > mm7
changeset 1293:557c0c3cc314
m
author | Ritor1 |
---|---|
date | Mon, 17 Jun 2013 09:09:03 +0600 |
parents | 24bc24b64ec2 |
children | 6bbd50bda571 |
files | mm7_1.cpp |
diffstat | 1 files changed, 34 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/mm7_1.cpp Fri Jun 14 16:06:30 2013 +0600 +++ b/mm7_1.cpp Mon Jun 17 09:09:03 2013 +0600 @@ -40,6 +40,7 @@ #include "TurnEngine.h" #include "texts.h" #include "UIHouses.h" +#include "mm7_data.h" #include "stru367.h" int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam); @@ -1510,7 +1511,7 @@ //signed int v20; // edx@17 //signed int v21; // ebx@19 //signed int v22; // esi@20 - int v23; // edi@21 + //int v23; // edi@21 int v24; // eax@21 //int v25; // eax@22 int v26; // eax@22 @@ -1579,6 +1580,7 @@ //signed int iw; // [sp+24h] [bp-4h]@61 pFace = &pIndoor->pFaces[uFaceID]; + memset(&stru_50B700, 0, sizeof(stru367)); if ( pFace->pFacePlane.vNormal.x * (pIndoor->pVertices[pFace->pVertexIDs[0]].x - pBLVRenderParams->vPartyPos.x)//check the angle of the vector and the plane + pFace->pFacePlane.vNormal.y * (pIndoor->pVertices[pFace->pVertexIDs[0]].y - pBLVRenderParams->vPartyPos.y) @@ -1622,6 +1624,8 @@ //maybe for near clip plane current_vertices_flag = stru_50B700._view_transformed_xs[0] >= (signed int)0x80000u;//координата у первой вершины >= ближней границы + //if (pFace->uNumVertices >= 24 ) + //__debugbreak(); for ( uint i = 1; i <= pFace->uNumVertices; ++i) { next_vertices_flag = stru_50B700._view_transformed_xs[i] >= (signed int)0x80000u;//координата у i-ой вершины >= ближней границы @@ -1629,14 +1633,15 @@ { if ( stru_50B700._view_transformed_xs[i] >= (signed int)0x80000u )//если координата у thisa < ближней границы, a i-ой вершины >= ближней границы { - //t = (near_clip - v0.x)/(v1.x - v0.x) + //t = (near_clip - v0.x)/(v1.x - v0.x) t = (0x80000 - stru_50B700._view_transformed_xs[i - 1]) / (stru_50B700._view_transformed_xs[i] - stru_50B700._view_transformed_xs[i - 1]); //z = (v1.z - v0.z)*t + v0.z - stru_50B700._view_transformed_zs[i] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i] - stru_50B700._view_transformed_zs[i - 1]) + stru_50B700._view_transformed_zs[length_num_vertices] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i] - stru_50B700._view_transformed_zs[i - 1]) * t)) + stru_50B700._view_transformed_zs[i - 1]; //y = (v1.y -v0.y)*(near_clip - v0.x)/(v1.x - v0.x) - stru_50B700._view_transformed_ys[i] = (unsigned __int64)((stru_50B700._view_transformed_ys[i] - stru_50B700._view_transformed_ys[i - 1]) + stru_50B700._view_transformed_ys[length_num_vertices] = (unsigned __int64)((stru_50B700._view_transformed_ys[i] - stru_50B700._view_transformed_ys[i - 1]) * t) + stru_50B700._view_transformed_ys[i]; + stru_50B700._view_transformed_xs[length_num_vertices] = 0x80000u;//z координата новой точки = 8.0 //stru_50B700._view_transformed_ys[i] = stru_50B700.field_38[new_point]; //stru_50B700._view_transformed_zs[i] = stru_50B700.field_128[new_point]; } @@ -1644,40 +1649,39 @@ { t = (0x80000 - stru_50B700._view_transformed_xs[i]) / (stru_50B700._view_transformed_xs[i - 1] - stru_50B700._view_transformed_xs[i]); //z = (v0.z - v1.z)*(near_clip - v1.x)/(v0.x - v1.x) + v1.z - stru_50B700._view_transformed_zs[i] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i - 1] - stru_50B700._view_transformed_zs[i]) + stru_50B700._view_transformed_zs[length_num_vertices + 1] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i - 1] - stru_50B700._view_transformed_zs[i]) * t)) + stru_50B700._view_transformed_zs[i]; //y = (v0.y - v1.y)*(near_clip - v1.x)/(v0.x - v1.x) - stru_50B700._view_transformed_ys[i] = (unsigned __int64)((stru_50B700._view_transformed_ys[i - 1] - stru_50B700._view_transformed_ys[i]) + stru_50B700._view_transformed_ys[length_num_vertices + 1] = (unsigned __int64)((stru_50B700._view_transformed_ys[i - 1] - stru_50B700._view_transformed_ys[i]) * t) + stru_50B700._view_transformed_ys[i]; + stru_50B700._view_transformed_xs[length_num_vertices + 1] = 0x80000u;//z координата новой точки = 8.0 //stru_50B700._view_transformed_ys[i] = stru_50B700.field_38[new_point]; //stru_50B700._view_transformed_zs[i] = stru_50B700.field_128[new_point]; } //stru_50B700.field_218[new_point] //stru_50B700._view_transformed_xs[i] = 0x80000u;//z координата новой точки = 8.0 - stru_50B700._view_transformed_xs[i] = 0x80000u;//z координата новой точки = 8.0 length_num_vertices++; //new_point++; } - /*if ( next_vertices_flag ) + if ( next_vertices_flag ) { //v20 = v79++; - stru_50B700.field_218[length_num_vertices] = stru_50B700._view_transformed_xs[i]; - stru_50B700.field_128[length_num_vertices] = stru_50B700._view_transformed_zs[i]; - stru_50B700.field_38[length_num_vertices] = stru_50B700._view_transformed_ys[i]; + //stru_50B700.field_38[length_num_vertices] = stru_50B700._view_transformed_ys[i]; + //stru_50B700.field_128[length_num_vertices] = stru_50B700._view_transformed_zs[i]; + //stru_50B700.field_218[length_num_vertices] = stru_50B700._view_transformed_xs[i]; length_num_vertices++; - }*/ + } /*else length_num_vertices++; stru_50B700.field_218[0] = stru_50B700._view_transformed_xs[i]; stru_50B700.field_128[0] = stru_50B700._view_transformed_zs[i]; stru_50B700.field_38[0] = stru_50B700._view_transformed_ys[i];*/ current_vertices_flag = next_vertices_flag;//i-ная передвигается вправо - length_num_vertices++; } //v21 = v79; - /*stru_50B700.field_218[length_num_vertices] = stru_50B700.field_218[0];//новые точки пересечения(t1, t2) по х - stru_50B700.field_128[length_num_vertices] = stru_50B700.field_128[0]; - stru_50B700.field_38[length_num_vertices] = stru_50B700.field_38[0];*/ + //stru_50B700.field_218[length_num_vertices] = stru_50B700.field_218[0];//новые точки пересечения(t1, t2) по х + //stru_50B700.field_128[length_num_vertices] = stru_50B700.field_128[0]; + //stru_50B700.field_38[length_num_vertices] = stru_50B700.field_38[0]; //maybe for far clip plane for ( uint i = 0; i < length_num_vertices; ++i ) @@ -1687,24 +1691,24 @@ //LODWORD(v28) = stru_50B700.field_128[i] << 16; //HIDWORD(v28) = stru_50B700.field_128[i] >> 16; v26 = stru_50B700._view_transformed_zs[i] / stru_50B700._view_transformed_xs[i]; - v23 = 0; + //v23 = 0; } else { - v23 = 0; + //v23 = 0; v24 = 0; if ( stru_50B700._view_transformed_zs[i] >= 0 ) { LOBYTE(v24) = stru_50B700._view_transformed_xs[i] >= 0; - v26 = ((v24 - 1) & 0xFF800000) + 0x400000; + v26 = ((v24 - 1) & 0xFF800000) + 0x400000;//((v24 - 1) & -127) + 64.0 } else { LOBYTE(v24) = stru_50B700._view_transformed_xs[i] >= 0; - v26 = ((v24 - 1) & 0x800000) - 0x400000; + v26 = ((v24 - 1) & 0x800000) - 0x400000;//((v24 - 1) & 128) - 64.0 } } - stru_50B700._xs3[i] = v26;//дальняя координата вершины от камеры + stru_50B700._xs3[i] = v26;//дальняя координата z вершины от камеры if ( abs(stru_50B700._view_transformed_ys[i]) <= abs(stru_50B700._view_transformed_xs[i]) ) { //LODWORD(v34) = stru_50B700.field_38[i] << 16; @@ -1714,22 +1718,23 @@ else { v30 = 0; - if ( stru_50B700._view_transformed_ys[i] >= v23 ) + if ( stru_50B700._view_transformed_ys[i] >= 0 ) { - LOBYTE(v30) = stru_50B700._view_transformed_xs[i] >= v23; + LOBYTE(v30) = stru_50B700._view_transformed_xs[i] >= 0; v32 = ((v30 - 1) & 0xFF800000) + 0x400000; } else { - LOBYTE(v30) = stru_50B700._view_transformed_xs[i] >= v23; + LOBYTE(v30) = stru_50B700._view_transformed_xs[i] >= 0; v32 = ((v30 - 1) & 0x800000) - 0x400000; } } - stru_50B700._ys2[i] = v32; - stru_50B700._xs3[i] = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)stru_50B700._xs3[i]); - stru_50B700._xs3[i] = pBLVRenderParams->uViewportCenterX - stru_50B700._xs3[i]; - stru_50B700._ys2[i] = pBLVRenderParams->uViewportCenterY - (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) - * (signed __int64)stru_50B700._ys2[i]); + //stru_50B700._ys2[i] = v32; + stru_50B700._xs3[i] = pBLVRenderParams->uViewportCenterX -(unsigned __int64)(SHIWORD(pBLVRenderParams->field_40)//maybe screen space x + * (signed __int64)stru_50B700._xs3[i]); + //stru_50B700._xs3[i] = pBLVRenderParams->uViewportCenterX - stru_50B700._xs3[i]; + stru_50B700._ys2[i] = pBLVRenderParams->uViewportCenterY - (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40)//screen space y + * (signed __int64)v32); } for_x_num_vertices = 0;