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.

62 lines
1.1 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include <stdio.h>
  8. #include "basetypes.h"
  9. #include "pacifier.h"
  10. #include "tier0/dbg.h"
  11. static int g_LastPacifierDrawn = -1;
  12. static bool g_bPacifierSuppressed = false;
  13. void StartPacifier( char const *pPrefix )
  14. {
  15. Msg( "%s", pPrefix );
  16. g_LastPacifierDrawn = -1;
  17. UpdatePacifier( 0.001f );
  18. }
  19. void UpdatePacifier( float flPercent )
  20. {
  21. int iCur = (int)(flPercent * 40.0f);
  22. iCur = clamp( iCur, g_LastPacifierDrawn, 40 );
  23. if( iCur != g_LastPacifierDrawn && !g_bPacifierSuppressed )
  24. {
  25. for( int i=g_LastPacifierDrawn+1; i <= iCur; i++ )
  26. {
  27. if ( !( i % 4 ) )
  28. {
  29. Msg("%d", i/4);
  30. }
  31. else
  32. {
  33. if( i != 40 )
  34. {
  35. Msg(".");
  36. }
  37. }
  38. }
  39. g_LastPacifierDrawn = iCur;
  40. }
  41. }
  42. void EndPacifier( bool bCarriageReturn )
  43. {
  44. UpdatePacifier(1);
  45. if( bCarriageReturn && !g_bPacifierSuppressed )
  46. Msg("\n");
  47. }
  48. void SuppressPacifier( bool bSuppress )
  49. {
  50. g_bPacifierSuppressed = bSuppress;
  51. }