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 c84c6d6..bf31dbe 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 4d5ddbe..94c3437 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 2df5d6f..7339528 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 8124ed7..5fa9867 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 d27ab4a..e7ce03c 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);
 }