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.

74 lines
1.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. //Gamestats was built for ep1, so this file is going to be amazingly short seeing as how ep1 set the standard
  7. #include "cbase.h"
  8. #include "ep1_gamestats.h"
  9. #include "tier1/utlbuffer.h"
  10. static CEP1GameStats s_CEP1GS_ThisJustSitsInMemory;
  11. // A bit of a hack to redirect the gamestats API for ep2 (ep3, etc.)
  12. extern CBaseGameStats *g_pEP2GameStats;
  13. CEP1GameStats::CEP1GameStats( void )
  14. {
  15. gamestats = &s_CEP1GS_ThisJustSitsInMemory;
  16. }
  17. CBaseGameStats *CEP1GameStats::OnInit( CBaseGameStats *pCurrentGameStats, char const *gamedir )
  18. {
  19. if ( !Q_stricmp( gamedir, "ep2" ) )
  20. {
  21. return g_pEP2GameStats;
  22. }
  23. return pCurrentGameStats;
  24. }
  25. const char *CEP1GameStats::GetStatSaveFileName( void )
  26. {
  27. return "ep1_gamestats.dat"; //overriding the default for backwards compatibility with release stat tracking code
  28. }
  29. const char *CEP1GameStats::GetStatUploadRegistryKeyName( void )
  30. {
  31. return "GameStatsUpload_Ep1"; //overriding the default for backwards compatibility with release stat tracking code
  32. }
  33. static char const *ep1Maps[] =
  34. {
  35. "ep1_citadel_00",
  36. "ep1_citadel_01",
  37. "ep1_citadel_02",
  38. "ep1_citadel_02b",
  39. "ep1_citadel_03",
  40. "ep1_citadel_04",
  41. "ep1_c17_00",
  42. "ep1_c17_00a",
  43. "ep1_c17_01",
  44. "ep1_c17_02",
  45. "ep1_c17_02b",
  46. "ep1_c17_02a",
  47. "ep1_c17_05",
  48. "ep1_c17_06",
  49. };
  50. bool CEP1GameStats::UserPlayedAllTheMaps( void )
  51. {
  52. int c = ARRAYSIZE( ep1Maps );
  53. for ( int i = 0; i < c; ++i )
  54. {
  55. int idx = m_BasicStats.m_MapTotals.Find( ep1Maps[ i ] );
  56. if( idx == m_BasicStats.m_MapTotals.InvalidIndex() )
  57. return false;
  58. }
  59. return true;
  60. }