equal
deleted
inserted
replaced
63 with HHGear^.Hedgehog^ do |
63 with HHGear^.Hedgehog^ do |
64 begin |
64 begin |
65 HHGear^.Message:= HHGear^.Message and (not gmSlot); |
65 HHGear^.Message:= HHGear^.Message and (not gmSlot); |
66 prevAmmo:= CurAmmoType; |
66 prevAmmo:= CurAmmoType; |
67 ammoidx:= 0; |
67 ammoidx:= 0; |
68 if ((HHGear^.State and (gstAttacking or gstAttacked)) <> 0) |
68 if (((HHGear^.State and (gstAttacking or gstAttacked)) <> 0) and (GameFlags and gfInfAttack = 0)) |
69 or ((HHGear^.State and gstHHDriven) = 0) then |
69 or ((HHGear^.State and gstHHDriven) = 0) then |
70 exit; |
70 exit; |
71 ChangeAmmo:= true; |
71 ChangeAmmo:= true; |
72 |
72 |
73 while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> CurAmmoType) do |
73 while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> CurAmmoType) do |
138 procedure HHSetWeapon(HHGear: PGear); |
138 procedure HHSetWeapon(HHGear: PGear); |
139 var t: LongInt; |
139 var t: LongInt; |
140 weap: TAmmoType; |
140 weap: TAmmoType; |
141 Hedgehog: PHedgehog; |
141 Hedgehog: PHedgehog; |
142 s: boolean; |
142 s: boolean; |
|
143 prevState, newState: LongWord; |
143 begin |
144 begin |
144 s:= false; |
145 s:= false; |
145 |
146 |
146 weap:= TAmmoType(HHGear^.MsgParam); |
147 weap:= TAmmoType(HHGear^.MsgParam); |
147 Hedgehog:= HHGear^.Hedgehog; |
148 Hedgehog:= HHGear^.Hedgehog; |
153 |
154 |
154 t:= cMaxSlotAmmoIndex; |
155 t:= cMaxSlotAmmoIndex; |
155 |
156 |
156 HHGear^.Message:= HHGear^.Message and (not gmWeapon); |
157 HHGear^.Message:= HHGear^.Message and (not gmWeapon); |
157 |
158 |
|
159 prevState:= HHGear^.State; |
|
160 newState:= prevState; |
158 with Hedgehog^ do |
161 with Hedgehog^ do |
159 while (CurAmmoType <> weap) and (t >= 0) do |
162 while (CurAmmoType <> weap) and (t >= 0) do |
160 begin |
163 begin |
161 s:= ChangeAmmo(HHGear); |
164 s:= ChangeAmmo(HHGear); |
|
165 if HHGear^.State <> prevState then // so we can keep gstAttacked out of consideration when looping |
|
166 newState:= HHGear^.State; |
|
167 HHGear^.State:= prevState; |
162 dec(t) |
168 dec(t) |
163 end; |
169 end; |
|
170 HHGear^.State:= newState; |
164 |
171 |
165 if s then |
172 if s then |
166 ApplyAmmoChanges(HHGear^.Hedgehog^) |
173 ApplyAmmoChanges(HHGear^.Hedgehog^) |
167 end; |
174 end; |
168 |
175 |