Engine:
authorsmxx
Tue, 30 Mar 2010 13:20:04 +0000
changeset 3172 ae5c7f97df44
parent 3171 601f092071e7
child 3173 909b28b1b61a
Engine: * Lowered the number of feathers spawned by Birdy * Made hogs caugh/moan once they lose health due to poison - no longer random Frontend: * Modified game scheme editor to lookup the number of default ammoschemes (no longer hardcoded) * Added new default game schemes: Barrel Mayhem, Tunnel Hogs * Added new default weapon scheme: Tunnel Hogs
QTfrontend/ammoSchemeModel.cpp
QTfrontend/ammoSchemeModel.h
QTfrontend/pages.cpp
hedgewars/GSHandlers.inc
hedgewars/uGears.pas
--- a/QTfrontend/ammoSchemeModel.cpp	Tue Mar 30 02:45:31 2010 +0000
+++ b/QTfrontend/ammoSchemeModel.cpp	Tue Mar 30 13:20:04 2010 +0000
@@ -53,16 +53,19 @@
 
 AmmoSchemeModel::AmmoSchemeModel(QObject* parent, const QString & fileName) :
     QAbstractTableModel(parent),
-    numberOfDefaultSchemes(4),
     fileConfig(fileName, QSettings::IniFormat)
 {
     QStringList predefSchemesNames;
     predefSchemesNames
         << "Default"
-        << "Pro mode"
+        << "Pro Mode"
         << "Shoppa"
         << "Basketball"
-        << "Minefield";
+        << "Minefield"
+        << "Barrel Mayhem"
+        << "Tunnel Hogs";
+
+    numberOfDefaultSchemes = predefSchemesNames.size();
 
     spNames = QStringList()
         << "name"             //  0
@@ -213,11 +216,73 @@
         << QVariant(0)             // explosives     25
         ;
 
+    QList<QVariant> barrelmayhem;
+    barrelmayhem
+        << predefSchemesNames[5]   // name           0
+        << QVariant(false)         // fortsmode      1
+        << QVariant(false)         // team divide    2
+        << QVariant(false)         // solid land     3
+        << QVariant(false)         // border         4
+        << QVariant(false)         // low gravity    5
+        << QVariant(false)         // laser sight    6
+        << QVariant(false)         // invulnerable   7
+        << QVariant(false)         // add mines      8
+        << QVariant(false)         // vampiric       9
+        << QVariant(false)         // karma          10
+        << QVariant(false)         // artillery      11
+        << QVariant(true)          // random order   12
+        << QVariant(false)         // king           13
+        << QVariant(false)         // place hog      14
+        << QVariant(true)          // shared ammo    15
+        << QVariant(false)         //disable girders 16
+        << QVariant(100)           // damage modfier 17
+        << QVariant(30)            // turn time      18
+        << QVariant(100)           // init health    19
+        << QVariant(15)            // sudden death   20
+        << QVariant(0)             // case prob      21
+        << QVariant(0)             // mines time     22
+        << QVariant(0)             // landadds       23
+        << QVariant(0)             // mine dud pct   24
+        << QVariant(80)            // explosives     25
+        ;
+
+    QList<QVariant> tunnelhogs;
+    tunnelhogs
+        << predefSchemesNames[6]   // name           0
+        << QVariant(false)         // fortsmode      1
+        << QVariant(false)         // team divide    2
+        << QVariant(false)         // solid land     3
+        << QVariant(true)          // border         4
+        << QVariant(false)         // low gravity    5
+        << QVariant(false)         // laser sight    6
+        << QVariant(false)         // invulnerable   7
+        << QVariant(true)          // add mines      8
+        << QVariant(false)         // vampiric       9
+        << QVariant(false)         // karma          10
+        << QVariant(false)         // artillery      11
+        << QVariant(true)          // random order   12
+        << QVariant(false)         // king           13
+        << QVariant(false)         // place hog      14
+        << QVariant(true)          // shared ammo    15
+        << QVariant(true)          //disable girders 16
+        << QVariant(100)           // damage modfier 17
+        << QVariant(30)            // turn time      18
+        << QVariant(100)           // init health    19
+        << QVariant(15)            // sudden death   20
+        << QVariant(5)             // case prob      21
+        << QVariant(3)             // mines time     22
+        << QVariant(10)            // landadds       23
+        << QVariant(10)            // mine dud pct   24
+        << QVariant(10)            // explosives     25
+        ;
+
     schemes.append(defaultScheme);
     schemes.append(proMode);
     schemes.append(shoppa);
     schemes.append(basketball);
     schemes.append(minefield);
+    schemes.append(barrelmayhem);
+    schemes.append(tunnelhogs);
 
 
     int size = fileConfig.beginReadArray("schemes");
--- a/QTfrontend/ammoSchemeModel.h	Tue Mar 30 02:45:31 2010 +0000
+++ b/QTfrontend/ammoSchemeModel.h	Tue Mar 30 13:20:04 2010 +0000
@@ -40,7 +40,7 @@
     bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
     QVariant data(const QModelIndex &index, int role) const;
 
-    const int numberOfDefaultSchemes;
+    int numberOfDefaultSchemes;
 
 public slots:
     void Save();
--- a/QTfrontend/pages.cpp	Tue Mar 30 02:45:31 2010 +0000
+++ b/QTfrontend/pages.cpp	Tue Mar 30 13:20:04 2010 +0000
@@ -40,6 +40,7 @@
 #include <QDataWidgetMapper>
 
 
+#include "ammoSchemeModel.h"
 #include "pages.h"
 #include "sdlkeys.h"
 #include "hwconsts.h"
@@ -1432,9 +1433,10 @@
 
 void PageScheme::schemeSelected(int n)
 {
-    gbGameModes->setEnabled(n >= 5); // FIXME: derive number from model
-    gbBasicSettings->setEnabled(n >= 5);
-    LE_name->setEnabled(n >= 5);
+    int c = ((AmmoSchemeModel*)mapper->model())->numberOfDefaultSchemes;
+    gbGameModes->setEnabled(n >= c);
+    gbBasicSettings->setEnabled(n >= c);
+    LE_name->setEnabled(n >= c);
 }
 
 /////////////////////////////////////////////////
--- a/hedgewars/GSHandlers.inc	Tue Mar 30 02:45:31 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Tue Mar 30 13:20:04 2010 +0000
@@ -2830,14 +2830,9 @@
     end;
 
 if Gear^.Health < 0 then Gear^.Health:= 0;
-if (GameTicks and $7F) = 0 then
-       begin
-       if Gear^.Health < 1000 then
-            for i:= ((1000-Gear^.Health) div 250) downto 0 do
-                AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtFeather);
-       if Gear^.Tex <> nil then FreeTexture(Gear^.Tex);
-       Gear^.Tex:= RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(round(Gear^.Health / 20)) + '%', cWhiteColor, fntSmall)
-       end;
+if ((GameTicks and $FF) = 0) and (Gear^.Health < 500) then
+    for i:= ((500-Gear^.Health) div 250) downto 0 do
+        AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtFeather);
 
 if (HHGear^.Message and gm_Attack <> 0) then begin
         HHGear^.Message := HHGear^.Message and not gm_Attack;
