- Fix too long delay between shotgun and deagle shots
authorunc0rr
Mon, 21 Apr 2008 18:43:07 +0000
changeset 855 8842c71d16bf
parent 854 fef7f2d908bf
child 856 beecc5c5c71c
- Fix too long delay between shotgun and deagle shots - Hedgehog can jump even when someone is on its head
hedgewars/HHHandlers.inc
hedgewars/uCollisions.pas
hedgewars/uGears.pas
hedgewars/uLandGraphics.pas
--- a/hedgewars/HHHandlers.inc	Mon Apr 21 16:51:14 2008 +0000
+++ b/hedgewars/HHHandlers.inc	Mon Apr 21 18:43:07 2008 +0000
@@ -231,14 +231,12 @@
       begin
       DeleteCI(Gear);
       Gear^.Message:= Gear^.Message and not gm_HJump;
-      if not TestCollisionYwithGear(Gear, -1) then
-         begin
-         Gear^.dY:= -_0_2;
-         SetLittle(Gear^.dX);
-         Gear^.State:= Gear^.State or gstMoving or gstHHJumping;
-         PlaySound(sndJump3, false);
-         exit
-         end;
+
+      Gear^.dY:= -_0_2;
+      SetLittle(Gear^.dX);
+      Gear^.State:= Gear^.State or gstMoving or gstHHJumping;
+      PlaySound(sndJump3, false);
+      exit
       end;
 
    PrevdX:= hwSign(Gear^.dX);
@@ -321,7 +319,7 @@
 procedure doStepHedgehogMoving(Gear: PGear);
 var isFalling: boolean;
 begin
-isFalling:= not TestCollisionYKick(Gear, 1);
+isFalling:= (Gear^.dY.isNegative) or not TestCollisionYKick(Gear, 1);
 if isFalling then
    begin
    if (Gear^.dY.isNegative) and TestCollisionYKick(Gear, -1) then Gear^.dY:= _0;
@@ -423,7 +421,7 @@
 	t:= CheckGearNear(Gear, gtCase, 36, 36);
 	if t <> nil then
 		PickUp(Gear, t)
-	end; 
+	end;
 
 if CurAmmoGear <> nil then
    begin
--- a/hedgewars/uCollisions.pas	Mon Apr 21 16:51:14 2008 +0000
+++ b/hedgewars/uCollisions.pas	Mon Apr 21 18:43:07 2008 +0000
@@ -200,7 +200,7 @@
    for i:= 0 to Pred(Count) do
     with cinfos[i] do
       if (Gear <> cGear) and
-         (sqr(mx - x) + sqr(my - y) <= sqr(Radius + Gear^.Radius)) and
+         (sqr(mx - x) + sqr(my - y) <= sqr(Radius + Gear^.Radius + 2)) and
          ((mx > x) xor (Dir > 0)) then
          if (cGear^.Kind in [gtHedgehog, gtMine]) then
              begin
@@ -248,7 +248,7 @@
    for i:= 0 to Pred(Count) do
     with cinfos[i] do
       if (Gear <> cGear) and
-         (sqr(mx - x) + sqr(my - y) <= sqr(Radius + Gear^.Radius)) and
+         (sqr(mx - x) + sqr(my - y) <= sqr(Radius + Gear^.Radius + 2)) and
          ((my > y) xor (Dir > 0)) then
          if (cGear^.Kind in [gtHedgehog, gtMine]) then
              begin
--- a/hedgewars/uGears.pas	Mon Apr 21 16:51:14 2008 +0000
+++ b/hedgewars/uGears.pas	Mon Apr 21 18:43:07 2008 +0000
@@ -404,8 +404,12 @@
         stChDmg: if CheckNoDamage then inc(step) else step:= stDelay;
         stChWin: if not CheckForWin then inc(step) else step:= stDelay;
     stTurnReact: begin
-                 if not isInMultiShoot then uStats.TurnReaction;
-                 inc(step)
+                 if not isInMultiShoot then
+                    begin
+                    uStats.TurnReaction;
+                    inc(step)
+                    end else
+                    inc(step, 2);
                  end;
    stAfterDelay: begin
                  if delay = 0 then
--- a/hedgewars/uLandGraphics.pas	Mon Apr 21 16:51:14 2008 +0000
+++ b/hedgewars/uLandGraphics.pas	Mon Apr 21 18:43:07 2008 +0000
@@ -57,7 +57,7 @@
    begin
    if ((y + dy) and $FFFFFC00) = 0 then
       for i:= max(x - dx, 0) to min(x + dx, 2047) do
-          if (Land[y + dy, i] > 0) then dec(Land[y + dy, i]);
+          if (Land[y + dy, i] > 0) then dec(Land[y + dy, i]); // check > 0 because explosion can erase collision data
    if ((y - dy) and $FFFFFC00) = 0 then
       for i:= max(x - dx, 0) to min(x + dx, 2047) do
           if (Land[y - dy, i] > 0) then dec(Land[y - dy, i]);