Configuration for tag display default
authornemo
Sun, 23 Jun 2013 17:11:29 -0400
changeset 9249 7b8c82785145
parent 9247 68bbe56badcc
child 9251 6c238c897213
Configuration for tag display default
QTfrontend/game.cpp
QTfrontend/gameuiconfig.cpp
QTfrontend/hwform.cpp
QTfrontend/ui/page/pageoptions.cpp
QTfrontend/ui/page/pageoptions.h
hedgewars/ArgParsers.inc
hedgewars/hwengine.pas
hedgewars/uConsts.pas
hedgewars/uGearsRender.pas
hedgewars/uVariables.pas
--- a/QTfrontend/game.cpp	Sun Jun 23 13:35:26 2013 -0400
+++ b/QTfrontend/game.cpp	Sun Jun 23 17:11:29 2013 -0400
@@ -17,6 +17,7 @@
  */
 
 #include <QString>
+#include <QCheckBox>
 #include <QByteArray>
 #include <QUuid>
 #include <QColor>
@@ -415,6 +416,15 @@
         arguments << nick;
     }
 
+    if (!config->Form->ui.pageOptions->CBTeamTag->isChecked())
+        arguments << "--no-teamtag";
+    if (!config->Form->ui.pageOptions->CBHogTag->isChecked())
+        arguments << "--no-hogtag";
+    if (!config->Form->ui.pageOptions->CBHealthTag->isChecked())
+        arguments << "--no-healthtag";
+    if (config->Form->ui.pageOptions->CBTagOpacity->isChecked())
+        arguments << "--translucent-tags";
+
     return arguments;
 }
 
--- a/QTfrontend/gameuiconfig.cpp	Sun Jun 23 13:35:26 2013 -0400
+++ b/QTfrontend/gameuiconfig.cpp	Sun Jun 23 17:11:29 2013 -0400
@@ -139,9 +139,14 @@
     Form->ui.pageOptions->CBShowFPS->setChecked(value("fps/show", false).toBool());
     Form->ui.pageOptions->fpsedit->setValue(value("fps/limit", 27).toUInt());
 
-    Form->ui.pageOptions->CBAltDamage->setChecked(value("misc/altdamage", false).toBool());
+    Form->ui.pageOptions->CBAltDamage->setChecked(value("misc/altdamage", true).toBool());
     Form->ui.pageOptions->CBNameWithDate->setChecked(value("misc/appendTimeToRecords", false).toBool());
 
+    Form->ui.pageOptions->CBTeamTag->setChecked(value("misc/teamtag", true).toBool());
+    Form->ui.pageOptions->CBHogTag->setChecked(value("misc/hogtag", true).toBool());
+    Form->ui.pageOptions->CBHealthTag->setChecked(value("misc/healthtag", true).toBool());
+    Form->ui.pageOptions->CBTagOpacity->setChecked(value("misc/tagopacity", false).toBool());
+
 #ifdef SPARKLE_ENABLED
     Form->ui.pageOptions->CBAutoUpdate->setChecked(value("misc/autoUpdate", true).toBool());
 #endif
@@ -280,6 +285,12 @@
     setValue("fps/limit", Form->ui.pageOptions->fpsedit->value());
 
     setValue("misc/altdamage", isAltDamageEnabled());
+
+    setValue("misc/teamtag",   Form->ui.pageOptions->CBTeamTag->isChecked());
+    setValue("misc/hogtag",    Form->ui.pageOptions->CBHogTag->isChecked());
+    setValue("misc/healthtag", Form->ui.pageOptions->CBHealthTag->isChecked());
+    setValue("misc/tagopacity",Form->ui.pageOptions->CBTagOpacity->isChecked());
+
     setValue("misc/appendTimeToRecords", appendDateTimeToRecordName());
     setValue("misc/locale", language());
 
