#include "missing.h"
#include "gtkmisc.h"
-#ifdef _WIN32
- // sanity check - some gtk2 win32 runtimes replace sprintf
- #if defined( sprintf )
- #error sprintf is a macro. are you sure?
- #endif
-#endif
-
#ifdef _WIN32
#include <io.h>
#define X_OK 0
#define LEAKSTOP_KEY "LeakStop"
#define DOSLEEP_KEY "SleepMode"
#define SUBDIVISIONS_KEY "Subdivisions"
+#define DEFAULTTEXURESCALE_KEY "DefaultTextureScale"
#define CLIPCAULK_KEY "ClipCaulk"
#define PATCHSHOWBOUNDS_KEY "PatchShowBounds"
#define NATIVEGUI_KEY "NativeGUI"
#define TEXTURECOMPRESSIONFORMAT_KEY "TextureCompressionFormat"
#define LIGHTRADIUS_KEY "LightRadiuses"
#define Q3MAP2TEX_KEY "Q3Map2Tex"
+
+#ifdef ATIHACK_812
#define ATIHACK_KEY "ATIHack"
+#endif
+
+#ifdef NVIDIA_AERO_HACK
+#define NVAEROHACK_KEY "NvidiaAeroHack"
+#endif
// window stuff
#define ENTITYSPLIT1_KEY "EntitySplit1"
m_nLightRadiuses = 1;
m_bQ3Map2Texturing = TRUE;
#ifdef ATIHACK_812
- m_bGlATIHack = FALSE;
+ m_bGlATIHack = FALSE;
+#endif
+#ifdef NVIDIA_AERO_HACK
+ m_bGlNvidiaAeroHack = TRUE;
+ m_bGlNvidiaAeroHackPrevState = -1; // -1 is uninitialized, 0 is FALSE, 1 is TRUE
#endif
}
gtk_tree_store_append(store, &tab, &group);
gtk_tree_store_set(store, &tab, 0, _("Paths"), 1, (gpointer)PTAB_PATHS, -1);
}
+ {
+ GtkTreeIter tab;
+ gtk_tree_store_append(store, &tab, &group);
+ gtk_tree_store_set(store, &tab, 0, _("Brush"), 1, (gpointer)PTAB_BRUSH, -1);
+ }
{
GtkTreeIter tab;
gtk_tree_store_append(store, &tab, &group);
g_list_free (combo_list);
#ifdef ATIHACK_812
- // ATI bugs
- check = gtk_check_button_new_with_label (_("ATI cards with broken drivers - bug #802"));
- gtk_widget_show(check);
- gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
- AddDialogData(check, &m_bGlATIHack, DLG_CHECK_BOOL);
+ // ATI bugs
+ check = gtk_check_button_new_with_label (_("ATI and Intel cards w/ buggy drivers (disappearing polygons)"));
+ gtk_widget_show(check);
+ gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
+ AddDialogData(check, &m_bGlATIHack, DLG_CHECK_BOOL);
+#endif
+
+#ifdef NVIDIA_AERO_HACK
+ check = gtk_check_button_new_with_label (_("NVIDIA/Aero bug - disable Windows composition"));
+ gtk_widget_show(check);
+ gtk_box_pack_start(GTK_BOX(vbox), check, FALSE, FALSE, 0);
+ AddDialogData(check, &m_bGlNvidiaAeroHack, DLG_CHECK_BOOL);
#endif
// Add the page to the notebook
// Add the page to the notebook
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
+ /******** Brush group ********/
+ preflabel = gtk_label_new(_("Brush"));
+ gtk_widget_show(preflabel);
+ pageframe = gtk_frame_new(_("Brush"));
+ gtk_container_set_border_width(GTK_CONTAINER(pageframe), 5);
+ gtk_widget_show(pageframe);
+ vbox = gtk_vbox_new(FALSE, 5);
+ gtk_widget_show(vbox);
+ gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
+ gtk_container_add(GTK_CONTAINER(pageframe), vbox);
+
+ // default texture scale
+ // table
+ table = gtk_table_new(2, 1, FALSE); // I believe that the 2 and 1 are switched here, and this is
+ // intentional to be consistent with other calls to gtk_table_new()
+ // [that are probably also switched].
+ gtk_widget_show(table);
+ gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, TRUE, 0);
+ gtk_table_set_row_spacings(GTK_TABLE(table), 5);
+ gtk_table_set_col_spacings(GTK_TABLE(table), 5);
+
+ // label
+ label = gtk_label_new(_("Default texture scale:"));
+ gtk_widget_show(label);
+ gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
+ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
+ (GtkAttachOptions) (0),
+ (GtkAttachOptions) (0), 0, 0);
+
+ // scale entry
+ entry = gtk_entry_new();
+ gtk_widget_show(entry);
+ gtk_widget_set_usize(GTK_WIDGET(entry), 60, -2);
+ gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1,
+ (GtkAttachOptions) (GTK_FILL),
+ (GtkAttachOptions) (0), 0, 0);
+ AddDialogData(entry, &m_fDefTextureScale, DLG_ENTRY_FLOAT);
+
+ // Add the page to the notebook
+ gtk_notebook_append_page(GTK_NOTEBOOK(notebook), pageframe, preflabel);
+
/******** Misc group *********/
preflabel = gtk_label_new(_("Misc"));
gtk_widget_show(preflabel);
}
#endif
+#ifdef NVIDIA_AERO_HACK
+void PrefsDlg::UpdateNvidiaAeroHack() {
+ if (m_bGlNvidiaAeroHack && m_bGlNvidiaAeroHackPrevState == 1) { return; }
+ if ((!m_bGlNvidiaAeroHack) && m_bGlNvidiaAeroHackPrevState == 0) { return; }
+ if ((!m_bGlNvidiaAeroHack) && m_bGlNvidiaAeroHackPrevState < 0) {
+ // The hack state is uninitialized, meaning that this is the first call
+ // to this function. I prefer not to explicitly enable composition because
+ // the user may have set the application to disable it, and I don't want to
+ // override that. Leave the state of composition as-is if the hack checkbox
+ // isn't checked.
+ m_bGlNvidiaAeroHackPrevState = 0;
+ return;
+ }
+ HMODULE lib = LoadLibrary("dwmapi.dll");
+ if (lib) {
+ void (WINAPI *qDwmEnableComposition) (bool bEnable) =
+ (void (WINAPI *) (bool bEnable)) GetProcAddress(lib, "DwmEnableComposition");
+ if (qDwmEnableComposition) {
+ if (m_bGlNvidiaAeroHack) {
+ Sys_Printf("Disabling Windows composition\n");
+ qDwmEnableComposition(0);
+ m_bGlNvidiaAeroHackPrevState = 1;
+ }
+ else {
+ Sys_Printf("Enabling Windows composition\n");
+ qDwmEnableComposition(1);
+ m_bGlNvidiaAeroHackPrevState = 0;
+ }
+ }
+ FreeLibrary(lib);
+ }
+}
+#endif
+
// TTimo: m_strEnginePath has a special status, if not found in registry we need to
// initiliaze it for sure. It is not totally failsafe but we can use the same
// code than in q3map, expecting to find some "quake" above us. If not, we prompt
mLocalPrefs.GetPref(SELECTCURVES_KEY, &m_bSelectCurves, TRUE);
mLocalPrefs.GetPref(SELECTMODELS_KEY, &m_bSelectModels, TRUE);
mLocalPrefs.GetPref(SHADERLISTONLY_KEY, &m_bTexturesShaderlistOnly, FALSE);
+ mLocalPrefs.GetPref(DEFAULTTEXURESCALE_KEY, &m_fDefTextureScale, g_pGameDescription->mTextureDefaultScale);
mLocalPrefs.GetPref(SUBDIVISIONS_KEY, &m_nSubdivisions, SUBDIVISIONS_DEF);
mLocalPrefs.GetPref(CLIPCAULK_KEY, &m_bClipCaulk, FALSE);
mLocalPrefs.GetPref(SNAPTTOGRID_KEY, &m_bSnapTToGrid, FALSE);
mLocalPrefs.GetPref(ATIHACK_KEY, &m_bGlATIHack, FALSE);
#endif
+#ifdef NVIDIA_AERO_HACK
+ mLocalPrefs.GetPref(NVAEROHACK_KEY, &m_bGlNvidiaAeroHack, TRUE);
+#endif
+
Undo_SetMaxSize(m_nUndoLevels); // set it internally as well / FIXME: why not just have one global value?
UpdateTextureCompression();
UpdateATIHack();
#endif
+#ifdef NVIDIA_AERO_HACK
+ UpdateNvidiaAeroHack();
+#endif
+
if (mLocalPrefs.mbEmpty)
{
mLocalPrefs.mbEmpty = false;
SavePrefs();
// make sure the logfile is ok
Sys_LogFile();
- #ifdef ATIHACK_812
- UpdateATIHack();
- #endif
+#ifdef ATIHACK_812
+ UpdateATIHack();
+#endif
+#ifdef NVIDIA_AERO_HACK
+ UpdateNvidiaAeroHack();
+#endif
if (g_pParentWnd)
g_pParentWnd->SetGridStatus();
Sys_UpdateWindows(W_ALL);
case GAME_JA:
gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Jedi Academy and mods") );
break;
+ case GAME_REACTION:
+ gtk_combo_box_append_text( GTK_COMBO_BOX( combo ), _("Reaction Quake 3") );
+ break;
}
iGame++;
}
fprintf( fg, " basegame=\"base\"\n" );
break;
}
+ case GAME_REACTION: {
+ fprintf( fg, " "TOOLS_ATTRIBUTE"=\"%sinstalls/"REACTION_PACK"/game\"\n", g_strAppPath.GetBuffer() );
+ fprintf( fg, " prefix=\".Reaction\"\n" );
+ Str source = g_strAppPath.GetBuffer();
+ source += "installs/";
+ source += REACTION_PACK;
+ source += "/install/";
+ Str dest = m_strEngine.GetBuffer();
+ CopyTree( source.GetBuffer(), dest.GetBuffer() );
+ fprintf( fg, " basegame=\"Boomstick\"\n" );
+ fprintf( fg, " default_scale=\"0.5\"\n" ); // Superfluous because the default is already 0.5,
+ // but demonstrates how to set the default texture scale
+ // for a specific game.
+ break;
+ }
}
fprintf( fg, "/>\n" );
fclose( fg );
if ( stricmp( dirname, JA_PACK ) == 0 ) {
m_availGames[ iGame++ ] = GAME_JA;
}
+ if ( stricmp( dirname, REACTION_PACK ) == 0 ) {
+ m_availGames[ iGame++ ] = GAME_REACTION;
+ }
}
Sys_Printf("No installable games found in: %s\n",
pakPaths.GetBuffer() );