hedgewars/uAmmos.pas
changeset 1964 dc9ea05c9d2f
parent 1922 88cdabb51995
child 1966 31e449e1d9dd
equal deleted inserted replaced
1963:58c29439225d 1964:dc9ea05c9d2f
    25 procedure AssignStores;
    25 procedure AssignStores;
    26 procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType);
    26 procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType);
    27 function  HHHasAmmo(var Hedgehog: THedgehog; Ammo: TAmmoType): boolean;
    27 function  HHHasAmmo(var Hedgehog: THedgehog; Ammo: TAmmoType): boolean;
    28 procedure PackAmmo(Ammo: PHHAmmo; Slot: LongInt);
    28 procedure PackAmmo(Ammo: PHHAmmo; Slot: LongInt);
    29 procedure OnUsedAmmo(var Hedgehog: THedgehog);
    29 procedure OnUsedAmmo(var Hedgehog: THedgehog);
    30 procedure ApplyAngleBounds(var Hedgehog: THedgehog);
    30 procedure ApplyAngleBounds(var Hedgehog: THedgehog; AmmoType: TAmmoType);
    31 procedure ApplyAmmoChanges(var Hedgehog: THedgehog);
    31 procedure ApplyAmmoChanges(var Hedgehog: THedgehog);
    32 procedure SwitchNotHeldAmmo(var Hedgehog: THedgehog);
    32 procedure SwitchNotHeldAmmo(var Hedgehog: THedgehog);
    33 procedure SetWeapon(weap: TAmmoType);
    33 procedure SetWeapon(weap: TAmmoType);
    34 procedure DisableSomeWeapons;
    34 procedure DisableSomeWeapons;
    35 
    35 
   178       inc(ami)
   178       inc(ami)
   179       end;
   179       end;
   180 HHHasAmmo:= false
   180 HHHasAmmo:= false
   181 end;
   181 end;
   182 
   182 
   183 procedure ApplyAngleBounds(var Hedgehog: THedgehog);
   183 procedure ApplyAngleBounds(var Hedgehog: THedgehog; AmmoType: TAmmoType);
   184 begin
   184 begin
   185 with Hedgehog do
   185 with Hedgehog do
   186 	with Ammo^[CurSlot, CurAmmo] do
   186 	begin
   187 		begin
   187 	CurMinAngle:= Ammoz[AmmoType].minAngle;
   188 		CurMinAngle:= Ammoz[AmmoType].minAngle;
   188 	if Ammoz[AmmoType].maxAngle <> 0 then
   189 		if Ammoz[AmmoType].maxAngle <> 0 then
   189 		CurMaxAngle:= Ammoz[AmmoType].maxAngle
   190 			CurMaxAngle:= Ammoz[AmmoType].maxAngle
   190 	else
   191 		else
   191 		CurMaxAngle:= cMaxAngle;
   192 			CurMaxAngle:= cMaxAngle;
   192 
   193 
   193 	with Hedgehog.Gear^ do
   194 		with Hedgehog.Gear^ do
   194 		begin
   195 			begin
   195 		if Angle < CurMinAngle then Angle:= CurMinAngle;
   196 			if Angle < CurMinAngle then Angle:= CurMinAngle;
   196 		if Angle > CurMaxAngle then Angle:= CurMaxAngle;
   197 			if Angle > CurMaxAngle then Angle:= CurMaxAngle;
       
   198 			end
       
   199 		end
   197 		end
       
   198 	end
   200 end;
   199 end;
   201 
   200 
   202 procedure ApplyAmmoChanges(var Hedgehog: THedgehog);
   201 procedure ApplyAmmoChanges(var Hedgehog: THedgehog);
   203 var s: shortstring;
   202 var s: shortstring;
   204 begin
   203 begin
   211 		CurAmmo:= 0;
   210 		CurAmmo:= 0;
   212 		CurSlot:= 0;
   211 		CurSlot:= 0;
   213 		while (CurSlot <= cMaxSlotIndex) and (Ammo^[CurSlot, CurAmmo].Count = 0) do inc(CurSlot)
   212 		while (CurSlot <= cMaxSlotIndex) and (Ammo^[CurSlot, CurAmmo].Count = 0) do inc(CurSlot)
   214 		end;
   213 		end;
   215 
   214 
   216 	ApplyAngleBounds(Hedgehog);
   215 	ApplyAngleBounds(Hedgehog, Ammo^[CurSlot, CurAmmo].AmmoType);
   217 
   216 
   218 	with Ammo^[CurSlot, CurAmmo] do
   217 	with Ammo^[CurSlot, CurAmmo] do
   219 		begin
   218 		begin
   220 		s:= trammo[Ammoz[AmmoType].NameId];
   219 		s:= trammo[Ammoz[AmmoType].NameId];
   221 		if Count <> AMMO_INFINITE then
   220 		if Count <> AMMO_INFINITE then