summaryrefslogtreecommitdiff
path: root/game/shared/tf/tf_weapon_flag.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'game/shared/tf/tf_weapon_flag.cpp')
-rw-r--r--game/shared/tf/tf_weapon_flag.cpp82
1 files changed, 82 insertions, 0 deletions
diff --git a/game/shared/tf/tf_weapon_flag.cpp b/game/shared/tf/tf_weapon_flag.cpp
new file mode 100644
index 0000000..af2e985
--- /dev/null
+++ b/game/shared/tf/tf_weapon_flag.cpp
@@ -0,0 +1,82 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================
+
+#include "cbase.h"
+#include "tf_weapon_flag.h"
+#include "decals.h"
+
+// Client specific.
+#ifdef CLIENT_DLL
+#include "c_tf_player.h"
+// Server specific.
+#else
+#include "tf_player.h"
+#include "tf_team.h"
+#endif
+
+//=============================================================================
+//
+// Weapon Flag tables.
+//
+IMPLEMENT_NETWORKCLASS_ALIASED( TFFlag, DT_TFWeaponFlag )
+
+BEGIN_NETWORK_TABLE( CTFFlag, DT_TFWeaponFlag )
+END_NETWORK_TABLE()
+
+BEGIN_PREDICTION_DATA( CTFFlag )
+END_PREDICTION_DATA()
+
+LINK_ENTITY_TO_CLASS( tf_weapon_flag, CTFFlag );
+PRECACHE_WEAPON_REGISTER( tf_weapon_flag );
+
+//=============================================================================
+//
+// Weapon Flag functions.
+//
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+CTFFlag::CTFFlag()
+{
+
+}
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+bool CTFFlag::Deploy( void )
+{
+ if ( BaseClass::Deploy() )
+ {
+#ifdef GAME_DLL
+ TFTeamMgr()->PlayerCenterPrint( ToTFPlayer( GetOwner() ), "#TF_Flag_AltFireToDrop" );
+#endif
+ return true;
+ }
+
+ return false;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+void CTFFlag::SecondaryAttack( void )
+{
+ CTFPlayer *pPlayer = ToTFPlayer( GetOwner() );
+
+ if ( !pPlayer )
+ return;
+
+ if ( !CanAttack() )
+ return;
+
+#ifdef GAME_DLL
+ pPlayer->DropCurrentWeapon();
+#endif
+ pPlayer->SwitchToNextBestWeapon( this );
+}
+