Added bugfix for StartDirectDraw failure

The original code didn't account for it failing, which leads to
annoying bugs happening whenever it does fail.

Now, the game just closes, like it does with any other init error.
This commit is contained in:
Clownacy 2020-01-17 10:35:43 +00:00
parent 727b3eee0d
commit 6764f17ab9

View file

@ -275,10 +275,24 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
hMenu = GetMenu(hWnd);
#ifdef FIX_BUGS
if (conf.display_mode == 1)
{
if (!StartDirectDraw(hWnd, 0, 0))
return 0;
}
else
{
if !(StartDirectDraw(hWnd, 1, 0))
return 0;
}
#else
// Doesn't handle StartDirectDraw failing
if (conf.display_mode == 1)
StartDirectDraw(hWnd, 0, 0);
else
StartDirectDraw(hWnd, 1, 0);
#endif
break;
@ -322,7 +336,14 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
break;
}
#ifdef FIX_BUGS
if (!StartDirectDraw(hWnd, 2, depth))
return 0;
#else
// Doesn't handle StartDirectDraw failing
StartDirectDraw(hWnd, 2, depth);
#endif
bFullscreen = TRUE;
ShowCursor(FALSE);