hedgewars/uAmmos.pas
changeset 7337 c224cd2d32f3
parent 7037 7edce323558f
child 7341 d70478d265ec
equal deleted inserted replaced
7335:3c6f08af7dac 7337:c224cd2d32f3
    30 procedure SetAmmoProbability(var s: shortstring);
    30 procedure SetAmmoProbability(var s: shortstring);
    31 procedure SetAmmoDelay(var s: shortstring);
    31 procedure SetAmmoDelay(var s: shortstring);
    32 procedure SetAmmoReinforcement(var s: shortstring);
    32 procedure SetAmmoReinforcement(var s: shortstring);
    33 procedure AssignStores;
    33 procedure AssignStores;
    34 procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType);
    34 procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType);
       
    35 procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType; amt: LongWord);
    35 procedure SetAmmo(var Hedgehog: THedgehog; ammo: TAmmoType; cnt: LongWord);
    36 procedure SetAmmo(var Hedgehog: THedgehog; ammo: TAmmoType; cnt: LongWord);
    36 function  HHHasAmmo(var Hedgehog: THedgehog; Ammo: TAmmoType): LongWord;
    37 function  HHHasAmmo(var Hedgehog: THedgehog; Ammo: TAmmoType): LongWord;
    37 procedure PackAmmo(Ammo: PHHAmmo; Slot: LongInt);
    38 procedure PackAmmo(Ammo: PHHAmmo; Slot: LongInt);
    38 procedure OnUsedAmmo(var Hedgehog: THedgehog);
    39 procedure OnUsedAmmo(var Hedgehog: THedgehog);
    39 procedure ApplyAngleBounds(var Hedgehog: THedgehog; AmmoType: TAmmoType);
    40 procedure ApplyAngleBounds(var Hedgehog: THedgehog; AmmoType: TAmmoType);
   186                     Hedgehogs[i].CurAmmoType:= amNothing
   187                     Hedgehogs[i].CurAmmoType:= amNothing
   187                 end
   188                 end
   188         end
   189         end
   189 end;
   190 end;
   190 
   191 
   191 procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType);
   192 procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType; amt: LongWord);
   192 var cnt: LongWord;
   193 var cnt: LongWord;
   193     a: PAmmo;
   194     a: PAmmo;
   194 begin
   195 begin
   195 a:= GetAmmoEntry(Hedgehog, ammo);
   196 a:= GetAmmoEntry(Hedgehog, ammo);
   196 if (a^.AmmoType <> amNothing) then
   197 if (a^.AmmoType <> amNothing) then
   197     cnt:= a^.Count
   198     cnt:= a^.Count
   198 else
   199 else
   199     cnt:= 0;
   200     cnt:= 0;
   200 if (cnt <> AMMO_INFINITE) then
   201 if (cnt <> AMMO_INFINITE) then
   201     begin
   202     begin
   202     inc(cnt, Ammoz[ammo].NumberInCase);
   203     inc(cnt, amt);
   203     SetAmmo(Hedgehog, ammo, cnt)
   204     SetAmmo(Hedgehog, ammo, cnt)
   204     end
   205     end
       
   206 end;
       
   207 
       
   208 procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType);
       
   209 begin
       
   210     AddAmmo(Hedgehog, ammo, Ammoz[ammo].NumberInCase);
   205 end;
   211 end;
   206 
   212 
   207 procedure SetAmmo(var Hedgehog: THedgehog; ammo: TAmmoType; cnt: LongWord);
   213 procedure SetAmmo(var Hedgehog: THedgehog; ammo: TAmmoType; cnt: LongWord);
   208 var ammos: TAmmoCounts;
   214 var ammos: TAmmoCounts;
   209     slot, ami: LongInt;
   215     slot, ami: LongInt;