hedgewars/uGearsHandlers.pas
changeset 7721 2b1ad418ba39
parent 7671 43f38923bc6e
child 9080 9b42757d7e71
equal deleted inserted replaced
7720:8e6b79a020f8 7721:2b1ad418ba39
    33 
    33 
    34 const dirs: array[0..3] of TPoint =   ((X: 0; Y: -1), (X: 1; Y: 0),(X: 0; Y: 1),(X: -1; Y: 0));
    34 const dirs: array[0..3] of TPoint =   ((X: 0; Y: -1), (X: 1; Y: 0),(X: 0; Y: 1),(X: -1; Y: 0));
    35 
    35 
    36 procedure PrevAngle(Gear: PGear; dA: LongInt); inline;
    36 procedure PrevAngle(Gear: PGear; dA: LongInt); inline;
    37 begin
    37 begin
    38     Gear^.Angle := (Gear^.Angle - dA) and 3
    38     Gear^.Angle := (LongInt(Gear^.Angle) - dA) and 3
    39 end;
    39 end;
    40 
    40 
    41 procedure NextAngle(Gear: PGear; dA: LongInt); inline;
    41 procedure NextAngle(Gear: PGear; dA: LongInt); inline;
    42 begin
    42 begin
    43     Gear^.Angle := (Gear^.Angle + dA) and 3
    43     Gear^.Angle := (LongInt(Gear^.Angle) + dA) and 3
    44 end;
    44 end;
    45 
    45 
    46 procedure cakeStep(Gear: PGear);
    46 procedure cakeStep(Gear: PGear);
    47 var
    47 var
    48     xx, yy, xxn, yyn: LongInt;
    48     xx, yy, xxn, yyn: LongInt;
    49     dA: LongInt;
    49     dA: LongInt;
    50 begin
    50 begin
    51     dA := hwSign(Gear^.dX);
    51     dA := hwSign(Gear^.dX);
    52     xx := dirs[Gear^.Angle].x;
    52     xx := dirs[Gear^.Angle].x;
    53     yy := dirs[Gear^.Angle].y;
    53     yy := dirs[Gear^.Angle].y;
    54     xxn := dirs[(Gear^.Angle + dA) and 3].x;
    54     xxn := dirs[(LongInt(Gear^.Angle) + dA) and 3].x;
    55     yyn := dirs[(Gear^.Angle + dA) and 3].y;
    55     yyn := dirs[(LongInt(Gear^.Angle) + dA) and 3].y;
    56 
    56 
    57     if (xx = 0) then
    57     if (xx = 0) then
    58         if TestCollisionYwithGear(Gear, yy) <> 0 then
    58         if TestCollisionYwithGear(Gear, yy) <> 0 then
    59             PrevAngle(Gear, dA)
    59             PrevAngle(Gear, dA)
    60     else
    60     else