]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - in_win.c
check for -safe
[xonotic/darkplaces.git] / in_win.c
index 94c343731e41555ee7385df723cd936c78e33d2a..d11cd66ba1e742e99d43c877929b1d60e54d9d56 100644 (file)
--- a/in_win.c
+++ b/in_win.c
@@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include "quakedef.h"
 #include "winquake.h"
-//#include "dosisms.h"
 
 #include <dinput.h>
 
@@ -33,8 +32,6 @@ HRESULT (WINAPI *pDirectInputCreate)(HINSTANCE hinst, DWORD dwVersion,
        LPDIRECTINPUT * lplpDirectInput, LPUNKNOWN punkOuter);
 
 // mouse variables
-cvar_t m_filter = {CVAR_SAVE, "m_filter","0"};
-
 int                    mouse_buttons;
 int                    mouse_oldbuttonstate;
 POINT          current_pos;
@@ -379,7 +376,7 @@ IN_StartupMouse
 */
 void IN_StartupMouse (void)
 {
-       if ( COM_CheckParm ("-nomouse") 
+       if (COM_CheckParm ("-nomouse") || COM_CheckParm("-safe")
                return; 
 
        mouseinitialized = true;
@@ -438,9 +435,6 @@ IN_Init
 */
 void IN_Init (void)
 {
-       // mouse variables
-       Cvar_RegisterVariable (&m_filter);
-
        // joystick variables
        Cvar_RegisterVariable (&in_joystick);
        Cvar_RegisterVariable (&joy_name);
@@ -477,7 +471,6 @@ IN_Shutdown
 */
 void IN_Shutdown (void)
 {
-//     usingmouse = false;
        IN_DeactivateMouse ();
        IN_ShowMouse ();
 
@@ -534,7 +527,7 @@ IN_MouseMove
 */
 void IN_MouseMove (usercmd_t *cmd)
 {
-       int                                     i, mx, my, mouselook = (in_mlook.state & 1) || freelook.integer;
+       int                                     i, mx, my;
        DIDEVICEOBJECTDATA      od;
        DWORD                           dwElements;
        HRESULT                         hr;
@@ -567,9 +560,7 @@ void IN_MouseMove (usercmd_t *cmd)
 
                        /* Unable to read data or no data available */
                        if (FAILED(hr) || dwElements == 0)
-                       {
                                break;
-                       }
 
                        /* Look at the element to see what happened */
 
@@ -633,52 +624,11 @@ void IN_MouseMove (usercmd_t *cmd)
                my_accum = 0;
        }
 
-//if (mx ||  my)
-//     Con_DPrintf("mx=%d, my=%d\n", mx, my);
+       IN_Mouse(cmd, mx, my);
 
-       if (m_filter.integer)
-       {
-               mouse_x = (mx + old_mouse_x) * 0.5;
-               mouse_y = (my + old_mouse_y) * 0.5;
-       }
-       else
-       {
-               mouse_x = mx;
-               mouse_y = my;
-       }
-
-       old_mouse_x = mx;
-       old_mouse_y = my;
-
-       // LordHavoc: viewzoom affects mouse sensitivity for sniping
-       mouse_x *= sensitivity.value * cl.viewzoom;
-       mouse_y *= sensitivity.value * cl.viewzoom;
-
-// add mouse X/Y movement to cmd
-       if ( (in_strafe.state & 1) || (lookstrafe.integer && mouselook))
-               cmd->sidemove += m_side.value * mouse_x;
-       else
-               cl.viewangles[YAW] -= m_yaw.value * mouse_x;
-
-       if (mouselook)
-               V_StopPitchDrift ();
-       
-       // LordHavoc: changed limits on pitch from -70 to 80, to -90 to 90
-       if (mouselook && !(in_strafe.state & 1))
-               cl.viewangles[PITCH] += m_pitch.value * mouse_y;
-       else
-       {
-               if ((in_strafe.state & 1) && noclip_anglehack)
-                       cmd->upmove -= m_forward.value * mouse_y;
-               else
-                       cmd->forwardmove -= m_forward.value * mouse_y;
-       }
-
-// if the mouse has moved, force it to the center, so there's room to move
-       if (mx || my)
-       {
+       // if the mouse has moved, force it to the center, so there's room to move
+       if (!dinput && (mx || my))
                SetCursorPos (window_center_x, window_center_y);
-       }
 }
 
 
@@ -689,7 +639,7 @@ IN_Move
 */
 void IN_Move (usercmd_t *cmd)
 {
-       if (ActiveApp && !Minimized)
+       if (vid_activewindow && !vid_hidden)
        {
                IN_MouseMove (cmd);
                IN_JoyMove (cmd);
@@ -729,7 +679,6 @@ IN_ClearStates
 */
 void IN_ClearStates (void)
 {
-
        if (mouseactive)
        {
                mx_accum = 0;
@@ -749,12 +698,13 @@ void IN_StartupJoystick (void)
        int                     numdevs;
        JOYCAPS         jc;
        MMRESULT        mmr;
+       mmr = 0;
  
        // assume no joystick
        joy_avail = false; 
 
        // abort startup if user requests no joystick
-       if ( COM_CheckParm ("-nojoy") 
+       if (COM_CheckParm ("-nojoy") || COM_CheckParm("-safe")
                return; 
  
        // verify joystick driver is present
@@ -1002,10 +952,8 @@ qboolean IN_ReadJoystick (void)
        else
        {
                // read error occurred
-               // turning off the joystick seems too harsh for 1 read error,\
+               // turning off the joystick seems too harsh for 1 read error,
                // but what should be done?
-               // Con_Printf ("IN_ReadJoystick: no response\n");
-               // joy_avail = false;
                return false;
        }
 }
@@ -1182,10 +1130,5 @@ void IN_JoyMove (usercmd_t *cmd)
                        break;
                }
        }
-
-       // bounds check pitch
-       if (cl.viewangles[PITCH] > 80.0)
-               cl.viewangles[PITCH] = 80.0;
-       if (cl.viewangles[PITCH] < -70.0)
-               cl.viewangles[PITCH] = -70.0;
 }
+