equal
deleted
inserted
replaced
34 procedure ApplyAngleBounds(var Hedgehog: THedgehog; AmmoType: TAmmoType); |
34 procedure ApplyAngleBounds(var Hedgehog: THedgehog; AmmoType: TAmmoType); |
35 procedure ApplyAmmoChanges(var Hedgehog: THedgehog); |
35 procedure ApplyAmmoChanges(var Hedgehog: THedgehog); |
36 procedure SwitchNotHeldAmmo(var Hedgehog: THedgehog); |
36 procedure SwitchNotHeldAmmo(var Hedgehog: THedgehog); |
37 procedure SetWeapon(weap: TAmmoType); |
37 procedure SetWeapon(weap: TAmmoType); |
38 procedure DisableSomeWeapons; |
38 procedure DisableSomeWeapons; |
|
39 procedure ResetWeapons; |
39 |
40 |
40 var shoppa: boolean; |
41 var shoppa: boolean; |
41 |
42 |
42 implementation |
43 implementation |
43 uses uMisc, uGears, uWorld, uLocale, uConsole; |
44 uses uMisc, uGears, uWorld, uLocale, uConsole; |
55 for a:= Low(TAmmoType) to High(TAmmoType) do |
56 for a:= Low(TAmmoType) to High(TAmmoType) do |
56 if cnts[a] > 0 then |
57 if cnts[a] > 0 then |
57 begin |
58 begin |
58 TryDo(mi[Ammoz[a].Slot] <= cMaxSlotAmmoIndex, 'Ammo slot overflow', true); |
59 TryDo(mi[Ammoz[a].Slot] <= cMaxSlotAmmoIndex, 'Ammo slot overflow', true); |
59 Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]]:= Ammoz[a].Ammo; |
60 Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]]:= Ammoz[a].Ammo; |
|
61 |
60 Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= cnts[a]; |
62 Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= cnts[a]; |
|
63 Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].InitialCount:= cnts[a]; |
|
64 |
|
65 if ((GameFlags and gfPlaceHog) <> 0) and (a = amTeleport) then |
|
66 Ammo^[Ammoz[a].Slot, mi[Ammoz[a].Slot]].Count:= AMMO_INFINITE; |
61 inc(mi[Ammoz[a].Slot]) |
67 inc(mi[Ammoz[a].Slot]) |
62 end |
68 end |
63 end; |
69 end; |
64 |
70 |
65 procedure AddAmmoStore(s: shortstring); |
71 procedure AddAmmoStore(s: shortstring); |
108 ammos[a]:= cnt; |
114 ammos[a]:= cnt; |
109 if shoppa then Ammoz[a].NumberInCase:= 1; // FIXME - TEMPORARY remove when crate number in case editor is added |
115 if shoppa then Ammoz[a].NumberInCase:= 1; // FIXME - TEMPORARY remove when crate number in case editor is added |
110 |
116 |
111 if ((GameFlags and gfKing) <> 0) and (Ammoz[a].SkipTurns = 0) and (a <> amTeleport) and (a <> amSkip) then |
117 if ((GameFlags and gfKing) <> 0) and (Ammoz[a].SkipTurns = 0) and (a <> amTeleport) and (a <> amSkip) then |
112 Ammoz[a].SkipTurns:= 1; |
118 Ammoz[a].SkipTurns:= 1; |
|
119 |
|
120 if ((GameFlags and gfPlaceHog) <> 0) and |
|
121 (a <> amTeleport) and (a <> amSkip) and |
|
122 (Ammoz[a].SkipTurns < 10000) then inc(Ammoz[a].SkipTurns,10000) |
113 end else |
123 end else |
114 ammos[a]:= AMMO_INFINITE |
124 ammos[a]:= AMMO_INFINITE |
115 end; |
125 end; |
116 |
126 |
117 FillAmmoStore(StoresList[Pred(StoreCnt)], ammos) |
127 FillAmmoStore(StoresList[Pred(StoreCnt)], ammos) |
321 |
331 |
322 for t:= Low(TAmmoType) to High(TAmmoType) do |
332 for t:= Low(TAmmoType) to High(TAmmoType) do |
323 if (Ammoz[t].Ammo.Propz and ammoprop_NotBorder) <> 0 then Ammoz[t].Probability:= 0 |
333 if (Ammoz[t].Ammo.Propz and ammoprop_NotBorder) <> 0 then Ammoz[t].Probability:= 0 |
324 end; |
334 end; |
325 |
335 |
|
336 // Restore indefinitely disabled weapons and initial weapon counts. Only used for hog placement right now |
|
337 procedure ResetWeapons; |
|
338 var i, slot, a: Longword; |
|
339 t: TAmmoType; |
|
340 begin |
|
341 for i:= 0 to Pred(StoreCnt) do |
|
342 for slot:= 0 to cMaxSlotIndex do |
|
343 begin |
|
344 for a:= 0 to cMaxSlotAmmoIndex do |
|
345 with StoresList[i]^[slot, a] do |
|
346 if Count <> InitialCount then Count:= InitialCount; |
|
347 |
|
348 PackAmmo(StoresList[i], slot) |
|
349 end; |
|
350 for t:= Low(TAmmoType) to High(TAmmoType) do |
|
351 if Ammoz[t].SkipTurns >= 10000 then dec(Ammoz[t].SkipTurns,10000); |
|
352 end; |
|
353 |
326 procedure init_uAmmos; |
354 procedure init_uAmmos; |
327 begin |
355 begin |
328 shoppa:= false; |
356 shoppa:= false; |
329 StoreCnt:= 0 |
357 StoreCnt:= 0 |
330 end; |
358 end; |