new quality slider widget (needs to be customized), removed obsolete arguments experimental3D
authorkoda
Mon, 02 Aug 2010 15:05:56 +0200
branchexperimental3D
changeset 3694 3e9c0634065c
parent 3692 bbec1275e46f
child 3696 6009d8378422
new quality slider widget (needs to be customized), removed obsolete arguments
QTfrontend/CMakeLists.txt
QTfrontend/game.cpp
QTfrontend/gameuiconfig.cpp
QTfrontend/gameuiconfig.h
QTfrontend/pages.cpp
QTfrontend/pages.h
QTfrontend/xfire.h
hedgewars/hwengine.pas
hedgewars/uMisc.pas
--- a/QTfrontend/CMakeLists.txt	Mon Aug 02 12:24:06 2010 +0200
+++ b/QTfrontend/CMakeLists.txt	Mon Aug 02 15:05:56 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 12:24:06 2010 +0200
+++ b/QTfrontend/game.cpp	Mon Aug 02 15:05:56 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());
     arguments << (config->isStereoEnabled() ? "1" : "0");
     return arguments;
 }
--- a/QTfrontend/gameuiconfig.cpp	Mon Aug 02 12:24:06 2010 +0200
+++ b/QTfrontend/gameuiconfig.cpp	Mon Aug 02 15:05:56 2010 +0200
@@ -47,14 +47,11 @@
     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->CBEnableStereo->setChecked(value("video/anaglyph", false).toBool());
     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());
@@ -116,12 +113,12 @@
     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("video/anaglyph", isStereoEnabled());
 
     setValue("frontend/effects", isFrontendEffects());
 
-    setValue("misc/weaponTooltips", isWeaponTooltip());
+    setValue("misc/weaponTooltips", Form->ui.pageOptions->WeaponTooltip->isChecked());
 
     bool ffscr = isFrontendFullscreen();
     setValue("frontend/fullscreen", ffscr);
@@ -135,9 +132,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());
@@ -183,20 +177,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();
@@ -211,14 +244,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 12:24:06 2010 +0200
+++ b/QTfrontend/gameuiconfig.h	Mon Aug 02 15:05:56 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();
     bool isStereoEnabled() const;
 
--- a/QTfrontend/pages.cpp	Mon Aug 02 12:24:06 2010 +0200
+++ b/QTfrontend/pages.cpp	Mon Aug 02 15:05:56 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);
 
             CBEnableStereo = new QCheckBox(AGGroupBox);
             CBEnableStereo->setText(QCheckBox::tr("Anaglyph rendering (red/cyan)"));
--- a/QTfrontend/pages.h	Mon Aug 02 12:24:06 2010 +0200
+++ b/QTfrontend/pages.h	Mon Aug 02 15:05:56 2010 +0200
@@ -48,6 +48,7 @@
 class QDataWidgetMapper;
 class QAbstractItemModel;
 class QSettings;
+class QSlider;
 
 class GameCFGWidget;
 class TeamSelWidget;
@@ -222,9 +223,6 @@
     QCheckBox *CBEnableSound;
     QCheckBox *CBEnableFrontendSound;
     QCheckBox *CBEnableStereo;
-#ifdef _WIN32
-    QCheckBox *CBHardwareSound;
-#endif
     QCheckBox *CBEnableMusic;
     QCheckBox *CBEnableFrontendMusic;
     QCheckBox *CBFullscreen;
@@ -241,7 +239,7 @@
     QLabel *labelNN;
     QSpinBox * volumeBox;
     QLineEdit *editNetNick;
-    QCheckBox *CBReduceQuality;
+    QSlider *SLQuality;
     QCheckBox *CBFrontendEffects;
 };
 
--- a/QTfrontend/xfire.h	Mon Aug 02 12:24:06 2010 +0200
+++ b/QTfrontend/xfire.h	Mon Aug 02 15:05:56 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/hwengine.pas	Mon Aug 02 12:24:06 2010 +0200
+++ b/hedgewars/hwengine.pas	Mon Aug 02 15:05:56 2010 +0200
@@ -457,17 +457,8 @@
             cAltDamage:= ParamStr(15) = '1';
             UserNick:= DecodeBase64(ParamStr(16));
             isMusicEnabled:= ParamStr(17) = '1';
+            val(ParamStr(18), cReducedQuality);
             isStereoEnabled:= ParamStr(19) = '1';
-
-            if (ParamStr(18) = '1') then        //HACK - always disable rqLowRes as it's 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;
         3: begin
             val(ParamStr(2), ipcPort);
--- a/hedgewars/uMisc.pas	Mon Aug 02 12:24:06 2010 +0200
+++ b/hedgewars/uMisc.pas	Mon Aug 02 15:05:56 2010 +0200
@@ -35,8 +35,6 @@
     isSpeed         : boolean;
     isFirstFrame    : boolean;
 
-    isStereoEnabled : boolean = true;
-
     isStereoEnabled : boolean;
 
     fastUntilLag    : boolean;