86 var cnt: Longword; |
86 var cnt: Longword; |
87 a: TAmmoType; |
87 a: TAmmoType; |
88 ammos: TAmmoCounts; |
88 ammos: TAmmoCounts; |
89 substr: shortstring; // TEMPORARY |
89 substr: shortstring; // TEMPORARY |
90 begin |
90 begin |
91 TryDo(byte(s[0]) = byte(ord(High(TAmmoType))) * 2, 'Invalid ammo scheme (incompatible frontend)', true); |
91 TryDo(byte(s[0]) = byte(ord(High(TAmmoType))) * 4, 'Invalid ammo scheme (incompatible frontend)', true); |
92 |
92 |
93 // FIXME - TEMPORARY hardcoded check on shoppa pending creation of crate *type* probability editor |
93 // FIXME - TEMPORARY hardcoded check on shoppa pending creation of crate *type* probability editor |
94 substr:= Copy(s,1,15); |
94 substr:= Copy(s,1,15); |
95 if (substr = '000000990000009') or |
95 if (substr = '000000990000009') or |
96 (substr = '000000990000000') then |
96 (substr = '000000990000000') then |
104 for a:= Low(TAmmoType) to High(TAmmoType) do |
104 for a:= Low(TAmmoType) to High(TAmmoType) do |
105 begin |
105 begin |
106 if a <> amNothing then |
106 if a <> amNothing then |
107 begin |
107 begin |
108 Ammoz[a].Probability:= probability[byte(s[ord(a) + ord(High(TAmmoType))]) - byte('0')]; |
108 Ammoz[a].Probability:= probability[byte(s[ord(a) + ord(High(TAmmoType))]) - byte('0')]; |
|
109 Ammoz[a].SkipTurns:= (byte(s[ord(a) + ord(High(TAmmoType)) + ord(High(TAmmoType))]) - byte('0')); |
|
110 Ammoz[a].NumberInCase:= (byte(s[ord(a) + ord(High(TAmmoType)) + ord(High(TAmmoType)) + ord(High(TAmmoType))]) - byte('0')); |
109 if (TrainingFlags and tfIgnoreDelays) <> 0 then Ammoz[a].SkipTurns:= 0; |
111 if (TrainingFlags and tfIgnoreDelays) <> 0 then Ammoz[a].SkipTurns:= 0; |
110 cnt:= byte(s[ord(a)]) - byte('0'); |
112 cnt:= byte(s[ord(a)]) - byte('0'); |
111 // avoid things we already have infinite number |
113 // avoid things we already have infinite number |
112 if cnt = 9 then |
114 if cnt = 9 then |
113 begin |
115 begin |
114 cnt:= AMMO_INFINITE; |
116 cnt:= AMMO_INFINITE; |
115 Ammoz[a].Probability:= 0 |
117 Ammoz[a].Probability:= 0 |
116 end; |
118 end; |
|
119 if Ammoz[a].NumberInCase = 0 then Ammoz[a].Probability:= 0; |
|
120 |
117 // avoid things we already have by scheme |
121 // avoid things we already have by scheme |
118 // merge this into DisableSomeWeapons ? |
122 // merge this into DisableSomeWeapons ? |
119 if ((a = amLowGravity) and ((GameFlags and gfLowGravity) <> 0)) or |
123 if ((a = amLowGravity) and ((GameFlags and gfLowGravity) <> 0)) or |
120 ((a = amInvulnerable) and ((GameFlags and gfInvulnerable) <> 0)) or |
124 ((a = amInvulnerable) and ((GameFlags and gfInvulnerable) <> 0)) or |
121 ((a = amLaserSight) and ((GameFlags and gfLaserSight) <> 0)) or |
125 ((a = amLaserSight) and ((GameFlags and gfLaserSight) <> 0)) or |
123 begin |
127 begin |
124 cnt:= 0; |
128 cnt:= 0; |
125 Ammoz[a].Probability:= 0 |
129 Ammoz[a].Probability:= 0 |
126 end; |
130 end; |
127 ammos[a]:= cnt; |
131 ammos[a]:= cnt; |
128 if shoppa then Ammoz[a].NumberInCase:= 1; // FIXME - TEMPORARY remove when crate number in case editor is added |
|
129 |
132 |
130 if ((GameFlags and gfKing) <> 0) and ((GameFlags and gfPlaceHog) = 0) and (Ammoz[a].SkipTurns = 0) and (a <> amTeleport) and (a <> amSkip) then |
133 if ((GameFlags and gfKing) <> 0) and ((GameFlags and gfPlaceHog) = 0) and (Ammoz[a].SkipTurns = 0) and (a <> amTeleport) and (a <> amSkip) then |
131 Ammoz[a].SkipTurns:= 1; |
134 Ammoz[a].SkipTurns:= 1; |
132 |
135 |
133 if ((GameFlags and gfPlaceHog) <> 0) and |
136 if ((GameFlags and gfPlaceHog) <> 0) and |