stop the crosshair from twitching when it's not supposed to move + fix aimingUp/Down booleans
authorXeli
Fri, 17 Feb 2012 23:36:05 +0100
changeset 6705 d2e95dcf2bb0
parent 6704 77c93096d055
child 6706 c4272519b128
stop the crosshair from twitching when it's not supposed to move + fix aimingUp/Down booleans
hedgewars/uTouch.pas
--- a/hedgewars/uTouch.pas	Fri Feb 17 22:54:45 2012 +0100
+++ b/hedgewars/uTouch.pas	Fri Feb 17 23:36:05 2012 +0100
@@ -120,7 +120,6 @@
 if isOnRect(arrowUp.active, finger^) then
      begin
      upKey:= true;
-     aimingUp:= true;
      moveCursor:= false;
      finger^.pressedWidget:= @arrowUp;
      exit;
@@ -128,7 +127,6 @@
 if isOnRect(arrowDown.active, finger^) then
      begin
      downKey:= true;
-     aimingDown:= true;
      moveCursor:= false;
      finger^.pressedWidget:= @arrowDown;
      exit;
@@ -228,6 +226,8 @@
 if aimingCrosshair then
     begin
     aimingCrosshair:= false;
+    upKey:= false;
+    downKey:= false;
     dec(buttonsDown);
     end;
 
@@ -378,22 +378,16 @@
     deltaAngle: LongInt;
 begin
 invertCursor := not(bShowAmmoMenu);
-if aimingCrosshair or aimingUp or aimingDown then
+if aimingCrosshair then
     if CurrentHedgehog^.Gear <> nil then
         begin
         deltaAngle:= CurrentHedgehog^.Gear^.Angle - targetAngle;
-        if (deltaAngle = 0) then 
+        if (deltaAngle > -5) and (deltaAngle < 5) then 
             begin
-            if aimingUp then
-                begin
                 upKey:= false;
                 aimingUp:= false;
-                end;
-            if aimingDown then
-                begin
                 downKey:= false;
                 aimingDown:= false;
-                end
             end
         else
             begin