1
0
mirror of https://github.com/moparisthebest/minetest synced 2024-11-06 17:35:14 -05:00

Only retrieve always_fly_fast setting once

This commit is contained in:
SmallJoker 2015-05-30 22:24:49 +02:00 committed by est31
parent addf3ee165
commit b4dfaa3a7a

View File

@ -86,9 +86,8 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
bool noclip = m_gamedef->checkLocalPrivilege("noclip") && bool noclip = m_gamedef->checkLocalPrivilege("noclip") &&
g_settings->getBool("noclip"); g_settings->getBool("noclip");
bool free_move = noclip && fly_allowed && g_settings->getBool("free_move"); bool free_move = noclip && fly_allowed && g_settings->getBool("free_move");
if(free_move) if (free_move) {
{ position += m_speed * dtime;
position += m_speed * dtime;
setPosition(position); setPosition(position);
m_sneak_node_exists = false; m_sneak_node_exists = false;
return; return;
@ -408,11 +407,12 @@ void LocalPlayer::applyControl(float dtime)
// When aux1_descends is enabled the fast key is used to go down, so fast isn't possible // 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 && !g_settings->getBool("aux1_descends"); bool fast_climb = fast_move && control.aux1 && !g_settings->getBool("aux1_descends");
bool continuous_forward = g_settings->getBool("continuous_forward"); bool continuous_forward = g_settings->getBool("continuous_forward");
bool always_fly_fast = g_settings->getBool("always_fly_fast");
// Whether superspeed mode is used or not // Whether superspeed mode is used or not
bool superspeed = false; bool superspeed = false;
if(g_settings->getBool("always_fly_fast") && free_move && fast_move) if (always_fly_fast && free_move && fast_move)
superspeed = true; superspeed = true;
// Old descend control // Old descend control
@ -470,7 +470,7 @@ void LocalPlayer::applyControl(float dtime)
if(free_move) if(free_move)
{ {
// In free movement mode, sneak descends // In free movement mode, sneak descends
if(fast_move && (control.aux1 || g_settings->getBool("always_fly_fast"))) if (fast_move && (control.aux1 || always_fly_fast))
speedV.Y = -movement_speed_fast; speedV.Y = -movement_speed_fast;
else else
speedV.Y = -movement_speed_walk; speedV.Y = -movement_speed_walk;
@ -517,11 +517,9 @@ void LocalPlayer::applyControl(float dtime)
} }
if(control.jump) if(control.jump)
{ {
if(free_move) if (free_move) {
{ if (g_settings->getBool("aux1_descends") || always_fly_fast) {
if(g_settings->getBool("aux1_descends") || g_settings->getBool("always_fly_fast")) if (fast_move)
{
if(fast_move)
speedV.Y = movement_speed_fast; speedV.Y = movement_speed_fast;
else else
speedV.Y = movement_speed_walk; speedV.Y = movement_speed_walk;