some saucer thing for firing weps underwater and aiming and such. bit drunk and sleepy so testing I guess
authornemo
Mon, 13 May 2013 22:40:32 -0400
changeset 8987 47cf32305d99
parent 8986 f7bb323a6934
child 8988 58b28c4a25c5
some saucer thing for firing weps underwater and aiming and such. bit drunk and sleepy so testing I guess
hedgewars/GSHandlers.inc
hedgewars/uConsts.pas
hedgewars/uGearsHedgehog.pas
hedgewars/uGearsList.pas
hedgewars/uGearsUtils.pas
hedgewars/uVariables.pas
--- a/hedgewars/GSHandlers.inc	Mon May 13 23:31:03 2013 +0200
+++ b/hedgewars/GSHandlers.inc	Mon May 13 22:40:32 2013 -0400
@@ -3181,10 +3181,11 @@
     move:= _0_02;
     fuel:= 5;
     end;*)
-
-    if Gear^.Health > 0 then
-        begin
-        if (HHGear^.Message and gmUp) <> 0 then
+    if HHGear^.Message and gmPrecise <> 0 then
+        HedgehogChAngle(HHGear)
+    else if Gear^.Health > 0 then
+        begin
+        if HHGear^.Message and gmUp <> 0 then
             begin
             if (not HHGear^.dY.isNegative) or (HHGear^.Y > -_256) then
                 begin
@@ -3251,10 +3252,12 @@
         Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(i) + '%', cWhiteColor, fntSmall)
         end;
 
-    if HHGear^.Message and (gmAttack or gmUp or gmPrecise or gmLeft or gmRight) <> 0 then
+    if (HHGear^.Message and (gmAttack or gmUp or gmLeft or gmRight) <> 0) and
+       (HHGear^.Message and gmPrecise = 0) then
         Gear^.State := Gear^.State and (not gsttmpFlag);
 
-    HHGear^.Message := HHGear^.Message and (not (gmUp or gmPrecise or gmLeft or gmRight));
+    if HHGear^.Message and gmPrecise = 0 then
+        HHGear^.Message := HHGear^.Message and (not (gmUp or gmLeft or gmRight));
     HHGear^.State := HHGear^.State or gstMoving;
 
     Gear^.X := HHGear^.X;
--- a/hedgewars/uConsts.pas	Mon May 13 23:31:03 2013 +0200
+++ b/hedgewars/uConsts.pas	Mon May 13 22:40:32 2013 -0400
@@ -212,6 +212,7 @@
     gstLoser          = $00080000;
     gstHHGone         = $00100000;
     gstInvisible      = $00200000;
+    gstNoDrown        = $00400000;
 
     // gear messages
     gmLeft           = $00000001;
--- a/hedgewars/uGearsHedgehog.pas	Mon May 13 23:31:03 2013 +0200
+++ b/hedgewars/uGearsHedgehog.pas	Mon May 13 22:40:32 2013 -0400
@@ -257,8 +257,24 @@
             and ((Gear^.Message and gmLJump) <> 0)
             and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then
                 begin
-                newDx:= dX;
-                newDy:= dY;
+                if (CurAmmoGear^.AmmoType = amJetpack) and (Gear^.Message and gmPrecise <> 0) then
+                    begin
+                    if hwRound(Gear^.Y) > cWaterLine then
+                        begin
+                        newDx:= xx*cMaxPower/cPowerDivisor/2;
+                        newDy:= yy*cMaxPower/cPowerDivisor/2
+                        end
+                    else
+                        begin
+                        newDx:= xx*cMaxPower/cPowerDivisor;
+                        newDy:= yy*cMaxPower/cPowerDivisor
+                        end
+                    end
+                else
+                    begin
+                    newDx:= dX;
+                    newDy:= dY
+                    end;
                 altUse:= true
                 end
             else
@@ -385,11 +401,15 @@
                        amTardis: newGear:= AddGear(hwRound(X), hwRound(Y), gtTardis, 0, _0, _0, 5000);
                        amIceGun: newGear:= AddGear(hwRound(X), hwRound(Y), gtIceGun, 0, _0, _0, 0);
             end;
-            if altUse and (newGear <> nil) then
+            if altUse and (newGear <> nil) and 
+               ((CurAmmoGear = nil) or (CurAmmoGear^.AmmoType <> amJetpack) or (Gear^.Message and gmPrecise = 0)) then
                begin
                newGear^.dX:= newDx / newGear^.Density;
                newGear^.dY:= newDY / newGear^.Density
                end;
+            if (CurAmmoGear <> nil) and (CurAmmoGear^.AmmoType = amJetpack) and
+               (Gear^.Message and gmPrecise <> 0) and (hwRound(Y) > cWaterLine) then
+                newGear^.State:= newGear^.State or gstNoDrown;
 
             case CurAmmoType of
                      amGrenade, amMolotov,
@@ -798,7 +818,7 @@
         da:= 2
     else da:= 1;
 
-if (((HHGear^.Message and gmPrecise) = 0) or ((GameTicks mod 5) = 1)) then
+if ((HHGear^.Message and gmPrecise = 0) or ((CurAmmoGear <> nil) and (CurAmmoGear^.AmmoType = amJetpack))) or (GameTicks mod 5 = 1) then
     if ((HHGear^.Message and gmUp) <> 0) and (HHGear^.Angle >= CurMinAngle + da) then
         dec(HHGear^.Angle, da)
     else
--- a/hedgewars/uGearsList.pas	Mon May 13 23:31:03 2013 +0200
+++ b/hedgewars/uGearsList.pas	Mon May 13 22:40:32 2013 -0400
@@ -469,7 +469,8 @@
                 end;
      gtJetpack: begin
                 gear^.Health:= 2000;
-                gear^.Damage:= 100
+                gear^.Damage:= 100;
+                gear^.State:= gstNoDrown
                 end;
      gtMolotov: begin
                 gear^.Radius:= 6;
--- a/hedgewars/uGearsUtils.pas	Mon May 13 23:31:03 2013 +0200
+++ b/hedgewars/uGearsUtils.pas	Mon May 13 22:40:32 2013 -0400
@@ -361,7 +361,7 @@
             else DeleteGear(Gear);
             exit
             end;
-        isSubmersible:= (Gear = CurrentHedgehog^.Gear) and (CurAmmoGear <> nil) and (CurAmmoGear^.AmmoType = amJetpack);
+        isSubmersible:= ((Gear = CurrentHedgehog^.Gear) and (CurAmmoGear <> nil) and (CurAmmoGear^.AmmoType = amJetpack)) or (Gear^.State and gstNoDrown <> 0);
         skipSpeed := _0_25;
         skipAngle := _1_9;
         skipDecay := _0_87;
--- a/hedgewars/uVariables.pas	Mon May 13 23:31:03 2013 +0200
+++ b/hedgewars/uVariables.pas	Mon May 13 22:40:32 2013 -0400
@@ -1765,7 +1765,6 @@
             Ammo: (Propz: ammoprop_NoRoundEnd or
                           ammoprop_ForwMsgs or
                           ammoprop_AttackInMove or
-                          ammoprop_NoCrosshair or
                           ammoprop_DontHold or
                           ammoprop_Utility or
                           ammoprop_NeedUpDown or