Mgv7 generateRidgeTerrain: Make river generation relative to water level
authorparamat <mat.gregory@virginmedia.com>
Mon, 19 Jan 2015 11:03:54 +0000 (11:03 +0000)
committerkwolekr <kwolekr@minetest.net>
Thu, 22 Jan 2015 07:21:11 +0000 (02:21 -0500)
Remove widthn and make nridge zero underwater

src/mapgen_v7.cpp

index f13eee82950f7720f8a34efb3f84c7de224960ba..e8ca7809d7f14f4ac59453d29d77b646ace235ef 100644 (file)
@@ -521,15 +521,10 @@ void MapgenV7::generateRidgeTerrain()
                        if (fabs(uwatern) > width)
                                continue;
 
-                       float widthn = (noise_terrain_persist->result[j] - 0.6) / 0.1;
-                       widthn = rangelim(widthn, -0.05, 0.5);
-
-                       float height_mod = (float)(y + 17) / 2.5;
-                       float width_mod  = (width - fabs(uwatern));
-                       float nridge = noise_ridge->result[index] * (float)y / 7.0;
-
-                       if (y < water_level)
-                               nridge = -fabs(nridge) * 3.0 * widthn * 0.3;
+                       float altitude = y - water_level;
+                       float height_mod = (altitude + 17) / 2.5;
+                       float width_mod  = width - fabs(uwatern);
+                       float nridge = noise_ridge->result[index] * MYMAX(altitude, 0) / 7.0;
 
                        if (nridge + width_mod * height_mod < 0.6)
                                continue;