--- a/hedgewars/uGears.pas	Tue Mar 30 02:45:31 2010 +0000
+++ b/hedgewars/uGears.pas	Tue Mar 30 13:20:04 2010 +0000
@@ -591,7 +591,13 @@
 		if Gear^.Kind = gtHedgehog then
 			begin
             if PHedgehog(Gear^.Hedgehog)^.Effects[hePoisoned] then
+                begin
                 inc(Gear^.Damage, min(5, max(0,Gear^.Health - 1 - Gear^.Damage)));
+                if getRandom(2) = 0 then
+                    PlaySound(sndPoisonCough, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack)
+                else
+                    PlaySound(sndPoisonMoan, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
+                end;
             inc(Gear^.Damage, min(cHealthDecrease, max(0,Gear^.Health - 1 - Gear^.Damage)));
             if PHedgehog(Gear^.Hedgehog)^.King then
                 begin
@@ -636,11 +642,6 @@
     begin
     Gear:= t;
     t:= Gear^.NextGear;
-    if (((GameTicks + Gear^.UID * 100) mod 1000) = 0) and (Gear^.Kind = gtHedgehog) and (Gear^.Hedgehog <> nil) and (PHedgehog(Gear^.Hedgehog)^.Effects[hePoisoned]) and (getRandom(100) = 0) then
-        if getRandom(2) = 0 then
-            PlaySound(sndPoisonCough, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack)
-        else
-            PlaySound(sndPoisonMoan, PHedgehog(Gear^.Hedgehog)^.Team^.voicepack);
 
     if Gear^.Active then
         begin