Mercurial > mm7
comparison mm7_4.cpp @ 830:08d90b633131
some BLV floor collisions
author | Nomad |
---|---|
date | Wed, 27 Mar 2013 11:59:37 +0200 |
parents | 085eb19b7ffd |
children | dfd683c4f538 |
comparison
equal
deleted
inserted
replaced
829:d5b1870df3ab | 830:08d90b633131 |
---|---|
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 |
341 { | 341 { |
342 auto portal = &pIndoor->pFaces[pSector->pPortals[i]]; | 342 auto portal = &pIndoor->pFaces[pSector->pPortals[i]]; |
343 if (portal->uPolygonType != POLYGON_Floor) | 343 if (portal->uPolygonType != POLYGON_Floor) |
344 continue; | 344 continue; |
345 | 345 |
346 if (!portal->uNumVertices) | |
347 continue; | |
348 | |
346 if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 && | 349 if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 && |
347 y <= portal->pBounding.y2 && y >= portal->pBounding.y1 ) | 350 y <= portal->pBounding.y2 && y >= portal->pBounding.y1 ) |
348 { | 351 { |
349 for (uint j = 0; j < portal->uNumVertices; ++j) | 352 for (uint j = 0; j < portal->uNumVertices; ++j) |
350 { | 353 { |
354 word_721390_ys[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; | 357 word_721390_ys[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; |
355 } | 358 } |
356 word_721460_xs[2 * portal->uNumVertices] = word_721460_xs[0]; | 359 word_721460_xs[2 * portal->uNumVertices] = word_721460_xs[0]; |
357 word_721390_ys[2 * portal->uNumVertices] = word_721390_ys[0]; | 360 word_721390_ys[2 * portal->uNumVertices] = word_721390_ys[0]; |
358 v54 = 0; | 361 v54 = 0; |
359 v49 = word_721390_ys[0] >= y; | 362 v47 = word_721390_ys[0] >= y; |
360 if ( portal->uNumVertices > 0 ) | 363 |
361 { | 364 for (uint j = 0; j < 2 * portal->uNumVertices; ++j) |
362 for ( int i = 0; i < 2 * portal->uNumVertices; ++i ) | |
363 { | 365 { |
366 v49 = v47; | |
364 if ( v54 >= 2 ) | 367 if ( v54 >= 2 ) |
365 break; | 368 break; |
366 v47 = word_721390_ys[i + 1] >= y; | 369 v47 = word_721390_ys[j + 1] >= y; |
367 if ( v49 != v47 ) | 370 if ( v49 != v47 ) |
368 { | 371 { |
369 v28 = word_721460_xs[i + 1] >= x ? 0 : 2; | 372 v28 = word_721460_xs[j + 1] >= x ? 0 : 2; |
370 v29 = v28 | word_721460_xs[i] < x; | 373 v29 = v28 | (word_721460_xs[j] < x); |
371 if ( v29 != 3 ) | 374 if ( v29 != 3 ) |
372 { | 375 { |
373 if ( !v29 ) | 376 if ( !v29 ) |
374 ++v54; | 377 ++v54; |
375 else | 378 else |
376 { | 379 { |
377 //v30 = word_721390_ys[v27]; | 380 auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); |
378 v31 = word_721390_ys[i + 1] - word_721390_ys[i]; | 381 auto res = fixpoint_mul(word_721460_xs[j + 1] - word_721460_xs[j], a_div_b); |
379 v32 = y - word_721390_ys[i]; | 382 if (res + word_721460_xs[j] >= x) |
380 LODWORD(v33) = v32 << 16; | |
381 HIDWORD(v33) = v32 >> 16; | |
382 if ((signed int)(((unsigned __int64)(((signed int)word_721460_xs[i + 1] - (signed int)word_721460_xs[i]) * v33 / v31) >> 16) + word_721460_xs[i]) >= x) | |
383 ++v54; | 383 ++v54; |
384 } | 384 } |
385 } | 385 } |
386 } | 386 } |
387 v49 = v47; | |
388 } | 387 } |
389 if ( v54 == 1 ) | 388 if ( v54 == 1 ) |
390 { | 389 { |
391 if ( v55 >= 50 ) | 390 if ( v55 >= 50 ) |
392 break; | 391 break; |
393 v34 = v55++; | 392 blv_floor_level[v55] = -29000; |
394 blv_floor_level[v34] = -29000; | 393 blv_floor_id[v55] = pSector->pPortals[i]; |
395 blv_floor_id[v34] = pSector->pPortals[i]; | 394 v55++; |
396 } | 395 } |
397 } | |
398 } | 396 } |
399 } | 397 } |
400 } | 398 } |
401 if ( v55 == 1 ) | 399 if ( v55 == 1 ) |
402 { | 400 { |
405 } | 403 } |
406 if ( !v55 ) | 404 if ( !v55 ) |
407 return -30000; | 405 return -30000; |
408 *pFaceID = blv_floor_id[0]; | 406 *pFaceID = blv_floor_id[0]; |
409 //result = blv_floor_level[0]; | 407 //result = blv_floor_level[0]; |
410 if ( v55 > 1 ) | 408 |
411 { | 409 /*for ( v35 = 1; v35 < v55; ++v35 ) |
412 for ( v35 = 1; v35 < v55; ++v35 ) | |
413 { | 410 { |
414 if ( blv_floor_level[0] <= z + 5 ) | 411 if ( blv_floor_level[0] <= z + 5 ) |
415 { | 412 { |
416 if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 ) | 413 if ( blv_floor_level[v35] >= blv_floor_level[0] || blv_floor_level[v35] > z + 5 ) |
417 continue; | 414 continue; |
422 if ( blv_floor_level[v35] < blv_floor_level[0] ) | 419 if ( blv_floor_level[v35] < blv_floor_level[0] ) |
423 { | 420 { |
424 blv_floor_level[0] = blv_floor_level[v35]; | 421 blv_floor_level[0] = blv_floor_level[v35]; |
425 *pFaceID = blv_floor_id[v35]; | 422 *pFaceID = blv_floor_id[v35]; |
426 } | 423 } |
427 } | 424 }*/ |
428 } | 425 |
429 return blv_floor_level[0]; | 426 |
427 int result = blv_floor_level[0]; | |
428 for (uint i = 1; i < v55; ++i) | |
429 { | |
430 v38 = blv_floor_level[i]; | |
431 if ( result <= z + 5 ) | |
432 { | |
433 if ( v38 > result && v38 <= z + 5 ) | |
434 { | |
435 result = blv_floor_level[i]; | |
436 *pFaceID = blv_floor_id[i]; | |
437 } | |
438 } | |
439 else if ( v38 < result ) | |
440 { | |
441 result = blv_floor_level[i]; | |
442 *pFaceID = blv_floor_id[i]; | |
443 } | |
444 } | |
445 | |
446 return result; | |
430 } | 447 } |
431 | 448 |
432 //----- (0046D49E) -------------------------------------------------------- | 449 //----- (0046D49E) -------------------------------------------------------- |
433 int __fastcall ODM_GetFloorLevel(int X, signed int Y, int Z, int __unused, int *pIsOnWater, int *a6, int bWaterWalk) | 450 int __fastcall ODM_GetFloorLevel(int X, signed int Y, int Z, int __unused, int *pIsOnWater, int *a6, int bWaterWalk) |
434 { | 451 { |