Automatically use parachute when vertical speed is high enough
authorunc0rr
Sat, 12 Apr 2008 16:34:48 +0000
changeset 835 6f567934cc44
parent 834 5687fa57a6c1
child 836 150c7c87e66c
Automatically use parachute when vertical speed is high enough
hedgewars/HHHandlers.inc
hedgewars/uFloat.pas
--- a/hedgewars/HHHandlers.inc	Sat Apr 05 17:06:26 2008 +0000
+++ b/hedgewars/HHHandlers.inc	Sat Apr 12 16:34:48 2008 +0000
@@ -407,15 +407,21 @@
    exit
    end;
 
-if ((Gear^.State and gstMoving) <> 0)
-   or (StepTicks = cHHStepTicks)
-   or (CurAmmoGear <> nil) then // we're moving
-   begin
-   // check for case with ammo
-   t:= CheckGearNear(Gear, gtCase, 36, 36);
-   if t <> nil then
-      PickUp(Gear, t)
-   end;
+if ((Gear^.State and gstMoving) <> 0) then
+	begin
+	if (StepTicks = cHHStepTicks)
+	or (CurAmmoGear <> nil) then // we're moving
+		begin
+		// check for case with ammo
+		t:= CheckGearNear(Gear, gtCase, 36, 36);
+		if t <> nil then
+			PickUp(Gear, t)
+		end else
+		with PHedgehog(Gear^.Hedgehog)^ do
+			if (CurAmmoGear = nil)
+			and (Gear^.dY > _0_39)
+			and (Ammo^[CurSlot, CurAmmo].AmmoType = amParachute) then Gear^.Message:= Gear^.Message or gm_Attack
+	end;
 
 if CurAmmoGear <> nil then
    begin
--- a/hedgewars/uFloat.pas	Sat Apr 05 17:06:26 2008 +0000
+++ b/hedgewars/uFloat.pas	Sat Apr 12 16:34:48 2008 +0000
@@ -85,6 +85,7 @@
            _0_25: hwFloat = (isNegative: false; QWordValue:  1073741824);
             _0_3: hwFloat = (isNegative: false; QWordValue:  1288490189);
            _0_35: hwFloat = (isNegative: false; QWordValue:  1503238553);
+           _0_39: hwFloat = (isNegative: false; QWordValue:  1675037245);
             _0_4: hwFloat = (isNegative: false; QWordValue:  1717986918);
            _0_45: hwFloat = (isNegative: false; QWordValue:  1932735283);
             _0_5: hwFloat = (isNegative: false; QWordValue:  2147483648);