mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 22:51:50 +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 (*actions & SB_LOOK_LEFT)
|
||||
// Process keyboard input.
|
||||
auto doLookKeys = [&](ESyncBits_ const key, double const direction)
|
||||
{
|
||||
// start looking left
|
||||
look_ang -= getscaledangle(LOOKINGSPEED, scaleAdjust);
|
||||
rotscrnang += getscaledangle(ROTATESPEED, scaleAdjust);
|
||||
}
|
||||
|
||||
if (*actions & SB_LOOK_RIGHT)
|
||||
{
|
||||
// start looking right
|
||||
look_ang += getscaledangle(LOOKINGSPEED, scaleAdjust);
|
||||
rotscrnang -= getscaledangle(ROTATESPEED, scaleAdjust);
|
||||
}
|
||||
if (*actions & key)
|
||||
{
|
||||
look_ang += getscaledangle(LOOKINGSPEED, scaleAdjust * direction);
|
||||
rotscrnang -= getscaledangle(ROTATESPEED, scaleAdjust * direction);
|
||||
}
|
||||
};
|
||||
doLookKeys(SB_LOOK_LEFT, -1);
|
||||
doLookKeys(SB_LOOK_RIGHT, 1);
|
||||
|
||||
if (!movementlocked())
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue