hedgewars/uInputHandler.pas
branchsdl2transition
changeset 9798 f2b18754742f
parent 9694 e8d0fe885169
parent 9714 54d756b6dbb1
child 11360 7a7611adf715
equal deleted inserted replaced
9711:7d0329f37181 9798:f2b18754742f
   135 tkbd[code]:= KeyDown;
   135 tkbd[code]:= KeyDown;
   136 
   136 
   137 Trusted:= (CurrentTeam <> nil)
   137 Trusted:= (CurrentTeam <> nil)
   138           and (not CurrentTeam^.ExtDriven)
   138           and (not CurrentTeam^.ExtDriven)
   139           and (CurrentHedgehog^.BotLevel = 0);
   139           and (CurrentHedgehog^.BotLevel = 0);
   140 
   140 // REVIEW OR FIXME
       
   141 // ctrl/cmd + q to close engine and frontend - this seems like a bad idea, since we let people set arbitrary binds, and don't warn them of this.
       
   142 // There's no confirmation at all
   141 // ctrl/cmd + q to close engine and frontend
   143 // ctrl/cmd + q to close engine and frontend
   142 if(KeyDown and (code = SDLK_q)) then
   144 if(KeyDown and (code = SDLK_q)) then
   143     begin
   145     begin
   144 {$IFDEF DARWIN}
   146 {$IFDEF DARWIN}
   145     if tkbd[KeyNameToCode('left_meta')] or tkbd[KeyNameToCode('right_meta')] then
   147     if tkbd[KeyNameToCode('left_meta')] or tkbd[KeyNameToCode('right_meta')] then
   174         and (not CurrentTeam^.ExtDriven) 
   176         and (not CurrentTeam^.ExtDriven) 
   175         then bShowAmmoMenu:= false;
   177         then bShowAmmoMenu:= false;
   176 
   178 
   177     if KeyDown then
   179     if KeyDown then
   178         begin
   180         begin
       
   181         if CurrentBinds[code] = 'switch' then
       
   182             LocalMessage:= LocalMessage or gmSwitch
       
   183         else if CurrentBinds[code] = '+precise' then
       
   184             LocalMessage:= LocalMessage or gmPrecise;
       
   185             
   179         ParseCommand(CurrentBinds[code], Trusted);
   186         ParseCommand(CurrentBinds[code], Trusted);
   180         if (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then
   187         if (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then
   181             ParseCommand('gencmd R', true)
   188             ParseCommand('gencmd R', true)
   182         end
   189         end
   183     else if (CurrentBinds[code][1] = '+') then
   190     else if (CurrentBinds[code][1] = '+') then
   184         begin
   191         begin
       
   192         if CurrentBinds[code] = '+precise' then
       
   193             LocalMessage:= LocalMessage and not(gmPrecise);
   185         s:= CurrentBinds[code];
   194         s:= CurrentBinds[code];
   186         s[1]:= '-';
   195         s[1]:= '-';
   187         ParseCommand(s, Trusted);
   196         ParseCommand(s, Trusted);
   188         if (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then
   197         if (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then
   189             ParseCommand('gencmd R', true)
   198             ParseCommand('gencmd R', true)
   190         end;
   199         end
       
   200     else
       
   201         begin
       
   202         if CurrentBinds[code] = 'switch' then
       
   203             LocalMessage:= LocalMessage and not(gmSwitch)
       
   204         end
   191     end
   205     end
   192 end;
   206 end;
   193 
   207 
   194 {$IFDEF SDL2}
   208 {$IFDEF SDL2}
   195 procedure ProcessKey(event: TSDL_KeyboardEvent); inline;
   209 procedure ProcessKey(event: TSDL_KeyboardEvent); inline;