percentage modifier for get away time
authornikin
Sat, 19 Mar 2011 20:24:31 -0400
changeset 5026 e83d4552625f
parent 5025 ac1691d35cf2
child 5027 872c5c8a07ec
percentage modifier for get away time
QTfrontend/ammoSchemeModel.cpp
QTfrontend/gamecfgwidget.cpp
QTfrontend/pages.cpp
QTfrontend/pages.h
hedgewars/HHHandlers.inc
hedgewars/uCommandHandlers.pas
hedgewars/uVariables.pas
--- a/QTfrontend/ammoSchemeModel.cpp	Sat Mar 19 19:41:59 2011 -0400
+++ b/QTfrontend/ammoSchemeModel.cpp	Sat Mar 19 20:24:31 2011 -0400
@@ -62,6 +62,7 @@
         << QVariant(47)            // water rise amt 36
         << QVariant(5)             // health dec amt 37
         << QVariant(100)           // rope modfier   38
+        << QVariant(100)           // get away time  39
         ;
 
 AmmoSchemeModel::AmmoSchemeModel(QObject* parent, const QString & fileName) :
@@ -123,7 +124,8 @@
         << "healthcaseamount" // 35
         << "waterrise"        // 36
         << "healthdecrease"   // 37
-        << "ropepct"          // 38
+        << "ropepct"          // 38 
+        << "getawaytime"      // 39 
         ;
 
     QList<QVariant> proMode;
@@ -166,7 +168,8 @@
         << QVariant(25)            // health case amt 35
         << QVariant(47)            // water rise amt 36
         << QVariant(5)             // health dec amt 37
-        << QVariant(100)           // rope modfier   38
+        << QVariant(100)           // rope modfier   38 
+        << QVariant(100)           // get away time  39 
         ;
 
     QList<QVariant> shoppa;
@@ -209,7 +212,8 @@
         << QVariant(25)            // health case amt 35
         << QVariant(47)            // water rise amt 36
         << QVariant(5)             // health dec amt 37
-        << QVariant(100)           // rope modfier   38
+        << QVariant(100)           // rope modfier   38 
+        << QVariant(100)           // get away time  39 
         ;
 
     QList<QVariant> cleanslate;
@@ -252,7 +256,8 @@
         << QVariant(25)            // health case amt 35
         << QVariant(47)            // water rise amt 36
         << QVariant(5)             // health dec amt 37
-        << QVariant(100)           // rope modfier   38
+        << QVariant(100)           // rope modfier   38  
+        << QVariant(100)           // get away time  39 
         ;
 
     QList<QVariant> minefield;
@@ -295,7 +300,8 @@
         << QVariant(25)            // health case amt 35
         << QVariant(47)            // water rise amt 36
         << QVariant(5)             // health dec amt 37
-        << QVariant(100)           // rope modfier   38
+        << QVariant(100)           // rope modfier   38   
+        << QVariant(100)           // get away time  39 
         ;
 
     QList<QVariant> barrelmayhem;
@@ -338,7 +344,8 @@
         << QVariant(25)            // health case amt 35
         << QVariant(47)            // water rise amt 36
         << QVariant(5)             // health dec amt 37
-        << QVariant(100)           // rope modfier   38
+        << QVariant(100)           // rope modfier   38    
+        << QVariant(100)           // get away time  39 
         ;
 
     QList<QVariant> tunnelhogs;
@@ -381,7 +388,8 @@
         << QVariant(25)            // health case amt 35
         << QVariant(47)            // water rise amt 36
         << QVariant(5)             // health dec amt 37
-        << QVariant(100)           // rope modfier   38
+        << QVariant(100)           // rope modfier   38     
+        << QVariant(100)           // get away time  39 
         ;
 
     QList<QVariant> forts;
@@ -424,7 +432,8 @@
         << QVariant(25)            // health case amt 35
         << QVariant(47)            // water rise amt 36
         << QVariant(5)             // health dec amt 37
-        << QVariant(100)           // rope modfier   38
+        << QVariant(100)           // rope modfier   38      
+        << QVariant(100)           // get away time  39 
         ;
 
     QList<QVariant> timeless;
