@@ -1620,6 +1620,11 @@ class Game
16201620 bool m_cache_enable_fog;
16211621 f32 m_cache_mouse_sensitivity;
16221622 f32 m_repeat_right_click_time;
1623+
1624+ #ifdef __ANDROID__
1625+ bool m_cache_hold_aux1;
1626+ #endif
1627+
16231628};
16241629
16251630Game::Game () :
@@ -1653,6 +1658,11 @@ Game::Game() :
16531658 m_repeat_right_click_time = g_settings->getFloat (" repeat_rightclick_time" );
16541659
16551660 m_cache_mouse_sensitivity = rangelim (m_cache_mouse_sensitivity, 0.001 , 100.0 );
1661+
1662+ #ifdef __ANDROID__
1663+ m_cache_hold_aux1 = false ; // This is initialised properly later
1664+ #endif
1665+
16561666}
16571667
16581668
@@ -1759,6 +1769,11 @@ void Game::run()
17591769
17601770 set_light_table (g_settings->getFloat (" display_gamma" ));
17611771
1772+ #ifdef __ANDROID__
1773+ m_cache_hold_aux1 = g_settings->getBool (" fast_move" )
1774+ && client->checkPrivilege (" fast" );
1775+ #endif
1776+
17621777 while (device->run () && !(*kill || g_gamecallback->shutdown_requested )) {
17631778
17641779 /* Must be called immediately after a device->run() call because it
@@ -2747,8 +2762,14 @@ void Game::toggleFast(float *statustext_time)
27472762 *statustext_time = 0 ;
27482763 statustext = msg[fast_move];
27492764
2750- if (fast_move && !client->checkPrivilege (" fast" ))
2765+ bool has_fast_privs = client->checkPrivilege (" fast" );
2766+
2767+ if (fast_move && !has_fast_privs)
27512768 statustext += L" (note: no 'fast' privilege)" ;
2769+
2770+ #ifdef __ANDROID__
2771+ m_cache_hold_aux1 = fast_move && has_fast_privs;
2772+ #endif
27522773}
27532774
27542775
@@ -2998,11 +3019,15 @@ void Game::updatePlayerControl(const CameraOrientation &cam)
29983019 );
29993020
30003021#ifdef ANDROID
3001- /* For Android, invert the meaning of holding down the fast button (i.e.
3002- * holding down the fast button -- if there is one -- means walk)
3022+ /* For Android, simulate holding down AUX1 (fast move) if the user has
3023+ * the fast_move setting toggled on. If there is an aux1 key defined for
3024+ * Android then its meaning is inverted (i.e. holding aux1 means walk and
3025+ * not fast)
30033026 */
3004- control.aux1 = control.aux1 ^ true ;
3005- keypress_bits ^= ((u32 )(1U << 5 ));
3027+ if (m_cache_hold_aux1) {
3028+ control.aux1 = control.aux1 ^ true ;
3029+ keypress_bits ^= ((u32 )(1U << 5 ));
3030+ }
30063031#endif
30073032
30083033 client->setPlayerControl (control);
0 commit comments