summaryrefslogtreecommitdiff
path: root/game/shared/tf2/weapon_combat_grenade.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/shared/tf2/weapon_combat_grenade.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/shared/tf2/weapon_combat_grenade.cpp')
-rw-r--r--game/shared/tf2/weapon_combat_grenade.cpp97
1 files changed, 97 insertions, 0 deletions
diff --git a/game/shared/tf2/weapon_combat_grenade.cpp b/game/shared/tf2/weapon_combat_grenade.cpp
new file mode 100644
index 0000000..781b710
--- /dev/null
+++ b/game/shared/tf2/weapon_combat_grenade.cpp
@@ -0,0 +1,97 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: The Commando's anti-personnel grenades
+//
+// $NoKeywords: $
+//=============================================================================//
+#include "cbase.h"
+#include "basetfplayer_shared.h"
+#include "weapon_combat_usedwithshieldbase.h"
+#include "weapon_combat_basegrenade.h"
+#include "weapon_combatshield.h"
+#include "in_buttons.h"
+
+#if !defined( CLIENT_DLL )
+#include "grenade_antipersonnel.h"
+#else
+#define CWeaponCombatGrenade C_WeaponCombatGrenade
+#endif
+
+// memdbgon must be the last include file in a .cpp file!!!
+#include "tier0/memdbgon.h"
+
+
+class CBaseGrenade;
+
+//-----------------------------------------------------------------------------
+// Purpose: Combo shield & grenade weapon
+//-----------------------------------------------------------------------------
+class CWeaponCombatGrenade : public CWeaponCombatBaseGrenade
+{
+ DECLARE_CLASS( CWeaponCombatGrenade, CWeaponCombatBaseGrenade );
+public:
+ DECLARE_NETWORKCLASS();
+ DECLARE_PREDICTABLE();
+
+ CWeaponCombatGrenade();
+
+ virtual void Precache( void );
+ virtual CBaseGrenade *CreateGrenade( const Vector &vecOrigin, const Vector &vecAngles, CBasePlayer *pOwner );
+
+ // All predicted weapons need to implement and return true
+ virtual bool IsPredicted( void ) const
+ {
+ return true;
+ }
+
+#if defined( CLIENT_DLL )
+ virtual bool ShouldPredict( void )
+ {
+ if ( GetOwner() == C_BasePlayer::GetLocalPlayer() )
+ return true;
+
+ return BaseClass::ShouldPredict();
+ }
+#endif
+private:
+ CWeaponCombatGrenade( const CWeaponCombatGrenade & );
+
+};
+
+CWeaponCombatGrenade::CWeaponCombatGrenade( void )
+{
+ SetPredictionEligible( true );
+}
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+void CWeaponCombatGrenade::Precache( void )
+{
+ BaseClass::Precache();
+#if !defined( CLIENT_DLL )
+ UTIL_PrecacheOther( "grenade_antipersonnel" );
+#endif
+}
+
+CBaseGrenade *CWeaponCombatGrenade::CreateGrenade( const Vector &vecOrigin, const Vector &vecAngles, CBasePlayer *pOwner )
+{
+#if !defined( CLIENT_DLL )
+ return CGrenadeAntiPersonnel::Create(vecOrigin, vecAngles, pOwner );
+#else
+ return NULL;
+#endif
+}
+
+
+LINK_ENTITY_TO_CLASS( weapon_combat_grenade, CWeaponCombatGrenade );
+
+IMPLEMENT_NETWORKCLASS_ALIASED( WeaponCombatGrenade, DT_WeaponCombatGrenade )
+
+BEGIN_NETWORK_TABLE( CWeaponCombatGrenade, DT_WeaponCombatGrenade )
+END_NETWORK_TABLE()
+
+BEGIN_PREDICTION_DATA( CWeaponCombatGrenade )
+END_PREDICTION_DATA()
+
+PRECACHE_WEAPON_REGISTER(weapon_combat_grenade);