Stated development on a fast general biome finder.

This commit is contained in:
Cubitect 2018-08-02 23:55:43 +02:00
parent f3243ca3fc
commit a877005e13
5 changed files with 598 additions and 7 deletions

407
finders.c
View File

@ -1557,8 +1557,6 @@ int64_t filterAllTempCats(
}
const int majorBiomes[] = {
ocean, plains, desert, extremeHills, forest, taiga, swampland,
icePlains, mushroomIsland, jungle, deepOcean, birchForest, roofedForest,
@ -1656,3 +1654,408 @@ int64_t filterAllMajorBiomes(
if (cache == NULL) free(map);
return hits;
}
BiomeFilter setupBiomeFilter(const int *biomeList, int listLen)
{
BiomeFilter bf;
int i, id;
memset(&bf, 0, sizeof(bf));
for (i = 0; i < listLen; i++)
{
id = biomeList[i] & 0x7f;
switch (id)
{
case mushroomIsland:
case mushroomIslandShore:
bf.requireMushroom = 1;
bf.tempCat |= (1ULL << Oceanic);
bf.biomesToFind |= (1ULL << id);
case mesa:
case mesaPlateau_F:
case mesaPlateau:
bf.tempCat |= (1ULL << (Warm+Special));
bf.biomesToFind |= (1ULL << id);
break;
case savanna:
case savannaPlateau:
bf.tempCat |= (1ULL << Warm);
bf.biomesToFind |= (1ULL << id);
break;
case roofedForest:
case birchForest:
case birchForestHills:
case swampland:
bf.tempCat |= (1ULL << Lush);
bf.biomesToFind |= (1ULL << id);
break;
case jungle:
case jungleHills:
bf.tempCat |= (1ULL << (Lush+Special));
bf.biomesToFind |= (1ULL << id);
break;
/*case jungleEdge:
bf.tempCat |= (1ULL << Lush) | (1ULL << Lush+4);
bf.biomesToFind |= (1ULL << id);
break;*/
case megaTaiga:
case megaTaigaHills:
bf.tempCat |= (1ULL << (Cold+Special));
bf.biomesToFind |= (1ULL << id);
break;
case icePlains:
case iceMountains:
case coldTaiga:
case coldTaigaHills:
bf.tempCat |= (1ULL << Freezing);
bf.biomesToFind |= (1ULL << id);
break;
default:
if (isOceanic(id))
{
if (id != ocean && id != deepOcean)
bf.doOceanTypeCheck = 1;
if (isShallowOcean(id))
{
bf.oceansToFind |= (1ULL < id);
bf.biomesToFind |= (1ULL < ocean);
}
else
{
if (id == warmDeepOcean)
bf.oceansToFind |= (1ULL << warmOcean);
else if (id == lukewarmDeepOcean)
bf.oceansToFind |= (1ULL << lukewarmOcean);
else if (id == deepOcean)
bf.oceansToFind |= (1ULL << ocean);
else if (id == coldDeepOcean)
bf.oceansToFind |= (1ULL << coldOcean);
else if (id == frozenDeepOcean)
bf.oceansToFind |= (1ULL << frozenOcean);
bf.biomesToFind |= (1ULL << deepOcean);
}
bf.tempCat |= (1ULL << Oceanic);
}
else
{
bf.biomesToFind |= (1ULL << id);
}
break;
}
}
for (i = 0; i < Special; i++)
{
if (bf.tempCat & (1ULL << i)) bf.tempNormal++;
}
for (i = Special; i < Freezing+Special; i++)
{
if (bf.tempCat & (1ULL << i)) bf.tempSpecial++;
}
bf.doTempCheck = (bf.tempSpecial + bf.tempNormal) >= 6;
bf.doShroomAndTempCheck = bf.requireMushroom && (bf.tempSpecial >= 1 || bf.tempNormal >= 4);
bf.doMajorBiomeCheck = 1;
bf.checkBiomePotential = 1;
return bf;
}
/* Tries to determine if the biomes configured in the filter will generate in
* this seed within the specified area. The smallest layer scale checked is
* given by 'minscale'. Lowering this value terminate the search earlier and
* yield more false positives.
*/
int64_t checkForBiomes(
LayerStack * g,
int * cache,
const int64_t seed,
const int blockX,
const int blockZ,
const unsigned int width,
const unsigned int height,
const BiomeFilter filter,
const int minscale)
{
Layer *lspecial = &g->layers[L_SPECIAL_1024];
Layer *lmushroom = &g->layers[L_ADD_MUSHROOM_ISLAND_256];
Layer *lbiomes = &g->layers[L_BIOME_256];
Layer *loceantemp = NULL;
int *map = cache ? cache : allocCache(&g->layers[g->layerNum-1], width, height);
uint64_t potential, required;
int64_t ss, cs;
int id, types[0x100];
int i, x, z; int areaX1024, areaZ1024, areaWidth1024, areaHeight1024;
int areaX256, areaZ256, areaWidth256, areaHeight256;
// 1:1024 scale
areaX1024 = blockX >> 10;
areaZ1024 = blockZ >> 10;
areaWidth1024 = ((width-1) >> 10) + 2;
areaHeight1024 = ((height-1) >> 10) + 2;
// 1:256 scale
areaX256 = blockX >> 8;
areaZ256 = blockZ >> 8;
areaWidth256 = ((width-1) >> 8) + 2;
areaHeight256 = ((height-1) >> 8) + 2;
/*** BIOME CHECKS THAT DON'T NEED OTHER LAYERS ***/
// Check that there is the necessary minimum of both special and normal
// temperature categories present.
if (filter.tempNormal || filter.tempSpecial)
{
ss = processWorldSeed(seed, lspecial->baseSeed);
types[0] = types[1] = 0;
for (z = 0; z < areaHeight1024; z++)
{
for (x = 0; x < areaWidth1024; x++)
{
cs = getChunkSeed(ss, (int64_t)(x + areaX1024), (int64_t)(z + areaZ1024));
types[(cs >> 24) % 13 == 0]++;
}
}
if (types[0] < filter.tempNormal || types[1] < filter.tempSpecial)
{
goto return_zero;
}
}
// Check there is a mushroom island, provided there is an ocean.
if (filter.requireMushroom)
{
ss = processWorldSeed(seed, lmushroom->baseSeed);
for (z = 0; z < areaHeight256; z++)
{
for (x = 0; x < areaWidth256; x++)
{
cs = getChunkSeed(ss, (int64_t)(x + areaX256), (int64_t)(z + areaZ256));
if ((cs >> 24) % 100 == 0)
{
goto after_protomushroom;
}
}
}
goto return_zero;
}
after_protomushroom:
if (filter.checkBiomePotential)
{
ss = processWorldSeed(seed, lbiomes->baseSeed);
potential = 0;
required = filter.biomesToFind & (
(1ULL << mesaPlateau) | (1ULL << mesaPlateau_F) |
(1ULL << savanna) | (1ULL << roofedForest) |
(1ULL << birchForest) | (1ULL << swampland) );
for (z = 0; z < areaHeight256; z++)
{
for (x = 0; x < areaWidth256; x++)
{
cs = getChunkSeed(ss, (int64_t)(x + areaX256), (int64_t)(z + areaZ256));
cs >>= 24;
int cs6 = cs % 6;
int cs3 = cs6 & 3;
if (cs3 == 0) potential |= (1ULL << mesaPlateau);
else if (cs3 == 1 || cs3 == 2) potential |= (1ULL << mesaPlateau_F);
if (cs6 == 1) potential |= (1ULL << roofedForest);
else if (cs6 == 3) potential |= (1ULL << savanna);
else if (cs6 == 4) potential |= (1ULL << savanna) | (1ULL << birchForest);
else if (cs6 == 5) potential |= (1ULL << swampland);
if (!((potential & required) ^ required))
{
goto after_protobiome;
}
}
}
goto return_zero;
}
after_protobiome:
/*** BIOME CHECKS ***/
if (filter.doTempCheck)
{
setWorldSeed(lspecial, seed);
genArea(lspecial, map, areaX1024, areaZ1024, areaWidth1024, areaHeight1024);
potential = 0;
for (i = 0; i < areaWidth1024 * areaHeight1024; i++)
{
id = map[i];
if (id >= Special) id = (id & 0xf) + Special;
potential |= (1ULL << id);
}
if ((potential & filter.tempCat) ^ filter.tempCat)
{
goto return_zero;
}
}
if (minscale > 256) goto return_one;
if (filter.doShroomAndTempCheck)
{
setWorldSeed(lmushroom, seed);
genArea(lmushroom, map, areaX256, areaZ256, areaWidth256, areaHeight256);
potential = 0;
for (i = 0; i < areaWidth256 * areaHeight256; i++)
{
id = map[i];
if (id >= BIOME_NUM) id = (id & 0xf) + Special;
potential |= (1ULL << id);
}
required = filter.tempCat | (1ULL << mushroomIsland);
if ((potential & required) ^ required)
{
goto return_zero;
}
}
if (filter.doOceanTypeCheck)
{
loceantemp = &g->layers[L13_OCEAN_TEMP_256];
setWorldSeed(loceantemp, seed);
genArea(loceantemp, map, areaX256, areaZ256, areaWidth256, areaHeight256);
potential = 0; // ocean potential
for (i = 0; i < areaWidth256 * areaHeight256; i++)
{
id = map[i];
if (id == warmOcean) potential |= (1ULL << warmOcean) | (1ULL << lukewarmOcean);
if (id == lukewarmOcean) potential |= (1ULL << lukewarmOcean);
if (id == ocean) potential |= (1ULL << ocean);
if (id == coldOcean) potential |= (1ULL << coldOcean);
if (id == frozenOcean) potential |= (1ULL << frozenOcean) | (1ULL << coldOcean);
}
if ((potential & filter.oceansToFind) ^ filter.oceansToFind)
{
goto return_zero;
}
}
if (filter.doMajorBiomeCheck)
{
setWorldSeed(lbiomes, seed);
genArea(lbiomes, map, areaX256, areaZ256, areaWidth256, areaHeight256);
// get biomes out of the way that we cannot check for at this layer
potential = (1ULL << beach) | (1ULL << stoneBeach) | (1ULL << coldBeach) |
(1ULL << river) | (1ULL << frozenRiver);
for (i = 0; i < areaWidth256 * areaHeight256; i++)
{
id = map[i];
switch (id)
{
case mesaPlateau_F:
case mesaPlateau:
potential |= (1ULL << id) | (1ULL << mesa) | (1ULL << desert); break;
case megaTaiga:
potential |= (1ULL << id) | (1ULL << taiga) | (1ULL << taigaHills) | (1ULL << megaTaigaHills); break;
case desert:
potential |= (1ULL << id) | (1ULL << extremeHillsPlus) | (1ULL << desertHills); break;
case swampland:
potential |= (1ULL << id) | (1ULL << jungleEdge) | (1ULL << plains); break;
case forest:
potential |= (1ULL << id) | (1ULL << forestHills); break;
case birchForest:
potential |= (1ULL << id) | (1ULL << birchForestHills); break;
case roofedForest:
potential |= (1ULL << id) | (1ULL << plains); break;
case taiga:
potential |= (1ULL << id) | (1ULL << taigaHills); break;
case coldTaiga:
potential |= (1ULL << id) | (1ULL << coldTaigaHills); break;
case plains:
potential |= (1ULL << id) | (1ULL << forestHills) | (1ULL << forest); break;
case icePlains:
potential |= (1ULL << id) | (1ULL << iceMountains); break;
case jungle:
potential |= (1ULL << id) | (1ULL << jungleHills); break;
case ocean:
potential |= (1ULL << id) | (1ULL << deepOcean);
// TODO: buffer possible ocean types at this location
potential |= (1ULL << frozenOcean) | (1ULL << coldOcean) | (1ULL << lukewarmOcean) | (1ULL << warmOcean); break;
case extremeHills:
potential |= (1ULL << id) | (1ULL << extremeHillsPlus); break;
case savanna:
potential |= (1ULL << id) | (1ULL << savannaPlateau); break;
case deepOcean:
potential |= (1ULL << id) | (1ULL << plains) | (1ULL << forest);
// TODO: buffer possible ocean types at this location
potential |= (1ULL << frozenDeepOcean) | (1ULL << coldDeepOcean) | (1ULL << lukewarmDeepOcean); break;
case mushroomIsland:
potential |= (1ULL << id) | (1ULL << mushroomIslandShore);
default:
potential |= (1ULL << id);
}
}
if ((potential & filter.biomesToFind) ^ filter.biomesToFind)
{
goto return_zero;
}
}
if (minscale > 64) goto return_one;
int ret;
// clean up and return
return_one:
ret = 1;
if (0)
{
return_zero:
ret = 0;
}
if (!cache) free(map);
return ret;
}

View File

@ -60,6 +60,10 @@ static const StructureConfig SHIPWRECK_CONFIG = {165745295, 15, 7, 0};
static const StructureConfig MONUMENT_CONFIG = { 10387313, 32, 27, LARGE_STRUCT};
static const StructureConfig MANSION_CONFIG = { 10387319, 80, 60, LARGE_STRUCT};
//==============================================================================
// Biome Tables
//==============================================================================
static const int templeBiomeList[] = {desert, desertHills, jungle, jungleHills, swampland, icePlains, coldTaiga};
static const int biomesToSpawnIn[] = {forest, plains, taiga, taigaHills, forestHills, jungle, jungleHills};
static const int oceanMonumentBiomeList1[] = {ocean, deepOcean, river, frozenRiver, frozenOcean, frozenDeepOcean, coldOcean, coldDeepOcean, lukewarmOcean, lukewarmDeepOcean, warmOcean, warmDeepOcean};
@ -67,7 +71,7 @@ static const int oceanMonumentBiomeList2[] = {frozenDeepOcean, coldDeepOcean, de
static const int villageBiomeList[] = {plains, desert, savanna, taiga};
static const int mansionBiomeList[] = {roofedForest, roofedForest+128};
static const int achievementBiomes[] =
static const int achievementBiomes_1_7[] =
{
ocean, plains, desert, extremeHills, forest, taiga, swampland, river, /*hell, sky,*/ // 0-9
/*frozenOcean,*/ frozenRiver, icePlains, iceMountains, mushroomIsland, mushroomIslandShore, beach, desertHills, forestHills, taigaHills, // 10-19
@ -82,6 +86,33 @@ STRUCT(Pos)
int x, z;
};
STRUCT(BiomeFilter)
{
// bitfield for required temperature categories, including special variants
uint64_t tempCat;
// bitfield for the required ocean types
uint64_t oceansToFind;
// bitfield of required biomes without modification bit
uint64_t biomesToFind;
// bitfield of required modified biomes
uint64_t modifiedToFind;
// check that there is a minimum of both special and normal temperatures
int tempNormal, tempSpecial;
// check for the temperatures specified by tempCnt (1:1024)
int doTempCheck;
// check for mushroom potential
int requireMushroom;
// combine a more detailed mushroom and temperature check (1:256)
int doShroomAndTempCheck;
// early check for 1.13 ocean types (1:256)
int doOceanTypeCheck;
int doMajorBiomeCheck;
// pre-generation biome checks in layer L_BIOME_256
int checkBiomePotential;
};
//==============================================================================
// Globals
@ -498,5 +529,25 @@ int64_t filterAllMajorBiomes(
const unsigned int sZ
);
/* Creates a biome filter configuration from a given list of biomes.
*/
BiomeFilter setupBiomeFilter(const int *biomeList, int listLen);
/* Tries to determine if the biomes configured in the filter will generate in
* this seed within the specified area. The smallest layer scale checked is
* given by 'minscale'. Lowering this value terminate the search earlier and
* yield more false positives.
*/
int64_t checkForBiomes(
LayerStack * g,
int * cache,
const int64_t seed,
const int blockX,
const int blockZ,
const unsigned int width,
const unsigned int height,
const BiomeFilter filter,
const int minscale);
#endif /* FINDERS_H_ */

View File

@ -3,13 +3,13 @@
#include "layers.h"
/* Minecraft versions */
enum
{
MC_1_7, MC_1_8, MC_1_9, MC_1_10, MC_1_11, MC_1_12, MC_1_13
};
/* Enumeration of the layer indices in the generator.
*/
/* Enumeration of the layer indices in the generator. */
enum
{
L_ISLAND_4096 = 0,
@ -74,6 +74,113 @@ enum
};
/******************************** BIOME TABLES *********************************
* The biome tables below are lists of the biomes that can be present at some
* notable layers. Of cause, layers that are applied later in the hierarchy will
* also contain these biomes.
*/
//==============================================================================
// MC 1.13 Biome Tables
//==============================================================================
static const int BIOMES_L13_OCEAN_TEMP_256[] =
{
ocean, frozenOcean, warmOcean, lukewarmOcean, coldOcean
};
static const int BIOMES_L13_OCEAN_MIX_4[] =
{
ocean, plains, desert, extremeHills, forest, taiga, swampland, river, /*hell, sky,*/ // 0-9
frozenOcean, frozenRiver, icePlains, iceMountains, mushroomIsland, mushroomIslandShore, beach, desertHills, forestHills, taigaHills, // 10-19
/*extremeHillsEdge,*/ jungle, jungleHills, jungleEdge, deepOcean, stoneBeach, coldBeach, birchForest, birchForestHills, roofedForest, // 20-29
coldTaiga, coldTaigaHills, megaTaiga, megaTaigaHills, extremeHillsPlus, savanna, savannaPlateau, mesa, mesaPlateau_F, mesaPlateau, // 30-39
/*skyIslandLow, skyIslandMedium, skyIslandHigh, skyIslandBarren,*/ warmOcean, lukewarmOcean, coldOcean, /*warmDeepOcean,*/ lukewarmDeepOcean, coldDeepOcean, // 40-49
frozenDeepOcean,
// Modified variants...
plains+128, desert+128, extremeHills+128, forest+128, taiga+128, swampland+128,
icePlains+128, jungle+128, jungleEdge+128, birchForest+128, birchForestHills+128, roofedForest+128,
coldTaiga+128, megaTaiga+128, megaTaigaHills+128, extremeHillsPlus+128, savanna+128, savannaPlateau+128, mesa+128, mesaPlateau_F+128, mesaPlateau+128
};
//==============================================================================
// MC 1.7 Biome Tables
//==============================================================================
/* L_ADD_MUSHROOM_ISLAND_256 and L_DEEP_OCEAN_256
* add the mushroomIsland and deepOcean biomes respectively, however the rest of
* the biomes are incomplete and are better described by temperature categories
* with special modifications bits.
*/
// BIOMES_L_BIOME_256: Changes temperature to weighted biomes:
// Warm -> [desert, desert, desert, savanna, savanna, plains]
// Warm,special -> [mesaPlateau, mesaPlateau_F, mesaPlateau_F]
// Lush -> [forest, roofedForest, extremeHills, plains, birchForest, swampland]
// Lush,special -> [jungle]
// Cold -> [forest, extremeHills, taiga, plains]
// Cold,special -> [megaTaiga]
// Freezing -> [icePlains, icePlains, icePlains, coldTaiga]
static const int BIOMES_L_BIOME_256[] =
{
ocean, plains, desert, extremeHills, forest, taiga, swampland, /*river, hell, sky,*/ // 0-9
/*frozenOcean, frozenRiver,*/ icePlains, /*iceMountains,*/ mushroomIsland, /*mushroomIslandShore, beach, desertHills, forestHills, taigaHills,*/ // 10-19
/*extremeHillsEdge,*/ jungle, /*jungleHills, jungleEdge,*/ deepOcean, /*stoneBeach, coldBeach,*/ birchForest, /*birchForestHills,*/ roofedForest, // 20-29
coldTaiga, /*coldTaigaHills,*/ megaTaiga, /*megaTaigaHills, extremeHillsPlus,*/ savanna, /*savannaPlateau, mesa,*/ mesaPlateau_F, mesaPlateau, // 30-39
};
// Introduces biomes: jungleEdge, extremeHillsPlus, mesa
static const int BIOMES_L_BIOME_EDGE_64[] =
{
ocean, plains, desert, extremeHills, forest, taiga, swampland, /*river, hell, sky,*/ // 0-9
/*frozenOcean, frozenRiver,*/ icePlains, /*iceMountains,*/ mushroomIsland, /*mushroomIslandShore, beach, desertHills, forestHills, taigaHills,*/ // 10-19
/*extremeHillsEdge,*/ jungle, /*jungleHills,*/ jungleEdge, deepOcean, /*stoneBeach, coldBeach,*/ birchForest, /*birchForestHills,*/ roofedForest, // 20-29
coldTaiga, /*coldTaigaHills,*/ megaTaiga, /*megaTaigaHills,*/ extremeHillsPlus, savanna, /*savannaPlateau,*/ mesa, mesaPlateau_F, mesaPlateau, // 30-39
};
// Introduces biomes: iceMountains, desertHills, forestHills, taigaHills,
// jungleHills, birchForestHills, coldTaigaHills, megaTaigaHills, savannaPlateau
// and all 21 mutated biomes
static const int BIOMES_L_HILLS_64[] =
{
ocean, plains, desert, extremeHills, forest, taiga, swampland, /*river, hell, sky,*/ // 0-9
/*frozenOcean, frozenRiver,*/ icePlains, iceMountains, mushroomIsland, /*mushroomIslandShore, beach,*/ desertHills, forestHills, taigaHills, // 10-19
/*extremeHillsEdge,*/ jungle, jungleHills, jungleEdge, deepOcean, /*stoneBeach, coldBeach,*/ birchForest, birchForestHills, roofedForest, // 20-29
coldTaiga, coldTaigaHills, megaTaiga, megaTaigaHills, extremeHillsPlus, savanna, savannaPlateau, mesa, mesaPlateau_F, mesaPlateau, // 30-39
// Modified variants...
plains+128, desert+128, extremeHills+128, forest+128, taiga+128, swampland+128,
icePlains+128, jungle+128, jungleEdge+128, birchForest+128, birchForestHills+128, roofedForest+128,
coldTaiga+128, megaTaiga+128, megaTaigaHills+128, extremeHillsPlus+128, savanna+128, savannaPlateau+128, mesa+128, mesaPlateau_F+128, mesaPlateau+128
};
// Introduces biomes: mushroomIslandShore, beach, stoneBeach, coldBeach
static const int BIOMES_L_SHORE_16[] =
{
ocean, plains, desert, extremeHills, forest, taiga, swampland, /*river, hell, sky,*/ // 0-9
/*frozenOcean, frozenRiver,*/ icePlains, iceMountains, mushroomIsland, mushroomIslandShore, beach, desertHills, forestHills, taigaHills, // 10-19
/*extremeHillsEdge,*/ jungle, jungleHills, jungleEdge, deepOcean, stoneBeach, coldBeach, birchForest, birchForestHills, roofedForest, // 20-29
coldTaiga, coldTaigaHills, megaTaiga, megaTaigaHills, extremeHillsPlus, savanna, savannaPlateau, mesa, mesaPlateau_F, mesaPlateau, // 30-39
// Modified variants...
plains+128, desert+128, extremeHills+128, forest+128, taiga+128, swampland+128,
icePlains+128, jungle+128, jungleEdge+128, birchForest+128, birchForestHills+128, roofedForest+128,
coldTaiga+128, megaTaiga+128, megaTaigaHills+128, extremeHillsPlus+128, savanna+128, savannaPlateau+128, mesa+128, mesaPlateau_F+128, mesaPlateau+128
};
// Merges the river branch and adds frozenRiver biome
static const int BIOMES_L_RIVER_MIX_4[] =
{
ocean, plains, desert, extremeHills, forest, taiga, swampland, river, /*hell, sky,*/ // 0-9
/*frozenOcean,*/ frozenRiver, icePlains, iceMountains, mushroomIsland, mushroomIslandShore, beach, desertHills, forestHills, taigaHills, // 10-19
/*extremeHillsEdge,*/ jungle, jungleHills, jungleEdge, deepOcean, stoneBeach, coldBeach, birchForest, birchForestHills, roofedForest, // 20-29
coldTaiga, coldTaigaHills, megaTaiga, megaTaigaHills, extremeHillsPlus, savanna, savannaPlateau, mesa, mesaPlateau_F, mesaPlateau, // 30-39
// Modified variants...
plains+128, desert+128, extremeHills+128, forest+128, taiga+128, swampland+128,
icePlains+128, jungle+128, jungleEdge+128, birchForest+128, birchForestHills+128, roofedForest+128,
coldTaiga+128, megaTaiga+128, megaTaigaHills+128, extremeHillsPlus+128, savanna+128, savannaPlateau+128, mesa+128, mesaPlateau_F+128, mesaPlateau+128
};
STRUCT(LayerStack)
{
Layer *layers;

View File

@ -46,7 +46,7 @@ enum BiomeType
enum BiomeTempCategory
{
Oceanic, Warm, Lush, Cold, Freezing, UnknownTemp
Oceanic, Warm, Lush, Cold, Freezing, Special
};
@ -185,6 +185,34 @@ static inline int mcNextInt(Layer *layer, int mod)
return ret;
}
static inline int64_t processWorldSeed(register int64_t ws, const int64_t bs)
{
ws *= ws * 6364136223846793005LL + 1442695040888963407LL;
ws += bs;
ws *= ws * 6364136223846793005LL + 1442695040888963407LL;
ws += bs;
ws *= ws * 6364136223846793005LL + 1442695040888963407LL;
ws += bs;
ws *= ws * 6364136223846793005LL + 1442695040888963407LL;
return ws;
}
static inline int64_t getChunkSeed(register int64_t ss, const int64_t x, const int64_t z)
{
ss += x;
ss *= ss * 6364136223846793005LL + 1442695040888963407LL;
ss += z;
ss *= ss * 6364136223846793005LL + 1442695040888963407LL;
ss += x;
ss *= ss * 6364136223846793005LL + 1442695040888963407LL;
ss += z;
return ss;
}
static inline void setChunkSeed(Layer *layer, int64_t chunkX, int64_t chunkZ)
{
layer->chunkSeed = layer->worldSeed;

View File

@ -181,7 +181,9 @@ void getBiomeColourMap(uint *colbuf, const unsigned char biomeColour[256][3],
{
// This may happen for some intermediate layers
containsInvalidBiomes = 1;
r = 0; g = 0; b = 0;
r = biomeColour[id&0x7f][0]-40; r = (r>0xff) ? 0x00 : r&0xff;
g = biomeColour[id&0x7f][1]-40; g = (g>0xff) ? 0x00 : g&0xff;
b = biomeColour[id&0x7f][2]-40; b = (b>0xff) ? 0x00 : b&0xff;
}
else
{