mapgen_carpathian.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. Minetest
  3. Copyright (C) 2010-2016 paramat, Matt Gregory
  4. Copyright (C) 2010-2016 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
  5. Copyright (C) 2017 vlapsley, Vaughan Lapsley <vlapsley@gmail.com>
  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. u32 spflags = MGCARPATHIAN_CAVERNS;
  27. float cave_width = 0.09f;
  28. s16 large_cave_depth = -33;
  29. s16 lava_depth = -256;
  30. s16 cavern_limit = -256;
  31. s16 cavern_taper = 256;
  32. float cavern_threshold = 0.7f;
  33. NoiseParams np_base;
  34. NoiseParams np_filler_depth;
  35. NoiseParams np_height1;
  36. NoiseParams np_height2;
  37. NoiseParams np_height3;
  38. NoiseParams np_height4;
  39. NoiseParams np_hills_terrain;
  40. NoiseParams np_ridge_terrain;
  41. NoiseParams np_step_terrain;
  42. NoiseParams np_hills;
  43. NoiseParams np_ridge_mnt;
  44. NoiseParams np_step_mnt;
  45. NoiseParams np_mnt_var;
  46. NoiseParams np_cave1;
  47. NoiseParams np_cave2;
  48. NoiseParams np_cavern;
  49. MapgenCarpathianParams();
  50. ~MapgenCarpathianParams() = default;
  51. void readParams(const Settings *settings);
  52. void writeParams(Settings *settings) const;
  53. };
  54. class MapgenCarpathian : public MapgenBasic
  55. {
  56. public:
  57. MapgenCarpathian(int mapgenid, MapgenCarpathianParams *params,
  58. EmergeManager *emerge);
  59. ~MapgenCarpathian();
  60. virtual MapgenType getType() const { return MAPGEN_CARPATHIAN; }
  61. float getSteps(float noise);
  62. inline float getLerp(float noise1, float noise2, float mod);
  63. virtual void makeChunk(BlockMakeData *data);
  64. int getSpawnLevelAtPoint(v2s16 p);
  65. private:
  66. s16 large_cave_depth;
  67. s32 grad_wl;
  68. Noise *noise_base;
  69. Noise *noise_height1;
  70. Noise *noise_height2;
  71. Noise *noise_height3;
  72. Noise *noise_height4;
  73. Noise *noise_hills_terrain;
  74. Noise *noise_ridge_terrain;
  75. Noise *noise_step_terrain;
  76. Noise *noise_hills;
  77. Noise *noise_ridge_mnt;
  78. Noise *noise_step_mnt;
  79. Noise *noise_mnt_var;
  80. float terrainLevelAtPoint(s16 x, s16 z);
  81. int generateTerrain();
  82. };