Disable cheat trick with hjump
authorunc0rr
Sat, 10 Feb 2007 13:14:41 +0000
changeset 424 4598c21bb421
parent 423 5f4559ce7062
child 425 a7e1dabc8fb7
Disable cheat trick with hjump
hedgewars/HHHandlers.inc
hedgewars/uConsts.pas
--- a/hedgewars/HHHandlers.inc	Sat Feb 10 12:52:14 2007 +0000
+++ b/hedgewars/HHHandlers.inc	Sat Feb 10 13:14:41 2007 +0000
@@ -257,7 +257,7 @@
    TurnTimeLeft:= 0;
    Gear^.State:= Gear^.State and not gstHHDriven;
    if Gear^.Damage > 0 then
-      Gear^.State:= Gear^.State and not gstHHJumping;
+      Gear^.State:= Gear^.State and not (gstHHJumping or gstHHHJump);
    exit
    end;
 if ((Gear^.State and gstFalling) <> 0) or (StepTicks = cHHStepTicks)
@@ -280,11 +280,12 @@
 
 if (Gear^.State and gstFalling) <> 0 then
    begin
-   // it could be the source to trick: hwFloat-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 (hwAbs(Gear^.dX) < cLittle + cLittle) and (Gear^.dY < -_0_02) then
+   if ((Gear^.Message and gm_HJump) <> 0) and
+      ((Gear^.State and gstHHJumping) <> 0) and
+      ((Gear^.State and gstHHHJump) = 0) then
+      if (not (hwAbs(Gear^.dX) > cLittle)) and (Gear^.dY < -_0_02) then
          begin
+         Gear^.State:= Gear^.State or gstHHHJump;
          Gear^.dY:= -_0_25;
          Gear^.dX:= hwSign(Gear^.dX) * _0_02
          end;
@@ -299,7 +300,7 @@
       CheckHHDamage(Gear);
       if ((hwAbs(Gear^.dX) + hwAbs(Gear^.dY)) < _0_55)
          and ((Gear^.State and gstHHJumping) <> 0) then SetLittle(Gear^.dX);
-      Gear^.State:= Gear^.State and not (gstFalling or gstHHJumping);
+      Gear^.State:= Gear^.State and not (gstFalling or gstHHJumping or gstHHHJump);
       StepTicks:= 300;
       Gear^.dY:= 0
       end;
--- a/hedgewars/uConsts.pas	Sat Feb 10 12:52:14 2007 +0000
+++ b/hedgewars/uConsts.pas	Sat Feb 10 13:14:41 2007 +0000
@@ -144,6 +144,7 @@
       gsttmpFlag        = $00000200;
       gstHHThinking     = $00000800;
       gstNoDamage       = $00001000;
+      gstHHHJump        = $00002000;
 
       gm_Left   = $00000001;
       gm_Right  = $00000002;