trying something else... also replaced M_PI by PI everywhere
authorKahrl <kahrl@gmx.net>
Thu, 8 Sep 2011 14:10:44 +0000 (16:10 +0200)
committerKahrl <kahrl@gmx.net>
Thu, 8 Sep 2011 14:10:44 +0000 (16:10 +0200)
src/camera.cpp
src/game.cpp
src/map.cpp
src/server.cpp

index 7c3dfda3cfec5e0d17a60f08c583f1393d8d5108..8dc1af02b1863cc100544bb566a70adcee768be0 100644 (file)
@@ -105,10 +105,10 @@ void Camera::update(LocalPlayer* player, f32 frametime, v2u32 screensize)
 
        if ((m_view_bobbing_anim & (BOBFRAMES/2-1)) != 0)
        {
-               f32 bobamount = cos(player->getPitch() * M_PI / 180);
+               f32 bobamount = cos(player->getPitch() * PI / 180);
                bobamount = 2 * MYMIN(bobamount, 0.5);
 
-               f32 bobangle = m_view_bobbing_anim * 2 * M_PI / BOBFRAMES;
+               f32 bobangle = m_view_bobbing_anim * 2 * PI / BOBFRAMES;
                f32 bobangle_s = sin(bobangle);
                f32 bobangle_c = cos(bobangle);
                f32 bobwidth = 0.02 * bobamount / (bobangle_c * bobangle_c + 1);
@@ -282,7 +282,7 @@ void Camera::updateSettings()
        f32 fov_degrees = g_settings.getFloat("fov");
        fov_degrees = MYMAX(fov_degrees, 10.0);
        fov_degrees = MYMIN(fov_degrees, 170.0);
-       m_fov_y = fov_degrees * M_PI / 180.0;
+       m_fov_y = fov_degrees * PI / 180.0;
 
        f32 wanted_fps = g_settings.getFloat("wanted_fps");
        wanted_fps = MYMAX(wanted_fps, 1.0);
index af4886137ccf40d37ff36a5a83c67fe0d7ef1135..cb7594c3008011008b6163a1b67e55a64f2f35ea 100644 (file)
@@ -831,7 +831,7 @@ void the_game(
                Tool
        */
        
-       v3f tool_wield_position(0.06*BS, 1.619*BS, 0.1*BS);
+       v3f tool_wield_position(0.06*BS, -0.06*BS, 0.1*BS);
        v3f tool_wield_rotation(-25, 180, -25);
        float tool_wield_animation = 0.0;
        scene::IMeshSceneNode *tool_wield;
@@ -856,7 +856,7 @@ void the_game(
                mesh->addMeshBuffer(buf);
                buf->drop();
        
-               tool_wield = smgr->addMeshSceneNode(mesh, camera.getPlayerNode());
+               tool_wield = smgr->addMeshSceneNode(mesh, camera.getCameraNode());
                mesh->drop();
        }
        tool_wield->setVisible(false);
@@ -1997,8 +1997,9 @@ void the_game(
                        Animate tool
                */
                {
-                       tool_wield->setRotation(tool_wield_rotation - sin(tool_wield_animation * PI) * 40.0);
-                       tool_wield->setPosition(tool_wield_position - sin(tool_wield_animation * PI) / 3.0);
+                       f32 tool_wield_sin = sin(tool_wield_animation * PI);
+                       tool_wield->setRotation(tool_wield_rotation - tool_wield_sin * 40.0);
+                       tool_wield->setPosition(tool_wield_position - tool_wield_sin * BS / 30.0);
                }
 
 
index b1908fe2ea4091b526e4dc98277413c8f1bce09d..ecd12bddb5831d85482ce6f6062454c9afe555c6 100644 (file)
@@ -3605,7 +3605,7 @@ ClientMap::ClientMap(
        m_control(control),
        m_camera_position(0,0,0),
        m_camera_direction(0,0,1),
-       m_camera_fov(M_PI)
+       m_camera_fov(PI)
 {
        m_camera_mutex.Init();
        assert(m_camera_mutex.IsInitialized());
index fd93d7523b22f872fdbf8f2b9106c403a6382b21..c89e4113be6581f15fd462b92e724327e9613ed3 100644 (file)
@@ -584,7 +584,7 @@ void RemoteClient::GetNextBlocks(Server *server, float dtime,
                                Don't generate or send if not in sight
                        */
 
-                       if(isBlockInSight(p, camera_pos, camera_dir, M_PI, 10000*BS) == false)
+                       if(isBlockInSight(p, camera_pos, camera_dir, PI, 10000*BS) == false)
                        {
                                continue;
                        }