random stuff and different node lighting
authorPerttu Ahola <celeron55@gmail.com>
Mon, 13 Dec 2010 09:38:04 +0000 (11:38 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Mon, 13 Dec 2010 09:38:04 +0000 (11:38 +0200)
src/map.cpp
src/mapblock.cpp
src/test.cpp

index ff57e8d90a0c7c39dda53b84dd284df498ef34b4..8bc914cfd82221f172a53c7be1fc881805727287 100644 (file)
@@ -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; i<underground_level*3; i++)
                {
                        if(rand()%2 == 0)
@@ -1977,13 +1978,15 @@ MapBlock * ServerMap::emergeBlock(
                                MapNode n;
                                n.d = CONTENT_MESE;
                                
-                               if(is_ground_content(block->getNode(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);
                                }
index 033c69cdbc19196d7c3f40d7009a5375c7fa32e9..7500143c037b5e5d35162f182f52e7893f378e3d 100644 (file)
@@ -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<u8> paramdata(nodecount);
+               // Get and compress lights
+               SharedBuffer<u8> lightdata(nodecount);
                for(u32 i=0; i<nodecount; i++)
                {
-                       paramdata[i] = data[i].param;
+                       lightdata[i] = data[i].param;
                }
-               compress(paramdata, os, version);
+               compress(lightdata, os, version);
                
                if(version >= 10)
                {
index 726930ce69f01495124e49c404af617ef69ff0a8..6d71566f476dad6afef360d2b242f44cbe841439 100644 (file)
@@ -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