diff --git a/engine/client/in_win.c b/engine/client/in_win.c index 6468339ad..5db55acf4 100644 --- a/engine/client/in_win.c +++ b/engine/client/in_win.c @@ -1383,11 +1383,7 @@ static void ProcessMouse(mouse_t *mouse, usercmd_t *cmd, int pnum) if(in_xflip.value) mx *= -1; #endif - if (mouseusedforgui || (key_dest == key_menu && (m_state == m_complex || m_state == m_plugin) || key_dest == key_console) -#ifdef VM_UI - || UI_MenuState() -#endif - ) + if (Key_MouseShouldBeFree()) { mousemove_x += mx; mousemove_y += my; diff --git a/engine/client/keys.c b/engine/client/keys.c index bd65eeb66..740aab41c 100644 --- a/engine/client/keys.c +++ b/engine/client/keys.c @@ -492,7 +492,7 @@ void Key_ConsoleRelease(int key) } for (x = con_mousedown[0]; x < xpos; x++) - *buf++ = con_current->text[x + ((y%con_current->totallines)*con_current->linewidth)]; + *buf++ = con_current->text[x + ((y%con_current->totallines)*con_current->linewidth)]&127; } while(buf > bufhead && buf[-1] == ' ') buf--; @@ -1274,6 +1274,35 @@ void Key_Init (void) Cvar_Register (&con_selectioncolour, "Console variables"); } +qboolean Key_MouseShouldBeFree(void) +{ + //returns if the mouse should be a cursor or if it should go to the menu + + //if true, the input code is expected to return mouse cursor positions rather than deltas + + extern int mouseusedforgui; + if (mouseusedforgui) //I don't like this + return true; + + if (key_dest == key_menu) + { + if (m_state == m_complex || m_state == m_plugin) + return true; + } + if (key_dest == key_console) + return true; + if (key_dest == key_game && cls.state < ca_connected) + return true; + +#ifdef VM_UI + if (UI_MenuState()) + return true; +#endif + + + return false; +} + /* =================== Key_Event