Diff noise reduction

This commit is contained in:
Adam Olsen 2001-07-15 00:03:11 +00:00
parent 66c8f00dc7
commit fb0fe95e7e
2 changed files with 91 additions and 59 deletions

View file

@ -1,7 +1,7 @@
/*
cl_input.c
@description@
builds an intended movement command to send to the server
Copyright (C) 1996-1997 Id Software, Inc.
@ -48,20 +48,20 @@
#include "host.h"
/*
KEY BUTTONS
KEY BUTTONS
Continuous button event tracking is complicated by the fact that two different
input sources (say, mouse button 1 and the control key) can both press the
same button, but the button should only be released when both of the
pressing key have been released.
Continuous button event tracking is complicated by the fact that two
different input sources (say, mouse button 1 and the control key) can
both press the same button, but the button should only be released when
both of the pressing key have been released.
When a key event issues a button command (+forward, +attack, etc), it appends
its key number as a parameter to the command so it can be matched up with
the release.
When a key event issues a button command (+forward, +attack, etc), it
appends its key number as a parameter to the command so it can be
matched up with the release.
state bit 0 is the current state of the key
state bit 1 is edge triggered on the up to down transition
state bit 2 is edge triggered on the down to up transition
state bit 0 is the current state of the key
state bit 1 is edge triggered on the up to down transition
state bit 2 is edge triggered on the down to up transition
*/
@ -85,7 +85,7 @@ KeyDown (kbutton_t *b)
k = atoi (c);
else
k = -1; // typed manually at the console for
// continuous down
// continuous down
if (k == b->down[0] || k == b->down[1])
return; // repeating key
@ -104,7 +104,6 @@ KeyDown (kbutton_t *b)
b->state |= 1 + 2; // down + impulse down
}
void
KeyUp (kbutton_t *b)
{
@ -115,8 +114,8 @@ KeyUp (kbutton_t *b)
if (c[0])
k = atoi (c);
else { // typed manually at the console,
// assume for unsticking, so clear
// all
// assume for unsticking, so clear
// all
b->down[0] = b->down[1] = 0;
b->state = 4; // impulse up
return;
@ -128,12 +127,10 @@ KeyUp (kbutton_t *b)
b->down[1] = 0;
else
return; // key up without coresponding down
// (menu pass through)
// (menu pass through)
if (b->down[0] || b->down[1])
return; // some other key is still holding it
//
//
// down
// down
if (!(b->state & 1))
return; // still up (this should not happen)
@ -438,6 +435,8 @@ CL_KeyState (kbutton_t *key)
}
//==========================================================================
cvar_t *cl_anglespeedkey;
cvar_t *cl_backspeed;
cvar_t *cl_forwardspeed;
@ -539,9 +538,6 @@ CL_BaseMove (usercmd_t *cmd)
cmd->sidemove *= cl_movespeedkey->value;
cmd->upmove *= cl_movespeedkey->value;
}
#ifdef QUAKE2
cmd->lightlevel = cl.light_level;
#endif
if (freelook)
V_StopPitchDrift ();
@ -634,39 +630,75 @@ CL_SendMove (usercmd_t *cmd)
void
CL_InitInput (void)
{
Cmd_AddCommand ("+moveup", IN_UpDown, "No Description");
Cmd_AddCommand ("-moveup", IN_UpUp, "No Description");
Cmd_AddCommand ("+movedown", IN_DownDown, "No Description");
Cmd_AddCommand ("-movedown", IN_DownUp, "No Description");
Cmd_AddCommand ("+left", IN_LeftDown, "No Description");
Cmd_AddCommand ("-left", IN_LeftUp, "No Description");
Cmd_AddCommand ("+right", IN_RightDown, "No Description");
Cmd_AddCommand ("-right", IN_RightUp, "No Description");
Cmd_AddCommand ("+forward", IN_ForwardDown, "No Description");
Cmd_AddCommand ("-forward", IN_ForwardUp, "No Description");
Cmd_AddCommand ("+back", IN_BackDown, "No Description");
Cmd_AddCommand ("-back", IN_BackUp, "No Description");
Cmd_AddCommand ("+lookup", IN_LookupDown, "No Description");
Cmd_AddCommand ("-lookup", IN_LookupUp, "No Description");
Cmd_AddCommand ("+lookdown", IN_LookdownDown, "No Description");
Cmd_AddCommand ("-lookdown", IN_LookdownUp, "No Description");
Cmd_AddCommand ("+strafe", IN_StrafeDown, "No Description");
Cmd_AddCommand ("-strafe", IN_StrafeUp, "No Description");
Cmd_AddCommand ("+moveleft", IN_MoveleftDown, "No Description");
Cmd_AddCommand ("-moveleft", IN_MoveleftUp, "No Description");
Cmd_AddCommand ("+moveright", IN_MoverightDown, "No Description");
Cmd_AddCommand ("-moveright", IN_MoverightUp, "No Description");
Cmd_AddCommand ("+speed", IN_SpeedDown, "No Description");
Cmd_AddCommand ("-speed", IN_SpeedUp, "No Description");
Cmd_AddCommand ("+attack", IN_AttackDown, "No Description");
Cmd_AddCommand ("-attack", IN_AttackUp, "No Description");
Cmd_AddCommand ("+use", IN_UseDown, "No Description");
Cmd_AddCommand ("-use", IN_UseUp, "No Description");
Cmd_AddCommand ("+jump", IN_JumpDown, "No Description");
Cmd_AddCommand ("-jump", IN_JumpUp, "No Description");
Cmd_AddCommand ("impulse", IN_Impulse, "No Description");
Cmd_AddCommand ("+klook", IN_KLookDown, "No Description");
Cmd_AddCommand ("-klook", IN_KLookUp, "No Description");
Cmd_AddCommand ("+mlook", IN_MLookDown, "No Description");
Cmd_AddCommand ("-mlook", IN_MLookUp, "No Description");
Cmd_AddCommand ("+moveup", IN_UpDown, "When active the player is swimming "
"up in a liquid");
Cmd_AddCommand ("-moveup", IN_UpUp, "When active the player is not "
"swimming up in a liquid");
Cmd_AddCommand ("+movedown", IN_DownDown, "When active the player is "
"swimming down in a liquid");
Cmd_AddCommand ("-movedown", IN_DownUp, "When active the player is not "
"swimming down in a liquid");
Cmd_AddCommand ("+left", IN_LeftDown, "When active the player is turning "
"left");
Cmd_AddCommand ("-left", IN_LeftUp, "When active the player is not turning"
" left");
Cmd_AddCommand ("+right", IN_RightDown, "When active the player is "
"turning right");
Cmd_AddCommand ("-right", IN_RightUp, "When active the player is not "
"turning right");
Cmd_AddCommand ("+forward", IN_ForwardDown, "When active the player is "
"moving forward");
Cmd_AddCommand ("-forward", IN_ForwardUp, "When active the player is not "
"moving forward");
Cmd_AddCommand ("+back", IN_BackDown, "When active the player is moving "
"backwards");
Cmd_AddCommand ("-back", IN_BackUp, "When active the player is not "
"moving backwards");
Cmd_AddCommand ("+lookup", IN_LookupDown, "When active the player's view "
"is looking up");
Cmd_AddCommand ("-lookup", IN_LookupUp, "When active the player's view is "
"not looking up");
Cmd_AddCommand ("+lookdown", IN_LookdownDown, "When active the player's "
"view is looking down");
Cmd_AddCommand ("-lookdown", IN_LookdownUp, "When active the player's "
"view is not looking up");
Cmd_AddCommand ("+strafe", IN_StrafeDown, "When active, +left and +right "
"function like +moveleft and +moveright");
Cmd_AddCommand ("-strafe", IN_StrafeUp, "When active, +left and +right "
"stop functioning like +moveleft and +moveright");
Cmd_AddCommand ("+moveleft", IN_MoveleftDown, "When active the player is "
"strafing left");
Cmd_AddCommand ("-moveleft", IN_MoveleftUp, "When active the player is "
"not strafing left");
Cmd_AddCommand ("+moveright", IN_MoverightDown, "When active the player "
"is strafing right");
Cmd_AddCommand ("-moveright", IN_MoverightUp, "When active the player is "
"not strafing right");
Cmd_AddCommand ("+speed", IN_SpeedDown, "When active the player is "
"running");
Cmd_AddCommand ("-speed", IN_SpeedUp, "When active the player is not "
"running");
Cmd_AddCommand ("+attack", IN_AttackDown, "When active player is "
"firing/using current weapon");
Cmd_AddCommand ("-attack", IN_AttackUp, "When active player is not "
"firing/using current weapon");
Cmd_AddCommand ("+use", IN_UseDown, "Non-functional. Left over command "
"for opening doors and triggering switches");
Cmd_AddCommand ("-use", IN_UseUp, "Non-functional. Left over command for "
"opening doors and triggering switches");
Cmd_AddCommand ("+jump", IN_JumpDown, "When active the player is jumping");
Cmd_AddCommand ("-jump", IN_JumpUp, "When active the player is not "
"jumping");
Cmd_AddCommand ("impulse", IN_Impulse, "Call a game function or QuakeC "
"function.");
Cmd_AddCommand ("+klook", IN_KLookDown, "When active, +forward and +back "
"perform +lookup and +lookdown");
Cmd_AddCommand ("-klook", IN_KLookUp, "When active, +forward and +back "
"don't perform +lookup and +lookdown");
Cmd_AddCommand ("+mlook", IN_MLookDown, "When active moving the mouse or "
"joystick forwards and backwards performs +lookup and "
"+lookdown");
Cmd_AddCommand ("-mlook", IN_MLookUp, "When active moving the mouse or "
"joystick forwards and backwards doesn't perform +lookup "
"and +lookdown");
}

View file

@ -442,8 +442,8 @@ CL_KeyState (kbutton_t *key)
val = 0.75; // released and re-pressed this frame
else
val = 0.25; // pressed and released this frame
}
key->state &= 1; // clear impulses
return val;