applied from experimental3D, use a slider to set up quality
authorkoda
Mon, 02 Aug 2010 15:23:16 +0200
changeset 3708 64e059b6f9c5
parent 3706 a79784328c03
child 3709 c7849b74748d
applied from experimental3D, use a slider to set up quality
QTfrontend/CMakeLists.txt
QTfrontend/game.cpp
QTfrontend/gameuiconfig.cpp
QTfrontend/gameuiconfig.h
QTfrontend/pages.cpp
QTfrontend/pages.h
QTfrontend/xfire.h
hedgewars/ArgParsers.inc
--- a/QTfrontend/CMakeLists.txt	Mon Aug 02 01:07:51 2010 +0200
+++ b/QTfrontend/CMakeLists.txt	Mon Aug 02 15:23:16 2010 +0200
@@ -31,6 +31,7 @@
 if(WIN32 AND NOT UNIX)
 	set(HEDGEWARS_BINDIR ".")
 	set(HEDGEWARS_DATADIR "../share/")
+        add_definitions(-DUSE_XFIRE)
 else()
 	set(HEDGEWARS_BINDIR ${CMAKE_INSTALL_PREFIX})
 	if(DEFINED DATA_INSTALL_DIR)
--- a/QTfrontend/game.cpp	Mon Aug 02 01:07:51 2010 +0200
+++ b/QTfrontend/game.cpp	Mon Aug 02 15:23:16 2010 +0200
@@ -277,12 +277,8 @@
     arguments << QString("%1").arg(ipc_port);
     arguments << (config->vid_Fullscreen() ? "1" : "0");
     arguments << (config->isSoundEnabled() ? "1" : "0");
-#ifdef _WIN32
-    arguments << (config->isSoundHardware() ? "1" : "0");
-#else
-    arguments << "0";
-#endif
-    arguments << (config->isWeaponTooltip() ? "1" : "0");
+    arguments << "0"; //(config->isSoundHardware() ? "1" : "0");
+    arguments << "0"; //(config->isWeaponTooltip() ? "1" : "0");
     arguments << tr("en.txt");
     arguments << QString::number(config->volume()); // sound volume
     arguments << QString::number(config->timerInterval());
@@ -291,7 +287,7 @@
     arguments << (config->isAltDamageEnabled() ? "1" : "0");
     arguments << config->netNick().toUtf8().toBase64();
     arguments << (config->isMusicEnabled() ? "1" : "0");
-    arguments << (config->isReducedQuality() ? "1" : "0");
+    arguments << QString::number(config->translateQuality());
     return arguments;
 }
 
--- a/QTfrontend/gameuiconfig.cpp	Mon Aug 02 01:07:51 2010 +0200
+++ b/QTfrontend/gameuiconfig.cpp	Mon Aug 02 15:23:16 2010 +0200
@@ -47,13 +47,10 @@
     bool ffscr=value("frontend/fullscreen", false).toBool();
     Form->ui.pageOptions->CBFrontendFullscreen->setChecked(ffscr);
 
-    Form->ui.pageOptions->CBReduceQuality->setChecked(value("video/reducequality", false).toBool());
+    Form->ui.pageOptions->SLQuality->setValue(value("video/quality", 5).toUInt());
     Form->ui.pageOptions->CBFrontendEffects->setChecked(frontendEffects);
     Form->ui.pageOptions->CBEnableSound->setChecked(value("audio/sound", true).toBool());
     Form->ui.pageOptions->CBEnableFrontendSound->setChecked(value("frontend/sound", true).toBool());
-#ifdef _WIN32
-//  Form->ui.pageOptions->CBHardwareSound->setChecked(value("audio/hardware", false).toBool());
-#endif
     Form->ui.pageOptions->CBEnableMusic->setChecked(value("audio/music", true).toBool());
     Form->ui.pageOptions->CBEnableFrontendMusic->setChecked(value("frontend/music", true).toBool());
     Form->ui.pageOptions->volumeBox->setValue(value("audio/volume", 100).toUInt());
@@ -115,11 +112,11 @@
     setValue("video/resolution", Form->ui.pageOptions->CBResolution->currentText());
     setValue("video/fullscreen", vid_Fullscreen());
 
-    setValue("video/reducequality", isReducedQuality());
+    setValue("video/quality", Form->ui.pageOptions->SLQuality->value());
 
     setValue("frontend/effects", isFrontendEffects());
 
-    setValue("misc/weaponTooltips", isWeaponTooltip());
+    setValue("misc/weaponTooltips", Form->ui.pageOptions->WeaponTooltip->isChecked());
 
     bool ffscr = isFrontendFullscreen();
     setValue("frontend/fullscreen", ffscr);
@@ -133,9 +130,6 @@
 
     setValue("audio/sound", isSoundEnabled());
     setValue("frontend/sound", isFrontendSoundEnabled());
