| 372 | } |
| 373 | |
| 374 | static bool QueryProfileCodeToDo(Input& in, InputCode code, bool reset, bool checkFocus) |
| 375 | { |
| 376 | if (!code.valid()) |
| 377 | return false; |
| 378 | const int packed = code.toLegacy(); |
| 379 | const int value = InputBindingValue(packed); |
| 380 | switch (InputBindingDevice(packed)) |
| 381 | { |
| 382 | case INPUT_DEVICE_KEYBOARD: |
| 383 | return InputBindingIsDoubleTap(packed) ? QueryDoubleTapKeyToDo(in, value, reset, checkFocus) |
| 384 | : QueryKeyToDo(in, value, reset, checkFocus); |
| 385 | case INPUT_DEVICE_MOUSE: |
| 386 | return InputBindingIsDoubleTap(packed) ? QueryDoubleTapMouseButtonToDo(in, value, reset, checkFocus) |
| 387 | : QueryMouseButtonToDo(in, value, reset, checkFocus); |
| 388 | case INPUT_DEVICE_STICK: |
| 389 | return QueryJoystickButtonToDo(in, value, reset, checkFocus); |
| 390 | case INPUT_DEVICE_STICK_POV: |
| 391 | if (checkFocus && in.gameFocusLost > 0) |
| 392 | return false; |
| 393 | if (value < 0 || value >= N_JOYSTICK_POV) |
| 394 | return false; |
| 395 | { |
| 396 | bool ret = in.gamepad.stickPovToDo[value]; |
| 397 | if (reset) |
| 398 | in.gamepad.stickPovToDo[value] = false; |
| 399 | return ret; |
| 400 | } |
| 401 | default: |
| 402 | return false; |
| 403 | } |
| 404 | } |
| 405 | |
| 406 | static float QueryProfileAction(const Input& in, const InputProfile& profile, UserAction action, bool checkFocus) |
| 407 | { |
no test coverage detected