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;
// forward-referenced functions
void IN_StartupJoystick (void);
void Joy_AdvancedUpdate_f (void);
-void IN_JoyMove (usercmd_t *cmd);
+void IN_JoyMove (void);
void IN_StartupMouse (void);
/*
void VID_Finish (void)
{
- int vid_usemouse;
- static int old_vsync = -1;
-
- if (old_vsync != vid_vsync.integer)
- {
- 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)
+ vid_usevsync = vid_vsync.integer && !cls.timedemo && gl_videosyncavailable;
+ if (vid_usingvsync != vid_usevsync && gl_videosyncavailable)
{
- 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);
+ }
}
//==========================================================================
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];
IN_MouseMove
===========
*/
-void IN_MouseMove (usercmd_t *cmd)
+void IN_MouseMove (void)
{
int i, mx, my;
DIDEVICEOBJECTDATA od;
{
GetCursorPos (¤t_pos);
//ui_mouseupdate(current_pos.x - window_x, current_pos.y - window_y);
- IN_Mouse( cmd, 0, 0 );
+ IN_Mouse( 0, 0 );
return;
}
my = current_pos.y - window_center_y;
}
- IN_Mouse(cmd, mx, my);
+ IN_Mouse(mx, my);
// if the mouse has moved, force it to the center, so there's room to move
if (!dinput && (mx || my))
IN_Move
===========
*/
-void IN_Move (usercmd_t *cmd)
+void IN_Move (void)
{
if (vid_activewindow && !vid_hidden)
{
- IN_MouseMove (cmd);
- IN_JoyMove (cmd);
+ IN_MouseMove ();
+ IN_JoyMove ();
}
}
IN_JoyMove
===========
*/
-void IN_JoyMove (usercmd_t *cmd)
+void IN_JoyMove (void)
{
float speed, aspeed;
float fAxisValue, fTemp;
// user wants forward control to be forward control
if (fabs(fAxisValue) > joy_forwardthreshold.value)
{
- cmd->forwardmove += (fAxisValue * joy_forwardsensitivity.value) * speed * cl_forwardspeed.value;
+ cl.cmd.forwardmove += (fAxisValue * joy_forwardsensitivity.value) * speed * cl_forwardspeed.value;
}
}
break;
case AxisSide:
if (fabs(fAxisValue) > joy_sidethreshold.value)
{
- cmd->sidemove += (fAxisValue * joy_sidesensitivity.value) * speed * cl_sidespeed.value;
+ cl.cmd.sidemove += (fAxisValue * joy_sidesensitivity.value) * speed * cl_sidespeed.value;
}
break;
// user wants turn control to become side control
if (fabs(fAxisValue) > joy_sidethreshold.value)
{
- cmd->sidemove -= (fAxisValue * joy_sidesensitivity.value) * speed * cl_sidespeed.value;
+ cl.cmd.sidemove -= (fAxisValue * joy_sidesensitivity.value) * speed * cl_sidespeed.value;
}
}
else