summaryrefslogtreecommitdiff
path: root/game/shared/tf/tf_weaponbase_gun.h
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/tf/tf_weaponbase_gun.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/shared/tf/tf_weaponbase_gun.h')
-rw-r--r--game/shared/tf/tf_weaponbase_gun.h111
1 files changed, 111 insertions, 0 deletions
diff --git a/game/shared/tf/tf_weaponbase_gun.h b/game/shared/tf/tf_weaponbase_gun.h
new file mode 100644
index 0000000..b35f3dc
--- /dev/null
+++ b/game/shared/tf/tf_weaponbase_gun.h
@@ -0,0 +1,111 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: Weapon Base Gun
+//
+//=============================================================================
+
+#ifndef TF_WEAPONBASE_GUN_H
+#define TF_WEAPONBASE_GUN_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "tf_shareddefs.h"
+#include "tf_weaponbase.h"
+
+#define CREATE_SIMPLE_WEAPON_TABLE( WpnName, entityname ) \
+ \
+ IMPLEMENT_NETWORKCLASS_ALIASED( WpnName, DT_##WpnName ) \
+ \
+ BEGIN_NETWORK_TABLE( C##WpnName, DT_##WpnName ) \
+ END_NETWORK_TABLE() \
+ \
+ BEGIN_PREDICTION_DATA( C##WpnName ) \
+ END_PREDICTION_DATA() \
+ \
+ LINK_ENTITY_TO_CLASS( entityname, C##WpnName ); \
+ PRECACHE_WEAPON_REGISTER( entityname );
+
+#if defined( CLIENT_DLL )
+#define CTFWeaponBaseGun C_TFWeaponBaseGun
+#endif
+
+#define ZOOM_CONTEXT "ZoomContext"
+#define ZOOM_REZOOM_TIME 1.4f
+
+//=============================================================================
+//
+// Weapon Base Melee Gun
+//
+class CTFWeaponBaseGun : public CTFWeaponBase
+{
+public:
+
+ DECLARE_CLASS( CTFWeaponBaseGun, CTFWeaponBase );
+ DECLARE_NETWORKCLASS();
+ DECLARE_PREDICTABLE();
+#if !defined( CLIENT_DLL )
+ DECLARE_DATADESC();
+#endif
+
+ CTFWeaponBaseGun();
+
+ virtual void PrimaryAttack();
+ virtual void SecondaryAttack( void );
+ virtual bool Holster( CBaseCombatWeapon *pSwitchingTo );
+
+ // Derived classes call this to fire a bullet.
+ //bool TFBaseGunFire( void );
+
+ virtual void DoFireEffects();
+ virtual bool ShouldDoMuzzleFlash( void ) { return true; }
+
+ void ToggleZoom( void );
+
+ virtual int GetWeaponProjectileType( void ) const { return m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_iProjectile; }
+ virtual CBaseEntity *FireProjectile( CTFPlayer *pPlayer );
+ virtual void RemoveProjectileAmmo( CTFPlayer *pPlayer );
+ virtual void ModifyProjectile( CBaseEntity* pProj ) {};
+
+ virtual void FireBullet( CTFPlayer *pPlayer );
+ CBaseEntity *FireRocket( CTFPlayer *pPlayer, int iRocketType=0 );
+ CBaseEntity *FireNail( CTFPlayer *pPlayer, int iSpecificNail );
+ virtual CBaseEntity *FirePipeBomb( CTFPlayer *pPlayer, int iPipeBombType );
+ CBaseEntity *FireFlare( CTFPlayer *pPlayer );
+ virtual CBaseEntity *FireArrow( CTFPlayer *pPlayer, ProjectileType_t projectileType );
+ virtual CBaseEntity *FireJar( CTFPlayer *pPlayer );
+ virtual CBaseEntity *FireFlameRocket( CTFPlayer *pPlayer );
+ virtual CBaseEntity *FireEnergyBall( CTFPlayer *pPlayer, bool bRing=false );
+
+ virtual bool HasLastShotCritical( void );
+
+ virtual float GetWeaponSpread( void );
+ virtual void GetCustomProjectileModel( CAttribute_String *attrCustomProjModel );
+ virtual float GetProjectileSpeed( void ) { return 0.0f; }
+ virtual float GetProjectileGravity( void ) { return 0.f; }
+ virtual float GetProjectileSpread( void ) { return 0.0f; }
+
+ virtual int GetAmmoPerShot( void );
+
+ void UpdatePunchAngles( CTFPlayer *pPlayer );
+ virtual float GetProjectileDamage( void );
+
+ virtual bool ShouldPlayFireAnim( void ) { return true; }
+
+ virtual void ZoomIn( void );
+ virtual void ZoomOut( void );
+ void ZoomOutIn( void );
+
+ virtual void PlayWeaponShootSound( void );
+ virtual bool HasPrimaryAmmo( void );
+ virtual bool CanDeploy( void );
+ virtual bool CanBeSelected( void );
+
+ virtual bool ShouldRemoveDisguiseOnPrimaryAttack() const;
+
+private:
+
+ CTFWeaponBaseGun( const CTFWeaponBaseGun & );
+};
+
+#endif // TF_WEAPONBASE_GUN_H \ No newline at end of file