Ejemplo n.º 1
0
void CClientTools::OnRemoveEntity( C_BaseEntity *ent )
{
	if ( !ent )
	{
		Assert( 0 );
		return;
	}

	HTOOLHANDLE handle = ent->GetToolHandle();
	ent->SetToolHandle( (HTOOLHANDLE)0 );

	if ( handle == (HTOOLHANDLE)0 ) 
	{
		Assert( 0 );
		return;
	}

	int idx = m_Handles.Find( HToolEntry_t( handle ) );
	if ( idx == m_Handles.InvalidIndex() )
	{
		Assert( 0 );
		return;
	}

	// Send deletion message to tool interface
	if ( m_bInRecordingMode )
	{
		KeyValues *kv = new KeyValues( "deleted" );
		ToolFramework_PostToolMessage( handle, kv );
		kv->deleteThis();
	}

	m_Handles.RemoveAt( idx );
	m_ActiveHandles.FindAndRemove( handle );
}
Ejemplo n.º 2
0
//-----------------------------------------------------------------------------
// Recording 
//-----------------------------------------------------------------------------
static inline void RecordSprite( const Vector& start, int nModelIndex, 
								 float flScale, int nBrightness )
{
	if ( !ToolsEnabled() )
		return;

	if ( clienttools->IsInRecordingMode() )
	{
		const model_t* pModel = (nModelIndex != 0) ? modelinfo->GetModel( nModelIndex ) : NULL;
		const char *pModelName = pModel ? modelinfo->GetModelName( pModel ) : "";

		KeyValues *msg = new KeyValues( "TempEntity" );

 		msg->SetInt( "te", TE_SPRITE_SINGLE );
 		msg->SetString( "name", "TE_Sprite" );
		msg->SetFloat( "time", gpGlobals->curtime );
		msg->SetFloat( "originx", start.x );
		msg->SetFloat( "originy", start.y );
		msg->SetFloat( "originz", start.z );
  		msg->SetString( "model", pModelName );
 		msg->SetFloat( "scale", flScale );
 		msg->SetInt( "brightness", nBrightness );

		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
		msg->deleteThis();
	}
}
Ejemplo n.º 3
0
//================================================================================
// Pensamiento
//================================================================================
void CInternalLight::Update( const Vector &vecPos, const Vector &vecForward, const Vector &vecRight, const Vector &vecUp )
{
    VPROF_BUDGET( __FUNCTION__, VPROF_BUDGETGROUP_SHADOW_DEPTH_TEXTURING );

    // No esta encendida
    if ( !IsOn() )
        return;

    FlashlightState_t state;

    // Actualizamos el estado
    if ( !UpdateState( state, vecPos, vecForward, vecRight, vecUp ) )
        return;

    // Actualizamos la proyección de la luz
    UpdateLightProjection( state );

#ifndef NO_TOOLFRAMEWORK
    if ( clienttools->IsInRecordingMode() ) {
        KeyValues *msg = new KeyValues( "FlashlightState" );
        msg->SetFloat( "time", gpGlobals->curtime );
        msg->SetInt( "entindex", m_iEntIndex );
        msg->SetInt( "flashlightHandle", m_nLightHandle );
        msg->SetPtr( "flashlightState", &state );
        ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
        msg->deleteThis();
    }
#endif
}
Ejemplo n.º 4
0
//-----------------------------------------------------------------------------
// Recording 
//-----------------------------------------------------------------------------
void C_TEExplosion::RecordExplosion( )
{
	if ( !ToolsEnabled() )
		return;

	if ( clienttools->IsInRecordingMode() )
	{
		const model_t* pModel = (m_nModelIndex != 0) ? modelinfo->GetModel( m_nModelIndex ) : NULL;
		const char *pModelName = pModel ? modelinfo->GetModelName( pModel ) : "";

		KeyValues *msg = new KeyValues( "TempEntity" );

 		msg->SetInt( "te", TE_EXPLOSION );
 		msg->SetString( "name", "TE_Explosion" );
		msg->SetFloat( "time", gpGlobals->curtime );
		msg->SetFloat( "originx", m_vecOrigin.x );
		msg->SetFloat( "originy", m_vecOrigin.y );
		msg->SetFloat( "originz", m_vecOrigin.z );
		msg->SetFloat( "directionx", m_vecNormal.x );
		msg->SetFloat( "directiony", m_vecNormal.y );
		msg->SetFloat( "directionz", m_vecNormal.z );
  		msg->SetString( "model", pModelName );
		msg->SetFloat( "scale", m_fScale );
		msg->SetInt( "framerate", m_nFrameRate );
		msg->SetInt( "flags", m_nFlags );
		msg->SetInt( "materialtype", m_chMaterialType );
		msg->SetInt( "radius", m_nRadius );
		msg->SetInt( "magnitude", m_nMagnitude );

		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
		msg->deleteThis();
	}
}
Ejemplo n.º 5
0
//-----------------------------------------------------------------------------
// Recording
//-----------------------------------------------------------------------------
static inline void RecordSparks( const Vector &start, int nMagnitude, int nTrailLength, const Vector &direction )
{
	if ( !ToolsEnabled() )
		return;

	if ( clienttools->IsInRecordingMode() )
	{
		KeyValues *msg = new KeyValues( "TempEntity" );

 		msg->SetInt( "te", TE_SPARKS );
 		msg->SetString( "name", "TE_Sparks" );
		msg->SetFloat( "time", gpGlobals->curtime );
		msg->SetFloat( "originx", start.x );
		msg->SetFloat( "originy", start.y );
		msg->SetFloat( "originz", start.z );
		msg->SetFloat( "directionx", direction.x );
		msg->SetFloat( "directiony", direction.y );
		msg->SetFloat( "directionz", direction.z );
		msg->SetInt( "magnitude", nMagnitude );
		msg->SetInt( "traillength", nTrailLength );

		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
		msg->deleteThis();
	}
}
Ejemplo n.º 6
0
//================================================================================
// Apaga y destruye la luz
//================================================================================
void CInternalLight::TurnOff()
{
    // No esta encendida
    if ( !IsOn() )
        return;

    m_bIsOn = false;

    // Destruimos la luz
    if ( m_nLightHandle != CLIENTSHADOW_INVALID_HANDLE ) {
        g_pClientShadowMgr->DestroyFlashlight( m_nLightHandle );
        m_nLightHandle = CLIENTSHADOW_INVALID_HANDLE;
    }

#ifndef NO_TOOLFRAMEWORK
    if ( clienttools->IsInRecordingMode() ) {
        KeyValues *msg = new KeyValues( "FlashlightState" );
        msg->SetFloat( "time", gpGlobals->curtime );
        msg->SetInt( "entindex", m_iEntIndex );
        msg->SetInt( "flashlightHandle", m_nLightHandle );
        msg->SetPtr( "flashlightState", NULL );
        ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
        msg->deleteThis();
    }
#endif
}
Ejemplo n.º 7
0
//-----------------------------------------------------------------------------
// Recording
//-----------------------------------------------------------------------------
static inline void RecordMuzzleFlash( const Vector &start, const QAngle &angles, float scale, int type )
{
	if ( !ToolsEnabled() )
		return;

	if ( clienttools->IsInRecordingMode() )
	{
		KeyValues *msg = new KeyValues( "TempEntity" );

 		msg->SetInt( "te", TE_MUZZLE_FLASH );
 		msg->SetString( "name", "TE_MuzzleFlash" );
		msg->SetFloat( "time", gpGlobals->curtime );
		msg->SetFloat( "originx", start.x );
		msg->SetFloat( "originy", start.y );
		msg->SetFloat( "originz", start.z );
		msg->SetFloat( "anglesx", angles.x );
		msg->SetFloat( "anglesy", angles.y );
		msg->SetFloat( "anglesz", angles.z );
		msg->SetFloat( "scale", scale );
		msg->SetInt( "type", type );

		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
		msg->deleteThis();
	}
}
Ejemplo n.º 8
0
//-----------------------------------------------------------------------------
// Recording 
//-----------------------------------------------------------------------------
static inline void RecordDecal( const Vector &pos, const Vector &start, 
	int entity, int hitbox, int index )
{
	if ( !ToolsEnabled() )
		return;

	if ( clienttools->IsInRecordingMode() )
	{
		// FIXME: Can't record on entities yet
		if ( entity != 0 )
			return;

		KeyValues *msg = new KeyValues( "TempEntity" );

 		msg->SetInt( "te", TE_DECAL );
 		msg->SetString( "name", "TE_Decal" );
		msg->SetFloat( "time", gpGlobals->curtime );
		msg->SetFloat( "originx", pos.x );
		msg->SetFloat( "originy", pos.y );
		msg->SetFloat( "originz", pos.z );
		msg->SetFloat( "startx", start.x );
		msg->SetFloat( "starty", start.y );
		msg->SetFloat( "startz", start.z );
		msg->SetInt( "hitbox", hitbox );
		msg->SetString( "decalname", effects->Draw_DecalNameFromIndex( index ) );

		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
		
		msg->deleteThis();
	}
}
Ejemplo n.º 9
0
//-----------------------------------------------------------------------------
// Recording 
//-----------------------------------------------------------------------------
static inline void RecordBloodSprite( const Vector &start, const Vector &direction, 
	int r, int g, int b, int a, int nSprayModelIndex, int nDropModelIndex, int size )
{
	if ( !ToolsEnabled() )
		return;

	if ( clienttools->IsInRecordingMode() )
	{
		Color clr( r, g, b, a );

		const model_t* pSprayModel = (nSprayModelIndex != 0) ? modelinfo->GetModel( nSprayModelIndex ) : NULL;
		const model_t* pDropModel = (nDropModelIndex != 0) ? modelinfo->GetModel( nDropModelIndex ) : NULL;
		const char *pSprayModelName = pSprayModel ? modelinfo->GetModelName( pSprayModel ) : "";
		const char *pDropModelName = pDropModel ? modelinfo->GetModelName( pDropModel ) : "";

		KeyValues *msg = new KeyValues( "TempEntity" );

 		msg->SetInt( "te", TE_BLOOD_SPRITE );
 		msg->SetString( "name", "TE_BloodSprite" );
		msg->SetFloat( "time", gpGlobals->curtime );
		msg->SetFloat( "originx", start.x );
		msg->SetFloat( "originy", start.y );
		msg->SetFloat( "originz", start.z );
		msg->SetFloat( "directionx", direction.x );
		msg->SetFloat( "directiony", direction.y );
		msg->SetFloat( "directionz", direction.z );
		msg->SetColor( "color", clr );
  		msg->SetString( "spraymodel", pSprayModelName );
 		msg->SetString( "dropmodel", pDropModelName );
		msg->SetInt( "size", size );

		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
		msg->deleteThis();
	}
}
Ejemplo n.º 10
0
//-----------------------------------------------------------------------------
// Recording 
//-----------------------------------------------------------------------------
static inline void RecordPhysicsProp( const Vector& start, const QAngle &angles, 
	const Vector& vel, int nModelIndex, int flags, int nSkin, int nEffects )
{
	if ( !ToolsEnabled() )
		return;

	if ( clienttools->IsInRecordingMode() )
	{
		const model_t* pModel = (nModelIndex != 0) ? modelinfo->GetModel( nModelIndex ) : NULL;
		const char *pModelName = pModel ? modelinfo->GetModelName( pModel ) : "";

		KeyValues *msg = new KeyValues( "TempEntity" );

 		msg->SetInt( "te", TE_PHYSICS_PROP );
 		msg->SetString( "name", "TE_PhysicsProp" );
		msg->SetFloat( "time", gpGlobals->curtime );
		msg->SetFloat( "originx", start.x );
		msg->SetFloat( "originy", start.y );
		msg->SetFloat( "originz", start.z );
		msg->SetFloat( "anglesx", angles.x );
		msg->SetFloat( "anglesy", angles.y );
		msg->SetFloat( "anglesz", angles.z );
		msg->SetFloat( "velx", vel.x );
		msg->SetFloat( "vely", vel.y );
		msg->SetFloat( "velz", vel.z );
  		msg->SetString( "model", pModelName );
 		msg->SetInt( "breakmodel", flags );
		msg->SetInt( "skin", nSkin );
		msg->SetInt( "effects", nEffects );

		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
		msg->deleteThis();
	}
}
CRecordEffectOwner::~CRecordEffectOwner()
{
	if ( m_bToolsEnabled )
	{
		KeyValues *msg = new KeyValues( "EffectsOwner" );
		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
		msg->deleteThis();
	}
}
//-----------------------------------------------------------------------------
// Helper class to indicate ownership of effects
//-----------------------------------------------------------------------------
CRecordEffectOwner::CRecordEffectOwner( C_BaseEntity *pEntity, bool bIsViewModel )
{
	m_bToolsEnabled = ToolsEnabled() && clienttools->IsInRecordingMode();
	if ( m_bToolsEnabled )
	{
		KeyValues *msg = new KeyValues( "EffectsOwner" );
		msg->SetInt( "viewModel", bIsViewModel );
		ToolFramework_PostToolMessage( pEntity ? pEntity->GetToolHandle() : HTOOLHANDLE_INVALID, msg );
		msg->deleteThis();
	}
}
Ejemplo n.º 13
0
void CClientTools::OnEntityCreated( CBaseEntity *pEntity )
{
	if ( !m_bInRecordingMode )
		return;

	HTOOLHANDLE h = AttachToEntity( pEntity );

	// Send deletion message to tool interface
	KeyValues *kv = new KeyValues( "created" );
	ToolFramework_PostToolMessage( h, kv );
	kv->deleteThis();
}
Ejemplo n.º 14
0
//-----------------------------------------------------------------------------
// Purpose: Do the headlight
//-----------------------------------------------------------------------------
void CFlashlightEffect::UpdateLight(	int nEntIdx, const Vector &vecPos, const Vector &vecForward, const Vector &vecRight,
										const Vector &vecUp, float flFov, float flFarZ, float flLinearAtten, bool castsShadows, const char* pTextureName )
{
	VPROF_BUDGET( __FUNCTION__, VPROF_BUDGETGROUP_SHADOW_DEPTH_TEXTURING );

	m_nEntIndex = nEntIdx;
	m_flFov = flFov;
	m_flFarZ = flFarZ;
	m_flLinearAtten = flLinearAtten;

	if ( m_bCastsShadows != castsShadows )
	{
		// requires recreation of the flashlight
		LightOff();
	}
	m_bCastsShadows = castsShadows;

	UpdateFlashlightTexture( pTextureName );

	FlashlightState_t state;

	if ( UpdateDefaultFlashlightState( state, vecPos, vecForward, vecRight, vecUp, castsShadows ) == false )
	{
		return;
	}

	if( m_FlashlightHandle == CLIENTSHADOW_INVALID_HANDLE )
	{
		m_FlashlightHandle = g_pClientShadowMgr->CreateFlashlight( state );
	}
	else
	{
		if( !r_flashlightlockposition.GetBool() )
		{
			g_pClientShadowMgr->UpdateFlashlightState( m_FlashlightHandle, state );
		}
	}
	
	g_pClientShadowMgr->UpdateProjectedTexture( m_FlashlightHandle, true );
	
#ifndef NO_TOOLFRAMEWORK
	if ( clienttools->IsInRecordingMode() )
	{
		KeyValues *msg = new KeyValues( "FlashlightState" );
		msg->SetFloat( "time", gpGlobals->curtime );
		msg->SetInt( "entindex", m_nEntIndex );
		msg->SetInt( "flashlightHandle", m_FlashlightHandle );
		msg->SetPtr( "flashlightState", &state );
		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
		msg->deleteThis();
	}
#endif
}
Ejemplo n.º 15
0
void CClientTools::OnEntityCreated( CBaseEntity *pEntity )
{
	if ( !ToolsEnabled() )
		return;

	HTOOLHANDLE h = AttachToEntity( pEntity );

	// Send deletion message to tool interface
	KeyValues *kv = new KeyValues( "created" );
	kv->SetPtr( "esr", ( void* )pEntity );
	ToolFramework_PostToolMessage( h, kv );
	kv->deleteThis();
}
Ejemplo n.º 16
0
//-----------------------------------------------------------------------------
// Record effects
//-----------------------------------------------------------------------------
static void RecordEffect( const char *pEffectName, const CEffectData &data )
{
	if ( !ToolsEnabled() )
		return;

	if ( clienttools->IsInRecordingMode() && ( (data.m_fFlags & EFFECTDATA_NO_RECORD) == 0 ) )
	{
		KeyValues *msg = new KeyValues( "TempEntity" );

		const char *pSurfacePropName = physprops->GetPropName( data.m_nSurfaceProp );

		char pName[1024];
		Q_snprintf( pName, sizeof(pName), "TE_DispatchEffect %s %s", pEffectName, pSurfacePropName );

 		msg->SetInt( "te", TE_DISPATCH_EFFECT );
 		msg->SetString( "name", pName );
		msg->SetFloat( "time", gpGlobals->curtime );
		msg->SetFloat( "originx", data.m_vOrigin.x );
		msg->SetFloat( "originy", data.m_vOrigin.y );
		msg->SetFloat( "originz", data.m_vOrigin.z );
		msg->SetFloat( "startx", data.m_vStart.x );
		msg->SetFloat( "starty", data.m_vStart.y );
		msg->SetFloat( "startz", data.m_vStart.z );
		msg->SetFloat( "normalx", data.m_vNormal.x );
		msg->SetFloat( "normaly", data.m_vNormal.y );
		msg->SetFloat( "normalz", data.m_vNormal.z );
		msg->SetFloat( "anglesx", data.m_vAngles.x );
		msg->SetFloat( "anglesy", data.m_vAngles.y );
		msg->SetFloat( "anglesz", data.m_vAngles.z );
		msg->SetInt( "flags", data.m_fFlags );
		msg->SetFloat( "scale", data.m_flScale );
		msg->SetFloat( "magnitude", data.m_flMagnitude );
		msg->SetFloat( "radius", data.m_flRadius );
		msg->SetString( "surfaceprop", pSurfacePropName );
		msg->SetInt( "color", data.m_nColor );
		msg->SetInt( "damagetype", data.m_nDamageType );
		msg->SetInt( "hitbox", data.m_nHitBox );
 		msg->SetString( "effectname", pEffectName );

		// FIXME: Need to write the attachment name here
 		msg->SetInt( "attachmentindex", data.m_nAttachmentIndex );

		// NOTE: Ptrs are our way of indicating it's an entindex
		msg->SetPtr( "entindex", (void*)data.entindex() );

		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
		msg->deleteThis();
	}
}
Ejemplo n.º 17
0
void CClientTools::OnEntityDeleted( CBaseEntity *pEntity )
{
	HTOOLHANDLE handle = pEntity ? pEntity->GetToolHandle() : (HTOOLHANDLE)0;
	if ( handle == (HTOOLHANDLE)0 )
		return;

	if ( m_bInRecordingMode )
	{
		// Send deletion message to tool interface
		KeyValues *kv = new KeyValues( "deleted" );
		ToolFramework_PostToolMessage( handle, kv );
		kv->deleteThis();
	}

	DetachFromEntity( pEntity );
}
//-----------------------------------------------------------------------------
// Overrides for recording
//-----------------------------------------------------------------------------
void CNewParticleEffect::StopEmission( bool bInfiniteOnly, bool bRemoveAllParticles, bool bWakeOnStop )
{
	if ( m_nToolParticleEffectId != TOOLPARTICLESYSTEMID_INVALID && clienttools->IsInRecordingMode() )
	{
		KeyValues *msg = new KeyValues( "ParticleSystem_StopEmission" );

		static ParticleSystemStopEmissionState_t state;
		state.m_nParticleSystemId = GetToolParticleEffectId();
		state.m_flTime = gpGlobals->curtime;
		state.m_bInfiniteOnly = bInfiniteOnly;

		msg->SetPtr( "state", &state );
		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
	}

	CParticleCollection::StopEmission( bInfiniteOnly, bRemoveAllParticles, bWakeOnStop );
}
void CNewParticleEffect::SetControlPoint( int nWhichPoint, const Vector &v )
{
	if ( m_nToolParticleEffectId != TOOLPARTICLESYSTEMID_INVALID && clienttools->IsInRecordingMode() )
	{
		static ParticleSystemSetControlPointPositionState_t state;
		state.m_nParticleSystemId = GetToolParticleEffectId();
		state.m_flTime = gpGlobals->curtime;
		state.m_nControlPoint = nWhichPoint;
		state.m_vecPosition = v;

		KeyValues *msg = new KeyValues( "ParticleSystem_SetControlPointPosition" );
		msg->SetPtr( "state", &state );
		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
	}

	CParticleCollection::SetControlPoint( nWhichPoint, v );
}
Ejemplo n.º 20
0
void CClientTools::OnEntityCreated( CBaseEntity *pEntity )
{
	// It won't have a HTOOLHANDLE since it's new!!!
	if ( m_bInRecordingMode )
	{
		// Send deletion message to tool interface
		KeyValues *kv = new KeyValues( "created" );
		kv->SetPtr( "entity", pEntity );
		kv->SetInt( "index", pEntity->entindex() );
		kv->SetInt( "client", 1 );
		kv->SetString( "classname", pEntity->GetClassname() );

		HTOOLHANDLE h = AttachToEntity( pEntity );
		ToolFramework_PostToolMessage( h, kv );

		kv->deleteThis();
	}
}
void CNewParticleEffect::RecordControlPointOrientation( int nWhichPoint )
{
	if ( m_nToolParticleEffectId != TOOLPARTICLESYSTEMID_INVALID && clienttools->IsInRecordingMode() )
	{
		// FIXME: Make a more direct way of getting 
		QAngle angles;
		VectorAngles( m_ControlPoints[nWhichPoint].m_ForwardVector, m_ControlPoints[nWhichPoint].m_UpVector, angles );

		static ParticleSystemSetControlPointOrientationState_t state;
		state.m_nParticleSystemId = GetToolParticleEffectId();
		state.m_flTime = gpGlobals->curtime;
		state.m_nControlPoint = nWhichPoint;
		AngleQuaternion( angles, state.m_qOrientation );

		KeyValues *msg = new KeyValues( "ParticleSystem_SetControlPointOrientation" );
		msg->SetPtr( "state", &state );
		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
	}
}
Ejemplo n.º 22
0
void CNewParticleEffect::RecordCreation()
{
	if ( IsValid() && clienttools->IsInRecordingMode() )
	{
		m_bRecord = true;

		int nId = AllocateToolParticleEffectId();	

		static ParticleSystemCreatedState_t state;
		state.m_nParticleSystemId = nId;
		state.m_flTime = gpGlobals->curtime;
		state.m_pName = m_pDef->GetName();
		state.m_nOwner = m_hOwner ? m_hOwner->entindex() : -1;

		KeyValues *msg = new KeyValues( "ParticleSystem_Create" );
		msg->SetPtr( "state", &state );
		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
	}
}
Ejemplo n.º 23
0
//-----------------------------------------------------------------------------
// Shared code
//-----------------------------------------------------------------------------
static inline void RecordWorldDecal( const Vector *pos, int index )
{
	if ( !ToolsEnabled() )
		return;

	if ( clienttools->IsInRecordingMode() )
	{
		KeyValues *msg = new KeyValues( "TempEntity" );

 		msg->SetInt( "te", TE_WORLD_DECAL );
 		msg->SetString( "name", "TE_WorldDecal" );
		msg->SetFloat( "time", gpGlobals->curtime );
		msg->SetFloat( "originx", pos->x );
		msg->SetFloat( "originy", pos->y );
		msg->SetFloat( "originz", pos->z );
		msg->SetString( "decalname", effects->Draw_DecalNameFromIndex( index ) );

		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
		msg->deleteThis();
	}
}
Ejemplo n.º 24
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CFlashlightEffect::LightOff()
{
#ifndef NO_TOOLFRAMEWORK
	if ( clienttools->IsInRecordingMode() )
	{
		KeyValues *msg = new KeyValues( "FlashlightState" );
		msg->SetFloat( "time", gpGlobals->curtime );
		msg->SetInt( "entindex", m_nEntIndex );
		msg->SetInt( "flashlightHandle", m_FlashlightHandle );
		msg->SetPtr( "flashlightState", NULL );
		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
		msg->deleteThis();
	}
#endif

	// Clear out the light
	if( m_FlashlightHandle != CLIENTSHADOW_INVALID_HANDLE )
	{
		g_pClientShadowMgr->DestroyFlashlight( m_FlashlightHandle );
		m_FlashlightHandle = CLIENTSHADOW_INVALID_HANDLE;
	}
}
Ejemplo n.º 25
0
void TE_DynamicLight( IRecipientFilter& filter, float delay,
	const Vector* org, int r, int g, int b, int exponent, float radius, float time, float decay, int nLightIndex )
{
	dlight_t *dl = effects->CL_AllocDlight( nLightIndex );
	if ( !dl )
		return;

	dl->origin	= *org;
	dl->radius	= radius;
	dl->color.r	= r;
	dl->color.g	= g;
	dl->color.b	= b;
	dl->color.exponent	= exponent;
	dl->die		= gpGlobals->curtime + time;
	dl->decay	= decay;

	if ( ToolsEnabled() && clienttools->IsInRecordingMode() )
	{
		Color clr( r, g, b, 255 );

		KeyValues *msg = new KeyValues( "TempEntity" );

 		msg->SetInt( "te", TE_DYNAMIC_LIGHT );
 		msg->SetString( "name", "TE_DynamicLight" );
		msg->SetFloat( "time", gpGlobals->curtime );
		msg->SetFloat( "duration", time );
		msg->SetFloat( "originx", org->x );
		msg->SetFloat( "originy", org->y );
		msg->SetFloat( "originz", org->z );
		msg->SetFloat( "radius", radius );
		msg->SetFloat( "decay", decay );
		msg->SetColor( "color", clr );
 		msg->SetInt( "exponent", exponent );
 		msg->SetInt( "lightindex", nLightIndex );

		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
		msg->deleteThis();
	}
}
Ejemplo n.º 26
0
//-----------------------------------------------------------------------------
// Recording
//-----------------------------------------------------------------------------
static inline void RecordSmoke( const Vector &start, float flScale, int nFrameRate )
{
	if ( !ToolsEnabled() )
		return;

	if ( clienttools->IsInRecordingMode() )
	{
		KeyValues *msg = new KeyValues( "TempEntity" );

 		msg->SetInt( "te", TE_SMOKE );
 		msg->SetString( "name", "TE_Smoke" );
		msg->SetFloat( "time", gpGlobals->curtime );
		msg->SetFloat( "originx", start.x );
		msg->SetFloat( "originy", start.y );
		msg->SetFloat( "originz", start.z );
		msg->SetFloat( "scale", flScale );
		msg->SetInt( "framerate", nFrameRate );

		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
		msg->deleteThis();
	}
}
CNewParticleEffect::~CNewParticleEffect(void)
{
	if ( m_nToolParticleEffectId != TOOLPARTICLESYSTEMID_INVALID && clienttools->IsInRecordingMode() )
	{
		static ParticleSystemDestroyedState_t state;
		state.m_nParticleSystemId = gpGlobals->curtime;
		state.m_flTime = gpGlobals->curtime;

		KeyValues *msg = new KeyValues( "ParticleSystem_Destroy" );
		msg->SetPtr( "state", &state );

		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
		m_nToolParticleEffectId = TOOLPARTICLESYSTEMID_INVALID; 
	}

	m_bAllocated = false;
	if ( m_hOwner )
	{
		// NOTE: This can provoke another NotifyRemove call which is why flags is set to 0
		m_hOwner->ParticleProp()->OnParticleSystemDeleted( this );
	}
}
Ejemplo n.º 28
0
//-----------------------------------------------------------------------------
// Recording 
//-----------------------------------------------------------------------------
void C_TEShatterSurface::RecordShatterSurface( )
{
	if ( !ToolsEnabled() )
		return;

	if ( clienttools->IsInRecordingMode() )
	{
		Color front( m_uchFrontColor[0], m_uchFrontColor[1], m_uchFrontColor[2], 255 );
		Color back( m_uchBackColor[0], m_uchBackColor[1], m_uchBackColor[2], 255 );

		KeyValues *msg = new KeyValues( "TempEntity" );

 		msg->SetInt( "te", TE_SHATTER_SURFACE );
 		msg->SetString( "name", "TE_ShatterSurface" );
		msg->SetFloat( "time", gpGlobals->curtime );
		msg->SetFloat( "originx", m_vecOrigin.x );
		msg->SetFloat( "originy", m_vecOrigin.y );
		msg->SetFloat( "originz", m_vecOrigin.z );
		msg->SetFloat( "anglesx", m_vecAngles.x );
		msg->SetFloat( "anglesy", m_vecAngles.y );
		msg->SetFloat( "anglesz", m_vecAngles.z );
		msg->SetFloat( "forcex", m_vecForce.x );
		msg->SetFloat( "forcey", m_vecForce.y );
		msg->SetFloat( "forcez", m_vecForce.z );
		msg->SetFloat( "forceposx", m_vecForcePos.x );
		msg->SetFloat( "forceposy", m_vecForcePos.y );
		msg->SetFloat( "forceposz", m_vecForcePos.z );
		msg->SetColor( "frontcolor", front );
		msg->SetColor( "backcolor", back );
		msg->SetFloat( "width", m_flWidth );
		msg->SetFloat( "height", m_flHeight );
		msg->SetFloat( "size", m_flShardSize );
		msg->SetInt( "surfacetype", m_nSurfaceType );

		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
		msg->deleteThis();
	}
}
Ejemplo n.º 29
0
//-----------------------------------------------------------------------------
// Recording
//-----------------------------------------------------------------------------
static inline void RecordBreakModel( const Vector &start, const QAngle &angles, const Vector &size,
	const Vector &vel, int nModelIndex, int nRandomization, int nCount, float flDuration, int nFlags )
{
	if ( !ToolsEnabled() )
		return;

	if ( clienttools->IsInRecordingMode() )
	{
		const model_t* pModel = (nModelIndex != 0) ? modelinfo->GetModel( nModelIndex ) : NULL;
		const char *pModelName = pModel ? modelinfo->GetModelName( pModel ) : "";

		KeyValues *msg = new KeyValues( "TempEntity" );

 		msg->SetInt( "te", TE_BREAK_MODEL );
 		msg->SetString( "name", "TE_BreakModel" );
		msg->SetFloat( "time", gpGlobals->curtime );
		msg->SetFloat( "originx", start.x );
		msg->SetFloat( "originy", start.y );
		msg->SetFloat( "originz", start.z );
		msg->SetFloat( "anglesx", angles.x );
		msg->SetFloat( "anglesy", angles.y );
		msg->SetFloat( "anglesz", angles.z );
		msg->SetFloat( "sizex", size.x );
		msg->SetFloat( "sizey", size.y );
		msg->SetFloat( "sizez", size.z );
		msg->SetFloat( "velx", vel.x );
		msg->SetFloat( "vely", vel.y );
		msg->SetFloat( "velz", vel.z );
  		msg->SetString( "model", pModelName );
		msg->SetInt( "randomization", nRandomization );
		msg->SetInt( "count", nCount );
		msg->SetFloat( "duration", flDuration );
		msg->SetInt( "flags", nFlags );

		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
		msg->deleteThis();
	}
}
void CNewParticleEffect::Construct()
{
	m_vSortOrigin.Init();

	m_bDontRemove = false;
	m_bRemove = false;
	m_bDrawn = false;
	m_bNeedsBBoxUpdate = false;
	m_bIsFirstFrame = true;
	m_bAutoUpdateBBox = false;
	m_bAllocated = true;
	m_bSimulate = true;
	m_bShouldPerformCullCheck = false;

	m_nToolParticleEffectId = TOOLPARTICLESYSTEMID_INVALID;
	m_RefCount = 0;
	ParticleMgr()->AddEffect( this );
	m_LastMax = Vector( -1.0e6, -1.0e6, -1.0e6 );
	m_LastMin = Vector( 1.0e6, 1.0e6, 1.0e6 );
	m_MinBounds = Vector( 1.0e6, 1.0e6, 1.0e6 );
	m_MaxBounds = Vector( -1.0e6, -1.0e6, -1.0e6 );
	m_pDebugName = NULL;

	if ( IsValid() && clienttools->IsInRecordingMode() )
	{
		int nId = AllocateToolParticleEffectId();	

		static ParticleSystemCreatedState_t state;
		state.m_nParticleSystemId = nId;
		state.m_flTime = gpGlobals->curtime;
		state.m_pName = GetName();
		state.m_nOwner = m_hOwner.Get() ? m_hOwner->entindex() : -1;

		KeyValues *msg = new KeyValues( "ParticleSystem_Create" );
		msg->SetPtr( "state", &state );
		ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
	}
}