-#ifdef _WIN32
-//  setValue("audio/hardware", isSoundHardware());
-#endif
     setValue("audio/music", isMusicEnabled());
     setValue("frontend/music", isFrontendMusicEnabled());
     setValue("audio/volume", Form->ui.pageOptions->volumeBox->value());
@@ -181,20 +175,59 @@
     return Form->ui.pageOptions->CBFullscreen->isChecked();
 }
 
-bool GameUIConfig::isReducedQuality() const
+quint32 GameUIConfig::translateQuality()
 {
-  return Form->ui.pageOptions->CBReduceQuality->isChecked();
+    quint32 rqNone = 0x00000000;  // don't reduce quality
+    quint32 rqLowRes = 0x00000001;  // use half land array
+    quint32 rqBlurryLand = 0x00000002;  // downscaled terrain
+    quint32 rqNoBackground = 0x00000004;  // don't draw background
+    quint32 rqSimpleRope = 0x00000008;  // avoid drawing rope
+    quint32 rq2DWater = 0x00000010;  // disabe 3D water effect
+    quint32 rqFancyBoom = 0x00000020;  // no fancy explosion effects
+    quint32 rqKillFlakes = 0x00000040;  // no flakes
+    quint32 rqSlowMenu = 0x00000080;  // ammomenu appears with no animation
+    quint32 rqPlainSplash = 0x00000100;  // no droplets
+    quint32 rqClampLess = 0x00000200;  // don't clamp textures
+    quint32 rqTooltipsOff = 0x00000400;  // tooltips are not drawn
+    quint32 rqDesyncVBlank = 0x00000800;  // don't sync on vblank
+    
+    quint32 result = (Form->ui.pageOptions->WeaponTooltip->isChecked()) ? rqNone : rqTooltipsOff;
+    
+    switch (Form->ui.pageOptions->SLQuality->value()) {
+      case 5:
+        break;
+      case 4:
+        result |= rqBlurryLand;
+        break;
+      case 3:
+        result |= rqBlurryLand | rqKillFlakes | rqPlainSplash;
+        break;
+      case 2:
+        result |= rqBlurryLand | rqKillFlakes | rqPlainSplash | rq2DWater |
+                  rqFancyBoom | rqSlowMenu;
+        break;
+      case 1:
+        result |= rqBlurryLand | rqKillFlakes | rqPlainSplash | rq2DWater |
+                  rqFancyBoom | rqSlowMenu | rqSimpleRope | rqDesyncVBlank;
+        break;
+      case 0:
+        result |= rqBlurryLand | rqKillFlakes | rqPlainSplash | rq2DWater |
+                  rqFancyBoom | rqSlowMenu | rqSimpleRope | rqDesyncVBlank |
+                  rqNoBackground | rqClampLess;
+        break;
+      default:
+        fprintf(stderr,"unset value from slider");
+        break;
+    }
+    
+    return result;
 }
+
 bool GameUIConfig::isFrontendEffects() const
 {
   return Form->ui.pageOptions->CBFrontendEffects->isChecked();
 }
 
-bool GameUIConfig::isWeaponTooltip() const
-{
-  return Form->ui.pageOptions->WeaponTooltip->isChecked();
-}
-
 bool GameUIConfig::isFrontendFullscreen() const
 {
   return Form->ui.pageOptions->CBFrontendFullscreen->isChecked();
@@ -209,14 +242,6 @@
     return Form->ui.pageOptions->CBEnableFrontendSound->isChecked();
 }
 
