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

experimental
MirceaKitsune 2014-12-07 23:47:52 +02:00 committed by PilzAdam
parent 6ba50aa8f9
commit cec141adc1
1 changed files with 16 additions and 12 deletions

View File

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