From 9b1b57a52390ecc98c27b2f923052511c387ba3d Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Wed, 2 Feb 2011 18:46:14 +0200 Subject: some tweaking --- src/map.cpp | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 112 insertions(+), 12 deletions(-) (limited to 'src/map.cpp') diff --git a/src/map.cpp b/src/map.cpp index 7c0d19dbb..80210cead 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -2145,7 +2145,7 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos, TimeTaker timer("generateChunkRaw()"); - // The distance how far into the neighbors the generator is allowed to go + // The distance how far into the neighbors the generator is allowed to go. s16 max_spread_amount_sectors = 2; assert(max_spread_amount_sectors <= m_chunksize); s16 max_spread_amount = max_spread_amount_sectors * MAP_BLOCKSIZE; @@ -2190,6 +2190,12 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos, *(u32)sectorpos_base_size*MAP_BLOCKSIZE *(u32)h_blocks*MAP_BLOCKSIZE; + /* + The limiting edges of the lighting update, inclusive. + */ + s16 lighting_min_d = 0-max_spread_amount; + s16 lighting_max_d = sectorpos_base_size*MAP_BLOCKSIZE+max_spread_amount-1; + /* Create the whole area of this and the neighboring chunks */ @@ -2226,6 +2232,12 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos, } } } + + /* + Clear all light emitted + */ + + core::map unlight_from; /* Now we have a big empty area. @@ -2310,7 +2322,8 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos, */ u32 stone_obstacle_amount = - myrand_range(0, myrand_range(20, myrand_range(80,150))); + myrand_range(0, myrand_range(20, 150)); + //myrand_range(0, myrand_range(20, myrand_range(80,150))); /* Loop this part, it will make stuff look older and newer nicely @@ -2346,9 +2359,19 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos, myrand_range(0, maxheight_randomized), myrand_range(5, stone_obstacle_max_size) ); - v2s16 ob_place( + /*v2s16 ob_place( myrand_range(0, sectorpos_base_size*MAP_BLOCKSIZE-1), myrand_range(0, sectorpos_base_size*MAP_BLOCKSIZE-1) + );*/ + /* + Limit by 1 to not obstruct sunlight at borders, because + it would fuck up lighting in some places because we're + leaving out removing light from the borders for optimization + and simplicity. + */ + v2s16 ob_place( + myrand_range(1, sectorpos_base_size*MAP_BLOCKSIZE-1-1), + myrand_range(1, sectorpos_base_size*MAP_BLOCKSIZE-1-1) ); // Minimum space left on top of the obstacle @@ -2450,20 +2473,20 @@ MapChunk* ServerMap::generateChunkRaw(v2s16 chunkpos, Make dungeons */ u32 dungeons_count = relative_volume / 200000; - u32 bruises_count = relative_volume * stone_surface_max_y / 15000000; + u32 bruises_count = relative_volume * stone_surface_max_y / 200000 / 50; for(u32 jj=0; jj=y_nodes_min; y--) + { + MapNode *n = &vmanip.m_data[i]; + if(n->getLight(LIGHTBANK_DAY) != 0) + { + light_sources.insert(v3s16(p2d.X, y, p2d.Y), true); + } + } + } + } +#endif + /*for(s16 x=0; xsetLight(LIGHTBANK_DAY, light); n->setLight(LIGHTBANK_NIGHT, 0); -- cgit v1.2.3