+ farmesh config options
authorJiří Procházka <ojirio@gmail.com>
Mon, 11 Jul 2011 12:29:59 +0000 (14:29 +0200)
committerNils Dagsson Moskopp <nils@dieweltistgarnichtso.net>
Mon, 11 Jul 2011 13:01:43 +0000 (15:01 +0200)
src/defaultsettings.cpp
src/farmesh.cpp
src/farmesh.h
src/game.cpp

index 74d323237e535e3867d667c762c17486f5e0b047..ac1983ed1fc482aa0a73633add84b41974cbb011 100644 (file)
@@ -68,6 +68,8 @@ void set_default_settings()
        g_settings.setDefault("fast_move", "false");
        g_settings.setDefault("invert_mouse", "false");
        g_settings.setDefault("enable_farmesh", "false");
+       g_settings.setDefault("farmesh_trees", "true");
+       g_settings.setDefault("farmesh_distance", "40");
        g_settings.setDefault("enable_clouds", "true");
        g_settings.setDefault("invisible_stone", "false");
 
index 72dbe11c21e60305c05fcd4dccf99591f4c8df9a..a35983729bc03bbaf69c994521cc2686c8e4894b 100644 (file)
@@ -70,6 +70,7 @@ FarMesh::FarMesh(
        m_box = core::aabbox3d<f32>(-BS*1000000,-BS*31000,-BS*1000000,
                        BS*1000000,BS*31000,BS*1000000);
 
+    trees = g_settings.getBool("farmesh_trees");
 }
 
 FarMesh::~FarMesh()
@@ -312,12 +313,11 @@ void FarMesh::render()
                                }
                                else
                                {
-                                       /*// Trees if there are over 0.01 trees per MapNode
-                                       if(tree_amount_avg > 0.01)
+                                       // Trees if there are over 0.01 trees per MapNode
+                                       if(trees && tree_amount_avg > 0.01)
                                                c = video::SColor(255,50,128,50);
                                        else
-                                               c = video::SColor(255,107,134,51);*/
-                                       c = video::SColor(255,107,134,51);
+                                               c = video::SColor(255,107,134,51);
                                        ground_is_mud = true;
                                }
                        }
@@ -350,7 +350,7 @@ void FarMesh::render()
                                video::EVT_STANDARD, scene::EPT_TRIANGLES, video::EIT_16BIT);
 
                // Add some trees if appropriate
-               if(tree_amount_avg >= 0.0065 && steepness < 1.4
+               if(trees && tree_amount_avg >= 0.0065 && steepness < 1.4
                                && ground_is_mud == true)
                {
                        driver->setMaterial(m_materials[1]);
@@ -403,11 +403,11 @@ void FarMesh::step(float dtime)
        m_time += dtime;
 }
 
-void FarMesh::update(v2f camera_p, float brightness, s16 render_range)
+void FarMesh::update(v2f camera_p, float brightness)
 {
        m_camera_pos = camera_p;
        m_brightness = brightness;
-       m_render_range = render_range;
+       m_render_range = g_settings.getS16("farmesh_distance")*10;
 }
 
 
index 0a30a8aefe348a000186f6f2213333c65ab13eb3..577224e152bad3ba24a5b7043cca9d4d1e38e96a 100644 (file)
@@ -67,7 +67,7 @@ public:
 
        void step(float dtime);
 
-       void update(v2f camera_p, float brightness, s16 render_range);
+       void update(v2f camera_p, float brightness);
 
 private:
        video::SMaterial m_materials[FARMESH_MATERIAL_COUNT];
@@ -79,6 +79,7 @@ private:
        float m_time;
        Client *m_client;
        s16 m_render_range;
+    bool trees;
 };
 
 #endif
index 5632c1805ae39c8a47c23b77cec50e876c720a42..367abebe1e42382b2c48cad216139f7437174528 100644 (file)
@@ -1874,15 +1874,9 @@ void the_game(
                */
                if(farmesh)
                {
-                       farmesh_range = draw_control.wanted_range * 10;
-                       if(draw_control.range_all && farmesh_range < 500)
-                               farmesh_range = 500;
-                       if(farmesh_range > 1000)
-                               farmesh_range = 1000;
-
                        farmesh->step(dtime);
                        farmesh->update(v2f(player_position.X, player_position.Z),
-                                       0.05+brightness*0.95, farmesh_range);
+                                       0.05+brightness*0.95);
                }
                
                // Store brightness value