mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 04:20:42 +00:00
- PlayerAngle::applyinput()
: Consolidate some mostly duplicated code into a lambda.
This commit is contained in:
parent
1bb0c04e61
commit
5050947dca
1 changed files with 10 additions and 12 deletions
|
@ -389,19 +389,17 @@ void PlayerAngle::applyinput(float const avel, ESyncBits* actions, double const
|
||||||
if (abs(look_ang.signedbam()) < (BAMUNIT >> 2)) look_ang = bamang(0);
|
if (abs(look_ang.signedbam()) < (BAMUNIT >> 2)) look_ang = bamang(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*actions & SB_LOOK_LEFT)
|
// Process keyboard input.
|
||||||
|
auto doLookKeys = [&](ESyncBits_ const key, double const direction)
|
||||||
{
|
{
|
||||||
// start looking left
|
if (*actions & key)
|
||||||
look_ang -= getscaledangle(LOOKINGSPEED, scaleAdjust);
|
{
|
||||||
rotscrnang += getscaledangle(ROTATESPEED, scaleAdjust);
|
look_ang += getscaledangle(LOOKINGSPEED, scaleAdjust * direction);
|
||||||
}
|
rotscrnang -= getscaledangle(ROTATESPEED, scaleAdjust * direction);
|
||||||
|
}
|
||||||
if (*actions & SB_LOOK_RIGHT)
|
};
|
||||||
{
|
doLookKeys(SB_LOOK_LEFT, -1);
|
||||||
// start looking right
|
doLookKeys(SB_LOOK_RIGHT, 1);
|
||||||
look_ang += getscaledangle(LOOKINGSPEED, scaleAdjust);
|
|
||||||
rotscrnang -= getscaledangle(ROTATESPEED, scaleAdjust);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!movementlocked())
|
if (!movementlocked())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue