Ejemplo n.º 1
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : effectnum - 
//-----------------------------------------------------------------------------
void CInput::ForceFeedback_Stop( int effectnum )
{
	if ( !m_pFF || !m_pFF->m_bForceFeedbackAvailable )
		return;


	// look up the effect
	FORCEFEEDBACK_t effect = (FORCEFEEDBACK_t)effectnum;

	if ( effect < 0 || effect >= NUM_FORCE_FEEDBACK_PRESETS )
	{
		Assert( !"ForceFeedback_Stop with bogus effectnum" );
		return;
	}

	EffectMap_t *map = &g_EffectMap[ effectnum ];

	vecEffectPtr_t *effects = map->pVecEffectPtr;

	// Stop the effects on the device
	int c = effects->Count();
	for ( int i = 0; i < c; ++i )
	{
		LPDIRECTINPUTEFFECT pEffect = (*effects)[ i ];
		pEffect->Stop();
	}
}
//--------------------------------------------------------------//
void Win32ForceFeedback::remove( const Effect* eff )
{
	//Get the effect - if it exists
	EffectList::iterator i = mEffectList.find(eff->_handle);
	if( i != mEffectList.end() )
	{
		LPDIRECTINPUTEFFECT dxEffect = i->second;
		if( dxEffect )
		{
			dxEffect->Stop();
			//We care about the return value - as the effect might not
			//have been unlaoded
			if( SUCCEEDED(dxEffect->Unload()) )
				mEffectList.erase(i);
		}
		else
			mEffectList.erase(i);
	}
}