Cuberite
A lightweight, fast and extensible game server for Minecraft
ProtIntGen.h
Go to the documentation of this file.
1 
2 // ProtIntGen.h
3 
4 // Declares the prototyping integer generators - cProtIntGen class and its descendants
5 
6 /*
7 These classes generate 2D arrays of integers that have various interpretations. The main purpose of these
8 classes is to provide fast prototyping for cIntGen classes - unlike cIntGen classes, these are not
9 template-based and so they take care of the underlying sizes automatically. This makes them easier to chain
10 and re-chain, since the size parameters don't need to be adjusted after each such case. Their performance is,
11 however, slightly worse, which is why we use cIntGen classes in the final generator.
12 
13 Because there is no SizeX / SizeZ template param, the generators would have to either alloc memory for each
14 underlying generator's values, or use a maximum-size buffer. We chose the latter, to avoid memory allocation
15 overhead; this however means that there's (an arbitrary) limit to the size of the generated data.
16 */
17 
18 
19 
20 
21 
22 #pragma once
23 
24 // We need the biome group constants defined there:
25 #include "IntGen.h"
26 
27 
28 
29 
30 
35 #ifndef PROT_INT_BUFFER_SIZE
36  #define PROT_INT_BUFFER_SIZE 900
37 #endif
38 
39 
40 
41 
42 
45 {
46 protected:
49  static const int m_BufferSize = PROT_INT_BUFFER_SIZE;
50 
51 public:
52 
54  using Underlying = std::shared_ptr<cProtIntGen>;
55 
56 
59  virtual ~cProtIntGen() {}
60 
62  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) = 0;
63 };
64 
65 
66 
67 
68 
71  public cProtIntGen
72 {
73  using Super = cProtIntGen;
74 
75 public:
76 
77  cProtIntGenWithNoise(int a_Seed):
78  m_Noise(a_Seed)
79  {
80  }
81 
82 protected:
84 
86  int chooseRandomOne(int a_RndX, int a_RndZ, int a_Val1, int a_Val2)
87  {
88  int rnd = m_Noise.IntNoise2DInt(a_RndX, a_RndZ) / 7;
89  return ((rnd & 1) == 0) ? a_Val1 : a_Val2;
90  }
91 
93  int chooseRandomOne(int a_RndX, int a_RndZ, int a_Val1, int a_Val2, int a_Val3, int a_Val4)
94  {
95  int rnd = m_Noise.IntNoise2DInt(a_RndX, a_RndZ) / 7;
96  switch (rnd % 4)
97  {
98  case 0: return a_Val1;
99  case 1: return a_Val2;
100  case 2: return a_Val3;
101  default: return a_Val4;
102  }
103  }
104 };
105 
106 
107 
108 
109 
112  public cProtIntGenWithNoise
113 {
115 
116 public:
117 
118  cProtIntGenChoice(int a_Seed, int a_Range):
119  Super(a_Seed),
120  m_Range(a_Range)
121  {
122  }
123 
124 
125  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
126  {
127  for (size_t z = 0; z < a_SizeZ; z++)
128  {
129  int BaseZ = a_MinZ + static_cast<int>(z);
130  for (size_t x = 0; x < a_SizeX; x++)
131  {
132  a_Values[x + a_SizeX * z] = (Super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), BaseZ) / 7) % m_Range;
133  }
134  } // for z
135  }
136 
137 protected:
138  int m_Range;
139 };
140 
141 
142 
143 
144 
149  public cProtIntGenWithNoise
150 {
152 
153 public:
154 
155  cProtIntGenLandOcean(int a_Seed, int a_Threshold):
156  Super(a_Seed),
157  m_Threshold(a_Threshold)
158  {
159  }
160 
161 
162  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
163  {
164  for (size_t z = 0; z < a_SizeZ; z++)
165  {
166  int BaseZ = a_MinZ + static_cast<int>(z);
167  for (size_t x = 0; x < a_SizeX; x++)
168  {
169  int rnd = (Super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), BaseZ) / 7);
170  a_Values[x + a_SizeX * z] = ((rnd % 100) < m_Threshold) ? ((rnd / 101) % bgLandOceanMax + 1) : 0;
171  }
172  }
173 
174  // If the centerpoint of the world is within the area, set it to bgTemperate, always:
175  if ((a_MinX <= 0) && (a_MinZ <= 0) && (a_MinX + static_cast<int>(a_SizeX) > 0) && (a_MinZ + static_cast<int>(a_SizeZ) > 0))
176  {
177  a_Values[static_cast<size_t>(-a_MinX) - static_cast<size_t>(a_MinZ) * a_SizeX] = bgTemperate;
178  }
179  }
180 
181 protected:
183 };
184 
185 
186 
187 
188 
193  public cProtIntGenWithNoise
194 {
196 
197 public:
198 
199  cProtIntGenZoom(int a_Seed, Underlying a_UnderlyingGen):
200  Super(a_Seed),
201  m_UnderlyingGen(std::move(a_UnderlyingGen))
202  {
203  }
204 
205 
206  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
207  {
208  // Get the coords for the lower generator:
209  int lowerMinX = a_MinX >> 1;
210  int lowerMinZ = a_MinZ >> 1;
211  size_t lowerSizeX = a_SizeX / 2 + 2;
212  size_t lowerSizeZ = a_SizeZ / 2 + 2;
213  ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
214  ASSERT(lowerSizeX > 0);
215  ASSERT(lowerSizeZ > 0);
216 
217  // Generate the underlying data with half the resolution:
218  int lowerData[m_BufferSize];
219  m_UnderlyingGen->GetInts(lowerMinX, lowerMinZ, lowerSizeX, lowerSizeZ, lowerData);
220  const size_t lowStepX = (lowerSizeX - 1) * 2;
221  int cache[m_BufferSize];
222 
223  // Discreet-interpolate the values into twice the size:
224  for (size_t z = 0; z < lowerSizeZ - 1; ++z)
225  {
226  size_t idx = (z * 2) * lowStepX;
227  int PrevZ0 = lowerData[z * lowerSizeX];
228  int PrevZ1 = lowerData[(z + 1) * lowerSizeX];
229 
230  for (size_t x = 0; x < lowerSizeX - 1; ++x)
231  {
232  int ValX1Z0 = lowerData[x + 1 + z * lowerSizeX];
233  int ValX1Z1 = lowerData[x + 1 + (z + 1) * lowerSizeX];
234  int RndX = (static_cast<int>(x) + lowerMinX) * 2;
235  int RndZ = (static_cast<int>(z) + lowerMinZ) * 2;
236  cache[idx] = PrevZ0;
237  cache[idx + lowStepX] = Super::chooseRandomOne(RndX, RndZ + 1, PrevZ0, PrevZ1);
238  cache[idx + 1] = Super::chooseRandomOne(RndX, RndZ - 1, PrevZ0, ValX1Z0);
239  cache[idx + 1 + lowStepX] = Super::chooseRandomOne(RndX, RndZ, PrevZ0, ValX1Z0, PrevZ1, ValX1Z1);
240  idx += 2;
241  PrevZ0 = ValX1Z0;
242  PrevZ1 = ValX1Z1;
243  }
244  }
245 
246  // Copy from Cache into a_Values; take into account the even / odd offsets in a_Min:
247  for (size_t z = 0; z < a_SizeZ; ++z)
248  {
249  memcpy(a_Values + z * a_SizeX, cache + (z + (a_MinZ & 1)) * lowStepX + (a_MinX & 1), a_SizeX * sizeof(int));
250  }
251  }
252 
253 protected:
255 };
256 
257 
258 
259 
260 
264  public cProtIntGenWithNoise
265 {
267 
268 public:
269 
270  cProtIntGenSmooth(int a_Seed, Underlying a_Underlying):
271  Super(a_Seed),
272  m_Underlying(std::move(a_Underlying))
273  {
274  }
275 
276 
277  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
278  {
279  // Generate the underlying values:
280  size_t lowerSizeX = a_SizeX + 2;
281  size_t lowerSizeZ = a_SizeZ + 2;
282  ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
283  int lowerData[m_BufferSize];
284  m_Underlying->GetInts(a_MinX - 1, a_MinZ - 1, lowerSizeX, lowerSizeZ, lowerData);
285 
286  // Smooth - for each square check if the surroundings are the same, if so, expand them diagonally.
287  // Also get rid of single-pixel irregularities (A-B-A):
288  for (size_t z = 0; z < a_SizeZ; z++)
289  {
290  int NoiseZ = a_MinZ + static_cast<int>(z);
291  for (size_t x = 0; x < a_SizeX; x++)
292  {
293  int val = lowerData[x + 1 + (z + 1) * lowerSizeX];
294  int above = lowerData[x + 1 + z * lowerSizeX];
295  int below = lowerData[x + 1 + (z + 2) * lowerSizeX];
296  int left = lowerData[x + (z + 1) * lowerSizeX];
297  int right = lowerData[x + 2 + (z + 1) * lowerSizeX];
298 
299  if ((left == right) && (above == below))
300  {
301  if (((Super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ) / 7) % 2) == 0)
302  {
303  val = left;
304  }
305  else
306  {
307  val = above;
308  }
309  }
310  else
311  {
312  if (left == right)
313  {
314  val = left;
315  }
316 
317  if (above == below)
318  {
319  val = above;
320  }
321  }
322 
323  a_Values[x + z * a_SizeX] = val;
324  }
325  }
326  }
327 
328 protected:
330 };
331 
332 
333 
334 
335 
338  public cProtIntGen
339 {
341 
342 public:
343 
345  m_Underlying(std::move(a_Underlying))
346  {
347  }
348 
349 
350  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
351  {
352  // Generate the underlying values:
353  size_t lowerSizeX = a_SizeX + 1;
354  size_t lowerSizeZ = a_SizeZ + 1;
355  ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
356  int lowerData[m_BufferSize];
357  m_Underlying->GetInts(a_MinX, a_MinZ, lowerSizeX, lowerSizeZ, lowerData);
358 
359  // Average - add all 4 "neighbors" and divide by 4:
360  for (size_t z = 0; z < a_SizeZ; z++)
361  {
362  for (size_t x = 0; x < a_SizeX; x++)
363  {
364  size_t idxLower = x + lowerSizeX * z;
365  a_Values[x + a_SizeX * z] = (
366  lowerData[idxLower] + lowerData[idxLower + 1] +
367  lowerData[idxLower + lowerSizeX] + lowerData[idxLower + lowerSizeX + 1]
368  ) / 4;
369  }
370  }
371  }
372 
373 protected:
375 };
376 
377 
378 
379 
380 
383  public cProtIntGen
384 {
386 
387 public:
388 
390  m_Underlying(std::move(a_Underlying))
391  {
392  }
393 
394 
395  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
396  {
397  // Generate the underlying values:
398  size_t lowerSizeX = a_SizeX + 4;
399  size_t lowerSizeZ = a_SizeZ + 4;
400  ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
401  int lowerData[m_BufferSize];
402  m_Underlying->GetInts(a_MinX - 1, a_MinZ - 1, lowerSizeX, lowerSizeZ, lowerData);
403 
404  // Calculate the weighted average of all 16 "neighbors":
405  for (size_t z = 0; z < a_SizeZ; z++)
406  {
407  for (size_t x = 0; x < a_SizeX; x++)
408  {
409  size_t idxLower1 = x + lowerSizeX * z;
410  size_t idxLower2 = idxLower1 + lowerSizeX;
411  size_t idxLower3 = idxLower1 + 2 * lowerSizeX;
412  size_t idxLower4 = idxLower1 + 3 * lowerSizeX;
413  a_Values[x + a_SizeX * z] = (
414  1 * lowerData[idxLower1] + 2 * lowerData[idxLower1 + 1] + 2 * lowerData[idxLower1 + 2] + 1 * lowerData[idxLower1 + 3] +
415  2 * lowerData[idxLower2] + 32 * lowerData[idxLower2 + 1] + 32 * lowerData[idxLower2 + 2] + 2 * lowerData[idxLower2 + 3] +
416  2 * lowerData[idxLower3] + 32 * lowerData[idxLower3 + 1] + 32 * lowerData[idxLower3 + 2] + 2 * lowerData[idxLower3 + 3] +
417  1 * lowerData[idxLower4] + 2 * lowerData[idxLower4 + 1] + 2 * lowerData[idxLower4 + 2] + 1 * lowerData[idxLower4 + 3]
418  ) / 148;
419  }
420  }
421  }
422 
423 protected:
425 };
426 
427 
428 
429 
430 
432 template <int WeightCenter, int WeightCardinal, int WeightDiagonal>
434  public cProtIntGen
435 {
437 
438 public:
439 
441  m_Underlying(std::move(a_Underlying))
442  {
443  }
444 
445 
446  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
447  {
448  // Generate the underlying values:
449  size_t lowerSizeX = a_SizeX + 3;
450  size_t lowerSizeZ = a_SizeZ + 3;
451  ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
452  int lowerData[m_BufferSize];
453  m_Underlying->GetInts(a_MinX, a_MinZ, lowerSizeX, lowerSizeZ, lowerData);
454 
455  // Calculate the weighted average the neighbors:
456  for (size_t z = 0; z < a_SizeZ; z++)
457  {
458  for (size_t x = 0; x < a_SizeX; x++)
459  {
460  size_t idxLower1 = x + lowerSizeX * z;
461  size_t idxLower2 = idxLower1 + lowerSizeX;
462  size_t idxLower3 = idxLower1 + 2 * lowerSizeX;
463  a_Values[x + a_SizeX * z] = (
464  WeightDiagonal * lowerData[idxLower1] + WeightCardinal * lowerData[idxLower1 + 1] + WeightDiagonal * lowerData[idxLower1 + 2] +
465  WeightCardinal * lowerData[idxLower2] + WeightCenter * lowerData[idxLower2 + 1] + WeightCardinal * lowerData[idxLower2 + 2] +
466  WeightDiagonal * lowerData[idxLower3] + WeightCardinal * lowerData[idxLower3 + 1] + WeightDiagonal * lowerData[idxLower3 + 2]
467  ) / (4 * WeightDiagonal + 4 * WeightCardinal + WeightCenter);
468  }
469  }
470  }
471 
472 protected:
474 };
475 
476 
477 
478 
479 
482  public cProtIntGenWithNoise
483 {
485 
486 public:
487 
488  cProtIntGenRndChoice(int a_Seed, int a_ChancePct, int a_Min, int a_Range, Underlying a_Underlying):
489  Super(a_Seed),
490  m_ChancePct(a_ChancePct),
491  m_Min(a_Min),
492  m_Range(a_Range),
493  m_Underlying(std::move(a_Underlying))
494  {
495  }
496 
497 
498  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
499  {
500  // Generate the underlying values:
501  m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
502 
503  // Replace random values:
504  for (size_t z = 0; z < a_SizeZ; z++)
505  {
506  int BaseZ = a_MinZ + static_cast<int>(z);
507  for (size_t x = 0; x < a_SizeX; x++)
508  {
509  if (((Super::m_Noise.IntNoise2DInt(BaseZ, a_MinX + static_cast<int>(x)) / 13) % 101) < m_ChancePct)
510  {
511  a_Values[x + a_SizeX * z] = m_Min + (Super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), BaseZ) / 7) % m_Range;
512  }
513  } // for x
514  } // for z
515  }
516 
517 protected:
519  int m_Min;
520  int m_Range;
522 };
523 
524 
525 
526 
527 
530  public cProtIntGenWithNoise
531 {
533 
534 public:
535 
536  cProtIntGenAddRnd(int a_Seed, int a_HalfRange, Underlying a_Underlying):
537  Super(a_Seed),
538  m_Range(a_HalfRange * 2 + 1),
539  m_HalfRange(a_HalfRange),
540  m_Underlying(std::move(a_Underlying))
541  {
542  }
543 
544 
545  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
546  {
547  // Generate the underlying values:
548  m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
549 
550  // Add the random values:
551  for (size_t z = 0; z < a_SizeZ; z++)
552  {
553  int NoiseZ = a_MinZ + static_cast<int>(z);
554  for (size_t x = 0; x < a_SizeX; x++)
555  {
556  int noiseVal = ((Super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ) / 7) % m_Range) - m_HalfRange;
557  a_Values[x + z * a_SizeX] += noiseVal;
558  }
559  }
560  }
561 
562 protected:
563  int m_Range;
566 };
567 
568 
569 
570 
571 
574  public cProtIntGenWithNoise
575 {
577 
578 public:
579 
580  cProtIntGenRndAvg(int a_Seed, int a_AvgChancePct, Underlying a_Underlying):
581  Super(a_Seed),
582  m_AvgChancePct(a_AvgChancePct),
583  m_Underlying(std::move(a_Underlying))
584  {
585  }
586 
587 
588  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
589  {
590  // Generate the underlying values:
591  size_t lowerSizeX = a_SizeX + 2;
592  size_t lowerSizeZ = a_SizeZ + 2;
593  ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
594  int lowerData[m_BufferSize];
595  m_Underlying->GetInts(a_MinX - 1, a_MinZ - 1, lowerSizeX, lowerSizeZ, lowerData);
596 
597  // Average random values:
598  for (size_t z = 0; z < a_SizeZ; z++)
599  {
600  int NoiseZ = a_MinZ + static_cast<int>(z);
601  for (size_t x = 0; x < a_SizeX; x++)
602  {
603  size_t idxLower = x + 1 + lowerSizeX * (z + 1);
604  if (((Super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ) / 7) % 100) > m_AvgChancePct)
605  {
606  // Average the 4 neighbors:
607  a_Values[x + z * a_SizeX] = (
608  lowerData[idxLower - 1] + lowerData[idxLower + 1] +
609  lowerData[idxLower - lowerSizeX] + lowerData[idxLower + lowerSizeX]
610  ) / 4;
611  }
612  else
613  {
614  // Keep the underlying value:
615  a_Values[x + z * a_SizeX] = lowerData[idxLower];
616  }
617  }
618  }
619  }
620 
621 protected:
624 };
625 
626 
627 
628 
629 
632  public cProtIntGenWithNoise
633 {
635 
636 public:
637 
638  cProtIntGenRndBetween(int a_Seed, int a_AvgChancePct, Underlying a_Underlying):
639  Super(a_Seed),
640  m_AvgChancePct(a_AvgChancePct),
641  m_Underlying(std::move(a_Underlying))
642  {
643  }
644 
645 
646  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
647  {
648  // Generate the underlying values:
649  size_t lowerSizeX = a_SizeX + 2;
650  size_t lowerSizeZ = a_SizeZ + 2;
651  ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
652  int lowerData[m_BufferSize];
653  m_Underlying->GetInts(a_MinX - 1, a_MinZ - 1, lowerSizeX, lowerSizeZ, lowerData);
654 
655  // Average random values:
656  for (size_t z = 0; z < a_SizeZ; z++)
657  {
658  int NoiseZ = a_MinZ + static_cast<int>(z);
659  for (size_t x = 0; x < a_SizeX; x++)
660  {
661  size_t idxLower = x + 1 + lowerSizeX * (z + 1);
662  if (((Super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ) / 7) % 100) > m_AvgChancePct)
663  {
664  // Chose a value in between the min and max neighbor:
665  int min = std::min(std::min(lowerData[idxLower - 1], lowerData[idxLower + 1]), std::min(lowerData[idxLower - lowerSizeX], lowerData[idxLower + lowerSizeX]));
666  int max = std::max(std::max(lowerData[idxLower - 1], lowerData[idxLower + 1]), std::max(lowerData[idxLower - lowerSizeX], lowerData[idxLower + lowerSizeX]));
667  a_Values[x + z * a_SizeX] = min + ((Super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ + 10) / 7) % (max - min + 1));
668  }
669  else
670  {
671  // Keep the underlying value:
672  a_Values[x + z * a_SizeX] = lowerData[idxLower];
673  }
674  }
675  }
676  }
677 
678 protected:
681 };
682 
683 
684 
685 
686 
689  public cProtIntGen
690 {
692 
693 public:
694 
696  m_Underlying(std::move(a_Underlying))
697  {
698  }
699 
700 
701  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
702  {
703  // Map for biome -> its beach:
704  static const int ToBeach[] =
705  {
706  /* biOcean */ biOcean,
707  /* biPlains */ biBeach,
708  /* biDesert */ biBeach,
709  /* biExtremeHills */ biStoneBeach,
710  /* biForest */ biBeach,
711  /* biTaiga */ biColdBeach,
712  /* biSwampland */ biSwampland,
713  /* biRiver */ biRiver,
714  /* biNether */ biNether,
715  /* biEnd */ biEnd,
716  /* biFrozenOcean */ biColdBeach,
717  /* biFrozenRiver */ biColdBeach,
718  /* biIcePlains */ biColdBeach,
719  /* biIceMountains */ biColdBeach,
720  /* biMushroomIsland */ biMushroomShore,
721  /* biMushroomShore */ biMushroomShore,
722  /* biBeach */ biBeach,
723  /* biDesertHills */ biBeach,
724  /* biForestHills */ biBeach,
725  /* biTaigaHills */ biColdBeach,
726  /* biExtremeHillsEdge */ biStoneBeach,
727  /* biJungle */ biBeach,
728  /* biJungleHills */ biBeach,
729  /* biJungleEdge */ biBeach,
730  /* biDeepOcean */ biOcean,
731  /* biStoneBeach */ biStoneBeach,
732  /* biColdBeach */ biColdBeach,
733  /* biBirchForest */ biBeach,
734  /* biBirchForestHills */ biBeach,
735  /* biRoofedForest */ biBeach,
736  /* biColdTaiga */ biColdBeach,
737  /* biColdTaigaHills */ biColdBeach,
738  /* biMegaTaiga */ biStoneBeach,
739  /* biMegaTaigaHills */ biStoneBeach,
740  /* biExtremeHillsPlus */ biStoneBeach,
741  /* biSavanna */ biBeach,
742  /* biSavannaPlateau */ biBeach,
743  /* biMesa */ biMesa,
744  /* biMesaPlateauF */ biMesa,
745  /* biMesaPlateau */ biMesa,
746  };
747 
748  // Generate the underlying values:
749  size_t lowerSizeX = a_SizeX + 2;
750  size_t lowerSizeZ = a_SizeZ + 2;
751  ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
752  int lowerValues[m_BufferSize];
753  m_Underlying->GetInts(a_MinX - 1, a_MinZ - 1, lowerSizeX, lowerSizeZ, lowerValues);
754 
755  // Add beaches between ocean and biomes:
756  for (size_t z = 0; z < a_SizeZ; z++)
757  {
758  for (size_t x = 0; x < a_SizeX; x++)
759  {
760  int val = lowerValues[x + 1 + (z + 1) * lowerSizeX];
761  int above = lowerValues[x + 1 + z * lowerSizeX];
762  int below = lowerValues[x + 1 + (z + 2) * lowerSizeX];
763  int left = lowerValues[x + (z + 1) * lowerSizeX];
764  int right = lowerValues[x + 2 + (z + 1) * lowerSizeX];
765  if (!IsBiomeOcean(val))
766  {
767  if (IsBiomeOcean(above) || IsBiomeOcean(below) || IsBiomeOcean(left) || IsBiomeOcean(right))
768  {
769  // First convert the value to a regular biome (drop the M flag), then modulo by our biome count:
770  val = ToBeach[static_cast<size_t>(val % 128) % ARRAYCOUNT(ToBeach)];
771  }
772  }
773  a_Values[x + z * a_SizeX] = val;
774  }
775  }
776  }
777 
778 protected:
780 };
781 
782 
783 
784 
785 
789  public cProtIntGenWithNoise
790 {
792 
793 public:
794 
795  using Underlying = std::shared_ptr<cProtIntGen>;
796 
797 
798  cProtIntGenAddIslands(int a_Seed, int a_Chance, Underlying a_Underlying):
799  Super(a_Seed),
800  m_Chance(a_Chance),
801  m_Underlying(std::move(a_Underlying))
802  {
803  }
804 
805 
806  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
807  {
808  m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
809  for (size_t z = 0; z < a_SizeZ; z++)
810  {
811  for (size_t x = 0; x < a_SizeX; x++)
812  {
813  if (a_Values[x + z * a_SizeX] == bgOcean)
814  {
815  int rnd = Super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), a_MinZ + static_cast<int>(z)) / 7;
816  if (rnd % 1000 < m_Chance)
817  {
818  a_Values[x + z * a_SizeX] = (rnd / 1003) % bgLandOceanMax;
819  }
820  }
821  }
822  }
823  }
824 
825 protected:
827  int m_Chance;
828 
830 };
831 
832 
833 
834 
835 
838  public cProtIntGen
839 {
841 
842 public:
843 
845  m_Underlying(std::move(a_Underlying))
846  {
847  }
848 
849 
850  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override
851  {
852  // Generate the underlying biome groups:
853  size_t lowerSizeX = a_SizeX + 2;
854  size_t lowerSizeZ = a_SizeZ + 2;
855  ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
856  int lowerValues[m_BufferSize];
857  m_Underlying->GetInts(a_MinX, a_MinZ, lowerSizeX, lowerSizeZ, lowerValues);
858 
859  // Change the biomes on incompatible edges into an edge biome:
860  for (size_t z = 0; z < a_SizeZ; z++)
861  {
862  for (size_t x = 0; x < a_SizeX; x++)
863  {
864  int val = lowerValues[x + 1 + (z + 1) * lowerSizeX];
865  int Above = lowerValues[x + 1 + z * lowerSizeX];
866  int Below = lowerValues[x + 1 + (z + 2) * lowerSizeX];
867  int Left = lowerValues[x + (z + 1) * lowerSizeX];
868  int Right = lowerValues[x + 2 + (z + 1) * lowerSizeX];
869  switch (val)
870  {
871  // Desert should neighbor only oceans, desert and temperates; change to temperate when another:
872  case bgDesert:
873  {
874  if (
875  !isDesertCompatible(Above) ||
876  !isDesertCompatible(Below) ||
877  !isDesertCompatible(Left) ||
878  !isDesertCompatible(Right)
879  )
880  {
881  val = bgTemperate;
882  }
883  break;
884  } // case bgDesert
885 
886  // Ice should not neighbor deserts; change to temperate:
887  case bgIce:
888  {
889  if (
890  (Above == bgDesert) ||
891  (Below == bgDesert) ||
892  (Left == bgDesert) ||
893  (Right == bgDesert)
894  )
895  {
896  val = bgTemperate;
897  }
898  break;
899  } // case bgIce
900  }
901  a_Values[x + z * a_SizeX] = val;
902  } // for x
903  } // for z
904  }
905 
906 protected:
908 
909 
910  inline bool isDesertCompatible(int a_BiomeGroup)
911  {
912  switch (a_BiomeGroup)
913  {
914  case bgOcean:
915  case bgDesert:
916  case bgTemperate:
917  {
918  return true;
919  }
920  default:
921  {
922  return false;
923  }
924  }
925  }
926 };
927 
928 
929 
930 
931 
936  public cProtIntGenWithNoise
937 {
939 
940 public:
941 
942  cProtIntGenBiomes(int a_Seed, Underlying a_Underlying):
943  Super(a_Seed),
944  m_Underlying(std::move(a_Underlying))
945  {
946  }
947 
948 
949  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
950  {
951  // Define the per-biome-group biomes:
952  static const int oceanBiomes[] =
953  {
954  biOcean, // biDeepOcean,
955  };
956 
957  // Same as oceanBiomes, there are no rare oceanic biomes (mushroom islands are handled separately)
958  static const int rareOceanBiomes[] =
959  {
960  biOcean,
961  };
962 
963  static const int desertBiomes[] =
964  {
966  };
967 
968  static const int rareDesertBiomes[] =
969  {
971  };
972 
973  static const int temperateBiomes[] =
974  {
976  };
977 
978  static const int rareTemperateBiomes[] =
979  {
980  biJungle, // Jungle is not strictly temperate, but let's piggyback it here
981  };
982 
983  static const int mountainBiomes[] =
984  {
986  };
987 
988  static const int rareMountainBiomes[] =
989  {
990  biMegaTaiga,
991  };
992 
993  static const int iceBiomes[] =
994  {
996  };
997 
998  // Same as iceBiomes, there's no rare ice biome
999  static const int rareIceBiomes[] =
1000  {
1002  };
1003 
1004  static const cBiomesInGroups biomesInGroups[] =
1005  {
1006  /* bgOcean */ { static_cast<int>(ARRAYCOUNT(oceanBiomes)), oceanBiomes},
1007  /* bgDesert */ { static_cast<int>(ARRAYCOUNT(desertBiomes)), desertBiomes},
1008  /* bgTemperate */ { static_cast<int>(ARRAYCOUNT(temperateBiomes)), temperateBiomes},
1009  /* bgMountains */ { static_cast<int>(ARRAYCOUNT(mountainBiomes)), mountainBiomes},
1010  /* bgIce */ { static_cast<int>(ARRAYCOUNT(iceBiomes)), iceBiomes},
1011  };
1012 
1013  static const cBiomesInGroups rareBiomesInGroups[] =
1014  {
1015  /* bgOcean */ { static_cast<int>(ARRAYCOUNT(rareOceanBiomes)), rareOceanBiomes},
1016  /* bgDesert */ { static_cast<int>(ARRAYCOUNT(rareDesertBiomes)), rareDesertBiomes},
1017  /* bgTemperate */ { static_cast<int>(ARRAYCOUNT(rareTemperateBiomes)), rareTemperateBiomes},
1018  /* bgMountains */ { static_cast<int>(ARRAYCOUNT(rareMountainBiomes)), rareMountainBiomes},
1019  /* bgIce */ { static_cast<int>(ARRAYCOUNT(rareIceBiomes)), rareIceBiomes},
1020  };
1021 
1022  // Generate the underlying values, representing biome groups:
1023  m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
1024 
1025  // Overwrite each biome group with a random biome from that group:
1026  // Take care of the bgfRare flag
1027  for (size_t z = 0; z < a_SizeZ; z++)
1028  {
1029  size_t IdxZ = z * a_SizeX;
1030  for (size_t x = 0; x < a_SizeX; x++)
1031  {
1032  int val = a_Values[x + IdxZ];
1033  const cBiomesInGroups & Biomes = (val > bgfRare) ?
1034  rareBiomesInGroups[(val & (bgfRare - 1)) % ARRAYCOUNT(rareBiomesInGroups)] :
1035  biomesInGroups[static_cast<size_t>(val) % ARRAYCOUNT(biomesInGroups)];
1036  int rnd = (Super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7);
1037  a_Values[x + IdxZ] = Biomes.Biomes[rnd % Biomes.Count];
1038  }
1039  }
1040  }
1041 
1042 protected:
1043 
1045  {
1046  const int Count;
1047  const int * Biomes;
1048  };
1049 
1050 
1053 };
1054 
1055 
1056 
1057 
1058 
1061  public cProtIntGenWithNoise
1062 {
1064 
1065 public:
1066 
1067  using Underlying = std::shared_ptr<cProtIntGen>;
1068 
1069 
1070  cProtIntGenReplaceRandomly(int a_Seed, int a_From, int a_To, int a_Chance, Underlying a_Underlying):
1071  Super(a_Seed),
1072  m_From(a_From),
1073  m_To(a_To),
1074  m_Chance(a_Chance),
1075  m_Underlying(std::move(a_Underlying))
1076  {
1077  }
1078 
1079 
1080  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
1081  {
1082  // Generate the underlying values:
1083  m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
1084 
1085  // Replace some of the values:
1086  for (size_t z = 0; z < a_SizeZ; z++)
1087  {
1088  size_t idxZ = z * a_SizeX;
1089  for (size_t x = 0; x < a_SizeX; x++)
1090  {
1091  size_t idx = x + idxZ;
1092  if (a_Values[idx] == m_From)
1093  {
1094  int rnd = Super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7;
1095  if (rnd % 1000 < m_Chance)
1096  {
1097  a_Values[idx] = m_To;
1098  }
1099  }
1100  }
1101  } // for z
1102  }
1103 
1104 
1105 protected:
1107  int m_From;
1108 
1110  int m_To;
1111 
1114 
1116 };
1117 
1118 
1119 
1120 
1121 
1127  public cProtIntGen
1128 {
1130 
1131 public:
1132 
1134  m_Biomes(std::move(a_Biomes)),
1135  m_Rivers(std::move(a_Rivers))
1136  {
1137  }
1138 
1139 
1140  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
1141  {
1142  // Generate the underlying data:
1143  ASSERT(a_SizeX * a_SizeZ <= m_BufferSize);
1144  m_Biomes->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
1145  int riverData[m_BufferSize];
1146  m_Rivers->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, riverData);
1147 
1148  // Mix the values:
1149  for (size_t z = 0; z < a_SizeZ; z++)
1150  {
1151  size_t idxZ = z * a_SizeX;
1152  for (size_t x = 0; x < a_SizeX; x++)
1153  {
1154  size_t idx = x + idxZ;
1155  if (IsBiomeOcean(a_Values[idx]))
1156  {
1157  // Oceans are kept without any changes
1158  continue;
1159  }
1160  if (riverData[idx] != biRiver)
1161  {
1162  // There's no river, keep the current value
1163  continue;
1164  }
1165 
1166  // There's a river, change the output to a river or a frozen river, based on the original biome:
1167  if (IsBiomeVeryCold(static_cast<EMCSBiome>(a_Values[idx])))
1168  {
1169  a_Values[idx] = biFrozenRiver;
1170  }
1171  else
1172  {
1173  a_Values[idx] = biRiver;
1174  }
1175  } // for x
1176  } // for z
1177  }
1178 
1179 protected:
1182 };
1183 
1184 
1185 
1186 
1187 
1192  public cProtIntGenWithNoise
1193 {
1195 
1196 public:
1197 
1198  cProtIntGenRiver(int a_Seed, Underlying a_Underlying):
1199  Super(a_Seed),
1200  m_Underlying(std::move(a_Underlying))
1201  {
1202  }
1203 
1204 
1205  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
1206  {
1207  // Generate the underlying data:
1208  size_t lowerSizeX = a_SizeX + 2;
1209  size_t lowerSizeZ = a_SizeZ + 2;
1210  ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
1211  int lowerValues[m_BufferSize];
1212  m_Underlying->GetInts(a_MinX - 1, a_MinZ - 1, lowerSizeX, lowerSizeZ, lowerValues);
1213 
1214  // Detect the edges:
1215  for (size_t z = 0; z < a_SizeZ; z++)
1216  {
1217  for (size_t x = 0; x < a_SizeX; x++)
1218  {
1219  int Above = lowerValues[x + 1 + z * lowerSizeX];
1220  int Below = lowerValues[x + 1 + (z + 2) * lowerSizeX];
1221  int Left = lowerValues[x + (z + 1) * lowerSizeX];
1222  int Right = lowerValues[x + 2 + (z + 1) * lowerSizeX];
1223  int val = lowerValues[x + 1 + (z + 1) * lowerSizeX];
1224 
1225  if ((val == Above) && (val == Below) && (val == Left) && (val == Right))
1226  {
1227  val = 0;
1228  }
1229  else
1230  {
1231  val = biRiver;
1232  }
1233  a_Values[x + z * a_SizeX] = val;
1234  } // for x
1235  } // for z
1236  }
1237 
1238 protected:
1240 };
1241 
1242 
1243 
1244 
1245 
1249  public cProtIntGenWithNoise
1250 {
1252 
1253 public:
1254 
1255  cProtIntGenAddToOcean(int a_Seed, int a_Chance, int a_ToValue, Underlying a_Underlying):
1256  Super(a_Seed),
1257  m_Chance(a_Chance),
1258  m_ToValue(a_ToValue),
1259  m_Underlying(std::move(a_Underlying))
1260  {
1261  }
1262 
1263 
1264  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
1265  {
1266  // Generate the underlying data:
1267  size_t lowerSizeX = a_SizeX + 2;
1268  size_t lowerSizeZ = a_SizeZ + 2;
1269  ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
1270  int lowerValues[m_BufferSize];
1271  m_Underlying->GetInts(a_MinX - 1, a_MinZ - 1, lowerSizeX, lowerSizeZ, lowerValues);
1272 
1273  // Add the mushroom islands:
1274  for (size_t z = 0; z < a_SizeZ; z++)
1275  {
1276  for (size_t x = 0; x < a_SizeX; x++)
1277  {
1278  int val = lowerValues[x + 1 + (z + 1) * lowerSizeX];
1279  if (!IsBiomeOcean(val))
1280  {
1281  a_Values[x + z * a_SizeX] = val;
1282  continue;
1283  }
1284 
1285  // Count the ocean neighbors:
1286  int Above = lowerValues[x + 1 + z * lowerSizeX];
1287  int Below = lowerValues[x + 1 + (z + 2) * lowerSizeX];
1288  int Left = lowerValues[x + (z + 1) * lowerSizeX];
1289  int Right = lowerValues[x + 2 + (z + 1) * lowerSizeX];
1290  int NumOceanNeighbors = 0;
1291  if (IsBiomeOcean(Above))
1292  {
1293  NumOceanNeighbors += 1;
1294  }
1295  if (IsBiomeOcean(Below))
1296  {
1297  NumOceanNeighbors += 1;
1298  }
1299  if (IsBiomeOcean(Left))
1300  {
1301  NumOceanNeighbors += 1;
1302  }
1303  if (IsBiomeOcean(Right))
1304  {
1305  NumOceanNeighbors += 1;
1306  }
1307 
1308  // If at least 3 ocean neighbors and the chance is right, change:
1309  if (
1310  (NumOceanNeighbors >= 3) &&
1311  ((Super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7) % 1000 < m_Chance)
1312  )
1313  {
1314  a_Values[x + z * a_SizeX] = m_ToValue;
1315  }
1316  else
1317  {
1318  a_Values[x + z * a_SizeX] = val;
1319  }
1320  } // for x
1321  } // for z
1322  }
1323 
1324 protected:
1327 
1330 
1332 };
1333 
1334 
1335 
1336 
1337 
1340  public cProtIntGenWithNoise
1341 {
1343 
1344 public:
1345 
1346  cProtIntGenSetRandomly(int a_Seed, int a_Chance, int a_ToValue, Underlying a_Underlying):
1347  Super(a_Seed),
1348  m_Chance(a_Chance),
1349  m_ToValue(a_ToValue),
1350  m_Underlying(std::move(a_Underlying))
1351  {
1352  }
1353 
1354 
1355  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
1356  {
1357  // Generate the underlying data:
1358  m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
1359 
1360  // Change random pixels to bgOcean:
1361  for (size_t z = 0; z < a_SizeZ; z++)
1362  {
1363  for (size_t x = 0; x < a_SizeX; x++)
1364  {
1365  int rnd = Super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7;
1366  if (rnd % 1000 < m_Chance)
1367  {
1368  a_Values[x + z * a_SizeX] = m_ToValue;
1369  }
1370  }
1371  }
1372  }
1373 
1374 protected:
1377 
1380 
1382 };
1383 
1384 
1385 
1386 
1387 
1390  public cProtIntGenWithNoise
1391 {
1393 
1394 public:
1395 
1396  cProtIntGenRareBiomeGroups(int a_Seed, int a_Chance, Underlying a_Underlying):
1397  Super(a_Seed),
1398  m_Chance(a_Chance),
1399  m_Underlying(std::move(a_Underlying))
1400  {
1401  }
1402 
1403 
1404  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
1405  {
1406  // Generate the underlying data:
1407  m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
1408 
1409  // Change some of the biome groups into rare biome groups:
1410  for (size_t z = 0; z < a_SizeZ; z++)
1411  {
1412  for (size_t x = 0; x < a_SizeX; x++)
1413  {
1414  int rnd = Super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7;
1415  if (rnd % 1000 < m_Chance)
1416  {
1417  size_t idx = x + a_SizeX * z;
1418  a_Values[idx] = a_Values[idx] | bgfRare;
1419  }
1420  }
1421  }
1422  }
1423 
1424 protected:
1427 
1430 };
1431 
1432 
1433 
1434 
1435 
1439  public cProtIntGenWithNoise
1440 {
1442 
1443 public:
1444 
1445  cProtIntGenAlternateBiomes(int a_Seed, Underlying a_Alterations, Underlying a_BaseBiomes):
1446  Super(a_Seed),
1447  m_Alterations(std::move(a_Alterations)),
1448  m_BaseBiomes(std::move(a_BaseBiomes))
1449  {
1450  }
1451 
1452 
1453  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
1454  {
1455  // Generate the base biomes and the alterations:
1456  m_BaseBiomes->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
1457  int alterations[m_BufferSize];
1458  m_Alterations->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, alterations);
1459 
1460  // Change the biomes into their alternate versions:
1461  size_t len = a_SizeX * a_SizeZ;
1462  for (size_t idx = 0; idx < len; ++idx)
1463  {
1464  if (alterations[idx] == 0)
1465  {
1466  // No change
1467  continue;
1468  }
1469 
1470  // Change to alternate biomes:
1471  int val = a_Values[idx];
1472  switch (val)
1473  {
1474  case biBirchForest: val = biBirchForestHills; break;
1475  case biDesert: val = biDesertHills; break;
1476  case biExtremeHills: val = biExtremeHillsPlus; break;
1477  case biForest: val = biForestHills; break;
1478  case biIcePlains: val = biIceMountains; break;
1479  case biJungle: val = biJungleHills; break;
1480  case biMegaTaiga: val = biMegaTaigaHills; break;
1481  case biMesaPlateau: val = biMesa; break;
1482  case biMesaPlateauF: val = biMesa; break;
1483  case biMesaPlateauM: val = biMesa; break;
1484  case biMesaPlateauFM: val = biMesa; break;
1485  case biPlains: val = biForest; break;
1486  case biRoofedForest: val = biPlains; break;
1487  case biSavanna: val = biSavannaPlateau; break;
1488  case biTaiga: val = biTaigaHills; break;
1489  }
1490  a_Values[idx] = val;
1491  } // for idx - a_Values[]
1492  }
1493 
1494 protected:
1497 };
1498 
1499 
1500 
1501 
1502 
1505  public cProtIntGenWithNoise
1506 {
1508 
1509 public:
1510 
1511  cProtIntGenBiomeEdges(int a_Seed, Underlying a_Underlying):
1512  Super(a_Seed),
1513  m_Underlying(std::move(a_Underlying))
1514  {
1515  }
1516 
1517 
1518  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
1519  {
1520  // Generate the underlying biomes:
1521  size_t lowerSizeX = a_SizeX + 2;
1522  size_t lowerSizeZ = a_SizeZ + 2;
1523  ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
1524  int lowerValues[m_BufferSize];
1525  m_Underlying->GetInts(a_MinX - 1, a_MinZ - 1, lowerSizeX, lowerSizeZ, lowerValues);
1526 
1527  // Convert incompatible edges into neutral biomes:
1528  for (size_t z = 0; z < a_SizeZ; z++)
1529  {
1530  for (size_t x = 0; x < a_SizeX; x++)
1531  {
1532  int biome = lowerValues[x + 1 + (z + 1) * lowerSizeX];
1533  int above = lowerValues[x + 1 + z * lowerSizeX];
1534  int below = lowerValues[x + 1 + (z + 2) * lowerSizeX];
1535  int left = lowerValues[x + (z + 1) * lowerSizeX];
1536  int right = lowerValues[x + 2 + (z + 1) * lowerSizeX];
1537 
1538  switch (biome)
1539  {
1540  case biDesert:
1541  case biDesertM:
1542  case biDesertHills:
1543  {
1544  if (
1545  IsBiomeVeryCold(static_cast<EMCSBiome>(above)) ||
1546  IsBiomeVeryCold(static_cast<EMCSBiome>(below)) ||
1547  IsBiomeVeryCold(static_cast<EMCSBiome>(left)) ||
1548  IsBiomeVeryCold(static_cast<EMCSBiome>(right))
1549  )
1550  {
1551  biome = biPlains;
1552  }
1553  break;
1554  } // case biDesert
1555 
1556  case biMesaPlateau:
1557  case biMesaPlateauF:
1558  case biMesaPlateauFM:
1559  case biMesaPlateauM:
1560  {
1561  if (
1562  !isMesaCompatible(above) ||
1563  !isMesaCompatible(below) ||
1564  !isMesaCompatible(left) ||
1565  !isMesaCompatible(right)
1566  )
1567  {
1568  biome = biDesert;
1569  }
1570  break;
1571  } // Mesa biomes
1572 
1573  case biJungle:
1574  case biJungleM:
1575  {
1576  if (
1577  !isJungleCompatible(above) ||
1578  !isJungleCompatible(below) ||
1579  !isJungleCompatible(left) ||
1580  !isJungleCompatible(right)
1581  )
1582  {
1583  biome = (biome == biJungle) ? biJungleEdge : biJungleEdgeM;
1584  }
1585  break;
1586  } // Jungle biomes
1587 
1588  case biSwampland:
1589  case biSwamplandM:
1590  {
1591  if (
1592  IsBiomeNoDownfall(static_cast<EMCSBiome>(above)) ||
1593  IsBiomeNoDownfall(static_cast<EMCSBiome>(below)) ||
1594  IsBiomeNoDownfall(static_cast<EMCSBiome>(left)) ||
1595  IsBiomeNoDownfall(static_cast<EMCSBiome>(right))
1596  )
1597  {
1598  biome = biPlains;
1599  }
1600  break;
1601  } // Swampland biomes
1602  } // switch (biome)
1603 
1604  a_Values[x + z * a_SizeX] = biome;
1605  } // for x
1606  } // for z
1607  }
1608 
1609 
1610 protected:
1612 
1613 
1614  bool isMesaCompatible(int a_Biome)
1615  {
1616  switch (a_Biome)
1617  {
1618  case biDesert:
1619  case biMesa:
1620  case biMesaBryce:
1621  case biMesaPlateau:
1622  case biMesaPlateauF:
1623  case biMesaPlateauFM:
1624  case biMesaPlateauM:
1625  case biOcean:
1626  case biDeepOcean:
1627  {
1628  return true;
1629  }
1630  default:
1631  {
1632  return false;
1633  }
1634  }
1635  }
1636 
1637 
1638  bool isJungleCompatible(int a_Biome)
1639  {
1640  switch (a_Biome)
1641  {
1642  case biJungle:
1643  case biJungleM:
1644  case biJungleEdge:
1645  case biJungleEdgeM:
1646  case biJungleHills:
1647  {
1648  return true;
1649  }
1650  default:
1651  {
1652  return false;
1653  }
1654  }
1655  }
1656 };
1657 
1658 
1659 
1660 
1661 
1665  public cProtIntGenWithNoise
1666 {
1668 
1669 public:
1670 
1671  cProtIntGenMBiomes(int a_Seed, Underlying a_Alteration, Underlying a_Underlying):
1672  Super(a_Seed),
1673  m_Underlying(std::move(a_Underlying)),
1674  m_Alteration(std::move(a_Alteration))
1675  {
1676  }
1677 
1678 
1679  virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
1680  {
1681  // Generate the underlying biomes and the alterations:
1682  m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
1683  int alterations[m_BufferSize];
1684  m_Alteration->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, alterations);
1685 
1686  // Wherever alterations are nonzero, change into alternate biome, if available:
1687  size_t len = a_SizeX * a_SizeZ;
1688  for (size_t idx = 0; idx < len; ++idx)
1689  {
1690  if (alterations[idx] == 0)
1691  {
1692  continue;
1693  }
1694 
1695  // Ice spikes biome was removed from here, because it was generated way too often
1696  switch (a_Values[idx])
1697  {
1698  case biPlains: a_Values[idx] = biSunflowerPlains; break;
1699  case biDesert: a_Values[idx] = biDesertM; break;
1700  case biExtremeHills: a_Values[idx] = biExtremeHillsM; break;
1701  case biForest: a_Values[idx] = biFlowerForest; break;
1702  case biTaiga: a_Values[idx] = biTaigaM; break;
1703  case biSwampland: a_Values[idx] = biSwamplandM; break;
1704  case biJungle: a_Values[idx] = biJungleM; break;
1705  case biJungleEdge: a_Values[idx] = biJungleEdgeM; break;
1706  case biBirchForest: a_Values[idx] = biBirchForestM; break;
1707  case biBirchForestHills: a_Values[idx] = biBirchForestHillsM; break;
1708  case biRoofedForest: a_Values[idx] = biRoofedForestM; break;
1709  case biColdTaiga: a_Values[idx] = biColdTaigaM; break;
1710  case biMegaSpruceTaiga: a_Values[idx] = biMegaSpruceTaiga; break;
1711  case biMegaSpruceTaigaHills: a_Values[idx] = biMegaSpruceTaigaHills; break;
1712  case biExtremeHillsPlus: a_Values[idx] = biExtremeHillsPlusM; break;
1713  case biSavanna: a_Values[idx] = biSavannaM; break;
1714  case biSavannaPlateau: a_Values[idx] = biSavannaPlateauM; break;
1715  case biMesa: a_Values[idx] = biMesaBryce; break;
1716  case biMesaPlateauF: a_Values[idx] = biMesaPlateauFM; break;
1717  case biMesaPlateau: a_Values[idx] = biMesaBryce; break;
1718  }
1719  } // for idx - a_Values[] / alterations[]
1720  }
1721 
1722 protected:
1725 };
1726 
1727 
1728 
1729 
bool IsBiomeNoDownfall(EMCSBiome a_Biome)
Returns true if the biome has no downfall - deserts and savannas.
Definition: BiomeDef.cpp:142
bool IsBiomeVeryCold(EMCSBiome a_Biome)
Returns true if the biome is very cold (has snow on ground everywhere, turns top water to ice,...
Definition: BiomeDef.cpp:169
bool IsBiomeOcean(int a_Biome)
Returns true if the biome is an ocean biome.
Definition: BiomeDef.h:135
EMCSBiome
Biome IDs The first batch corresponds to the clientside biomes, used by MineCraft.
Definition: BiomeDef.h:18
@ biJungleEdge
Definition: BiomeDef.h:50
@ biIceMountains
Definition: BiomeDef.h:38
@ biMesa
Definition: BiomeDef.h:64
@ biMesaPlateau
Definition: BiomeDef.h:66
@ biExtremeHillsM
Definition: BiomeDef.h:79
@ biForestHills
Definition: BiomeDef.h:43
@ biNether
Definition: BiomeDef.h:31
@ biBirchForest
Definition: BiomeDef.h:54
@ biBirchForestM
Definition: BiomeDef.h:86
@ biDesert
Definition: BiomeDef.h:24
@ biMesaPlateauF
Definition: BiomeDef.h:65
@ biSunflowerPlains
Definition: BiomeDef.h:77
@ biExtremeHillsPlusM
Definition: BiomeDef.h:92
@ biFlowerForest
Definition: BiomeDef.h:80
@ biMegaSpruceTaiga
Definition: BiomeDef.h:90
@ biStoneBeach
Definition: BiomeDef.h:52
@ biMushroomShore
Definition: BiomeDef.h:40
@ biSavanna
Definition: BiomeDef.h:62
@ biTaigaHills
Definition: BiomeDef.h:44
@ biExtremeHillsPlus
Definition: BiomeDef.h:61
@ biJungle
Definition: BiomeDef.h:46
@ biMegaTaiga
Definition: BiomeDef.h:59
@ biJungleHills
Definition: BiomeDef.h:47
@ biOcean
Definition: BiomeDef.h:22
@ biDesertHills
Definition: BiomeDef.h:42
@ biBeach
Definition: BiomeDef.h:41
@ biForest
Definition: BiomeDef.h:26
@ biJungleEdgeM
Definition: BiomeDef.h:85
@ biTaigaM
Definition: BiomeDef.h:81
@ biBirchForestHillsM
Definition: BiomeDef.h:87
@ biJungleM
Definition: BiomeDef.h:84
@ biFrozenRiver
Definition: BiomeDef.h:35
@ biRiver
Definition: BiomeDef.h:29
@ biMesaPlateauFM
Definition: BiomeDef.h:96
@ biDeepOcean
Definition: BiomeDef.h:51
@ biSavannaPlateauM
Definition: BiomeDef.h:94
@ biMesaBryce
Definition: BiomeDef.h:95
@ biPlains
Definition: BiomeDef.h:23
@ biRoofedForestM
Definition: BiomeDef.h:88
@ biBirchForestHills
Definition: BiomeDef.h:55
@ biColdBeach
Definition: BiomeDef.h:53
@ biMegaSpruceTaigaHills
Definition: BiomeDef.h:91
@ biSavannaM
Definition: BiomeDef.h:93
@ biSwamplandM
Definition: BiomeDef.h:82
@ biEnd
Definition: BiomeDef.h:33
@ biExtremeHills
Definition: BiomeDef.h:25
@ biColdTaiga
Definition: BiomeDef.h:57
@ biMegaTaigaHills
Definition: BiomeDef.h:60
@ biRoofedForest
Definition: BiomeDef.h:56
@ biIcePlains
Definition: BiomeDef.h:36
@ biTaiga
Definition: BiomeDef.h:27
@ biDesertM
Definition: BiomeDef.h:78
@ biSavannaPlateau
Definition: BiomeDef.h:63
@ biMesaPlateauM
Definition: BiomeDef.h:97
@ biColdTaigaM
Definition: BiomeDef.h:89
@ biSwampland
Definition: BiomeDef.h:28
const int bgDesert
Definition: IntGen.h:41
const int bgfRare
Definition: IntGen.h:46
const int bgIce
Definition: IntGen.h:44
const int bgOcean
Constants representing the biome group designators.
Definition: IntGen.h:40
const int bgTemperate
Definition: IntGen.h:42
const int bgLandOceanMax
Definition: IntGen.h:45
#define PROT_INT_BUFFER_SIZE
Maximum size of the generated area.
Definition: ProtIntGen.h:36
#define ARRAYCOUNT(X)
Evaluates to the number of elements in an array (compile-time!)
Definition: Globals.h:231
#define ASSERT(x)
Definition: Globals.h:276
Definition: FastNBT.h:132
Interface that all the generator classes provide.
Definition: ProtIntGen.h:45
virtual ~cProtIntGen()
Force a virtual destructor in all descendants.
Definition: ProtIntGen.h:59
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values)=0
Generates the array of specified size into a_Values, based on given min coords.
std::shared_ptr< cProtIntGen > Underlying
Type of the generic interface used for storing links to the underlying generators.
Definition: ProtIntGen.h:54
static const int m_BufferSize
Maximum size of the generated area.
Definition: ProtIntGen.h:49
Provides additional cNoise member and its helper functions.
Definition: ProtIntGen.h:72
int chooseRandomOne(int a_RndX, int a_RndZ, int a_Val1, int a_Val2)
Chooses one of a_Val1 or a_Val2, based on m_Noise and the coordinates for querying the noise.
Definition: ProtIntGen.h:86
cProtIntGenWithNoise(int a_Seed)
Definition: ProtIntGen.h:77
int chooseRandomOne(int a_RndX, int a_RndZ, int a_Val1, int a_Val2, int a_Val3, int a_Val4)
Chooses one of a_ValN, based on m_Noise and the coordinates for querying the noise.
Definition: ProtIntGen.h:93
Generates a 2D array of random integers in the specified range [0 .
Definition: ProtIntGen.h:113
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:125
cProtIntGenChoice(int a_Seed, int a_Range)
Definition: ProtIntGen.h:118
Decides between the ocean and landmass biomes.
Definition: ProtIntGen.h:150
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:162
cProtIntGenLandOcean(int a_Seed, int a_Threshold)
Definition: ProtIntGen.h:155
Zooms the underlying value array to twice the size.
Definition: ProtIntGen.h:194
Underlying m_UnderlyingGen
Definition: ProtIntGen.h:254
cProtIntGenZoom(int a_Seed, Underlying a_UnderlyingGen)
Definition: ProtIntGen.h:199
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:206
Smoothes out some artifacts generated by the zooming - mostly single-pixel values.
Definition: ProtIntGen.h:265
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:277
cProtIntGenSmooth(int a_Seed, Underlying a_Underlying)
Definition: ProtIntGen.h:270
Underlying m_Underlying
Definition: ProtIntGen.h:329
Averages the values of the underlying 2 * 2 neighbors.
Definition: ProtIntGen.h:339
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:350
Underlying m_Underlying
Definition: ProtIntGen.h:374
cProtIntGenAvgValues(Underlying a_Underlying)
Definition: ProtIntGen.h:344
Averages the values of the underlying 4 * 4 neighbors.
Definition: ProtIntGen.h:384
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:395
Underlying m_Underlying
Definition: ProtIntGen.h:424
cProtIntGenAvg4Values(Underlying a_Underlying)
Definition: ProtIntGen.h:389
Averages the values of the underlying 3 * 3 neighbors with custom weight.
Definition: ProtIntGen.h:435
cProtIntGenWeightAvg(Underlying a_Underlying)
Definition: ProtIntGen.h:440
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:446
Underlying m_Underlying
Definition: ProtIntGen.h:473
Replaces random values of the underlying data with random integers in the specified range [Min .
Definition: ProtIntGen.h:483
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:498
Underlying m_Underlying
Definition: ProtIntGen.h:521
cProtIntGenRndChoice(int a_Seed, int a_ChancePct, int a_Min, int a_Range, Underlying a_Underlying)
Definition: ProtIntGen.h:488
Adds a random value in range [-a_HalfRange, +a_HalfRange] to each of the underlying values.
Definition: ProtIntGen.h:531
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:545
cProtIntGenAddRnd(int a_Seed, int a_HalfRange, Underlying a_Underlying)
Definition: ProtIntGen.h:536
Underlying m_Underlying
Definition: ProtIntGen.h:565
Replaces random underlying values with the average of the neighbors.
Definition: ProtIntGen.h:575
cProtIntGenRndAvg(int a_Seed, int a_AvgChancePct, Underlying a_Underlying)
Definition: ProtIntGen.h:580
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:588
Underlying m_Underlying
Definition: ProtIntGen.h:623
Replaces random underlying values with a random value in between the max and min of the neighbors.
Definition: ProtIntGen.h:633
Underlying m_Underlying
Definition: ProtIntGen.h:680
cProtIntGenRndBetween(int a_Seed, int a_AvgChancePct, Underlying a_Underlying)
Definition: ProtIntGen.h:638
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:646
Converts land biomes at the edge of an ocean into the respective beach biome.
Definition: ProtIntGen.h:690
Underlying m_Underlying
Definition: ProtIntGen.h:779
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:701
cProtIntGenBeaches(Underlying a_Underlying)
Definition: ProtIntGen.h:695
Generates the underlying numbers and then randomly changes some ocean group pixels into random land b...
Definition: ProtIntGen.h:790
Underlying m_Underlying
Definition: ProtIntGen.h:829
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:806
int m_Chance
Chance of each ocean pixel being converted, in permille.
Definition: ProtIntGen.h:827
cProtIntGenAddIslands(int a_Seed, int a_Chance, Underlying a_Underlying)
Definition: ProtIntGen.h:798
A filter that adds an edge biome group between two biome groups that need an edge between them.
Definition: ProtIntGen.h:839
cProtIntGenBiomeGroupEdges(Underlying a_Underlying)
Definition: ProtIntGen.h:844
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:850
bool isDesertCompatible(int a_BiomeGroup)
Definition: ProtIntGen.h:910
Turns biome group indices into real biomes.
Definition: ProtIntGen.h:937
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:949
Underlying m_Underlying
The underlying int generator.
Definition: ProtIntGen.h:1052
cProtIntGenBiomes(int a_Seed, Underlying a_Underlying)
Definition: ProtIntGen.h:942
Randomly replaces pixels of one value to another value, using the given chance.
Definition: ProtIntGen.h:1062
int m_To
The destination value to which to replace.
Definition: ProtIntGen.h:1110
cProtIntGenReplaceRandomly(int a_Seed, int a_From, int a_To, int a_Chance, Underlying a_Underlying)
Definition: ProtIntGen.h:1070
int m_Chance
Chance, in permille, of replacing the value.
Definition: ProtIntGen.h:1113
int m_From
The original value to be replaced.
Definition: ProtIntGen.h:1107
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:1080
Mixer that joins together finalized biomes and rivers.
Definition: ProtIntGen.h:1128
cProtIntGenMixRivers(Underlying a_Biomes, Underlying a_Rivers)
Definition: ProtIntGen.h:1133
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:1140
Generates a river based on the underlying data.
Definition: ProtIntGen.h:1193
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:1205
Underlying m_Underlying
Definition: ProtIntGen.h:1239
cProtIntGenRiver(int a_Seed, Underlying a_Underlying)
Definition: ProtIntGen.h:1198
Turns some of the oceans into the specified biome.
Definition: ProtIntGen.h:1250
cProtIntGenAddToOcean(int a_Seed, int a_Chance, int a_ToValue, Underlying a_Underlying)
Definition: ProtIntGen.h:1255
Underlying m_Underlying
Definition: ProtIntGen.h:1331
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:1264
int m_Chance
Chance, in permille, of changing the biome.
Definition: ProtIntGen.h:1326
int m_ToValue
The value to change the ocean into.
Definition: ProtIntGen.h:1329
Changes random pixels of the underlying data to the specified value.
Definition: ProtIntGen.h:1341
cProtIntGenSetRandomly(int a_Seed, int a_Chance, int a_ToValue, Underlying a_Underlying)
Definition: ProtIntGen.h:1346
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:1355
int m_ToValue
The value to which to set the pixel.
Definition: ProtIntGen.h:1379
int m_Chance
Chance, in permille, of changing each pixel.
Definition: ProtIntGen.h:1376
Adds a "rare" flag to random biome groups, based on the given chance.
Definition: ProtIntGen.h:1391
int m_Chance
Chance, in permille, of changing each pixel into the rare biome group.
Definition: ProtIntGen.h:1426
Underlying m_Underlying
The underlying generator.
Definition: ProtIntGen.h:1429
cProtIntGenRareBiomeGroups(int a_Seed, int a_Chance, Underlying a_Underlying)
Definition: ProtIntGen.h:1396
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:1404
Changes biomes in the parent data into an alternate versions (usually "hill" variants),...
Definition: ProtIntGen.h:1440
cProtIntGenAlternateBiomes(int a_Seed, Underlying a_Alterations, Underlying a_BaseBiomes)
Definition: ProtIntGen.h:1445
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:1453
Adds an edge between two specifically incompatible biomes, such as mesa and forest.
Definition: ProtIntGen.h:1506
Underlying m_Underlying
Definition: ProtIntGen.h:1611
bool isMesaCompatible(int a_Biome)
Definition: ProtIntGen.h:1614
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:1518
bool isJungleCompatible(int a_Biome)
Definition: ProtIntGen.h:1638
cProtIntGenBiomeEdges(int a_Seed, Underlying a_Underlying)
Definition: ProtIntGen.h:1511
Changes biomes in the parent data into their alternate versions ("M" variants), in such places that h...
Definition: ProtIntGen.h:1666
Underlying m_Alteration
Definition: ProtIntGen.h:1724
virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
Generates the array of specified size into a_Values, based on given min coords.
Definition: ProtIntGen.h:1679
cProtIntGenMBiomes(int a_Seed, Underlying a_Alteration, Underlying a_Underlying)
Definition: ProtIntGen.h:1671
Underlying m_Underlying
Definition: ProtIntGen.h:1723
Definition: Noise.h:20
int IntNoise2DInt(int a_X, int a_Y) const
Definition: Noise.h:243