@@ -467,7 +476,8 @@
         << QVariant(30)            // health case amt 35
         << QVariant(0)            // water rise amt 36
         << QVariant(0)             // health dec amt 37
-        << QVariant(100)           // rope modfier   38
+        << QVariant(100)           // rope modfier   38 
+        << QVariant(100)           // get away time  39 
         ;
 
     QList<QVariant> thinkingportals;
@@ -510,7 +520,8 @@
         << QVariant(25)            // health case amt 35
         << QVariant(47)            // water rise amt 36
         << QVariant(5)             // health dec amt 37
-        << QVariant(100)           // rope modfier   38
+        << QVariant(100)           // rope modfier   38  
+        << QVariant(100)           // get away time  39 
         ;
 
     QList<QVariant> kingmode;
@@ -553,7 +564,8 @@
         << QVariant(25)            // health case amt 35
         << QVariant(47)            // water rise amt 36
         << QVariant(5)             // health dec amt 37
-        << QVariant(100)           // rope modfier   38
+        << QVariant(100)           // rope modfier   38 
+        << QVariant(100)           // get away time  39 
         ;
 
 
@@ -759,4 +771,4 @@
         netScheme[i] = QVariant(cfg[i]);
 
     reset();
-}
+}                      
--- a/QTfrontend/gamecfgwidget.cpp	Sat Mar 19 19:41:59 2011 -0400
+++ b/QTfrontend/gamecfgwidget.cpp	Sat Mar 19 20:24:31 2011 -0400
@@ -242,6 +242,7 @@
     bcfg << QString("e$waterrise %1").arg(schemeData(36).toInt()).toUtf8();
     bcfg << QString("e$healthdec %1").arg(schemeData(37).toInt()).toUtf8();
     bcfg << QString("e$ropepct %1").arg(schemeData(38).toInt()).toUtf8();
+    bcfg << QString("e$getawaytime %1").arg(schemeData(39).toInt()).toUtf8();
     bcfg << QString("e$template_filter %1").arg(pMapContainer->getTemplateFilter()).toUtf8();
     bcfg << QString("e$mapgen %1").arg(mapgen).toUtf8();
 
--- a/QTfrontend/pages.cpp	Sat Mar 19 19:41:59 2011 -0400
+++ b/QTfrontend/pages.cpp	Sat Mar 19 20:24:31 2011 -0400
@@ -1868,7 +1868,6 @@
     SB_MineDuds->setSingleStep(5);
     glBSLayout->addWidget(SB_MineDuds,12,2,1,1);
 
-
     l = new QLabel(gbBasicSettings);
     l->setText(QLabel::tr("Explosives"));
     l->setWordWrap(true);
@@ -1884,22 +1883,36 @@
     glBSLayout->addWidget(SB_Explosives,13,2,1,1);
 
     l = new QLabel(gbBasicSettings);
+    l->setText(QLabel::tr("% Get Away Time"));
+    l->setWordWrap(true);
+    glBSLayout->addWidget(l,14,0,1,1);
+    l = new QLabel(gbBasicSettings);
+    l->setFixedSize(32,32);
+    l->setPixmap(QPixmap(":/res/iconTime.png"));
+    glBSLayout->addWidget(l,14,1,1,1);
+    SB_GetAwayTime = new QSpinBox(gbBasicSettings);
+    SB_GetAwayTime->setRange(0, 999);
+    SB_GetAwayTime->setValue(100);
+    SB_GetAwayTime->setSingleStep(25);
+    glBSLayout->addWidget(SB_GetAwayTime,14,2,1,1);
+ 
+    l = new QLabel(gbBasicSettings);
     l->setText(QLabel::tr("Scheme Name:"));
 
     LE_name = new QLineEdit(this);
 
-    gl->addWidget(LE_name,14,1,1,5);
-    gl->addWidget(l,14,0,1,1);
+    gl->addWidget(LE_name,15,1,1,5);
+    gl->addWidget(l,15,0,1,1);
 
     mapper = new QDataWidgetMapper(this);
 
