hedgewars/GSHandlers.inc
changeset 776 8fc7e59d9cb4
parent 764 7513452b1d51
child 789 3d976d2579eb
equal deleted inserted replaced
775:23c253aae336 776:8fc7e59d9cb4
    49 end;
    49 end;
    50 
    50 
    51 ////////////////////////////////////////////////////////////////////////////////
    51 ////////////////////////////////////////////////////////////////////////////////
    52 ////////////////////////////////////////////////////////////////////////////////
    52 ////////////////////////////////////////////////////////////////////////////////
    53 procedure CalcRotationDirAngle(Gear: PGear);
    53 procedure CalcRotationDirAngle(Gear: PGear);
    54 var dAngle: hwFloat;
    54 var dAngle: real;
    55 begin
    55 begin
    56 dAngle:= (hwAbs(Gear^.dX) + hwAbs(Gear^.dY)) * _0_1;
    56 dAngle:= (hwAbs(Gear^.dX) + hwAbs(Gear^.dY)).QWordValue / $80000000;
    57 if not Gear^.dX.isNegative then Gear^.DirAngle:= Gear^.DirAngle + dAngle
    57 if not Gear^.dX.isNegative then Gear^.DirAngle:= Gear^.DirAngle + dAngle
    58                 else Gear^.DirAngle:= Gear^.DirAngle - dAngle;
    58                 else Gear^.DirAngle:= Gear^.DirAngle - dAngle;
    59 if Gear^.DirAngle.isNegative then Gear^.DirAngle:= Gear^.DirAngle + _16
    59 if Gear^.DirAngle < 0 then Gear^.DirAngle:= Gear^.DirAngle + 360
    60 else if _16 < Gear^.DirAngle then Gear^.DirAngle:= Gear^.DirAngle - _16
    60 else if 360 < Gear^.DirAngle then Gear^.DirAngle:= Gear^.DirAngle - 360
    61 end;
    61 end;
    62 
    62 
    63 ////////////////////////////////////////////////////////////////////////////////
    63 ////////////////////////////////////////////////////////////////////////////////
    64 procedure doStepDrowningGear(Gear: PGear);
    64 procedure doStepDrowningGear(Gear: PGear);
    65 begin
    65 begin
   597            begin
   597            begin
   598            with RopePoints.ar[RopePoints.Count] do
   598            with RopePoints.ar[RopePoints.Count] do
   599                 begin
   599                 begin
   600                 X:= Gear^.X;
   600                 X:= Gear^.X;
   601                 Y:= Gear^.Y;
   601                 Y:= Gear^.Y;
   602                 if RopePoints.Count = 0 then RopePoints.HookAngle:= DxDy2Angle32(Gear^.dY, Gear^.dX);
   602                 if RopePoints.Count = 0 then RopePoints.HookAngle:= DxDy2Angle(Gear^.dY, Gear^.dX);
   603                 b:= (cc * HHGear^.dY) > (cs * HHGear^.dX);
   603                 b:= (cc * HHGear^.dY) > (cs * HHGear^.dX);
   604                 dLen:= len
   604                 dLen:= len
   605                 end;
   605                 end;
   606            Gear^.X:= Gear^.X + tx;
   606            Gear^.X:= Gear^.X + tx;
   607            Gear^.Y:= Gear^.Y + ty;
   607            Gear^.Y:= Gear^.Y + ty;