# HG changeset patch # User Ritor1 # Date 1363974141 -21600 # Node ID 4b06e19fcdbcf22e9bc82a4f2f81941472377ec8 # Parent 353ff9ea11e646c4e3e81a66c98e1a928cb4aa33# Parent 9cc972ebd3cf65150a320f3b637bee9c76d86f1c Слияние diff -r 9cc972ebd3cf -r 4b06e19fcdbc Render.cpp --- a/Render.cpp Fri Mar 22 20:07:55 2013 +0200 +++ b/Render.cpp Fri Mar 22 23:42:21 2013 +0600 @@ -8209,17 +8209,17 @@ //----- (004A354F) -------------------------------------------------------- void Render::MakeParticleBillboardAndPush_BLV(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle) { - double v5; // st7@3 - float v6; // ST20_4@3 - float v7; // ST00_4@3 + //double v5; // st7@3 + //float v6; // ST20_4@3 + //float v7; // ST00_4@3 unsigned int v8; // esi@3 - int v9; // eax@3 - int v10; // ebx@3 + //int v9; // eax@3 + //int v10; // ebx@3 float v11; // ST28_4@3 - double v12; // st7@3 - float v13; // ST24_4@3 - double v14; // st6@3 - float v15; // ST1C_4@3 + //double v12; // st7@3 + //float v13; // ST24_4@3 + //double v14; // st6@3 + //float v15; // ST1C_4@3 float v16; // ST2C_4@3 float v17; // ST30_4@3 signed int v18; // ST18_4@3 @@ -8256,23 +8256,23 @@ { if (a2->zbuffer_depth) { - v5 = (double)a2->zbuffer_depth; - v6 = v5; - v7 = v5; - v8 = Billboard_ProbablyAddToListAndSortByZOrder(LODWORD(v7)); + //v5 = (double)a2->zbuffer_depth; + //v6 = v5; + //v7 = v5; + v8 = Billboard_ProbablyAddToListAndSortByZOrder(a2->zbuffer_depth); pBillboardRenderListD3D[v8].uOpacity = RenderBillboardD3D::Opaque_1; pBillboardRenderListD3D[v8].field_90 = a2->field_44; pBillboardRenderListD3D[v8].sZValue = a2->sZValue; pBillboardRenderListD3D[v8].uParentBillboardID = a2->uParentBillboardID; - v9 = a2->uScreenSpaceX; - v10 = a2->uScreenSpaceY; + //v9 = a2->uScreenSpaceX; + //v10 = a2->uScreenSpaceY; v11 = (a2->_screenspace_x_scaler_packedfloat & 0xFFFF) * 0.000015260186 + HIWORD(a2->_screenspace_x_scaler_packedfloat); - v12 = (double)v9; - v13 = v12; - v14 = (double)(v10 - 12); - v15 = v14; - v16 = (double)(v9 - 12) - v12; - v17 = (double)(v10 - 25) - v14; + //v12 = (double) a2->uScreenSpaceX; + //v13 = v12; + //v14 = (double)(a2->uScreenSpaceY - 12); + //v15 = v14; + v16 = (double)( a2->uScreenSpaceX - 12) - (double) a2->uScreenSpaceX; + v17 = (double)(a2->uScreenSpaceY - 25) - (double)(a2->uScreenSpaceY - 12); v18 = stru_5C6E00->Cos(angle); v19 = stru_5C6E00->Sin(angle); v20 = stru_5C6E00->Sin(angle); @@ -8283,7 +8283,7 @@ - ((double)(unsigned __int16)v19 * 0.000015259022 + (double)(v19 >> 16)) * v17) - * v11 + v13; + * v11 + (double) a2->uScreenSpaceX; v22 = (((double)(unsigned __int16)v21 * 0.000015259022 + (double)(v21 >> 16)) * v17 + ((double)(unsigned __int16)v20 * 0.000015259022 + (double)(v20 >> 16)) * v16 - 12.0) @@ -8292,25 +8292,25 @@ pBillboardRenderListD3D[v8].pQuards[0].specular = 0; pBillboardRenderListD3D[v8].pQuards[0].diffuse = uDiffuse; pBillboardRenderListD3D[v8].pQuards[0].pos.y = v22; - pBillboardRenderListD3D[v8].pQuards[0].pos.z = 1.0 - 1.0 / (v6 * 0.061758894); - pBillboardRenderListD3D[v8].pQuards[0].rhw = 1.0 / v6; + pBillboardRenderListD3D[v8].pQuards[0].pos.z = 1.0 - 1.0 / (a2->zbuffer_depth * 0.061758894); + pBillboardRenderListD3D[v8].pQuards[0].rhw = 1.0 / a2->zbuffer_depth; pBillboardRenderListD3D[v8].pQuards[0].texcoord.x = 0.0; pBillboardRenderListD3D[v8].pQuards[0].texcoord.y = 0.0; - v31 = (double)(a2->uScreenSpaceX + 12) - v13; - v32 = (double)a2->uScreenSpaceY - v15; + v31 = (double)(a2->uScreenSpaceX + 12) - (double) a2->uScreenSpaceX; + v32 = (double)a2->uScreenSpaceY - (double)(a2->uScreenSpaceY - 12); v25 = stru_5C6E00->Cos(angle); v26 = stru_5C6E00->Sin(angle); v27 = stru_5C6E00->Sin(angle); v28 = stru_5C6E00->Cos(angle); pBillboardRenderListD3D[v8].pQuards[1].pos.x = (((double)(unsigned __int16)v25 * 0.000015259022 + (double)(v25 >> 16)) - * v23 + * v31 - ((double)(unsigned __int16)v26 * 0.000015259022 + (double)(v26 >> 16)) - * v24) - * v11 + v13; - v29 = (((double)(unsigned __int16)v28 * 0.000015259022 + (double)(v28 >> 16)) * v24 - + ((double)(unsigned __int16)v27 * 0.000015259022 + (double)(v27 >> 16)) * v23 + * v32) + * v11 + (double) a2->uScreenSpaceX; + v29 = (((double)(unsigned __int16)v28 * 0.000015259022 + (double)(v28 >> 16)) * v32 + + ((double)(unsigned __int16)v27 * 0.000015259022 + (double)(v27 >> 16)) * v31 - 12.0) * v11 + (double)a2->uScreenSpaceY; @@ -8322,22 +8322,22 @@ pBillboardRenderListD3D[v8].pQuards[1].diffuse = uDiffuse; pBillboardRenderListD3D[v8].pQuards[1].texcoord.x = 0.0; pBillboardRenderListD3D[v8].pQuards[1].texcoord.y = 1.0; - v23 = (double)(a2->uScreenSpaceX - 12) - v13; - v24 = (double)a2->uScreenSpaceY - v15; + v23 = (double)(a2->uScreenSpaceX - 12) - (double) a2->uScreenSpaceX; + v24 = (double)a2->uScreenSpaceY - (double)(a2->uScreenSpaceY - 12); v33 = stru_5C6E00->Cos(angle); v34 = stru_5C6E00->Sin(angle); v35 = stru_5C6E00->Sin(angle); v36 = stru_5C6E00->Cos(angle); pBillboardRenderListD3D[v8].pQuards[2].pos.x = (((double)(unsigned __int16)v33 * 0.000015259022 + (double)(v33 >> 16)) - * v31 + * v23 - ((double)(unsigned __int16)v34 * 0.000015259022 + (double)(v34 >> 16)) - * v32) - * v11 + v13; + * v24) + * v11 + (double) a2->uScreenSpaceX; v37 = pBillboardRenderListD3D[v8].pQuards[0].pos.z; - v38 = (((double)(unsigned __int16)v36 * 0.000015259022 + (double)(v36 >> 16)) * v32 - + ((double)(unsigned __int16)v35 * 0.000015259022 + (double)(v35 >> 16)) * v31 + v38 = (((double)(unsigned __int16)v36 * 0.000015259022 + (double)(v36 >> 16)) * v24 + + ((double)(unsigned __int16)v35 * 0.000015259022 + (double)(v35 >> 16)) * v23 - 12.0) * v11 + (double)a2->uScreenSpaceY; @@ -8348,8 +8348,8 @@ pBillboardRenderListD3D[v8].pQuards[2].pos.y = v38; pBillboardRenderListD3D[v8].pQuards[2].texcoord.x = 1.0; pBillboardRenderListD3D[v8].pQuards[2].texcoord.y = 1.0; - v39 = (double)(a2->uScreenSpaceX + 12) - v13; - v40 = (double)(a2->uScreenSpaceY - 25) - v15; + v39 = (double)(a2->uScreenSpaceX + 12) - (double) a2->uScreenSpaceX; + v40 = (double)(a2->uScreenSpaceY - 25) - (double)(a2->uScreenSpaceY - 12); v41 = stru_5C6E00->Cos(angle); v42 = stru_5C6E00->Sin(angle); v43 = stru_5C6E00->Sin(angle); @@ -8360,7 +8360,7 @@ - ((double)(unsigned __int16)v42 * 0.000015259022 + (double)(v42 >> 16)) * v40) - * v11 + v13; + * v11 + (double) a2->uScreenSpaceX; v45 = (((double)(unsigned __int16)v44 * 0.000015259022 + (double)(v44 >> 16)) * v40 + ((double)(unsigned __int16)v43 * 0.000015259022 + (double)(v43 >> 16)) * v39 - 12.0) @@ -8372,7 +8372,7 @@ pBillboardRenderListD3D[v8].pQuards[3].rhw = pBillboardRenderListD3D[v8].pQuards[0].rhw; pBillboardRenderListD3D[v8].pQuards[3].diffuse = uDiffuse; pBillboardRenderListD3D[v8].pTexture = a3; - pBillboardRenderListD3D[v8].z_order = v6; + pBillboardRenderListD3D[v8].z_order = a2->zbuffer_depth; pBillboardRenderListD3D[v8].uNumVertices = 4; pBillboardRenderListD3D[v8].pQuards[3].pos.y = v45; pBillboardRenderListD3D[v8].pQuards[3].texcoord.x = 1.0; diff -r 9cc972ebd3cf -r 4b06e19fcdbc SaveLoad.cpp --- a/SaveLoad.cpp Fri Mar 22 20:07:55 2013 +0200 +++ b/SaveLoad.cpp Fri Mar 22 23:42:21 2013 +0600 @@ -437,7 +437,6 @@ memcpy((void *)v9, &Src, 0x10); if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) { - __debugbreak(); pIndoor->dlv.uNumFacesInBModels = pIndoor->uNumFaces; pIndoor->dlv.uNumBModels = 0; pIndoor->dlv.uNumDecorations = uNumLevelDecorations; diff -r 9cc972ebd3cf -r 4b06e19fcdbc Vis.cpp --- a/Vis.cpp Fri Mar 22 20:07:55 2013 +0200 +++ b/Vis.cpp Fri Mar 22 23:42:21 2013 +0600 @@ -28,25 +28,8 @@ { char *v4; // eax@4 signed int v5; // ecx@4 - //BLVFace *v6; // ecx@7 - //unsigned int v7; // edi@7 - Vec3_short_ *v8; // eax@9 - char *v9; // edx@9 - signed int v10; // esi@10 - //Vec3_int_ **v11; // edx@13 - //char *v12; // eax@13 - //double v13; // st7@14 - //signed int v14; // ebx@14 - //Vis *v15; // ebx@15 - //Vis_ObjectInfo *result; // eax@21 - //Vis_ObjectInfo *v17; // ecx@24 RenderVertexSoft pRay[2]; // [sp+20h] [bp-70h]@17 int v20; // [sp+84h] [bp-Ch]@10 - //int v21; // [sp+88h] [bp-8h]@16 - //int v22; // [sp+8Ch] [bp-4h]@16 - signed int v23; // [sp+98h] [bp+8h]@7 - - //auto ecx0 = this; static Vis_SelectionList static_sub_4C1026_stru_F8FE00; static_sub_4C1026_stru_F8FE00.uNumPointers = 0; @@ -60,28 +43,16 @@ static_sub_4C1026_array_F8F200[i].flt_2C = 0.0f; } - //v6 = a2; - v23 = 0; - //v7 = face->uNumVertices; if (uCurrentlyLoadedLevelType == LEVEL_Indoor) { - __debugbreak(); // refactor for BLV picking if ( (signed int)face->uNumVertices > 0 ) { - v8 = pIndoor->pVertices; - v9 = (char *)&static_sub_4C1026_array_F8F200[0].vWorldPosition.y; - do + for ( int i = 0; i < face->uNumVertices; i++) { - v10 = v23++; - v20 = v8[face->pVertexIDs[v10]].x; - *((float *)v9 - 1) = (double)v20; - v20 = v8[face->pVertexIDs[v10]].y; - *(float *)v9 = (double)v20; - v9 += 48; - v20 = v8[face->pVertexIDs[v10]].z; - *((float *)v9 - 11) = (double)v20; + static_sub_4C1026_array_F8F200[i].vWorldPosition.x = (double)pIndoor->pVertices[face->pVertexIDs[i]].x; + static_sub_4C1026_array_F8F200[i].vWorldPosition.y = (double)pIndoor->pVertices[face->pVertexIDs[i]].y; + static_sub_4C1026_array_F8F200[i].vWorldPosition.z = (double)pIndoor->pVertices[face->pVertexIDs[i]].z; } - while ( v23 < (signed int)face->uNumVertices ); } } else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) @@ -329,53 +300,45 @@ void Vis::PickIndoorFaces_Mouse(float fDepth, RenderVertexSoft *pRay, Vis_SelectionList *list, Vis_SelectionFilter *filter) { int v5; // eax@1 - signed int v6; // edi@2 - signed int v7; // esi@4 + signed int pFaceID; // edi@2 int v8; // ecx@7 int v9; // eax@7 unsigned int *pNumPointers; // eax@7 unsigned int v11; // ecx@7 Vis_ObjectInfo *v12; // edi@7 RenderVertexSoft a1; // [sp+Ch] [bp-44h]@1 - BLVFace *v14; // [sp+3Ch] [bp-14h]@7 + BLVFace *pFace; // [sp+3Ch] [bp-14h]@7 void *v15; // [sp+40h] [bp-10h]@7 - int v16; // [sp+44h] [bp-Ch]@7 int v17; // [sp+48h] [bp-8h]@1 - Vis *thisa; // [sp+4Ch] [bp-4h]@1 - - - __debugbreak(); // refactor for BLV picking v5 = 0; - thisa = this; v17 = 0; for ( a1.flt_2C = 0.0; v17 < (signed int)pBspRenderer->num_faces; ++v17 ) { - v6 = pBspRenderer->faces[v5].uFaceID; - if ( v6 >= 0 ) + pFaceID = pBspRenderer->faces[v5].uFaceID; + if ( pFaceID >= 0 ) { - if ( v6 < (signed int)pIndoor->uNumFaces ) + if ( pFaceID < (signed int)pIndoor->uNumFaces ) { - v7 = v6; - if ( is_part_of_selection(&pIndoor->pFaces[v6], filter) ) + if ( is_part_of_selection(&pIndoor->pFaces[pFaceID], filter) ) { - if ( !pGame->pIndoorCameraD3D->IsCulled(&pIndoor->pFaces[v7]) ) + if ( !pGame->pIndoorCameraD3D->IsCulled(&pIndoor->pFaces[pFaceID]) ) { - if ( Intersect_Ray_Face(pRay, pRay + 1, &fDepth, &a1, &pIndoor->pFaces[v7], 0xFFFFFFFFu) ) + if ( Intersect_Ray_Face(pRay, pRay + 1, &fDepth, &a1, &pIndoor->pFaces[pFaceID], 0xFFFFFFFFu) ) { - pGame->pIndoorCameraD3D->ViewTransform(&a1, 1u); + pGame->pIndoorCameraD3D->ViewTransform(&a1, 1); v9 = _48B561_mess_with_scaling_along_z(/*v8, */a1.vWorldViewPosition.x); LOWORD(v9) = 0; - v15 = (void *)((8 * v6 | 6) + v9); + v15 = (void *)((8 * pFaceID | 6) + v9); pNumPointers = &list->uNumPointers; - v16 = 2; - v11 = list->uNumPointers; - v14 = &pIndoor->pFaces[v7]; - v12 = &list->object_pool[v11]; - v12->object = &pIndoor->pFaces[v7]; + //v16 = 2; + //v11 = list->uNumPointers; + pFace = &pIndoor->pFaces[pFaceID]; + v12 = &list->object_pool[list->uNumPointers]; + v12->object = &pIndoor->pFaces[pFaceID]; v12 = (Vis_ObjectInfo *)((char *)v12 + 4); v12->object = v15; - v12->sZValue = v16; + v12->sZValue = 2; ++*pNumPointers; } } @@ -1837,33 +1800,28 @@ void Vis::PickIndoorFaces_Keyboard(float pick_depth, Vis_SelectionList *list, Vis_SelectionFilter *filter) { int result; // eax@1 - signed int v5; // esi@2 - BLVFace *v6; // edi@4 + signed int pFaceID; // esi@2 + BLVFace *pFace; // edi@4 unsigned int v7; // eax@6 Vis_ObjectInfo *v8; // eax@6 - //int v9; // ST18_4@7 - //unsigned int v10; // ST1C_4@7 - //unsigned int v11; // ecx@7 signed int i; // [sp+18h] [bp-8h]@1 - Vis *thisa; // [sp+1Ch] [bp-4h]@1 result = 0; - thisa = this; for ( i = 0; i < (signed int)pBspRenderer->num_faces; ++i ) { - v5 = pBspRenderer->faces[result].uFaceID; - if ( v5 >= 0 ) + pFaceID = pBspRenderer->faces[result].uFaceID; + if ( pFaceID >= 0 ) { - if ( v5 < (signed int)pIndoor->uNumFaces ) + if ( pFaceID < (signed int)pIndoor->uNumFaces ) { - v6 = &pIndoor->pFaces[v5]; - if ( !pGame->pIndoorCameraD3D->IsCulled(&pIndoor->pFaces[v5]) ) + pFace = &pIndoor->pFaces[pFaceID]; + if ( !pGame->pIndoorCameraD3D->IsCulled(&pIndoor->pFaces[pFaceID]) ) { - if ( is_part_of_selection(v6, filter) ) + if ( is_part_of_selection(pFace, filter) ) { - v7 = 8 * v5; - LOBYTE(v7) = 8 * v5 | OBJECT_BModel; - v8 = _4C1026(v6, v7, pick_depth); + v7 = 8 * pFaceID; + LOBYTE(v7) = 8 * pFaceID | OBJECT_BModel; + v8 = _4C1026(pFace, v7, pick_depth); if ( v8 ) list->AddObject(v8->object, v8->object_type, v8->sZValue); } diff -r 9cc972ebd3cf -r 4b06e19fcdbc mm7_3.cpp --- a/mm7_3.cpp Fri Mar 22 20:07:55 2013 +0200 +++ b/mm7_3.cpp Fri Mar 22 23:42:21 2013 +0600 @@ -493,7 +493,6 @@ } - //----- (0046ED1B) -------------------------------------------------------- int _46ED1B_collide_against_floor(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID) { diff -r 9cc972ebd3cf -r 4b06e19fcdbc mm7_4.cpp --- a/mm7_4.cpp Fri Mar 22 20:07:55 2013 +0200 +++ b/mm7_4.cpp Fri Mar 22 23:42:21 2013 +0600 @@ -543,6 +543,8 @@ if ( v19 != 3 ) { if ( !v19 ) + ++v48; + else { LODWORD(v23) = (Y - word_720F70[i]) << 16; HIDWORD(v23) = (Y - word_720F70[i]) >> 16;