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.

52 lines
1.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "tf_weaponbase_merasmus_grenade.h"
  8. // memdbgon must be the last include file in a .cpp file!!!
  9. #include "tier0/memdbgon.h"
  10. IMPLEMENT_NETWORKCLASS_ALIASED( TFWeaponBaseMerasmusGrenade, DT_TFWeaponBaseMerasmusGrenade )
  11. LINK_ENTITY_TO_CLASS( tf_weaponbase_merasmus_grenade, CTFWeaponBaseMerasmusGrenade );
  12. BEGIN_NETWORK_TABLE( CTFWeaponBaseMerasmusGrenade, DT_TFWeaponBaseMerasmusGrenade )
  13. END_NETWORK_TABLE()
  14. int CTFWeaponBaseMerasmusGrenade::GetDamageCustom()
  15. {
  16. return TF_DMG_CUSTOM_MERASMUS_GRENADE;
  17. }
  18. int CTFWeaponBaseMerasmusGrenade::GetCustomParticleIndex()
  19. {
  20. return GetParticleSystemIndex( "merasmus_dazed_explosion" );
  21. }
  22. #ifdef CLIENT_DLL
  23. int CTFWeaponBaseMerasmusGrenade::DrawModel( int flags )
  24. {
  25. float flAliveTime = gpGlobals->curtime - m_flSpawnTime;
  26. const float flNoDrawTime = 0.1f;
  27. const float flScaleTime = 0.1f;
  28. // Don't draw the rocket for the first bit of life
  29. if( flAliveTime < flNoDrawTime )
  30. {
  31. return 0;
  32. }
  33. // Scale up as we become visible
  34. if( flAliveTime < ( flNoDrawTime + flScaleTime ) )
  35. {
  36. float flSize = RemapVal( flAliveTime, flNoDrawTime, flNoDrawTime + flScaleTime, 0.f, 1.f );
  37. SetModelScale( flSize );
  38. }
  39. return BaseClass::DrawModel( flags );
  40. }
  41. #endif