Mercurial > mm7
changeset 1176:dac817fbf85a
Слияние
author | Ritor1 |
---|---|
date | Mon, 03 Jun 2013 09:32:05 +0600 |
parents | 9e3bacdbec56 (diff) 8ce08eea96ed (current diff) |
children | ce5ff6d32200 |
files | Render.cpp Vis.cpp |
diffstat | 2 files changed, 104 insertions(+), 80 deletions(-) [+] |
line wrap: on
line diff
--- a/Render.cpp Sun Jun 02 22:16:58 2013 +0400 +++ b/Render.cpp Mon Jun 03 09:32:05 2013 +0600 @@ -904,7 +904,7 @@ int v30; // ecx@64 int v31; // ecx@68 int v32; // eax@70 - int v33; // ecx@71 + //int v33; // ecx@71 int v34; // eax@73 int v35; // ecx@77 int v36; // ecx@81 @@ -913,7 +913,7 @@ int v39; // ecx@88 int v40; // eax@90 int v41; // edx@94 - int v42; // ecx@95 + //int v42; // ecx@95 int v43; // ecx@98 int v44; // ecx@102 int v45; // eax@104 @@ -931,7 +931,7 @@ int v57; // ecx@140 int v58; // eax@142 int v59; // ecx@146 - int v60; // ecx@147 + //int v60; // ecx@147 int v61; // ecx@150 int v62; // ecx@155 int v63; // eax@157 @@ -946,7 +946,7 @@ //int v72; // ecx@178 //int x; // ebx@180 //int v74; // eax@182 - int v75; // eax@184 + //int v75; // eax@184 IndoorCameraD3D *pIndoorCameraD3D_3; // ecx@184 int uStartZ; // ecx@184 int v79; // ebx@185 @@ -992,11 +992,11 @@ v105 = pIndoorCamera->sRotationY / ((signed int)stru_5C6E00->uIntegerHalfPi / 2);//2 pDirectionIndicator1 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerDoublePi - pIndoorCamera->sRotationY);//1536 pDirectionIndicator2 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1);//512 - v124 = ((pIndoorCamera->uMapGridCellX << 16) + 3 * stru_5C6E00->Cos(stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1))) >> 16; - v123 = ((pIndoorCamera->uMapGridCellZ << 16) + 3 * stru_5C6E00->Sin(pDirectionIndicator2)) >> 16; + v124 = ((pIndoorCamera->uMapGridCellX << 16) + 3 * stru_5C6E00->Cos(stru_5C6E00->uDoublePiMask & (stru_5C6E00->uIntegerPi + pDirectionIndicator1))) >> 16;//88 + v123 = ((pIndoorCamera->uMapGridCellZ << 16) + 3 * stru_5C6E00->Sin(pDirectionIndicator2)) >> 16;// 66 v120 = pOutdoorCamera->outdoor_grid_band_3 + v124;//+- range X v119 = pOutdoorCamera->outdoor_grid_band_3 + v123; - v2 = pOutdoorCamera->uCameraFovInDegrees + 15; + v2 = pOutdoorCamera->uCameraFovInDegrees + 15;//90 i = v124 - pOutdoorCamera->outdoor_grid_band_3; v122 = v123 - pOutdoorCamera->outdoor_grid_band_3; @@ -1005,42 +1005,50 @@ v3 = (v2 << 11) / 720; v4 = stru_5C6E00->uDoublePiMask & (pDirectionIndicator1 - v3); v5 = stru_5C6E00->uDoublePiMask & (v3 + pDirectionIndicator1); + v106 = stru_5C6E00->Cos(v4); uEndZ = stru_5C6E00->Sin(v4); + v111 = stru_5C6E00->Cos(v5); v6 = stru_5C6E00->Sin(v5); + v7 = v4 & stru_5C6E00->uPiMask; - if ( (v4 & stru_5C6E00->uPiMask) >= stru_5C6E00->uIntegerHalfPi ) v8 = -stru_5C6E00->pTanTable[stru_5C6E00->uIntegerPi - v7]; else v8 = stru_5C6E00->pTanTable[v7]; v112 = abs(v8); + v9 = v5 & stru_5C6E00->uPiMask; if ( (v5 & stru_5C6E00->uPiMask) >= stru_5C6E00->uIntegerHalfPi ) v10 = -stru_5C6E00->pTanTable[stru_5C6E00->uIntegerPi - v9]; else v10 = stru_5C6E00->pTanTable[v9]; v108 = abs(v10); + //v11 = v124; //v12 = v123; v114 = 0; v115 = 0; pIndoorCameraD3D_4 = 0; v125 = 0; - v110 = (v106 >= 0 ? 1: -1);//2 * (v106 >= 0) - 1; v126 = v124; v118 = v123; + + v110 = (v106 >= 0 ? 1: -1);//2 * (v106 >= 0) - 1; v109 = (uEndZ >= 0 ? 1: -1);//2 * (v107 >= 0) - 1; uEndZ = (v111 >= 0 ? 1: -1);//2 * (v111 >= 0) - 1; - terrain_76E1C8[0] = 65535; + v106 = (v6 >= 0 ? 1: -1);//2 * (v6 >= 0) - 1; + uint _i = 1; - v106 = (v6 >= 0 ? 1: -1);//2 * (v6 >= 0) - 1; uint j = 1; - terrain_76E3C8[0] = 65535; - terrain_76DDC8[0] = 65535; - terrain_76DFC8[0] = 65535; - for( _i = 1; _i < 128; _i++) + + terrain_76DDC8[0] = -1; + terrain_76DFC8[0] = -1; + terrain_76E1C8[0] = -1; + terrain_76E3C8[0] = -1; + + for( uint _i = 1; _i < 128; _i++) { if ( v112 >= 0x10000 ) { @@ -1112,6 +1120,7 @@ v126 = 0; v17 = j - 1; v18 = _i - 1; + switch ( v105 ) { case 0: @@ -1223,13 +1232,8 @@ { v106 = v122; memset32(terrain_76DBC8, v120 + 1, 4 * (terrain_76DDC8[v17] - v122 + 1)); - v32 = v122; - do - { - v33 = v126++; - terrain_76D9C8[v33] = v32++; - } - while ( v32 <= terrain_76DDC8[v17] ); + for ( v32 = v122; v32 <= terrain_76DDC8[v17]; v32++) + terrain_76D9C8[v126++] = v32; if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] ) { do @@ -1296,10 +1300,9 @@ v41 = terrain_76E1C8[v18]; while ( v41 <= v123 ) { - v42 = terrain_76E3C8[v18]; terrain_76D5C8[v16] = v41; - terrain_76D7C8[v16] = v42; - if ( v42 == 65535 ) + terrain_76D7C8[v16] = terrain_76E3C8[v18]; + if ( terrain_76E3C8[v18] == 65535 ) { terrain_76D7C8[v16] = v124; break; @@ -1326,10 +1329,8 @@ { v106 = v119; memset32(terrain_76DBC8, i, 4 * (v119 - terrain_76DDC8[v17] + 1)); - v45 = v119; - do - terrain_76D9C8[v126++] = v45--; - while ( v45 >= terrain_76DDC8[v17] ); + for ( v45 = v119; v45 >= terrain_76DDC8[v17]; v45--) + terrain_76D9C8[v126++] = v45; if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] ) { do @@ -1450,9 +1451,9 @@ if ( v59 > v124 ) break; terrain_76DBC8[v16] = v59; - v60 = terrain_76DDC8[v17]; - terrain_76D9C8[v16] = v60; - if ( v60 == 65535 ) + //v60 = terrain_76DDC8[v17]; + terrain_76D9C8[v16] = terrain_76DDC8[v17]; + if ( terrain_76DDC8[v17] == 65535 ) { terrain_76D9C8[v16] = v123; break; @@ -1549,30 +1550,33 @@ //v74 = terrain_76D7C8[i]; if ( terrain_76D7C8[i] <= 0 ) terrain_76D7C8[i] = -terrain_76D7C8[i]; - v75 = terrain_76D7C8[i] + 2; + uEndZ = terrain_76D7C8[i] + 2; //pIndoorCameraD3D_3 = pGame->pIndoorCameraD3D; - uEndZ = v75; + //uEndZ = v75; //pIndoorCameraD3D_4 = pIndoorCameraD3D_3; uStartZ = terrain_76DBC8[i] - 2; - if ( terrain_76DBC8[i] - 2 < v75 ) + if ( terrain_76DBC8[i] - 2 < uEndZ ) { v127 = 0; //v79 = (v73 - 66) << 9; //v116 = v77; //pHeight = v79; - v111 = v75 - uStartZ; + v111 = uEndZ - uStartZ; for (int z = uStartZ; z < uEndZ; ++z) { ptr_801A08[v127].vWorldPosition.x = (-64 + terrain_76DBC8[i]) * 512;//pTerrainVertices[z * 128 + x].vWorldPosition.x = (-64 + (signed)x) * 512; ptr_801A08[v127].vWorldPosition.y = (64 - terrain_76D9C8[i]) * 512; ptr_801A08[v127].vWorldPosition.z = pOutdoor->GetHeightOnTerrain( z, terrain_76D9C8[i]); + ptr_801A04[v127].vWorldPosition.x = (-64 + terrain_76DBC8[i]) * 512; ptr_801A04[v127].vWorldPosition.y = (63 - terrain_76D9C8[i]) * 512; ptr_801A04[v127].vWorldPosition.z = pOutdoor->GetHeightOnTerrain( z, terrain_76D9C8[i] + 1); + if ( !byte_4D864C || !(pGame->uFlags & 0x80) ) { pIndoorCameraD3D_4->ViewTransform(&ptr_801A08[v127], 1); pIndoorCameraD3D_4->ViewTransform(&ptr_801A04[v127], 1); + pIndoorCameraD3D_4->Project(&ptr_801A08[v127], 1, 0); pIndoorCameraD3D_4->Project(&ptr_801A04[v127], 1, 0); } @@ -1586,7 +1590,8 @@ v103 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[i]); v104 = abs((int)pIndoorCamera->uMapGridCellX - terrain_76DBC8[i]); if ( pRenderer->pRenderD3D )//Ritor1: do comment to test - Render::DrawTerrainD3D(v111, 0, v103, v104);//Render::RenderTerrainD3D(); + Render::DrawTerrainD3D(v111, 0, v103, v104); + //Render::RenderTerrainD3D(); else Render::DrawTerrainSW(v111, 0, v103, v104); } @@ -1622,18 +1627,12 @@ //do for ( v116 = terrain_76D9C8[i] - 2; v116 < v107; ++v116 ) { - //v93 = v116; - //v106 = (*(int *)((char *)terrain_76DBC8 + v86) - 64) << 9; ptr_801A08[v86].vWorldPosition.x = (terrain_76DBC8[v86] - 64) << 9; - //*(float *)&pHeight = (double)pHeight; ptr_801A08[v86].vWorldPosition.y = v92; - //v106 = ; - //v97 = v116; ptr_801A08[v86].vWorldPosition.z = pOutdoor->GetHeightOnTerrain(terrain_76DBC8[v86], v116); - //v106 = (*(int *)((char *)terrain_76DBC8 + v86) - 63) << 9; + ptr_801A04[v86].vWorldPosition.x = (terrain_76DBC8[v86] - 63) << 9; ptr_801A04[v86].vWorldPosition.y = v92; - //pHeight = pOutdoor->GetHeightOnTerrain(*(int *)((char *)terrain_76DBC8 + v86) + 1, v97); ptr_801A04[v86].vWorldPosition.z = pOutdoor->GetHeightOnTerrain(terrain_76DBC8[v86] + 1, v116); if ( !byte_4D864C || !(pGame->uFlags & 0x80) ) { @@ -1982,7 +1981,7 @@ v90 = (float)pOutdoor->vSunlight.x / 65536.0; v91 = (float)pOutdoor->vSunlight.y / 65536.0; v92 = (float)pOutdoor->vSunlight.z / 65536.0; - if ( a1 - 1 > 0 ) +/* if ( a1 - 1 > 0 ) { while ( 1 ) { @@ -2012,11 +2011,11 @@ !byte_4D864C) || !(pGame->uFlags & 0x80)) && !sub_481EFA(v8, v9, v101, pVertices, 1)) )*/ - if ( !&stru_76E5C8[(v5 << 7) + v6] ) - goto LABEL_162; + /*if ( !&stru_76E5C8[(v5 << 7) + v6] ) + goto LABEL_162*/ v8 = &pVerticesSR_806210[v4]; - pVertices2 = &pVerticesSR_801A10[v4 + 1]; - v102 = v8; + //pVertices2 = &pVerticesSR_801A10[v4 + 1]; + //v102 = v8; if (!v82) { pVertices = &pVerticesSR_801A10[v4]; @@ -2031,12 +2030,12 @@ sY = floorf(v8->vWorldPosition.z + 0.5f); v89 = WorldPosToGridCellX(floorf((v101->vWorldPosition.x + v8->vWorldPosition.x) / 2 + 0.5f)); v97 = WorldPosToGridCellZ(floorf((pVertices->vWorldPosition.z + v8->vWorldPosition.z) / 2 + 0.5f)); - WorldPosToGridCellX(sX); + /*WorldPosToGridCellX(sX); WorldPosToGridCellZ(sY); if ((!byte_4D864C || !(pGame->uFlags & 0x80)) && !sub_481EFA(v8, pVertices, v101, pVertices2, 1)) if ( v8->vWorldPosition.y != pVertices->vWorldPosition.y || pVertices->vWorldPosition.y != pVertices2->vWorldPosition.y || pVertices2->vWorldPosition.y != v101->vWorldPosition.y ) - break; + break;*/ v16 = &array_77EC08[pOutdoorCamera->numStru148s]; v16->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY); if ( v16->uTileBitmapID != -1 ) @@ -2174,7 +2173,7 @@ if ( ++v88 >= v84 ) return; } - v40 = &array_77EC08[pOutdoorCamera->numStru148s]; + /* v40 = &array_77EC08[pOutdoorCamera->numStru148s]; v40->uTileBitmapID = pOutdoor->GetTileTexture(sX, sY); if ( v40->uTileBitmapID == -1 ) goto LABEL_162; @@ -2211,7 +2210,7 @@ --pOutdoorCamera->numStru148s; goto LABEL_112; }*/ - memcpy(&array_50AC10[0], v102, 0x30u); + /*memcpy(&array_50AC10[0], v102, 0x30u); array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); array_50AC10[0].u = 0.0; array_50AC10[0].v = 0.0; @@ -2236,7 +2235,7 @@ stru148(stru_76D590); atexit(loc_48118F); }*/ - v96 = pGame->pLightmapBuilder; + /*v96 = pGame->pLightmapBuilder; pGame->pLightmapBuilder->StackLights_TerrainFace(v48, (float *)&a4, array_50AC10, 3, 0); pDecalBuilder->_49BE8A(v40, v48, &a4, array_50AC10, 3, 0); uNumVertices = 3; @@ -2359,7 +2358,7 @@ __init_flag1 = true; stru154::stru154(&static_sub_0048034E_stru_76D578); }*/ - v96 = pGame->pLightmapBuilder; + /* v96 = pGame->pLightmapBuilder; pGame->pLightmapBuilder->StackLights_TerrainFace(v63, &v87, array_50AC10, 3, 1); pDecalBuilder->_49BE8A(v40, v63, &v87, array_50AC10, 3, 1); v100 = 3; @@ -2439,7 +2438,7 @@ OutdoorCamera::Project(v73); goto LABEL_154; } - } + }*/ // 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int); // 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int); // 4D864C: using guessed type char byte_4D864C;
--- a/Vis.cpp Sun Jun 02 22:16:58 2013 +0400 +++ b/Vis.cpp Mon Jun 03 09:32:05 2013 +0600 @@ -34,8 +34,8 @@ RenderVertexSoft pRay[2]; // [sp+20h] [bp-70h]@17 int v20; // [sp+84h] [bp-Ch]@10 - static Vis_SelectionList SelectedPointersList; - SelectedPointersList.uNumPointers = 0; + static Vis_SelectionList SelectionFacetIntersectionList;//stru_F8FE00 + SelectionFacetIntersectionList.uNumPointers = 0; static bool _init_flag = false; static RenderVertexSoft static_DetermineFacetIntersection_array_F8F200[64]; @@ -74,7 +74,6 @@ pGame->pIndoorCameraD3D->ViewTransform(static_DetermineFacetIntersection_array_F8F200, face->uNumVertices); pGame->pIndoorCameraD3D->Project(static_DetermineFacetIntersection_array_F8F200, face->uNumVertices, 1); - //v15 = this; SortVectors_x(static_DetermineFacetIntersection_array_F8F200, 0, face->uNumVertices - 1); if (static_DetermineFacetIntersection_array_F8F200[0].vWorldViewPosition.x > pick_depth) return nullptr; @@ -88,21 +87,21 @@ CastPickRay(pRay, screenspace_center_x, screenspace_center_y, pick_depth); if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) - PickOutdoorFaces_Mouse(pick_depth, pRay, &SelectedPointersList, &vis_face_filter, true); + PickOutdoorFaces_Mouse(pick_depth, pRay, &SelectionFacetIntersectionList, &vis_face_filter, true); else if (uCurrentlyLoadedLevelType == LEVEL_Indoor) - PickIndoorFaces_Mouse(pick_depth, pRay, &SelectedPointersList, &vis_face_filter); + PickIndoorFaces_Mouse(pick_depth, pRay, &SelectionFacetIntersectionList, &vis_face_filter); else assert(false); - SelectedPointersList.create_object_pointers(); - sort_object_pointers(SelectedPointersList.object_pointers, 0, SelectedPointersList.uNumPointers - 1); - if (!SelectedPointersList.uNumPointers) + SelectionFacetIntersectionList.create_object_pointers(); + sort_object_pointers(SelectionFacetIntersectionList.object_pointers, 0, SelectionFacetIntersectionList.uNumPointers - 1); + if (!SelectionFacetIntersectionList.uNumPointers) return nullptr; - if (!SelectedPointersList.SelectionPointers(VisObjectType_Face, pid)) + if (!SelectionFacetIntersectionList.sub_4C2551(VisObjectType_Face, pid)) return nullptr; - if (SelectedPointersList.uNumPointers) - return SelectedPointersList.object_pointers[0]; + if (SelectionFacetIntersectionList.uNumPointers) + return SelectionFacetIntersectionList.object_pointers[0]; else return nullptr; } // F91E08: using guessed type char static_DetermineFacetIntersection_byte_F91E08__init_flags; @@ -900,8 +899,14 @@ } //----- (004C2551) -------------------------------------------------------- -Vis_ObjectInfo *Vis_SelectionList::SelectionPointers(int pVisObjectType, int pid) +Vis_ObjectInfo *Vis_SelectionList::sub_4C2551(int pVisObjectType, int pid) { + //unsigned int v3; // esi@1 + //signed int v4; // edx@1 + //char *v5; // eax@2 + //Vis_ObjectInfo *result; // eax@6 + + //v3 = this->uNumPointers; if ( this->uNumPointers > 0 ) { for ( uint i = 0; i < this->uNumPointers; ++i ) @@ -911,6 +916,22 @@ } } return false; + /*v4 = 0; + if ( this->uNumPointers <= 0 ) + return false; + else + { + //v5 = (char *)&this->object_pool[0].sZValue; + while ( this->object_pool[v4].object_type != a2 || (this->object_pool[v4].sZValue & 0xFFFF) != a3 ) + { + ++v4; + //v5 += 12; + if ( v4 >= this->uNumPointers ) + return false; + } + result = &this->object_pool[v4]; + } + return result;*/ } //----- (004C2591) -------------------------------------------------------- @@ -958,33 +979,36 @@ //int v5; // ebx@1 int v6; // esi@2 signed int i; // ecx@2 - //int v8; // eax@3 + int v8; // eax@3 //int v9; // ebx@4 - //int v10; // ebx@6 + int v10; // ebx@6 Vis_ObjectInfo *v11; // eax@7 //Vis *thisa; // [sp+4h] [bp-4h]@1 - //Vis_ObjectInfo *a3a; // [sp+14h] [bp+Ch]@2 + Vis_ObjectInfo *a3a; // [sp+14h] [bp+Ch]@2 //v4 = left; //v5 = right; //thisa = this; - if ( right > left ) + if ( right > left )//left == 0 { - do + //do + for ( left; right > left; ++left ) { - v6 = left - 1; + v6 = left; //a3a = pPointers[right]; for ( i = right; ; pPointers[i] = v11 ) { - //v8 = a3a->sZValue; - //LOWORD(v8) = 0; - do + v8 = a3a->sZValue; + LOWORD(v8) = 0; + + //do + while ( pPointers[v6]->sZValue < pPointers[right]->sZValue ); { ++v6; //v9 = pPointers[v6]->sZValue; //LOWORD(v9) = 0; } - while ( pPointers[v6]->sZValue < pPointers[right]->sZValue ); + do { if ( i < 1 ) @@ -994,6 +1018,7 @@ //LOWORD(v10) = 0; } while ( pPointers[i]->sZValue > pPointers[right]->sZValue ); + v11 = pPointers[v6]; if ( v6 >= i ) break; @@ -1003,9 +1028,9 @@ pPointers[v6] = pPointers[right]; pPointers[right] = v11; sort_object_pointers(pPointers, left, v6 - 1); - left = v6 + 1; + //left = v6 + 1; } - while ( right > v6 + 1 ); + //while ( right > left ); } }