hedgewars/uInputHandler.pas
changeset 9714 54d756b6dbb1
parent 9693 9e31e3bb4476
child 9798 f2b18754742f
child 9950 2759212a27de
child 9981 94f5e5cd151b
equal deleted inserted replaced
9713:cd1d63c355a6 9714:54d756b6dbb1
   134 tkbd[code]:= KeyDown;
   134 tkbd[code]:= KeyDown;
   135 
   135 
   136 Trusted:= (CurrentTeam <> nil)
   136 Trusted:= (CurrentTeam <> nil)
   137           and (not CurrentTeam^.ExtDriven)
   137           and (not CurrentTeam^.ExtDriven)
   138           and (CurrentHedgehog^.BotLevel = 0);
   138           and (CurrentHedgehog^.BotLevel = 0);
   139 
   139 // REVIEW OR FIXME
       
   140 // 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.
       
   141 // There's no confirmation at all
   140 // ctrl/cmd + q to close engine and frontend
   142 // ctrl/cmd + q to close engine and frontend
   141 if(KeyDown and (code = SDLK_q)) then
   143 if(KeyDown and (code = SDLK_q)) then
   142     begin
   144     begin
   143 {$IFDEF DARWIN}
   145 {$IFDEF DARWIN}
   144     if tkbd[KeyNameToCode('left_meta')] or tkbd[KeyNameToCode('right_meta')] then
   146     if tkbd[KeyNameToCode('left_meta')] or tkbd[KeyNameToCode('right_meta')] then
   165     end;
   167     end;
   166 
   168 
   167 if CurrentBinds[code][0] <> #0 then
   169 if CurrentBinds[code][0] <> #0 then
   168     begin
   170     begin
   169     if (code > 3) and KeyDown and (not ((CurrentBinds[code] = 'put')) or (CurrentBinds[code] = 'ammomenu') or (CurrentBinds[code] = '+cur_u') or (CurrentBinds[code] = '+cur_d') or (CurrentBinds[code] = '+cur_l') or (CurrentBinds[code] = '+cur_r')) and (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) then bShowAmmoMenu:= false;
   171     if (code > 3) and KeyDown and (not ((CurrentBinds[code] = 'put')) or (CurrentBinds[code] = 'ammomenu') or (CurrentBinds[code] = '+cur_u') or (CurrentBinds[code] = '+cur_d') or (CurrentBinds[code] = '+cur_l') or (CurrentBinds[code] = '+cur_r')) and (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) then bShowAmmoMenu:= false;
   170 
       
   171     if KeyDown then
   172     if KeyDown then
   172         begin
   173         begin
   173         if CurrentBinds[code] = 'switch' then
   174         if CurrentBinds[code] = 'switch' then
   174             LocalMessage:= LocalMessage or gmSwitch;
   175             LocalMessage:= LocalMessage or gmSwitch
       
   176         else if CurrentBinds[code] = '+precise' then
       
   177             LocalMessage:= LocalMessage or gmPrecise;
   175             
   178             
   176         ParseCommand(CurrentBinds[code], Trusted);
   179         ParseCommand(CurrentBinds[code], Trusted);
   177         if (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then
   180         if (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then
   178             ParseCommand('gencmd R', true)
   181             ParseCommand('gencmd R', true)
   179         end
   182         end
   180     else if (CurrentBinds[code][1] = '+') then
   183     else if (CurrentBinds[code][1] = '+') then
   181         begin
   184         begin
       
   185         if CurrentBinds[code] = '+precise' then
       
   186             LocalMessage:= LocalMessage and not(gmPrecise);
   182         s:= CurrentBinds[code];
   187         s:= CurrentBinds[code];
   183         s[1]:= '-';
   188         s[1]:= '-';
   184         ParseCommand(s, Trusted);
   189         ParseCommand(s, Trusted);
   185         if (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then
   190         if (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then
   186             ParseCommand('gencmd R', true)
   191             ParseCommand('gencmd R', true)