--- a/hedgewars/GSHandlers.inc Sun Dec 10 21:31:45 2006 +0000
+++ b/hedgewars/GSHandlers.inc Thu Dec 14 20:06:46 2006 +0000
@@ -382,7 +382,7 @@
if TestCollisionYwithGear(Gear, 1) then
begin
Gear.dY:= 0;
- HHGear.dX:= 0.0000001 * hwSign(HHGear.dX);
+ SetLittle(HHGear.dX);
HHGear.dY:= 0;
end else
begin
--- a/hedgewars/HHHandlers.inc Sun Dec 10 21:31:45 2006 +0000
+++ b/hedgewars/HHHandlers.inc Thu Dec 14 20:06:46 2006 +0000
@@ -142,8 +142,6 @@
if (TurnTimeLeft = 0) or (Gear.Damage > 0) then
begin
TurnTimeLeft:= 0;
- if ((Gear.State and (gstMoving or gstFalling)) = 0)
- and (CurAmmoGear = nil) then Gear.dX:= 0.0000001 * hwSign(Gear.dX);
Gear.State:= Gear.State and not gstHHDriven;
if Gear.Damage > 0 then
Gear.State:= Gear.State and not gstHHJumping;
@@ -172,13 +170,13 @@
// it could be the source to trick: double-backspace jump -> vertical wall
// collision - > (abs(Gear.dX) < 0.0000002) -> backspace -> even more high jump
if ((Gear.Message and gm_HJump) <> 0) and ((Gear.State and gstHHJumping) <> 0) then
- if (abs(Gear.dX) < 0.0000002) and (Gear.dY < -0.02) then
+ if (abs(Gear.dX) < 2 * cLittle) and (Gear.dY < -0.02) then
begin
Gear.dY:= -0.25;
Gear.dX:= hwSign(Gear.dX) * 0.02
end;
Gear.Message:= Gear.Message and not (gm_LJump or gm_HJump);
- if TestCollisionXwithGear(Gear, hwSign(Gear.dX)) then Gear.dX:= 0.0000001 * hwSign(Gear.dX);
+ if TestCollisionXwithGear(Gear, hwSign(Gear.dX)) then SetLittle(Gear.dX);
Gear.X:= Gear.X + Gear.dX;
Gear.dY:= Gear.dY + cGravity;
if (Gear.dY < 0)and TestCollisionYwithGear(Gear, -1) then Gear.dY:= 0;
@@ -187,7 +185,7 @@
begin
CheckHHDamage(Gear);
if ((abs(Gear.dX) + abs(Gear.dY)) < 0.55)
- and ((Gear.State and gstHHJumping) <> 0) then Gear.dX:= 0.0000001 * hwSign(Gear.dX);
+ and ((Gear.State and gstHHJumping) <> 0) then SetLittle(Gear.dX);
Gear.State:= Gear.State and not (gstFalling or gstHHJumping);
StepTicks:= 300;
Gear.dY:= 0
@@ -233,8 +231,8 @@
end;
end;
PrevdX:= hwSign(Gear.dX);
- if (Gear.Message and gm_Left )<>0 then Gear.dX:= -1.0 else
- if (Gear.Message and gm_Right )<>0 then Gear.dX:= 1.0 else exit;
+ if (Gear.Message and gm_Left )<>0 then Gear.dX:= -cLittle else
+ if (Gear.Message and gm_Right )<>0 then Gear.dX:= cLittle else exit;
StepTicks:= cHHStepTicks;
if PrevdX <> hwSign(Gear.dX) then exit;
PHedgehog(Gear.Hedgehog).visStepPos:= (PHedgehog(Gear.Hedgehog).visStepPos + 1) and 7;
@@ -253,8 +251,8 @@
if not (TestCollisionXwithXYShift(Gear, 0, -1, hwSign(Gear.dX))
or TestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1;
end;
- if not TestCollisionXwithGear(Gear, hwSign(Gear.dX)) then Gear.X:= Gear.X + Gear.dX;
- Gear.dX:= 0.0000001 * hwSign(Gear.dX);
+ if not TestCollisionXwithGear(Gear, hwSign(Gear.dX)) then Gear.X:= Gear.X + hwSign(Gear.dX);
+
SetAllHHToActive;
if not TestCollisionYwithGear(Gear, 1) then
@@ -279,7 +277,6 @@
begin
Gear.Y:= Gear.Y - 6;
Gear.dY:= 0;
- Gear.dX:= 0.0000001 * hwSign(Gear.dX);
Gear.State:= Gear.State or gstFalling
end;
end
@@ -303,7 +300,7 @@
end else begin
CheckHHDamage(Gear);
if ((abs(Gear.dX) + abs(Gear.dY)) < 0.55)
- and ((Gear.State and gstHHJumping) <> 0) then Gear.dX:= 0.0000001 * hwSign(Gear.dX);
+ and ((Gear.State and gstHHJumping) <> 0) then SetLittle(Gear.dX);
Gear.State:= Gear.State and not (gstFalling or gstHHJumping);
if Gear.dY > 0 then Gear.dY:= 0;
if ((Gear.State and gstMoving) <> 0) then Gear.dX:= Gear.dX * Gear.Friction
@@ -323,11 +320,11 @@
if abs(Gear.dX) > 0.02 then Gear.dX:= -Gear.Elasticity * Gear.dX
else begin
Gear.State:= Gear.State and not gstMoving;
- Gear.dX:= 0.0000001 * hwSign(Gear.dX)
+ SetLittle(Gear.dX)
end
else begin
Gear.State:= Gear.State and not gstMoving;
- Gear.dX:= 0.0000001 * hwSign(Gear.dX)
+ SetLittle(Gear.dX)
end
else Gear.dX:= -Gear.Elasticity * Gear.dX;
@@ -335,7 +332,7 @@
(sqr(Gear.dX) + sqr(Gear.dY) < 0.0008) then
begin
Gear.State:= Gear.State and not gstMoving;
- Gear.dX:= 0.0000001 * hwSign(Gear.dX);
+ SetLittle(Gear.dX);
Gear.dY:= 0
end else Gear.State:= Gear.State or gstMoving;
--- a/hedgewars/uConsts.pas Sun Dec 10 21:31:45 2006 +0000
+++ b/hedgewars/uConsts.pas Thu Dec 14 20:06:46 2006 +0000
@@ -115,6 +115,8 @@
cHHStepTicks = 38;
cHHZ = 1000;
cCurrHHZ = Succ(cHHZ);
+ cHHKick = 0.03;
+ cLittle = 0.0000001;
cKeyMaxIndex = 1023;
--- a/hedgewars/uGears.pas Sun Dec 10 21:31:45 2006 +0000
+++ b/hedgewars/uGears.pas Thu Dec 14 20:06:46 2006 +0000
@@ -646,8 +646,8 @@
if (Mask and EXPLNoDamage) = 0 then inc(Gear.Damage, dmg);
if ((Mask and EXPLDoNotTouchHH) = 0) or (Gear.Kind <> gtHedgehog) then
begin
- Gear.dX:= Gear.dX + dmg / 200 * hwSign(Gear.X - X);
- Gear.dY:= Gear.dY + dmg / 200 * hwSign(Gear.Y - Y);
+ Gear.dX:= Gear.dX + (dmg / 200 + cHHKick)* hwSign(Gear.X - X);
+ Gear.dY:= Gear.dY + (dmg / 200 + cHHKick)* hwSign(Gear.Y - Y);
Gear.Active:= true;
FollowGear:= Gear
end;
--- a/hedgewars/uMisc.pas Sun Dec 10 21:31:45 2006 +0000
+++ b/hedgewars/uMisc.pas Thu Dec 14 20:06:46 2006 +0000
@@ -105,6 +105,7 @@
{$ENDIF}
procedure SetKB(n: Longword);
procedure SendKB;
+procedure SetLittle(var r: Double);
var CursorPoint: TPoint;
TargetPoint: TPoint = (X: NoPointX; Y: 0);
@@ -205,6 +206,11 @@
end
end;
+procedure SetLittle(var r: Double);
+begin
+if r >= 0 then r:= cLittle else r:= - cLittle
+end;
+
{$IFDEF DEBUGFILE}
procedure AddFileLog(s: shortstring);
begin