From: Perttu Ahola Date: Mon, 13 Dec 2010 09:38:04 +0000 (+0200) Subject: random stuff and different node lighting X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=2b9d03b267a3a11e6fc81d94423caaa852616fa8;p=zefram%2Fminetest%2Fminetest_engine.git random stuff and different node lighting --- diff --git a/src/map.cpp b/src/map.cpp index ff57e8d9..8bc914cf 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1961,9 +1961,10 @@ MapBlock * ServerMap::emergeBlock( Add some minerals */ - if(is_underground) + //if(is_underground) + if(some_part_underground) { - s16 underground_level = lowest_ground_y/MAP_BLOCKSIZE - block_y; + s16 underground_level = (lowest_ground_y/MAP_BLOCKSIZE - block_y)+1; for(s16 i=0; igetNode(cp).d)) + //if(is_ground_content(block->getNode(cp).d)) + if(block->getNode(cp).d == CONTENT_STONE) if(rand()%8 == 0) block->setNode(cp, n); for(u16 i=0; i<26; i++) { - if(is_ground_content(block->getNode(cp+g_26dirs[i]).d)) + //if(is_ground_content(block->getNode(cp+g_26dirs[i]).d)) + if(block->getNode(cp+g_26dirs[i]).d == CONTENT_STONE) if(rand()%8 == 0) block->setNode(cp+g_26dirs[i], n); } diff --git a/src/mapblock.cpp b/src/mapblock.cpp index 033c69cd..7500143c 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -162,9 +162,15 @@ u8 MapBlock::getFaceLight(v3s16 p, v3s16 face_dir) light = n2.getLight(); // Make some nice difference to different sides - if(face_dir.X == 1 || face_dir.Z == 1 || face_dir.Y == -1) + + /*if(face_dir.X == 1 || face_dir.Z == 1 || face_dir.Y == -1) light = diminish_light(diminish_light(light)); else if(face_dir.X == -1 || face_dir.Z == -1) + light = diminish_light(light);*/ + + if(face_dir.X == 1 || face_dir.X == -1 || face_dir.Y == -1) + light = diminish_light(diminish_light(light)); + else if(face_dir.Z == 1 || face_dir.Z == -1) light = diminish_light(light); return light; @@ -832,13 +838,13 @@ void MapBlock::serialize(std::ostream &os, u8 version) } compress(materialdata, os, version); - // Get and compress params - SharedBuffer paramdata(nodecount); + // Get and compress lights + SharedBuffer lightdata(nodecount); for(u32 i=0; i= 10) { diff --git a/src/test.cpp b/src/test.cpp index 726930ce..6d71566f 100644 --- a/src/test.cpp +++ b/src/test.cpp @@ -461,7 +461,8 @@ struct TestMapBlock assert(b.getFaceLight(p, v3s16(0,-1,0)) == 0); // According to MapBlock::getFaceLight, // The face on the z+ side should have double-diminished light - assert(b.getFaceLight(p, v3s16(0,0,1)) == diminish_light(diminish_light(LIGHT_MAX))); + //assert(b.getFaceLight(p, v3s16(0,0,1)) == diminish_light(diminish_light(LIGHT_MAX))); + assert(b.getFaceLight(p, v3s16(0,0,1)) == diminish_light(LIGHT_MAX)); } /* Check how the block handles being in between blocks with some non-sunlight