mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
Minor comment updates, Imt->IMT in a few function names, and accel->amp for input amplification (once known as sensitivity).
This commit is contained in:
parent
80696badc7
commit
36395e1681
4 changed files with 48 additions and 91 deletions
|
@ -361,7 +361,7 @@ typedef enum {
|
|||
IMT_15,
|
||||
IMT_16,
|
||||
IMT_LAST,
|
||||
} imt_t;
|
||||
} imt_t; // Input Mapping Table
|
||||
|
||||
// key_none should, preferably, be last
|
||||
typedef enum {key_game, key_console, key_message, key_none} keydest_t;
|
||||
|
|
|
@ -57,11 +57,13 @@
|
|||
#include "QF/mathlib.h"
|
||||
|
||||
cvar_t *_windowed_mouse;
|
||||
cvar_t *in_mouse_filter;
|
||||
cvar_t *in_mouse_pre_accel;
|
||||
cvar_t *in_mouse_accel;
|
||||
cvar_t *lookstrafe;
|
||||
cvar_t *in_amp;
|
||||
cvar_t *in_pre_amp;
|
||||
cvar_t *in_freelook;
|
||||
cvar_t *in_mouse_filter;
|
||||
cvar_t *in_mouse_amp;
|
||||
cvar_t *in_mouse_pre_amp;
|
||||
cvar_t *lookstrafe;
|
||||
|
||||
kbutton_t in_mlook, in_klook;
|
||||
kbutton_t in_strafe;
|
||||
|
@ -71,6 +73,7 @@ qboolean in_mouse_avail;
|
|||
float in_mouse_x, in_mouse_y;
|
||||
static float in_old_mouse_x, in_old_mouse_y;
|
||||
|
||||
|
||||
void
|
||||
IN_Commands (void)
|
||||
{
|
||||
|
@ -79,7 +82,6 @@ IN_Commands (void)
|
|||
IN_LL_Commands ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_SendKeyEvents (void)
|
||||
{
|
||||
|
@ -87,7 +89,6 @@ IN_SendKeyEvents (void)
|
|||
IN_LL_SendKeyEvents ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_Move (void)
|
||||
{
|
||||
|
@ -96,8 +97,8 @@ IN_Move (void)
|
|||
if (!in_mouse_avail)
|
||||
return;
|
||||
|
||||
in_mouse_x *= in_mouse_pre_accel->value;
|
||||
in_mouse_y *= in_mouse_pre_accel->value;
|
||||
in_mouse_x *= in_mouse_pre_amp->value *= in_pre_amp->value;
|
||||
in_mouse_y *= in_mouse_pre_amp->value *= in_pre_amp->value;
|
||||
|
||||
if (in_mouse_filter->int_val) {
|
||||
in_mouse_x = (in_mouse_x + in_old_mouse_x) * 0.5;
|
||||
|
@ -107,8 +108,8 @@ IN_Move (void)
|
|||
in_old_mouse_y = in_mouse_y;
|
||||
}
|
||||
|
||||
in_mouse_x *= in_mouse_accel->value;
|
||||
in_mouse_y *= in_mouse_accel->value;
|
||||
in_mouse_x *= in_mouse_amp->value *= in_amp->value;
|
||||
in_mouse_y *= in_mouse_amp->value *= in_amp->value;
|
||||
|
||||
if ((in_strafe.state & 1) || (lookstrafe->int_val && freelook))
|
||||
viewdelta.position[0] += in_mouse_x;
|
||||
|
@ -155,17 +156,20 @@ IN_Init_Cvars (void)
|
|||
JOY_Init_Cvars ();
|
||||
_windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, NULL,
|
||||
"With this set to 1, quake will grab the mouse from X");
|
||||
in_amp = Cvar_Get ("in_amp", "1", CVAR_ARCHIVE, NULL,
|
||||
"global in_amp multiplier");
|
||||
in_pre_amp = Cvar_Get ("in_pre_amp", "1", CVAR_ARCHIVE, NULL,
|
||||
"global in_pre_amp multiplier");
|
||||
in_freelook = Cvar_Get ("freelook", "0", CVAR_ARCHIVE, NULL,
|
||||
"force +mlook");
|
||||
|
||||
"force +mlook");
|
||||
in_mouse_filter = Cvar_Get ("in_mouse_filter", "0", CVAR_ARCHIVE, NULL,
|
||||
"Toggle mouse input filtering.");
|
||||
in_mouse_amp = Cvar_Get ("in_mouse_amp", "15", CVAR_ARCHIVE, NULL,
|
||||
"mouse in_mouse_amp multiplier");
|
||||
in_mouse_pre_amp = Cvar_Get ("in_mouse_pre_amp", "1", CVAR_ARCHIVE, NULL,
|
||||
"mouse in_mouse_pre_amp multiplier");
|
||||
lookstrafe = Cvar_Get ("lookstrafe", "0", CVAR_ARCHIVE, NULL,
|
||||
"when mlook/klook on player will strafe");
|
||||
in_mouse_filter = Cvar_Get ("in_mouse_filter", "0", CVAR_ARCHIVE, NULL,
|
||||
"Toggle mouse input filtering.");
|
||||
in_mouse_pre_accel = Cvar_Get ("in_mouse_pre_accel", "1", CVAR_ARCHIVE,
|
||||
NULL, "mouse in_mouse_pre_accel multiplier");
|
||||
in_mouse_accel = Cvar_Get ("in_mouse_accel", "3", CVAR_ARCHIVE, NULL,
|
||||
"mouse in_mouse_accel multiplier");
|
||||
IN_LL_Init_Cvars ();
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,6 @@
|
|||
|
||||
cvar_t *in_snd_block;
|
||||
cvar_t *in_dga;
|
||||
cvar_t *in_dga_mouseaccel;
|
||||
|
||||
static qboolean dga_avail;
|
||||
static qboolean dga_active;
|
||||
|
@ -545,8 +544,6 @@ IN_LL_Init_Cvars (void)
|
|||
"block sound output on window focus loss");
|
||||
in_dga = Cvar_Get ("in_dga", "1", CVAR_ARCHIVE, NULL,
|
||||
"DGA Input support");
|
||||
in_dga_mouseaccel = Cvar_Get ("in_dga_mouseaccel", "1", CVAR_ARCHIVE, NULL,
|
||||
"DGA Mouse accelleration multiplier");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -394,7 +394,6 @@ keyname_t keynames[] = {
|
|||
LINE TYPING INTO THE CONSOLE
|
||||
*/
|
||||
|
||||
|
||||
qboolean
|
||||
CheckForCommand (void)
|
||||
{
|
||||
|
@ -420,11 +419,9 @@ CheckForCommand (void)
|
|||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
Key_Game
|
||||
Key_Game
|
||||
|
||||
Game key handling.
|
||||
====================
|
||||
Game key handling.
|
||||
*/
|
||||
qboolean
|
||||
Key_Game (knum_t key, short unicode)
|
||||
|
@ -461,11 +458,9 @@ Key_Game (knum_t key, short unicode)
|
|||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
Key_Console
|
||||
Key_Console
|
||||
|
||||
Interactive line editing and console scrollback
|
||||
====================
|
||||
Interactive line editing and console scrollback
|
||||
*/
|
||||
void
|
||||
Key_Console (knum_t key, short unicode)
|
||||
|
@ -478,7 +473,7 @@ Key_Console (knum_t key, short unicode)
|
|||
if (Key_Game (key, unicode))
|
||||
return;
|
||||
|
||||
if (unicode == '\x0D' || key == K_RETURN) { // backslash text are commands, else
|
||||
if (unicode == '\x0D' || key == K_RETURN) { // backslash text are commands, else
|
||||
if (!strncmp(key_lines[edit_line], "//", 2))
|
||||
goto no_lf;
|
||||
else if (key_lines[edit_line][1] == '\\' ||
|
||||
|
@ -651,18 +646,14 @@ Key_Message (knum_t key, short unicode)
|
|||
|
||||
//============================================================================
|
||||
|
||||
|
||||
/*
|
||||
===================
|
||||
Key_StringToImtnum
|
||||
|
||||
Returns a imt number to be used to index imtbindings[] by looking at
|
||||
the given string. Single ascii characters return themselves, while
|
||||
the K_* names are matched up.
|
||||
===================
|
||||
Key_StringToIMTnum
|
||||
Returns an imt number to be used to index imtbindings[] by looking at
|
||||
the given string. Single ascii characters return themselves, while
|
||||
the K_* names are matched up.
|
||||
*/
|
||||
int
|
||||
Key_StringToImtnum (const char *str)
|
||||
Key_StringToIMTnum (const char *str)
|
||||
{
|
||||
imtname_t *kn;
|
||||
|
||||
|
@ -677,15 +668,13 @@ Key_StringToImtnum (const char *str)
|
|||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
Key_ImtnumToString
|
||||
Key_IMTnumToString
|
||||
|
||||
Returns a string (a K_* name) for the
|
||||
given imtnum.
|
||||
===================
|
||||
Returns a string (a K_* name) for the given imtnum.
|
||||
FIXME: handle quote special (general escape sequence?)
|
||||
*/
|
||||
char *
|
||||
Key_ImtnumToString (const int imtnum)
|
||||
Key_IMTnumToString (const int imtnum)
|
||||
{
|
||||
imtname_t *kn;
|
||||
|
||||
|
@ -747,18 +736,12 @@ Key_KeynumToString (knum_t keynum)
|
|||
return "<UNKNOWN KEYNUM>";
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
Key_In_Unbind_f
|
||||
===================
|
||||
*/
|
||||
|
||||
void
|
||||
Key_In_Unbind (const char *imt, const char *key)
|
||||
{
|
||||
int t, b;
|
||||
|
||||
t = Key_StringToImtnum (imt);
|
||||
t = Key_StringToIMTnum (imt);
|
||||
if (t == -1) {
|
||||
Con_Printf ("\"%s\" isn't a valid imt\n", imt);
|
||||
return;
|
||||
|
@ -793,19 +776,12 @@ Key_Unbindall_f (void)
|
|||
Key_SetBinding (j, i, NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===================
|
||||
Key_In_Bind_f
|
||||
===================
|
||||
*/
|
||||
|
||||
void
|
||||
Key_In_Bind (const char *imt, const char *key, const char *cmd)
|
||||
{
|
||||
int t, b;
|
||||
|
||||
t = Key_StringToImtnum (imt);
|
||||
t = Key_StringToIMTnum (imt);
|
||||
if (t == -1) {
|
||||
Con_Printf ("\"%s\" isn't a valid imt\n", imt);
|
||||
return;
|
||||
|
@ -906,18 +882,13 @@ Key_Bind_f (void)
|
|||
void
|
||||
in_bind_imt_f (cvar_t *var)
|
||||
{
|
||||
if (Key_StringToImtnum (var->string) == -1) {
|
||||
if (Key_StringToIMTnum (var->string) == -1) {
|
||||
Con_Printf ("\"%s\" is not a valid imt. setting to \"imt_default\"\n",
|
||||
var->string);
|
||||
Cvar_Set (var, "imt_default");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
Key_GameTarget_f
|
||||
===================
|
||||
*/
|
||||
void
|
||||
Key_InputMappingTable_f (void)
|
||||
{
|
||||
|
@ -926,12 +897,12 @@ Key_InputMappingTable_f (void)
|
|||
c = Cmd_Argc ();
|
||||
|
||||
if (c != 2) {
|
||||
Con_Printf ("Current imt is %s\n", Key_ImtnumToString(game_target));
|
||||
Con_Printf ("Current imt is %s\n", Key_IMTnumToString(game_target));
|
||||
Con_Printf ("imt <imt> : set to a specific input mapping table\n");
|
||||
return;
|
||||
}
|
||||
|
||||
t = Key_StringToImtnum (Cmd_Argv (1));
|
||||
t = Key_StringToIMTnum (Cmd_Argv (1));
|
||||
if (t == -1) {
|
||||
Con_Printf ("\"%s\" isn't a valid imt\n", Cmd_Argv (1));
|
||||
return;
|
||||
|
@ -941,11 +912,9 @@ Key_InputMappingTable_f (void)
|
|||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Key_WriteBindings
|
||||
Key_WriteBindings
|
||||
|
||||
Writes lines containing "bind key value"
|
||||
============
|
||||
Writes lines containing "bind key value"
|
||||
*/
|
||||
void
|
||||
Key_WriteBindings (VFile *f)
|
||||
|
@ -956,17 +925,15 @@ Key_WriteBindings (VFile *f)
|
|||
for (j = 0; j < IMT_LAST; j++)
|
||||
for (i = 0; i < K_LAST; i++)
|
||||
if ((bind = Key_GetBinding(j, i)))
|
||||
Qprintf (f, "in_bind %s %s \"%s\"\n", Key_ImtnumToString (j),
|
||||
Qprintf (f, "in_bind %s %s \"%s\"\n", Key_IMTnumToString (j),
|
||||
Key_KeynumToString (i), bind);
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
Key_Event
|
||||
Key_Event
|
||||
|
||||
Called by the system between frames for both key up and key down events
|
||||
Should NOT be called during an interrupt!
|
||||
===================
|
||||
Called by the system between frames for both key up and key down events
|
||||
Should NOT be called during an interrupt!
|
||||
*/
|
||||
void
|
||||
Key_Event (knum_t key, short unicode, qboolean down)
|
||||
|
@ -1020,11 +987,6 @@ Key_Event (knum_t key, short unicode, qboolean down)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
Key_ClearStates
|
||||
===================
|
||||
*/
|
||||
void
|
||||
Key_ClearStates (void)
|
||||
{
|
||||
|
@ -1037,11 +999,6 @@ Key_ClearStates (void)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
Key_Init
|
||||
===================
|
||||
*/
|
||||
void
|
||||
Key_Init (void)
|
||||
{
|
||||
|
@ -1065,7 +1022,6 @@ Key_Init (void)
|
|||
Cmd_AddCommand ("unbindall", Key_Unbindall_f,
|
||||
"Remove all binds (USE CAUTIOUSLY!!!)");
|
||||
Cmd_AddCommand ("imt", Key_InputMappingTable_f, "");
|
||||
|
||||
Cmd_AddCommand ("bind", Key_Bind_f,
|
||||
"wrapper for in_bind that uses in_bind_imt for the imt "
|
||||
"parameter");
|
||||
|
|
Loading…
Reference in a new issue