@@ -138,7 +138,7 @@ void CaveV5::makeTunnel(bool dirswitch) {
138
138
(float )(ps->next () % maxlen.Z ) - (float )maxlen.Z / 2
139
139
);
140
140
141
- // Do not make large caves that are above ground.
141
+ // Do not make caves that are above ground.
142
142
// It is only necessary to check the startpoint and endpoint.
143
143
v3s16 orpi (orp.X , orp.Y , orp.Z );
144
144
v3s16 veci (vec.X , vec.Y , vec.Z );
@@ -193,20 +193,15 @@ void CaveV5::makeTunnel(bool dirswitch) {
193
193
// Every second section is rough
194
194
bool randomize_xz = (ps->range (1 , 2 ) == 1 );
195
195
196
- // Make a ravine every once in a while if it's long enough
197
- // float xylen = vec.X * vec.X + vec.Z * vec.Z;
198
- // disable ravines for now
199
- bool is_ravine = false ; // (xylen > 500.0) && !large_cave && (ps->range(1, 8) == 1);
200
-
201
196
// Carve routes
202
197
for (float f = 0 ; f < 1.0 ; f += 1.0 / veclen)
203
- carveRoute (vec, f, randomize_xz, is_ravine );
198
+ carveRoute (vec, f, randomize_xz);
204
199
205
200
orp = rp;
206
201
}
207
202
208
203
209
- void CaveV5::carveRoute (v3f vec, float f, bool randomize_xz, bool is_ravine ) {
204
+ void CaveV5::carveRoute (v3f vec, float f, bool randomize_xz) {
210
205
MapNode airnode (CONTENT_AIR);
211
206
MapNode waternode (c_water_source);
212
207
MapNode lavanode (c_lava_source);
@@ -230,15 +225,12 @@ void CaveV5::carveRoute(v3f vec, float f, bool randomize_xz, bool is_ravine) {
230
225
d1 += ps->range (-1 , 1 );
231
226
}
232
227
233
- bool should_make_cave_hole = ps->range (1 , 10 ) == 1 ;
234
-
235
228
for (s16 z0 = d0; z0 <= d1; z0++) {
236
229
s16 si = rs / 2 - MYMAX (0 , abs (z0) - rs / 7 - 1 );
237
230
for (s16 x0 = -si - ps->range (0 ,1 ); x0 <= si - 1 + ps->range (0 ,1 ); x0++) {
238
231
s16 maxabsxz = MYMAX (abs (x0), abs (z0));
239
232
240
- s16 si2 = is_ravine ? MYMIN (ps->range (25 , 26 ), ar.Y ) :
241
- rs / 2 - MYMAX (0 , maxabsxz - rs / 7 - 1 );
233
+ s16 si2 = rs / 2 - MYMAX (0 , maxabsxz - rs / 7 - 1 );
242
234
243
235
for (s16 y0 = -si2; y0 <= si2; y0 ++) {
244
236
if (large_cave_is_flat) {
@@ -250,15 +242,6 @@ void CaveV5::carveRoute(v3f vec, float f, bool randomize_xz, bool is_ravine) {
250
242
v3s16 p (cp.X + x0, cp.Y + y0 , cp.Z + z0);
251
243
p += of;
252
244
253
- if (!is_ravine && mg->heightmap && should_make_cave_hole &&
254
- p.X <= node_max.X && p.Z <= node_max.Z ) {
255
- int maplen = node_max.X - node_min.X + 1 ;
256
- int idx = (p.Z - node_min.Z ) * maplen +
257
- (p.X - node_min.X );
258
- if (p.Y >= mg->heightmap [idx] - 2 )
259
- continue ;
260
- }
261
-
262
245
if (vm->m_area .contains (p) == false )
263
246
continue ;
264
247
@@ -431,38 +414,36 @@ void CaveV6::makeTunnel(bool dirswitch) {
431
414
);
432
415
}
433
416
434
- // Do not make large caves that are entirely above ground.
417
+ // Do not make caves that are entirely above ground.
435
418
// It is only necessary to check the startpoint and endpoint.
436
- if (large_cave) {
437
- v3s16 orpi (orp.X , orp.Y , orp.Z );
438
- v3s16 veci (vec.X , vec.Y , vec.Z );
439
- s16 h1;
440
- s16 h2;
441
-
442
- v3s16 p1 = orpi + veci + of + rs / 2 ;
443
- if (p1.Z >= node_min.Z && p1.Z <= node_max.Z &&
444
- p1.X >= node_min.X && p1.X <= node_max.X ) {
445
- u32 index1 = (p1.Z - node_min.Z ) * mg->ystride +
446
- (p1.X - node_min.X );
447
- h1 = mg->heightmap [index1];
448
- } else {
449
- h1 = water_level; // If not in heightmap
450
- }
451
-
452
- v3s16 p2 = orpi + of + rs / 2 ;
453
- if (p2.Z >= node_min.Z && p2.Z <= node_max.Z &&
454
- p2.X >= node_min.X && p2.X <= node_max.X ) {
455
- u32 index2 = (p2.Z - node_min.Z ) * mg->ystride +
456
- (p2.X - node_min.X );
457
- h2 = mg->heightmap [index2];
458
- } else {
459
- h2 = water_level;
460
- }
419
+ v3s16 orpi (orp.X , orp.Y , orp.Z );
420
+ v3s16 veci (vec.X , vec.Y , vec.Z );
421
+ s16 h1;
422
+ s16 h2;
423
+
424
+ v3s16 p1 = orpi + veci + of + rs / 2 ;
425
+ if (p1.Z >= node_min.Z && p1.Z <= node_max.Z &&
426
+ p1.X >= node_min.X && p1.X <= node_max.X ) {
427
+ u32 index1 = (p1.Z - node_min.Z ) * mg->ystride +
428
+ (p1.X - node_min.X );
429
+ h1 = mg->heightmap [index1];
430
+ } else {
431
+ h1 = water_level; // If not in heightmap
432
+ }
461
433
462
- if (p1.Y > h1 && p2.Y > h2) // If startpoint and endpoint are above ground
463
- return ;
434
+ v3s16 p2 = orpi + of + rs / 2 ;
435
+ if (p2.Z >= node_min.Z && p2.Z <= node_max.Z &&
436
+ p2.X >= node_min.X && p2.X <= node_max.X ) {
437
+ u32 index2 = (p2.Z - node_min.Z ) * mg->ystride +
438
+ (p2.X - node_min.X );
439
+ h2 = mg->heightmap [index2];
440
+ } else {
441
+ h2 = water_level;
464
442
}
465
443
444
+ if (p1.Y > h1 && p2.Y > h2) // If startpoint and endpoint are above ground
445
+ return ;
446
+
466
447
vec += main_direction;
467
448
468
449
v3f rp = orp + vec;
@@ -680,7 +661,7 @@ void CaveV7::makeTunnel(bool dirswitch) {
680
661
(float )(ps->next () % maxlen.Z ) - (float )maxlen.Z / 2
681
662
);
682
663
683
- // Do not make large caves that are above ground.
664
+ // Do not make caves that are above ground.
684
665
// It is only necessary to check the startpoint and endpoint.
685
666
v3s16 orpi (orp.X , orp.Y , orp.Z );
686
667
v3s16 veci (vec.X , vec.Y , vec.Z );
@@ -735,20 +716,15 @@ void CaveV7::makeTunnel(bool dirswitch) {
735
716
// Every second section is rough
736
717
bool randomize_xz = (ps->range (1 , 2 ) == 1 );
737
718
738
- // Make a ravine every once in a while if it's long enough
739
- // float xylen = vec.X * vec.X + vec.Z * vec.Z;
740
- // disable ravines for now
741
- bool is_ravine = false ; // (xylen > 500.0) && !large_cave && (ps->range(1, 8) == 1);
742
-
743
719
// Carve routes
744
720
for (float f = 0 ; f < 1.0 ; f += 1.0 / veclen)
745
- carveRoute (vec, f, randomize_xz, is_ravine );
721
+ carveRoute (vec, f, randomize_xz);
746
722
747
723
orp = rp;
748
724
}
749
725
750
726
751
- void CaveV7::carveRoute (v3f vec, float f, bool randomize_xz, bool is_ravine ) {
727
+ void CaveV7::carveRoute (v3f vec, float f, bool randomize_xz) {
752
728
MapNode airnode (CONTENT_AIR);
753
729
MapNode waternode (c_water_source);
754
730
MapNode lavanode (c_lava_source);
@@ -773,15 +749,12 @@ void CaveV7::carveRoute(v3f vec, float f, bool randomize_xz, bool is_ravine) {
773
749
d1 += ps->range (-1 , 1 );
774
750
}
775
751
776
- bool should_make_cave_hole = ps->range (1 , 10 ) == 1 ;
777
-
778
752
for (s16 z0 = d0; z0 <= d1; z0++) {
779
753
s16 si = rs / 2 - MYMAX (0 , abs (z0) - rs / 7 - 1 );
780
754
for (s16 x0 = -si - ps->range (0 ,1 ); x0 <= si - 1 + ps->range (0 ,1 ); x0++) {
781
755
s16 maxabsxz = MYMAX (abs (x0), abs (z0));
782
756
783
- s16 si2 = is_ravine ? MYMIN (ps->range (25 , 26 ), ar.Y ) :
784
- rs / 2 - MYMAX (0 , maxabsxz - rs / 7 - 1 );
757
+ s16 si2 = rs / 2 - MYMAX (0 , maxabsxz - rs / 7 - 1 );
785
758
786
759
for (s16 y0 = -si2; y0 <= si2; y0 ++) {
787
760
if (large_cave_is_flat) {
@@ -793,15 +766,6 @@ void CaveV7::carveRoute(v3f vec, float f, bool randomize_xz, bool is_ravine) {
793
766
v3s16 p (cp.X + x0, cp.Y + y0 , cp.Z + z0);
794
767
p += of;
795
768
796
- if (!is_ravine && mg->heightmap && should_make_cave_hole &&
797
- p.X <= node_max.X && p.Z <= node_max.Z ) {
798
- int maplen = node_max.X - node_min.X + 1 ;
799
- int idx = (p.Z - node_min.Z ) * maplen +
800
- (p.X - node_min.X );
801
- if (p.Y >= mg->heightmap [idx] - 2 )
802
- continue ;
803
- }
804
-
805
769
if (vm->m_area .contains (p) == false )
806
770
continue ;
807
771
0 commit comments