diff options
-rw-r--r-- | src/client.cpp | 1 | ||||
-rw-r--r-- | src/content_mapblock.cpp | 10 | ||||
-rw-r--r-- | src/mapblock_mesh.cpp | 8 | ||||
-rw-r--r-- | src/sky.cpp | 32 | ||||
-rw-r--r-- | src/sky.h | 3 |
5 files changed, 27 insertions, 27 deletions
diff --git a/src/client.cpp b/src/client.cpp index 0bc2e66a5..7e74cf36b 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -250,6 +250,7 @@ Client::Client( m_inventory_updated(false), m_inventory_from_server(NULL), m_inventory_from_server_age(0.0), + m_show_hud(true), m_animation_time(0), m_crack_level(-1), m_crack_pos(0,0,0), diff --git a/src/content_mapblock.cpp b/src/content_mapblock.cpp index 53b9874d4..996db421b 100644 --- a/src/content_mapblock.cpp +++ b/src/content_mapblock.cpp @@ -188,10 +188,10 @@ void mapblock_mesh_generate_special(MeshMakeData *data, // Create selection mesh v3s16 p = data->m_highlighted_pos_relative; - if (data->m_show_hud & - (p.X >= 0) & (p.X < MAP_BLOCKSIZE) & - (p.Y >= 0) & (p.Y < MAP_BLOCKSIZE) & - (p.Z >= 0) & (p.Z < MAP_BLOCKSIZE)) { + if (data->m_show_hud && + (p.X >= 0) && (p.X < MAP_BLOCKSIZE) && + (p.Y >= 0) && (p.Y < MAP_BLOCKSIZE) && + (p.Z >= 0) && (p.Z < MAP_BLOCKSIZE)) { MapNode n = data->m_vmanip.getNodeNoEx(blockpos_nodes + p); if(n.getContent() != CONTENT_AIR) { @@ -215,7 +215,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data, l = l1; } video::SColor c = MapBlock_LightColor(255, l, 0); - data->m_highlight_mesh_color = c; + data->m_highlight_mesh_color = c; std::vector<aabb3f> boxes = n.getSelectionBoxes(nodedef); TileSpec h_tile; h_tile.material_flags |= MATERIAL_FLAG_HIGHLIGHTED; diff --git a/src/mapblock_mesh.cpp b/src/mapblock_mesh.cpp index a7fafa683..2459cf0d7 100644 --- a/src/mapblock_mesh.cpp +++ b/src/mapblock_mesh.cpp @@ -48,6 +48,8 @@ MeshMakeData::MeshMakeData(IGameDef *gamedef): m_crack_pos_relative(-1337, -1337, -1337), m_highlighted_pos_relative(-1337, -1337, -1337), m_smooth_lighting(false), + m_show_hud(false), + m_highlight_mesh_color(255, 255, 255, 255), m_gamedef(gamedef) {} @@ -330,7 +332,7 @@ static void finalColorBlend(video::SColor& result, // Emphase blue a bit in darker places // Each entry of this array represents a range of 8 blue levels - static u8 emphase_blue_when_dark[32] = { + static const u8 emphase_blue_when_dark[32] = { 1, 4, 6, 6, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; @@ -338,7 +340,7 @@ static void finalColorBlend(video::SColor& result, b = irr::core::clamp (b, 0, 255); // Artificial light is yellow-ish - static u8 emphase_yellow_when_artificial[16] = { + static const u8 emphase_yellow_when_artificial[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 10, 15, 15, 15 }; rg += emphase_yellow_when_artificial[night/16]; @@ -1086,7 +1088,7 @@ MapBlockMesh::MapBlockMesh(MeshMakeData *data, v3s16 camera_offset): mapblock_mesh_generate_special(data, collector); - m_highlight_mesh_color = data->m_highlight_mesh_color; + m_highlight_mesh_color = data->m_highlight_mesh_color; /* Convert MeshCollector to SMesh diff --git a/src/sky.cpp b/src/sky.cpp index 17d8d46ce..b5706f4e3 100644 --- a/src/sky.cpp +++ b/src/sky.cpp @@ -573,6 +573,20 @@ void Sky::update(float time_of_day, float time_brightness, m_clouds_visible = false; } + video::SColor bgcolor_bright = m_bgcolor_bright_f.toSColor(); + m_bgcolor = video::SColor( + 255, + bgcolor_bright.getRed() * m_brightness, + bgcolor_bright.getGreen() * m_brightness, + bgcolor_bright.getBlue() * m_brightness); + + video::SColor skycolor_bright = m_skycolor_bright_f.toSColor(); + m_skycolor = video::SColor( + 255, + skycolor_bright.getRed() * m_brightness, + skycolor_bright.getGreen() * m_brightness, + skycolor_bright.getBlue() * m_brightness); + // Horizon coloring based on sun and moon direction during sunset and sunrise video::SColor pointcolor = video::SColor(255, 255, 255, m_bgcolor.getAlpha()); if (m_directional_colored_fog) { @@ -606,25 +620,7 @@ void Sky::update(float time_of_day, float time_brightness, // calculate the blend color pointcolor = m_mix_scolor(pointcolor_moon, pointcolor_sun, pointcolor_blend); } - } - - video::SColor bgcolor_bright = m_bgcolor_bright_f.toSColor(); - m_bgcolor = video::SColor( - 255, - bgcolor_bright.getRed() * m_brightness, - bgcolor_bright.getGreen() * m_brightness, - bgcolor_bright.getBlue() * m_brightness); - if (m_directional_colored_fog) { m_bgcolor = m_mix_scolor(m_bgcolor, pointcolor, m_horizon_blend() * 0.5); - } - - video::SColor skycolor_bright = m_skycolor_bright_f.toSColor(); - m_skycolor = video::SColor( - 255, - skycolor_bright.getRed() * m_brightness, - skycolor_bright.getGreen() * m_brightness, - skycolor_bright.getBlue() * m_brightness); - if (m_directional_colored_fog) { m_skycolor = m_mix_scolor(m_skycolor, pointcolor, m_horizon_blend() * 0.25); } @@ -79,7 +79,8 @@ private: { if (!m_sunlight_seen) return 0; - float x; m_time_of_day >= 0.5 ? x = (1 - m_time_of_day) * 2 : x = m_time_of_day * 2; + float x = m_time_of_day >= 0.5 ? (1 - m_time_of_day) * 2 : m_time_of_day * 2; + if (x <= 0.3) return 0; if (x <= 0.4) // when the sun and moon are aligned |