comparison mm7_3.cpp @ 718:a5ee769b02c6

Слияние
author Ritor1
date Mon, 18 Mar 2013 01:51:31 +0600
parents d5473972234d af0332a32034
children 70c5a87a1307
comparison
equal deleted inserted replaced
717:d5473972234d 718:a5ee769b02c6
4477 v9 = v6 * *(float *)v4; 4477 v9 = v6 * *(float *)v4;
4478 *((int *)v4 + 20) = LODWORD(v5); 4478 *((int *)v4 + 20) = LODWORD(v5);
4479 *((float *)v4 + 19) = v8 - v9; 4479 *((float *)v4 + 19) = v8 - v9;
4480 } 4480 }
4481 *((int *)v4 + 21) = *((int *)v4 + 1); 4481 *((int *)v4 + 21) = *((int *)v4 + 1);
4482 if ( (double)(signed int)pViewport->uViewportX <= *((float *)v4 + 18) 4482 if ( (double)(signed int)pViewport->uViewportTL_X <= *((float *)v4 + 18)
4483 && (double)(signed int)pViewport->uViewportZ > *((float *)v4 + 18) 4483 && (double)(signed int)pViewport->uViewportBR_X > *((float *)v4 + 18)
4484 && (double)(signed int)pViewport->uViewportY <= *((float *)v4 + 19) 4484 && (double)(signed int)pViewport->uViewportTL_Y <= *((float *)v4 + 19)
4485 && (double)(signed int)pViewport->uViewportW > *((float *)v4 + 19) ) 4485 && (double)(signed int)pViewport->uViewportBR_Y > *((float *)v4 + 19) )
4486 v16 = 1; 4486 v16 = 1;
4487 ++v3; 4487 ++v3;
4488 v4 += 16; 4488 v4 += 16;
4489 } 4489 }
4490 while ( v3 < v2->field_10 ); 4490 while ( v3 < v2->field_10 );
4503 v13 = (double)pViewport->uScreenCenterY; 4503 v13 = (double)pViewport->uScreenCenterY;
4504 v14 = v12 * *((float *)v10 + 2); 4504 v14 = v12 * *((float *)v10 + 2);
4505 *((int *)v10 + 22) = LODWORD(v11); 4505 *((int *)v10 + 22) = LODWORD(v11);
4506 *((int *)v10 + 23) = *((int *)v10 + 3); 4506 *((int *)v10 + 23) = *((int *)v10 + 3);
4507 *((float *)v10 + 21) = v13 - v14; 4507 *((float *)v10 + 21) = v13 - v14;
4508 if ( (double)(signed int)pViewport->uViewportX <= *((float *)v10 + 20) 4508 if ( (double)(signed int)pViewport->uViewportTL_X <= *((float *)v10 + 20)
4509 && (double)(signed int)pViewport->uViewportZ > *((float *)v10 + 20) 4509 && (double)(signed int)pViewport->uViewportBR_X > *((float *)v10 + 20)
4510 && (double)(signed int)pViewport->uViewportY <= *((float *)v10 + 21) 4510 && (double)(signed int)pViewport->uViewportTL_Y <= *((float *)v10 + 21)
4511 && (double)(signed int)pViewport->uViewportW > *((float *)v10 + 21) ) 4511 && (double)(signed int)pViewport->uViewportBR_Y > *((float *)v10 + 21) )
4512 v16 = 1; 4512 v16 = 1;
4513 ++v1; 4513 ++v1;
4514 v10 += 16; 4514 v10 += 16;
4515 } 4515 }
4516 while ( v1 < v2->field_10 ); 4516 while ( v1 < v2->field_10 );
5842 last_camera_rot_x == pParty->sRotationX) 5842 last_camera_rot_x == pParty->sRotationX)
5843 { 5843 {
5844 draw: 5844 draw:
5845 struct RenderVertexD3D3 v[6]; 5845 struct RenderVertexD3D3 v[6];
5846 5846
5847 v[0].pos.x = pViewport->uScreenX; 5847 v[0].pos.x = pViewport->uScreen_TL_X;
5848 v[0].pos.y = pViewport->uScreenY; 5848 v[0].pos.y = pViewport->uScreen_TL_Y;
5849 v[0].pos.z = 0.99989998; 5849 v[0].pos.z = 0.99989998;
5850 v[0].rhw = 1; 5850 v[0].rhw = 1;
5851 v[0].diffuse = 0xFFFFFFFF; 5851 v[0].diffuse = 0xFFFFFFFF;
5852 v[0].specular = 0; 5852 v[0].specular = 0;
5853 v[0].texcoord.x = 0; 5853 v[0].texcoord.x = 0;
5854 v[0].texcoord.y = 0; 5854 v[0].texcoord.y = 0;
5855 5855
5856 v[1].pos.x = pViewport->uScreenX + pViewport->uScreenWidth; 5856 v[1].pos.x = pViewport->uScreen_TL_X + pViewport->uScreenWidth;
5857 v[1].pos.y = pViewport->uScreenY + pViewport->uScreenHeight; 5857 v[1].pos.y = pViewport->uScreen_TL_Y + pViewport->uScreenHeight;
5858 v[1].pos.z = 0.99989998; 5858 v[1].pos.z = 0.99989998;
5859 v[1].rhw = 1; 5859 v[1].rhw = 1;
5860 v[1].diffuse = 0xFFFFFFFF; 5860 v[1].diffuse = 0xFFFFFFFF;
5861 v[1].specular = 0; 5861 v[1].specular = 0;
5862 v[1].texcoord.x = (float)pViewport->uScreenWidth / skybox_width; 5862 v[1].texcoord.x = (float)pViewport->uScreenWidth / skybox_width;
5863 v[1].texcoord.y = (float)pViewport->uScreenHeight / skybox_height; 5863 v[1].texcoord.y = (float)pViewport->uScreenHeight / skybox_height;
5864 5864
5865 v[2].pos.x = pViewport->uScreenX + pViewport->uScreenWidth; 5865 v[2].pos.x = pViewport->uScreen_TL_X + pViewport->uScreenWidth;
5866 v[2].pos.y = pViewport->uScreenY; 5866 v[2].pos.y = pViewport->uScreen_TL_Y;
5867 v[2].pos.z = 0.99989998; 5867 v[2].pos.z = 0.99989998;
5868 v[2].rhw = 1; 5868 v[2].rhw = 1;
5869 v[2].diffuse = 0xFFFFFFFF; 5869 v[2].diffuse = 0xFFFFFFFF;
5870 v[2].specular = 0; 5870 v[2].specular = 0;
5871 v[2].texcoord.x = (float)pViewport->uScreenWidth / skybox_width; 5871 v[2].texcoord.x = (float)pViewport->uScreenWidth / skybox_width;
5872 v[2].texcoord.y = 0; 5872 v[2].texcoord.y = 0;
5873 5873
5874 memcpy(&v[3], &v[0], sizeof(*v)); 5874 memcpy(&v[3], &v[0], sizeof(*v));
5875 5875
5876 v[4].pos.x = pViewport->uScreenX; 5876 v[4].pos.x = pViewport->uScreen_TL_X;
5877 v[4].pos.y = pViewport->uScreenY + pViewport->uScreenHeight; 5877 v[4].pos.y = pViewport->uScreen_TL_Y + pViewport->uScreenHeight;
5878 v[4].pos.z = 0.99989998; 5878 v[4].pos.z = 0.99989998;
5879 v[4].rhw = 1; 5879 v[4].rhw = 1;
5880 v[4].diffuse = 0xFFFFFFFF; 5880 v[4].diffuse = 0xFFFFFFFF;
5881 v[4].specular = 0; 5881 v[4].specular = 0;
5882 v[4].texcoord.x = 0; 5882 v[4].texcoord.x = 0;
6123 _this.field_24 = 0x2000000; 6123 _this.field_24 = 0x2000000;
6124 6124
6125 _this.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed; 6125 _this.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed;
6126 _this.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed; 6126 _this.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed;
6127 6127
6128 array_50AC10[0].vWorldViewProjX = pViewport->uViewportX; 6128 array_50AC10[0].vWorldViewProjX = pViewport->uViewportTL_X;
6129 array_50AC10[0].vWorldViewProjY = pViewport->uViewportY; 6129 array_50AC10[0].vWorldViewProjY = pViewport->uViewportTL_Y;
6130 6130
6131 array_50AC10[1].vWorldViewProjX = pViewport->uViewportX; 6131 array_50AC10[1].vWorldViewProjX = pViewport->uViewportTL_X;
6132 array_50AC10[1].vWorldViewProjY = v38; 6132 array_50AC10[1].vWorldViewProjY = v38;
6133 6133
6134 array_50AC10[2].vWorldViewProjX = pViewport->uViewportZ; 6134 array_50AC10[2].vWorldViewProjX = pViewport->uViewportBR_X;
6135 array_50AC10[2].vWorldViewProjY = pViewport->uViewportY; 6135 array_50AC10[2].vWorldViewProjY = pViewport->uViewportTL_Y;
6136 6136
6137 array_50AC10[3].vWorldViewProjX = pViewport->uViewportZ; 6137 array_50AC10[3].vWorldViewProjX = pViewport->uViewportBR_X;
6138 array_50AC10[3].vWorldViewProjY = v38; 6138 array_50AC10[3].vWorldViewProjY = v38;
6139 6139
6140 /*v36 = (double)(pViewport->uViewportZ - pViewport->uViewportX) * 0.5; 6140 /*v36 = (double)(pViewport->uViewportZ - pViewport->uViewportX) * 0.5;
6141 v33 = 65536 / (signed int)(v36 / tan(0.6457717418670654) + 0.5); 6141 v33 = 65536 / (signed int)(v36 / tan(0.6457717418670654) + 0.5);
6142 6142
6443 if ( !X ) 6443 if ( !X )
6444 goto LABEL_14; 6444 goto LABEL_14;
6445 v21 = abs(v19 >> 14); 6445 v21 = abs(v19 >> 14);
6446 if ( v21 <= abs(X) ) 6446 if ( v21 <= abs(X) )
6447 break; 6447 break;
6448 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportY ) 6448 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y )
6449 break; 6449 break;
6450 v19 = v77; 6450 v19 = v77;
6451 v20 = v79; 6451 v20 = v79;
6452 LABEL_14: 6452 LABEL_14:
6453 LODWORD(v80) = v62.v_18.z; 6453 LODWORD(v80) = v62.v_18.z;
6563 if ( !X ) 6563 if ( !X )
6564 goto LABEL_36; 6564 goto LABEL_36;
6565 v40 = abs(X); 6565 v40 = abs(X);
6566 if ( abs((signed __int64)v65) <= v40 ) 6566 if ( abs((signed __int64)v65) <= v40 )
6567 break; 6567 break;
6568 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportY ) 6568 if ( SLODWORD(v76) <= (signed int)pViewport->uViewportTL_Y )
6569 break; 6569 break;
6570 v39 = v78; 6570 v39 = v78;
6571 LABEL_36: 6571 LABEL_36:
6572 v78 = v62.v_18.z; 6572 v78 = v62.v_18.z;
6573 v41 = (unsigned __int64)(v62.v_18.z * (signed __int64)v39) >> 16; 6573 v41 = (unsigned __int64)(v62.v_18.z * (signed __int64)v39) >> 16;
12268 pRenderer->ResetClip(); 12268 pRenderer->ResetClip();
12269 } 12269 }
12270 12270
12271 12271
12272 //----- (00442955) -------------------------------------------------------- 12272 //----- (00442955) --------------------------------------------------------
12273 void DrawBook_Map_sub( unsigned int x, unsigned int y, unsigned int width, int height, int _48074 ) 12273 void DrawBook_Map_sub( unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074 )
12274 { 12274 {
12275 int v5; // ebx@1 12275 int v5; // ebx@1
12276 int v6; // edi@1 12276 int v6; // edi@1
12277 BLVMapOutlines *v7; // eax@8 12277 BLVMapOutlines *v7; // eax@8
12278 unsigned __int8 v8; // zf@8 12278 unsigned __int8 v8; // zf@8
12298 int v28; // edx@21 12298 int v28; // edx@21
12299 int v29; // eax@21 12299 int v29; // eax@21
12300 double v30; // st7@23 12300 double v30; // st7@23
12301 signed __int64 v31; // qax@23 12301 signed __int64 v31; // qax@23
12302 unsigned short *v32; // edx@23 12302 unsigned short *v32; // edx@23
12303 int v33; // esi@23 12303 int textr_width; // esi@23
12304 signed int v34; // eax@23 12304 signed int v34; // eax@23
12305 signed int v35; // ecx@23 12305 signed int v35; // ecx@23
12306 int v36; // esi@27 12306 int v36; // esi@27
12307 int v37; // ecx@27 12307 int v37; // ecx@27
12308 int v38; // edx@31 12308 int v38; // edx@31
12340 unsigned int v70; // [sp-10h] [bp-48074h]@80 12340 unsigned int v70; // [sp-10h] [bp-48074h]@80
12341 unsigned int v71; // [sp-Ch] [bp-48070h]@80 12341 unsigned int v71; // [sp-Ch] [bp-48070h]@80
12342 unsigned int v72; // [sp-8h] [bp-4806Ch]@80 12342 unsigned int v72; // [sp-8h] [bp-4806Ch]@80
12343 signed int v73; // [sp-4h] [bp-48068h]@59 12343 signed int v73; // [sp-4h] [bp-48068h]@59
12344 unsigned __int16 v74; // [sp-4h] [bp-48068h]@79 12344 unsigned __int16 v74; // [sp-4h] [bp-48068h]@79
12345 unsigned short v75[131070]; // [sp+Ch] [bp-48058h]@23 12345 unsigned short map_texture_16[147456]; // [sp+Ch] [bp-48058h]@23
12346 int v76; // [sp+4800Ch] [bp-58h]@23 12346 int v76; // [sp+4800Ch] [bp-58h]@23
12347 unsigned __int16 *v77; // [sp+48010h] [bp-54h]@27 12347 unsigned __int16 *v77; // [sp+48010h] [bp-54h]@27
12348 unsigned __int16 *v78; // [sp+48014h] [bp-50h]@23 12348 unsigned __int16 *pPalette_16; // [sp+48014h] [bp-50h]@23
12349 unsigned int v79; // [sp+48018h] [bp-4Ch]@1 12349 unsigned int surfPitch; // [sp+48018h] [bp-4Ch]@1
12350 unsigned int y_; // [sp+4801Ch] [bp-48h]@1 12350
12351 int v81; // [sp+48020h] [bp-44h]@23 12351 int v81; // [sp+48020h] [bp-44h]@23
12352 unsigned int x_; // [sp+48024h] [bp-40h]@1 12352 unsigned __int16* render16_data;
12353 unsigned char* texture8_data;
12354 unsigned char* curr_line;
12355 int scale_increment;
12356 int scaled_posX;
12357 int scaled_posY;
12358 int stepX_r;
12359 int stepY_r;
12360
12361
12353 unsigned int teal; // [sp+48028h] [bp-3Ch]@8 12362 unsigned int teal; // [sp+48028h] [bp-3Ch]@8
12354 int v84; // [sp+4802Ch] [bp-38h]@1 12363 int v84; // [sp+4802Ch] [bp-38h]@1
12355 int v85; // [sp+48030h] [bp-34h]@1 12364 int screenCenter_X; // [sp+48030h] [bp-34h]@1
12356 int v86; // [sp+48034h] [bp-30h]@1 12365 int v86; // [sp+48034h] [bp-30h]@1
12357 int v87; // [sp+48038h] [bp-2Ch]@16 12366 int v87; // [sp+48038h] [bp-2Ch]@16
12358 unsigned int v88; // [sp+4803Ch] [bp-28h]@16 12367 unsigned int v88; // [sp+4803Ch] [bp-28h]@16
12359 int black; // [sp+48040h] [bp-24h]@8 12368 int black; // [sp+48040h] [bp-24h]@8
12360 int v90; // [sp+48044h] [bp-20h]@1 12369 int screenCenterY; // [sp+48044h] [bp-20h]@1
12361 unsigned int i; // [sp+48048h] [bp-1Ch]@9 12370 unsigned int i; // [sp+48048h] [bp-1Ch]@9
12362 unsigned int v92; // [sp+4804Ch] [bp-18h]@16 12371 unsigned int screenHeight; // [sp+4804Ch] [bp-18h]@16
12363 unsigned __int16 *v93; // [sp+48050h] [bp-14h]@16 12372 unsigned __int16 *v93; // [sp+48050h] [bp-14h]@16
12364 signed int v94; // [sp+48054h] [bp-10h]@8 12373 signed int screenWidth; // [sp+48054h] [bp-10h]@8
12365 unsigned int v95; // [sp+48058h] [bp-Ch]@16 12374 unsigned int v95; // [sp+48058h] [bp-Ch]@16
12366 int v96; // [sp+4805Ch] [bp-8h]@10 12375 int v96; // [sp+4805Ch] [bp-8h]@10
12367 const void *v97; // [sp+48060h] [bp-4h]@16 12376 const void *v97; // [sp+48060h] [bp-4h]@16
12368 unsigned short *a4a; // [sp+4806Ch] [bp+8h]@85 12377 unsigned short *a4a; // [sp+4806Ch] [bp+8h]@85
12369 int a5a; // [sp+48070h] [bp+Ch]@86 12378 int a5a; // [sp+48070h] [bp+Ch]@86
12370 12379
12371 x_ = x; 12380 tl_x = tl_x;
12372 y_ = y; 12381 tl_y = tl_y;
12373 v85 = (signed int)(x + width) >> 1; 12382 screenCenter_X = (signed int)(tl_x + br_x) >> 1;
12374 v90 = (signed int)(y + height) >> 1; 12383 screenCenterY = (signed int)(tl_y + br_y) >> 1;
12375 v79 = pRenderer->uTargetSurfacePitch; 12384 surfPitch = pRenderer->uTargetSurfacePitch;
12376 pRenderer->Clip_v2(x, y, width, height); 12385 pRenderer->Clip_v2(tl_x, tl_y, br_x, br_y);
12377 v5 = viewparams->field_2C; 12386 v5 = viewparams->field_2C;
12378 v6 = viewparams->sPartyPosX; 12387 v6 = viewparams->sViewCenterX;
12379 v86 = viewparams->sPartyPosX; 12388 v86 = viewparams->sViewCenterX;
12380 v84 = viewparams->sPartyPosZ; 12389 v84 = viewparams->sViewCenterY;
12381 if ( viewparams->field_2C != 384 ) 12390 if ( viewparams->field_2C != 384 )
12382 { 12391 {
12383 if ( viewparams->field_2C == 768 ) 12392 if ( viewparams->field_2C == 768 )
12384 { 12393 {
12385 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) 12394 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
12394 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) 12403 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
12395 v5 = viewparams->field_2C - 34; 12404 v5 = viewparams->field_2C - 34;
12396 } 12405 }
12397 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) 12406 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor)
12398 { 12407 {
12399 v94 = width - x_ + 1; 12408 screenWidth = br_x - tl_x + 1;
12400 v92 = height - y_ + 1; 12409 screenHeight = br_y - tl_y + 1;
12401 v93 = &pRenderer->pTargetSurface[x_ + y_ * v79]; 12410 render16_data = &pRenderer->pTargetSurface[tl_x + tl_y * surfPitch];
12402 v95 = (unsigned int)pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0; 12411 texture8_data = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0;
12403 v78 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; 12412 pPalette_16 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16;
12404 v87 = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / v5; 12413 scale_increment = (1 << (pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2 + 16)) / v5;
12414
12405 v30 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2)); 12415 v30 = (double)(1 << (16 - pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2));
12406 black = 22528 / (v5 / 384); 12416
12407 teal = (unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16; 12417
12418 teal = (unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16;
12408 v97 = (const void *)((unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16); 12419 v97 = (const void *)((unsigned int)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30) << 16);
12409 v96 = 32768 - black - v84; 12420
12410 v31 = (signed __int64)((double)v96 / v30); 12421 v32 = map_texture_16;
12411 v32 = v75; 12422 textr_width = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth;
12412 v33 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; 12423 stepY_r = (int)(signed __int64)((double)(- v84 - 22528 / (v5 / 384)+ 32768) / v30) << 16;
12413 v34 = (int)v31 << 16; 12424 v81 = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30);
12414 v81 = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30);
12415 black = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30); 12425 black = (signed __int16)(signed __int64)((double)(v6 - 22528 / (v5 / 384) + 32768) / v30);
12416 v76 = v33; 12426
12417 v35 = v34 >> 16; 12427 v76 = textr_width;
12418 if ( v95 && (signed int)v92 > 0 ) 12428 scaled_posY = stepY_r >> 16;
12419 { 12429 //nearest neiborhood scaling
12420 v96 = v92; 12430 if ( texture8_data)
12421 do 12431 {
12422 { 12432 for(uint i=0; i<screenHeight;++i)
12423 v88 = 0; 12433 {
12424 if ( (signed int)v94 > 0 ) 12434 curr_line=&texture8_data[scaled_posY*textr_width];
12435 stepX_r=teal;
12436 for(uint j=0; j<screenWidth;++j)
12437 {
12438 scaled_posX=stepX_r>>16;
12439 map_texture_16[i*screenWidth+j]=pPalette_16[*(curr_line+scaled_posX)];
12440 stepX_r+=scale_increment;
12441 }
12442 stepY_r+=scale_increment;
12443 scaled_posY=stepY_r>>16;
12444 }
12445 }
12446 //move visible square to render
12447 for(uint i=0; i<screenHeight;++i)
12425 { 12448 {
12426 v36 = v95 + v35 * v76; 12449 if ( screenWidth > 0 )
12427 i = v94; 12450 {
12428 v88 = v94; 12451 memcpy((void*)&render16_data[surfPitch*i],(void*)&map_texture_16[i*screenWidth], screenWidth*2);
12429 v37 = black; 12452 }
12430 v77 = (unsigned __int16 *)v36;
12431 do
12432 {
12433 *(short *)v32 = v78[*((char *)v77 + v37)];//crash
12434 ++v32;
12435 v97 = (char *)v97 + v87;
12436 v37 = (signed int)v97 >> 16;
12437 --i;
12438 }
12439 while ( i );
12440 } 12453 }
12441 v34 += v87;
12442 v97 = (const void *)teal;
12443 black = v81;
12444 v32 += 2 * (v94 - v88);
12445 v35 = v34 >> 16;
12446 --v96;
12447 }
12448 while ( v96 );
12449 }
12450 v97 = &v75;
12451 if ( (signed int)v92 > 0 )
12452 {
12453 v96 = v92;
12454 v38 = 2 * (v79 - v94);
12455 do
12456 {
12457 if ( (signed int)v94 > 0 )
12458 {
12459 v39 = v94;
12460 v40 = (short *)v97;
12461 v41 = (short *)v93;
12462 v42 = v94 & 1;
12463 v43 = v94 >> 1;
12464 memcpy(v93, v97, 2 * (v94 >> 1));
12465 v45 = &v40[2 * v43];
12466 v44 = &v41[2 * v43];
12467 v46 = v42;
12468 v39 *= 2;
12469 v93 = (unsigned __int16 *)((char *)v93 + v39);
12470 v97 = (char *)v97 + v39;
12471 while ( v46 )
12472 {
12473 *v44 = *v45;
12474 ++v45;
12475 ++v44;
12476 --v46;
12477 }
12478 v6 = v86;
12479 }
12480 v93 = (unsigned __int16 *)((char *)v93 + v38);
12481 --v96;
12482 }
12483 while ( v96 );
12484 }
12485 } 12454 }
12486 else 12455 else
12487 { 12456 {
12488 black = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0); 12457 black = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0);
12489 teal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0xFFu); 12458 teal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0xFFu);
12490 v7 = pIndoor->pMapOutlines; 12459 v7 = pIndoor->pMapOutlines;
12491 uNumBlueFacesInBLVMinimap = 0; 12460 uNumBlueFacesInBLVMinimap = 0;
12492 v8 = pIndoor->pMapOutlines->uNumOutlines == 0; 12461 v8 = pIndoor->pMapOutlines->uNumOutlines == 0;
12493 v9 = pIndoor->pMapOutlines->uNumOutlines < 0; 12462 v9 = pIndoor->pMapOutlines->uNumOutlines < 0;
12494 v94 = 0; 12463 screenWidth = 0;
12495 if ( !(v9 | v8) ) 12464 if ( !(v9 | v8) )
12496 { 12465 {
12497 i = 0; 12466 i = 0;
12498 do 12467 do
12499 { 12468 {
12504 v12 = *(short *)((char *)v7 + i + 14); 12473 v12 = *(short *)((char *)v7 + i + 14);
12505 if ( !(v12 & 1) ) 12474 if ( !(v12 & 1) )
12506 { 12475 {
12507 if ( !(!(v96 & 0x80) && (v11 & 0x80u) == 0 )) 12476 if ( !(!(v96 & 0x80) && (v11 & 0x80u) == 0 ))
12508 { 12477 {
12509 v96 = (signed int)v94 >> 3; 12478 v96 = (signed int)screenWidth >> 3;
12510 v13 = v94; 12479 v13 = screenWidth;
12511 *(short *)(v10 + 10) = v12 | 1; 12480 *(short *)(v10 + 10) = v12 | 1;
12512 pIndoor->_visible_outlines[v96] |= 1 << (7 - v13 % 8); 12481 pIndoor->_visible_outlines[v96] |= 1 << (7 - v13 % 8);
12513 } 12482 }
12514 } 12483 }
12515 if ( (!(v12 & 1) && !(!(v96 & 0x80) && (v11 & 0x80u) == 0 )) || v12 & 1) 12484 if ( (!(v12 & 1) && !(!(v96 & 0x80) && (v11 & 0x80u) == 0 )) || v12 & 1)
12518 v88 = v5; 12487 v88 = v5;
12519 v15 = &pIndoor->pVertices[v14]; 12488 v15 = &pIndoor->pVertices[v14];
12520 v16 = v15->x; 12489 v16 = v15->x;
12521 v17 = v15->y - v84; 12490 v17 = v15->y - v84;
12522 v93 = (unsigned __int16 *)(v16 - v6); 12491 v93 = (unsigned __int16 *)(v16 - v6);
12523 v92 = v17; 12492 screenHeight = v17;
12524 v18 = &pIndoor->pVertices[*(short *)(v10 + 2)]; 12493 v18 = &pIndoor->pVertices[*(short *)(v10 + 2)];
12525 v19 = v18->x; 12494 v19 = v18->x;
12526 v20 = v18->y - v84; 12495 v20 = v18->y - v84;
12527 v95 = v19 - v6; 12496 v95 = v19 - v6;
12528 v97 = (const void *)v20; 12497 v97 = (const void *)v20;
12529 v88 = (unsigned __int64)((v16 - v6) * (signed __int64)v5) >> 16; 12498 v88 = (unsigned __int64)((v16 - v6) * (signed __int64)v5) >> 16;
12530 v87 = (unsigned __int64)((signed int)v92 * (signed __int64)v5) >> 16; 12499 v87 = (unsigned __int64)((signed int)screenHeight * (signed __int64)v5) >> 16;
12531 v93 = (unsigned __int16 *)((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16); 12500 v93 = (unsigned __int16 *)((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16);
12532 v92 = (unsigned __int64)(v20 * (signed __int64)v5) >> 16; 12501 screenHeight = (unsigned __int64)(v20 * (signed __int64)v5) >> 16;
12533 pRenderer->Line2D( 12502 pRenderer->Line2D(
12534 v85 + v88, 12503 screenCenter_X + v88,
12535 v90 - v87, 12504 screenCenterY - v87,
12536 v85 + ((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16), 12505 screenCenter_X + ((unsigned __int64)((v19 - v6) * (signed __int64)v5) >> 16),
12537 v90 - v92, 12506 screenCenterY - screenHeight,
12538 black); 12507 black);
12539 v7 = pIndoor->pMapOutlines; 12508 v7 = pIndoor->pMapOutlines;
12540 } 12509 }
12541 } 12510 }
12542 ++v94; 12511 ++screenWidth;
12543 i += 12; 12512 i += 12;
12544 } 12513 }
12545 while ( v94 < (signed int)v7->uNumOutlines ); 12514 while ( screenWidth < (signed int)v7->uNumOutlines );
12546 } 12515 }
12547 v21 = 0; 12516 v21 = 0;
12548 if ( (signed int)uNumBlueFacesInBLVMinimap > 0 ) 12517 if ( (signed int)uNumBlueFacesInBLVMinimap > 0 )
12549 { 12518 {
12550 while ( 1 ) 12519 while ( 1 )
12557 v26 = v25->x; 12526 v26 = v25->x;
12558 v27 = (unsigned __int16 *)(v24->x - v86); 12527 v27 = (unsigned __int16 *)(v24->x - v86);
12559 v28 = v24->y - v84; 12528 v28 = v24->y - v84;
12560 v29 = v25->y - v84; 12529 v29 = v25->y - v84;
12561 v93 = v27; 12530 v93 = v27;
12562 v92 = v28; 12531 screenHeight = v28;
12563 v97 = (const void *)v29; 12532 v97 = (const void *)v29;
12564 v87 = (unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16; 12533 v87 = (unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16;
12565 v88 = (unsigned __int64)(v28 * (signed __int64)v5) >> 16; 12534 v88 = (unsigned __int64)(v28 * (signed __int64)v5) >> 16;
12566 i = (unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16; 12535 i = (unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16;
12567 v95 = (unsigned __int64)(v29 * (signed __int64)v5) >> 16; 12536 v95 = (unsigned __int64)(v29 * (signed __int64)v5) >> 16;
12568 pRenderer->Line2D( 12537 pRenderer->Line2D(
12569 v85 + ((unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16), 12538 screenCenter_X + ((unsigned __int64)((signed int)v27 * (signed __int64)v5) >> 16),
12570 v90 - v88, 12539 screenCenterY - v88,
12571 v85 + ((unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16), 12540 screenCenter_X + ((unsigned __int64)((v26 - v86) * (signed __int64)v5) >> 16),
12572 v90 - v95, 12541 screenCenterY - v95,
12573 teal); 12542 teal);
12574 ++v21; 12543 ++v21;
12575 if ( v21 >= (signed int)uNumBlueFacesInBLVMinimap ) 12544 if ( v21 >= (signed int)uNumBlueFacesInBLVMinimap )
12576 break; 12545 break;
12577 v7 = pIndoor->pMapOutlines; 12546 v7 = pIndoor->pMapOutlines;
12578 } 12547 }
12579 v6 = v86; 12548 v6 = v86;
12580 } 12549 }
12581 } 12550 }
12582 v47 = ((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + v85 - 3; 12551 v47 = ((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + screenCenter_X - 3;
12583 v81 = pParty->vPosition.y - v84; 12552 v81 = pParty->vPosition.y - v84;
12584 v97 = (const void *)((unsigned __int64)((pParty->vPosition.y - v84) * (signed __int64)v5) >> 16); 12553 v97 = (const void *)((unsigned __int64)((pParty->vPosition.y - v84) * (signed __int64)v5) >> 16);
12585 v48 = 1; 12554 v48 = 1;
12586 v49 = v90 - (int)v97 - 3; 12555 v49 = screenCenterY - (int)v97 - 3;
12587 if ( v47 >= (signed int)x_ ) 12556 if ( v47 >= (signed int)tl_x )
12588 { 12557 {
12589 if ( v47 > (signed int)width ) 12558 if ( v47 > (signed int)br_x )
12590 { 12559 {
12591 if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + v85 - 6) > (signed int)width ) 12560 if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + screenCenter_X - 6) > (signed int)br_x )
12592 v48 = 0; 12561 v48 = 0;
12593 v47 = width; 12562 v47 = br_x;
12594 } 12563 }
12595 } 12564 }
12596 else 12565 else
12597 { 12566 {
12598 if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + v85) < (signed int)x_ ) 12567 if ( (signed int)(((unsigned __int64)((pParty->vPosition.x - v6) * (signed __int64)v5) >> 16) + screenCenter_X) < (signed int)tl_x )
12599 v48 = 0; 12568 v48 = 0;
12600 v47 = x_; 12569 v47 = tl_x;
12601 } 12570 }
12602 if ( v49 >= (signed int)y_ ) 12571 if ( v49 >= (signed int)tl_y )
12603 { 12572 {
12604 if ( v49 > height ) 12573 if ( v49 > br_y )
12605 { 12574 {
12606 if ( v90 - (signed int)v97 - 6 > height ) 12575 if ( screenCenterY - (signed int)v97 - 6 > br_y )
12607 v48 = 0; 12576 v48 = 0;
12608 v49 = height; 12577 v49 = br_y;
12609 } 12578 }
12610 } 12579 }
12611 else 12580 else
12612 { 12581 {
12613 if ( v90 - (signed int)v97 < (signed int)y_ ) 12582 if ( screenCenterY - (signed int)v97 < (signed int)tl_y )
12614 v48 = 0; 12583 v48 = 0;
12615 v49 = y_; 12584 v49 = tl_y;
12616 } 12585 }
12617 if ( v48 == 1 ) 12586 if ( v48 == 1 )
12618 { 12587 {
12619 v50 = 0; 12588 v50 = 0;
12620 v51 = pParty->sRotationY & stru_5C6E00->uDoublePiMask; 12589 v51 = pParty->sRotationY & stru_5C6E00->uDoublePiMask;
12670 result = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 12639 result = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
12671 v95 = 0; 12640 v95 = 0;
12672 v86 = result; 12641 v86 = result;
12673 if ( (signed int)uNumLevelDecorations > 0 ) 12642 if ( (signed int)uNumLevelDecorations > 0 )
12674 { 12643 {
12675 v94 = (unsigned int)&pLevelDecorations[0].vPosition; 12644 screenWidth = (unsigned int)&pLevelDecorations[0].vPosition;
12676 do 12645 do
12677 { 12646 {
12678 if ( *(char *)(v94 - 2) & 8 ) 12647 if ( *(char *)(screenWidth - 2) & 8 )
12679 { 12648 {
12680 v53 = *(int *)(v94 + 4) - v84; 12649 v53 = *(int *)(screenWidth + 4) - v84;
12681 v93 = (unsigned __int16 *)(*(int *)v94 - v6); 12650 v93 = (unsigned __int16 *)(*(int *)screenWidth - v6);
12682 v92 = v53; 12651 screenHeight = v53;
12683 v54 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + v85; 12652 v54 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + screenCenter_X;
12684 v97 = (const void *)((unsigned __int64)(v53 * (signed __int64)v5) >> 16); 12653 v97 = (const void *)((unsigned __int64)(v53 * (signed __int64)v5) >> 16);
12685 v55 = v90 - (int)v97; 12654 v55 = screenCenterY - (int)v97;
12686 if ( v54 >= pRenderer->field_1C_clipx ) 12655 if ( v54 >= pRenderer->field_1C_clipx )
12687 { 12656 {
12688 if ( v54 <= pRenderer->field_24_width && v55 >= pRenderer->field_20_clipy && v55 <= pRenderer->field_28_height ) 12657 if ( v54 <= pRenderer->field_24_width && v55 >= pRenderer->field_20_clipy && v55 <= pRenderer->field_28_height )
12689 { 12658 {
12690 v74 = v86; 12659 v74 = v86;
12700 v71 = v54; 12669 v71 = v54;
12701 v70 = black; 12670 v70 = black;
12702 } 12671 }
12703 else 12672 else
12704 { 12673 {
12705 v72 = v90 - (int)v97; 12674 v72 = screenCenterY - (int)v97;
12706 v71 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + v85; 12675 v71 = ((unsigned __int64)((signed int)v93 * (signed __int64)v5) >> 16) + screenCenter_X;
12707 v70 = v90 - (int)v97; 12676 v70 = screenCenterY - (int)v97;
12708 } 12677 }
12709 pRenderer->Line2D(v54, v70, v71, v72, v74); 12678 pRenderer->Line2D(v54, v70, v71, v72, v74);
12710 } 12679 }
12711 } 12680 }
12712 } 12681 }
12713 ++v95; 12682 ++v95;
12714 result = v95; 12683 result = v95;
12715 v94 += 32; 12684 screenWidth += 32;
12716 } 12685 }
12717 while ( (signed int)v95 < (signed int)uNumLevelDecorations ); 12686 while ( (signed int)v95 < (signed int)uNumLevelDecorations );
12718 } 12687 }
12719 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) 12688 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
12720 { 12689 {
12721 v90 = width - x_ + 1; 12690 screenCenterY = br_x - tl_x + 1;
12722 v95 = height - y_ + 1; 12691 v95 = br_y - tl_y + 1;
12723 v77 = &pRenderer->pTargetSurface[x_ + y_ * v79]; 12692 v77 = &pRenderer->pTargetSurface[tl_x + tl_y * surfPitch];
12724 v56 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2; 12693 v56 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2;
12725 black = (1 << (v56 + 16)) / v5; 12694 black = (1 << (v56 + 16)) / v5;
12726 v57 = (double)(1 << (16 - v56)); 12695 v57 = (double)(1 << (16 - v56));
12727 v58 = 22528 / (v5 / 384); 12696 v58 = 22528 / (v5 / 384);
12728 v59 = (signed __int64)((double)(v6 - v58 + 32768) / v57); 12697 v59 = (signed __int64)((double)(v6 - v58 + 32768) / v57);
12729 v60 = (int)v59 << 16; 12698 v60 = (int)v59 << 16;
12730 v97 = (const void *)((int)v59 << 16); 12699 v97 = (const void *)((int)v59 << 16);
12731 v61 = (signed __int64)((double)(32768 - v58 - v84) / v57); 12700 v61 = (signed __int64)((double)(32768 - v58 - v84) / v57);
12732 v78 = (unsigned __int16 *)(v60 >> 16); 12701 pPalette_16 = (unsigned __int16 *)(v60 >> 16);
12733 v62 = (int)v61 << 16; 12702 v62 = (int)v61 << 16;
12734 teal = v60 >> 16; 12703 teal = v60 >> 16;
12735 v63 = (signed __int16)v61; 12704 v63 = (signed __int16)v61;
12736 a4a = v75; 12705 a4a = map_texture_16;
12737 result = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xCu, 0xCu, 0xCu); 12706 result = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xCu, 0xCu, 0xCu);
12738 v85 = 0; 12707 screenCenter_X = 0;
12739 for ( i = result; v85 < (signed int)v95; result = v85 ) 12708 for ( i = result; screenCenter_X < (signed int)v95; result = screenCenter_X )
12740 { 12709 {
12741 a5a = 0; 12710 a5a = 0;
12742 if ( v90 > 0 ) 12711 if ( screenCenterY > 0 )
12743 { 12712 {
12744 v96 = (v63 - 80) / 4; 12713 v96 = (v63 - 80) / 4;
12745 v64 = teal; 12714 v64 = teal;
12746 do 12715 do
12747 { 12716 {
12748 v81 = (v64 - 80) / 4; 12717 v81 = (v64 - 80) / 4;
12749 if ( !pOutdoor->_47F04C(v81, v96) ) 12718 if ( !pOutdoor->_47F04C(v81, v96) )
12750 { 12719 {
12751 if ( pOutdoor->_47F097(v81, v96) ) 12720 if ( pOutdoor->_47F097(v81, v96) )
12752 { 12721 {
12753 if ( !((a5a + v85) % 2) ) 12722 if ( !((a5a + screenCenter_X) % 2) )
12754 *a4a = i; 12723 *a4a = i;
12755 } 12724 }
12756 else 12725 else
12757 { 12726 {
12758 *a4a = 0; 12727 *a4a = 0;
12761 ++a4a; 12730 ++a4a;
12762 v97 = (char *)v97 + black; 12731 v97 = (char *)v97 + black;
12763 v64 = (signed int)v97 >> 16; 12732 v64 = (signed int)v97 >> 16;
12764 ++a5a; 12733 ++a5a;
12765 } 12734 }
12766 while ( a5a < v90 ); 12735 while ( a5a < screenCenterY );
12767 } 12736 }
12768 v62 += black; 12737 v62 += black;
12769 v97 = (const void *)v60; 12738 v97 = (const void *)v60;
12770 a4a += v90 - a5a; 12739 a4a += screenCenterY - a5a;
12771 v63 = v62 >> 16; 12740 v63 = v62 >> 16;
12772 ++v85; 12741 ++screenCenter_X;
12773 teal = (unsigned int)v78; 12742 teal = (unsigned int)pPalette_16;
12774 } 12743 }
12775 v65 = v95; 12744 v65 = v95;
12776 v66 = v75; 12745 v66 = map_texture_16;
12777 if ( (signed int)v95 > 0 ) 12746 if ( (signed int)v95 > 0 )
12778 { 12747 {
12779 v67 = v77; 12748 v67 = v77;
12780 result = 2 * (v79 - v90); 12749 result = 2 * (surfPitch - screenCenterY);
12781 do 12750 do
12782 { 12751 {
12783 if ( v90 > 0 ) 12752 if ( screenCenterY > 0 )
12784 { 12753 {
12785 v68 = v90; 12754 v68 = screenCenterY;
12786 do 12755 do
12787 { 12756 {
12788 v69 = *(short *)v66; 12757 v69 = *(short *)v66;
12789 if ( !*(short *)v66 || v69 == (short)i ) 12758 if ( !*(short *)v66 || v69 == (short)i )
12790 *v67 = v69; 12759 *v67 = v69;
12800 while ( v65 ); 12769 while ( v65 );
12801 } 12770 }
12802 } 12771 }
12803 } 12772 }
12804 12773
12805 //----- (00443219) -------------------------------------------------------- 12774
12806 void ViewingParams::_443219()
12807 {
12808 this->sPartyPosZ += 512;
12809 _4432E7();
12810 }
12811
12812 //----- (00443225) --------------------------------------------------------
12813 void ViewingParams::_443225()
12814 {
12815 this->sPartyPosX -= 512;
12816 _4432E7();
12817 }
12818
12819 //----- (00443231) --------------------------------------------------------
12820 void ViewingParams::_443231()
12821 {
12822 this->sPartyPosZ -= 512;
12823 _4432E7();
12824 }
12825
12826 //----- (0044323D) --------------------------------------------------------
12827 void ViewingParams::_44323D()
12828 {
12829 this->sPartyPosX += 512;
12830 _4432E7();
12831 }
12832
12833 //----- (00443249) --------------------------------------------------------
12834 void ViewingParams::_443249()
12835 {
12836 int v1; // edx@1
12837
12838 v1 = (unsigned __int64)((signed __int64)this->field_2C << 15) >> 16;
12839 this->field_2C = v1;
12840 if ( v1 < 384 )
12841 this->field_2C = 384;
12842 this->sPartyPosX = pParty->vPosition.x;
12843 this->sPartyPosZ = pParty->vPosition.y;
12844 _4432E7();
12845 }
12846
12847 //----- (00443291) --------------------------------------------------------
12848 void ViewingParams::_443291()
12849 {
12850 int v1; // edx@1
12851 int v2; // eax@1
12852
12853 v1 = 2 * this->field_2C;
12854 v2 = 1536;
12855 this->field_2C = v1;
12856 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
12857 v2 = 3072;
12858 if ( v1 > v2 )
12859 this->field_2C = v2;
12860 this->sPartyPosX = pParty->vPosition.x;
12861 this->sPartyPosZ = pParty->vPosition.y;
12862 _4432E7();
12863 }
12864
12865 //----- (004432E7) --------------------------------------------------------
12866 void ViewingParams::_4432E7()
12867 {
12868 ViewingParams *v1; // esi@1
12869 int v2; // ebx@1
12870 signed int v3; // edx@1
12871 int v4; // ecx@1
12872 int v5; // edi@3
12873 int v6; // eax@3
12874 int v7; // eax@5
12875 int result; // eax@7
12876
12877 v1 = this;
12878 v2 = this->field_3A;
12879 v3 = 88 >> this->field_2C / 384;
12880 v4 = (44 - v3) << 9;
12881 if ( v1->sPartyPosZ > v2 + v4 )
12882 v1->sPartyPosZ = v2 + v4;
12883
12884 v5 = v1->field_38;
12885 v6 = (v3 - 44) << 9;
12886 if ( v1->sPartyPosX < v5 + v6 )
12887 v1->sPartyPosX = v5 + v6;
12888
12889 v7 = v2 + v6;
12890 if ( v1->sPartyPosZ < v7 )
12891 v1->sPartyPosZ = v7;
12892
12893 result = v5 + v4;
12894 if ( v1->sPartyPosX > v5 + v4 )
12895 v1->sPartyPosX = result;
12896 }
12897
12898 //----- (00443343) --------------------------------------------------------
12899 void ViewingParams::InitGrayPalette()
12900 {
12901 for (unsigned short i=0; i<256; ++i)
12902 pPalette[i]=GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(i, i, i);
12903 }
12904
12905 //----- (00443365) --------------------------------------------------------
12906 int ViewingParams::_443365()
12907 {
12908 ViewingParams *v1; // esi@1
12909 __int16 *v2; // edi@3
12910 Vec3_short_ *v3; // eax@4
12911 unsigned int v4; // edx@4
12912 signed int v5; // eax@8
12913 Vec3_short_ *v6; // eax@12
12914 signed int v7; // edi@12
12915 signed int v8; // eax@16
12916 char v9; // zf@20
12917 int result; // eax@21
12918 unsigned int v11; // [sp+4h] [bp-1Ch]@3
12919 unsigned int *v12; // [sp+8h] [bp-18h]@3
12920 unsigned int v13; // [sp+Ch] [bp-14h]@8
12921 unsigned int v14; // [sp+10h] [bp-10h]@2
12922 unsigned int v15; // [sp+14h] [bp-Ch]@2
12923 unsigned int v16; // [sp+18h] [bp-8h]@2
12924 unsigned int v17; // [sp+1Ch] [bp-4h]@2
12925
12926 v1 = this;
12927 InitGrayPalette();
12928 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
12929 {
12930 v16 = 0x40000000u;
12931 v14 = 0x40000000u;
12932 v17 = 0xC0000000u;
12933 v15 = 0xC0000000u;
12934 if ( (signed int)pIndoor->pMapOutlines->uNumOutlines > 0 )
12935 {
12936 v2 = (__int16 *)(pIndoor->pMapOutlines->pOutlines);
12937 v11 = pIndoor->pMapOutlines->uNumOutlines;
12938 v12 = (uint *)pIndoor->pMapOutlines->pOutlines;
12939 do
12940 {
12941 v3 = &pIndoor->pVertices[*v2];
12942 v4 = v3->x;
12943 if ( (signed int)v4 < (signed int)v16 )
12944 v16 = v3->x;
12945 if ( (signed int)v4 > (signed int)v17 )
12946 v17 = v3->x;
12947 v5 = v3->y;
12948 v13 = v5;
12949 if ( v5 < (signed int)v14 )
12950 v14 = v4;
12951 if ( v5 > (signed int)v15 )
12952 v15 = v4;
12953 v6 = &pIndoor->pVertices[v2[1]];
12954 v7 = v6->x;
12955 if ( v7 < (signed int)v16 )
12956 v16 = v4;
12957 if ( v7 > (signed int)v17 )
12958 v17 = v4;
12959 v8 = v6->y;
12960 if ( v8 < (signed int)v14 )
12961 v14 = v13;
12962 if ( v8 > (signed int)v15 )
12963 v15 = v13;
12964 v2 = (__int16 *)(v12 + 3);
12965 v9 = v11-- == 1;
12966 v12 += 3;
12967 }
12968 while ( !v9 );
12969 }
12970 v1->uMinimapZoom = 1024;
12971 v1->field_38 = (signed int)(v16 + v17) / 2;
12972 v1->field_28 = 10;
12973 result = (signed int)(v14 + v15) / 2;
12974 v1->field_3A = result;
12975 }
12976 else
12977 {
12978 v1->field_38 = 0;
12979 v1->field_3A = 0;
12980 v1->uMinimapZoom = dword_576E2C;
12981 result = dword_576E28;
12982 v1->field_28 = dword_576E28;
12983 }
12984 v1->field_2C = 384;
12985 return result;
12986 }
12987 12775
12988 12776
12989 //----- (00443801) -------------------------------------------------------- 12777 //----- (00443801) --------------------------------------------------------
12990 void Initialize2DA() 12778 void Initialize2DA()
12991 { 12779 {
13571 { 13359 {
13572 double v0; // st7@3 13360 double v0; // st7@3
13573 int v1; // ebx@3 13361 int v1; // ebx@3
13574 int v2; // edi@3 13362 int v2; // edi@3
13575 int v3; // eax@3 13363 int v3; // eax@3
13576 int v4; // esi@5
13577 int v5; // edi@6 13364 int v5; // edi@6
13578 int v6; // eax@6 13365 int v6; // eax@6
13579 int v7; // eax@6 13366 int v7; // eax@6
13580 BSPModel **v8; // ecx@6
13581 unsigned __int8 v9; // zf@7 13367 unsigned __int8 v9; // zf@7
13582 unsigned __int8 v10; // sf@7 13368 unsigned __int8 v10; // sf@7
13583 ODMFace *v11; // eax@9 13369 ODMFace *v11; // eax@9
13584 __int16 v12; // cx@9 13370 __int16 v12; // cx@9
13585 const char *v13; // eax@11 13371 const char *v13; // eax@11
13587 const char *result; // eax@15 13373 const char *result; // eax@15
13588 unsigned int v16; // [sp+0h] [bp-20h]@3 13374 unsigned int v16; // [sp+0h] [bp-20h]@3
13589 const char *v17; // [sp+4h] [bp-1Ch]@3 13375 const char *v17; // [sp+4h] [bp-1Ch]@3
13590 unsigned int pY; // [sp+8h] [bp-18h]@3 13376 unsigned int pY; // [sp+8h] [bp-18h]@3
13591 float v19; // [sp+Ch] [bp-14h]@1 13377 float v19; // [sp+Ch] [bp-14h]@1
13592 int v20; // [sp+10h] [bp-10h]@1 13378 int v20;
13593 int v21; // [sp+14h] [bp-Ch]@1 13379 int v21; // [sp+14h] [bp-Ch]@1
13594 unsigned int v22; // [sp+18h] [bp-8h]@8 13380 unsigned int v22; // [sp+18h] [bp-8h]@8
13595 int pX; // [sp+1Ch] [bp-4h]@3 13381 int pX; // [sp+1Ch] [bp-4h]@3
13596 13382
13597 v20 = viewparams->sPartyPosX; 13383 v20 = viewparams->sViewCenterX;
13598 v21 = viewparams->sPartyPosZ; 13384 v21 = viewparams->sViewCenterY;
13599 v19 = (double)viewparams->field_2C * 0.000015258789; 13385 v19 = (double)viewparams->field_2C * 0.000015258789;
13600 if ( viewparams->field_2C == 384 ) 13386 if ( viewparams->field_2C == 384 )
13601 { 13387 {
13602 v20 = viewparams->field_38; 13388 v20 = viewparams->field_38;
13603 v21 = viewparams->field_3A; 13389 v21 = viewparams->field_3A;
13608 v0 = 1.0 / v19; 13394 v0 = 1.0 / v19;
13609 v1 = (signed __int64)((double)(pX - 229) * v0 + (double)v20); 13395 v1 = (signed __int64)((double)(pX - 229) * v0 + (double)v20);
13610 LODWORD(v19) = (signed __int64)((double)v21 - (double)(signed int)(pY - 181) * v0); 13396 LODWORD(v19) = (signed __int64)((double)v21 - (double)(signed int)(pY - 181) * v0);
13611 v2 = abs(v1 + 22528) / 512; 13397 v2 = abs(v1 + 22528) / 512;
13612 v3 = abs((signed)LODWORD(v19) - 22528); 13398 v3 = abs((signed)LODWORD(v19) - 22528);
13399 result = 0;
13613 if ( pOutdoor->_47F04C(v2, v3 / 512) 13400 if ( pOutdoor->_47F04C(v2, v3 / 512)
13614 && uCurrentlyLoadedLevelType == LEVEL_Outdoor 13401 && uCurrentlyLoadedLevelType == LEVEL_Outdoor
13615 && (v4 = 0, v20 = 0, (signed int)v16 > 0) ) 13402 && (signed int)v16 > 0 )
13616 { 13403 {
13617 while ( 1 ) 13404 for(int i = 0; i < pOutdoor->uNumBModels && !v17; i++)
13618 { 13405 {
13619 pX = *(int *)((char *)&pOutdoor->pBModels[v4].vBoundingCenter.x) - v1; 13406 pX = pOutdoor->pBModels[i].vBoundingCenter.x - v1;
13620 pY = *(int *)((char *)&pOutdoor->pBModels[v4].vBoundingCenter.y) - LODWORD(v19); 13407 pY = pOutdoor->pBModels[i].vBoundingCenter.y - LODWORD(v19);
13621 v5 = abs((signed)pY); 13408 v5 = abs((signed)pY);
13622 v6 = abs((signed)pX); 13409 v6 = abs((signed)pX);
13623 v7 = int_get_vector_length(v6, v5, 0); 13410 v7 = int_get_vector_length(v6, v5, 0);
13624 v8 = &pOutdoor->pBModels; 13411 if ( v7 < pOutdoor->pBModels[i].sBoundingRadius )
13625 if ( v7 < *(int *)((char *)&pOutdoor->pBModels[v4].sBoundingRadius) ) 13412 {
13626 { 13413 if ( pOutdoor->pBModels[i].uNumFaces > 0 )
13627 v9 = pOutdoor->pBModels[v4].uNumFaces == 0;
13628 v10 = pOutdoor->pBModels[v4].uNumFaces < 0;
13629 v21 = 0;
13630 if ( !(v10 | v9) )
13631 { 13414 {
13632 v22 = 0; 13415 for(int j = 0; j < pOutdoor->pBModels[i].uNumFaces; j++)
13633 do
13634 { 13416 {
13635 v11 = &v8[v4]->pFaces[v22 / 0x134]; 13417 v11 = &pOutdoor->pBModels[i].pFaces[j];//&v8[v4]->pFaces[v22 / 0x134];
13636 v12 = v11->sCogTriggeredID; 13418 v12 = v11->sCogTriggeredID;
13637 if ( v12 ) 13419 if ( v12 )
13638 { 13420 {
13639 if ( !(BYTE2(v11->uAttributes) & 0x10) ) 13421 if ( !(BYTE2(v11->uAttributes) & 0x10) )
13640 { 13422 {
13645 if ( _strcmpi(v13, "") ) 13427 if ( _strcmpi(v13, "") )
13646 v17 = v14; 13428 v17 = v14;
13647 } 13429 }
13648 } 13430 }
13649 } 13431 }
13650 ++v21;
13651 v8 = &pOutdoor->pBModels;
13652 v22 += 308;
13653 } 13432 }
13654 while ( v21 < pOutdoor->pBModels[v4].uNumFaces );
13655 } 13433 }
13656 result = v17; 13434 result = v17;
13657 if ( v17 ) 13435 }
13658 break; 13436 }
13659 }
13660 ++v20;
13661 v4 += 188;
13662 if ( v20 >= (signed int)v16 )
13663 goto LABEL_17;
13664 }
13665 }
13666 else
13667 {
13668 LABEL_17:
13669 result = 0;
13670 } 13437 }
13671 return result; 13438 return result;
13672 } 13439 }
13673 13440
13674 13441