I don't know why I'm bothering. Sheepluva has a whole new approach in the works.
--- 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;
--- a/hedgewars/uGears.pas Fri Mar 26 00:53:31 2010 +0000
+++ b/hedgewars/uGears.pas Fri Mar 26 03:04:19 2010 +0000
@@ -29,7 +29,7 @@
TGear = record
NextGear, PrevGear: PGear;
Active: Boolean;
- AdvBounce: Boolean;
+ AdvBounce: Longword;
Invulnerable: Boolean;
RenderTimer: Boolean;
Ammo : PAmmo;
@@ -256,7 +256,7 @@
case Kind of
gtAmmo_Bomb,
gtClusterBomb: begin
- gear^.AdvBounce:= true;
+ gear^.AdvBounce:= 1;
gear^.Radius:= 4;
gear^.Elasticity:= _0_6;
gear^.Friction:= _0_96;
@@ -264,7 +264,7 @@
if gear^.Timer = 0 then gear^.Timer:= 3000
end;
gtWatermelon: begin
- gear^.AdvBounce:= true;
+ gear^.AdvBounce:= 1;
gear^.Radius:= 4;
gear^.Elasticity:= _0_8;
gear^.Friction:= _0_995;
@@ -272,7 +272,7 @@
if gear^.Timer = 0 then gear^.Timer:= 3000
end;
gtHedgehog: begin
- gear^.AdvBounce:= true;
+ gear^.AdvBounce:= 1;
gear^.Radius:= cHHRadius;
gear^.Elasticity:= _0_35;
gear^.Friction:= _0_999;
@@ -408,7 +408,7 @@
if not dX.isNegative then gear^.Angle:= 1 else gear^.Angle:= 3
end;
gtHellishBomb: begin
- gear^.AdvBounce:= true;
+ gear^.AdvBounce:= 1;
gear^.Radius:= 4;
gear^.Elasticity:= _0_5;
gear^.Friction:= _0_96;
@@ -420,7 +420,7 @@
gear^.Radius:= 4
end;
gtBall: begin
- gear^.AdvBounce:= true;
+ gear^.AdvBounce:= 1;
gear^.Radius:= 5;
gear^.Tag:= random(8);
gear^.Timer:= 5000;
@@ -453,7 +453,6 @@
gear^.Angle:= random(360);
end;
gtEgg: begin
- gear^.AdvBounce:= true;
gear^.Radius:= 4;
gear^.Elasticity:= _0_6;
gear^.Friction:= _0_96;