mirror of
https://github.com/Cubitect/cubiomes.git
synced 2025-09-24 04:03:39 -04:00
Relaced hasAllTemps with the more general checkForTemps.
This commit is contained in:
parent
9a323f4167
commit
9a859a14a2
72
finders.c
72
finders.c
@ -2439,9 +2439,7 @@ L_HAS_PROTO_MUSHROOM:
|
||||
|
||||
int hasAllTemps(LayerStack *g, int64_t seed, int x1024, int z1024)
|
||||
{
|
||||
int64_t ls;
|
||||
ls = getLayerSeed(3); // L_SPECIAL_1024 layer seed
|
||||
|
||||
int64_t ls = getLayerSeed(3); // L_SPECIAL_1024 layer seed
|
||||
int64_t ss = getStartSeed(seed, ls);
|
||||
int spbits = 0, spcnt = 0;
|
||||
|
||||
@ -2490,9 +2488,65 @@ int hasAllTemps(LayerStack *g, int64_t seed, int x1024, int z1024)
|
||||
}
|
||||
|
||||
|
||||
int checkForTemps(LayerStack *g, int64_t seed, int x, int z, int w, int h, const int tc[9])
|
||||
{
|
||||
int64_t ls = getLayerSeed(3); // L_SPECIAL_1024 layer seed
|
||||
int64_t ss = getStartSeed(seed, ls);
|
||||
|
||||
int i, j;
|
||||
int scnt = 0;
|
||||
|
||||
if (tc[Special+Warm] > 0) scnt += tc[Special+Warm];
|
||||
if (tc[Special+Lush] > 0) scnt += tc[Special+Lush];
|
||||
if (tc[Special+Cold] > 0) scnt += tc[Special+Cold];
|
||||
|
||||
if (scnt > 0)
|
||||
{
|
||||
for (j = 0; j < h; j++)
|
||||
{
|
||||
for (i = 0; i < w; i++)
|
||||
{
|
||||
if (mcFirstIsZero(getChunkSeed(ss, x+i, z+j), 13))
|
||||
scnt--;
|
||||
}
|
||||
}
|
||||
if (scnt > 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
Layer *l = &g->layers[L_SPECIAL_1024];
|
||||
int ccnt[9] = {0};
|
||||
int *area = allocCache(l, w, h);
|
||||
int ret = 1;
|
||||
|
||||
setWorldSeed(l, seed);
|
||||
genArea(l, area, x, z, w, h);
|
||||
|
||||
for (i = 0; i < w*h; i++)
|
||||
{
|
||||
int id = area[i];
|
||||
int t = id & 0xff;
|
||||
if (id != t && t != Freezing)
|
||||
t += Special;
|
||||
ccnt[t]++;
|
||||
}
|
||||
for (i = 0; i < 9; i++)
|
||||
{
|
||||
if (ccnt[i] < tc[i] || (ccnt[i] && tc[i] < 0))
|
||||
{
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
free(area);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void genPotential(uint64_t *mL, uint64_t *mM, int layer, int mc, int id)
|
||||
{
|
||||
if (!isOverworldBiome(mc, id))
|
||||
if (layer >= L_BIOME_256 && !isOverworldBiome(mc, id))
|
||||
return;
|
||||
|
||||
int i;
|
||||
@ -2500,15 +2554,17 @@ void genPotential(uint64_t *mL, uint64_t *mM, int layer, int mc, int id)
|
||||
switch (layer)
|
||||
{
|
||||
case L_SPECIAL_1024: // biomes added in (L_SPECIAL_1024, L_ADD_MUSHROOM_256]
|
||||
if (id == ocean)
|
||||
if (id == Oceanic)
|
||||
genPotential(mL, mM, L_ADD_MUSHROOM_256, mc, mushroom_fields);
|
||||
genPotential(mL, mM, L_ADD_MUSHROOM_256, mc, id);
|
||||
if ((id & ~0xf00) >= Oceanic && (id & ~0xf00) <= Freezing)
|
||||
genPotential(mL, mM, L_ADD_MUSHROOM_256, mc, id);
|
||||
break;
|
||||
|
||||
case L_ADD_MUSHROOM_256: // biomes added in (L_ADD_MUSHROOM_256, L_DEEP_OCEAN_256]
|
||||
if (id == ocean)
|
||||
if (id == Oceanic)
|
||||
genPotential(mL, mM, L_DEEP_OCEAN_256, mc, deep_ocean);
|
||||
genPotential(mL, mM, L_DEEP_OCEAN_256, mc, id);
|
||||
if ((id & ~0xf00) >= Oceanic && (id & ~0xf00) <= Freezing)
|
||||
genPotential(mL, mM, L_DEEP_OCEAN_256, mc, id);
|
||||
break;
|
||||
|
||||
case L_DEEP_OCEAN_256: // biomes added in (L_DEEP_OCEAN_256, L_BIOME_256]
|
||||
|
10
finders.h
10
finders.h
@ -682,8 +682,14 @@ int checkForBiomes(
|
||||
int protoCheck
|
||||
);
|
||||
|
||||
int hasAllTemps(LayerStack *g, int64_t seed, int x1024, int z1024);
|
||||
|
||||
/* Checks that the area (x,z,w,h) at layer Special, scale 1:1024 contains the
|
||||
* temperature category requirements defined by 'tc' as:
|
||||
* if (tc[TEMP_CAT] >= 0) require at least this many entries of this category
|
||||
* if (tc[TEMP_CAT] < 0) avoid, there shall be no entries of this category
|
||||
* TEMP_CAT is any of:
|
||||
* Oceanic, Warm, Lush, Cold, Freeing, Special+Warm, Special+Lush, Special+Cold
|
||||
*/
|
||||
int checkForTemps(LayerStack *g, int64_t seed, int x, int z, int w, int h, const int tc[9]);
|
||||
|
||||
/* Given a biome 'id' at a generation 'layer', this functions finds which
|
||||
* biomes may generate from it. The result is stored in the bitfields:
|
||||
|
Loading…
x
Reference in New Issue
Block a user