mapgen_valleys.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. Minetest
  3. Copyright (C) 2016-2019 Duane Robertson <duane@duanerobertson.com>
  4. Copyright (C) 2016-2019 paramat
  5. Based on Valleys Mapgen by Gael de Sailly
  6. (https://forum.minetest.net/viewtopic.php?f=9&t=11430)
  7. and mapgen_v7, mapgen_flat by kwolekr and paramat.
  8. Licensing changed by permission of Gael de Sailly.
  9. This program is free software; you can redistribute it and/or modify
  10. it under the terms of the GNU Lesser General Public License as published by
  11. the Free Software Foundation; either version 2.1 of the License, or
  12. (at your option) any later version.
  13. This program is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. GNU Lesser General Public License for more details.
  17. You should have received a copy of the GNU Lesser General Public License along
  18. with this program; if not, write to the Free Software Foundation, Inc.,
  19. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  20. */
  21. #pragma once
  22. #include "mapgen.h"
  23. #define MGVALLEYS_ALT_CHILL 0x01
  24. #define MGVALLEYS_HUMID_RIVERS 0x02
  25. #define MGVALLEYS_VARY_RIVER_DEPTH 0x04
  26. #define MGVALLEYS_ALT_DRY 0x08
  27. class BiomeManager;
  28. class BiomeGenOriginal;
  29. extern FlagDesc flagdesc_mapgen_valleys[];
  30. struct MapgenValleysParams : public MapgenParams {
  31. u32 spflags = MGVALLEYS_ALT_CHILL | MGVALLEYS_HUMID_RIVERS |
  32. MGVALLEYS_VARY_RIVER_DEPTH | MGVALLEYS_ALT_DRY;
  33. u16 altitude_chill = 90;
  34. u16 river_depth = 4;
  35. u16 river_size = 5;
  36. float cave_width = 0.09f;
  37. s16 large_cave_depth = -33;
  38. s16 lava_depth = 1;
  39. s16 cavern_limit = -256;
  40. s16 cavern_taper = 192;
  41. float cavern_threshold = 0.6f;
  42. s16 dungeon_ymin = -31000;
  43. s16 dungeon_ymax = 63;
  44. NoiseParams np_filler_depth;
  45. NoiseParams np_inter_valley_fill;
  46. NoiseParams np_inter_valley_slope;
  47. NoiseParams np_rivers;
  48. NoiseParams np_terrain_height;
  49. NoiseParams np_valley_depth;
  50. NoiseParams np_valley_profile;
  51. NoiseParams np_cave1;
  52. NoiseParams np_cave2;
  53. NoiseParams np_cavern;
  54. MapgenValleysParams();
  55. ~MapgenValleysParams() = default;
  56. void readParams(const Settings *settings);
  57. void writeParams(Settings *settings) const;
  58. };
  59. class MapgenValleys : public MapgenBasic {
  60. public:
  61. MapgenValleys(int mapgenid, MapgenValleysParams *params,
  62. EmergeManager *emerge);
  63. ~MapgenValleys();
  64. virtual MapgenType getType() const { return MAPGEN_VALLEYS; }
  65. virtual void makeChunk(BlockMakeData *data);
  66. int getSpawnLevelAtPoint(v2s16 p);
  67. private:
  68. BiomeGenOriginal *m_bgen;
  69. float altitude_chill;
  70. float river_depth_bed;
  71. float river_size_factor;
  72. s16 large_cave_depth;
  73. s16 dungeon_ymin;
  74. s16 dungeon_ymax;
  75. Noise *noise_inter_valley_fill;
  76. Noise *noise_inter_valley_slope;
  77. Noise *noise_rivers;
  78. Noise *noise_terrain_height;
  79. Noise *noise_valley_depth;
  80. Noise *noise_valley_profile;
  81. virtual int generateTerrain();
  82. };