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.

113 lines
3.6 KiB

  1. //===== Copyright � 1996-2009, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. //===========================================================================//
  6. #include "mm_title.h"
  7. // memdbgon must be the last include file in a .cpp file!!!
  8. #include "tier0/memdbgon.h"
  9. TitleDataFieldsDescription_t const * CMatchTitle::DescribeTitleDataStorage()
  10. {
  11. #define TD_ENTRY( szName, nTD, eDataType, numBytesOffset ) \
  12. { szName, TitleDataFieldsDescription_t::nTD, TitleDataFieldsDescription_t::eDataType, numBytesOffset }
  13. static TitleDataFieldsDescription_t tdfd[] =
  14. {
  15. #if 0
  16. TD_ENTRY( "TD1.Easy.Games.Total", DB_TD1, DT_U64, offsetof( TitleData1, mGames[0] ) ),
  17. TD_ENTRY( "TD1.Normal.Games.Total", DB_TD1, DT_U64, offsetof( TitleData1, mGames[1] ) ),
  18. TD_ENTRY( "TD1.Advanced.Games.Total", DB_TD1, DT_U64, offsetof( TitleData1, mGames[2] ) ),
  19. TD_ENTRY( "TD1.Expert.Games.Total", DB_TD1, DT_U64, offsetof( TitleData1, mGames[3] ) ),
  20. #endif
  21. TD_ENTRY( NULL, DB_TD1, DT_U8, 0 )
  22. };
  23. #undef TD_ENTRY
  24. return tdfd;
  25. }
  26. TitleAchievementsDescription_t const * CMatchTitle::DescribeTitleAchievements()
  27. {
  28. static TitleAchievementsDescription_t tad[] =
  29. {
  30. //#include "left4dead2.xhelp.achtitledesc.txt"
  31. // END MARKER
  32. { NULL, 0 }
  33. };
  34. return tad;
  35. }
  36. TitleAvatarAwardsDescription_t const * CMatchTitle::DescribeTitleAvatarAwards()
  37. {
  38. static TitleAvatarAwardsDescription_t taad[] =
  39. {
  40. //#include "left4dead2.xhelp.avawtitledesc.txt"
  41. // END MARKER
  42. { NULL, 0 }
  43. };
  44. return taad;
  45. }
  46. // Title leaderboards
  47. KeyValues * CMatchTitle::DescribeTitleLeaderboard( char const *szLeaderboardView )
  48. {
  49. /*
  50. // Check if this is a survival leaderboard
  51. if ( char const *szSurvivalMap = StringAfterPrefix( szLeaderboardView, "survival_" ) )
  52. {
  53. if ( IsX360() )
  54. {
  55. // Find the corresponding record in the mission script
  56. KeyValues *pSettings = new KeyValues( "settings" );
  57. KeyValues::AutoDelete autodelete_pSettings( pSettings );
  58. pSettings->SetString( "game/mode", "survival" );
  59. KeyValues *pMissionInfo = NULL;
  60. KeyValues *pMapInfo = g_pMatchExtL4D->GetMapInfoByBspName( pSettings, szSurvivalMap, &pMissionInfo );
  61. if ( !pMapInfo || !pMissionInfo )
  62. return NULL;
  63. // Find the leaderboard description in the map info
  64. KeyValues *pLbDesc = pMapInfo->FindKey( "x360leaderboard" );
  65. if ( !pLbDesc )
  66. return NULL;
  67. // Insert the required keys
  68. pLbDesc = pLbDesc->MakeCopy();
  69. static KeyValues *s_pRatingKey = KeyValues::FromString( ":rating", // X360 leaderboards are rated
  70. " name besttime " // game name of the rating field is "besttime"
  71. " type uint64 " // type is uint64
  72. " rule max" // rated field must be greater than cached value so that it can be written
  73. );
  74. pLbDesc->AddSubKey( s_pRatingKey->MakeCopy() );
  75. pLbDesc->SetString( "besttime/type", "uint64" );
  76. return pLbDesc;
  77. }
  78. if ( IsPC() )
  79. {
  80. KeyValues *pSettings = KeyValues::FromString( "SteamLeaderboard",
  81. " :score besttime " // :score is the leaderboard value mapped to game name "besttime"
  82. );
  83. pSettings->SetInt( ":sort", k_ELeaderboardSortMethodDescending ); // Sort order when fetching and displaying leaderboard data
  84. pSettings->SetInt( ":format", k_ELeaderboardDisplayTypeTimeMilliSeconds ); // Note: this is actually 1/100th seconds type, Steam change pending
  85. pSettings->SetInt( ":upload", k_ELeaderboardUploadScoreMethodKeepBest ); // Upload method when writing to leaderboard
  86. return pSettings;
  87. }
  88. }
  89. */
  90. return NULL;
  91. }