diff options
author | Perttu Ahola <celeron55@gmail.com> | 2012-03-23 15:29:30 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-03-24 04:24:25 +0200 |
commit | 8c2f3bb378640c921a0ad40c4577687b0c7c37f3 (patch) | |
tree | 35d97d6c21b4b2207ec9fc8f21dc38b2435c9542 /src/camera.cpp | |
parent | 0ac2ce7dea133fd0b71a12ca3c2f3ce463d48440 (diff) | |
download | minetest-8c2f3bb378640c921a0ad40c4577687b0c7c37f3.tar.gz minetest-8c2f3bb378640c921a0ad40c4577687b0c7c37f3.tar.bz2 minetest-8c2f3bb378640c921a0ad40c4577687b0c7c37f3.zip |
c55sound continued
Diffstat (limited to 'src/camera.cpp')
-rw-r--r-- | src/camera.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/camera.cpp b/src/camera.cpp index 2a15386d9..8dad8dc63 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -30,8 +30,11 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "settings.h" #include "itemdef.h" // For wield visualization #include "noise.h" // easeCurve +#include "gamedef.h" +#include "sound.h" -Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control): +Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control, + IGameDef *gamedef): m_smgr(smgr), m_playernode(NULL), m_headnode(NULL), @@ -42,6 +45,7 @@ Camera::Camera(scene::ISceneManager* smgr, MapDrawControl& draw_control): m_wieldlight(0), m_draw_control(draw_control), + m_gamedef(gamedef), m_camera_position(0,0,0), m_camera_direction(0,0,0), @@ -168,7 +172,13 @@ void Camera::step(f32 dtime) } else { + float was = m_view_bobbing_anim; m_view_bobbing_anim = my_modf(m_view_bobbing_anim + offset); + bool step = (was == 0 || + (was < 0.5f && m_view_bobbing_anim >= 0.5f) || + (was > 0.5f && m_view_bobbing_anim <= 0.5f)); + if(step) + m_gamedef->sound()->playSound("default_grass_walk", false, 1.0); } } @@ -180,6 +190,7 @@ void Camera::step(f32 dtime) { m_digging_anim = 0; m_digging_button = -1; + m_gamedef->sound()->playSound("dig", false, 1.0); } } } @@ -481,9 +492,9 @@ void Camera::setDigging(s32 button) m_digging_button = button; } -void Camera::wield(const ItemStack &item, IGameDef *gamedef) +void Camera::wield(const ItemStack &item) { - IItemDefManager *idef = gamedef->idef(); + IItemDefManager *idef = m_gamedef->idef(); scene::IMesh *wield_mesh = item.getDefinition(idef).wield_mesh; if(wield_mesh) { |