]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
added in_pitch_min and in_pitch_max cvars to limit pitch (default: -90 to +90)
authorlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 25 Feb 2002 08:31:17 +0000 (08:31 +0000)
committerlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 25 Feb 2002 08:31:17 +0000 (08:31 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@1568 d7cf8633-e32d-0410-b094-e92efae38249

in_svgalib.c
in_win.c
vid.h
vid_glx.c
vid_shared.c

index c84c6d65fc872715869933098f35456b8b15b13d..bf31dbe12e28c571b8a52d4d8e9721ed1c663b2f 100644 (file)
@@ -368,13 +368,7 @@ void IN_Move(usercmd_t *cmd)
 
        // 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;
-               if (cl.viewangles[PITCH] > 90)
-                       cl.viewangles[PITCH] = 90;
-               if (cl.viewangles[PITCH] < -90)
-                       cl.viewangles[PITCH] = -90;
-       }
        else
        {
                if ((in_strafe.state & 1) && noclip_anglehack)
@@ -382,6 +376,7 @@ void IN_Move(usercmd_t *cmd)
                else
                        cmd->forwardmove -= m_forward.value * mouse_y;
        }
+       cl.viewangles[PITCH] = bound (in_pitch_min.value, cl.viewangles[PITCH], in_pitch_max.value);
 }
 
 void IN_HandlePause (qboolean pause)
index 4d5ddbe9704cd720f418307a5b8aca37ebe10992..94c343731e41555ee7385df723cd936c78e33d2a 100644 (file)
--- a/in_win.c
+++ b/in_win.c
@@ -665,13 +665,7 @@ void IN_MouseMove (usercmd_t *cmd)
        
        // 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;
-               if (cl.viewangles[PITCH] > 90)
-                       cl.viewangles[PITCH] = 90;
-               if (cl.viewangles[PITCH] < -90)
-                       cl.viewangles[PITCH] = -90;
-       }
        else
        {
                if ((in_strafe.state & 1) && noclip_anglehack)
@@ -695,12 +689,13 @@ IN_Move
 */
 void IN_Move (usercmd_t *cmd)
 {
-
        if (ActiveApp && !Minimized)
        {
                IN_MouseMove (cmd);
                IN_JoyMove (cmd);
        }
+
+       cl.viewangles[PITCH] = bound (in_pitch_min.value, cl.viewangles[PITCH], in_pitch_max.value);
 }
 
 
diff --git a/vid.h b/vid.h
index 2df5d6fc0fc6c99b862e64384f5a77351164f24a..7339528258059e5d896a3f0d4321e58284426918 100644 (file)
--- a/vid.h
+++ b/vid.h
@@ -40,6 +40,9 @@ extern cvar_t vid_mode;
 extern cvar_t vid_mouse;
 extern cvar_t vid_fullscreen;
 
+extern cvar_t in_pitch_min;
+extern cvar_t in_pitch_max;
+
 void VID_InitCvars(void);
 
 void GL_Init (void);
index 8124ed710a69ae703e85770c0b5bbe62b9bcbaae..5fa9867b6ec74b5c0ee2dcf8019a0e8f8e363f88 100644 (file)
--- a/vid_glx.c
+++ b/vid_glx.c
@@ -862,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)
@@ -879,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);
 }
 
 
index d27ab4ae2b5b71b6b49df1b9010e14f089142980..e7ce03c51fc235c7abd20fc1fbd2ee25151d5f14 100644 (file)
@@ -17,6 +17,9 @@ cvar_t vid_mouse = {CVAR_SAVE, "vid_mouse", "1"};
 cvar_t vid_fullscreen = {0, "vid_fullscreen", "1"};
 cvar_t gl_combine = {0, "gl_combine", "1"};
 
+cvar_t in_pitch_min = {0, "in_pitch_min", "-90"};
+cvar_t in_pitch_max = {0, "in_pitch_max", "90"};
+
 // GL_ARB_multitexture
 void (GLAPIENTRY *qglMultiTexCoord2f) (GLenum, GLfloat, GLfloat);
 void (GLAPIENTRY *qglActiveTexture) (GLenum);
@@ -168,5 +171,7 @@ void VID_InitCvars(void)
        Cvar_RegisterVariable(&vid_mouse);
        Cvar_RegisterVariable(&vid_fullscreen);
        Cvar_RegisterVariable(&gl_combine);
+       Cvar_RegisterVariable(&in_pitch_min);
+       Cvar_RegisterVariable(&in_pitch_max);
        Cmd_AddCommand("force_centerview", Force_CenterView_f);
 }