--- a/hedgewars/uGearsUtils.pas Thu Aug 23 20:43:39 2012 -0400
+++ b/hedgewars/uGearsUtils.pas Fri Aug 24 14:01:07 2012 +0400
@@ -38,6 +38,8 @@
function CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear;
function CheckGearDrowning(Gear: PGear): boolean;
+procedure CheckCollision(Gear: PGear); inline;
+procedure CheckCollisionWithLand(Gear: PGear); inline;
var doStepHandlers: array[TGearType] of TGearStepProcedure;
@@ -663,4 +665,22 @@
CheckGearNear:= nil
end;
+procedure CheckCollision(Gear: PGear); inline;
+begin
+ if TestCollisionXwithGear(Gear, hwSign(Gear^.dX))
+ or (TestCollisionYwithGear(Gear, hwSign(Gear^.dY)) <> 0) then
+ Gear^.State := Gear^.State or gstCollision
+ else
+ Gear^.State := Gear^.State and (not gstCollision)
+end;
+
+procedure CheckCollisionWithLand(Gear: PGear); inline;
+begin
+ if TestCollisionX(Gear, hwSign(Gear^.dX))
+ or TestCollisionY(Gear, hwSign(Gear^.dY)) then
+ Gear^.State := Gear^.State or gstCollision
+ else
+ Gear^.State := Gear^.State and (not gstCollision)
+end;
+
end.