Mercurial > mm7
diff mm7_4.cpp @ 792:41b4e9769863
Walking in BLV iproved drastically.
author | Nomad |
---|---|
date | Mon, 25 Mar 2013 07:32:38 +0200 |
parents | 346f7069676a |
children | 14beae4f1723 |
line wrap: on
line diff
--- a/mm7_4.cpp Mon Mar 25 05:27:18 2013 +0200 +++ b/mm7_4.cpp Mon Mar 25 07:32:38 2013 +0200 @@ -228,11 +228,11 @@ signed int v14; // ebx@14 int v15; // eax@16 //int v16; // edx@19 - int v17; // ST18_4@19 - signed int v18; // edx@19 - signed __int64 v19; // qtt@19 + //int v17; // ST18_4@19 + //signed int v18; // edx@19 + //signed __int64 v19; // qtt@19 int v21; // eax@27 - int v22; // ecx@29 + //int v22; // ecx@29 signed int v28; // eax@45 int v29; // ebx@47 int v30; // edx@49 @@ -243,7 +243,7 @@ signed int v35; // esi@56 int result; // eax@57 int v38; // edx@62 - int v44; // [sp+20h] [bp-20h]@10 + //int v44; // [sp+20h] [bp-20h]@10 bool v47; // [sp+24h] [bp-1Ch]@43 bool v48; // [sp+28h] [bp-18h]@10 bool v49; // [sp+28h] [bp-18h]@41 @@ -261,13 +261,14 @@ static __int16 word_721460_xs[104]; // idb auto pSector = &pIndoor->pSectors[uSectorID]; - v55 = 1; + v55 = 0; for (uint i = 0; i < pSector->uNumFloors; ++i) { auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]]; if (pFloor->Clickable()) continue; + assert(pFloor->uNumVertices); if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 && y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1) { @@ -278,52 +279,42 @@ word_721390_ys[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y; word_721390_ys[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; } - v44 = 2 * pFloor->uNumVertices; word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0]; word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0]; - v48 = word_721390_ys[0] >= y; + v50 = word_721390_ys[0] >= y; v53 = 0; - if ( pFloor->uNumVertices > 0 ) - { - for ( int i = 0; i < v44; i++ ) - { - if ( v53 >= 2 ) - break; - v50 = word_721390_ys[i + 1] >= y; + + for (uint j = 0; j < 2 * pFloor->uNumVertices - 1; ++j) + { + if (v53 >= 2) + break; + + v48 = v50; + v50 = word_721390_ys[j + 1] >= y; v13 = i; - if ( v48 != v50 ) + if (v48 == v50) + continue; + + v14 = word_721460_xs[j + 1] >= x ? 0 : 2; + v15 = v14 | word_721460_xs[j] < x; + + if (v15 == 3) + continue; + else if (!v15) + ++v53; + else { - v14 = word_721460_xs[i + 1] >= x ? 0 : 2; - v15 = v14 | word_721460_xs[i] < x; - - if ( !v15) - ++v53; - else - { - //v16 = word_721390_ys[i]; - v17 = word_721390_ys[i + 1] - word_721390_ys[i]; - v18 = y - word_721390_ys[i]; - LODWORD(v19) = v18 << 16; - HIDWORD(v19) = v18 >> 16; - if ((signed int)(((unsigned __int64)(((signed int)word_721460_xs[i + 1] - (signed int)word_721460_xs[i]) * v19 / v17) >> 16) + word_721460_xs[i]) >= x) + auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); + auto res = fixpoint_mul((signed int)word_721460_xs[j + 1] - (signed int)word_721460_xs[j], a_div_b); + + if (res + word_721460_xs[j] >= x) ++v53; - } - /*if ( v15 != 3 ) - { - if ( !v15 ) - { - LODWORD(v19) = (y - word_721390_ys[i]) << 16; - HIDWORD(v19) = (y - word_721390_ys[i]) >> 16; - v16 = ((((word_721460_xs[i + 1] - word_721460_xs[i]) * v19 / (word_721390_ys[i + 1] - word_721390_ys[i])) >> 16) + word_721460_xs[i]); - if ( v16 >= x) - ++v53; - } - }*/ } - v48 = v50; - } + } + + if ( v53 == 1 ) { if ( v55 >= 50 ) @@ -334,16 +325,16 @@ } else { - v21 = ((unsigned __int64)(pFloor->zCalc1 * (signed __int64)x) >> 16) + ((unsigned __int64)(pFloor->zCalc2 * (signed __int64)y) >> 16) - + HIWORD(pFloor->zCalc3); + v21 = fixpoint_mul(pFloor->zCalc1, x) + fixpoint_mul(pFloor->zCalc2, y) + (short)(pFloor->zCalc3 >> 16); } - v22 = v55++; - blv_floor_level[v22] = v21; - blv_floor_id[v22] = pSector->pFloors[i]; + blv_floor_level[v55] = v21; + blv_floor_id[v55] = pSector->pFloors[i]; + v55++; } - } - } - } + } + } + + if ( pSector->field_0 & 8 ) { for (uint i = 0; i < pSector->uNumPortals; ++i)