Fix mortar clusters spread direction
authorunc0rr
Thu, 29 May 2008 18:27:20 +0000
changeset 963 5f8bb3470563
parent 962 f2f3aa499548
child 964 4c6ff62c54d2
Fix mortar clusters spread direction
hedgewars/GSHandlers.inc
--- a/hedgewars/GSHandlers.inc	Wed May 28 20:34:23 2008 +0000
+++ b/hedgewars/GSHandlers.inc	Thu May 29 18:27:20 2008 +0000
@@ -1352,23 +1352,30 @@
 procedure doStepMortar(Gear: PGear);
 var dX, dY: hwFloat;
     i: LongInt;
+    dxn, dyn: boolean;
 begin
 AllInactive:= false;
+dxn:= Gear^.dX.isNegative;
+dyn:= Gear^.dY.isNegative;
+
 doStepFallingGear(Gear);
 if (Gear^.State and gstCollision) <> 0 then
 	begin
 	doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, EXPLAutoSound);
-	
+
+	Gear^.dX.isNegative:= not dxn;
+	Gear^.dY.isNegative:= not dyn;
 	for i:= 0 to 4 do
 		begin
-		dX:= - Gear^.dX + (GetRandom - _0_5) * _0_03;
-		dY:= - Gear^.dY + (GetRandom - _0_5) * _0_03;
+		dX:= Gear^.dX + (GetRandom - _0_5) * _0_03;
+		dY:= Gear^.dY + (GetRandom - _0_5) * _0_03;
 		AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtCluster, 0, dX, dY, 0);
 		end;
 	
 	DeleteGear(Gear);
 	exit
 	end;
+
 if (GameTicks and $3F) = 0 then
 	AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0)
 end;