--- a/hedgewars/GSHandlers.inc Sun Nov 14 02:38:05 2010 -0500
+++ b/hedgewars/GSHandlers.inc Sun Nov 14 12:57:01 2010 +0100
@@ -708,7 +708,7 @@
var
i, x, y: LongWord;
oX, oY: hwFloat;
- trail: PVisualGear;
+ VGear: PVisualGear;
begin
AllInactive := false;
inc(Gear^.Timer);
@@ -756,27 +756,38 @@
if (Ammoz[Gear^.AmmoType].Ammo.NumPerTurn <= CurrentHedgehog^.MultiShootAttacks) and
((GameFlags and gfArtillery) = 0) then cArtillery := false;
+ // Bullet Hit
+ if (hwRound(Gear^.X) and LAND_WIDTH_MASK = 0)
+ and (hwRound(Gear^.Y) and LAND_HEIGHT_MASK = 0) then
+ begin
+ VGear := AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtBulletHit);
+ if VGear <> nil then
+ begin
+ VGear^.Angle := DxDy2Angle(-Gear^.dX, Gear^.dY);
+ end;
+ end;
+
// Bullet trail
- trail := AddVisualGear(
+ VGear := AddVisualGear(
hwround(CurrentHedgehog^.Gear^.X) + GetLaunchX(CurrentHedgehog^.CurAmmoType, hwSign(CurrentHedgehog^.Gear^.dX), CurrentHedgehog^.Gear^.Angle),
hwround(CurrentHedgehog^.Gear^.Y) + GetLaunchY(CurrentHedgehog^.CurAmmoType, CurrentHedgehog^.Gear^.Angle),
vgtLineTrail
);
- if trail <> nil then
+ if VGear <> nil then
begin
// http://mantis.freepascal.org/view.php?id=17714 hits again
- trail^.dX := Gear^.X.QWordValue / SignAs(_1,_1).QWordValue;
- trail^.dY := Gear^.Y.QWordValue / SignAs(_1,_1).QWordValue;
+ VGear^.dX := Gear^.X.QWordValue / SignAs(_1,_1).QWordValue;
+ VGear^.dY := Gear^.Y.QWordValue / SignAs(_1,_1).QWordValue;
// reached edge of land. assume infinite beam. Extend it way out past camera
if (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0)
or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) then
begin
- trail^.dX := trail^.dX + (CurrentHedgehog^.Gear^.dX * LAND_WIDTH).QWordValue / SignAs(_1,_1).QWordValue;
- trail^.dY := trail^.dY + (CurrentHedgehog^.Gear^.dY * LAND_WIDTH).QWordValue / SignAs(_1,_1).QWordValue;
+ VGear^.dX := VGear^.dX + (CurrentHedgehog^.Gear^.dX * LAND_WIDTH).QWordValue / SignAs(_1,_1).QWordValue;
+ VGear^.dY := VGear^.dY + (CurrentHedgehog^.Gear^.dY * LAND_WIDTH).QWordValue / SignAs(_1,_1).QWordValue;
end;
- trail^.Timer := 200;
+ VGear^.Timer := 200;
end;
Gear^.doStep := @doStepShotIdle