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.

251 lines
6.7 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Defines options that are written to the registry.
  4. //
  5. //=============================================================================//
  6. #ifndef OPTIONS_H
  7. #define OPTIONS_H
  8. #pragma once
  9. #pragma warning(push, 1)
  10. #pragma warning(disable:4701 4702 4530)
  11. #include <fstream>
  12. #pragma warning(pop)
  13. #include <afxtempl.h>
  14. class CGameConfig;
  15. class KeyValues;
  16. enum TextureAlignment_t;
  17. class COptionsGeneral
  18. {
  19. public:
  20. int nMaxCameras;
  21. int iUndoLevels;
  22. BOOL bLockingTextures;
  23. BOOL bScaleLockingTextures;
  24. TextureAlignment_t eTextureAlignment;
  25. BOOL bLoadwinpos;
  26. BOOL bIndependentwin;
  27. BOOL bEnablePerforceIntegration;
  28. BOOL bGroupWhileIgnore;
  29. BOOL bStretchArches;
  30. BOOL bShowHelpers;
  31. BOOL bCheckVisibleMapErrors;
  32. int iTimeBetweenSaves;
  33. int iMaxAutosaveSpace;
  34. int iMaxAutosavesPerMap;
  35. BOOL bClosedCorrectly;
  36. char szAutosaveDir[MAX_PATH];
  37. BOOL bShowCollisionModels;
  38. BOOL bShowDetailObjects;
  39. BOOL bShowNoDrawBrushes;
  40. BOOL bEnableAutosave;
  41. BOOL bShowHiddenTargetsAsBroken;
  42. BOOL bRadiusCulling;
  43. };
  44. class COptionsTextures
  45. {
  46. public:
  47. CStringArray TextureFiles;
  48. int nTextureFiles;
  49. float fBrightness;
  50. };
  51. class COptionsColors
  52. {
  53. public:
  54. bool bUseCustom; // Whether to use the custom colors or not.
  55. bool bScaleAxisColor; // Whether to use the intensity slider to scale the axis color in the 2D view.
  56. bool bScaleGridColor; // Whether to use the intensity slider to scale the grid color in the 2D view.
  57. bool bScaleGridDotColor; // Whether to use the intensity slider to scale the dotted grid color in the 2D view.
  58. bool bScaleGrid10Color; // Whether to use the intensity slider to scale the 10 grid color in the 2D view.
  59. bool bScaleGrid1024Color; // Whether to use the intensity slider to scale the 1024 grid color in the 2D view.
  60. COLORREF clrAxis; // The 2D view axis color.
  61. COLORREF clrGrid; // The 2D view grid color.
  62. COLORREF clrGridDot; // The 2D view dotted grid color.
  63. COLORREF clrGrid10; // The 2D view grid color for every 10th line.
  64. COLORREF clrGrid1024; // The 2D view grid color for every 1024 units line.
  65. COLORREF clrBackground; // The 2D view background color.
  66. COLORREF clrBrush; // The color of brushes.
  67. COLORREF clrEntity; // The default color of point entities & brush entities, can be overridden by the FGD.
  68. COLORREF clrSelection; // The color of selected objects.
  69. COLORREF clrVertex; // The color of vertices.
  70. COLORREF clrToolHandle; // The color of tool handles.
  71. COLORREF clrToolBlock; // The color of the block tool.
  72. COLORREF clrToolSelection; // The color of the selection tool.
  73. COLORREF clrToolMorph; // The color of the morph tool.
  74. COLORREF clrToolPath; // The color of the path tool.
  75. COLORREF clrToolDrag; // The color of tool bounds while it is being dragged.
  76. COLORREF clrModelCollisionWireframe; // The color of a model's collision wireframe
  77. COLORREF clrModelCollisionWireframeDisabled; // The color of a model's collision wireframe when set to "Not Solid" via the entity properties
  78. };
  79. class COptionsView2D
  80. {
  81. public:
  82. BOOL bCrosshairs;
  83. BOOL bGroupCarve;
  84. BOOL bScrollbars;
  85. BOOL bRotateConstrain;
  86. BOOL bDrawVertices;
  87. BOOL bDrawModels;
  88. BOOL bWhiteOnBlack;
  89. BOOL bGridHigh1024;
  90. BOOL bGridHigh10;
  91. BOOL bHideSmallGrid;
  92. BOOL bNudge;
  93. BOOL bOrientPrimitives;
  94. BOOL bAutoSelect;
  95. BOOL bSelectbyhandles;
  96. BOOL bKeepclonegroup;
  97. BOOL bGridHigh64;
  98. BOOL bCenteroncamera;
  99. BOOL bUsegroupcolors;
  100. BOOL bGridDots;
  101. int iDefaultGrid;
  102. int iGridIntensity;
  103. int iGridHighSpec;
  104. };
  105. class COptionsView3D
  106. {
  107. public:
  108. BOOL bHardware; // Whether to use hardware acceleration (disabled for OpenGL).
  109. BOOL bReverseY; // Wether to reverse the mouse's Y axis when mouse looking.
  110. BOOL bUseMouseLook; // Whether to use the engine's default movement controls.
  111. int iBackPlane; // Distance to far clipping plane in world units.
  112. int nModelDistance; // Distance in world units within which studio models render.
  113. int nDetailDistance; // Distance in world units within which detail props render.
  114. BOOL bAnimateModels; // Whether to animate studio models.
  115. int nForwardSpeedMax; // Max forward speed in world units per second.
  116. int nTimeToMaxSpeed; // Time to max forward speed in milliseconds.
  117. BOOL bFilterTextures; // Whether to filter textures.
  118. BOOL bReverseSelection; // Whether to animate studio models.
  119. bool bPreviewModelFade; // Whether to preview model fade in the 3D view.
  120. int nFadeMode; // Fade - Low, Med, High
  121. float fFOV; // FOV of 3D Camera
  122. int iViewInstancesMode; // View Instances mode, none, tinted, normal
  123. };
  124. class COptionsConfigs
  125. {
  126. public:
  127. COptionsConfigs(void);
  128. virtual ~COptionsConfigs(void);
  129. CGameConfig *AddConfig(void);
  130. int LoadGameConfigs();
  131. void SaveGameConfigs();
  132. bool ResetGameConfigs( bool bOverwrite );
  133. inline int GetGameConfigCount();
  134. inline CGameConfig *GetGameConfig(int nIndex);
  135. // find a game config based on ID:
  136. CGameConfig *FindConfig(DWORD dwID, int *piIndex = NULL);
  137. CGameConfig *FindConfigForGame(const char *szGame);
  138. int nConfigs;
  139. CTypedPtrArray<CPtrArray, CGameConfig*> Configs;
  140. CString m_strConfigDir;
  141. private:
  142. int LoadGameConfigsBlock( KeyValues *pBlock );
  143. int ImportOldGameConfigs(const char *pszFileName);
  144. };
  145. //-----------------------------------------------------------------------------
  146. // Purpose: Functions for iterating the game configs.
  147. //-----------------------------------------------------------------------------
  148. int COptionsConfigs::GetGameConfigCount()
  149. {
  150. return nConfigs;
  151. }
  152. CGameConfig *COptionsConfigs::GetGameConfig(int nIndex)
  153. {
  154. return Configs.GetAt(nIndex);
  155. }
  156. class COptions
  157. {
  158. public:
  159. COptions();
  160. bool Init();
  161. bool Read();
  162. void SetDefaults();
  163. void Write( BOOL fOverwrite, BOOL fSaveConfigs );
  164. void SetClosedCorrectly(BOOL bClosed);
  165. // This happens if it can't initialize the file system, or if they're missing gameinfo.txt.
  166. // It forces them to choose or create a config that works.
  167. bool RunConfigurationDialog();
  168. void PerformChanges(DWORD = 0xffffffff);
  169. // Accessors:
  170. TextureAlignment_t GetTextureAlignment(void);
  171. TextureAlignment_t SetTextureAlignment(TextureAlignment_t eTextureAlignment);
  172. bool GetShowHelpers(void);
  173. void SetShowHelpers(bool bShow);
  174. BOOL SetLockingTextures(BOOL b);
  175. BOOL IsLockingTextures(void);
  176. BOOL SetScaleLockingTextures(BOOL b);
  177. BOOL IsScaleLockingTextures(void);
  178. // Attributes:
  179. UINT uDaysSinceInstalled;
  180. // Flags for PerformChanges:
  181. enum
  182. {
  183. secTextures = 0x01,
  184. secGeneral = 0x02,
  185. secView2D = 0x04,
  186. secView3D = 0x08,
  187. secConfigs = 0x10
  188. };
  189. COptionsGeneral general;
  190. COptionsView2D view2d;
  191. COptionsView3D view3d;
  192. COptionsTextures textures;
  193. COptionsConfigs configs;
  194. COptionsColors colors;
  195. private:
  196. void ReadColorSettings(void);
  197. };
  198. extern COptions Options;
  199. #endif // OPTIONS_H