No more hedgehogs hung in air
authorunc0rr
Sun, 05 Feb 2006 18:51:54 +0000
changeset 62 c3eda0c68cd6
parent 61 505691a09dee
child 63 27e2b5bb6d4b
No more hedgehogs hung in air
hedgewars/HHHandlers.inc
hedgewars/uCollisions.pas
--- a/hedgewars/HHHandlers.inc	Sun Feb 05 12:48:35 2006 +0000
+++ b/hedgewars/HHHandlers.inc	Sun Feb 05 18:51:54 2006 +0000
@@ -270,6 +270,7 @@
          or HHTestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1;
       end;
    if not TestCollisionXwithGear(Gear, Sign(Gear.dX)) then Gear.X:= Gear.X + Gear.dX;
+   SetAllHHToActive;
 
    if not HHTestCollisionYwithGear(Gear, 1) then
    begin
@@ -301,14 +302,14 @@
    end
    end
    end
-   end;
-   SetAllHHToActive
+   end
    end
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepHedgehogFree(Gear: PGear);
 begin
+//DeleteCI(Gear);
 if not HHTestCollisionYwithGear(Gear, 1) then
    begin
    if (Gear.dY < 0) and HHTestCollisionYwithGear(Gear, -1) then Gear.dY:= 0;
@@ -329,11 +330,11 @@
    if TestCollisionXwithGear(Gear, Sign(Gear.dX)) then
       if ((Gear.State and gstFalling) = 0) then
          if abs(Gear.dX) > 0.01 then
-            if not TestCollisionXwithXYShift(Gear, 0, -1, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.9; Gear.Y:= Gear.Y - 1 end else
-            if not TestCollisionXwithXYShift(Gear, 0, -2, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.9; Gear.Y:= Gear.Y - 2 end else
-            if not TestCollisionXwithXYShift(Gear, 0, -3, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.9; Gear.Y:= Gear.Y - 3 end else
-            if not TestCollisionXwithXYShift(Gear, 0, -4, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.9; Gear.Y:= Gear.Y - 4 end else
-            if not TestCollisionXwithXYShift(Gear, 0, -5, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.3; Gear.Y:= Gear.Y - 5 end else
+            if not TestCollisionXwithXYShift(Gear, 0, -1, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.90; Gear.Y:= Gear.Y - 1 end else
+            if not TestCollisionXwithXYShift(Gear, 0, -2, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.88; Gear.Y:= Gear.Y - 2 end else
+            if not TestCollisionXwithXYShift(Gear, 0, -3, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.84; Gear.Y:= Gear.Y - 3 end else
+            if not TestCollisionXwithXYShift(Gear, 0, -4, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.81; Gear.Y:= Gear.Y - 4 end else
+            if not TestCollisionXwithXYShift(Gear, 0, -5, Sign(Gear.dX)) then begin Gear.dX:= Gear.dX * 0.78; Gear.Y:= Gear.Y - 5 end else
             if abs(Gear.dX) > 0.02 then Gear.dX:= -0.5 * Gear.dX
                                    else begin
                                         Gear.State:= Gear.State and not gstMoving;
--- a/hedgewars/uCollisions.pas	Sun Feb 05 12:48:35 2006 +0000
+++ b/hedgewars/uCollisions.pas	Sun Feb 05 18:51:54 2006 +0000
@@ -77,7 +77,7 @@
      X:= round(Gear.X);
      Y:= round(Gear.Y);
      Radius:= Gear.Radius;
-     FillRoundInLand(X, Y, Radius, $FF);
+     FillRoundInLand(X, Y, Radius-1, $FF);
      cGear:= Gear
      end;
 Gear.CollIndex:= Count;
@@ -88,7 +88,7 @@
 begin
 if Gear.CollIndex < Count then
    begin
-   with cinfos[Gear.CollIndex] do FillRoundInLand(X, Y, Radius, 0);
+   with cinfos[Gear.CollIndex] do FillRoundInLand(X, Y, Radius-1, 0);
    cinfos[Gear.CollIndex]:= cinfos[Pred(Count)];
    cinfos[Gear.CollIndex].cGear.CollIndex:= Gear.CollIndex;
    Gear.CollIndex:= High(Longword);