X-Git-Url: http://git.shiar.net/netris.git/blobdiff_plain/ec797c133bd83404f6167fb46c098c236333d168..776faa936ea4b3f5ccaacda0f05a2ed1e945d304:/shapes.c diff --git a/shapes.c b/shapes.c index c62f69b..2309bcc 100644 --- a/shapes.c +++ b/shapes.c @@ -1,6 +1,6 @@ /* * Netris -- A free networked version of T*tris - * Copyright (C) 1994,1995,1996 Mark H. Weaver + * Copyright (C) 1994-1996,1999 Mark H. Weaver * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * $Id: shapes.c,v 1.15 1996/02/09 08:22:17 mhw Exp $ + * $Id: shapes.c,v 1.16 1999/05/16 06:56:31 mhw Exp $ */ #include "netris.h" @@ -28,44 +28,48 @@ #define PreDecl(name, dir) \ static Shape ShapeName(name, dir) -#define StdShape(name, cmdName, mirror, type, realDir, dir, nextDir) \ - static Shape ShapeName(name, dir) = { &ShapeName(name, nextDir), \ - 0, 0, mirror, D_ ## realDir, type, cmds_ ## cmdName } +#define StdShape(name, cmdName, mirror, type, realDir, dir, nextDir, prevDir) \ + static Shape ShapeName(name, dir) = { \ + &ShapeName(name, nextDir), &ShapeName(name, prevDir), \ + 0, 0, mirror, D_ ## realDir, type, cmds_ ## cmdName \ + } #define FourWayDecl(name, cmdName, mirror, type) \ PreDecl(name, down); \ - StdShape(name, cmdName, mirror, type, left, left, down); \ - StdShape(name, cmdName, mirror, type, up, up, left); \ - StdShape(name, cmdName, mirror, type, right, right, up); \ - StdShape(name, cmdName, mirror, type, down, down, right) + PreDecl(name, up); \ + StdShape(name, cmdName, mirror, type, left, left, up, down); \ + PreDecl(name, right); \ + StdShape(name, cmdName, mirror, type, up, up, right, left); \ + StdShape(name, cmdName, mirror, type, right, right, down, up); \ + StdShape(name, cmdName, mirror, type, down, down, left, right) #define TwoWayDecl(name, cmdName, mirror, type) \ PreDecl(name, vert); \ - StdShape(name, cmdName, mirror, type, right, horiz, vert); \ - StdShape(name, cmdName, mirror, type, down, vert, horiz) + StdShape(name, cmdName, mirror, type, right, horiz, vert, vert); \ + StdShape(name, cmdName, mirror, type, down, vert, horiz, horiz) static Cmd cmds_long[] = { C_back, C_plot, C_forw, C_plot, C_forw, C_plot, C_forw, C_plot, C_end }; -TwoWayDecl(long, long, 0, BT_piece1); +TwoWayDecl(long, long, 0, BT_blue); static Cmd cmds_square[] = { C_plot, C_forw, C_left, C_plot, C_forw, C_left, C_plot, C_forw, C_left, C_plot, C_end }; -static Shape shape_square = { &shape_square, 0, 0, D_up, 0, BT_piece1, - cmds_square }; +static Shape shape_square = { &shape_square, &shape_square, 0, 0, D_up, 0, + BT_magenta, cmds_square }; static Cmd cmds_l[] = { C_right, C_back, C_plot, C_forw, C_plot, C_forw, C_plot, C_left, C_forw, C_plot, C_end }; -FourWayDecl(l, l, 0, BT_piece1); -FourWayDecl(l1, l, 1, BT_piece1); +FourWayDecl(l, l, 0, BT_cyan); +FourWayDecl(l1, l, 1, BT_yellow); static Cmd cmds_t[] = { C_plot, C_forw, C_plot, C_back, C_right, C_forw, C_plot, C_back, C_back, C_plot, C_end }; -FourWayDecl(t, t, 0, BT_piece1); +FourWayDecl(t, t, 0, BT_white); static Cmd cmds_s[] = { C_back, C_plot, C_forw, C_plot, C_left, C_forw, C_plot, C_right, C_forw, C_plot, C_end }; -TwoWayDecl(s, s, 0, BT_piece1); -TwoWayDecl(s1, s, 1, BT_piece1); +TwoWayDecl(s, s, 0, BT_green); +TwoWayDecl(s1, s, 1, BT_red); ShapeOption stdOptions[] = { {1, &shape_long_horiz},