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
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#ifndef TERRAIN_H
#define TERRAIN_H
#include <camera.h>
#include <gfx.h>
#include <util.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C"
{
#endif
enum
{
MAP_TILES = 24,
TERRAIN_SZ = 16,
MAP_W = MAP_TILES * TERRAIN_SZ,
MAP_H = MAP_TILES * TERRAIN_SZ
};
struct terrain_map
{
struct terrain_tile
{
unsigned char t, obj;
} m[MAP_TILES][MAP_TILES];
int nx, ny, last_w, last_h;
};
int terrain_init(const char *path, struct terrain_map *map);
void terrain_update(struct terrain_map *map);
int terrain_render(const struct terrain_map *map, const struct camera *cam);
enum
{
SIDEWALK,
GRASS,
ROOF1,
ROOF2,
PAVEMENT,
BUILDING1,
BUILDING2,
MAX_TERRAIN_SPRITES
};
extern struct sprite terrain_sprites[MAX_TERRAIN_SPRITES];
#ifdef __cplusplus
}
#endif
#endif /* TERRAIN_H */
|