Mercurial > mm7
comparison mm7_3.cpp @ 693:e0a1fccc89b1
map render fixes
author | Gloval |
---|---|
date | Sun, 17 Mar 2013 01:50:34 +0400 |
parents | 066e2b29b30f |
children | af0332a32034 |
comparison
equal
deleted
inserted
replaced
692:066e2b29b30f | 693:e0a1fccc89b1 |
---|---|
4497 v9 = v6 * *(float *)v4; | 4497 v9 = v6 * *(float *)v4; |
4498 *((int *)v4 + 20) = LODWORD(v5); | 4498 *((int *)v4 + 20) = LODWORD(v5); |
4499 *((float *)v4 + 19) = v8 - v9; | 4499 *((float *)v4 + 19) = v8 - v9; |
4500 } | 4500 } |
4501 *((int *)v4 + 21) = *((int *)v4 + 1); | 4501 *((int *)v4 + 21) = *((int *)v4 + 1); |
4502 if ( (double)(signed int)pViewport->uViewportX <= *((float *)v4 + 18) | 4502 if ( (double)(signed int)pViewport->uViewportTL_X <= *((float *)v4 + 18) |
4503 && (double)(signed int)pViewport->uViewportZ > *((float *)v4 + 18) | 4503 && (double)(signed int)pViewport->uViewportBR_X > *((float *)v4 + 18) |
4504 && (double)(signed int)pViewport->uViewportY <= *((float *)v4 + 19) | 4504 && (double)(signed int)pViewport->uViewportTL_Y <= *((float *)v4 + 19) |
4505 && (double)(signed int)pViewport->uViewportW > *((float *)v4 + 19) ) | 4505 && (double)(signed int)pViewport->uViewportBR_Y > *((float *)v4 + 19) ) |
4506 v16 = 1; | 4506 v16 = 1; |
4507 ++v3; | 4507 ++v3; |
4508 v4 += 16; | 4508 v4 += 16; |
4509 } | 4509 } |
4510 while ( v3 < v2->field_10 ); | 4510 while ( v3 < v2->field_10 ); |
4523 v13 = (double)pViewport->uScreenCenterY; | 4523 v13 = (double)pViewport->uScreenCenterY; |
4524 v14 = v12 * *((float *)v10 + 2); | 4524 v14 = v12 * *((float *)v10 + 2); |
4525 *((int *)v10 + 22) = LODWORD(v11); | 4525 *((int *)v10 + 22) = LODWORD(v11); |
4526 *((int *)v10 + 23) = *((int *)v10 + 3); | 4526 *((int *)v10 + 23) = *((int *)v10 + 3); |
4527 *((float *)v10 + 21) = v13 - v14; | 4527 *((float *)v10 + 21) = v13 - v14; |
4528 if ( (double)(signed int)pViewport->uViewportX <= *((float *)v10 + 20) | 4528 if ( (double)(signed int)pViewport->uViewportTL_X <= *((float *)v10 + 20) |
4529 && (double)(signed int)pViewport->uViewportZ > *((float *)v10 + 20) | 4529 && (double)(signed int)pViewport->uViewportBR_X > *((float *)v10 + 20) |
4530 && (double)(signed int)pViewport->uViewportY <= *((float *)v10 + 21) | 4530 && (double)(signed int)pViewport->uViewportTL_Y <= *((float *)v10 + 21) |
4531 && (double)(signed int)pViewport->uViewportW > *((float *)v10 + 21) ) | 4531 && (double)(signed int)pViewport->uViewportBR_Y > *((float *)v10 + 21) ) |
4532 v16 = 1; | 4532 v16 = 1; |
4533 ++v1; | 4533 ++v1; |
4534 v10 += 16; | 4534 v10 += 16; |
4535 } | 4535 } |
4536 while ( v1 < v2->field_10 ); | 4536 while ( v1 < v2->field_10 ); |
6143 _this.field_24 = 0x2000000; | 6143 _this.field_24 = 0x2000000; |
6144 | 6144 |
6145 _this.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed; | 6145 _this.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed; |
6146 _this.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed; | 6146 _this.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed; |
6147 | 6147 |
6148 array_50AC10[0].vWorldViewProjX = pViewport->uViewportX; | 6148 array_50AC10[0].vWorldViewProjX = pViewport->uViewportTL_X; |
6149 array_50AC10[0].vWorldViewProjY = pViewport->uViewportY; | 6149 array_50AC10[0].vWorldViewProjY = pViewport->uViewportTL_Y; |
6150 | 6150 |
6151 array_50AC10[1].vWorldViewProjX = pViewport->uViewportX; | 6151 array_50AC10[1].vWorldViewProjX = pViewport->uViewportTL_X; |
6152 array_50AC10[1].vWorldViewProjY = v38; | 6152 array_50AC10[1].vWorldViewProjY = v38; |
6153 | 6153 |
6154 array_50AC10[2].vWorldViewProjX = pViewport->uViewportZ; | 6154 array_50AC10[2].vWorldViewProjX = pViewport->uViewportBR_X; |
6155 array_50AC10[2].vWorldViewProjY = pViewport->uViewportY; | 6155 array_50AC10[2].vWorldViewProjY = pViewport->uViewportTL_Y; |
6156 | 6156 |
6157 array_50AC10[3].vWorldViewProjX = pViewport->uViewportZ; | 6157 array_50AC10[3].vWorldViewProjX = pViewport->uViewportBR_X; |
6158 array_50AC10[3].vWorldViewProjY = v38; | 6158 array_50AC10[3].vWorldViewProjY = v38; |
6159 | 6159 |
6160 /*v36 = (double)(pViewport->uViewportZ - pViewport->uViewportX) * 0.5; | 6160 /*v36 = (double)(pViewport->uViewportZ - pViewport->uViewportX) * 0.5; |
6161 v33 = 65536 / (signed int)(v36 / tan(0.6457717418670654) + 0.5); | 6161 v33 = 65536 / (signed int)(v36 / tan(0.6457717418670654) + 0.5); |
6162 | 6162 |
6463 if ( !X ) | 6463 if ( !X ) |
6464 goto LABEL_14; | 6464 goto LABEL_14; |
6465 v21 = abs(v19 >> 14); | 6465 v21 = abs(v19 >> 14); |
6466 if ( v21 <= abs(X) ) | 6466 if ( v21 <= abs(X) ) |
6467 break; | 6467 break; |
6468 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportY ) | 6468 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) |
6469 break; | 6469 break; |
6470 v19 = v77; | 6470 v19 = v77; |
6471 v20 = v79; | 6471 v20 = v79; |
6472 LABEL_14: | 6472 LABEL_14: |
6473 LODWORD(v80) = v62.v_18.z; | 6473 LODWORD(v80) = v62.v_18.z; |
6583 if ( !X ) | 6583 if ( !X ) |
6584 goto LABEL_36; | 6584 goto LABEL_36; |
6585 v40 = abs(X); | 6585 v40 = abs(X); |
6586 if ( abs((signed __int64)v65) <= v40 ) | 6586 if ( abs((signed __int64)v65) <= v40 ) |
6587 break; | 6587 break; |
6588 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportY ) | 6588 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y ) |
6589 break; | 6589 break; |
6590 v39 = v78; | 6590 v39 = v78; |
6591 LABEL_36: | 6591 LABEL_36: |
6592 v78 = v62.v_18.z; | 6592 v78 = v62.v_18.z; |
6593 v41 = (unsigned __int64)(v62.v_18.z * (signed __int64)v39) >> 16; | 6593 v41 = (unsigned __int64)(v62.v_18.z * (signed __int64)v39) >> 16; |
12288 pRenderer->ResetClip(); | 12288 pRenderer->ResetClip(); |
12289 } | 12289 } |
12290 | 12290 |
12291 | 12291 |
12292 //----- (00442955) -------------------------------------------------------- | 12292 //----- (00442955) -------------------------------------------------------- |
12293 void DrawBook_Map_sub( unsigned int x, unsigned int y, unsigned int width, int height, int _48074 ) | 12293 void DrawBook_Map_sub( unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074 ) |
12294 { | 12294 { |
12295 int v5; // ebx@1 | 12295 int v5; // ebx@1 |
12296 int v6; // edi@1 | 12296 int v6; // edi@1 |
12297 BLVMapOutlines *v7; // eax@8 | 12297 BLVMapOutlines *v7; // eax@8 |
12298 unsigned __int8 v8; // zf@8 | 12298 unsigned __int8 v8; // zf@8 |
12318 int v28; // edx@21 | 12318 int v28; // edx@21 |
12319 int v29; // eax@21 | 12319 int v29; // eax@21 |
12320 double v30; // st7@23 | 12320 double v30; // st7@23 |
12321 signed __int64 v31; // qax@23 | 12321 signed __int64 v31; // qax@23 |
12322 unsigned short *v32; // edx@23 | 12322 unsigned short *v32; // edx@23 |
12323 int v33; // esi@23 | 12323 int textr_width; // esi@23 |
12324 signed int v34; // eax@23 | 12324 signed int v34; // eax@23 |
12325 signed int v35; // ecx@23 | 12325 signed int v35; // ecx@23 |
12326 int v36; // esi@27 | 12326 int v36; // esi@27 |
12327 int v37; // ecx@27 | 12327 int v37; // ecx@27 |
12328 int v38; // edx@31 | 12328 int v38; // edx@31 |
12360 unsigned int v70; // [sp-10h] [bp-48074h]@80 | 12360 unsigned int v70; // [sp-10h] [bp-48074h]@80 |
12361 unsigned int v71; // [sp-Ch] [bp-48070h]@80 | 12361 unsigned int v71; // [sp-Ch] [bp-48070h]@80 |
12362 unsigned int v72; // [sp-8h] [bp-4806Ch]@80 | 12362 unsigned int v72; // [sp-8h] [bp-4806Ch]@80 |
12363 signed int v73; // [sp-4h] [bp-48068h]@59 | 12363 signed int v73; // [sp-4h] [bp-48068h]@59 |
12364 unsigned __int16 v74; // [sp-4h] [bp-48068h]@79 | 12364 unsigned __int16 v74; // [sp-4h] [bp-48068h]@79 |
12365 unsigned short v75[131070]; // [sp+Ch] [bp-48058h]@23 | 12365 unsigned short map_texture_16[147456]; // [sp+Ch] [bp-48058h]@23 |
12366 int v76; // [sp+4800Ch] [bp-58h]@23 | 12366 int v76; // [sp+4800Ch] [bp-58h]@23 |
12367 unsigned __int16 *v77; // [sp+48010h] [bp-54h]@27 | 12367 unsigned __int16 *v77; // [sp+48010h] [bp-54h]@27 |
12368 unsigned __int16 *v78; // [sp+48014h] [bp-50h]@23 | 12368 unsigned __int16 *pPalette_16; // [sp+48014h] [bp-50h]@23 |
12369 unsigned int v79; // [sp+48018h] [bp-4Ch]@1 | 12369 unsigned int surfPitch; // [sp+48018h] [bp-4Ch]@1 |
12370 unsigned int y_; // [sp+4801Ch] [bp-48h]@1 | 12370 |
12371 int v81; // [sp+48020h] [bp-44h]@23 | 12371 int v81; // [sp+48020h] [bp-44h]@23 |
12372 unsigned int x_; // [sp+48024h] [bp-40h]@1 | 12372 unsigned __int16* render16_data; |
12373 unsigned char* texture8_data; | |
12374 unsigned char* curr_line; | |
12375 int scale_increment; | |
12376 int scaled_posX; | |
12377 int scaled_posY; | |
12378 int stepX_r; | |
12379 int stepY_r; | |
12380 | |
12381 | |
12373 unsigned int teal; // [sp+48028h] [bp-3Ch]@8 | 12382 unsigned int teal; // [sp+48028h] [bp-3Ch]@8 |
12374 int v84; // [sp+4802Ch] [bp-38h]@1 | 12383 int v84; // [sp+4802Ch] [bp-38h]@1 |
12375 int v85; // [sp+48030h] [bp-34h]@1 | 12384 int screenCenter_X; // [sp+48030h] [bp-34h]@1 |
12376 int v86; // [sp+48034h] [bp-30h]@1 | 12385 int v86; // [sp+48034h] [bp-30h]@1 |
12377 int v87; // [sp+48038h] [bp-2Ch]@16 | 12386 int v87; // [sp+48038h] [bp-2Ch]@16 |
12378 unsigned int v88; // [sp+4803Ch] [bp-28h]@16 | 12387 unsigned int v88; // [sp+4803Ch] [bp-28h]@16 |
12379 int black; // [sp+48040h] [bp-24h]@8 | 12388 int black; // [sp+48040h] [bp-24h]@8 |
12380 int v90; // [sp+48044h] [bp-20h]@1 | 12389 int screenCenterY; // [sp+48044h] [bp-20h]@1 |
12381 unsigned int i; // [sp+48048h] [bp-1Ch]@9 | 12390 unsigned int i; // [sp+48048h] [bp-1Ch]@9 |
12382 unsigned int v92; // [sp+4804Ch] [bp-18h]@16 | 12391 unsigned int screenHeight; // [sp+4804Ch] [bp-18h]@16 |
12383 unsigned __int16 *v93; // [sp+48050h] [bp-14h]@16 | 12392 unsigned __int16 *v93; // [sp+48050h] [bp-14h]@16 |
12384 signed int v94; // [sp+48054h] [bp-10h]@8 | 12393 signed int screenWidth; // [sp+48054h] [bp-10h]@8 |
12385 unsigned int v95; // [sp+48058h] [bp-Ch]@16 | 12394 unsigned int v95; // [sp+48058h] [bp-Ch]@16 |
12386 int v96; // [sp+4805Ch] [bp-8h]@10 | 12395 int v96; // [sp+4805Ch] [bp-8h]@10 |
12387 const void *v97; // [sp+48060h] [bp-4h]@16 | 12396 const void *v97; // [sp+48060h] [bp-4h]@16 |
12388 unsigned short *a4a; // [sp+4806Ch] [bp+8h]@85 | 12397 unsigned short *a4a; // [sp+4806Ch] [bp+8h]@85 |
12389 int a5a; // [sp+48070h] [bp+Ch]@86 | 12398 int a5a; // [sp+48070h] [bp+Ch]@86 |
12390 | 12399 |
12391 x_ = x; | 12400 tl_x = tl_x; |
12392 y_ = y; | 12401 tl_y = tl_y; |
12393 v85 = (signed int)(x + width) >> 1; | 12402 screenCenter_X = (signed int)(tl_x + br_x) >> 1; |
12394 v90 = (signed int)(y + height) >> 1; | 12403 screenCenterY = (signed int)(tl_y + br_y) >> 1; |
12395 v79 = pRenderer->uTargetSurfacePitch; | 12404 surfPitch = pRenderer->uTargetSurfacePitch; |
12396 pRenderer->Clip_v2(x, y, width, height); | 12405 pRenderer->Clip_v2(tl_x, tl_y, br_x, br_y); |
12397 v5 = viewparams->field_2C; | 12406 v5 = viewparams->field_2C; |
12398 v6 = viewparams->sPartyPosX; | 12407 v6 = viewparams->sViewCenterX; |
12399 v86 = viewparams->sPartyPosX; | 12408 v86 = viewparams->sViewCenterX; |
12400 v84 = viewparams->sPartyPosZ; | 12409 v84 = viewparams->sViewCenterY; |
12401 if ( viewparams->field_2C != 384 ) | 12410 if ( viewparams->field_2C != 384 ) |
12402 { | 12411 { |
12403 if ( viewparams->field_2C == 768 ) | 12412 if ( viewparams->field_2C == 768 ) |
12404 { | 12413 { |
12405 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | 12414 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
12414 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | 12423 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
12415 v5 = viewparams->field_2C - 34; | 12424 v5 = viewparams->field_2C - 34; |
12416 } | 12425 } |
12417 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) | 12426 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) |
12418 { | 12427 { |
12419 v94 = width - x_ + 1; | 12428 screenWidth = br_x - tl_x + 1; |
12420 v92 = height - y_ + 1; | 12429 screenHeight = br_y - tl_y + 1; |
12421 v93 = &pRenderer->pTargetSurface[x_ + y_ * v79]; | 12430 render16_data = &pRenderer->pTargetSurface[tl_x + tl_y * surfPitch]; |
12422 v95 = (unsigned int)pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0; | 12431 texture8_data = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0; |
12423 v78 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; | 12432 pPalette_16 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; |
12424 v87 = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / v5; | 12433 scale_increment = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / v5; |
12434 | |
12425 v30 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); | 12435 v30 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); |
12426 black = 22528 / (v5 / 384); | 12436 |
12427 teal = (unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16; | 12437 |
12438 teal = (unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16; | |
12428 v97 = (const void *)((unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16); | 12439 v97 = (const void *)((unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16); |
12429 v96 = 32768 - black - v84; | 12440 |
12430 v31 = (signed __int64)((double)v96 / v30); | 12441 v32 = map_texture_16; |
12431 v32 = v75; | 12442 textr_width = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; |
12432 v33 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; | 12443 stepY_r = (int)(signed __int64)((double)(- v84 - 22528 / (v5 / 384)+ 32768) / v30) << 16; |
12433 v34 = (int)v31 << 16; | 12444 v81 = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30); |
12434 v81 = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30); | |
12435 black = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30); | 12445 black = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30); |
12436 v76 = v33; | 12446 |
12437 v35 = v34 >> 16; | 12447 v76 = textr_width; |
12438 if ( v95 && (signed int)v92 > 0 ) | 12448 scaled_posY = stepY_r >> 16; |
12439 { | 12449 //nearest neiborhood scaling |
12440 v96 = v92; | 12450 if ( texture8_data) |
12441 do | 12451 { |
12442 { | 12452 for(uint i=0; i<screenHeight;++i) |
12443 v88 = 0; | 12453 { |
12444 if ( (signed int)v94 > 0 ) | 12454 curr_line=&texture8_data[scaled_posY*textr_width]; |
12455 stepX_r=teal; | |
12456 for(uint j=0; j<screenWidth;++j) | |
12457 { | |
12458 scaled_posX=stepX_r>>16; | |
12459 map_texture_16[i*screenWidth+j]=pPalette_16[*(curr_line+scaled_posX)]; | |
12460 stepX_r+=scale_increment; | |
12461 } | |
12462 stepY_r+=scale_increment; | |
12463 scaled_posY=stepY_r>>16; | |
12464 } | |
12465 } | |
12466 //move visible square to render | |
12467 for(uint i=0; i<screenHeight;++i) | |
12445 { | 12468 { |
12446 v36 = v95 + v35 * v76; | 12469 if ( screenWidth > 0 ) |
12447 i = v94; | 12470 { |
12448 v88 = v94; | 12471 memcpy((void*)&render16_data[surfPitch*i],(void*)&map_texture_16[i*screenWidth], screenWidth*2); |
12449 v37 = black; | 12472 } |
12450 v77 = (unsigned __int16 *)v36; | |
12451 do | |
12452 { | |
12453 *(short *)v32 = v78[*((char *)v77 + v37)];//crash | |
12454 ++v32; | |
12455 v97 = (char *)v97 + v87; | |
12456 v37 = (signed int)v97 >> 16; | |
12457 --i; | |
12458 } | |
12459 while ( i ); | |
12460 } | 12473 } |
12461 v34 += v87; | |
12462 v97 = (const void *)teal; | |
12463 black = v81; | |
12464 v32 += 2 * (v94 - v88); | |
12465 v35 = v34 >> 16; | |
12466 --v96; | |
12467 } | |
12468 while ( v96 ); | |
12469 } | |
12470 v97 = &v75; | |
12471 if ( (signed int)v92 > 0 ) | |
12472 { | |
12473 v96 = v92; | |
12474 v38 = 2 * (v79 - v94); | |
12475 do | |
12476 { | |
12477 if ( (signed int)v94 > 0 ) | |
12478 { | |
12479 v39 = v94; | |
12480 v40 = (short *)v97; | |
12481 v41 = (short *)v93; | |
12482 v42 = v94 & 1; | |
12483 v43 = v94 >> 1; | |
12484 memcpy(v93, v97, 2 * (v94 >> 1)); | |
12485 v45 = &v40[2 * v43]; | |
12486 v44 = &v41[2 * v43]; | |
12487 v46 = v42; | |
12488 v39 *= 2; | |
12489 v93 = (unsigned __int16 *)((char *)v93 + v39); | |
12490 v97 = (char *)v97 + v39; | |
12491 while ( v46 ) | |
12492 { | |
12493 *v44 = *v45; | |
12494 ++v45; | |
12495 ++v44; | |
12496 --v46; | |
12497 } | |
12498 v6 = v86; | |
12499 } | |
12500 v93 = (unsigned __int16 *)((char *)v93 + v38); | |
12501 --v96; | |
12502 } | |
12503 while ( v96 ); | |
12504 } | |
12505 } | 12474 } |
12506 else | 12475 else |
12507 { | 12476 { |
12508 black = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0); | 12477 black = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0); |
12509 teal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0xFFu); | 12478 teal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0xFFu); |
12510 v7 = pIndoor->pMapOutlines; | 12479 v7 = pIndoor->pMapOutlines; |
12511 uNumBlueFacesInBLVMinimap = 0; | 12480 uNumBlueFacesInBLVMinimap = 0; |
12512 v8 = pIndoor->pMapOutlines->uNumOutlines == 0; | 12481 v8 = pIndoor->pMapOutlines->uNumOutlines == 0; |
12513 v9 = pIndoor->pMapOutlines->uNumOutlines < 0; | 12482 v9 = pIndoor->pMapOutlines->uNumOutlines < 0; |
12514 v94 = 0; | 12483 screenWidth = 0; |
12515 if ( !(v9 | v8) ) | 12484 if ( !(v9 | v8) ) |
12516 { | 12485 { |
12517 i = 0; | 12486 i = 0; |
12518 do | 12487 do |
12519 { | 12488 { |
12524 v12 = *(short *)((char *)v7 + i + 14); | 12493 v12 = *(short *)((char *)v7 + i + 14); |
12525 if ( !(v12 & 1) ) | 12494 if ( !(v12 & 1) ) |
12526 { | 12495 { |
12527 if ( !(!(v96 & 0x80) && (v11 & 0x80u) == 0 )) | 12496 if ( !(!(v96 & 0x80) && (v11 & 0x80u) == 0 )) |
12528 { | 12497 { |
12529 v96 = (signed int)v94 >> 3; | 12498 v96 = (signed int)screenWidth >> 3; |
12530 v13 = v94; | 12499 v13 = screenWidth; |
12531 *(short *)(v10 + 10) = v12 | 1; | 12500 *(short *)(v10 + 10) = v12 | 1; |
12532 pIndoor->_visible_outlines[v96] |= 1 << (7 - v13 % 8); | 12501 pIndoor->_visible_outlines[v96] |= 1 << (7 - v13 % 8); |
12533 } | 12502 } |
12534 } | 12503 } |
12535 if ( (!(v12 & 1) && !(!(v96 & 0x80) && (v11 & 0x80u) == 0 )) || v12 & 1) | 12504 if ( (!(v12 & 1) && !(!(v96 & 0x80) && (v11 & 0x80u) == 0 )) || v12 & 1) |
12538 v88 = v5; | 12507 v88 = v5; |
12539 v15 = &pIndoor->pVertices[v14]; | 12508 v15 = &pIndoor->pVertices[v14]; |
12540 v16 = v15->x; | 12509 v16 = v15->x; |
12541 v17 = v15->y - v84; | 12510 v17 = v15->y - v84; |
12542 v93 = (unsigned __int16 *)(v16 - v6); | 12511 v93 = (unsigned __int16 *)(v16 - v6); |
12543 v92 = v17; | 12512 screenHeight = v17; |
12544 v18 = &pIndoor->pVertices[*(short *)(v10 + 2)]; | 12513 v18 = &pIndoor->pVertices[*(short *)(v10 + 2)]; |
12545 v19 = v18->x; | 12514 v19 = v18->x; |
12546 v20 = v18->y - v84; | 12515 v20 = v18->y - v84; |
12547 v95 = v19 - v6; | 12516 v95 = v19 - v6; |
12548 v97 = (const void *)v20; | 12517 v97 = (const void *)v20; |
12549 v88 = (unsigned __int64)((v16 - v6) * (signed __int64)v5) >> 16; | 12518 v88 = (unsigned __int64)((v16 - v6) * (signed __int64)v5) >> 16; |
12550 v87 = (unsigned __int64)((signed int)v92 * (signed __int64)v5) >> 16; | 12519 v87 = (unsigned __int64)((signed int)screenHeight * (signed __int64)v5) >> 16; |
12551 v93 = (unsigned __int16 *)((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16); | 12520 v93 = (unsigned __int16 *)((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16); |
12552 v92 = (unsigned __int64)(v20 * (signed __int64)v5) >> 16; | 12521 screenHeight = (unsigned __int64)(v20 * (signed __int64)v5) >> 16; |
12553 pRenderer->Line2D( | 12522 pRenderer->Line2D( |
12554 v85 + v88, | 12523 screenCenter_X + v88, |
12555 v90 - v87, | 12524 screenCenterY - v87, |
12556 v85 + ((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16), | 12525 screenCenter_X + ((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16), |
12557 v90 - v92, | 12526 screenCenterY - screenHeight, |
12558 black); | 12527 black); |
12559 v7 = pIndoor->pMapOutlines; | 12528 v7 = pIndoor->pMapOutlines; |
12560 } | 12529 } |
12561 } | 12530 } |
12562 ++v94; | 12531 ++screenWidth; |
12563 i += 12; | 12532 i += 12; |
12564 } | 12533 } |
12565 while ( v94 < (signed int)v7->uNumOutlines ); | 12534 while ( screenWidth < (signed int)v7->uNumOutlines ); |
12566 } | 12535 } |
12567 v21 = 0; | 12536 v21 = 0; |
12568 if ( (signed int)uNumBlueFacesInBLVMinimap > 0 ) | 12537 if ( (signed int)uNumBlueFacesInBLVMinimap > 0 ) |
12569 { | 12538 { |
12570 while ( 1 ) | 12539 while ( 1 ) |
12577 v26 = v25->x; | 12546 v26 = v25->x; |
12578 v27 = (unsigned __int16 *)(v24->x - v86); | 12547 v27 = (unsigned __int16 *)(v24->x - v86); |
12579 v28 = v24->y - v84; | 12548 v28 = v24->y - v84; |
12580 v29 = v25->y - v84; | 12549 v29 = v25->y - v84; |
12581 v93 = v27; | 12550 v93 = v27; |
12582 v92 = v28; | 12551 screenHeight = v28; |
12583 v97 = (const void *)v29; | 12552 v97 = (const void *)v29; |
12584 v87 = (unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16; | 12553 v87 = (unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16; |
12585 v88 = (unsigned __int64)(v28 * (signed __int64)v5) >> 16; | 12554 v88 = (unsigned __int64)(v28 * (signed __int64)v5) >> 16; |
12586 i = (unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16; | 12555 i = (unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16; |
12587 v95 = (unsigned __int64)(v29 * (signed __int64)v5) >> 16; | 12556 v95 = (unsigned __int64)(v29 * (signed __int64)v5) >> 16; |
12588 pRenderer->Line2D( | 12557 pRenderer->Line2D( |
12589 v85 + ((unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16), | 12558 screenCenter_X + ((unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16), |
12590 v90 - v88, | 12559 screenCenterY - v88, |
12591 v85 + ((unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16), | 12560 screenCenter_X + ((unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16), |
12592 v90 - v95, | 12561 screenCenterY - v95, |
12593 teal); | 12562 teal); |
12594 ++v21; | 12563 ++v21; |
12595 if ( v21 >= (signed int)uNumBlueFacesInBLVMinimap ) | 12564 if ( v21 >= (signed int)uNumBlueFacesInBLVMinimap ) |
12596 break; | 12565 break; |
12597 v7 = pIndoor->pMapOutlines; | 12566 v7 = pIndoor->pMapOutlines; |
12598 } | 12567 } |
12599 v6 = v86; | 12568 v6 = v86; |
12600 } | 12569 } |
12601 } | 12570 } |
12602 v47 = ((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + v85 - 3; | 12571 v47 = ((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + screenCenter_X - 3; |
12603 v81 = pParty->vPosition.y - v84; | 12572 v81 = pParty->vPosition.y - v84; |
12604 v97 = (const void *)((unsigned __int64)((pParty->vPosition.y - v84) * (signed __int64)v5) >> 16); | 12573 v97 = (const void *)((unsigned __int64)((pParty->vPosition.y - v84) * (signed __int64)v5) >> 16); |
12605 v48 = 1; | 12574 v48 = 1; |
12606 v49 = v90 - (int)v97 - 3; | 12575 v49 = screenCenterY - (int)v97 - 3; |
12607 if ( v47 >= (signed int)x_ ) | 12576 if ( v47 >= (signed int)tl_x ) |
12608 { | 12577 { |
12609 if ( v47 > (signed int)width ) | 12578 if ( v47 > (signed int)br_x ) |
12610 { | 12579 { |
12611 if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + v85 - 6) > (signed int)width ) | 12580 if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + screenCenter_X - 6) > (signed int)br_x ) |
12612 v48 = 0; | 12581 v48 = 0; |
12613 v47 = width; | 12582 v47 = br_x; |
12614 } | 12583 } |
12615 } | 12584 } |
12616 else | 12585 else |
12617 { | 12586 { |
12618 if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + v85) < (signed int)x_ ) | 12587 if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + screenCenter_X) < (signed int)tl_x ) |
12619 v48 = 0; | 12588 v48 = 0; |
12620 v47 = x_; | 12589 v47 = tl_x; |
12621 } | 12590 } |
12622 if ( v49 >= (signed int)y_ ) | 12591 if ( v49 >= (signed int)tl_y ) |
12623 { | 12592 { |
12624 if ( v49 > height ) | 12593 if ( v49 > br_y ) |
12625 { | 12594 { |
12626 if ( v90 - (signed int)v97 - 6 > height ) | 12595 if ( screenCenterY - (signed int)v97 - 6 > br_y ) |
12627 v48 = 0; | 12596 v48 = 0; |
12628 v49 = height; | 12597 v49 = br_y; |
12629 } | 12598 } |
12630 } | 12599 } |
12631 else | 12600 else |
12632 { | 12601 { |
12633 if ( v90 - (signed int)v97 < (signed int)y_ ) | 12602 if ( screenCenterY - (signed int)v97 < (signed int)tl_y ) |
12634 v48 = 0; | 12603 v48 = 0; |
12635 v49 = y_; | 12604 v49 = tl_y; |
12636 } | 12605 } |
12637 if ( v48 == 1 ) | 12606 if ( v48 == 1 ) |
12638 { | 12607 { |
12639 v50 = 0; | 12608 v50 = 0; |
12640 v51 = pParty->sRotationY & stru_5C6E00->uDoublePiMask; | 12609 v51 = pParty->sRotationY & stru_5C6E00->uDoublePiMask; |
12690 result = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); | 12659 result = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); |
12691 v95 = 0; | 12660 v95 = 0; |
12692 v86 = result; | 12661 v86 = result; |
12693 if ( (signed int)uNumLevelDecorations > 0 ) | 12662 if ( (signed int)uNumLevelDecorations > 0 ) |
12694 { | 12663 { |
12695 v94 = (unsigned int)&pLevelDecorations[0].vPosition; | 12664 screenWidth = (unsigned int)&pLevelDecorations[0].vPosition; |
12696 do | 12665 do |
12697 { | 12666 { |
12698 if ( *(char *)(v94 - 2) & 8 ) | 12667 if ( *(char *)(screenWidth - 2) & 8 ) |
12699 { | 12668 { |
12700 v53 = *(int *)(v94 + 4) - v84; | 12669 v53 = *(int *)(screenWidth + 4) - v84; |
12701 v93 = (unsigned __int16 *)(*(int *)v94 - v6); | 12670 v93 = (unsigned __int16 *)(*(int *)screenWidth - v6); |
12702 v92 = v53; | 12671 screenHeight = v53; |
12703 v54 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + v85; | 12672 v54 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + screenCenter_X; |
12704 v97 = (const void *)((unsigned __int64)(v53 * (signed __int64)v5) >> 16); | 12673 v97 = (const void *)((unsigned __int64)(v53 * (signed __int64)v5) >> 16); |
12705 v55 = v90 - (int)v97; | 12674 v55 = screenCenterY - (int)v97; |
12706 if ( v54 >= pRenderer->field_1C_clipx ) | 12675 if ( v54 >= pRenderer->field_1C_clipx ) |
12707 { | 12676 { |
12708 if ( v54 <= pRenderer->field_24_width && v55 >= pRenderer->field_20_clipy && v55 <= pRenderer->field_28_height ) | 12677 if ( v54 <= pRenderer->field_24_width && v55 >= pRenderer->field_20_clipy && v55 <= pRenderer->field_28_height ) |
12709 { | 12678 { |
12710 v74 = v86; | 12679 v74 = v86; |
12720 v71 = v54; | 12689 v71 = v54; |
12721 v70 = black; | 12690 v70 = black; |
12722 } | 12691 } |
12723 else | 12692 else |
12724 { | 12693 { |
12725 v72 = v90 - (int)v97; | 12694 v72 = screenCenterY - (int)v97; |
12726 v71 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + v85; | 12695 v71 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + screenCenter_X; |
12727 v70 = v90 - (int)v97; | 12696 v70 = screenCenterY - (int)v97; |
12728 } | 12697 } |
12729 pRenderer->Line2D(v54, v70, v71, v72, v74); | 12698 pRenderer->Line2D(v54, v70, v71, v72, v74); |
12730 } | 12699 } |
12731 } | 12700 } |
12732 } | 12701 } |
12733 ++v95; | 12702 ++v95; |
12734 result = v95; | 12703 result = v95; |
12735 v94 += 32; | 12704 screenWidth += 32; |
12736 } | 12705 } |
12737 while ( (signed int)v95 < (signed int)uNumLevelDecorations ); | 12706 while ( (signed int)v95 < (signed int)uNumLevelDecorations ); |
12738 } | 12707 } |
12739 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | 12708 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) |
12740 { | 12709 { |
12741 v90 = width - x_ + 1; | 12710 screenCenterY = br_x - tl_x + 1; |
12742 v95 = height - y_ + 1; | 12711 v95 = br_y - tl_y + 1; |
12743 v77 = &pRenderer->pTargetSurface[x_ + y_ * v79]; | 12712 v77 = &pRenderer->pTargetSurface[tl_x + tl_y * surfPitch]; |
12744 v56 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2; | 12713 v56 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2; |
12745 black = (1 << (v56 + 16)) / v5; | 12714 black = (1 << (v56 + 16)) / v5; |
12746 v57 = (double)(1 << (16 - v56)); | 12715 v57 = (double)(1 << (16 - v56)); |
12747 v58 = 22528 / (v5 / 384); | 12716 v58 = 22528 / (v5 / 384); |
12748 v59 = (signed __int64)((double)(v6 - v58 + 32768) / v57); | 12717 v59 = (signed __int64)((double)(v6 - v58 + 32768) / v57); |
12749 v60 = (int)v59 << 16; | 12718 v60 = (int)v59 << 16; |
12750 v97 = (const void *)((int)v59 << 16); | 12719 v97 = (const void *)((int)v59 << 16); |
12751 v61 = (signed __int64)((double)(32768 - v58 - v84) / v57); | 12720 v61 = (signed __int64)((double)(32768 - v58 - v84) / v57); |
12752 v78 = (unsigned __int16 *)(v60 >> 16); | 12721 pPalette_16 = (unsigned __int16 *)(v60 >> 16); |
12753 v62 = (int)v61 << 16; | 12722 v62 = (int)v61 << 16; |
12754 teal = v60 >> 16; | 12723 teal = v60 >> 16; |
12755 v63 = (signed __int16)v61; | 12724 v63 = (signed __int16)v61; |
12756 a4a = v75; | 12725 a4a = map_texture_16; |
12757 result = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xCu, 0xCu, 0xCu); | 12726 result = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xCu, 0xCu, 0xCu); |
12758 v85 = 0; | 12727 screenCenter_X = 0; |
12759 for ( i = result; v85 < (signed int)v95; result = v85 ) | 12728 for ( i = result; screenCenter_X < (signed int)v95; result = screenCenter_X ) |
12760 { | 12729 { |
12761 a5a = 0; | 12730 a5a = 0; |
12762 if ( v90 > 0 ) | 12731 if ( screenCenterY > 0 ) |
12763 { | 12732 { |
12764 v96 = (v63 - 80) / 4; | 12733 v96 = (v63 - 80) / 4; |
12765 v64 = teal; | 12734 v64 = teal; |
12766 do | 12735 do |
12767 { | 12736 { |
12768 v81 = (v64 - 80) / 4; | 12737 v81 = (v64 - 80) / 4; |
12769 if ( !pOutdoor->_47F04C(v81, v96) ) | 12738 if ( !pOutdoor->_47F04C(v81, v96) ) |
12770 { | 12739 { |
12771 if ( pOutdoor->_47F097(v81, v96) ) | 12740 if ( pOutdoor->_47F097(v81, v96) ) |
12772 { | 12741 { |
12773 if ( !((a5a + v85) % 2) ) | 12742 if ( !((a5a + screenCenter_X) % 2) ) |
12774 *a4a = i; | 12743 *a4a = i; |
12775 } | 12744 } |
12776 else | 12745 else |
12777 { | 12746 { |
12778 *a4a = 0; | 12747 *a4a = 0; |
12781 ++a4a; | 12750 ++a4a; |
12782 v97 = (char *)v97 + black; | 12751 v97 = (char *)v97 + black; |
12783 v64 = (signed int)v97 >> 16; | 12752 v64 = (signed int)v97 >> 16; |
12784 ++a5a; | 12753 ++a5a; |
12785 } | 12754 } |
12786 while ( a5a < v90 ); | 12755 while ( a5a < screenCenterY ); |
12787 } | 12756 } |
12788 v62 += black; | 12757 v62 += black; |
12789 v97 = (const void *)v60; | 12758 v97 = (const void *)v60; |
12790 a4a += v90 - a5a; | 12759 a4a += screenCenterY - a5a; |
12791 v63 = v62 >> 16; | 12760 v63 = v62 >> 16; |
12792 ++v85; | 12761 ++screenCenter_X; |
12793 teal = (unsigned int)v78; | 12762 teal = (unsigned int)pPalette_16; |
12794 } | 12763 } |
12795 v65 = v95; | 12764 v65 = v95; |
12796 v66 = v75; | 12765 v66 = map_texture_16; |
12797 if ( (signed int)v95 > 0 ) | 12766 if ( (signed int)v95 > 0 ) |
12798 { | 12767 { |
12799 v67 = v77; | 12768 v67 = v77; |
12800 result = 2 * (v79 - v90); | 12769 result = 2 * (surfPitch - screenCenterY); |
12801 do | 12770 do |
12802 { | 12771 { |
12803 if ( v90 > 0 ) | 12772 if ( screenCenterY > 0 ) |
12804 { | 12773 { |
12805 v68 = v90; | 12774 v68 = screenCenterY; |
12806 do | 12775 do |
12807 { | 12776 { |
12808 v69 = *(short *)v66; | 12777 v69 = *(short *)v66; |
12809 if ( !*(short *)v66 || v69 == (short)i ) | 12778 if ( !*(short *)v66 || v69 == (short)i ) |
12810 *v67 = v69; | 12779 *v67 = v69; |
13431 int v20; // [sp+10h] [bp-10h]@1 | 13400 int v20; // [sp+10h] [bp-10h]@1 |
13432 int v21; // [sp+14h] [bp-Ch]@1 | 13401 int v21; // [sp+14h] [bp-Ch]@1 |
13433 unsigned int v22; // [sp+18h] [bp-8h]@8 | 13402 unsigned int v22; // [sp+18h] [bp-8h]@8 |
13434 int pX; // [sp+1Ch] [bp-4h]@3 | 13403 int pX; // [sp+1Ch] [bp-4h]@3 |
13435 | 13404 |
13436 v20 = viewparams->sPartyPosX; | 13405 v20 = viewparams->sViewCenterX; |
13437 v21 = viewparams->sPartyPosZ; | 13406 v21 = viewparams->sViewCenterY; |
13438 v19 = (double)viewparams->field_2C * 0.000015258789; | 13407 v19 = (double)viewparams->field_2C * 0.000015258789; |
13439 if ( viewparams->field_2C == 384 ) | 13408 if ( viewparams->field_2C == 384 ) |
13440 { | 13409 { |
13441 v20 = viewparams->field_38; | 13410 v20 = viewparams->field_38; |
13442 v21 = viewparams->field_3A; | 13411 v21 = viewparams->field_3A; |