Counter Strike : Global Offensive Source Code
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.

156 lines
3.6 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "fx_cs_shared.h"
  8. #include "c_cs_player.h"
  9. #include "c_basetempentity.h"
  10. #include <cliententitylist.h>
  11. // NOTE: This has to be the last file included!
  12. #include "tier0/memdbgon.h"
  13. class C_TEFireBullets : public C_BaseTempEntity
  14. {
  15. public:
  16. DECLARE_CLASS( C_TEFireBullets, C_BaseTempEntity );
  17. DECLARE_CLIENTCLASS();
  18. C_TEFireBullets();
  19. virtual void PostDataUpdate( DataUpdateType_t updateType );
  20. public:
  21. int m_iPlayer;
  22. uint16 m_nItemDefIndex;
  23. Vector m_vecOrigin;
  24. QAngle m_vecAngles;
  25. CSWeaponID m_iWeaponID;
  26. int m_iMode;
  27. int m_iSeed;
  28. float m_fInaccuracy;
  29. float m_flRecoilIndex;
  30. float m_fSpread;
  31. #if defined( WEAPON_FIRE_BULLETS_ACCURACY_FISHTAIL_FEATURE )
  32. float m_fAccuracyFishtail;
  33. #endif
  34. WeaponSound_t m_iSoundType;
  35. };
  36. C_TEFireBullets::C_TEFireBullets()
  37. {
  38. m_iPlayer = 0;
  39. m_nItemDefIndex = 0;
  40. m_iWeaponID = WEAPON_NONE;
  41. m_iMode = 0;
  42. m_iSeed = 0;
  43. m_fInaccuracy = 0;
  44. m_flRecoilIndex = 0;
  45. m_fSpread = 0;
  46. m_iSoundType = EMPTY;
  47. }
  48. void C_TEFireBullets::PostDataUpdate( DataUpdateType_t updateType )
  49. {
  50. // Create the effect.
  51. //
  52. // Vitaliy: Aug-2013 economy update note
  53. // fields m_nItemDefIndex and m_iSoundType are new and are not
  54. // networked in the previous demo recordings, force the sound type
  55. // to the default SINGLE value if it didn't network correctly
  56. //
  57. Assert(
  58. ( m_iSoundType == EMPTY ) || // pre-economy update ver. 1.23.1.4
  59. ( m_iSoundType == SINGLE ) || // default sound for firing
  60. ( m_iSoundType == SPECIAL1 ) || // silenced weapons use this sound
  61. 0 );
  62. WeaponSound_t wpnSoundToUse = SINGLE;
  63. switch ( m_iSoundType )
  64. {
  65. case SPECIAL1:
  66. wpnSoundToUse = SPECIAL1;
  67. break;
  68. }
  69. m_vecAngles.z = 0;
  70. FX_FireBullets(
  71. m_iPlayer+1,
  72. m_nItemDefIndex,
  73. m_vecOrigin,
  74. m_vecAngles,
  75. m_iWeaponID,
  76. m_iMode,
  77. m_iSeed,
  78. m_fInaccuracy,
  79. m_fSpread,
  80. #if defined( WEAPON_FIRE_BULLETS_ACCURACY_FISHTAIL_FEATURE )
  81. m_fAccuracyFishtail,
  82. #else
  83. 0.0f,
  84. #endif
  85. 0,
  86. wpnSoundToUse,
  87. m_flRecoilIndex
  88. );
  89. }
  90. IMPLEMENT_CLIENTCLASS_EVENT( C_TEFireBullets, DT_TEFireBullets, CTEFireBullets );
  91. BEGIN_RECV_TABLE_NOBASE(C_TEFireBullets, DT_TEFireBullets)
  92. RecvPropVector( RECVINFO( m_vecOrigin ) ),
  93. RecvPropFloat( RECVINFO( m_vecAngles[0] ) ),
  94. RecvPropFloat( RECVINFO( m_vecAngles[1] ) ),
  95. RecvPropInt( RECVINFO( m_iWeaponID ) ),
  96. RecvPropInt( RECVINFO( m_iMode ) ),
  97. RecvPropInt( RECVINFO( m_iSeed ) ),
  98. RecvPropInt( RECVINFO( m_iPlayer ) ),
  99. RecvPropFloat( RECVINFO( m_fInaccuracy ) ),
  100. RecvPropFloat( RECVINFO( m_fSpread ) ),
  101. RecvPropInt( RECVINFO( m_nItemDefIndex ) ),
  102. RecvPropInt( RECVINFO( m_iSoundType ) ),
  103. #if defined( WEAPON_FIRE_BULLETS_ACCURACY_FISHTAIL_FEATURE )
  104. RecvPropFloat( RECVINFO( m_fAccuracyFishtail) ),
  105. #endif
  106. RecvPropFloat( RECVINFO( m_flRecoilIndex ) ),
  107. END_RECV_TABLE()
  108. class C_TEPlantBomb : public C_BaseTempEntity
  109. {
  110. public:
  111. DECLARE_CLASS( C_TEPlantBomb, C_BaseTempEntity );
  112. DECLARE_CLIENTCLASS();
  113. virtual void PostDataUpdate( DataUpdateType_t updateType );
  114. public:
  115. int m_iPlayer;
  116. Vector m_vecOrigin;
  117. PlantBombOption_t m_option;
  118. };
  119. void C_TEPlantBomb::PostDataUpdate( DataUpdateType_t updateType )
  120. {
  121. // Create the effect.
  122. FX_PlantBomb( m_iPlayer+1, m_vecOrigin, m_option );
  123. }
  124. IMPLEMENT_CLIENTCLASS_EVENT( C_TEPlantBomb, DT_TEPlantBomb, CTEPlantBomb );
  125. BEGIN_RECV_TABLE_NOBASE(C_TEPlantBomb, DT_TEPlantBomb)
  126. RecvPropVector( RECVINFO( m_vecOrigin ) ),
  127. RecvPropInt( RECVINFO( m_iPlayer ) ),
  128. RecvPropInt( RECVINFO( m_option ) ),
  129. END_RECV_TABLE()