feat: TU19 (Dec 2014) Features & Content (#155)
* try to resolve merge conflict
* feat: TU19 (Dec 2014) Features & Content (#32)
* December 2014 files
* Working release build
* Fix compilation issues
* Add sound to Windows64Media
* Add DLC content and force Tutorial DLC
* Revert "Add DLC content and force Tutorial DLC"
This reverts commit 97a4399472.
* Disable broken light packing
* Disable breakpoint during DLC texture map load
Allows DLC loading but the DLC textures are still broken
* Fix post build not working
* ...
* fix vs2022 build
* fix cmake build
---------
Co-authored-by: Loki <lokirautio@gmail.com>
This commit is contained in:
@@ -12,7 +12,7 @@ void OreFeature::_init(int tile, int count, int targetTile)
|
||||
|
||||
OreFeature::OreFeature(int tile, int count)
|
||||
{
|
||||
_init(tile, count, Tile::rock_Id);
|
||||
_init(tile, count, Tile::stone_Id);
|
||||
}
|
||||
|
||||
OreFeature::OreFeature(int tile, int count, int targetTile)
|
||||
@@ -23,18 +23,18 @@ OreFeature::OreFeature(int tile, int count, int targetTile)
|
||||
bool OreFeature::place(Level *level, Random *random, int x, int y, int z)
|
||||
{
|
||||
PIXBeginNamedEvent(0,"Place Ore Feature");
|
||||
float dir = random->nextFloat() * PI;
|
||||
float dir = random->nextFloat() * PI;
|
||||
|
||||
double x0 = x + 8 + Mth::sin(dir) * count / 8;
|
||||
double x1 = x + 8 - Mth::sin(dir) * count / 8;
|
||||
double z0 = z + 8 + Mth::cos(dir) * count / 8;
|
||||
double z1 = z + 8 - Mth::cos(dir) * count / 8;
|
||||
double x0 = x + 8 + Mth::sin(dir) * count / 8;
|
||||
double x1 = x + 8 - Mth::sin(dir) * count / 8;
|
||||
double z0 = z + 8 + Mth::cos(dir) * count / 8;
|
||||
double z1 = z + 8 - Mth::cos(dir) * count / 8;
|
||||
|
||||
double y0 = y + random->nextInt(3) - 2;
|
||||
double y1 = y + random->nextInt(3) - 2;
|
||||
double y0 = y + random->nextInt(3) - 2;
|
||||
double y1 = y + random->nextInt(3) - 2;
|
||||
|
||||
bool collisionsExpected = false;
|
||||
|
||||
|
||||
LevelGenerationOptions *levelGenOptions = NULL;
|
||||
if( app.getLevelGenerationOptions() != NULL )
|
||||
{
|
||||
@@ -44,7 +44,7 @@ bool OreFeature::place(Level *level, Random *random, int x, int y, int z)
|
||||
int minX = x0 - 1;
|
||||
int minY = y0 - 1;
|
||||
int minZ = z0 - 1;
|
||||
|
||||
|
||||
double maxss = count / 16;
|
||||
double maxr = (Mth::sin(PI) + 1) * maxss + 1;
|
||||
double maxhr = (Mth::sin(PI) + 1) * maxss + 1;
|
||||
@@ -55,23 +55,32 @@ bool OreFeature::place(Level *level, Random *random, int x, int y, int z)
|
||||
collisionsExpected = levelGenOptions->checkIntersects(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
}
|
||||
|
||||
for (int d = 0; d <= count; d++)
|
||||
bool doEarlyRejectTest = false;
|
||||
if( y0 > level->getSeaLevel() )
|
||||
{
|
||||
double xx = x0 + (x1 - x0) * d / count;
|
||||
double yy = y0 + (y1 - y0) * d / count;
|
||||
double zz = z0 + (z1 - z0) * d / count;
|
||||
doEarlyRejectTest = true;
|
||||
}
|
||||
|
||||
for (int d = 0; d <= count; d++)
|
||||
{
|
||||
double xx = x0 + (x1 - x0) * d / count;
|
||||
double yy = y0 + (y1 - y0) * d / count;
|
||||
double zz = z0 + (z1 - z0) * d / count;
|
||||
|
||||
double ss = random->nextDouble() * count / 16;
|
||||
double r = (Mth::sin(d * PI / count) + 1) * ss + 1;
|
||||
double hr = (Mth::sin(d * PI / count) + 1) * ss + 1;
|
||||
double hr = r; //(Mth::sin(d * PI / count) + 1) * ss + 1;
|
||||
|
||||
int xt0 = Mth::floor(xx - r / 2);
|
||||
int yt0 = Mth::floor(yy - hr / 2);
|
||||
int zt0 = Mth::floor(zz - r / 2);
|
||||
|
||||
int xt1 = Mth::floor(xx + r / 2);
|
||||
int yt1 = Mth::floor(yy + hr / 2);
|
||||
int zt1 = Mth::floor(zz + r / 2);
|
||||
double halfR = r/2;
|
||||
double halfHR = halfR; //hr/2;
|
||||
|
||||
int xt0 = Mth::floor(xx - halfR);
|
||||
int yt0 = Mth::floor(yy - halfHR);
|
||||
int zt0 = Mth::floor(zz - halfR);
|
||||
|
||||
int xt1 = Mth::floor(xx + halfR);
|
||||
int yt1 = Mth::floor(yy + halfHR);
|
||||
int zt1 = Mth::floor(zz + halfR);
|
||||
|
||||
// 4J Stu Added to stop ore features generating areas previously place by game rule generation
|
||||
if(collisionsExpected && levelGenOptions != NULL)
|
||||
@@ -87,36 +96,49 @@ bool OreFeature::place(Level *level, Random *random, int x, int y, int z)
|
||||
// A large % of ore placement is entirely into the air. Attempt to identify some of these early, by check the corners
|
||||
// of the area we are placing in to see if we are going to (very probably) be entirely above the height stored in the heightmap
|
||||
|
||||
bool earlyReject = true;
|
||||
if ( level->getHeightmap(xt0, zt0) >= yt0 ) earlyReject = false;
|
||||
else if( level->getHeightmap(xt1, zt0) >= yt0 ) earlyReject = false;
|
||||
else if( level->getHeightmap(xt0, zt1) >= yt0 ) earlyReject = false;
|
||||
else if( level->getHeightmap(xt1, zt1) >= yt0 ) earlyReject = false;
|
||||
|
||||
if( earlyReject ) continue;
|
||||
|
||||
for (int x2 = xt0; x2 <= xt1; x2++)
|
||||
if( doEarlyRejectTest )
|
||||
{
|
||||
double xd = ((x2 + 0.5) - xx) / (r / 2);
|
||||
if (xd * xd < 1)
|
||||
bool earlyReject = true;
|
||||
if ( level->getHeightmap(xt0, zt0) >= yt0 ) earlyReject = false;
|
||||
else if( level->getHeightmap(xt1, zt0) >= yt0 ) earlyReject = false;
|
||||
else if( level->getHeightmap(xt0, zt1) >= yt0 ) earlyReject = false;
|
||||
else if( level->getHeightmap(xt1, zt1) >= yt0 ) earlyReject = false;
|
||||
|
||||
if( earlyReject ) continue;
|
||||
}
|
||||
|
||||
double xdxd,ydyd;
|
||||
|
||||
double xd0 = ((xt0 + 0.5) - xx);
|
||||
double yd0 = ((yt0 + 0.5) - yy);
|
||||
double zd0 = ((zt0 + 0.5) - zz);
|
||||
|
||||
double halfRSq = halfR * halfR;
|
||||
|
||||
double xd = xd0;
|
||||
for (int x2 = xt0; x2 <= xt1; x2++, xd++)
|
||||
{
|
||||
xdxd = xd * xd;
|
||||
if (xdxd < halfRSq)
|
||||
{
|
||||
for (int y2 = yt0; y2 <= yt1; y2++)
|
||||
double yd = yd0;
|
||||
for (int y2 = yt0; y2 <= yt1; y2++, yd++)
|
||||
{
|
||||
double yd = ((y2 + 0.5) - yy) / (hr / 2);
|
||||
if (xd * xd + yd * yd < 1)
|
||||
ydyd = yd * yd;
|
||||
if (xdxd + ydyd < halfRSq)
|
||||
{
|
||||
for (int z2 = zt0; z2 <= zt1; z2++)
|
||||
double zd = zd0;
|
||||
for (int z2 = zt0; z2 <= zt1; z2++, zd++)
|
||||
{
|
||||
double zd = ((z2 + 0.5) - zz) / (r / 2);
|
||||
if (xd * xd + yd * yd + zd * zd < 1)
|
||||
if (xdxd + ydyd + zd * zd < halfRSq)
|
||||
{
|
||||
if (level->getTile(x2, y2, z2) == targetTile)
|
||||
{
|
||||
level->setTileNoUpdateNoLightCheck(x2, y2, z2, tile); // 4J changed from setTileNoUpdate
|
||||
if ( level->getTile(x2, y2, z2) == targetTile)
|
||||
{
|
||||
level->setTileAndData(x2, y2, z2, tile, 0, Tile::UPDATE_INVISIBLE_NO_LIGHT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user