示例#1
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CLogicPlayMovie::InputPlayMovie( inputdata_t &data )
{
	const char *szVideoCommand = ( m_bAllowUserSkip ) ? "playvideo_exitcommand" : "playvideo_exitcommand_nointerrupt";
	// Build the hacked string
	
	char szClientCmd[256];
	Q_snprintf( szClientCmd, sizeof(szClientCmd), 
				"%s %s ent_fire %s __MovieFinished\n", 
				szVideoCommand,
				STRING(m_strMovieFilename), 
				GetEntityNameAsCStr() );

	// Send it on
	engine->ServerCommand( szClientCmd );
}
示例#2
0
void CDeferredLight::Activate()
{
	BaseClass::Activate();

	SetSolid( SOLID_NONE );
	AddEffects( EF_NODRAW );

	m_iDefFlags = GetSpawnFlags();

	m_bShouldTransmit = GetParent() != NULL ||
		Q_strlen( GetEntityNameAsCStr() ) > 0;

	SetMoveType( (GetParent() != NULL) ? MOVETYPE_PUSH : MOVETYPE_NONE );

	DispatchUpdateTransmitState();

	const char *pszCookie = STRING( m_str_CookieString );

	if ( m_iDefFlags & DEFLIGHT_COOKIE_ENABLED &&
		pszCookie != NULL && Q_strlen( pszCookie ) > 0 )
		m_iCookieIndex = GetDeferredManager()->AddCookieTexture( pszCookie );
	else
		m_iCookieIndex = 0;

	Assert( m_iCookieIndex >= 0 && m_iCookieIndex < MAX_COOKIE_TEXTURES );

	m_vecColor_Diff.GetForModify() = stringColToVec( STRING( m_str_Diff ) );
	m_vecColor_Ambient.GetForModify() = stringColToVec( STRING( m_str_Ambient ) );

	if ( !m_bShouldTransmit )
	{
		if ( m_iDefFlags & DEFLIGHT_ENABLED &&
			( m_vecColor_Diff.Get().LengthSqr() > 0 || m_vecColor_Ambient.Get().LengthSqr() > 0 ) &&
			m_flSpotConeOuter > 0.01f && m_flRadius > 0 )
		{
			GetDeferredManager()->AddWorldLight( this );
		}
		else
			AssertMsg( 0, "I'm turned off and nobody can turn me on :(" );

		UTIL_Remove( this );
	}
	else
	{
		UpdateSize();
	}
}