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.

100 lines
2.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef ACTIVITYLIST_H
  8. #define ACTIVITYLIST_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <KeyValues.h>
  13. typedef struct activityentry_s activityentry_t;
  14. class CActivityRemap
  15. {
  16. public:
  17. CActivityRemap()
  18. {
  19. pExtraBlock = NULL;
  20. }
  21. void SetExtraKeyValueBlock ( KeyValues *pKVBlock )
  22. {
  23. pExtraBlock = pKVBlock;
  24. }
  25. KeyValues *GetExtraKeyValueBlock ( void ) { return pExtraBlock; }
  26. Activity activity;
  27. Activity mappedActivity;
  28. private:
  29. KeyValues *pExtraBlock;
  30. };
  31. class CActivityRemapCache
  32. {
  33. public:
  34. CActivityRemapCache()
  35. {
  36. }
  37. CActivityRemapCache( const CActivityRemapCache& src )
  38. {
  39. int c = src.m_cachedActivityRemaps.Count();
  40. for ( int i = 0; i < c; i++ )
  41. {
  42. m_cachedActivityRemaps.AddToTail( src.m_cachedActivityRemaps[ i ] );
  43. }
  44. }
  45. CActivityRemapCache& operator = ( const CActivityRemapCache& src )
  46. {
  47. if ( this == &src )
  48. return *this;
  49. int c = src.m_cachedActivityRemaps.Count();
  50. for ( int i = 0; i < c; i++ )
  51. {
  52. m_cachedActivityRemaps.AddToTail( src.m_cachedActivityRemaps[ i ] );
  53. }
  54. return *this;
  55. }
  56. CUtlVector< CActivityRemap > m_cachedActivityRemaps;
  57. };
  58. void UTIL_LoadActivityRemapFile( const char *filename, const char *section, CUtlVector <CActivityRemap> &entries );
  59. //=========================================================
  60. //=========================================================
  61. extern void ActivityList_Init( void );
  62. extern void ActivityList_Free( void );
  63. extern bool ActivityList_RegisterSharedActivity( const char *pszActivityName, int iActivityIndex );
  64. extern Activity ActivityList_RegisterPrivateActivity( const char *pszActivityName );
  65. extern int ActivityList_IndexForName( const char *pszActivityName );
  66. extern const char *ActivityList_NameForIndex( int iActivityIndex );
  67. extern int ActivityList_HighestIndex();
  68. // This macro guarantees that the names of each activity and the constant used to
  69. // reference it in the code are identical.
  70. #define REGISTER_SHARED_ACTIVITY( _n ) ActivityList_RegisterSharedActivity(#_n, _n);
  71. #define REGISTER_PRIVATE_ACTIVITY( _n ) _n = ActivityList_RegisterPrivateActivity( #_n );
  72. // Implemented in shared code
  73. extern void ActivityList_RegisterSharedActivities( void );
  74. class ISaveRestoreOps;
  75. extern ISaveRestoreOps* ActivityDataOps();
  76. #endif // ACTIVITYLIST_H