16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
17 *) |
17 *) |
18 |
18 |
19 unit uAmmos; |
19 unit uAmmos; |
20 interface |
20 interface |
21 uses uConsts; |
21 uses uConsts, uTeams; |
22 {$INCLUDE options.inc} |
22 {$INCLUDE options.inc} |
23 type PHHAmmo = ^THHAmmo; |
|
24 THHAmmo = array[0..cMaxSlotIndex, 0..cMaxSlotAmmoIndex] of TAmmo; |
|
25 |
23 |
26 procedure AddAmmoStore(s: shortstring); |
24 procedure AddAmmoStore(s: shortstring); |
27 procedure AssignStores; |
25 procedure AssignStores; |
28 procedure AddAmmo(Hedgehog: pointer; ammo: TAmmoType); |
26 procedure AddAmmo(Hedgehog: pointer; ammo: TAmmoType); |
29 function HHHasAmmo(Hedgehog: pointer; Ammo: TAmmoType): boolean; |
27 function HHHasAmmo(Hedgehog: pointer; Ammo: TAmmoType): boolean; |
30 procedure PackAmmo(Ammo: PHHAmmo; Slot: LongInt); |
28 procedure PackAmmo(Ammo: PHHAmmo; Slot: LongInt); |
31 procedure OnUsedAmmo(Ammo: PHHAmmo); |
29 procedure OnUsedAmmo(var Hedgehog: THedgehog); |
32 |
30 |
33 implementation |
31 implementation |
34 uses uMisc, uTeams, uGears; |
32 uses uMisc, uGears; |
35 type TAmmoCounts = array[TAmmoType] of Longword; |
33 type TAmmoCounts = array[TAmmoType] of Longword; |
36 var StoresList: array[0..Pred(cMaxHHs)] of PHHAmmo; |
34 var StoresList: array[0..Pred(cMaxHHs)] of PHHAmmo; |
37 StoreCnt: Longword = 0; |
35 StoreCnt: Longword = 0; |
38 |
36 |
39 procedure FillAmmoStore(Ammo: PHHAmmo; var cnts: TAmmoCounts); |
37 procedure FillAmmoStore(Ammo: PHHAmmo; var cnts: TAmmoCounts); |
128 Ammo^[Slot, ami + 1].Count:= 0 |
126 Ammo^[Slot, ami + 1].Count:= 0 |
129 end; |
127 end; |
130 until not b; |
128 until not b; |
131 end; |
129 end; |
132 |
130 |
133 procedure OnUsedAmmo(Ammo: PHHAmmo); |
131 procedure OnUsedAmmo(var Hedgehog: THedgehog); |
134 var s, a: Longword; |
132 var s, a: Longword; |
|
133 Ammo: PHHAmmo; |
135 begin |
134 begin |
136 with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog] do |
135 Ammo:= Hedgehog.Ammo; |
|
136 with Hedgehog do |
137 begin |
137 begin |
138 if CurAmmoGear = nil then begin s:= CurSlot; a:= CurAmmo end |
138 if CurAmmoGear = nil then begin s:= CurSlot; a:= CurAmmo end |
139 else begin s:= AltSlot; a:= AltAmmo end; |
139 else begin s:= AltSlot; a:= AltAmmo end; |
140 with Ammo^[s, a] do |
140 with Ammo^[s, a] do |
141 if Count <> AMMO_INFINITE then |
141 if Count <> AMMO_INFINITE then |