{
cl.viewangles[YAW] -= speed*cl_yawspeed.value*CL_KeyState (&in_right);
cl.viewangles[YAW] += speed*cl_yawspeed.value*CL_KeyState (&in_left);
- cl.viewangles[YAW] = ANGLEMOD(cl.viewangles[YAW]);
}
if (in_klook.state & 1)
{
if (up || down)
V_StopPitchDrift ();
- // LordHavoc: changed from 80 to 90 (straight up)
- if (cl.viewangles[PITCH] > 90)
- cl.viewangles[PITCH] = 90;
- // LordHavoc: changed from -70 to -90 (straight down)
- if (cl.viewangles[PITCH] < -90)
- cl.viewangles[PITCH] = -90;
-
- if (cl.viewangles[ROLL] > 50)
- cl.viewangles[ROLL] = 50;
- if (cl.viewangles[ROLL] < -50)
- cl.viewangles[ROLL] = -50;
-
+ cl.viewangles[YAW] = ANGLEMOD(cl.viewangles[YAW]);
+ cl.viewangles[PITCH] = ANGLEMOD(cl.viewangles[PITCH]);
+ cl.viewangles[ROLL] = ANGLEMOD(cl.viewangles[ROLL]);
+
+ cl.viewangles[PITCH] = bound (in_pitch_min.value, cl.viewangles[PITCH], in_pitch_max.value);
+ cl.viewangles[ROLL] = bound(-50, cl.viewangles[ROLL], 50);
}
/*
// get basic movement from keyboard
CL_BaseMove (&cmd);
+ IN_PreMove(); // OS independent code
+
// allow mice or other external controllers to add to the move
IN_Move (&cmd);
+ IN_PostMove(); // OS independent code
+
// send the unreliable message
CL_SendMove (&cmd);
}
static void IN_init_kb(void);
static void IN_init_mouse(void);
-cvar_t m_filter = {CVAR_SAVE, "m_filter","0"};
-
static void keyhandler(int scancode, int state)
{
int sc;
char *mousedev;
int mouserate = MOUSE_DEFAULTSAMPLERATE;
- Cvar_RegisterVariable (&m_filter);
-
mouse_buttons = 3;
mtype = vga_getmousetype();
void IN_Move(usercmd_t *cmd)
{
- int mouselook = (in_mlook.state & 1) || freelook.integer;
if (!UseMouse)
return;
;
if (key_dest != key_game)
- {
ui_mouseupdaterelative(uimx, uimy);
- uimx = uimy = 0;
- return;
- }
- uimx = uimy = 0;
-
- if (m_filter.integer)
- {
- 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;
-
- // LordHavoc: viewzoom affects mouse sensitivity for sniping
- mouse_x *= sensitivity.value * cl.viewzoom;
- mouse_y *= sensitivity.value * cl.viewzoom;
-
- /* Add mouse X/Y movement to cmd */
- if ( (in_strafe.state & 1) || (lookstrafe.integer && mouselook))
- cmd->sidemove += m_side.value * mouse_x;
- else
- cl.viewangles[YAW] -= m_yaw.value * mouse_x;
-
- if (mouselook)
- V_StopPitchDrift();
-
- // LordHavoc: changed limits on pitch from -70 to 80, to -90 to 90
- if (mouselook && !(in_strafe.state & 1))
- cl.viewangles[PITCH] += m_pitch.value * mouse_y;
- else
- {
- if ((in_strafe.state & 1) && noclip_anglehack)
- cmd->upmove -= m_forward.value * mouse_y;
- else
- cmd->forwardmove -= m_forward.value * mouse_y;
- }
- cl.viewangles[PITCH] = bound (in_pitch_min.value, cl.viewangles[PITCH], in_pitch_max.value);
+ IN_Mouse(cmd, mx, my);
+ mx = 0;
+ my = 0;
+ uimx = 0;
+ uimy = 0;
}
void IN_HandlePause (qboolean pause)
LPDIRECTINPUT * lplpDirectInput, LPUNKNOWN punkOuter);
// mouse variables
-cvar_t m_filter = {CVAR_SAVE, "m_filter","0"};
-
int mouse_buttons;
int mouse_oldbuttonstate;
POINT current_pos;
*/
void IN_Init (void)
{
- // mouse variables
- Cvar_RegisterVariable (&m_filter);
-
// joystick variables
Cvar_RegisterVariable (&in_joystick);
Cvar_RegisterVariable (&joy_name);
my_accum = 0;
}
-//if (mx || my)
-// Con_DPrintf("mx=%d, my=%d\n", mx, my);
+ IN_Mouse(cmd, mx, my);
- if (m_filter.integer)
- {
- 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;
-
- // LordHavoc: viewzoom affects mouse sensitivity for sniping
- mouse_x *= sensitivity.value * cl.viewzoom;
- mouse_y *= sensitivity.value * cl.viewzoom;
-
-// add mouse X/Y movement to cmd
- if ( (in_strafe.state & 1) || (lookstrafe.integer && mouselook))
- cmd->sidemove += m_side.value * mouse_x;
- else
- cl.viewangles[YAW] -= m_yaw.value * mouse_x;
-
- if (mouselook)
- V_StopPitchDrift ();
-
- // LordHavoc: changed limits on pitch from -70 to 80, to -90 to 90
- if (mouselook && !(in_strafe.state & 1))
- cl.viewangles[PITCH] += m_pitch.value * mouse_y;
- else
- {
- if ((in_strafe.state & 1) && noclip_anglehack)
- cmd->upmove -= m_forward.value * mouse_y;
- else
- cmd->forwardmove -= m_forward.value * mouse_y;
- }
-
-// if the mouse has moved, force it to the center, so there's room to move
- if (mx || my)
- {
+ // if the mouse has moved, force it to the center, so there's room to move
+ if (!dinput && (mx || my))
SetCursorPos (window_center_x, window_center_y);
- }
}
break;
}
}
-
- // bounds check pitch
- if (cl.viewangles[PITCH] > 80.0)
- cl.viewangles[PITCH] = 80.0;
- if (cl.viewangles[PITCH] < -70.0)
- cl.viewangles[PITCH] = -70.0;
}
*/
// input.h -- external (non-keyboard) input devices
+extern cvar_t in_pitch_min;
+extern cvar_t in_pitch_max;
+
void IN_Init (void);
void IN_Shutdown (void);
void IN_Move (usercmd_t *cmd);
// add additional movement on top of the keyboard move cmd
+void IN_PreMove(void);
+void IN_PostMove(void);
+
+void IN_Mouse(usercmd_t *cmd, float mx, float my);
+
void IN_ClearStates (void);
// restores all button and position states to defaults
extern cvar_t vid_mouse;
extern cvar_t vid_fullscreen;
-extern cvar_t in_pitch_min;
-extern cvar_t in_pitch_max;
-
void VID_InitCvars(void);
void GL_Init (void);
cvar_t vid_dga = {CVAR_SAVE, "vid_dga", "1"};
cvar_t vid_dga_mouseaccel = {0, "vid_dga_mouseaccel", "1"};
-cvar_t m_filter = {0, "m_filter", "0"};
qboolean vidmode_ext = false;
Cvar_RegisterVariable (&vid_dga);
Cvar_RegisterVariable (&vid_dga_mouseaccel);
- Cvar_RegisterVariable (&m_filter);
// interpret command-line params
{
}
-/*
-===========
-IN_Move
-===========
-*/
-void IN_MouseMove (usercmd_t *cmd)
-{
- if (!mouse_avail)
- return;
-
- if (m_filter.integer)
- {
- mouse_x = (mouse_x + old_mouse_x) * 0.5;
- mouse_y = (mouse_y + old_mouse_y) * 0.5;
-
- old_mouse_x = mouse_x;
- old_mouse_y = mouse_y;
- }
-
- // LordHavoc: viewzoom affects mouse sensitivity for sniping
- mouse_x *= sensitivity.value * cl.viewzoom;
- mouse_y *= sensitivity.value * cl.viewzoom;
-
- if (in_strafe.state & 1)
- cmd->sidemove += m_side.value * mouse_x;
- else
- cl.viewangles[YAW] -= m_yaw.value * mouse_x;
-
- //if (freelook)
- V_StopPitchDrift ();
-
- if (/*freelook && */!(in_strafe.state & 1))
- cl.viewangles[PITCH] += m_pitch.value * mouse_y;
- else
- {
- if ((in_strafe.state & 1) && noclip_anglehack)
- cmd->upmove -= m_forward.value * mouse_y;
- else
- cmd->forwardmove -= m_forward.value * mouse_y;
- }
- mouse_x = mouse_y = 0.0;
-}
-
void IN_Move (usercmd_t *cmd)
{
- IN_MouseMove(cmd);
- cl.viewangles[PITCH] = bound (in_pitch_min.value, cl.viewangles[PITCH], in_pitch_max.value);
+ if (mouseavail)
+ In_Mouse(cmd, mouse_x, mouse_y);
+ mouse_x = 0;
+ mouse_y = 0;
}
cvar_t in_pitch_min = {0, "in_pitch_min", "-90"};
cvar_t in_pitch_max = {0, "in_pitch_max", "90"};
+cvar_t m_filter = {CVAR_SAVE, "m_filter","0"};
+
// GL_ARB_multitexture
void (GLAPIENTRY *qglMultiTexCoord2f) (GLenum, GLfloat, GLfloat);
void (GLAPIENTRY *qglActiveTexture) (GLenum);
cl.viewangles[PITCH] = 0;
}
+void IN_PreMove(void)
+{
+}
+
+void IN_PostMove(void)
+{
+}
+
+void IN_Mouse(usercmd_t *cmd, float mx, float my)
+{
+ int mouselook = (in_mlook.state & 1) || freelook.integer;
+ float mouse_x, mouse_y;
+ static float old_mouse_x = 0, old_mouse_y = 0;
+
+ if (m_filter.integer)
+ {
+ 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;
+
+ // LordHavoc: viewzoom affects mouse sensitivity for sniping
+ mouse_x *= sensitivity.value * cl.viewzoom;
+ mouse_y *= sensitivity.value * cl.viewzoom;
+
+ // Add mouse X/Y movement to cmd
+ if ( (in_strafe.state & 1) || (lookstrafe.integer && mouselook))
+ cmd->sidemove += m_side.value * mouse_x;
+ else
+ cl.viewangles[YAW] -= m_yaw.value * mouse_x;
+
+ if (mouselook)
+ V_StopPitchDrift();
+
+ if (mouselook && !(in_strafe.state & 1))
+ cl.viewangles[PITCH] += m_pitch.value * mouse_y;
+ else
+ {
+ if ((in_strafe.state & 1) && noclip_anglehack)
+ cmd->upmove -= m_forward.value * mouse_y;
+ else
+ cmd->forwardmove -= m_forward.value * mouse_y;
+ }
+}
+
void VID_InitCvars(void)
{
Cvar_RegisterVariable(&vid_mode);
Cvar_RegisterVariable(&gl_combine);
Cvar_RegisterVariable(&in_pitch_min);
Cvar_RegisterVariable(&in_pitch_max);
+ Cvar_RegisterVariable(&m_filter);
Cmd_AddCommand("force_centerview", Force_CenterView_f);
}