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.

104 lines
3.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "weapon_dodbaserpg.h"
  8. #if defined( CLIENT_DLL )
  9. #include "c_dod_player.h"
  10. #define CWeaponBazooka C_WeaponBazooka
  11. #else
  12. #include "rocket_bazooka.h"
  13. #include "dod_player.h"
  14. #endif
  15. class CWeaponBazooka : public CDODBaseRocketWeapon
  16. {
  17. public:
  18. DECLARE_CLASS( CWeaponBazooka, CDODBaseRocketWeapon );
  19. DECLARE_NETWORKCLASS();
  20. DECLARE_PREDICTABLE();
  21. DECLARE_ACTTABLE();
  22. CWeaponBazooka() {}
  23. virtual DODWeaponID GetWeaponID( void ) const { return WEAPON_BAZOOKA; }
  24. virtual void FireRocket( void );
  25. private:
  26. CWeaponBazooka( const CWeaponBazooka & );
  27. };
  28. IMPLEMENT_NETWORKCLASS_ALIASED( WeaponBazooka, DT_WeaponBazooka )
  29. BEGIN_NETWORK_TABLE( CWeaponBazooka, DT_WeaponBazooka )
  30. END_NETWORK_TABLE()
  31. BEGIN_PREDICTION_DATA( CWeaponBazooka )
  32. END_PREDICTION_DATA()
  33. LINK_ENTITY_TO_CLASS( weapon_bazooka, CWeaponBazooka );
  34. PRECACHE_WEAPON_REGISTER( weapon_bazooka );
  35. acttable_t CWeaponBazooka::m_acttable[] =
  36. {
  37. { ACT_PRONE_IDLE, ACT_DOD_PRONE_AIM_BAZOOKA, false },
  38. { ACT_PRONE_FORWARD, ACT_DOD_PRONEWALK_IDLE_BAZOOKA, false },
  39. { ACT_DOD_STAND_IDLE, ACT_DOD_STAND_IDLE_BAZOOKA, false },
  40. { ACT_DOD_CROUCH_IDLE, ACT_DOD_CROUCH_IDLE_BAZOOKA, false },
  41. { ACT_DOD_CROUCHWALK_IDLE, ACT_DOD_CROUCHWALK_IDLE_BAZOOKA, false },
  42. { ACT_DOD_WALK_IDLE, ACT_DOD_WALK_IDLE_BAZOOKA, false },
  43. { ACT_DOD_RUN_IDLE, ACT_DOD_RUN_IDLE_BAZOOKA, false },
  44. { ACT_SPRINT, ACT_DOD_SPRINT_IDLE_BAZOOKA, false },
  45. // Zoomed Aim
  46. { ACT_DOD_IDLE_ZOOMED, ACT_DOD_STAND_ZOOM_BAZOOKA, false },
  47. { ACT_DOD_CROUCH_ZOOMED, ACT_DOD_CROUCH_ZOOM_BAZOOKA, false },
  48. { ACT_DOD_CROUCHWALK_ZOOMED, ACT_DOD_CROUCHWALK_ZOOM_BAZOOKA, false },
  49. { ACT_DOD_WALK_ZOOMED, ACT_DOD_WALK_ZOOM_BAZOOKA, false },
  50. { ACT_DOD_PRONE_ZOOMED, ACT_DOD_PRONE_ZOOM_BAZOOKA, false },
  51. { ACT_DOD_PRONE_FORWARD_ZOOMED, ACT_DOD_PRONE_ZOOM_FORWARD_BAZOOKA, false },
  52. // Attack ( must be zoomed )
  53. { ACT_RANGE_ATTACK1, ACT_DOD_PRIMARYATTACK_BAZOOKA, false },
  54. { ACT_DOD_PRIMARYATTACK_CROUCH, ACT_DOD_PRIMARYATTACK_BAZOOKA, false },
  55. { ACT_DOD_PRIMARYATTACK_PRONE, ACT_DOD_PRIMARYATTACK_PRONE_BAZOOKA, false },
  56. // Reload ( zoomed or not, prone or not )
  57. { ACT_RELOAD, ACT_DOD_RELOAD_BAZOOKA, false },
  58. { ACT_DOD_RELOAD_CROUCH, ACT_DOD_RELOAD_CROUCH_BAZOOKA, false },
  59. { ACT_DOD_RELOAD_PRONE, ACT_DOD_RELOAD_PRONE_BAZOOKA, false },
  60. { ACT_DOD_RELOAD_DEPLOYED, ACT_DOD_ZOOMLOAD_BAZOOKA, false },
  61. { ACT_DOD_RELOAD_PRONE_DEPLOYED, ACT_DOD_ZOOMLOAD_PRONE_BAZOOKA, false },
  62. // Hand Signals
  63. { ACT_DOD_HS_IDLE, ACT_DOD_HS_IDLE_BAZOOKA, false },
  64. { ACT_DOD_HS_CROUCH, ACT_DOD_HS_CROUCH_BAZOOKA, false },
  65. };
  66. IMPLEMENT_ACTTABLE( CWeaponBazooka );
  67. void CWeaponBazooka::FireRocket( void )
  68. {
  69. #ifndef CLIENT_DLL
  70. CBasePlayer *pPlayer = GetPlayerOwner();
  71. #ifdef DBGFLAG_ASSERT
  72. CBazookaRocket *pRocket =
  73. #endif //DEBUG
  74. CBazookaRocket::Create( pPlayer->Weapon_ShootPosition(), pPlayer->EyeAngles(), pPlayer );
  75. Assert( pRocket );
  76. #endif
  77. }