-#ifdef _WIN32
-bool GameUIConfig::isSoundHardware()
-{
-//  return Form->ui.pageOptions->CBHardwareSound->isChecked();
-return false;
-}
-#endif
-
 bool GameUIConfig::isMusicEnabled()
 {
     return Form->ui.pageOptions->CBEnableMusic->isChecked();
--- a/QTfrontend/gameuiconfig.h	Mon Aug 02 01:07:51 2010 +0200
+++ b/QTfrontend/gameuiconfig.h	Mon Aug 02 15:23:16 2010 +0200
@@ -35,12 +35,10 @@
     QStringList GetTeamsList();
     QRect vid_Resolution();
     bool vid_Fullscreen();
+    quint32 translateQuality();
     bool isSoundEnabled();
     bool isFrontendSoundEnabled();
     QString language();
-#ifdef _WIN32
-    bool isSoundHardware();
-#endif
     bool isMusicEnabled();
     bool isFrontendMusicEnabled();
     bool isShowFPSEnabled();
@@ -53,7 +51,6 @@
     bool isReducedQuality() const;
     bool isFrontendEffects() const;
     bool isFrontendFullscreen() const;
-    bool isWeaponTooltip() const;
     void resizeToConfigValues();
 
 #ifdef __APPLE__
--- a/QTfrontend/pages.cpp	Mon Aug 02 01:07:51 2010 +0200
+++ b/QTfrontend/pages.cpp	Mon Aug 02 15:23:16 2010 +0200
@@ -39,7 +39,7 @@
 #include <QMenu>
 #include <QDataWidgetMapper>
 #include <QTime>
-
+#include <QSlider>
 
 #include "ammoSchemeModel.h"
 #include "pages.h"
@@ -573,6 +573,7 @@
 
             QVBoxLayout * GBAlayout = new QVBoxLayout(AGGroupBox);
             QHBoxLayout * GBAreslayout = new QHBoxLayout(0);
+            QHBoxLayout * GBAqualayout = new QHBoxLayout(0);
 
             CBFrontendFullscreen = new QCheckBox(AGGroupBox);
             CBFrontendFullscreen->setText(QCheckBox::tr("Frontend fullscreen"));
@@ -608,9 +609,17 @@
             CBFullscreen->setText(QCheckBox::tr("Fullscreen"));
             GBAlayout->addWidget(CBFullscreen);
 
-            CBReduceQuality = new QCheckBox(AGGroupBox);
-            CBReduceQuality->setText(QCheckBox::tr("Reduced quality"));
-            GBAlayout->addWidget(CBReduceQuality);
+            QLabel * quality = new QLabel(AGGroupBox);
+            quality->setText(QLabel::tr("Quality"));
+            GBAqualayout->addWidget(quality);
+            
+            SLQuality = new QSlider(Qt::Horizontal, AGGroupBox);
+            SLQuality->setTickPosition(QSlider::TicksBelow);
+            SLQuality->setMaximum(5);
+            SLQuality->setMinimum(0);
+            SLQuality->setFixedWidth(150);
+            GBAqualayout->addWidget(SLQuality);
+            GBAlayout->addLayout(GBAqualayout);
 
             hr = new QFrame(AGGroupBox);
             hr->setFrameStyle(QFrame::HLine);
--- a/QTfrontend/pages.h	Mon Aug 02 01:07:51 2010 +0200
+++ b/QTfrontend/pages.h	Mon Aug 02 15:23:16 2010 +0200
@@ -48,6 +48,7 @@
 class QDataWidgetMapper;
 class QAbstractItemModel;
 class QSettings;
+class QSlider;
 
 class GameCFGWidget;
 class TeamSelWidget;
@@ -221,9 +222,6 @@
     QComboBox *CBResolution;
     QCheckBox *CBEnableSound;
     QCheckBox *CBEnableFrontendSound;
-#ifdef _WIN32
-    QCheckBox *CBHardwareSound;
-#endif
     QCheckBox *CBEnableMusic;
     QCheckBox *CBEnableFrontendMusic;
     QCheckBox *CBFullscreen;
@@ -240,7 +238,7 @@
     QLabel *labelNN;
     QSpinBox * volumeBox;
     QLineEdit *editNetNick;
-    QCheckBox *CBReduceQuality;
+    QSlider *SLQuality;
     QCheckBox *CBFrontendEffects;
 };
 
--- a/QTfrontend/xfire.h	Mon Aug 02 01:07:51 2010 +0200
+++ b/QTfrontend/xfire.h	Mon Aug 02 15:23:16 2010 +0200
@@ -19,10 +19,6 @@
 #ifndef XFIRE_H
 #define XFIRE_H
 
-#ifdef _WIN32
-// TODO: Move to CMAKE
-#define USE_XFIRE
-#endif
 
 #ifdef USE_XFIRE
 enum XFIRE_KEYS
--- a/hedgewars/ArgParsers.inc	Mon Aug 02 01:07:51 2010 +0200
+++ b/hedgewars/ArgParsers.inc	Mon Aug 02 15:23:16 2010 +0200
@@ -26,16 +26,8 @@
     cAltDamage:= ParamStr(15) = '1';
     UserNick:= DecodeBase64(ParamStr(16));
     isMusicEnabled:= ParamStr(17) = '1';
+    val(ParamStr(18), cReducedQuality);
 
-    if (ParamStr(18) = '1') then        //HACK - always disable rqLowRes as it is a game breaker
-        cReducedQuality:= $FFFFFFFF xor rqLowRes
-    else
-        val(ParamStr(18), cReducedQuality);
-    
-    if (ParamStr(8) = '0') then         //HACK - ifcVSyncInUse not true, disable it
-        cReducedQuality:= cReducedQuality xor rqDesyncVBlank;
-    if (ParamStr(9) = '0') then         //HACK - if cWeaponTooltips not true, disable it
-        cReducedQuality:= cReducedQuality xor rqTooltipsOff;
 end;
 
 procedure setVideo(screenWidth: LongInt; screenHeight: LongInt; bitsStr: LongInt);