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.

63 lines
1.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef LOADCOMMENTARYDIALOG_H
  7. #define LOADCOMMENTARYDIALOG_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "vgui_controls/Frame.h"
  12. #include "filesystem.h"
  13. #include "utlvector.h"
  14. #define COMMENTARY_MAPFILENAME_MAX_LEN MAX_PATH
  15. #define COMMENTARY_MAPNAME_MAX_LEN 32
  16. #define COMMENTARY_DESCRIP_MAX_LEN 512
  17. #define MAX_LISTED_COMMENTARY_ITEMS 32
  18. struct CommentaryItem_t
  19. {
  20. char szMapFileName[COMMENTARY_MAPFILENAME_MAX_LEN]; // file location of the map
  21. char szMapName[COMMENTARY_MAPNAME_MAX_LEN]; // clean name of the map, eg "dod_kalt"
  22. char szPrintName[COMMENTARY_MAPNAME_MAX_LEN]; // printable name "Kalt"
  23. char szDescription[COMMENTARY_DESCRIP_MAX_LEN]; // track description "This map is fun, and people like it!"
  24. //int iChannel; // TODO: multiple channels within a single map, loaded into separate commentary tracks
  25. };
  26. //-----------------------------------------------------------------------------
  27. // Purpose: Base class for save & load game dialogs
  28. //-----------------------------------------------------------------------------
  29. class CLoadCommentaryDialog : public vgui::Frame
  30. {
  31. DECLARE_CLASS_SIMPLE( CLoadCommentaryDialog, vgui::Frame );
  32. public:
  33. CLoadCommentaryDialog( vgui::Panel *parent );
  34. protected:
  35. CUtlVector<CommentaryItem_t> m_CommentaryItems;
  36. vgui::PanelListPanel *m_pGameList;
  37. virtual void OnCommand( const char *command );
  38. virtual void OnKeyCodePressed( vgui::KeyCode code );
  39. void ScanCommentaryFiles();
  40. void CreateCommentaryItemList();
  41. int GetSelectedItemIndex();
  42. void AddCommentaryItemToList( int saveIndex );
  43. void ParseCommentaryFile( char const *pszFileName, char const *pszShortName );
  44. static int __cdecl SaveGameSortFunc( const void *lhs, const void *rhs );
  45. private:
  46. MESSAGE_FUNC( OnPanelSelected, "PanelSelected" );
  47. };
  48. #endif // LOADCOMMENTARYDIALOG_H