Can't stop spinning
Moderator: InsideQC Admins
24 posts
• Page 2 of 2 • 1, 2
The spinning only happens when I have forward, backward, left, right, strafe left, strafe right bound to keys that are letters. The spinning doesn't happen if I use the arrow keys..

Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.
Get off my lawn!
-

dreadlorde - Posts: 268
- Joined: Tue Nov 24, 2009 2:20 am
A good read ...
viewtopic.php?t=1257
Possibly related to your problem. If you are exiting and entering the focus of the Quake window, it is possible that Quake stupidly is doing a Keyup simulated keypress for every key on your keyboard.
It does on Windows, leading to annoying results on ALT-TAB.
If you really want to find out fast do this in config.cfg
alias +testkeys "say my key has been pressed"
alias -testkeys "say my key has been released"
bind x +testkeys
If you see "my key has been released" print in the console when you never even pressed the key, doing the tutorial linked in this post may very well solve your problems.
viewtopic.php?t=1257
Possibly related to your problem. If you are exiting and entering the focus of the Quake window, it is possible that Quake stupidly is doing a Keyup simulated keypress for every key on your keyboard.
It does on Windows, leading to annoying results on ALT-TAB.
If you really want to find out fast do this in config.cfg
alias +testkeys "say my key has been pressed"
alias -testkeys "say my key has been released"
bind x +testkeys
If you see "my key has been released" print in the console when you never even pressed the key, doing the tutorial linked in this post may very well solve your problems.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
The message never showed up. 
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.
Get off my lawn!
-

dreadlorde - Posts: 268
- Joined: Tue Nov 24, 2009 2:20 am
dreadlorde wrote:The spinning only happens when I have forward, backward, left, right, strafe left, strafe right bound to keys that are letters. The spinning doesn't happen if I use the arrow keys..
dreadlorde wrote:The message never showed up.
Ok, but this still is enough information that you should be able to do some debug catching.
You are saying that the spinning is related to keypresses because of the top quote.
All keypresses flow through the Key_Event handler. Certainly you put some Con_Printfs in there to print to the console when that gets called.
Like Con_Printf("Key_Event ... key = %i", mykey); or whatever.
Whenever a situation has "only happens when" you have enough information to trap the problem and get more information about why it is happening.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
So I've learned more C, more about the engine and I've read Baker's ``Fixing annoying -alias keypress in standard Quake'' tutorial. But I'm still not sure where to call Key_ClearStates from. The Key_ClearStates I'm using is the same as Baker's version:
- Code: Select all
void
Key_ClearStates(void) {
int i;
for(i = 0; i < 256; i++)
if(keydown[i])
Key_Event(i, false);
}
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.
Get off my lawn!
-

dreadlorde - Posts: 268
- Joined: Tue Nov 24, 2009 2:20 am
Calling Key_ClearStates() from cl_input:/^CL_ParseServerInfo/, right after the call to CL_ClearState() seems to fix the issue.

Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.
Get off my lawn!
-

dreadlorde - Posts: 268
- Joined: Tue Nov 24, 2009 2:20 am
dreadlorde wrote:Calling Key_ClearStates() from cl_input:/^CL_ParseServerInfo/, right after the call to CL_ClearState() seems to fix the issue.
Cool.
I wish I had a dedicated Linux machine. Had my Linux machine not gotten broke, ProQuake Linux would be entirely Windows equivalent in functionality. In fact, at the time my Linux machine broke I was ramping up revision after revision after revision.
Oh well ... eventually I'll have a dedicated Linux machine again. Virtual Box just doesn't cut it and I don't have a good candidate machine for dual booting.
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
dreadlorde wrote:The spinning only happens when I have forward, backward, left, right, strafe left, strafe right bound to keys that are letters. The spinning doesn't happen if I use the arrow keys..
It seems to be related to the usage of the consolekeys array then. Search for all occurrences of "consolekeys" in all files to check it out.
-

mankrip - Posts: 915
- Joined: Fri Jul 04, 2008 3:02 am
``consolekeys'' is only used in keys.c:mk wrote:It seems to be related to the usage of the consolekeys array then. Search for all occurrences of "consolekeys" in all files to check it out.
- Code: Select all
[~/src/proj/quake-hg]% grep consolekeys *
keys.c:qboolean consolekeys[256]; // if true, can't be rebound while in console
keys.c: consolekeys[i] = true;
keys.c: consolekeys[K_ENTER] = true;
keys.c: consolekeys[K_TAB] = true;
keys.c: consolekeys[K_LEFTARROW] = true;
keys.c: consolekeys[K_RIGHTARROW] = true;
keys.c: consolekeys[K_UPARROW] = true;
keys.c: consolekeys[K_DOWNARROW] = true;
keys.c: consolekeys[K_BACKSPACE] = true;
keys.c: consolekeys[K_PGUP] = true;
keys.c: consolekeys[K_PGDN] = true;
keys.c: consolekeys[K_SHIFT] = true;
keys.c: consolekeys[K_MWHEELUP] = true;
keys.c: consolekeys[K_MWHEELDOWN] = true;
keys.c: consolekeys['`'] = false;
keys.c: consolekeys['~'] = false;
keys.c: if(cls.demoplayback && down && consolekeys[key] && key_dest == key_game) {
keys.c: || (key_dest == key_console && !consolekeys[key])
keys.c: || (key_dest == key_game && (!con_forcedup || !consolekeys[key]))) {
It's only referenced a few times. Once to initialize it:
- Code: Select all
qboolean consolekeys[256]; // if true, can't be rebound while in console
A few more times to set what keys can be used in the console:
- Code: Select all
// init ascii characters in console mode
for(i = 32; i < 128; i++)
consolekeys[i] = true;
consolekeys[K_ENTER] = true;
consolekeys[K_TAB] = true;
consolekeys[K_LEFTARROW] = true;
consolekeys[K_RIGHTARROW] = true;
consolekeys[K_UPARROW] = true;
consolekeys[K_DOWNARROW] = true;
consolekeys[K_BACKSPACE] = true;
consolekeys[K_PGUP] = true;
consolekeys[K_PGDN] = true;
consolekeys[K_SHIFT] = true;
consolekeys[K_MWHEELUP] = true;
consolekeys[K_MWHEELDOWN] = true;
consolekeys['`'] = false;
consolekeys['~'] = false;
And for checking to see if we're in a demo or if the key should be sent to the interpreter (in function Key_Event):
- Code: Select all
// during demo playback, most keys bring up the main menu
if(cls.demoplayback && down && consolekeys[key] && key_dest == key_game) {
M_ToggleMenu_f();
return;
}
// if not a consolekey, send to the interpreter no matter what mode is
if((key_dest == key_menu && menubound[key])
|| (key_dest == key_console && !consolekeys[key])
|| (key_dest == key_game && (!con_forcedup || !consolekeys[key]))) {
kb = keybindings[key];
if(kb) {
if(kb[0] == '+') { // button commands add keynum as a parm
sprintf(cmd, "%s %i\n", kb, key);
Cbuf_AddText(cmd);
} else {
Cbuf_AddText(kb);
Cbuf_AddText("\n");
}
}
return;
}
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.
Get off my lawn!
-

dreadlorde - Posts: 268
- Joined: Tue Nov 24, 2009 2:20 am
24 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 1 guest