12 #define CHUNK_TIMESTAMP_UNDEFINED 0xFFFFFFFF
14 #define CHUNK_STATE_CLEAN 0x00 /* unmodified */
15 #define CHUNK_STATE_WRITE_AT_UNLOAD 0x01 /* modified, save when unloaded */
16 #define CHUNK_STATE_WRITE_NEEDED 0x02 /* modified, save ASAP */
17 #define CHUNK_STATE_UNDERGROUND 0x04 /* old is_underground = true */
18 #define CHUNK_STATE_BADLIGHT 0x08 /* old light_expired = true */
19 #define CHUNK_STATE_BADMESH 0x10 /* old mesh_expired = true */
20 #define CHUNK_STATE_UNGENERATED 0x20
21 #define CHUNK_STATE_BADSPAWN 0x40
23 #define MAPOCT_MINUS_XYZ 0
24 #define MAPOCT_MINUS_XY_PLUS_Z 1
25 #define MAPOCT_MINUS_X_PLUS_YZ 2
26 #define MAPOCT_MINUS_XZ_PLUS_Y 3
27 #define MAPOCT_MINUS_YZ_PLUS_X 4
28 #define MAPOCT_MINUS_Z_PLUS_XY 5
29 #define MAPOCT_MINUS_Y_PLUS_XZ 6
30 #define MAPOCT_PLUS_XYZ 7
32 #define MAP_NORTH 0x00
33 #define MAP_SOUTH 0x01
39 #define MAP_X_MINUS MAP_WEST
40 #define MAP_X_PLUS MAP_EAST
41 #define MAP_Y_MINUS MAP_DOWN
42 #define MAP_Y_PLUS MAP_UP
43 #define MAP_Z_MINUS MAP_NORTH
44 #define MAP_Z_PLUS MAP_SOUTH
46 #define MAP_NORTH_INDEX 0
47 #define MAP_SOUTH_INDEX 1
48 #define MAP_EAST_INDEX 2
49 #define MAP_WEST_INDEX 3
50 #define MAP_UP_INDEX 4
51 #define MAP_DOWN_INDEX 5
53 #define MAP_X_MINUS_INDEX MAP_WEST_INDEX
54 #define MAP_X_PLUS_INDEX MAP_EAST_INDEX
55 #define MAP_Y_MINUS_INDEX MAP_DOWN_INDEX
56 #define MAP_Y_PLUS_INDEX MAP_UP_INDEX
57 #define MAP_Z_MINUS_INDEX MAP_NORTH_INDEX
58 #define MAP_Z_PLUS_INDEX MAP_SOUTH_INDEX
60 #define MAP_TRIGGER_MIN 0x00
61 #define MAP_TRIGGER_MAX 0x02
62 #define MAP_TRIGGER_COUNT 3
64 #define MAP_TRIGGER_LOADED 0x00
65 #define MAP_TRIGGER_UNLOAD 0x01
66 #define MAP_TRIGGER_UPDATE 0x02
68 #ifndef _HAVE_BLOCK_TYPE
69 #define _HAVE_BLOCK_TYPE
70 typedef struct block_s
{
79 #ifndef _HAVE_CHUNK_TYPE
80 #define _HAVE_CHUNK_TYPE
82 typedef struct chunk_s
{
85 struct mapoct_s
*mapoct
;
88 block_t blocks
[CHUNKSIZE
][CHUNKSIZE
][CHUNKSIZE
];
109 #ifndef _HAVE_MAPOCT_TYPE
110 #define _HAVE_MAPOCT_TYPE
111 typedef struct mapoct_s
{
114 struct mapoct_s
*parent
;
116 struct mapoct_s
*children
[8];
121 /* defined in map.c */
123 void map_clear(void);
125 void map_add_chunk(chunk_t
*ch
);
126 void map_delete_chunk(chunk_t
*ch
);
127 chunk_t
*map_get_chunk_containing(pos_t
*p
);
128 block_t
*map_get_block(pos_t
*p
);
129 void map_set_block(pos_t
*p
, block_t
*b
);
131 /* defined in map_trigger.c */
132 int map_trigger(uint32_t type
, chunk_t
*ch
, pos_t
*p
);
133 int map_trigger_add(uint32_t type
, void (*fn
)(chunk_t
*,pos_t
*));
134 void map_trigger_clear(void);
136 /* defined in mapgen.c */
137 int mapgen_queue_max_setter(char* v
);
138 int mapgen_init(void);
139 void mapgen_exit(void);
140 void mapgen_request(pos_t
*p
);
142 /* defined in mapgen_noise.c */
143 void mapgen_seed(int s
);
146 /* defined in mapgen_basic.c */
147 void mapgen_underground(pos_t
*p
);
148 void mapgen_space(pos_t
*p
);
149 void mapgen_air(pos_t
*p
);
151 /* defined in mapgen_terrain.c */
152 void mapgen_terrain(pos_t
*p
);
154 /* defined in mapgen_util.c */
155 void mapgen_fill_chunk(chunk_t
*ch
, content_t id
);
156 chunk_t
*mapgen_create_chunk(pos_t
*p
);