forked from Mirrorlandia_minetest/minetest
Add option to set water opaque (mainly for stylistic choice)
This commit is contained in:
parent
f5995337e8
commit
d0fdfd44c5
@ -107,6 +107,7 @@ void content_mapnode_init()
|
|||||||
bool new_style_water = g_settings->getBool("new_style_water");
|
bool new_style_water = g_settings->getBool("new_style_water");
|
||||||
bool new_style_leaves = g_settings->getBool("new_style_leaves");
|
bool new_style_leaves = g_settings->getBool("new_style_leaves");
|
||||||
bool invisible_stone = g_settings->getBool("invisible_stone");
|
bool invisible_stone = g_settings->getBool("invisible_stone");
|
||||||
|
bool opaque_water = g_settings->getBool("opaque_water");
|
||||||
|
|
||||||
content_t i;
|
content_t i;
|
||||||
ContentFeatures *f = NULL;
|
ContentFeatures *f = NULL;
|
||||||
@ -398,6 +399,7 @@ void content_mapnode_init()
|
|||||||
f->liquid_alternative_source = CONTENT_WATERSOURCE;
|
f->liquid_alternative_source = CONTENT_WATERSOURCE;
|
||||||
f->liquid_viscosity = WATER_VISC;
|
f->liquid_viscosity = WATER_VISC;
|
||||||
#ifndef SERVER
|
#ifndef SERVER
|
||||||
|
if(!opaque_water)
|
||||||
f->vertex_alpha = WATER_ALPHA;
|
f->vertex_alpha = WATER_ALPHA;
|
||||||
f->post_effect_color = video::SColor(64, 100, 100, 200);
|
f->post_effect_color = video::SColor(64, 100, 100, 200);
|
||||||
if(f->special_material == NULL && g_texturesource)
|
if(f->special_material == NULL && g_texturesource)
|
||||||
@ -408,6 +410,7 @@ void content_mapnode_init()
|
|||||||
f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
|
f->special_material->setFlag(video::EMF_BACK_FACE_CULLING, false);
|
||||||
f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
|
f->special_material->setFlag(video::EMF_BILINEAR_FILTER, false);
|
||||||
f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
|
f->special_material->setFlag(video::EMF_FOG_ENABLE, true);
|
||||||
|
if(!opaque_water)
|
||||||
f->special_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
|
f->special_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA;
|
||||||
AtlasPointer *pa_water1 = new AtlasPointer(g_texturesource->getTexture(
|
AtlasPointer *pa_water1 = new AtlasPointer(g_texturesource->getTexture(
|
||||||
g_texturesource->getTextureId("water.png")));
|
g_texturesource->getTextureId("water.png")));
|
||||||
@ -432,8 +435,10 @@ void content_mapnode_init()
|
|||||||
if(g_texturesource)
|
if(g_texturesource)
|
||||||
t.texture = g_texturesource->getTexture("water.png");
|
t.texture = g_texturesource->getTexture("water.png");
|
||||||
|
|
||||||
|
if(!opaque_water){
|
||||||
t.alpha = WATER_ALPHA;
|
t.alpha = WATER_ALPHA;
|
||||||
t.material_type = MATERIAL_ALPHA_VERTEX;
|
t.material_type = MATERIAL_ALPHA_VERTEX;
|
||||||
|
}
|
||||||
t.material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING;
|
t.material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING;
|
||||||
f->setAllTiles(t);
|
f->setAllTiles(t);
|
||||||
#endif
|
#endif
|
||||||
@ -450,6 +455,7 @@ void content_mapnode_init()
|
|||||||
f->liquid_alternative_source = CONTENT_WATERSOURCE;
|
f->liquid_alternative_source = CONTENT_WATERSOURCE;
|
||||||
f->liquid_viscosity = WATER_VISC;
|
f->liquid_viscosity = WATER_VISC;
|
||||||
#ifndef SERVER
|
#ifndef SERVER
|
||||||
|
if(!opaque_water)
|
||||||
f->vertex_alpha = WATER_ALPHA;
|
f->vertex_alpha = WATER_ALPHA;
|
||||||
f->post_effect_color = video::SColor(64, 100, 100, 200);
|
f->post_effect_color = video::SColor(64, 100, 100, 200);
|
||||||
if(f->special_material == NULL && g_texturesource)
|
if(f->special_material == NULL && g_texturesource)
|
||||||
|
@ -79,6 +79,7 @@ void set_default_settings(Settings *settings)
|
|||||||
settings->setDefault("screenshot_path", ".");
|
settings->setDefault("screenshot_path", ".");
|
||||||
settings->setDefault("view_bobbing_amount", "1.0");
|
settings->setDefault("view_bobbing_amount", "1.0");
|
||||||
settings->setDefault("enable_3d_clouds", "false");
|
settings->setDefault("enable_3d_clouds", "false");
|
||||||
|
settings->setDefault("opaque_water", "false");
|
||||||
|
|
||||||
// Server stuff
|
// Server stuff
|
||||||
// "map-dir" doesn't exist by default.
|
// "map-dir" doesn't exist by default.
|
||||||
|
@ -81,6 +81,7 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
|||||||
bool fancy_trees;
|
bool fancy_trees;
|
||||||
bool smooth_lighting;
|
bool smooth_lighting;
|
||||||
bool clouds_3d;
|
bool clouds_3d;
|
||||||
|
bool opaque_water;
|
||||||
|
|
||||||
// Client options
|
// Client options
|
||||||
{
|
{
|
||||||
@ -125,6 +126,13 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
|||||||
else
|
else
|
||||||
clouds_3d = m_data->clouds_3d;
|
clouds_3d = m_data->clouds_3d;
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
gui::IGUIElement *e = getElementFromId(GUI_ID_OPAQUE_WATER_CB);
|
||||||
|
if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
|
||||||
|
opaque_water = ((gui::IGUICheckBox*)e)->isChecked();
|
||||||
|
else
|
||||||
|
opaque_water = m_data->opaque_water;
|
||||||
|
}
|
||||||
|
|
||||||
// Server options
|
// Server options
|
||||||
{
|
{
|
||||||
@ -260,6 +268,12 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
|
|||||||
Environment->addCheckBox(clouds_3d, rect, this, GUI_ID_3D_CLOUDS_CB,
|
Environment->addCheckBox(clouds_3d, rect, this, GUI_ID_3D_CLOUDS_CB,
|
||||||
wgettext("3D Clouds"));
|
wgettext("3D Clouds"));
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
core::rect<s32> rect(0, 0, 250, 30);
|
||||||
|
rect += topleft_client + v2s32(35, 150+60);
|
||||||
|
Environment->addCheckBox(opaque_water, rect, this, GUI_ID_OPAQUE_WATER_CB,
|
||||||
|
wgettext("Opaque water"));
|
||||||
|
}
|
||||||
// Start game button
|
// Start game button
|
||||||
{
|
{
|
||||||
core::rect<s32> rect(0, 0, 180, 30);
|
core::rect<s32> rect(0, 0, 180, 30);
|
||||||
@ -377,9 +391,9 @@ void GUIMainMenu::acceptInput()
|
|||||||
m_data->enable_damage = ((gui::IGUICheckBox*)e)->isChecked();
|
m_data->enable_damage = ((gui::IGUICheckBox*)e)->isChecked();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
gui::IGUIElement *e = getElementFromId(GUI_ID_3D_CLOUDS_CB);
|
gui::IGUIElement *e = getElementFromId(GUI_ID_FANCYTREE_CB);
|
||||||
if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
|
if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
|
||||||
m_data->clouds_3d = ((gui::IGUICheckBox*)e)->isChecked();
|
m_data->fancy_trees = ((gui::IGUICheckBox*)e)->isChecked();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
gui::IGUIElement *e = getElementFromId(GUI_ID_SMOOTH_LIGHTING_CB);
|
gui::IGUIElement *e = getElementFromId(GUI_ID_SMOOTH_LIGHTING_CB);
|
||||||
@ -387,9 +401,14 @@ void GUIMainMenu::acceptInput()
|
|||||||
m_data->smooth_lighting = ((gui::IGUICheckBox*)e)->isChecked();
|
m_data->smooth_lighting = ((gui::IGUICheckBox*)e)->isChecked();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
gui::IGUIElement *e = getElementFromId(GUI_ID_FANCYTREE_CB);
|
gui::IGUIElement *e = getElementFromId(GUI_ID_3D_CLOUDS_CB);
|
||||||
if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
|
if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
|
||||||
m_data->fancy_trees = ((gui::IGUICheckBox*)e)->isChecked();
|
m_data->clouds_3d = ((gui::IGUICheckBox*)e)->isChecked();
|
||||||
|
}
|
||||||
|
{
|
||||||
|
gui::IGUIElement *e = getElementFromId(GUI_ID_OPAQUE_WATER_CB);
|
||||||
|
if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
|
||||||
|
m_data->opaque_water = ((gui::IGUICheckBox*)e)->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_accepted = true;
|
m_accepted = true;
|
||||||
|
@ -36,6 +36,7 @@ enum
|
|||||||
GUI_ID_FANCYTREE_CB,
|
GUI_ID_FANCYTREE_CB,
|
||||||
GUI_ID_SMOOTH_LIGHTING_CB,
|
GUI_ID_SMOOTH_LIGHTING_CB,
|
||||||
GUI_ID_3D_CLOUDS_CB,
|
GUI_ID_3D_CLOUDS_CB,
|
||||||
|
GUI_ID_OPAQUE_WATER_CB,
|
||||||
GUI_ID_DAMAGE_CB,
|
GUI_ID_DAMAGE_CB,
|
||||||
GUI_ID_CREATIVE_CB,
|
GUI_ID_CREATIVE_CB,
|
||||||
GUI_ID_JOIN_GAME_BUTTON,
|
GUI_ID_JOIN_GAME_BUTTON,
|
||||||
@ -66,6 +67,7 @@ struct MainMenuData
|
|||||||
bool fancy_trees;
|
bool fancy_trees;
|
||||||
bool smooth_lighting;
|
bool smooth_lighting;
|
||||||
bool clouds_3d;
|
bool clouds_3d;
|
||||||
|
bool opaque_water;
|
||||||
// Server options
|
// Server options
|
||||||
bool creative_mode;
|
bool creative_mode;
|
||||||
bool enable_damage;
|
bool enable_damage;
|
||||||
|
@ -1547,6 +1547,7 @@ int main(int argc, char *argv[])
|
|||||||
menudata.fancy_trees = g_settings->getBool("new_style_leaves");
|
menudata.fancy_trees = g_settings->getBool("new_style_leaves");
|
||||||
menudata.smooth_lighting = g_settings->getBool("smooth_lighting");
|
menudata.smooth_lighting = g_settings->getBool("smooth_lighting");
|
||||||
menudata.clouds_3d = g_settings->getBool("enable_3d_clouds");
|
menudata.clouds_3d = g_settings->getBool("enable_3d_clouds");
|
||||||
|
menudata.opaque_water = g_settings->getBool("opaque_water");
|
||||||
menudata.creative_mode = g_settings->getBool("creative_mode");
|
menudata.creative_mode = g_settings->getBool("creative_mode");
|
||||||
menudata.enable_damage = g_settings->getBool("enable_damage");
|
menudata.enable_damage = g_settings->getBool("enable_damage");
|
||||||
|
|
||||||
@ -1620,6 +1621,7 @@ int main(int argc, char *argv[])
|
|||||||
g_settings->set("new_style_leaves", itos(menudata.fancy_trees));
|
g_settings->set("new_style_leaves", itos(menudata.fancy_trees));
|
||||||
g_settings->set("smooth_lighting", itos(menudata.smooth_lighting));
|
g_settings->set("smooth_lighting", itos(menudata.smooth_lighting));
|
||||||
g_settings->set("enable_3d_clouds", itos(menudata.clouds_3d));
|
g_settings->set("enable_3d_clouds", itos(menudata.clouds_3d));
|
||||||
|
g_settings->set("opaque_water", itos(menudata.opaque_water));
|
||||||
g_settings->set("creative_mode", itos(menudata.creative_mode));
|
g_settings->set("creative_mode", itos(menudata.creative_mode));
|
||||||
g_settings->set("enable_damage", itos(menudata.enable_damage));
|
g_settings->set("enable_damage", itos(menudata.enable_damage));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user