--- /dev/null
+/* Tetrix color support by Eric S. Raymond, eric@snark.uu.net */
+
+#include <curses.h>
+#include "tet.h"
+
+#ifdef COLOR
+/* color pair indexes for pieces */
+#define BLACK 0
+#define GREEN 1
+#define RED 2
+#define TAN 3
+#define WHITE 4
+#define VIOLET 5
+#define BLUE 6
+#define YELLOW 7
+#define NCOLORS 8
+
+static int attribs[NCOLORS];
+
+typedef struct
+{
+ int forgrnd;
+ int attrib;
+}
+colorpair;
+
+void init_colors()
+{
+ start_color();
+
+ init_pair(BLACK, COLOR_BLACK, COLOR_BLACK);
+ attribs[BLACK] = COLOR_PAIR(BLACK);
+
+ init_pair(GREEN, COLOR_GREEN, COLOR_BLACK);
+ attribs[GREEN] = COLOR_PAIR(GREEN);
+
+ init_pair(RED, COLOR_RED, COLOR_BLACK);
+ attribs[RED] = COLOR_PAIR(RED);
+
+#ifdef EGA
+ init_pair(TAN, COLOR_YELLOW, COLOR_BLACK);
+#else
+ init_pair(TAN, COLOR_CYAN, COLOR_BLACK);
+#endif /* EGA */
+ attribs[TAN] = COLOR_PAIR(TAN);
+
+ init_pair(WHITE, COLOR_WHITE, COLOR_BLACK);
+ attribs[WHITE] = COLOR_PAIR(WHITE);
+
+ init_pair(VIOLET, COLOR_MAGENTA, COLOR_BLACK);
+ attribs[VIOLET] = COLOR_PAIR(VIOLET);
+
+ init_pair(BLUE, COLOR_BLUE, COLOR_BLACK);
+ attribs[BLUE] = COLOR_PAIR(BLUE);
+
+#ifdef EGA
+ attribs[YELLOW] = attribs[TAN] | A_BOLD;
+#else
+ init_pair(YELLOW, COLOR_YELLOW, COLOR_BLACK);
+ attribs[YELLOW] = COLOR_PAIR(YELLOW);
+#endif /* EGA */
+}
+
+void PUTCH(x,y,z)
+int x, y, z;
+{
+ switch(z)
+ {
+ case NO_CHAR: attron(attribs[WHITE]); break;
+ case 'G': attron(attribs[GREEN]); break;
+ case 'R': attron(attribs[RED]); break;
+ case 'O': attron(attribs[TAN]); break;
+ case 'W': attron(attribs[WHITE]); break;
+ case 'V': attron(attribs[VIOLET]); break;
+ case 'B': attron(attribs[BLUE]); break;
+ case 'Y': attron(attribs[YELLOW]); break;
+ }
+ mvaddch(y, x, z);
+ if (INBOARD(x, y))
+ Board[x-MINX][y-MINY]=z;
+ attrset(0);
+}
+
+#endif /* COLOR */
--- /dev/null
+# - un'cpio' this in /usr/src or /usr/local/src or something - doesn't matter.
+# - do a 'make install' in the tetrix directory
+# - tetrix gets installed in /usr/local/bin
+# - this will create a high score file in /usr/tmp, so doing it again
+# later on will erase high scores for the machine.
+
+CFLAGS=-O -DCOLOR -DTERMINFO -DEGA
+LFLAGS = -s
+OBJS= MoveR.o MoveL.o DrawP.o AdvanceP.o Rotate.o Colors.o tet.o
+INCS= tet.h
+
+tetrix: $(OBJS) $(INCS)
+ cc $(LFLAGS) $(OBJS) -o tetrix -lcurses
+
+MoveR.o: MoveR.c tet.h
+MoveL.o: MoveL.c tet.h
+DrawP.o: DrawP.c tet.h
+AdvanceP.o: AdvanceP.c tet.h
+Rotate.o: Rotate.c tet.h
+Colors.o: Colors.c tet.h
+tet.o: tet.c tet.h
+
+install: tetrix
+ chmod 755 tetrix
+ /bin/mv -f tetrix /usr/local/bin
+
+shar:
+ shar README Makefile tet.h $(OBJS:.o=.c)
+
+clean:
+ /bin/rm -rf tetrix core *.o