equal
deleted
inserted
replaced
1 (* |
1 (* |
2 * Hedgewars, a free turn based strategy game |
2 * Hedgewars, a free turn based strategy game |
3 * Copyright (c) 2004-2014 Andrey Korotaev <unC0Rr@gmail.com> |
3 * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> |
4 * |
4 * |
5 * This program is free software; you can redistribute it and/or modify |
5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License as published by |
6 * it under the terms of the GNU General Public License as published by |
7 * the Free Software Foundation; version 2 of the License |
7 * the Free Software Foundation; version 2 of the License |
8 * |
8 * |
211 procedure Attack(Gear: PGear); |
211 procedure Attack(Gear: PGear); |
212 var xx, yy, newDx, newDy, lx, ly: hwFloat; |
212 var xx, yy, newDx, newDy, lx, ly: hwFloat; |
213 speech: PVisualGear; |
213 speech: PVisualGear; |
214 newGear: PGear; |
214 newGear: PGear; |
215 CurWeapon: PAmmo; |
215 CurWeapon: PAmmo; |
|
216 usedAmmoType: TAmmoType; |
216 altUse: boolean; |
217 altUse: boolean; |
217 elastic: hwFloat; |
218 elastic: hwFloat; |
218 begin |
219 begin |
219 newGear:= nil; |
220 newGear:= nil; |
220 bShowFinger:= false; |
221 bShowFinger:= false; |
221 CurWeapon:= GetCurAmmoEntry(Gear^.Hedgehog^); |
222 CurWeapon:= GetCurAmmoEntry(Gear^.Hedgehog^); |
222 with Gear^, |
223 with Gear^, |
223 Gear^.Hedgehog^ do |
224 Gear^.Hedgehog^ do |
224 begin |
225 begin |
|
226 usedAmmoType:= CurAmmoType; |
225 if ((State and gstHHDriven) <> 0) and ((State and (gstAttacked or gstChooseTarget)) = 0) and (((State and gstMoving) = 0) |
227 if ((State and gstHHDriven) <> 0) and ((State and (gstAttacked or gstChooseTarget)) = 0) and (((State and gstMoving) = 0) |
226 or (Power > 0) |
228 or (Power > 0) |
227 or (CurAmmoType = amTeleport) |
229 or (CurAmmoType = amTeleport) |
228 or |
230 or |
229 // Allow attacks while moving on ammo with AltAttack |
231 // Allow attacks while moving on ammo with AltAttack |
507 end |
509 end |
508 end |
510 end |
509 else |
511 else |
510 Message:= Message and (not gmAttack); |
512 Message:= Message and (not gmAttack); |
511 |
513 |
512 ScriptCall('onHogAttack', ord(CurAmmoType)); |
514 ScriptCall('onHogAttack', ord(usedAmmoType)); |
513 end; // of with Gear^, Gear^.Hedgehog^ do |
515 end; // of with Gear^, Gear^.Hedgehog^ do |
514 |
516 |
515 TargetPoint.X := NoPointX; |
517 TargetPoint.X := NoPointX; |
516 end; |
518 end; |
517 |
519 |