From fa1829d65274b1377223f561585cae0252f00c14 Mon Sep 17 00:00:00 2001 From: Death Killer <884052+deathkiller@users.noreply.github.com> Date: Sun, 5 Nov 2023 14:10:59 +0100 Subject: [PATCH] Fixed down key after jump, don't assign mapping to "Mouse" detected as gamepad on Android --- Sources/Jazz2/Actors/Player.cpp | 5 ++--- Sources/nCine/Input/JoyMapping.cpp | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Sources/Jazz2/Actors/Player.cpp b/Sources/Jazz2/Actors/Player.cpp index ba6755e7..5cddbe21 100644 --- a/Sources/Jazz2/Actors/Player.cpp +++ b/Sources/Jazz2/Actors/Player.cpp @@ -714,14 +714,13 @@ namespace Jazz2::Actors _suspendTime = 4.0f; SetState(ActorState::ApplyGravitation, true); - } else if (!_wasDownPressed && _dizzyTime <= 0.0f) { + } else if (_dizzyTime <= 0.0f) { if (GetState(ActorState::CanJump)) { if (!_isLifting && std::abs(_speed.X) < std::numeric_limits::epsilon()) { _wasDownPressed = true; - SetAnimation(AnimState::Crouch); } - } else if (_playerType != PlayerType::Frog) { + } else if (!_wasDownPressed && _playerType != PlayerType::Frog) { _wasDownPressed = true; _controllable = false; diff --git a/Sources/nCine/Input/JoyMapping.cpp b/Sources/nCine/Input/JoyMapping.cpp index 8b3af82b..572f7095 100644 --- a/Sources/nCine/Input/JoyMapping.cpp +++ b/Sources/nCine/Input/JoyMapping.cpp @@ -466,8 +466,8 @@ namespace nCine // Never search by name on Android, it can lead to wrong mapping if (!mapping.isValid) { const StringView joyNameView = joyName; - // Don't assign Android default mapping to internal NVIDIA Shield devices and WSA devices - if (joyNameView == "virtual-search"_s || joyNameView == "shield-ask-remote"_s || joyNameView == "virtual_keyboard"_s) { + // Don't assign Android default mapping to internal NVIDIA Shield devices, WSA devices and mice (detected as gamepads) + if (joyNameView == "virtual-search"_s || joyNameView == "shield-ask-remote"_s || joyNameView == "virtual_keyboard"_s || joyNameView.contains("Mouse"_s)) { return false; }