aboutsummaryrefslogtreecommitdiff
path: root/mp/src/game/client/c_baseviewmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mp/src/game/client/c_baseviewmodel.cpp')
-rw-r--r--mp/src/game/client/c_baseviewmodel.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/mp/src/game/client/c_baseviewmodel.cpp b/mp/src/game/client/c_baseviewmodel.cpp
index 8ae21f63..28c804fb 100644
--- a/mp/src/game/client/c_baseviewmodel.cpp
+++ b/mp/src/game/client/c_baseviewmodel.cpp
@@ -18,6 +18,9 @@
#include "tools/bonelist.h"
#include <KeyValues.h>
#include "hltvcamera.h"
+#ifdef TF_CLIENT_DLL
+ #include "tf_weaponbase.h"
+#endif
#if defined( REPLAY_ENABLED )
#include "replay/replaycamera.h"
@@ -53,8 +56,8 @@ void FormatViewModelAttachment( Vector &vOrigin, bool bInverse )
// aspect ratio cancels out, so only need one factor
// the difference between the screen coordinates of the 2 systems is the ratio
// of the coefficients of the projection matrices (tan (fov/2) is that coefficient)
- float factorX = worldx / viewx;
-
+ // NOTE: viewx was coming in as 0 when folks set their viewmodel_fov to 0 and show their weapon.
+ float factorX = viewx ? ( worldx / viewx ) : 0.0f;
float factorY = factorX;
// Get the coordinates in the viewer's space.
@@ -331,6 +334,16 @@ int C_BaseViewModel::DrawModel( int flags )
}
}
+#ifdef TF_CLIENT_DLL
+ CTFWeaponBase* pTFWeapon = dynamic_cast<CTFWeaponBase*>( pWeapon );
+ if ( ( flags & STUDIO_RENDER ) && pTFWeapon && pTFWeapon->m_viewmodelStatTrakAddon )
+ {
+ pTFWeapon->m_viewmodelStatTrakAddon->RemoveEffects( EF_NODRAW );
+ pTFWeapon->m_viewmodelStatTrakAddon->DrawModel( flags );
+ pTFWeapon->m_viewmodelStatTrakAddon->AddEffects( EF_NODRAW );
+ }
+#endif
+
return ret;
}