diff options
| author | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:31:46 -0800 |
|---|---|---|
| committer | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:46:31 -0800 |
| commit | f56bb35301836e56582a575a75864392a0177875 (patch) | |
| tree | de61ddd39de3e7df52759711950b4c288592f0dc /mp/src/game/server/hl2/weapon_smg2.cpp | |
| parent | Mark some more files as text. (diff) | |
| download | source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip | |
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/game/server/hl2/weapon_smg2.cpp')
| -rw-r--r-- | mp/src/game/server/hl2/weapon_smg2.cpp | 246 |
1 files changed, 123 insertions, 123 deletions
diff --git a/mp/src/game/server/hl2/weapon_smg2.cpp b/mp/src/game/server/hl2/weapon_smg2.cpp index 8411fd48..498faddd 100644 --- a/mp/src/game/server/hl2/weapon_smg2.cpp +++ b/mp/src/game/server/hl2/weapon_smg2.cpp @@ -1,123 +1,123 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-//=============================================================================//
-
-#include "cbase.h"
-#include "basehlcombatweapon.h"
-#include "NPCevent.h"
-#include "basecombatcharacter.h"
-#include "ai_basenpc.h"
-#include "player.h"
-#include "game.h"
-#include "in_buttons.h"
-
-// memdbgon must be the last include file in a .cpp file!!!
-#include "tier0/memdbgon.h"
-
-class CWeaponSMG2 : public CHLSelectFireMachineGun
-{
-public:
- DECLARE_CLASS( CWeaponSMG2, CHLSelectFireMachineGun );
-
- CWeaponSMG2();
-
- DECLARE_SERVERCLASS();
-
- const Vector &GetBulletSpread( void );
-
- void Precache( void );
- void AddViewKick( void );
- void Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator );
-
- float GetFireRate( void ) { return 0.1f; }
- int CapabilitiesGet( void ) { return bits_CAP_WEAPON_RANGE_ATTACK1; }
-
- DECLARE_ACTTABLE();
-};
-
-IMPLEMENT_SERVERCLASS_ST(CWeaponSMG2, DT_WeaponSMG2)
-END_SEND_TABLE()
-
-LINK_ENTITY_TO_CLASS( weapon_smg2, CWeaponSMG2 );
-PRECACHE_WEAPON_REGISTER(weapon_smg2);
-
-acttable_t CWeaponSMG2::m_acttable[] =
-{
- { ACT_RANGE_ATTACK1, ACT_RANGE_ATTACK_SMG2, true },
-};
-
-IMPLEMENT_ACTTABLE(CWeaponSMG2);
-
-//=========================================================
-CWeaponSMG2::CWeaponSMG2( )
-{
- m_fMaxRange1 = 2000;
- m_fMinRange1 = 32;
-
- m_iFireMode = FIREMODE_3RNDBURST;
-}
-
-void CWeaponSMG2::Precache( void )
-{
- BaseClass::Precache();
-}
-
-//-----------------------------------------------------------------------------
-// Purpose:
-// Output : const Vector
-//-----------------------------------------------------------------------------
-const Vector &CWeaponSMG2::GetBulletSpread( void )
-{
- static const Vector cone = VECTOR_CONE_10DEGREES;
- return cone;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose:
-// Input : *pEvent -
-// *pOperator -
-//-----------------------------------------------------------------------------
-void CWeaponSMG2::Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator )
-{
- switch( pEvent->event )
- {
- case EVENT_WEAPON_SMG2:
- {
- Vector vecShootOrigin, vecShootDir;
- vecShootOrigin = pOperator->Weapon_ShootPosition( );
-
- CAI_BaseNPC *npc = pOperator->MyNPCPointer();
- ASSERT( npc != NULL );
- vecShootDir = npc->GetActualShootTrajectory( vecShootOrigin );
-
- WeaponSound(SINGLE_NPC);
- pOperator->FireBullets( 1, vecShootOrigin, vecShootDir, VECTOR_CONE_PRECALCULATED, MAX_TRACE_LENGTH, m_iPrimaryAmmoType, 2 );
- pOperator->DoMuzzleFlash();
- m_iClip1 = m_iClip1 - 1;
- }
- break;
- default:
- BaseClass::Operator_HandleAnimEvent( pEvent, pOperator );
- break;
- }
-}
-
-//-----------------------------------------------------------------------------
-// Purpose:
-//-----------------------------------------------------------------------------
-void CWeaponSMG2::AddViewKick( void )
-{
- #define EASY_DAMPEN 0.5f
- #define MAX_VERTICAL_KICK 2.0f //Degrees
- #define SLIDE_LIMIT 1.0f //Seconds
-
- //Get the view kick
- CBasePlayer *pPlayer = ToBasePlayer( GetOwner() );
-
- if (!pPlayer)
- return;
-
- DoMachineGunKick( pPlayer, EASY_DAMPEN, MAX_VERTICAL_KICK, m_fFireDuration, SLIDE_LIMIT );
-}
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//=============================================================================// + +#include "cbase.h" +#include "basehlcombatweapon.h" +#include "NPCevent.h" +#include "basecombatcharacter.h" +#include "ai_basenpc.h" +#include "player.h" +#include "game.h" +#include "in_buttons.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +class CWeaponSMG2 : public CHLSelectFireMachineGun +{ +public: + DECLARE_CLASS( CWeaponSMG2, CHLSelectFireMachineGun ); + + CWeaponSMG2(); + + DECLARE_SERVERCLASS(); + + const Vector &GetBulletSpread( void ); + + void Precache( void ); + void AddViewKick( void ); + void Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator ); + + float GetFireRate( void ) { return 0.1f; } + int CapabilitiesGet( void ) { return bits_CAP_WEAPON_RANGE_ATTACK1; } + + DECLARE_ACTTABLE(); +}; + +IMPLEMENT_SERVERCLASS_ST(CWeaponSMG2, DT_WeaponSMG2) +END_SEND_TABLE() + +LINK_ENTITY_TO_CLASS( weapon_smg2, CWeaponSMG2 ); +PRECACHE_WEAPON_REGISTER(weapon_smg2); + +acttable_t CWeaponSMG2::m_acttable[] = +{ + { ACT_RANGE_ATTACK1, ACT_RANGE_ATTACK_SMG2, true }, +}; + +IMPLEMENT_ACTTABLE(CWeaponSMG2); + +//========================================================= +CWeaponSMG2::CWeaponSMG2( ) +{ + m_fMaxRange1 = 2000; + m_fMinRange1 = 32; + + m_iFireMode = FIREMODE_3RNDBURST; +} + +void CWeaponSMG2::Precache( void ) +{ + BaseClass::Precache(); +} + +//----------------------------------------------------------------------------- +// Purpose: +// Output : const Vector +//----------------------------------------------------------------------------- +const Vector &CWeaponSMG2::GetBulletSpread( void ) +{ + static const Vector cone = VECTOR_CONE_10DEGREES; + return cone; +} + +//----------------------------------------------------------------------------- +// Purpose: +// Input : *pEvent - +// *pOperator - +//----------------------------------------------------------------------------- +void CWeaponSMG2::Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator ) +{ + switch( pEvent->event ) + { + case EVENT_WEAPON_SMG2: + { + Vector vecShootOrigin, vecShootDir; + vecShootOrigin = pOperator->Weapon_ShootPosition( ); + + CAI_BaseNPC *npc = pOperator->MyNPCPointer(); + ASSERT( npc != NULL ); + vecShootDir = npc->GetActualShootTrajectory( vecShootOrigin ); + + WeaponSound(SINGLE_NPC); + pOperator->FireBullets( 1, vecShootOrigin, vecShootDir, VECTOR_CONE_PRECALCULATED, MAX_TRACE_LENGTH, m_iPrimaryAmmoType, 2 ); + pOperator->DoMuzzleFlash(); + m_iClip1 = m_iClip1 - 1; + } + break; + default: + BaseClass::Operator_HandleAnimEvent( pEvent, pOperator ); + break; + } +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CWeaponSMG2::AddViewKick( void ) +{ + #define EASY_DAMPEN 0.5f + #define MAX_VERTICAL_KICK 2.0f //Degrees + #define SLIDE_LIMIT 1.0f //Seconds + + //Get the view kick + CBasePlayer *pPlayer = ToBasePlayer( GetOwner() ); + + if (!pPlayer) + return; + + DoMachineGunKick( pPlayer, EASY_DAMPEN, MAX_VERTICAL_KICK, m_fFireDuration, SLIDE_LIMIT ); +} |