hedgewars/uGearsUtils.pas
changeset 15708 88037382ae43
parent 15656 c34cad72cd85
child 15709 6b04399c84a7
equal deleted inserted replaced
15707:26c6e5325075 15708:88037382ae43
   955             while y < cWaterLine do
   955             while y < cWaterLine do
   956                 begin
   956                 begin
   957                 repeat
   957                 repeat
   958                     inc(y, 2);
   958                     inc(y, 2);
   959                 until (y >= cWaterLine) or
   959                 until (y >= cWaterLine) or
   960                     (ignoreOverLap and (CountLand(x, y, Gear^.Radius - 1, 1, $FF00, 0) = 0)) or
   960                     (ignoreOverLap and (CountLand(x, y, Gear^.Radius - 1, 1, lfLandMask, 0) = 0)) or
   961                     (not ignoreOverLap and (CountLand(x, y, Gear^.Radius - 1, 1, $FFFF, 0) = 0));
   961                     (not ignoreOverLap and (CountLand(x, y, Gear^.Radius - 1, 1, lfAll, 0) = 0));
   962 
       
   963 
   962 
   964                 sy:= y;
   963                 sy:= y;
   965 
   964 
   966                 repeat
   965                 repeat
   967                     inc(y);
   966                     inc(y);
   968                 until (y >= cWaterLine) or
   967                 until (y >= cWaterLine) or
   969                         (ignoreOverlap and 
   968                         (ignoreOverlap and 
   970                                 (CountLand(x, y, Gear^.Radius - 1, 1, $FFFF, 0) <> 0)) or
   969                                 (CountLand(x, y, Gear^.Radius - 1, 1, lfAll, 0) <> 0)) or
   971                         (not ignoreOverlap and 
   970                         (not ignoreOverlap and 
   972                             (CountLand(x, y, Gear^.Radius - 1, 1, lfLandMask, 0) <> 0));
   971                             (CountLand(x, y, Gear^.Radius - 1, 1, lfLandMask, 0) <> 0));
   973 
   972 
   974                 if (y - sy > Gear^.Radius * 2) and (y < cWaterLine)
   973                 if (y - sy > Gear^.Radius * 2) and (y < cWaterLine)
   975                     and (((Gear^.Kind = gtExplosives)
   974                     and (((Gear^.Kind = gtExplosives)
   976                         and (ignoreNearObjects or NoGearsToAvoid(x, y - Gear^.Radius, 60, 60))
   975                         and (ignoreNearObjects or NoGearsToAvoid(x, y - Gear^.Radius, 60, 60))
   977                         and (isSteadyPosition(x, y+1, Gear^.Radius - 1, 3, $FFFF)
   976                         and (isSteadyPosition(x, y+1, Gear^.Radius - 1, 3, lfAll)
   978                          or (CountLand(x, y+1, Gear^.Radius - 1, Gear^.Radius+1, $FFFF, 0) > Gear^.Radius)
   977                          or (CountLand(x, y+1, Gear^.Radius - 1, Gear^.Radius+1, lfAll, 0) > Gear^.Radius)
   979                             ))
   978                             ))
   980                     or
   979                     or
   981                         ((Gear^.Kind <> gtExplosives)
   980                         ((Gear^.Kind <> gtExplosives)
   982                         and (ignoreNearObjects or NoGearsToAvoid(x, y - Gear^.Radius, 110, 110))
   981                         and (ignoreNearObjects or NoGearsToAvoid(x, y - Gear^.Radius, 110, 110))
   983                         and (isSteadyPosition(x, y+1, Gear^.Radius - 1, 3, lfIce)
   982                         and (isSteadyPosition(x, y+1, Gear^.Radius - 1, 3, lfIce)
   984                          or (CountLand(x, y+1, Gear^.Radius - 1, Gear^.Radius+1, $FFFF, lfIce) <> 0)
   983                          or (CountLand(x, y+1, Gear^.Radius - 1, Gear^.Radius+1, lfAll, lfIce) <> 0)
   985                             ))) then
   984                             ))) then
   986                     begin
   985                     begin
   987                     ar[cnt].X:= x;
   986                     ar[cnt].X:= x;
   988                     if withFall then
   987                     if withFall then
   989                         ar[cnt].Y:= sy + Gear^.Radius
   988                         ar[cnt].Y:= sy + Gear^.Radius