Esempio n. 1
0
/*
===========
ControllerMove
===========
*/
void CInput::ControllerMove( float frametime, CUserCmd *cmd )
{
	if ( IsPC() )
	{
		if ( !m_fCameraInterceptingMouse && m_fMouseActive )
		{
			MouseMove( cmd);
		}
	}

	// birdpoop: let's do some xinput stuff ourself.
	cmd->ltrigger = 0.f;
	cmd->rtrigger = 0.f;

	// Maybe do something better in the future but for demo purposes we'll always have a controller attached
	// so it's safe to assume some things we wouldn't normally assume.
	XINPUT_STATE controllerstate;
	ZeroMemory( &controllerstate, sizeof(XINPUT_STATE) );
 
	if (ERROR_SUCCESS == XInputGetState( 0, &controllerstate ) )
	{
		// Trigger input is 8bit int, let's make it 0 - 1
		cmd->ltrigger = (float)controllerstate.Gamepad.bLeftTrigger / 255;
		cmd->rtrigger = (float)controllerstate.Gamepad.bRightTrigger / 255;
	}

	JoyStickMove( frametime, cmd);

	// NVNT if we have a haptic device..
	if(haptics && haptics->HasDevice())
	{
		if(engine->IsPaused() || engine->IsLevelMainMenuBackground() || vgui::surface()->IsCursorVisible() || !engine->IsInGame())
		{
			// NVNT send a menu process to the haptics system.
			haptics->MenuProcess();
			return;
		}
#ifdef CSTRIKE_DLL
		// NVNT cstrike fov grabing.
		C_BasePlayer *player = C_BasePlayer::GetLocalPlayer();
		if(player){
			haptics->UpdatePlayerFOV(player->GetFOV());
		}
#endif
		// NVNT calculate move with the navigation on the haptics system.
		haptics->CalculateMove(cmd->forwardmove, cmd->sidemove, frametime);
		// NVNT send a game process to the haptics system.
		haptics->GameProcess();
#if defined( WIN32 ) && !defined( _X360 )
		// NVNT update our avatar effect.
		UpdateAvatarEffect();
#endif
	}


}
Esempio n. 2
0
/*
===========
ControllerMove
===========
*/
void CInput::ControllerMove( float frametime, CUserCmd *cmd )
{
	if ( IsPC() )
	{
		if ( !m_fCameraInterceptingMouse && m_fMouseActive )
		{
			MouseMove( cmd);
		}
	}

	JoyStickMove( frametime, cmd);
}
/*
===========
ControllerMove
===========
*/
void CInput::ControllerMove( float frametime, CUserCmd *cmd )
{
	if ( IsPC() )
	{
		if ( !m_fCameraInterceptingMouse && m_fMouseActive )
		{
			MouseMove( cmd);
		}
	}

	JoyStickMove( frametime, cmd);
#ifdef C17_HAPTICS
	cliHaptics->HapticsMove  ( frametime, cmd); // Haptics addition
#endif
}
/*
===========
ControllerMove
===========
*/
void CInput::ControllerMove( float frametime, CUserCmd *cmd )
{
	if ( IsPC() )
	{
		if ( !m_fCameraInterceptingMouse && m_fMouseActive )
		{
			MouseMove( cmd);
		}
	}

	JoyStickMove( frametime, cmd);

#ifdef C17_HAPTICS
	cliHaptics->HapticsMove(frametime, cmd); // Haptics addition
#endif

	// NVNT if we have a haptic device..
	if(haptics && haptics->HasDevice())
	{
		if(engine->IsPaused() || engine->IsLevelMainMenuBackground() || vgui::surface()->IsCursorVisible() || !engine->IsInGame())
		{
			// NVNT send a menu process to the haptics system.
			haptics->MenuProcess();
			return;
		}
#ifdef CSTRIKE_DLL
		// NVNT cstrike fov grabing.
		C_BasePlayer *player = C_BasePlayer::GetLocalPlayer();
		if(player){
			haptics->UpdatePlayerFOV(player->GetFOV());
		}
#endif
		// NVNT calculate move with the navigation on the haptics system.
		haptics->CalculateMove(cmd->forwardmove, cmd->sidemove, frametime);
		// NVNT send a game process to the haptics system.
		haptics->GameProcess();
#if defined( WIN32 ) && !defined( _X360 )
		// NVNT update our avatar effect.
		UpdateAvatarEffect();
#endif
	}


}