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.

119 lines
3.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef PASSTIME_GAME_EVENTS_H
  8. #define PASSTIME_GAME_EVENTS_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. class IGameEvent;
  13. namespace PasstimeGameEvents
  14. {
  15. // TODO: this was done following valve's style of having different events
  16. // for everything, but these particular events have a lot of overlap and
  17. // might be better implemented as a single "ball event" that has an enum
  18. // specifying what kind it is. It would cut down on the number of strcmp
  19. // calls in the event handling functions. Or maybe we could just not use
  20. // 1000s of strcmps for each event dispatch and use a lookup table of some kind.
  21. //-----------------------------------------------------------------------------
  22. struct BallGet
  23. {
  24. BallGet( IGameEvent *pEvent );
  25. BallGet( int ownerIndex );
  26. void Fire();
  27. static const char *const s_eventName;
  28. static const char *const s_keyOwnerIndex;
  29. int ownerIndex;
  30. };
  31. //-----------------------------------------------------------------------------
  32. struct Score
  33. {
  34. Score( IGameEvent *pEvent );
  35. Score( int scorerIndex, int assisterIndex, int numPoints );
  36. Score( int scorerIndex_, int numPoints_ );
  37. void Fire();
  38. static const char *const s_eventName;
  39. static const char *const s_keyScorerIndex;
  40. static const char *const s_keyAssisterIndex;
  41. static const char *const s_keyNumPoints;
  42. int scorerIndex;
  43. int assisterIndex;
  44. int numPoints;
  45. };
  46. //-----------------------------------------------------------------------------
  47. struct BallFree
  48. {
  49. BallFree( IGameEvent *pEvent );
  50. BallFree();
  51. BallFree( int ownerIndex );
  52. BallFree( int ownerIndex, int attackerIndex );
  53. void Fire();
  54. static const char *const s_eventName;
  55. static const char *const s_keyOwnerIndex;
  56. static const char *const s_keyAttackerIndex;
  57. int ownerIndex;
  58. int attackerIndex;
  59. };
  60. //-----------------------------------------------------------------------------
  61. struct PassCaught
  62. {
  63. PassCaught( IGameEvent *pEvent );
  64. PassCaught();
  65. PassCaught( int passerIndex, int catcherIndex, float dist, float duration );
  66. void Fire();
  67. static const char *const s_eventName;
  68. static const char *const s_keyPasserIndex;
  69. static const char *const s_keyCatcherIndex;
  70. static const char *const s_keyDist;
  71. static const char *const s_keyDuration;
  72. int passerIndex;
  73. int catcherIndex;
  74. float dist;
  75. float duration;
  76. };
  77. //-----------------------------------------------------------------------------
  78. struct BallStolen
  79. {
  80. BallStolen( IGameEvent *pEvent );
  81. BallStolen();
  82. BallStolen( int victimIndex, int attackerIndex );
  83. void Fire();
  84. static const char *const s_eventName;
  85. static const char *const s_keyVictimIndex;
  86. static const char *const s_keyAttackerIndex;
  87. int victimIndex;
  88. int attackerIndex;
  89. };
  90. //-----------------------------------------------------------------------------
  91. struct BallBlocked
  92. {
  93. BallBlocked( IGameEvent *pEvent );
  94. BallBlocked();
  95. BallBlocked( int ownerIndex, int blockerIndex );
  96. void Fire();
  97. static const char *const s_eventName;
  98. static const char *const s_keyOwnerIndex;
  99. static const char *const s_keyBlockerIndex;
  100. int ownerIndex;
  101. int blockerIndex;
  102. };
  103. }
  104. #endif // PASSTIME_GAME_EVENTS_H