Allow footstep sounds to play for liquid and ladder nodes, making swimming and climbing sounds possible

This commit is contained in:
MirceaKitsune 2014-12-07 23:47:52 +02:00 committed by PilzAdam
parent 6ba50aa8f9
commit cec141adc1

@ -491,15 +491,19 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime,
// Render distance feedback loop
updateViewingRange(frametime, busytime);
// If the player seems to be walking on solid ground,
// If the player is walking, swimming, or climbing,
// view bobbing is enabled and free_move is off,
// start (or continue) the view bobbing animation.
v3f speed = player->getSpeed();
if ((hypot(speed.X, speed.Z) > BS) &&
(player->touching_ground) &&
(m_cache_view_bobbing == true) &&
(g_settings->getBool("free_move") == false ||
!m_gamedef->checkLocalPrivilege("fly")))
const bool movement_XZ = hypot(speed.X, speed.Z) > BS;
const bool movement_Y = abs(speed.Y) > BS;
const bool walking = movement_XZ && player->touching_ground;
const bool swimming = (movement_XZ || player->swimming_vertical) && player->in_liquid;
const bool climbing = movement_Y && player->is_climbing;
if ((walking || swimming || climbing) &&
m_cache_view_bobbing &&
(!g_settings->getBool("free_move") || !m_gamedef->checkLocalPrivilege("fly")))
{
// Start animation
m_view_bobbing_state = 1;