Engine (Henek):
authorsmxx
Fri, 28 May 2010 20:05:22 +0000
changeset 3485 ab91c56a9050
parent 3484 3c65b1d979cd
child 3486 e1b1a4c18c5b
Engine (Henek): * Moved some utility weapons to a new 10th row * Added adjustable flame output to Flamethrower (left/right controls power/intensity) * Added fuel display to flame thrower Frontend: * Added support to bind the new 10th row (default: F10)
QTfrontend/binds.cpp
QTfrontend/binds.h
hedgewars/GSHandlers.inc
hedgewars/GearDrawing.inc
hedgewars/HHHandlers.inc
hedgewars/uConsts.pas
hedgewars/uGears.pas
--- a/QTfrontend/binds.cpp	Fri May 28 19:48:51 2010 +0000
+++ b/QTfrontend/binds.cpp	Fri May 28 20:05:22 2010 +0000
@@ -40,6 +40,7 @@
     {"slot 7",  "f7",   QT_TRANSLATE_NOOP("binds", "slot 7"),   NULL, NULL},
     {"slot 8",  "f8",   QT_TRANSLATE_NOOP("binds", "slot 8"),   NULL, NULL},
     {"slot 9",  "f9",   QT_TRANSLATE_NOOP("binds", "slot 9"),   NULL, NULL},
+    {"slot :",  "f10",  QT_TRANSLATE_NOOP("binds", "slot 10"),  NULL, NULL},
     {"timer 1", "1",    QT_TRANSLATE_NOOP("binds", "timer 1 sec"),  NULL, QT_TRANSLATE_NOOP("binds (descriptions)", "Set the timer on bombs and timed weapons:")},
     {"timer 2", "2",    QT_TRANSLATE_NOOP("binds", "timer 2 sec"),  NULL, NULL},
     {"timer 3", "3",    QT_TRANSLATE_NOOP("binds", "timer 3 sec"),  NULL, NULL},
--- a/QTfrontend/binds.h	Fri May 28 19:48:51 2010 +0000
+++ b/QTfrontend/binds.h	Fri May 28 20:05:22 2010 +0000
@@ -22,9 +22,9 @@
 #include <QString>
 
 #ifdef _WIN32
-#define BINDS_NUMBER 42
+#define BINDS_NUMBER 43
 #else
-#define BINDS_NUMBER 43
+#define BINDS_NUMBER 44
 #endif
 
 struct BindAction
--- a/hedgewars/GSHandlers.inc	Fri May 28 19:48:51 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Fri May 28 20:05:22 2010 +0000
@@ -3631,37 +3631,64 @@
 procedure doStepFlamethrowerWork(Gear: PGear);
 var 
     HHGear: PGear;
-    rx, ry: hwFloat;
+    rx, ry, speed: hwFloat;
     gX, gY: LongInt;
     Fire: PGear;
 begin
     AllInactive := false;
-    dec(Gear^.Timer);
     HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
     HedgehogChAngle(HHGear);
     gX := hwRound(Gear^.X) + GetLaunchX(amBallgun, hwSign(HHGear^.dX), HHGear^.Angle);
     gY := hwRound(Gear^.Y) + GetLaunchY(amBallgun, HHGear^.Angle);
-    if (Gear^.Timer mod 100) = 0 then
+    
+    if (GameTicks and $FF) = 0 then
+    begin
+        if (HHGear^.Message and gm_Right) <> 0 then
+        begin
+            if HHGear^.dX.isNegative and (Gear^.Tag < 20) then inc(Gear^.Tag)
+            else if Gear^.Tag > 5 then dec(Gear^.Tag);
+        end
+        else if (HHGear^.Message and gm_Left) <> 0 then
+        begin
+            if HHGear^.dX.isNegative and (Gear^.Tag > 5) then dec(Gear^.Tag)
+            else if Gear^.Tag < 20 then inc(Gear^.Tag);
+        end
+    end;
+    
+    dec(Gear^.Timer);
+    if Gear^.Timer = 0 then
     begin
-        rx := rndSign(getRandom * _0_1);
-        ry := rndSign(getRandom * _0_1);
-
-        Fire := AddGear(gx, gy, gtFlame, 0,
-                    SignAs(AngleSin(HHGear^.Angle) * _0_8, HHGear^.dX) + rx,
-            AngleCos(HHGear^.Angle) * ( - _0_8) + ry, 0);
-        Fire^.State := Fire^.State or gsttmpFlag;
-        
-        if (Gear^.Timer mod 200) = 0 then 
+        dec(Gear^.Health);
+        if (Gear^.Health mod 10) = 0 then
+        begin
+            rx := rndSign(getRandom * _0_1);
+            ry := rndSign(getRandom * _0_1);
+            speed := _0_8 * (_10 / Gear^.Tag);
+    
             Fire := AddGear(gx, gy, gtFlame, 0,
-                        SignAs(AngleSin(HHGear^.Angle) * _0_8, HHGear^.dX) + rx,
-                AngleCos(HHGear^.Angle) * ( - _0_8) + ry, 0);
+                        SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx,
+                AngleCos(HHGear^.Angle) * ( - speed) + ry, 0);
+            Fire^.State := Fire^.State or gsttmpFlag;
+            
+            if (Gear^.Health mod 20) = 0 then 
+                Fire := AddGear(gx, gy, gtFlame, 0,
+                            SignAs(AngleSin(HHGear^.Angle) * speed, HHGear^.dX) + rx,
+                    AngleCos(HHGear^.Angle) * ( - speed) + ry, 0);
+        end;
+        Gear^.Timer:= Gear^.Tag
     end;
 
