hedgewars/uGearsUtils.pas
changeset 12454 8c5475bb4db7
parent 12453 8b89fe2115ad
child 12605 ef780eda6e48
equal deleted inserted replaced
12453:8b89fe2115ad 12454:8c5475bb4db7
   891 
   891 
   892                 repeat
   892                 repeat
   893                     inc(y);
   893                     inc(y);
   894                 until (y >= cWaterLine) or
   894                 until (y >= cWaterLine) or
   895                         (ignoreOverlap and 
   895                         (ignoreOverlap and 
   896                                 ((CountLand(x, y, Gear^.Radius - 1, 1, $FFFF, lfIce) <> 0) or
   896                                 (CountLand(x, y, Gear^.Radius - 1, 1, $FFFF, 0) <> 0)) or
   897                                  (CountLand(x, y+1, Gear^.Radius - 1, Gear^.Radius + 1, lfIce, 0) > Gear^.Radius))) or
       
   898                         (not ignoreOverlap and 
   897                         (not ignoreOverlap and 
   899                             ((CountLand(x, y, Gear^.Radius - 1, 1, lfLandMask, lfIce) <> 0) or
   898                             (CountLand(x, y, Gear^.Radius - 1, 1, lfLandMask, 0) <> 0));
   900                              (CountLand(x, y+1, Gear^.Radius - 1, Gear^.Radius + 1, lfIce, 0) > Gear^.Radius)));
       
   901 
   899 
   902                 if (y - sy > Gear^.Radius * 2) and (y < cWaterLine)
   900                 if (y - sy > Gear^.Radius * 2) and (y < cWaterLine)
   903                     and (((Gear^.Kind = gtExplosives)
   901                     and (((Gear^.Kind = gtExplosives)
   904                         and (ignoreNearObjects or NoGearsToAvoid(x, y - Gear^.Radius, 60, 60))
   902                         and (ignoreNearObjects or NoGearsToAvoid(x, y - Gear^.Radius, 60, 60))
   905                         and (isSteadyPosition(x, y+1, Gear^.Radius - 1, 3, $FFFF)
   903                         and (isSteadyPosition(x, y+1, Gear^.Radius - 1, 3, $FFFF)
   906                          or (CountLand(x, y+1, Gear^.Radius - 1, Gear^.Radius+1, $FFFF, 0) > Gear^.Radius)
   904                          or (CountLand(x, y+1, Gear^.Radius - 1, Gear^.Radius+1, $FFFF, 0) > Gear^.Radius)
   907                             ))
   905                             ))
   908                     or
   906                     or
   909                         ((Gear^.Kind <> gtExplosives)
   907                         ((Gear^.Kind <> gtExplosives)
   910                         and (ignoreNearObjects or NoGearsToAvoid(x, y - Gear^.Radius, 110, 110))
   908                         and (ignoreNearObjects or NoGearsToAvoid(x, y - Gear^.Radius, 110, 110))
   911                         )) then
   909                         and (isSteadyPosition(x, y+1, Gear^.Radius - 1, 3, lfIce)
       
   910                          or (CountLand(x, y+1, Gear^.Radius - 1, Gear^.Radius+1, $FFFF, lfIce) <> 0)
       
   911                             ))) then
   912                     begin
   912                     begin
   913                     ar[cnt].X:= x;
   913                     ar[cnt].X:= x;
   914                     if withFall then
   914                     if withFall then
   915                         ar[cnt].Y:= sy + Gear^.Radius
   915                         ar[cnt].Y:= sy + Gear^.Radius
   916                     else
   916                     else