comparison mm7_1.cpp @ 1226:33b30398e286

m
author Ritor1
date Fri, 07 Jun 2013 22:24:11 +0600
parents 42b41aaecd87
children 312e895a6439
comparison
equal deleted inserted replaced
1225:42b41aaecd87 1226:33b30398e286
2227 memcpy(&array_507D30[result], array_507D30, sizeof(array_507D30[result])); 2227 memcpy(&array_507D30[result], array_507D30, sizeof(array_507D30[result]));
2228 return result;*/ 2228 return result;*/
2229 } 2229 }
2230 2230
2231 //----- (00424829) -------------------------------------------------------- 2231 //----- (00424829) --------------------------------------------------------
2232 bool sub_424829(int pNumVertices, BspRenderer_stru2 *a2, BspRenderer_stru2 *a3, int uFaceID) 2232 bool isVisibleRoom(int pNumVertices, BspRenderer_stru2 *a2, BspRenderer_stru2 *a3, int uFaceID)
2233 { 2233 {
2234 //int v4; // edi@1 2234 //int v4; // edi@1
2235 //BspRenderer_stru2 *v5; // ebx@1 2235 //BspRenderer_stru2 *v5; // ebx@1
2236 int v6; // eax@3 2236 int v6; // eax@3
2237 int v7; // esi@5 2237 int v7; // esi@5
2306 2306
2307 //try graphic engine with function returning 1 always, and without 2307 //try graphic engine with function returning 1 always, and without
2308 //return true; 2308 //return true;
2309 if ( !pNumVertices ) 2309 if ( !pNumVertices )
2310 return false; 2310 return false;
2311
2311 v7 = stru_50B700._screen_space_y[0]; 2312 v7 = stru_50B700._screen_space_y[0];
2312 v65 = 0; 2313 v65 = 0;
2313 v8 = stru_50B700._screen_space_y[0]; 2314 v8 = stru_50B700._screen_space_y[0];
2315
2314 if ( !stru_50B700.field_0 ) 2316 if ( !stru_50B700.field_0 )
2315 { 2317 {
2316 v63 = 1; 2318 v63 = 1;
2317 v64 = -1; 2319 v64 = -1;
2318 } 2320 }
2319 else 2321 else
2320 { 2322 {
2321 v63 = -1; 2323 v63 = -1;
2322 v64 = 1; 2324 v64 = 1;
2323 } 2325 }
2326
2324 if ( pNumVertices <= 1 ) 2327 if ( pNumVertices <= 1 )
2325 return false; 2328 return false;
2329
2326 for ( v6 = 1; v6 < pNumVertices; ++v6 ) 2330 for ( v6 = 1; v6 < pNumVertices; ++v6 )
2327 { 2331 {
2328 if ( stru_50B700._screen_space_y[v6] >= v7 ) 2332 if ( stru_50B700._screen_space_y[v6] >= v7 )
2329 { 2333 {
2330 if ( stru_50B700._screen_space_y[v6] > v8 ) 2334 if ( stru_50B700._screen_space_y[v6] > v8 )
2334 { 2338 {
2335 v65 = v6; 2339 v65 = v6;
2336 v7 = stru_50B700._screen_space_y[v6]; 2340 v7 = stru_50B700._screen_space_y[v6];
2337 } 2341 }
2338 } 2342 }
2343
2339 if ( v8 == v7 ) 2344 if ( v8 == v7 )
2340 return false; 2345 return false;
2346
2341 v10 = v65; 2347 v10 = v65;
2342 a2->_viewport_space_y = v7; 2348 a2->_viewport_space_y = v7;
2343 a2->_viewport_space_w = v8; 2349 a2->_viewport_space_w = v8;
2344 v55 = v65; 2350 v55 = v65;
2351
2345 if ( pNumVertices > 0 ) 2352 if ( pNumVertices > 0 )
2346 { 2353 {
2347 //v11 = v65; 2354 //v11 = v65;
2348 for ( v68 = 0; v68 < pNumVertices; ++v68 ) 2355 for ( v68 = 0; v68 < pNumVertices; ++v68 )
2349 { 2356 {
2364 } 2371 }
2365 if ( stru_50B700._screen_space_y[v10] == v8 ) 2372 if ( stru_50B700._screen_space_y[v10] == v8 )
2366 break; 2373 break;
2367 } 2374 }
2368 } 2375 }
2376
2369 v13 = v55 + v64; 2377 v13 = v55 + v64;
2370 if ( v13 < pNumVertices ) 2378 if ( v13 < pNumVertices )
2371 { 2379 {
2372 if ( v13 < 0 ) 2380 if ( v13 < 0 )
2373 v13 += pNumVertices; 2381 v13 += pNumVertices;
2374 } 2382 }
2375 else 2383 else
2376 { 2384 {
2377 v13 -= pNumVertices; 2385 v13 -= pNumVertices;
2378 } 2386 }
2387
2379 if ( stru_50B700._screen_space_y[v13] != stru_50B700._screen_space_y[v55] ) 2388 if ( stru_50B700._screen_space_y[v13] != stru_50B700._screen_space_y[v55] )
2380 { 2389 {
2381 v62 = stru_50B700._screen_space_x[v55] << 16; 2390 v62 = stru_50B700._screen_space_x[v55] << 16;
2382 v54 = ((stru_50B700._screen_space_x[v13] - stru_50B700._screen_space_x[v55]) << 16) / (stru_50B700._screen_space_y[v13] - stru_50B700._screen_space_y[v55]); 2391 v54 = ((stru_50B700._screen_space_x[v13] - stru_50B700._screen_space_x[v55]) << 16) / (stru_50B700._screen_space_y[v13] - stru_50B700._screen_space_y[v55]);
2383 a2->array_18[v7] = LOWORD(stru_50B700._screen_space_x[v55]); 2392 a2->array_18[v7] = LOWORD(stru_50B700._screen_space_x[v55]);
2384 } 2393 }
2394
2385 v15 = v65; 2395 v15 = v65;
2386 v61 = v65; 2396 v61 = v65;
2387 if ( pNumVertices > 0 ) 2397 if ( pNumVertices > 0 )
2388 { 2398 {
2389 //v16 = v65; 2399 //v16 = v65;
2406 } 2416 }
2407 if ( stru_50B700._screen_space_y[v15] == v8 ) 2417 if ( stru_50B700._screen_space_y[v15] == v8 )
2408 break; 2418 break;
2409 } 2419 }
2410 } 2420 }
2421
2411 v18 = v63 + v61; 2422 v18 = v63 + v61;
2412 if ( v18 < pNumVertices ) 2423 if ( v18 < pNumVertices )
2413 { 2424 {
2414 if ( v18 < 0 ) 2425 if ( v18 < 0 )
2415 v18 += pNumVertices; 2426 v18 += pNumVertices;
2417 else 2428 else
2418 { 2429 {
2419 v18 -= pNumVertices; 2430 v18 -= pNumVertices;
2420 } 2431 }
2421 v19 = v18; 2432 v19 = v18;
2433
2422 v20 = v61; 2434 v20 = v61;
2423 if ( stru_50B700._screen_space_y[v19] != stru_50B700._screen_space_y[v61] ) 2435 if ( stru_50B700._screen_space_y[v19] != stru_50B700._screen_space_y[v61] )
2424 { 2436 {
2425 v61 = stru_50B700._screen_space_x[v20] << 16; 2437 v61 = stru_50B700._screen_space_x[v20] << 16;
2426 v53 = ((stru_50B700._screen_space_x[v19] - stru_50B700._screen_space_x[v20]) << 16) / stru_50B700._screen_space_y[v19] - stru_50B700._screen_space_y[v20]; 2438 v53 = ((stru_50B700._screen_space_x[v19] - stru_50B700._screen_space_x[v20]) << 16) / stru_50B700._screen_space_y[v19] - stru_50B700._screen_space_y[v20];
2427 a2->array_3D8[v8] = LOWORD(stru_50B700._screen_space_x[v20]); 2439 a2->array_3D8[v8] = LOWORD(stru_50B700._screen_space_x[v20]);
2428 } 2440 }
2441
2429 v22 = v7; 2442 v22 = v7;
2430 if ( v7 <= v8 ) 2443 if ( v7 <= v8 )
2431 { 2444 {
2432 //v56 = &a2->array_3D8[v7]; 2445 //v56 = &a2->array_3D8[v7];
2433 //v23 = &a2->array_18[v7]; 2446 //v23 = &a2->array_18[v7];
2496 v22 = v70 + 1; 2509 v22 = v70 + 1;
2497 v61 += v53; 2510 v61 += v53;
2498 //++v23; 2511 //++v23;
2499 } 2512 }
2500 } 2513 }
2514
2501 if ( v8 < a3->_viewport_space_y ) 2515 if ( v8 < a3->_viewport_space_y )
2502 return false; 2516 return false;
2503 if ( v7 > a3->_viewport_space_w ) 2517 if ( v7 > a3->_viewport_space_w )
2504 return false; 2518 return false;
2519
2505 if ( v7 < a3->_viewport_space_y ) 2520 if ( v7 < a3->_viewport_space_y )
2506 v7 = a3->_viewport_space_y; 2521 v7 = a3->_viewport_space_y;
2507 if ( v8 > a3->_viewport_space_w ) 2522 if ( v8 > a3->_viewport_space_w )
2508 v8 = a3->_viewport_space_w; 2523 v8 = a3->_viewport_space_w;
2524
2509 if ( v7 <= v8 ) 2525 if ( v7 <= v8 )
2510 { 2526 {
2511 //a3a = (char *)a2 - (char *)a3; 2527 //a3a = (char *)a2 - (char *)a3;
2512 //v42 = &a3->array_3D8[v7]; 2528 //v42 = &a3->array_3D8[v7];
2513 //v57 = *(__int16 *)((char *)v42 + a3a); 2529 //v57 = *(__int16 *)((char *)v42 + a3a);
2514 for ( v71 = v7; v71 <= v8; ++v71 ) 2530 for ( v7; v7 <= v8; ++v7 )
2515 { 2531 {
2516 if ( a2->array_18[v71] >= a3->array_18[v71] && a2->array_18[v71] <= a3->array_3D8[v71] ) 2532 if ( a2->array_18[v7] >= a3->array_18[v7] && a2->array_18[v7] <= a3->array_3D8[v7] )
2517 break; 2533 break;
2518 //++v57; 2534 //++v57;
2519 ++v7; 2535 //++v7;
2520 //++v42; 2536 //++v42;
2521 } 2537 }
2522 } 2538 }
2523 if ( v8 < v7 ) 2539 if ( v8 < v7 )
2524 return false; 2540 return false;
2525 //a3a = (char *)a2 - (char *)a3; 2541 //a3a = (char *)a2 - (char *)a3;
2526 //v43 = &a3->array_3D8[v8]; 2542 //v43 = &a3->array_3D8[v8];
2527 //v58 = *(__int16 *)((char *)v43 + a3a); 2543 //v58 = *(__int16 *)((char *)v43 + a3a);
2528 for ( v72 = v8; v72 >= v7; --v72 ) 2544 for ( v8; v8 >= v7; --v8 )
2529 { 2545 {
2530 if ( a2->array_3D8[v72] >= a3->array_18[v72] && a2->array_18[v72] <= a3->array_3D8[v72] ) 2546 if ( a2->array_3D8[v8] >= a3->array_18[v8] && a2->array_18[v8] <= a3->array_3D8[v8] )
2531 break; 2547 break;
2532 //--v58; 2548 //--v58;
2533 --v8; 2549 //--v8;
2534 //--v43; 2550 //--v43;
2535 //v8 = v8; 2551 //v8 = v8;
2536 } 2552 }
2537 if ( v7 >= v8 ) 2553 if ( v7 >= v8 )
2538 return false; 2554 return false;