Fix knockball
authornemo
Sun, 21 Oct 2012 10:20:48 -0400
changeset 7777 e0be9fbc21b4
parent 7775 835ad028fb66
child 7779 0c5f822916a7
Fix knockball
hedgewars/GSHandlers.inc
share/hedgewars/Data/Maps/Knockball/map.lua
--- a/hedgewars/GSHandlers.inc	Sun Oct 21 17:00:35 2012 +0400
+++ b/hedgewars/GSHandlers.inc	Sun Oct 21 10:20:48 2012 -0400
@@ -282,10 +282,12 @@
     else
         Gear^.State := Gear^.State or gstMoving;
 
-    if (Gear^.nImpactSounds > 0) and (((Gear^.Kind <> gtMine) and (Gear^.Damage <> 0))
-    or ((Gear^.State and (gstCollision or gstMoving)) = (gstCollision or gstMoving))) and(((Gear^.Radius < 3) and (Gear^.dY < -_0_1))
-    or ((Gear^.Radius >= 3) and ((Gear^.dX.QWordValue > _0_1.QWordValue)
-    or (Gear^.dY.QWordValue > _0_1.QWordValue)))) then
+    if (Gear^.nImpactSounds > 0) and 
+        (Gear^.State and gstCollision <> 0) and
+        (((Gear^.Kind <> gtMine) and (Gear^.Damage <> 0)) or (Gear^.State and gstMoving <> 0)) and
+        (((Gear^.Radius < 3) and (Gear^.dY < -_0_1)) or
+            ((Gear^.Radius >= 3) and 
+                ((Gear^.dX.QWordValue > _0_1.QWordValue) or (Gear^.dY.QWordValue > _0_1.QWordValue)))) then
         PlaySound(TSound(ord(Gear^.ImpactSound) + LongInt(GetRandom(Gear^.nImpactSounds))), true);
 end;
 
--- a/share/hedgewars/Data/Maps/Knockball/map.lua	Sun Oct 21 17:00:35 2012 +0400
+++ b/share/hedgewars/Data/Maps/Knockball/map.lua	Sun Oct 21 10:20:48 2012 -0400
@@ -34,7 +34,7 @@
 
 function onGearAdd(gear)
 	if GetGearType(gear) == gtShover then
-		ball = AddGear(GetX(gear), GetY(gear), gtBall, 0, 0, 0, 0)
+		ball = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtBall, 0, 0, 0, 0)
 		if ball ~= nil then
 			local dx, dy = GetGearVelocity(gear)
 			SetGearVelocity(ball, dx * 2, dy * 2)