almost done. no line completion, scoring, and next-piece display yet
[ansitris] / src / pieces.h
index de396ec..e3a5c54 100644 (file)
@@ -2,8 +2,12 @@
 #define PIECES_H_
 
 #define BLK(x, y)      ((x) | ((y) << 4))
+#define BLKX(c)                ((unsigned char)(c) & 0xf)
+#define BLKY(c)                ((unsigned char)(c) >> 4)
 
-unsigned char pieces[][4][4] = {
+#define NUM_PIECES     7
+
+static unsigned char pieces[NUM_PIECES][4][4] = {
        /* straight piece */
        {
                {BLK(0, 2), BLK(1, 2), BLK(2, 2), BLK(3, 2)},
@@ -55,5 +59,9 @@ unsigned char pieces[][4][4] = {
        }
 };
 
+static int piece_spawnpos[NUM_PIECES][2] = {
+       {-1, -2}, {-1, -3}, {-1, -2}, {-1, -2}, {-1, -2}, {-1, -2}, {-1, -2}
+};
+
 
 #endif /* PIECES_H_ */