From b3e136981348bb4e25b63613d3bf58957c38cad7 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Wed, 14 May 2025 11:36:40 +0100 Subject: [PATCH 1/7] bonk --- .../weapons/weapon_neobasecombatweapon.cpp | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp b/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp index 76ecaf71d6..1fa536230a 100644 --- a/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp +++ b/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp @@ -961,9 +961,18 @@ bool CNEOBaseCombatWeapon::CanBePickedUpByClass(int classId) #ifdef CLIENT_DLL void CNEOBaseCombatWeapon::ProcessMuzzleFlashEvent() { - if (GetPlayerOwner() == NULL) + C_BasePlayer *owner = GetPlayerOwner(); + if (!owner) return; // If using a view model in first person, muzzle flashes are not processed until the player drops their weapon. In that case, do not play a muzzle flash effect. Need to change how this is calculated if we want to allow dropped weapons to cook off for example + C_BasePlayer *localPlayer = UTIL_PlayerByIndex(GetLocalPlayerIndex()); + if (!localPlayer) + return; + + // bIsVisible in function calling ProcessMuzzleFlashEvent is set to true even though this weapon may not be drawn? Probably same reason for the same check in C_BaseCombatWeapon::DrawModel + if (localPlayer->IsObserver() && localPlayer->GetObserverMode() == OBS_MODE_IN_EYE && localPlayer->GetObserverTarget() == owner) + return; + if ((GetNeoWepBits() & NEO_WEP_SUPPRESSED)) return; @@ -1029,25 +1038,9 @@ void CNEOBaseCombatWeapon::DrawCrosshair() } } -void CNEOBaseCombatWeapon::DispatchMuzzleParticleEffect(int iAttachment) { - static constexpr char particleName[] = "ntr_muzzle_source"; - constexpr bool resetAllParticlesOnEntity = false; - const ParticleAttachment_t iAttachType = ParticleAttachment_t::PATTACH_POINT_FOLLOW; - - CEffectData data; - - data.m_nHitBox = GetParticleSystemIndex(particleName); - data.m_hEntity = this; - data.m_fFlags |= PARTICLE_DISPATCH_FROM_ENTITY; - data.m_vOrigin = GetAbsOrigin(); - data.m_nDamageType = iAttachType; - data.m_nAttachmentIndex = iAttachment; - - if (resetAllParticlesOnEntity) - data.m_fFlags |= PARTICLE_DISPATCH_RESET_PARTICLES; - - CSingleUserRecipientFilter filter(UTIL_PlayerByIndex(GetLocalPlayerIndex())); - te->DispatchEffect(filter, 0.0, data.m_vOrigin, "ParticleEffect", data); +void CNEOBaseCombatWeapon::DispatchMuzzleParticleEffect(int iAttachment) +{ + CNewParticleEffect* pMuzzleFlashParticle = ParticleProp()->Create("ntr_muzzle_source", PATTACH_POINT_FOLLOW, iAttachment); } static inline bool ShouldDrawLocalPlayerViewModel(void) From 9b98c68292824c73376f0e794fa5b85a804a1e4b Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Wed, 14 May 2025 12:16:13 +0100 Subject: [PATCH 2/7] fix muzzle flash not rotating, also rotate muzzle flash with model --- .../neo/neo_predicted_viewmodel_muzzleflash.cpp | 15 ++++++--------- .../neo/neo_predicted_viewmodel_muzzleflash.h | 1 - 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp b/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp index d37e4765be..feebef25cc 100644 --- a/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp +++ b/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp @@ -29,13 +29,11 @@ BEGIN_NETWORK_TABLE(CNEOPredictedViewModelMuzzleFlash, DT_NEOPredictedViewModelM #ifndef CLIENT_DLL SendPropEHandle(SENDINFO_NAME(m_hMoveParent, moveparent)), SendPropBool(SENDINFO(m_bActive)), -SendPropInt(SENDINFO(m_iAngleZ)), SendPropInt(SENDINFO(m_iAngleZIncrement)), SendPropBool(SENDINFO(m_bScaleChangeFlag)) #else RecvPropInt(RECVINFO_NAME(m_hNetworkMoveParent, moveparent), 0, RecvProxy_IntToMoveParent), RecvPropBool(RECVINFO(m_bActive)), -RecvPropInt(RECVINFO(m_iAngleZ)), RecvPropInt(RECVINFO(m_iAngleZIncrement)), RecvPropEHandle(RECVINFO(m_bScaleChangeFlag), RecvProxy_ScaleChangeFlag) #endif @@ -45,7 +43,6 @@ END_NETWORK_TABLE() BEGIN_PREDICTION_DATA(CNEOPredictedViewModelMuzzleFlash) DEFINE_PRED_FIELD(m_hNetworkMoveParent, FIELD_EHANDLE, FTYPEDESC_INSENDTABLE), DEFINE_PRED_FIELD(m_bActive, FIELD_BOOLEAN, FTYPEDESC_INSENDTABLE), -DEFINE_PRED_FIELD(m_iAngleZ, FIELD_INTEGER, FTYPEDESC_INSENDTABLE), DEFINE_PRED_FIELD(m_iAngleZIncrement, FIELD_INTEGER, FTYPEDESC_INSENDTABLE), DEFINE_PRED_FIELD(m_bScaleChangeFlag, FIELD_BOOLEAN, FTYPEDESC_INSENDTABLE), END_PREDICTION_DATA() @@ -58,7 +55,9 @@ constexpr const char* MUZZLE_FLASH_ENTITY_MODEL = "models/effect/fpmf/fpmf01.mdl CNEOPredictedViewModelMuzzleFlash::CNEOPredictedViewModelMuzzleFlash() { m_bActive = true; +#ifdef CLIENT_DLL m_iAngleZ = 0; +#endif // CLIENT_DLL m_iAngleZIncrement = -5; m_flTimeSwitchOffMuzzleFlash = gpGlobals->curtime; m_bScaleChangeFlag = false; @@ -108,7 +107,7 @@ int CNEOPredictedViewModelMuzzleFlash::DrawModel(int flags) vm->GetAttachment(iAttachment, localOrigin, localAngle); UncorrectViewModelAttachment(localOrigin); // Need position of muzzle without fov modifications & viewmodel offset m_iAngleZ = (m_iAngleZ + m_iAngleZIncrement) % 360; // NEOTODO (Adam) ? Speed of rotation depends on how often DrawModel() is called. Should this be tied to global time? - localAngle.z = m_iAngleZ; + localAngle.z += m_iAngleZ; SetAbsOrigin(localOrigin); SetAbsAngles(localAngle); @@ -145,6 +144,9 @@ void CNEOPredictedViewModelMuzzleFlash::UpdateMuzzleFlashProperties(CBaseCombatW return; } +#ifdef CLIENT_DLL + m_iAngleZ = 0; +#endif // CLIENT_DLL const auto neoWepBits = neoWep->GetNeoWepBits(); if (neoWepBits & (NEO_WEP_THROWABLE | NEO_WEP_GHOST | NEO_WEP_KNIFE | NEO_WEP_SUPPRESSED)) { @@ -154,7 +156,6 @@ void CNEOPredictedViewModelMuzzleFlash::UpdateMuzzleFlashProperties(CBaseCombatW { m_bActive = true; m_nSkin = 1; - m_iAngleZ = 0; m_iAngleZIncrement = -100; SetModelScale(0.75); m_bScaleChangeFlag = !m_bScaleChangeFlag; @@ -163,7 +164,6 @@ void CNEOPredictedViewModelMuzzleFlash::UpdateMuzzleFlashProperties(CBaseCombatW { m_bActive = true; m_nSkin = 1; - m_iAngleZ = 0; m_iAngleZIncrement = -90; SetModelScale(2); m_bScaleChangeFlag = !m_bScaleChangeFlag; @@ -172,7 +172,6 @@ void CNEOPredictedViewModelMuzzleFlash::UpdateMuzzleFlashProperties(CBaseCombatW { m_bActive = true; m_nSkin = 0; - m_iAngleZ = 0; m_iAngleZIncrement = -90; SetModelScale(0.75); m_bScaleChangeFlag = !m_bScaleChangeFlag; @@ -181,7 +180,6 @@ void CNEOPredictedViewModelMuzzleFlash::UpdateMuzzleFlashProperties(CBaseCombatW { m_bActive = true; m_nSkin = 0; - m_iAngleZ = 0; m_iAngleZIncrement = -100; SetModelScale(0.6); m_bScaleChangeFlag = !m_bScaleChangeFlag; @@ -190,7 +188,6 @@ void CNEOPredictedViewModelMuzzleFlash::UpdateMuzzleFlashProperties(CBaseCombatW { m_bActive = true; m_nSkin = 0; - m_iAngleZ = 0; m_iAngleZIncrement = -90; SetModelScale(0.75); m_bScaleChangeFlag = !m_bScaleChangeFlag; diff --git a/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.h b/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.h index a5ecd45551..3baffd133e 100644 --- a/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.h +++ b/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.h @@ -44,7 +44,6 @@ class CNEOPredictedViewModelMuzzleFlash : public CPredictedViewModel bool m_bScaleChangeFlag; #else CNetworkVar(bool, m_bActive); - CNetworkVar(int, m_iAngleZ); CNetworkVar(int, m_iAngleZIncrement); CNetworkVar(bool, m_bScaleChangeFlag); #endif // CLIENT_DLL From 764113cd473aa7a3b59fe3c5128992b6cb2ff40e Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Wed, 14 May 2025 12:47:55 +0100 Subject: [PATCH 3/7] do we really need a function for a one liner now --- src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp | 7 +------ src/game/shared/neo/weapons/weapon_neobasecombatweapon.h | 1 - 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp b/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp index 1fa536230a..6e0fdbeb2d 100644 --- a/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp +++ b/src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp @@ -1005,7 +1005,7 @@ void CNEOBaseCombatWeapon::ProcessMuzzleFlashEvent() el->color.exponent = 5; // Muzzle flash particle - DispatchMuzzleParticleEffect(iAttachment); + ParticleProp()->Create("ntr_muzzle_source", PATTACH_POINT_FOLLOW, iAttachment); } void CNEOBaseCombatWeapon::DrawCrosshair() @@ -1038,11 +1038,6 @@ void CNEOBaseCombatWeapon::DrawCrosshair() } } -void CNEOBaseCombatWeapon::DispatchMuzzleParticleEffect(int iAttachment) -{ - CNewParticleEffect* pMuzzleFlashParticle = ParticleProp()->Create("ntr_muzzle_source", PATTACH_POINT_FOLLOW, iAttachment); -} - static inline bool ShouldDrawLocalPlayerViewModel(void) { return !C_BasePlayer::ShouldDrawLocalPlayer(); diff --git a/src/game/shared/neo/weapons/weapon_neobasecombatweapon.h b/src/game/shared/neo/weapons/weapon_neobasecombatweapon.h index 4f717060e7..fdb6a3fadb 100644 --- a/src/game/shared/neo/weapons/weapon_neobasecombatweapon.h +++ b/src/game/shared/neo/weapons/weapon_neobasecombatweapon.h @@ -195,7 +195,6 @@ class CNEOBaseCombatWeapon : public CBaseHL2MPCombatWeapon virtual Activity GetPrimaryAttackActivity(void) override; #ifdef CLIENT_DLL - void DispatchMuzzleParticleEffect(int iAttachment); virtual void ProcessMuzzleFlashEvent(void) override; void DrawCrosshair() override; #endif From 8c6e02d1ffe819448e61fb8e7cdc72a0a465bf4f Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Wed, 14 May 2025 17:37:52 +0100 Subject: [PATCH 4/7] move setorigin and angles to CalcViewModelView --- .../neo_predicted_viewmodel_muzzleflash.cpp | 58 ++++++++++++------- .../neo/neo_predicted_viewmodel_muzzleflash.h | 1 + 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp b/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp index feebef25cc..59296b04dc 100644 --- a/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp +++ b/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp @@ -92,28 +92,11 @@ void CNEOPredictedViewModelMuzzleFlash::Spawn(void) #ifdef CLIENT_DLL int CNEOPredictedViewModelMuzzleFlash::DrawModel(int flags) { - if (m_flTimeSwitchOffMuzzleFlash > gpGlobals->curtime && m_bActive) + if (!m_bActive || m_flTimeSwitchOffMuzzleFlash <= gpGlobals->curtime && m_bActive) { - CBasePlayer* pOwner = ToBasePlayer(GetOwner()); - if (pOwner == NULL) { return -1; } - CBaseViewModel* vm = pOwner->GetViewModel(0, false); - if (vm == NULL || !vm->IsVisible()) { return -1; } - - int iAttachment = vm->LookupAttachment("muzzle"); - if (iAttachment < 0) { return -1; } - - Vector localOrigin; - QAngle localAngle; - vm->GetAttachment(iAttachment, localOrigin, localAngle); - UncorrectViewModelAttachment(localOrigin); // Need position of muzzle without fov modifications & viewmodel offset - m_iAngleZ = (m_iAngleZ + m_iAngleZIncrement) % 360; // NEOTODO (Adam) ? Speed of rotation depends on how often DrawModel() is called. Should this be tied to global time? - localAngle.z += m_iAngleZ; - SetAbsOrigin(localOrigin); - SetAbsAngles(localAngle); - - return BaseClass::DrawModel(flags); + return -1; } - return -1; + return BaseClass::DrawModel(flags); } void CNEOPredictedViewModelMuzzleFlash::ClientThink() @@ -129,6 +112,41 @@ void CNEOPredictedViewModelMuzzleFlash::ClientThink() #endif //CLIENT_DLL +void CNEOPredictedViewModelMuzzleFlash::CalcViewModelView(CBasePlayer* pOwner, + const Vector& eyePosition, const QAngle& eyeAngles) +{ +#ifdef GAME_DLL + return; +#endif // GAME_DLL + + if (!m_bActive || m_flTimeSwitchOffMuzzleFlash <= gpGlobals->curtime && m_bActive) + { + return; + } + + auto vm = static_cast(GetMoveParent()); + if (!vm) + { + return; + } + + int iAttachment = vm->LookupAttachment("muzzle"); + if (iAttachment < 0) { + return; + } + + Vector localOrigin; + QAngle localAngle; + vm->GetAttachment(iAttachment, localOrigin, localAngle); +#ifdef CLIENT_DLL + UncorrectViewModelAttachment(localOrigin); // Need position of muzzle without fov modifications & viewmodel offset + m_iAngleZ = (m_iAngleZ + m_iAngleZIncrement) % 360; // NEOTODO (Adam) ? Speed of rotation depends on how often DrawModel() is called. Should this be tied to global time? + localAngle.z += m_iAngleZ; +#endif //CLIENT_DLL + SetAbsOrigin(localOrigin); + SetAbsAngles(localAngle); +} + void CNEOPredictedViewModelMuzzleFlash::UpdateMuzzleFlashProperties(CBaseCombatWeapon* pWeapon, bool repeat) { auto neoWep = static_cast(pWeapon); diff --git a/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.h b/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.h index 3baffd133e..6189e30774 100644 --- a/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.h +++ b/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.h @@ -20,6 +20,7 @@ class CNEOPredictedViewModelMuzzleFlash : public CPredictedViewModel DECLARE_PREDICTABLE(); CNEOPredictedViewModelMuzzleFlash(); virtual ~CNEOPredictedViewModelMuzzleFlash(); + virtual void CalcViewModelView(CBasePlayer* pOwner, const Vector& eyePosition, const QAngle& eyeAngles); void UpdateMuzzleFlashProperties(CBaseCombatWeapon* pWeapon, bool repeat = true); virtual void Spawn(void) override; virtual void Precache(void) override; From 9731c413b0f6c4cbb747c6eda4a0eb1a0b799f2e Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Wed, 14 May 2025 17:43:11 +0100 Subject: [PATCH 5/7] update comment --- src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp b/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp index 59296b04dc..65fedd83c3 100644 --- a/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp +++ b/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp @@ -140,7 +140,7 @@ void CNEOPredictedViewModelMuzzleFlash::CalcViewModelView(CBasePlayer* pOwner, vm->GetAttachment(iAttachment, localOrigin, localAngle); #ifdef CLIENT_DLL UncorrectViewModelAttachment(localOrigin); // Need position of muzzle without fov modifications & viewmodel offset - m_iAngleZ = (m_iAngleZ + m_iAngleZIncrement) % 360; // NEOTODO (Adam) ? Speed of rotation depends on how often DrawModel() is called. Should this be tied to global time? + m_iAngleZ = (m_iAngleZ + m_iAngleZIncrement) % 360; // NEOTODO (Adam) ? Speed of rotation depends on how often CalcViewModel() is called. Should this be tied to global time? localAngle.z += m_iAngleZ; #endif //CLIENT_DLL SetAbsOrigin(localOrigin); From bfb7c13cfe38cd7cc48d431d01f35c96d8a13c33 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Wed, 14 May 2025 18:28:59 +0100 Subject: [PATCH 6/7] that was a bad idea --- src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp b/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp index 65fedd83c3..8d2cea5ddf 100644 --- a/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp +++ b/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp @@ -119,11 +119,6 @@ void CNEOPredictedViewModelMuzzleFlash::CalcViewModelView(CBasePlayer* pOwner, return; #endif // GAME_DLL - if (!m_bActive || m_flTimeSwitchOffMuzzleFlash <= gpGlobals->curtime && m_bActive) - { - return; - } - auto vm = static_cast(GetMoveParent()); if (!vm) { From f0af60bde31c4ce6d3e300a43001005eac271069 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Thu, 31 Jul 2025 13:35:21 +0100 Subject: [PATCH 7/7] don't network m_iAngleZIncrement --- .../neo_predicted_viewmodel_muzzleflash.cpp | 24 ++++++++++--------- .../neo/neo_predicted_viewmodel_muzzleflash.h | 4 ++-- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp b/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp index 8d2cea5ddf..bd4c194eee 100644 --- a/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp +++ b/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.cpp @@ -29,12 +29,10 @@ BEGIN_NETWORK_TABLE(CNEOPredictedViewModelMuzzleFlash, DT_NEOPredictedViewModelM #ifndef CLIENT_DLL SendPropEHandle(SENDINFO_NAME(m_hMoveParent, moveparent)), SendPropBool(SENDINFO(m_bActive)), -SendPropInt(SENDINFO(m_iAngleZIncrement)), SendPropBool(SENDINFO(m_bScaleChangeFlag)) #else RecvPropInt(RECVINFO_NAME(m_hNetworkMoveParent, moveparent), 0, RecvProxy_IntToMoveParent), RecvPropBool(RECVINFO(m_bActive)), -RecvPropInt(RECVINFO(m_iAngleZIncrement)), RecvPropEHandle(RECVINFO(m_bScaleChangeFlag), RecvProxy_ScaleChangeFlag) #endif END_NETWORK_TABLE() @@ -43,7 +41,6 @@ END_NETWORK_TABLE() BEGIN_PREDICTION_DATA(CNEOPredictedViewModelMuzzleFlash) DEFINE_PRED_FIELD(m_hNetworkMoveParent, FIELD_EHANDLE, FTYPEDESC_INSENDTABLE), DEFINE_PRED_FIELD(m_bActive, FIELD_BOOLEAN, FTYPEDESC_INSENDTABLE), -DEFINE_PRED_FIELD(m_iAngleZIncrement, FIELD_INTEGER, FTYPEDESC_INSENDTABLE), DEFINE_PRED_FIELD(m_bScaleChangeFlag, FIELD_BOOLEAN, FTYPEDESC_INSENDTABLE), END_PREDICTION_DATA() #endif @@ -57,8 +54,8 @@ CNEOPredictedViewModelMuzzleFlash::CNEOPredictedViewModelMuzzleFlash() m_bActive = true; #ifdef CLIENT_DLL m_iAngleZ = 0; -#endif // CLIENT_DLL m_iAngleZIncrement = -5; +#endif // CLIENT_DLL m_flTimeSwitchOffMuzzleFlash = gpGlobals->curtime; m_bScaleChangeFlag = false; } @@ -115,10 +112,7 @@ void CNEOPredictedViewModelMuzzleFlash::ClientThink() void CNEOPredictedViewModelMuzzleFlash::CalcViewModelView(CBasePlayer* pOwner, const Vector& eyePosition, const QAngle& eyeAngles) { -#ifdef GAME_DLL - return; -#endif // GAME_DLL - +#ifdef CLIENT_DLL auto vm = static_cast(GetMoveParent()); if (!vm) { @@ -133,13 +127,11 @@ void CNEOPredictedViewModelMuzzleFlash::CalcViewModelView(CBasePlayer* pOwner, Vector localOrigin; QAngle localAngle; vm->GetAttachment(iAttachment, localOrigin, localAngle); -#ifdef CLIENT_DLL UncorrectViewModelAttachment(localOrigin); // Need position of muzzle without fov modifications & viewmodel offset - m_iAngleZ = (m_iAngleZ + m_iAngleZIncrement) % 360; // NEOTODO (Adam) ? Speed of rotation depends on how often CalcViewModel() is called. Should this be tied to global time? localAngle.z += m_iAngleZ; -#endif //CLIENT_DLL SetAbsOrigin(localOrigin); SetAbsAngles(localAngle); +#endif //CLIENT_DLL } void CNEOPredictedViewModelMuzzleFlash::UpdateMuzzleFlashProperties(CBaseCombatWeapon* pWeapon, bool repeat) @@ -169,7 +161,9 @@ void CNEOPredictedViewModelMuzzleFlash::UpdateMuzzleFlashProperties(CBaseCombatW { m_bActive = true; m_nSkin = 1; +#ifdef CLIENT_DLL m_iAngleZIncrement = -100; +#endif SetModelScale(0.75); m_bScaleChangeFlag = !m_bScaleChangeFlag; } @@ -177,7 +171,9 @@ void CNEOPredictedViewModelMuzzleFlash::UpdateMuzzleFlashProperties(CBaseCombatW { m_bActive = true; m_nSkin = 1; +#ifdef CLIENT_DLL m_iAngleZIncrement = -90; +#endif SetModelScale(2); m_bScaleChangeFlag = !m_bScaleChangeFlag; } @@ -185,7 +181,9 @@ void CNEOPredictedViewModelMuzzleFlash::UpdateMuzzleFlashProperties(CBaseCombatW { m_bActive = true; m_nSkin = 0; +#ifdef CLIENT_DLL m_iAngleZIncrement = -90; +#endif SetModelScale(0.75); m_bScaleChangeFlag = !m_bScaleChangeFlag; } @@ -193,7 +191,9 @@ void CNEOPredictedViewModelMuzzleFlash::UpdateMuzzleFlashProperties(CBaseCombatW { m_bActive = true; m_nSkin = 0; +#ifdef CLIENT_DLL m_iAngleZIncrement = -100; +#endif SetModelScale(0.6); m_bScaleChangeFlag = !m_bScaleChangeFlag; } @@ -201,7 +201,9 @@ void CNEOPredictedViewModelMuzzleFlash::UpdateMuzzleFlashProperties(CBaseCombatW { m_bActive = true; m_nSkin = 0; +#ifdef CLIENT_DLL m_iAngleZIncrement = -90; +#endif SetModelScale(0.75); m_bScaleChangeFlag = !m_bScaleChangeFlag; } diff --git a/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.h b/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.h index 6189e30774..1a940b2757 100644 --- a/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.h +++ b/src/game/shared/neo/neo_predicted_viewmodel_muzzleflash.h @@ -20,7 +20,7 @@ class CNEOPredictedViewModelMuzzleFlash : public CPredictedViewModel DECLARE_PREDICTABLE(); CNEOPredictedViewModelMuzzleFlash(); virtual ~CNEOPredictedViewModelMuzzleFlash(); - virtual void CalcViewModelView(CBasePlayer* pOwner, const Vector& eyePosition, const QAngle& eyeAngles); + virtual void CalcViewModelView(CBasePlayer* pOwner, const Vector& eyePosition, const QAngle& eyeAngles) override; void UpdateMuzzleFlashProperties(CBaseCombatWeapon* pWeapon, bool repeat = true); virtual void Spawn(void) override; virtual void Precache(void) override; @@ -32,6 +32,7 @@ class CNEOPredictedViewModelMuzzleFlash : public CPredictedViewModel { if (!m_bActive) return; + m_iAngleZ = (m_iAngleZ + m_iAngleZIncrement) % 360; m_flTimeSwitchOffMuzzleFlash = gpGlobals->curtime + 0.01f; BaseClass::ProcessMuzzleFlashEvent(); } @@ -45,7 +46,6 @@ class CNEOPredictedViewModelMuzzleFlash : public CPredictedViewModel bool m_bScaleChangeFlag; #else CNetworkVar(bool, m_bActive); - CNetworkVar(int, m_iAngleZIncrement); CNetworkVar(bool, m_bScaleChangeFlag); #endif // CLIENT_DLL float m_flTimeSwitchOffMuzzleFlash;