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.

174 lines
3.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: The dod game stats header
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef DOD_GAMESTATS_H
  8. #define DOD_GAMESTATS_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. // Redefine some things for the stat reader so it doesn't have to include weapon_dodbase.h
  13. #ifndef GAME_DLL
  14. typedef enum
  15. {
  16. WEAPON_NONE = 0,
  17. //Melee
  18. WEAPON_AMERKNIFE,
  19. WEAPON_SPADE,
  20. //Pistols
  21. WEAPON_COLT,
  22. WEAPON_P38,
  23. WEAPON_C96,
  24. //Rifles
  25. WEAPON_GARAND,
  26. WEAPON_M1CARBINE,
  27. WEAPON_K98,
  28. //Sniper Rifles
  29. WEAPON_SPRING,
  30. WEAPON_K98_SCOPED,
  31. //SMG
  32. WEAPON_THOMPSON,
  33. WEAPON_MP40,
  34. WEAPON_MP44,
  35. WEAPON_BAR,
  36. //Machine guns
  37. WEAPON_30CAL,
  38. WEAPON_MG42,
  39. //Rocket weapons
  40. WEAPON_BAZOOKA,
  41. WEAPON_PSCHRECK,
  42. //Grenades
  43. WEAPON_FRAG_US,
  44. WEAPON_FRAG_GER,
  45. WEAPON_FRAG_US_LIVE,
  46. WEAPON_FRAG_GER_LIVE,
  47. WEAPON_SMOKE_US,
  48. WEAPON_SMOKE_GER,
  49. WEAPON_RIFLEGREN_US,
  50. WEAPON_RIFLEGREN_GER,
  51. WEAPON_RIFLEGREN_US_LIVE,
  52. WEAPON_RIFLEGREN_GER_LIVE,
  53. // not actually separate weapons, but defines used in stats recording
  54. // find a better way to do this without polluting the list of actual weapons.
  55. WEAPON_THOMPSON_PUNCH,
  56. WEAPON_MP40_PUNCH,
  57. WEAPON_GARAND_ZOOMED,
  58. WEAPON_K98_ZOOMED,
  59. WEAPON_SPRING_ZOOMED,
  60. WEAPON_K98_SCOPED_ZOOMED,
  61. WEAPON_30CAL_UNDEPLOYED,
  62. WEAPON_MG42_UNDEPLOYED,
  63. WEAPON_BAR_SEMIAUTO,
  64. WEAPON_MP44_SEMIAUTO,
  65. WEAPON_MAX, // number of weapons weapon index
  66. } DODWeaponID;
  67. #endif // ndef WEAPON_NONE
  68. #define DOD_STATS_BLOB_VERSION 2 // changed to 2 for the orange box beta
  69. #define DOD_NUM_DISTANCE_STAT_WEAPONS 22
  70. #define DOD_NUM_NODIST_STAT_WEAPONS 14
  71. #define DOD_NUM_WEAPON_DISTANCE_BUCKETS 10
  72. extern int iDistanceStatWeapons[DOD_NUM_DISTANCE_STAT_WEAPONS];
  73. extern int iNoDistStatWeapons[DOD_NUM_NODIST_STAT_WEAPONS];
  74. extern int iWeaponBucketDistances[DOD_NUM_WEAPON_DISTANCE_BUCKETS-1];
  75. #ifndef GAME_DLL
  76. extern const char * s_WeaponAliasInfo[];
  77. #endif
  78. typedef struct
  79. {
  80. char szGameName[8];
  81. byte iVersion;
  82. char szMapName[32];
  83. char ipAddr[4];
  84. short port;
  85. int serverid;
  86. } gamestats_header_t;
  87. // Stats for bullet weapons - includes distance of hits
  88. typedef struct
  89. {
  90. short iNumAttacks; // times fired
  91. short iNumHits; // times hit
  92. // distance buckets - distances are defined per-weapon ( 0 is closest, buckets-1 farthest )
  93. short iDistanceBuckets[DOD_NUM_WEAPON_DISTANCE_BUCKETS];
  94. } dod_gamestats_weapon_distance_t;
  95. // Stats for non-bullet weapons
  96. typedef struct
  97. {
  98. short iNumAttacks; // times fired
  99. short iNumHits; // times hit
  100. } dod_gamestats_weapon_nodist_t;
  101. typedef struct
  102. {
  103. gamestats_header_t header;
  104. // Team Scores
  105. byte iNumAlliesWins;
  106. byte iNumAxisWins;
  107. short iAlliesTickPoints;
  108. short iAxisTickPoints;
  109. short iMinutesPlayed; // time spent on the map rotation
  110. // Player Data
  111. short iMinutesPlayedPerClass_Allies[7]; // includes random
  112. short iMinutesPlayedPerClass_Axis[7]; // includes random
  113. short iKillsPerClass_Allies[6];
  114. short iKillsPerClass_Axis[6];
  115. short iSpawnsPerClass_Allies[6];
  116. short iSpawnsPerClass_Axis[6];
  117. short iCapsPerClass_Allies[6];
  118. short iCapsPerClass_Axis[6];
  119. byte iDefensesPerClass_Allies[6];
  120. byte iDefensesPerClass_Axis[6];
  121. // Server Settings
  122. // assume these class limits don't change through the course of the map
  123. byte iClassLimits_Allies[6];
  124. byte iClassLimits_Axis[6];
  125. // Weapon Data
  126. dod_gamestats_weapon_distance_t weaponStatsDistance[DOD_NUM_DISTANCE_STAT_WEAPONS]; // 14 * 22 = 308 bytes
  127. dod_gamestats_weapon_nodist_t weaponStats[DOD_NUM_NODIST_STAT_WEAPONS]; // 4 * 14 = 56 bytes
  128. // how many times a weapon was picked up ?
  129. } dod_gamestats_t;
  130. #endif // DOD_GAMESTATS_H