static int mouse_oldbuttonstate;
static float mouse_x, mouse_y;
static float old_mouse_x, old_mouse_y;
-static int mx, my;
+static int mx, my, uimx, uimy;
-static void IN_init_kb();
-static void IN_init_mouse();
-
-cvar_t m_filter = {"m_filter","0"};
+static void IN_init_kb(void);
+static void IN_init_mouse(void);
static void keyhandler(int scancode, int state)
{
static void mousehandler(int buttonstate, int dx, int dy, int dz, int drx, int dry, int drz)
{
mouse_buttonstate = buttonstate;
+ uimx += dx;
+ uimy += dy;
mx += dx;
my += dy;
if (drx > 0) {
}
-void Force_CenterView_f(void)
-{
- cl.viewangles[PITCH] = 0;
-}
-
-
void IN_Init(void)
{
if (COM_CheckParm("-nokbd")) UseKeyboard = 0;
if (COM_CheckParm("-nomouse")) UseMouse = 0;
+ uimx = uimy = 0;
if (UseKeyboard)
IN_init_kb();
if (UseMouse)
in_svgalib_inited = 1;
}
-static void IN_init_kb()
+static void IN_init_kb(void)
{
int i;
keyboard_seteventhandler(keyhandler);
}
-static void IN_init_mouse()
+static void IN_init_mouse(void)
{
int mtype;
char *mousedev;
int mouserate = MOUSE_DEFAULTSAMPLERATE;
- Cvar_RegisterVariable (&m_filter);
- Cmd_AddCommand("force_centerview", Force_CenterView_f);
-
mouse_buttons = 3;
mtype = vga_getmousetype();
{
Con_Printf("IN_Shutdown\n");
- if (UseMouse) mouse_close();
- if (UseKeyboard) keyboard_close();
+ if (UseMouse)
+ mouse_close();
+ if (UseKeyboard)
+ keyboard_close();
in_svgalib_inited = 0;
}
void IN_Move(usercmd_t *cmd)
{
- if (!UseMouse) return;
+ if (!UseMouse)
+ return;
/* Poll mouse values */
while (mouse_update())
;
- if (m_filter.value) {
- mouse_x = (mx + old_mouse_x) * 0.5;
- mouse_y = (my + old_mouse_y) * 0.5;
- } else {
- mouse_x = mx;
- mouse_y = my;
- }
- old_mouse_x = mx;
- old_mouse_y = my;
- /* Clear for next update */
- mx = my = 0;
-
- mouse_x *= sensitivity.value;
- mouse_y *= sensitivity.value;
-
- /* Add mouse X/Y movement to cmd */
- if ( (in_strafe.state & 1) ||
- (lookstrafe.value && (in_mlook.state & 1) )) {
- cmd->sidemove += m_side.value * mouse_x;
- } else {
- cl.viewangles[YAW] -= m_yaw.value * mouse_x;
- }
-
- if ((in_mlook.state & 1)) V_StopPitchDrift();
-
- // LordHavoc: changed limits on pitch from -70 to 80, to -90 to 90
- if ((in_mlook.state & 1) && !(in_strafe.state & 1)) {
- cl.viewangles[PITCH] += m_pitch.value * mouse_y;
- if (cl.viewangles[PITCH] > 90) {
- cl.viewangles[PITCH] = 90;
- }
- if (cl.viewangles[PITCH] < -90) {
- cl.viewangles[PITCH] = -90;
- }
- } else {
- if ((in_strafe.state & 1) && noclip_anglehack) {
- cmd->upmove -= m_forward.value * mouse_y;
- } else {
- cmd->forwardmove -= m_forward.value * mouse_y;
- }
- }
+ if (key_dest != key_game)
+ ui_mouseupdaterelative(uimx, uimy);
+ else
+ IN_Mouse(cmd, mx, my);
+ mx = 0;
+ my = 0;
+ uimx = 0;
+ uimy = 0;
}
void IN_HandlePause (qboolean pause)