mapgen_carpathian.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. Minetest
  3. Copyright (C) 2017-2019 vlapsley, Vaughan Lapsley <vlapsley@gmail.com>
  4. Copyright (C) 2017-2019 paramat
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU Lesser General Public License as published by
  7. the Free Software Foundation; either version 2.1 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public License along
  14. with this program; if not, write to the Free Software Foundation, Inc.,
  15. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  16. */
  17. #pragma once
  18. #include "mapgen.h"
  19. #define MGCARPATHIAN_CAVERNS 0x01
  20. #define MGCARPATHIAN_RIVERS 0x02
  21. class BiomeManager;
  22. extern FlagDesc flagdesc_mapgen_carpathian[];
  23. struct MapgenCarpathianParams : public MapgenParams
  24. {
  25. float base_level = 12.0f;
  26. float river_width = 0.05f;
  27. float river_depth = 24.0f;
  28. float valley_width = 0.25f;
  29. float cave_width = 0.09f;
  30. s16 large_cave_depth = -33;
  31. u16 small_cave_num_min = 0;
  32. u16 small_cave_num_max = 0;
  33. u16 large_cave_num_min = 0;
  34. u16 large_cave_num_max = 2;
  35. float large_cave_flooded = 0.5f;
  36. s16 cavern_limit = -256;
  37. s16 cavern_taper = 256;
  38. float cavern_threshold = 0.7f;
  39. s16 dungeon_ymin = -31000;
  40. s16 dungeon_ymax = 31000;
  41. NoiseParams np_filler_depth;
  42. NoiseParams np_height1;
  43. NoiseParams np_height2;
  44. NoiseParams np_height3;
  45. NoiseParams np_height4;
  46. NoiseParams np_hills_terrain;
  47. NoiseParams np_ridge_terrain;
  48. NoiseParams np_step_terrain;
  49. NoiseParams np_hills;
  50. NoiseParams np_ridge_mnt;
  51. NoiseParams np_step_mnt;
  52. NoiseParams np_rivers;
  53. NoiseParams np_mnt_var;
  54. NoiseParams np_cave1;
  55. NoiseParams np_cave2;
  56. NoiseParams np_cavern;
  57. NoiseParams np_dungeons;
  58. MapgenCarpathianParams();
  59. ~MapgenCarpathianParams() = default;
  60. void readParams(const Settings *settings);
  61. void writeParams(Settings *settings) const;
  62. void setDefaultSettings(Settings *settings);
  63. };
  64. class MapgenCarpathian : public MapgenBasic
  65. {
  66. public:
  67. MapgenCarpathian(MapgenCarpathianParams *params, EmergeParams *emerge);
  68. ~MapgenCarpathian();
  69. virtual MapgenType getType() const { return MAPGEN_CARPATHIAN; }
  70. virtual void makeChunk(BlockMakeData *data);
  71. int getSpawnLevelAtPoint(v2s16 p);
  72. private:
  73. float base_level;
  74. float river_width;
  75. float river_depth;
  76. float valley_width;
  77. Noise *noise_height1;
  78. Noise *noise_height2;
  79. Noise *noise_height3;
  80. Noise *noise_height4;
  81. Noise *noise_hills_terrain;
  82. Noise *noise_ridge_terrain;
  83. Noise *noise_step_terrain;
  84. Noise *noise_hills;
  85. Noise *noise_ridge_mnt;
  86. Noise *noise_step_mnt;
  87. Noise *noise_rivers = nullptr;
  88. Noise *noise_mnt_var;
  89. s32 grad_wl;
  90. float getSteps(float noise);
  91. inline float getLerp(float noise1, float noise2, float mod);
  92. int generateTerrain();
  93. };