--- a/QTfrontend/hwform.cpp	Sun Jun 23 13:35:26 2013 -0400
+++ b/QTfrontend/hwform.cpp	Sun Jun 23 17:11:29 2013 -0400
@@ -2009,7 +2009,11 @@
                    + (config->isShowFPSEnabled() ? " --showfps" : "")
                    + (config->isAltDamageEnabled() ? " --altdmg" : "")
                    + " --frame-interval " + QString::number(config->timerInterval())
-                   + " --raw-quality " + QString::number(config->translateQuality()));
+                   + " --raw-quality " + QString::number(config->translateQuality()))
+                   + (!config->Form->ui.pageOptions->CBTeamTag->isChecked() ? " --no-teamtag" : "")
+                   + (!config->Form->ui.pageOptions->CBHogTag->isChecked() ? " --no-hogtag" : "")
+                   + (!config->Form->ui.pageOptions->CBHealthTag->isChecked() ? " --no-healthtag" : "")
+                   + (config->Form->ui.pageOptions->CBTagOpacity->isChecked() ? " --translucent-tags" : "");
 }
 
 void HWForm::AssociateFiles()
--- a/QTfrontend/ui/page/pageoptions.cpp	Sun Jun 23 13:35:26 2013 -0400
+++ b/QTfrontend/ui/page/pageoptions.cpp	Sun Jun 23 17:11:29 2013 -0400
@@ -279,10 +279,10 @@
             // make some min/max-consts, shared with engine?
             windowWidthEdit = new QSpinBox(groupGame);
             windowWidthEdit->setRange(640, 102400);
-            windowWidthEdit->setFixedSize(55, CBResolution->height());
+            windowWidthEdit->setFixedSize(60, CBResolution->height());
             windowHeightEdit = new QSpinBox(groupGame);
             windowHeightEdit->setRange(480, 102400);
-            windowHeightEdit->setFixedSize(55, CBResolution->height());
+            windowHeightEdit->setFixedSize(60, CBResolution->height());
 
             winResLayout->addWidget(windowWidthEdit, 0);
             winResLayout->addWidget(winLabelX, 0);
@@ -365,6 +365,39 @@
             WeaponTooltip = new QCheckBox(groupGame);
             WeaponTooltip->setText(QCheckBox::tr("Show ammo menu tooltips"));
             groupGame->layout()->addWidget(WeaponTooltip, 9, 0, 1, 2);
