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.

82 lines
2.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "weapon_dodbasegrenade.h"
  8. #ifdef CLIENT_DLL
  9. #define CWeaponStickGrenade C_WeaponStickGrenade
  10. #else
  11. #include "dod_stickgrenade.h"
  12. #endif
  13. class CWeaponStickGrenade : public CWeaponDODBaseGrenade
  14. {
  15. public:
  16. DECLARE_CLASS( CWeaponStickGrenade, CWeaponDODBaseGrenade );
  17. DECLARE_NETWORKCLASS();
  18. DECLARE_PREDICTABLE();
  19. DECLARE_ACTTABLE();
  20. CWeaponStickGrenade() {}
  21. virtual DODWeaponID GetWeaponID( void ) const { return WEAPON_FRAG_GER; }
  22. #ifndef CLIENT_DLL
  23. virtual void EmitGrenade( Vector vecSrc, QAngle vecAngles, Vector vecVel, AngularImpulse angImpulse, CBasePlayer *pPlayer, float flLifeTime = GRENADE_FUSE_LENGTH )
  24. {
  25. // align the stickgrenade vertically and spin end over end
  26. QAngle vecNewAngles = QAngle(45,pPlayer->EyeAngles().y,0);
  27. AngularImpulse angNewImpulse = AngularImpulse( 0, 600, 0 );
  28. CDODStickGrenade::Create( vecSrc, vecNewAngles, vecVel, angNewImpulse, pPlayer, flLifeTime, GetWeaponID() );
  29. }
  30. #endif
  31. CWeaponStickGrenade( const CWeaponStickGrenade & ) {}
  32. };
  33. IMPLEMENT_NETWORKCLASS_ALIASED( WeaponStickGrenade, DT_WeaponStickGrenade )
  34. BEGIN_NETWORK_TABLE(CWeaponStickGrenade, DT_WeaponStickGrenade)
  35. END_NETWORK_TABLE()
  36. BEGIN_PREDICTION_DATA( CWeaponStickGrenade )
  37. END_PREDICTION_DATA()
  38. LINK_ENTITY_TO_CLASS( weapon_frag_ger, CWeaponStickGrenade );
  39. PRECACHE_WEAPON_REGISTER( weapon_frag_ger );
  40. acttable_t CWeaponStickGrenade::m_acttable[] =
  41. {
  42. // Move this out to the specific grenades???
  43. { ACT_DOD_STAND_AIM, ACT_DOD_STAND_AIM_GREN_STICK, false },
  44. { ACT_DOD_CROUCH_AIM, ACT_DOD_CROUCH_AIM_GREN_STICK, false },
  45. { ACT_DOD_CROUCHWALK_AIM, ACT_DOD_CROUCHWALK_AIM_GREN_STICK, false },
  46. { ACT_DOD_WALK_AIM, ACT_DOD_WALK_AIM_GREN_STICK, false },
  47. { ACT_DOD_RUN_AIM, ACT_DOD_RUN_AIM_GREN_STICK, false },
  48. { ACT_PRONE_IDLE, ACT_DOD_PRONE_AIM_GREN_STICK, false },
  49. { ACT_PRONE_FORWARD, ACT_DOD_PRONEWALK_AIM_GREN_STICK, false },
  50. { ACT_DOD_STAND_IDLE, ACT_DOD_STAND_AIM_GREN_STICK, false },
  51. { ACT_DOD_CROUCH_IDLE, ACT_DOD_CROUCH_AIM_GREN_STICK, false },
  52. { ACT_DOD_CROUCHWALK_IDLE, ACT_DOD_CROUCHWALK_AIM_GREN_STICK, false },
  53. { ACT_DOD_WALK_IDLE, ACT_DOD_WALK_AIM_GREN_STICK, false },
  54. { ACT_DOD_RUN_IDLE, ACT_DOD_RUN_AIM_GREN_STICK, false },
  55. { ACT_SPRINT, ACT_DOD_SPRINT_AIM_GREN_STICK, false },
  56. { ACT_RANGE_ATTACK1, ACT_DOD_PRIMARYATTACK_GREN_STICK, false },
  57. { ACT_DOD_PRIMARYATTACK_PRONE, ACT_DOD_PRIMARYATTACK_PRONE_GREN_STICK, false },
  58. { ACT_DOD_PRIMARYATTACK_CROUCH, ACT_DOD_PRIMARYATTACK_CROUCH_GREN_STICK, false },
  59. // Hand Signals
  60. { ACT_DOD_HS_IDLE, ACT_DOD_HS_IDLE_STICKGRENADE, false },
  61. { ACT_DOD_HS_CROUCH, ACT_DOD_HS_CROUCH_STICKGRENADE, false },
  62. };
  63. IMPLEMENT_ACTTABLE( CWeaponStickGrenade );