From 8f42a8be0c760322207287e50b624bd3d388a2e1 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Mon, 15 Aug 2011 02:04:56 +0300 Subject: lava! --- src/content_mapnode.cpp | 109 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 108 insertions(+), 1 deletion(-) (limited to 'src/content_mapnode.cpp') diff --git a/src/content_mapnode.cpp b/src/content_mapnode.cpp index b164033db..3c1353467 100644 --- a/src/content_mapnode.cpp +++ b/src/content_mapnode.cpp @@ -372,6 +372,21 @@ void content_mapnode_init() f->liquid_type = LIQUID_FLOWING; f->liquid_alternative_flowing = CONTENT_WATER; f->liquid_alternative_source = CONTENT_WATERSOURCE; + f->vertex_alpha = 160; + if(f->special_material == NULL && g_texturesource) + { + // Flowing water material + f->special_material = new video::SMaterial; + f->special_material->setFlag(video::EMF_LIGHTING, 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_FOG_ENABLE, true); + f->special_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA; + AtlasPointer *pa_water1 = new AtlasPointer(g_texturesource->getTexture( + g_texturesource->getTextureId("water.png"))); + f->special_material->setTexture(0, pa_water1->atlas); + f->special_atlas = pa_water1; + } i = CONTENT_WATERSOURCE; f = &content_features(i); @@ -389,7 +404,7 @@ void content_mapnode_init() if(g_texturesource) t.texture = g_texturesource->getTexture("water.png"); - t.alpha = WATER_ALPHA; + t.alpha = 160; t.material_type = MATERIAL_ALPHA_VERTEX; t.material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING; f->setAllTiles(t); @@ -404,6 +419,98 @@ void content_mapnode_init() f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1"; f->liquid_alternative_flowing = CONTENT_WATER; f->liquid_alternative_source = CONTENT_WATERSOURCE; + f->vertex_alpha = 160; + if(f->special_material == NULL && g_texturesource) + { + // Flowing water material + f->special_material = new video::SMaterial; + f->special_material->setFlag(video::EMF_LIGHTING, 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_FOG_ENABLE, true); + f->special_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA; + AtlasPointer *pa_water1 = new AtlasPointer(g_texturesource->getTexture( + g_texturesource->getTextureId("water.png"))); + f->special_material->setTexture(0, pa_water1->atlas); + f->special_atlas = pa_water1; + } + + i = CONTENT_LAVA; + f = &content_features(i); + f->setInventoryTextureCube("lava.png", "lava.png", "lava.png"); + f->param_type = CPT_LIGHT; + f->light_propagates = false; + f->light_source = LIGHT_MAX-1; + f->solidness = 0; // Drawn separately, makes no faces + f->walkable = false; + f->pointable = false; + f->diggable = false; + f->buildable_to = true; + f->liquid_type = LIQUID_FLOWING; + f->liquid_alternative_flowing = CONTENT_LAVA; + f->liquid_alternative_source = CONTENT_LAVASOURCE; + if(f->special_material == NULL && g_texturesource) + { + // Flowing lava material + f->special_material = new video::SMaterial; + f->special_material->setFlag(video::EMF_LIGHTING, 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_FOG_ENABLE, true); + f->special_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA; + AtlasPointer *pa_lava1 = new AtlasPointer( + g_texturesource->getTexture( + g_texturesource->getTextureId("lava.png"))); + f->special_material->setTexture(0, pa_lava1->atlas); + f->special_atlas = pa_lava1; + } + + i = CONTENT_LAVASOURCE; + f = &content_features(i); + f->setInventoryTextureCube("lava.png", "lava.png", "lava.png"); + if(new_style_water) + { + f->solidness = 0; // drawn separately, makes no faces + } + else // old style + { + f->solidness = 2; + + TileSpec t; + if(g_texturesource) + t.texture = g_texturesource->getTexture("lava.png"); + + //t.alpha = 255; + //t.material_type = MATERIAL_ALPHA_VERTEX; + //t.material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING; + f->setAllTiles(t); + } + f->param_type = CPT_LIGHT; + f->light_propagates = false; + f->light_source = LIGHT_MAX-1; + f->walkable = false; + f->pointable = false; + f->diggable = false; + f->buildable_to = true; + f->liquid_type = LIQUID_SOURCE; + f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1"; + f->liquid_alternative_flowing = CONTENT_LAVA; + f->liquid_alternative_source = CONTENT_LAVASOURCE; + if(f->special_material == NULL && g_texturesource) + { + // Flowing lava material + f->special_material = new video::SMaterial; + f->special_material->setFlag(video::EMF_LIGHTING, 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_FOG_ENABLE, true); + f->special_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA; + AtlasPointer *pa_lava1 = new AtlasPointer( + g_texturesource->getTexture( + g_texturesource->getTextureId("lava.png"))); + f->special_material->setTexture(0, pa_lava1->atlas); + f->special_atlas = pa_lava1; + } i = CONTENT_TORCH; f = &content_features(i); -- cgit v1.2.3 From 472585a7e8e511e7cc210ad8e2c17cad9dfeb186 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Mon, 15 Aug 2011 11:49:39 +0300 Subject: tuned lava/universal damage code --- src/content_mapnode.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/content_mapnode.cpp') diff --git a/src/content_mapnode.cpp b/src/content_mapnode.cpp index 3c1353467..f3d5b9f59 100644 --- a/src/content_mapnode.cpp +++ b/src/content_mapnode.cpp @@ -449,6 +449,7 @@ void content_mapnode_init() f->liquid_type = LIQUID_FLOWING; f->liquid_alternative_flowing = CONTENT_LAVA; f->liquid_alternative_source = CONTENT_LAVASOURCE; + f->damage_per_second = 4*2; if(f->special_material == NULL && g_texturesource) { // Flowing lava material @@ -496,6 +497,7 @@ void content_mapnode_init() f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1"; f->liquid_alternative_flowing = CONTENT_LAVA; f->liquid_alternative_source = CONTENT_LAVASOURCE; + f->damage_per_second = 4*2; if(f->special_material == NULL && g_texturesource) { // Flowing lava material -- cgit v1.2.3 From 8ab77f41531ab325a9dc027070e317d3651888dd Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Mon, 15 Aug 2011 11:51:33 +0300 Subject: Added #define WATER_ALPHA in content_mapnode.cpp --- src/content_mapnode.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/content_mapnode.cpp') diff --git a/src/content_mapnode.cpp b/src/content_mapnode.cpp index f3d5b9f59..a3c8d4b0a 100644 --- a/src/content_mapnode.cpp +++ b/src/content_mapnode.cpp @@ -24,6 +24,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "mapnode.h" #include "content_nodemeta.h" +#define WATER_ALPHA 160 + // TODO: Get rid of these and set up some attributes like toughness, // fluffyness, and a funciton to calculate time and durability loss // (and sound? and whatever else) from them @@ -372,7 +374,7 @@ void content_mapnode_init() f->liquid_type = LIQUID_FLOWING; f->liquid_alternative_flowing = CONTENT_WATER; f->liquid_alternative_source = CONTENT_WATERSOURCE; - f->vertex_alpha = 160; + f->vertex_alpha = WATER_ALPHA; if(f->special_material == NULL && g_texturesource) { // Flowing water material @@ -404,7 +406,7 @@ void content_mapnode_init() if(g_texturesource) t.texture = g_texturesource->getTexture("water.png"); - t.alpha = 160; + t.alpha = WATER_ALPHA; t.material_type = MATERIAL_ALPHA_VERTEX; t.material_flags &= ~MATERIAL_FLAG_BACKFACE_CULLING; f->setAllTiles(t); @@ -419,7 +421,7 @@ void content_mapnode_init() f->dug_item = std::string("MaterialItem2 ")+itos(i)+" 1"; f->liquid_alternative_flowing = CONTENT_WATER; f->liquid_alternative_source = CONTENT_WATERSOURCE; - f->vertex_alpha = 160; + f->vertex_alpha = WATER_ALPHA; if(f->special_material == NULL && g_texturesource) { // Flowing water material -- cgit v1.2.3 From 0c7e7f49980851c4290817dae7a9c1cdc4a93b65 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Mon, 15 Aug 2011 12:08:41 +0300 Subject: Non-vertex-alpha texture material for lava --- src/content_mapnode.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/content_mapnode.cpp') diff --git a/src/content_mapnode.cpp b/src/content_mapnode.cpp index a3c8d4b0a..7174a8a4b 100644 --- a/src/content_mapnode.cpp +++ b/src/content_mapnode.cpp @@ -460,7 +460,7 @@ void content_mapnode_init() 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_FOG_ENABLE, true); - f->special_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA; + f->special_material->MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF; AtlasPointer *pa_lava1 = new AtlasPointer( g_texturesource->getTexture( g_texturesource->getTextureId("lava.png"))); @@ -508,7 +508,7 @@ void content_mapnode_init() 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_FOG_ENABLE, true); - f->special_material->MaterialType = video::EMT_TRANSPARENT_VERTEX_ALPHA; + f->special_material->MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF; AtlasPointer *pa_lava1 = new AtlasPointer( g_texturesource->getTexture( g_texturesource->getTextureId("lava.png"))); -- cgit v1.2.3