Ejemplo n.º 1
0
/*
=================
CL_UpdateCmd

Updates msec, angles and builds interpolated movement vector for local prediction.
Doesn't touch command forward/side/upmove, these are filled by CL_FinalizeCmd.
=================
*/
void CL_UpdateCmd( int msec ) {
    VectorClear( cl.localmove );

    if( sv_paused->integer ) {
        return;
    }

    // add to milliseconds of time to apply the move
    cl.cmd.msec += msec;

    // adjust viewangles
    CL_AdjustAngles( msec );

    // get basic movement from keyboard
    CL_BaseMove( cl.localmove );

    // allow mice to add to the move
    CL_MouseMove();

    // add accumulated mouse forward/side movement
    cl.localmove[0] += cl.mousemove[0];
    cl.localmove[1] += cl.mousemove[1];

    // clamp to server defined max speed
    CL_ClampSpeed( cl.localmove );

    CL_ClampPitch();
    
    cl.cmd.angles[0] = ANGLE2SHORT( cl.viewangles[0] );
    cl.cmd.angles[1] = ANGLE2SHORT( cl.viewangles[1] );
    cl.cmd.angles[2] = ANGLE2SHORT( cl.viewangles[2] );
}
Ejemplo n.º 2
0
/*
=================
CL_CreateCmd
=================
*/
usercmd_t CL_CreateCmd( void )
{
	usercmd_t cmd;
	vec3_t    oldAngles;

	VectorCopy( cl.viewangles, oldAngles );

	// keyboard angle adjustment
	CL_AdjustAngles();

	memset( &cmd, 0, sizeof( cmd ) );

	CL_CmdButtons( &cmd );

	// get basic movement from keyboard
	CL_KeyMove( &cmd );

	// get basic movement from mouse
	CL_MouseMove( &cmd );

	// get basic movement from joystick or controller
	if ( cl_xbox360ControllerAvailable->integer )
	{
		CL_Xbox360ControllerMove( &cmd );
	}
	else
	{
		CL_JoystickMove( &cmd );
	}

	// check to make sure the angles haven't wrapped
	if ( cl.viewangles[ PITCH ] - oldAngles[ PITCH ] > 90 )
	{
		cl.viewangles[ PITCH ] = oldAngles[ PITCH ] + 90;
	}
	else if ( oldAngles[ PITCH ] - cl.viewangles[ PITCH ] > 90 )
	{
		cl.viewangles[ PITCH ] = oldAngles[ PITCH ] - 90;
	}

	// store out the final values
	CL_FinishMove( &cmd );

	// draw debug graphs of turning for mouse testing
	if ( cl_debugMove->integer )
	{
		if ( cl_debugMove->integer == 1 )
		{
			SCR_DebugGraph( abs( cl.viewangles[ YAW ] - oldAngles[ YAW ] ), 0 );
		}

		if ( cl_debugMove->integer == 2 )
		{
			SCR_DebugGraph( abs( cl.viewangles[ PITCH ] - oldAngles[ PITCH ] ), 0 );
		}
	}

	return cmd;
}
Ejemplo n.º 3
0
void IN_MouseMove( usercmd_t *cmd )
{
	if( mouse_active )
	{
		CL_MouseMove( cmd, mx, my );
		mx = my = 0;
	}
}
Ejemplo n.º 4
0
/*
=================
CL_CreateCmd
=================
*/
usercmd_t CL_CreateCmd( void ) {
	usercmd_t cmd;
	vec3_t oldAngles;
	float recoilAdd;

	VectorCopy( cl.viewangles, oldAngles );

	// keyboard angle adjustment
	CL_AdjustAngles();

	memset( &cmd, 0, sizeof( cmd ) );

	CL_CmdButtons( &cmd );

	// get basic movement from keyboard
	CL_KeyMove( &cmd );

	// get basic movement from mouse
	CL_MouseMove( &cmd );

	// get basic movement from joystick
	CL_JoystickMove( &cmd );

	// check to make sure the angles haven't wrapped
	if ( cl.viewangles[PITCH] - oldAngles[PITCH] > 90 ) {
		cl.viewangles[PITCH] = oldAngles[PITCH] + 90;
	} else if ( oldAngles[PITCH] - cl.viewangles[PITCH] > 90 ) {
		cl.viewangles[PITCH] = oldAngles[PITCH] - 90;
	}

	// RF, set the kickAngles so aiming is effected
	recoilAdd = cl_recoilPitch->value;
	if ( fabs( cl.viewangles[PITCH] + recoilAdd ) < 40 ) {
		cl.viewangles[PITCH] += recoilAdd;
	}
	// the recoilPitch has been used, so clear it out
	cl_recoilPitch->value = 0;

	// store out the final values
	CL_FinishMove( &cmd );

	// draw debug graphs of turning for mouse testing
	if ( cl_debugMove->integer ) {
		if ( cl_debugMove->integer == 1 ) {
			SCR_DebugGraph( abs(cl.viewangles[YAW] - oldAngles[YAW]) );
		}
		if ( cl_debugMove->integer == 2 ) {
			SCR_DebugGraph( abs(cl.viewangles[PITCH] - oldAngles[PITCH]) );
		}
	}

	cmd.cld = cl.cgameCld;          // NERVE - SMF

	return cmd;
}
Ejemplo n.º 5
0
usercmd_t CL_CreateCmd( void ) {
	usercmd_t	cmd;
	vec3_t		oldAngles;

	VectorCopy( cl.viewangles, oldAngles );

	// keyboard angle adjustment
	CL_AdjustAngles ();
	
	memset( &cmd, 0, sizeof( cmd ) );

	CL_CmdButtons( &cmd );

	// get basic movement from keyboard
	CL_KeyMove (&cmd);

	// get basic movement from mouse
	CL_MouseMove( &cmd );

	// get basic movement from joystick
	CL_JoystickMove( &cmd );

	// check to make sure the angles haven't wrapped
	if ( cl.viewangles[PITCH] - oldAngles[PITCH] > 90 ) {
		cl.viewangles[PITCH] = oldAngles[PITCH] + 90;
	} else if ( oldAngles[PITCH] - cl.viewangles[PITCH] > 90 ) {
		cl.viewangles[PITCH] = oldAngles[PITCH] - 90;
	} 

	if ( cl_overrideAngles )
	{
		VectorCopy( cl_overriddenAngles, cl.viewangles );
		cl_overrideAngles = qfalse;
	}
	// store out the final values
	CL_FinishMove( &cmd );

	// draw debug graphs of turning for mouse testing
#ifndef _XBOX
	if ( cl_debugMove->integer ) {
		if ( cl_debugMove->integer == 1 ) {
			SCR_DebugGraph( abs(cl.viewangles[YAW] - oldAngles[YAW]), 0 );
		}
		if ( cl_debugMove->integer == 2 ) {
			SCR_DebugGraph( abs(cl.viewangles[PITCH] - oldAngles[PITCH]), 0 );
		}
	}
#endif

	return cmd;
}
Ejemplo n.º 6
0
usercmd_t CL_CreateCmd( void ) {
	usercmd_t	cmd;
	vec3_t		oldAngles;

	VectorCopy( cl.viewangles, oldAngles );

	// keyboard angle adjustment
	CL_AdjustAngles ();

	Com_Memset( &cmd, 0, sizeof( cmd ) );

	CL_CmdButtons( &cmd );

	// get basic movement from keyboard
	CL_KeyMove( &cmd );

	// get basic movement from mouse
	CL_MouseMove( &cmd );

	// get basic movement from joystick
	CL_JoystickMove( &cmd );

	// mert akengin
	cvar_t *in_haptics = Cvar_Get("in_haptic","1",CVAR_ARCHIVE);
	cvar_t *in_haptics_move = Cvar_Get("in_haptic_move","0",CVAR_ARCHIVE);
	cvar_t *haptic_cvars[AXES] = { in_haptics, in_haptics_move, cl_sensitivity };
	haptic_dealwith(haptic_cvars,&cmd,cl.viewangles,in_buttons);

	// check to make sure the angles haven't wrapped
	if ( cl.viewangles[PITCH] - oldAngles[PITCH] > 90 ) {
		cl.viewangles[PITCH] = oldAngles[PITCH] + 90;
	} else if ( oldAngles[PITCH] - cl.viewangles[PITCH] > 90 ) {
		cl.viewangles[PITCH] = oldAngles[PITCH] - 90;
	}

	// store out the final values
	CL_FinishMove( &cmd );

	// draw debug graphs of turning for mouse testing
	if ( cl_debugMove->integer ) {
		if ( cl_debugMove->integer == 1 ) {
			SCR_DebugGraph( fabs(cl.viewangles[YAW] - oldAngles[YAW]) );
		}
		if ( cl_debugMove->integer == 2 ) {
			SCR_DebugGraph( fabs(cl.viewangles[PITCH] - oldAngles[PITCH]) );
		}
	}

	return cmd;
}
Ejemplo n.º 7
0
usercmd_t CL_CreateCmd( void ) {
	usercmd_t	cmd;
	vector3		oldAngles;

	VectorCopy( &cl.viewangles, &oldAngles );

	// keyboard angle adjustment
	CL_AdjustAngles();
	
	memset( &cmd, 0, sizeof( cmd ) );

	CL_CmdButtons( &cmd );

	// get basic movement from keyboard
	CL_KeyMove( &cmd );

	// get basic movement from mouse
	CL_MouseMove( &cmd );

	// get basic movement from joystick
	CL_JoystickMove( &cmd );

	// check to make sure the angles haven't wrapped
	if ( cl.viewangles.pitch - oldAngles.pitch > 90 ) {
		cl.viewangles.pitch = oldAngles.pitch + 90;
	} else if ( oldAngles.pitch - cl.viewangles.pitch > 90 ) {
		cl.viewangles.pitch = oldAngles.pitch - 90;
	} 

	// store out the final values
	CL_FinishMove( &cmd );

	// draw debug graphs of turning for mouse testing
	if ( cl_debugMove->integer ) {
		if ( cl_debugMove->integer == 1 ) {
			SCR_DebugGraph( fabsf(cl.viewangles.yaw - oldAngles.yaw) );
		}
		if ( cl_debugMove->integer == 2 ) {
			SCR_DebugGraph( fabsf(cl.viewangles.pitch - oldAngles.pitch) );
		}
	}

	return cmd;
}
Ejemplo n.º 8
0
void IN_MouseMove( usercmd_t *cmd )
{
	if( mouse_active ) {
		if( !mouse_relative ) {
			if( mx || my ) {
				int center_x, center_y;

				SDL_GetMouseState( &mx, &my );

				IN_WarpMouseToCenter( &center_x, &center_y );

				mx -= center_x;
				my -= center_y;
			}
		}

		if( mx || my ) {
			CL_MouseMove( cmd, mx, my );
		}
	}

	mx = my = 0;
}