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.

56 lines
1.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #include "cbase.h"
  9. #include "c_neurotoxin_countdown.h"
  10. // memdbgon must be the last include file in a .cpp file!!!
  11. #include "tier0/memdbgon.h"
  12. CUtlVector< C_NeurotoxinCountdown* > g_NeurotoxinCountdowns;
  13. IMPLEMENT_CLIENTCLASS_DT(C_NeurotoxinCountdown, DT_NeurotoxinCountdown, CNeurotoxinCountdown)
  14. RecvPropBool( RECVINFO(m_bEnabled) ),
  15. END_RECV_TABLE()
  16. C_NeurotoxinCountdown::C_NeurotoxinCountdown()
  17. {
  18. g_NeurotoxinCountdowns.AddToTail( this );
  19. }
  20. C_NeurotoxinCountdown::~C_NeurotoxinCountdown()
  21. {
  22. g_NeurotoxinCountdowns.FindAndRemove( this );
  23. }
  24. int C_NeurotoxinCountdown::GetMinutes( void )
  25. {
  26. C_BasePlayer *player = UTIL_PlayerByIndex( 1 );
  27. if ( player )
  28. return player->GetBonusProgress() / 60;
  29. return 0.0f;
  30. }
  31. int C_NeurotoxinCountdown::GetSeconds( void )
  32. {
  33. C_BasePlayer *player = UTIL_PlayerByIndex( 1 );
  34. if ( player )
  35. return player->GetBonusProgress() % 60;
  36. return 0.0f;
  37. }
  38. int C_NeurotoxinCountdown::GetMilliseconds( void )
  39. {
  40. return static_cast<int>( gpGlobals->curtime * 100.0f ) % 100;;
  41. }