hedgewars/GSHandlers.inc
changeset 3072 b18038b3a0f4
parent 3071 f40a3fbe3b34
child 3075 b4ef08187d22
--- a/hedgewars/GSHandlers.inc	Fri Mar 26 00:53:31 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Fri Mar 26 03:04:19 2010 +0000
@@ -186,6 +186,7 @@
         Gear^.dY:= - Gear^.dY * Gear^.Elasticity;
         Gear^.State:= Gear^.State or gstCollision
         end
+    else if (Gear^.AdvBounce=1) and TestCollisionYwithGear(Gear, 1) then collV:= 1;
     end 
 else if TestCollisionYwithGear(Gear, 1) then
     begin
@@ -198,8 +199,7 @@
 else
     begin
     isFalling:= true;
-    if Gear^.AdvBounce and Gear^.dY.isNegative and TestCollisionYwithGear(Gear, 1) then collV:= 1
-    else if Gear^.AdvBounce and not Gear^.dY.isNegative and TestCollisionYwithGear(Gear, -1) then collV:= -1;
+    if (Gear^.AdvBounce=1) and not Gear^.dY.isNegative and TestCollisionYwithGear(Gear, -1) then collV:= -1;
     end;
 
 
@@ -210,18 +210,20 @@
     Gear^.dY:=   Gear^.dY * Gear^.Elasticity;
     Gear^.State:= Gear^.State or gstCollision
     end 
-else if Gear^.AdvBounce and TestCollisionXwithGear(Gear, -hwSign(Gear^.dX)) then collH:= -hwSign(Gear^.dX);
+else if (Gear^.AdvBounce=1) and TestCollisionXwithGear(Gear, -hwSign(Gear^.dX)) then collH:= -hwSign(Gear^.dX);
 
 //if Gear^.AdvBounce and (collV <>0) and (collH <> 0) and (hwSqr(tdX) + hwSqr(tdY) > _0_08) then
-if Gear^.AdvBounce and (collV <>0) and (collH <> 0) and ((tdX.QWordValue + tdY.QWordValue) > _0_2.QWordValue) then
+if (Gear^.AdvBounce=1) and (collV <>0) and (collH <> 0) and ((tdX.QWordValue + tdY.QWordValue) > _0_2.QWordValue) then
     begin
     Gear^.dX:= tdY*Gear^.Elasticity*Gear^.Friction;
     Gear^.dY:= tdX*Gear^.Elasticity;//*Gear^.Friction;
-    if ((collV > 0) and (collH > 0)) or ((collV < 0) and (collH < 0)) then Gear^.dX.isNegative:=not tdY.isNegative
-    else if (collV < 0) and (collH > 0) then Gear^.dY.isNegative:= not tdX.isNegative;
+    Gear^.dY.isNegative:= not tdY.isNegative;
     isFalling:= false;
+    Gear^.AdvBounce:= 10;
     end;
 
+if Gear^.AdvBounce > 1 then dec(Gear^.AdvBounce);
+
 if isFalling then Gear^.dY:= Gear^.dY + cGravity;
 
 Gear^.X:= Gear^.X + Gear^.dX;