Slightly better behaved bounce, assuming we can make this 45 deg thing work, calcs could stand some optimisation.
--- a/hedgewars/GSHandlers.inc Sun Mar 14 23:46:46 2010 +0000
+++ b/hedgewars/GSHandlers.inc Mon Mar 15 02:23:40 2010 +0000
@@ -167,10 +167,13 @@
procedure doStepFallingGear(Gear: PGear);
var isFalling, isCollV, isCollH: boolean;
tmp: QWord;
+ tdX, tdY: hwFloat;
begin
Gear^.State:= Gear^.State and not gstCollision;
isCollV:= false;
isCollH:= false;
+tdX:= Gear^.dX;
+tdY:= Gear^.dY;
if Gear^.dY.isNegative then
begin
@@ -204,9 +207,11 @@
if isCollV and isCollH and Gear^.AdvBounce then
begin
- tmp:= Gear^.dX.QWordValue;
- Gear^.dX.QWordValue:= Gear^.dY.QWordValue;
- Gear^.dY.QWordValue:= tmp;
+ Gear^.dX:= hwAbs(tdY)*hwSign(Gear^.dX)*Gear^.Elasticity*Gear^.Friction;
+ Gear^.dY:= hwAbs(tdX)*hwSign(Gear^.dY)*Gear^.Elasticity;
+ //tmp:= Gear^.dX.QWordValue;
+ //Gear^.dX.QWordValue:= Gear^.dY.QWordValue;
+ //Gear^.dY.QWordValue:= tmp;
end;
if isFalling then Gear^.dY:= Gear^.dY + cGravity;