src/tgp.cpp
changeset 5852 cb3f71b16e1a
parent 5838 9c3129cb019b
child 5860 7fdc9b423ba1
equal deleted inserted replaced
5851:ea65a6afdc43 5852:cb3f71b16e1a
   534 
   534 
   535 	/* Lower to sea level */
   535 	/* Lower to sea level */
   536 	for (y = 0; y <= _height_map.size_y; y++) {
   536 	for (y = 0; y <= _height_map.size_y; y++) {
   537 		/* Top right */
   537 		/* Top right */
   538 		max_x = myabs((perlin_coast_noise_2D(_height_map.size_y - y, y, 0.9, 53) + 0.25) * 5 + (perlin_coast_noise_2D(y, y, 0.35, 179) + 1) * 12);
   538 		max_x = myabs((perlin_coast_noise_2D(_height_map.size_y - y, y, 0.9, 53) + 0.25) * 5 + (perlin_coast_noise_2D(y, y, 0.35, 179) + 1) * 12);
   539 		max_x = dmax((smallest_size * smallest_size / 16) + max_x, (smallest_size * smallest_size / 16) + margin - max_x);
   539 		max_x = max((smallest_size * smallest_size / 16) + max_x, (smallest_size * smallest_size / 16) + margin - max_x);
   540 		if (smallest_size < 8 && max_x > 5) max_x /= 1.5;
   540 		if (smallest_size < 8 && max_x > 5) max_x /= 1.5;
   541 		for (x = 0; x < max_x; x++) {
   541 		for (x = 0; x < max_x; x++) {
   542 			HeightMapXY(x, y) = 0;
   542 			HeightMapXY(x, y) = 0;
   543 		}
   543 		}
   544 
   544 
   545 		/* Bottom left */
   545 		/* Bottom left */
   546 		max_x = myabs((perlin_coast_noise_2D(_height_map.size_y - y, y, 0.85, 101) + 0.3) * 6 + (perlin_coast_noise_2D(y, y, 0.45,  67) + 0.75) * 8);
   546 		max_x = myabs((perlin_coast_noise_2D(_height_map.size_y - y, y, 0.85, 101) + 0.3) * 6 + (perlin_coast_noise_2D(y, y, 0.45,  67) + 0.75) * 8);
   547 		max_x = dmax((smallest_size * smallest_size / 16) + max_x, (smallest_size * smallest_size / 16) + margin - max_x);
   547 		max_x = max((smallest_size * smallest_size / 16) + max_x, (smallest_size * smallest_size / 16) + margin - max_x);
   548 		if (smallest_size < 8 && max_x > 5) max_x /= 1.5;
   548 		if (smallest_size < 8 && max_x > 5) max_x /= 1.5;
   549 		for (x = _height_map.size_x; x > (_height_map.size_x - 1 - max_x); x--) {
   549 		for (x = _height_map.size_x; x > (_height_map.size_x - 1 - max_x); x--) {
   550 			HeightMapXY(x, y) = 0;
   550 			HeightMapXY(x, y) = 0;
   551 		}
   551 		}
   552 	}
   552 	}
   553 
   553 
   554 	/* Lower to sea level */
   554 	/* Lower to sea level */
   555 	for (x = 0; x <= _height_map.size_x; x++) {
   555 	for (x = 0; x <= _height_map.size_x; x++) {
   556 		/* Top left */
   556 		/* Top left */
   557 		max_y = myabs((perlin_coast_noise_2D(x, _height_map.size_y / 2, 0.9, 167) + 0.4) * 5 + (perlin_coast_noise_2D(x, _height_map.size_y / 3, 0.4, 211) + 0.7) * 9);
   557 		max_y = myabs((perlin_coast_noise_2D(x, _height_map.size_y / 2, 0.9, 167) + 0.4) * 5 + (perlin_coast_noise_2D(x, _height_map.size_y / 3, 0.4, 211) + 0.7) * 9);
   558 		max_y = dmax((smallest_size * smallest_size / 16) + max_y, (smallest_size * smallest_size / 16) + margin - max_y);
   558 		max_y = max((smallest_size * smallest_size / 16) + max_y, (smallest_size * smallest_size / 16) + margin - max_y);
   559 		if (smallest_size < 8 && max_y > 5) max_y /= 1.5;
   559 		if (smallest_size < 8 && max_y > 5) max_y /= 1.5;
   560 		for (y = 0; y < max_y; y++) {
   560 		for (y = 0; y < max_y; y++) {
   561 			HeightMapXY(x, y) = 0;
   561 			HeightMapXY(x, y) = 0;
   562 		}
   562 		}
   563 
   563 
   564 
   564 
   565 		/* Bottom right */
   565 		/* Bottom right */
   566 		max_y = myabs((perlin_coast_noise_2D(x, _height_map.size_y / 3, 0.85, 71) + 0.25) * 6 + (perlin_coast_noise_2D(x, _height_map.size_y / 3, 0.35, 193) + 0.75) * 12);
   566 		max_y = myabs((perlin_coast_noise_2D(x, _height_map.size_y / 3, 0.85, 71) + 0.25) * 6 + (perlin_coast_noise_2D(x, _height_map.size_y / 3, 0.35, 193) + 0.75) * 12);
   567 		max_y = dmax((smallest_size * smallest_size / 16) + max_y, (smallest_size * smallest_size / 16) + margin - max_y);
   567 		max_y = max((smallest_size * smallest_size / 16) + max_y, (smallest_size * smallest_size / 16) + margin - max_y);
   568 		if (smallest_size < 8 && max_y > 5) max_y /= 1.5;
   568 		if (smallest_size < 8 && max_y > 5) max_y /= 1.5;
   569 		for (y = _height_map.size_y; y > (_height_map.size_y - 1 - max_y); y--) {
   569 		for (y = _height_map.size_y; y > (_height_map.size_y - 1 - max_y); y--) {
   570 			HeightMapXY(x, y) = 0;
   570 			HeightMapXY(x, y) = 0;
   571 		}
   571 		}
   572 	}
   572 	}