]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_glx.c
darkplaces now compiles in mingw
[xonotic/darkplaces.git] / vid_glx.c
index 994084da86f5c4ced9396e935591a42f93b58a55..5fa9867b6ec74b5c0ee2dcf8019a0e8f8e363f88 100644 (file)
--- a/vid_glx.c
+++ b/vid_glx.c
@@ -227,7 +227,7 @@ static void install_grabs(void)
 
        XGrabPointer(vidx11_display, win,  True, 0, GrabModeAsync, GrabModeAsync, win, None, CurrentTime);
 
-       if (vid_dga.value)
+       if (vid_dga.integer)
        {
                int MajorVersion, MinorVersion;
 
@@ -235,11 +235,11 @@ static void install_grabs(void)
                {
                        // unable to query, probalby not supported
                        Con_Printf( "Failed to detect XF86DGA Mouse\n" );
-                       vid_dga.value = 0;
+                       vid_dga.integer = 0;
                }
                else
                {
-                       vid_dga.value = 1;
+                       vid_dga.integer = 1;
                        XF86DGADirectVideo(vidx11_display, DefaultScreen(vidx11_display), XF86DGADirectMouse);
                        XWarpPointer(vidx11_display, None, win, 0, 0, 0, 0, 0, 0);
                }
@@ -260,7 +260,7 @@ static void uninstall_grabs(void)
        if (!vidx11_display || !win)
                return;
 
-       if (vid_dga.value == 1)
+       if (vid_dga.integer == 1)
                XF86DGADirectVideo(vidx11_display, DefaultScreen(vidx11_display), 0);
 
        XUngrabPointer(vidx11_display, CurrentTime);
@@ -295,7 +295,7 @@ static void HandleEvents(void)
                case MotionNotify:
                        if (usingmouse)
                        {
-                               if (vid_dga.value == 1)
+                               if (vid_dga.integer == 1)
                                {
                                        mouse_x += event.xmotion.x_root * vid_dga_mouseaccel.value;
                                        mouse_y += event.xmotion.y_root * vid_dga_mouseaccel.value;
@@ -478,31 +478,28 @@ void InitSig(void)
 
 /*
 =================
-GL_BeginRendering
-
+VID_GetWindowSize
 =================
 */
-void GL_BeginRendering (int *x, int *y, int *width, int *height)
+void VID_GetWindowSize (int *x, int *y, int *width, int *height)
 {
        *x = *y = 0;
        *width = scr_width;
        *height = scr_height;
-
-//     glViewport (*x, *y, *width, *height);
 }
 
-
-void GL_EndRendering (void)
+void VID_Finish (void)
 {
        int usemouse;
-       if (!r_render.value)
-               return;
-       glFlush();
-       glXSwapBuffers(vidx11_display, win);
+       if (r_render.integer)
+       {
+               glFinish();
+               glXSwapBuffers(vidx11_display, win);
+       }
 
 // handle the mouse state when windowed if that's changed
        usemouse = false;
-       if (vid_mouse.value && key_dest == key_game)
+       if (vid_mouse.integer && key_dest == key_game)
                usemouse = true;
        if (vidmode_active)
                usemouse = true;
@@ -636,7 +633,6 @@ void VID_Init(void)
        qboolean fullscreen = true;
        int MajorVersion, MinorVersion;
 
-       Cvar_RegisterVariable (&vid_mouse);
        Cvar_RegisterVariable (&vid_dga);
        Cvar_RegisterVariable (&vid_dga_mouseaccel);
        Cvar_RegisterVariable (&m_filter);
@@ -817,6 +813,8 @@ void Sys_SendKeyEvents(void)
 
 void IN_Init(void)
 {
+       if (COM_CheckParm ("-nomouse"))
+               mouse_avail = false;
 }
 
 void IN_Shutdown(void)
@@ -842,7 +840,7 @@ void IN_MouseMove (usercmd_t *cmd)
        if (!mouse_avail)
                return;
 
-       if (m_filter.value)
+       if (m_filter.integer)
        {
                mouse_x = (mouse_x + old_mouse_x) * 0.5;
                mouse_y = (mouse_y + old_mouse_y) * 0.5;
@@ -851,8 +849,9 @@ void IN_MouseMove (usercmd_t *cmd)
                old_mouse_y = mouse_y;
        }
 
-       mouse_x *= sensitivity.value;
-       mouse_y *= sensitivity.value;
+       // LordHavoc: viewzoom affects mouse sensitivity for sniping
+       mouse_x *= sensitivity.value * cl.viewzoom;
+       mouse_y *= sensitivity.value * cl.viewzoom;
 
        if (in_strafe.state & 1)
                cmd->sidemove += m_side.value * mouse_x;
@@ -863,10 +862,7 @@ void IN_MouseMove (usercmd_t *cmd)
                V_StopPitchDrift ();
 
        if (/*freelook && */!(in_strafe.state & 1))
-       {
                cl.viewangles[PITCH] += m_pitch.value * mouse_y;
-               cl.viewangles[PITCH] = bound (-90, cl.viewangles[PITCH], 90);
-       }
        else
        {
                if ((in_strafe.state & 1) && noclip_anglehack)
@@ -880,6 +876,7 @@ void IN_MouseMove (usercmd_t *cmd)
 void IN_Move (usercmd_t *cmd)
 {
        IN_MouseMove(cmd);
+       cl.viewangles[PITCH] = bound (in_pitch_min.value, cl.viewangles[PITCH], in_pitch_max.value);
 }