hedgewars/uGears.pas
changeset 51 b6e3ae05857f
parent 49 3afe33c1cf06
child 53 0e27949850e3
equal deleted inserted replaced
50:9ab4067dabec 51:b6e3ae05857f
   567                              Gear.dY:= Gear.dY + dmg / 200 * sign(Gear.Y - Y);
   567                              Gear.dY:= Gear.dY + dmg / 200 * sign(Gear.Y - Y);
   568                              Gear.Active:= true;
   568                              Gear.Active:= true;
   569                              FollowGear:= Gear
   569                              FollowGear:= Gear
   570                              end;
   570                              end;
   571                           end;
   571                           end;
   572                  gtGrave: Gear.dY:= - dmg / 250;
   572                  gtGrave: begin
       
   573                           Gear.dY:= - dmg / 250;
       
   574                           Gear.Active:= true;
       
   575                           end;
   573               end;
   576               end;
   574          end;
   577          end;
   575       Gear:= Gear.NextGear
   578       Gear:= Gear.NextGear
   576       end
   579       end
   577 end;
   580 end;
   638       begin
   641       begin
   639       if t.Kind in Kind then
   642       if t.Kind in Kind then
   640          if sqr(mX - t.X) / rX + sqr(mY - t.Y) / rY <= 1 then
   643          if sqr(mX - t.X) / rX + sqr(mY - t.Y) / rY <= 1 then
   641             begin
   644             begin
   642             Result:= t;
   645             Result:= t;
   643 //            {$IFDEF DEBUGFILE}AddFileLog('CheckGearsNear: near ('+inttostr(mx)+','+inttostr(my)+') is gear '+inttostr(integer(t)));{$ENDIF}
       
   644             exit
   646             exit
   645             end;
   647             end;
   646       t:= t.NextGear
   648       t:= t.NextGear
   647       end;
   649       end;
   648 Result:= nil
   650 Result:= nil
   666 begin
   668 begin
   667 if (CountGears(gtCase) > 1) or (getrandom(3) <> 0) then exit;
   669 if (CountGears(gtCase) > 1) or (getrandom(3) <> 0) then exit;
   668 k:= 7;
   670 k:= 7;
   669 repeat
   671 repeat
   670   x:= getrandom(2000) + 24;
   672   x:= getrandom(2000) + 24;
   671 //  {$IFDEF DEBUGFILE}AddFileLog('SpawnBoxOfSmth: check x = '+inttostr(x));{$ENDIF}
       
   672   b:= false;
   673   b:= false;
   673   y:= -1;
   674   y:= -1;
   674   while (y < 1023) and not b do
   675   while (y < 1023) and not b do
   675         begin
   676         begin
   676         inc(y);
   677         inc(y);
   678         while (i <= x + 13) and not b do // 13 is gtCase HalfWidth-1
   679         while (i <= x + 13) and not b do // 13 is gtCase HalfWidth-1
   679               begin
   680               begin
   680               if Land[y, i] <> 0 then
   681               if Land[y, i] <> 0 then
   681                  begin
   682                  begin
   682                  b:= true;
   683                  b:= true;
   683 //                 {$IFDEF DEBUGFILE}AddFileLog('SpawnBoxOfSmth: Land['+inttostr(y)+','+inttostr(i)+'] <> 0');{$ENDIF}
       
   684                  end;
   684                  end;
   685               inc(i)
   685               inc(i)
   686               end;
   686               end;
   687         end;
   687         end;
   688   if b then
   688   if b then