#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 */
