//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======= // // Purpose: // //============================================================================= #include "cbase.h" #include "tf_weapon_shotgun.h" #include "decals.h" #include "tf_fx_shared.h" // Client specific. #if defined( CLIENT_DLL ) #include "c_tf_player.h" // Server specific. #else #include "tf_player.h" #endif #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 ); #define CREATE_SIMPLE_WEAPON_TABLE_OLD(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## ); //============================================================================= // // Weapon Shotgun tables. // CREATE_SIMPLE_WEAPON_TABLE( TFShotgun, tf_weapon_shotgun_primary ) CREATE_SIMPLE_WEAPON_TABLE( TFShotgun_Soldier, tf_weapon_shotgun_soldier ) CREATE_SIMPLE_WEAPON_TABLE( TFShotgun_HWG, tf_weapon_shotgun_hwg ) CREATE_SIMPLE_WEAPON_TABLE( TFShotgun_Pyro, tf_weapon_shotgun_pyro ) CREATE_SIMPLE_WEAPON_TABLE( TFScatterGun, tf_weapon_scattergun ) //============================================================================= // // Weapon Shotgun functions. // //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- CTFShotgun::CTFShotgun() { m_bReloadsSingly = true; } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFShotgun::PrimaryAttack() { if ( !CanAttack() ) return; // Set the weapon mode. m_iWeaponMode = TF_WEAPON_PRIMARY_MODE; BaseClass::PrimaryAttack(); } //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CTFShotgun::UpdatePunchAngles( CTFPlayer *pPlayer ) { // Update the player's punch angle. QAngle angle = pPlayer->GetPunchAngle(); float flPunchAngle = m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_flPunchAngle; angle.x -= SharedRandomInt( "ShotgunPunchAngle", ( flPunchAngle - 1 ), ( flPunchAngle + 1 ) ); pPlayer->SetPunchAngle( angle ); }