mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-03-23 08:30:58 +00:00
freelook cvar support
This commit is contained in:
parent
2b42f07798
commit
a955b34f46
12 changed files with 34 additions and 30 deletions
|
@ -367,6 +367,7 @@ extern cvar_t *lookstrafe;
|
|||
/* extern cvar_t sensitivity;
|
||||
CVAR_FIXME */
|
||||
extern cvar_t *sensitivity;
|
||||
extern cvar_t *cl_freelook;
|
||||
|
||||
/* extern cvar_t m_pitch;
|
||||
CVAR_FIXME */
|
||||
|
|
|
@ -24,6 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "protocol.h"
|
||||
|
||||
#define freelook (in_mlook.state&1 || cl_freelook->value)
|
||||
|
||||
void IN_Init (void);
|
||||
|
||||
void IN_Shutdown (void);
|
||||
|
|
|
@ -146,9 +146,7 @@ void IN_KLookUp (void) {KeyUp(&in_klook);}
|
|||
void IN_MLookDown (void) {KeyDown(&in_mlook);}
|
||||
void IN_MLookUp (void) {
|
||||
KeyUp(&in_mlook);
|
||||
/* if ( !(in_mlook.state&1) && lookspring.value)
|
||||
CVAR_FIXME */
|
||||
if ( !(in_mlook.state&1) && lookspring->value)
|
||||
if ( !(in_mlook.state&1 || cl_freelook->value) && lookspring->value)
|
||||
V_StartPitchDrift();
|
||||
}
|
||||
void IN_UpDown(void) {KeyDown(&in_up);}
|
||||
|
|
|
@ -110,6 +110,7 @@ cvar_t *lookstrafe;
|
|||
/* cvar_t sensitivity = {"sensitivity","3", true};
|
||||
CVAR_FIXME */
|
||||
cvar_t *sensitivity;
|
||||
cvar_t *cl_freelook;
|
||||
|
||||
/* cvar_t m_pitch = {"m_pitch","0.022", true};
|
||||
CVAR_FIXME */
|
||||
|
@ -1338,6 +1339,7 @@ void CL_InitCvars (void)
|
|||
/* Cvar_RegisterVariable (&sensitivity);
|
||||
CVAR_FIXME */
|
||||
sensitivity = Cvar_Get("sensitivity", "3", CVAR_ARCHIVE, "None");
|
||||
cl_freelook = Cvar_Get("freelook", "0", CVAR_ARCHIVE, "None");
|
||||
|
||||
/* Cvar_RegisterVariable (&m_pitch);
|
||||
CVAR_FIXME */
|
||||
|
|
|
@ -823,7 +823,7 @@ void IN_MouseMove (usercmd_t *cmd)
|
|||
// add mouse X/Y movement to cmd
|
||||
/* if ( (in_strafe.state & 1) || (lookstrafe.value && (in_mlook.state & 1) ))
|
||||
CVAR_FIXME */
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) ))
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->value && freelook))
|
||||
/* cmd->sidemove += m_side.value * mouse_x;
|
||||
CVAR_FIXME */
|
||||
cmd->sidemove += m_side->value * mouse_x;
|
||||
|
@ -832,10 +832,10 @@ void IN_MouseMove (usercmd_t *cmd)
|
|||
CVAR_FIXME */
|
||||
cl.viewangles[YAW] -= m_yaw->value * mouse_x;
|
||||
|
||||
if (in_mlook.state & 1)
|
||||
if (in_freelook)
|
||||
V_StopPitchDrift ();
|
||||
|
||||
if ( (in_mlook.state & 1) && !(in_strafe.state & 1))
|
||||
if ( in_freelook && !(in_strafe.state & 1))
|
||||
{
|
||||
/* cl.viewangles[PITCH] += m_pitch.value * mouse_y;
|
||||
CVAR_FIXME */
|
||||
|
|
|
@ -861,7 +861,7 @@ void IN_MouseMove (usercmd_t *cmd)
|
|||
// add mouse X/Y movement to cmd
|
||||
/* if ( (in_strafe.state & 1) || (lookstrafe.value && (in_mlook.state & 1) ))
|
||||
CVAR_FIXME */
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) ))
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->value && freelook ))
|
||||
/* cmd->sidemove += m_side.value * mouse_x;
|
||||
CVAR_FIXME */
|
||||
cmd->sidemove += m_side->value * mouse_x;
|
||||
|
@ -870,10 +870,10 @@ void IN_MouseMove (usercmd_t *cmd)
|
|||
CVAR_FIXME */
|
||||
cl.viewangles[YAW] -= m_yaw->value * mouse_x;
|
||||
|
||||
if (in_mlook.state & 1)
|
||||
if (in_freelook)
|
||||
V_StopPitchDrift ();
|
||||
|
||||
if ( (in_mlook.state & 1) && !(in_strafe.state & 1))
|
||||
if ( in_freelook && !(in_strafe.state & 1))
|
||||
{
|
||||
/* cl.viewangles[PITCH] += m_pitch.value * mouse_y;
|
||||
CVAR_FIXME */
|
||||
|
|
|
@ -888,7 +888,7 @@ void IN_Move (usercmd_t *cmd)
|
|||
|
||||
/* if ( (in_strafe.state & 1) || (lookstrafe.value && (in_mlook.state & 1) ))
|
||||
CVAR_FIXME */
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) ))
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->value && freelook ))
|
||||
/* cmd->sidemove += m_side.value * mouse_x;
|
||||
CVAR_FIXME */
|
||||
cmd->sidemove += m_side->value * mouse_x;
|
||||
|
@ -896,10 +896,10 @@ void IN_Move (usercmd_t *cmd)
|
|||
/* cl.viewangles[YAW] -= m_yaw.value * mouse_x;
|
||||
CVAR_FIXME */
|
||||
cl.viewangles[YAW] -= m_yaw->value * mouse_x;
|
||||
if (in_mlook.state & 1)
|
||||
if (freelook)
|
||||
V_StopPitchDrift ();
|
||||
|
||||
if ( (in_mlook.state & 1) && !(in_strafe.state & 1)) {
|
||||
if ( freelook && !(in_strafe.state & 1)) {
|
||||
/* cl.viewangles[PITCH] += m_pitch.value * mouse_y;
|
||||
CVAR_FIXME */
|
||||
cl.viewangles[PITCH] += m_pitch->value * mouse_y;
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "console.h"
|
||||
#include "qargs.h"
|
||||
#include "cmd.h"
|
||||
#include "input.h"
|
||||
//#include "dosisms.h"
|
||||
|
||||
#define DINPUT_BUFFERSIZE 16
|
||||
|
@ -804,7 +805,7 @@ void IN_MouseMove (usercmd_t *cmd)
|
|||
// add mouse X/Y movement to cmd
|
||||
/* if ( (in_strafe.state & 1) || (lookstrafe.value && (in_mlook.state & 1) ))
|
||||
CVAR_FIXME */
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) ))
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->value && freelook ))
|
||||
/* cmd->sidemove += m_side.value * mouse_x;
|
||||
CVAR_FIXME */
|
||||
cmd->sidemove += m_side->value * mouse_x;
|
||||
|
@ -813,10 +814,10 @@ void IN_MouseMove (usercmd_t *cmd)
|
|||
CVAR_FIXME */
|
||||
cl.viewangles[YAW] -= m_yaw->value * mouse_x;
|
||||
|
||||
if (in_mlook.state & 1)
|
||||
if (freelook)
|
||||
V_StopPitchDrift ();
|
||||
|
||||
if ( (in_mlook.state & 1) && !(in_strafe.state & 1))
|
||||
if ( freelook && !(in_strafe.state & 1))
|
||||
{
|
||||
/* cl.viewangles[PITCH] += m_pitch.value * mouse_y;
|
||||
CVAR_FIXME */
|
||||
|
@ -1264,7 +1265,7 @@ static void IN_JoyMove (usercmd_t *cmd)
|
|||
case AxisForward:
|
||||
/* if ((joy_advanced.value == 0.0) && (in_mlook.state & 1))
|
||||
CVAR_FIXME */
|
||||
if ((joy_advanced->value == 0.0) && (in_mlook.state & 1))
|
||||
if ((joy_advanced->value == 0.0) && freelook)
|
||||
{
|
||||
// user wants forward control to become look control
|
||||
/* if (fabs(fAxisValue) > joy_pitchthreshold.value)
|
||||
|
@ -1329,7 +1330,7 @@ static void IN_JoyMove (usercmd_t *cmd)
|
|||
case AxisTurn:
|
||||
/* if ((in_strafe.state & 1) || (lookstrafe.value && (in_mlook.state & 1)))
|
||||
CVAR_FIXME */
|
||||
if ((in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1)))
|
||||
if ((in_strafe.state & 1) || (lookstrafe->value && freelook))
|
||||
{
|
||||
// user wants turn control to become side control
|
||||
/* if (fabs(fAxisValue) > joy_sidethreshold.value)
|
||||
|
@ -1366,7 +1367,7 @@ static void IN_JoyMove (usercmd_t *cmd)
|
|||
break;
|
||||
|
||||
case AxisLook:
|
||||
if (in_mlook.state & 1)
|
||||
if (freelook)
|
||||
{
|
||||
/* if (fabs(fAxisValue) > joy_pitchthreshold.value)
|
||||
CVAR_FIXME */
|
||||
|
|
|
@ -967,14 +967,14 @@ IN_Move(usercmd_t *cmd)
|
|||
mouse_x *= sensitivity->value;
|
||||
mouse_y *= sensitivity->value;
|
||||
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) ))
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->value && freelook ))
|
||||
cmd->sidemove += m_side->value * mouse_x;
|
||||
else
|
||||
cl.viewangles[YAW] -= m_yaw->value * mouse_x;
|
||||
if (in_mlook.state & 1)
|
||||
if (freelook)
|
||||
V_StopPitchDrift ();
|
||||
|
||||
if ( (in_mlook.state & 1) && !(in_strafe.state & 1)) {
|
||||
if ( freelook && !(in_strafe.state & 1)) {
|
||||
cl.viewangles[PITCH] += m_pitch->value * mouse_y;
|
||||
if (cl.viewangles[PITCH] > 80)
|
||||
cl.viewangles[PITCH] = 80;
|
||||
|
|
|
@ -850,15 +850,15 @@ void IN_MouseMove (usercmd_t *cmd)
|
|||
mouse_y *= sensitivity->value;
|
||||
|
||||
// add mouse X/Y movement to cmd
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) ))
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->value && freelook ))
|
||||
cmd->sidemove += m_side->value * mouse_x;
|
||||
else
|
||||
cl.viewangles[YAW] -= m_yaw->value * mouse_x;
|
||||
|
||||
if (in_mlook.state & 1)
|
||||
if (freelook)
|
||||
V_StopPitchDrift ();
|
||||
|
||||
if ( (in_mlook.state & 1) && !(in_strafe.state & 1))
|
||||
if ( freelook && !(in_strafe.state & 1))
|
||||
{
|
||||
cl.viewangles[PITCH] += m_pitch->value * mouse_y;
|
||||
if (cl.viewangles[PITCH] > 80)
|
||||
|
|
|
@ -1032,7 +1032,7 @@ void IN_MouseMove (usercmd_t *cmd)
|
|||
// add mouse X/Y movement to cmd
|
||||
/* if ( (in_strafe.state & 1) || (lookstrafe.value && (in_mlook.state & 1) ))
|
||||
CVAR_FIXME */
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) ))
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->value && freelook ))
|
||||
/* cmd->sidemove += m_side.value * mouse_x;
|
||||
CVAR_FIXME */
|
||||
cmd->sidemove += m_side->value * mouse_x;
|
||||
|
@ -1041,10 +1041,10 @@ void IN_MouseMove (usercmd_t *cmd)
|
|||
CVAR_FIXME */
|
||||
cl.viewangles[YAW] -= m_yaw->value * mouse_x;
|
||||
|
||||
if (in_mlook.state & 1)
|
||||
if (freelook)
|
||||
V_StopPitchDrift ();
|
||||
|
||||
if ( (in_mlook.state & 1) && !(in_strafe.state & 1))
|
||||
if ( freelook && !(in_strafe.state & 1))
|
||||
{
|
||||
/* cl.viewangles[PITCH] += m_pitch.value * mouse_y;
|
||||
CVAR_FIXME */
|
||||
|
|
|
@ -1144,7 +1144,7 @@ void IN_Move (usercmd_t *cmd)
|
|||
|
||||
/* if ( (in_strafe.state & 1) || (lookstrafe.value && (in_mlook.state & 1) ))
|
||||
CVAR_FIXME */
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) ))
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->value && freelook ))
|
||||
/* cmd->sidemove += m_side.value * mouse_x;
|
||||
CVAR_FIXME */
|
||||
cmd->sidemove += m_side->value * mouse_x;
|
||||
|
@ -1152,10 +1152,10 @@ void IN_Move (usercmd_t *cmd)
|
|||
/* cl.viewangles[YAW] -= m_yaw.value * mouse_x;
|
||||
CVAR_FIXME */
|
||||
cl.viewangles[YAW] -= m_yaw->value * mouse_x;
|
||||
if (in_mlook.state & 1)
|
||||
if (freelook)
|
||||
V_StopPitchDrift ();
|
||||
|
||||
if ( (in_mlook.state & 1) && !(in_strafe.state & 1)) {
|
||||
if ( freelook && !(in_strafe.state & 1)) {
|
||||
/* cl.viewangles[PITCH] += m_pitch.value * mouse_y;
|
||||
CVAR_FIXME */
|
||||
cl.viewangles[PITCH] += m_pitch->value * mouse_y;
|
||||
|
|
Loading…
Reference in a new issue