Skip to content

Commit c2a2c8f

Browse files
committed
Fix mouse position, aim and pie menu pointing being reset at some inappropriate times, specifically when anyone with a controller opens or closes their pie menu.
1 parent 27ce6f0 commit c2a2c8f

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

Source/Activities/GameActivity.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ void GameActivity::UpdateEditing() {
10551055
DisableAIs(false);
10561056
InitAIs();
10571057
// Reset the mouse value and pathfinding so it'll know about the newly placed stuff
1058-
g_UInputMan.SetMouseValueMagnitude(0);
1058+
g_UInputMan.SetMouseValueMagnitude(0, g_UInputMan.MouseUsedByPlayer());
10591059
g_SceneMan.GetScene()->ResetPathFinding();
10601060
// Start the in-game track
10611061
// g_AudioMan.ClearMusicQueue();
@@ -1235,7 +1235,7 @@ void GameActivity::Update() {
12351235
if (m_PlayerController[player].IsState(PRESS_SECONDARY)) {
12361236
// Reset the mouse so the actor doesn't change aim because mouse has been moved
12371237
if (m_PlayerController[player].IsMouseControlled()) {
1238-
g_UInputMan.SetMouseValueMagnitude(0);
1238+
g_UInputMan.SetMouseValueMagnitude(0, player);
12391239
}
12401240

12411241
m_ViewState[player] = ViewState::Normal;
@@ -1254,7 +1254,7 @@ void GameActivity::Update() {
12541254
else if (m_PlayerController[player].IsState(ACTOR_NEXT) || m_PlayerController[player].IsState(ACTOR_PREV) || m_PlayerController[player].IsState(PRESS_FACEBUTTON) || m_PlayerController[player].IsState(PRESS_PRIMARY)) {
12551255
// Reset the mouse so the actor doesn't change aim because mouse has been moved
12561256
if (m_PlayerController[player].IsMouseControlled()) {
1257-
g_UInputMan.SetMouseValueMagnitude(0);
1257+
g_UInputMan.SetMouseValueMagnitude(0, player);
12581258
}
12591259

12601260
if (pMarkedActor) {

Source/Managers/ActivityMan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ int ActivityMan::StartActivity(Activity* activity) {
314314
g_FrameMan.ClearScreenText();
315315

316316
// Reset the mouse input to the center
317-
g_UInputMan.SetMouseValueMagnitude(0.05F);
317+
g_UInputMan.SetMouseValueMagnitude(0, g_UInputMan.MouseUsedByPlayer());
318318

319319
g_AudioMan.PauseIngameSounds(false);
320320

Source/Managers/UInputMan.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,15 +324,17 @@ Vector UInputMan::GetMouseMovement(int whichPlayer) const {
324324
void UInputMan::SetMouseValueMagnitude(float magCap, int whichPlayer) {
325325
if (IsInMultiplayerMode() && whichPlayer >= Players::PlayerOne && whichPlayer < Players::MaxPlayerCount) {
326326
m_NetworkAnalogMoveData[whichPlayer].CapMagnitude(m_MouseTrapRadius * magCap);
327+
} else if (whichPlayer != Players::NoPlayer && m_ControlScheme.at(whichPlayer).GetDevice() == InputDevice::DEVICE_MOUSE_KEYB) {
328+
m_AnalogMouseData.SetMagnitude(m_MouseTrapRadius * magCap);
327329
}
328-
m_AnalogMouseData.SetMagnitude(m_MouseTrapRadius * magCap);
329330
}
330331

331332
void UInputMan::SetMouseValueAngle(float angle, int whichPlayer) {
332333
if (IsInMultiplayerMode() && whichPlayer >= Players::PlayerOne && whichPlayer < Players::MaxPlayerCount) {
333334
m_NetworkAnalogMoveData[whichPlayer].SetAbsRadAngle(angle);
335+
} else if (whichPlayer != Players::NoPlayer && m_ControlScheme.at(whichPlayer).GetDevice() == InputDevice::DEVICE_MOUSE_KEYB) {
336+
m_AnalogMouseData.SetAbsRadAngle(angle);
334337
}
335-
m_AnalogMouseData.SetAbsRadAngle(angle);
336338
}
337339

338340
void UInputMan::SetMousePos(const Vector& newPos, int whichPlayer) const {

Source/System/Controller.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ void Controller::UpdatePlayerAnalogInput() {
419419
// Disable sharp aim while moving - this also helps with keyboard vs mouse fighting when moving and aiming in opposite directions
420420
if (m_ControlStates[ControlState::BODY_JUMP] && !pieMenuActive) {
421421
if (IsMouseControlled()) {
422-
g_UInputMan.SetMouseValueMagnitude(0.3F);
422+
g_UInputMan.SetMouseValueMagnitude(0.3F, m_Player);
423423
}
424424
m_ControlStates[ControlState::AIM_SHARP] = false;
425425
}

0 commit comments

Comments
 (0)