cavegen.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. Minetest
  3. Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU Lesser General Public License as published by
  6. the Free Software Foundation; either version 2.1 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public License along
  13. with this program; if not, write to the Free Software Foundation, Inc.,
  14. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  15. */
  16. #ifndef CAVEGEN_HEADER
  17. #define CAVEGEN_HEADER
  18. #define VMANIP_FLAG_CAVE VOXELFLAG_CHECKED1
  19. class MapgenV6;
  20. class MapgenV7;
  21. class CaveV6 {
  22. public:
  23. MapgenV6 *mg;
  24. ManualMapVoxelManipulator *vm;
  25. INodeDefManager *ndef;
  26. s16 min_tunnel_diameter;
  27. s16 max_tunnel_diameter;
  28. u16 tunnel_routepoints;
  29. int dswitchint;
  30. int part_max_length_rs;
  31. bool large_cave;
  32. bool large_cave_is_flat;
  33. bool flooded;
  34. s16 max_stone_y;
  35. v3s16 node_min;
  36. v3s16 node_max;
  37. v3f orp; // starting point, relative to caved space
  38. v3s16 of; // absolute coordinates of caved space
  39. v3s16 ar; // allowed route area
  40. s16 rs; // tunnel radius size
  41. v3f main_direction;
  42. s16 route_y_min;
  43. s16 route_y_max;
  44. PseudoRandom *ps;
  45. PseudoRandom *ps2;
  46. content_t c_water_source;
  47. content_t c_lava_source;
  48. int water_level;
  49. CaveV6() {}
  50. CaveV6(MapgenV6 *mg, PseudoRandom *ps, PseudoRandom *ps2, bool large_cave);
  51. void makeCave(v3s16 nmin, v3s16 nmax, int max_stone_height);
  52. void makeTunnel(bool dirswitch);
  53. void carveRoute(v3f vec, float f, bool randomize_xz);
  54. };
  55. class CaveV7 {
  56. public:
  57. MapgenV7 *mg;
  58. ManualMapVoxelManipulator *vm;
  59. INodeDefManager *ndef;
  60. NoiseParams *np_caveliquids;
  61. s16 min_tunnel_diameter;
  62. s16 max_tunnel_diameter;
  63. u16 tunnel_routepoints;
  64. int dswitchint;
  65. int part_max_length_rs;
  66. bool large_cave;
  67. bool large_cave_is_flat;
  68. bool flooded;
  69. s16 max_stone_y;
  70. v3s16 node_min;
  71. v3s16 node_max;
  72. v3f orp; // starting point, relative to caved space
  73. v3s16 of; // absolute coordinates of caved space
  74. v3s16 ar; // allowed route area
  75. s16 rs; // tunnel radius size
  76. v3f main_direction;
  77. s16 route_y_min;
  78. s16 route_y_max;
  79. PseudoRandom *ps;
  80. content_t c_water_source;
  81. content_t c_lava_source;
  82. content_t c_ice;
  83. int water_level;
  84. CaveV7() {}
  85. CaveV7(MapgenV7 *mg, PseudoRandom *ps, bool large_cave);
  86. void makeCave(v3s16 nmin, v3s16 nmax, int max_stone_height);
  87. void makeTunnel(bool dirswitch);
  88. void carveRoute(v3f vec, float f, bool randomize_xz, bool is_ravine);
  89. };
  90. #endif