Browse Source

clang

pull/8140/head
wkdgmr 7 months ago
parent
commit
a82bed289c
  1. 7
      Source/controls/controller_motion.cpp
  2. 1
      Source/controls/controller_motion.h
  3. 9
      Source/controls/plrctrls.cpp

7
Source/controls/controller_motion.cpp

@ -103,7 +103,6 @@ bool IsPressedForMovement(ControllerButton button)
&& !(SpellSelectFlag && TriggersQuickSpellAction(button));
}
void SetGamepadAimActive(bool value)
{
if (GamepadAimActive == value)
@ -295,9 +294,9 @@ void SimulateRightStickWithPadmapper(ControllerButtonEvent ctrlEvent)
const bool downTriggered = actionName == "MouseDown";
const bool leftTriggered = actionName == "MouseLeft";
const bool rightTriggered = actionName == "MouseRight";
if (!upTriggered && !downTriggered && !leftTriggered && !rightTriggered) {
return;
}
if (!upTriggered && !downTriggered && !leftTriggered && !rightTriggered) {
return;
}
const bool upActive = (upTriggered && !ctrlEvent.up) || (!upTriggered && PadmapperIsActionActive("MouseUp"));
const bool downActive = (downTriggered && !ctrlEvent.up) || (!downTriggered && PadmapperIsActionActive("MouseDown"));

1
Source/controls/controller_motion.h

@ -11,7 +11,6 @@ namespace devilution {
// Returns true if gamepad aiming is currently active (right stick or padmapped mouse).
bool IsGamepadAimActive();
// Raw axis values.
extern float leftStickXUnscaled, leftStickYUnscaled, rightStickXUnscaled, rightStickYUnscaled;

9
Source/controls/plrctrls.cpp

@ -128,7 +128,8 @@ int GetDistance(Point destination, int maxDistance)
int8_t walkpath[MaxPathLengthPlayer];
Player &myPlayer = *MyPlayer;
const int steps = FindPath(CanStep, [&myPlayer](Point position) { return PosOkPlayer(myPlayer, position); }, myPlayer.position.future, destination, walkpath, std::min<size_t>(maxDistance, MaxPathLengthPlayer));
const int steps = FindPath(
CanStep, [&myPlayer](Point position) { return PosOkPlayer(myPlayer, position); }, myPlayer.position.future, destination, walkpath, std::min<size_t>(maxDistance, MaxPathLengthPlayer));
if (steps > maxDistance)
return 0;
@ -1752,7 +1753,7 @@ void DetectInputMethod(const SDL_Event &event, const ControllerButtonEvent &game
if (newControlDevice != ControlDevice) {
ControlDevice = newControlDevice;
#ifndef USE_SDL1
#ifndef USE_SDL1
// Prevent cursor hiding and device/mode swap while gamepad aiming is active
if (!IsGamepadAimActive()) {
if (ControlDevice != ControlTypes::KeyboardAndMouse) {
@ -1769,7 +1770,7 @@ void DetectInputMethod(const SDL_Event &event, const ControllerButtonEvent &game
GamepadType = newGamepadLayout;
}
}
#endif
#endif
}
if (newControlMode != ControlMode) {
@ -2277,7 +2278,7 @@ void QuickCast(size_t slot)
const SpellType spellType = myPlayer._pSplTHotKey[slot];
if (!IsGamepadAimActive) {
UpdateSpellTarget(spell);
UpdateSpellTarget(spell);
}
CheckPlrSpell(false, spell, spellType);

Loading…
Cancel
Save