- /*
- Cache some ground type values for speed
- */
-
-// Creates variables c_name=id and n_name=node
-#define CONTENT_VARIABLE(ndef, name)\
- content_t c_##name = ndef->getId("mapgen_" #name);\
- MapNode n_##name(c_##name);
-// Default to something else if was CONTENT_IGNORE
-#define CONTENT_VARIABLE_FALLBACK(name, dname)\
- if(c_##name == CONTENT_IGNORE){\
- c_##name = c_##dname;\
- n_##name = n_##dname;\
- }
-
- CONTENT_VARIABLE(ndef, stone);
- CONTENT_VARIABLE(ndef, air);
- CONTENT_VARIABLE(ndef, water_source);
- CONTENT_VARIABLE(ndef, dirt);
- CONTENT_VARIABLE(ndef, sand);
- CONTENT_VARIABLE(ndef, gravel);
- CONTENT_VARIABLE(ndef, clay);
- CONTENT_VARIABLE(ndef, lava_source);
- CONTENT_VARIABLE(ndef, cobble);
- CONTENT_VARIABLE(ndef, mossycobble);
- CONTENT_VARIABLE(ndef, dirt_with_grass);
- CONTENT_VARIABLE(ndef, junglegrass);
- CONTENT_VARIABLE(ndef, stone_with_coal);
- CONTENT_VARIABLE(ndef, stone_with_iron);
- CONTENT_VARIABLE(ndef, mese);
- CONTENT_VARIABLE(ndef, desert_sand);
- CONTENT_VARIABLE_FALLBACK(desert_sand, sand);
- CONTENT_VARIABLE(ndef, desert_stone);
- CONTENT_VARIABLE_FALLBACK(desert_stone, stone);
-
- // Maximum height of the stone surface and obstacles.
- // This is used to guide the cave generation
- s16 stone_surface_max_y = 0;
-
- /*
- Generate general ground level to full area
- */
- {
-#if 1
- TimeTaker timer1("Generating ground level");
-
- for(s16 x=node_min.X; x<=node_max.X; x++)
- for(s16 z=node_min.Z; z<=node_max.Z; z++)
- {
- // Node position
- v2s16 p2d = v2s16(x,z);
-
- /*
- Skip of already generated
- */
- /*{
- v3s16 p(p2d.X, node_min.Y, p2d.Y);
- if(vmanip.m_data[vmanip.m_area.index(p)].d != CONTENT_AIR)
- continue;
- }*/
-
- // Ground height at this point
- float surface_y_f = 0.0;
-
- // Use perlin noise for ground height
- surface_y_f = base_rock_level_2d(data->seed, p2d);
-
- /*// Experimental stuff
- {
- float a = highlands_level_2d(data->seed, p2d);
- if(a > surface_y_f)
- surface_y_f = a;
- }*/