cl_dll/c_fire_smoke.cpp
151617181920
#include "iefx.h"
#include "dlight.h"
#include "vstdlib/ICommandLine.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
15161718192021
#include "iefx.h"
#include "dlight.h"
#include "vstdlib/ICommandLine.h"
#include "iinput.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
797798799800801802
m_flLifetime = 0;
m_bStartedFading = false;
m_bCreatedClientside = false;
}
//-----------------------------------------------------------------------------
798799800801802803804
m_flLifetime = 0;
m_bStartedFading = false;
m_bCreatedClientside = false;
m_bUnderwater = false;
}
//-----------------------------------------------------------------------------
808809810811812813814
{
for (int i = 0; i < NUM_HITBOX_FIRES; i++)
{
delete m_pFireSmoke[i];
}
}
}
810811812813814815816817818819820
{
for (int i = 0; i < NUM_HITBOX_FIRES; i++)
{
if( m_pFireSmoke[i] )
{
delete m_pFireSmoke[i];
m_pFireSmoke[i] = NULL;
}
}
}
}
855856857858859860
C_BaseEntity *pEnt = m_hEntAttached;
if ( !pEnt )
return;
if ( m_bUseHitboxes && pEnt->GetBaseAnimating() != NULL )
{
861862863864865866867868869870871872873874875876877878
C_BaseEntity *pEnt = m_hEntAttached;
if ( !pEnt )
return;
// --> Mirv: Don't attach to local player in first person mode
if (pEnt == CBasePlayer::GetLocalPlayer() && !input->CAM_IsThirdPerson())
return;
// <--
// Mulch: Don't do flame underwater
if( pEnt->GetWaterLevel() > 0 )
{
m_bUnderwater = true;
return;
}
if ( m_bUseHitboxes && pEnt->GetBaseAnimating() != NULL )
{
879880881882883884
m_pEmitter->SetSortOrigin( GetAbsOrigin() );
}
}
}
BaseClass::OnDataChanged( updateType );
897898899900901902903904
m_pEmitter->SetSortOrigin( GetAbsOrigin() );
}
}
SetNextClientThink( CLIENT_THINK_ALWAYS );
}
BaseClass::OnDataChanged( updateType );
100310041005100610071008
void C_EntityFlame::ClientThink( void )
{
for (int i = 0; i < NUM_HITBOX_FIRES; i++)
{
if ( m_pFireSmoke[i] != NULL )
102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052
void C_EntityFlame::ClientThink( void )
{
// Mulch: Want to client think here to
// stop flames on ragdolls when they enter the water
if( m_hEntAttached )
{
if( UTIL_PointContents( m_vecLastPosition ) & CONTENTS_WATER )
{
// We're under water!
m_bUnderwater = true;
// Stop drawing on this client
DeleteHitBoxFlames();
// Stop playing the burning sound
StopSound( "General.BurningFlesh" );
StopSound( "General.BurningObject" );
//EmitSound( "General.StopBurning" );
// Don't think anymore
return;
}
}
// Mulch: Commented out for CL_CopyExistingEntity stuff error
/*
for (int i = 0; i < NUM_HITBOX_FIRES; i++)
{
if ( m_pFireSmoke[i] != NULL )
103310341035103610371038
}
}
}
SetNextClientThink( gpGlobals->curtime + 0.1f );
}
1077107810791080108110821083
}
}
}
*/
SetNextClientThink( gpGlobals->curtime + 0.1f );
}
108210831084108510861087
return 0;
}
//-----------------------------------------------------------------------------
// Purpose: Attaches fire to the hitboxes of an animating character. The fire
1127112811291130113111321133
return 0;
}
#include "c_baseplayer.h"
//-----------------------------------------------------------------------------
// Purpose: Attaches fire to the hitboxes of an animating character. The fire
1092109310941095109610971098
{
m_pCachedModel = NULL;
C_BaseCombatCharacter *pAnimating = (C_BaseCombatCharacter *)m_hEntAttached.Get();
if (!pAnimating || !pAnimating->GetModel())
{
return;
1138113911401141114211431144
{
m_pCachedModel = NULL;
C_BaseCombatCharacter *pAnimating = (C_BaseCombatCharacter *) m_hEntAttached.Get();
if (!pAnimating || !pAnimating->GetModel())
{
return;
11511152115311541155115611571158115911601161
{
hitboxindex = random->RandomInt( 0, set->numhitboxes - 1 );
}
mstudiobbox_t *pBox = set->pHitbox( hitboxvolume[hitboxindex].nIndex );
Assert( hitboxbones[pBox->bone] );
m_nHitbox[i] = hitboxvolume[hitboxindex].nIndex;
m_pFireSmoke[i] = new C_FireSmoke;
11971198119912001201120212031204120512061207
{
hitboxindex = random->RandomInt( 0, set->numhitboxes - 1 );
}
mstudiobbox_t *pBox = set->pHitbox( hitboxvolume[hitboxindex].nIndex );
Assert( hitboxbones[pBox->bone] );
m_nHitbox[i] = hitboxvolume[hitboxindex].nIndex;
m_pFireSmoke[i] = new C_FireSmoke;
1167116811691170117111721173
VectorTransform( m_vecFireOrigin[i], *hitboxbones[pBox->bone], vecAbsOrigin);
m_pFireSmoke[i]->SetLocalOrigin( vecAbsOrigin );
//
// The first fire emits smoke, the rest do not.
//
1213121412151216121712181219
VectorTransform( m_vecFireOrigin[i], *hitboxbones[pBox->bone], vecAbsOrigin);
m_pFireSmoke[i]->SetLocalOrigin( vecAbsOrigin );
//
// The first fire emits smoke, the rest do not.
//
1182118311841185118611871188
m_pFireSmoke[i]->m_flChildFlameSpread = 20.0;
m_pFireSmoke[i]->m_flScaleStart = 0;
m_pFireSmoke[i]->SetOwnerEntity( this );
// Do a simple That Looks About Right clamp on the volumes
// so that we don't get flames too large or too tiny.
float flVolume = hitboxvolume[hitboxindex].flVolume;
1228122912301231123212331234
m_pFireSmoke[i]->m_flChildFlameSpread = 20.0;
m_pFireSmoke[i]->m_flScaleStart = 0;
m_pFireSmoke[i]->SetOwnerEntity( this );
// Do a simple That Looks About Right clamp on the volumes
// so that we don't get flames too large or too tiny.
float flVolume = hitboxvolume[hitboxindex].flVolume;
120112021203120412051206120712081209
flVolume = FLAME_HITBOX_MAX_VOLUME;
}
m_pFireSmoke[i]->m_flScaleEnd = 0.00012f * flVolume;
m_pFireSmoke[i]->m_flScaleTimeStart = Helper_GetTime();
m_pFireSmoke[i]->m_flScaleTimeEnd = Helper_GetTime() + 2.0;
m_pFireSmoke[i]->StartClientOnly();
}
124712481249125012511252125312541255
flVolume = FLAME_HITBOX_MAX_VOLUME;
}
m_pFireSmoke[i]->m_flScaleEnd = 0.00012f * m_flSize * flVolume;
m_pFireSmoke[i]->m_flScaleTimeStart = Helper_GetTime();
m_pFireSmoke[i]->m_flScaleTimeEnd = Helper_GetTime() + 0.1;
m_pFireSmoke[i]->StartClientOnly();
}
12191220122112221223122412251226
{
for ( int i = 0; i < NUM_HITBOX_FIRES; i++ )
{
m_pFireSmoke[i]->RemoveClientOnly();
delete m_pFireSmoke[i];
}
}
126512661267126812691270127112721273127412751276
{
for ( int i = 0; i < NUM_HITBOX_FIRES; i++ )
{
if( m_pFireSmoke[i] )
{
m_pFireSmoke[i]->RemoveClientOnly();
delete m_pFireSmoke[i];
m_pFireSmoke[i] = NULL;
}
}
}
123012311232123312341235
//-----------------------------------------------------------------------------
void C_EntityFlame::UpdateHitBoxFlames( void )
{
C_BaseCombatCharacter *pAnimating = (C_BaseCombatCharacter *)m_hEntAttached.Get();
if (!pAnimating)
{
128012811282128312841285128612871288
//-----------------------------------------------------------------------------
void C_EntityFlame::UpdateHitBoxFlames( void )
{
if( m_bUnderwater )
return;
C_BaseCombatCharacter *pAnimating = (C_BaseCombatCharacter *)m_hEntAttached.Get();
if (!pAnimating)
{
1244124512461247124812491250
DeleteHitBoxFlames();
AttachToHitBoxes();
}
if (m_pCachedModel == NULL)
{
// We tried to reattach and failed.
1297129812991300130113021303
DeleteHitBoxFlames();
AttachToHitBoxes();
}
if (m_pCachedModel == NULL)
{
// We tried to reattach and failed.
1275127612771278127912801281
{
Vector vecAbsOrigin;
mstudiobbox_t *pBox = set->pHitbox(m_nHitbox[i]);
VectorTransform(m_vecFireOrigin[i], pAnimating->GetBoneForWrite( pBox->bone ), vecAbsOrigin);
m_pFireSmoke[i]->SetLocalOrigin(vecAbsOrigin);
1328132913301331133213331334
{
Vector vecAbsOrigin;
mstudiobbox_t *pBox = set->pHitbox(m_nHitbox[i]);
VectorTransform(m_vecFireOrigin[i], pAnimating->GetBoneForWrite( pBox->bone ), vecAbsOrigin);
m_pFireSmoke[i]->SetLocalOrigin(vecAbsOrigin);
1282128312841285128612871288
}
}
//CLIENTEFFECT_REGISTER_BEGIN( PrecacheEffectStriderKill )
//CLIENTEFFECT_MATERIAL( "effects/spark" )
//CLIENTEFFECT_REGISTER_END()
133513361337133813391340
}
}
//CLIENTEFFECT_REGISTER_BEGIN( PrecacheEffectStriderKill )
//CLIENTEFFECT_MATERIAL( "effects/spark" )
//CLIENTEFFECT_REGISTER_END()