static DEVMODE gdevmode;
static qboolean vid_initialized = false;
static qboolean vid_wassuspended = false;
-static int vid_usingmouse;
+static qboolean vid_usingmouse = false;
+static qboolean vid_usingvsync = false;
+static qboolean vid_usemouse = false;
+static qboolean vid_usevsync = false;
static HICON hIcon;
HWND mainwindow;
void VID_Finish (void)
{
- int vid_usemouse;
- static int old_vsync = -1;
-
- if (old_vsync != vid_vsync.integer)
+ vid_usevsync = vid_vsync.integer && !cls.timedemo && gl_videosyncavailable;
+ if (vid_usingvsync != vid_usevsync && gl_videosyncavailable)
{
- old_vsync = bound(0, vid_vsync.integer, 1);
- Cvar_SetValueQuick(&vid_vsync, old_vsync);
- if (gl_videosyncavailable)
- qwglSwapIntervalEXT (old_vsync);
- }
-
- if (r_render.integer && !vid_hidden)
- {
- if (r_speeds.integer || gl_finish.integer)
- qglFinish();
- SwapBuffers(baseDC);
+ vid_usingvsync = vid_usevsync;
+ qwglSwapIntervalEXT (vid_usevsync);
}
// handle the mouse state when windowed if that's changed
IN_ShowMouse();
}
}
+
+ if (r_render.integer && !vid_hidden)
+ {
+ if (r_speeds.integer || gl_finish.integer)
+ qglFinish();
+ SwapBuffers(baseDC);
+ }
}
//==========================================================================
window_y = (int) HIWORD(lParam);
VID_UpdateWindowStatus ();
break;
-
+
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
down = true;
static HINSTANCE gldll;
-int GL_OpenLibrary(const char *name)
+static void GL_CloseLibrary(void)
+{
+ FreeLibrary(gldll);
+ gldll = 0;
+ gl_driver[0] = 0;
+ qwglGetProcAddress = NULL;
+ gl_extensions = "";
+ gl_platform = "";
+ gl_platformextensions = "";
+}
+
+static int GL_OpenLibrary(const char *name)
{
Con_Printf("Loading OpenGL driver %s\n", name);
GL_CloseLibrary();
return true;
}
-void GL_CloseLibrary(void)
-{
- FreeLibrary(gldll);
- gldll = 0;
- gl_driver[0] = 0;
- qwglGetProcAddress = NULL;
- gl_extensions = "";
- gl_platform = "";
- gl_platformextensions = "";
-}
-
void *GL_GetProcAddress(const char *name)
{
void *p = NULL;
//vid_menudrawfn = VID_MenuDraw;
//vid_menukeyfn = VID_MenuKey;
+ vid_usingmouse = false;
+ vid_usingvsync = false;
vid_hidden = false;
vid_initialized = true;
if (hInstDI == NULL)
{
- Con_SafePrint("Couldn't load dinput.dll\n");
+ Con_Print("Couldn't load dinput.dll\n");
return false;
}
}
if (!pDirectInputCreate)
{
- Con_SafePrint("Couldn't get DI proc addr\n");
+ Con_Print("Couldn't get DI proc addr\n");
return false;
}
}
if (FAILED(hr))
{
- Con_SafePrint("Couldn't open DI mouse device\n");
+ Con_Print("Couldn't open DI mouse device\n");
return false;
}
if (FAILED(hr))
{
- Con_SafePrint("Couldn't set DI mouse format\n");
+ Con_Print("Couldn't set DI mouse format\n");
return false;
}
if (FAILED(hr))
{
- Con_SafePrint("Couldn't set DI coop level\n");
+ Con_Print("Couldn't set DI coop level\n");
return false;
}
if (FAILED(hr))
{
- Con_SafePrint("Couldn't set DI buffersize\n");
+ Con_Print("Couldn't set DI buffersize\n");
return false;
}
mouseinitialized = true;
-// COMMANDLINEOPTION: Windows Input: -nodinput disables DirectInput for mouse/joystick input, gl_finish 1 mode recommended if this option is used as otherwise it tends to stutter due to input backlog.
- if (!COM_CheckParm ("-nodinput"))
+// COMMANDLINEOPTION: Windows Input: -dinput enables DirectInput for mouse/joystick input
+ if (COM_CheckParm ("-dinput"))
{
dinput = IN_InitDInput ();
if (dinput)
{
- Con_SafePrint("DirectInput initialized\n");
+ Con_Print("DirectInput initialized\n");
}
else
{
- Con_SafePrint("DirectInput not initialized\n");
+ Con_Print("DirectInput not initialized\n");
}
}
if (mouseparmsvalid)
{
-// COMMANDLINEOPTION: Windows GDI Input: -noforcemspd disables setting of mouse speed (-nodinput only, windows only)
+// COMMANDLINEOPTION: Windows GDI Input: -noforcemspd disables setting of mouse speed (not used with -dinput, windows only)
if ( COM_CheckParm ("-noforcemspd") )
newmouseparms[2] = originalmouseparms[2];
-// COMMANDLINEOPTION: Windows GDI Input: -noforcemaccel disables setting of mouse acceleration (-nodinput only, windows only)
+// COMMANDLINEOPTION: Windows GDI Input: -noforcemaccel disables setting of mouse acceleration (not used with -dinput, windows only)
if ( COM_CheckParm ("-noforcemaccel") )
{
newmouseparms[0] = originalmouseparms[0];
newmouseparms[1] = originalmouseparms[1];
}
-// COMMANDLINEOPTION: Windows GDI Input: -noforcemparms disables setting of mouse parameters (-nodinput only, windows only)
+// COMMANDLINEOPTION: Windows GDI Input: -noforcemparms disables setting of mouse parameters (not used with -dinput, windows only)
if ( COM_CheckParm ("-noforcemparms") )
{
newmouseparms[0] = originalmouseparms[0];