2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 // Leonardo Zide (leo@lokigames.com)
30 #include <glib/gi18n.h>
32 #if defined (__linux__) || defined (__APPLE__)
34 #include <sys/types.h>
48 #define PREF_SECTION "Prefs"
49 #define INTERNAL_SECTION "Internals"
50 #define MOUSE_KEY "MouseButtons"
51 #define WINDOW_KEY "QE4StyleWindows"
52 #define LAYOUT_KEY "WindowLayout"
53 #define RUNQ2_KEY "RunQuake2Run"
54 #define TLOCK_KEY "TextureLock"
55 #define RLOCK_KEY "RotateLock"
56 #define LOADLAST_KEY "LoadLast"
57 #define LOADLASTMAP_KEY "LoadLastMap"
58 #define LASTPROJ_KEY "LastProject"
59 #define LASTPROJVER_KEY "LastProjectKey"
60 #define LASTMAP_KEY "LastMap"
61 #define FACE_KEY "NewFaceGrab"
62 #define BSP_KEY "InternalBSP"
63 #define RCLICK_KEY "NewRightClick"
64 #define VERTEX_KEY "NewVertex"
65 #define AUTOSAVE_KEY "Autosave"
66 #define AUTOSAVETIME_KEY "AutosaveMinutes"
67 #define PAK_KEY "UsePAK"
68 #define NEWAPPLY_KEY "ApplyDismissesSurface"
69 #define HACK_KEY "Gatewayescapehack"
70 #define TEXTURE_KEY "NewTextureWindowStuff"
71 #define TINYBRUSH_KEY "CleanTinyBrushes"
72 #define TINYSIZE_KEY "CleanTinyBrusheSize"
73 #define SNAPSHOT_KEY "Snapshots"
74 #define MOVESPEED_KEY "MoveSpeed"
75 #define ANGLESPEED_KEY "AngleSpeed"
76 #define SETGAME_KEY "UseSetGame"
77 #define CAMXYUPDATE_KEY "CamXYUpdate"
78 #define CAMDRAGMULTISELECT_KEY "CamDragMultiSelect"
79 #define CAMFREELOOK_KEY "CamFreeLook"
80 #define CAMINVERSEMOUSE_KEY "CamInverseMouse"
81 #define CAMDISCRETE_KEY "CamDiscrete"
82 #define LIGHTDRAW_KEY "NewLightStyle"
83 #define WHATGAME_KEY "WhichGame"
84 #define CUBICCLIP_KEY "CubicClipping"
85 #define CUBICSCALE_KEY "CubicScale"
86 #define ALTEDGE_KEY "ALTEdgeDrag"
87 #define FACECOLORS_KEY "FaceColors"
88 #define SNAPT_KEY "SnapT"
89 #define XZVIS_KEY "XZVIS"
90 #define YZVIS_KEY "YZVIS"
91 #define ZVIS_KEY "ZVIS"
92 #define SIZEPAINT_KEY "SizePainting"
93 #define DLLENTITIES_KEY "DLLEntities"
94 #define DETACHABLEMENUS_KEY "DetachableMenus"
95 #define PATCHTOOLBAR_KEY "PatchToolBar"
96 #define WIDETOOLBAR_KEY "WideToolBar"
97 #define PLUGINTOOLBAR_KEY "PluginToolBar"
98 #define NOCLAMP_KEY "NoClamp"
99 #define PREFAB_KEY "PrefabPath"
100 #define USERINI_KEY "UserINIPath"
101 #define ROTATION_KEY "Rotation"
102 #define BUGGYICD_KEY "BuggyICD"
103 #define CHASEMOUSE_KEY "ChaseMouse"
104 #define ENTITYSHOW_KEY "EntityShow"
105 #define TEXTURESCALE_KEY "TextureScale"
106 #define TEXTURESCROLLBAR_KEY "TextureScrollbar"
107 #define DISPLAYLISTS_KEY "UseDisplayLists"
108 #define ANTIALIASEDLINES_KEY "UseAntialiasedPointsAndLines" // Fishman - Add antialiazed points and lines support. 09/03/00
109 #define NORMALIZECOLORS_KEY "NormalizeColors"
110 #define SHADERS_KEY "UseShaders"
111 #define SWITCHCLIP_KEY "SwitchClipKey"
112 #define SELWHOLEENTS_KEY "SelectWholeEntitiesKey"
113 #define TEXTURESUBSET_KEY "UseTextureSubsetLoading"
114 #define TEXTUREQUALITY_KEY "TextureQuality"
115 #define SHOWSHADERS_KEY "ShowShaders"
116 #define SHADERTEST_KEY "ShaderTest"
117 #define GLLIGHTING_KEY "UseGLLighting"
118 #define LOADSHADERS_KEY "LoadShaders"
119 #define NOSTIPPLE_KEY "NoStipple"
120 #define UNDOLEVELS_KEY "UndoLevels"
121 #define VERTEXMODE_KEY "VertexSplit"
122 #define ENGINEPATH_KEY "EnginePath"
123 #define ENGINE_KEY "Engine"
124 #define LOGCONSOLE_KEY "LogConsole"
125 #define SELECTCURVES_KEY "SelectCurves"
126 #define SELECTMODELS_KEY "SelectModels"
127 #define SHADERLISTONLY_KEY "ShowShaderlistOnly"
128 #define WATCHBSP_KEY "WatchBSP"
129 #define LEAKSTOP_KEY "LeakStop"
130 #define DOSLEEP_KEY "SleepMode"
131 #define SUBDIVISIONS_KEY "Subdivisions"
132 #define CLIPCAULK_KEY "ClipCaulk"
133 #define PATCHSHOWBOUNDS_KEY "PatchShowBounds"
134 #define NATIVEGUI_KEY "NativeGUI"
135 #define STARTONPRIMMON_KEY "StartOnPrimMon"
136 #define NOSYSMENUPOPUPS_KEY "NoSysMenuPopups"
137 #define SNAPTTOGRID_KEY "SnapTToGrid"
138 #define FLOATINGZ_KEY "FloatingZ"
139 #define TARGETFIX_KEY "TargetFix"
140 #define GLPOINTWORKAROUND_KEY "GlPointWorkaround" // Gef: Workaround for broken Kyro * gl driver 25-aug-2001
141 #define WHEELINC_KEY "WheelMouseInc"
142 #define PATCHBBOXSEL_KEY "PatchBBoxSel"
143 #define LASTLIGHTINTENSITY_KEY "LastLightIntensity"
144 #define CUSTOMSHADEREDITOR_KEY "UseCustomShaderEditor"
145 #define CUSTOMSHADEREDITORCOMMAND_KEY "CustomShaderEditorCommand"
146 #define TEXTURECOMPRESSIONFORMAT_KEY "TextureCompressionFormat"
147 #define LIGHTRADIUS_KEY "LightRadiuses"
148 #define Q3MAP2TEX_KEY "Q3Map2Tex"
149 #define ATIHACK_KEY "ATIHack"
152 #define ENTITYSPLIT1_KEY "EntitySplit1"
153 #define ENTITYSPLIT2_KEY "EntitySplit2"
154 #define POSITIONX_KEY "PositionX"
155 #define POSITIONY_KEY "PositionY"
156 #define ENTITYWND_KEY "EntityWnd"
157 #define MAPINFOWND_KEY "MapInfoDlg"
158 #define CAMWND_KEY "CamWnd"
159 #define ZWND_KEY "ZWnd"
160 #define XYWND_KEY "XYWnd"
161 #define XZWND_KEY "XZWnd"
162 #define YZWND_KEY "YZWnd"
163 #define PATCHWND_KEY "PatchWnd"
164 #define SURFACEWND_KEY "SurfaceWnd"
165 #define ENTITYINFOWND_KEY "EntityInfoDlg"
166 #define WIDTH_KEY "Width"
167 #define HEIGHT_KEY "Height"
168 #define ZWIDTH_KEY "ZWidth"
169 #define XYHEIGHT_KEY "XYHeight"
170 #define XYWIDTH_KEY "XYWidth"
171 #define CAMWIDTH_KEY "CamWidth"
172 #define CAMHEIGHT_KEY "CamHeight"
173 #define ZFLOATWIDTH_KEY "ZWidthFloating"
174 #define STATE_KEY "State"
177 #define COUNT_KEY "Count"
178 #define FILE_KEY "File"
181 #define SI_TEXMENU_KEY "SI_TexMenu"
182 #define SI_GAMMA_KEY "SI_Gamma"
183 #define SI_COLORS_KEY "SI_Colors"
184 #define SI_EXCLUDE_KEY "SI_Exclude"
185 #define SI_INCLUDE_KEY "SI_Include"
186 #define SI_SURFACE_TEXDEF_KEY "SI_SurfaceTexdef"
187 #define SI_PATCH_TEXDEF_KEY "SI_PatchTexdef"
188 #define SI_AXISCOLORS_KEY "SI_AxisColors"
189 #define SI_SHOWNAMES_KEY "SI_ShowNames"
190 #define SI_SHOWCOORDS_KEY "SI_ShowCoords"
191 #define SI_SHOWANGLES_KEY "SI_ShowAngles"
192 #define SI_SHOWOUTLINES_KEY "SI_ShowOutlines"
193 #define SI_SHOWAXIS_KEY "SI_ShowAxis"
194 #define SI_NOSELOUTLINES_KEY "SI_NoSelectedOutlines"
195 #define SI_OUTLINESTYLE_KEY "SI_OutLineStyle"
198 #define TD_SCALE1_KEY "_Scale1"
199 #define TD_SCALE2_KEY "_Scale2"
200 #define TD_SHIFT1_KEY "_Shift1"
201 #define TD_SHIFT2_KEY "_Shift2"
202 #define TD_ROTATE_KEY "_Rotate"
207 #define WATCHBSP_DEF 1
209 #define LOADLAST_DEF 1
211 #define SUBDIVISIONS_DEF 4
213 void WindowPosition_Parse(window_position_t& m_value, const CString& value)
215 if(sscanf(value.GetBuffer(), "%d %d %d %d", &m_value.x, &m_value.y, &m_value.w, &m_value.h) != 4)
216 m_value.x = m_value.y = m_value.w = m_value.h = -1;
219 void WindowPosition_Write(const window_position_t& m_value, CString& value)
222 sprintf(buffer, "%d %d %d %d", m_value.x, m_value.y, m_value.w, m_value.h);
227 CXMLPropertyBag::CXMLPropertyBag() {
233 // generic preference functions
235 void CXMLPropertyBag::PushAssignment(const char *name, PrefTypes_t type, void *pV)
237 list<CPrefAssignment>::iterator iAssign;
238 for(iAssign=mPrefAssignments.begin(); iAssign!=mPrefAssignments.end(); iAssign++)
240 if ((*iAssign).mName == name)
242 // we have it already, check anyway
243 if (pV != (*iAssign).mVal)
245 Sys_FPrintf(SYS_ERR, "PushAssignment, '%s' has different mVal\n", name);
250 // ok, it's not in our list yet
251 mPrefAssignments.push_front(CPrefAssignment(name, type, pV));
254 xmlNodePtr CXMLPropertyBag::EpairForName(const char *name)
256 xmlNodePtr ret = NULL;
258 xmlNodePtr pNode = mpDocNode->children;
259 while (pNode != NULL)
261 if(pNode->type == XML_ELEMENT_NODE)
263 xmlAttrPtr tmp_attr_ptr = xmlHasProp(pNode, (xmlChar *)"name");
264 if (tmp_attr_ptr != NULL && !strcmp(name, (char *)tmp_attr_ptr->children->content))
267 Sys_FPrintf( SYS_WRN, "WARNING: dupe property in CXMLPropertyBag::EpairForName '%s'\n", name );
278 void CXMLPropertyBag::GetPref(const char *name, Str *pV, const char *V)
280 xmlNodePtr pNode = EpairForName( name );
283 if ( pNode->children && pNode->children->content ) {
284 *pV = pNode->children->content;
286 // means the pref exists, and that the value is ""
292 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)V);
293 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
295 // push the pref assignment if needed
296 PushAssignment(name, PREF_STR, pV);
299 void CXMLPropertyBag::GetPref(const char *name, int *pV, int V)
302 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
304 *pV = atoi((char *)pNode->children->content);
310 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s);
311 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
314 // push the pref assignment if needed
315 PushAssignment(name, PREF_INT, pV);
318 void CXMLPropertyBag::GetPref(const char *name, bool *pV, bool V)
321 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
323 if (!strcmp((char *)pNode->children->content, "true"))
335 V ? strcpy(s, "true") : strcpy(s, "false");
336 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s);
337 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
340 // push the pref assignment
341 PushAssignment(name, PREF_BOOL, pV);
344 void CXMLPropertyBag::GetPref(const char *name, float *pV, float V)
347 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
349 *pV = atof((char *)pNode->children->content);
355 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s);
356 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
359 // push the pref assignment if needed
360 PushAssignment(name, PREF_FLOAT, pV);
363 void CXMLPropertyBag::GetPref(const char *name, float* pV, float* V)
366 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
368 sscanf((char *)pNode->children->content, "%f %f %f", &pV[0], &pV[1], &pV[2]);
373 sprintf(s, "%f %f %f", V[0], V[1], V[2]);
374 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)s);
375 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
380 // push the pref assignment if needed
381 PushAssignment(name, PREF_VEC3, pV);
384 void CXMLPropertyBag::GetPref(const char *name, window_position_t* pV, window_position_t V)
387 if ((pNode = EpairForName(name)) && pNode->children && pNode->children->content)
389 WindowPosition_Parse(*pV, CString((xmlChar *)pNode->children->content));
394 WindowPosition_Write(V, str);
395 pNode = xmlNewChild(mpDocNode, NULL, (xmlChar *)"epair", (xmlChar *)str.GetBuffer());
396 xmlSetProp(pNode, (xmlChar *)"name", (xmlChar *)name);
399 // push the pref assignment if needed
400 PushAssignment(name, PREF_WNDPOS, pV);
403 void CXMLPropertyBag::UpdatePrefTree()
405 // read the assignments and update the tree
406 list<CPrefAssignment>::iterator iPref;
407 for(iPref = mPrefAssignments.begin(); iPref != mPrefAssignments.end(); iPref++)
409 CPrefAssignment *pPref = &(*iPref);
414 pNode = EpairForName(pPref->mName.GetBuffer());
415 // we never expect that the node could not be found, because this is supposed to happen
416 // after the tree was built with GetPref calls, never on a blank tree
419 Sys_FPrintf(SYS_ERR, "Unexpected EpairForName '%s' not found in UpdatePrefTree\n", pPref->mName.GetBuffer());
422 switch ((*iPref).mType)
425 xmlNodeSetContent(pNode, (const xmlChar *)((Str *)pPref->mVal)->GetBuffer());
428 sprintf(s, "%d", *(int *)pPref->mVal);
429 xmlNodeSetContent(pNode, (xmlChar *)s);
432 sprintf(s, "%f", *(float *)pPref->mVal);
433 xmlNodeSetContent(pNode, (xmlChar *)s);
436 *(bool *)pPref->mVal ? strcpy(s, "true") : strcpy(s, "false");
437 xmlNodeSetContent(pNode, (xmlChar *)s);
441 float* v = (float*)pPref->mVal;
442 sprintf(s, "%f %f %f", v[0], v[1], v[2]);
443 xmlNodeSetContent(pNode, (xmlChar *)s);
449 WindowPosition_Write(*(window_position_t*)pPref->mVal, str);
450 xmlNodeSetContent(pNode, (xmlChar*)str.GetBuffer());
457 void CXMLPropertyBag::Clear()
468 void CXMLPropertyBag::ReadXMLFile(const char* pFilename)
470 mpDoc = xmlParseFile(pFilename);
475 mpDocNode = mpDoc->children;
476 xmlAttrPtr tmp_attr_ptr = xmlHasProp(mpDocNode, (xmlChar *)"version");
477 if (strcmp((char *)mpDocNode->name, "qpref"))
479 Sys_FPrintf(SYS_ERR, "Unrecognized node '%s' in '%s'\n", mpDocNode->name, mpDoc->URL);
483 else if (tmp_attr_ptr != NULL && strcmp((char*)tmp_attr_ptr->children->content, "1"))
485 Sys_FPrintf(SYS_ERR, "Wrong version '%s' in <qpref> node for '%s'\n", (char*)tmp_attr_ptr->children->content, mpDoc->URL);
489 Sys_Printf("Opened XML property file: '%s'\n", pFilename);
495 // no document, create one
496 mpDoc = xmlNewDoc((xmlChar *)"1.0");
497 mpDocNode = xmlNewDocNode(mpDoc, NULL, (xmlChar *)"qpref", NULL);
498 xmlDocSetRootElement(mpDoc, mpDocNode);
499 xmlSetProp(mpDocNode, (xmlChar *)"version", (xmlChar *)"1");
500 Sys_Printf("XML property file '%s' invalid/not found, creating blank properties tree\n", pFilename);
504 qboolean CXMLPropertyBag::WriteXMLFile(const char* pFilename)
506 int res = xmlSaveFormatFile(pFilename, mpDoc, 1);
511 Sys_Printf("Wrote XML property file '%s'\n", pFilename);
515 // =============================================================================
516 // Widget callbacks for PrefsDlg
519 // browse for custom editor executable
520 static void OnBtnBrowseEditor (GtkWidget *widget, gpointer data)
522 PrefsDlg *dlg = (PrefsDlg*)data;
524 const char *filename = file_dialog(g_PrefsDlg.GetWidget(), TRUE, _("Executable for Custom Editor"));
528 dlg->m_strEditorCommand = filename;
529 dlg->UpdateData(FALSE);
534 static void OnBtnBrowseprefab (GtkWidget *widget, gpointer data)
536 PrefsDlg *dlg = (PrefsDlg*)data;
537 char *path = dlg->m_strPrefabPath;
538 if (strlen (path) == 0)
539 path = g_strGameToolsPath;
540 char *dir = dir_dialog (g_PrefsDlg.GetWidget (), _("Set prefab path"), path);
541 dlg->UpdateData(TRUE);
548 dlg->m_strPrefabPath = strPath;
549 dlg->UpdateData(FALSE);
554 static void OnBtnBrowseuserini (GtkWidget *widget, gpointer data)
556 PrefsDlg *dlg = (PrefsDlg*)data;
557 char *path = dlg->m_strUserPath;
558 if (strlen (path) == 0)
559 path = g_strGameToolsPath;
561 const char *filename = file_dialog (g_PrefsDlg.GetWidget(), TRUE, _("Find INI file"), path);
563 if (filename != NULL)
565 dlg->UpdateData(TRUE);
566 dlg->m_strUserPath = filename;
567 dlg->UpdateData(FALSE);
571 static void OnButtonClean (GtkWidget *widget, gpointer data)
573 // make sure this is what the user wants
574 if (gtk_MessageBox (g_PrefsDlg.GetWidget (), _("This will close Radiant and clean the corresponding registry entries.\n"
575 "Next time you start Radiant it will be good as new. Do you wish to continue?"),
576 _("Reset Registry"), MB_YESNO) == IDYES)
578 PrefsDlg *dlg = (PrefsDlg*)data;
579 dlg->EndModal (IDCANCEL);
581 g_qeglobals.disable_ini = true;
582 remove (dlg->m_inipath->str);
584 sprintf(buf, "%sSavedInfo.bin", dlg->m_rc_path->str);
586 HandleCommand (NULL, GINT_TO_POINTER (ID_FILE_EXIT));
591 // =============================================================================
594 // IMPORTANT NOTE: the values here don't matter very much
595 // the actual intialization if you start with an empty .ini is done when loading the prefs for the first time
596 // profile_load_int takes an argument to use if the value is not found
597 PrefsDlg::PrefsDlg ()
601 m_nView = MainFrame::eRegular;
603 m_bInternalBSP = FALSE;
604 m_bRightClick = FALSE;
608 m_bLoadLastMap = FALSE;
609 m_bTextureWindow = FALSE;
610 m_bSnapShots = FALSE;
612 m_bCleanTiny = FALSE;
613 m_bCamXYUpdate = TRUE;
614 m_bCamDragMultiSelect = FALSE;
615 m_bCamFreeLook = TRUE;
616 m_bCamFreeLookStrafe = FALSE;
617 m_bCamInverseMouse = FALSE;
618 m_bCamDiscrete = TRUE;
619 m_bNewLightDraw = FALSE;
620 m_strPrefabPath = "";
623 m_bFaceColors = FALSE;
627 m_bSizePaint = FALSE;
628 m_bDLLEntities = FALSE;
630 m_bDetachableMenus = FALSE; // Most win32 users will find detachable menus annoying
632 m_bDetachableMenus = TRUE; // Linux/Apple users are used to them...
634 m_bPatchToolbar = TRUE;
635 m_bWideToolbar = TRUE;
636 m_bPluginToolbar = TRUE;
640 m_bChaseMouse = FALSE;
641 m_bTextureScrollbar = TRUE;
642 m_bDisplayLists = TRUE;
643 m_bAntialiasedPointsAndLines = FALSE; // Fishman - Add antialiazed points and lines support. 09/03/00
644 m_bShowShaders = FALSE;
646 m_bNoStipple = FALSE;
647 m_bVertexSplit = FALSE;
648 m_bSelectCurves = TRUE;
649 m_bSelectModels = TRUE;
650 m_nEntityShowState = ENTITY_SKINNED_BOXED;
652 m_bSwitchClip = FALSE;
653 m_bSelectWholeEntities = TRUE;
654 m_nTextureQuality = 3;
655 m_bShowShaders = TRUE;
656 m_bGLLighting = FALSE;
659 m_bTexturesShaderlistOnly = FALSE;
660 // paths to ini files
670 m_bFloatingZ = FALSE;
671 m_bGlPtWorkaround = FALSE; // Gef: Kyro/GL_POINTS workaround 25-aug-2001
673 m_bNativeGUI = FALSE;
674 m_bStartOnPrimMon = FALSE;
676 m_global_rc_path = NULL;
678 m_bUseWin32Editor = TRUE;
680 // custom shader editor options
681 m_bUseCustomEditor = FALSE;
682 m_strEditorCommand = "";
684 m_nLightRadiuses = 1;
685 m_bQ3Map2Texturing = TRUE;
687 m_bGlATIHack = FALSE;
692 =========================================================
693 Games selection dialog
694 =========================================================
698 #define ENGINE_ATTRIBUTE "engine_win32"
699 #define MP_ENGINE_ATTRIBUTE "mp_engine_win32"
700 #elif defined(__linux__) || defined (__FreeBSD__)
701 #define ENGINE_ATTRIBUTE "engine_linux"
702 #define MP_ENGINE_ATTRIBUTE "mp_engine_linux"
703 #elif defined(__APPLE__)
704 #define ENGINE_ATTRIBUTE "engine_macos"
705 #define MP_ENGINE_ATTRIBUTE "mp_engine_macos"
707 #error "unsupported platform"
712 #define ENGINEPATH_ATTRIBUTE "enginepath_win32"
713 #elif defined(__linux__) || defined (__FreeBSD__)
714 #define ENGINEPATH_ATTRIBUTE "enginepath_linux"
715 #elif defined(__APPLE__)
716 #define ENGINEPATH_ATTRIBUTE "enginepath_macos"
718 #error "unknown platform"
722 CGameDescription::CGameDescription(xmlDocPtr pDoc, const Str &GameFile)
726 // read the user-friendly game name
727 xmlNodePtr pNode = mpDoc->children;
729 while (strcmp((const char*)pNode->name, "game") && pNode != NULL) pNode=pNode->next;
732 ///< \todo add the file name (this node and gametools should all be part of CGameDescription anyway)
733 Error("Didn't find 'game' node in the game description file '%s'\n", pDoc->URL);
735 // on win32, game tools path can now be specified relative to the exe's cwd
736 prop = (char*)xmlGetProp( pNode, (xmlChar*)"gametools" );
737 if ( prop == NULL ) {
738 Error( "Didn't find 'gametools' node in the game description file '%s'\n", pDoc->URL );
743 _fullpath( full, prop, PATH_MAX );
745 strncpy( full, prop, PATH_MAX );
749 for ( p = full; *p != '\0'; p++ ) {
753 mGameToolsPath = full;
754 if ( p != full && *(p-1) != '/' ) {
755 mGameToolsPath += "/";
760 prop = (char*)xmlGetProp(pNode, (xmlChar*)"name");
763 Sys_FPrintf(SYS_WRN, "Warning, 'name' attribute not found in '%s'\n", pDoc->URL);
764 mGameName = pDoc->URL;
772 mGameFile = GameFile;
774 prop = (char*)xmlGetProp(pNode, (xmlChar*)"quake2");
786 // if this is set, the open maps dialoge will open the engine path not the
787 // home dir for map loading and saving
788 prop = (char*)xmlGetProp(pNode, (xmlChar*)"no_maps_in_home");
792 noMapsInHome = false;
800 prop = (char*)xmlGetProp(pNode, (xmlChar*)"basegame");
804 mBaseGame = "baseq3";
813 prop = (char*)xmlGetProp(pNode, (const xmlChar*)ENGINE_ATTRIBUTE);
817 mEngine = "quake3.exe";
821 mEngine = "Quake3.app";
830 prop = (char*)xmlGetProp(pNode, (const xmlChar*)MP_ENGINE_ATTRIBUTE);
834 mMultiplayerEngine = "quake3.exe";
836 mMultiplayerEngine = "quake3";
838 mMultiplayerEngine = "Quake3.app";
843 mMultiplayerEngine = prop;
848 // on win32, engine path can now be specified relative to the exe's cwd
849 prop = (char*)xmlGetProp(pNode, (const xmlChar *)ENGINEPATH_ATTRIBUTE);
850 if ( prop != NULL ) {
853 _fullpath( full, prop, PATH_MAX );
855 strncpy( full, prop, PATH_MAX );
859 // process seperators
860 for ( p = full; *p != '\0'; p++ ) {
866 if ( p != full && *(p-1) != '/' ) {
872 // if engine path was not specified in the .game, it implies we can guess it from the gametools path
873 // on win32, and for most game package, the gametools are installed with the game
874 char aux_path[PATH_MAX]; // aux
875 strcpy( aux_path, mGameToolsPath.GetBuffer() );
876 if ( ( aux_path[ strlen(aux_path)-1 ] == '/' ) || ( aux_path[ strlen(aux_path)-1 ] == '\\' ) ) {
877 aux_path[strlen(aux_path)-1] = '\0'; // strip ending '/' if any
879 char up_path[PATH_MAX]; // up one level
880 ExtractFilePath( aux_path, up_path );
881 mEnginePath = up_path;
885 #if defined (__linux__) || defined (__APPLE__)
887 prop = (char*)xmlGetProp(pNode, (const xmlChar *)"prefix");
890 mUserPathPrefix = prop;
894 mShaderPath = xmlGetProp(pNode, (const xmlChar *)"shaderpath");
895 if (!mShaderPath.GetLength())
897 mShaderPath = "scripts/";
898 mShaderlist = "scripts/shaderlist.txt";
902 AddSlash(mShaderPath);
903 mShaderlist = mShaderPath;
904 mShaderlist += "shaderlist.txt";
906 xmlChar* default_scale = xmlGetProp(pNode, (const xmlChar *)"default_scale");
909 mTextureDefaultScale = atof((const char *)default_scale);
910 xmlFree(default_scale);
913 mTextureDefaultScale = 0.5f;
914 xmlChar* eclass_singleload = xmlGetProp(pNode, (const xmlChar*)"eclass_singleload");
915 if (eclass_singleload)
917 mEClassSingleLoad = true;
918 xmlFree(eclass_singleload);
921 mEClassSingleLoad = false;
922 xmlChar* no_patch = xmlGetProp(pNode, (const xmlChar *)"no_patch");
930 xmlChar* caulk_shader = xmlGetProp(pNode, (const xmlChar *)"caulk_shader");
933 mCaulkShader = caulk_shader;
934 xmlFree(caulk_shader);
937 mCaulkShader = "textures/common/caulk";
940 void CGameDescription::Dump()
943 if (CGameDialog::GetNetrun())
944 Sys_Printf("Running in network mode, prefs path set to '%s'\n", g_strTempPath.GetBuffer());
946 Sys_Printf("game name : '%s'\n", mGameName.GetBuffer());
947 Sys_Printf("game file : '%s'\n", mGameFile.GetBuffer());
948 Sys_Printf("game path : '%s'\n", mGameToolsPath.GetBuffer());
949 Sys_Printf("base game : '%s'\n", mBaseGame.GetBuffer());
950 Sys_Printf("engine path : '%s'\n", mEnginePath.GetBuffer());
951 Sys_Printf("engine : '%s'\n", mEngine.GetBuffer());
952 Sys_Printf("shaderlist : '%s'\n", mShaderlist.GetBuffer());
953 Sys_Printf("caulk shader: '%s'\n", mCaulkShader.GetBuffer());
954 #if defined (__linux__) || defined (__APPLE__)
955 Sys_Printf("prefix : '%s'\n", mUserPathPrefix.GetBuffer());
957 Sys_Printf("default texture scale: %g\n", mTextureDefaultScale);
958 Sys_Printf("single eclass load : %s\n", mEClassSingleLoad ? "Yes" : "No");
959 Sys_Printf("patches supported : %s\n", mNoPatch ? "No" : "Yes");
962 CPrefAssignment& CPrefAssignment::operator = (const CPrefAssignment& ass)
973 CPrefAssignment::CPrefAssignment(const CPrefAssignment& ass)
978 void CGameDialog::LoadPrefs()
980 // if we already have a document loaded, we will free and reload from file
981 if (mGlobalPrefs.InUse())
983 Sys_Printf("Reloading global prefs from file\n");
984 mGlobalPrefs.Clear();
987 // load global .pref file
988 CString strGlobalPref = g_PrefsDlg.m_global_rc_path->str;
989 strGlobalPref += "global.pref";
991 mGlobalPrefs.ReadXMLFile(strGlobalPref.GetBuffer());
993 mGlobalPrefs.GetPref("gamefile", &m_sGameFile, ""); // NOTE: there's no default, user HAS to select something
994 mGlobalPrefs.GetPref("autoload", &m_bAutoLoadGame, false);
995 mGlobalPrefs.GetPref("log console", &m_bLogConsole, false);
996 // in a very particular post-.pid startup
997 // we may have the console turned on and want to keep it that way
998 // so we use a latching system
999 if (m_bForceLogConsole)
1001 m_bLogConsole = true;
1002 Sys_Printf("console logging has been latched on, saving prefs\n");
1004 m_bForceLogConsole = false;
1007 // console logging: call Sys_LogConsole to check console logging status
1008 // it is important that we would log console as early as possible to make it useful
1011 if (mGlobalPrefs.mbEmpty)
1013 Sys_Printf("Saving global.pref with default pref values\n");
1018 void CGameDialog::SavePrefs()
1020 // update the tree and save it
1021 mGlobalPrefs.UpdatePrefTree();
1023 CString strGlobalPref = g_PrefsDlg.m_global_rc_path->str;
1024 strGlobalPref += "global.pref";
1026 if ( !mGlobalPrefs.WriteXMLFile( strGlobalPref.GetBuffer() ) ) {
1027 Sys_FPrintf(SYS_ERR, "Error occured while saving global prefs file '%s'\n", strGlobalPref.GetBuffer());
1031 void CGameDialog::DoGameInstall() {
1032 // make sure console logging is on whenever we enter the installation loop
1033 g_PrefsDlg.mGamesDialog.m_bLogConsole = true;
1038 void CGameDialog::DoGameDialog() {
1039 // allow looping the game selection dialog with calls to the game configure dialog in between
1040 while ( m_bDoGameInstall ) {
1042 m_bDoGameInstall = false;
1044 if ( DoModal() == IDCANCEL ) {
1045 Error( "game selection dialog canceled, cannot continue" );
1049 if ( m_bDoGameInstall ) {
1052 // and we will loop to do another DoModal dialog
1056 // unhook so we can use in other places
1057 // we manually incref'ed it when creating, it won't be freed (destructor)
1058 gtk_container_remove( GTK_CONTAINER( mTopBox ), GetGlobalFrame() );
1060 // we save the prefs file
1064 GtkWidget* CGameDialog::GetGlobalFrame()
1066 GtkWidget *vbox, *text, *combo, *check;
1068 if ( mFrame != NULL ) {
1072 mFrame = gtk_frame_new( NULL );
1073 gtk_container_set_border_width( GTK_CONTAINER( mFrame ), 5 );
1074 gtk_widget_show( mFrame );
1076 vbox = gtk_vbox_new( FALSE, 6 );
1077 gtk_widget_show( vbox );
1078 gtk_container_add( GTK_CONTAINER( mFrame ), vbox );
1079 gtk_container_set_border_width( GTK_CONTAINER( vbox ), 5 );
1081 text = gtk_label_new( _("Select the game:") );
1082 gtk_widget_show( text );
1083 gtk_box_pack_start( GTK_BOX( vbox ), text, FALSE, FALSE, 0 );
1085 combo = gtk_combo_box_new_text();
1086 gtk_widget_show( combo );
1087 gtk_box_pack_start( GTK_BOX( vbox ), combo, FALSE, FALSE, 0 );
1088 AddDialogData( combo, &m_nComboSelect, DLG_COMBO_BOX_INT );
1089 mGameCombo = GTK_COMBO_BOX( combo );
1093 check = gtk_check_button_new_with_label( _("Auto load selected game on startup") );
1094 gtk_widget_show(check);
1095 gtk_box_pack_start (GTK_BOX(vbox), check, FALSE, FALSE, 0);
1096 AddDialogData (check, &m_bAutoLoadGame, DLG_CHECK_BOOL);
1098 text = gtk_label_new(_("(this frame is available in the prefs menu if you set auto-select)"));
1099 gtk_widget_show(text);
1100 gtk_box_pack_start (GTK_BOX(vbox), text, FALSE, FALSE, 0);
1103 check = gtk_check_button_new_with_label( _("Networked install - per-user settings") );
1104 gtk_widget_show( check );
1105 gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 );
1106 AddDialogData( check, &m_bNetRun, DLG_CHECK_BOOL );
1109 check = gtk_check_button_new_with_label( _("Log the console to radiant.log") );
1110 gtk_widget_show( check );
1111 gtk_box_pack_start( GTK_BOX( vbox ), check, FALSE, FALSE, 0 );
1112 AddDialogData( check, &m_bLogConsole, DLG_CHECK_BOOL );
1114 // incref it so we can pass it around
1115 gtk_widget_ref( GTK_WIDGET( mFrame ) );
1120 void CGameDialog::UpdateData( bool retrieve ) {
1123 // use m_sGameFile to set m_nComboSelect
1124 list<CGameDescription *>::iterator iGame;
1126 for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++)
1128 if ((*iGame)->mGameFile == m_sGameFile)
1136 UpdateNetrun(false);
1139 Dialog::UpdateData(retrieve);
1142 // use m_nComboSelect to set m_sGameFile
1143 list<CGameDescription *>::iterator iGame = mGames.begin();
1145 for(i=0; i<m_nComboSelect; i++)
1149 m_sGameFile = (*iGame)->mGameFile;
1156 void CGameDialog::SInstallCallback( GtkWidget *widget, gpointer data ) {
1157 CGameDialog *d = static_cast< CGameDialog* >( data );
1158 d->m_bDoGameInstall = true;
1162 void CGameDialog::BuildDialog() {
1163 GtkWidget *dlg, *vbox1, *button, *setup_button;
1166 gtk_window_set_title( GTK_WINDOW( dlg ), _("Select Game") );
1168 vbox1 = gtk_vbox_new( FALSE, 0 );
1169 gtk_widget_show( vbox1 );
1170 gtk_container_add( GTK_CONTAINER( dlg ), vbox1 );
1172 gtk_container_add( GTK_CONTAINER( vbox1 ), GetGlobalFrame() );
1175 setup_button = gtk_button_new_with_label( _("Configure more games") );
1176 gtk_widget_show( setup_button );
1177 gtk_box_pack_start( GTK_BOX( vbox1 ), setup_button, FALSE, FALSE, 0 );
1178 gtk_signal_connect( GTK_OBJECT( setup_button ), "clicked",
1179 GTK_SIGNAL_FUNC( SInstallCallback ), this );
1181 button = gtk_button_new_with_label( _("OK") );
1182 gtk_widget_show( button );
1183 gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
1184 AddModalButton( button, IDOK );
1186 button = gtk_button_new_with_label( _("Cancel") );
1187 gtk_widget_show( button );
1188 gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
1189 AddModalButton( button, IDCANCEL );
1191 gtk_widget_set_usize( button, 60, -2 );
1194 void CGameDialog::UpdateGameCombo() {
1195 // fill in with the game descriptions
1196 list<CGameDescription *>::iterator iGame;
1198 if ( mGameCombo == NULL ) {
1199 Sys_Printf( "mGameCombo == NULL\n" );
1203 // clear whatever is in - wtf no way to know how many text entries?
1204 // use set/get active to track
1205 gtk_combo_box_set_active( mGameCombo, 0 );
1206 while ( gtk_combo_box_get_active( mGameCombo ) == 0 ) {
1207 gtk_combo_box_remove_text( mGameCombo, 0 );
1208 gtk_combo_box_set_active( mGameCombo, 0 );
1211 for ( iGame = mGames.begin(); iGame != mGames.end(); iGame++ ) {
1212 gtk_combo_box_append_text( mGameCombo, (*iGame)->mGameName.GetBuffer() );
1214 gtk_combo_box_set_active( mGameCombo, 0 );
1217 void CGameDialog::ScanForGames()
1222 CString strGamesPath = g_strAppPath.GetBuffer();
1223 strGamesPath += "games";
1224 const char *path = strGamesPath.GetBuffer();
1226 if ( !mGames.empty() ) {
1227 Sys_Printf( "Clearing game list\n" );
1228 list<CGameDescription*>::iterator iGame;
1229 for ( iGame = mGames.begin(); iGame != mGames.end(); iGame++ ) {
1235 Sys_Printf( "Scanning for game description files: %s\n", path );
1239 do we put game description files below g_strAppPath, or in ~/.radiant
1240 i.e. read only or read/write?
1241 my guess .. readonly cause it's an install
1242 we will probably want to add ~/.radiant/<version>/games/ scanning on top of that for developers
1243 (if that's really needed)
1246 // FIXME need to catch the 'no game description' situation and exit with a clean error
1248 dir = g_dir_open(path, 0, NULL);
1254 const gchar* name = g_dir_read_name(dir);
1258 dirlist = g_strdup(name);
1262 char *ext = strrchr (dirlist, '.');
1263 if ((ext == NULL) || (strcmp (ext, ".game") != 0))
1265 strPath.Format("%s/%s", path, dirlist);
1266 Sys_Printf("%s\n", strPath.GetBuffer());
1268 xmlDocPtr pDoc = xmlParseFile(strPath.GetBuffer());
1271 mGames.push_front( new CGameDescription( pDoc, dirlist ) );
1275 Sys_FPrintf(SYS_ERR, "XML parser failed on '%s'\n", strPath.GetBuffer());
1283 // entries in the combo need to be updated
1287 CGameDescription* CGameDialog::GameDescriptionForComboItem()
1289 list<CGameDescription *>::iterator iGame;
1291 for( iGame = mGames.begin(); iGame != mGames.end(); iGame++,i++ ) {
1292 if ( i == m_nComboSelect ) {
1296 return NULL; // not found
1299 void CGameDialog::InitGlobalPrefPath()
1301 GString *global_rc_path;
1302 // configure m_global_rc_path
1303 // this is the g_strTempPath, and it has already been mkdir'ed
1304 global_rc_path = g_string_new(g_strTempPath.GetBuffer());
1305 g_PrefsDlg.m_global_rc_path = global_rc_path;
1308 void CGameDialog::Reset()
1310 if (!g_PrefsDlg.m_global_rc_path)
1311 InitGlobalPrefPath();
1312 CString strGlobalPref = g_PrefsDlg.m_global_rc_path->str;
1313 strGlobalPref += "global.pref";
1314 remove(strGlobalPref.GetBuffer());
1317 void CGameDialog::Init()
1319 InitGlobalPrefPath();
1321 if ( mGames.empty() ) {
1324 if ( mGames.empty() ) {
1325 Error( "No games setup, aborting\n" );
1329 if ( m_bAutoLoadGame ) {
1330 // search by .game name
1331 list<CGameDescription *>::iterator iGame;
1332 for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++)
1334 if ((*iGame)->mGameFile == m_sGameFile)
1336 m_pCurrentGameDescription = (*iGame);
1341 if ( !m_bAutoLoadGame || !m_pCurrentGameDescription ) {
1343 // use m_nComboSelect to identify the game to run as and set the globals
1344 m_pCurrentGameDescription = GameDescriptionForComboItem();
1345 if ( !m_pCurrentGameDescription ) {
1346 Error("Lookup of game description object failed, can't continue\n");
1349 g_pGameDescription = m_pCurrentGameDescription;
1351 g_strGameToolsPath = g_pGameDescription->mGameToolsPath;
1353 // NOTE TTimo: this is moved from QE_LoadProject in 1.2
1354 // (probably broken)
1355 // NOTE Hydra: was broken for win32, we don't use m_strHomeGame or m_strFSBasePath
1356 #if defined (__linux__) || defined (__APPLE__)
1357 g_qeglobals.m_strHomeGame = g_get_home_dir();
1358 g_qeglobals.m_strHomeGame += "/";
1359 g_qeglobals.m_strHomeGame += m_pCurrentGameDescription->mUserPathPrefix.GetBuffer();
1360 g_qeglobals.m_strHomeGame += "/";
1362 g_qeglobals.m_strHomeGame = g_pGameDescription->mEnginePath.GetBuffer();
1365 g_pGameDescription->Dump();
1368 CGameDialog::~CGameDialog()
1372 // NOTE I'm not too sure how reliable this is
1373 gtk_widget_unref(GTK_WIDGET(mFrame));
1375 // free all the game descriptions
1376 list<CGameDescription *>::iterator iGame;
1377 for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++)
1384 void CGameDialog::AddPacksURL(Str &URL)
1386 // add the URLs for the list of game packs installed
1387 // FIXME: this is kinda hardcoded for now..
1388 list<CGameDescription *>::iterator iGame;
1389 for(iGame=mGames.begin(); iGame!=mGames.end(); iGame++)
1391 if ((*iGame)->mGameFile == "q3.game")
1392 URL += "&Games_dlup%5B%5D=1";
1393 else if ((*iGame)->mGameFile == "wolf.game")
1394 URL += "&Games_dlup%5B%5D=2";
1395 // FIXME: double entry
1396 else if ((*iGame)->mGameFile == "wolf.game")
1397 URL += "&Games_dlup%5B%5D=3";
1398 else if ((*iGame)->mGameFile == "jk2.game")
1399 URL += "&Games_dlup%5B%5D=4";
1400 else if ((*iGame)->mGameFile == "stvef.game")
1401 URL += "&Games_dlup%5B%5D=5";
1402 else if ((*iGame)->mGameFile == "sof2.game")
1403 URL += "&Games_dlup%5B%5D=6";
1404 else if ((*iGame)->mGameFile == "ja.game")
1405 URL += "&Games_dlup%5B%5D=7";
1411 #define NETRUN_FILENAME "netrun.conf"
1413 bool CGameDialog::m_bNetRun;
1415 void CGameDialog::UpdateNetrun(bool retrieve)
1419 strNetrun = g_strAppPath; strNetrun += NETRUN_FILENAME;
1422 // now check if we are running from a network installation
1423 // use a dummy file as the flag
1424 f_netrun = fopen(strNetrun.GetBuffer(), "r");
1437 f_netrun = fopen(strNetrun.GetBuffer(), "w");
1440 Sys_FPrintf(SYS_ERR, "ERROR: Failed to create netrun file '%s'\n", strNetrun.GetBuffer());
1446 Sys_Printf("Created/Checked '%s'\n", strNetrun.GetBuffer());
1451 if (remove(strNetrun.GetBuffer()) == -1)
1453 if (errno != ENOENT)
1454 Sys_FPrintf(SYS_ERR, "Failed to remove netrun file '%s'\n", strNetrun.GetBuffer());
1459 Sys_Printf("Netrun mode is disabled\n");
1465 bool CGameDialog::GetNetrun()
1474 very first prefs init deals with selecting the game and the game tools path
1475 then we can load .ini stuff
1477 using prefs / ini settings:
1481 look in g_strGameToolsPath for .ini
1484 look in ~/.radiant/<version>/gamename
1488 #define PREFS_LOCAL_FILENAME "local.pref"
1490 void PrefsDlg::Init()
1492 mGamesDialog.Init();
1494 // m_global_rc_path has been set above, do m_rc_path with game specific stuff now
1495 // the win32 and linux versions have been unified for network mode
1497 if (!CGameDialog::GetNetrun())
1499 // legacy prefs settings, this goes where the game pack is installed
1500 m_rc_path = g_string_new (g_strGameToolsPath.GetBuffer() );
1501 m_inipath = g_string_new (m_rc_path->str);
1502 g_string_append (m_inipath, PREFS_LOCAL_FILENAME);
1506 // this is common to win32 and Linux init now
1507 m_rc_path = g_string_new (m_global_rc_path->str);
1510 g_string_append (m_rc_path, g_pGameDescription->mGameFile.GetBuffer());
1511 g_string_append (m_rc_path, "/");
1512 Q_mkdir (m_rc_path->str, 0775);
1514 // then the ini file
1515 m_inipath = g_string_new (m_rc_path->str);
1516 g_string_append (m_inipath, PREFS_LOCAL_FILENAME);
1520 void PrefsDlg::UpdateData (bool retrieve)
1522 // leo: the "changed" signal confuses the update function
1523 if (m_pWidget == NULL)
1525 mGamesDialog.UpdateData (retrieve);
1526 Dialog::UpdateData (retrieve);
1530 #define PREFSHSPACE 5
1532 #define PREFSHSPACE 0
1535 static void UpdateSensitivity( GtkWidget *widget, gpointer data )
1537 PrefsDlg *dlg = (PrefsDlg*)data;
1538 dlg->DoSensitivity();
1541 static void UpdateEditorSensitivity(GtkWidget *widget, gpointer data)
1543 PrefsDlg *dlg = (PrefsDlg*)data;
1544 dlg->DoEditorSensitivity();
1547 // start new prefs dialog
1549 /*! Utility function for swapping notebook pages for tree list selections */
1550 void PrefsDlg::showPrefPage(int prefpage)
1552 if(gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)) != prefpage)
1553 gtk_notebook_set_page(GTK_NOTEBOOK(notebook), prefpage);
1558 static void treeSelection(GtkTreeSelection* selection, gpointer data)
1560 PrefsDlg *dlg = (PrefsDlg*)data;
1562 GtkTreeModel* model;
1563 GtkTreeIter selected;
1564 if(gtk_tree_selection_get_selected(selection, &model, &selected))
1567 gtk_tree_model_get(model, &selected, 1, (gpointer*)&prefpage, -1);
1568 dlg->showPrefPage(prefpage);
1572 void PrefsDlg::BuildDialog ()
1574 // Main Preferences dialog
1575 GtkWidget *dialog, *mainvbox, *hbox, *sc_win, *preflabel;
1577 // Widgets on notebook pages
1578 GtkWidget *check, *label, *scale, *hbox2, *combo,
1579 *table, *spin, *entry, *pixmap,
1580 *radio, *button, *pageframe, *vbox;
1582 GList *combo_list = (GList*)NULL;
1587 gtk_window_set_title(GTK_WINDOW(dialog), _("GtkRadiant Preferences"));
1588 gtk_widget_realize(dialog);
1590 mainvbox = gtk_vbox_new(FALSE, 5);
1591 gtk_container_add(GTK_CONTAINER(dialog), mainvbox);
1592 gtk_container_set_border_width(GTK_CONTAINER(mainvbox), 5);
1593 gtk_widget_show(mainvbox);
1595 hbox = gtk_hbox_new(FALSE, 5);
1596 gtk_widget_show(hbox);
1597 gtk_box_pack_end(GTK_BOX(mainvbox), hbox, FALSE, TRUE, 0);
1599 button = gtk_button_new_with_label(_("OK"));
1600 gtk_widget_show(button);
1601 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
1602 gtk_widget_set_usize(button, 60, -2);
1603 AddModalButton(button, IDOK);
1605 button = gtk_button_new_with_label(_("Cancel"));
1606 gtk_widget_show(button);
1607 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
1608 gtk_widget_set_usize(button, 60, -2);
1609 AddModalButton(button, IDCANCEL);
1611 button = gtk_button_new_with_label (_("Clean"));
1612 gtk_widget_show(button);
1613 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(OnButtonClean), this);
1614 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
1615 gtk_widget_set_usize (button, 60, -2);
1617 hbox = gtk_hbox_new(FALSE, 5);
1618 gtk_box_pack_start(GTK_BOX(mainvbox), hbox, TRUE, TRUE, 0);
1619 gtk_widget_show(hbox);
1621 sc_win = gtk_scrolled_window_new(NULL, NULL);
1622 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sc_win), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
1623 gtk_box_pack_start(GTK_BOX(hbox), sc_win, FALSE, FALSE, 0);
1624 gtk_widget_show(sc_win);
1626 // prefs pages notebook
1627 notebook = gtk_notebook_new();
1628 // hide the notebook tabs since its not supposed to look like a notebook
1629 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), FALSE);
1630 gtk_box_pack_start(GTK_BOX(hbox), notebook, TRUE, TRUE, 0);
1631 gtk_widget_show(notebook);
1633 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sc_win), GTK_SHADOW_IN);
1636 GtkTreeStore* store = gtk_tree_store_new(2, G_TYPE_STRING, G_TYPE_POINTER);
1638 GtkWidget* view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
1639 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
1642 GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
1643 GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes(_("Preferences"), renderer, "text", 0, NULL);
1644 gtk_tree_view_append_column(GTK_TREE_VIEW(view), column);
1648 GtkTreeSelection* selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
1649 g_signal_connect(G_OBJECT(selection), "changed", G_CALLBACK(treeSelection), this);
1652 gtk_widget_show(view);
1654 gtk_container_add(GTK_CONTAINER (sc_win), view);
1657 /********************************************************************/
1658 /* Add preference tree options */
1659 /********************************************************************/
1662 gtk_tree_store_append(store, &group, NULL);
1663 gtk_tree_store_set(store, &group, 0, _("Globals"), 1, PTAB_FRONT, -1);
1666 gtk_tree_store_append(store, &tab, &group);
1667 gtk_tree_store_set(store, &tab, 0, _("Game settings"), 1, (gpointer)PTAB_GAME_SETTINGS, -1);
1673 gtk_tree_store_append(store, &group, NULL);
1674 gtk_tree_store_set(store, &group, 0, _("Display"), 1, PTAB_FRONT, -1);
1677 gtk_tree_store_append(store, &tab, &group);
1678 gtk_tree_store_set(store, &tab, 0, _("2D Display/Rendering"), 1, (gpointer)PTAB_2D, -1);
1682 gtk_tree_store_append(store, &tab, &group);
1683 gtk_tree_store_set(store, &tab, 0, _("3D View"), 1, (gpointer)PTAB_CAMERA, -1);
1687 gtk_tree_store_append(store, &tab, &group);
1688 gtk_tree_store_set(store, &tab, 0, _("Texture Settings"), 1, (gpointer)PTAB_TEXTURE, -1);
1694 gtk_tree_store_append(store, &group, NULL);
1695 gtk_tree_store_set(store, &group, 0, _("Interface"), 1, PTAB_FRONT, -1);
1698 gtk_tree_store_append(store, &tab, &group);
1699 gtk_tree_store_set(store, &tab, 0, _("Layout"), 1, (gpointer)PTAB_LAYOUT, -1);
1703 gtk_tree_store_append(store, &tab, &group);
1704 gtk_tree_store_set(store, &tab, 0, _("Mouse"), 1, (gpointer)PTAB_MOUSE, -1);
1708 gtk_tree_store_append(store, &tab, &group);
1709 gtk_tree_store_set(store, &tab, 0, _("Editing"), 1, (gpointer)PTAB_EDITING, -1);
1715 gtk_tree_store_append(store, &group, NULL);
1716 gtk_tree_store_set(store, &group, 0, _("Other"), 1, PTAB_FRONT, -1);
1719 gtk_tree_store_append(store, &tab, &group);
1720 gtk_tree_store_set(store, &tab, 0, _("Startup/Auto save"), 1, (gpointer)PTAB_STARTUP, -1);
1724 gtk_tree_store_append(store, &tab, &group);
1725 gtk_tree_store_set(store, &tab, 0, _("Paths"), 1, (gpointer)PTAB_PATHS, -1);
1729 gtk_tree_store_append(store, &tab, &group);
1730 gtk_tree_store_set(store, &tab, 0, _("Misc"), 1, (gpointer)PTAB_MISC, -1);
1732 if (!g_qeglobals.bBSPFrontendPlugin)
1735 gtk_tree_store_append(store, &tab, &group);
1736 gtk_tree_store_set(store, &tab, 0, _("BSP Monitoring"), 1, (gpointer)PTAB_BSPMONITOR, -1);
1741 gtk_tree_view_expand_all(GTK_TREE_VIEW(view));
1743 g_object_unref(G_OBJECT(store));
1746 /**********************************************************************/
1747 /* build the prefs pages */
1748 /**********************************************************************/
1751 // todo : add something interesting here
1752 // NOTE TTimo: tip of the day? or a logo?
1753 preflabel = gtk_label_new(_("Front Page"));
1754 gtk_widget_show(preflabel);
1755 pageframe = gtk_frame_new(NULL);
1756 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
1757 gtk_widget_show(pageframe);
1758 vbox = gtk_vbox_new(FALSE, 5);
1759 gtk_widget_show(vbox);
1760 gtk_widget_set_usize(GTK_WIDGET(vbox), 350, -2);
1761 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1762 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
1764 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
1766 /******** global preferences group ****************************/
1767 preflabel = gtk_label_new(_("Globals"));
1768 gtk_widget_show(preflabel);
1770 pageframe = mGamesDialog.GetGlobalFrame();
1771 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
1773 /******** 2D prefs group (xy views/rendering options) *********/
1774 preflabel = gtk_label_new(_("2D Display"));
1775 gtk_widget_show(preflabel);
1776 pageframe = gtk_frame_new(_("2D Display"));
1777 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
1778 gtk_widget_show(pageframe);
1779 vbox = gtk_vbox_new(FALSE, 5);
1780 gtk_widget_show(vbox);
1781 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1782 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
1784 // OpenGL Display Lists
1785 check = gtk_check_button_new_with_label(_("OpenGL Display Lists"));
1786 gtk_widget_show(check);
1787 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1788 AddDialogData(check, &m_bDisplayLists, DLG_CHECK_BOOL);
1790 // Antialiased points & lines
1791 // Fishman - Add antialiazed points and lines support. 09/03/00
1792 check = gtk_check_button_new_with_label (_("OpenGL antialiased points and lines"));
1793 gtk_widget_show (check);
1794 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1795 AddDialogData (check, &m_bAntialiasedPointsAndLines, DLG_CHECK_BOOL);
1797 // Solid selection boxes
1798 check = gtk_check_button_new_with_label (_("Solid selection boxes"));
1799 gtk_widget_show (check);
1800 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1801 AddDialogData (check, &m_bNoStipple, DLG_CHECK_BOOL);
1803 // Display size info
1804 check = gtk_check_button_new_with_label (_("Display size info"));
1805 gtk_widget_show (check);
1806 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1807 AddDialogData (check, &m_bSizePaint, DLG_CHECK_BOOL);
1809 // Alternate vertex/edge handles
1810 // Gef: Kyro GL_POINT work around 25-aug-2001
1811 check = gtk_check_button_new_with_label (_("Alternate vertex/edge handles"));
1812 gtk_widget_show(check);
1813 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1814 AddDialogData(check, &m_bGlPtWorkaround, DLG_CHECK_BOOL);
1816 g_list_free (combo_list);
1820 check = gtk_check_button_new_with_label (_("ATI cards with broken drivers - bug #802"));
1821 gtk_widget_show(check);
1822 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
1823 AddDialogData(check, &m_bGlATIHack, DLG_CHECK_BOOL);
1826 // Add the page to the notebook
1827 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
1829 /******** 3D Camera view group *********/
1830 preflabel = gtk_label_new(_("3D View"));
1831 gtk_widget_show(preflabel);
1832 pageframe = gtk_frame_new(_("3D View"));
1833 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
1834 gtk_widget_show(pageframe);
1835 vbox = gtk_vbox_new(FALSE, 5);
1836 gtk_widget_show(vbox);
1837 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1838 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
1840 // Directional velocity (Movement Velocity)
1842 hbox2 = gtk_hbox_new (FALSE, 0);
1843 gtk_widget_show (hbox2);
1844 gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
1847 label = gtk_label_new(_("Movement Velocity"));
1848 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
1849 gtk_widget_show(label);
1850 gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
1853 adj = gtk_adjustment_new(100, 50, 300, 1, 10, 10);
1854 AddDialogData(adj, &m_nMoveSpeed, DLG_ADJ_INT);
1857 scale = gtk_hscale_new(GTK_ADJUSTMENT(adj));
1858 gtk_widget_show(scale);
1859 gtk_box_pack_start(GTK_BOX (vbox), scale, FALSE, TRUE, 2);
1861 gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
1863 // Angular velocity (Rotational Velocity)
1865 hbox2 = gtk_hbox_new (FALSE, 0);
1866 gtk_widget_show (hbox2);
1867 gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
1870 label = gtk_label_new (_("Rotational Velocity"));
1871 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
1872 gtk_widget_show (label);
1873 gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
1876 adj = gtk_adjustment_new (3, 1, 180, 1, 10, 10); // value, low, high, step, page_step, page_size
1877 AddDialogData (adj, &m_nAngleSpeed, DLG_ADJ_INT);
1880 scale = gtk_hscale_new (GTK_ADJUSTMENT (adj));
1881 gtk_widget_show (scale);
1882 gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, TRUE, 2);
1883 gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
1885 // Text under the velocity sliders
1887 hbox2 = gtk_hbox_new (FALSE, 0);
1888 gtk_widget_show (hbox2);
1889 gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
1892 label = gtk_label_new (_("slow"));
1893 gtk_widget_show (label);
1894 gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
1897 label = gtk_label_new (_("fast"));
1898 gtk_widget_show (label);
1899 gtk_box_pack_end (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
1901 // Allow drag to select multiple faces/brushes
1903 table = gtk_table_new(2, 1, FALSE);
1904 gtk_widget_show(table);
1905 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
1906 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
1907 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
1909 label = gtk_label_new (_("Use paint-select in camera view:"));
1910 gtk_widget_show (label);
1911 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
1912 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
1913 (GtkAttachOptions) (0),
1914 (GtkAttachOptions) (0), 0, 0);
1917 combo_list = g_list_append (combo_list, (void *)_("No"));
1918 combo_list = g_list_append (combo_list, (void *)_("Yes"));
1919 combo_list = g_list_append (combo_list, (void *)_("Yes (Classic Key Setup)"));
1921 combo = gtk_combo_new ();
1922 gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list);
1923 gtk_widget_show (combo);
1924 gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1,
1925 (GtkAttachOptions) (GTK_FILL),
1926 (GtkAttachOptions) (0), 0, 0);
1927 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
1928 AddDialogData (combo, &m_nCamDragMultiSelect, DLG_COMBO_INT);
1930 // Freelook in Camera view
1931 check = gtk_check_button_new_with_label (_("Freelook in Camera view"));
1932 gtk_widget_show (check);
1933 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1934 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1935 AddDialogData (check, &m_bCamFreeLook, DLG_CHECK_BOOL);
1937 // Freelook in Camera view w/ forward & back strafing instead of up and down looking
1938 check = gtk_check_button_new_with_label (_("Freelook strafes Forward and Back"));
1939 gtk_widget_show (check);
1940 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1941 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1942 AddDialogData (check, &m_bCamFreeLookStrafe, DLG_CHECK_BOOL);
1944 // Invert mouse in freelook
1945 check = gtk_check_button_new_with_label (_("Invert mouse in freelook"));
1946 gtk_widget_show (check);
1947 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1948 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1949 AddDialogData (check, &m_bCamInverseMouse, DLG_CHECK_BOOL);
1951 // Discrete movement
1952 check = gtk_check_button_new_with_label (_("Discrete movement"));
1953 gtk_widget_show (check);
1954 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1955 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1956 AddDialogData (check, &m_bCamDiscrete, DLG_CHECK_BOOL);
1958 // Update XY views on camera move
1959 check = gtk_check_button_new_with_label (_("Update XY views on camera move"));
1960 gtk_widget_show (check);
1961 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
1962 gtk_label_set_justify (GTK_LABEL (GTK_BIN (check)->child), GTK_JUSTIFY_LEFT);
1963 AddDialogData (check, &m_bCamXYUpdate, DLG_CHECK_BOOL);
1965 // Add the page to the notebook
1966 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
1968 /******** Texture group *********/
1969 preflabel = gtk_label_new(_("Textures"));
1970 gtk_widget_show(preflabel);
1971 pageframe = gtk_frame_new(_("Textures"));
1972 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
1973 gtk_widget_show(pageframe);
1974 vbox = gtk_vbox_new(FALSE, 6);
1975 gtk_widget_show(vbox);
1976 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
1977 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
1979 // Texture quality slider
1981 label = gtk_label_new (_("Texture quality"));
1982 gtk_widget_show (label);
1983 gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
1984 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
1985 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
1988 adj = gtk_adjustment_new (0, 0, 4, 1, 1, 1);
1989 AddDialogData (adj, &m_nLatchedTextureQuality, DLG_ADJ_INT);
1992 scale = gtk_hscale_new (GTK_ADJUSTMENT (adj));
1993 gtk_widget_show (scale);
1994 gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
1995 gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
1997 // text under the texture slider
1998 hbox2 = gtk_hbox_new (FALSE, 0);
1999 gtk_widget_show (hbox2);
2000 gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
2001 label = gtk_label_new (_("low"));
2002 gtk_widget_show (label);
2003 gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
2004 label = gtk_label_new (_("high"));
2005 gtk_widget_show (label);
2006 gtk_box_pack_end (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
2009 check = gtk_check_button_new_with_label (_("Texture subsets"));
2010 gtk_widget_show (check);
2011 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2012 AddDialogData (check, &m_bTextureWindow, DLG_CHECK_BOOL);
2014 // texture scrollbar
2015 check = gtk_check_button_new_with_label (_("Texture scrollbar"));
2016 gtk_widget_show (check);
2017 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2018 AddDialogData (check, &m_bTextureScrollbar, DLG_CHECK_BOOL);
2020 // texture increment matches grid
2021 check = gtk_check_button_new_with_label (_("Tex increment matches grid"));
2022 gtk_widget_show (check);
2023 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2024 AddDialogData (check, &m_bSnapTToGrid, DLG_CHECK_BOOL);
2027 // Texture compression choice label
2029 table = gtk_table_new(2, 1, FALSE);
2030 gtk_widget_show(table);
2031 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2032 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2033 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2035 label = gtk_label_new (_("Texture Compression (if available):"));
2036 gtk_widget_show (label);
2037 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
2038 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
2039 (GtkAttachOptions) (0),
2040 (GtkAttachOptions) (0), 0, 0);
2041 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
2043 // Texture compression choice label
2045 // NONE will always be in pos 0
2046 combo_list = g_list_append (combo_list, (void *)_("None"));
2048 // if OpenGL compression is enabled it will always be
2050 if (g_qeglobals.m_bOpenGLCompressionSupported)
2052 combo_list = g_list_append (combo_list, (void *)_("OpenGL ARB"));
2055 // If S3 is enabled offer all 3 valid compression schemes in RGBA
2056 if (g_qeglobals.m_bS3CompressionSupported)
2058 combo_list = g_list_append (combo_list, (void *)_("S3TC DXT1"));
2059 combo_list = g_list_append (combo_list, (void *)_("S3TC DXT3"));
2060 combo_list = g_list_append (combo_list, (void *)_("S3TC DXT5"));
2063 combo = gtk_combo_new ();
2064 gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list);
2065 gtk_widget_show (combo);
2066 gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1,
2067 (GtkAttachOptions) (GTK_FILL),
2068 (GtkAttachOptions) (0), 0, 0);
2069 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
2070 AddDialogData (combo, &m_nTextureCompressionFormat, DLG_COMBO_INT);
2071 g_list_free (combo_list);
2074 table = gtk_table_new(2, 1, FALSE);
2075 gtk_widget_show(table);
2076 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2077 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2078 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2082 label = gtk_label_new (_("Startup Shaders:"));
2083 gtk_widget_show (label);
2084 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
2085 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
2086 (GtkAttachOptions) (0),
2087 (GtkAttachOptions) (0), 0, 0);
2088 gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
2092 combo_list = g_list_append (combo_list, (void *)_("None"));
2093 if (g_pGameDescription->mGameFile == "jk2.game" || g_pGameDescription->mGameFile == "ja.game")
2094 combo_list = g_list_append (combo_list, (void *)_("System"));
2095 else if (g_pGameDescription->mGameFile == "sof2.game")
2096 combo_list = g_list_append (combo_list, (void *)("Tools"));
2098 combo_list = g_list_append (combo_list, (void *)_("Common"));
2099 combo_list = g_list_append (combo_list, (void *)_("All"));
2100 combo = gtk_combo_new ();
2101 gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list);
2102 gtk_widget_show (combo);
2103 gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1,
2104 (GtkAttachOptions) (GTK_FILL),
2105 (GtkAttachOptions) (0), 0, 0);
2106 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
2107 AddDialogData (combo, &m_nLatchedShader, DLG_COMBO_INT);
2108 g_list_free (combo_list);
2110 // Add the page to the notebook
2111 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2113 /******** Layout group *********/
2114 preflabel = gtk_label_new(_("Layout"));
2115 gtk_widget_show(preflabel);
2116 pageframe = gtk_frame_new(_("Layout"));
2117 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2118 gtk_widget_show(pageframe);
2119 vbox = gtk_vbox_new(FALSE, 5);
2120 gtk_widget_show(vbox);
2121 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2122 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2126 table = gtk_table_new (2, 4, FALSE);
2127 gtk_widget_show (table);
2128 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2129 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2130 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2133 pixmap = new_pixmap (g_pParentWnd->m_pWidget, "window1.bmp");
2134 gtk_widget_show (pixmap);
2135 gtk_table_attach (GTK_TABLE (table), pixmap, 0, 1, 0, 1,
2136 (GtkAttachOptions) (0),
2137 (GtkAttachOptions) (0), 0, 0);
2140 pixmap = new_pixmap (g_pParentWnd->m_pWidget, "window2.bmp");
2141 gtk_widget_show (pixmap);
2142 gtk_table_attach (GTK_TABLE (table), pixmap, 1, 2, 0, 1,
2143 (GtkAttachOptions) (0),
2144 (GtkAttachOptions) (0), 0, 0);
2147 pixmap = new_pixmap (g_pParentWnd->m_pWidget, "window3.bmp");
2148 gtk_widget_show (pixmap);
2149 gtk_table_attach (GTK_TABLE (table), pixmap, 2, 3, 0, 1,
2150 (GtkAttachOptions) (0),
2151 (GtkAttachOptions) (0), 0, 0);
2154 pixmap = new_pixmap (g_pParentWnd->m_pWidget, "window4.bmp");
2155 gtk_widget_show (pixmap);
2156 gtk_table_attach (GTK_TABLE (table), pixmap, 3, 4, 0, 1,
2157 (GtkAttachOptions) (0),
2158 (GtkAttachOptions) (0), 0, 0);
2160 // view type 1 selector
2161 radio = gtk_radio_button_new (NULL);
2162 gtk_widget_show (radio);
2163 gtk_table_attach (GTK_TABLE (table), radio, 0, 1, 1, 2,
2164 (GtkAttachOptions) (0),
2165 (GtkAttachOptions) (0), 0, 0);
2167 // view type 2 selector
2168 radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (radio));
2169 gtk_widget_show (radio);
2170 gtk_table_attach (GTK_TABLE (table), radio, 1, 2, 1, 2,
2171 (GtkAttachOptions) (0),
2172 (GtkAttachOptions) (0), 0, 0);
2174 // view type 3 selector
2175 radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (radio));
2176 gtk_widget_show (radio);
2177 gtk_table_attach (GTK_TABLE (table), radio, 2, 3, 1, 2,
2178 (GtkAttachOptions) (0),
2179 (GtkAttachOptions) (0), 0, 0);
2181 // view type 4 selector
2182 radio = gtk_radio_button_new_from_widget (GTK_RADIO_BUTTON (radio));
2183 gtk_widget_show (radio);
2184 gtk_table_attach (GTK_TABLE (table), radio, 3, 4, 1, 2,
2185 (GtkAttachOptions) (0),
2186 (GtkAttachOptions) (0), 0, 0);
2187 AddDialogData (radio, &m_nLatchedView, DLG_RADIO_INT);
2189 // Floating Z window
2190 check = gtk_check_button_new_with_label (_("Floating Z Window"));
2191 gtk_widget_show (check);
2192 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2193 AddDialogData (check, &m_bLatchedFloatingZ, DLG_CHECK_BOOL);
2195 // show menu tear-off seperators
2196 check = gtk_check_button_new_with_label (_("Detachable Menus"));
2197 gtk_widget_show (check);
2198 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2199 AddDialogData (check, &m_bLatchedDetachableMenus, DLG_CHECK_BOOL);
2201 if (!g_pGameDescription->mNoPatch)
2203 // show patch toolbar
2204 check = gtk_check_button_new_with_label (_("Patch Toolbar"));
2205 gtk_widget_show (check);
2206 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2207 g_object_set_data (G_OBJECT (dialog), "check_patchtoolbar", check); // Allow to be disabled for Q1/Q2
2208 AddDialogData (check, &m_bLatchedPatchToolbar, DLG_CHECK_BOOL);
2212 check = gtk_check_button_new_with_label (_("Wide Toolbar"));
2213 gtk_widget_show (check);
2214 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2215 AddDialogData (check, &m_bLatchedWideToolbar, DLG_CHECK_BOOL);
2217 // use plugin toolbar
2218 check = gtk_check_button_new_with_label (_("Plugin Toolbar"));
2219 gtk_widget_show (check);
2220 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2221 AddDialogData (check, &m_bLatchedPluginToolbar, DLG_CHECK_BOOL);
2224 // win32 file dialog
2225 check = gtk_check_button_new_with_label (_("Use win32 file load dialog"));
2226 gtk_widget_show (check);
2227 // gtk_container_add (GTK_CONTAINER (vbox), check);
2228 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2229 AddDialogData (check, &m_bNativeGUI, DLG_CHECK_BOOL);
2231 // position on primary monitor
2232 check = gtk_check_button_new_with_label (_("Start on Primary Monitor"));
2233 gtk_widget_show (check);
2234 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2235 g_object_set_data (G_OBJECT (dialog), "check_startonprimary", check);
2236 gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateSensitivity), this );
2237 AddDialogData (check, &m_bStartOnPrimMon, DLG_CHECK_BOOL);
2240 // Add the page to the notebook
2241 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2243 /******** Mouse group *********/
2244 preflabel = gtk_label_new(_("Mouse"));
2245 gtk_widget_show(preflabel);
2246 pageframe = gtk_frame_new(_("Mouse"));
2247 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2248 gtk_widget_show(pageframe);
2249 vbox = gtk_vbox_new(FALSE, 5);
2250 gtk_widget_show(vbox);
2251 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2252 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2256 hbox2 = gtk_hbox_new (FALSE, 5);
2257 gtk_widget_show (hbox2);
2258 gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
2261 radio = gtk_radio_button_new_with_label (NULL, _("2 button"));
2262 gtk_widget_show (radio);
2263 gtk_box_pack_start (GTK_BOX (hbox2), radio, FALSE, FALSE, 0);
2266 radio = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio), _("3 button"));
2267 gtk_widget_show (radio);
2268 gtk_box_pack_start (GTK_BOX (hbox2), radio, FALSE, FALSE, 0);
2269 AddDialogData (radio, &m_nMouse, DLG_RADIO_INT);
2271 // right click to drop entity
2272 check = gtk_check_button_new_with_label (_("Right click to drop entities"));
2273 gtk_widget_show (check);
2274 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2275 AddDialogData (check, &m_bRightClick, DLG_CHECK_BOOL);
2277 // Mouse chaser (and this does what?)
2278 check = gtk_check_button_new_with_label (_("Mouse chaser"));
2279 gtk_widget_show (check);
2280 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2281 AddDialogData (check, &m_bChaseMouse, DLG_CHECK_BOOL);
2284 check = gtk_check_button_new_with_label (_("ALT + multi-drag"));
2285 gtk_widget_show (check);
2286 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2287 AddDialogData (check, &m_bALTEdge, DLG_CHECK_BOOL);
2289 // Mouse wheel increments
2291 hbox2 = gtk_hbox_new (FALSE, 5);
2292 gtk_widget_show (hbox2);
2293 gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
2296 label = gtk_label_new (_("Wheel Mouse inc:"));
2297 gtk_widget_show (label);
2298 gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
2301 entry = gtk_entry_new ();
2302 gtk_widget_show (entry);
2303 gtk_widget_set_usize (entry, 40, -2);
2304 gtk_box_pack_start (GTK_BOX (hbox2), entry, FALSE, FALSE, 0);
2305 AddDialogData (entry, &m_nWheelInc, DLG_ENTRY_INT);
2307 // Add the page to the notebook
2308 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2310 /******** Editing group *********/
2311 preflabel = gtk_label_new(_("Editing"));
2312 gtk_widget_show(preflabel);
2313 pageframe = gtk_frame_new(_("Editing"));
2314 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2315 gtk_widget_show(pageframe);
2316 vbox = gtk_vbox_new(FALSE, 5);
2317 gtk_widget_show(vbox);
2318 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2319 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2321 // Vertex editing splits faces
2322 check = gtk_check_button_new_with_label (_("Vertex editing splits face"));
2323 gtk_widget_show (check);
2324 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2325 AddDialogData (check, &m_bVertexSplit, DLG_CHECK_BOOL);
2327 // Fix target/targetname collisions
2328 check = gtk_check_button_new_with_label (_("Fix target/targetname collisions"));
2329 gtk_widget_show (check);
2330 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2331 AddDialogData (check, &m_bDoTargetFix, DLG_CHECK_BOOL);
2333 // Clipper tool uses caulk
2334 check = gtk_check_button_new_with_label (_("Clipper tool uses caulk"));
2335 gtk_widget_show (check);
2336 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2337 AddDialogData (check, &m_bClipCaulk, DLG_CHECK_BOOL);
2339 // Don't clamp plane points
2340 check = gtk_check_button_new_with_label (_("Don't clamp plane points"));
2341 gtk_widget_show (check);
2342 gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
2343 AddDialogData (check, &m_bNoClamp, DLG_CHECK_BOOL);
2345 // Select patch by bounding box
2346 check = gtk_check_button_new_with_label (_("Select patches by bounding box"));
2347 gtk_widget_show (check);
2348 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2349 AddDialogData (check, &m_bPatchBBoxSelect, DLG_CHECK_BOOL);
2351 // Rotation increment
2353 table = gtk_table_new (2, 3, FALSE);
2354 gtk_widget_show (table);
2355 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2356 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2357 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2360 label = gtk_label_new (_("Rotation increment:"));
2361 gtk_widget_show (label);
2362 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
2363 (GtkAttachOptions) (0),
2364 (GtkAttachOptions) (0), 0, 0);
2367 entry = gtk_entry_new ();
2368 gtk_widget_show (entry);
2369 gtk_widget_set_usize (entry, 60, -2);
2370 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1,
2371 (GtkAttachOptions) (GTK_FILL),
2372 (GtkAttachOptions) (0), 0, 0);
2373 AddDialogData (entry, &m_nRotation, DLG_ENTRY_INT);
2377 label = gtk_label_new (_("Undo Levels:"));
2378 gtk_widget_show (label);
2379 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
2380 (GtkAttachOptions) (0),
2381 (GtkAttachOptions) (0), 0, 0);
2383 // spinner (allows undo levels to be set to zero)
2384 spin = gtk_spin_button_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 0, 64, 1, 10, 10)), 1, 0);
2385 gtk_widget_show (spin);
2386 gtk_table_attach (GTK_TABLE (table), spin, 1, 2, 1, 2,
2387 (GtkAttachOptions) (GTK_FILL),
2388 (GtkAttachOptions) (0), 0, 0);
2389 gtk_widget_set_usize (spin, 60, -2);
2390 AddDialogData (spin, &m_nUndoLevels, DLG_SPIN_INT);
2392 // Patch subdivisions
2394 label = gtk_label_new (_("Patch subdivisions:"));
2395 gtk_widget_show (label);
2396 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
2397 (GtkAttachOptions) (0),
2398 (GtkAttachOptions) (0), 0, 0);
2400 // entry (spinner perhaps? [2-16])
2401 entry = gtk_entry_new ();
2402 gtk_widget_show (entry);
2403 gtk_widget_set_usize (entry, 60, -2);
2404 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 2, 3,
2405 (GtkAttachOptions) (GTK_FILL),
2406 (GtkAttachOptions) (0), 0, 0);
2407 AddDialogData (entry, &m_nSubdivisions, DLG_ENTRY_INT);
2409 // Add the page to the notebook
2410 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2412 /******** Save/Load group *********/
2413 preflabel = gtk_label_new(_("Startup/Auto save"));
2414 gtk_widget_show(preflabel);
2415 pageframe = gtk_frame_new(_("Startup/Auto save"));
2416 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2417 gtk_widget_show(pageframe);
2418 vbox = gtk_vbox_new(FALSE, 5);
2419 gtk_widget_show(vbox);
2420 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2421 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2424 check = gtk_check_button_new_with_label (_("Snapshots"));
2425 gtk_widget_show (check);
2426 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2427 AddDialogData (check, &m_bSnapShots, DLG_CHECK_BOOL);
2429 // load last project on open
2430 check = gtk_check_button_new_with_label (_("Load last project on open"));
2431 gtk_widget_show (check);
2432 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2433 AddDialogData (check, &m_bLoadLast, DLG_CHECK_BOOL);
2435 // load last map on open
2436 check = gtk_check_button_new_with_label (_("Load last map on open"));
2437 gtk_widget_show (check);
2438 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2439 AddDialogData (check, &m_bLoadLastMap, DLG_CHECK_BOOL);
2443 hbox2 = gtk_hbox_new (FALSE, 5);
2444 gtk_widget_show (hbox2);
2445 gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
2446 gtk_container_set_border_width (GTK_CONTAINER (hbox2), 0);
2449 check = gtk_check_button_new_with_label (_("Auto save every"));
2450 gtk_widget_show (check);
2451 gtk_box_pack_start (GTK_BOX (hbox2), check, FALSE, FALSE, 0);
2452 AddDialogData (check, &m_bAutoSave, DLG_CHECK_BOOL);
2455 spin = gtk_spin_button_new (GTK_ADJUSTMENT (gtk_adjustment_new (1, 1, 60, 1, 10, 10)), 1, 0);
2456 gtk_widget_show (spin);
2457 gtk_box_pack_start (GTK_BOX (hbox2), spin, FALSE, FALSE, 0);
2458 gtk_widget_set_usize (spin, 60, -2);
2459 AddDialogData (spin, &m_nAutoSave, DLG_SPIN_INT);
2462 label = gtk_label_new (_("minutes"));
2463 gtk_widget_show (label);
2464 gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);
2466 // Add the page to the notebook
2467 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2469 /******** Paths group *********/
2470 preflabel = gtk_label_new(_("Paths"));
2471 gtk_widget_show(preflabel);
2472 pageframe = gtk_frame_new(_("Paths"));
2473 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2474 gtk_widget_show(pageframe);
2475 vbox = gtk_vbox_new(FALSE, 5);
2476 gtk_widget_show(vbox);
2477 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2478 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2482 table = gtk_table_new (3, 3, FALSE);
2483 gtk_widget_show (table);
2484 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2485 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2486 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2489 label = gtk_label_new (_("Prefab path:"));
2490 gtk_widget_show (label);
2491 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
2492 (GtkAttachOptions) (0),
2493 (GtkAttachOptions) (0), 0, 0);
2494 gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
2497 entry = gtk_entry_new ();
2498 gtk_widget_show (entry);
2499 gtk_widget_set_usize(GTK_WIDGET(entry), 240, -2);
2500 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1,
2501 (GtkAttachOptions) (GTK_FILL),
2502 (GtkAttachOptions) (0), 1, 0);
2503 AddDialogData (entry, &m_strPrefabPath, DLG_ENTRY_TEXT);
2507 button = gtk_button_new_with_label ("...");
2508 gtk_widget_show (button);
2509 gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (OnBtnBrowseprefab), this);
2510 gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1,
2511 (GtkAttachOptions) (0),
2512 (GtkAttachOptions) (0), 0, 0);
2517 label = gtk_label_new (_("User INI path:"));
2518 gtk_widget_show (label);
2519 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
2520 (GtkAttachOptions) (0),
2521 (GtkAttachOptions) (0), 0, 0);
2522 gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
2524 // user ini path entry
2525 entry = gtk_entry_new ();
2526 gtk_widget_show (entry);
2527 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 1, 2,
2528 (GtkAttachOptions) (GTK_FILL),
2529 (GtkAttachOptions) (0), 1, 0);
2530 AddDialogData (entry, &m_strUserPath, DLG_ENTRY_TEXT);
2532 // user ini browse button
2533 button = gtk_button_new_with_label ("...");
2534 gtk_widget_show (button);
2535 gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (OnBtnBrowseuserini), this);
2536 gtk_table_attach (GTK_TABLE (table), button, 2, 3, 1, 2,
2537 (GtkAttachOptions) (0),
2538 (GtkAttachOptions) (0), 0, 0);
2540 // Add the page to the notebook
2541 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2543 /******** Misc group *********/
2544 preflabel = gtk_label_new(_("Misc"));
2545 gtk_widget_show(preflabel);
2546 pageframe = gtk_frame_new(_("Misc"));
2547 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2548 gtk_widget_show(pageframe);
2549 vbox = gtk_vbox_new(FALSE, 5);
2550 gtk_widget_show(vbox);
2551 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2552 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2555 check = gtk_check_button_new_with_label (_("Light drawing"));
2556 gtk_widget_show (check);
2557 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2558 AddDialogData (check, &m_bNewLightDraw, DLG_CHECK_BOOL);
2562 table = gtk_table_new(2, 1, FALSE);
2563 gtk_widget_show(table);
2564 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2565 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2566 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2568 label = gtk_label_new (_("Light radiuses:"));
2569 gtk_widget_show (label);
2570 gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
2571 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
2572 (GtkAttachOptions) (0),
2573 (GtkAttachOptions) (0), 0, 0);
2576 combo_list = g_list_append (combo_list, (void *)_("Disabled"));
2577 combo_list = g_list_append (combo_list, (void *)_("True Q3Map2 Style"));
2578 combo_list = g_list_append (combo_list, (void *)_("Classic Style"));
2580 combo = gtk_combo_new ();
2581 gtk_combo_set_popdown_strings (GTK_COMBO (combo), combo_list);
2582 gtk_widget_show (combo);
2583 gtk_table_attach(GTK_TABLE(table), combo, 1, 2, 0, 1,
2584 (GtkAttachOptions) (GTK_FILL),
2585 (GtkAttachOptions) (0), 0, 0);
2586 gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (combo)->entry), FALSE);
2587 AddDialogData (combo, &m_nLightRadiuses, DLG_COMBO_INT);
2590 check = gtk_check_button_new_with_label (_("Use win32 file associations to open text files instead of builtin editor"));
2591 gtk_widget_show(check);
2592 gtk_box_pack_start(GTK_BOX (vbox), check, FALSE, FALSE, 0);
2593 AddDialogData (check, &g_PrefsDlg.m_bUseWin32Editor, DLG_CHECK_BOOL);
2595 // use custom shader editor
2596 check = gtk_check_button_new_with_label (_("Use Custom Shader Editor"));
2597 gtk_widget_show(check);
2598 gtk_box_pack_start(GTK_BOX (vbox), check, FALSE, FALSE, 0);
2599 gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateEditorSensitivity), this);
2600 g_object_set_data (G_OBJECT(dialog), "check_customeditor", check);
2601 AddDialogData (check, &g_PrefsDlg.m_bUseCustomEditor, DLG_CHECK_BOOL);
2603 // custom shader editor executable
2605 table = gtk_table_new (3, 1, FALSE);
2606 gtk_widget_show (table);
2607 gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, TRUE, 0);
2608 gtk_table_set_row_spacings (GTK_TABLE (table), 5);
2609 gtk_table_set_col_spacings (GTK_TABLE (table), 5);
2612 label = gtk_label_new(_("Custom Editor Command"));
2613 gtk_widget_show(label);
2614 gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
2615 (GtkAttachOptions) (0),
2616 (GtkAttachOptions) (0), 0, 0);
2617 gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
2618 g_object_set_data (G_OBJECT(dialog), "label_customeditor", label);
2619 gtk_widget_set_sensitive (label, g_PrefsDlg.m_bUseCustomEditor);
2621 // custom editor command entry
2622 entry = gtk_entry_new ();
2623 gtk_widget_show (entry);
2624 gtk_widget_set_usize(GTK_WIDGET(entry), 240, -2);
2625 gtk_table_attach (GTK_TABLE (table), entry, 1, 2, 0, 1,
2626 (GtkAttachOptions) (GTK_FILL),
2627 (GtkAttachOptions) (0), 1, 0);
2628 AddDialogData (entry, &m_strEditorCommand, DLG_ENTRY_TEXT);
2629 gtk_widget_set_sensitive (entry, g_PrefsDlg.m_bUseCustomEditor);
2630 g_object_set_data (G_OBJECT(dialog), "entry_customeditor", entry);
2633 button = gtk_button_new_with_label (_("..."));
2634 gtk_widget_show (button);
2635 gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (OnBtnBrowseEditor), this);
2636 gtk_table_attach (GTK_TABLE (table), button, 2, 3, 0, 1,
2637 (GtkAttachOptions) (0),
2638 (GtkAttachOptions) (0), 0, 0);
2639 g_object_set_data (G_OBJECT(dialog), "button_customeditor", button);
2640 gtk_widget_set_sensitive (button, g_PrefsDlg.m_bUseCustomEditor);
2643 // Add the page to the notebook
2644 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2646 /******** BSP Monitoring group *********/
2647 // this is never displayed if the plugin isn't available
2648 preflabel = gtk_label_new(_("BSP Monitoring"));
2649 gtk_widget_show(preflabel);
2650 pageframe = gtk_frame_new(_("BSP Monitoring"));
2651 gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
2652 gtk_widget_show(pageframe);
2653 vbox = gtk_vbox_new(FALSE, 5);
2654 gtk_widget_show(vbox);
2655 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
2656 gtk_container_add(GTK_CONTAINER(pageframe), vbox);
2658 // Enable BSP process monitoring
2659 check = gtk_check_button_new_with_label (_("Enable BSP process monitoring"));
2660 gtk_widget_show (check);
2661 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2662 g_object_set_data (G_OBJECT (dialog), "check_monitorbsp", check);
2663 gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateSensitivity), this );
2664 AddDialogData (check, &g_PrefsDlg.m_bWatchBSP, DLG_CHECK_BOOL);
2667 check = gtk_check_button_new_with_label (_("Stop compilation on leak"));
2668 gtk_widget_show (check);
2669 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2670 g_object_set_data (G_OBJECT (dialog), "check_leakstop", check);
2671 AddDialogData (check, &g_PrefsDlg.m_bLeakStop, DLG_CHECK_BOOL);
2673 // engine after compile
2674 check = gtk_check_button_new_with_label (_("Run engine after compile"));
2675 gtk_widget_show (check);
2676 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2677 g_object_set_data (G_OBJECT (dialog), "check_runengine", check);
2678 gtk_signal_connect( GTK_OBJECT (check), "clicked", GTK_SIGNAL_FUNC(UpdateSensitivity), this );
2679 AddDialogData( check, &g_PrefsDlg.m_bRunQuake, DLG_CHECK_BOOL );
2681 // sleep mode when running engine
2682 check = gtk_check_button_new_with_label (_("Activate sleep mode when running the engine"));
2683 gtk_widget_show (check);
2684 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2685 g_object_set_data (G_OBJECT (dialog), "check_sleep", check);
2686 AddDialogData( check, &g_PrefsDlg.m_bDoSleep, DLG_CHECK_BOOL );
2688 // use q3map2's texture projection
2689 check = gtk_check_button_new_with_label (_("Texturing compatible with q3map2"));
2690 gtk_widget_show (check);
2691 gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0);
2692 g_object_set_data (G_OBJECT (dialog), "check_q3map2", check);
2693 AddDialogData( check, &g_PrefsDlg.m_bQ3Map2Texturing, DLG_CHECK_BOOL );
2695 // Add the page to the notebook
2696 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
2698 gtk_notebook_set_page(GTK_NOTEBOOK(notebook), PTAB_FRONT);
2703 // end new prefs dialog
2705 void PrefsDlg::LoadTexdefPref(texdef_t* pTexdef, char* pName)
2709 memset(pTexdef, 0, sizeof(texdef_t));
2711 sprintf(buffer, "%s%s", pName, TD_SCALE1_KEY);
2712 mLocalPrefs.GetPref(buffer, &pTexdef->scale[0], 0.5f);
2714 sprintf(buffer, "%s%s", pName, TD_SCALE2_KEY);
2715 mLocalPrefs.GetPref(buffer, &pTexdef->scale[1], 0.5f);
2717 sprintf(buffer, "%s%s", pName, TD_SHIFT1_KEY);
2718 mLocalPrefs.GetPref(buffer, &pTexdef->shift[0], 8.f);
2720 sprintf(buffer, "%s%s", pName, TD_SHIFT2_KEY);
2721 mLocalPrefs.GetPref(buffer, &pTexdef->shift[1], 8.f);
2723 sprintf(buffer, "%s%s", pName, TD_ROTATE_KEY);
2724 mLocalPrefs.GetPref(buffer, &pTexdef->rotate, 45);
2727 void PrefsDlg::UpdateTextureCompression()
2729 // if OpenGL is not ready yet, don't do anything
2730 if (!g_qeglobals.m_bOpenGLReady) {
2731 Sys_Printf("OpenGL not ready - postpone texture compression capability check\n");
2735 if (g_qeglobals.bTextureCompressionSupported)
2737 if (m_nTextureCompressionFormat >= 2 && !g_qeglobals.m_bS3CompressionSupported)
2739 Sys_Printf("Inconsistant pref setting for texture compression (%d), rolling back\n", m_nTextureCompressionFormat);
2740 m_nTextureCompressionFormat = 1; // if this is not supported either, see below
2742 if (m_nTextureCompressionFormat == 1 && !g_qeglobals.m_bOpenGLCompressionSupported)
2744 Sys_Printf("Inconsistant pref setting for texture compression (GL_COMPRESSED_RGBA), rolling back\n");
2745 m_nTextureCompressionFormat = 0;
2747 switch (m_nTextureCompressionFormat)
2751 g_qeglobals.texture_components = GL_RGBA;
2752 Sys_Printf("texture compression disabled by preferences settings\n");
2757 g_qeglobals.texture_components = GL_COMPRESSED_RGBA;
2758 Sys_Printf("OpenGL texture compression enabled\n");
2763 g_qeglobals.texture_components = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
2764 Sys_Printf("S3TC DXT1 texture compression enabled\n");
2769 g_qeglobals.texture_components = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
2770 Sys_Printf("S3TC DXT3 texture compression enabled\n");
2775 g_qeglobals.texture_components = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
2776 Sys_Printf("S3TC DXT5 texture compression enabled\n");
2783 Sys_Printf("texture compression is not supported by your current graphic card/drivers\n");
2784 g_qeglobals.texture_components = GL_RGBA;
2785 m_nTextureCompressionFormat = 0;
2790 void PrefsDlg::UpdateATIHack() {
2791 // if OpenGL is not ready yet, don't do anything
2792 if (!g_qeglobals.m_bOpenGLReady) {
2793 Sys_Printf("OpenGL not ready - postpone ATI bug workaround setup\n");
2798 qglCullFace = &qglCullFace_ATIHack;
2799 qglDisable = &qglDisable_ATIHack;
2800 qglEnable = &qglEnable_ATIHack;
2801 qglPolygonMode = &qglPolygonMode_ATIHack;
2802 Sys_Printf("ATI bug workaround enabled\n");
2804 qglCullFace = qglCullFace_real;
2805 qglDisable = qglDisable_real;
2806 qglEnable = qglEnable_real;
2807 qglPolygonMode = qglPolygonMode_real;
2808 Sys_Printf("ATI bug workaround disabled\n");
2813 // TTimo: m_strEnginePath has a special status, if not found in registry we need to
2814 // initiliaze it for sure. It is not totally failsafe but we can use the same
2815 // code than in q3map, expecting to find some "quake" above us. If not, we prompt
2816 // for the engine executable path
2817 void PrefsDlg::LoadPrefs ()
2821 // first things first, load prefs from global prefs
2822 mGamesDialog.LoadPrefs();
2824 // if we already have a document loaded, we will free and reload from file
2825 if (mLocalPrefs.InUse()) {
2826 mLocalPrefs.Clear();
2829 // load local.pref file
2830 mLocalPrefs.ReadXMLFile(m_inipath->str);
2832 mLocalPrefs.GetPref(PATCHSHOWBOUNDS_KEY, &g_bPatchShowBounds, FALSE);
2833 mLocalPrefs.GetPref(MOUSE_KEY, &m_nMouse, MOUSE_DEF);
2834 m_nMouseButtons = m_nMouse ? 3 : 2;
2837 // if it's not found here, mainframe.cpp will take care of finding one
2838 mLocalPrefs.GetPref(LASTPROJ_KEY, &m_strLastProject, "");
2839 mLocalPrefs.GetPref(LASTPROJVER_KEY, &m_nLastProjectVer, -1);
2842 // NOTE TTimo: I'm not sure why this is in prefs
2843 // should probably be a project setting
2844 // and I'm not sure that we really have a way to set this reliably either
2846 strPrefab = g_qeglobals.m_strHomeGame.GetBuffer();
2847 strPrefab += g_pGameDescription->mBaseGame.GetBuffer();
2848 strPrefab += "/prefabs/";
2849 mLocalPrefs.GetPref(PREFAB_KEY, &m_strPrefabPath, strPrefab);
2851 mLocalPrefs.GetPref(LASTLIGHTINTENSITY_KEY, &m_iLastLightIntensity, 300);
2852 mLocalPrefs.GetPref(TLOCK_KEY, &m_bTextureLock, TLOCK_DEF);
2853 mLocalPrefs.GetPref(RLOCK_KEY, &m_bRotateLock, TLOCK_DEF);
2854 mLocalPrefs.GetPref(LASTMAP_KEY, &m_strLastMap, "");
2855 mLocalPrefs.GetPref(LOADLAST_KEY, &m_bLoadLast, LOADLAST_DEF);
2856 mLocalPrefs.GetPref(BSP_KEY, &m_bInternalBSP, FALSE);
2857 mLocalPrefs.GetPref(RCLICK_KEY, &m_bRightClick, TRUE);
2858 mLocalPrefs.GetPref(AUTOSAVE_KEY, &m_bAutoSave, TRUE);
2859 mLocalPrefs.GetPref(LOADLASTMAP_KEY, &m_bLoadLastMap, FALSE);
2860 mLocalPrefs.GetPref(TINYBRUSH_KEY, &m_bCleanTiny, FALSE);
2861 mLocalPrefs.GetPref(TINYSIZE_KEY, &m_fTinySize, 0.5f);
2862 mLocalPrefs.GetPref(AUTOSAVETIME_KEY, &m_nAutoSave, 5);
2863 mLocalPrefs.GetPref(SNAPSHOT_KEY, &m_bSnapShots, FALSE);
2864 mLocalPrefs.GetPref(MOVESPEED_KEY, &m_nMoveSpeed, 100);
2865 mLocalPrefs.GetPref(ANGLESPEED_KEY, &m_nAngleSpeed, 3);
2866 mLocalPrefs.GetPref(SETGAME_KEY, &m_bSetGame, FALSE);
2867 mLocalPrefs.GetPref(CAMXYUPDATE_KEY, &m_bCamXYUpdate, TRUE);
2868 mLocalPrefs.GetPref(CAMDRAGMULTISELECT_KEY, &m_nCamDragMultiSelect, TRUE);
2869 mLocalPrefs.GetPref(CAMFREELOOK_KEY, &m_bCamFreeLook, TRUE);
2870 mLocalPrefs.GetPref(CAMINVERSEMOUSE_KEY, &m_bCamInverseMouse, FALSE);
2871 mLocalPrefs.GetPref(CAMDISCRETE_KEY, &m_bCamDiscrete, TRUE);
2872 mLocalPrefs.GetPref(LIGHTDRAW_KEY, &m_bNewLightDraw, TRUE);
2873 mLocalPrefs.GetPref(CUBICCLIP_KEY, &m_bCubicClipping, TRUE);
2874 mLocalPrefs.GetPref(CUBICSCALE_KEY, &m_nCubicScale, 13);
2875 mLocalPrefs.GetPref(ALTEDGE_KEY, &m_bALTEdge, FALSE);
2876 mLocalPrefs.GetPref(FACECOLORS_KEY, &m_bFaceColors, FALSE);
2877 mLocalPrefs.GetPref(XZVIS_KEY, &m_bXZVis, FALSE);
2878 mLocalPrefs.GetPref(YZVIS_KEY, &m_bYZVis, FALSE);
2879 mLocalPrefs.GetPref(ZVIS_KEY, &m_bZVis, FALSE);
2880 mLocalPrefs.GetPref(SIZEPAINT_KEY, &m_bSizePaint, FALSE);
2881 mLocalPrefs.GetPref(DLLENTITIES_KEY, &m_bDLLEntities, FALSE);
2883 mLocalPrefs.GetPref(DETACHABLEMENUS_KEY, &m_bLatchedDetachableMenus, TRUE);
2884 m_bDetachableMenus = m_bLatchedDetachableMenus;
2886 if (g_pGameDescription->mNoPatch)
2888 m_bPatchToolbar = false;
2892 mLocalPrefs.GetPref(PATCHTOOLBAR_KEY, &m_bLatchedPatchToolbar, TRUE);
2893 m_bPatchToolbar = m_bLatchedPatchToolbar;
2896 mLocalPrefs.GetPref(WIDETOOLBAR_KEY, &m_bLatchedWideToolbar, TRUE);
2897 m_bWideToolbar = m_bLatchedWideToolbar;
2899 mLocalPrefs.GetPref(PLUGINTOOLBAR_KEY, &m_bLatchedPluginToolbar, TRUE);
2900 m_bPluginToolbar = m_bLatchedPluginToolbar;
2902 mLocalPrefs.GetPref(WINDOW_KEY, (int*)&m_nLatchedView, WINDOW_DEF);
2903 m_nView = m_nLatchedView;
2905 mLocalPrefs.GetPref(FLOATINGZ_KEY, &m_bLatchedFloatingZ, FALSE);
2906 m_bFloatingZ = m_bLatchedFloatingZ;
2908 mLocalPrefs.GetPref(TEXTUREQUALITY_KEY, &m_nLatchedTextureQuality, 3);
2909 m_nTextureQuality = m_nLatchedTextureQuality;
2911 mLocalPrefs.GetPref(LOADSHADERS_KEY, &m_nLatchedShader, 0);
2912 m_nShader = m_nLatchedShader;
2914 mLocalPrefs.GetPref(NOCLAMP_KEY, &m_bNoClamp, FALSE);
2915 mLocalPrefs.GetPref(USERINI_KEY, &m_strUserPath, "");
2916 mLocalPrefs.GetPref(ROTATION_KEY, &m_nRotation, 45);
2917 mLocalPrefs.GetPref(CHASEMOUSE_KEY, &m_bChaseMouse, TRUE);
2918 mLocalPrefs.GetPref(ENTITYSHOW_KEY, &m_nEntityShowState, ENTITY_SKINNED_BOXED);
2920 // this will probably need to be 75 or 100 for Q1.
2921 mLocalPrefs.GetPref(TEXTURESCALE_KEY, &m_nTextureScale, 50);
2923 // FIXME: Hydra - actually, this stuff is Q1,Q2 and HL specific.
2924 if ( (g_pGameDescription->mGameFile == "hl.game") )
2926 // No BSP monitoring in the default compiler tools for Half-life (yet)
2927 mLocalPrefs.GetPref(WATCHBSP_KEY, &m_bWatchBSP, FALSE);
2929 // Texture subset on by default (HL specific really, because of halflife.wad's size)
2930 mLocalPrefs.GetPref(TEXTURE_KEY, &m_bTextureWindow, TRUE);
2932 else if (g_pGameDescription->quake2)
2934 // BSP monitoring is implemented in Quake2 and Heretic2 tools
2935 mLocalPrefs.GetPref(WATCHBSP_KEY, &m_bWatchBSP, TRUE);
2937 // Texture subset on by default (HL specific really, because of halflife.wad's size)
2938 mLocalPrefs.GetPref(TEXTURE_KEY, &m_bTextureWindow, TRUE);
2942 mLocalPrefs.GetPref(WATCHBSP_KEY, &m_bWatchBSP, WATCHBSP_DEF);
2943 mLocalPrefs.GetPref(TEXTURE_KEY, &m_bTextureWindow, FALSE);
2947 mLocalPrefs.GetPref(TEXTURESCROLLBAR_KEY, &m_bTextureScrollbar, TRUE);
2948 mLocalPrefs.GetPref(DISPLAYLISTS_KEY, &m_bDisplayLists, TRUE);
2949 mLocalPrefs.GetPref(ANTIALIASEDLINES_KEY, &m_bAntialiasedPointsAndLines, FALSE);
2950 mLocalPrefs.GetPref(SWITCHCLIP_KEY, &m_bSwitchClip, TRUE);
2951 mLocalPrefs.GetPref(SELWHOLEENTS_KEY, &m_bSelectWholeEntities, TRUE);
2952 mLocalPrefs.GetPref(SHOWSHADERS_KEY, &m_bShowShaders, TRUE);
2953 mLocalPrefs.GetPref(GLLIGHTING_KEY, &m_bGLLighting, FALSE);
2954 mLocalPrefs.GetPref(NOSTIPPLE_KEY, &m_bNoStipple, FALSE);
2955 mLocalPrefs.GetPref(UNDOLEVELS_KEY, &m_nUndoLevels, 30);
2956 mLocalPrefs.GetPref(VERTEXMODE_KEY, &m_bVertexSplit, TRUE);
2957 mLocalPrefs.GetPref(RUNQ2_KEY, &m_bRunQuake, RUNQ2_DEF);
2958 mLocalPrefs.GetPref(LEAKSTOP_KEY, &m_bLeakStop, TRUE);
2959 mLocalPrefs.GetPref(DOSLEEP_KEY, &m_bDoSleep, FALSE);
2960 mLocalPrefs.GetPref(SELECTCURVES_KEY, &m_bSelectCurves, TRUE);
2961 mLocalPrefs.GetPref(SELECTMODELS_KEY, &m_bSelectModels, TRUE);
2962 mLocalPrefs.GetPref(SHADERLISTONLY_KEY, &m_bTexturesShaderlistOnly, FALSE);
2963 mLocalPrefs.GetPref(SUBDIVISIONS_KEY, &m_nSubdivisions, SUBDIVISIONS_DEF);
2964 mLocalPrefs.GetPref(CLIPCAULK_KEY, &m_bClipCaulk, FALSE);
2965 mLocalPrefs.GetPref(SNAPTTOGRID_KEY, &m_bSnapTToGrid, FALSE);
2966 mLocalPrefs.GetPref(TARGETFIX_KEY, &m_bDoTargetFix, TRUE);
2967 mLocalPrefs.GetPref(WHEELINC_KEY, &m_nWheelInc, 64);
2968 mLocalPrefs.GetPref(PATCHBBOXSEL_KEY, &m_bPatchBBoxSelect, FALSE);
2970 // Gef: Kyro GL_POINT workaround
2971 mLocalPrefs.GetPref(GLPOINTWORKAROUND_KEY, &m_bGlPtWorkaround, FALSE);
2973 // window positioning
2974 mLocalPrefs.GetPref(ENTITYSPLIT1_KEY, &mWindowInfo.nEntitySplit1, -1);
2975 mLocalPrefs.GetPref(ENTITYSPLIT2_KEY, &mWindowInfo.nEntitySplit2, -1);
2977 mLocalPrefs.GetPref(POSITIONX_KEY, &mWindowInfo.position.x, -1);
2978 mLocalPrefs.GetPref(POSITIONY_KEY, &mWindowInfo.position.y, -1);
2979 mLocalPrefs.GetPref(WIDTH_KEY, &mWindowInfo.position.w, -1);
2980 mLocalPrefs.GetPref(HEIGHT_KEY, &mWindowInfo.position.h, 450);
2982 const window_position_t default_window_pos = { 0, 0, 200, 200, };
2984 mLocalPrefs.GetPref(ENTITYWND_KEY, &mWindowInfo.posEntityWnd, default_window_pos);
2985 mLocalPrefs.GetPref(MAPINFOWND_KEY, &mWindowInfo.posMapInfoWnd, default_window_pos);
2986 mLocalPrefs.GetPref(CAMWND_KEY, &mWindowInfo.posCamWnd, default_window_pos);
2987 mLocalPrefs.GetPref(ZWND_KEY, &mWindowInfo.posZWnd, default_window_pos);
2988 mLocalPrefs.GetPref(XYWND_KEY, &mWindowInfo.posXYWnd, default_window_pos);
2989 mLocalPrefs.GetPref(YZWND_KEY, &mWindowInfo.posYZWnd, default_window_pos);
2990 mLocalPrefs.GetPref(XZWND_KEY, &mWindowInfo.posXZWnd, default_window_pos);
2991 mLocalPrefs.GetPref(PATCHWND_KEY, &mWindowInfo.posPatchWnd, default_window_pos);
2992 mLocalPrefs.GetPref(SURFACEWND_KEY, &mWindowInfo.posSurfaceWnd, default_window_pos);
2993 mLocalPrefs.GetPref(ENTITYINFOWND_KEY, &mWindowInfo.posEntityInfoWnd, default_window_pos);
2995 mLocalPrefs.GetPref(ZWIDTH_KEY, &mWindowInfo.nZWidth, 30);
2996 mLocalPrefs.GetPref(XYHEIGHT_KEY, &mWindowInfo.nXYHeight, 300);
2997 mLocalPrefs.GetPref(XYWIDTH_KEY, &mWindowInfo.nXYWidth, 300);
2998 mLocalPrefs.GetPref(CAMWIDTH_KEY, &mWindowInfo.nCamWidth, 200);
2999 mLocalPrefs.GetPref(CAMHEIGHT_KEY, &mWindowInfo.nCamHeight, 200);
3000 mLocalPrefs.GetPref(ZFLOATWIDTH_KEY, &mWindowInfo.nZFloatWidth, 300);
3002 mLocalPrefs.GetPref(STATE_KEY, &mWindowInfo.nState, SW_SHOW);
3006 mLocalPrefs.GetPref(COUNT_KEY, &m_nMRUCount, 0);
3007 for(i = 0; i < 4; i++)
3010 sprintf (buf, "%s%d", FILE_KEY, i);
3011 mLocalPrefs.GetPref(buf, &m_strMRUFiles[i], "");
3014 // some platform specific prefs
3016 mLocalPrefs.GetPref(NATIVEGUI_KEY, &m_bNativeGUI, TRUE);
3017 mLocalPrefs.GetPref(STARTONPRIMMON_KEY, &m_bStartOnPrimMon, FALSE);
3020 mLocalPrefs.GetPref(SI_TEXMENU_KEY, &g_qeglobals.d_savedinfo.iTexMenu, ID_VIEW_BILINEARMIPMAP);
3021 mLocalPrefs.GetPref(SI_GAMMA_KEY, &g_qeglobals.d_savedinfo.fGamma, 1.0f);
3022 mLocalPrefs.GetPref(SI_EXCLUDE_KEY, &g_qeglobals.d_savedinfo.exclude, 0); // nothing filtered by default
3023 mLocalPrefs.GetPref(SI_INCLUDE_KEY, &g_qeglobals.d_savedinfo.include, INCLUDE_NAMES | INCLUDE_COORDS | INCLUDE_ANGLES | INCLUDE_CAMERATINT);
3024 mLocalPrefs.GetPref(SI_SHOWNAMES_KEY, &g_qeglobals.d_savedinfo.show_names, FALSE);
3025 mLocalPrefs.GetPref(SI_SHOWCOORDS_KEY, &g_qeglobals.d_savedinfo.show_coordinates, TRUE);
3026 mLocalPrefs.GetPref(SI_SHOWANGLES_KEY, &g_qeglobals.d_savedinfo.show_angles, TRUE);
3027 mLocalPrefs.GetPref(SI_SHOWOUTLINES_KEY, &g_qeglobals.d_savedinfo.show_outline, FALSE);
3028 mLocalPrefs.GetPref(SI_SHOWAXIS_KEY, &g_qeglobals.d_savedinfo.show_axis, TRUE);
3029 mLocalPrefs.GetPref(SI_NOSELOUTLINES_KEY, &g_qeglobals.d_savedinfo.bNoSelectedOutlines, FALSE);
3031 mLocalPrefs.GetPref(SI_OUTLINESTYLE_KEY, &g_qeglobals.d_savedinfo.iSelectedOutlinesStyle, OUTLINE_ZBUF|OUTLINE_BSEL);
3033 LoadTexdefPref(&g_qeglobals.d_savedinfo.m_SIIncrement, SI_SURFACE_TEXDEF_KEY);
3034 LoadTexdefPref(&g_qeglobals.d_savedinfo.m_PIIncrement, SI_PATCH_TEXDEF_KEY);
3036 // text editor binding
3038 mLocalPrefs.GetPref(CUSTOMSHADEREDITOR_KEY, &m_bUseWin32Editor, TRUE);
3040 mLocalPrefs.GetPref(CUSTOMSHADEREDITOR_KEY, &m_bUseCustomEditor, FALSE);
3041 mLocalPrefs.GetPref(CUSTOMSHADEREDITORCOMMAND_KEY, &m_strEditorCommand, "");
3045 vec3_t vDefaultAxisColours[3] = {
3051 for(i = 0; i < 3; i++) {
3053 sprintf(buf, "%s%d", SI_AXISCOLORS_KEY, i);
3054 mLocalPrefs.GetPref(buf, g_qeglobals.d_savedinfo.AxisColors[i], vDefaultAxisColours[i]);
3057 vec3_t vDefaultColours[COLOR_LAST] = {
3058 {0.25f, 0.25f, 0.25f},
3060 {0.75f, 0.75f, 0.75f},
3062 {0.25f, 0.25f, 0.25f},
3075 for(i = 0; i < COLOR_LAST; i++) {
3077 sprintf(buf, "%s%d", SI_COLORS_KEY, i);
3078 mLocalPrefs.GetPref(buf, g_qeglobals.d_savedinfo.colors[i], vDefaultColours[i]);
3081 mLocalPrefs.GetPref(TEXTURECOMPRESSIONFORMAT_KEY, &m_nTextureCompressionFormat, 1);
3083 mLocalPrefs.GetPref(LIGHTRADIUS_KEY, &m_nLightRadiuses, TRUE);
3085 mLocalPrefs.GetPref(Q3MAP2TEX_KEY, &m_bQ3Map2Texturing, TRUE);
3088 mLocalPrefs.GetPref(ATIHACK_KEY, &m_bGlATIHack, FALSE);
3091 Undo_SetMaxSize(m_nUndoLevels); // set it internally as well / FIXME: why not just have one global value?
3093 UpdateTextureCompression();
3099 if (mLocalPrefs.mbEmpty)
3101 mLocalPrefs.mbEmpty = false;
3102 Sys_Printf("Saving local.pref with default pref values\n");
3107 void PrefsDlg::SavePrefs ()
3109 if (g_qeglobals.disable_ini)
3113 Sys_Printf("PrefsDlg::SavePrefs\n");
3116 // this will take care of copying back from the dialog to the variables
3117 // NOTE: it may be overkill to call systematically before a SavePrefs, but it's safer
3118 // this will also cause an UpdateData for the mGamesDialog
3121 mGamesDialog.SavePrefs();
3123 // update the tree and save it
3124 mLocalPrefs.UpdatePrefTree();
3125 if (!mLocalPrefs.WriteXMLFile(m_inipath->str))
3126 Sys_FPrintf(SYS_ERR, "Error occured while saving local prefs file '%s'\n", m_inipath->str);
3128 if ( m_nMouse == 0 ) {
3129 m_nMouseButtons = 2;
3131 m_nMouseButtons = 3;
3136 void PrefsDlg::PostModal (int code)
3141 // make sure the logfile is ok
3147 g_pParentWnd->SetGridStatus();
3148 Sys_UpdateWindows(W_ALL);
3149 if (m_nUndoLevels != 0)
3150 Undo_SetMaxSize(m_nUndoLevels);
3154 void PrefsDlg::DoEditorSensitivity()
3156 if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(g_object_get_data (G_OBJECT(m_pWidget), "check_customeditor"))))
3158 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "label_customeditor")), TRUE);
3159 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "entry_customeditor")), TRUE);
3160 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "button_customeditor")), TRUE);
3164 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "label_customeditor")), FALSE);
3165 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "entry_customeditor")), FALSE);
3166 gtk_widget_set_sensitive(GTK_WIDGET(g_object_get_data (G_OBJECT(m_pWidget), "button_customeditor")), FALSE);
3170 void PrefsDlg::DoSensitivity()
3173 // first, look at the project file version ... will monitoring work?
3174 // project files now XML, guaranteed to be at least version 2
3175 if (0)//IntForKey( g_qeglobals.d_project_entity, "version" ) < 2)
3180 Msg = "The current project file (";
3181 Msg += g_PrefsDlg.m_strLastProject;
3182 Msg += ") is not at least version 2.\nI need version 2 or above to setup BSP monitoring correctly.";
3183 gtk_MessageBox(m_pWidget, Msg.GetBuffer(), MB_OK );
3188 // go ahead, disable everybuddy
3189 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_leakstop" )), FALSE );
3190 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_monitorbsp" )), FALSE );
3191 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_runengine" )), FALSE );
3192 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_sleep" )), FALSE );
3199 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_leakstop" )), TRUE );
3200 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_monitorbsp" )), TRUE );
3201 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_runengine" )), TRUE );
3202 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_sleep" )), TRUE );
3204 if ( ! gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( g_object_get_data( G_OBJECT(m_pWidget), "check_monitorbsp" ) ) ) )
3206 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_leakstop" )), FALSE );
3207 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_runengine" )), FALSE );
3208 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_sleep" )), FALSE );
3209 } else if (! gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( g_object_get_data( G_OBJECT(m_pWidget), "check_runengine" ) ) ) )
3211 gtk_widget_set_sensitive( GTK_WIDGET(g_object_get_data( G_OBJECT(m_pWidget), "check_sleep" )), FALSE );
3216 ============================================================
3218 ============================================================
3221 CGameInstall::CGameInstall() {
3222 memset( m_availGames, 0, sizeof( m_availGames ) );
3225 void CGameInstall::OnBtnBrowseEngine( GtkWidget *widget, gpointer data ) {
3226 Sys_Printf( "OnBtnBrowseEngine\n" );
3228 CGameInstall* i = static_cast<CGameInstall*>( data );
3229 char *dir = dir_dialog( widget, _("Select game directory"), NULL );
3231 i->UpdateData( TRUE );
3233 if ( dir != NULL ) {
3234 i->m_strEngine = dir;
3235 i->UpdateData( FALSE );
3240 void CGameInstall::OnGameSelectChanged( GtkWidget *widget, gpointer data ) {
3241 Sys_Printf( "OnGameSelectChanged\n" );
3243 CGameInstall* i = static_cast<CGameInstall*>( data );
3244 i->UpdateData( TRUE );
3245 i->m_strName = gtk_combo_box_get_active_text( GTK_COMBO_BOX( widget ) );
3246 i->UpdateData( FALSE );
3249 void CGameInstall::BuildDialog() {
3250 GtkWidget *dlg, *vbox1, *button, *text, *combo, *entry, *hbox;
3253 gtk_window_set_title( GTK_WINDOW( dlg ), _("Configure games") );
3255 vbox1 = gtk_vbox_new( FALSE, 0 );
3256 gtk_widget_show( vbox1 );
3257 gtk_container_add( GTK_CONTAINER( dlg ), vbox1 );
3259 text = gtk_label_new( _("Select the game to configure") );
3260 gtk_widget_show( text );
3261 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 );
3263 combo = gtk_combo_box_new_text();
3264 gtk_widget_show( combo );
3265 gtk_box_pack_start( GTK_BOX( vbox1 ), combo, FALSE, FALSE, 0 );
3267 // GList *combo_list = NULL;
3269 while ( m_availGames[ iGame ] != GAME_NONE ) {
3270 switch ( m_availGames[ iGame ] ) {
3272 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Quake II") );
3275 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Quake III Arena and mods") );
3278 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Urban Terror (standalone)") );
3281 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("UFO: Alien Invasion") );
3284 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Quake2World") );
3287 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Warsow") );
3290 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Nexuiz") );
3292 case GAME_TREMULOUS:
3293 gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Tremulous") );
3298 AddDialogData( combo, &m_nComboSelect, DLG_COMBO_BOX_INT );
3299 gtk_signal_connect( GTK_OBJECT( combo ), "changed", G_CALLBACK( OnGameSelectChanged ), this );
3300 gtk_combo_box_set_active( GTK_COMBO_BOX( combo ), 0 ); // NOTE: will trigger signal
3302 text = gtk_label_new( _("Name:") );
3303 gtk_widget_show( text );
3304 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 );
3306 entry = gtk_entry_new();
3307 gtk_widget_show( entry );
3308 gtk_box_pack_start( GTK_BOX( vbox1 ), entry, FALSE, FALSE, 0 );
3309 AddDialogData( entry, &m_strName, DLG_ENTRY_TEXT );
3311 text = gtk_label_new( _("Engine directory:") );
3312 gtk_widget_show( text );
3313 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 );
3315 hbox = gtk_hbox_new( FALSE, 0 );
3316 gtk_widget_show( hbox );
3317 gtk_box_pack_start( GTK_BOX( vbox1 ), hbox, FALSE, FALSE, 0 );
3319 entry = gtk_entry_new();
3320 gtk_widget_show( entry );
3321 gtk_box_pack_start( GTK_BOX( hbox ), entry, FALSE, FALSE, 0 );
3322 AddDialogData( entry, &m_strEngine, DLG_ENTRY_TEXT );
3324 button = gtk_button_new_with_label (_("..."));
3325 gtk_widget_show( button );
3326 gtk_signal_connect( GTK_OBJECT( button ), "clicked", GTK_SIGNAL_FUNC( OnBtnBrowseEngine ), this );
3327 gtk_box_pack_start( GTK_BOX( hbox ), button, FALSE, FALSE, 0 );
3329 // this gets done in the project stuff atm
3331 text = gtk_label_new( _("Mod subdirectory:") );
3332 gtk_widget_show( text );
3333 gtk_box_pack_start( GTK_BOX( vbox1 ), text, FALSE, FALSE, 0 );
3335 entry = gtk_entry_new();
3336 gtk_widget_show( entry );
3337 gtk_box_pack_start( GTK_BOX( vbox1 ), entry, FALSE, FALSE, 0 );
3338 AddDialogData( entry, &m_strMod, DLG_ENTRY_TEXT );
3341 button = gtk_button_new_with_label( _("OK") );
3342 gtk_widget_show( button );
3343 gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
3344 AddModalButton( button, IDOK );
3346 button = gtk_button_new_with_label( _("Cancel") );
3347 gtk_widget_show( button );
3348 gtk_box_pack_start( GTK_BOX( vbox1 ), button, FALSE, FALSE, 0 );
3349 AddModalButton( button, IDCANCEL );
3351 gtk_widget_set_usize( button, 60, -2 );
3354 void CGameInstall::Run() {
3356 if ( DoModal() == IDCANCEL ) {
3357 Sys_Printf( "game dialog cancelled\n" );
3360 Sys_Printf( "combo: %d name: %s engine: %s mod: %s\n", m_nComboSelect, m_strName.GetBuffer(), m_strEngine.GetBuffer(), m_strMod.GetBuffer() );
3362 // write out the game file
3363 Str gameFilePath = g_strAppPath.GetBuffer();
3364 gameFilePath += "games/";
3365 gameFilePath += m_strName.GetBuffer();
3366 gameFilePath += ".game";
3367 Sys_Printf( "game file: %s\n", gameFilePath.GetBuffer() );
3369 FILE *fg = fopen( gameFilePath.GetBuffer(), "w" );
3371 Error( "Failed to open %s for writing\n", gameFilePath.GetBuffer() );
3373 fprintf( fg, "<?xml version=\"1.0\" encoding=\"iso-8859-1\" standalone=\"yes\"?>\n<game\n" );
3374 fprintf( fg, " name=\"%s\"\n", m_strName.GetBuffer() );
3375 fprintf( fg, " "ENGINEPATH_ATTRIBUTE"=\"%s\"\n", m_strEngine.GetBuffer() );
3376 switch ( m_availGames[ m_nComboSelect ] ) {
3378 fprintf( fg, " gametools=\"%sinstalls/Quake2Pack/game\"\n", g_strAppPath.GetBuffer() );
3379 fprintf( fg, " prefix=\".quake2\"\n" );
3380 Str source = g_strAppPath.GetBuffer();
3381 source += "installs/";
3383 source += "/install/";
3384 Str dest = m_strEngine.GetBuffer();
3385 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3386 fprintf( fg, " basegame=\"baseq2\"\n" );
3390 fprintf( fg, " gametools=\"%sinstalls/Q3Pack/game\"\n", g_strAppPath.GetBuffer() );
3391 fprintf( fg, " prefix=\".q3a\"\n" );
3392 Str source = g_strAppPath.GetBuffer();
3393 source += "installs/";
3395 source += "/install/";
3396 Str dest = m_strEngine.GetBuffer();
3397 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3398 fprintf( fg, " basegame=\"baseq3\"\n" );
3402 fprintf( fg, " gametools=\"%sinstalls/UrTPack/game\"\n", g_strAppPath.GetBuffer() );
3403 fprintf( fg, " prefix=\".q3a\"\n" );
3404 Str source = g_strAppPath.GetBuffer();
3405 source += "installs/";
3407 source += "/install/";
3408 Str dest = m_strEngine.GetBuffer();
3409 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3410 fprintf( fg, " basegame=\"q3ut4\"\n" );
3414 fprintf( fg, " gametools=\"%sinstalls/UFOAIPack/game\"\n", g_strAppPath.GetBuffer() );
3415 fprintf( fg, " prefix=\".ufoai\"\n" );
3416 Str source = g_strAppPath.GetBuffer();
3417 source += "installs/";
3418 source += UFOAI_PACK;
3419 source += "/install/";
3420 Str dest = m_strEngine.GetBuffer();
3421 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3422 fprintf( fg, " basegame=\"base\"\n" );
3426 fprintf( fg, " gametools=\"%sinstalls/Q2WPack/game\"\n", g_strAppPath.GetBuffer() );
3427 fprintf( fg, " prefix=\".quake2world\"\n" );
3428 Str source = g_strAppPath.GetBuffer();
3429 source += "installs/";
3431 source += "/install/";
3432 Str dest = m_strEngine.GetBuffer();
3433 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3434 fprintf( fg, " basegame=\"default\"\n" );
3438 fprintf( fg, " gametools=\"%sinstalls/WarsowPack/game\"\n", g_strAppPath.GetBuffer() );
3439 fprintf( fg, " prefix=\".warsow\"\n" );
3440 Str source = g_strAppPath.GetBuffer();
3441 source += "installs/";
3442 source += WARSOW_PACK;
3443 source += "/install/";
3444 Str dest = m_strEngine.GetBuffer();
3445 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3446 fprintf( fg, " basegame=\"basewsw\"\n" );
3450 fprintf( fg, " gametools=\"%sinstalls/NexuizPack/game\"\n", g_strAppPath.GetBuffer() );
3451 fprintf( fg, " prefix=\".nexuiz\"\n" );
3452 Str source = g_strAppPath.GetBuffer();
3453 source += "installs/";
3454 source += NEXUIZ_PACK;
3455 source += "/install/";
3456 Str dest = m_strEngine.GetBuffer();
3457 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3458 fprintf( fg, " basegame=\"data\"\n" );
3461 case GAME_TREMULOUS: {
3462 fprintf( fg, " gametools=\"%sinstalls/TremulousPack/game\"\n", g_strAppPath.GetBuffer() );
3463 fprintf( fg, " prefix=\".tremulous\"\n" );
3464 Str source = g_strAppPath.GetBuffer();
3465 source += "installs/";
3466 source += TREMULOUS_PACK;
3467 source += "/install/";
3468 Str dest = m_strEngine.GetBuffer();
3469 CopyTree( source.GetBuffer(), dest.GetBuffer() );
3470 fprintf( fg, " basegame=\"base\"\n" );
3474 fprintf( fg, "/>\n" );
3480 CGameInstall::ScanGames
3481 scan for active games that can be installed, based on the presence
3484 void CGameInstall::ScanGames() {
3485 Str pakPaths = g_strAppPath.GetBuffer();
3487 const char *dirname;
3489 pakPaths += "installs/";
3490 FindFiles fileScan( pakPaths.GetBuffer() );
3491 while ( ( dirname = fileScan.NextFile() ) != NULL ) {
3492 if ( stricmp( dirname, Q3_PACK ) == 0 ) {
3493 m_availGames[ iGame++ ] = GAME_Q3;
3495 if ( stricmp( dirname, URT_PACK ) == 0 ) {
3496 m_availGames[ iGame++ ] = GAME_URT;
3498 if ( stricmp( dirname, UFOAI_PACK ) == 0 ) {
3499 m_availGames[ iGame++ ] = GAME_UFOAI;
3501 if ( stricmp( dirname, Q2W_PACK ) == 0 ) {
3502 m_availGames[ iGame++ ] = GAME_Q2W;
3504 if ( stricmp( dirname, WARSOW_PACK ) == 0 ) {
3505 m_availGames[ iGame++ ] = GAME_WARSOW;
3507 if ( stricmp( dirname, NEXUIZ_PACK ) == 0 ) {
3508 m_availGames[ iGame++ ] = GAME_NEXUIZ;
3510 if ( stricmp( dirname, Q2_PACK ) == 0 ) {
3511 m_availGames[ iGame++ ] = GAME_Q2;
3513 if ( stricmp( dirname, TREMULOUS_PACK ) == 0 ) {
3514 m_availGames[ iGame++ ] = GAME_TREMULOUS;