Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
3.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "weapon_dodsemiauto.h"
  8. #if defined( CLIENT_DLL )
  9. #define CWeaponP38 C_WeaponP38
  10. #endif
  11. class CWeaponP38 : public CDODSemiAutoWeapon
  12. {
  13. public:
  14. DECLARE_CLASS( CWeaponP38, CDODSemiAutoWeapon );
  15. DECLARE_NETWORKCLASS();
  16. DECLARE_PREDICTABLE();
  17. DECLARE_ACTTABLE();
  18. CWeaponP38() {}
  19. virtual DODWeaponID GetWeaponID( void ) const { return WEAPON_P38; }
  20. virtual Activity GetIdleActivity( void );
  21. virtual Activity GetPrimaryAttackActivity( void );
  22. virtual Activity GetDrawActivity( void );
  23. virtual float GetRecoil( void ) { return 1.4f; }
  24. private:
  25. CWeaponP38( const CWeaponP38 & );
  26. };
  27. IMPLEMENT_NETWORKCLASS_ALIASED( WeaponP38, DT_WeaponP38 )
  28. BEGIN_NETWORK_TABLE( CWeaponP38, DT_WeaponP38 )
  29. END_NETWORK_TABLE()
  30. BEGIN_PREDICTION_DATA( CWeaponP38 )
  31. END_PREDICTION_DATA()
  32. LINK_ENTITY_TO_CLASS( weapon_p38, CWeaponP38 );
  33. PRECACHE_WEAPON_REGISTER( weapon_p38 );
  34. acttable_t CWeaponP38::m_acttable[] =
  35. {
  36. { ACT_DOD_STAND_AIM, ACT_DOD_STAND_AIM_PISTOL, false },
  37. { ACT_DOD_CROUCH_AIM, ACT_DOD_CROUCH_AIM_PISTOL, false },
  38. { ACT_DOD_CROUCHWALK_AIM, ACT_DOD_CROUCHWALK_AIM_PISTOL, false },
  39. { ACT_DOD_WALK_AIM, ACT_DOD_WALK_AIM_PISTOL, false },
  40. { ACT_DOD_RUN_AIM, ACT_DOD_RUN_AIM_PISTOL, false },
  41. { ACT_PRONE_IDLE, ACT_DOD_PRONE_AIM_PISTOL, false },
  42. { ACT_PRONE_FORWARD, ACT_DOD_PRONEWALK_IDLE_PISTOL, false },
  43. { ACT_DOD_STAND_IDLE, ACT_DOD_STAND_IDLE_PISTOL, false },
  44. { ACT_DOD_CROUCH_IDLE, ACT_DOD_CROUCH_IDLE_PISTOL, false },
  45. { ACT_DOD_CROUCHWALK_IDLE, ACT_DOD_CROUCHWALK_IDLE_PISTOL, false },
  46. { ACT_DOD_WALK_IDLE, ACT_DOD_WALK_IDLE_PISTOL, false },
  47. { ACT_DOD_RUN_IDLE, ACT_DOD_RUN_IDLE_PISTOL, false },
  48. { ACT_SPRINT, ACT_DOD_SPRINT_IDLE_PISTOL, false },
  49. { ACT_RANGE_ATTACK1, ACT_DOD_PRIMARYATTACK_PISTOL, false },
  50. { ACT_DOD_PRIMARYATTACK_CROUCH, ACT_DOD_PRIMARYATTACK_PISTOL, false },
  51. { ACT_DOD_PRIMARYATTACK_PRONE, ACT_DOD_PRIMARYATTACK_PRONE_PISTOL, false },
  52. { ACT_RELOAD, ACT_DOD_RELOAD_PISTOL, false },
  53. { ACT_DOD_RELOAD_CROUCH, ACT_DOD_RELOAD_CROUCH_PISTOL, false },
  54. { ACT_DOD_RELOAD_PRONE, ACT_DOD_RELOAD_PRONE_PISTOL, false },
  55. // Hand Signals
  56. { ACT_DOD_HS_IDLE, ACT_DOD_HS_IDLE_PISTOL, false },
  57. { ACT_DOD_HS_CROUCH, ACT_DOD_HS_CROUCH_PISTOL, false },
  58. };
  59. IMPLEMENT_ACTTABLE( CWeaponP38 );
  60. Activity CWeaponP38::GetIdleActivity( void )
  61. {
  62. Activity actIdle;
  63. if( m_iClip1 <= 0 )
  64. actIdle = ACT_VM_IDLE_EMPTY;
  65. else
  66. actIdle = ACT_VM_IDLE;
  67. return actIdle;
  68. }
  69. Activity CWeaponP38::GetPrimaryAttackActivity( void )
  70. {
  71. Activity actPrim;
  72. if( m_iClip1 <= 0 )
  73. actPrim = ACT_VM_PRIMARYATTACK_EMPTY;
  74. else
  75. actPrim = ACT_VM_PRIMARYATTACK;
  76. return actPrim;
  77. }
  78. Activity CWeaponP38::GetDrawActivity( void )
  79. {
  80. Activity actDraw;
  81. if( m_iClip1 <= 0 )
  82. actDraw = ACT_VM_DRAW_EMPTY;
  83. else
  84. actDraw = ACT_VM_DRAW;
  85. return actDraw;
  86. }