+
+            groupGame->addDivider();
+
+            lblTags = new QLabel(groupGame);
+            lblTags->setText(QLabel::tr("Displayed tags above hogs and translucent tags"));
+            groupGame->layout()->addWidget(lblTags, 11, 0, 1, 2);
+
+            tagsContainer = new QWidget();
+            QHBoxLayout * tagsLayout = new QHBoxLayout(tagsContainer);
+            tagsLayout->setSpacing(0);
+            groupGame->layout()->addWidget(tagsContainer, 12, 0, 1, 2);
+
+            CBTeamTag = new QCheckBox(groupGame);
+            CBTeamTag->setText(QCheckBox::tr("Team"));
+            CBTeamTag->setWhatsThis(QCheckBox::tr("Enable team tags by default"));
+
+            CBHogTag = new QCheckBox(groupGame);
+            CBHogTag->setText(QCheckBox::tr("Hog"));
+            CBHogTag->setWhatsThis(QCheckBox::tr("Enable hedgehog tags by default"));
+
+            CBHealthTag = new QCheckBox(groupGame);
+            CBHealthTag->setText(QCheckBox::tr("Health"));
+            CBHealthTag->setWhatsThis(QCheckBox::tr("Enable health tags by default"));
+
+            CBTagOpacity = new QCheckBox(groupGame);
+            CBTagOpacity->setText(QCheckBox::tr("Translucent"));
+            CBTagOpacity->setWhatsThis(QCheckBox::tr("Enable translucent tags by default"));
+
+            tagsLayout->addWidget(CBTeamTag, 0);
+            tagsLayout->addWidget(CBHogTag, 0);
+            tagsLayout->addWidget(CBHealthTag, 0);
+            tagsLayout->addWidget(CBTagOpacity, 0);
+            tagsLayout->addStretch(1); 
         }
 
         { // group: frontend
--- a/QTfrontend/ui/page/pageoptions.h	Sun Jun 23 13:35:26 2013 -0400
+++ b/QTfrontend/ui/page/pageoptions.h	Sun Jun 23 17:11:29 2013 -0400
@@ -90,6 +90,13 @@
         QCheckBox *CBSavePassword;
         QCheckBox *CBAltDamage;
         QCheckBox *CBNameWithDate;
+
+
+        QCheckBox *CBTeamTag;
+        QCheckBox *CBHogTag;
+        QCheckBox *CBHealthTag;
+        QCheckBox *CBTagOpacity;
+
 #ifdef __APPLE__
         QCheckBox *CBAutoUpdate;
         QPushButton *BtnUpdateNow;
@@ -165,7 +172,9 @@
 
         QLabel * lblFullScreenRes;
         QLabel * lblWinScreenRes;
+        QLabel * lblTags;
         QWidget * winResContainer;
+        QWidget * tagsContainer;
 
     private slots:
         void forceFullscreen(int index);
--- a/hedgewars/ArgParsers.inc	Sun Jun 23 13:35:26 2013 -0400
+++ b/hedgewars/ArgParsers.inc	Sun Jun 23 17:11:29 2013 -0400
@@ -57,6 +57,10 @@
     WriteLn(stdout, ' --fullscreen');
     WriteLn(stdout, ' --showfps');
     WriteLn(stdout, ' --altdmg');
+    WriteLn(stdout, ' --no-teamtag');
+    WriteLn(stdout, ' --no-hogtag');
+    WriteLn(stdout, ' --no-healthtag');
+    WriteLn(stdout, ' --translucent-tags');
     WriteLn(stdout, ' --stats-only');
     WriteLn(stdout, ' --help');
     WriteLn(stdout, '');
@@ -168,14 +172,14 @@
       audioArray: Array [1..3] of String = ('--volume','--nomusic','--nosound');
       otherArray: Array [1..3] of String = ('--locale','--fullscreen','--showfps');
       mediaArray: Array [1..10] of String = ('--fullscreen-width', '--fullscreen-height', '--width', '--height', '--depth', '--volume','--nomusic','--nosound','--locale','--fullscreen');
-      allArray: Array [1..14] of String = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth','--volume','--nomusic','--nosound','--locale','--fullscreen','--showfps','--altdmg','--frame-interval','--low-quality');
-      reallyAll: array[0..30] of shortstring = (
+      allArray: Array [1..18] of String = ('--fullscreen-width','--fullscreen-height', '--width', '--height', '--depth','--volume','--nomusic','--nosound','--locale','--fullscreen','--showfps','--altdmg','--frame-interval','--low-quality','--no-teamtag','--no-hogtag','--no-healthtag','--translucent-tags');
+      reallyAll: array[0..34] of shortstring = (
                 '--prefix', '--user-prefix', '--locale', '--fullscreen-width', '--fullscreen-height', '--width',
                 '--height', '--frame-interval', '--volume','--nomusic', '--nosound',
                 '--fullscreen', '--showfps', '--altdmg', '--low-quality', '--raw-quality', '--stereo', '--nick',
   {deprecated}  '--depth', '--set-video', '--set-audio', '--set-other', '--set-multimedia', '--set-everything',
   {internal}    '--internal', '--port', '--recorder', '--landpreview',
-  {misc}        '--stats-only', '--gci', '--help');
+  {misc}        '--stats-only', '--gci', '--help','--no-teamtag','--no-hogtag','--no-healthtag','--translucent-tags');
 var cmdIndex: byte;
 begin
     parseParameter:= false;
@@ -220,6 +224,10 @@
         {--stats-only}          28 : statsOnlyGame();
         {--gci}                 29 : GciEasterEgg();
         {--help}                30 : DisplayUsage();
+        {--no-teamtag}          31 : cTagsMask := cTagsMask and not htTeamName;
+        {--no-hogtag}           32 : cTagsMask := cTagsMask and not htName;
+        {--no-healthtag}        33 : cTagsMask := cTagsMask and not htHealth;
+        {--translucent-tags}    34 : cTagsMask := cTagsMask or htTransparent 
     else
         begin
         //Asusme the first "non parameter" is the replay file, anything else is invalid
@@ -255,7 +263,7 @@
         isValid:= (cmd<>'--depth');
 
         // check if the parameter is a boolean one
-        isBool:= (cmd = '--nomusic') or (cmd = '--nosound') or (cmd = '--fullscreen') or (cmd = '--showfps') or (cmd = '--altdmg');
+        isBool:= (cmd = '--nomusic') or (cmd = '--nosound') or (cmd = '--fullscreen') or (cmd = '--showfps') or (cmd = '--altdmg') or (cmd = '--no-teamtag') or (cmd = '--no-hogtag') or (cmd = '--no-healthtag') or (cmd = '--translucent-tags');
         if isBool and (arg='0') then
             isValid:= false;
         if (cmd='--nomusic') or (cmd='--nosound') then
--- a/hedgewars/hwengine.pas	Sun Jun 23 13:35:26 2013 -0400
+++ b/hedgewars/hwengine.pas	Sun Jun 23 17:11:29 2013 -0400
@@ -401,7 +401,7 @@
 
     isDeveloperMode:= false;
     TryDo(InitStepsFlags = cifAllInited, 'Some parameters not set (flags = ' + inttostr(InitStepsFlags) + ')', true);
-    ParseCommand('rotmask', true);
+    //ParseCommand('rotmask', true);
 
 {$IFDEF USE_VIDEO_RECORDING}
     if GameType = gmtRecord then
@@ -533,6 +533,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 begin
     preInitEverything();
+    cTagsMask:= htTeamName or htName or htHealth; // this one doesn't fit nicely w/ reset of other variables. suggestions welcome
     GetParams();
 
     if GameType = gmtLandPreview then
--- a/hedgewars/uConsts.pas	Sun Jun 23 13:35:26 2013 -0400
+++ b/hedgewars/uConsts.pas	Sun Jun 23 17:11:29 2013 -0400
@@ -283,6 +283,13 @@
     posCaseExplode = $00000010;
     posCasePoison  = $00000020;
 
+    // hog tag mask
+    //htNone        = $00;
+    htTeamName    = $01;
+    htName        = $02;
+    htHealth      = $04;
+    htTransparent = $08;
+
     NoPointX = Low(LongInt);
     cTargetPointRef : TPoint = (X: NoPointX; Y: 0);
 
--- a/hedgewars/uGearsRender.pas	Sun Jun 23 13:35:26 2013 -0400
+++ b/hedgewars/uGearsRender.pas	Sun Jun 23 17:11:29 2013 -0400
@@ -40,14 +40,6 @@
 implementation
 uses uRender, uUtils, uVariables, uAmmos, Math, uVisualGears;
 
-const
-    // hog tag mask
-    //htNone        = $00;
-    htTeamName    = $01;
-    htName        = $02;
-    htHealth      = $04;
-    htTransparent = $08;
-
 procedure DrawRopeLinesRQ(Gear: PGear);
 begin
 with RopePoints do
--- a/hedgewars/uVariables.pas	Sun Jun 23 13:35:26 2013 -0400
+++ b/hedgewars/uVariables.pas	Sun Jun 23 17:11:29 2013 -0400
@@ -2466,7 +2466,6 @@
     cWaterRise          := 47;
     cHealthDecrease     := 5;
 
-    cTagsMask       := 0;
     InitStepsFlags  := 0;
     RealTicks       := 0;
     AttackBar       := 0; // 0 - none, 1 - just bar at the right-down corner, 2 - from weapon