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.

125 lines
2.5 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //===========================================================================//
  7. #include "cbase.h"
  8. #include "weapon_ifmbase.h"
  9. #if defined( CLIENT_DLL )
  10. #include "vgui/ISurface.h"
  11. #include "vgui_controls/controls.h"
  12. #include "hud_crosshair.h"
  13. #endif
  14. // NOTE: This has to be the last file included!
  15. #include "tier0/memdbgon.h"
  16. //-----------------------------------------------------------------------------
  17. // CWeaponIFMBase tables.
  18. //-----------------------------------------------------------------------------
  19. IMPLEMENT_NETWORKCLASS_ALIASED( WeaponIFMBase, DT_WeaponIFMBase )
  20. BEGIN_NETWORK_TABLE( CWeaponIFMBase, DT_WeaponIFMBase )
  21. END_NETWORK_TABLE()
  22. BEGIN_PREDICTION_DATA( CWeaponIFMBase )
  23. END_PREDICTION_DATA()
  24. LINK_ENTITY_TO_CLASS( weapon_ifm_base, CWeaponIFMBase );
  25. #ifdef GAME_DLL
  26. BEGIN_DATADESC( CWeaponIFMBase )
  27. END_DATADESC()
  28. #endif
  29. //-----------------------------------------------------------------------------
  30. // CWeaponIFMBase implementation.
  31. //-----------------------------------------------------------------------------
  32. CWeaponIFMBase::CWeaponIFMBase()
  33. {
  34. SetPredictionEligible( true );
  35. AddSolidFlags( FSOLID_TRIGGER ); // Nothing collides with these but it gets touches.
  36. }
  37. bool CWeaponIFMBase::IsPredicted() const
  38. {
  39. return true;
  40. }
  41. #ifdef CLIENT_DLL
  42. void CWeaponIFMBase::OnDataChanged( DataUpdateType_t type )
  43. {
  44. BaseClass::OnDataChanged( type );
  45. if ( GetPredictable() && !ShouldPredict() )
  46. {
  47. ShutdownPredictable();
  48. }
  49. }
  50. bool CWeaponIFMBase::ShouldPredict()
  51. {
  52. if ( C_BasePlayer::IsLocalPlayer( GetOwner() ) )
  53. return true;
  54. return BaseClass::ShouldPredict();
  55. }
  56. #else
  57. void CWeaponIFMBase::Spawn()
  58. {
  59. BaseClass::Spawn();
  60. // Set this here to allow players to shoot dropped weapons
  61. SetCollisionGroup( COLLISION_GROUP_WEAPON );
  62. }
  63. #endif
  64. /*
  65. void CWeaponIFMBase::FallInit( void )
  66. {
  67. #ifndef CLIENT_DLL
  68. SetModel( GetWorldModel() );
  69. VPhysicsDestroyObject();
  70. if ( HasSpawnFlags( SF_NORESPAWN ) == false )
  71. {
  72. SetMoveType( MOVETYPE_NONE );
  73. SetSolid( SOLID_BBOX );
  74. AddSolidFlags( FSOLID_TRIGGER );
  75. UTIL_DropToFloor( this, MASK_SOLID );
  76. }
  77. else
  78. {
  79. if ( !VPhysicsInitNormal( SOLID_BBOX, GetSolidFlags() | FSOLID_TRIGGER, false ) )
  80. {
  81. SetMoveType( MOVETYPE_NONE );
  82. SetSolid( SOLID_BBOX );
  83. AddSolidFlags( FSOLID_TRIGGER );
  84. }
  85. }
  86. SetPickupTouch();
  87. SetThink( &CBaseCombatWeapon::FallThink );
  88. SetNextThink( gpGlobals->curtime + 0.1f );
  89. #endif
  90. }
  91. */