aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--minetest.conf.example8
-rw-r--r--src/defaultsettings.cpp1
-rw-r--r--src/minimap.cpp28
-rw-r--r--src/minimap.h2
-rw-r--r--src/nodedef.cpp3
5 files changed, 31 insertions, 11 deletions
diff --git a/minetest.conf.example b/minetest.conf.example
index d1f1de6fb..6aaae2b14 100644
--- a/minetest.conf.example
+++ b/minetest.conf.example
@@ -266,6 +266,14 @@
#enable_mesh_cache = true
# Enables caching of facedir rotated meshes
+#enable_minimap = true
+# Enables minimap
+#minimap_shape_round = true
+# true - round shape, false - square
+#minimap_double_scan_height = true
+# true = 256, false = 128
+# useable to make minimap smoother on slower machines
+
# The time in seconds it takes between repeated
# right clicks when holding the right mouse button.
#repeat_rightclick_time = 0.25
diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp
index 73e36da98..ecd89242b 100644
--- a/src/defaultsettings.cpp
+++ b/src/defaultsettings.cpp
@@ -179,6 +179,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("enable_minimap", "true");
settings->setDefault("minimap_shape_round", "true");
+ settings->setDefault("minimap_double_scan_height", "true");
settings->setDefault("curl_timeout", "5000");
settings->setDefault("curl_parallel_limit", "8");
diff --git a/src/minimap.cpp b/src/minimap.cpp
index 753468c32..9adeb84bc 100644
--- a/src/minimap.cpp
+++ b/src/minimap.cpp
@@ -164,6 +164,15 @@ void *MinimapUpdateThread::Thread()
return NULL;
}
+MinimapUpdateThread::~MinimapUpdateThread()
+{
+ for (std::map<v3s16, MinimapMapblock *>::iterator
+ it = m_blocks_cache.begin();
+ it != m_blocks_cache.end(); it++) {
+ delete it->second;
+ }
+}
+
MinimapPixel *MinimapUpdateThread::getMinimapPixel (v3s16 pos, s16 height, s16 &pixel_height)
{
pixel_height = height - MAP_BLOCKSIZE;
@@ -236,6 +245,12 @@ Mapper::Mapper(IrrlichtDevice *device, Client *client)
this->shdrsrc = client->getShaderSource();
m_enable_shaders = g_settings->getBool("enable_shaders");
+ m_enable_shaders = g_settings->getBool("enable_shaders");
+ if (g_settings->getBool("minimap_double_scan_height")) {
+ m_surface_mode_scan_height = 256;
+ } else {
+ m_surface_mode_scan_height = 128;
+ }
data = new MinimapData;
data->mode = MINIMAP_MODE_OFF;
data->radar = false;
@@ -265,13 +280,6 @@ Mapper::~Mapper()
{
m_minimap_update_thread->Stop();
m_minimap_update_thread->Wait();
-
- for (std::map<v3s16, MinimapMapblock *>::iterator
- it = m_minimap_update_thread->m_blocks_cache.begin();
- it != m_minimap_update_thread->m_blocks_cache.end(); it++){
- delete it->second;
- }
-
m_meshbuffer->drop();
data->minimap_mask_round->drop();
data->minimap_mask_square->drop();
@@ -303,9 +311,9 @@ void Mapper::setMinimapMode(MinimapMode mode)
{
static const u16 modeDefs[7 * 3] = {
0, 0, 0,
- 0, 256, 256,
- 0, 256, 128,
- 0, 256, 64,
+ 0, m_surface_mode_scan_height, 256,
+ 0, m_surface_mode_scan_height, 128,
+ 0, m_surface_mode_scan_height, 64,
1, 32, 128,
1, 32, 64,
1, 32, 32};
diff --git a/src/minimap.h b/src/minimap.h
index 1794da190..220c3add0 100644
--- a/src/minimap.h
+++ b/src/minimap.h
@@ -124,6 +124,7 @@ public:
this->driver = device->getVideoDriver();
this->tsrc = client->getTextureSource();
}
+ ~MinimapUpdateThread();
void getMap (v3s16 pos, s16 size, s16 height, bool radar);
MinimapPixel *getMinimapPixel (v3s16 pos, s16 height, s16 &pixel_height);
s16 getAirCount (v3s16 pos, s16 height);
@@ -148,6 +149,7 @@ private:
video::ITexture *minimap_texture;
scene::SMeshBuffer *m_meshbuffer;
bool m_enable_shaders;
+ u16 m_surface_mode_scan_height;
JMutex m_mutex;
public:
diff --git a/src/nodedef.cpp b/src/nodedef.cpp
index ba1ca2c65..e392f477a 100644
--- a/src/nodedef.cpp
+++ b/src/nodedef.cpp
@@ -787,6 +787,7 @@ void CNodeDefManager::updateTextures(IGameDef *gamedef,
bool enable_bumpmapping = g_settings->getBool("enable_bumpmapping");
bool enable_parallax_occlusion = g_settings->getBool("enable_parallax_occlusion");
bool enable_mesh_cache = g_settings->getBool("enable_mesh_cache");
+ bool enable_minimap = g_settings->getBool("enable_minimap");
bool use_normal_texture = enable_shaders &&
(enable_bumpmapping || enable_parallax_occlusion);
@@ -797,7 +798,7 @@ void CNodeDefManager::updateTextures(IGameDef *gamedef,
ContentFeatures *f = &m_content_features[i];
// minimap pixel color - the average color of a texture
- if (f->tiledef[0].name != "")
+ if (enable_minimap && f->tiledef[0].name != "")
f->minimap_color = tsrc->getTextureAverageColor(f->tiledef[0].name);
// Figure out the actual tiles to use