Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void IN_MouseMove ( float frametime, usercmd_t *cmd)
- {
- int mx, my;
- vec3_t viewangles;
- double mouse_x2, mouse_y2;
- gEngfuncs.GetViewAngles( (float *)viewangles );
- // Ricochet: Don't let them move the mouse when they're in spectator mode
- int iSpectator = !bCanMoveMouse();
- //jjb - this disbles normal mouse control if the user is trying to
- // move the camera
- if ( !iMouseInUse && !g_iVisibleMouse && !iSpectator )
- {
- GetCursorPos (¤t_pos);
- IN_ResetMouse();
- mx = (current_pos.x - gEngfuncs.GetWindowCenterX());
- my = (current_pos.y - gEngfuncs.GetWindowCenterY());
- if (cl_acceleration->value == 0)
- {
- mouse_x2 = TRANSFORM_ORB_PIXELS_TO_DEGREES(mx, SCREEN_WIDTH, gHUD.m_iFOV, sensitivity->value);
- mouse_y2 = TRANSFORM_ORB_PIXELS_TO_DEGREES(my, SCREEN_HEIGHT, gHUD.m_iFOV, sensitivity->value);
- }
- else
- {
- mouse_x2 = mx == 0 ? 0 : TRANSDUCE_PIXELS_TO_DEGREES(mx, SCREEN_WIDTH, gHUD.m_iFOV, sensitivity->value);
- mouse_y2 = my == 0 ? 0 : TRANSDUCE_PIXELS_TO_DEGREES(my, SCREEN_HEIGHT, gHUD.m_iFOV, sensitivity->value);
- }
- // add mouse X/Y movement to cmd
- if ((in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1)))
- {
- cmd->sidemove += mouse_x2;
- //cmd->sidemove += m_side->value * mouse_x;
- }
- else
- {
- viewangles[YAW] -= mouse_x2;
- //viewangles[YAW] -= m_yaw->value * mouse_x;
- }
- if ( in_mlook.state & 1)
- {
- V_StopPitchDrift ();
- }
- if ( (in_mlook.state & 1) && !(in_strafe.state & 1))
- {
- viewangles[PITCH] += mouse_y2;
- //viewangles[PITCH] += m_pitch->value * mouse_y;
- if (viewangles[PITCH] > cl_pitchdown->value)
- {
- viewangles[PITCH] = cl_pitchdown->value;
- }
- if (viewangles[PITCH] < -cl_pitchup->value)
- {
- viewangles[PITCH] = -cl_pitchup->value;
- }
- }
- else
- {
- if ((in_strafe.state & 1) && gEngfuncs.IsNoClipping() )
- {
- cmd->upmove -= mouse_y2;
- //cmd->upmove -= m_forward->value * mouse_y;
- }
- else
- {
- cmd->forwardmove -= mouse_y2;
- //cmd->forwardmove -= m_forward->value * mouse_y;
- }
- }
- }
- gEngfuncs.SetViewAngles( (float *)viewangles );
- /*
- //#define TRACE_TEST
- #if defined( TRACE_TEST )
- {
- int mx, my;
- void V_Move( int mx, int my );
- IN_GetMousePos( &mx, &my );
- V_Move( mx, my );
- }
- #endif
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement