summaryrefslogtreecommitdiff
path: root/game/shared/tf2/weapon_combatshield.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/tf2/weapon_combatshield.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/shared/tf2/weapon_combatshield.h')
-rw-r--r--game/shared/tf2/weapon_combatshield.h185
1 files changed, 185 insertions, 0 deletions
diff --git a/game/shared/tf2/weapon_combatshield.h b/game/shared/tf2/weapon_combatshield.h
new file mode 100644
index 0000000..fdece5c
--- /dev/null
+++ b/game/shared/tf2/weapon_combatshield.h
@@ -0,0 +1,185 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef WEAPON_COMBATSHIELD_SHARED_H
+#define WEAPON_COMBATSHIELD_SHARED_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "basetfcombatweapon_shared.h"
+
+// Shield States
+enum
+{
+ SS_DOWN, // Not in use
+ SS_RAISING, // Going up
+ SS_UP, // Up, active, and blocking
+ SS_LOWERING, // Going down
+ SS_PARRYING, // In the process of parrying
+ SS_PARRYING_FINISH_SWING, // Time to allow the parrying animation to finish
+ SS_UNAVAILABLE, // Post-parry, unavailable for using
+};
+
+// Shield Hitboxes
+enum
+{
+ SS_HITBOX_NOSHIELD,
+ SS_HITBOX_FULLSHIELD,
+ SS_HITBOX_SMALLSHIELD,
+};
+
+// Range of the shield bash
+#define SHIELD_BASH_RANGE 64.0
+
+#if defined( CLIENT_DLL )
+class Beam_t;
+
+#define CWeaponCombatShield C_WeaponCombatShield
+#define CWeaponCombatShieldAlien C_WeaponCombatShieldAlien
+#endif
+
+//-----------------------------------------------------------------------------
+// Purpose: Shared version of CWeaponCombatShield
+//-----------------------------------------------------------------------------
+class CWeaponCombatShield : public CBaseTFCombatWeapon
+{
+ DECLARE_CLASS( CWeaponCombatShield, CBaseTFCombatWeapon );
+public:
+ DECLARE_NETWORKCLASS();
+ DECLARE_PREDICTABLE();
+
+ CWeaponCombatShield();
+
+ virtual void Precache( void );
+
+ virtual bool Deploy( void );
+ virtual bool Holster( CBaseCombatWeapon *pSwitchingTo = NULL );
+ virtual bool TakeShieldBash( CBaseTFPlayer *pBasher );
+ virtual void ItemPostFrame( void );
+ virtual void ItemBusyFrame( void );
+ virtual void ShieldPostFrame( void );
+ virtual void GainedNewTechnology( CBaseTechnology *pTechnology );
+ virtual int UpdateClientData( CBasePlayer *pPlayer );
+
+ void SetShieldState( int iShieldState );
+ void UpdateShieldState( void );
+ int GetShieldState( void );
+
+ void ShieldBash( void );
+
+ void SetAllowPostFrame( bool allow );
+ void SetShieldUsable( bool bUsable );
+ bool ShieldUsable( void );
+
+ // Shield power levels
+ float AttemptToBlock( float flDamage );
+ void ShieldRechargeThink( void );
+
+ virtual bool VisibleInWeaponSelection( void );
+ virtual int GetOtherWeaponsActivity( int iActivity );
+ virtual int ReplaceOtherWeaponsActivity( int iActivity );
+
+ // All predicted weapons need to implement and return true
+ virtual bool IsPredicted( void ) const
+ {
+ return true;
+ }
+
+ bool IsUp( void );
+ float GetRaisingTime( void );
+ float GetLoweringTime( void );
+
+ // Shield health handling
+ float GetShieldHealth( void );
+ void AddShieldHealth( float flHealth );
+ void RemoveShieldHealth( float flHealth );
+
+#if defined( CLIENT_DLL )
+ virtual void GetViewmodelBoneControllers( CBaseViewModel *pViewModel, float controllers[MAXSTUDIOBONECTRLS]);
+ virtual bool ShouldPredict( void )
+ {
+ if ( GetOwner() &&
+ GetOwner() == C_BasePlayer::GetLocalPlayer() )
+ return true;
+
+ return BaseClass::ShouldPredict();
+ }
+
+ virtual void DrawAmmo( void );
+ virtual void HandleInput( void );
+
+ virtual void ViewModelDrawn( C_BaseViewModel *pViewModel );
+
+ void InitShieldBeam( void );
+ void InitTeslaBeam( void );
+
+ void DrawBeams( C_BaseViewModel *pViewModel );
+
+#endif
+
+private:
+ CWeaponCombatShield( const CWeaponCombatShield& );
+
+ CNetworkVar( int, m_iShieldState );
+
+ bool m_bUsable;
+
+ CNetworkVar( float, m_flShieldUpStartTime );
+ CNetworkVar( float, m_flShieldDownStartTime );
+ CNetworkVar( float, m_flShieldParryEndTime );
+ CNetworkVar( float, m_flShieldParrySwingEndTime );
+ CNetworkVar( float, m_flShieldUnavailableEndTime );
+
+ CNetworkVar( float, m_flShieldRaisedTime );
+ CNetworkVar( float, m_flShieldLoweredTime );
+
+ CNetworkVar( float, m_flShieldHealth );
+
+ CNetworkVar( bool, m_bAllowPostFrame );
+ CNetworkVar( bool, m_bHasShieldParry );
+
+#if defined( CLIENT_DLL )
+ float m_flFlashTimeEnd;
+
+ float m_flTeslaSpeed;
+ float m_flTeslaSkitter;
+ float m_flTeslaLeftInc;
+ float m_flTeslaRightInc;
+ Beam_t *m_pTeslaBeam;
+ Beam_t *m_pTeslaBeam2;
+ CMaterialReference m_hTeslaSpriteMaterial;
+
+ bool m_bLeftToRight;
+ int m_nShieldEdge;
+ float m_flShieldSpeed;
+ float m_flShieldInc;
+ Beam_t *m_pShieldBeam;
+ Beam_t *m_pShieldBeam2;
+ Beam_t *m_pShieldBeam3;
+ CMaterialReference m_hShieldSpriteMaterial;
+#endif
+};
+
+//-----------------------------------------------------------------------------
+// Purpose: Need to do different art on client vs server
+//-----------------------------------------------------------------------------
+class CWeaponCombatShieldAlien : public CWeaponCombatShield
+{
+ DECLARE_CLASS( CWeaponCombatShieldAlien, CWeaponCombatShield );
+public:
+ DECLARE_NETWORKCLASS();
+ DECLARE_PREDICTABLE();
+
+ CWeaponCombatShieldAlien( void ) {}
+
+private:
+ CWeaponCombatShieldAlien( const CWeaponCombatShieldAlien & );
+};
+
+
+#endif // WEAPON_COMBATSHIELD_SHARED_H