equal
deleted
inserted
replaced
30 procedure SetAmmoProbability(s: shortstring); |
30 procedure SetAmmoProbability(s: shortstring); |
31 procedure SetAmmoDelay(s: shortstring); |
31 procedure SetAmmoDelay(s: shortstring); |
32 procedure SetAmmoReinforcement(s: shortstring); |
32 procedure SetAmmoReinforcement(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; cnt: LongWord); |
35 function HHHasAmmo(var Hedgehog: THedgehog; Ammo: TAmmoType): boolean; |
36 function HHHasAmmo(var Hedgehog: THedgehog; Ammo: TAmmoType): boolean; |
36 procedure PackAmmo(Ammo: PHHAmmo; Slot: LongInt); |
37 procedure PackAmmo(Ammo: PHHAmmo; Slot: LongInt); |
37 procedure OnUsedAmmo(var Hedgehog: THedgehog); |
38 procedure OnUsedAmmo(var Hedgehog: THedgehog); |
38 procedure ApplyAngleBounds(var Hedgehog: THedgehog; AmmoType: TAmmoType); |
39 procedure ApplyAngleBounds(var Hedgehog: THedgehog; AmmoType: TAmmoType); |
39 procedure ApplyAmmoChanges(var Hedgehog: THedgehog); |
40 procedure ApplyAmmoChanges(var Hedgehog: THedgehog); |
41 procedure SetWeapon(weap: TAmmoType); |
42 procedure SetWeapon(weap: TAmmoType); |
42 procedure DisableSomeWeapons; |
43 procedure DisableSomeWeapons; |
43 procedure ResetWeapons; |
44 procedure ResetWeapons; |
44 function GetAmmoByNum(num: Longword): PHHAmmo; |
45 function GetAmmoByNum(num: Longword): PHHAmmo; |
45 function GetAmmoEntry(var Hedgehog: THedgehog): PAmmo; |
46 function GetAmmoEntry(var Hedgehog: THedgehog): PAmmo; |
|
47 function GetAmmoEntry(var Hedgehog: THedgehog; am: TAmmoType): PAmmo; |
46 |
48 |
47 var StoreCnt: Longword; |
49 var StoreCnt: Longword; |
48 |
50 |
49 implementation |
51 implementation |
50 uses uLocale, uMobile, uVariables, uCommands, uUtils, uCaptions, uDebug; |
52 uses uLocale, uMobile, uVariables, uCommands, uUtils, uCaptions, uDebug; |
137 TryDo(num < StoreCnt, 'Invalid store number', true); |
139 TryDo(num < StoreCnt, 'Invalid store number', true); |
138 exit(StoresList[num]) |
140 exit(StoresList[num]) |
139 end; |
141 end; |
140 |
142 |
141 function GetAmmoEntry(var Hedgehog: THedgehog): PAmmo; |
143 function GetAmmoEntry(var Hedgehog: THedgehog): PAmmo; |
|
144 begin |
|
145 GetAmmoEntry:= GetAmmoEntry(Hedgehog, Hedgehog.CurAmmoType) |
|
146 end; |
|
147 |
|
148 function GetAmmoEntry(var Hedgehog: THedgehog; am: TAmmoType): PAmmo; |
142 var ammoidx, slot: LongWord; |
149 var ammoidx, slot: LongWord; |
143 begin |
150 begin |
144 with Hedgehog do |
151 with Hedgehog do |
145 begin |
152 begin |
146 slot:= Ammoz[CurAmmoType].Slot; |
153 slot:= Ammoz[am].Slot; |
147 ammoidx:= 0; |
154 ammoidx:= 0; |
148 while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> CurAmmoType) do inc(ammoidx); |
155 while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> am) do inc(ammoidx); |
149 GetAmmoEntry:= @Ammo^[slot, ammoidx]; |
156 GetAmmoEntry:= @Ammo^[slot, ammoidx]; |
150 end |
157 end |
151 end; |
158 end; |
152 |
159 |
153 procedure AssignStores; |
160 procedure AssignStores; |
168 end |
175 end |
169 end |
176 end |
170 end; |
177 end; |
171 |
178 |
172 procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType); |
179 procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType); |
|
180 begin |
|
181 if GetAmmoEntry(Hedgehog, ammo)^.Count <> AMMO_INFINITE then |
|
182 AddAmmo(Hedgehog, ammo, Ammoz[ammo].NumberInCase); |
|
183 end; |
|
184 |
|
185 procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType; cnt: LongWord); |
173 var ammos: TAmmoCounts; |
186 var ammos: TAmmoCounts; |
174 slot, ami: LongInt; |
187 slot, ami: LongInt; |
175 hhammo: PHHAmmo; |
188 hhammo: PHHAmmo; |
176 begin |
189 begin |
177 {$HINTS OFF} |
190 {$HINTS OFF} |
182 for slot:= 0 to cMaxSlotIndex do |
195 for slot:= 0 to cMaxSlotIndex do |
183 for ami:= 0 to cMaxSlotAmmoIndex do |
196 for ami:= 0 to cMaxSlotAmmoIndex do |
184 if hhammo^[slot, ami].Count > 0 then |
197 if hhammo^[slot, ami].Count > 0 then |
185 ammos[hhammo^[slot, ami].AmmoType]:= hhammo^[slot, ami].Count; |
198 ammos[hhammo^[slot, ami].AmmoType]:= hhammo^[slot, ami].Count; |
186 |
199 |
187 if ammos[ammo] <> AMMO_INFINITE then |
200 ammos[ammo]:= cnt; |
188 begin |
201 if ammos[ammo] > AMMO_INFINITE then ammos[ammo]:= AMMO_INFINITE; |
189 inc(ammos[ammo], Ammoz[ammo].NumberInCase); |
|
190 if ammos[ammo] > AMMO_INFINITE then ammos[ammo]:= AMMO_INFINITE |
|
191 end; |
|
192 |
202 |
193 FillAmmoStore(hhammo, ammos) |
203 FillAmmoStore(hhammo, ammos) |
194 end; |
204 end; |
195 |
205 |
196 procedure PackAmmo(Ammo: PHHAmmo; Slot: LongInt); |
206 procedure PackAmmo(Ammo: PHHAmmo; Slot: LongInt); |