55 lines
1.2 KiB
C++
55 lines
1.2 KiB
C++
#include <cstdint>
|
|
|
|
#define BLOCK_AIR 0
|
|
#define BLOCK_STONE 1
|
|
#define BLOCK_GRASS 2
|
|
#define BLOCK_DIRT 3
|
|
#define BLOCK_GRAVEL 4
|
|
#define BLOCK_ASPHELT 5
|
|
#define BLOCK_BARRIER 6
|
|
#define BLOCK_GRASS_PLANT 7
|
|
#define BLOCK_WATER 8
|
|
#define BLOCK_SAND 9
|
|
|
|
#define BTYPE_BLOCK 0
|
|
#define BTYPE_RAMP 1
|
|
#define BTYPE_PLANT 2
|
|
#define BTYPE_FLUID 3
|
|
|
|
#define DIRECTION_N 0
|
|
#define DIRECTION_E 1
|
|
#define DIRECTION_S 2
|
|
#define DIRECTION_W 3
|
|
|
|
struct Block
|
|
{
|
|
uint8_t id=0;
|
|
uint8_t type=0;
|
|
uint8_t direction=0;
|
|
};
|
|
|
|
struct BlockFaceMap
|
|
{
|
|
bool t, b, n, e, s, w;
|
|
};
|
|
|
|
struct BlockTextures
|
|
{
|
|
int t, b, n, e, s, w;
|
|
};
|
|
|
|
struct BlockSettings
|
|
{
|
|
bool transparent;
|
|
BlockTextures tex;
|
|
};
|
|
|
|
void blocks_init();
|
|
Block make_block(uint8_t id, uint8_t type=0, uint8_t direction=0);
|
|
void render_block(Block block, int x, int y, int z, BlockFaceMap fm);
|
|
void unbind_block_texture();
|
|
void bind_block_texture();
|
|
BlockSettings blockGetSettings(int id);
|
|
void render_block_face_here(Block block);
|
|
double get_fluid_motion(int x, int z);
|