many little fixes

This commit is contained in:
lllzebralll
2022-11-08 14:49:10 +03:00
parent 815aa90489
commit b1e5a3c6fb
6 changed files with 48 additions and 42 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
#define VOXELS_BLOCK_H_
#define BLOCK_MODEL_CUBE 1
#define BLOCK_MODEL_GRASS 2
#define BLOCK_MODEL_X_SPRITE 2
class Block {
public:
+2 -2
View File
@@ -142,10 +142,10 @@ void WorldGenerator::generate(voxel* voxels, int cx, int cz, int seed){
}
if (real_y <= 2)
id = BLOCK_BEDROCK;
if ((id == 0) && (real_y > 55) && ((int)height + 1 == real_y) && ((unsigned short)random() > 56000)){
if ((id == 0) && (real_y > 55) && ((int)(height + 0.5f) == real_y) && ((unsigned short)random() > 56000)){
id = BLOCK_GRASS;
}
if ((id == 0) && (real_y > 55) && ((int)height + 1 == real_y) && ((unsigned short)random() > 64000)){
if ((id == 0) && (real_y > 55) && ((int)(height + 0.5f) == real_y) && ((unsigned short)random() > 64000)){
id = BLOCK_FLOWER;
}
voxels[(y * CHUNK_D + z) * CHUNK_W + x].id = id;