This commit is contained in:
MarcEricMartel
2021-12-08 16:29:36 -05:00
parent 8e2169420e
commit 9b56a9b4a5
6 changed files with 10 additions and 13 deletions

View File

@@ -39,8 +39,7 @@ BlockType World::BlockAt(const Vector3f& pos, BlockType defaultBlockType) const
}
void World::TransposeWorld(Player& player, Bullet* bullets[MAX_BULLETS]) {
int x = 0;
int y = 0;
int x = 0, y = 0;
if (player.GetPosition().x > (WORLD_SIZE_X * CHUNK_SIZE_X) * .66f) ++x;
else if (player.GetPosition().x < (WORLD_SIZE_X * CHUNK_SIZE_X) * .33f) --x;
@@ -211,12 +210,12 @@ bool World::GenerateChunk(int chx, int chy, Perlin& perlin) {
}
void World::UpdateChunk(int& generates, int& updates, int chx, int chy, Perlin& perlin, BlockInfo* blockinfo[BTYPE_LAST]) {
if (generates == 0 && GenerateChunk(chx, chy, perlin)) generates = FRAMES_RENDER_CHUNKS;
if (updates == 0 && ChunkAt(chx, 1, chy) &&
ChunkAt(chx, 1, chy)->IsDirty()) {
ChunkAt(chx, 1, chy)->Update(blockinfo, this);
updates = FRAMES_UPDATE_CHUNKS;
}
if (generates == 0 && GenerateChunk(chx, chy, perlin)) generates = FRAMES_RENDER_CHUNKS;
}
void World::ChangeBlockAtCursor(BlockType blockType, Player& player, bool& block) {
@@ -276,7 +275,6 @@ void World::ChangeBlockAtCursor(BlockType blockType, Player& player, bool& block
}
}
void World::ChangeBlockAtPosition(BlockType blockType, Vector3f pos) {
int bx = (int)pos.x % CHUNK_SIZE_X;
int by = (int)pos.y % CHUNK_SIZE_Y;