comparison Render.cpp @ 2152:d44b7775fc06

Removed DirectDraw2 compatibility. 3D Sound enabled (change 3DSoundProvider registry entry to activate it). Moved all forward declarations to mm7_unsorted_subs.h (many cpp files do not need them anyweay).
author Nomad
date Thu, 09 Jan 2014 01:37:34 +0200
parents 92511cd8fcdb
children d28d3c006077
comparison
equal deleted inserted replaced
2151:92511cd8fcdb 2152:d44b7775fc06
22 #include "Game.h" 22 #include "Game.h"
23 #include "LightmapBuilder.h" 23 #include "LightmapBuilder.h"
24 #include "ObjectList.h" 24 #include "ObjectList.h"
25 #include "SpriteObject.h" 25 #include "SpriteObject.h"
26 #include "DecorationList.h" 26 #include "DecorationList.h"
27 #include "OSInfo.h"
28 #include "Actor.h" 27 #include "Actor.h"
29 #include "Log.h" 28 #include "Log.h"
30 #include "TileFrameTable.h" 29 #include "TileFrameTable.h"
31 #include "texts.h" 30 #include "texts.h"
32 #include "mm7_data.h" 31 #include "mm7_data.h"
212 char v0; // zf@4 211 char v0; // zf@4
213 bool result; // eax@8 212 bool result; // eax@8
214 213
215 if (!pRenderer) 214 if (!pRenderer)
216 return true; 215 return true;
217 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) 216
218 { 217 {
219 if ( !pRenderer->pBackBuffer4 ) 218 if ( !pRenderer->pBackBuffer4 )
220 goto LABEL_9; 219 goto LABEL_9;
221 v0 = pRenderer->pFrontBuffer4 == 0; 220 v0 = pRenderer->pFrontBuffer4 == 0;
222 } 221 }
223 else 222
224 {
225 if ( !pRenderer->pBackBuffer2 )
226 goto LABEL_9;
227 v0 = pRenderer->pFrontBuffer2 == 0;
228 }
229 if ( !v0 ) 223 if ( !v0 )
230 { 224 {
231 LOBYTE(result) = 1; 225 LOBYTE(result) = 1;
232 return result; 226 return result;
233 } 227 }
234 LABEL_9: 228 LABEL_9:
235 LOBYTE(result) = 0; 229 LOBYTE(result) = 0;
236 return result; 230 return result;
237 } 231 }
232
233
234 //----- (004A19D8) --------------------------------------------------------
235 unsigned int BlendColors(unsigned int a1, unsigned int a2)
236 {
237 /*signed __int64 v2; // ST10_8@1
238 double v3; // st7@1
239 float v4; // ST24_4@1
240 double v5; // ST10_8@1
241 int v6; // ST1C_4@1
242 float v7; // ST24_4@1
243 double v8; // ST10_8@1
244 unsigned __int8 v9; // ST20_1@1
245 float v10; // ST24_4@1
246 double v11; // ST10_8@1
247 float v12; // ST24_4@1
248 double v13; // ST08_8@1*/
249
250 uint alpha = (uint)floorf(0.5f + (a1 >> 24) / 255.0f *
251 (a2 >> 24) / 255.0f * 255.0f),
252 red = (uint)floorf(0.5f + ((a1 >> 16) & 0xFF) / 255.0f *
253 ((a2 >> 16) & 0xFF) / 255.0f * 255.0f),
254 green = (uint)floorf(0.5f + ((a1 >> 8) & 0xFF) / 255.0f *
255 ((a2 >> 8) & 0xFF) / 255.0f * 255.0f),
256 blue = (uint)floorf(0.5f + ((a1 >> 0) & 0xFF) / 255.0f *
257 ((a2 >> 0) & 0xFF) / 255.0f * 255.0f);
258 return (alpha << 24) | (red << 16) | (green << 8) | blue;
259 /*v2 = a1 >> 24;
260 v3 = (double)v2 / 255.0f;
261 HIDWORD(v2) = 0;
262 LODWORD(v2) = a2 >> 24;
263 v4 = v3 * (double)v2 / 255.0f * 255.0;
264 v5 = v4 + 6.7553994e15;
265 v6 = LODWORD(v5);
266 v7 = (double)((a1 >> 16) & 0xFFi64) / 255.0f * (double)((a2 >> 16) & 0xFF) * 0.0039215689 * 255.0;
267 v8 = v7 + 6.7553994e15;
268 v9 = LOBYTE(v8);
269 v10 = (double)((unsigned __int16)a1 >> 8) / 255.0f * (double)((unsigned __int16)a2 >> 8) / 255.0f * 255.0;
270 v11 = v10 + 6.7553994e15;
271 v12 = (double)(a1 & 0xFFi64) / 255.0f * (double)(unsigned __int8)a2 / 255.0f * 255.0;
272 v13 = v12 + 6.7553994e15;
273 return LOBYTE(v13) | ((LOBYTE(v11) | (((v6 << 8) | v9) << 8)) << 8);*/
274 }
275
238 276
239 void Render::RenderTerrainD3D() // New function 277 void Render::RenderTerrainD3D() // New function
240 { 278 {
241 int v6; // ecx@8 279 int v6; // ecx@8
242 struct Polygon *pTilePolygon; // ebx@8 280 struct Polygon *pTilePolygon; // ebx@8
2075 v1 = this; 2113 v1 = this;
2076 this->pDirectDraw4 = 0; 2114 this->pDirectDraw4 = 0;
2077 this->pFrontBuffer4 = 0; 2115 this->pFrontBuffer4 = 0;
2078 this->pBackBuffer4 = 0; 2116 this->pBackBuffer4 = 0;
2079 this->pColorKeySurface4 = 0; 2117 this->pColorKeySurface4 = 0;
2080 this->pDirectDraw2 = 0; 2118 //this->pDirectDraw2 = 0;
2081 this->pFrontBuffer2 = 0; 2119 //this->pFrontBuffer2 = 0;
2082 this->pBackBuffer2 = 0; 2120 //this->pBackBuffer2 = 0;
2083 this->pSomeSurface2 = 0; 2121 //this->pSomeSurface2 = 0;
2084 //RenderHWLContainer::RenderHWLContainer(&this->pD3DBitmaps); 2122 //RenderHWLContainer::RenderHWLContainer(&this->pD3DBitmaps);
2085 //RenderHWLContainer::RenderHWLContainer(&v1->pD3DSprites); 2123 //RenderHWLContainer::RenderHWLContainer(&v1->pD3DSprites);
2086 v1->bWindowMode = 1; 2124 v1->bWindowMode = 1;
2087 v1->field_40054 = 0; 2125 v1->field_40054 = 0;
2088 v1->field_10 = 640; 2126 v1->field_10 = 640;
2170 DDBLTFX v3; // [sp+4h] [bp-74h]@5 2208 DDBLTFX v3; // [sp+4h] [bp-74h]@5
2171 RECT x; // [sp+68h] [bp-10h]@3 2209 RECT x; // [sp+68h] [bp-10h]@3
2172 2210
2173 memset(&v3, 0, sizeof(DDBLTFX)); 2211 memset(&v3, 0, sizeof(DDBLTFX));
2174 GetWindowRect(window->GetApiHandle(), &x); 2212 GetWindowRect(window->GetApiHandle(), &x);
2175 if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || 2213
2176 pVersion->pVersionInfo.dwMajorVersion >= 5)
2177 { 2214 {
2178 v2 = (IDirectDrawSurface *)this->pBackBuffer4; 2215 v2 = (IDirectDrawSurface *)this->pBackBuffer4;
2179 } 2216 }
2180 else 2217
2181 {
2182 v2 = (IDirectDrawSurface *)this->pBackBuffer2;
2183 }
2184 v3.dwFillColor = 0; 2218 v3.dwFillColor = 0;
2185 v3.dwSize = 100; 2219 v3.dwSize = 100;
2186 v2->Blt(&x, 0, 0, DDBLT_COLORFILL, &v3); 2220 v2->Blt(&x, 0, 0, DDBLT_COLORFILL, &v3);
2187 pRenderer->Present(); 2221 pRenderer->Present();
2188 } 2222 }
2997 *v15 = 0; 3031 *v15 = 0;
2998 *v16 = 0; 3032 *v16 = 0;
2999 } 3033 }
3000 }*/ 3034 }*/
3001 } 3035 }
3036
3037
3038
3039
3040 void Present32(unsigned __int32 *src, unsigned int src_pitch,
3041 unsigned __int32 *dst, unsigned int dst_pitch)
3042 {
3043 for (uint y = 0; y < 8; ++y)
3044 memcpy(dst + y * dst_pitch,
3045 src + y * src_pitch, src_pitch * sizeof(__int32));
3046
3047 for (uint y = 8; y < 352; ++y)
3048 {
3049 memcpy(dst + y * dst_pitch,
3050 src + y * src_pitch, 8 * sizeof(__int32));
3051 memcpy(dst + 8 + game_viewport_width + y * dst_pitch,
3052 src + 8 + game_viewport_width + y * src_pitch, 174/*172*/ * sizeof(__int32));
3053 }
3054
3055 for (uint y = 352; y < 480; ++y)
3056 memcpy(dst + y * dst_pitch,
3057 src + y * src_pitch, src_pitch * sizeof(__int32));
3058
3059 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y)
3060 {
3061 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x)
3062 {
3063 //if (src[x + y * src_pitch] != (pRenderer->uTargetGMask | pRenderer->uTargetBMask))
3064 if (src[x + y * src_pitch] != 0xFFF8FCF8) // FFF8FCF8 = Color32(Color16(g_mask | b_mask))
3065 dst[x + y * dst_pitch] = src[x + y * src_pitch];
3066 }
3067 }
3068 }
3069
3070 //----- (004A597D) --------------------------------------------------------
3071 void Present_NoColorKey()
3072 {
3073 //unsigned __int16 *v0; // eax@4
3074 unsigned __int16 *v1; // esi@4
3075 void *v2; // edi@4
3076 //signed int v4; // ebx@4
3077 //signed int v5; // ebx@6
3078 //void *v6; // edi@7
3079 //const void *v7; // esi@7
3080 signed int v8; // ebx@8
3081 int v9; // eax@10
3082 unsigned int v10; // esi@10
3083 unsigned __int32 v11; // edi@10
3084 //int v12; // ecx@10
3085 unsigned int v13; // ebx@10
3086 int v14; // eax@11
3087 int v15; // eax@13
3088 int v16; // eax@14
3089 int v17; // eax@16
3090 HRESULT v18; // eax@22
3091 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-98h]@3
3092 //int v20; // [sp+88h] [bp-1Ch]@10
3093 int v21; // [sp+8Ch] [bp-18h]@10
3094 __int32 v22; // [sp+90h] [bp-14h]@10
3095 //unsigned __int32 v23; // [sp+94h] [bp-10h]@10
3096 unsigned int v24; // [sp+98h] [bp-Ch]@4
3097 //unsigned int _this; // [sp+9Ch] [bp-8h]@10
3098 //LPVOID v26; // [sp+A0h] [bp-4h]@4
3099
3100 int r_mask = 0xF800;
3101 int g_mask = 0x7E0;
3102 int b_mask = 0x1F;
3103
3104 if ( !pRenderer->uNumSceneBegins )
3105 {
3106 if ( pRenderer->using_software_screen_buffer )
3107 {
3108 memset(&Dst, 0, 0x7Cu);
3109 Dst.dwSize = 124;
3110 if ( pRenderer->LockSurface_DDraw4(pRenderer->pBackBuffer4, &Dst, DDLOCK_WAIT) )
3111 {
3112 //v26 = Dst.lpSurface;
3113 //pRenderer->pCurrentlyLockedSurfaceDataPtr = (unsigned __int16 *)Dst.lpSurface;
3114 v24 = g_mask | b_mask | ((g_mask | b_mask) << 16);
3115 //pRenderer->pCurrentlyLockedSoftSurface = pRenderer->pTargetSurface;
3116 //pRenderer->uCurrentlyLockedSurfacePitch = Dst.lPitch;
3117 //v1 = pRenderer->pTargetSurface;
3118 v2 = Dst.lpSurface;
3119
3120
3121 /*for (uint y = 0; y < 480; ++y)
3122 {
3123 auto pDst = (unsigned short *)((char *)Dst.lpSurface + y * Dst.lPitch);
3124 for (uint x = 0; x < 640; ++x)
3125 pDst[x] = pRenderer->uTargetRMask | pRenderer->uTargetBMask;
3126 }*/
3127
3128 if (!FORCE_16_BITS)
3129 Present32((unsigned __int32 *)pRenderer->pTargetSurface, pRenderer->uTargetSurfacePitch, (unsigned __int32 *)Dst.lpSurface, Dst.lPitch / 4);
3130 else
3131 {
3132 ushort* pSrc = (unsigned short *)pRenderer->pTargetSurface;
3133 short* pDst = (__int16 *)Dst.lpSurface;
3134
3135 for (uint y = 0; y < 8; ++y)
3136 memcpy(pDst + y * Dst.lPitch / 2,
3137
3138 pSrc + y * 640, 640 * sizeof(__int16));
3139
3140 for (uint y = 8; y < 352; ++y)
3141 {
3142 memcpy(pDst + y * Dst.lPitch / 2,
3143 pSrc + y * 640, 8 * sizeof(__int16));
3144 memcpy(pDst + 8 + game_viewport_width/*462*/ + y * Dst.lPitch / 2,
3145 pSrc + 8 + game_viewport_width/*462*/ + y * 640, 174/*172*/ * sizeof(__int16));
3146 }
3147
3148 for (uint y = 352; y < 480; ++y)
3149 memcpy(pDst + y * Dst.lPitch / 2,
3150 pSrc + y * 640, 640 * sizeof(__int16));
3151
3152
3153 ushort* pSrc_x1y1 = pSrc + 640 * pViewport->uViewportTL_Y + pViewport->uViewportTL_X;
3154 //_this = (unsigned int)&pSrc[2 * (((signed int)pViewport->uViewportX >> 1) + 320 * pViewport->uViewportY)];
3155 short* pDst_x1y1 = pDst + Dst.lPitch * pViewport->uViewportTL_Y + pViewport->uViewportTL_X;
3156 //v23 = (unsigned __int32)((char *)v26 + 4 * (((signed int)pViewport->uViewportX >> 1) + (Dst.lPitch >> 2) * pViewport->uViewportY));
3157 v9 = ((signed int)pViewport->uViewportTL_X >> 1) - ((signed int)pViewport->uViewportBR_X >> 1);
3158 //v20 = ((signed int)pViewport->uViewportZ >> 1) - ((signed int)pViewport->uViewportX >> 1);
3159 v22 = 4 * ((Dst.lPitch / 4) + v9);
3160 v21 = 4 * v9 + 1280;
3161
3162 //auto uNumLines = pViewport->uViewportW - pViewport->uViewportY + 1;
3163 //v26 = (LPVOID)(pViewport->uViewportW - pViewport->uViewportY + 1);
3164 v10 = (int)pSrc_x1y1;
3165 v11 = (int)pDst_x1y1;
3166 int uHalfWidth = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2;
3167 v13 = v24;
3168
3169 for (uint y = pViewport->uViewportTL_Y; y < pViewport->uViewportBR_Y + 1; ++y)
3170 {
3171 //memcpy(pDst + pViewport->uViewportX + y * Dst.lPitch / 2,
3172 // pSrc + pViewport->uViewportX + y * 640, (pViewport->uViewportZ - pViewport->uViewportX) * sizeof(__int16));
3173 for (uint x = pViewport->uViewportTL_X; x < pViewport->uViewportBR_X; ++x)
3174 {
3175 if (pSrc[y * 640 + x] != (g_mask | b_mask))
3176 pDst[y * Dst.lPitch / 2 + x] = pSrc[y * 640 + x];
3177 }
3178 }
3179 }
3180
3181 ErrD3D(pRenderer->pBackBuffer4->Unlock(0));
3182
3183 /* while ( 1 )
3184 {
3185 while ( 1 )
3186 {
3187 v14 = *(int *)v10;
3188 v10 += 4;
3189 if ( v14 == v13 )
3190 break;
3191 if ( (short)v14 == (short)v13 )
3192 {
3193 *(int *)v11 = *(int *)v11 & 0xFFFF | v14 & 0xFFFF0000;
3194 v11 += 4;
3195 --uHalfWidth;
3196 if ( !uHalfWidth )
3197 goto LABEL_21;
3198 }
3199 else
3200 {
3201 v15 = __ROL__(v14, 16);
3202 if ( (short)v15 == (short)v13 )
3203 {
3204 v17 = __ROR__(v15, 16);
3205 *(int *)v11 = *(int *)v11 & 0xFFFF0000 | (unsigned __int16)v17;
3206 v11 += 4;
3207 --uHalfWidth;
3208 if ( !uHalfWidth )
3209 goto LABEL_21;
3210 }
3211 else
3212 {
3213 v16 = __ROR__(v15, 16);
3214 *(int *)v11 = v16;
3215 v11 += 4;
3216 --uHalfWidth;
3217 if ( !uHalfWidth )
3218 goto LABEL_21;
3219 }
3220 }
3221 }
3222 v11 += 4;
3223 --uHalfWidth;
3224 if ( !uHalfWidth )
3225 {
3226 LABEL_21:
3227 v10 += v21;
3228 v11 += v22;
3229 uHalfWidth = v20;
3230 if ( !--uNumLines )
3231 {
3232 ErrD3D(pRenderer->pBackBuffer4->Unlock(0));
3233 return;
3234 }
3235 }
3236 }*/
3237 }
3238 }
3239 }
3240 }
3241
3242
3243
3002 3244
3003 //----- (0049FFD7) -------------------------------------------------------- 3245 //----- (0049FFD7) --------------------------------------------------------
3004 void Render::CreateSomeTexture() 3246 void Render::CreateSomeTexture()
3005 { 3247 {
3006 pRenderD3D->CreateTexture(64, 64, &pSurface, &pTexture, true, false, 32); 3248 pRenderD3D->CreateTexture(64, 64, &pSurface, &pTexture, true, false, 32);
3814 LABEL_21: 4056 LABEL_21:
3815 LOBYTE(result) = v9; 4057 LOBYTE(result) = v9;
3816 return result; 4058 return result;
3817 } 4059 }
3818 4060
3819 //----- (004A1032) --------------------------------------------------------
3820 bool Render::LockSurface_DDraw2(IDirectDrawSurface2 *pSurface, DDSURFACEDESC *pDesc, unsigned int uLockFlags)
3821 {
3822 IDirectDrawSurface2 *v4; // esi@1
3823 HRESULT v5; // eax@1
3824 HRESULT v6; // eax@2
3825 int v7; // [sp-8h] [bp-10h]@8
3826 unsigned int v8; // [sp-4h] [bp-Ch]@8
3827
3828 v4 = pSurface;
3829 v5 = pSurface->Lock(
3830 0,
3831 pDesc,
3832 uLockFlags,
3833 0);
3834 BYTE3(pSurface) = 1;
3835 if ( v5 == DDERR_SURFACELOST )
3836 {
3837 v6 = v4->Restore();
3838 if ( !v6 )
3839 goto LABEL_5;
3840 if ( v6 == DDERR_IMPLICITLYCREATED )
3841 {
3842 pRenderer->pFrontBuffer2->Restore();
3843 v4->Restore();
3844 LABEL_5:
3845 v5 = v4->Lock(0, pDesc, 1u, 0) != 0;
3846 if ( v5 == DDERR_INVALIDRECT || v5 == DDERR_SURFACEBUSY )
3847 goto LABEL_14;
3848 if ( !v5 )
3849 return true;
3850 ErrD3D(v5);
3851 //v8 = 0;
3852 //v7 = 2247;
3853 goto LABEL_13;
3854 }
3855 else
3856 {
3857 pDesc->dwSize = 0;
3858 return false;
3859 }
3860 }
3861 else
3862 {
3863 if ( !v5 )
3864 return true;
3865 if ( v5 != DDERR_INVALIDRECT && v5 != DDERR_SURFACEBUSY )
3866 {
3867 //v8 = 0;
3868 //v7 = 2269;
3869 ErrD3D(v5);
3870 pDesc->dwSize = 0;
3871 return false;
3872 LABEL_13:
3873 //CheckHRESULT((CheckHRESULT_stru0 *)&pSurface, v5, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Screen16.cpp", v7, v8);
3874 goto LABEL_14;
3875 }
3876 }
3877 LABEL_14:
3878 return true;
3879 }
3880 4061
3881 //----- (004A10E4) -------------------------------------------------------- 4062 //----- (004A10E4) --------------------------------------------------------
3882 void Render::CreateDirectDraw() 4063 void Render::CreateDirectDraw()
3883 { 4064 {
3884 Render *v1; // edi@1 4065 Render *v1; // edi@1
3889 IDirectDraw *lpDD; // [sp+10h] [bp-4h]@1 4070 IDirectDraw *lpDD; // [sp+10h] [bp-4h]@1
3890 4071
3891 v1 = this; 4072 v1 = this;
3892 ErrD3D(DirectDrawCreate(0, &lpDD, 0)); 4073 ErrD3D(DirectDrawCreate(0, &lpDD, 0));
3893 4074
3894 pDirectDraw2 = nullptr;
3895 pDirectDraw4 = nullptr; 4075 pDirectDraw4 = nullptr;
3896 4076
3897 if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || 4077 ErrD3D(lpDD->QueryInterface(IID_IDirectDraw4, (void **)&pDirectDraw4));
3898 pVersion->pVersionInfo.dwMajorVersion != 4 )
3899 ErrD3D(lpDD->QueryInterface(IID_IDirectDraw4, (void **)&pDirectDraw4));
3900 else
3901 ErrD3D(lpDD->QueryInterface(IID_IDirectDraw2, (void **)&pDirectDraw2));
3902 4078
3903 lpDD->Release(); 4079 lpDD->Release();
3904 lpDD = nullptr; 4080 lpDD = nullptr;
3905 } 4081 }
3906 4082
3914 unsigned int v7; // [sp-4h] [bp-4h]@3 4090 unsigned int v7; // [sp-4h] [bp-4h]@3
3915 4091
3916 flags = bFullscreen ? DDSCL_NORMAL | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN : 4092 flags = bFullscreen ? DDSCL_NORMAL | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN :
3917 DDSCL_NORMAL; 4093 DDSCL_NORMAL;
3918 4094
3919 if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || 4095 ErrD3D(pDirectDraw4->SetCooperativeLevel(hWnd, flags | DDSCL_MULTITHREADED));
3920 pVersion->pVersionInfo.dwMajorVersion != 4 )
3921 ErrD3D(pDirectDraw4->SetCooperativeLevel(hWnd, flags | DDSCL_MULTITHREADED));
3922 else
3923 ErrD3D(pDirectDraw2->SetCooperativeLevel(hWnd, flags));
3924 } 4096 }
3925 4097
3926 //----- (004A11C6) -------------------------------------------------------- 4098 //----- (004A11C6) --------------------------------------------------------
3927 void Render::SetDirectDrawDisplayMode(unsigned int uWidth, unsigned int uHeight, unsigned int uBPP) 4099 void Render::SetDirectDrawDisplayMode(unsigned int uWidth, unsigned int uHeight, unsigned int uBPP)
3928 { 4100 {
3929 if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || 4101 ErrD3D(pDirectDraw4->SetDisplayMode(uWidth, uHeight, uBPP, 0, 0));
3930 pVersion->pVersionInfo.dwMajorVersion != 4 )
3931 ErrD3D(pDirectDraw4->SetDisplayMode(uWidth, uHeight, uBPP, 0, 0));
3932 else
3933 ErrD3D(pDirectDraw2->SetDisplayMode(uWidth, uHeight, uBPP, 0, 0));
3934 } 4102 }
3935 4103
3936 //----- (004A121C) -------------------------------------------------------- 4104 //----- (004A121C) --------------------------------------------------------
3937 void Render::CreateFrontBuffer() 4105 void Render::CreateFrontBuffer()
3938 { 4106 {
3944 int v6; // [sp-8h] [bp-8Ch]@3 4112 int v6; // [sp-8h] [bp-8Ch]@3
3945 unsigned int v7; // [sp-4h] [bp-88h]@3 4113 unsigned int v7; // [sp-4h] [bp-88h]@3
3946 DDSURFACEDESC2 a2; // [sp+4h] [bp-80h]@3 4114 DDSURFACEDESC2 a2; // [sp+4h] [bp-80h]@3
3947 4115
3948 v1 = this; 4116 v1 = this;
3949 if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || 4117 //if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT ||
3950 pVersion->pVersionInfo.dwMajorVersion != 4 ) 4118 //pVersion->pVersionInfo.dwMajorVersion != 4 )
3951 { 4119 {
3952 memset(&a2, 0, 0x7Cu); 4120 memset(&a2, 0, 0x7Cu);
3953 pDD = (IDirectDraw *)v1->pDirectDraw4; 4121 pDD = (IDirectDraw *)v1->pDirectDraw4;
3954 a2.dwSize = 124; 4122 a2.dwSize = 124;
3955 a2.dwFlags = 1; 4123 a2.dwFlags = 1;
3957 a2.ddsCaps.dwCaps = 512; 4125 a2.ddsCaps.dwCaps = 512;
3958 v6 = 2357; 4126 v6 = 2357;
3959 pOutSurf = (IDirectDrawSurface **)&v1->pFrontBuffer4; 4127 pOutSurf = (IDirectDrawSurface **)&v1->pFrontBuffer4;
3960 v4 = (struct _DDSURFACEDESC *)&a2; 4128 v4 = (struct _DDSURFACEDESC *)&a2;
3961 } 4129 }
3962 else 4130 /*else
3963 { 4131 {
3964 memset(&a2.lPitch, 0, 0x6Cu); // DDSURFACEDESC here 4132 memset(&a2.lPitch, 0, 0x6Cu); // DDSURFACEDESC here
3965 pDD = (IDirectDraw *)v1->pDirectDraw2; 4133 pDD = (IDirectDraw *)v1->pDirectDraw2;
3966 a2.lPitch = 108; 4134 a2.lPitch = 108;
3967 a2.dwBackBufferCount = 1; 4135 a2.dwBackBufferCount = 1;
3968 v7 = 0; 4136 v7 = 0;
3969 a2.dwTextureStage = 512; 4137 a2.dwTextureStage = 512;
3970 v6 = 2346; 4138 v6 = 2346;
3971 pOutSurf = (IDirectDrawSurface **)&v1->pFrontBuffer2; 4139 pOutSurf = (IDirectDrawSurface **)&v1->pFrontBuffer2;
3972 v4 = (struct _DDSURFACEDESC *)&a2.lPitch; 4140 v4 = (struct _DDSURFACEDESC *)&a2.lPitch;
3973 } 4141 }*/
3974 ErrD3D(pDD->CreateSurface(v4, pOutSurf, 0)); 4142 ErrD3D(pDD->CreateSurface(v4, pOutSurf, 0));
3975 } 4143 }
3976 4144
3977 //----- (004A12CD) -------------------------------------------------------- 4145 //----- (004A12CD) --------------------------------------------------------
3978 void Render::CreateBackBuffer() 4146 void Render::CreateBackBuffer()
3985 int v6; // [sp-8h] [bp-8Ch]@3 4153 int v6; // [sp-8h] [bp-8Ch]@3
3986 unsigned int v7; // [sp-4h] [bp-88h]@3 4154 unsigned int v7; // [sp-4h] [bp-88h]@3
3987 DDSURFACEDESC2 a2; // [sp+4h] [bp-80h]@3 4155 DDSURFACEDESC2 a2; // [sp+4h] [bp-80h]@3
3988 4156
3989 v1 = this; 4157 v1 = this;
3990 if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || 4158 //if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT ||
3991 pVersion->pVersionInfo.dwMajorVersion != 4 ) 4159 // pVersion->pVersionInfo.dwMajorVersion != 4 )
3992 { 4160 {
3993 memset(&a2, 0, 0x7Cu); 4161 memset(&a2, 0, 0x7Cu);
3994 v2 = (IDirectDraw *)v1->pDirectDraw4; 4162 v2 = (IDirectDraw *)v1->pDirectDraw4;
3995 a2.dwSize = 124; 4163 a2.dwSize = 124;
3996 a2.dwFlags = 7; 4164 a2.dwFlags = 7;
4000 a2.dwHeight = 480; 4168 a2.dwHeight = 480;
4001 v6 = 2387; 4169 v6 = 2387;
4002 ppBackBuffer = (IDirectDrawSurface **)&v1->pBackBuffer4; 4170 ppBackBuffer = (IDirectDrawSurface **)&v1->pBackBuffer4;
4003 v4 = (struct _DDSURFACEDESC *)&a2; 4171 v4 = (struct _DDSURFACEDESC *)&a2;
4004 } 4172 }
4005 else 4173 /*else
4006 { 4174 {
4007 memset(&a2.lPitch, 0, 0x6Cu); 4175 memset(&a2.lPitch, 0, 0x6Cu);
4008 v2 = (IDirectDraw *)v1->pDirectDraw2; 4176 v2 = (IDirectDraw *)v1->pDirectDraw2;
4009 a2.lPitch = 108; 4177 a2.lPitch = 108;
4010 a2.dwBackBufferCount = 7; 4178 a2.dwBackBufferCount = 7;
4013 a2.dwAlphaBitDepth = 640; 4181 a2.dwAlphaBitDepth = 640;
4014 a2.dwMipMapCount = 480; 4182 a2.dwMipMapCount = 480;
4015 v6 = 2374; 4183 v6 = 2374;
4016 ppBackBuffer = (IDirectDrawSurface **)&v1->pBackBuffer2; 4184 ppBackBuffer = (IDirectDrawSurface **)&v1->pBackBuffer2;
4017 v4 = (struct _DDSURFACEDESC *)&a2.lPitch; // //DDSURFACEDESC here fo ddraw2 4185 v4 = (struct _DDSURFACEDESC *)&a2.lPitch; // //DDSURFACEDESC here fo ddraw2
4018 } 4186 }*/
4019 ErrD3D(v2->CreateSurface(v4, ppBackBuffer, 0)); 4187 ErrD3D(v2->CreateSurface(v4, ppBackBuffer, 0));
4020 } 4188 }
4021 4189
4022 //----- (004A139A) -------------------------------------------------------- 4190 //----- (004A139A) --------------------------------------------------------
4023 void Render::CreateDirectDrawPrimarySurface() 4191 void Render::CreateDirectDrawPrimarySurface()
4040 DDSURFACEDESC2 ddsd2; // [sp+Ch] [bp-94h]@3 4208 DDSURFACEDESC2 ddsd2; // [sp+Ch] [bp-94h]@3
4041 DDSCAPS2 v17; // [sp+88h] [bp-18h]@4 4209 DDSCAPS2 v17; // [sp+88h] [bp-18h]@4
4042 int a4; // [sp+98h] [bp-8h]@3 4210 int a4; // [sp+98h] [bp-8h]@3
4043 4211
4044 v1 = this; 4212 v1 = this;
4045 if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || 4213 //if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT ||
4046 pVersion->pVersionInfo.dwMajorVersion != 4 ) 4214 //pVersion->pVersionInfo.dwMajorVersion != 4 )
4047 { 4215 {
4048 v2 = 0; 4216 v2 = 0;
4049 this->field_4004C = 1; 4217 this->field_4004C = 1;
4050 memset(&ddsd2, 0, 0x7Cu); 4218 memset(&ddsd2, 0, 0x7Cu);
4051 v7 = v1->pDirectDraw4; 4219 v7 = v1->pDirectDraw4;
4058 &pFrontBuffer4, 4226 &pFrontBuffer4,
4059 0)); 4227 0));
4060 pFrontBuffer = (IDirectDrawSurface *)v1->pFrontBuffer4; 4228 pFrontBuffer = (IDirectDrawSurface *)v1->pFrontBuffer4;
4061 ppBackBuffer = (IDirectDrawSurface **)&v1->pBackBuffer4; 4229 ppBackBuffer = (IDirectDrawSurface **)&v1->pBackBuffer4;
4062 } 4230 }
4063 else 4231 /*else
4064 { 4232 {
4065 v2 = 0; 4233 v2 = 0;
4066 this->field_4004C = 1; 4234 this->field_4004C = 1;
4067 4235
4068 DDSURFACEDESC ddsd; 4236 DDSURFACEDESC ddsd;
4077 (IDirectDrawSurface **)&pFrontBuffer2, 4245 (IDirectDrawSurface **)&pFrontBuffer2,
4078 0)); 4246 0));
4079 4247
4080 pFrontBuffer = (IDirectDrawSurface *)v1->pFrontBuffer2; 4248 pFrontBuffer = (IDirectDrawSurface *)v1->pFrontBuffer2;
4081 ppBackBuffer = (IDirectDrawSurface **)&v1->pBackBuffer2; 4249 ppBackBuffer = (IDirectDrawSurface **)&v1->pBackBuffer2;
4082 } 4250 }*/
4083 __debugbreak(); // warning C4700: uninitialized local variable 'v6' used 4251 __debugbreak(); // warning C4700: uninitialized local variable 'v6' used
4084 v9 = (int)v6; 4252 v9 = (int)v6;
4085 v10 = pFrontBuffer; // BUG 4253 v10 = pFrontBuffer; // BUG
4086 4254
4087 v17.dwCaps = 4; 4255 v17.dwCaps = 4;
4092 } 4260 }
4093 4261
4094 //----- (004A14F4) -------------------------------------------------------- 4262 //----- (004A14F4) --------------------------------------------------------
4095 void Render::CreateClipper(HWND a2) 4263 void Render::CreateClipper(HWND a2)
4096 { 4264 {
4097 if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || 4265 ErrD3D(pDirectDraw4->CreateClipper(0, &pDDrawClipper, 0));
4098 pVersion->pVersionInfo.dwMajorVersion != 4 ) 4266 ErrD3D(pDDrawClipper->SetHWnd(0, a2));
4099 { 4267 ErrD3D(pFrontBuffer4->SetClipper(pDDrawClipper));
4100 ErrD3D(pDirectDraw4->CreateClipper(0, &pDDrawClipper, 0));
4101 ErrD3D(pDDrawClipper->SetHWnd(0, a2));
4102 ErrD3D(pFrontBuffer4->SetClipper(pDDrawClipper));
4103 }
4104 else
4105 {
4106 ErrD3D(pDirectDraw2->CreateClipper(0, &pDDrawClipper, 0));
4107 ErrD3D(pDDrawClipper->SetHWnd(0, a2));
4108 }
4109 } 4268 }
4110 4269
4111 //----- (004A15D8) -------------------------------------------------------- 4270 //----- (004A15D8) --------------------------------------------------------
4112 void Render::GetTargetPixelFormat(DDPIXELFORMAT *pOut) 4271 void Render::GetTargetPixelFormat(DDPIXELFORMAT *pOut)
4113 { 4272 {
4114 IDirectDrawSurface *v2; // eax@3 4273 pFrontBuffer4->GetPixelFormat(pOut);
4115
4116 if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT ||
4117 pVersion->pVersionInfo.dwMajorVersion != 4 )
4118 v2 = (IDirectDrawSurface *)this->pFrontBuffer4;
4119 else
4120 v2 = (IDirectDrawSurface *)this->pFrontBuffer2;
4121 v2->GetPixelFormat(pOut);
4122 } 4274 }
4123 4275
4124 //----- (004A1605) -------------------------------------------------------- 4276 //----- (004A1605) --------------------------------------------------------
4125 void Render::LockRenderSurface(void **pOutSurfacePtr, unsigned int *pOutPixelsPerRow) 4277 void Render::LockRenderSurface(void **pOutSurfacePtr, unsigned int *pOutPixelsPerRow)
4126 { 4278 {
4127 signed int v4; // eax@3 4279 signed int v4; // eax@3
4128 4280
4129 if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || 4281 //if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT ||
4130 pVersion->pVersionInfo.dwMajorVersion != 4 ) 4282 //pVersion->pVersionInfo.dwMajorVersion != 4 )
4131 { 4283 {
4132 DDSURFACEDESC2 pDesc; // [sp+4h] [bp-7Ch]@3 4284 DDSURFACEDESC2 pDesc; // [sp+4h] [bp-7Ch]@3
4133 memset(&pDesc, 0, 0x7Cu); 4285 memset(&pDesc, 0, 0x7Cu);
4134 pDesc.dwSize = 124; 4286 pDesc.dwSize = 124;
4135 LockSurface_DDraw4(this->pBackBuffer4, &pDesc, DDLOCK_WAIT); 4287 LockSurface_DDraw4(this->pBackBuffer4, &pDesc, DDLOCK_WAIT);
4136 *pOutSurfacePtr = pDesc.lpSurface; 4288 *pOutSurfacePtr = pDesc.lpSurface;
4137 v4 = pDesc.lPitch; 4289 v4 = pDesc.lPitch;
4138 } 4290 }
4139 else 4291 /*else
4140 { 4292 {
4141 DDSURFACEDESC pDesc; // [sp+4h] [bp-7Ch]@3 4293 DDSURFACEDESC pDesc; // [sp+4h] [bp-7Ch]@3
4142 memset(&pDesc.lPitch, 0, 0x6Cu); 4294 memset(&pDesc.lPitch, 0, 0x6Cu);
4143 pDesc.lPitch = 108; 4295 pDesc.lPitch = 108;
4144 LockSurface_DDraw2(this->pBackBuffer2, &pDesc, 1); 4296 LockSurface_DDraw2(this->pBackBuffer2, &pDesc, 1);
4145 *pOutSurfacePtr = (void *)pDesc.lpSurface; 4297 *pOutSurfacePtr = (void *)pDesc.lpSurface;
4146 v4 = pDesc.dwReserved; 4298 v4 = pDesc.dwReserved;
4147 } 4299 }*/
4148 *pOutPixelsPerRow = v4 >> 1; 4300 *pOutPixelsPerRow = v4 >> 1;
4149 } 4301 }
4150 4302
4151 //----- (004A16E1) -------------------------------------------------------- 4303 //----- (004A16E1) --------------------------------------------------------
4152 void Render::UnlockBackBuffer() 4304 void Render::UnlockBackBuffer()
4153 { 4305 {
4154 if (pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || 4306 ErrD3D(pBackBuffer4->Unlock(0));
4155 pVersion->pVersionInfo.dwMajorVersion != 4 )
4156 ErrD3D(pBackBuffer4->Unlock(0));
4157 else
4158 ErrD3D(pBackBuffer2->Unlock(0));
4159 } 4307 }
4160 4308
4161 //----- (004A172E) -------------------------------------------------------- 4309 //----- (004A172E) --------------------------------------------------------
4162 void Render::LockFrontBuffer(void **pOutSurface, unsigned int *pOutPixelsPerRow) 4310 void Render::LockFrontBuffer(void **pOutSurface, unsigned int *pOutPixelsPerRow)
4163 { 4311 {
4164 signed int v4; // eax@3 4312 signed int v4; // eax@3
4165 4313
4166 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) 4314 //if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 )
4167 { 4315 {
4168 DDSURFACEDESC2 pDesc; // [sp+4h] [bp-7Ch]@3 4316 DDSURFACEDESC2 pDesc; // [sp+4h] [bp-7Ch]@3
4169 memset(&pDesc, 0, 0x7Cu); 4317 memset(&pDesc, 0, 0x7Cu);
4170 pDesc.dwSize = 124; 4318 pDesc.dwSize = 124;
4171 LockSurface_DDraw4(this->pFrontBuffer4, &pDesc, DDLOCK_WAIT); 4319 LockSurface_DDraw4(this->pFrontBuffer4, &pDesc, DDLOCK_WAIT);
4172 *pOutSurface = pDesc.lpSurface; 4320 *pOutSurface = pDesc.lpSurface;
4173 v4 = pDesc.lPitch; 4321 v4 = pDesc.lPitch;
4174 } 4322 }
4175 else 4323 /*else
4176 { 4324 {
4177 DDSURFACEDESC pDesc; // [sp+4h] [bp-7Ch]@3 4325 DDSURFACEDESC pDesc; // [sp+4h] [bp-7Ch]@3
4178 memset(&pDesc.lPitch, 0, 0x6Cu); 4326 memset(&pDesc.lPitch, 0, 0x6Cu);
4179 pDesc.lPitch = 108; 4327 pDesc.lPitch = 108;
4180 LockSurface_DDraw2(this->pFrontBuffer2, &pDesc, 1); 4328 LockSurface_DDraw2(this->pFrontBuffer2, &pDesc, 1);
4181 *pOutSurface = (void *)pDesc.lpSurface; 4329 *pOutSurface = (void *)pDesc.lpSurface;
4182 v4 = pDesc.dwReserved; 4330 v4 = pDesc.dwReserved;
4183 } 4331 }*/
4184 *pOutPixelsPerRow = v4 >> 1; 4332 *pOutPixelsPerRow = v4 >> 1;
4185 } 4333 }
4186 4334
4187 //----- (004A17C7) -------------------------------------------------------- 4335 //----- (004A17C7) --------------------------------------------------------
4188 void Render::UnlockFrontBuffer() 4336 void Render::UnlockFrontBuffer()
4189 { 4337 {
4190 IDirectDrawSurface *pFront; // eax@3 4338 ErrD3D(pFrontBuffer4->Unlock(0));
4191 HRESULT v2; // eax@5
4192 signed int v3; // [sp-8h] [bp-Ch]@3
4193 int v4; // [sp-4h] [bp-8h]@3
4194
4195 Render* a5 = this;
4196 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 )
4197 {
4198 pFront = (IDirectDrawSurface *)a5->pFrontBuffer4;
4199 v4 = 0;
4200 v3 = 2615;
4201 }
4202 else
4203 {
4204 pFront = (IDirectDrawSurface *)a5->pFrontBuffer2;
4205 v4 = 0;
4206 v3 = 2611;
4207 }
4208 ErrD3D(pFront->Unlock(0));
4209 } 4339 }
4210 4340
4211 //----- (004A1814) -------------------------------------------------------- 4341 //----- (004A1814) --------------------------------------------------------
4212 void Render::RestoreFrontBuffer() 4342 void Render::RestoreFrontBuffer()
4213 { 4343 {
4214 IDirectDrawSurface **v1; // esi@2 4344 if (pFrontBuffer4->IsLost() == DDERR_SURFACELOST )
4215 4345 pFrontBuffer4->Restore();
4216 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT
4217 || (v1 = (IDirectDrawSurface **)&this->pFrontBuffer2, pVersion->pVersionInfo.dwMajorVersion >= 5u) )
4218 v1 = (IDirectDrawSurface **)&this->pFrontBuffer4;
4219 if ( (*v1)->IsLost() == DDERR_SURFACELOST )
4220 (*v1)->Restore();
4221 } 4346 }
4222 4347
4223 //----- (004A184C) -------------------------------------------------------- 4348 //----- (004A184C) --------------------------------------------------------
4224 HRESULT Render::_4A184C() 4349 void Render::RestoreBackBuffer()
4225 { 4350 {
4226 IDirectDrawSurface **pBack; // esi@2 4351 if ( pBackBuffer4->IsLost() == DDERR_SURFACELOST )
4227 HRESULT result; // eax@4 4352 pBackBuffer4->Restore();
4228
4229 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT
4230 || (pBack = (IDirectDrawSurface **)&this->pBackBuffer2, pVersion->pVersionInfo.dwMajorVersion != 4) )
4231 pBack = (IDirectDrawSurface **)&this->pBackBuffer4;
4232 result = (*pBack)->IsLost();
4233 if ( result == DDERR_SURFACELOST )
4234 result = (*pBack)->Restore();
4235 return result;
4236 } 4353 }
4237 4354
4238 //----- (004A1884) -------------------------------------------------------- 4355 //----- (004A1884) --------------------------------------------------------
4239 void Render::PresentRect(RECT *a2, RECT *a3) 4356 void Render::PresentRect(RECT *a2, RECT *a3)
4240 { 4357 {
4246 DDBLTFX *v8; // [sp-10h] [bp-10h]@3 4363 DDBLTFX *v8; // [sp-10h] [bp-10h]@3
4247 const char *v9; // [sp-Ch] [bp-Ch]@3 4364 const char *v9; // [sp-Ch] [bp-Ch]@3
4248 int v10; // [sp-8h] [bp-8h]@3 4365 int v10; // [sp-8h] [bp-8h]@3
4249 unsigned int v11; // [sp-4h] [bp-4h]@3 4366 unsigned int v11; // [sp-4h] [bp-4h]@3
4250 4367
4251 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) 4368 //if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 )
4252 { 4369 {
4253 v11 = 0; 4370 v11 = 0;
4254 pFront = (IDirectDrawSurface *)this->pFrontBuffer4; 4371 pFront = (IDirectDrawSurface *)this->pFrontBuffer4;
4255 v10 = 2657; 4372 v10 = 2657;
4256 v9 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Screen16.cpp"; 4373 v9 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Screen16.cpp";
4257 v8 = 0; 4374 v8 = 0;
4258 v7 = DDBLT_WAIT; 4375 v7 = DDBLT_WAIT;
4259 v6 = a3; 4376 v6 = a3;
4260 pBack = (IDirectDrawSurface *)this->pBackBuffer4; 4377 pBack = (IDirectDrawSurface *)this->pBackBuffer4;
4261 } 4378 }
4262 else 4379 /*else
4263 { 4380 {
4264 v11 = 0; 4381 v11 = 0;
4265 pFront = (IDirectDrawSurface *)this->pFrontBuffer2; 4382 pFront = (IDirectDrawSurface *)this->pFrontBuffer2;
4266 v10 = 2653; 4383 v10 = 2653;
4267 v9 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Screen16.cpp"; 4384 v9 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Screen16.cpp";
4268 v8 = 0; 4385 v8 = 0;
4269 v7 = DDBLT_WAIT; 4386 v7 = DDBLT_WAIT;
4270 v6 = a3; 4387 v6 = a3;
4271 pBack = (IDirectDrawSurface *)this->pBackBuffer2; 4388 pBack = (IDirectDrawSurface *)this->pBackBuffer2;
4272 } 4389 }*/
4273 ErrD3D(pFront->Blt(a2, pBack, v6, v7, v8)); 4390 ErrD3D(pFront->Blt(a2, pBack, v6, v7, v8));
4274 } 4391 }
4275 4392
4276 //----- (004A18F5) -------------------------------------------------------- 4393 //----- (004A18F5) --------------------------------------------------------
4277 void Render::BltToFront(RECT *pDstRect, IDirectDrawSurface *pSrcSurface, RECT *pSrcRect, unsigned int uBltFlags) 4394 void Render::BltToFront(RECT *pDstRect, IDirectDrawSurface *pSrcSurface, RECT *pSrcRect, unsigned int uBltFlags)
4278 { 4395 {
4279 IDirectDrawSurface *pFront; // eax@3 4396 ErrD3D(pFrontBuffer4->Blt(pDstRect, (IDirectDrawSurface4 *)pSrcSurface, pSrcRect, uBltFlags, nullptr));
4280 HRESULT v6; // eax@5
4281 int v7; // [sp-8h] [bp-8h]@3
4282 unsigned int v8; // [sp-4h] [bp-4h]@3
4283
4284 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion >= 5u )
4285 ErrD3D(pFrontBuffer4->Blt(pDstRect, (IDirectDrawSurface4 *)pSrcSurface, pSrcRect, uBltFlags, nullptr));
4286 else
4287 ErrD3D(pFrontBuffer2->Blt(pDstRect, (IDirectDrawSurface2 *)pSrcSurface, pSrcRect, uBltFlags, nullptr));
4288 } 4397 }
4289 4398
4290 //----- (004A194A) -------------------------------------------------------- 4399 //----- (004A194A) --------------------------------------------------------
4291 void Render::BltBackToFontFast(int a2, int a3, RECT *a4) 4400 void Render::BltBackToFontFast(int a2, int a3, RECT *a4)
4292 { 4401 {
4293 IDirectDrawSurface *pFront; // eax@3 4402 IDirectDrawSurface *pFront; // eax@3
4294 IDirectDrawSurface *pBack; // [sp-Ch] [bp-Ch]@3 4403 IDirectDrawSurface *pBack; // [sp-Ch] [bp-Ch]@3
4295 4404
4296 if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) 4405 //if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 )
4297 { 4406 {
4298 pFront = (IDirectDrawSurface *)this->pFrontBuffer4; 4407 pFront = (IDirectDrawSurface *)this->pFrontBuffer4;
4299 pBack = (IDirectDrawSurface *)this->pBackBuffer4; 4408 pBack = (IDirectDrawSurface *)this->pBackBuffer4;
4300 } 4409 }
4301 else 4410 /*else
4302 { 4411 {
4303 pFront = (IDirectDrawSurface *)this->pFrontBuffer2; 4412 pFront = (IDirectDrawSurface *)this->pFrontBuffer2;
4304 pBack = (IDirectDrawSurface *)this->pBackBuffer2; 4413 pBack = (IDirectDrawSurface *)this->pBackBuffer2;
4305 } 4414 }*/
4306 pFront->BltFast(0, 0, pBack, a4, DDBLTFAST_WAIT); 4415 pFront->BltFast(0, 0, pBack, a4, DDBLTFAST_WAIT);
4307 } 4416 }
4308 4417
4309 //----- (004A1B22) -------------------------------------------------------- 4418 //----- (004A1B22) --------------------------------------------------------
4310 unsigned int Render::Billboard_ProbablyAddToListAndSortByZOrder(float z) 4419 unsigned int Render::Billboard_ProbablyAddToListAndSortByZOrder(float z)