88 lines
1.3 KiB
C
88 lines
1.3 KiB
C
#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 = 64,
|
|
TERRAIN_SZ = 16,
|
|
MAP_W = MAP_TILES * TERRAIN_SZ,
|
|
MAP_H = MAP_TILES * TERRAIN_SZ
|
|
};
|
|
|
|
enum terrain_type
|
|
{
|
|
ROOF1_1_NW,
|
|
ROOF1_1_N,
|
|
ROOF1_1_NE,
|
|
ROOF1_2_NW,
|
|
ROOF1_2_NE,
|
|
ROOF1_3_NW,
|
|
ROOF1_3_N,
|
|
ROOF1_3_NE,
|
|
ROOF1_4_N,
|
|
|
|
ROOF1_1_W,
|
|
ROOF1_1_C,
|
|
ROOF1_1_E,
|
|
ROOF1_2_SW,
|
|
ROOF1_2_SE,
|
|
ROOF1_3_SW,
|
|
ROOF1_3_S,
|
|
ROOF1_3_SE,
|
|
ROOF1_4_C,
|
|
|
|
ROOF1_1_SW,
|
|
ROOF1_1_S,
|
|
ROOF1_1_SE,
|
|
ROOF1_5_W,
|
|
ROOF1_5_C,
|
|
ROOF1_5_E,
|
|
ROOF1_6,
|
|
ROOF1_4_S,
|
|
|
|
ROOF1_START = ROOF1_1_NW,
|
|
ROOF1_END = ROOF1_4_S
|
|
};
|
|
|
|
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,
|
|
ROOF1,
|
|
ROOF2,
|
|
BUILDING1,
|
|
|
|
MAX_TERRAIN_SPRITES
|
|
};
|
|
|
|
extern struct sprite terrain_sprites[MAX_TERRAIN_SPRITES];
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* TERRAIN_H */
|