Skip to content

Commit 9a86826

Browse files
committed
Fix cl_muzzleflash_dlight_1st and disable it by default
1 parent c623a7c commit 9a86826

3 files changed

Lines changed: 37 additions & 5 deletions

File tree

src/game/client/tf/tf_fx_muzzleflash.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ CLIENTEFFECT_REGISTER_BEGIN( PrecacheEffect_TF_MuzzleFlash )
3232
CLIENTEFFECT_MATERIAL( "effects/muzzleflash4" )
3333
CLIENTEFFECT_REGISTER_END()
3434

35-
ConVar cl_muzzleflash_dlight_1st( "cl_muzzleflash_dlight_1st", "1" );
35+
ConVar cl_muzzleflash_dlight_1st( "cl_muzzleflash_dlight_1st", "0", FCVAR_ARCHIVE );
3636

3737
void TE_DynamicLight( IRecipientFilter& filter, float delay,
3838
const Vector* org, int r, int g, int b, int exponent, float radius, float time, float decay, int nLightIndex = LIGHT_INDEX_TE_DYNAMIC );

src/game/shared/tf/tf_weapon_minigun.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
#define TF_MINIGUN_SPINUP_TIME 0.75f
3636
#define TF_MINIGUN_PENALTY_PERIOD 1.f
3737

38+
#ifdef CLIENT_DLL
39+
extern ConVar cl_muzzleflash_dlight_1st;
40+
#endif
41+
3842
//=============================================================================
3943
//
4044
// Weapon Minigun tables.
@@ -365,6 +369,32 @@ void CTFMinigun::SharedAttack()
365369
// NVNT the local player fired a shot. notify the haptics system.
366370
if ( haptics )
367371
haptics->ProcessHapticEvent(2,"Weapons","minigun_fire");
372+
373+
374+
if ( cl_muzzleflash_dlight_1st.GetBool() == true && IsFirstPersonView() )
375+
{
376+
Vector vecOrigin;
377+
QAngle angAngles;
378+
void TE_DynamicLight( IRecipientFilter& filter, float delay,
379+
const Vector* org, int r, int g, int b, int exponent, float radius, float time, float decay, int nLightIndex = LIGHT_INDEX_TE_DYNAMIC );
380+
381+
m_hMuzzleEffectWeapon = GetWeaponForEffect();
382+
383+
// Try and setup the attachment point if it doesn't already exist.
384+
// This caching will mess up if we go third person from first - we only do this in taunts and don't fire so we should
385+
// be okay for now.
386+
if ( m_iMuzzleAttachment <= 0 )
387+
{
388+
m_iMuzzleAttachment = m_hMuzzleEffectWeapon->LookupAttachment( "muzzle" );
389+
}
390+
m_hMuzzleEffectWeapon->GetAttachment( m_iMuzzleAttachment, vecOrigin, angAngles );
391+
392+
if ( m_iMuzzleAttachment > 0 )
393+
{
394+
CLocalPlayerFilter filter;
395+
TE_DynamicLight( filter, 0.0f, &vecOrigin, 255, 192, 64, 5, 70.0f, 0.2f, 70.0f / 0.2f, LIGHT_INDEX_MUZZLEFLASH );
396+
}
397+
}
368398
}
369399
#endif
370400
CalcIsAttackCritical();

src/game/shared/tf/tf_weaponbase.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ extern ConVar tf_weapon_criticals_bucket_bottom;
9292

9393
#ifdef CLIENT_DLL
9494
extern ConVar cl_crosshair_file;
95+
extern ConVar cl_muzzleflash_dlight_1st;
9596
#endif
9697

9798
//=============================================================================
@@ -3130,10 +3131,11 @@ void CTFWeaponBase::CreateMuzzleFlashEffects( C_BaseEntity *pAttachEnt, int nInd
31303131
pAttachEnt->GetAttachment( iMuzzleFlashAttachment, vecOrigin, angAngles );
31313132

31323133
// Muzzleflash light
3133-
/*
3134-
CLocalPlayerFilter filter;
3135-
TE_DynamicLight( filter, 0.0f, &vecOrigin, 255, 192, 64, 5, 70.0f, 0.05f, 70.0f / 0.05f, LIGHT_INDEX_MUZZLEFLASH );
3136-
*/
3134+
if ( cl_muzzleflash_dlight_1st.GetBool() == true && IsFirstPersonView() )
3135+
{
3136+
CLocalPlayerFilter filter;
3137+
TE_DynamicLight( filter, 0.0f, &vecOrigin, 255, 192, 64, 5, 70.0f, 0.05f, 70.0f / 0.05f, LIGHT_INDEX_MUZZLEFLASH );
3138+
}
31373139

31383140
if ( pszMuzzleFlashEffect )
31393141
{

0 commit comments

Comments
 (0)