| 279 | } |
| 280 | |
| 281 | static bool QueryActionToDo(Input& in, UserAction action, bool reset, bool checkFocus) |
| 282 | { |
| 283 | if (in.actionDone[action]) |
| 284 | return false; |
| 285 | if (reset) |
| 286 | in.actionDone[action] = true; |
| 287 | |
| 288 | bool found = false; |
| 289 | for (int i = 0; i < in.userKeys[action].Size(); i++) |
| 290 | { |
| 291 | if (!ModifierHeld(in, action, i)) |
| 292 | continue; |
| 293 | int key = in.userKeys[action][i]; |
| 294 | const int value = InputBindingValue(key); |
| 295 | switch (InputBindingDevice(key)) |
| 296 | { |
| 297 | case INPUT_DEVICE_KEYBOARD: |
| 298 | if (InputBindingIsDoubleTap(key) ? QueryDoubleTapKeyToDo(in, value, false, checkFocus) |
| 299 | : QueryKeyToDo(in, value, false, checkFocus)) |
| 300 | found = true; |
| 301 | break; |
| 302 | case INPUT_DEVICE_MOUSE: |
| 303 | if (InputBindingIsDoubleTap(key) ? QueryDoubleTapMouseButtonToDo(in, value, false, checkFocus) |
| 304 | : QueryMouseButtonToDo(in, value, false, checkFocus)) |
| 305 | found = true; |
| 306 | break; |
| 307 | case INPUT_DEVICE_STICK: |
| 308 | if (QueryJoystickButtonToDo(in, value, false, checkFocus)) |
| 309 | found = true; |
| 310 | break; |
| 311 | case INPUT_DEVICE_STICK_POV: |
| 312 | if (!checkFocus || in.gameFocusLost <= 0) |
| 313 | { |
| 314 | int offset = value; |
| 315 | PoseidonAssert(offset >= 0); |
| 316 | PoseidonAssert(offset < N_JOYSTICK_POV); |
| 317 | if (in.gamepad.stickPovToDo[offset]) |
| 318 | found = true; |
| 319 | } |
| 320 | break; |
| 321 | } |
| 322 | } |
| 323 | return found; |
| 324 | } |
| 325 | |
| 326 | static bool ProfileModifierHeld(const Input& in, InputCode modifier, bool checkFocus) |
| 327 | { |
nothing calls this directly
no test coverage detected