mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2024-11-21 11:21:18 +00:00
Bound keys not saved in quotes fix, this caused problems with a binded semilicon
This commit is contained in:
parent
809e15da8a
commit
55406f5c5d
1 changed files with 51 additions and 38 deletions
|
@ -209,7 +209,8 @@ keyname_t keynames[] =
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
qboolean CheckForCommand (void)
|
||||
qboolean
|
||||
CheckForCommand ( void )
|
||||
{
|
||||
char command[128];
|
||||
char *cmd, *s;
|
||||
|
@ -227,12 +228,13 @@ qboolean CheckForCommand (void)
|
|||
cmd = Cmd_CompleteCommand (command);
|
||||
if (!cmd || strcmp (cmd, command))
|
||||
cmd = Cvar_CompleteVariable (command);
|
||||
if (!cmd || strcmp (cmd, command) )
|
||||
if (!cmd || strcmp (cmd, command) )
|
||||
return false; // just a chat message
|
||||
return true;
|
||||
}
|
||||
|
||||
void CompleteCommand (void)
|
||||
void
|
||||
CompleteCommand ( void )
|
||||
{
|
||||
char *cmd, *s;
|
||||
|
||||
|
@ -262,7 +264,8 @@ Key_Console
|
|||
Interactive line editing and console scrollback
|
||||
====================
|
||||
*/
|
||||
void Key_Console (int key)
|
||||
void
|
||||
Key_Console ( int key )
|
||||
{
|
||||
int i;
|
||||
#ifdef _WIN32
|
||||
|
@ -272,8 +275,8 @@ void Key_Console (int key)
|
|||
#endif
|
||||
|
||||
switch (key) {
|
||||
case KP_ENTER:
|
||||
case K_ENTER:
|
||||
case KP_ENTER:
|
||||
case K_ENTER:
|
||||
// backslash text are commands
|
||||
if (key_lines[edit_line][1] == '/' && key_lines[edit_line][2] == '/')
|
||||
goto no_lf;
|
||||
|
@ -332,13 +335,13 @@ no_lf:
|
|||
return;
|
||||
|
||||
case KP_LEFTARROW:
|
||||
case K_LEFTARROW:
|
||||
case K_LEFTARROW:
|
||||
if (key_linepos > 1)
|
||||
key_linepos--;
|
||||
return;
|
||||
|
||||
case KP_UPARROW:
|
||||
case K_UPARROW:
|
||||
case KP_UPARROW:
|
||||
case K_UPARROW:
|
||||
do {
|
||||
history_line = (history_line - 1) & 31;
|
||||
} while (history_line != edit_line
|
||||
|
@ -349,8 +352,8 @@ no_lf:
|
|||
key_linepos = Q_strlen(key_lines[edit_line]);
|
||||
return;
|
||||
|
||||
case KP_DOWNARROW:
|
||||
case K_DOWNARROW:
|
||||
case KP_DOWNARROW:
|
||||
case K_DOWNARROW:
|
||||
if (history_line == edit_line) return;
|
||||
do {
|
||||
history_line = (history_line + 1) & 31;
|
||||
|
@ -367,23 +370,23 @@ no_lf:
|
|||
}
|
||||
return;
|
||||
|
||||
case K_MWHEELUP:
|
||||
case KP_PGUP:
|
||||
case K_PGUP:
|
||||
case K_MWHEELUP:
|
||||
case KP_PGUP:
|
||||
case K_PGUP:
|
||||
if (con->display - con->current + con->numlines > 2)
|
||||
con->display -= 2;
|
||||
return;
|
||||
|
||||
case K_MWHEELDOWN:
|
||||
case KP_PGDN:
|
||||
case K_PGDN:
|
||||
case K_MWHEELDOWN:
|
||||
case KP_PGDN:
|
||||
case K_PGDN:
|
||||
con->display += 2;
|
||||
if (con->display > con->current)
|
||||
con->display = con->current;
|
||||
return;
|
||||
|
||||
case KP_HOME:
|
||||
case K_HOME:
|
||||
case KP_HOME:
|
||||
case K_HOME:
|
||||
if (keydown[K_CTRL])
|
||||
{
|
||||
if (con->numlines > 10)
|
||||
|
@ -393,8 +396,8 @@ no_lf:
|
|||
key_linepos = 1;
|
||||
return;
|
||||
|
||||
case KP_END:
|
||||
case K_END:
|
||||
case KP_END:
|
||||
case K_END:
|
||||
if (keydown[K_CTRL])
|
||||
con->display = con->current;
|
||||
else
|
||||
|
@ -450,7 +453,8 @@ qboolean chat_team;
|
|||
char chat_buffer[MAXCMDLINE];
|
||||
int chat_bufferlen = 0;
|
||||
|
||||
void Key_Message (int key)
|
||||
void
|
||||
Key_Message ( int key )
|
||||
{
|
||||
|
||||
if (key == K_ENTER || key == KP_ENTER)
|
||||
|
@ -490,7 +494,7 @@ void Key_Message (int key)
|
|||
}
|
||||
|
||||
if (chat_bufferlen == sizeof(chat_buffer)-1)
|
||||
return; // all full
|
||||
return; // all full
|
||||
|
||||
chat_buffer[chat_bufferlen++] = key;
|
||||
chat_buffer[chat_bufferlen] = 0;
|
||||
|
@ -508,7 +512,8 @@ the given string. Single ascii characters return themselves, while
|
|||
the K_* names are matched up.
|
||||
===================
|
||||
*/
|
||||
int Key_StringToKeynum (char *str)
|
||||
int
|
||||
Key_StringToKeynum ( char *str )
|
||||
{
|
||||
keyname_t *kn;
|
||||
|
||||
|
@ -534,7 +539,8 @@ given keynum.
|
|||
FIXME: handle quote special (general escape sequence?)
|
||||
===================
|
||||
*/
|
||||
char *Key_KeynumToString (int keynum)
|
||||
char *
|
||||
Key_KeynumToString ( int keynum )
|
||||
{
|
||||
keyname_t *kn;
|
||||
static char tinystr[2];
|
||||
|
@ -561,7 +567,8 @@ char *Key_KeynumToString (int keynum)
|
|||
Key_SetBinding
|
||||
===================
|
||||
*/
|
||||
void Key_SetBinding (int keynum, char *binding)
|
||||
void
|
||||
Key_SetBinding ( int keynum, char *binding )
|
||||
{
|
||||
char *new;
|
||||
int l;
|
||||
|
@ -596,7 +603,8 @@ void Key_SetBinding (int keynum, char *binding)
|
|||
Key_Unbind_f
|
||||
===================
|
||||
*/
|
||||
void Key_Unbind_f (void)
|
||||
void
|
||||
Key_Unbind_f ( void )
|
||||
{
|
||||
int b;
|
||||
|
||||
|
@ -616,7 +624,8 @@ void Key_Unbind_f (void)
|
|||
Key_SetBinding (b, "");
|
||||
}
|
||||
|
||||
void Key_Unbindall_f (void)
|
||||
void
|
||||
Key_Unbindall_f ( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -631,7 +640,8 @@ void Key_Unbindall_f (void)
|
|||
Key_Bind_f
|
||||
===================
|
||||
*/
|
||||
void Key_Bind_f (void)
|
||||
void
|
||||
Key_Bind_f ( void )
|
||||
{
|
||||
int i, c, b;
|
||||
char cmd[1024];
|
||||
|
@ -678,13 +688,14 @@ Key_WriteBindings
|
|||
Writes lines containing "bind key value"
|
||||
============
|
||||
*/
|
||||
void Key_WriteBindings (QFile *f)
|
||||
void
|
||||
Key_WriteBindings ( QFile *f )
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0 ; i<256 ; i++)
|
||||
if (keybindings[i])
|
||||
Qprintf (f, "bind %s \"%s\"\n", Key_KeynumToString(i), keybindings[i]);
|
||||
Qprintf (f, "bind \"%s\" \"%s\"\n", Key_KeynumToString(i), keybindings[i]); // 1999-12-26 bound keys not saved in quotes fix by Maddes
|
||||
}
|
||||
|
||||
|
||||
|
@ -693,7 +704,8 @@ void Key_WriteBindings (QFile *f)
|
|||
Key_Init
|
||||
===================
|
||||
*/
|
||||
void Key_Init (void)
|
||||
void
|
||||
Key_Init ( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -788,12 +800,13 @@ Called by the system between frames for both key up and key down events
|
|||
Should NOT be called during an interrupt!
|
||||
===================
|
||||
*/
|
||||
void Key_Event (int key, qboolean down)
|
||||
void
|
||||
Key_Event ( int key, qboolean down )
|
||||
{
|
||||
char *kb;
|
||||
char cmd[1024];
|
||||
|
||||
// Con_Printf ("%i : %i\n", key, down); //@@@
|
||||
// Con_Printf ("%i : %i\n", key, down); //@@@
|
||||
|
||||
keydown[key] = down;
|
||||
|
||||
|
@ -823,7 +836,7 @@ void Key_Event (int key, qboolean down)
|
|||
|
||||
if (key_dest == key_message && cls.state != ca_active)
|
||||
key_dest = key_console;
|
||||
|
||||
|
||||
//
|
||||
// handle escape specialy, so the user can never unbind it
|
||||
//
|
||||
|
@ -880,7 +893,7 @@ void Key_Event (int key, qboolean down)
|
|||
// during demo playback, most keys bring up the main menu
|
||||
//
|
||||
if (cls.demoplayback && down && consolekeys[key] && key_dest == key_game
|
||||
&& key != K_CTRL && key != K_DEL && key != K_HOME && key != K_END && key != K_TAB)
|
||||
&& key != K_CTRL && key != K_DEL && key != K_HOME && key != K_END && key != K_TAB)
|
||||
{
|
||||
M_ToggleMenu_f ();
|
||||
return;
|
||||
|
@ -941,7 +954,8 @@ void Key_Event (int key, qboolean down)
|
|||
Key_ClearStates
|
||||
===================
|
||||
*/
|
||||
void Key_ClearStates (void)
|
||||
void
|
||||
Key_ClearStates ( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -951,4 +965,3 @@ void Key_ClearStates (void)
|
|||
key_repeats[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue