PrefsDlg.cpp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. /*
  2. ===========================================================================
  3. Copyright (C) 1999-2005 Id Software, Inc.
  4. This file is part of Quake III Arena source code.
  5. Quake III Arena source code is free software; you can redistribute it
  6. and/or modify it under the terms of the GNU General Public License as
  7. published by the Free Software Foundation; either version 2 of the License,
  8. or (at your option) any later version.
  9. Quake III Arena source code is distributed in the hope that it will be
  10. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with Foobar; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. ===========================================================================
  17. */
  18. // PrefsDlg.cpp : implementation file
  19. //
  20. #include "stdafx.h"
  21. #include "PrefsDlg.h"
  22. #include "shlobj.h"
  23. #ifdef _DEBUG
  24. #define new DEBUG_NEW
  25. #undef THIS_FILE
  26. static char THIS_FILE[] = __FILE__;
  27. #endif
  28. #define PREF_SECTION "Prefs"
  29. #define INTERNAL_SECTION "Internals"
  30. #define MOUSE_KEY "MouseButtons"
  31. #define WINDOW_KEY "QE4StyleWindows"
  32. #define LAYOUT_KEY "WindowLayout"
  33. #define Q2_KEY "Quake2Dir"
  34. #define RUNQ2_KEY "RunQuake2Run"
  35. #define TLOCK_KEY "TextureLock"
  36. #define RLOCK_KEY "RotateLock"
  37. #define LOADLAST_KEY "LoadLast"
  38. #define LOADLASTMAP_KEY "LoadLastMap"
  39. #define LASTPROJ_KEY "LastProject"
  40. #define LASTMAP_KEY "LastMap"
  41. #define RUN_KEY "RunBefore"
  42. #define _3DFX_KEY "Use3Dfx"
  43. #define FACE_KEY "NewFaceGrab"
  44. #define BSP_KEY "InternalBSP"
  45. #define RCLICK_KEY "NewRightClick"
  46. #define VERTEX_KEY "NewVertex"
  47. #define AUTOSAVE_KEY "Autosave"
  48. #define AUTOSAVETIME_KEY "AutosaveMinutes"
  49. #define PAK_KEY "UsePAK"
  50. #define NEWAPPLY_KEY "ApplyDismissesSurface"
  51. #define HACK_KEY "Gatewayescapehack"
  52. #define TEXTURE_KEY "NewTextureWindowStuff"
  53. #define TINYBRUSH_KEY "CleanTinyBrushes"
  54. #define TINYSIZE_KEY "CleanTinyBrusheSize"
  55. #define SNAPSHOT_KEY "Snapshots"
  56. #define PAKFILE_KEY "PAKFile"
  57. #define STATUS_KEY "StatusPointSize"
  58. #define MOVESPEED_KEY "MoveSpeed"
  59. #define ANGLESPEED_KEY "AngleSpeed"
  60. #define SETGAME_KEY "UseSetGame"
  61. #define CAMXYUPDATE_KEY "CamXYUpdate"
  62. #define LIGHTDRAW_KEY "NewLightStyle"
  63. #define WHATGAME_KEY "WhichGame"
  64. #define CUBICCLIP_KEY "CubicClipping"
  65. #define CUBICSCALE_KEY "CubicScale"
  66. #define ALTEDGE_KEY "ALTEdgeDrag"
  67. #define TEXTUREBAR_KEY "UseTextureBar"
  68. #define FACECOLORS_KEY "FaceColors"
  69. #define QE4PAINT_KEY "QE4Paint"
  70. #define SNAPT_KEY "SnapT"
  71. #define XZVIS_KEY "XZVIS"
  72. #define YZVIS_KEY "YZVIS"
  73. #define ZVIS_KEY "ZVIS"
  74. #define SIZEPAINT_KEY "SizePainting"
  75. #define DLLENTITIES_KEY "DLLEntities"
  76. #define WIDETOOLBAR_KEY "WideToolBar"
  77. #define NOCLAMP_KEY "NoClamp"
  78. #define PREFAB_KEY "PrefabPath"
  79. #define USERINI_KEY "UserINIPath"
  80. #define ROTATION_KEY "Rotation"
  81. #define SGIOPENGL_KEY "SGIOpenGL"
  82. #define BUGGYICD_KEY "BuggyICD"
  83. #define HICOLOR_KEY "HiColorTextures"
  84. #define CHASEMOUSE_KEY "ChaseMouse"
  85. #define ENTITYSHOW_KEY "EntityShow"
  86. #define TEXTURESCALE_KEY "TextureScale"
  87. #define TEXTURESCROLLBAR_KEY "TextureScrollbar"
  88. #define DISPLAYLISTS_KEY "UseDisplayLists"
  89. #define NORMALIZECOLORS_KEY "NormalizeColors"
  90. #define SHADERS_KEY "UseShaders"
  91. #define SWITCHCLIP_KEY "SwitchClipKey"
  92. #define SELWHOLEENTS_KEY "SelectWholeEntitiesKey"
  93. #define TEXTURESUBSET_KEY "UseTextureSubsetLoading"
  94. #define TEXTUREQUALITY_KEY "TextureQuality"
  95. #define SHOWSHADERS_KEY "ShowShaders"
  96. #define SHADERTEST_KEY "ShaderTest"
  97. #define GLLIGHTING_KEY "UseGLLighting"
  98. #define LOADSHADERS_KEY "LoadShaders"
  99. #define NOSTIPPLE_KEY "NoStipple"
  100. #define UNDOLEVELS_KEY "UndoLevels"
  101. #define MOUSE_DEF 1
  102. #define WINDOW_DEF 0
  103. #define Q2_DEF "c:\\quake2\\quake2.exe"
  104. #define Q3_DEF "c:\\Program Files\\Quake III Arena\\quake3.exe"
  105. #define PAKFILE_DEF "c:\\quake2\\baseq2\\pak0.pak"
  106. #define RUNQ2_DEF 0
  107. #define TLOCK_DEF 1
  108. #define LOADLAST_DEF 1
  109. #define RUN_DEF 0
  110. /////////////////////////////////////////////////////////////////////////////
  111. // CPrefsDlg dialog
  112. CPrefsDlg::CPrefsDlg(CWnd* pParent /*=NULL*/)
  113. : CDialog(CPrefsDlg::IDD, pParent)
  114. {
  115. //{{AFX_DATA_INIT(CPrefsDlg)
  116. m_strQuake2 = _T("c:\\quake3\\");
  117. m_nMouse = 1;
  118. m_nView = 0;
  119. m_bLoadLast = FALSE;
  120. m_bFace = FALSE;
  121. m_bInternalBSP = FALSE;
  122. m_bRightClick = FALSE;
  123. m_bRunQuake = FALSE;
  124. m_bSetGame = FALSE;
  125. m_bVertex = FALSE;
  126. m_bAutoSave = TRUE;
  127. m_bNewApplyHandling = FALSE;
  128. m_strAutoSave = _T("5");
  129. m_bPAK = FALSE;
  130. m_bLoadLastMap = FALSE;
  131. m_bTextureWindow = FALSE;
  132. m_bSnapShots = FALSE;
  133. m_fTinySize = 0.5;
  134. m_bCleanTiny = FALSE;
  135. m_strPAKFile = _T("c:\\quake2\\baseq2\\pak0.pak");
  136. m_nStatusSize = 10;
  137. m_bCamXYUpdate = FALSE;
  138. m_bNewLightDraw = FALSE;
  139. m_strPrefabPath = _T("");
  140. m_nWhatGame = 0;
  141. m_strWhatGame = _T("Quake3");
  142. m_bALTEdge = FALSE;
  143. m_bTextureBar = FALSE;
  144. m_bFaceColors = FALSE;
  145. m_bQE4Painting = TRUE;
  146. m_bSnapTToGrid = FALSE;
  147. m_bXZVis = FALSE;
  148. m_bYZVis = FALSE;
  149. m_bZVis = FALSE;
  150. m_bSizePaint = FALSE;
  151. m_bDLLEntities = FALSE;
  152. m_bWideToolbar = TRUE;
  153. m_bNoClamp = FALSE;
  154. m_strUserPath = _T("");
  155. m_nRotation = 0;
  156. m_bSGIOpenGL = FALSE;
  157. m_bBuggyICD = FALSE;
  158. m_bHiColorTextures = TRUE;
  159. m_bChaseMouse = FALSE;
  160. m_bTextureScrollbar = TRUE;
  161. m_bDisplayLists = TRUE;
  162. m_bShowShaders = FALSE;
  163. m_nShader = -1;
  164. m_bNoStipple = FALSE;
  165. //}}AFX_DATA_INIT
  166. //LoadPrefs();
  167. m_bSelectCurves = TRUE;
  168. m_bSelectTerrain = TRUE;
  169. m_nEntityShowState = 0;
  170. m_nTextureScale = 2;
  171. m_bSwitchClip = FALSE;
  172. m_bSelectWholeEntities = TRUE;
  173. m_nTextureQuality = 3;
  174. m_bShowShaders = TRUE;
  175. m_bGLLighting = FALSE;
  176. m_nShader = 0;
  177. m_nUndoLevels = 64;
  178. }
  179. void CPrefsDlg::DoDataExchange(CDataExchange* pDX)
  180. {
  181. CDialog::DoDataExchange(pDX);
  182. //{{AFX_DATA_MAP(CPrefsDlg)
  183. DDX_Control(pDX, IDC_SPIN_UNDO, m_wndUndoSpin);
  184. DDX_Control(pDX, IDC_SPIN_POINTSIZE, m_wndFontSpin);
  185. DDX_Control(pDX, IDC_SLIDER_TEXTUREQUALITY, m_wndTexturequality);
  186. DDX_Control(pDX, IDC_COMBO_WHATGAME, m_wndWhatGame);
  187. DDX_Control(pDX, IDC_SLIDER_CAMSPEED, m_wndCamSpeed);
  188. DDX_Control(pDX, IDC_SPIN_AUTOSAVE, m_wndSpin);
  189. DDX_Text(pDX, IDC_EDIT_QUAKE2, m_strQuake2);
  190. DDX_Radio(pDX, IDC_RADIO_MOUSE, m_nMouse);
  191. DDX_Radio(pDX, IDC_RADIO_VIEWTYPE, m_nView);
  192. DDX_Check(pDX, IDC_CHECK_LOADLAST, m_bLoadLast);
  193. DDX_Check(pDX, IDC_CHECK_FACE, m_bFace);
  194. DDX_Check(pDX, IDC_CHECK_INTERNALBSP, m_bInternalBSP);
  195. DDX_Check(pDX, IDC_CHECK_RIGHTCLICK, m_bRightClick);
  196. DDX_Check(pDX, IDC_CHECK_RUNQUAKE, m_bRunQuake);
  197. DDX_Check(pDX, IDC_CHECK_SETGAME, m_bSetGame);
  198. DDX_Check(pDX, IDC_CHECK_VERTEX, m_bVertex);
  199. DDX_Check(pDX, IDC_CHECK_AUTOSAVE, m_bAutoSave);
  200. DDX_Text(pDX, IDC_EDIT_AUTOSAVE, m_strAutoSave);
  201. DDX_Check(pDX, IDC_CHECK_PAK, m_bPAK);
  202. DDX_Check(pDX, IDC_CHECK_LOADLASTMAP, m_bLoadLastMap);
  203. DDX_Check(pDX, IDC_CHECK_TEXTUREWINDOW, m_bTextureWindow);
  204. DDX_Check(pDX, IDC_CHECK_SNAPSHOTS, m_bSnapShots);
  205. DDX_Text(pDX, IDC_EDIT_PAKFILE, m_strPAKFile);
  206. DDX_Text(pDX, IDC_EDIT_STATUSPOINTSIZE, m_nStatusSize);
  207. DDV_MinMaxInt(pDX, m_nStatusSize, 2, 14);
  208. DDX_Check(pDX, IDC_CHECK_CAMXYUPDATE, m_bCamXYUpdate);
  209. DDX_Check(pDX, IDC_CHECK_LIGHTDRAW, m_bNewLightDraw);
  210. DDX_Text(pDX, IDC_EDIT_PREFABPATH, m_strPrefabPath);
  211. DDX_CBString(pDX, IDC_COMBO_WHATGAME, m_strWhatGame);
  212. DDX_Check(pDX, IDC_CHECK_ALTDRAG, m_bALTEdge);
  213. DDX_Check(pDX, IDC_CHECK_TEXTURETOOLBAR, m_bTextureBar);
  214. DDX_Check(pDX, IDC_CHECK_FACECOLOR, m_bFaceColors);
  215. DDX_Check(pDX, IDC_CHECK_QE4PAINTING, m_bQE4Painting);
  216. DDX_Check(pDX, IDC_CHECK_SNAPT, m_bSnapTToGrid);
  217. DDX_Check(pDX, IDC_CHECK_SIZEPAINT, m_bSizePaint);
  218. DDX_Check(pDX, IDC_CHECK_DLLENTITIES, m_bDLLEntities);
  219. DDX_Check(pDX, IDC_CHECK_WIDETOOLBAR, m_bWideToolbar);
  220. DDX_Check(pDX, IDC_CHECK_NOCLAMP, m_bNoClamp);
  221. DDX_Text(pDX, IDC_EDIT_USERPATH, m_strUserPath);
  222. DDX_Text(pDX, IDC_EDIT_ROTATION, m_nRotation);
  223. DDX_Check(pDX, IDC_CHECK_SGIOPENGL, m_bSGIOpenGL);
  224. DDX_Check(pDX, IDC_CHECK_BUGGYICD, m_bBuggyICD);
  225. DDX_Check(pDX, IDC_CHECK_HICOLOR, m_bHiColorTextures);
  226. DDX_Check(pDX, IDC_CHECK_MOUSECHASE, m_bChaseMouse);
  227. DDX_Check(pDX, IDC_CHECK_TEXTURESCROLLBAR, m_bTextureScrollbar);
  228. DDX_Check(pDX, IDC_CHECK_DISPLAYLISTS, m_bDisplayLists);
  229. DDX_CBIndex(pDX, IDC_COMBO_SHADERS, m_nShader);
  230. DDX_Check(pDX, IDC_CHECK_NOSTIPPLE, m_bNoStipple);
  231. DDX_Text(pDX, IDC_EDIT_UNDOLEVELS, m_nUndoLevels);
  232. DDV_MinMaxInt(pDX, m_nUndoLevels, 1, 64);
  233. //}}AFX_DATA_MAP
  234. }
  235. BEGIN_MESSAGE_MAP(CPrefsDlg, CDialog)
  236. //{{AFX_MSG_MAP(CPrefsDlg)
  237. ON_BN_CLICKED(IDC_BTN_BROWSE, OnBtnBrowse)
  238. ON_BN_CLICKED(IDC_BTN_BROWSEPAK, OnBtnBrowsepak)
  239. ON_BN_CLICKED(IDC_BTN_BROWSEPREFAB, OnBtnBrowseprefab)
  240. ON_BN_CLICKED(IDC_BTN_BROWSEUSERINI, OnBtnBrowseuserini)
  241. ON_CBN_SELCHANGE(IDC_COMBO_WHATGAME, OnSelchangeComboWhatgame)
  242. //}}AFX_MSG_MAP
  243. END_MESSAGE_MAP()
  244. /////////////////////////////////////////////////////////////////////////////
  245. // CPrefsDlg message handlers
  246. void CPrefsDlg::OnBtnBrowse()
  247. {
  248. UpdateData(TRUE);
  249. CFileDialog dlg(true, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Executables (*.exe)|*.exe||", this);
  250. if (dlg.DoModal() == IDOK)
  251. {
  252. m_strQuake2 = dlg.GetPathName();
  253. UpdateData(FALSE);
  254. }
  255. }
  256. BOOL CPrefsDlg::OnInitDialog()
  257. {
  258. CDialog::OnInitDialog();
  259. m_wndSpin.SetRange(1,60);
  260. m_wndCamSpeed.SetRange(10, 800);
  261. m_wndCamSpeed.SetPos(m_nMoveSpeed);
  262. this->m_wndTexturequality.SetRange(0, 3);
  263. this->m_wndTexturequality.SetPos(m_nTextureQuality);
  264. m_wndFontSpin.SetRange(4,24);
  265. m_wndUndoSpin.SetRange(1,64);
  266. m_wndWhatGame.AddString("Quake2");
  267. m_wndWhatGame.AddString("Quake3");
  268. GetDlgItem(IDC_CHECK_HICOLOR)->EnableWindow(TRUE);
  269. GetDlgItem(IDC_CHECK_NOCLAMP)->EnableWindow(TRUE);
  270. //GetDlgItem(IDC_CHECK_NOCLAMP)->EnableWindow(FALSE);
  271. m_wndWhatGame.SelectString(-1,m_strWhatGame);
  272. if (strstr(m_strWhatGame, "Quake3") != NULL)
  273. {
  274. GetDlgItem(IDC_EDIT_PAKFILE)->EnableWindow(FALSE);
  275. GetDlgItem(IDC_BTN_BROWSEPAK)->EnableWindow(FALSE);
  276. GetDlgItem(IDC_CHECK_INTERNALBSP)->EnableWindow(FALSE);
  277. }
  278. else
  279. {
  280. GetDlgItem(IDC_EDIT_PAKFILE)->EnableWindow(TRUE);
  281. GetDlgItem(IDC_BTN_BROWSEPAK)->EnableWindow(TRUE);
  282. GetDlgItem(IDC_CHECK_INTERNALBSP)->EnableWindow(TRUE);
  283. }
  284. return TRUE; // return TRUE unless you set the focus to a control
  285. // EXCEPTION: OCX Property Pages should return FALSE
  286. }
  287. void CPrefsDlg::OnOK()
  288. {
  289. m_nMoveSpeed = m_wndCamSpeed.GetPos();
  290. m_nAngleSpeed = (float)m_nMoveSpeed * 0.50;
  291. this->m_nTextureQuality = m_wndTexturequality.GetPos();
  292. SavePrefs();
  293. if (g_pParentWnd)
  294. g_pParentWnd->SetGridStatus();
  295. Sys_UpdateWindows(W_ALL);
  296. Undo_SetMaxSize(m_nUndoLevels);
  297. CDialog::OnOK();
  298. }
  299. void CPrefsDlg::LoadPrefs()
  300. {
  301. CString strBuff;
  302. CString strPrefab = g_strAppPath;
  303. AddSlash(strPrefab);
  304. strPrefab += "Prefabs\\";
  305. m_nMouse = AfxGetApp()->GetProfileInt(PREF_SECTION, MOUSE_KEY, MOUSE_DEF);
  306. if (m_nMouse == 0)
  307. m_nMouseButtons = 2;
  308. else
  309. m_nMouseButtons = 3;
  310. m_nView = AfxGetApp()->GetProfileInt(PREF_SECTION, WINDOW_KEY, WINDOW_DEF);
  311. m_strQuake2 = AfxGetApp()->GetProfileString(PREF_SECTION, Q2_KEY, Q2_DEF);
  312. m_bRunQuake = AfxGetApp()->GetProfileInt(PREF_SECTION, RUNQ2_KEY, RUNQ2_DEF);
  313. m_bTextureLock = AfxGetApp()->GetProfileInt(PREF_SECTION, TLOCK_KEY, TLOCK_DEF);
  314. m_bRotateLock = AfxGetApp()->GetProfileInt(PREF_SECTION, RLOCK_KEY, TLOCK_DEF);
  315. m_strLastProject = AfxGetApp()->GetProfileString(PREF_SECTION, LASTPROJ_KEY, "");
  316. m_strLastMap = AfxGetApp()->GetProfileString(PREF_SECTION, LASTMAP_KEY, "");
  317. m_bLoadLast = AfxGetApp()->GetProfileInt(PREF_SECTION, LOADLAST_KEY, LOADLAST_DEF);
  318. m_bRunBefore = AfxGetApp()->GetProfileInt(INTERNAL_SECTION, RUN_KEY, RUN_DEF);
  319. //m_b3Dfx = AfxGetApp()->GetProfileInt(PREF_SECTION, _3DFX_KEY, 0);
  320. m_bFace = AfxGetApp()->GetProfileInt(PREF_SECTION, FACE_KEY, 1);
  321. m_bInternalBSP = AfxGetApp()->GetProfileInt(PREF_SECTION, BSP_KEY, 0);
  322. m_bRightClick = AfxGetApp()->GetProfileInt(PREF_SECTION, RCLICK_KEY, 1);
  323. m_bVertex = AfxGetApp()->GetProfileInt(PREF_SECTION, VERTEX_KEY, 1);
  324. m_bAutoSave = AfxGetApp()->GetProfileInt(PREF_SECTION, AUTOSAVE_KEY, 1);
  325. m_bPAK = AfxGetApp()->GetProfileInt(PREF_SECTION, PAK_KEY, 1);
  326. m_bNewApplyHandling = AfxGetApp()->GetProfileInt(PREF_SECTION, NEWAPPLY_KEY, 0);
  327. m_bLoadLastMap = AfxGetApp()->GetProfileInt(PREF_SECTION, LOADLASTMAP_KEY, 0);
  328. m_bGatewayHack = AfxGetApp()->GetProfileInt(PREF_SECTION, HACK_KEY, 0);
  329. m_bTextureWindow = AfxGetApp()->GetProfileInt(PREF_SECTION, TEXTURE_KEY, 0);
  330. m_bCleanTiny = AfxGetApp()->GetProfileInt(PREF_SECTION, TINYBRUSH_KEY, 0);
  331. strBuff = AfxGetApp()->GetProfileString(PREF_SECTION, TINYSIZE_KEY, "0.5");
  332. m_fTinySize = atof(strBuff);
  333. m_nAutoSave = AfxGetApp()->GetProfileInt(PREF_SECTION, AUTOSAVETIME_KEY, 5);
  334. m_strAutoSave.Format("%i", m_nAutoSave);
  335. m_bSnapShots = AfxGetApp()->GetProfileInt(PREF_SECTION, SNAPSHOT_KEY, 0);
  336. m_strPAKFile = AfxGetApp()->GetProfileString(PREF_SECTION, PAKFILE_KEY, PAKFILE_DEF);
  337. m_nStatusSize = AfxGetApp()->GetProfileInt(PREF_SECTION, STATUS_KEY, 10);
  338. m_nMoveSpeed = AfxGetApp()->GetProfileInt(PREF_SECTION, MOVESPEED_KEY, 400);
  339. m_nAngleSpeed = AfxGetApp()->GetProfileInt(PREF_SECTION, ANGLESPEED_KEY, 300);
  340. m_bSetGame = AfxGetApp()->GetProfileInt(PREF_SECTION, SETGAME_KEY, 0);
  341. m_bCamXYUpdate = AfxGetApp()->GetProfileInt(PREF_SECTION, CAMXYUPDATE_KEY, 1);
  342. m_bNewLightDraw = AfxGetApp()->GetProfileInt(PREF_SECTION, LIGHTDRAW_KEY, 1);
  343. m_bCubicClipping = AfxGetApp()->GetProfileInt(PREF_SECTION, CUBICCLIP_KEY, 1);
  344. m_nCubicScale = AfxGetApp()->GetProfileInt(PREF_SECTION, CUBICSCALE_KEY, 13);
  345. m_bALTEdge = AfxGetApp()->GetProfileInt(PREF_SECTION, ALTEDGE_KEY, 0);
  346. m_bTextureBar = AfxGetApp()->GetProfileInt(PREF_SECTION, TEXTUREBAR_KEY, 0);
  347. m_strWhatGame = AfxGetApp()->GetProfileString(PREF_SECTION, WHATGAME_KEY, "Quake3");
  348. m_bFaceColors = AfxGetApp()->GetProfileInt(PREF_SECTION, FACECOLORS_KEY, 0);
  349. m_bQE4Painting = AfxGetApp()->GetProfileInt(PREF_SECTION, QE4PAINT_KEY, 1);
  350. m_bSnapTToGrid = AfxGetApp()->GetProfileInt(PREF_SECTION, SNAPT_KEY, 0);
  351. m_bXZVis = AfxGetApp()->GetProfileInt(PREF_SECTION, XZVIS_KEY, 0);
  352. m_bYZVis = AfxGetApp()->GetProfileInt(PREF_SECTION, YZVIS_KEY, 0);
  353. m_bZVis = AfxGetApp()->GetProfileInt(PREF_SECTION, ZVIS_KEY, 1);
  354. m_bSizePaint = AfxGetApp()->GetProfileInt(PREF_SECTION, SIZEPAINT_KEY, 0);
  355. m_bDLLEntities = AfxGetApp()->GetProfileInt(PREF_SECTION, DLLENTITIES_KEY, 0);
  356. m_bWideToolbar = AfxGetApp()->GetProfileInt(PREF_SECTION, WIDETOOLBAR_KEY, 1);
  357. m_bNoClamp = AfxGetApp()->GetProfileInt(PREF_SECTION, NOCLAMP_KEY, 0);
  358. m_strPrefabPath = AfxGetApp()->GetProfileString(PREF_SECTION, PREFAB_KEY, strPrefab);
  359. m_strUserPath = AfxGetApp()->GetProfileString(PREF_SECTION, USERINI_KEY, "");
  360. m_nRotation = AfxGetApp()->GetProfileInt(PREF_SECTION, ROTATION_KEY, 45);
  361. m_bSGIOpenGL = AfxGetApp()->GetProfileInt(PREF_SECTION, SGIOPENGL_KEY, 0);
  362. m_bBuggyICD = AfxGetApp()->GetProfileInt(PREF_SECTION, BUGGYICD_KEY, 0);
  363. m_bHiColorTextures = AfxGetApp()->GetProfileInt(PREF_SECTION, HICOLOR_KEY, 1);
  364. m_bChaseMouse = AfxGetApp()->GetProfileInt(PREF_SECTION, CHASEMOUSE_KEY, 1);
  365. m_nEntityShowState = AfxGetApp()->GetProfileInt(PREF_SECTION, ENTITYSHOW_KEY, 0);
  366. m_nTextureScale = AfxGetApp()->GetProfileInt(PREF_SECTION, TEXTURESCALE_KEY, 50);
  367. m_bTextureScrollbar = AfxGetApp()->GetProfileInt(PREF_SECTION, TEXTURESCROLLBAR_KEY, TRUE);
  368. m_bDisplayLists = AfxGetApp()->GetProfileInt(PREF_SECTION, DISPLAYLISTS_KEY, TRUE);
  369. m_bSwitchClip = AfxGetApp()->GetProfileInt(PREF_SECTION, SWITCHCLIP_KEY, TRUE);
  370. m_bSelectWholeEntities = AfxGetApp()->GetProfileInt(PREF_SECTION, SELWHOLEENTS_KEY, TRUE);
  371. m_nTextureQuality = AfxGetApp()->GetProfileInt(PREF_SECTION, TEXTUREQUALITY_KEY, 6);
  372. m_bShowShaders = AfxGetApp()->GetProfileInt(PREF_SECTION, SHOWSHADERS_KEY, TRUE);
  373. m_bGLLighting = AfxGetApp()->GetProfileInt(PREF_SECTION, GLLIGHTING_KEY, FALSE);
  374. m_nShader = AfxGetApp()->GetProfileInt(PREF_SECTION, LOADSHADERS_KEY, 0);
  375. m_bNoStipple = AfxGetApp()->GetProfileInt(PREF_SECTION, NOSTIPPLE_KEY, 0);
  376. m_nUndoLevels = AfxGetApp()->GetProfileInt(PREF_SECTION, UNDOLEVELS_KEY, 0);
  377. if (m_bRunBefore == FALSE)
  378. {
  379. SetGamePrefs();
  380. }
  381. }
  382. void CPrefsDlg::SavePrefs()
  383. {
  384. if (GetSafeHwnd())
  385. UpdateData(TRUE);
  386. AfxGetApp()->WriteProfileInt(PREF_SECTION, MOUSE_KEY, m_nMouse);
  387. if (m_nMouse == 0)
  388. m_nMouseButtons = 2;
  389. else
  390. m_nMouseButtons = 3;
  391. AfxGetApp()->WriteProfileInt(PREF_SECTION, WINDOW_KEY, m_nView);
  392. AfxGetApp()->WriteProfileString(PREF_SECTION, Q2_KEY, m_strQuake2);
  393. AfxGetApp()->WriteProfileInt(PREF_SECTION, RUNQ2_KEY, m_bRunQuake);
  394. AfxGetApp()->WriteProfileInt(PREF_SECTION, TLOCK_KEY, m_bTextureLock);
  395. AfxGetApp()->WriteProfileInt(PREF_SECTION, RLOCK_KEY, m_bRotateLock);
  396. AfxGetApp()->WriteProfileInt(PREF_SECTION, LOADLAST_KEY, m_bLoadLast);
  397. AfxGetApp()->WriteProfileString(PREF_SECTION, LASTPROJ_KEY, m_strLastProject);
  398. AfxGetApp()->WriteProfileString(PREF_SECTION, LASTMAP_KEY, m_strLastMap);
  399. AfxGetApp()->WriteProfileInt(INTERNAL_SECTION, RUN_KEY, m_bRunBefore);
  400. //AfxGetApp()->WriteProfileInt(PREF_SECTION, _3DFX_KEY, m_b3Dfx);
  401. AfxGetApp()->WriteProfileInt(PREF_SECTION, FACE_KEY, m_bFace);
  402. AfxGetApp()->WriteProfileInt(PREF_SECTION, BSP_KEY, m_bInternalBSP);
  403. AfxGetApp()->WriteProfileInt(PREF_SECTION, RCLICK_KEY, m_bRightClick);
  404. AfxGetApp()->WriteProfileInt(PREF_SECTION, VERTEX_KEY, m_bVertex);
  405. AfxGetApp()->WriteProfileInt(PREF_SECTION, AUTOSAVE_KEY, m_bAutoSave);
  406. AfxGetApp()->WriteProfileInt(PREF_SECTION, PAK_KEY, m_bPAK);
  407. AfxGetApp()->WriteProfileInt(PREF_SECTION, LOADLASTMAP_KEY, m_bLoadLastMap);
  408. AfxGetApp()->WriteProfileInt(PREF_SECTION, TEXTURE_KEY, m_bTextureWindow);
  409. m_nAutoSave = atoi(m_strAutoSave);
  410. AfxGetApp()->WriteProfileInt(PREF_SECTION, AUTOSAVETIME_KEY, m_nAutoSave);
  411. AfxGetApp()->WriteProfileInt(PREF_SECTION, SNAPSHOT_KEY, m_bSnapShots);
  412. AfxGetApp()->WriteProfileString(PREF_SECTION, PAKFILE_KEY, m_strPAKFile);
  413. AfxGetApp()->WriteProfileInt(PREF_SECTION, STATUS_KEY, m_nStatusSize);
  414. AfxGetApp()->WriteProfileInt(PREF_SECTION, SETGAME_KEY, m_bSetGame);
  415. AfxGetApp()->WriteProfileInt(PREF_SECTION, CAMXYUPDATE_KEY, m_bCamXYUpdate);
  416. AfxGetApp()->WriteProfileInt(PREF_SECTION, LIGHTDRAW_KEY, m_bNewLightDraw);
  417. AfxGetApp()->WriteProfileInt(PREF_SECTION, MOVESPEED_KEY, m_nMoveSpeed);
  418. AfxGetApp()->WriteProfileInt(PREF_SECTION, ANGLESPEED_KEY, m_nAngleSpeed);
  419. AfxGetApp()->WriteProfileInt(PREF_SECTION, CUBICCLIP_KEY, m_bCubicClipping);
  420. AfxGetApp()->WriteProfileInt(PREF_SECTION, CUBICSCALE_KEY, m_nCubicScale);
  421. AfxGetApp()->WriteProfileInt(PREF_SECTION, ALTEDGE_KEY, m_bALTEdge);
  422. AfxGetApp()->WriteProfileInt(PREF_SECTION, TEXTUREBAR_KEY, m_bTextureBar);
  423. AfxGetApp()->WriteProfileInt(PREF_SECTION, FACECOLORS_KEY, m_bFaceColors);
  424. AfxGetApp()->WriteProfileString(PREF_SECTION, WHATGAME_KEY, m_strWhatGame);
  425. AfxGetApp()->WriteProfileInt(PREF_SECTION, QE4PAINT_KEY, m_bQE4Painting);
  426. AfxGetApp()->WriteProfileInt(PREF_SECTION, SNAPT_KEY, m_bSnapTToGrid);
  427. AfxGetApp()->WriteProfileInt(PREF_SECTION, XZVIS_KEY, m_bXZVis);
  428. AfxGetApp()->WriteProfileInt(PREF_SECTION, YZVIS_KEY, m_bYZVis);
  429. AfxGetApp()->WriteProfileInt(PREF_SECTION, ZVIS_KEY, m_bZVis);
  430. AfxGetApp()->WriteProfileInt(PREF_SECTION, SIZEPAINT_KEY, m_bSizePaint);
  431. AfxGetApp()->WriteProfileInt(PREF_SECTION, DLLENTITIES_KEY, m_bDLLEntities);
  432. AfxGetApp()->WriteProfileInt(PREF_SECTION, WIDETOOLBAR_KEY, m_bWideToolbar);
  433. AfxGetApp()->WriteProfileInt(PREF_SECTION, NOCLAMP_KEY, m_bNoClamp);
  434. AfxGetApp()->WriteProfileString(PREF_SECTION, PREFAB_KEY, m_strPrefabPath);
  435. AfxGetApp()->WriteProfileString(PREF_SECTION, USERINI_KEY, m_strUserPath);
  436. AfxGetApp()->WriteProfileInt(PREF_SECTION, ROTATION_KEY, m_nRotation);
  437. AfxGetApp()->WriteProfileInt(PREF_SECTION, SGIOPENGL_KEY, m_bSGIOpenGL);
  438. AfxGetApp()->WriteProfileInt(PREF_SECTION, BUGGYICD_KEY, m_bBuggyICD);
  439. AfxGetApp()->WriteProfileInt(PREF_SECTION, HICOLOR_KEY, m_bHiColorTextures);
  440. AfxGetApp()->WriteProfileInt(PREF_SECTION, CHASEMOUSE_KEY, m_bChaseMouse);
  441. AfxGetApp()->WriteProfileInt(PREF_SECTION, ENTITYSHOW_KEY, m_nEntityShowState);
  442. AfxGetApp()->WriteProfileInt(PREF_SECTION, TEXTURESCALE_KEY, m_nTextureScale);
  443. AfxGetApp()->WriteProfileInt(PREF_SECTION, TEXTURESCROLLBAR_KEY, m_bTextureScrollbar);
  444. AfxGetApp()->WriteProfileInt(PREF_SECTION, DISPLAYLISTS_KEY, m_bDisplayLists);
  445. AfxGetApp()->WriteProfileInt(PREF_SECTION, SWITCHCLIP_KEY, m_bSwitchClip);
  446. AfxGetApp()->WriteProfileInt(PREF_SECTION, SELWHOLEENTS_KEY, m_bSelectWholeEntities);
  447. AfxGetApp()->WriteProfileInt(PREF_SECTION, TEXTUREQUALITY_KEY, m_nTextureQuality);
  448. AfxGetApp()->WriteProfileInt(PREF_SECTION, SHOWSHADERS_KEY, m_bShowShaders);
  449. AfxGetApp()->WriteProfileInt(PREF_SECTION, GLLIGHTING_KEY, m_bGLLighting);
  450. AfxGetApp()->WriteProfileInt(PREF_SECTION, LOADSHADERS_KEY, m_nShader);
  451. AfxGetApp()->WriteProfileInt(PREF_SECTION, NOSTIPPLE_KEY, m_bNoStipple);
  452. AfxGetApp()->WriteProfileInt(PREF_SECTION, UNDOLEVELS_KEY, m_nUndoLevels);
  453. }
  454. void CPrefsDlg::OnBtnBrowsepak()
  455. {
  456. UpdateData(TRUE);
  457. CFileDialog dlg(true, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "PAK files (*.pak)|*.pak||", this);
  458. if (dlg.DoModal() == IDOK)
  459. {
  460. m_strPAKFile = dlg.GetPathName();
  461. UpdateData(FALSE);
  462. }
  463. }
  464. void CPrefsDlg::OnBtnBrowseprefab()
  465. {
  466. UpdateData(TRUE);
  467. BROWSEINFO bi;
  468. CString strPath;
  469. char* p = strPath.GetBuffer(MAX_PATH+1);
  470. bi.hwndOwner = GetSafeHwnd();
  471. bi.pidlRoot = NULL;
  472. bi.pszDisplayName = p;
  473. bi.lpszTitle = "Load textures from path";
  474. bi.ulFlags = 0;
  475. bi.lpfn = NULL;
  476. bi.lParam = NULL;
  477. bi.iImage = 0;
  478. LPITEMIDLIST pidlBrowse;
  479. pidlBrowse = SHBrowseForFolder(&bi);
  480. if (pidlBrowse)
  481. {
  482. SHGetPathFromIDList(pidlBrowse, p);
  483. strPath.ReleaseBuffer();
  484. AddSlash(strPath);
  485. m_strPrefabPath = strPath;
  486. UpdateData(FALSE);
  487. }
  488. }
  489. void CPrefsDlg::OnBtnBrowseuserini()
  490. {
  491. UpdateData(TRUE);
  492. CFileDialog dlg(true, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "INI files (*.ini)|*.ini||", this);
  493. if (dlg.DoModal() == IDOK)
  494. {
  495. m_strUserPath = dlg.GetPathName();
  496. UpdateData(FALSE);
  497. }
  498. }
  499. void CPrefsDlg::OnSelchangeComboWhatgame()
  500. {
  501. int n = m_wndWhatGame.GetCurSel();
  502. if (n >= 0)
  503. {
  504. m_wndWhatGame.GetLBText(n, m_strWhatGame);
  505. }
  506. SetGamePrefs();
  507. }
  508. void CPrefsDlg::SetGamePrefs()
  509. {
  510. if (strstr(m_strWhatGame, "Quake3") != NULL)
  511. {
  512. m_bHiColorTextures = TRUE;
  513. m_bWideToolbar = TRUE;
  514. m_strPAKFile = "PK3 files are loaded from the baseq3 path";
  515. m_bInternalBSP = FALSE;
  516. if (GetSafeHwnd())
  517. {
  518. GetDlgItem(IDC_EDIT_PAKFILE)->EnableWindow(FALSE);
  519. GetDlgItem(IDC_BTN_BROWSEPAK)->EnableWindow(FALSE);
  520. GetDlgItem(IDC_CHECK_INTERNALBSP)->EnableWindow(FALSE);
  521. }
  522. }
  523. else
  524. {
  525. m_bHiColorTextures = FALSE;
  526. m_bWideToolbar = FALSE;
  527. m_strPAKFile = PAKFILE_DEF;
  528. if (GetSafeHwnd())
  529. {
  530. GetDlgItem(IDC_EDIT_PAKFILE)->EnableWindow(TRUE);
  531. GetDlgItem(IDC_BTN_BROWSEPAK)->EnableWindow(TRUE);
  532. GetDlgItem(IDC_CHECK_INTERNALBSP)->EnableWindow(TRUE);
  533. }
  534. }
  535. SavePrefs();
  536. }