summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/defaultsettings.cpp2
-rw-r--r--src/farmesh.cpp22
-rw-r--r--src/farmesh.h3
-rw-r--r--src/game.cpp20
4 files changed, 25 insertions, 22 deletions
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index 209d20b63..6eff4ef70 100644
--- a/src/defaultsettings.cpp
+++ b/src/defaultsettings.cpp
@@ -49,7 +49,7 @@ void set_default_settings()
g_settings.setDefault("wanted_fps", "30");
g_settings.setDefault("fps_max", "60");
g_settings.setDefault("viewing_range_nodes_max", "300");
- g_settings.setDefault("viewing_range_nodes_min", "28");
+ g_settings.setDefault("viewing_range_nodes_min", "25");
g_settings.setDefault("screenW", "800");
g_settings.setDefault("screenH", "600");
g_settings.setDefault("address", "");
diff --git a/src/farmesh.cpp b/src/farmesh.cpp
index efbbeb665..b46d84151 100644
--- a/src/farmesh.cpp
+++ b/src/farmesh.cpp
@@ -50,7 +50,8 @@ FarMesh::FarMesh(
m_seed(seed),
m_camera_pos(0,0),
m_time(0),
- m_client(client)
+ m_client(client),
+ m_render_range(20*MAP_BLOCKSIZE)
{
dstream<<__FUNCTION_NAME<<std::endl;
@@ -155,7 +156,7 @@ void FarMesh::render()
//const s16 grid_radius_i = 12;
//const float grid_size = BS*50;
- const s16 grid_radius_i = 20;
+ const s16 grid_radius_i = m_render_range/MAP_BLOCKSIZE;
const float grid_size = BS*MAP_BLOCKSIZE;
const v2f grid_speed(-BS*0, 0);
@@ -354,7 +355,7 @@ void FarMesh::render()
video::EVT_STANDARD, scene::EPT_TRIANGLES, video::EIT_16BIT);
// Add some trees if appropriate
- if(tree_amount_avg >= 0.005 && steepness < 1.0
+ if(tree_amount_avg >= 0.0065 && steepness < 1.4
&& ground_is_mud == true)
{
driver->setMaterial(m_materials[1]);
@@ -367,11 +368,11 @@ void FarMesh::render()
{
video::S3DVertex(p0.X,noise[0],p0.Y,
0,0,0, c, 0,1),
- video::S3DVertex(p0.X,noise[1]+BS*MAP_BLOCKSIZE,p0.Y,
+ video::S3DVertex(p0.X,noise[0]+BS*MAP_BLOCKSIZE,p0.Y,
0,0,0, c, 0,0),
video::S3DVertex(p1.X,noise[2]+BS*MAP_BLOCKSIZE,p1.Y,
0,0,0, c, 1,0),
- video::S3DVertex(p1.X,noise[3],p1.Y,
+ video::S3DVertex(p1.X,noise[2],p1.Y,
0,0,0, c, 1,1),
};
u16 indices[] = {0,1,2,2,3,0};
@@ -382,13 +383,13 @@ void FarMesh::render()
{
video::S3DVertex vertices[4] =
{
- video::S3DVertex(p1.X,noise[0],p0.Y,
+ video::S3DVertex(p1.X,noise[3],p0.Y,
0,0,0, c, 0,1),
- video::S3DVertex(p1.X,noise[1]+BS*MAP_BLOCKSIZE,p0.Y,
+ video::S3DVertex(p1.X,noise[3]+BS*MAP_BLOCKSIZE,p0.Y,
0,0,0, c, 0,0),
- video::S3DVertex(p0.X,noise[2]+BS*MAP_BLOCKSIZE,p1.Y,
+ video::S3DVertex(p0.X,noise[1]+BS*MAP_BLOCKSIZE,p1.Y,
0,0,0, c, 1,0),
- video::S3DVertex(p0.X,noise[3],p1.Y,
+ video::S3DVertex(p0.X,noise[1],p1.Y,
0,0,0, c, 1,1),
};
u16 indices[] = {0,1,2,2,3,0};
@@ -407,10 +408,11 @@ void FarMesh::step(float dtime)
m_time += dtime;
}
-void FarMesh::update(v2f camera_p, float brightness)
+void FarMesh::update(v2f camera_p, float brightness, s16 render_range)
{
m_camera_pos = camera_p;
m_brightness = brightness;
+ m_render_range = render_range;
}
diff --git a/src/farmesh.h b/src/farmesh.h
index aea806542..0a30a8aef 100644
--- a/src/farmesh.h
+++ b/src/farmesh.h
@@ -67,7 +67,7 @@ public:
void step(float dtime);
- void update(v2f camera_p, float brightness);
+ void update(v2f camera_p, float brightness, s16 render_range);
private:
video::SMaterial m_materials[FARMESH_MATERIAL_COUNT];
@@ -78,6 +78,7 @@ private:
v2f m_camera_pos;
float m_time;
Client *m_client;
+ s16 m_render_range;
};
#endif
diff --git a/src/game.cpp b/src/game.cpp
index 237867be1..1ab3d7962 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -915,6 +915,7 @@ void the_game(
core::list<float> frametime_log;
float damage_flash_timer = 0;
+ s16 farmesh_range = 20*MAP_BLOCKSIZE;
bool invert_mouse = g_settings.getBool("invert_mouse");
@@ -1826,13 +1827,19 @@ void the_game(
}
/*
- Update farmesh (TODO: Remove from here)
+ Update farmesh
*/
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);
+ 0.05+brightness*0.95, farmesh_range);
}
// Store brightness value
@@ -1847,7 +1854,7 @@ void the_game(
f32 range;
if(farmesh)
{
- range = BS*MAP_BLOCKSIZE*20;
+ range = BS*farmesh_range;
}
else
{
@@ -2054,13 +2061,6 @@ void the_game(
beginscenetime = timer.stop(true);
}
- /*
- Draw farmesh before everything else
- */
- {
- //farmesh->render();
- }
-
//timer3.stop();
//std::cout<<DTIME<<"smgr->drawAll()"<<std::endl;