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 |