hedgewars/uGears.pas
changeset 394 4c017ae1226a
parent 393 db01cc79f278
child 408 6c3da4907d00
equal deleted inserted replaced
393:db01cc79f278 394:4c017ae1226a
   219                 Result^.Y:= Result^.Y - 16;
   219                 Result^.Y:= Result^.Y - 16;
   220                 Result^.State:= 8
   220                 Result^.State:= 8
   221                 end;
   221                 end;
   222         gtRope: begin
   222         gtRope: begin
   223                 Result^.Radius:= 3;
   223                 Result^.Radius:= 3;
   224                 Result^.Friction:= 500;
   224                 Result^.Friction:= 450;
   225                 RopePoints.Count:= 0;
   225                 RopePoints.Count:= 0;
   226                 end;
   226                 end;
   227    gtExplosion: begin
   227    gtExplosion: begin
   228                 Result^.X:= Result^.X - 25;
   228                 Result^.X:= Result^.X - 25;
   229                 Result^.Y:= Result^.Y - 25;
   229                 Result^.Y:= Result^.Y - 25;
   796       end;
   796       end;
   797 CountGears:= Result
   797 CountGears:= Result
   798 end;
   798 end;
   799 
   799 
   800 procedure SpawnBoxOfSmth;
   800 procedure SpawnBoxOfSmth;
       
   801 var t: LongInt;
       
   802     i: TAmmoType;
   801 begin
   803 begin
   802 if (CountGears(gtCase) >= 5) or (getrandom(cCaseFactor) <> 0) then exit;
   804 if (CountGears(gtCase) >= 5) or (getrandom(cCaseFactor) <> 0) then exit;
   803 FollowGear:= AddGear(0, 0, gtCase, 0, 0, 0, 0);
   805 FollowGear:= AddGear(0, 0, gtCase, 0, 0, 0, 0);
   804 case getrandom(2) of
   806 case getrandom(2) of
   805      0: begin
   807      0: begin
   806         FollowGear^.Health:= 25;
   808         FollowGear^.Health:= 25;
   807         FollowGear^.Pos:= posCaseHealth
   809         FollowGear^.Pos:= posCaseHealth
   808         end;
   810         end;
   809      1: begin
   811      1: begin
       
   812         t:= 0;
       
   813         for i:= Low(TAmmoType) to High(TAmmoType) do
       
   814             inc(t, Ammoz[i].Probability);
       
   815         t:= GetRandom(t);
       
   816         i:= Low(TAmmoType);
       
   817         dec(t, Ammoz[i].Probability);
       
   818         while t >= 0 do
       
   819           begin
       
   820           inc(i);
       
   821           dec(t, Ammoz[i].Probability)
       
   822           end;
   810         FollowGear^.Pos:= posCaseAmmo;
   823         FollowGear^.Pos:= posCaseAmmo;
   811         FollowGear^.State:= Longword(amMineStrike)
   824         FollowGear^.State:= Longword(i)
   812         end;
   825         end;
   813      end;
   826      end;
   814 FindPlace(FollowGear, true, 0, 2048)
   827 FindPlace(FollowGear, true, 0, 2048)
   815 end;
   828 end;
   816 
   829