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.

163 lines
5.4 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef OPTIONSSUBMULTIPLAYER_H
  8. #define OPTIONSSUBMULTIPLAYER_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui_controls/PropertyPage.h>
  13. class CLabeledCommandComboBox;
  14. class CBitmapImagePanel;
  15. class CCvarToggleCheckButton;
  16. class CCvarTextEntry;
  17. class CCvarSlider;
  18. class CrosshairImagePanel;
  19. class CMultiplayerAdvancedDialog;
  20. class AdvancedCrosshairImagePanel;
  21. enum ConversionErrorType
  22. {
  23. CE_SUCCESS,
  24. CE_MEMORY_ERROR,
  25. CE_CANT_OPEN_SOURCE_FILE,
  26. CE_ERROR_PARSING_SOURCE,
  27. CE_SOURCE_FILE_FORMAT_NOT_SUPPORTED,
  28. CE_ERROR_WRITING_OUTPUT_FILE,
  29. CE_ERROR_LOADING_DLL
  30. };
  31. struct TGAHeader {
  32. byte identsize; // size of ID field that follows 18 byte header (0 usually)
  33. byte colourmaptype; // type of colour map 0=none, 1=has palette
  34. byte imagetype; // type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed
  35. short colourmapstart; // first colour map entry in palette
  36. short colourmaplength; // number of colours in palette
  37. byte colourmapbits; // number of bits per palette entry 15,16,24,32
  38. short xstart; // image x origin
  39. short ystart; // image y origin
  40. short width; // image width in pixels
  41. short height; // image height in pixels
  42. byte bits; // image bits per pixel 8,16,24,32
  43. byte descriptor; // image descriptor bits (vh flip bits)
  44. };
  45. //-----------------------------------------------------------------------------
  46. // Purpose: multiplayer options property page
  47. //-----------------------------------------------------------------------------
  48. class COptionsSubMultiplayer : public vgui::PropertyPage
  49. {
  50. DECLARE_CLASS_SIMPLE( COptionsSubMultiplayer, vgui::PropertyPage );
  51. public:
  52. explicit COptionsSubMultiplayer(vgui::Panel *parent);
  53. ~COptionsSubMultiplayer();
  54. virtual vgui::Panel *CreateControlByName(const char *controlName);
  55. protected:
  56. // Called when page is loaded. Data should be reloaded from document into controls.
  57. virtual void OnResetData();
  58. // Called when the OK / Apply button is pressed. Changed data should be written into document.
  59. virtual void OnApplyChanges();
  60. virtual void OnCommand( const char *command );
  61. private:
  62. void InitModelList(CLabeledCommandComboBox *cb);
  63. void InitLogoList(CLabeledCommandComboBox *cb);
  64. void RemapModel();
  65. void RemapLogo();
  66. MESSAGE_FUNC_PTR( OnTextChanged, "TextChanged", panel );
  67. MESSAGE_FUNC_PARAMS( OnSliderMoved, "SliderMoved", data );
  68. MESSAGE_FUNC( OnApplyButtonEnable, "ControlModified" );
  69. MESSAGE_FUNC_CHARPTR( OnFileSelected, "FileSelected", fullpath );
  70. void RemapPalette(char *filename, int topcolor, int bottomcolor);
  71. void ColorForName(char const *pszColorName, int &r, int &g, int &b);
  72. CBitmapImagePanel *m_pModelImage;
  73. CLabeledCommandComboBox *m_pModelList;
  74. char m_ModelName[128];
  75. vgui::ImagePanel *m_pLogoImage;
  76. CLabeledCommandComboBox *m_pLogoList;
  77. char m_LogoName[128];
  78. CCvarSlider *m_pPrimaryColorSlider;
  79. CCvarSlider *m_pSecondaryColorSlider;
  80. CCvarToggleCheckButton *m_pHighQualityModelCheckBox;
  81. // Mod specific general checkboxes
  82. vgui::Dar< CCvarToggleCheckButton * > m_cvarToggleCheckButtons;
  83. // --- crosshair controls ----------------------------------
  84. CLabeledCommandComboBox *m_pCrosshairSize;
  85. void InitCrosshairSizeList(CLabeledCommandComboBox *cb);
  86. CCvarToggleCheckButton *m_pCrosshairTranslucencyCheckbox;
  87. vgui::ComboBox *m_pCrosshairColorComboBox;
  88. void InitCrosshairColorEntries();
  89. void ApplyCrosshairColorChanges();
  90. CrosshairImagePanel *m_pCrosshairImage;
  91. // called when the appearance of the crosshair has changed.
  92. void RedrawCrosshairImage();
  93. // ---------------------------------------------------------
  94. // --- advanced crosshair controls
  95. AdvancedCrosshairImagePanel *m_pAdvCrosshairImage;
  96. CCvarSlider *m_pAdvCrosshairRedSlider;
  97. CCvarSlider *m_pAdvCrosshairBlueSlider;
  98. CCvarSlider *m_pAdvCrosshairGreenSlider;
  99. CCvarSlider *m_pAdvCrosshairScaleSlider;
  100. CLabeledCommandComboBox *m_pAdvCrosshairStyle;
  101. void InitAdvCrosshairStyleList(CLabeledCommandComboBox *cb);
  102. void RedrawAdvCrosshairImage();
  103. // -----
  104. // --- client download filter
  105. vgui::ComboBox *m_pDownloadFilterCombo;
  106. // Begin Spray Import Functions
  107. ConversionErrorType ConvertJPEGToTGA(const char *jpgPath, const char *tgaPath);
  108. ConversionErrorType ConvertBMPToTGA(const char *bmpPath, const char *tgaPath);
  109. ConversionErrorType ConvertTGA(const char *tgaPath);
  110. unsigned char *ReadTGAAsRGBA(const char *tgaPath, int &width, int &height, ConversionErrorType &errcode, TGAHeader &tgaHeader);
  111. ConversionErrorType StretchRGBAImage(const unsigned char *srcBuf, const int srcWidth, const int srcHeight, unsigned char *destBuf, const int destWidth, const int destHeight);
  112. ConversionErrorType PadRGBAImage(const unsigned char *srcBuf, const int srcWidth, const int srcHeight, unsigned char *destBuf, const int destWidth, const int destHeight);
  113. ConversionErrorType ConvertTGAToVTF(const char *tgaPath);
  114. ConversionErrorType WriteSprayVMT(const char *vtfPath);
  115. void SelectLogo(const char *logoName);
  116. // End Spray Import Functions
  117. int m_nTopColor;
  118. int m_nBottomColor;
  119. int m_nLogoR;
  120. int m_nLogoG;
  121. int m_nLogoB;
  122. vgui::DHANDLE<CMultiplayerAdvancedDialog> m_hMultiplayerAdvancedDialog;
  123. vgui::FileOpenDialog *m_hImportSprayDialog;
  124. };
  125. #endif // OPTIONSSUBMULTIPLAYER_H