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.

84 lines
2.9 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Player class data file parsing, shared by game & client dlls.
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef PLAYERCLASS_INFO_PARSE_H
  8. #define PLAYERCLASS_INFO_PARSE_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "shareddefs.h"
  13. class IFileSystem;
  14. class KeyValues;
  15. typedef unsigned short PLAYERCLASS_FILE_INFO_HANDLE;
  16. #define MAX_PLAYERCLASS_NAME_LENGTH 128
  17. //-----------------------------------------------------------------------------
  18. // Purpose: Contains the data read from the player class script files.
  19. // It's cached so we only read each script file once.
  20. // Each game provides a CreatePlayerClassInfo function so it can have game-specific
  21. // data in the player class scripts.
  22. //-----------------------------------------------------------------------------
  23. class FilePlayerClassInfo_t
  24. {
  25. public:
  26. FilePlayerClassInfo_t();
  27. // Each game can override this to get whatever values it wants from the script.
  28. virtual void Parse( KeyValues *pKeyValuesData, const char *szClassName );
  29. public:
  30. bool m_bParsedScript;
  31. public:
  32. // Class properties
  33. // todo : better lengths for these arrays ?
  34. char m_szPlayerClassName[MAX_PLAYERCLASS_NAME_LENGTH];
  35. char m_szPrintName[MAX_PLAYERCLASS_NAME_LENGTH]; // localization key for print name
  36. char m_szPlayerModel[MAX_PLAYERCLASS_NAME_LENGTH];
  37. char m_szSelectCmd[32]; //command the player can issue to switch to this class
  38. };
  39. // The weapon parse function
  40. bool ReadPlayerClassDataFromFileForSlot( IFileSystem* filesystem, const char *szClassName,
  41. PLAYERCLASS_FILE_INFO_HANDLE *phandle, const unsigned char *pICEKey = NULL );
  42. // If player class info has been loaded for the specified class name, this returns it.
  43. PLAYERCLASS_FILE_INFO_HANDLE LookupPlayerClassInfoSlot( const char *name );
  44. // Given a handle to the player class info, return the class data
  45. FilePlayerClassInfo_t *GetFilePlayerClassInfoFromHandle( PLAYERCLASS_FILE_INFO_HANDLE handle );
  46. // Get the null Player Class object
  47. PLAYERCLASS_FILE_INFO_HANDLE GetInvalidPlayerClassInfoHandle( void );
  48. // Initialize all player class info
  49. void ResetFilePlayerClassInfoDatabase( void );
  50. //
  51. // Read a possibly-encrypted KeyValues file in.
  52. // If pICEKey is NULL, then it appends .txt to the filename and loads it as an unencrypted file.
  53. // If pICEKey is non-NULL, then it appends .ctx to the filename and loads it as an encrypted file.
  54. //
  55. // (This should be moved into a more appropriate place).
  56. //
  57. extern KeyValues* ReadEncryptedKVPlayerClassFile( IFileSystem *filesystem, const char *szFilenameWithoutExtension, const unsigned char *pICEKey );
  58. // Each game implements this. It can return a derived class and override Parse() if it wants.
  59. extern FilePlayerClassInfo_t* CreatePlayerClassInfo();
  60. #endif // PLAYERCLASS_INFO_PARSE_H