summaryrefslogtreecommitdiff
path: root/src/mapgen/mapgen_valleys.h
diff options
context:
space:
mode:
authorVitaliy <silverunicorn2011@yandex.ru>2017-11-09 01:56:20 +0300
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-11-08 23:56:20 +0100
commit20a85d76d94c9c5c7fbe198c3d0e1fbee97a485f (patch)
tree67378802190117d8271b3b6d489a92bcb16203b7 /src/mapgen/mapgen_valleys.h
parentfc9747eb4b7f75e59a28957bc50f7a78256b3d66 (diff)
downloadminetest-20a85d76d94c9c5c7fbe198c3d0e1fbee97a485f.tar.gz
minetest-20a85d76d94c9c5c7fbe198c3d0e1fbee97a485f.tar.bz2
minetest-20a85d76d94c9c5c7fbe198c3d0e1fbee97a485f.zip
Move files to subdirectories (#6599)
* Move files around
Diffstat (limited to 'src/mapgen/mapgen_valleys.h')
-rw-r--r--src/mapgen/mapgen_valleys.h134
1 files changed, 134 insertions, 0 deletions
diff --git a/src/mapgen/mapgen_valleys.h b/src/mapgen/mapgen_valleys.h
new file mode 100644
index 000000000..7b5eb187d
--- /dev/null
+++ b/src/mapgen/mapgen_valleys.h
@@ -0,0 +1,134 @@
+/*
+Minetest Valleys C
+Copyright (C) 2016-2017 Duane Robertson <duane@duanerobertson.com>
+Copyright (C) 2016-2017 paramat
+
+Based on Valleys Mapgen by Gael de Sailly
+ (https://forum.minetest.net/viewtopic.php?f=9&t=11430)
+and mapgen_v7 by kwolekr and paramat.
+
+Licensing changed by permission of Gael de Sailly.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#pragma once
+
+#include "mapgen.h"
+
+////////////// Mapgen Valleys flags
+#define MGVALLEYS_ALT_CHILL 0x01
+#define MGVALLEYS_HUMID_RIVERS 0x02
+
+// Feed only one variable into these.
+#define MYSQUARE(x) (x) * (x)
+#define MYCUBE(x) (x) * (x) * (x)
+
+class BiomeManager;
+class BiomeGenOriginal;
+
+// Global profiler
+//class Profiler;
+//extern Profiler *mapgen_profiler;
+
+
+struct MapgenValleysParams : public MapgenParams {
+ u32 spflags = MGVALLEYS_HUMID_RIVERS | MGVALLEYS_ALT_CHILL;
+ s16 large_cave_depth = -33;
+ s16 massive_cave_depth = -256; // highest altitude of massive caves
+ u16 altitude_chill = 90; // The altitude at which temperature drops by 20C.
+ u16 lava_features = 0; // How often water will occur in caves.
+ u16 river_depth = 4; // How deep to carve river channels.
+ u16 river_size = 5; // How wide to make rivers.
+ u16 water_features = 0; // How often water will occur in caves.
+ float cave_width = 0.09f;
+ NoiseParams np_cave1;
+ NoiseParams np_cave2;
+ NoiseParams np_filler_depth;
+ NoiseParams np_inter_valley_fill;
+ NoiseParams np_inter_valley_slope;
+ NoiseParams np_rivers;
+ NoiseParams np_massive_caves;
+ NoiseParams np_terrain_height;
+ NoiseParams np_valley_depth;
+ NoiseParams np_valley_profile;
+
+ MapgenValleysParams();
+ ~MapgenValleysParams() = default;
+
+ void readParams(const Settings *settings);
+ void writeParams(Settings *settings) const;
+};
+
+struct TerrainNoise {
+ s16 x;
+ s16 z;
+ float terrain_height;
+ float *rivers;
+ float *valley;
+ float valley_profile;
+ float *slope;
+ float inter_valley_fill;
+};
+
+class MapgenValleys : public MapgenBasic {
+public:
+
+ MapgenValleys(int mapgenid, MapgenValleysParams *params, EmergeManager *emerge);
+ ~MapgenValleys();
+
+ virtual MapgenType getType() const { return MAPGEN_VALLEYS; }
+
+ virtual void makeChunk(BlockMakeData *data);
+ int getSpawnLevelAtPoint(v2s16 p);
+
+ s16 large_cave_depth;
+
+private:
+ BiomeGenOriginal *m_bgen;
+
+ bool humid_rivers;
+ bool use_altitude_chill;
+ float humidity_adjust;
+ s16 cave_water_max_height;
+ s16 lava_max_height;
+
+ float altitude_chill;
+ s16 lava_features_lim;
+ s16 massive_cave_depth;
+ float river_depth_bed;
+ float river_size_factor;
+ float *tcave_cache;
+ s16 water_features_lim;
+ Noise *noise_inter_valley_fill;
+ Noise *noise_inter_valley_slope;
+ Noise *noise_rivers;
+ Noise *noise_cave1;
+ Noise *noise_cave2;
+ Noise *noise_massive_caves;
+ Noise *noise_terrain_height;
+ Noise *noise_valley_depth;
+ Noise *noise_valley_profile;
+
+ float terrainLevelAtPoint(s16 x, s16 z);
+
+ void calculateNoise();
+
+ virtual int generateTerrain();
+ float terrainLevelFromNoise(TerrainNoise *tn);
+ float adjustedTerrainLevelFromNoise(TerrainNoise *tn);
+
+ virtual void generateCaves(s16 max_stone_y, s16 large_cave_depth);
+};