hedgewars/uGears.pas
changeset 701 8841f71b5e79
parent 700 be4847674071
child 708 6ee55ba9c8fe
equal deleted inserted replaced
700:be4847674071 701:8841f71b5e79
   937     function CountNonZeroz(x, y, r: LongInt): LongInt;
   937     function CountNonZeroz(x, y, r: LongInt): LongInt;
   938     var i: LongInt;
   938     var i: LongInt;
   939         Result: LongInt;
   939         Result: LongInt;
   940     begin
   940     begin
   941     Result:= 0;
   941     Result:= 0;
   942 AddFileLog('x, y, test = ' + inttostr(x) + ', ' + inttostr(y) + ' ,' + inttostr(y and $FFFFFC00));
   942     if (y and $FFFFFC00) = 0 then
   943     if (y and $FFFFFC00) <> 0 then exit;
   943       for i:= max(x - r, 0) to min(x + r, 2043) do
   944     for i:= max(x - r, 0) to min(x + r, 2043) do
       
   945         if Land[y, i] <> 0 then inc(Result);
   944         if Land[y, i] <> 0 then inc(Result);
   946 AddFileLog('CountNonZeroz = ' + inttostr(Result));
       
   947     CountNonZeroz:= Result
   945     CountNonZeroz:= Result
   948     end;
   946     end;
   949 
   947 
   950 var x: LongInt;
   948 var x: LongInt;
   951     y, sy: LongInt;
   949     y, sy: LongInt;
   963      cnt:= 0;
   961      cnt:= 0;
   964      y:= -Gear^.Radius * 2;
   962      y:= -Gear^.Radius * 2;
   965      while y < 1023 do
   963      while y < 1023 do
   966         begin
   964         begin
   967         repeat
   965         repeat
   968           inc(y, 2);
   966          inc(y, 2);
   969         until (y > 1023) or (CountNonZeroz(x, y, Gear^.Radius - 1) = 0);
   967         until (y > 1023) or (CountNonZeroz(x, y, Gear^.Radius - 1) = 0);
   970         sy:= y;
   968         sy:= y;
   971         repeat
   969         repeat
   972           inc(y);
   970           inc(y);
   973         until (y > 1023) or (CountNonZeroz(x, y, Gear^.Radius - 1) <> 0);
   971         until (y > 1023) or (CountNonZeroz(x, y, Gear^.Radius - 1) <> 0);