]> git.lizzy.rs Git - minetest.git/blob - src/cavegen.h
Cavegen, mgv5: Cleanup code
[minetest.git] / src / cavegen.h
1 /*
2 Minetest
3 Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
4
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
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef CAVEGEN_HEADER
21 #define CAVEGEN_HEADER
22
23 #define VMANIP_FLAG_CAVE VOXELFLAG_CHECKED1
24
25 class MapgenV5;
26 class MapgenV6;
27 class MapgenV7;
28
29 class CaveV5 {
30 public:
31         MapgenV5 *mg;
32         MMVManip *vm;
33         INodeDefManager *ndef;
34
35         NoiseParams *np_caveliquids;
36
37         s16 min_tunnel_diameter;
38         s16 max_tunnel_diameter;
39         u16 tunnel_routepoints;
40         int dswitchint;
41         int part_max_length_rs;
42
43         bool large_cave_is_flat;
44         bool flooded;
45
46         s16 max_stone_y;
47         v3s16 node_min;
48         v3s16 node_max;
49
50         v3f orp;  // starting point, relative to caved space
51         v3s16 of; // absolute coordinates of caved space
52         v3s16 ar; // allowed route area
53         s16 rs;   // tunnel radius size
54         v3f main_direction;
55
56         s16 route_y_min;
57         s16 route_y_max;
58
59         PseudoRandom *ps;
60
61         content_t c_water_source;
62         content_t c_lava_source;
63         content_t c_ice;
64
65         int water_level;
66
67         CaveV5() {}
68         CaveV5(MapgenV5 *mg, PseudoRandom *ps);
69         void makeCave(v3s16 nmin, v3s16 nmax, int max_stone_height);
70         void makeTunnel(bool dirswitch);
71         void carveRoute(v3f vec, float f, bool randomize_xz, bool is_ravine);
72 };
73
74 class CaveV6 {
75 public:
76         MapgenV6 *mg;
77         MMVManip *vm;
78         INodeDefManager *ndef;
79
80         s16 min_tunnel_diameter;
81         s16 max_tunnel_diameter;
82         u16 tunnel_routepoints;
83         int dswitchint;
84         int part_max_length_rs;
85
86         bool large_cave;
87         bool large_cave_is_flat;
88         bool flooded;
89
90         s16 max_stone_y;
91         v3s16 node_min;
92         v3s16 node_max;
93
94         v3f orp;  // starting point, relative to caved space
95         v3s16 of; // absolute coordinates of caved space
96         v3s16 ar; // allowed route area
97         s16 rs;   // tunnel radius size
98         v3f main_direction;
99
100         s16 route_y_min;
101         s16 route_y_max;
102
103         PseudoRandom *ps;
104         PseudoRandom *ps2;
105
106         content_t c_water_source;
107         content_t c_lava_source;
108
109         int water_level;
110
111         CaveV6() {}
112         CaveV6(MapgenV6 *mg, PseudoRandom *ps, PseudoRandom *ps2, bool large_cave);
113         void makeCave(v3s16 nmin, v3s16 nmax, int max_stone_height);
114         void makeTunnel(bool dirswitch);
115         void carveRoute(v3f vec, float f, bool randomize_xz);
116 };
117
118 class CaveV7 {
119 public:
120         MapgenV7 *mg;
121         MMVManip *vm;
122         INodeDefManager *ndef;
123
124         NoiseParams *np_caveliquids;
125
126         s16 min_tunnel_diameter;
127         s16 max_tunnel_diameter;
128         u16 tunnel_routepoints;
129         int dswitchint;
130         int part_max_length_rs;
131
132         bool large_cave_is_flat;
133         bool flooded;
134
135         s16 max_stone_y;
136         v3s16 node_min;
137         v3s16 node_max;
138
139         v3f orp;  // starting point, relative to caved space
140         v3s16 of; // absolute coordinates of caved space
141         v3s16 ar; // allowed route area
142         s16 rs;   // tunnel radius size
143         v3f main_direction;
144
145         s16 route_y_min;
146         s16 route_y_max;
147
148         PseudoRandom *ps;
149
150         content_t c_water_source;
151         content_t c_lava_source;
152         content_t c_ice;
153
154         int water_level;
155
156         CaveV7() {}
157         CaveV7(MapgenV7 *mg, PseudoRandom *ps);
158         void makeCave(v3s16 nmin, v3s16 nmax, int max_stone_height);
159         void makeTunnel(bool dirswitch);
160         void carveRoute(v3f vec, float f, bool randomize_xz, bool is_ravine);
161 };
162
163 #endif