hedgewars/uCollisions.pas
changeset 3414 b2f3bb44777e
parent 3411 30d0d780d605
child 3473 f80431269806
equal deleted inserted replaced
3413:d08eaae8d3e8 3414:b2f3bb44777e
    47 function  TestCollisionY(Gear: PGear; Dir: LongInt): boolean;
    47 function  TestCollisionY(Gear: PGear; Dir: LongInt): boolean;
    48 
    48 
    49 function  TestCollisionXwithXYShift(Gear: PGear; ShiftX: hwFloat; ShiftY: LongInt; Dir: LongInt): boolean;
    49 function  TestCollisionXwithXYShift(Gear: PGear; ShiftX: hwFloat; ShiftY: LongInt; Dir: LongInt): boolean;
    50 function  TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: LongInt; Dir: LongInt): boolean;
    50 function  TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: LongInt; Dir: LongInt): boolean;
    51 
    51 
    52 function  calcSlopeTangent(Gear: PGear; collisionX, collisionY: LongInt; var deltaX, deltaY: LongInt; TestWord: LongWord): Boolean;
    52 function  calcSlopeTangent(Gear: PGear; collisionX, collisionY: LongInt; var outDeltaX, outDeltaY: LongInt; TestWord: LongWord): Boolean;
    53 
    53 
    54 implementation
    54 implementation
    55 uses uMisc, uConsts, uLand, uLandGraphics;
    55 uses uMisc, uConsts, uLand, uLandGraphics;
    56 
    56 
    57 type TCollisionEntry = record
    57 type TCollisionEntry = record
   313 Gear^.X:= Gear^.X - int2hwFloat(ShiftX);
   313 Gear^.X:= Gear^.X - int2hwFloat(ShiftX);
   314 Gear^.Y:= Gear^.Y - int2hwFloat(ShiftY)
   314 Gear^.Y:= Gear^.Y - int2hwFloat(ShiftY)
   315 end;
   315 end;
   316 
   316 
   317 
   317 
   318 function calcSlopeTangent(Gear: PGear; collisionX, collisionY: LongInt; var deltaX, deltaY: LongInt; TestWord: LongWord): boolean;
   318 function calcSlopeTangent(Gear: PGear; collisionX, collisionY: LongInt; var outDeltaX, outDeltaY: LongInt; TestWord: LongWord): boolean;
   319 var ldx, ldy, rdx, rdy: LongInt;
   319 var ldx, ldy, rdx, rdy: LongInt;
   320     i, j, mx, my, li, ri, jfr, jto, tmpo : ShortInt;
   320     i, j, mx, my, li, ri, jfr, jto, tmpo : ShortInt;
   321     tmpx, tmpy: LongWord;
   321     tmpx, tmpy: LongWord;
   322     dx, dy: hwFloat;
   322     dx, dy: hwFloat;
   323     offset: Array[0..7,0..1] of ShortInt;
   323     offset: Array[0..7,0..1] of ShortInt;
   414     ldx:= rdx - ldx;
   414     ldx:= rdx - ldx;
   415     ldy:= rdy - ldy;
   415     ldy:= rdy - ldy;
   416 
   416 
   417     if ((ldx = 0) and (ldy = 0)) then EXIT(false);
   417     if ((ldx = 0) and (ldy = 0)) then EXIT(false);
   418 
   418 
   419 deltaX:= ldx;
   419 outDeltaX:= ldx;
   420 deltaY:= ldy;
   420 outDeltaY:= ldy;
   421 exit(true);
   421 exit(true);
   422 end;
   422 end;
   423 
   423 
   424 procedure initModule;
   424 procedure initModule;
   425 begin
   425 begin