-    BtnBack = addButton(":/res/Exit.png", pageLayout, 15, 0, true);
-    BtnCopy = addButton(tr("Copy"), pageLayout, 15, 2);
-    BtnNew = addButton(tr("New"), pageLayout, 15, 3);
-    BtnDelete = addButton(tr("Delete"), pageLayout, 15, 4);
+    BtnBack = addButton(":/res/Exit.png", pageLayout, 16, 0, true);
+    BtnCopy = addButton(tr("Copy"), pageLayout, 16, 2);
+    BtnNew = addButton(tr("New"), pageLayout, 16, 3);
+    BtnDelete = addButton(tr("Delete"), pageLayout, 16, 4);
 
     selectScheme = new QComboBox(this);
-    pageLayout->addWidget(selectScheme, 15, 1);
+    pageLayout->addWidget(selectScheme, 16, 1);
 
     connect(BtnCopy, SIGNAL(clicked()), this, SLOT(copyRow()));
     connect(BtnNew, SIGNAL(clicked()), this, SLOT(newRow()));
@@ -1952,6 +1965,7 @@
     mapper->addMapping(SB_WaterRise, 36);
     mapper->addMapping(SB_HealthDecrease, 37);
     mapper->addMapping(SB_RopeModifier, 38);
+		mapper->addMapping(SB_GetAwayTime, 39);
 
     mapper->toFirst();
 }
--- a/QTfrontend/pages.h	Sat Mar 19 19:41:59 2011 -0400
+++ b/QTfrontend/pages.h	Sat Mar 19 20:24:31 2011 -0400
@@ -535,6 +535,7 @@
     QSpinBox * SB_MineDuds;
     QSpinBox * SB_Explosives;
     QSpinBox * SB_RopeModifier;
+    QSpinBox * SB_GetAwayTime;
     QLineEdit * LE_name;
 
     QGroupBox * gbGameModes;
--- a/hedgewars/HHHandlers.inc	Sat Mar 19 19:41:59 2011 -0400
+++ b/hedgewars/HHHandlers.inc	Sat Mar 19 20:24:31 2011 -0400
@@ -382,7 +382,7 @@
             if ((Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) = 0) and ((GameFlags and gfInfAttack) = 0) then
                 begin
                 if TagTurnTimeLeft = 0 then TagTurnTimeLeft:= TurnTimeLeft;
-                TurnTimeLeft:= Ammoz[a].TimeAfterTurn;
+                TurnTimeLeft:=round(Ammoz[a].TimeAfterTurn * (cGetAwayTime / 100));
                 end;
             if ((Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) = 0) then State:= State or gstAttacked;
             if (Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) <> 0 then ApplyAmmoChanges(CurrentHedgehog^)
--- a/hedgewars/uCommandHandlers.pas	Sat Mar 19 19:41:59 2011 -0400
+++ b/hedgewars/uCommandHandlers.pas	Sat Mar 19 20:24:31 2011 -0400
@@ -602,6 +602,7 @@
     RegisterVariable('healthdec', vtLongInt, @cHealthDecrease, false);
     RegisterVariable('damagepct',vtLongInt, @cDamagePercent , false);
     RegisterVariable('ropepct' , vtLongInt, @cRopePercent   , false);
+    RegisterVariable('getawaytime' , vtLongInt, @cGetAwayTime , false);
     RegisterVariable('minedudpct',vtLongInt,@cMineDudPercent, false);
     RegisterVariable('minesnum', vtLongInt, @cLandMines     , false);
     RegisterVariable('explosives',vtLongInt,@cExplosives    , false);
--- a/hedgewars/uVariables.pas	Sat Mar 19 19:41:59 2011 -0400
+++ b/hedgewars/uVariables.pas	Sat Mar 19 20:24:31 2011 -0400
@@ -74,6 +74,7 @@
     cMapGen         : LongInt;
     cMazeSize       : LongInt;
     cRopePercent    : LongWord;
+    cGetAwayTime    : LongWord;
 
     cHedgehogTurnTime: Longword;
     cMinesTime       : LongInt;
@@ -2308,6 +2309,7 @@
     cSuddenDTurns       := 15;
     cDamagePercent      := 100;
     cRopePercent        := 100;
+    cGetAwayTime        := 100;
     cMineDudPercent     := 0;
     cTemplateFilter     := 0;
     cMapGen             := 0;   // MAPGEN_REGULAR