timesynk/tile.h

40 lines
1017 B
C

#ifndef TILE_H
#define TILE_H
#define TILE_NULL 0
#define PASS 0
#define NO_PASS 1
#define NULL_CHAR '\0'
#define PLAYER 1
#define FLOOR 2
#define WALL 3
#define ITEM 4
#define MONSTER 5
/*** Tile
struct Tile is the overarching struct for all objects on the map, be they walls, items, monsters, or even the players.
***/
struct Tile {
unsigned int tid;
short id; // the tile's id, 0-9,999=walls;10,000-19,999=ground;20,000-29,999=items;30,000-39,999=monsters
short x; // x coords on the map
short y; // y coords on the map
struct Tile *next; // pointer to next Tile in the chain
struct Tile *prev; // pointer to previous Tile in the chain
void *data; // pointer to the Tile's actual data, preferably a struct
};
struct Tile null_tile; // FIXME: temporary solution to next and prev pointers
struct BasicTile {
int collision;
char name[16];
};
/*
interface used for creating new Tile
*/
struct Tile *newTile(unsigned int tid, short id, short x, short y);
void freeTile(struct Tile* tile);
#endif