diff options
author | DS <vorunbekannt75@web.de> | 2019-05-21 20:50:00 +0200 |
---|---|---|
committer | Paramat <paramat@users.noreply.github.com> | 2019-05-21 19:50:00 +0100 |
commit | 9d09c87f13a197672bd69ede8de987953af945ad (patch) | |
tree | 889ab878c662a9593040af508fbd838bb78ab5c2 | |
parent | a90f2efb12b5131436d22a3627403736e2d326b2 (diff) | |
download | minetest-9d09c87f13a197672bd69ede8de987953af945ad.tar.gz minetest-9d09c87f13a197672bd69ede8de987953af945ad.tar.bz2 minetest-9d09c87f13a197672bd69ede8de987953af945ad.zip |
Make autoforward simulate the 'up' key (#8249)
-rw-r--r-- | src/client/game.cpp | 6 | ||||
-rw-r--r-- | src/client/localplayer.cpp | 13 |
2 files changed, 8 insertions, 11 deletions
diff --git a/src/client/game.cpp b/src/client/game.cpp index 0badda535..8c0433283 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -2483,6 +2483,12 @@ void Game::updatePlayerControl(const CameraOrientation &cam) keypress_bits |= 1U << 4; } + // autoforward if set: simulate "up" key + if (player->getPlayerSettings().continuous_forward) { + control.up = true; + keypress_bits |= 1U << 0; + } + client->setPlayerControl(control); player->keyPressed = keypress_bits; diff --git a/src/client/localplayer.cpp b/src/client/localplayer.cpp index 7e7b1a867..dabeee6fe 100644 --- a/src/client/localplayer.cpp +++ b/src/client/localplayer.cpp @@ -496,7 +496,6 @@ void LocalPlayer::applyControl(float dtime, Environment *env) bool pitch_move = (free_move || in_liquid) && player_settings.pitch_move; // When aux1_descends is enabled the fast key is used to go down, so fast isn't possible bool fast_climb = fast_move && control.aux1 && !player_settings.aux1_descends; - bool continuous_forward = player_settings.continuous_forward; bool always_fly_fast = player_settings.always_fly_fast; // Whether superspeed mode is used or not @@ -583,16 +582,8 @@ void LocalPlayer::applyControl(float dtime, Environment *env) } } - if (continuous_forward) - speedH += v3f(0,0,1); - if (control.up) { - if (continuous_forward) { - if (fast_move) - superspeed = true; - } else { - speedH += v3f(0,0,1); - } + speedH += v3f(0,0,1); } if (control.down) { speedH -= v3f(0,0,1); @@ -1111,7 +1102,7 @@ void LocalPlayer::handleAutojump(f32 dtime, Environment *env, if (m_autojump) return; - bool control_forward = control.up || player_settings.continuous_forward || + bool control_forward = control.up || (!control.up && !control.down && control.forw_move_joystick_axis < -0.05); bool could_autojump = |