From 241f521388f39d8145d5036ebb1969baaf98006d Mon Sep 17 00:00:00 2001 From: lordhavoc Date: Mon, 25 Feb 2002 08:31:17 +0000 Subject: [PATCH] added in_pitch_min and in_pitch_max cvars to limit pitch (default: -90 to +90) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@1568 d7cf8633-e32d-0410-b094-e92efae38249 --- in_svgalib.c | 7 +------ in_win.c | 9 ++------- vid.h | 3 +++ vid_glx.c | 4 +--- vid_shared.c | 5 +++++ 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/in_svgalib.c b/in_svgalib.c index c84c6d65..bf31dbe1 100644 --- a/in_svgalib.c +++ b/in_svgalib.c @@ -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) diff --git a/in_win.c b/in_win.c index 4d5ddbe9..94c34373 100644 --- 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 2df5d6fc..73395282 100644 --- 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); diff --git a/vid_glx.c b/vid_glx.c index 8124ed71..5fa9867b 100644 --- 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); } diff --git a/vid_shared.c b/vid_shared.c index d27ab4ae..e7ce03c5 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -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); } -- 2.39.2