map.h
changeset 926 bd4312619522
parent 909 81bc9ef93f50
child 927 28f45a22a564
--- a/map.h	Fri Jan 07 12:33:28 2005 +0000
+++ b/map.h	Fri Jan 07 17:02:43 2005 +0000
@@ -4,6 +4,8 @@
 #define TILE_X_BITS 8
 #define TILE_Y_BITS 8
 
+#define TILE_MASK(x) (int)((x) & ((1 << (MapLogX() + MapLogY())) - 1))
+
 extern byte   _map_type_and_height[];
 extern byte   _map5[];
 extern byte   _map3_lo[];
@@ -24,6 +26,20 @@
 /* The number of tiles in the map */
 static inline uint MapSize(void) { return MapSizeX() * MapSizeY(); }
 
+
+typedef uint16 TileIndex;
+
+static inline uint TileX(TileIndex tile)
+{
+	return tile & MapMaxX();
+}
+
+static inline uint TileY(TileIndex tile)
+{
+	return tile >> MapLogX();
+}
+
+
 typedef int16 TileIndexDiff;
 
 typedef struct TileIndexDiffC {