mirror of
https://github.com/minetest/minetest.git
synced 2024-12-02 12:33:45 +01:00
Change internal type for seeds to s32
This fixes value truncation (and therefore incompatibility) on platforms with an LP32 data model, such as VAX or MS-DOS.
This commit is contained in:
parent
2060fd9cbe
commit
dfbdb5bcd7
@ -35,7 +35,7 @@ static NoiseParams nparams_caveliquids(0, 1, v3f(150.0, 150.0, 150.0), 776, 3, 0
|
|||||||
|
|
||||||
CavesNoiseIntersection::CavesNoiseIntersection(
|
CavesNoiseIntersection::CavesNoiseIntersection(
|
||||||
INodeDefManager *nodedef, BiomeManager *biomemgr, v3s16 chunksize,
|
INodeDefManager *nodedef, BiomeManager *biomemgr, v3s16 chunksize,
|
||||||
NoiseParams *np_cave1, NoiseParams *np_cave2, int seed, float cave_width)
|
NoiseParams *np_cave1, NoiseParams *np_cave2, s32 seed, float cave_width)
|
||||||
{
|
{
|
||||||
assert(nodedef);
|
assert(nodedef);
|
||||||
assert(biomemgr);
|
assert(biomemgr);
|
||||||
@ -130,7 +130,7 @@ void CavesNoiseIntersection::generateCaves(MMVManip *vm,
|
|||||||
CavesRandomWalk::CavesRandomWalk(
|
CavesRandomWalk::CavesRandomWalk(
|
||||||
INodeDefManager *ndef,
|
INodeDefManager *ndef,
|
||||||
GenerateNotifier *gennotify,
|
GenerateNotifier *gennotify,
|
||||||
int seed,
|
s32 seed,
|
||||||
int water_level,
|
int water_level,
|
||||||
content_t water_source,
|
content_t water_source,
|
||||||
content_t lava_source)
|
content_t lava_source)
|
||||||
|
@ -41,7 +41,7 @@ class CavesNoiseIntersection {
|
|||||||
public:
|
public:
|
||||||
CavesNoiseIntersection(INodeDefManager *nodedef, BiomeManager *biomemgr,
|
CavesNoiseIntersection(INodeDefManager *nodedef, BiomeManager *biomemgr,
|
||||||
v3s16 chunksize, NoiseParams *np_cave1, NoiseParams *np_cave2,
|
v3s16 chunksize, NoiseParams *np_cave1, NoiseParams *np_cave2,
|
||||||
int seed, float cave_width);
|
s32 seed, float cave_width);
|
||||||
~CavesNoiseIntersection();
|
~CavesNoiseIntersection();
|
||||||
|
|
||||||
void generateCaves(MMVManip *vm, v3s16 nmin, v3s16 nmax, u8 *biomemap);
|
void generateCaves(MMVManip *vm, v3s16 nmin, v3s16 nmax, u8 *biomemap);
|
||||||
@ -83,7 +83,7 @@ public:
|
|||||||
s16 *heightmap;
|
s16 *heightmap;
|
||||||
|
|
||||||
// configurable parameters
|
// configurable parameters
|
||||||
int seed;
|
s32 seed;
|
||||||
int water_level;
|
int water_level;
|
||||||
int lava_depth;
|
int lava_depth;
|
||||||
NoiseParams *np_caveliquids;
|
NoiseParams *np_caveliquids;
|
||||||
@ -122,7 +122,7 @@ public:
|
|||||||
// If gennotify is NULL, generation events are not logged.
|
// If gennotify is NULL, generation events are not logged.
|
||||||
CavesRandomWalk(INodeDefManager *ndef,
|
CavesRandomWalk(INodeDefManager *ndef,
|
||||||
GenerateNotifier *gennotify = NULL,
|
GenerateNotifier *gennotify = NULL,
|
||||||
int seed = 0,
|
s32 seed = 0,
|
||||||
int water_level = 1,
|
int water_level = 1,
|
||||||
content_t water_source = CONTENT_IGNORE,
|
content_t water_source = CONTENT_IGNORE,
|
||||||
content_t lava_source = CONTENT_IGNORE);
|
content_t lava_source = CONTENT_IGNORE);
|
||||||
|
@ -39,7 +39,7 @@ int dir_to_facedir(v3s16 d);
|
|||||||
|
|
||||||
|
|
||||||
struct DungeonParams {
|
struct DungeonParams {
|
||||||
int seed;
|
s32 seed;
|
||||||
|
|
||||||
content_t c_water;
|
content_t c_water;
|
||||||
content_t c_river_water;
|
content_t c_river_water;
|
||||||
|
@ -89,11 +89,25 @@ Mapgen::Mapgen(int mapgenid, MapgenParams *params, EmergeManager *emerge) :
|
|||||||
{
|
{
|
||||||
generating = false;
|
generating = false;
|
||||||
id = mapgenid;
|
id = mapgenid;
|
||||||
seed = (int)params->seed;
|
|
||||||
water_level = params->water_level;
|
water_level = params->water_level;
|
||||||
flags = params->flags;
|
flags = params->flags;
|
||||||
csize = v3s16(1, 1, 1) * (params->chunksize * MAP_BLOCKSIZE);
|
csize = v3s16(1, 1, 1) * (params->chunksize * MAP_BLOCKSIZE);
|
||||||
|
|
||||||
|
/*
|
||||||
|
We are losing half our entropy by doing this, but it is necessary to
|
||||||
|
preserve reverse compatibility. If the top half of our current 64 bit
|
||||||
|
seeds ever starts getting used, existing worlds will break due to a
|
||||||
|
different hash outcome and no way to differentiate between versions.
|
||||||
|
|
||||||
|
A solution could be to add a new bit to designate that the top half of
|
||||||
|
the seed value should be used, essentially a 1-bit version code, but
|
||||||
|
this would require increasing the total size of a seed to 9 bytes (yuck)
|
||||||
|
|
||||||
|
It's probably okay if this never gets fixed. 4.2 billion possibilities
|
||||||
|
ought to be enough for anyone.
|
||||||
|
*/
|
||||||
|
seed = (s32)params->seed;
|
||||||
|
|
||||||
vm = NULL;
|
vm = NULL;
|
||||||
ndef = emerge->ndef;
|
ndef = emerge->ndef;
|
||||||
biomegen = NULL;
|
biomegen = NULL;
|
||||||
@ -107,7 +121,7 @@ Mapgen::~Mapgen()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
u32 Mapgen::getBlockSeed(v3s16 p, int seed)
|
u32 Mapgen::getBlockSeed(v3s16 p, s32 seed)
|
||||||
{
|
{
|
||||||
return (u32)seed +
|
return (u32)seed +
|
||||||
p.Z * 38134234 +
|
p.Z * 38134234 +
|
||||||
@ -116,7 +130,7 @@ u32 Mapgen::getBlockSeed(v3s16 p, int seed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
u32 Mapgen::getBlockSeed2(v3s16 p, int seed)
|
u32 Mapgen::getBlockSeed2(v3s16 p, s32 seed)
|
||||||
{
|
{
|
||||||
u32 n = 1619 * p.X + 31337 * p.Y + 52591 * p.Z + 1013 * seed;
|
u32 n = 1619 * p.X + 31337 * p.Y + 52591 * p.Z + 1013 * seed;
|
||||||
n = (n >> 13) ^ n;
|
n = (n >> 13) ^ n;
|
||||||
|
@ -150,7 +150,7 @@ struct MapgenParams {
|
|||||||
*/
|
*/
|
||||||
class Mapgen {
|
class Mapgen {
|
||||||
public:
|
public:
|
||||||
int seed;
|
s32 seed;
|
||||||
int water_level;
|
int water_level;
|
||||||
u32 flags;
|
u32 flags;
|
||||||
bool generating;
|
bool generating;
|
||||||
@ -171,8 +171,8 @@ public:
|
|||||||
Mapgen(int mapgenid, MapgenParams *params, EmergeManager *emerge);
|
Mapgen(int mapgenid, MapgenParams *params, EmergeManager *emerge);
|
||||||
virtual ~Mapgen();
|
virtual ~Mapgen();
|
||||||
|
|
||||||
static u32 getBlockSeed(v3s16 p, int seed);
|
static u32 getBlockSeed(v3s16 p, s32 seed);
|
||||||
static u32 getBlockSeed2(v3s16 p, int seed);
|
static u32 getBlockSeed2(v3s16 p, s32 seed);
|
||||||
s16 findGroundLevelFull(v2s16 p2d);
|
s16 findGroundLevelFull(v2s16 p2d);
|
||||||
s16 findGroundLevel(v2s16 p2d, s16 ymin, s16 ymax);
|
s16 findGroundLevel(v2s16 p2d, s16 ymin, s16 ymax);
|
||||||
s16 findLiquidSurface(v2s16 p2d, s16 ymin, s16 ymax);
|
s16 findLiquidSurface(v2s16 p2d, s16 ymin, s16 ymax);
|
||||||
|
@ -80,7 +80,7 @@ struct BiomeParams {
|
|||||||
virtual void writeParams(Settings *settings) const = 0;
|
virtual void writeParams(Settings *settings) const = 0;
|
||||||
virtual ~BiomeParams() {}
|
virtual ~BiomeParams() {}
|
||||||
|
|
||||||
int seed;
|
s32 seed;
|
||||||
};
|
};
|
||||||
|
|
||||||
class BiomeGen {
|
class BiomeGen {
|
||||||
|
@ -156,7 +156,7 @@ s32 PcgRandom::randNormalDist(s32 min, s32 max, int num_trials)
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
float noise2d(int x, int y, int seed)
|
float noise2d(int x, int y, s32 seed)
|
||||||
{
|
{
|
||||||
unsigned int n = (NOISE_MAGIC_X * x + NOISE_MAGIC_Y * y
|
unsigned int n = (NOISE_MAGIC_X * x + NOISE_MAGIC_Y * y
|
||||||
+ NOISE_MAGIC_SEED * seed) & 0x7fffffff;
|
+ NOISE_MAGIC_SEED * seed) & 0x7fffffff;
|
||||||
@ -166,7 +166,7 @@ float noise2d(int x, int y, int seed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float noise3d(int x, int y, int z, int seed)
|
float noise3d(int x, int y, int z, s32 seed)
|
||||||
{
|
{
|
||||||
unsigned int n = (NOISE_MAGIC_X * x + NOISE_MAGIC_Y * y + NOISE_MAGIC_Z * z
|
unsigned int n = (NOISE_MAGIC_X * x + NOISE_MAGIC_Y * y + NOISE_MAGIC_Z * z
|
||||||
+ NOISE_MAGIC_SEED * seed) & 0x7fffffff;
|
+ NOISE_MAGIC_SEED * seed) & 0x7fffffff;
|
||||||
@ -235,7 +235,7 @@ float triLinearInterpolationNoEase(
|
|||||||
return linearInterpolation(u, v, z);
|
return linearInterpolation(u, v, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
float noise2d_gradient(float x, float y, int seed, bool eased)
|
float noise2d_gradient(float x, float y, s32 seed, bool eased)
|
||||||
{
|
{
|
||||||
// Calculate the integer coordinates
|
// Calculate the integer coordinates
|
||||||
int x0 = myfloor(x);
|
int x0 = myfloor(x);
|
||||||
@ -256,7 +256,7 @@ float noise2d_gradient(float x, float y, int seed, bool eased)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float noise3d_gradient(float x, float y, float z, int seed, bool eased)
|
float noise3d_gradient(float x, float y, float z, s32 seed, bool eased)
|
||||||
{
|
{
|
||||||
// Calculate the integer coordinates
|
// Calculate the integer coordinates
|
||||||
int x0 = myfloor(x);
|
int x0 = myfloor(x);
|
||||||
@ -290,7 +290,7 @@ float noise3d_gradient(float x, float y, float z, int seed, bool eased)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float noise2d_perlin(float x, float y, int seed,
|
float noise2d_perlin(float x, float y, s32 seed,
|
||||||
int octaves, float persistence, bool eased)
|
int octaves, float persistence, bool eased)
|
||||||
{
|
{
|
||||||
float a = 0;
|
float a = 0;
|
||||||
@ -306,7 +306,7 @@ float noise2d_perlin(float x, float y, int seed,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float noise2d_perlin_abs(float x, float y, int seed,
|
float noise2d_perlin_abs(float x, float y, s32 seed,
|
||||||
int octaves, float persistence, bool eased)
|
int octaves, float persistence, bool eased)
|
||||||
{
|
{
|
||||||
float a = 0;
|
float a = 0;
|
||||||
@ -321,7 +321,7 @@ float noise2d_perlin_abs(float x, float y, int seed,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float noise3d_perlin(float x, float y, float z, int seed,
|
float noise3d_perlin(float x, float y, float z, s32 seed,
|
||||||
int octaves, float persistence, bool eased)
|
int octaves, float persistence, bool eased)
|
||||||
{
|
{
|
||||||
float a = 0;
|
float a = 0;
|
||||||
@ -336,7 +336,7 @@ float noise3d_perlin(float x, float y, float z, int seed,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float noise3d_perlin_abs(float x, float y, float z, int seed,
|
float noise3d_perlin_abs(float x, float y, float z, s32 seed,
|
||||||
int octaves, float persistence, bool eased)
|
int octaves, float persistence, bool eased)
|
||||||
{
|
{
|
||||||
float a = 0;
|
float a = 0;
|
||||||
@ -363,7 +363,7 @@ float contour(float v)
|
|||||||
///////////////////////// [ New noise ] ////////////////////////////
|
///////////////////////// [ New noise ] ////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
float NoisePerlin2D(NoiseParams *np, float x, float y, int seed)
|
float NoisePerlin2D(NoiseParams *np, float x, float y, s32 seed)
|
||||||
{
|
{
|
||||||
float a = 0;
|
float a = 0;
|
||||||
float f = 1.0;
|
float f = 1.0;
|
||||||
@ -389,7 +389,7 @@ float NoisePerlin2D(NoiseParams *np, float x, float y, int seed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float NoisePerlin3D(NoiseParams *np, float x, float y, float z, int seed)
|
float NoisePerlin3D(NoiseParams *np, float x, float y, float z, s32 seed)
|
||||||
{
|
{
|
||||||
float a = 0;
|
float a = 0;
|
||||||
float f = 1.0;
|
float f = 1.0;
|
||||||
@ -416,7 +416,7 @@ float NoisePerlin3D(NoiseParams *np, float x, float y, float z, int seed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Noise::Noise(NoiseParams *np_, int seed, u32 sx, u32 sy, u32 sz)
|
Noise::Noise(NoiseParams *np_, s32 seed, u32 sx, u32 sy, u32 sz)
|
||||||
{
|
{
|
||||||
memcpy(&np, np_, sizeof(np));
|
memcpy(&np, np_, sizeof(np));
|
||||||
this->seed = seed;
|
this->seed = seed;
|
||||||
@ -543,7 +543,7 @@ void Noise::resizeNoiseBuf(bool is3d)
|
|||||||
void Noise::gradientMap2D(
|
void Noise::gradientMap2D(
|
||||||
float x, float y,
|
float x, float y,
|
||||||
float step_x, float step_y,
|
float step_x, float step_y,
|
||||||
int seed)
|
s32 seed)
|
||||||
{
|
{
|
||||||
float v00, v01, v10, v11, u, v, orig_u;
|
float v00, v01, v10, v11, u, v, orig_u;
|
||||||
u32 index, i, j, noisex, noisey;
|
u32 index, i, j, noisex, noisey;
|
||||||
@ -607,7 +607,7 @@ void Noise::gradientMap2D(
|
|||||||
void Noise::gradientMap3D(
|
void Noise::gradientMap3D(
|
||||||
float x, float y, float z,
|
float x, float y, float z,
|
||||||
float step_x, float step_y, float step_z,
|
float step_x, float step_y, float step_z,
|
||||||
int seed)
|
s32 seed)
|
||||||
{
|
{
|
||||||
float v000, v010, v100, v110;
|
float v000, v010, v100, v110;
|
||||||
float v001, v011, v101, v111;
|
float v001, v011, v101, v111;
|
||||||
|
32
src/noise.h
32
src/noise.h
@ -148,7 +148,7 @@ struct NoiseParams {
|
|||||||
class Noise {
|
class Noise {
|
||||||
public:
|
public:
|
||||||
NoiseParams np;
|
NoiseParams np;
|
||||||
int seed;
|
s32 seed;
|
||||||
u32 sx;
|
u32 sx;
|
||||||
u32 sy;
|
u32 sy;
|
||||||
u32 sz;
|
u32 sz;
|
||||||
@ -157,7 +157,7 @@ public:
|
|||||||
float *persist_buf;
|
float *persist_buf;
|
||||||
float *result;
|
float *result;
|
||||||
|
|
||||||
Noise(NoiseParams *np, int seed, u32 sx, u32 sy, u32 sz=1);
|
Noise(NoiseParams *np, s32 seed, u32 sx, u32 sy, u32 sz=1);
|
||||||
~Noise();
|
~Noise();
|
||||||
|
|
||||||
void setSize(u32 sx, u32 sy, u32 sz=1);
|
void setSize(u32 sx, u32 sy, u32 sz=1);
|
||||||
@ -167,11 +167,11 @@ public:
|
|||||||
void gradientMap2D(
|
void gradientMap2D(
|
||||||
float x, float y,
|
float x, float y,
|
||||||
float step_x, float step_y,
|
float step_x, float step_y,
|
||||||
int seed);
|
s32 seed);
|
||||||
void gradientMap3D(
|
void gradientMap3D(
|
||||||
float x, float y, float z,
|
float x, float y, float z,
|
||||||
float step_x, float step_y, float step_z,
|
float step_x, float step_y, float step_z,
|
||||||
int seed);
|
s32 seed);
|
||||||
|
|
||||||
float *perlinMap2D(float x, float y, float *persistence_map=NULL);
|
float *perlinMap2D(float x, float y, float *persistence_map=NULL);
|
||||||
float *perlinMap3D(float x, float y, float z, float *persistence_map=NULL);
|
float *perlinMap3D(float x, float y, float z, float *persistence_map=NULL);
|
||||||
@ -202,11 +202,11 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
float NoisePerlin2D(NoiseParams *np, float x, float y, int seed);
|
float NoisePerlin2D(NoiseParams *np, float x, float y, s32 seed);
|
||||||
float NoisePerlin3D(NoiseParams *np, float x, float y, float z, int seed);
|
float NoisePerlin3D(NoiseParams *np, float x, float y, float z, s32 seed);
|
||||||
|
|
||||||
inline float NoisePerlin2D_PO(NoiseParams *np, float x, float xoff,
|
inline float NoisePerlin2D_PO(NoiseParams *np, float x, float xoff,
|
||||||
float y, float yoff, int seed)
|
float y, float yoff, s32 seed)
|
||||||
{
|
{
|
||||||
return NoisePerlin2D(np,
|
return NoisePerlin2D(np,
|
||||||
x + xoff * np->spread.X,
|
x + xoff * np->spread.X,
|
||||||
@ -215,7 +215,7 @@ inline float NoisePerlin2D_PO(NoiseParams *np, float x, float xoff,
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline float NoisePerlin3D_PO(NoiseParams *np, float x, float xoff,
|
inline float NoisePerlin3D_PO(NoiseParams *np, float x, float xoff,
|
||||||
float y, float yoff, float z, float zoff, int seed)
|
float y, float yoff, float z, float zoff, s32 seed)
|
||||||
{
|
{
|
||||||
return NoisePerlin3D(np,
|
return NoisePerlin3D(np,
|
||||||
x + xoff * np->spread.X,
|
x + xoff * np->spread.X,
|
||||||
@ -225,22 +225,22 @@ inline float NoisePerlin3D_PO(NoiseParams *np, float x, float xoff,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return value: -1 ... 1
|
// Return value: -1 ... 1
|
||||||
float noise2d(int x, int y, int seed);
|
float noise2d(int x, int y, s32 seed);
|
||||||
float noise3d(int x, int y, int z, int seed);
|
float noise3d(int x, int y, int z, s32 seed);
|
||||||
|
|
||||||
float noise2d_gradient(float x, float y, int seed, bool eased=true);
|
float noise2d_gradient(float x, float y, s32 seed, bool eased=true);
|
||||||
float noise3d_gradient(float x, float y, float z, int seed, bool eased=false);
|
float noise3d_gradient(float x, float y, float z, s32 seed, bool eased=false);
|
||||||
|
|
||||||
float noise2d_perlin(float x, float y, int seed,
|
float noise2d_perlin(float x, float y, s32 seed,
|
||||||
int octaves, float persistence, bool eased=true);
|
int octaves, float persistence, bool eased=true);
|
||||||
|
|
||||||
float noise2d_perlin_abs(float x, float y, int seed,
|
float noise2d_perlin_abs(float x, float y, s32 seed,
|
||||||
int octaves, float persistence, bool eased=true);
|
int octaves, float persistence, bool eased=true);
|
||||||
|
|
||||||
float noise3d_perlin(float x, float y, float z, int seed,
|
float noise3d_perlin(float x, float y, float z, s32 seed,
|
||||||
int octaves, float persistence, bool eased=false);
|
int octaves, float persistence, bool eased=false);
|
||||||
|
|
||||||
float noise3d_perlin_abs(float x, float y, float z, int seed,
|
float noise3d_perlin_abs(float x, float y, float z, s32 seed,
|
||||||
int octaves, float persistence, bool eased=false);
|
int octaves, float persistence, bool eased=false);
|
||||||
|
|
||||||
inline float easeCurve(float t)
|
inline float easeCurve(float t)
|
||||||
|
@ -758,7 +758,7 @@ int ModApiEnvMod::l_get_perlin_map(lua_State *L)
|
|||||||
return 0;
|
return 0;
|
||||||
v3s16 size = read_v3s16(L, 2);
|
v3s16 size = read_v3s16(L, 2);
|
||||||
|
|
||||||
int seed = (int)(env->getServerMap().getSeed());
|
s32 seed = (s32)(env->getServerMap().getSeed());
|
||||||
LuaPerlinNoiseMap *n = new LuaPerlinNoiseMap(&np, seed, size);
|
LuaPerlinNoiseMap *n = new LuaPerlinNoiseMap(&np, seed, size);
|
||||||
*(void **)(lua_newuserdata(L, sizeof(void *))) = n;
|
*(void **)(lua_newuserdata(L, sizeof(void *))) = n;
|
||||||
luaL_getmetatable(L, "PerlinNoiseMap");
|
luaL_getmetatable(L, "PerlinNoiseMap");
|
||||||
|
@ -146,7 +146,7 @@ const luaL_reg LuaPerlinNoise::methods[] = {
|
|||||||
LuaPerlinNoiseMap
|
LuaPerlinNoiseMap
|
||||||
*/
|
*/
|
||||||
|
|
||||||
LuaPerlinNoiseMap::LuaPerlinNoiseMap(NoiseParams *params, int seed, v3s16 size)
|
LuaPerlinNoiseMap::LuaPerlinNoiseMap(NoiseParams *params, s32 seed, v3s16 size)
|
||||||
{
|
{
|
||||||
m_is3d = size.Z > 1;
|
m_is3d = size.Z > 1;
|
||||||
np = *params;
|
np = *params;
|
||||||
|
@ -79,7 +79,7 @@ class LuaPerlinNoiseMap : public ModApiBase {
|
|||||||
static int l_getMapSlice(lua_State *L);
|
static int l_getMapSlice(lua_State *L);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LuaPerlinNoiseMap(NoiseParams *np, int seed, v3s16 size);
|
LuaPerlinNoiseMap(NoiseParams *np, s32 seed, v3s16 size);
|
||||||
|
|
||||||
~LuaPerlinNoiseMap();
|
~LuaPerlinNoiseMap();
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ private:
|
|||||||
static int l_next(lua_State *L);
|
static int l_next(lua_State *L);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LuaPseudoRandom(int seed) :
|
LuaPseudoRandom(s32 seed) :
|
||||||
m_pseudo(seed) {}
|
m_pseudo(seed) {}
|
||||||
|
|
||||||
// LuaPseudoRandom(seed)
|
// LuaPseudoRandom(seed)
|
||||||
|
@ -31,7 +31,7 @@ namespace treegen
|
|||||||
{
|
{
|
||||||
|
|
||||||
void make_tree(MMVManip &vmanip, v3s16 p0,
|
void make_tree(MMVManip &vmanip, v3s16 p0,
|
||||||
bool is_apple_tree, INodeDefManager *ndef, int seed)
|
bool is_apple_tree, INodeDefManager *ndef, s32 seed)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
NOTE: Tree-placing code is currently duplicated in the engine
|
NOTE: Tree-placing code is currently duplicated in the engine
|
||||||
@ -149,7 +149,7 @@ treegen::error make_ltree(MMVManip &vmanip, v3s16 p0,
|
|||||||
INodeDefManager *ndef, TreeDef tree_definition)
|
INodeDefManager *ndef, TreeDef tree_definition)
|
||||||
{
|
{
|
||||||
MapNode dirtnode(ndef->getId("mapgen_dirt"));
|
MapNode dirtnode(ndef->getId("mapgen_dirt"));
|
||||||
int seed;
|
s32 seed;
|
||||||
if (tree_definition.explicit_seed)
|
if (tree_definition.explicit_seed)
|
||||||
seed = tree_definition.seed + 14002;
|
seed = tree_definition.seed + 14002;
|
||||||
else
|
else
|
||||||
@ -649,7 +649,7 @@ v3f transposeMatrix(irr::core::matrix4 M, v3f v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void make_jungletree(MMVManip &vmanip, v3s16 p0, INodeDefManager *ndef, int seed)
|
void make_jungletree(MMVManip &vmanip, v3s16 p0, INodeDefManager *ndef, s32 seed)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
NOTE: Tree-placing code is currently duplicated in the engine
|
NOTE: Tree-placing code is currently duplicated in the engine
|
||||||
@ -748,7 +748,7 @@ void make_jungletree(MMVManip &vmanip, v3s16 p0, INodeDefManager *ndef, int seed
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void make_pine_tree(MMVManip &vmanip, v3s16 p0, INodeDefManager *ndef, int seed)
|
void make_pine_tree(MMVManip &vmanip, v3s16 p0, INodeDefManager *ndef, s32 seed)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
NOTE: Tree-placing code is currently duplicated in the engine
|
NOTE: Tree-placing code is currently duplicated in the engine
|
||||||
|
@ -54,19 +54,19 @@ namespace treegen {
|
|||||||
bool thin_branches;
|
bool thin_branches;
|
||||||
MapNode fruitnode;
|
MapNode fruitnode;
|
||||||
int fruit_chance;
|
int fruit_chance;
|
||||||
int seed;
|
s32 seed;
|
||||||
bool explicit_seed;
|
bool explicit_seed;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Add default tree
|
// Add default tree
|
||||||
void make_tree(MMVManip &vmanip, v3s16 p0,
|
void make_tree(MMVManip &vmanip, v3s16 p0,
|
||||||
bool is_apple_tree, INodeDefManager *ndef, int seed);
|
bool is_apple_tree, INodeDefManager *ndef, s32 seed);
|
||||||
// Add jungle tree
|
// Add jungle tree
|
||||||
void make_jungletree(MMVManip &vmanip, v3s16 p0,
|
void make_jungletree(MMVManip &vmanip, v3s16 p0,
|
||||||
INodeDefManager *ndef, int seed);
|
INodeDefManager *ndef, s32 seed);
|
||||||
// Add pine tree
|
// Add pine tree
|
||||||
void make_pine_tree(MMVManip &vmanip, v3s16 p0,
|
void make_pine_tree(MMVManip &vmanip, v3s16 p0,
|
||||||
INodeDefManager *ndef, int seed);
|
INodeDefManager *ndef, s32 seed);
|
||||||
|
|
||||||
// Add L-Systems tree (used by engine)
|
// Add L-Systems tree (used by engine)
|
||||||
treegen::error make_ltree(MMVManip &vmanip, v3s16 p0, INodeDefManager *ndef,
|
treegen::error make_ltree(MMVManip &vmanip, v3s16 p0, INodeDefManager *ndef,
|
||||||
|
Loading…
Reference in New Issue
Block a user