rollin' back my silly hack ( rea4d1fe665d7 )
authorsheepluva
Sat, 10 Sep 2011 03:27:47 +0200
changeset 5834 f9944a75b350
parent 5833 d0c742472d46
child 5835 812be8a96927
rollin' back my silly hack ( rea4d1fe665d7 )
hedgewars/HHHandlers.inc
hedgewars/uCollisions.pas
--- a/hedgewars/HHHandlers.inc	Sat Sep 10 01:05:01 2011 +0200
+++ b/hedgewars/HHHandlers.inc	Sat Sep 10 03:27:47 2011 +0200
@@ -770,30 +770,6 @@
    Gear^.State:= Gear^.State and not gstMoving;
    exit
    end;
-
-// move hedgehogs out of walls
-if hwAbs(Gear^.dX) < _0_03 then
-    begin
-    if CountCollisionsX(Gear, -1) > Gear^.Radius then
-        repeat
-        Gear^.X:= Gear^.X + _1;
-        if CountCollisionsX(Gear, 1) > Gear^.Radius then
-            begin
-            Gear^.X:= Gear^.X - _1;
-            break;
-            end
-        until CountCollisionsX(Gear, -1) <= Gear^.Radius
-    else if CountCollisionsX(Gear, 1) > Gear^.Radius then
-        repeat
-        Gear^.X:= Gear^. X - _1;
-        if CountCollisionsX(Gear, -1) > Gear^.Radius then
-            begin
-            Gear^.X:= Gear^.X + _1;
-            break;
-            end
-        until CountCollisionsX(Gear, 1) <= Gear^.Radius;
-    end;
-
 isFalling:= (Gear^.dY.isNegative) or not TestCollisionYKick(Gear, 1);
 if isFalling then
    begin
--- a/hedgewars/uCollisions.pas	Sat Sep 10 01:05:01 2011 +0200
+++ b/hedgewars/uCollisions.pas	Sat Sep 10 03:27:47 2011 +0200
@@ -44,8 +44,6 @@
 function  TestCollisionXKick(Gear: PGear; Dir: LongInt): boolean;
 function  TestCollisionYKick(Gear: PGear; Dir: LongInt): boolean;
 
-function  CountCollisionsX(Gear: PGear; Dir: LongInt): LongInt;
-
 function  TestCollisionX(Gear: PGear; Dir: LongInt): boolean;
 function  TestCollisionY(Gear: PGear; Dir: LongInt): boolean;
 
@@ -303,27 +301,6 @@
 Gear^.X:= Gear^.X - ShiftX;
 Gear^.Y:= Gear^.Y - int2hwFloat(ShiftY)
 end;
-
-function CountCollisionsX(Gear: PGear; Dir: LongInt): LongInt;
-var x, y, i, cnt: LongInt;
-begin
-cnt:= 0;
-x:= hwRound(Gear^.X);
-if Dir < 0 then x:= x - Gear^.Radius
-           else x:= x + Gear^.Radius;
-if (x and LAND_WIDTH_MASK) = 0 then
-   begin
-   y:= hwRound(Gear^.Y) - Gear^.Radius + 1;
-   i:= y + Gear^.Radius * 2 - 2;
-   repeat
-     if (y and LAND_HEIGHT_MASK) = 0 then
-        if Land[y, x] > 255 then inc(cnt);
-     inc(y)
-   until (y > i);
-   end;
-CountCollisionsX:= cnt
-end;
-
 function TestCollisionX(Gear: PGear; Dir: LongInt): boolean;
 var x, y, i: LongInt;
 begin