Mercurial > mm7
comparison Render.cpp @ 1980:c1c74df0a33e
changing most of auto types to their actual types
author | Grumpy7 |
---|---|
date | Wed, 30 Oct 2013 00:47:37 -0700 |
parents | bd5c3f33bff4 |
children | 2647e2f820a6 |
comparison
equal
deleted
inserted
replaced
1979:92dfa0cafbe3 | 1980:c1c74df0a33e |
---|---|
145 soft_billboard.uViewportW = pBLVRenderParams->uViewportW; | 145 soft_billboard.uViewportW = pBLVRenderParams->uViewportW; |
146 | 146 |
147 pODMRenderParams->uNumBillboards = ::uNumBillboardsToDraw; | 147 pODMRenderParams->uNumBillboards = ::uNumBillboardsToDraw; |
148 for (uint i = 0; i < ::uNumBillboardsToDraw; ++i) | 148 for (uint i = 0; i < ::uNumBillboardsToDraw; ++i) |
149 { | 149 { |
150 auto p = pBillboardRenderList + i; | 150 RenderBillboard* p = &pBillboardRenderList[i]; |
151 | 151 |
152 soft_billboard.uScreenSpaceX = p->uScreenSpaceX; | 152 soft_billboard.uScreenSpaceX = p->uScreenSpaceX; |
153 soft_billboard.uParentBillboardID = i; | 153 soft_billboard.uParentBillboardID = i; |
154 soft_billboard.uScreenSpaceY = p->uScreenSpaceY; | 154 soft_billboard.uScreenSpaceY = p->uScreenSpaceY; |
155 soft_billboard._screenspace_x_scaler_packedfloat = p->_screenspace_x_scaler_packedfloat; | 155 soft_billboard._screenspace_x_scaler_packedfloat = p->_screenspace_x_scaler_packedfloat; |
297 //shading (затенение)---------------------------------------------------------------------------- | 297 //shading (затенение)---------------------------------------------------------------------------- |
298 //uint norm_idx = pTerrainNormalIndices[2 * (z * 128 + x) + 1]; | 298 //uint norm_idx = pTerrainNormalIndices[2 * (z * 128 + x) + 1]; |
299 uint norm_idx = pTerrainNormalIndices[2 * (x * 128 + z) + 2]; | 299 uint norm_idx = pTerrainNormalIndices[2 * (x * 128 + z) + 2]; |
300 assert(norm_idx < uNumTerrainNormals); | 300 assert(norm_idx < uNumTerrainNormals); |
301 | 301 |
302 auto norm = pTerrainNormals + norm_idx; | 302 Vec3_float_* norm = &pTerrainNormals[norm_idx]; |
303 float _f = ((norm->x * (float)pOutdoor->vSunlight.x / 65536.0) - | 303 float _f = ((norm->x * (float)pOutdoor->vSunlight.x / 65536.0) - |
304 (norm->y * (float)pOutdoor->vSunlight.y / 65536.0) - | 304 (norm->y * (float)pOutdoor->vSunlight.y / 65536.0) - |
305 (norm->z * (float)pOutdoor->vSunlight.z / 65536.0)); | 305 (norm->z * (float)pOutdoor->vSunlight.z / 65536.0)); |
306 pTilePolygon->dimming_level = 20.0 - floorf(20.0 * _f + 0.5f); | 306 pTilePolygon->dimming_level = 20.0 - floorf(20.0 * _f + 0.5f); |
307 //----------------------------------------------------------------------------------------------- | 307 //----------------------------------------------------------------------------------------------- |
388 billboard.uViewportW = pViewport->uViewportBR_Y; | 388 billboard.uViewportW = pViewport->uViewportBR_Y; |
389 pODMRenderParams->uNumBillboards = uNumBillboardsToDraw; | 389 pODMRenderParams->uNumBillboards = uNumBillboardsToDraw; |
390 | 390 |
391 for (int i = 0; i < ::uNumBillboardsToDraw; ++i) | 391 for (int i = 0; i < ::uNumBillboardsToDraw; ++i) |
392 { | 392 { |
393 auto pBillboard = pBillboardRenderList + i; | 393 RenderBillboard* pBillboard = &pBillboardRenderList[i]; |
394 | 394 |
395 billboard.uScreenSpaceX = pBillboard->uScreenSpaceX; | 395 billboard.uScreenSpaceX = pBillboard->uScreenSpaceX; |
396 billboard.uScreenSpaceY = pBillboard->uScreenSpaceY; | 396 billboard.uScreenSpaceY = pBillboard->uScreenSpaceY; |
397 billboard.uParentBillboardID = i; | 397 billboard.uParentBillboardID = i; |
398 billboard._screenspace_x_scaler_packedfloat = pBillboard->_screenspace_x_scaler_packedfloat; | 398 billboard._screenspace_x_scaler_packedfloat = pBillboard->_screenspace_x_scaler_packedfloat; |
487 signed __int16 v46; // [sp+3Ch] [bp-4h]@12 | 487 signed __int16 v46; // [sp+3Ch] [bp-4h]@12 |
488 | 488 |
489 //v41 = 0; | 489 //v41 = 0; |
490 for (int i = 0; i < uNumSpriteObjects; ++i) | 490 for (int i = 0; i < uNumSpriteObjects; ++i) |
491 { | 491 { |
492 auto object = &pSpriteObjects[i]; | 492 SpriteObject* object = &pSpriteObjects[i]; |
493 //auto v0 = (char *)&pSpriteObjects[i].uSectorID; | 493 //auto v0 = (char *)&pSpriteObjects[i].uSectorID; |
494 //v0 = (char *)&pSpriteObjects[0].uSectorID; | 494 //v0 = (char *)&pSpriteObjects[0].uSectorID; |
495 //do | 495 //do |
496 //{ | 496 //{ |
497 if (!object->uObjectDescID) // item probably pciked up | 497 if (!object->uObjectDescID) // item probably pciked up |
498 continue; | 498 continue; |
499 | 499 |
500 assert(object->uObjectDescID < pObjectList->uNumObjects); | 500 assert(object->uObjectDescID < pObjectList->uNumObjects); |
501 auto object_desc = pObjectList->pObjects + object->uObjectDescID; | 501 ObjectDesc* object_desc = &pObjectList->pObjects[object->uObjectDescID]; |
502 if (object_desc->NoSprite()) | 502 if (object_desc->NoSprite()) |
503 continue; | 503 continue; |
504 | 504 |
505 //v1 = &pObjectList->pObjects[*((short *)v0 - 13)]; | 505 //v1 = &pObjectList->pObjects[*((short *)v0 - 13)]; |
506 //if ( !(v1->uFlags & 1) ) | 506 //if ( !(v1->uFlags & 1) ) |
906 //{ | 906 //{ |
907 //v0 = (char *)&pLevelDecorations[0].vPosition.y; | 907 //v0 = (char *)&pLevelDecorations[0].vPosition.y; |
908 //do | 908 //do |
909 for (int i = 0; i < uNumLevelDecorations; ++i) | 909 for (int i = 0; i < uNumLevelDecorations; ++i) |
910 { | 910 { |
911 auto decor = &pLevelDecorations[i]; | 911 LevelDecoration* decor = &pLevelDecorations[i]; |
912 auto v0 = (char *)&pLevelDecorations[i].vPosition.y; | 912 char* v0 = (char *)&pLevelDecorations[i].vPosition.y; |
913 | 913 |
914 if ((!(decor->uFlags & LEVEL_DECORATION_OBELISK_CHEST) || decor->IsObeliskChestActive()) && !(decor->uFlags & LEVEL_DECORATION_INVISIBLE)) | 914 if ((!(decor->uFlags & LEVEL_DECORATION_OBELISK_CHEST) || decor->IsObeliskChestActive()) && !(decor->uFlags & LEVEL_DECORATION_INVISIBLE)) |
915 { | 915 { |
916 //v1 = &pDecorationList->pDecorations[decor->uDecorationDescID]; | 916 //v1 = &pDecorationList->pDecorations[decor->uDecorationDescID]; |
917 auto decor_desc = pDecorationList->pDecorations + decor->uDecorationDescID; | 917 DecorationDesc* decor_desc = pDecorationList->pDecorations + decor->uDecorationDescID; |
918 v2 = decor_desc->uFlags; | 918 v2 = decor_desc->uFlags; |
919 if ( (char)v2 >= 0 ) | 919 if ( (char)v2 >= 0 ) |
920 { | 920 { |
921 if ( !(v2 & 0x22) ) | 921 if ( !(v2 & 0x22) ) |
922 { | 922 { |
2111 bUseColoredLights = bColoredLights;//ReadWindowsRegistryInt("Colored Lights", 0); | 2111 bUseColoredLights = bColoredLights;//ReadWindowsRegistryInt("Colored Lights", 0); |
2112 uLevelOfDetail = uDetailLevel;//ReadWindowsRegistryInt("Detail Level", 1); | 2112 uLevelOfDetail = uDetailLevel;//ReadWindowsRegistryInt("Detail Level", 1); |
2113 | 2113 |
2114 this->bTinting = bTinting; | 2114 this->bTinting = bTinting; |
2115 | 2115 |
2116 auto r1 = pD3DBitmaps.Load(L"data\\d3dbitmap.hwl"); | 2116 bool r1 = pD3DBitmaps.Load(L"data\\d3dbitmap.hwl"); |
2117 auto r2 = pD3DSprites.Load(L"data\\d3dsprite.hwl"); | 2117 bool r2 = pD3DSprites.Load(L"data\\d3dsprite.hwl"); |
2118 | 2118 |
2119 return r1 && r2; | 2119 return r1 && r2; |
2120 } | 2120 } |
2121 | 2121 |
2122 //----- (0049EBF1) -------------------------------------------------------- | 2122 //----- (0049EBF1) -------------------------------------------------------- |
2947 Render *v2; // esi@1 | 2947 Render *v2; // esi@1 |
2948 IDirectDrawSurface4 *v3; // eax@6 | 2948 IDirectDrawSurface4 *v3; // eax@6 |
2949 IDirectDrawSurface4 *v4; // ST0C_4@6 | 2949 IDirectDrawSurface4 *v4; // ST0C_4@6 |
2950 RECT v5; // [sp+8h] [bp-10h]@6 | 2950 RECT v5; // [sp+8h] [bp-10h]@6 |
2951 | 2951 |
2952 auto a1 = this; | 2952 Render* a1 = this; |
2953 v2 = a1; | 2953 v2 = a1; |
2954 if ( a1->pRenderD3D ) | 2954 if ( a1->pRenderD3D ) |
2955 { | 2955 { |
2956 if (pFrontBuffer4->IsLost() == DDERR_SURFACELOST) | 2956 if (pFrontBuffer4->IsLost() == DDERR_SURFACELOST) |
2957 pFrontBuffer4->Restore(); | 2957 pFrontBuffer4->Restore(); |
4300 IDirectDrawSurface *pFront; // eax@3 | 4300 IDirectDrawSurface *pFront; // eax@3 |
4301 HRESULT v2; // eax@5 | 4301 HRESULT v2; // eax@5 |
4302 signed int v3; // [sp-8h] [bp-Ch]@3 | 4302 signed int v3; // [sp-8h] [bp-Ch]@3 |
4303 int v4; // [sp-4h] [bp-8h]@3 | 4303 int v4; // [sp-4h] [bp-8h]@3 |
4304 | 4304 |
4305 auto a5 = this; | 4305 Render* a5 = this; |
4306 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) | 4306 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) |
4307 { | 4307 { |
4308 pFront = (IDirectDrawSurface *)a5->pFrontBuffer4; | 4308 pFront = (IDirectDrawSurface *)a5->pFrontBuffer4; |
4309 v4 = 0; | 4309 v4 = 0; |
4310 v3 = 2615; | 4310 v3 = 2615; |
5432 //auto a3 = pFace; | 5432 //auto a3 = pFace; |
5433 //auto a6 = uPackedID; | 5433 //auto a6 = uPackedID; |
5434 //v59 = pGame->pLightmapBuilder; | 5434 //v59 = pGame->pLightmapBuilder; |
5435 //v9 = v59->std__vector_000004_size; | 5435 //v9 = v59->std__vector_000004_size; |
5436 | 5436 |
5437 auto uCorrectedColor = uColor; | 5437 uint uCorrectedColor = uColor; |
5438 if (pGame->pLightmapBuilder->std__vector_000004_size) | 5438 if (pGame->pLightmapBuilder->std__vector_000004_size) |
5439 uCorrectedColor = 0xFFFFFFFF; | 5439 uCorrectedColor = 0xFFFFFFFF; |
5440 pGame->AlterGamma_BLV(pFace, &uCorrectedColor); | 5440 pGame->AlterGamma_BLV(pFace, &uCorrectedColor); |
5441 | 5441 |
5442 | 5442 |
6388 unsigned __int16 *v14; // eax@19 | 6388 unsigned __int16 *v14; // eax@19 |
6389 DWORD v15; // edx@20 | 6389 DWORD v15; // edx@20 |
6390 HRESULT v16; // eax@23 | 6390 HRESULT v16; // eax@23 |
6391 stru350 Dst; // [sp+Ch] [bp-F8h]@12 | 6391 stru350 Dst; // [sp+Ch] [bp-F8h]@12 |
6392 | 6392 |
6393 auto pHWLTexture = pD3DBitmaps.LoadTexture(pName, bMipMaps); | 6393 HWLTexture* pHWLTexture = pD3DBitmaps.LoadTexture(pName, bMipMaps); |
6394 if ( pHWLTexture ) | 6394 if ( pHWLTexture ) |
6395 { | 6395 { |
6396 bMipMaps = !strncmp(pName, "HDWTR", 5); | 6396 bMipMaps = !strncmp(pName, "HDWTR", 5); |
6397 if ( !pRenderD3D->CreateTexture( | 6397 if ( !pRenderD3D->CreateTexture( |
6398 pHWLTexture->uWidth, | 6398 pHWLTexture->uWidth, |
6649 double v39; // [sp+94h] [bp-Ch]@6 | 6649 double v39; // [sp+94h] [bp-Ch]@6 |
6650 float v40; // [sp+9Ch] [bp-4h]@6 | 6650 float v40; // [sp+9Ch] [bp-4h]@6 |
6651 | 6651 |
6652 __debugbreak(); | 6652 __debugbreak(); |
6653 | 6653 |
6654 auto ecx0 = this; | 6654 Render* ecx0 = this; |
6655 v3 = 0; | 6655 v3 = 0; |
6656 | 6656 |
6657 if (!this->pRenderD3D) | 6657 if (!this->pRenderD3D) |
6658 __debugbreak(); // sw render | 6658 __debugbreak(); // sw render |
6659 | 6659 |
7166 return; | 7166 return; |
7167 | 7167 |
7168 unsigned __int32 twoColors = (uColor16 << 16) | uColor16; | 7168 unsigned __int32 twoColors = (uColor16 << 16) | uColor16; |
7169 for (uint y = 0; y < uHeight; ++y) | 7169 for (uint y = 0; y < uHeight; ++y) |
7170 { | 7170 { |
7171 auto pDst = &pTargetSurface[uX + (y + uY) * uTargetSurfacePitch]; | 7171 ushort* pDst = &pTargetSurface[uX + (y + uY) * uTargetSurfacePitch]; |
7172 | 7172 |
7173 memset32(pDst, twoColors, uWidth / 2); | 7173 memset32(pDst, twoColors, uWidth / 2); |
7174 if (uWidth & 1) | 7174 if (uWidth & 1) |
7175 pDst[uWidth - 1] = uColor16; | 7175 pDst[uWidth - 1] = uColor16; |
7176 } | 7176 } |
7311 int v27; // [sp+1Ch] [bp+Ch]@33 | 7311 int v27; // [sp+1Ch] [bp+Ch]@33 |
7312 unsigned int v28; // [sp+20h] [bp+10h]@30 | 7312 unsigned int v28; // [sp+20h] [bp+10h]@30 |
7313 unsigned int v29; // [sp+24h] [bp+14h]@22 | 7313 unsigned int v29; // [sp+24h] [bp+14h]@22 |
7314 unsigned int v30; // [sp+24h] [bp+14h]@31 | 7314 unsigned int v30; // [sp+24h] [bp+14h]@31 |
7315 | 7315 |
7316 auto a2 = x; | 7316 int a2 = x; |
7317 auto a3 = y; | 7317 int a3 = y; |
7318 auto a6 = uFontHeight; | 7318 uint a6 = uFontHeight; |
7319 if ( this->uNumSceneBegins ) | 7319 if ( this->uNumSceneBegins ) |
7320 { | 7320 { |
7321 v8 = a5; | 7321 v8 = a5; |
7322 v9 = a6; | 7322 v9 = a6; |
7323 v10 = &pTargetSurface[x + y * uTargetSurfacePitch]; | 7323 v10 = &pTargetSurface[x + y * uTargetSurfacePitch]; |
8428 //v5 = 0, pDesta = uNumItems; | 8428 //v5 = 0, pDesta = uNumItems; |
8429 uint idx1 = 0, | 8429 uint idx1 = 0, |
8430 idx2 = uNumItems; | 8430 idx2 = uNumItems; |
8431 while (true) | 8431 while (true) |
8432 { | 8432 { |
8433 auto i = idx1 + (idx2 - idx1) / 2; | 8433 uint i = idx1 + (idx2 - idx1) / 2; |
8434 | 8434 |
8435 auto res = _stricmp(pName, pSpriteNames[i]); | 8435 int res = _stricmp(pName, pSpriteNames[i]); |
8436 if (!res) | 8436 if (!res) |
8437 { | 8437 { |
8438 fseek(pFile, pSpriteOffsets[i], SEEK_SET); | 8438 fseek(pFile, pSpriteOffsets[i], SEEK_SET); |
8439 break; | 8439 break; |
8440 } | 8440 } |
8449 | 8449 |
8450 | 8450 |
8451 uint uCompressedSize = 0; | 8451 uint uCompressedSize = 0; |
8452 fread(&uCompressedSize, 4, 1, pFile); | 8452 fread(&uCompressedSize, 4, 1, pFile); |
8453 | 8453 |
8454 auto pTex = new HWLTexture; | 8454 HWLTexture* pTex = new HWLTexture; |
8455 fread(&pTex->uBufferWidth, 4, 1, pFile); | 8455 fread(&pTex->uBufferWidth, 4, 1, pFile); |
8456 fread(&pTex->uBufferHeight, 4, 1, pFile); | 8456 fread(&pTex->uBufferHeight, 4, 1, pFile); |
8457 fread(&pTex->uAreaWidth, 4, 1, pFile); | 8457 fread(&pTex->uAreaWidth, 4, 1, pFile); |
8458 fread(&pTex->uAreaHeigth, 4, 1, pFile); | 8458 fread(&pTex->uAreaHeigth, 4, 1, pFile); |
8459 fread(&pTex->uWidth, 4, 1, pFile); | 8459 fread(&pTex->uWidth, 4, 1, pFile); |
8462 fread(&pTex->uAreaY, 4, 1, pFile); | 8462 fread(&pTex->uAreaY, 4, 1, pFile); |
8463 | 8463 |
8464 pTex->pPixels = new unsigned __int16[pTex->uWidth * pTex->uHeight]; | 8464 pTex->pPixels = new unsigned __int16[pTex->uWidth * pTex->uHeight]; |
8465 if (uCompressedSize) | 8465 if (uCompressedSize) |
8466 { | 8466 { |
8467 auto pCompressedData = new char[uCompressedSize]; | 8467 char* pCompressedData = new char[uCompressedSize]; |
8468 { | 8468 { |
8469 fread(pCompressedData, 1, uCompressedSize, pFile); | 8469 fread(pCompressedData, 1, uCompressedSize, pFile); |
8470 auto uDecompressedSize = pTex->uWidth * pTex->uHeight * sizeof(short); | 8470 uint uDecompressedSize = pTex->uWidth * pTex->uHeight * sizeof(short); |
8471 zlib::MemUnzip(pTex->pPixels, &uDecompressedSize, pCompressedData, uCompressedSize); | 8471 zlib::MemUnzip(pTex->pPixels, &uDecompressedSize, pCompressedData, uCompressedSize); |
8472 } | 8472 } |
8473 delete [] pCompressedData; | 8473 delete [] pCompressedData; |
8474 } | 8474 } |
8475 else | 8475 else |
8638 | 8638 |
8639 }*/ | 8639 }*/ |
8640 | 8640 |
8641 for (uint i = pRenderer->uNumBillboardsToDraw - 1; i != (uint)-1; --i) | 8641 for (uint i = pRenderer->uNumBillboardsToDraw - 1; i != (uint)-1; --i) |
8642 { | 8642 { |
8643 auto p = &pRenderer->pBillboardRenderListD3D[i]; | 8643 RenderBillboardD3D* p = &pRenderer->pBillboardRenderListD3D[i]; |
8644 | 8644 |
8645 if (p->uOpacity != RenderBillboardD3D::NoBlend) | 8645 if (p->uOpacity != RenderBillboardD3D::NoBlend) |
8646 SetBillboardBlendOptions(p->uOpacity); | 8646 SetBillboardBlendOptions(p->uOpacity); |
8647 | 8647 |
8648 pRenderer->pRenderD3D->pDevice->SetTexture(0, p->pTexture); | 8648 pRenderer->pRenderD3D->pDevice->SetTexture(0, p->pTexture); |