hedgewars/uGearsHandlersRope.pas
changeset 10680 4a4a82686e91
parent 10108 c68cf030eded
child 10684 d403fd2f9a6f
equal deleted inserted replaced
10679:5989c293955a 10680:4a4a82686e91
   119     lx, ly, cd: LongInt;
   119     lx, ly, cd: LongInt;
   120     haveCollision,
   120     haveCollision,
   121     haveDivided: boolean;
   121     haveDivided: boolean;
   122     wrongSide: boolean;
   122     wrongSide: boolean;
   123 begin
   123 begin
       
   124     HHGear := Gear^.Hedgehog^.Gear;
       
   125 
       
   126     if ((HHGear^.State and gstHHDriven) = 0) or
       
   127         (CheckGearDrowning(HHGear)) or (Gear^.PortalCounter <> 0) then
       
   128         begin
       
   129         PlaySound(sndRopeRelease);
       
   130         RopeDeleteMe(Gear, HHGear);
       
   131         exit
       
   132         end;
       
   133 
   124     if GameTicks mod 4 <> 0 then exit;
   134     if GameTicks mod 4 <> 0 then exit;
   125 
       
   126     HHGear := Gear^.Hedgehog^.Gear;
       
   127 
   135 
   128     tX:= HHGear^.X;
   136     tX:= HHGear^.X;
   129     if WorldWrap(HHGear) and (WorldEdge = weWrap) and
   137     if WorldWrap(HHGear) and (WorldEdge = weWrap) and
   130        ((TestCollisionXwithGear(HHGear, 1) <> 0) or (TestCollisionXwithGear(HHGear, -1) <> 0))  then
   138        ((TestCollisionXwithGear(HHGear, 1) <> 0) or (TestCollisionXwithGear(HHGear, -1) <> 0))  then
   131         begin
   139         begin
   135         HHGear^.dX.isNegative:= hwRound(tX) > LongInt(leftX) + HHGear^.Radius * 2;
   143         HHGear^.dX.isNegative:= hwRound(tX) > LongInt(leftX) + HHGear^.Radius * 2;
   136         exit
   144         exit
   137         end;
   145         end;
   138 
   146 
   139     tX:= HHGear^.X;
   147     tX:= HHGear^.X;
   140     if ((HHGear^.State and gstHHDriven) = 0) or
       
   141         (CheckGearDrowning(HHGear)) or (Gear^.PortalCounter <> 0) then
       
   142         begin
       
   143         PlaySound(sndRopeRelease);
       
   144         RopeDeleteMe(Gear, HHGear);
       
   145         exit
       
   146         end;
       
   147 
       
   148     HHGear^.dX.QWordValue:= HHGear^.dX.QWordValue shl 2;
   148     HHGear^.dX.QWordValue:= HHGear^.dX.QWordValue shl 2;
   149     HHGear^.dY.QWordValue:= HHGear^.dY.QWordValue shl 2;
   149     HHGear^.dY.QWordValue:= HHGear^.dY.QWordValue shl 2;
   150     if (Gear^.Message and gmLeft  <> 0) and (TestCollisionXwithGear(HHGear, -1) = 0) then
   150     if (Gear^.Message and gmLeft  <> 0) and (TestCollisionXwithGear(HHGear, -1) = 0) then
   151         HHGear^.dX := HHGear^.dX - _0_0032;
   151         HHGear^.dX := HHGear^.dX - _0_0032;
   152 
   152