#include "porting.h"
#include "mapgen.h"
#include "nodemetadata.h"
+#include "content_mapnode.h"
+#ifndef SERVER
+#include <IMaterialRenderer.h>
+#endif
+#include "settings.h"
/*
SQLite format specification:
generation for testing or whatever
*/
#if 0
- //if(g_settings.get(""))
+ //if(g_settings->get(""))
{
core::map<v3s16, MapBlock*>::Iterator i;
i = blocks_to_update.getIterator();
/*
*/
void Map::addNodeAndUpdate(v3s16 p, MapNode n,
- core::map<v3s16, MapBlock*> &modified_blocks)
+ core::map<v3s16, MapBlock*> &modified_blocks, std::string &player_name)
{
/*PrintInfo(m_dout);
m_dout<<DTIME<<"Map::addNodeAndUpdate(): p=("
if(meta_proto)
{
NodeMetadata *meta = meta_proto->clone();
+ meta->setOwner(player_name);
setNodeMetadata(p, meta);
}
bool succeeded = true;
try{
core::map<v3s16, MapBlock*> modified_blocks;
- addNodeAndUpdate(p, n, modified_blocks);
+ std::string st = std::string("");
+ addNodeAndUpdate(p, n, modified_blocks, st);
// Copy modified_blocks to event
for(core::map<v3s16, MapBlock*>::Iterator
//m_chunksize = 8; // Takes a few seconds
- if (g_settings.get("fixed_map_seed").empty())
+ if (g_settings->get("fixed_map_seed").empty())
{
m_seed = (((u64)(myrand()%0xffff)<<0)
+ ((u64)(myrand()%0xffff)<<16)
}
else
{
- m_seed = g_settings.getU64("fixed_map_seed");
+ m_seed = g_settings->getU64("fixed_map_seed");
}
/*
void ServerMap::initBlockMake(mapgen::BlockMakeData *data, v3s16 blockpos)
{
- bool enable_mapgen_debug_info = g_settings.getBool("enable_mapgen_debug_info");
+ bool enable_mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info");
if(enable_mapgen_debug_info)
dstream<<"initBlockMake(): ("<<blockpos.X<<","<<blockpos.Y<<","
<<blockpos.Z<<")"<<std::endl;
return NULL;
}
- bool enable_mapgen_debug_info = g_settings.getBool("enable_mapgen_debug_info");
+ bool enable_mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info");
/*dstream<<"Resulting vmanip:"<<std::endl;
data->vmanip.print(dstream);*/
<<"("<<p.X<<","<<p.Y<<","<<p.Z<<")"
<<std::endl;*/
- bool enable_mapgen_debug_info = g_settings.getBool("enable_mapgen_debug_info");
+ bool enable_mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info");
TimeTaker timer("generateBlock");
if(version < SER_FMT_VER_HIGHEST || save_after_load)
{
saveBlock(block);
+
+ // Should be in database now, so delete the old file
+ fs::RecursiveDelete(fullpath);
}
// We just loaded it from the disk, so it's up-to-date.
m_client(client),
m_control(control),
m_camera_position(0,0,0),
- m_camera_direction(0,0,1)
+ m_camera_direction(0,0,1),
+ m_camera_fov(PI)
{
m_camera_mutex.Init();
assert(m_camera_mutex.IsInitialized());
m_camera_mutex.Lock();
v3f camera_position = m_camera_position;
v3f camera_direction = m_camera_direction;
+ f32 camera_fov = m_camera_fov;
m_camera_mutex.Unlock();
/*
float d = 0.0;
if(isBlockInSight(block->getPos(), camera_position,
- camera_direction, range, &d) == false)
+ camera_direction, camera_fov,
+ range, &d) == false)
{
continue;
}
<<", rendered "<<vertex_count<<" vertices."<<std::endl;*/
}
+void ClientMap::renderPostFx()
+{
+ // Sadly ISceneManager has no "post effects" render pass, in that case we
+ // could just register for that and handle it in renderMap().
+
+ m_camera_mutex.Lock();
+ v3f camera_position = m_camera_position;
+ m_camera_mutex.Unlock();
+
+ MapNode n = getNodeNoEx(floatToInt(camera_position, BS));
+
+ // - If the player is in a solid node, make everything black.
+ // - If the player is in liquid, draw a semi-transparent overlay.
+ ContentFeatures& features = content_features(n);
+ video::SColor post_effect_color = features.post_effect_color;
+ if(features.solidness == 2 && g_settings->getBool("free_move") == false)
+ {
+ post_effect_color = video::SColor(255, 0, 0, 0);
+ }
+ if (post_effect_color.getAlpha() != 0)
+ {
+ // Draw a full-screen rectangle
+ video::IVideoDriver* driver = SceneManager->getVideoDriver();
+ v2u32 ss = driver->getScreenSize();
+ core::rect<s32> rect(0,0, ss.X, ss.Y);
+ driver->draw2DRectangle(post_effect_color, rect);
+ }
+}
+
bool ClientMap::setTempMod(v3s16 p, NodeMod mod,
core::map<v3s16, MapBlock*> *affected_blocks)
{