hedgewars/uCollisions.pas
changeset 10354 56bd029245fc
parent 10108 c68cf030eded
child 10494 0eb97cf4c78e
equal deleted inserted replaced
10352:2af2309207b0 10354:56bd029245fc
    52 function  TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: LongInt; Dir: LongInt): Word; inline;
    52 function  TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: LongInt; Dir: LongInt): Word; inline;
    53 function  TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: LongInt; Dir: LongInt; withGear: boolean): Word;
    53 function  TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: LongInt; Dir: LongInt; withGear: boolean): Word;
    54 
    54 
    55 function  TestRectancleForObstacle(x1, y1, x2, y2: LongInt; landOnly: boolean): boolean;
    55 function  TestRectancleForObstacle(x1, y1, x2, y2: LongInt; landOnly: boolean): boolean;
    56 
    56 
       
    57 function  CheckCoordInWater(X, Y: LongInt): boolean; inline;
       
    58 
    57 // returns: negative sign if going downhill to left, value is steepness (noslope/error = _0, 45 = _0_5)
    59 // returns: negative sign if going downhill to left, value is steepness (noslope/error = _0, 45 = _0_5)
    58 function  CalcSlopeBelowGear(Gear: PGear): hwFloat;
    60 function  CalcSlopeBelowGear(Gear: PGear): hwFloat;
    59 function  CalcSlopeNearGear(Gear: PGear; dirX, dirY: LongInt): hwFloat;
    61 function  CalcSlopeNearGear(Gear: PGear; dirX, dirY: LongInt): hwFloat;
    60 function  CalcSlopeTangent(Gear: PGear; collisionX, collisionY: LongInt; var outDeltaX, outDeltaY: LongInt; TestWord: LongWord): boolean;
    62 function  CalcSlopeTangent(Gear: PGear; collisionX, collisionY: LongInt; var outDeltaX, outDeltaY: LongInt; TestWord: LongWord): boolean;
    61 
    63 
   108     cinfos[Gear^.CollisionIndex]:= cinfos[Pred(Count)];
   110     cinfos[Gear^.CollisionIndex]:= cinfos[Pred(Count)];
   109     cinfos[Gear^.CollisionIndex].cGear^.CollisionIndex:= Gear^.CollisionIndex;
   111     cinfos[Gear^.CollisionIndex].cGear^.CollisionIndex:= Gear^.CollisionIndex;
   110     Gear^.CollisionIndex:= -1;
   112     Gear^.CollisionIndex:= -1;
   111     dec(Count)
   113     dec(Count)
   112     end;
   114     end;
       
   115 end;
       
   116 
       
   117 function CheckCoordInWater(X, Y: LongInt): boolean; inline;
       
   118 begin
       
   119     CheckCoordInWater:= (Y > cWaterLine)
       
   120         or ((WorldEdge = weSea) and ((X < leftX) or (X > rightX)));
   113 end;
   121 end;
   114 
   122 
   115 function CheckGearsCollision(Gear: PGear): PGearArray;
   123 function CheckGearsCollision(Gear: PGear): PGearArray;
   116 var mx, my, tr: LongInt;
   124 var mx, my, tr: LongInt;
   117     i: Longword;
   125     i: Longword;