hedgewars/uInputHandler.pas
changeset 15028 9d00a873bbcc
parent 15027 f81b46f584c7
child 15300 7ab5cf405686
--- a/hedgewars/uInputHandler.pas	Sat May 18 19:20:54 2019 +0200
+++ b/hedgewars/uInputHandler.pas	Sat May 18 19:33:49 2019 +0200
@@ -188,6 +188,7 @@
 var
     Trusted: boolean;
     curBind, s: shortstring;
+    readyAborter: boolean;
 begin
 if not(tkbd[code] xor KeyDown) then exit;
 tkbd[code]:= KeyDown;
@@ -228,6 +229,12 @@
 if CurrentBinds.indices[code] > 0 then
     begin
     curBind:= CurrentBinds.binds[CurrentBinds.indices[code]];
+
+    // Check if the keypress should end the ready phase.
+    // Camera movement keys are "safe" since its equivalent to moving the mouse,
+    // which also does not end the ready phase.
+    readyAborter:= (curBind <> '+cur_u') and (curBind <> '+cur_d') and (curBind <> '+cur_l') and (curBind <> '+cur_r');
+
     if (code < cKeyMaxIndex - 2) // means not mouse buttons
         and KeyDown
         and (not ((curBind = 'put')
@@ -255,7 +262,8 @@
             end;
 
         ParseCommand(curBind, Trusted);
-        if (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then
+        // End ready phase
+        if (readyAborter) and (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then
             ParseCommand('gencmd R', true)
         end
     else if (curBind[1] = '+') then
@@ -270,7 +278,8 @@
         s:= curBind;
         s[1]:= '-';
         ParseCommand(s, Trusted);
-        if (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then
+        // End ready phase
+        if (readyAborter) and (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then
             ParseCommand('gencmd R', true)
         end
     else