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 ApplyAmmoChanges(var Hedgehog: THedgehog); |
31 procedure ApplyAmmoChanges(var Hedgehog: THedgehog); |
31 procedure SwitchNotHoldedAmmo(var Hedgehog: THedgehog); |
32 procedure SwitchNotHeldAmmo(var Hedgehog: THedgehog); |
32 procedure SetWeapon(weap: TAmmoType); |
33 procedure SetWeapon(weap: TAmmoType); |
33 procedure DisableSomeWeapons; |
34 procedure DisableSomeWeapons; |
34 |
35 |
35 implementation |
36 implementation |
36 uses uMisc, uGears, uWorld, uLocale, uConsole; |
37 uses uMisc, uGears, uWorld, uLocale, uConsole; |
177 inc(ami) |
178 inc(ami) |
178 end; |
179 end; |
179 HHHasAmmo:= false |
180 HHHasAmmo:= false |
180 end; |
181 end; |
181 |
182 |
|
183 procedure ApplyAngleBounds(var Hedgehog: THedgehog); |
|
184 begin |
|
185 with Hedgehog do |
|
186 with Ammo^[CurSlot, CurAmmo] do |
|
187 begin |
|
188 CurMinAngle:= Ammoz[AmmoType].minAngle; |
|
189 if Ammoz[AmmoType].maxAngle <> 0 then |
|
190 CurMaxAngle:= Ammoz[AmmoType].maxAngle |
|
191 else |
|
192 CurMaxAngle:= cMaxAngle; |
|
193 |
|
194 with Hedgehog.Gear^ do |
|
195 begin |
|
196 if Angle < CurMinAngle then Angle:= CurMinAngle; |
|
197 if Angle > CurMaxAngle then Angle:= CurMaxAngle; |
|
198 end |
|
199 end |
|
200 end; |
|
201 |
182 procedure ApplyAmmoChanges(var Hedgehog: THedgehog); |
202 procedure ApplyAmmoChanges(var Hedgehog: THedgehog); |
183 var s: shortstring; |
203 var s: shortstring; |
184 begin |
204 begin |
185 TargetPoint.X:= NoPointX; |
205 TargetPoint.X:= NoPointX; |
186 |
206 |
187 with Hedgehog do |
207 with Hedgehog do |
188 begin |
208 begin |
189 if (Ammo^[CurSlot, CurAmmo].Count = 0) then |
209 if (Ammo^[CurSlot, CurAmmo].Count = 0) then |
190 begin |
210 begin |
191 CurAmmo:= 0; |
211 CurAmmo:= 0; |
192 CurSlot:= 0; |
212 CurSlot:= 0; |
193 while (CurSlot <= cMaxSlotIndex) and (Ammo^[CurSlot, CurAmmo].Count = 0) do inc(CurSlot) |
213 while (CurSlot <= cMaxSlotIndex) and (Ammo^[CurSlot, CurAmmo].Count = 0) do inc(CurSlot) |
194 end; |
214 end; |
195 |
215 |
196 with Ammo^[CurSlot, CurAmmo] do |
216 ApplyAngleBounds(Hedgehog); |
197 begin |
217 |
198 CurMinAngle:= Ammoz[AmmoType].minAngle; |
218 with Ammo^[CurSlot, CurAmmo] do |
199 if Ammoz[AmmoType].maxAngle <> 0 then CurMaxAngle:= Ammoz[AmmoType].maxAngle |
219 begin |
200 else CurMaxAngle:= cMaxAngle; |
220 s:= trammo[Ammoz[AmmoType].NameId]; |
201 with Hedgehog.Gear^ do |
221 if Count <> AMMO_INFINITE then |
202 begin |
222 s:= s + ' (' + IntToStr(Count) + ')'; |
203 if Angle < CurMinAngle then Angle:= CurMinAngle; |
223 if (Propz and ammoprop_Timerable) <> 0 then |
204 if Angle > CurMaxAngle then Angle:= CurMaxAngle; |
224 s:= s + ', ' + inttostr(Timer div 1000) + ' ' + trammo[sidSeconds]; |
205 end; |
225 AddCaption(s, Team^.Clan^.Color, capgrpAmmoinfo); |
206 |
226 if (Propz and ammoprop_NeedTarget) <> 0 |
207 s:= trammo[Ammoz[AmmoType].NameId]; |
227 then begin |
208 if Count <> AMMO_INFINITE then |
228 Gear^.State:= Gear^.State or gstHHChooseTarget; |
209 s:= s + ' (' + IntToStr(Count) + ')'; |
229 isCursorVisible:= true |
210 if (Propz and ammoprop_Timerable) <> 0 then |
230 end else begin |
211 s:= s + ', ' + inttostr(Timer div 1000) + ' ' + trammo[sidSeconds]; |
231 Gear^.State:= Gear^.State and not gstHHChooseTarget; |
212 AddCaption(s, Team^.Clan^.Color, capgrpAmmoinfo); |
232 isCursorVisible:= false |
213 if (Propz and ammoprop_NeedTarget) <> 0 |
233 end; |
214 then begin |
234 ShowCrosshair:= (Propz and ammoprop_NoCrosshair) = 0 |
215 Gear^.State:= Gear^.State or gstHHChooseTarget; |
235 end |
216 isCursorVisible:= true |
236 end |
217 end else begin |
237 end; |
218 Gear^.State:= Gear^.State and not gstHHChooseTarget; |
238 |
219 isCursorVisible:= false |
239 procedure SwitchNotHeldAmmo(var Hedgehog: THedgehog); |
220 end; |
|
221 ShowCrosshair:= (Propz and ammoprop_NoCrosshair) = 0 |
|
222 end |
|
223 end |
|
224 end; |
|
225 |
|
226 procedure SwitchNotHoldedAmmo(var Hedgehog: THedgehog); |
|
227 begin |
240 begin |
228 with Hedgehog do |
241 with Hedgehog do |
229 if ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_DontHold) <> 0) or |
242 if ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_DontHold) <> 0) or |
230 (Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber >= 0) then |
243 (Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber >= 0) then |
231 begin |
244 begin |