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 |
|
174 if CurrentBinds[code] = 'switch' then |
|
175 LocalMessage:= LocalMessage or gmSwitch |
|
176 else if CurrentBinds[code] = '+precise' then |
|
177 LocalMessage:= LocalMessage or gmPrecise; |
|
178 |
173 ParseCommand(CurrentBinds[code], Trusted); |
179 ParseCommand(CurrentBinds[code], Trusted); |
174 if (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then |
180 if (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then |
175 ParseCommand('gencmd R', true) |
181 ParseCommand('gencmd R', true) |
176 end |
182 end |
177 else if (CurrentBinds[code][1] = '+') then |
183 else if (CurrentBinds[code][1] = '+') then |
178 begin |
184 begin |
|
185 if CurrentBinds[code] = '+precise' then |
|
186 LocalMessage:= LocalMessage and not(gmPrecise); |
179 s:= CurrentBinds[code]; |
187 s:= CurrentBinds[code]; |
180 s[1]:= '-'; |
188 s[1]:= '-'; |
181 ParseCommand(s, Trusted); |
189 ParseCommand(s, Trusted); |
182 if (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then |
190 if (CurrentTeam <> nil) and (not CurrentTeam^.ExtDriven) and (ReadyTimeLeft > 1) then |
183 ParseCommand('gencmd R', true) |
191 ParseCommand('gencmd R', true) |
184 end; |
192 end |
|
193 else |
|
194 begin |
|
195 if CurrentBinds[code] = 'switch' then |
|
196 LocalMessage:= LocalMessage and not(gmSwitch) |
|
197 end |
185 end |
198 end |
186 end; |
199 end; |
187 |
200 |
188 procedure ProcessKey(event: TSDL_KeyboardEvent); inline; |
201 procedure ProcessKey(event: TSDL_KeyboardEvent); inline; |
189 var code: LongInt; |
202 var code: LongInt; |
311 |
324 |
312 DefaultBinds[KeyNameToCode('j0a0u')]:= '+left'; |
325 DefaultBinds[KeyNameToCode('j0a0u')]:= '+left'; |
313 DefaultBinds[KeyNameToCode('j0a0d')]:= '+right'; |
326 DefaultBinds[KeyNameToCode('j0a0d')]:= '+right'; |
314 DefaultBinds[KeyNameToCode('j0a1u')]:= '+up'; |
327 DefaultBinds[KeyNameToCode('j0a1u')]:= '+up'; |
315 DefaultBinds[KeyNameToCode('j0a1d')]:= '+down'; |
328 DefaultBinds[KeyNameToCode('j0a1d')]:= '+down'; |
316 for i:= 1 to 10 do DefaultBinds[KeyNameToCode('f'+IntToStr(i))]:= 'slot '+IntToStr(i); |
329 for i:= 1 to 10 do DefaultBinds[KeyNameToCode('f'+IntToStr(i))]:= 'slot '+char(i+48); |
317 for i:= 1 to 5 do DefaultBinds[KeyNameToCode(IntToStr(i))]:= 'timer '+IntToStr(i); |
330 for i:= 1 to 5 do DefaultBinds[KeyNameToCode(IntToStr(i))]:= 'timer '+IntToStr(i); |
318 |
331 |
319 loadBinds('dbind', cPathz[ptData] + '/settings.ini'); |
332 loadBinds('dbind', cPathz[ptData] + '/settings.ini'); |
320 end; |
333 end; |
321 |
334 |