comparison Render.cpp @ 168:ee11772d0ad2

New sky (turn on -new_sky console command) cube textures are stored in /daata/skybox/%name%_xn.tga %name%%_xp.tga %name%_zn.tga etc
author Nomad
date Thu, 14 Feb 2013 13:58:34 +0200
parents 8ab4484c22e0
children d1dde383af89
comparison
equal deleted inserted replaced
144:8ab4484c22e0 168:ee11772d0ad2
1823 v31 = (8 * (0 | (0 << 6))); 1823 v31 = (8 * (0 | (0 << 6)));
1824 v8->field_50 = v31 | 6; 1824 v8->field_50 = v31 | 6;
1825 for (unsigned int k = 0; k < 4; ++k) 1825 for (unsigned int k = 0; k < 4; ++k)
1826 { 1826 {
1827 memcpy(&array_50AC10[k], &array_73D150[k], sizeof(struct RenderVertexSoft)); 1827 memcpy(&array_50AC10[k], &array_73D150[k], sizeof(struct RenderVertexSoft));
1828 array_50AC10[k].flt_20 = 1.0 / (array_73D150[k].vWorldViewPosition.x + 0.0000001000000011686097); 1828 array_50AC10[k]._rhw = 1.0 / (array_73D150[k].vWorldViewPosition.x + 0.0000001000000011686097);
1829 } 1829 }
1830 1830
1831 assert(v6 < 1000); // many random crashes here 1831 assert(v6 < 1000); // many random crashes here
1832 pRenderer->DrawTerrainPolygon(v8, pBitmaps_LOD->pHardwareTextures[v6]); 1832 pRenderer->DrawTerrainPolygon(v8, pBitmaps_LOD->pHardwareTextures[v6]);
1833 --pOutdoorCamera->numStru148s; 1833 --pOutdoorCamera->numStru148s;
2057 //{ 2057 //{
2058 //--pOutdoorCamera->numStru148s; 2058 //--pOutdoorCamera->numStru148s;
2059 //goto LABEL_162; 2059 //goto LABEL_162;
2060 //} 2060 //}
2061 memcpy(&array_50AC10[0], v102, 0x30u); 2061 memcpy(&array_50AC10[0], v102, 0x30u);
2062 array_50AC10[0].flt_20 = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); 2062 array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097);
2063 array_50AC10[0].u = 0.0; 2063 array_50AC10[0].u = 0.0;
2064 array_50AC10[0].v = 0.0; 2064 array_50AC10[0].v = 0.0;
2065 memcpy(&array_50AC10[1], pVertices, sizeof(array_50AC10[1])); 2065 memcpy(&array_50AC10[1], pVertices, sizeof(array_50AC10[1]));
2066 array_50AC10[1].flt_20 = 1.0 / (pVertices->vWorldViewPosition.x + 0.0000001000000011686097); 2066 array_50AC10[1]._rhw = 1.0 / (pVertices->vWorldViewPosition.x + 0.0000001000000011686097);
2067 array_50AC10[1].u = 0.0; 2067 array_50AC10[1].u = 0.0;
2068 array_50AC10[1].v = 1.0; 2068 array_50AC10[1].v = 1.0;
2069 memcpy(&array_50AC10[2], pVertices2, sizeof(array_50AC10[2])); 2069 memcpy(&array_50AC10[2], pVertices2, sizeof(array_50AC10[2]));
2070 array_50AC10[2].flt_20 = 1.0 / (pVertices2->vWorldViewPosition.x + 0.0000001000000011686097); 2070 array_50AC10[2]._rhw = 1.0 / (pVertices2->vWorldViewPosition.x + 0.0000001000000011686097);
2071 array_50AC10[2].u = 1.0; 2071 array_50AC10[2].u = 1.0;
2072 array_50AC10[2].v = 1.0; 2072 array_50AC10[2].v = 1.0;
2073 memcpy(&array_50AC10[3], v101, sizeof(array_50AC10[3])); 2073 memcpy(&array_50AC10[3], v101, sizeof(array_50AC10[3]));
2074 array_50AC10[3].flt_20 = 1.0 / (v101->vWorldViewPosition.x + 0.0000001000000011686097); 2074 array_50AC10[3]._rhw = 1.0 / (v101->vWorldViewPosition.x + 0.0000001000000011686097);
2075 array_50AC10[3].u = 1.0; 2075 array_50AC10[3].u = 1.0;
2076 array_50AC10[3].v = 0.0; 2076 array_50AC10[3].v = 0.0;
2077 /*if ( !(byte_76D5C0 & 1) ) 2077 /*if ( !(byte_76D5C0 & 1) )
2078 { 2078 {
2079 byte_76D5C0 |= 1u; 2079 byte_76D5C0 |= 1u;
2197 { 2197 {
2198 --pOutdoorCamera->numStru148s; 2198 --pOutdoorCamera->numStru148s;
2199 goto LABEL_112; 2199 goto LABEL_112;
2200 }*/ 2200 }*/
2201 memcpy(&array_50AC10[0], v102, 0x30u); 2201 memcpy(&array_50AC10[0], v102, 0x30u);
2202 array_50AC10[0].flt_20 = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); 2202 array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097);
2203 array_50AC10[0].u = 0.0; 2203 array_50AC10[0].u = 0.0;
2204 array_50AC10[0].v = 0.0; 2204 array_50AC10[0].v = 0.0;
2205 memcpy(&array_50AC10[1], pVertices, sizeof(array_50AC10[1])); 2205 memcpy(&array_50AC10[1], pVertices, sizeof(array_50AC10[1]));
2206 array_50AC10[1].flt_20 = 1.0 / pVertices->vWorldViewPosition.x + 0.0000001000000011686097; 2206 array_50AC10[1]._rhw = 1.0 / pVertices->vWorldViewPosition.x + 0.0000001000000011686097;
2207 array_50AC10[1].u = 0.0; 2207 array_50AC10[1].u = 0.0;
2208 array_50AC10[1].v = 1.0; 2208 array_50AC10[1].v = 1.0;
2209 memcpy(&array_50AC10[2], pVertices2, sizeof(array_50AC10[2])); 2209 memcpy(&array_50AC10[2], pVertices2, sizeof(array_50AC10[2]));
2210 array_50AC10[2].flt_20 = 1.0 / pVertices2->vWorldViewPosition.x + 0.0000001000000011686097; 2210 array_50AC10[2]._rhw = 1.0 / pVertices2->vWorldViewPosition.x + 0.0000001000000011686097;
2211 array_50AC10[2].u = 1.0; 2211 array_50AC10[2].u = 1.0;
2212 array_50AC10[2].v = 1.0; 2212 array_50AC10[2].v = 1.0;
2213 static stru154 static_sub_0048034E_stru_76D590; 2213 static stru154 static_sub_0048034E_stru_76D590;
2214 /*static bool __init_flag2 = false; 2214 /*static bool __init_flag2 = false;
2215 if (!__init_flag2) 2215 if (!__init_flag2)
2326 //LABEL_126: 2326 //LABEL_126:
2327 --pOutdoorCamera->numStru148s; 2327 --pOutdoorCamera->numStru148s;
2328 goto LABEL_162; 2328 goto LABEL_162;
2329 } 2329 }
2330 memcpy(&array_50AC10[0], v102, 0x30u); 2330 memcpy(&array_50AC10[0], v102, 0x30u);
2331 array_50AC10[0].flt_20 = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097); 2331 array_50AC10[0]._rhw = 1.0 / (v102->vWorldViewPosition.x + 0.0000001000000011686097);
2332 array_50AC10[0].u = 0.0; 2332 array_50AC10[0].u = 0.0;
2333 array_50AC10[0].v = 0.0; 2333 array_50AC10[0].v = 0.0;
2334 memcpy(&array_50AC10[1], pVertices2, sizeof(array_50AC10[1])); 2334 memcpy(&array_50AC10[1], pVertices2, sizeof(array_50AC10[1]));
2335 array_50AC10[1].flt_20 = 1.0 / pVertices2->vWorldViewPosition.x + 0.0000001000000011686097; 2335 array_50AC10[1]._rhw = 1.0 / pVertices2->vWorldViewPosition.x + 0.0000001000000011686097;
2336 array_50AC10[1].u = 1.0; 2336 array_50AC10[1].u = 1.0;
2337 array_50AC10[1].v = 1.0; 2337 array_50AC10[1].v = 1.0;
2338 memcpy(&array_50AC10[2], v101, sizeof(array_50AC10[2])); 2338 memcpy(&array_50AC10[2], v101, sizeof(array_50AC10[2]));
2339 array_50AC10[2].flt_20 = 1.0 / v101->vWorldViewPosition.x + 0.0000001000000011686097; 2339 array_50AC10[2]._rhw = 1.0 / v101->vWorldViewPosition.x + 0.0000001000000011686097;
2340 array_50AC10[2].u = 1.0; 2340 array_50AC10[2].u = 1.0;
2341 array_50AC10[2].v = 0.0; 2341 array_50AC10[2].v = 0.0;
2342 static stru154 static_sub_0048034E_stru_76D578; 2342 static stru154 static_sub_0048034E_stru_76D578;
2343 /*static bool __init_flag1 = false; 2343 /*static bool __init_flag1 = false;
2344 if (!__init_flag1) 2344 if (!__init_flag1)
2638 ++pOutdoorCamera->numStru148s; 2638 ++pOutdoorCamera->numStru148s;
2639 if ( !sub_481FC9(v10, (RenderVertexSoft *)HIDWORD(v101), v102, v17) ) 2639 if ( !sub_481FC9(v10, (RenderVertexSoft *)HIDWORD(v101), v102, v17) )
2640 goto LABEL_104; 2640 goto LABEL_104;
2641 v26 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001); 2641 v26 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001);
2642 memcpy(array_50AC10, v104, 0x30u); 2642 memcpy(array_50AC10, v104, 0x30u);
2643 array_50AC10[0].flt_20 = v26; 2643 array_50AC10[0]._rhw = v26;
2644 array_50AC10[0].u = 0.0; 2644 array_50AC10[0].u = 0.0;
2645 array_50AC10[0].v = 0.0; 2645 array_50AC10[0].v = 0.0;
2646 v27 = *(float *)(HIDWORD(v101) + 12) + 0.0000001; 2646 v27 = *(float *)(HIDWORD(v101) + 12) + 0.0000001;
2647 memcpy(&array_50AC10[1], (void *)HIDWORD(v101), sizeof(array_50AC10[1])); 2647 memcpy(&array_50AC10[1], (void *)HIDWORD(v101), sizeof(array_50AC10[1]));
2648 array_50AC10[1].flt_20 = 1.0 / v27; 2648 array_50AC10[1]._rhw = 1.0 / v27;
2649 array_50AC10[1].u = 0.0; 2649 array_50AC10[1].u = 0.0;
2650 array_50AC10[1].v = 1.0; 2650 array_50AC10[1].v = 1.0;
2651 v28 = v103->vWorldViewPosition.x + 0.0000001; 2651 v28 = v103->vWorldViewPosition.x + 0.0000001;
2652 memcpy(&array_50AC10[2], v103, sizeof(array_50AC10[2])); 2652 memcpy(&array_50AC10[2], v103, sizeof(array_50AC10[2]));
2653 array_50AC10[2].flt_20 = 1.0 / v28; 2653 array_50AC10[2]._rhw = 1.0 / v28;
2654 array_50AC10[2].u = 1.0; 2654 array_50AC10[2].u = 1.0;
2655 array_50AC10[2].v = 1.0; 2655 array_50AC10[2].v = 1.0;
2656 v29 = v102->vWorldViewPosition.x + 0.0000001; 2656 v29 = v102->vWorldViewPosition.x + 0.0000001;
2657 memcpy(&array_50AC10[3], v102, sizeof(array_50AC10[3])); 2657 memcpy(&array_50AC10[3], v102, sizeof(array_50AC10[3]));
2658 array_50AC10[3].flt_20 = 1.0 / v29; 2658 array_50AC10[3]._rhw = 1.0 / v29;
2659 array_50AC10[3].u = 1.0; 2659 array_50AC10[3].u = 1.0;
2660 array_50AC10[3].v = 0.0; 2660 array_50AC10[3].v = 0.0;
2661 pGame->pLightmapBuilder->StackLights_TerrainFace(pNormal, &a3a, array_50AC10, 4u, 1); 2661 pGame->pLightmapBuilder->StackLights_TerrainFace(pNormal, &a3a, array_50AC10, 4u, 1);
2662 if ( stru_F8AD28.uNumLightsApplied <= 0 ) 2662 if ( stru_F8AD28.uNumLightsApplied <= 0 )
2663 { 2663 {
2759 ++pOutdoorCamera->numStru148s; 2759 ++pOutdoorCamera->numStru148s;
2760 if ( !sub_481FC9((RenderVertexSoft *)HIDWORD(v101), v103, v104, v38) ) 2760 if ( !sub_481FC9((RenderVertexSoft *)HIDWORD(v101), v103, v104, v38) )
2761 goto LABEL_74; 2761 goto LABEL_74;
2762 v48 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001); 2762 v48 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001);
2763 memcpy(array_50AC10, v104, 0x30u); 2763 memcpy(array_50AC10, v104, 0x30u);
2764 array_50AC10[0].flt_20 = v48; 2764 array_50AC10[0]._rhw = v48;
2765 array_50AC10[0].u = 0.0; 2765 array_50AC10[0].u = 0.0;
2766 array_50AC10[0].v = 0.0; 2766 array_50AC10[0].v = 0.0;
2767 v49 = *(float *)(HIDWORD(v101) + 12) + 0.0000001; 2767 v49 = *(float *)(HIDWORD(v101) + 12) + 0.0000001;
2768 memcpy(&array_50AC10[1], (void *)HIDWORD(v101), sizeof(array_50AC10[1])); 2768 memcpy(&array_50AC10[1], (void *)HIDWORD(v101), sizeof(array_50AC10[1]));
2769 array_50AC10[1].flt_20 = 1.0 / v49; 2769 array_50AC10[1]._rhw = 1.0 / v49;
2770 array_50AC10[1].u = 0.0; 2770 array_50AC10[1].u = 0.0;
2771 array_50AC10[1].v = 1.0; 2771 array_50AC10[1].v = 1.0;
2772 v50 = v103->vWorldViewPosition.x + 0.0000001; 2772 v50 = v103->vWorldViewPosition.x + 0.0000001;
2773 memcpy(&array_50AC10[2], v103, sizeof(array_50AC10[2])); 2773 memcpy(&array_50AC10[2], v103, sizeof(array_50AC10[2]));
2774 array_50AC10[2].flt_20 = 1.0 / v50; 2774 array_50AC10[2]._rhw = 1.0 / v50;
2775 array_50AC10[2].u = 1.0; 2775 array_50AC10[2].u = 1.0;
2776 array_50AC10[2].v = 1.0; 2776 array_50AC10[2].v = 1.0;
2777 pGame->pLightmapBuilder->StackLights_TerrainFace(pNormala, &v78, array_50AC10, 3u, 0); 2777 pGame->pLightmapBuilder->StackLights_TerrainFace(pNormala, &v78, array_50AC10, 3u, 0);
2778 if ( stru_F8AD28.uNumLightsApplied <= 0 ) 2778 if ( stru_F8AD28.uNumLightsApplied <= 0 )
2779 { 2779 {
2853 --pOutdoorCamera->numStru148s; 2853 --pOutdoorCamera->numStru148s;
2854 goto LABEL_105; 2854 goto LABEL_105;
2855 } 2855 }
2856 v62 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001); 2856 v62 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001);
2857 memcpy(array_50AC10, v104, 0x30u); 2857 memcpy(array_50AC10, v104, 0x30u);
2858 array_50AC10[0].flt_20 = v62; 2858 array_50AC10[0]._rhw = v62;
2859 array_50AC10[0].u = 0.0; 2859 array_50AC10[0].u = 0.0;
2860 array_50AC10[0].v = 0.0; 2860 array_50AC10[0].v = 0.0;
2861 v63 = v103->vWorldViewPosition.x + 0.0000001; 2861 v63 = v103->vWorldViewPosition.x + 0.0000001;
2862 memcpy(&array_50AC10[1], v103, sizeof(array_50AC10[1])); 2862 memcpy(&array_50AC10[1], v103, sizeof(array_50AC10[1]));
2863 array_50AC10[1].flt_20 = 1.0 / v63; 2863 array_50AC10[1]._rhw = 1.0 / v63;
2864 array_50AC10[1].u = 1.0; 2864 array_50AC10[1].u = 1.0;
2865 array_50AC10[1].v = 1.0; 2865 array_50AC10[1].v = 1.0;
2866 v64 = v102->vWorldViewPosition.x + 0.0000001; 2866 v64 = v102->vWorldViewPosition.x + 0.0000001;
2867 memcpy(&array_50AC10[2], v102, sizeof(array_50AC10[2])); 2867 memcpy(&array_50AC10[2], v102, sizeof(array_50AC10[2]));
2868 array_50AC10[2].flt_20 = 1.0 / v64; 2868 array_50AC10[2]._rhw = 1.0 / v64;
2869 array_50AC10[2].u = 1.0; 2869 array_50AC10[2].u = 1.0;
2870 array_50AC10[2].v = 0.0; 2870 array_50AC10[2].v = 0.0;
2871 pGame->pLightmapBuilder->StackLights_TerrainFace(pNormalb, &v70, array_50AC10, 3u, 1); 2871 pGame->pLightmapBuilder->StackLights_TerrainFace(pNormalb, &v70, array_50AC10, 3u, 1);
2872 if ( stru_F8AD28.uNumLightsApplied <= 0 ) 2872 if ( stru_F8AD28.uNumLightsApplied <= 0 )
2873 { 2873 {
4829 v30 = v3 + 1; 4829 v30 = v3 + 1;
4830 if ( v1->pRenderD3D ) 4830 if ( v1->pRenderD3D )
4831 { 4831 {
4832 memset(&Dst, 0, 0x7Cu); 4832 memset(&Dst, 0, 0x7Cu);
4833 Dst.dwSize = 124; 4833 Dst.dwSize = 124;
4834 if ( !pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, 1u) ) 4834 if ( !pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) )
4835 return; 4835 return;
4836 v28 = Dst.lpSurface; 4836 v28 = Dst.lpSurface;
4837 v5 = Dst.lPitch >> 1; 4837 v5 = Dst.lPitch >> 1;
4838 v2 = 0; 4838 v2 = 0;
4839 } 4839 }
5025 v43 = v4 + 1; 5025 v43 = v4 + 1;
5026 if ( v2->pRenderD3D ) 5026 if ( v2->pRenderD3D )
5027 { 5027 {
5028 memset(&Dst, 0, 0x7Cu); 5028 memset(&Dst, 0, 0x7Cu);
5029 Dst = 124; 5029 Dst = 124;
5030 if ( !pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, (DDSURFACEDESC2 *)&Dst, 1u) ) 5030 if ( !pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, (DDSURFACEDESC2 *)&Dst, DDLOCK_WAIT) )
5031 return; 5031 return;
5032 v42 = v20; 5032 v42 = v20;
5033 v6 = v19 >> 1; 5033 v6 = v19 >> 1;
5034 v3 = 0; 5034 v3 = 0;
5035 } 5035 }
6134 ptr_400E8 = v18; 6134 ptr_400E8 = v18;
6135 if ( v18 ) 6135 if ( v18 )
6136 { 6136 {
6137 memset(&pDesc, 0, 0x7Cu); 6137 memset(&pDesc, 0, 0x7Cu);
6138 pDesc.dwSize = 124; 6138 pDesc.dwSize = 124;
6139 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &pDesc, 1u) ) 6139 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &pDesc, DDLOCK_WAIT) )
6140 { 6140 {
6141 pRenderer->pBackBuffer4->Unlock(0); 6141 pRenderer->pBackBuffer4->Unlock(0);
6142 v19 = ptr_400E8; 6142 v19 = ptr_400E8;
6143 v20 = (unsigned int)pDesc.lpSurface & 7; 6143 v20 = (unsigned int)pDesc.lpSurface & 7;
6144 v21 = (unsigned int)ptr_400E8 & 7; 6144 v21 = (unsigned int)ptr_400E8 & 7;
6467 6467
6468 //----- (004A0F40) -------------------------------------------------------- 6468 //----- (004A0F40) --------------------------------------------------------
6469 bool Render::LockSurface_DDraw4(IDirectDrawSurface4 *pSurface, DDSURFACEDESC2 *pDesc, unsigned int uLockFlags) 6469 bool Render::LockSurface_DDraw4(IDirectDrawSurface4 *pSurface, DDSURFACEDESC2 *pDesc, unsigned int uLockFlags)
6470 { 6470 {
6471 IDirectDrawSurface4 *v4; // esi@1 6471 IDirectDrawSurface4 *v4; // esi@1
6472 bool result; // eax@1 6472 HRESULT result; // eax@1
6473 HRESULT v6; // eax@4 6473 HRESULT v6; // eax@4
6474 int v7; // [sp-8h] [bp-14h]@10 6474 int v7; // [sp-8h] [bp-14h]@10
6475 unsigned int v8; // [sp-4h] [bp-10h]@10 6475 unsigned int v8; // [sp-4h] [bp-10h]@10
6476 char v9; // [sp+Bh] [bp-1h]@1 6476 char v9; // [sp+Bh] [bp-1h]@1
6477 6477
6837 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) 6837 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 )
6838 { 6838 {
6839 DDSURFACEDESC2 pDesc; // [sp+4h] [bp-7Ch]@3 6839 DDSURFACEDESC2 pDesc; // [sp+4h] [bp-7Ch]@3
6840 memset(&pDesc, 0, 0x7Cu); 6840 memset(&pDesc, 0, 0x7Cu);
6841 pDesc.dwSize = 124; 6841 pDesc.dwSize = 124;
6842 LockSurface_DDraw4(v3->pBackBuffer4, &pDesc, 1u); 6842 LockSurface_DDraw4(v3->pBackBuffer4, &pDesc, DDLOCK_WAIT);
6843 *pOutSurfacePtr = pDesc.lpSurface; 6843 *pOutSurfacePtr = pDesc.lpSurface;
6844 v4 = pDesc.lPitch; 6844 v4 = pDesc.lPitch;
6845 } 6845 }
6846 else 6846 else
6847 { 6847 {
6882 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) 6882 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 )
6883 { 6883 {
6884 DDSURFACEDESC2 pDesc; // [sp+4h] [bp-7Ch]@3 6884 DDSURFACEDESC2 pDesc; // [sp+4h] [bp-7Ch]@3
6885 memset(&pDesc, 0, 0x7Cu); 6885 memset(&pDesc, 0, 0x7Cu);
6886 pDesc.dwSize = 124; 6886 pDesc.dwSize = 124;
6887 LockSurface_DDraw4(v3->pFrontBuffer4, &pDesc, 1u); 6887 LockSurface_DDraw4(v3->pFrontBuffer4, &pDesc, DDLOCK_WAIT);
6888 *pOutSurface = pDesc.lpSurface; 6888 *pOutSurface = pDesc.lpSurface;
6889 v4 = pDesc.lPitch; 6889 v4 = pDesc.lPitch;
6890 } 6890 }
6891 else 6891 else
6892 { 6892 {
7615 for (i = 0; i < uNumVertices; ++i) 7615 for (i = 0; i < uNumVertices; ++i)
7616 { 7616 {
7617 pVertices[i].pos.x = array_50AC10[i].vWorldViewProjX; 7617 pVertices[i].pos.x = array_50AC10[i].vWorldViewProjX;
7618 pVertices[i].pos.y = array_50AC10[i].vWorldViewProjY; 7618 pVertices[i].pos.y = array_50AC10[i].vWorldViewProjY;
7619 pVertices[i].pos.z = 0.99989998; 7619 pVertices[i].pos.z = 0.99989998;
7620 pVertices[i].rhw = array_50AC10[i].flt_20; 7620 pVertices[i].rhw = array_50AC10[i]._rhw;
7621 7621
7622 pVertices[i].diffuse = GetActorTintColor(31, 0, array_50AC10[i].vWorldViewPosition.x, 1, 0); 7622 pVertices[i].diffuse = GetActorTintColor(31, 0, array_50AC10[i].vWorldViewPosition.x, 1, 0);
7623 v7 = 0; 7623 v7 = 0;
7624 if (this->bUsingSpecular) 7624 if (this->bUsingSpecular)
7625 { 7625 {
7657 for (i = 0; i < uNumVertices; ++i) 7657 for (i = 0; i < uNumVertices; ++i)
7658 { 7658 {
7659 pVertices[i].pos.x = array_50AC10[i].vWorldViewProjX; 7659 pVertices[i].pos.x = array_50AC10[i].vWorldViewProjX;
7660 pVertices[i].pos.y = array_50AC10[i].vWorldViewProjY; 7660 pVertices[i].pos.y = array_50AC10[i].vWorldViewProjY;
7661 pVertices[i].pos.z = 0.99989998; 7661 pVertices[i].pos.z = 0.99989998;
7662 pVertices[i].rhw = array_50AC10[i].flt_20; 7662 pVertices[i].rhw = array_50AC10[i]._rhw;
7663 7663
7664 pVertices[i].diffuse = GetActorTintColor(31, 0, array_50AC10[i].vWorldViewPosition.x, 1, 0); 7664 pVertices[i].diffuse = GetActorTintColor(31, 0, array_50AC10[i].vWorldViewPosition.x, 1, 0);
7665 v7 = 0; 7665 v7 = 0;
7666 if (this->bUsingSpecular) 7666 if (this->bUsingSpecular)
7667 { 7667 {
8829 8829
8830 DDSURFACEDESC2 desc; 8830 DDSURFACEDESC2 desc;
8831 memset(&desc, 0, sizeof(DDSURFACEDESC2)); 8831 memset(&desc, 0, sizeof(DDSURFACEDESC2));
8832 desc.dwSize = sizeof(DDSURFACEDESC2); 8832 desc.dwSize = sizeof(DDSURFACEDESC2);
8833 8833
8834 if ( LockSurface_DDraw4(pNextSurf, &desc, 0x21u) ) 8834 if ( LockSurface_DDraw4(pNextSurf, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY) )
8835 { 8835 {
8836 Dst.sub_451007_scale_image_bicubic( 8836 Dst.sub_451007_scale_image_bicubic(
8837 pHWLTexture->pPixels, 8837 pHWLTexture->pPixels,
8838 pHWLTexture->uWidth, 8838 pHWLTexture->uWidth,
8839 pHWLTexture->uHeight, 8839 pHWLTexture->uHeight,
8863 8863
8864 DDSURFACEDESC2 desc; 8864 DDSURFACEDESC2 desc;
8865 memset(&desc, 0, sizeof(DDSURFACEDESC2)); 8865 memset(&desc, 0, sizeof(DDSURFACEDESC2));
8866 desc.dwSize = sizeof(DDSURFACEDESC2); 8866 desc.dwSize = sizeof(DDSURFACEDESC2);
8867 8867
8868 if ( LockSurface_DDraw4(*pOutSurface, &desc, 0x21u) ) 8868 if ( LockSurface_DDraw4(*pOutSurface, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY) )
8869 { 8869 {
8870 bMipMaps = 0; 8870 bMipMaps = 0;
8871 v13 = pHWLTexture->pPixels; 8871 v13 = pHWLTexture->pPixels;
8872 v14 = (unsigned __int16 *)desc.lpSurface; 8872 v14 = (unsigned __int16 *)desc.lpSurface;
8873 if ( desc.dwHeight ) 8873 if ( desc.dwHeight )
8939 //pSprite = v2->pTextureSurface; 8939 //pSprite = v2->pTextureSurface;
8940 //pSprite = (Sprite *)pSprite->pName; 8940 //pSprite = (Sprite *)pSprite->pName;
8941 //v8 = pSprite; 8941 //v8 = pSprite;
8942 memset(&Dst, 0, 0x7Cu); 8942 memset(&Dst, 0, 0x7Cu);
8943 Dst.dwSize = 124; 8943 Dst.dwSize = 124;
8944 if ( LockSurface_DDraw4((IDirectDrawSurface4 *)v2->pTextureSurface, &Dst, 0x21u) ) 8944 if ( LockSurface_DDraw4((IDirectDrawSurface4 *)v2->pTextureSurface, &Dst, DDLOCK_WAIT | DDLOCK_WRITEONLY) )
8945 { 8945 {
8946 v9 = v5->pPixels; 8946 v9 = v5->pPixels;
8947 v10 = Dst.lpSurface; 8947 v10 = Dst.lpSurface;
8948 v11 = 0; 8948 v11 = 0;
8949 if ( (signed int)v5->uHeight > 0 ) 8949 if ( (signed int)v5->uHeight > 0 )
8997 { 8997 {
8998 if ( this->bColorKeySupported ) 8998 if ( this->bColorKeySupported )
8999 { 8999 {
9000 memset(&Dst, 0, 0x7Cu); 9000 memset(&Dst, 0, 0x7Cu);
9001 Dst.dwSize = 124; 9001 Dst.dwSize = 124;
9002 if ( LockSurface_DDraw4(v1->pColorKeySurface4, &Dst, 0x801u) ) 9002 if ( LockSurface_DDraw4(v1->pColorKeySurface4, &Dst, 0x800 | DDLOCK_WAIT) )
9003 { 9003 {
9004 v1->pTargetSurface = (unsigned __int16 *)Dst.lpSurface; 9004 v1->pTargetSurface = (unsigned __int16 *)Dst.lpSurface;
9005 v3 = Dst.lPitch >> 1; 9005 v3 = Dst.lPitch >> 1;
9006 v1->uTargetSurfacePitch = Dst.lPitch >> 1; 9006 v1->uTargetSurfacePitch = Dst.lPitch >> 1;
9007 LABEL_10: 9007 LABEL_10: