Mercurial > mm7
changeset 1049:efe228ab5003
IntersectBModel_sub
author | Ritor1 |
---|---|
date | Thu, 23 May 2013 13:00:29 +0600 |
parents | d36681a9e4f8 |
children | 4b329bf2d197 |
files | Player.cpp Vis.cpp Vis.h |
diffstat | 3 files changed, 87 insertions(+), 214 deletions(-) [+] |
line wrap: on
line diff
--- a/Player.cpp Thu May 23 11:17:01 2013 +0600 +++ b/Player.cpp Thu May 23 13:00:29 2013 +0600 @@ -5224,7 +5224,7 @@ v15 = pItemsTable->pItems[v29].uDamageMod; v14 = pItemsTable->pItems[v29].uDamageDice * pItemsTable->pItems[v29].uDamageRoll; v5 += v15 + v14; - return v5 + v62 + v61 + return v5 + v62 + v61; } v59 = 3; LABEL_74:
--- a/Vis.cpp Thu May 23 11:17:01 2013 +0600 +++ b/Vis.cpp Thu May 23 13:00:29 2013 +0600 @@ -369,8 +369,6 @@ auto bmodel = &pOutdoor->pBModels[i]; for (uint j = 0; j < bmodel->uNumFaces; ++j) { - //if ( i == 77 && j == 17 )// - //__debugbreak();// auto face = &bmodel->pFaces[j]; if (is_part_of_selection(face, filter)) { @@ -549,144 +547,59 @@ //----- (004C1C0C) -------------------------------------------------------- bool Vis::Intersect_Ray_Face(RenderVertexSoft *pRayStart, RenderVertexSoft *pRayEnd, float *pDepth, RenderVertexSoft *Intersection, BLVFace *pFace, unsigned int pBModelID) { - //BLVFace *v7; // ebx@1 - //bool result; // eax@1 - double v9; // st7@3 - //__int16 v10; // fps@3 - //char v11; // c0@3 - //char v12; // c2@3 - //char v13; // c3@3 - //__int16 v14; // fps@5 - //char v15; // c0@5 - //char v16; // c2@5 - //char v17; // c3@5 - double c1; // st5@6 - //__int16 v19; // fps@6 - //char v20; // c0@6 - //char v21; // c2@6 - //char v22; // c3@6 - //unsigned __int8 v23; // c0@6 - //char v24; // c2@6 - //unsigned __int8 v25; // c3@6 - //char v26; // zf@6 - double v27; // st6@10 - //__int16 v28; // fps@10 - //unsigned __int8 v29; // c0@10 - //char v30; // c2@10 - //unsigned __int8 v31; // c3@10 - double c2; // st7@11 - //Vec2_short_ v33; // ST1E_4@11 - Vec3_short_ v34; // ST04_6@11 - //float a5a; // [sp+30h] [bp+18h]@10 - //float a5b; // [sp+30h] [bp+18h]@13 + float c1; // st5@6 + float c2; // st7@11 + Vec3_short_ IntersectPoint; // ST04_6@11 + if (pFace->Portal() || pFace->Invisible()) return false; - int ray_dir_x = pRayEnd->vWorldPosition.x - pRayStart->vWorldPosition.x,//dir_x y z это вектор направления - ray_dir_y = pRayEnd->vWorldPosition.y - pRayStart->vWorldPosition.y,//точка В - точка А = вектор из А в В + int ray_dir_x = pRayEnd->vWorldPosition.x - pRayStart->vWorldPosition.x,//calculate the direction vector of the line(вычислим вектор направления линий) + ray_dir_y = pRayEnd->vWorldPosition.y - pRayStart->vWorldPosition.y, ray_dir_z = pRayEnd->vWorldPosition.z - pRayStart->vWorldPosition.z; - /*v9 = ray_dir_z * pFace->pFacePlane.vNormal.z - + ray_dir_y * pFace->pFacePlane.vNormal.y//скалярное произведение направления луча и нормали к полигону - + ray_dir_x * pFace->pFacePlane.vNormal.x;//= косинус угла между двумя векторами - if (v9 >= 0) // ray faces face's normal ( > 0) or parallel ( == 0) - return false;*/ - -//ray = t dir + start -//plane = (p - vertex) normal = -d -// -// -//(t dir + start - vertex) normal = -d -// -// -d - (start - vertex) norm -//t = -------------------- -// dir norm - - - /*float dir_mag = sqrtf(ray_dir_x * ray_dir_x + ray_dir_y * ray_dir_y + ray_dir_z * ray_dir_z);//модуль вектора - float ndir_x = ray_dir_x / dir_mag,//ndir - нормализованное направление - ndir_y = ray_dir_y / dir_mag,//В результате нормализации получается вектор, направление которого совпадает с исходным, а модуль равен единице (единичный вектор). - ndir_z = ray_dir_z / dir_mag;//Чтобы нормализовать произвольный вектор, достаточно разделить каждый компонент вектора на модуль вектора - - int face_center_x = (pFace->pBounding.x1 + pFace->pBounding.x2) / 2,//усреднённые координаты баундинга - face_center_y = (pFace->pBounding.y1 + pFace->pBounding.y2) / 2, - face_center_z = (pFace->pBounding.z1 + pFace->pBounding.z2) / 2; - - int to_plane_x = pRayStart->vWorldPosition.x - face_center_x,//вектор из глас к середине фейса - to_plane_y = pRayStart->vWorldPosition.y - face_center_y, - to_plane_z = pRayStart->vWorldPosition.z - face_center_z;*/ - - //float t = /*-pFace->pFacePlane.dist*/ - (to_plane_x * pFace->pFacePlane.vNormal.x + to_plane_y * pFace->pFacePlane.vNormal.y + to_plane_y * pFace->pFacePlane.vNormal.z) / - // (ndir_x * pFace->pFacePlane.vNormal.x + ndir_y * pFace->pFacePlane.vNormal.y + ndir_z * pFace->pFacePlane.vNormal.z);//насколько сильно луч из камеры отклоняется от луча до центра фейса -/* if (t <= *pDepth) - { - int intersection_x = pRayStart->vWorldPosition.x + ndir_x * t, - intersection_y = pRayStart->vWorldPosition.y + ndir_y * t, - intersection_z = pRayStart->vWorldPosition.z + ndir_z * t; - - if (intersection_x < pFace->pBounding.x1 || intersection_x > pFace->pBounding.x2 || - intersection_y < pFace->pBounding.y1 || intersection_y > pFace->pBounding.y2 || - intersection_z < pFace->pBounding.z1 || intersection_z > pFace->pBounding.z2) - return false; - - pFace->uAttributes |= 0x80000000; - return true; - } - - return false;*/ - - //c1 = -d-(n*p0) c1 = -pFace->pFacePlane.dist -(pFace->pFacePlane.vNormal.x * pRayStart->vWorldPosition.x + pFace->pFacePlane.vNormal.y * pRayStart->vWorldPosition.y + pFace->pFacePlane.vNormal.z * pRayStart->vWorldPosition.z); - //if (c1 > 0) - //return false; -#define EPSILON 0.000001 + if (c1 > 0) + return false; +#define EPSILON 1e-6 //c2 = n*u - c2 = pFace->pFacePlane.vNormal.x * ray_dir_y + c2 = pFace->pFacePlane.vNormal.x * ray_dir_y// get length of the line(Это дает нам длину линии) + pFace->pFacePlane.vNormal.y * ray_dir_x + pFace->pFacePlane.vNormal.z * ray_dir_z; if (c2 > -EPSILON && c2 < EPSILON) // ray faces face's normal ( > 0) or parallel ( == 0) return false; //t = -d-(n*p0)/n*u - double t = c1 / c2;//точка соприкосновения - - //if (t < 0 || t > 1) - //return false; + float t = c1 / c2;//How far is crossing the line in percent for 0 to 1(Как далеко пересечение линии в процентах от 0 до 1 ) - // p(t) = p0 + tu; - // p(t) - вектор указывающий в точку на плоскости - // p0 - начало вектора, точка наблюдателя, камеры - // t - - // u - вектор направления - Intersection->vWorldPosition.x = pRayStart->vWorldPosition.x + t * ray_dir_y;//12432 < X < 12656 - Intersection->vWorldPosition.y = pRayStart->vWorldPosition.y + t * ray_dir_x;//-96 < Y < 1088 - Intersection->vWorldPosition.z = pRayStart->vWorldPosition.z + t * ray_dir_z;//Z == 192 - - v34.x = (signed __int64)Intersection->vWorldPosition.x; - v34.y = (signed __int64)Intersection->vWorldPosition.y; - v34.z = (signed __int64)Intersection->vWorldPosition.z; - - if ( !_4C1D2B(pFace, v34, pBModelID) ) + if (t < 0 || t > 1) return false; - //a5b = v27; - //*pDepth = t; +// p(t) = p0 + tu; + Intersection->vWorldPosition.x = pRayStart->vWorldPosition.x + t * ray_dir_y;// add the interest to the start line(прибавляем процент линии к линии старта) + Intersection->vWorldPosition.y = pRayStart->vWorldPosition.y + t * ray_dir_x; + Intersection->vWorldPosition.z = pRayStart->vWorldPosition.z + t * ray_dir_z; + + IntersectPoint.x = (signed __int64)Intersection->vWorldPosition.x; + IntersectPoint.y = (signed __int64)Intersection->vWorldPosition.y; + IntersectPoint.z = (signed __int64)Intersection->vWorldPosition.z; + + if ( !IntersectBModel_sub(pFace, IntersectPoint, pBModelID) ) + return false; + + *pDepth = t;//Record the distance from the origin of the ray (Записываем дистанцию от начала луча) return true; } //----- (004C1D2B) -------------------------------------------------------- -bool Vis::_4C1D2B(BLVFace *pFace, Vec3_short_ a2, unsigned int uModelID) +bool Vis::IntersectBModel_sub(BLVFace *pFace, Vec3_short_ IntersectPoint, unsigned int uModelID) { - //BLVFace *v4; // esi@1 int v5; // esi@10 bool v6; // edi@10 - int v7; // ecx@12 - signed int v8; // edx@12 - signed int v9; // eax@13 signed int v10; // ebx@14 int v11; // edi@16 signed int v12; // ST28_4@18 @@ -695,114 +608,102 @@ int v15; // [sp+10h] [bp-Ch]@10 signed int v16; // [sp+18h] [bp-4h]@10 - //v4 = pFace; - if (a2.x < pFace->pBounding.x1 || a2.x > pFace->pBounding.x2 || - a2.y < pFace->pBounding.y1 || a2.y > pFace->pBounding.y2 || - a2.z < pFace->pBounding.z1 || a2.z > pFace->pBounding.z2 ) + int a1 = 0, a2 = 0; + + if (IntersectPoint.x < pFace->pBounding.x1 || IntersectPoint.x > pFace->pBounding.x2 || + IntersectPoint.y < pFace->pBounding.y1 || IntersectPoint.y > pFace->pBounding.y2 || + IntersectPoint.z < pFace->pBounding.z1 || IntersectPoint.z > pFace->pBounding.z2 ) return false; pFace->uAttributes |= 0x80000000; - return true; + if (uModelID != -1) - _4C2186_BLV_IntersectBModel(pFace, uModelID, - word_F8BC48_displaced_face_intersect_plane_coords_a, - word_F8BD18_displaced_face_intersect_plane_coords_b, - &a2, pFace, uModelID); + ODM_IntersectBModel(&a1, &a2, word_F8BC48_displaced_face_intersect_plane_coords_a, word_F8BD18_displaced_face_intersect_plane_coords_b, + &IntersectPoint, pFace, uModelID); else - _4C1EE5_BLV_IntersectBModel_2((int *)&pFace, (int *)&uModelID, - word_F8BC48_displaced_face_intersect_plane_coords_a, - word_F8BD18_displaced_face_intersect_plane_coords_b, - &a2, pFace); - + BLV_IntersectBModel(&a1, &a2, word_F8BC48_displaced_face_intersect_plane_coords_a, word_F8BD18_displaced_face_intersect_plane_coords_b, + &IntersectPoint, pFace); v5 = 2 * pFace->uNumVertices; v16 = 0; word_F8BC48_displaced_face_intersect_plane_coords_a[v5] = word_F8BC48_displaced_face_intersect_plane_coords_a[0]; word_F8BD18_displaced_face_intersect_plane_coords_b[v5] = word_F8BD18_displaced_face_intersect_plane_coords_b[0]; - v15 = 0; - v6 = word_F8BD18_displaced_face_intersect_plane_coords_b[0] >= (signed int)uModelID; + v6 = word_F8BD18_displaced_face_intersect_plane_coords_b[0] >= a2; if (v5 <= 0) return false; - - do + for ( uint i = 0; i < v5; ++i ) { if ( v16 >= 2 ) break; - v7 = 2 * v15; - v8 = word_F8BD18_displaced_face_intersect_plane_coords_b[ + v15 + 1]; - if ( v6 ^ v8 >= (signed int)uModelID ) + if ( v6 ^ word_F8BD18_displaced_face_intersect_plane_coords_b[i + 1] >= a2 ) { - v9 = word_F8BC48_displaced_face_intersect_plane_coords_a[v7/2 + 1]; - if ( v9 >= (signed int)pFace ) + if ( word_F8BC48_displaced_face_intersect_plane_coords_a[i + 1] >= a1 ) v10 = 0; else v10 = 2; - v11 = v10 | word_F8BC48_displaced_face_intersect_plane_coords_a[v7/2] < (signed int)pFace; + v11 = v10 | word_F8BC48_displaced_face_intersect_plane_coords_a[i] < a1; if ( v11 != 3 ) { if ( !v11 - || (v12 = v9 - word_F8BC48_displaced_face_intersect_plane_coords_a[v7/2], + || (v12 = word_F8BC48_displaced_face_intersect_plane_coords_a[i + 1] - word_F8BC48_displaced_face_intersect_plane_coords_a[i], LODWORD(v13) = v12 << 16, HIDWORD(v13) = v12 >> 16, - word_F8BC48_displaced_face_intersect_plane_coords_a[v7/2] - + ((signed int)(((unsigned __int64)(v13 / (v8 - word_F8BD18_displaced_face_intersect_plane_coords_b[v7/2]) - * (signed int)((uModelID - word_F8BD18_displaced_face_intersect_plane_coords_b[v7/2]) << 16)) >> 16) + 32768) >> 16) >= (signed int)pFace) ) + word_F8BC48_displaced_face_intersect_plane_coords_a[i] + + ((signed int)(((unsigned __int64)(v13 / (word_F8BD18_displaced_face_intersect_plane_coords_b[i + 1] - word_F8BD18_displaced_face_intersect_plane_coords_b[i]) + * (signed int)((a2 - word_F8BD18_displaced_face_intersect_plane_coords_b[i]) << 16)) >> 16) + 32768) >> 16) >= a1) ) ++v16; } } - ++v15; - v6 = v8 >= (signed int)uModelID; + v6 = word_F8BD18_displaced_face_intersect_plane_coords_b[i + 1] >= a2; } - while ( v15 < v5 ); result = 1; if ( v16 != 1 ) -LABEL_25: result = 0; return result; } //----- (004C1EE5) -------------------------------------------------------- -bool Vis::_4C1EE5_BLV_IntersectBModel_2(int *a1, int *a2, __int16 *a3, __int16 *a4, Vec3_short_ *a5, BLVFace *pFace) +bool Vis::BLV_IntersectBModel(int *a1, int *a2, __int16 *displaced_face_intersect_plane_coords_a, __int16 *displaced_face_intersect_plane_coords_b, Vec3_short_ *IntersectPoint, BLVFace *pFace) { if (pFace->uAttributes & FACE_XY_PLANE) { - *a1 = a5->x; - *a2 = a5->y; + *a1 = IntersectPoint->x; + *a2 = IntersectPoint->y; for (uint i = 0; i < pFace->uNumVertices; ++i) { - a3[2 * i] = pFace->pXInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].x; - a3[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].x; + displaced_face_intersect_plane_coords_a[2 * i] = pFace->pXInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].x; + displaced_face_intersect_plane_coords_a[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].x; - a4[2 * i] = pFace->pYInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].y; - a4[2 * i + 1] = pFace->pYInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].y; + displaced_face_intersect_plane_coords_b[2 * i] = pFace->pYInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].y; + displaced_face_intersect_plane_coords_b[2 * i + 1] = pFace->pYInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].y; } } else if (pFace->uAttributes & FACE_XZ_PLANE) { - *a1 = a5->x; - *a2 = a5->z; + *a1 = IntersectPoint->x; + *a2 = IntersectPoint->z; for (uint i = 0; i < pFace->uNumVertices; ++i) { - a3[2 * i] = pFace->pXInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].x; - a3[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].x; + displaced_face_intersect_plane_coords_a[2 * i] = pFace->pXInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].x; + displaced_face_intersect_plane_coords_a[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].x; - a4[2 * i] = pFace->pZInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].z; - a4[2 * i + 1] = pFace->pZInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].z; + displaced_face_intersect_plane_coords_b[2 * i] = pFace->pZInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].z; + displaced_face_intersect_plane_coords_b[2 * i + 1] = pFace->pZInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].z; } } else if (pFace->uAttributes & FACE_YZ_PLANE) { - *a1 = a5->y; - *a2 = a5->z; + *a1 = IntersectPoint->y; + *a2 = IntersectPoint->z; for (uint i = 0; i < pFace->uNumVertices; ++i) { - a3[2 * i] = pFace->pYInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].y; - a3[2 * i + 1] = pFace->pYInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].y; + displaced_face_intersect_plane_coords_a[2 * i] = pFace->pYInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].y; + displaced_face_intersect_plane_coords_a[2 * i + 1] = pFace->pYInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].y; - a4[2 * i] = pFace->pZInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].z; - a4[2 * i + 1] = pFace->pZInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].z; + displaced_face_intersect_plane_coords_b[2 * i] = pFace->pZInterceptDisplacements[i] + pIndoor->pVertices[pFace->pVertexIDs[i]].z; + displaced_face_intersect_plane_coords_b[2 * i + 1] = pFace->pZInterceptDisplacements[i + 1] + pIndoor->pVertices[pFace->pVertexIDs[i + 1]].z; } } else @@ -815,72 +716,48 @@ } //----- (004C2186) -------------------------------------------------------- -bool Vis::_4C2186_BLV_IntersectBModel(BLVFace *pFace, unsigned int ModelID, __int16 *displaced_face_intersect_plane_coords_a, __int16 *displaced_face_intersect_plane_coords_b, Vec3_short_ *a5, BLVFace *face, unsigned int uModelID) +bool Vis::ODM_IntersectBModel(int *a1, int *a2, __int16 *displaced_face_intersect_plane_coords_a, __int16 *displaced_face_intersect_plane_coords_b, Vec3_short_ *IntersectPoint, BLVFace *pFace, unsigned int uModelID) { - bool result; // eax@1 - //int *v9; // esi@1 - //unsigned int v10; // ecx@1 - //unsigned int v11; // edx@3 - //signed int v12; // ecx@4 - //__int16 v13; // si@4 - //__int16 *v14; // ecx@4 - unsigned int v15; // edx@8 - //signed int v16; // ecx@9 - __int16 v17; // si@9 - __int16 *v18; // ecx@9 - unsigned int v19; // edx@12 - //signed int v20; // ecx@13 - __int16 v21; // si@13 - __int16 *v22; // ecx@13 - //signed int a1a; // [sp+14h] [bp+8h]@1 - //__int16 *a5a; // [sp+24h] [bp+18h]@3 - __int16 *a5b; // [sp+24h] [bp+18h]@8 - __int16 *a5c; // [sp+24h] [bp+18h]@12 - - //result = (bool)a6; - //v9 = pFace; - //v10 = pFace->uAttributes; - //a1a = 0; if (pFace->uAttributes & FACE_XY_PLANE) { - pFace->pFacePlane.vNormal.x = a5->x; - pFace->pFacePlane.vNormal.y = a5->y; + *a1 = IntersectPoint->x; + *a2 = IntersectPoint->y; for (int i = 0; i < pFace->uNumVertices; ++i) { - displaced_face_intersect_plane_coords_a[2 * i] = pFace->pXInterceptDisplacements[i] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i]].x; - displaced_face_intersect_plane_coords_a[i * 2 + 1] = pFace->pXInterceptDisplacements[i + 1] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; + displaced_face_intersect_plane_coords_a[2 * i] = pFace->pXInterceptDisplacements[i] + pOutdoor->pBModels[uModelID].pVertices.pVertices[pFace->pVertexIDs[i]].x; + displaced_face_intersect_plane_coords_a[i * 2 + 1] = pFace->pXInterceptDisplacements[i + 1] + pOutdoor->pBModels[uModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; - displaced_face_intersect_plane_coords_b[2 * i] = pFace->pYInterceptDisplacements[i] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i]].y; - displaced_face_intersect_plane_coords_b[i * 2 + 1] = pFace->pYInterceptDisplacements[i + 1] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; + displaced_face_intersect_plane_coords_b[2 * i] = pFace->pYInterceptDisplacements[i] + pOutdoor->pBModels[uModelID].pVertices.pVertices[pFace->pVertexIDs[i]].y; + displaced_face_intersect_plane_coords_b[i * 2 + 1] = pFace->pYInterceptDisplacements[i + 1] + pOutdoor->pBModels[uModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; } } else if (pFace->uAttributes & FACE_XZ_PLANE) { - pFace->pFacePlane.vNormal.x = a5->x; - pFace->pFacePlane.vNormal.z = a5->z; + *a1 = IntersectPoint->x; + *a2 = IntersectPoint->z; for (int i = 0; i < pFace->uNumVertices; ++i) { - displaced_face_intersect_plane_coords_a[2 * i] = pFace->pXInterceptDisplacements[i] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i]].x; - displaced_face_intersect_plane_coords_a[i * 2 + 1] = pFace->pXInterceptDisplacements[i + 1] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; + displaced_face_intersect_plane_coords_a[2 * i] = pFace->pXInterceptDisplacements[i] + pOutdoor->pBModels[uModelID].pVertices.pVertices[pFace->pVertexIDs[i]].x; + displaced_face_intersect_plane_coords_a[i * 2 + 1] = pFace->pXInterceptDisplacements[i + 1] + pOutdoor->pBModels[uModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; - displaced_face_intersect_plane_coords_b[2 * i] = pFace->pZInterceptDisplacements[i] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i]].z; - displaced_face_intersect_plane_coords_b[i * 2 + 1] = pFace->pZInterceptDisplacements[i + 1] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].z; + displaced_face_intersect_plane_coords_b[2 * i] = pFace->pZInterceptDisplacements[i] + pOutdoor->pBModels[uModelID].pVertices.pVertices[pFace->pVertexIDs[i]].z; + displaced_face_intersect_plane_coords_b[i * 2 + 1] = pFace->pZInterceptDisplacements[i + 1] + pOutdoor->pBModels[uModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].z; } } else if (pFace->uAttributes & FACE_YZ_PLANE) { - pFace->pFacePlane.vNormal.y = a5->y; - pFace->pFacePlane.vNormal.z = a5->z; + *a1 = IntersectPoint->y; + *a2 = IntersectPoint->z; for (int i = 0; i < pFace->uNumVertices; ++i) { - displaced_face_intersect_plane_coords_a[2 * i] = pFace->pYInterceptDisplacements[i] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i]].y; - displaced_face_intersect_plane_coords_a[i * 2 + 1] = pFace->pYInterceptDisplacements[i + 1] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; + displaced_face_intersect_plane_coords_a[2 * i] = pFace->pYInterceptDisplacements[i] + pOutdoor->pBModels[uModelID].pVertices.pVertices[pFace->pVertexIDs[i]].y; + displaced_face_intersect_plane_coords_a[i * 2 + 1] = pFace->pYInterceptDisplacements[i + 1] + pOutdoor->pBModels[uModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; - displaced_face_intersect_plane_coords_b[2 * i] = pFace->pZInterceptDisplacements[i] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i]].z; - displaced_face_intersect_plane_coords_b[i * 2 + 1] = pFace->pZInterceptDisplacements[i + 1] + pOutdoor->pBModels[ModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].z; + displaced_face_intersect_plane_coords_b[2 * i] = pFace->pZInterceptDisplacements[i] + pOutdoor->pBModels[uModelID].pVertices.pVertices[pFace->pVertexIDs[i]].z; + displaced_face_intersect_plane_coords_b[i * 2 + 1] = pFace->pZInterceptDisplacements[i + 1] + pOutdoor->pBModels[uModelID].pVertices.pVertices[pFace->pVertexIDs[i + 1]].z; } } else assert(false); @@ -888,10 +765,6 @@ return true; } - - - - //----- (0046A0A1) -------------------------------------------------------- int UnprojectX(int x) {
--- a/Vis.h Thu May 23 11:17:01 2013 +0600 +++ b/Vis.h Thu May 23 13:00:29 2013 +0600 @@ -112,8 +112,8 @@ int get_picked_object_zbuf_val(); bool Intersect_Ray_Face(struct RenderVertexSoft *pRayStart, struct RenderVertexSoft *pRayEnd, float *pDepth, RenderVertexSoft *Intersection, BLVFace *pFace, unsigned int pBModelID); bool IntersectBModel_sub(BLVFace *pFace, Vec3_short_ IntersectPoint, unsigned int uModelID); - bool _4C1EE5_BLV_IntersectBModel_2(int *a1, int *a2, __int16 *a3, __int16 *a4, Vec3_short_ *a5, BLVFace *pFace); - bool _4C2186_BLV_IntersectBModel(BLVFace *pFace, unsigned int ModelID, __int16 *displaced_face_intersect_plane_coords_a, __int16 *displaced_face_intersect_plane_coords_b, Vec3_short_ *IntersectPoint, BLVFace *face, unsigned int uModelID); + bool BLV_IntersectBModel(int *a1, int *a2, __int16 *displaced_face_intersect_plane_coords_a, __int16 *displaced_face_intersect_plane_coords_b, Vec3_short_ *IntersectPoint, BLVFace *pFace); + bool ODM_IntersectBModel(int *a1, int *a2, __int16 *displaced_face_intersect_plane_coords_a, __int16 *displaced_face_intersect_plane_coords_b, Vec3_short_ *IntersectPoint, BLVFace *pFace, unsigned int uModelID); void CastPickRay(RenderVertexSoft *pRay, float fMouseX, float fMouseY, float fPickDepth); void sort_object_pointers(Vis_ObjectInfo **pPointers, int left, int right); bool SortVerticesByX(struct RenderVertexD3D3 *a2, unsigned int uStart, unsigned int uEnd);