mapgen_carpathian.h 2.8 KB

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