forked from Mirrorlandia_minetest/minetest
Various uninitialised variable fixes
sky.cpp: m_bgcolor.getAlpha() was being used before initialised mesh related: m_highlight_mesh_color was being used uninitialised
This commit is contained in:
parent
fe8ef1be59
commit
076c5ee223
@ -250,6 +250,7 @@ Client::Client(
|
|||||||
m_inventory_updated(false),
|
m_inventory_updated(false),
|
||||||
m_inventory_from_server(NULL),
|
m_inventory_from_server(NULL),
|
||||||
m_inventory_from_server_age(0.0),
|
m_inventory_from_server_age(0.0),
|
||||||
|
m_show_hud(true),
|
||||||
m_animation_time(0),
|
m_animation_time(0),
|
||||||
m_crack_level(-1),
|
m_crack_level(-1),
|
||||||
m_crack_pos(0,0,0),
|
m_crack_pos(0,0,0),
|
||||||
|
@ -188,10 +188,10 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
|
|||||||
|
|
||||||
// Create selection mesh
|
// Create selection mesh
|
||||||
v3s16 p = data->m_highlighted_pos_relative;
|
v3s16 p = data->m_highlighted_pos_relative;
|
||||||
if (data->m_show_hud &
|
if (data->m_show_hud &&
|
||||||
(p.X >= 0) & (p.X < MAP_BLOCKSIZE) &
|
(p.X >= 0) && (p.X < MAP_BLOCKSIZE) &&
|
||||||
(p.Y >= 0) & (p.Y < MAP_BLOCKSIZE) &
|
(p.Y >= 0) && (p.Y < MAP_BLOCKSIZE) &&
|
||||||
(p.Z >= 0) & (p.Z < MAP_BLOCKSIZE)) {
|
(p.Z >= 0) && (p.Z < MAP_BLOCKSIZE)) {
|
||||||
|
|
||||||
MapNode n = data->m_vmanip.getNodeNoEx(blockpos_nodes + p);
|
MapNode n = data->m_vmanip.getNodeNoEx(blockpos_nodes + p);
|
||||||
if(n.getContent() != CONTENT_AIR) {
|
if(n.getContent() != CONTENT_AIR) {
|
||||||
|
@ -48,6 +48,8 @@ MeshMakeData::MeshMakeData(IGameDef *gamedef):
|
|||||||
m_crack_pos_relative(-1337, -1337, -1337),
|
m_crack_pos_relative(-1337, -1337, -1337),
|
||||||
m_highlighted_pos_relative(-1337, -1337, -1337),
|
m_highlighted_pos_relative(-1337, -1337, -1337),
|
||||||
m_smooth_lighting(false),
|
m_smooth_lighting(false),
|
||||||
|
m_show_hud(false),
|
||||||
|
m_highlight_mesh_color(255, 255, 255, 255),
|
||||||
m_gamedef(gamedef)
|
m_gamedef(gamedef)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -330,7 +332,7 @@ static void finalColorBlend(video::SColor& result,
|
|||||||
|
|
||||||
// Emphase blue a bit in darker places
|
// Emphase blue a bit in darker places
|
||||||
// Each entry of this array represents a range of 8 blue levels
|
// 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,
|
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,
|
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);
|
b = irr::core::clamp (b, 0, 255);
|
||||||
|
|
||||||
// Artificial light is yellow-ish
|
// 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
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 10, 15, 15, 15
|
||||||
};
|
};
|
||||||
rg += emphase_yellow_when_artificial[night/16];
|
rg += emphase_yellow_when_artificial[night/16];
|
||||||
|
32
src/sky.cpp
32
src/sky.cpp
@ -573,6 +573,20 @@ void Sky::update(float time_of_day, float time_brightness,
|
|||||||
m_clouds_visible = false;
|
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
|
// Horizon coloring based on sun and moon direction during sunset and sunrise
|
||||||
video::SColor pointcolor = video::SColor(255, 255, 255, m_bgcolor.getAlpha());
|
video::SColor pointcolor = video::SColor(255, 255, 255, m_bgcolor.getAlpha());
|
||||||
if (m_directional_colored_fog) {
|
if (m_directional_colored_fog) {
|
||||||
@ -606,25 +620,7 @@ void Sky::update(float time_of_day, float time_brightness,
|
|||||||
// calculate the blend color
|
// calculate the blend color
|
||||||
pointcolor = m_mix_scolor(pointcolor_moon, pointcolor_sun, pointcolor_blend);
|
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);
|
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);
|
m_skycolor = m_mix_scolor(m_skycolor, pointcolor, m_horizon_blend() * 0.25);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,8 @@ private:
|
|||||||
{
|
{
|
||||||
if (!m_sunlight_seen)
|
if (!m_sunlight_seen)
|
||||||
return 0;
|
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)
|
if (x <= 0.3)
|
||||||
return 0;
|
return 0;
|
||||||
if (x <= 0.4) // when the sun and moon are aligned
|
if (x <= 0.4) // when the sun and moon are aligned
|
||||||
|
Loading…
Reference in New Issue
Block a user