mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-24 17:49:52 +01:00
remove unused code + add some more presets
This commit is contained in:
parent
5e121fd76b
commit
bde5fcd70b
87
src/main.c
87
src/main.c
@ -564,38 +564,6 @@ HRESULT __stdcall ddraw_SetDisplayMode(IDirectDrawImpl *This, DWORD width, DWORD
|
|||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* minimal window proc for dummy renderer as everything is emulated */
|
|
||||||
LRESULT CALLBACK dummy_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
||||||
{
|
|
||||||
switch(uMsg)
|
|
||||||
{
|
|
||||||
/* if the plugin window changes */
|
|
||||||
case WM_USER:
|
|
||||||
ddraw->hWnd = (HWND)lParam;
|
|
||||||
ddraw->render.hDC = GetDC(ddraw->hWnd);
|
|
||||||
case WM_ACTIVATEAPP:
|
|
||||||
if (wParam == TRUE)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case WM_SIZE:
|
|
||||||
case WM_NCACTIVATE:
|
|
||||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
|
||||||
case WM_MOUSEMOVE:
|
|
||||||
case WM_NCMOUSEMOVE:
|
|
||||||
ddraw->cursor.x = GET_X_LPARAM(lParam);
|
|
||||||
ddraw->cursor.y = GET_Y_LPARAM(lParam);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ddraw->WndProc)
|
|
||||||
{
|
|
||||||
return ddraw->WndProc(hWnd, uMsg, wParam, lParam);
|
|
||||||
}
|
|
||||||
|
|
||||||
return DefWindowProc(hWnd, uMsg, wParam, lParam);
|
|
||||||
}
|
|
||||||
|
|
||||||
// LastSetWindowPosTick = Workaround for a wine+gnome bug where each SetWindowPos call triggers a WA_INACTIVE message
|
// LastSetWindowPosTick = Workaround for a wine+gnome bug where each SetWindowPos call triggers a WA_INACTIVE message
|
||||||
DWORD LastSetWindowPosTick;
|
DWORD LastSetWindowPosTick;
|
||||||
|
|
||||||
@ -1094,36 +1062,39 @@ HRESULT __stdcall ddraw_SetCooperativeLevel(IDirectDrawImpl *This, HWND hWnd, DW
|
|||||||
This->hWnd = hWnd;
|
This->hWnd = hWnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
mouse_init();
|
if (!This->WndProc)
|
||||||
|
|
||||||
This->WndProc = (LRESULT(CALLBACK *)(HWND, UINT, WPARAM, LPARAM))GetWindowLong(hWnd, GWL_WNDPROC);
|
|
||||||
|
|
||||||
SetWindowLong(This->hWnd, GWL_WNDPROC, (LONG)WndProc);
|
|
||||||
|
|
||||||
if(!This->render.hDC)
|
|
||||||
{
|
{
|
||||||
This->render.hDC = GetDC(This->hWnd);
|
mouse_init();
|
||||||
|
|
||||||
memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR));
|
This->WndProc = (LRESULT(CALLBACK *)(HWND, UINT, WPARAM, LPARAM))GetWindowLong(hWnd, GWL_WNDPROC);
|
||||||
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
|
|
||||||
pfd.nVersion = 1;
|
SetWindowLong(This->hWnd, GWL_WNDPROC, (LONG)WndProc);
|
||||||
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER | (This->renderer == render_main ? PFD_SUPPORT_OPENGL : 0);
|
|
||||||
pfd.iPixelType = PFD_TYPE_RGBA;
|
if (!This->render.hDC)
|
||||||
pfd.cColorBits = ddraw->render.bpp ? ddraw->render.bpp : ddraw->mode.dmBitsPerPel;
|
{
|
||||||
pfd.iLayerType = PFD_MAIN_PLANE;
|
This->render.hDC = GetDC(This->hWnd);
|
||||||
SetPixelFormat( This->render.hDC, ChoosePixelFormat( This->render.hDC, &pfd ), &pfd );
|
|
||||||
|
memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR));
|
||||||
|
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
|
||||||
|
pfd.nVersion = 1;
|
||||||
|
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER | (This->renderer == render_main ? PFD_SUPPORT_OPENGL : 0);
|
||||||
|
pfd.iPixelType = PFD_TYPE_RGBA;
|
||||||
|
pfd.cColorBits = ddraw->render.bpp ? ddraw->render.bpp : ddraw->mode.dmBitsPerPel;
|
||||||
|
pfd.iLayerType = PFD_MAIN_PLANE;
|
||||||
|
SetPixelFormat(This->render.hDC, ChoosePixelFormat(This->render.hDC, &pfd), &pfd);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetCursor(LoadCursor(NULL, IDC_ARROW));
|
||||||
|
|
||||||
|
GetWindowText(This->hWnd, (LPTSTR)&This->title, sizeof(This->title));
|
||||||
|
|
||||||
|
ddraw->isredalert = strcmp(This->title, "Red Alert") == 0;
|
||||||
|
ddraw->iscnc1 = strcmp(This->title, "Command & Conquer") == 0;
|
||||||
|
|
||||||
|
if (This->vhack && !ddraw->isredalert && !ddraw->iscnc1)
|
||||||
|
This->vhack = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCursor(LoadCursor(NULL, IDC_ARROW));
|
|
||||||
|
|
||||||
GetWindowText(This->hWnd, (LPTSTR)&This->title, sizeof(This->title));
|
|
||||||
|
|
||||||
ddraw->isredalert = strcmp(This->title, "Red Alert") == 0;
|
|
||||||
ddraw->iscnc1 = strcmp(This->title, "Command & Conquer") == 0;
|
|
||||||
|
|
||||||
if (This->vhack && !ddraw->isredalert && !ddraw->iscnc1)
|
|
||||||
This->vhack = 0;
|
|
||||||
|
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ void Settings_Load()
|
|||||||
GetString("shader", "", ddraw->shader, sizeof(ddraw->shader));
|
GetString("shader", "", ddraw->shader, sizeof(ddraw->shader));
|
||||||
|
|
||||||
GetString("renderer", "auto", tmp, sizeof(tmp));
|
GetString("renderer", "auto", tmp, sizeof(tmp));
|
||||||
printf("DirectDrawCreate: Using %s renderer\n", tmp);
|
printf("Using %s renderer\n", tmp);
|
||||||
|
|
||||||
if (tolower(tmp[0]) == 's' || tolower(tmp[0]) == 'g') //gdi
|
if (tolower(tmp[0]) == 's' || tolower(tmp[0]) == 'g') //gdi
|
||||||
{
|
{
|
||||||
@ -208,6 +208,18 @@ static void CreateSettingsIni()
|
|||||||
"[C&C95]\n"
|
"[C&C95]\n"
|
||||||
"sleep=10\n"
|
"sleep=10\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
"[empires]\n"
|
||||||
|
"hidemouse=false\n"
|
||||||
|
"border=false\n"
|
||||||
|
"posX=0\n"
|
||||||
|
"posY=0\n"
|
||||||
|
"\n"
|
||||||
|
"[empiresx]\n"
|
||||||
|
"hidemouse=false\n"
|
||||||
|
"border=false\n"
|
||||||
|
"posX=0\n"
|
||||||
|
"posY=0\n"
|
||||||
|
"\n"
|
||||||
"[EMPIRES2]\n"
|
"[EMPIRES2]\n"
|
||||||
"hidemouse=false\n"
|
"hidemouse=false\n"
|
||||||
"border=false\n"
|
"border=false\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user