1 #ifndef INCLUDE_CAVE_PARSE_H 2 #define INCLUDE_CAVE_PARSE_H 3 4 typedef struct 5 { 6 unsigned char block; 7 unsigned char data; 8 unsigned char light:4; 9 unsigned char skylight:4; 10 } raw_block; 11 12 // this is the old fully-decoded chunk 13 typedef struct 14 { 15 int xpos, zpos, max_y; 16 int height[16][16]; 17 raw_block rb[16][16][256]; // [z][x][y] which becomes [y][x][z] in stb 18 } chunk; 19 20 chunk *get_decoded_chunk(int chunk_x, int chunk_z); 21 22 #define NUM_SEGMENTS 16 23 typedef struct 24 { 25 int max_y, xpos, zpos; 26 27 unsigned char *blockdata[NUM_SEGMENTS]; 28 unsigned char *data[NUM_SEGMENTS]; 29 unsigned char *skylight[NUM_SEGMENTS]; 30 unsigned char *light[NUM_SEGMENTS]; 31 32 void *pointer_to_free; 33 34 int refcount; // this allows multi-threaded building without wrapping in ANOTHER struct 35 } fast_chunk; 36 37 fast_chunk *get_decoded_fastchunk(int chunk_x, int chunk_z); // cache, never call free() 38 39 fast_chunk *get_decoded_fastchunk_uncached(int chunk_x, int chunk_z); 40 41 #endif 42