2016-01-14 04:57:02 +01:00
|
|
|
/*
|
2018-01-15 03:26:15 +01:00
|
|
|
Minetest
|
2019-03-14 01:27:16 +01:00
|
|
|
Copyright (C) 2016-2019 Duane Robertson <duane@duanerobertson.com>
|
|
|
|
Copyright (C) 2016-2019 paramat
|
2016-01-14 04:57:02 +01:00
|
|
|
|
|
|
|
Based on Valleys Mapgen by Gael de Sailly
|
2018-01-15 03:26:15 +01:00
|
|
|
(https://forum.minetest.net/viewtopic.php?f=9&t=11430)
|
2019-03-14 01:27:16 +01:00
|
|
|
and mapgen_v7, mapgen_flat by kwolekr and paramat.
|
2016-01-14 04:57:02 +01:00
|
|
|
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
2019-03-14 01:27:16 +01:00
|
|
|
|
2017-08-17 22:19:39 +02:00
|
|
|
#pragma once
|
2016-01-14 04:57:02 +01:00
|
|
|
|
|
|
|
#include "mapgen.h"
|
|
|
|
|
2018-07-18 04:34:05 +02:00
|
|
|
#define MGVALLEYS_ALT_CHILL 0x01
|
|
|
|
#define MGVALLEYS_HUMID_RIVERS 0x02
|
|
|
|
#define MGVALLEYS_VARY_RIVER_DEPTH 0x04
|
|
|
|
#define MGVALLEYS_ALT_DRY 0x08
|
2016-01-31 09:59:15 +01:00
|
|
|
|
2016-01-14 04:57:02 +01:00
|
|
|
class BiomeManager;
|
2016-04-28 09:43:09 +02:00
|
|
|
class BiomeGenOriginal;
|
2016-01-14 04:57:02 +01:00
|
|
|
|
2018-07-18 04:34:05 +02:00
|
|
|
extern FlagDesc flagdesc_mapgen_valleys[];
|
|
|
|
|
2016-01-14 04:57:02 +01:00
|
|
|
|
2016-06-25 00:15:56 +02:00
|
|
|
struct MapgenValleysParams : public MapgenParams {
|
2018-07-18 04:34:05 +02:00
|
|
|
u16 altitude_chill = 90;
|
|
|
|
u16 river_depth = 4;
|
|
|
|
u16 river_size = 5;
|
2018-04-21 23:50:36 +02:00
|
|
|
|
2017-06-17 19:11:28 +02:00
|
|
|
float cave_width = 0.09f;
|
2018-04-21 23:50:36 +02:00
|
|
|
s16 large_cave_depth = -33;
|
2019-11-08 04:09:43 +01:00
|
|
|
u16 small_cave_num_min = 0;
|
|
|
|
u16 small_cave_num_max = 0;
|
|
|
|
u16 large_cave_num_min = 0;
|
|
|
|
u16 large_cave_num_max = 2;
|
|
|
|
float large_cave_flooded = 0.5f;
|
2018-04-21 23:50:36 +02:00
|
|
|
s16 cavern_limit = -256;
|
|
|
|
s16 cavern_taper = 192;
|
|
|
|
float cavern_threshold = 0.6f;
|
2018-02-17 18:43:13 +01:00
|
|
|
s16 dungeon_ymin = -31000;
|
2018-07-18 04:34:05 +02:00
|
|
|
s16 dungeon_ymax = 63;
|
2018-02-17 18:43:13 +01:00
|
|
|
|
2016-01-14 04:57:02 +01:00
|
|
|
NoiseParams np_filler_depth;
|
|
|
|
NoiseParams np_inter_valley_fill;
|
|
|
|
NoiseParams np_inter_valley_slope;
|
|
|
|
NoiseParams np_rivers;
|
|
|
|
NoiseParams np_terrain_height;
|
|
|
|
NoiseParams np_valley_depth;
|
|
|
|
NoiseParams np_valley_profile;
|
|
|
|
|
2018-04-21 23:50:36 +02:00
|
|
|
NoiseParams np_cave1;
|
|
|
|
NoiseParams np_cave2;
|
|
|
|
NoiseParams np_cavern;
|
2019-06-01 21:50:43 +02:00
|
|
|
NoiseParams np_dungeons;
|
2018-04-21 23:50:36 +02:00
|
|
|
|
2016-01-14 04:57:02 +01:00
|
|
|
MapgenValleysParams();
|
2017-08-18 18:18:25 +02:00
|
|
|
~MapgenValleysParams() = default;
|
2016-01-14 04:57:02 +01:00
|
|
|
|
|
|
|
void readParams(const Settings *settings);
|
|
|
|
void writeParams(Settings *settings) const;
|
2020-01-25 16:56:54 +01:00
|
|
|
void setDefaultSettings(Settings *settings);
|
2016-01-14 04:57:02 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-05-02 08:24:57 +02:00
|
|
|
class MapgenValleys : public MapgenBasic {
|
2016-01-14 04:57:02 +01:00
|
|
|
public:
|
|
|
|
|
2019-03-25 16:42:53 +01:00
|
|
|
MapgenValleys(MapgenValleysParams *params,
|
2018-07-18 04:34:05 +02:00
|
|
|
EmergeManager *emerge);
|
2016-01-14 04:57:02 +01:00
|
|
|
~MapgenValleys();
|
|
|
|
|
2016-06-14 06:10:55 +02:00
|
|
|
virtual MapgenType getType() const { return MAPGEN_VALLEYS; }
|
|
|
|
|
2016-01-14 04:57:02 +01:00
|
|
|
virtual void makeChunk(BlockMakeData *data);
|
2016-02-04 02:03:31 +01:00
|
|
|
int getSpawnLevelAtPoint(v2s16 p);
|
2016-01-14 04:57:02 +01:00
|
|
|
|
|
|
|
private:
|
2016-04-28 09:43:09 +02:00
|
|
|
BiomeGenOriginal *m_bgen;
|
2016-01-14 04:57:02 +01:00
|
|
|
|
2018-02-17 18:43:13 +01:00
|
|
|
float altitude_chill;
|
2016-04-25 12:47:25 +02:00
|
|
|
float river_depth_bed;
|
|
|
|
float river_size_factor;
|
2018-04-21 23:50:36 +02:00
|
|
|
|
2016-01-14 04:57:02 +01:00
|
|
|
Noise *noise_inter_valley_fill;
|
|
|
|
Noise *noise_inter_valley_slope;
|
|
|
|
Noise *noise_rivers;
|
|
|
|
Noise *noise_terrain_height;
|
|
|
|
Noise *noise_valley_depth;
|
|
|
|
Noise *noise_valley_profile;
|
|
|
|
|
|
|
|
virtual int generateTerrain();
|
|
|
|
};
|