summaryrefslogtreecommitdiff
path: root/include/worldgen.h
blob: 909590690d4d2f70a117c450f26b8f6d8f9f7cce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef STATES_WORLDGEN_H
#define STATES_WORLDGEN_H
#ifdef __cplusplus
extern "C" {
#endif

#include <daw/types.h>

// amounts to 32768 blocks per chunk
#define CHUNK_WIDTH  16
#define CHUNK_LENGTH 16
#define CHUNK_HEIGHT 128
#define CHUNK_SIZE   (CHUNK_WIDTH * CHUNK_LENGTH * CHUNK_HEIGHT)



// World size is defined in terms of number of chunks. Chunks are not stacked
// vertically
#define WORLD_WIDTH  4
#define WORLD_LENGTH 4
#define WORLD_SIZE   (WORLD_LENGTH * WORLD_WIDTH)


// first 4 bits for material type, 16 types in total
#define BLOCK_none    0
#define BLOCK_grass   1
#define BLOCK_rock    2

// next 4 bits for shape type
#define SHAPE_none        (0 << 4)
#define SHAPE_slope_north (1 << 4)
#define SHAPE_slope_east  (2 << 4)
#define SHAPE_slope_south (3 << 4)
#define SHAPE_slope_west  (4 << 4)

void gen_terrain(u8 *world);


#ifdef __cplusplus
}
#endif
#endif