mapgen_flat.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. Minetest
  3. Copyright (C) 2015-2020 paramat
  4. Copyright (C) 2015-2016 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
  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. /////// Mapgen Flat flags
  20. #define MGFLAT_LAKES 0x01
  21. #define MGFLAT_HILLS 0x02
  22. #define MGFLAT_CAVERNS 0x04
  23. class BiomeManager;
  24. extern FlagDesc flagdesc_mapgen_flat[];
  25. struct MapgenFlatParams : public MapgenParams
  26. {
  27. s16 ground_level = 8;
  28. float lake_threshold = -0.45f;
  29. float lake_steepness = 48.0f;
  30. float hill_threshold = 0.45f;
  31. float hill_steepness = 64.0f;
  32. float cave_width = 0.09f;
  33. u16 small_cave_num_min = 0;
  34. u16 small_cave_num_max = 0;
  35. u16 large_cave_num_min = 0;
  36. u16 large_cave_num_max = 2;
  37. s16 large_cave_depth = -33;
  38. float large_cave_flooded = 0.5f;
  39. s16 cavern_limit = -256;
  40. s16 cavern_taper = 256;
  41. float cavern_threshold = 0.7f;
  42. s16 dungeon_ymin = -31000;
  43. s16 dungeon_ymax = 31000;
  44. NoiseParams np_terrain;
  45. NoiseParams np_filler_depth;
  46. NoiseParams np_cavern;
  47. NoiseParams np_cave1;
  48. NoiseParams np_cave2;
  49. NoiseParams np_dungeons;
  50. MapgenFlatParams();
  51. ~MapgenFlatParams() = default;
  52. void readParams(const Settings *settings);
  53. void writeParams(Settings *settings) const;
  54. void setDefaultSettings(Settings *settings);
  55. };
  56. class MapgenFlat : public MapgenBasic
  57. {
  58. public:
  59. MapgenFlat(MapgenFlatParams *params, EmergeParams *emerge);
  60. ~MapgenFlat();
  61. virtual MapgenType getType() const { return MAPGEN_FLAT; }
  62. virtual void makeChunk(BlockMakeData *data);
  63. int getSpawnLevelAtPoint(v2s16 p);
  64. s16 generateTerrain();
  65. private:
  66. s16 ground_level;
  67. float lake_threshold;
  68. float lake_steepness;
  69. float hill_threshold;
  70. float hill_steepness;
  71. Noise *noise_terrain;
  72. };