comparison mm7_1.cpp @ 1195:1f92c110a4f2

indoor sub_424829
author zipi
date Fri, 07 Jun 2013 23:46:57 +0100
parents 02e2a5c1ebc0
children 8c02e6f74b29 eb419a6d48fe
comparison
equal deleted inserted replaced
1194:9baf16113199 1195:1f92c110a4f2
2232 bool sub_424829(int pNumVertices, BspRenderer_stru2 *a2, BspRenderer_stru2 *a3, int uFaceID) 2232 bool sub_424829(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 min_y; // esi@5
2238 int v8; // edx@5 2238 int max_y; // edx@5
2239 //int v9; // ecx@6 2239 //int v9; // ecx@6
2240 int v10; // eax@12 2240 int v10; // eax@12
2241 //int v11; // edi@13 2241 //int v11; // edi@13
2242 //int v12; // edx@18 2242 //int v12; // edx@18
2243 int v13; // eax@22 2243 int v13; // eax@22
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 <= 1 ) 2309 if ( pNumVertices <= 1 )
2310 return false; 2310 return false;
2311 v7 = stru_50B700._screen_space_y[0]; 2311 min_y = stru_50B700._screen_space_y[0];
2312 v65 = 0; 2312 v65 = 0;
2313 v8 = stru_50B700._screen_space_y[0]; 2313 max_y = stru_50B700._screen_space_y[0];
2314 if ( !stru_50B700.field_0 ) 2314 if ( !stru_50B700.field_0 )
2315 { 2315 {
2316 v63 = 1; 2316 v63 = 1;
2317 v64 = -1; 2317 v64 = -1;
2318 } 2318 }
2322 v64 = 1; 2322 v64 = 1;
2323 } 2323 }
2324 2324
2325 for ( v6 = 1; v6 < pNumVertices; ++v6 ) 2325 for ( v6 = 1; v6 < pNumVertices; ++v6 )
2326 { 2326 {
2327 if ( stru_50B700._screen_space_y[v6] >= v7 ) 2327 if ( stru_50B700._screen_space_y[v6] >= min_y )
2328 { 2328 {
2329 if ( stru_50B700._screen_space_y[v6] > v8 ) 2329 if ( stru_50B700._screen_space_y[v6] > max_y )
2330 v8 = stru_50B700._screen_space_y[v6]; 2330 max_y = stru_50B700._screen_space_y[v6];
2331 } 2331 }
2332 else 2332 if ( stru_50B700._screen_space_y[v6] < min_y )
2333 { 2333 {
2334 v65 = v6; 2334 v65 = v6;
2335 v7 = stru_50B700._screen_space_y[v6]; 2335 min_y = stru_50B700._screen_space_y[v6];
2336 } 2336 }
2337 } 2337 }
2338 if ( v8 == v7 ) 2338 if ( max_y == min_y )
2339 return false; 2339 return false;
2340 2340
2341 v10 = v65; 2341 v10 = v65;
2342 a2->_viewport_space_y = v7; 2342 a2->_viewport_space_y = min_y;
2343 a2->_viewport_space_w = v8; 2343 a2->_viewport_space_w = max_y;
2344 v55 = v65; 2344 v55 = v65;
2345 2345
2346 for ( v68 = 0; v68 < pNumVertices; ++v68 ) 2346 for ( v68 = 0; v68 < pNumVertices; ++v68 )
2347 { 2347 {
2348 v10 += v64; 2348 v10 += v64;
2356 if ( stru_50B700._screen_space_y[v10] <= stru_50B700._screen_space_y[v65] ) 2356 if ( stru_50B700._screen_space_y[v10] <= stru_50B700._screen_space_y[v65] )
2357 { 2357 {
2358 v55 = v10; 2358 v55 = v10;
2359 v65 = v10; 2359 v65 = v10;
2360 } 2360 }
2361 if ( stru_50B700._screen_space_y[v10] == v8 ) 2361 if ( stru_50B700._screen_space_y[v10] == max_y )
2362 break; 2362 break;
2363 } 2363 }
2364 v13 = v55 + v64; 2364 v13 = v55 + v64;
2365 if ( v13 < pNumVertices ) 2365 if ( v13 < pNumVertices )
2366 { 2366 {
2371 v13 -= pNumVertices; 2371 v13 -= pNumVertices;
2372 if ( stru_50B700._screen_space_y[v13] != stru_50B700._screen_space_y[v55] ) 2372 if ( stru_50B700._screen_space_y[v13] != stru_50B700._screen_space_y[v55] )
2373 { 2373 {
2374 v62 = stru_50B700._screen_space_x[v55] << 16; 2374 v62 = stru_50B700._screen_space_x[v55] << 16;
2375 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]); 2375 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]);
2376 a2->array_18[v7] = LOWORD(stru_50B700._screen_space_x[v55]); 2376 a2->array_18[min_y] = LOWORD(stru_50B700._screen_space_x[v55]);
2377 } 2377 }
2378 v15 = v65; 2378 v15 = v65;
2379 v61 = v65; 2379 v61 = v65;
2380 2380
2381 for ( v69 = 0; v69 < pNumVertices; ++v69 ) 2381 for ( v69 = 0; v69 < pNumVertices; ++v69 )
2391 if ( stru_50B700._screen_space_y[v15] <= stru_50B700._screen_space_y[v65] ) 2391 if ( stru_50B700._screen_space_y[v15] <= stru_50B700._screen_space_y[v65] )
2392 { 2392 {
2393 v61 = v15; 2393 v61 = v15;
2394 v65 = v15; 2394 v65 = v15;
2395 } 2395 }
2396 if ( stru_50B700._screen_space_y[v15] == v8 ) 2396 if ( stru_50B700._screen_space_y[v15] == max_y )
2397 break; 2397 break;
2398 } 2398 }
2399 v18 = v63 + v61; 2399 v18 = v63 + v61;
2400 if ( v18 < pNumVertices ) 2400 if ( v18 < pNumVertices )
2401 { 2401 {
2408 v20 = v61; 2408 v20 = v61;
2409 if ( stru_50B700._screen_space_y[v19] != stru_50B700._screen_space_y[v61] ) 2409 if ( stru_50B700._screen_space_y[v19] != stru_50B700._screen_space_y[v61] )
2410 { 2410 {
2411 v61 = stru_50B700._screen_space_x[v20] << 16; 2411 v61 = stru_50B700._screen_space_x[v20] << 16;
2412 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]; 2412 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];
2413 a2->array_3D8[v8] = LOWORD(stru_50B700._screen_space_x[v20]); 2413 a2->array_3D8[max_y] = LOWORD(stru_50B700._screen_space_x[v20]);
2414 } 2414 }
2415 v22 = v7; 2415 v22 = min_y;
2416 if ( v7 <= v8 ) 2416 if ( min_y <= max_y )
2417 { 2417 {
2418 //v56 = &a2->array_3D8[v7]; 2418 //v56 = &a2->array_3D8[v7];
2419 //v23 = &a2->array_18[v7]; 2419 //v23 = &a2->array_18[v7];
2420 for ( v70 = v7; v70 <= v8; ++v70 ) 2420 for ( v70 = min_y; v70 <= max_y; ++v70 )
2421 { 2421 {
2422 v24 = v13; 2422 v24 = v13;
2423 if ( v22 >= stru_50B700._screen_space_y[v13] && v22 != v8 ) 2423 if ( v22 >= stru_50B700._screen_space_y[v13] && v22 != max_y )
2424 { 2424 {
2425 v13 = v64 + v13; 2425 v13 = v64 + v13;
2426 if ( v13 < pNumVertices ) 2426 if ( v13 < pNumVertices )
2427 { 2427 {
2428 if ( v13 < 0 ) 2428 if ( v13 < 0 )
2437 v54 = ((stru_50B700._screen_space_x[v26] - stru_50B700._screen_space_x[v24]) << 16) / stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24]; 2437 v54 = ((stru_50B700._screen_space_x[v26] - stru_50B700._screen_space_x[v24]) << 16) / stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24];
2438 v62 = stru_50B700._screen_space_x[v24] << 16; 2438 v62 = stru_50B700._screen_space_x[v24] << 16;
2439 } 2439 }
2440 } 2440 }
2441 v29 = v18; 2441 v29 = v18;
2442 if ( v70 >= stru_50B700._screen_space_y[v18] && v70 != v8 ) 2442 if ( v70 >= stru_50B700._screen_space_y[v18] && v70 != max_y )
2443 { 2443 {
2444 v18 += v63; 2444 v18 += v63;
2445 if ( v18 < pNumVertices ) 2445 if ( v18 < pNumVertices )
2446 { 2446 {
2447 if ( v18 < 0 ) 2447 if ( v18 < 0 )
2478 v22 = v70 + 1; 2478 v22 = v70 + 1;
2479 v61 += v53; 2479 v61 += v53;
2480 //++v23; 2480 //++v23;
2481 } 2481 }
2482 } 2482 }
2483 if ( v8 < a3->_viewport_space_y ) 2483 if ( max_y < a3->_viewport_space_y )
2484 return false; 2484 return false;
2485 if ( v7 > a3->_viewport_space_w ) 2485 if ( min_y > a3->_viewport_space_w )
2486 return false; 2486 return false;
2487 if ( v7 < a3->_viewport_space_y ) 2487 if ( min_y < a3->_viewport_space_y )
2488 v7 = a3->_viewport_space_y; 2488 min_y = a3->_viewport_space_y;
2489 if ( v8 > a3->_viewport_space_w ) 2489 if ( max_y > a3->_viewport_space_w )
2490 v8 = a3->_viewport_space_w; 2490 max_y = a3->_viewport_space_w;
2491 if ( v7 <= v8 ) 2491 if ( min_y <= max_y )
2492 { 2492 {
2493 //a3a = (char *)a2 - (char *)a3; 2493 //a3a = (char *)a2 - (char *)a3;
2494 //v42 = &a3->array_3D8[v7]; 2494 //v42 = &a3->array_3D8[v7];
2495 //v57 = *(__int16 *)((char *)v42 + a3a); 2495 //v57 = *(__int16 *)((char *)v42 + a3a);
2496 for ( v71 = v7; v71 <= v8; ++v71 ) 2496 for ( v71 = min_y; v71 <= max_y; ++v71 )
2497 { 2497 {
2498 if ( a2->array_18[v71] >= a3->array_18[v71] && a2->array_18[v71] <= a3->array_3D8[v71] ) 2498 if ( a2->array_18[v71] >= a3->array_18[v71] && a2->array_18[v71] <= a3->array_3D8[v71] )
2499 break; 2499 break;
2500 //++v57; 2500 //++v57;
2501 ++v7; 2501 ++min_y;
2502 //++v42; 2502 //++v42;
2503 } 2503 }
2504 } 2504 }
2505 if ( v8 < v7 ) 2505 if ( max_y < min_y )
2506 return false; 2506 return false;
2507 //a3a = (char *)a2 - (char *)a3; 2507 //a3a = (char *)a2 - (char *)a3;
2508 //v43 = &a3->array_3D8[v8]; 2508 //v43 = &a3->array_3D8[v8];
2509 //v58 = *(__int16 *)((char *)v43 + a3a); 2509 //v58 = *(__int16 *)((char *)v43 + a3a);
2510 for ( v72 = v8; v72 >= v7; --v72 ) 2510 for ( v72 = max_y; v72 >= min_y; --v72 )
2511 { 2511 {
2512 if ( a2->array_3D8[v72] >= a3->array_18[v72] && a2->array_18[v72] <= a3->array_3D8[v72] ) 2512 if ( a2->array_3D8[v72] >= a3->array_18[v72] && a2->array_18[v72] <= a3->array_3D8[v72] )
2513 break; 2513 break;
2514 //--v58; 2514 //--v58;
2515 --v8; 2515 --max_y;
2516 //--v43; 2516 //--v43;
2517 //v8 = v8; 2517 //v8 = v8;
2518 } 2518 }
2519 if ( v7 >= v8 ) 2519 if ( min_y >= max_y )
2520 return false; 2520 return false;
2521 //a3b = (char *)a3 - (char *)a2; 2521 //a3b = (char *)a3 - (char *)a2;
2522 v59 = v7; 2522 v59 = min_y;
2523 //v45 = &a2->array_18[v7]; 2523 //v45 = &a2->array_18[v7];
2524 2524
2525 for ( v46 = v8 - v7 + 1; v46; --v46 ) 2525 for ( v46 = max_y - min_y + 1; v46; --v46 )
2526 { 2526 {
2527 //v47 = *(__int16 *)((char *)v45 + a3b); 2527 //v47 = *(__int16 *)((char *)v45 + a3b);
2528 if ( a2->array_18[v59] < a3->array_18[v59] ) 2528 if ( a2->array_18[v59] < a3->array_18[v59] )
2529 a2->array_18[v59] = a3->array_18[v59]; 2529 a2->array_18[v59] = a3->array_18[v59];
2530 if ( a2->array_3D8[v59] > a3->array_3D8[v59] ) 2530 if ( a2->array_3D8[v59] > a3->array_3D8[v59] )
2531 a2->array_3D8[v59] = a3->array_3D8[v59]; 2531 a2->array_3D8[v59] = a3->array_3D8[v59];
2532 ++v59; 2532 ++v59;
2533 //++v45; 2533 //++v45;
2534 } 2534 }
2535 a2->_viewport_space_y = v7; 2535 a2->_viewport_space_y = min_y;
2536 a2->_viewport_space_w = v8; 2536 a2->_viewport_space_w = max_y;
2537 a2->field_8 = a2->array_18[v7]; 2537 a2->field_8 = a2->array_18[min_y];
2538 //v48 = a2->array_3D8[v7]; 2538 //v48 = a2->array_3D8[v7];
2539 a2->field_10 = v7; 2539 a2->field_10 = min_y;
2540 a2->field_14 = v7; 2540 a2->field_14 = min_y;
2541 a2->field_C = a2->array_3D8[v7]; 2541 a2->field_C = a2->array_3D8[min_y];
2542 v49 = v7 + 1; 2542 v49 = min_y + 1;
2543 if ( v49 <= v8 ) 2543 if ( v49 <= max_y )
2544 { 2544 {
2545 //v50 = &a2->array_3D8[v49]; 2545 //v50 = &a2->array_3D8[v49];
2546 for ( v49; v49 <= v8; ++v49 ) 2546 for ( v49; v49 <= max_y; ++v49 )
2547 { 2547 {
2548 //v51 = a2->array_18[v49]; 2548 //v51 = a2->array_18[v49];
2549 if ( a2->array_18[v49] < a2->field_8 ) 2549 if ( a2->array_18[v49] < a2->field_8 )
2550 { 2550 {
2551 a2->field_8 = a2->array_18[v49]; 2551 a2->field_8 = a2->array_18[v49];