hedgewars/uCollisions.pas
changeset 498 9c8b385dc9a1
parent 393 db01cc79f278
child 504 13b6ebc53627
equal deleted inserted replaced
497:adf1aee202c6 498:9c8b385dc9a1
    32 procedure DeleteCI(Gear: PGear);
    32 procedure DeleteCI(Gear: PGear);
    33 function CheckGearsCollision(Gear: PGear): PGearArray;
    33 function CheckGearsCollision(Gear: PGear): PGearArray;
    34 function TestCollisionXwithGear(Gear: PGear; Dir: LongInt): boolean;
    34 function TestCollisionXwithGear(Gear: PGear; Dir: LongInt): boolean;
    35 function TestCollisionYwithGear(Gear: PGear; Dir: LongInt): boolean;
    35 function TestCollisionYwithGear(Gear: PGear; Dir: LongInt): boolean;
    36 function TestCollisionY(Gear: PGear; Dir: LongInt): boolean;
    36 function TestCollisionY(Gear: PGear; Dir: LongInt): boolean;
    37 function TestCollisionXwithXYShift(Gear: PGear; ShiftX, ShiftY: hwFloat; Dir: LongInt): boolean;
    37 function TestCollisionXwithXYShift(Gear: PGear; ShiftX: hwFloat; ShiftY: LongInt; Dir: LongInt): boolean;
    38 function TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: LongInt; Dir: LongInt): boolean;
    38 function TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: LongInt; Dir: LongInt): boolean;
    39 
    39 
    40 implementation
    40 implementation
    41 uses uMisc, uConsts, uLand, uLandGraphics;
    41 uses uMisc, uConsts, uLand, uLandGraphics;
    42 
    42 
   117    until (y > i);
   117    until (y > i);
   118    end;
   118    end;
   119 TestCollisionXwithGear:= false
   119 TestCollisionXwithGear:= false
   120 end;
   120 end;
   121 
   121 
   122 function TestCollisionXwithXYShift(Gear: PGear; ShiftX, ShiftY: hwFloat; Dir: LongInt): boolean;
   122 function TestCollisionXwithXYShift(Gear: PGear; ShiftX: hwFloat; ShiftY: LongInt; Dir: LongInt): boolean;
   123 begin
   123 begin
   124 Gear^.X:= Gear^.X + ShiftX;
   124 Gear^.X:= Gear^.X + ShiftX;
   125 Gear^.Y:= Gear^.Y + ShiftY;
   125 Gear^.Y:= Gear^.Y + int2hwFloat(ShiftY);
   126 TestCollisionXwithXYShift:= TestCollisionXwithGear(Gear, Dir);
   126 TestCollisionXwithXYShift:= TestCollisionXwithGear(Gear, Dir);
   127 Gear^.X:= Gear^.X - ShiftX;
   127 Gear^.X:= Gear^.X - ShiftX;
   128 Gear^.Y:= Gear^.Y - ShiftY
   128 Gear^.Y:= Gear^.Y - int2hwFloat(ShiftY)
   129 end;
   129 end;
   130 
   130 
   131 function TestCollisionYwithGear(Gear: PGear; Dir: LongInt): boolean;
   131 function TestCollisionYwithGear(Gear: PGear; Dir: LongInt): boolean;
   132 var x, y, i: LongInt;
   132 var x, y, i: LongInt;
   133 begin
   133 begin
   166 TestCollisionY:= false
   166 TestCollisionY:= false
   167 end;
   167 end;
   168 
   168 
   169 function TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: LongInt; Dir: LongInt): boolean;
   169 function TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: LongInt; Dir: LongInt): boolean;
   170 begin
   170 begin
   171 Gear^.X:= Gear^.X + ShiftX;
   171 Gear^.X:= Gear^.X + int2hwFloat(ShiftX);
   172 Gear^.Y:= Gear^.Y + ShiftY;
   172 Gear^.Y:= Gear^.Y + int2hwFloat(ShiftY);
   173 TestCollisionYwithXYShift:= TestCollisionYwithGear(Gear, Dir);
   173 TestCollisionYwithXYShift:= TestCollisionYwithGear(Gear, Dir);
   174 Gear^.X:= Gear^.X - ShiftX;
   174 Gear^.X:= Gear^.X - int2hwFloat(ShiftX);
   175 Gear^.Y:= Gear^.Y - ShiftY
   175 Gear^.Y:= Gear^.Y - int2hwFloat(ShiftY)
   176 end;
   176 end;
   177 
   177 
   178 end.
   178 end.