Mobile: remove aux1 holding hack

master
Maksim 2022-02-27 13:50:23 +01:00
parent d974b14e2c
commit 46bd318b38
3 changed files with 25 additions and 34 deletions

View File

@ -1021,13 +1021,17 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
bool allow_update = false;
// increase speed if using fast or flying fast
if((g_settings->getBool("fast_move") &&
m_client->checkLocalPrivilege("fast")) &&
(controls.aux1 ||
if (g_settings->getBool("fast_move") &&
m_client->checkLocalPrivilege("fast")) {
#ifndef HAVE_TOUCHSCREENGUI
// do not require pressing AUX1 for Fast if HAVE_TOUCHSCREENGUI.
if ((controls.aux1 ||
(!player->touching_ground &&
g_settings->getBool("free_move") &&
m_client->checkLocalPrivilege("fly"))))
new_speed *= 1.5;
#endif
new_speed *= 1.5;
}
// slowdown speed if sneeking
if (controls.sneak && walking)
new_speed /= 2;

View File

@ -928,9 +928,7 @@ private:
bool m_does_lost_focus_pause_game = false;
int m_reset_HW_buffer_counter = 0;
#ifdef HAVE_TOUCHSCREENGUI
bool m_cache_hold_aux1;
#endif
#if defined(__ANDROID__) || defined(__IOS__)
bool m_android_chat_open;
#endif
@ -968,11 +966,6 @@ Game::Game() :
&settingChangedCallback, this);
readSettings();
#ifdef HAVE_TOUCHSCREENGUI
m_cache_hold_aux1 = false; // This is initialised properly later
#endif
}
@ -1093,11 +1086,6 @@ void Game::run()
set_light_table(g_settings->getFloat("display_gamma"));
#ifdef HAVE_TOUCHSCREENGUI
m_cache_hold_aux1 = g_settings->getBool("fast_move")
&& client->checkPrivilege("fast");
#endif
irr::core::dimension2d<u32> previous_screen_size(g_settings->getU16("screen_w"),
g_settings->getU16("screen_h"));
@ -2215,10 +2203,6 @@ void Game::toggleFast()
} else {
m_game_ui->showTranslatedStatusText("Fast mode disabled");
}
#ifdef HAVE_TOUCHSCREENGUI
m_cache_hold_aux1 = fast_move && has_fast_privs;
#endif
}
@ -2531,18 +2515,6 @@ void Game::updatePlayerControl(const CameraOrientation &cam)
( (u32)(isKeyDown(KeyType::ZOOM) & 0x1) << 9)
);
#ifdef HAVE_TOUCHSCREENGUI
/* For touch, simulate holding down AUX1 (fast move) if the user has
* the fast_move setting toggled on. If there is an aux1 key defined for
* touch then its meaning is inverted (i.e. holding aux1 means walk and
* not fast)
*/
if (m_cache_hold_aux1 && !porting::hasRealKeyboard()) {
control.aux1 = control.aux1 ^ true;
keypress_bits ^= ((u32)(1U << 5));
}
#endif
LocalPlayer *player = client->getEnv().getLocalPlayer();
// autojump if set: simulate "jump" key

View File

@ -502,7 +502,11 @@ void LocalPlayer::applyControl(float dtime, Environment *env)
bool fast_move = fast_allowed && player_settings.fast_move;
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
#ifndef HAVE_TOUCHSCREENGUI
bool fast_climb = fast_move && control.aux1 && !player_settings.aux1_descends;
#else
bool fast_climb = fast_move && !player_settings.aux1_descends;
#endif
bool always_fly_fast = player_settings.always_fly_fast;
// Whether superspeed mode is used or not
@ -541,7 +545,10 @@ void LocalPlayer::applyControl(float dtime, Environment *env)
// New minecraft-like descend control
// Auxiliary button 1 (E)
if (control.aux1) {
#ifndef HAVE_TOUCHSCREENGUI
if (control.aux1)
#endif
{
if (!is_climbing) {
// aux1 is "Turbo button"
if (fast_move)
@ -604,7 +611,11 @@ void LocalPlayer::applyControl(float dtime, Environment *env)
else
speedV.Y = movement_speed_walk;
} else {
#ifndef HAVE_TOUCHSCREENGUI
if (fast_move && control.aux1)
#else
if (fast_move)
#endif
speedV.Y = movement_speed_fast;
else
speedV.Y = movement_speed_walk;
@ -661,7 +672,11 @@ void LocalPlayer::applyControl(float dtime, Environment *env)
if ((!touching_ground && !free_move && !is_climbing && !in_liquid) ||
(!free_move && m_can_jump && control.jump)) {
// Jumping and falling
#ifndef HAVE_TOUCHSCREENGUI
if (superspeed || (fast_move && control.aux1))
#else
if (superspeed || fast_move)
#endif
incH = movement_acceleration_fast * BS * dtime;
else
incH = movement_acceleration_air * BS * dtime;