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:
daoge
2026-03-03 03:04:10 +08:00
committed by GitHub
parent 84c31a2331
commit b3feddfef3
2069 changed files with 264842 additions and 139522 deletions

View File

@@ -10,15 +10,15 @@ HellFlatLevelSource::HellFlatLevelSource(Level *level, __int64 seed)
int hellScale = level->getLevelData()->getHellScale();
m_XZSize = ceil((float)xzSize / hellScale);
this->level = level;
this->level = level;
random = new Random(seed);
random = new Random(seed);
pprandom = new Random(seed);
}
HellFlatLevelSource::~HellFlatLevelSource()
{
delete random;
delete random;
delete pprandom;
}
@@ -35,7 +35,7 @@ void HellFlatLevelSource::prepareHeights(int xOffs, int zOffs, byteArray blocks)
int block = 0;
if ( (yc <= 6) || ( yc >= 121 ) )
{
block = Tile::hellRock_Id;
block = Tile::netherRack_Id;
}
blocks[xc << 11 | zc << 7 | yc] = (byte) block;
@@ -46,13 +46,13 @@ void HellFlatLevelSource::prepareHeights(int xOffs, int zOffs, byteArray blocks)
void HellFlatLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks)
{
for (int x = 0; x < 16; x++)
for (int x = 0; x < 16; x++)
{
for (int z = 0; z < 16; z++)
for (int z = 0; z < 16; z++)
{
for (int y = Level::genDepthMinusOne; y >= 0; y--)
for (int y = Level::genDepthMinusOne; y >= 0; y--)
{
int offs = (z * 16 + x) * Level::genDepth + y;
int offs = (z * 16 + x) * Level::genDepth + y;
// 4J Build walls around the level
bool blockSet = false;
@@ -93,15 +93,15 @@ void HellFlatLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks)
if (y >= Level::genDepthMinusOne - random->nextInt(5))
{
blocks[offs] = (byte) Tile::unbreakable_Id;
}
blocks[offs] = (byte) Tile::unbreakable_Id;
}
else if (y <= 0 + random->nextInt(5))
{
blocks[offs] = (byte) Tile::unbreakable_Id;
}
}
}
}
blocks[offs] = (byte) Tile::unbreakable_Id;
}
}
}
}
}
LevelChunk *HellFlatLevelSource::create(int x, int z)
@@ -111,28 +111,28 @@ LevelChunk *HellFlatLevelSource::create(int x, int z)
LevelChunk *HellFlatLevelSource::getChunk(int xOffs, int zOffs)
{
random->setSeed(xOffs * 341873128712l + zOffs * 132897987541l);
random->setSeed(xOffs * 341873128712l + zOffs * 132897987541l);
// 4J - now allocating this with a physical alloc & bypassing general memory management so that it will get cleanly freed
int chunksSize = Level::genDepth * 16 * 16;
byte *tileData = (byte *)XPhysicalAlloc(chunksSize, MAXULONG_PTR, 4096, PAGE_READWRITE);
XMemSet128(tileData,0,chunksSize);
byteArray blocks = byteArray(tileData,chunksSize);
// byteArray blocks = byteArray(16 * level->depth * 16);
// byteArray blocks = byteArray(16 * level->depth * 16);
prepareHeights(xOffs, zOffs, blocks);
buildSurfaces(xOffs, zOffs, blocks);
prepareHeights(xOffs, zOffs, blocks);
buildSurfaces(xOffs, zOffs, blocks);
// caveFeature->apply(this, level, xOffs, zOffs, blocks);
// townFeature.apply(this, level, xOffs, zOffs, blocks);
// addCaves(xOffs, zOffs, blocks);
// addTowns(xOffs, zOffs, blocks);
// caveFeature->apply(this, level, xOffs, zOffs, blocks);
// townFeature.apply(this, level, xOffs, zOffs, blocks);
// addCaves(xOffs, zOffs, blocks);
// addTowns(xOffs, zOffs, blocks);
// 4J - this now creates compressed block data from the blocks array passed in, so needs to be after data is finalised.
// Also now need to free the passed in blocks as the LevelChunk doesn't use the passed in allocation anymore.
LevelChunk *levelChunk = new LevelChunk(level, blocks, xOffs, zOffs);
LevelChunk *levelChunk = new LevelChunk(level, blocks, xOffs, zOffs);
XPhysicalFree(tileData);
return levelChunk;
return levelChunk;
}
// 4J - removed & moved into its own method from getChunk, so we can call recalcHeightmap after the chunk is added into the cache. Without
@@ -151,9 +151,9 @@ bool HellFlatLevelSource::hasChunk(int x, int y)
void HellFlatLevelSource::postProcess(ChunkSource *parent, int xt, int zt)
{
HeavyTile::instaFall = true;
int xo = xt * 16;
int zo = zt * 16;
HeavyTile::instaFall = true;
int xo = xt * 16;
int zo = zt * 16;
// 4J - added. The original java didn't do any setting of the random seed here. We'll be running our postProcess in parallel with getChunk etc. so
// we need to use a separate random - have used the same initialisation code as used in RandomLevelSource::postProcess to make sure this random value
@@ -163,26 +163,26 @@ void HellFlatLevelSource::postProcess(ChunkSource *parent, int xt, int zt)
__int64 zScale = pprandom->nextLong() / 2 * 2 + 1;
pprandom->setSeed(((xt * xScale) + (zt * zScale)) ^ level->getSeed());
int count = pprandom->nextInt(pprandom->nextInt(10) + 1) + 1;
int count = pprandom->nextInt(pprandom->nextInt(10) + 1) + 1;
for (int i = 0; i < count; i++)
for (int i = 0; i < count; i++)
{
int x = xo + pprandom->nextInt(16) + 8;
int y = pprandom->nextInt(Level::genDepth - 8) + 4;
int z = zo + pprandom->nextInt(16) + 8;
HellFireFeature().place(level, pprandom, x, y, z);
}
int x = xo + pprandom->nextInt(16) + 8;
int y = pprandom->nextInt(Level::genDepth - 8) + 4;
int z = zo + pprandom->nextInt(16) + 8;
HellFireFeature().place(level, pprandom, x, y, z);
}
count = pprandom->nextInt(pprandom->nextInt(10) + 1);
for (int i = 0; i < count; i++)
count = pprandom->nextInt(pprandom->nextInt(10) + 1);
for (int i = 0; i < count; i++)
{
int x = xo + pprandom->nextInt(16) + 8;
int y = pprandom->nextInt(Level::genDepth - 8) + 4;
int z = zo + pprandom->nextInt(16) + 8;
LightGemFeature().place(level, pprandom, x, y, z);
}
int x = xo + pprandom->nextInt(16) + 8;
int y = pprandom->nextInt(Level::genDepth - 8) + 4;
int z = zo + pprandom->nextInt(16) + 8;
LightGemFeature().place(level, pprandom, x, y, z);
}
HeavyTile::instaFall = false;
HeavyTile::instaFall = false;
app.processSchematics(parent->getChunk(xt,zt));
@@ -210,15 +210,19 @@ wstring HellFlatLevelSource::gatherStats()
vector<Biome::MobSpawnerData *> *HellFlatLevelSource::getMobsAt(MobCategory *mobCategory, int x, int y, int z)
{
Biome *biome = level->getBiome(x, z);
if (biome == NULL)
{
return NULL;
}
return biome->getMobs(mobCategory);
Biome *biome = level->getBiome(x, z);
if (biome == NULL)
{
return NULL;
}
return biome->getMobs(mobCategory);
}
TilePos *HellFlatLevelSource::findNearestMapFeature(Level *level, const wstring& featureName, int x, int y, int z)
{
return NULL;
}
void HellFlatLevelSource::recreateLogicStructuresForChunk(int chunkX, int chunkZ)
{
}