This repository has been archived on 2022-01-13. You can view files and clone it, but cannot push or open issues or pull requests.
jtmm2-old/include/tiles.h

44 lines
1.0 KiB
C
Raw Normal View History

2021-01-04 18:02:11 +01:00
#ifndef _DEF_TILES
#define _DEF_TILES
2021-01-07 14:15:00 +01:00
#define TILESET_WIDTH 16
#define TILE_AT(x, y) (x + y * TILESET_WIDTH)
2021-01-04 18:02:11 +01:00
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
2021-01-04 18:02:11 +01:00
/* define properties */
#define P_AIR (0)
#define P_BASE (F_SOLID)
2021-01-08 19:03:58 +01:00
#define P_SPIKE (F_SPIKY)
#define P_UNKNOWN (0)
2021-01-04 18:02:11 +01:00
enum {
ID_AIR = TILE_AT(0, 0),
2021-01-08 13:32:34 +01:00
ID_CHAIN = TILE_AT(0, 1),
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),
2021-01-04 18:02:11 +01:00
};
Tile_flags tile_get_flags(Tile tile);
#endif /* _DEF_TILES */