diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2015-07-20 23:30:43 +0200 |
---|---|---|
committer | Loic Blot <loic.blot@unix-experience.fr> | 2015-07-21 08:10:43 +0200 |
commit | fa7fe510d9b77c0a7802604a5697de4e52cddba3 (patch) | |
tree | 6e65917fc32db32940cdcd954c5eb54b0285a1dc /src/camera.cpp | |
parent | 5ebb4237e204bfa760313f6f2a46a09dceb9cce0 (diff) | |
download | minetest-fa7fe510d9b77c0a7802604a5697de4e52cddba3.tar.gz minetest-fa7fe510d9b77c0a7802604a5697de4e52cddba3.tar.bz2 minetest-fa7fe510d9b77c0a7802604a5697de4e52cddba3.zip |
Remove profiler.h include where it's not needed. Remove some unreachable and very old code
Diffstat (limited to 'src/camera.cpp')
-rw-r--r-- | src/camera.cpp | 42 |
1 files changed, 12 insertions, 30 deletions
diff --git a/src/camera.cpp b/src/camera.cpp index ca28555d2..46df0575c 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -162,55 +162,37 @@ void Camera::step(f32 dtime) { //f32 offset = dtime * m_view_bobbing_speed * 0.035; f32 offset = dtime * m_view_bobbing_speed * 0.030; - if (m_view_bobbing_state == 2) - { -#if 0 + if (m_view_bobbing_state == 2) { // Animation is getting turned off - if (m_view_bobbing_anim < 0.5) + if (m_view_bobbing_anim < 0.25) { m_view_bobbing_anim -= offset; - else + } else if (m_view_bobbing_anim > 0.75) { m_view_bobbing_anim += offset; - if (m_view_bobbing_anim <= 0 || m_view_bobbing_anim >= 1) - { - m_view_bobbing_anim = 0; - m_view_bobbing_state = 0; } -#endif -#if 1 - // Animation is getting turned off - if(m_view_bobbing_anim < 0.25) - { - m_view_bobbing_anim -= offset; - } else if(m_view_bobbing_anim > 0.75) { - m_view_bobbing_anim += offset; - } - if(m_view_bobbing_anim < 0.5) - { + + if (m_view_bobbing_anim < 0.5) { m_view_bobbing_anim += offset; - if(m_view_bobbing_anim > 0.5) + if (m_view_bobbing_anim > 0.5) m_view_bobbing_anim = 0.5; } else { m_view_bobbing_anim -= offset; - if(m_view_bobbing_anim < 0.5) + if (m_view_bobbing_anim < 0.5) m_view_bobbing_anim = 0.5; } - if(m_view_bobbing_anim <= 0 || m_view_bobbing_anim >= 1 || - fabs(m_view_bobbing_anim - 0.5) < 0.01) - { + + if (m_view_bobbing_anim <= 0 || m_view_bobbing_anim >= 1 || + fabs(m_view_bobbing_anim - 0.5) < 0.01) { m_view_bobbing_anim = 0; m_view_bobbing_state = 0; } -#endif } - else - { + 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) - { + if(step) { MtEvent *e = new SimpleTriggerEvent("ViewBobbingStep"); m_gamedef->event()->put(e); } |