mapgen_flat.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. Minetest
  3. Copyright (C) 2015-2017 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. class BiomeManager;
  23. extern FlagDesc flagdesc_mapgen_flat[];
  24. struct MapgenFlatParams : public MapgenParams
  25. {
  26. u32 spflags = 0;
  27. s16 ground_level = 8;
  28. s16 large_cave_depth = -33;
  29. s16 lava_depth = -256;
  30. float cave_width = 0.09f;
  31. float lake_threshold = -0.45f;
  32. float lake_steepness = 48.0f;
  33. float hill_threshold = 0.45f;
  34. float hill_steepness = 64.0f;
  35. NoiseParams np_terrain;
  36. NoiseParams np_filler_depth;
  37. NoiseParams np_cave1;
  38. NoiseParams np_cave2;
  39. MapgenFlatParams();
  40. ~MapgenFlatParams() = default;
  41. void readParams(const Settings *settings);
  42. void writeParams(Settings *settings) const;
  43. };
  44. class MapgenFlat : public MapgenBasic
  45. {
  46. public:
  47. MapgenFlat(int mapgenid, MapgenFlatParams *params, EmergeManager *emerge);
  48. ~MapgenFlat();
  49. virtual MapgenType getType() const { return MAPGEN_FLAT; }
  50. virtual void makeChunk(BlockMakeData *data);
  51. int getSpawnLevelAtPoint(v2s16 p);
  52. s16 generateTerrain();
  53. private:
  54. s16 ground_level;
  55. s16 large_cave_depth;
  56. float lake_threshold;
  57. float lake_steepness;
  58. float hill_threshold;
  59. float hill_steepness;
  60. Noise *noise_terrain;
  61. };