-    if (Gear^.Timer = 0) or (HHGear^.Damage <> 0) then
+    if (Gear^.Health = 0) or (HHGear^.Damage <> 0) then
     begin
         DeleteGear(Gear);
         AfterAttack
     end
+    else
+    begin
+        if Gear^.Tex <> nil then FreeTexture(Gear^.Tex);
+        Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(round(Gear^.Health / 5)) +
+                     '%', cWhiteColor, fntSmall) 
+    end
 end;
 
 procedure doStepFlamethrower(Gear: PGear);
@@ -3669,7 +3696,7 @@
     HHGear: PGear;
 begin
     HHGear := PHedgehog(Gear^.Hedgehog)^.Gear;
-    HHGear^.Message := HHGear^.Message and not (gm_Up or gm_Down);
+    HHGear^.Message := HHGear^.Message and not (gm_Up or gm_Down or gm_Left or gm_Right);
     HHGear^.State := HHGear^.State or gstNotKickable;
     Gear^.doStep := @doStepFlamethrowerWork
 end;
--- a/hedgewars/GearDrawing.inc	Fri May 28 19:48:51 2010 +0000
+++ b/hedgewars/GearDrawing.inc	Fri May 28 20:05:22 2010 +0000
@@ -289,7 +289,10 @@
                     end;
                 defaultPos:= false
                 end;
-            gtFlamethrower: DrawRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, hwSign(Gear^.dX), aangle);
+            gtFlamethrower: begin
+                DrawRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, hwSign(Gear^.dX), aangle);
+                if CurAmmoGear^.Tex <> nil then DrawCentered(sx, sy - 40, CurAmmoGear^.Tex)
+                end;
         end;
 
         case CurAmmoGear^.Kind of
--- a/hedgewars/HHHandlers.inc	Fri May 28 19:48:51 2010 +0000
+++ b/hedgewars/HHHandlers.inc	Fri May 28 20:05:22 2010 +0000
@@ -104,6 +104,7 @@
 procedure Attack(Gear: PGear);
 var xx, yy, lx, ly: hwFloat;
     tmpGear: PVisualGear;
+    tmpGear2: PGear;
 begin
 bShowFinger:= false;
 with Gear^,
--- a/hedgewars/uConsts.pas	Fri May 28 19:48:51 2010 +0000
+++ b/hedgewars/uConsts.pas	Fri May 28 20:05:22 2010 +0000
@@ -370,7 +370,7 @@
     gm_Precise= $00002000;
     gmAllStoppable = gm_Left or gm_Right or gm_Up or gm_Down or gm_Attack or gm_Precise;
 
-    cMaxSlotIndex       = 8;
+    cMaxSlotIndex       = 9;
     cMaxSlotAmmoIndex   = 5;
 
     ammoprop_Timerable    = $00000001;
@@ -1074,7 +1074,7 @@
                 Pos: 0;
                 AmmoType: amSkip;
                 AttackVoice: sndNone);
-            Slot: 8;
+            Slot: 9;
             TimeAfterTurn: 0;
             minAngle: 0;
             maxAngle: 0;
@@ -1441,7 +1441,7 @@
                     Pos: 0;
                     AmmoType: amSwitch;
                     AttackVoice: sndNone);
-            Slot: 8;
+            Slot: 9;
             TimeAfterTurn: 0;
             minAngle: 0;
             maxAngle: 0;
@@ -1716,7 +1716,7 @@
                     Pos: 0;
                     AmmoType: amLowGravity;
                     AttackVoice: sndNone);
-            Slot: 8;
+            Slot: 9;
             TimeAfterTurn: 0;
             minAngle: 0;
             maxAngle: 0;
@@ -1745,7 +1745,7 @@
                     Pos: 0;
                     AmmoType: amExtraDamage;
                     AttackVoice: sndNone);
-            Slot: 8;
+            Slot: 9;
             TimeAfterTurn: 0;
             minAngle: 0;
             maxAngle: 0;
@@ -1774,7 +1774,7 @@
                     Pos: 0;
                     AmmoType: amInvulnerable;
                     AttackVoice: sndNone);
-            Slot: 6;
+            Slot: 8;
             TimeAfterTurn: 0;
             minAngle: 0;
             maxAngle: 0;
@@ -1803,7 +1803,7 @@
                     Pos: 0;
                     AmmoType: amExtraTime;
                     AttackVoice: sndNone);
-            Slot: 8;
+            Slot: 9;
             TimeAfterTurn: 0;
             minAngle: 0;
             maxAngle: 0;
@@ -1832,7 +1832,7 @@
                     Pos: 0;
                     AmmoType: amLaserSight;
                     AttackVoice: sndNone);
-            Slot: 2;
+            Slot: 8;
             TimeAfterTurn: 0;
             minAngle: 0;
             maxAngle: 0;
@@ -1861,7 +1861,7 @@
                     Pos: 0;
                     AmmoType: amVampiric;
                     AttackVoice: sndNone);
-            Slot: 6;
+            Slot: 8;
             TimeAfterTurn: 0;
             minAngle: 0;
             maxAngle: 0;
--- a/hedgewars/uGears.pas	Fri May 28 19:48:51 2010 +0000
+++ b/hedgewars/uGears.pas	Fri May 28 20:05:22 2010 +0000
@@ -495,7 +495,9 @@
                 gear^.Health:= 6000;
                 end;
 gtFlamethrower: begin
-                gear^.Timer:= 5001;
+                gear^.Tag:= 10;
+                gear^.Timer:= 10;
+                gear^.Health:= 500;
                 end;
      end;
 InsertGearToList(gear);