//-----------------------------------------------------------------------------
// Purpose: 
// Input  : iActivity - 
//-----------------------------------------------------------------------------
void CWarsWeapon::SendViewModelAnim( int nSequence )
{
#if defined( CLIENT_DLL )
	if ( !IsPredicted() )
	{
		return;
	}
#endif
	
	if ( nSequence < 0 )
		return;

	CBasePlayer *pOwner = ToBasePlayer( GetCommander() );
	if ( pOwner == NULL ) {
		BaseClass::SendViewModelAnim( nSequence );
		return;
	}
	
	CBaseViewModel *vm = pOwner->GetViewModel( m_nViewModelIndex );
	if ( vm == NULL )
	{
		return;
	}

	SetViewModel();
	Assert( vm->ViewModelIndex() == m_nViewModelIndex );
	vm->SendViewModelMatchingSequence( nSequence );
}
bool CWeaponDODBase::DefaultDeploy( char *szViewModel, char *szWeaponModel, int iActivity, char *szAnimExt )
{
	CBasePlayer *pOwner = GetPlayerOwner();
	if ( !pOwner )
	{
		return false;
	}

	pOwner->SetAnimationExtension( szAnimExt );

	SetViewModel();
	SendWeaponAnim( iActivity );

	pOwner->SetNextAttack( gpGlobals->curtime + SequenceDuration() );
	m_flNextPrimaryAttack	= gpGlobals->curtime;
	m_flNextSecondaryAttack	= gpGlobals->curtime;

	SetWeaponVisible( true );
	SetWeaponModelIndex( szWeaponModel );

	CBaseViewModel *vm = pOwner->GetViewModel( m_nViewModelIndex );

	Assert( vm );

	if( vm )
	{
		//set sleeves to proper team
		switch( pOwner->GetTeamNumber() )
		{
		case TEAM_ALLIES:
			vm->m_nSkin = SLEEVE_ALLIES;
			break;
		case TEAM_AXIS:
			vm->m_nSkin = SLEEVE_AXIS;
			break;
		default:
			Assert( !"TEAM_UNASSIGNED or spectator getting a view model assigned" );
			break;
		}
	}	

	return true;
}
float CWarsWeapon::GetViewModelSequenceDuration()
{
	CBasePlayer *pOwner = ToBasePlayer( GetCommander() );
	if ( pOwner == NULL )
	{
		return BaseClass::GetViewModelSequenceDuration( );
	}
	
	CBaseViewModel *vm = pOwner->GetViewModel( m_nViewModelIndex );
	if ( vm == NULL )
	{
		Assert( false );
		return 0;
	}

	SetViewModel();
	Assert( vm->ViewModelIndex() == m_nViewModelIndex );
	return vm->SequenceDuration();
}
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
bool CWarsWeapon::DefaultDeploy( char *szViewModel, char *szWeaponModel, int iActivity, char *szAnimExt )
{
	bool ret = BaseClass::DefaultDeploy( szViewModel, szWeaponModel, iActivity, szAnimExt );

	CBasePlayer *pOwner = GetCommander();
	if ( pOwner )
	{
		// Dead men deploy no weapons
		if ( pOwner->IsAlive() == false )
			return false;

		pOwner->SetAnimationExtension( szAnimExt );

		SetViewModel();
		SendWeaponAnim( iActivity );

		pOwner->SetNextAttack( gpGlobals->curtime + SequenceDuration() );
	}
	return ret;
}
Beispiel #5
0
tcStockScene::tcStockScene(QObject *pParent)
	: QGraphicsScene(pParent)
{
	SetViewModel(NULL);
}