MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / QueryAction

Function QueryAction

engine/Poseidon/Input/InputSubsystem.cpp:238–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236}
237
238static float QueryAction(const Input& in, UserAction action, bool checkFocus)
239{
240 float sum = 0;
241 for (int i = 0; i < in.userKeys[action].Size(); i++)
242 {
243 if (!ModifierHeld(in, action, i))
244 continue;
245 int key = in.userKeys[action][i];
246 const int value = InputBindingValue(key);
247 switch (InputBindingDevice(key))
248 {
249 case INPUT_DEVICE_KEYBOARD:
250 sum += InputBindingIsDoubleTap(key) ? QueryDoubleTapKey(in, value, checkFocus)
251 : QueryKey(in, value, checkFocus);
252 break;
253 case INPUT_DEVICE_MOUSE:
254 sum += InputBindingIsDoubleTap(key) ? QueryDoubleTapMouseButton(in, value, checkFocus)
255 : QueryMouseButton(in, value, checkFocus);
256 break;
257 case INPUT_DEVICE_STICK:
258 sum += QueryJoystickButton(in, value, checkFocus);
259 break;
260 case INPUT_DEVICE_STICK_AXIS:
261 {
262 int offset = value;
263 PoseidonAssert(offset >= 0);
264 PoseidonAssert(offset < N_JOYSTICK_AXES);
265 sum += in.gamepad.stickAxis[offset];
266 }
267 break;
268 case INPUT_DEVICE_STICK_POV:
269 {
270 int offset = value;
271 PoseidonAssert(offset >= 0);
272 PoseidonAssert(offset < N_JOYSTICK_POV);
273 sum += in.gamepad.stickPov[offset];
274 }
275 break;
276 }
277 }
278 return sum;
279}
280
281static bool QueryActionToDo(Input& in, UserAction action, bool reset, bool checkFocus)
282{

Callers

nothing calls this directly

Calls 10

ModifierHeldFunction · 0.85
InputBindingValueFunction · 0.85
InputBindingDeviceFunction · 0.85
InputBindingIsDoubleTapFunction · 0.85
QueryDoubleTapKeyFunction · 0.85
QueryKeyFunction · 0.85
QueryMouseButtonFunction · 0.85
QueryJoystickButtonFunction · 0.85
SizeMethod · 0.45

Tested by

no test coverage detected