49 lines
1.1 KiB
C
49 lines
1.1 KiB
C
#ifndef _DEF_TILES
|
|
#define _DEF_TILES
|
|
#define TILESET_WIDTH 16
|
|
#define TILE_AT(x, y) (x + y * TILESET_WIDTH)
|
|
|
|
typedef unsigned char Tile; /* the tile ID */
|
|
typedef unsigned char Tile_flags; /* the tile properties (bitmask) */
|
|
|
|
/* define flags */
|
|
#define F_SOLID 0b1
|
|
#define F_SPIKY 0b10
|
|
#define F_ICE 0b100
|
|
#define F_GLUE 0b1000
|
|
|
|
/* define properties */
|
|
#define P_AIR (0)
|
|
#define P_BASE (F_SOLID)
|
|
#define P_SPIKE (F_SPIKY)
|
|
#define P_ICE (F_SOLID | F_ICE)
|
|
#define P_GLUE (F_SOLID | F_GLUE)
|
|
#define P_UNKNOWN (0)
|
|
|
|
enum {
|
|
ID_AIR = TILE_AT(0, 0),
|
|
ID_SPIKE = TILE_AT(0, 4),
|
|
ID_CHAIN = TILE_AT(7, 2),
|
|
ID_ICE = TILE_AT(0, 5),
|
|
ID_GLUE = TILE_AT(0, 6),
|
|
ID_BASE_0 = TILE_AT(1, 0),
|
|
ID_BASE_1 = TILE_AT(2, 0),
|
|
ID_BASE_2 = TILE_AT(3, 0),
|
|
ID_BASE_3 = TILE_AT(4, 0),
|
|
ID_BASE_4 = TILE_AT(1, 1),
|
|
ID_BASE_5 = TILE_AT(2, 1),
|
|
ID_BASE_6 = TILE_AT(3, 1),
|
|
ID_BASE_7 = TILE_AT(4, 1),
|
|
ID_BASE_8 = TILE_AT(1, 2),
|
|
ID_BASE_9 = TILE_AT(2, 2),
|
|
ID_BASE_10 = TILE_AT(3, 2),
|
|
ID_BASE_11 = TILE_AT(4, 2),
|
|
ID_BASE_12 = TILE_AT(1, 3),
|
|
ID_BASE_13 = TILE_AT(2, 3),
|
|
ID_BASE_14 = TILE_AT(3, 3),
|
|
ID_BASE_15 = TILE_AT(4, 3),
|
|
};
|
|
|
|
Tile_flags tile_get_flags(Tile tile);
|
|
#endif /* _DEF_TILES */
|