1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-27 17:28:41 +00:00

Cavegen: Remove CavesV6 dependency on Mapgen

This commit is contained in:
kwolekr 2016-05-10 13:21:13 -04:00
parent bf25837617
commit a605d69092
3 changed files with 97 additions and 62 deletions

View file

@ -23,13 +23,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define VMANIP_FLAG_CAVE VOXELFLAG_CHECKED1
#define DEFAULT_LAVA_DEPTH (-256)
class MapgenV6;
class GenerateNotifier;
class CavesRandomWalk {
public:
Mapgen *mg;
MMVManip *vm;
INodeDefManager *ndef;
s16 *heightmap;
// variables
int lava_depth;
@ -64,7 +65,7 @@ public:
content_t c_ice;
int water_level;
int ystride;
u16 ystride;
CavesRandomWalk(Mapgen *mg, PseudoRandom *ps);
void makeCave(v3s16 nmin, v3s16 nmax, int max_stone_height);
@ -87,9 +88,18 @@ public:
*/
class CavesV6 {
public:
MapgenV6 *mg;
MMVManip *vm;
INodeDefManager *ndef;
GenerateNotifier *gennotify;
PseudoRandom *ps;
PseudoRandom *ps2;
s16 *heightmap;
content_t c_water_source;
content_t c_lava_source;
int water_level;
u16 ystride;
s16 min_tunnel_diameter;
s16 max_tunnel_diameter;
@ -100,7 +110,6 @@ public:
bool large_cave;
bool large_cave_is_flat;
s16 max_stone_y;
v3s16 node_min;
v3s16 node_max;
@ -113,16 +122,22 @@ public:
s16 route_y_min;
s16 route_y_max;
PseudoRandom *ps;
PseudoRandom *ps2;
// ndef is a mandatory parameter.
// If gennotify is NULL, generation events are not logged.
CavesV6(INodeDefManager *ndef,
GenerateNotifier *gennotify = NULL,
int water_level = 1,
content_t water_source = CONTENT_IGNORE,
content_t lava_source = CONTENT_IGNORE);
content_t c_water_source;
content_t c_lava_source;
// vm, ps, and ps2 are mandatory parameters.
// If heightmap is NULL, the surface level at all points is assumed to
// be water_level.
void makeCave(MMVManip *vm, v3s16 nmin, v3s16 nmax,
PseudoRandom *ps, PseudoRandom *ps2,
bool is_large_cave, int max_stone_height, s16 *heightmap = NULL);
int water_level;
CavesV6(MapgenV6 *mg, PseudoRandom *ps, PseudoRandom *ps2, bool large_cave);
void makeCave(v3s16 nmin, v3s16 nmax, int max_stone_height);
private:
void makeTunnel(bool dirswitch);
void carveRoute(v3f vec, float f, bool randomize_xz, bool tunnel_above_ground);
};