all was broken :\

This commit is contained in:
2026-04-27 23:43:36 +02:00
parent 0645905fc6
commit de72a9a3b7
20 changed files with 141 additions and 127 deletions

View File

@@ -278,8 +278,8 @@ void Level::tickTiles() {
for (int i = 0; i < pollChunkOffsetsSize; i += 2) {
const int xp = xx + pollChunkOffsets[i];
const int zp = zz + pollChunkOffsets[i+1];
if (xp >= 0 && xp < CHUNK_CACHE_WIDTH &&
zp >= 0 && zp < CHUNK_CACHE_WIDTH)
if (xp >= 0 && xp < LevelConstants::CHUNK_CACHE_WIDTH &&
zp >= 0 && zp < LevelConstants::CHUNK_CACHE_WIDTH)
_chunksToPoll.insert(ChunkPos(xp, zp));
}
}
@@ -428,17 +428,17 @@ bool Level::findPath(Path* path, Entity* from, int xBest, int yBest, int zBest,
/*protected*/
void Level::setInitialSpawn() {
isFindingSpawn = true;
int xSpawn = CHUNK_CACHE_WIDTH * CHUNK_WIDTH / 2; // (Level.MAX_LEVEL_SIZE - 100) * 0;
int xSpawn = LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_WIDTH / 2; // (Level.MAX_LEVEL_SIZE - 100) * 0;
int ySpawn = 64;
int zSpawn = CHUNK_CACHE_WIDTH * CHUNK_DEPTH / 2; // (Level.MAX_LEVEL_SIZE - 100) * 0;
int zSpawn = LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_DEPTH / 2; // (Level.MAX_LEVEL_SIZE - 100) * 0;
while (!dimension->isValidSpawn(xSpawn, zSpawn)) {
xSpawn += random.nextInt(32) - random.nextInt(32);
zSpawn += random.nextInt(32) - random.nextInt(32);
if (xSpawn < 4) xSpawn += 32;
if (xSpawn >= LEVEL_WIDTH-4) xSpawn -= 32;
if (xSpawn >= LevelConstants::LEVEL_WIDTH-4) xSpawn -= 32;
if (zSpawn < 4) zSpawn += 32;
if (zSpawn >= LEVEL_DEPTH-4) zSpawn -= 32;
if (zSpawn >= LevelConstants::LEVEL_DEPTH-4) zSpawn -= 32;
}
levelData.setSpawn(xSpawn, ySpawn, zSpawn);
isFindingSpawn = false;
@@ -456,9 +456,9 @@ void Level::validateSpawn() {
zSpawn += random.nextInt(8) - random.nextInt(8);
if (xSpawn < 4) xSpawn += 8;
if (xSpawn >= LEVEL_WIDTH-4) xSpawn -= 8;
if (xSpawn >= LevelConstants::LEVEL_WIDTH-4) xSpawn -= 8;
if (zSpawn < 4) zSpawn += 8;
if (zSpawn >= LEVEL_DEPTH-4) zSpawn -= 8;
if (zSpawn >= LevelConstants::LEVEL_DEPTH-4) zSpawn -= 8;
}
levelData.setXSpawn(xSpawn);
levelData.setZSpawn(zSpawn);
@@ -944,7 +944,7 @@ HitResult Level::clip(const Vec3& A, const Vec3& b, bool liquid /*= false*/, boo
if (solidOnly && tile != NULL && tile->getAABB(this, xTile0, yTile0, zTile0) == NULL) {
// No collision
} else if (t > 0 && tile->mayPick(data, liquid)) {
if(xTile0 >= 0 && zTile0 >= 0 && xTile0 < LEVEL_WIDTH && zTile0 < LEVEL_WIDTH) {
if(xTile0 >= 0 && zTile0 >= 0 && xTile0 < LevelConstants::LEVEL_WIDTH && zTile0 < LevelConstants::LEVEL_WIDTH) {
HitResult r = tile->clip(this, xTile0, yTile0, zTile0, a, b);
if (r.isHit()) return r;
}
@@ -2222,9 +2222,9 @@ void Level::setNightMode( bool isNightMode ) {
}
bool Level::inRange( int x, int y, int z ) {
return x >= 0 && x < LEVEL_WIDTH
&& y >= 0 && y < LEVEL_HEIGHT
&& z >= 0 && z < LEVEL_DEPTH;
return x >= 0 && x < LevelConstants::LEVEL_WIDTH
&& y >= 0 && y < LevelConstants::LEVEL_HEIGHT
&& z >= 0 && z < LevelConstants::LEVEL_DEPTH;
}
//