mapgen_v7.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. Minetest
  3. Copyright (C) 2013-2016 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
  4. Copyright (C) 2014-2017 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. #ifndef MAPGEN_V7_HEADER
  18. #define MAPGEN_V7_HEADER
  19. #include "mapgen.h"
  20. //////////// Mapgen V7 flags
  21. #define MGV7_MOUNTAINS 0x01
  22. #define MGV7_RIDGES 0x02
  23. #define MGV7_FLOATLANDS 0x04
  24. #define MGV7_CAVERNS 0x08
  25. class BiomeManager;
  26. extern FlagDesc flagdesc_mapgen_v7[];
  27. struct MapgenV7Params : public MapgenParams {
  28. u32 spflags = MGV7_MOUNTAINS | MGV7_RIDGES | MGV7_CAVERNS;
  29. float cave_width = 0.09f;
  30. float float_mount_density = 0.6f;
  31. float float_mount_height = 128.0f;
  32. s16 floatland_level = 1280;
  33. s16 shadow_limit = 1024;
  34. s16 cavern_limit = -256;
  35. s16 cavern_taper = 256;
  36. float cavern_threshold = 0.7f;
  37. NoiseParams np_terrain_base;
  38. NoiseParams np_terrain_alt;
  39. NoiseParams np_terrain_persist;
  40. NoiseParams np_height_select;
  41. NoiseParams np_filler_depth;
  42. NoiseParams np_mount_height;
  43. NoiseParams np_ridge_uwater;
  44. NoiseParams np_floatland_base;
  45. NoiseParams np_float_base_height;
  46. NoiseParams np_mountain;
  47. NoiseParams np_ridge;
  48. NoiseParams np_cavern;
  49. NoiseParams np_cave1;
  50. NoiseParams np_cave2;
  51. MapgenV7Params();
  52. ~MapgenV7Params() {}
  53. void readParams(const Settings *settings);
  54. void writeParams(Settings *settings) const;
  55. };
  56. class MapgenV7 : public MapgenBasic {
  57. public:
  58. MapgenV7(int mapgenid, MapgenV7Params *params, EmergeManager *emerge);
  59. ~MapgenV7();
  60. virtual MapgenType getType() const { return MAPGEN_V7; }
  61. virtual void makeChunk(BlockMakeData *data);
  62. int getSpawnLevelAtPoint(v2s16 p);
  63. float baseTerrainLevelAtPoint(s16 x, s16 z);
  64. float baseTerrainLevelFromMap(int index);
  65. bool getMountainTerrainAtPoint(s16 x, s16 y, s16 z);
  66. bool getMountainTerrainFromMap(int idx_xyz, int idx_xz, s16 y);
  67. bool getFloatlandMountainFromMap(int idx_xyz, int idx_xz, s16 y);
  68. void floatBaseExtentFromMap(s16 *float_base_min, s16 *float_base_max, int idx_xz);
  69. int generateTerrain();
  70. void generateRidgeTerrain();
  71. private:
  72. float float_mount_density;
  73. float float_mount_height;
  74. s16 floatland_level;
  75. s16 shadow_limit;
  76. Noise *noise_terrain_base;
  77. Noise *noise_terrain_alt;
  78. Noise *noise_terrain_persist;
  79. Noise *noise_height_select;
  80. Noise *noise_mount_height;
  81. Noise *noise_ridge_uwater;
  82. Noise *noise_floatland_base;
  83. Noise *noise_float_base_height;
  84. Noise *noise_mountain;
  85. Noise *noise_ridge;
  86. };
  87. #endif