hedgewars/uGearsHandlersMess.pas
changeset 9731 953197ac43d8
parent 9724 b3fefde4cff7
child 9742 419e5c651870
--- a/hedgewars/uGearsHandlersMess.pas	Sat Nov 30 20:53:54 2013 +0400
+++ b/hedgewars/uGearsHandlersMess.pas	Sat Nov 30 22:34:39 2013 -0500
@@ -325,7 +325,7 @@
             if land and lfIce <> 0 then
                  Gear^.dX := Gear^.dX * (_0_9 + Gear^.Friction * _0_1)
             else Gear^.dX := Gear^.dX * Gear^.Friction;
-            if land and lfBouncy = 0 then
+            if (Gear^.AdvBounce = 0) or (land and lfBouncy = 0) then
                  begin
                  Gear^.dY := - Gear^.dY * Gear^.Elasticity;
                  Gear^.State := Gear^.State or gstCollision
@@ -350,7 +350,7 @@
             else
                 Gear^.dX := Gear^.dX * Gear^.Friction;
 
-            if land and lfBouncy = 0 then
+            if (Gear^.AdvBounce = 0) or (land and lfBouncy = 0) then
                  begin
                  Gear^.dY := - Gear^.dY * Gear^.Elasticity;
                  Gear^.State := Gear^.State or gstCollision
@@ -373,7 +373,7 @@
     if xland <> 0 then
         begin
         collH := hwSign(Gear^.dX);
-        if xland and lfBouncy = 0 then
+        if (Gear^.AdvBounce = 0) or (xland and lfBouncy = 0) then
             begin
             Gear^.dX := - Gear^.dX * Gear^.Elasticity;
             Gear^.dY :=   Gear^.dY * Gear^.Elasticity;
@@ -392,8 +392,8 @@
         end;
     //if Gear^.AdvBounce and (collV <>0) and (collH <> 0) and (hwSqr(tdX) + hwSqr(tdY) > _0_08) then
     if (collV <> 0) and (collH <> 0) and 
-       (((Gear^.AdvBounce=1) and ((collV=-1) or ((tdX.QWordValue + tdY.QWordValue) > _0_2.QWordValue))) or
-        ((xland or land) and lfBouncy <> 0)) then
+       (((Gear^.AdvBounce=1) and ((collV=-1) or ((tdX.QWordValue + tdY.QWordValue) > _0_2.QWordValue)))) then
+ //or ((xland or land) and lfBouncy <> 0)) then
         begin
         if (xland or land) and lfBouncy = 0 then
             begin
@@ -430,7 +430,7 @@
     else
         Gear^.State := Gear^.State or gstMoving;
 
-    if ((xland or land) and lfBouncy <> 0) and (Gear^.dX.QWordValue < _0_1.QWordValue) and (Gear^.dY.QWordValue < _0_1.QWordValue) then
+    if ((xland or land) and lfBouncy <> 0) and (Gear^.dX.QWordValue < _0_15.QWordValue) and (Gear^.dY.QWordValue < _0_15.QWordValue) then
         Gear^.State := Gear^.State or gstCollision;
     
     if ((xland or land) and lfBouncy <> 0) and
@@ -1697,12 +1697,14 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepSMine(Gear: PGear);
+    var land: Word;
 begin
     // TODO: do real calculation?
-    if (TestCollisionXwithGear(Gear, 2) <> 0)
-    or (TestCollisionYwithGear(Gear,-2) <> 0)
-    or (TestCollisionXwithGear(Gear,-2) <> 0)
-    or (TestCollisionYwithGear(Gear, 2) <> 0) then
+    land:= TestCollisionXwithGear(Gear, 2);
+    if land = 0 then land:= TestCollisionYwithGear(Gear,-2);
+    if land = 0 then land:= TestCollisionXwithGear(Gear,-2);
+    if land = 0 then land:= TestCollisionYwithGear(Gear, 2);
+    if (land <> 0) and (land and lfBouncy = 0) then
         begin
         if (not isZero(Gear^.dX)) or (not isZero(Gear^.dY)) then
             begin