forked from Mirrorlandia_minetest/minetest
On Android enable always fast
Invert the meaning of holding down the fast button (i.e. holding down the fast button -- if there is one -- means walk), unless performing an action, sneaking or jumping. Still requires fast move to be toggled on (and fast priv)
This commit is contained in:
parent
bf06b68c96
commit
ff924ef0dc
24
src/game.cpp
24
src/game.cpp
@ -2969,9 +2969,8 @@ void Game::updatePlayerControl(const CameraOrientation &cam)
|
|||||||
cam.camera_pitch,
|
cam.camera_pitch,
|
||||||
cam.camera_yaw
|
cam.camera_yaw
|
||||||
);
|
);
|
||||||
client->setPlayerControl(control);
|
|
||||||
LocalPlayer *player = client->getEnv().getLocalPlayer();
|
u32 keypress_bits =
|
||||||
player->keyPressed =
|
|
||||||
( (u32)(input->isKeyDown(keycache.key[KeyCache::KEYMAP_ID_FORWARD]) & 0x1) << 0) |
|
( (u32)(input->isKeyDown(keycache.key[KeyCache::KEYMAP_ID_FORWARD]) & 0x1) << 0) |
|
||||||
( (u32)(input->isKeyDown(keycache.key[KeyCache::KEYMAP_ID_BACKWARD]) & 0x1) << 1) |
|
( (u32)(input->isKeyDown(keycache.key[KeyCache::KEYMAP_ID_BACKWARD]) & 0x1) << 1) |
|
||||||
( (u32)(input->isKeyDown(keycache.key[KeyCache::KEYMAP_ID_LEFT]) & 0x1) << 2) |
|
( (u32)(input->isKeyDown(keycache.key[KeyCache::KEYMAP_ID_LEFT]) & 0x1) << 2) |
|
||||||
@ -2983,6 +2982,25 @@ void Game::updatePlayerControl(const CameraOrientation &cam)
|
|||||||
( (u32)(input->getRightState() & 0x1) << 8
|
( (u32)(input->getRightState() & 0x1) << 8
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef ANDROID
|
||||||
|
/* For Android, invert the meaning of holding down the fast button (i.e.
|
||||||
|
* holding down the fast button -- if there is one -- means walk), unless
|
||||||
|
* performing an action, sneaking or jumping.
|
||||||
|
*/
|
||||||
|
const u32 autofast_exludebits =
|
||||||
|
(1U << 4) | (1U << 6) // jump, sneak
|
||||||
|
| (1U << 7) | (1U << 8); // left state, right state
|
||||||
|
|
||||||
|
if ((keypress_bits & autofast_exludebits) == 0) {
|
||||||
|
control.aux1 = control.aux1 ^ true;
|
||||||
|
keypress_bits ^= ((u32)(1U << 5));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
client->setPlayerControl(control);
|
||||||
|
LocalPlayer *player = client->getEnv().getLocalPlayer();
|
||||||
|
player->keyPressed = keypress_bits;
|
||||||
|
|
||||||
//tt.stop();
|
//tt.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user