comparison Render.cpp @ 2428:c99c99439f6c

Merge
author a.parshin
date Wed, 23 Jul 2014 13:32:09 +0300
parents 22ac062b40f7
children 6d5877899730
comparison
equal deleted inserted replaced
2427:94393b73d333 2428:c99c99439f6c
270 pGame->pIndoorCameraD3D->ViewTransform(&pTerrainVertices[z * 128 + x], 1); 270 pGame->pIndoorCameraD3D->ViewTransform(&pTerrainVertices[z * 128 + x], 1);
271 pGame->pIndoorCameraD3D->Project(&pTerrainVertices[z * 128 + x], 1, 0); 271 pGame->pIndoorCameraD3D->Project(&pTerrainVertices[z * 128 + x], 1, 0);
272 } 272 }
273 } 273 }
274 //-------(Отсечение невидимой части карты)------------------------------------------------------------------------------------------ 274 //-------(Отсечение невидимой части карты)------------------------------------------------------------------------------------------
275 float direction = pGame->pIndoorCameraD3D->sRotationY / 256;//direction of the camera(напрвление камеры) 275 float direction = (float)(pGame->pIndoorCameraD3D->sRotationY / 256);//direction of the camera(напрвление камеры)
276 //0-East(B) 276 //0-East(B)
277 //1-NorthEast(CB) 277 //1-NorthEast(CB)
278 //2-North(C) 278 //2-North(C)
279 //3-WestNorth(CЗ) 279 //3-WestNorth(CЗ)
280 //4-West(З) 280 //4-West(З)
281 //5-SouthWest(ЮЗ) 281 //5-SouthWest(ЮЗ)
282 //6-South(Ю) 282 //6-South(Ю)
283 //7-SouthEast(ЮВ) 283 //7-SouthEast(ЮВ)
284 int Start_X, End_X, Start_Z, End_Z; 284 unsigned int Start_X, End_X, Start_Z, End_Z;
285 if ( direction >= 0 && direction < 1.0 )//East(B) - NorthEast(CB) 285 if ( direction >= 0 && direction < 1.0 )//East(B) - NorthEast(CB)
286 { 286 {
287 Start_X = pODMRenderParams->uMapGridCellX - 2, End_X = 127; 287 Start_X = pODMRenderParams->uMapGridCellX - 2, End_X = 127;
288 Start_Z = 0, End_Z = 127; 288 Start_Z = 0, End_Z = 127;
289 } 289 }
505 billboard.uViewportY = pViewport->uViewportTL_Y; 505 billboard.uViewportY = pViewport->uViewportTL_Y;
506 billboard.uViewportZ = pViewport->uViewportBR_X - 1; 506 billboard.uViewportZ = pViewport->uViewportBR_X - 1;
507 billboard.uViewportW = pViewport->uViewportBR_Y; 507 billboard.uViewportW = pViewport->uViewportBR_Y;
508 pODMRenderParams->uNumBillboards = uNumBillboardsToDraw; 508 pODMRenderParams->uNumBillboards = uNumBillboardsToDraw;
509 509
510 for (int i = 0; i < ::uNumBillboardsToDraw; ++i) 510 for (unsigned int i = 0; i < ::uNumBillboardsToDraw; ++i)
511 { 511 {
512 billboard.uScreenSpaceX = pBillboardRenderList[i].uScreenSpaceX; 512 billboard.uScreenSpaceX = pBillboardRenderList[i].uScreenSpaceX;
513 billboard.uScreenSpaceY = pBillboardRenderList[i].uScreenSpaceY; 513 billboard.uScreenSpaceY = pBillboardRenderList[i].uScreenSpaceY;
514 billboard.sParentBillboardID = i; 514 billboard.sParentBillboardID = i;
515 billboard._screenspace_x_scaler_packedfloat = pBillboardRenderList[i]._screenspace_x_scaler_packedfloat; 515 billboard._screenspace_x_scaler_packedfloat = pBillboardRenderList[i]._screenspace_x_scaler_packedfloat;
572 int x; // [sp+34h] [bp-Ch]@10 572 int x; // [sp+34h] [bp-Ch]@10
573 int z; // [sp+38h] [bp-8h]@10 573 int z; // [sp+38h] [bp-8h]@10
574 signed __int16 v46; // [sp+3Ch] [bp-4h]@12 574 signed __int16 v46; // [sp+3Ch] [bp-4h]@12
575 575
576 //v41 = 0; 576 //v41 = 0;
577 for (int i = 0; i < uNumSpriteObjects; ++i) 577 for (unsigned int i = 0; i < uNumSpriteObjects; ++i)
578 { 578 {
579 SpriteObject* object = &pSpriteObjects[i]; 579 SpriteObject* object = &pSpriteObjects[i];
580 //auto v0 = (char *)&pSpriteObjects[i].uSectorID; 580 //auto v0 = (char *)&pSpriteObjects[i].uSectorID;
581 //v0 = (char *)&pSpriteObjects[0].uSectorID; 581 //v0 = (char *)&pSpriteObjects[0].uSectorID;
582 //do 582 //do
943 int v40; // [sp+90h] [bp-14h]@24 943 int v40; // [sp+90h] [bp-14h]@24
944 int v41; // [sp+94h] [bp-10h]@24 944 int v41; // [sp+94h] [bp-10h]@24
945 int v42; // [sp+98h] [bp-Ch]@9 945 int v42; // [sp+98h] [bp-Ch]@9
946 int b; // [sp+A0h] [bp-4h]@22 946 int b; // [sp+A0h] [bp-4h]@22
947 947
948 for (int i = 0; i < uNumLevelDecorations; ++i) 948 for (unsigned int i = 0; i < uNumLevelDecorations; ++i)
949 { 949 {
950 //LevelDecoration* decor = &pLevelDecorations[i]; 950 //LevelDecoration* decor = &pLevelDecorations[i];
951 if ((!(pLevelDecorations[i].uFlags & LEVEL_DECORATION_OBELISK_CHEST) 951 if ((!(pLevelDecorations[i].uFlags & LEVEL_DECORATION_OBELISK_CHEST)
952 || pLevelDecorations[i].IsObeliskChestActive()) && !(pLevelDecorations[i].uFlags & LEVEL_DECORATION_INVISIBLE)) 952 || pLevelDecorations[i].IsObeliskChestActive()) && !(pLevelDecorations[i].uFlags & LEVEL_DECORATION_INVISIBLE))
953 { 953 {
2185 // 4D864C: using guessed type char byte_4D864C; 2185 // 4D864C: using guessed type char byte_4D864C;
2186 2186
2187 //----- (0049EB79) -------------------------------------------------------- 2187 //----- (0049EB79) --------------------------------------------------------
2188 Render::~Render() 2188 Render::~Render()
2189 { 2189 {
2190 Render *v1; // esi@1
2191
2192 //v1 = this;
2193 free(this->pDefaultZBuffer); 2190 free(this->pDefaultZBuffer);
2194 this->pD3DBitmaps.Release(); 2191 this->pD3DBitmaps.Release();
2195 this->pD3DSprites.Release(); 2192 this->pD3DSprites.Release();
2196 Release(); 2193 Release();
2197 this->bWindowMode = 1; 2194 this->bWindowMode = 1;
2335 FILE *File; // [sp+128h] [bp-3Ch]@3 2332 FILE *File; // [sp+128h] [bp-3Ch]@3
2336 PCXHeader_1 header1; // [sp+130h] [bp-34h]@10 2333 PCXHeader_1 header1; // [sp+130h] [bp-34h]@10
2337 PCXHeader_2 header2; // [sp+140h] [bp-24h]@10 2334 PCXHeader_2 header2; // [sp+140h] [bp-24h]@10
2338 char *lineRGB; // [sp+148h] [bp-1Ch]@10 2335 char *lineRGB; // [sp+148h] [bp-1Ch]@10
2339 void *surface; // [sp+14Ch] [bp-18h]@8 2336 void *surface; // [sp+14Ch] [bp-18h]@8
2340 int image_width; // [sp+150h] [bp-14h]@4 2337 unsigned int image_width; // [sp+150h] [bp-14h]@4
2341 int pitch; // [sp+154h] [bp-10h]@4 2338 int pitch; // [sp+154h] [bp-10h]@4
2342 char v31; // [sp+15Ah] [bp-Ah]@25 2339 char v31; // [sp+15Ah] [bp-Ah]@25
2343 unsigned char pict_byte; // [sp+15Bh] [bp-9h]@17 2340 unsigned char pict_byte; // [sp+15Bh] [bp-9h]@17
2344 unsigned short *line_picture_data; // [sp+15Ch] [bp-8h]@10 2341 unsigned short *line_picture_data; // [sp+15Ch] [bp-8h]@10
2345 byte test_byte; // [sp+163h] [bp-1h]@17 2342 byte test_byte; // [sp+163h] [bp-1h]@17
2413 if ( this->GetRenderHeight() > 0 ) 2410 if ( this->GetRenderHeight() > 0 )
2414 { 2411 {
2415 image_width = 3 * pitch; 2412 image_width = 3 * pitch;
2416 //v24 = 2 * v5; 2413 //v24 = 2 * v5;
2417 v8 = (unsigned short *)surface; 2414 v8 = (unsigned short *)surface;
2418 for ( int y = 0; y < this->GetRenderHeight(); y++ ) 2415 for ( unsigned int y = 0; y < this->GetRenderHeight(); y++ )
2419 { 2416 {
2420 line_picture_data = v8; 2417 line_picture_data = v8;
2421 if ( GetRenderWidth() > 0 ) 2418 if ( GetRenderWidth() > 0 )
2422 { 2419 {
2423 lineG = (char *)lineRGB + pitch; 2420 lineG = (char *)lineRGB + pitch;
4968 { 4965 {
4969 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP)); 4966 ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP));
4970 v5 = 31 - (pSkyPolygon->dimming_level & 0x1F); 4967 v5 = 31 - (pSkyPolygon->dimming_level & 0x1F);
4971 if ( v5 < pOutdoor->max_terrain_dimming_level ) 4968 if ( v5 < pOutdoor->max_terrain_dimming_level )
4972 v5 = pOutdoor->max_terrain_dimming_level; 4969 v5 = pOutdoor->max_terrain_dimming_level;
4973 for (uint i = 0; i < uNumVertices; ++i) 4970 for (uint i = 0; i < (unsigned int)uNumVertices; ++i)
4974 { 4971 {
4975 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX; 4972 d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX;
4976 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY; 4973 d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY;
4977 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894); 4974 d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894);
4978 d3d_vertex_buffer[i].rhw = array_507D30[i]._rhw; 4975 d3d_vertex_buffer[i].rhw = array_507D30[i]._rhw;
4994 BLVFace *pFace; // esi@1 4991 BLVFace *pFace; // esi@1
4995 double v5; // st7@3 4992 double v5; // st7@3
4996 signed __int64 v6; // qax@3 4993 signed __int64 v6; // qax@3
4997 int v12; // edx@7 4994 int v12; // edx@7
4998 int v13; // eax@7 4995 int v13; // eax@7
4999 // void *v15; // ecx@9
5000 int v17; // edi@9 4996 int v17; // edi@9
5001 double v18; // st7@9 4997 double v18; // st7@9
5002 signed int v19; // ebx@9 4998 signed int v19; // ebx@9
5003 void *v20; // ecx@9 4999 void *v20; // ecx@9
5004 int v21; // ebx@11 5000 int v21; // ebx@11
5005 int v22; // eax@14 5001 int v22; // eax@14
5006 signed __int64 v23; // qtt@16 5002 signed __int64 v23; // qtt@16
5007 // double v24; // st7@16
5008 // unsigned __int8 v25; // sf@16
5009 // unsigned __int8 v26; // of@16
5010 double v28; // st7@20 5003 double v28; // st7@20
5011 // char *v29; // ebx@20
5012 // char *v30; // edx@20
5013 // unsigned __int8 v31; // c0@21
5014 // unsigned __int8 v32; // c3@21
5015 double v33; // st6@23 5004 double v33; // st6@23
5016 // char *v34; // esi@30
5017 const void *v35; // ecx@31 5005 const void *v35; // ecx@31
5018 int v36; // eax@31 5006 int v36; // eax@31
5019 const void *v37; // edi@31 5007 const void *v37; // edi@31
5020 signed __int64 v38; // qax@31 5008 signed __int64 v38; // qax@31
5021 int v39; // ecx@31 5009 int v39; // ecx@31
5022 int v40; // ebx@33 5010 int v40; // ebx@33
5023 int v41; // eax@36 5011 int v41; // eax@36
5024 signed __int64 v42; // qtt@39 5012 signed __int64 v42; // qtt@39
5025 int v43; // eax@39 5013 int v43; // eax@39
5026 // char v44; // zf@39
5027 // double v45; // st7@39
5028 // double v46; // st7@39
5029 // unsigned int v47; // edx@40
5030 double v48; // st7@41 5014 double v48; // st7@41
5031 // RenderVertexSoft *v49; // ebx@41
5032 // void *v50; // edi@43
5033 double v51; // st7@46 5015 double v51; // st7@46
5034 // RenderVertexSoft *v52; // edx@46
5035 // void *v53; // edi@48
5036 // signed int v59; // [sp-4h] [bp-178h]@17
5037 // struct Polygon *v60; // [sp+0h] [bp-174h]@17
5038 // IDirect3DTexture2 *v61; // [sp+4h] [bp-170h]@17
5039 struct Polygon pSkyPolygon; // [sp+14h] [bp-160h]@6 5016 struct Polygon pSkyPolygon; // [sp+14h] [bp-160h]@6
5040 unsigned int v63; // [sp+120h] [bp-54h]@7 5017 unsigned int v63; // [sp+120h] [bp-54h]@7
5041 unsigned int v65; // [sp+128h] [bp-4Ch]@1 5018 unsigned int v65; // [sp+128h] [bp-4Ch]@1
5042 unsigned int v66; // [sp+12Ch] [bp-48h]@7 5019 unsigned int v66; // [sp+12Ch] [bp-48h]@7
5043 //float v67; // [sp+130h] [bp-44h]@7
5044 __int64 v69; // [sp+13Ch] [bp-38h]@3 5020 __int64 v69; // [sp+13Ch] [bp-38h]@3
5045 int v70; // [sp+144h] [bp-30h]@3 5021 int v70; // [sp+144h] [bp-30h]@3
5046 int X; // [sp+148h] [bp-2Ch]@9 5022 int X; // [sp+148h] [bp-2Ch]@9
5047 int v72; // [sp+14Ch] [bp-28h]@7 5023 int v72; // [sp+14Ch] [bp-28h]@7
5048 float v73; // [sp+150h] [bp-24h]@16 5024 float v73; // [sp+150h] [bp-24h]@16
6223 6199
6224 //----- (004A4CC9) -------------------------------------------------------- 6200 //----- (004A4CC9) --------------------------------------------------------
6225 void Render::_4A4CC9_AddSomeBillboard(stru6_stru1_indoor_sw_billboard *a1, int diffuse) 6201 void Render::_4A4CC9_AddSomeBillboard(stru6_stru1_indoor_sw_billboard *a1, int diffuse)
6226 { 6202 {
6227 unsigned int v5; // eax@7 6203 unsigned int v5; // eax@7
6228 // char *v7; // edx@8
6229 double v10; // st6@9 6204 double v10; // st6@9
6230 double v11; // st6@10 6205 double v11; // st6@10
6231 int v12; // ebx@13 6206 int v12; // ebx@13
6232 6207
6233 if (a1->uNumVertices < 3) 6208 if (a1->uNumVertices < 3)
6234 return; 6209 return;
6235 6210
6236 float depth = 1000000.0; 6211 float depth = 1000000.0;
6237 for (uint i = 0; i < a1->uNumVertices; ++i) 6212 for (uint i = 0; i < (unsigned int)a1->uNumVertices; ++i)
6238 { 6213 {
6239 if (a1->field_104[i].z < depth) 6214 if (a1->field_104[i].z < depth)
6240 depth = a1->field_104[i * 4].z; 6215 depth = a1->field_104[i * 4].z;
6241 } 6216 }
6242 6217
6246 pBillboardRenderListD3D[v5].opacity = RenderBillboardD3D::Opaque_2; 6221 pBillboardRenderListD3D[v5].opacity = RenderBillboardD3D::Opaque_2;
6247 pBillboardRenderListD3D[v5].pTexture = 0; 6222 pBillboardRenderListD3D[v5].pTexture = 0;
6248 pBillboardRenderListD3D[v5].uNumVertices = a1->uNumVertices; 6223 pBillboardRenderListD3D[v5].uNumVertices = a1->uNumVertices;
6249 pBillboardRenderListD3D[v5].z_order = depth; 6224 pBillboardRenderListD3D[v5].z_order = depth;
6250 6225
6251 for (uint i = 0; i < a1->uNumVertices; ++i) 6226 for (uint i = 0; i < (unsigned int)a1->uNumVertices; ++i)
6252 { 6227 {
6253 pBillboardRenderListD3D[v5].pQuads[i].pos.x = a1->field_104[i].x; 6228 pBillboardRenderListD3D[v5].pQuads[i].pos.x = a1->field_104[i].x;
6254 pBillboardRenderListD3D[v5].pQuads[i].pos.y = a1->field_104[i].y; 6229 pBillboardRenderListD3D[v5].pQuads[i].pos.y = a1->field_104[i].y;
6255 6230
6256 v10 = a1->field_104[i].z; 6231 v10 = a1->field_104[i].z;
6330 if ( LockSurface_DDraw4(*pOutSurface, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY) ) 6305 if ( LockSurface_DDraw4(*pOutSurface, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY) )
6331 { 6306 {
6332 bMipMaps = 0; 6307 bMipMaps = 0;
6333 v13 = pHWLTexture->pPixels; 6308 v13 = pHWLTexture->pPixels;
6334 v14 = (unsigned __int16 *)desc.lpSurface; 6309 v14 = (unsigned __int16 *)desc.lpSurface;
6335 for(int bMipMaps = 0; bMipMaps < desc.dwHeight; bMipMaps++) 6310 for(uint bMipMaps = 0; bMipMaps < desc.dwHeight; bMipMaps++)
6336 { 6311 {
6337 for (v15 = 0; v15 < desc.dwWidth; v15++) 6312 for (v15 = 0; v15 < desc.dwWidth; v15++)
6338 { 6313 {
6339 *v14 = *v13; 6314 *v14 = *v13;
6340 ++v14; 6315 ++v14;
6375 Dst.dwSize = 124; 6350 Dst.dwSize = 124;
6376 if ( LockSurface_DDraw4((IDirectDrawSurface4 *)pSprite->pTextureSurface, &Dst, DDLOCK_WAIT | DDLOCK_WRITEONLY) ) 6351 if ( LockSurface_DDraw4((IDirectDrawSurface4 *)pSprite->pTextureSurface, &Dst, DDLOCK_WAIT | DDLOCK_WRITEONLY) )
6377 { 6352 {
6378 v9 = sprite_texture->pPixels; 6353 v9 = sprite_texture->pPixels;
6379 v10 = Dst.lpSurface; 6354 v10 = Dst.lpSurface;
6380 for (int i=0; i<sprite_texture->uHeight; ++i) 6355 for (uint i=0; i<sprite_texture->uHeight; ++i)
6381 { 6356 {
6382 for (int j=0; j<sprite_texture->uWidth/2; ++j) 6357 for (uint j=0; j<sprite_texture->uWidth/2; ++j)
6383 { 6358 {
6384 *(int *)v10 = *(int *)v9; 6359 *(int *)v10 = *(int *)v9;
6385 v9 += 2; 6360 v9 += 2;
6386 v10 = (char *)v10 + 4; 6361 v10 = (char *)v10 + 4;
6387 } 6362 }
6928 v16 = a3; 6903 v16 = a3;
6929 v6 = v15 - v16; 6904 v6 = v15 - v16;
6930 } 6905 }
6931 } 6906 }
6932 6907
6933 for (int y = 0; y < v6; ++y) 6908 for (uint y = 0; y < v6; ++y)
6934 { 6909 {
6935 for (int x = 0; x < v5; ++x) 6910 for (int x = 0; x < v5; ++x)
6936 { 6911 {
6937 if ( *v20 ) 6912 if ( *v20 )
6938 WritePixel16(clipped_out_x + x, clipped_out_y + y, ((unsigned int)a4->pPalette16[*v20] >> 1) & 0x7BEF); 6913 WritePixel16(clipped_out_x + x, clipped_out_y + y, ((unsigned int)a4->pPalette16[*v20] >> 1) & 0x7BEF);
7115 v20 = uOutY; 7090 v20 = uOutY;
7116 v10 = v19 - v20; 7091 v10 = v19 - v20;
7117 } 7092 }
7118 } 7093 }
7119 7094
7120 for (int y = 0; y < v10; ++y) 7095 for (uint y = 0; y < v10; ++y)
7121 { 7096 {
7122 for (int x = 0; x < v9; ++x) 7097 for (uint x = 0; x < v9; ++x)
7123 { 7098 {
7124 if (*v24) 7099 if (*v24)
7125 { 7100 {
7126 v22 = uShadowColor; 7101 v22 = uShadowColor;
7127 if ( *v24 != 1 ) 7102 if ( *v24 != 1 )
7232 } 7207 }
7233 7208
7234 if ( a8 ) 7209 if ( a8 )
7235 { 7210 {
7236 v28 = 0x7FF; // 16bit pRenderer->uTargetGMask | pRenderer->uTargetBMask; 7211 v28 = 0x7FF; // 16bit pRenderer->uTargetGMask | pRenderer->uTargetBMask;
7237 for (int dy = 0; dy < v9; ++dy) 7212 for (uint dy = 0; dy < v9; ++dy)
7238 { 7213 {
7239 for (int dx = 0; dx < v8; ++dx) 7214 for (int dx = 0; dx < v8; ++dx)
7240 { 7215 {
7241 if ( *v11 ) 7216 if ( *v11 )
7242 v24 = pPalette[*v11]; 7217 v24 = pPalette[*v11];
7280 while ( !v22 ); 7255 while ( !v22 );
7281 }*/ 7256 }*/
7282 } 7257 }
7283 else 7258 else
7284 { 7259 {
7285 for (int dy = 0; dy < v9; ++dy) 7260 for (uint dy = 0; dy < v9; ++dy)
7286 { 7261 {
7287 for (int dx = 0; dx < v8; ++dx) 7262 for (int dx = 0; dx < v8; ++dx)
7288 { 7263 {
7289 if ( *v11 ) 7264 if ( *v11 )
7290 WritePixel16(clipped_out_x + dx, clipped_out_y + dy, pPalette[*v11]); 7265 WritePixel16(clipped_out_x + dx, clipped_out_y + dy, pPalette[*v11]);
7507 v5 = this->uClipW - v15; 7482 v5 = this->uClipW - v15;
7508 } 7483 }
7509 } 7484 }
7510 7485
7511 v16 = v19; 7486 v16 = v19;
7512 for (int y = 0; y < v5; ++y) 7487 for (uint y = 0; y < v5; ++y)
7513 { 7488 {
7514 for (int x = 0; x < v20; ++x) 7489 for (int x = 0; x < v20; ++x)
7515 { 7490 {
7516 if ( *v16 ) 7491 if ( *v16 )
7517 WritePixel16(clipped_out_x + x, clipped_out_y + y, pTexture->pPalette16[*v16] & mask); 7492 WritePixel16(clipped_out_x + x, clipped_out_y + y, pTexture->pPalette16[*v16] & mask);
7606 v19 = y; 7581 v19 = y;
7607 uHeight = this->uClipW - v19; 7582 uHeight = this->uClipW - v19;
7608 } 7583 }
7609 } 7584 }
7610 7585
7611 for (int dy = 0; dy < uHeight; ++dy) 7586 for (uint dy = 0; dy < uHeight; ++dy)
7612 { 7587 {
7613 for (int dx = 0; dx < Width; ++dx) 7588 for (int dx = 0; dx < Width; ++dx)
7614 { 7589 {
7615 v20 = *v24; 7590 v20 = *v24;
7616 if ( v20 >= a7 && v20 <= a8 ) 7591 if ( v20 >= a7 && v20 <= a8 )
8253 { 8228 {
8254 pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); 8229 pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits);
8255 pPaletteManager->RecalculateAll(); 8230 pPaletteManager->RecalculateAll();
8256 pBitmaps_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); 8231 pBitmaps_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits);
8257 pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); 8232 pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits);
8258 for (int i = 0; i < pObjectList->uNumObjects; i++) 8233 for (uint i = 0; i < pObjectList->uNumObjects; i++)
8259 { 8234 {
8260 BYTE3(v4) = 0; 8235 BYTE3(v4) = 0;
8261 v5 = &pObjectList->pObjects[i]; 8236 v5 = &pObjectList->pObjects[i];
8262 *(short *)((char *)&v4 + 1) = v5->uParticleTrailColorR; 8237 *(short *)((char *)&v4 + 1) = v5->uParticleTrailColorR;
8263 LOBYTE(v4) = v5->uParticleTrailColorG; 8238 LOBYTE(v4) = v5->uParticleTrailColorG;
8440 File = fopen("logd3d.txt", "w"); 8415 File = fopen("logd3d.txt", "w");
8441 v4 = ftell(this->pFile); 8416 v4 = ftell(this->pFile);
8442 v5 = this->pFile; 8417 v5 = this->pFile;
8443 this->uDataOffset = v4; 8418 this->uDataOffset = v4;
8444 fwrite(&this->uNumItems, 4u, 1u, v5); 8419 fwrite(&this->uNumItems, 4u, 1u, v5);
8445 for (int i = 0; i < this->uNumItems; i++) 8420 for (uint i = 0; i < this->uNumItems; i++)
8446 { 8421 {
8447 fwrite(this->pSpriteNames[i], 1u, 0x14u, this->pFile); 8422 fwrite(this->pSpriteNames[i], 1u, 0x14u, this->pFile);
8448 fprintf(File, "D3D texture name: %s\t\toffset: %x\n", this->pSpriteNames[i], *(unsigned int *)(&(this->pSpriteNames[i]) + 200000/sizeof(char*))); 8423 fprintf(File, "D3D texture name: %s\t\toffset: %x\n", this->pSpriteNames[i], *(unsigned int *)(&(this->pSpriteNames[i]) + 200000/sizeof(char*)));
8449 } 8424 }
8450 fwrite(this->pSpriteOffsets, 4u, this->uNumItems, this->pFile); 8425 fwrite(this->pSpriteOffsets, 4u, this->uNumItems, this->pFile);
8454 fclose(File); 8429 fclose(File);
8455 } 8430 }
8456 else 8431 else
8457 { 8432 {
8458 fclose(this->pFile); 8433 fclose(this->pFile);
8459 for (int i = 0; i < this->uNumItems; i++) 8434 for (uint i = 0; i < this->uNumItems; i++)
8460 { 8435 {
8461 free(this->pSpriteNames[i]); 8436 free(this->pSpriteNames[i]);
8462 } 8437 }
8463 } 8438 }
8464 return true; 8439 return true;
8658 // | | 8633 // | |
8659 // .__________________. 8634 // .__________________.
8660 // v2 v1 8635 // v2 v1
8661 8636
8662 int out_num_vertices = 0; 8637 int out_num_vertices = 0;
8663 for (int i = 0; i < num_vertices; ++i) 8638 for (uint i = 0; i < num_vertices; ++i)
8664 { 8639 {
8665 next_vertices_flag = array_50AC10[i + 1].vWorldViewPosition.x <= 8.0;// 8640 next_vertices_flag = array_50AC10[i + 1].vWorldViewPosition.x <= 8.0;//
8666 if ( current_vertices_flag ^ next_vertices_flag ) 8641 if ( current_vertices_flag ^ next_vertices_flag )
8667 { 8642 {
8668 if ( next_vertices_flag )//следующая вершина за ближней границей 8643 if ( next_vertices_flag )//следующая вершина за ближней границей
8806 } 8781 }
8807 8782
8808 unused = 0; 8783 unused = 0;
8809 if ( (signed int)pOutdoor->uNumBModels > 0 ) 8784 if ( (signed int)pOutdoor->uNumBModels > 0 )
8810 { 8785 {
8811 for ( uint model_id = 0; model_id < pOutdoor->uNumBModels; model_id++ ) 8786 for ( uint model_id = 0; model_id < (unsigned int)pOutdoor->uNumBModels; model_id++ )
8812 { 8787 {
8813 if ( IsBModelVisible(model_id, &unused) ) 8788 if ( IsBModelVisible(model_id, &unused) )
8814 { 8789 {
8815 pOutdoor->pBModels[model_id].field_40 |= 1; 8790 pOutdoor->pBModels[model_id].field_40 |= 1;
8816 if ( pOutdoor->pBModels[model_id].uNumFaces > 0 ) 8791 if ( pOutdoor->pBModels[model_id].uNumFaces > 0 )
9184 memset(&Dst, 0, 0x7C); 9159 memset(&Dst, 0, 0x7C);
9185 Dst.dwSize = sizeof(Dst); 9160 Dst.dwSize = sizeof(Dst);
9186 9161
9187 if ( LockSurface_DDraw4(pBackBuffer4, &Dst, DDLOCK_WAIT) ) 9162 if ( LockSurface_DDraw4(pBackBuffer4, &Dst, DDLOCK_WAIT) )
9188 { 9163 {
9189 for (uint y = 0; y < height; ++y) 9164 for (uint y = 0; y < (unsigned int)height; ++y)
9190 { 9165 {
9191 for (uint x = 0; x < width; ++x) 9166 for (uint x = 0; x < (unsigned int)width; ++x)
9192 { 9167 {
9193 //*v3 = pRenderer->ReadPixel16((int)(x* interval_x + 8.0), (int)(y * interval_y + 8.0));//screen_data[screen_y + (int)(x* interval_x + 8.0)]; 9168 //*v3 = pRenderer->ReadPixel16((int)(x* interval_x + 8.0), (int)(y * interval_y + 8.0));//screen_data[screen_y + (int)(x* interval_x + 8.0)];
9194 /* 9169 /*
9195 if (ddpfPrimarySuface.dwRGBBitCount == 32) 9170 if (ddpfPrimarySuface.dwRGBBitCount == 32)
9196 { 9171 {
9541 if ( pDecal->field_C1C & 1 ) 9516 if ( pDecal->field_C1C & 1 )
9542 color_mult = 1.0; 9517 color_mult = 1.0;
9543 else 9518 else
9544 color_mult = pDecal->field_C18->_43B570_get_color_mult_by_time(); 9519 color_mult = pDecal->field_C18->_43B570_get_color_mult_by_time();
9545 9520
9546 for (uint i = 0; i < pDecal->uNumVertices; ++i) 9521 for (uint i = 0; i < (unsigned int)pDecal->uNumVertices; ++i)
9547 { 9522 {
9548 uint uTint = Render::GetActorTintColor(pDecal->pVertices[i].vWorldViewPosition.x, pDecal->field_C14, 0, 0, nullptr); 9523 uint uTint = Render::GetActorTintColor(pDecal->pVertices[i].vWorldViewPosition.x, pDecal->field_C14, 0, 0, nullptr);
9549 9524
9550 uint uTintR = (uTint >> 16) & 0xFF, 9525 uint uTintR = (uTint >> 16) & 0xFF,
9551 uTintG = (uTint >> 8) & 0xFF, 9526 uTintG = (uTint >> 8) & 0xFF,