comparison 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
comparison
equal deleted inserted replaced
791:346f7069676a 792:41b4e9769863
226 { 226 {
227 int v13; // ecx@13 227 int v13; // ecx@13
228 signed int v14; // ebx@14 228 signed int v14; // ebx@14
229 int v15; // eax@16 229 int v15; // eax@16
230 //int v16; // edx@19 230 //int v16; // edx@19
231 int v17; // ST18_4@19 231 //int v17; // ST18_4@19
232 signed int v18; // edx@19 232 //signed int v18; // edx@19
233 signed __int64 v19; // qtt@19 233 //signed __int64 v19; // qtt@19
234 int v21; // eax@27 234 int v21; // eax@27
235 int v22; // ecx@29 235 //int v22; // ecx@29
236 signed int v28; // eax@45 236 signed int v28; // eax@45
237 int v29; // ebx@47 237 int v29; // ebx@47
238 int v30; // edx@49 238 int v30; // edx@49
239 int v31; // ST10_4@49 239 int v31; // ST10_4@49
240 signed int v32; // edx@49 240 signed int v32; // edx@49
241 signed __int64 v33; // qtt@49 241 signed __int64 v33; // qtt@49
242 signed int v34; // eax@54 242 signed int v34; // eax@54
243 signed int v35; // esi@56 243 signed int v35; // esi@56
244 int result; // eax@57 244 int result; // eax@57
245 int v38; // edx@62 245 int v38; // edx@62
246 int v44; // [sp+20h] [bp-20h]@10 246 //int v44; // [sp+20h] [bp-20h]@10
247 bool v47; // [sp+24h] [bp-1Ch]@43 247 bool v47; // [sp+24h] [bp-1Ch]@43
248 bool v48; // [sp+28h] [bp-18h]@10 248 bool v48; // [sp+28h] [bp-18h]@10
249 bool v49; // [sp+28h] [bp-18h]@41 249 bool v49; // [sp+28h] [bp-18h]@41
250 bool v50; // [sp+2Ch] [bp-14h]@12 250 bool v50; // [sp+2Ch] [bp-14h]@12
251 signed int v53; // [sp+30h] [bp-10h]@10 251 signed int v53; // [sp+30h] [bp-10h]@10
259 259
260 static __int16 word_721390_ys[104]; // idb 260 static __int16 word_721390_ys[104]; // idb
261 static __int16 word_721460_xs[104]; // idb 261 static __int16 word_721460_xs[104]; // idb
262 262
263 auto pSector = &pIndoor->pSectors[uSectorID]; 263 auto pSector = &pIndoor->pSectors[uSectorID];
264 v55 = 1; 264 v55 = 0;
265 for (uint i = 0; i < pSector->uNumFloors; ++i) 265 for (uint i = 0; i < pSector->uNumFloors; ++i)
266 { 266 {
267 auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]]; 267 auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]];
268 if (pFloor->Clickable()) 268 if (pFloor->Clickable())
269 continue; 269 continue;
270 270
271 assert(pFloor->uNumVertices);
271 if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 && 272 if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 &&
272 y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1) 273 y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1)
273 { 274 {
274 for (uint j = 0; j < pFloor->uNumVertices; ++j) 275 for (uint j = 0; j < pFloor->uNumVertices; ++j)
275 { 276 {
276 word_721460_xs[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x; 277 word_721460_xs[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x;
277 word_721460_xs[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x; 278 word_721460_xs[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x;
278 word_721390_ys[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y; 279 word_721390_ys[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y;
279 word_721390_ys[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; 280 word_721390_ys[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y;
280 } 281 }
281 v44 = 2 * pFloor->uNumVertices;
282 word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0]; 282 word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0];
283 word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0]; 283 word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0];
284 284
285 v48 = word_721390_ys[0] >= y; 285 v50 = word_721390_ys[0] >= y;
286 v53 = 0; 286 v53 = 0;
287 if ( pFloor->uNumVertices > 0 ) 287
288 { 288 for (uint j = 0; j < 2 * pFloor->uNumVertices - 1; ++j)
289 for ( int i = 0; i < v44; i++ ) 289 {
290 { 290 if (v53 >= 2)
291 if ( v53 >= 2 ) 291 break;
292 break; 292
293 v50 = word_721390_ys[i + 1] >= y; 293 v48 = v50;
294 v50 = word_721390_ys[j + 1] >= y;
294 295
295 v13 = i; 296 v13 = i;
296 if ( v48 != v50 ) 297 if (v48 == v50)
298 continue;
299
300 v14 = word_721460_xs[j + 1] >= x ? 0 : 2;
301 v15 = v14 | word_721460_xs[j] < x;
302
303 if (v15 == 3)
304 continue;
305 else if (!v15)
306 ++v53;
307 else
297 { 308 {
298 v14 = word_721460_xs[i + 1] >= x ? 0 : 2; 309 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]);
299 v15 = v14 | word_721460_xs[i] < x; 310 auto res = fixpoint_mul((signed int)word_721460_xs[j + 1] - (signed int)word_721460_xs[j], a_div_b);
300 311
301 if ( !v15) 312 if (res + word_721460_xs[j] >= x)
302 ++v53;
303 else
304 {
305 //v16 = word_721390_ys[i];
306 v17 = word_721390_ys[i + 1] - word_721390_ys[i];
307 v18 = y - word_721390_ys[i];
308 LODWORD(v19) = v18 << 16;
309 HIDWORD(v19) = v18 >> 16;
310 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)
311 ++v53; 313 ++v53;
312 }
313 /*if ( v15 != 3 )
314 {
315 if ( !v15 )
316 {
317 LODWORD(v19) = (y - word_721390_ys[i]) << 16;
318 HIDWORD(v19) = (y - word_721390_ys[i]) >> 16;
319 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]);
320 if ( v16 >= x)
321 ++v53;
322 }
323 }*/
324 } 314 }
325 v48 = v50; 315 }
326 } 316
317
327 if ( v53 == 1 ) 318 if ( v53 == 1 )
328 { 319 {
329 if ( v55 >= 50 ) 320 if ( v55 >= 50 )
330 break; 321 break;
331 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling ) 322 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling )
332 { 323 {
333 v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z; 324 v21 = pIndoor->pVertices[pFloor->pVertexIDs[0]].z;
334 } 325 }
335 else 326 else
336 { 327 {
337 v21 = ((unsigned __int64)(pFloor->zCalc1 * (signed __int64)x) >> 16) + ((unsigned __int64)(pFloor->zCalc2 * (signed __int64)y) >> 16) 328 v21 = fixpoint_mul(pFloor->zCalc1, x) + fixpoint_mul(pFloor->zCalc2, y) + (short)(pFloor->zCalc3 >> 16);
338 + HIWORD(pFloor->zCalc3);
339 } 329 }
340 v22 = v55++; 330 blv_floor_level[v55] = v21;
341 blv_floor_level[v22] = v21; 331 blv_floor_id[v55] = pSector->pFloors[i];
342 blv_floor_id[v22] = pSector->pFloors[i]; 332 v55++;
343 } 333 }
344 } 334 }
345 } 335 }
346 } 336
337
347 if ( pSector->field_0 & 8 ) 338 if ( pSector->field_0 & 8 )
348 { 339 {
349 for (uint i = 0; i < pSector->uNumPortals; ++i) 340 for (uint i = 0; i < pSector->uNumPortals; ++i)
350 { 341 {
351 auto portal = &pIndoor->pFaces[pSector->pPortals[i]]; 342 auto portal = &pIndoor->pFaces[pSector->pPortals[i]];