mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r27018) -Fix [FS#6141] (r27008): the higher amplitudes needed for higher maps were not ignored properly causing much smoother maps than wanted
This commit is contained in:
parent
54280f45c0
commit
b4b0b2750c
11
src/tgp.cpp
11
src/tgp.cpp
|
@ -277,7 +277,7 @@ static amplitude_t GetAmplitude(int frequency)
|
||||||
|
|
||||||
/* We need to extrapolate the amplitude. */
|
/* We need to extrapolate the amplitude. */
|
||||||
double extrapolation_factor = extrapolation_factors[smoothness];
|
double extrapolation_factor = extrapolation_factors[smoothness];
|
||||||
int height_range = 16;
|
int height_range = I2H(16);
|
||||||
do {
|
do {
|
||||||
amplitude = (amplitude_t)(extrapolation_factor * (double)amplitude);
|
amplitude = (amplitude_t)(extrapolation_factor * (double)amplitude);
|
||||||
height_range <<= 1;
|
height_range <<= 1;
|
||||||
|
@ -352,12 +352,18 @@ static void HeightMapGenerate()
|
||||||
assert(_height_map.h != NULL);
|
assert(_height_map.h != NULL);
|
||||||
|
|
||||||
int start = max(MAX_TGP_FREQUENCIES - (int)min(MapLogX(), MapLogY()), 0);
|
int start = max(MAX_TGP_FREQUENCIES - (int)min(MapLogX(), MapLogY()), 0);
|
||||||
|
bool first = true;
|
||||||
|
|
||||||
for (int frequency = start; frequency < MAX_TGP_FREQUENCIES; frequency++) {
|
for (int frequency = start; frequency < MAX_TGP_FREQUENCIES; frequency++) {
|
||||||
const amplitude_t amplitude = GetAmplitude(frequency);
|
const amplitude_t amplitude = GetAmplitude(frequency);
|
||||||
|
|
||||||
|
/* Ignore zero amplitudes; it means our map isn't height enough for this
|
||||||
|
* amplitude, so ignore it and continue with the next set of amplitude. */
|
||||||
|
if (amplitude == 0) continue;
|
||||||
|
|
||||||
const int step = 1 << (MAX_TGP_FREQUENCIES - frequency - 1);
|
const int step = 1 << (MAX_TGP_FREQUENCIES - frequency - 1);
|
||||||
|
|
||||||
if (frequency == start) {
|
if (first) {
|
||||||
/* This is first round, we need to establish base heights with step = size_min */
|
/* This is first round, we need to establish base heights with step = size_min */
|
||||||
for (int y = 0; y <= _height_map.size_y; y += step) {
|
for (int y = 0; y <= _height_map.size_y; y += step) {
|
||||||
for (int x = 0; x <= _height_map.size_x; x += step) {
|
for (int x = 0; x <= _height_map.size_x; x += step) {
|
||||||
|
@ -365,6 +371,7 @@ static void HeightMapGenerate()
|
||||||
_height_map.height(x, y) = height;
|
_height_map.height(x, y) = height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
first = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue