Tune caves
[oweals/minetest.git] / src / camera.cpp
index fada476085dabe4368f8d4f9bdd2bf5c3798428d..ba05329e58c651be2b88196abf766c067761d15a 100644 (file)
@@ -188,13 +188,23 @@ void Camera::step(f32 dtime)
        if (m_digging_button != -1)
        {
                f32 offset = dtime * 3.5;
+               float m_digging_anim_was = m_digging_anim;
                m_digging_anim += offset;
                if (m_digging_anim >= 1)
                {
                        m_digging_anim = 0;
                        m_digging_button = -1;
-                       MtEvent *e = new SimpleTriggerEvent("CameraDig");
-                       m_gamedef->event()->put(e);
+               }
+               float lim = 0.15;
+               if(m_digging_anim_was < lim && m_digging_anim >= lim)
+               {
+                       if(m_digging_button == 0){
+                               MtEvent *e = new SimpleTriggerEvent("CameraPunchLeft");
+                               m_gamedef->event()->put(e);
+                       } else if(m_digging_button == 1){
+                               MtEvent *e = new SimpleTriggerEvent("CameraPunchRight");
+                               m_gamedef->event()->put(e);
+                       }
                }
        }
 }
@@ -280,6 +290,9 @@ void Camera::update(LocalPlayer* player, f32 frametime, v2u32 screensize,
        // FOV and aspect ratio
        m_aspect = (f32)screensize.X / (f32) screensize.Y;
        m_fov_y = fov_degrees * PI / 180.0;
+       // Increase vertical FOV on lower aspect ratios (<16:10)
+       m_fov_y *= MYMAX(1.0, MYMIN(1.4, sqrt(16./10. / m_aspect)));
+       // WTF is this? It can't be right
        m_fov_x = 2 * atan(0.5 * m_aspect * tan(m_fov_y));
        m_cameranode->setAspectRatio(m_aspect);
        m_cameranode->setFOV(m_fov_y);