[unix-pc.sources] Bitmapped "Tetris" Game

hjespers@attcan.UUCP (Hans Jespersen) (12/02/89)

This is a UNIXpc specific version of the popular game "Tetris".
Bitmapped graphics are handled by wrastop() so there is no
need for any special hardware or software.

This program has been through so many ports and rewrites that the
lineage is completely lost. To my knowledge it does not contain
any copyrighted code. The last identifiable author is Quentin Neill
but unfortunately he has not included his email address in any of
the documentation. I have hacked in some UNIXpc specific stuff but
the majority of the code is Quentin's.

-- 
Hans Jespersen                UUCP: {uunet | att}!attcan!hjespers
AT&T Canada Inc.            
Toronto, Ontario              

----------------------cut here-------------------------------------- 
#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 1)."
# Contents:  AdvanceP.c Makefile MoveL.c MoveR.c NewP.c README Rotate.c
#   tet.c tet.h window.c
# Wrapped by root@arakis on Thu Nov 30 23:52:28 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'AdvanceP.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'AdvanceP.c'\"
else
echo shar: Extracting \"'AdvanceP.c'\" \(6881 characters\)
sed "s/^X//" >'AdvanceP.c' <<'END_OF_FILE'
X
X#include <tam.h>
X#include <termio.h>
X#include "tet.h"
X/*********************************************************************/
X/* Switch on type of piece, find out if I can move down */
X/* If so, then do it and return 1 else return 0 */
X/*********************************************************************/
AdvancePiece()
X{
switch (Type) {
X	/*  WHITE PIECES  */
X	case W_TYPE	: 
X		    if (IS_FREE(Column-1,Row+1) && 
X			IS_FREE(Column,Row+2) &&
X			IS_FREE(Column+1,Row+1)) 
X				{
X				PUTCH(Column-1,Row,NO_CHAR);
X				PUTCH(Column,Row,NO_CHAR);
X				PUTCH(Column+1,Row,NO_CHAR);
X				PUTCH(Column-1,Row+1,W_CHAR);
X				PUTCH(Column,Row+2,W_CHAR);
X				PUTCH(Column+1,Row+1,W_CHAR);
X				Row +=1;
X				goto out;
X				}
X			else goto badout;
X
X	case W_TYPE-1 :
X		    if (IS_FREE(Column,Row+2) && 
X			IS_FREE(Column+1,Row+1))
X				{
X				PUTCH(Column,Row-1,NO_CHAR);
X				PUTCH(Column+1,Row,NO_CHAR);
X				PUTCH(Column,Row+2,W_CHAR);
X				PUTCH(Column+1,Row+1,W_CHAR);
X				Row +=1;
X				goto out;
X				}
X			else goto badout;
X
X	case W_TYPE-2 :  
X		    if (IS_FREE(Column-1,Row+1) && 	
X			IS_FREE(Column,Row+1) && 
X			IS_FREE(Column+1,Row+1))
X				{
X				PUTCH(Column-1,Row,NO_CHAR);
X				PUTCH(Column,Row-1,NO_CHAR);
X				PUTCH(Column+1,Row,NO_CHAR);
X				PUTCH(Column-1,Row+1,W_CHAR);
X				PUTCH(Column,Row+1,W_CHAR);
X				PUTCH(Column+1,Row+1,W_CHAR);
X				Row +=1;
X				goto out;
X				}
X			else goto badout;
X
X	case W_TYPE-3 :  
X		    if (IS_FREE(Column-1,Row+1) && 	
X			IS_FREE(Column,Row+2))
X				{
X				PUTCH(Column-1,Row,NO_CHAR);
X				PUTCH(Column,Row-1,NO_CHAR);
X				PUTCH(Column-1,Row+1,W_CHAR);
X				PUTCH(Column,Row+2,W_CHAR);
X				Row +=1;
X				goto out;
X				}
X			else goto badout;
X
X
X	/*  RED PIECES  */
X	case R_TYPE   : 
X		    if (IS_FREE(Column-1,Row+2) && 
X			IS_FREE(Column,Row+1) &&
X			IS_FREE(Column+1,Row+1))
X				{
X				PUTCH(Column-1,Row,NO_CHAR);
X				PUTCH(Column,Row,NO_CHAR);
X				PUTCH(Column+1,Row,NO_CHAR);
X				PUTCH(Column-1,Row+2,R_CHAR);
X				PUTCH(Column,Row+1,R_CHAR);
X				PUTCH(Column+1,Row+1,R_CHAR);
X				Row +=1;
X				goto out;
X				}
X			else goto badout;
X
X	case R_TYPE-1 : 
X		    if (IS_FREE(Column,Row+2) && 
X			IS_FREE(Column+1,Row+2))
X				{
X				PUTCH(Column,Row-1,NO_CHAR);
X				PUTCH(Column+1,Row+1,NO_CHAR);
X				PUTCH(Column,Row+2,R_CHAR);
X				PUTCH(Column+1,Row+2,R_CHAR);
X				Row +=1;
X				goto out;
X				}
X			else goto badout;
X
X	case R_TYPE-2 : 
X		    if (IS_FREE(Column-1,Row+1) && 
X			IS_FREE(Column,Row+1) &&
X			IS_FREE(Column+1,Row+1))
X				{
X				PUTCH(Column-1,Row,NO_CHAR);
X				PUTCH(Column,Row,NO_CHAR);
X				PUTCH(Column+1,Row-1,NO_CHAR);
X				PUTCH(Column-1,Row+1,R_CHAR);
X				PUTCH(Column,Row+1,R_CHAR);
X				PUTCH(Column+1,Row+1,R_CHAR);
X				Row +=1;
X				goto out;
X				}
X			else goto badout;
X
X	case R_TYPE-3 : 
X		    if (IS_FREE(Column-1,Row) && 
X			IS_FREE(Column,Row+2))
X				{
X				PUTCH(Column-1,Row-1,NO_CHAR);
X				PUTCH(Column,Row-1,NO_CHAR);
X				PUTCH(Column-1,Row,R_CHAR);
X				PUTCH(Column,Row+2,R_CHAR);
X				Row +=1;
X				goto out;
X				}
X			else goto badout;
X
X
X	/*  TAN PIECES  */
X	case T_TYPE   :
X	case T_TYPE-1 :
X	case T_TYPE-2 :
X	case T_TYPE-3 :
X		    if (IS_FREE(Column,Row+2) && 
X			IS_FREE(Column+1,Row+2))
X				{
X				PUTCH(Column,Row,NO_CHAR);
X				PUTCH(Column+1,Row,NO_CHAR);
X				PUTCH(Column,Row+2,T_CHAR);
X				PUTCH(Column+1,Row+2,T_CHAR);
X				Row +=1;
X				goto out;
X				}
X			else goto badout;
X
X
X	/*  YELLOW PIECES  */
X	case Y_TYPE   :
X	case Y_TYPE-2 :  
X		    if (IS_FREE(Column-1,Row+2) && 
X			IS_FREE(Column,Row+2) &&
X			IS_FREE(Column+1,Row+1))
X				{
X				PUTCH(Column-1,Row+1,NO_CHAR);
X				PUTCH(Column,Row,NO_CHAR);
X				PUTCH(Column+1,Row,NO_CHAR);
X				PUTCH(Column-1,Row+2,Y_CHAR);
X				PUTCH(Column,Row+2,Y_CHAR);
X				PUTCH(Column+1,Row+1,Y_CHAR);
X				Row +=1;
X				goto out;
X				}
X			else goto badout;
X
X	case Y_TYPE-1 :
X	case Y_TYPE-3 : 
X		    if (IS_FREE(Column,Row+1) && 
X			IS_FREE(Column+1,Row+2))
X				{
X				PUTCH(Column,Row-1,NO_CHAR);
X				PUTCH(Column+1,Row,NO_CHAR);
X				PUTCH(Column,Row+1,Y_CHAR);
X				PUTCH(Column+1,Row+2,Y_CHAR);
X				Row +=1;
X				goto out;
X				}
X			else goto badout;
X
X
X	/*  GREEN PIECES  */
X	case G_TYPE   :
X	case G_TYPE-2 : 
X		    if (IS_FREE(Column-1,Row+1) && 
X			IS_FREE(Column,Row+2) &&
X			IS_FREE(Column+1,Row+2))
X				{
X				PUTCH(Column-1,Row,NO_CHAR);
X				PUTCH(Column,Row,NO_CHAR);
X				PUTCH(Column+1,Row+1,NO_CHAR);
X				PUTCH(Column-1,Row+1,G_CHAR);
X				PUTCH(Column,Row+2,G_CHAR);
X				PUTCH(Column+1,Row+2,G_CHAR);
X				Row +=1;
X				goto out;
X				}
X			else goto badout;
X
X	case G_TYPE-1 :
X	case G_TYPE-3 : 
X		    if (IS_FREE(Column-1,Row+2) && 
X			IS_FREE(Column,Row+1))
X				{
X				PUTCH(Column,Row-1,NO_CHAR);
X				PUTCH(Column-1,Row,NO_CHAR);
X				PUTCH(Column,Row+1,G_CHAR);
X				PUTCH(Column-1,Row+2,G_CHAR);
X				Row +=1;
X				goto out;
X				}
X			else goto badout;
X
X
X	/*  BLUE PIECES  */
X	case B_TYPE   : 
X		    if (IS_FREE(Column-1,Row+1) && 
X			IS_FREE(Column,Row+1) &&
X			IS_FREE(Column+1,Row+2))
X				{
X				PUTCH(Column-1,Row,NO_CHAR);
X				PUTCH(Column,Row,NO_CHAR);
X				PUTCH(Column+1,Row,NO_CHAR);
X				PUTCH(Column-1,Row+1,B_CHAR);
X				PUTCH(Column,Row+1,B_CHAR);
X				PUTCH(Column+1,Row+2,B_CHAR);
X				Row +=1;
X				goto out;
X				}
X			else goto badout;
X
X	case B_TYPE-1 : 
X		    if (IS_FREE(Column,Row+2) && 
X			IS_FREE(Column+1,Row))
X				{
X				PUTCH(Column,Row-1,NO_CHAR);
X				PUTCH(Column+1,Row-1,NO_CHAR);
X				PUTCH(Column,Row+2,B_CHAR);
X				PUTCH(Column+1,Row,B_CHAR);
X				Row +=1;
X				goto out;
X				}
X			else goto badout;
X
X	case B_TYPE-2 : 
X		    if (IS_FREE(Column-1,Row+1) && 
X			IS_FREE(Column,Row+1) &&
X			IS_FREE(Column+1,Row+1))
X				{
X				PUTCH(Column-1,Row-1,NO_CHAR);
X				PUTCH(Column,Row,NO_CHAR);
X				PUTCH(Column+1,Row,NO_CHAR);
X				PUTCH(Column-1,Row+1,B_CHAR);
X				PUTCH(Column,Row+1,B_CHAR);
X				PUTCH(Column+1,Row+1,B_CHAR);
X				Row +=1;
X				goto out;
X				}
X			else goto badout;
X
X	case B_TYPE-3 : 
X		    if (IS_FREE(Column-1,Row+2) && 
X			IS_FREE(Column,Row+2))
X				{
X				PUTCH(Column-1,Row+1,NO_CHAR);
X				PUTCH(Column,Row-1,NO_CHAR);
X				PUTCH(Column-1,Row+2,B_CHAR);
X				PUTCH(Column,Row+2,B_CHAR);
X				Row +=1;
X				goto out;
X				}
X			else goto badout;
X
X
X	/*  VIOLET PIECES  */
X	case V_TYPE   :
X	case V_TYPE-2 : 
X		    if (IS_FREE(Column-1,Row+1) && 
X			IS_FREE(Column,Row+1) && 
X			IS_FREE(Column+1,Row+1) && 
X			IS_FREE(Column+2,Row+1))
X				{
X				PUTCH(Column-1,Row,NO_CHAR);
X				PUTCH(Column,Row,NO_CHAR);
X				PUTCH(Column+1,Row,NO_CHAR);
X				PUTCH(Column+2,Row,NO_CHAR);
X				PUTCH(Column-1,Row+1,V_CHAR);
X				PUTCH(Column,Row+1,V_CHAR);
X				PUTCH(Column+1,Row+1,V_CHAR);
X				PUTCH(Column+2,Row+1,V_CHAR);
X				Row +=1;
X				goto out;
X				}
X			else goto badout;
X
X	case V_TYPE-1 :
X	case V_TYPE-3 : 
X		    if (IS_FREE(Column,Row+3)) 
X				{
X				PUTCH(Column,Row-1,NO_CHAR);
X				PUTCH(Column,Row+3,V_CHAR);
X				Row +=1;
X				goto out;
X				}
X			else goto badout;
X
X	default : 
X		printf("Advance Piece: illegal piece Type=%d!!\n",Type); 
X		exit();
X	}
badout:
X	return(0);
out:
X	refresh();
X	return(1);
X}
END_OF_FILE
if test 6881 -ne `wc -c <'AdvanceP.c'`; then
    echo shar: \"'AdvanceP.c'\" unpacked with wrong size!
fi
# end of 'AdvanceP.c'
fi
if test -f 'Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(679 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
X#  - un'cpio' this in /usr/src or /usr/local/src or something - doesn't matter.
X#  - do a 'make install' in the tetrix directory
X#  - tetrix gets installed in /usr/local/bin
X#  - this will create a high score file in /usr/tmp, so doing it again
X#    later on will erase high scores for the machine.
X
X
OBJS= MoveR.o MoveL.o NewP.o AdvanceP.o Rotate.o tet.o window.o
INCS= tet.h
X
tetrix: $(OBJS) $(INCS)
X	cc -O $(OBJS) -o tetrix -ltam -ltermlib
X
MoveR.o: MoveR.c
X
window.o: window.c
X
MoveL.o: MoveL.c
X
NewP.o: NewP.c
X
AdvanceP.o: AdvanceP.c
X
Rotate.o: Rotate.c
X
tet.o: tet.c
X
install: tetrix
X	chmod 755 tetrix
X	/bin/mv -f tetrix /usr/local/bin
X
clean:
X	/bin/rm -rf tetrix core *.o
END_OF_FILE
if test 679 -ne `wc -c <'Makefile'`; then
    echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'MoveL.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'MoveL.c'\"
else
echo shar: Extracting \"'MoveL.c'\" \(6758 characters\)
sed "s/^X//" >'MoveL.c' <<'END_OF_FILE'
X
X#include <tam.h>
X#include <termio.h>
X#include "tet.h"
X/*********************************************************************/
X/* Switch on type of piece, find out if I can move left */
X/* If so, then do it */
X/*********************************************************************/
MoveLeft()
X{
switch (Type) {
X	/*  WHITE PIECES  */
X	case W_TYPE   :  /* checked */
X		if (IS_FREE(Column-2,Row) && IS_FREE(Column-1,Row+1)) {
X			PUTCH(Column+1,Row,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column-2,Row,W_CHAR);
X			PUTCH(Column-1,Row+1,W_CHAR);
X			Column -=1;
X			}
X		else goto beepout;
X		goto out;
X	case W_TYPE-1 :  /* checked */
X		if (IS_FREE(Column-1,Row-1) && IS_FREE(Column-1,Row) && 
X		    IS_FREE(Column-1,Row+1)) {
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column+1,Row,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column-1,Row-1,W_CHAR);
X			PUTCH(Column-1,Row,W_CHAR);
X			PUTCH(Column-1,Row+1,W_CHAR);
X			Column -=1;
X			}
X		else goto beepout;
X		goto out;
X	case W_TYPE-2 :  /* checked */
X		if (IS_FREE(Column-2,Row) && IS_FREE(Column-1,Row-1)) {
X			PUTCH(Column+1,Row,NO_CHAR);
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column-2,Row,W_CHAR);
X			PUTCH(Column-1,Row-1,W_CHAR);
X			Column -=1;
X			}
X		else goto beepout;
X		goto out;
X	case W_TYPE-3 :  /* checked */
X		if (IS_FREE(Column-1,Row-1) && IS_FREE(Column-2,Row) && 
X		    IS_FREE(Column-1,Row+1)) {
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column,Row,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column-1,Row-1,W_CHAR);
X			PUTCH(Column-2,Row,W_CHAR);
X			PUTCH(Column-1,Row+1,W_CHAR);
X			Column -=1;
X			}
X		else goto beepout;
X		goto out;
X
X	/*  RED PIECES  */
X	case R_TYPE   : /* checked */
X		if (IS_FREE(Column-2,Row) && IS_FREE(Column-2,Row+1)) {
X			PUTCH(Column+1,Row,NO_CHAR);
X			PUTCH(Column-1,Row+1,NO_CHAR);
X			PUTCH(Column-2,Row,R_CHAR);
X			PUTCH(Column-2,Row+1,R_CHAR);
X			Column -=1;
X			}
X		else goto beepout;
X		goto out;
X	case R_TYPE-1 : /* checked */
X		if (IS_FREE(Column-1,Row-1) && IS_FREE(Column-1,Row) && 
X		    IS_FREE(Column-1,Row+1)) {
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column,Row,NO_CHAR);
X			PUTCH(Column+1,Row+1,NO_CHAR);
X			PUTCH(Column-1,Row-1,R_CHAR);
X			PUTCH(Column-1,Row,R_CHAR);
X			PUTCH(Column-1,Row+1,R_CHAR);
X			Column -=1;
X			}
X		else goto beepout;
X		goto out;
X	case R_TYPE-2 : /* checked  */
X		if (IS_FREE(Column-2,Row) && IS_FREE(Column,Row-1)) {
X			PUTCH(Column+1,Row-1,NO_CHAR);
X			PUTCH(Column+1,Row,NO_CHAR);
X			PUTCH(Column-2,Row,R_CHAR);
X			PUTCH(Column,Row-1,R_CHAR);
X			Column -=1;
X			}
X		else goto beepout;
X		goto out;
X	case R_TYPE-3 : /* checked */
X		if (IS_FREE(Column-2,Row-1) && IS_FREE(Column-1,Row) && 
X		    IS_FREE(Column-1,Row+1)) {
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column,Row,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column-2,Row-1,R_CHAR);
X			PUTCH(Column-1,Row,R_CHAR);
X			PUTCH(Column-1,Row+1,R_CHAR);
X			Column -=1;
X			}
X		else goto beepout;
X		goto out;
X
X	/*  TAN PIECES  */
X	case T_TYPE   :
X	case T_TYPE-1 :
X	case T_TYPE-2 :
X	case T_TYPE-3 : /* checked */
X		if (IS_FREE(Column-1,Row) && IS_FREE(Column-1,Row+1)) {
X			PUTCH(Column+1,Row,NO_CHAR);
X			PUTCH(Column+1,Row+1,NO_CHAR);
X			PUTCH(Column-1,Row,T_CHAR);
X			PUTCH(Column-1,Row+1,T_CHAR);
X			Column -=1;
X			}
X		else goto beepout;
X		goto out;
X
X	/*  YELLOW PIECES  */
X	case Y_TYPE   :
X	case Y_TYPE-2 :  /* checked */
X		if (IS_FREE(Column-1,Row) && IS_FREE(Column-2,Row+1)) {
X			PUTCH(Column+1,Row,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column-1,Row,Y_CHAR);
X			PUTCH(Column-2,Row+1,Y_CHAR);
X			Column -=1;
X			}
X		else goto beepout;
X		goto out;
X	case Y_TYPE-1 :
X	case Y_TYPE-3 : /* checked */
X		if (IS_FREE(Column-1,Row-1) && IS_FREE(Column-1,Row) && 
X		    IS_FREE(Column,Row+1)) {
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column+1,Row,NO_CHAR);
X			PUTCH(Column+1,Row+1,NO_CHAR);
X			PUTCH(Column-1,Row-1,Y_CHAR);
X			PUTCH(Column-1,Row,Y_CHAR);
X			PUTCH(Column,Row+1,Y_CHAR);
X			Column -=1;
X			}
X		else goto beepout;
X		goto out;
X
X	/*  GREEN PIECES  */
X	case G_TYPE   :
X	case G_TYPE-2 : /* checked */
X		if (IS_FREE(Column-2,Row) && IS_FREE(Column-1,Row+1)) {
X			PUTCH(Column,Row,NO_CHAR);
X			PUTCH(Column+1,Row+1,NO_CHAR);
X			PUTCH(Column-2,Row,G_CHAR);
X			PUTCH(Column-1,Row+1,G_CHAR);
X			Column -=1;
X			}
X		else goto beepout;
X		goto out;
X	case G_TYPE-1 :
X	case G_TYPE-3 : /* checked */
X		if (IS_FREE(Column-1,Row-1) && IS_FREE(Column-2,Row) && 
X		    IS_FREE(Column-2,Row+1)) {
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column,Row,NO_CHAR);
X			PUTCH(Column-1,Row+1,NO_CHAR);
X			PUTCH(Column-1,Row-1,G_CHAR);
X			PUTCH(Column-2,Row,G_CHAR);
X			PUTCH(Column-2,Row+1,G_CHAR);
X			Column -=1;
X			}
X		else goto beepout;
X		goto out;
X
X	/*  BLUE PIECES  */
X	case B_TYPE   : /* checked */
X		if (IS_FREE(Column-2,Row) && IS_FREE(Column,Row+1)) {
X			PUTCH(Column+1,Row,NO_CHAR);
X			PUTCH(Column+1,Row+1,NO_CHAR);
X			PUTCH(Column-2,Row,B_CHAR);
X			PUTCH(Column,Row+1,B_CHAR);
X			Column -=1;
X			}
X		else goto beepout;
X		goto out;
X	case B_TYPE-1 : /* checked */
X		if (IS_FREE(Column-1,Row-1) && IS_FREE(Column-1,Row) && 
X		    IS_FREE(Column-1,Row+1)) {
X			PUTCH(Column+1,Row-1,NO_CHAR);
X			PUTCH(Column,Row,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column-1,Row-1,B_CHAR);
X			PUTCH(Column-1,Row,B_CHAR);
X			PUTCH(Column-1,Row+1,B_CHAR);
X			Column -=1;
X			}
X		else goto beepout;
X		goto out;
X	case B_TYPE-2 : /* checked */
X		if (IS_FREE(Column-2,Row-1) && IS_FREE(Column-2,Row)) {
X			PUTCH(Column-1,Row-1,NO_CHAR);
X			PUTCH(Column+1,Row,NO_CHAR);
X			PUTCH(Column-2,Row-1,B_CHAR);
X			PUTCH(Column-2,Row,B_CHAR);
X			Column -=1;
X			}
X		else goto beepout;
X		goto out;
X	case B_TYPE-3 : /* checked */
X		if (IS_FREE(Column-1,Row-1) && IS_FREE(Column-1,Row) && 
X		    IS_FREE(Column-2,Row+1)) {
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column,Row,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column-1,Row-1,B_CHAR);
X			PUTCH(Column-1,Row,B_CHAR);
X			PUTCH(Column-2,Row+1,B_CHAR);
X			Column -=1;
X			}
X		else goto beepout;
X		goto out;
X
X	/*  VIOLET PIECES  */
X	case V_TYPE   :
X	case V_TYPE-2 : /* checked */
X		if (IS_FREE(Column-2,Row)) {
X			PUTCH(Column+2,Row,NO_CHAR);
X			PUTCH(Column-2,Row,V_CHAR);
X			Column -=1;
X			}
X		else goto beepout;
X		goto out;
X	case V_TYPE-1 :
X	case V_TYPE-3 : /* checked */
X		if (IS_FREE(Column-1,Row-1) && IS_FREE(Column-1,Row) && 
X		    IS_FREE(Column-1,Row+1) && IS_FREE(Column-1,Row+2)) {
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column,Row,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column,Row+2,NO_CHAR);
X			PUTCH(Column-1,Row-1,V_CHAR);
X			PUTCH(Column-1,Row,V_CHAR);
X			PUTCH(Column-1,Row+1,V_CHAR);
X			PUTCH(Column-1,Row+2,V_CHAR);
X			Column -=1;
X			}
X		else goto beepout;
X		goto out;
X	default : 
X		printf("illegal piece Type=%d!!\n",Type); 
X		exit();
X	}
beepout:
X	if (Beep) beep();
out:
X	refresh();
X}
X
END_OF_FILE
if test 6758 -ne `wc -c <'MoveL.c'`; then
    echo shar: \"'MoveL.c'\" unpacked with wrong size!
fi
# end of 'MoveL.c'
fi
if test -f 'MoveR.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'MoveR.c'\"
else
echo shar: Extracting \"'MoveR.c'\" \(6676 characters\)
sed "s/^X//" >'MoveR.c' <<'END_OF_FILE'
X
X#include <tam.h>
X#include <termio.h>
X#include "tet.h"
X/*********************************************************************/
X/* Switch on type of piece, find out if I can move right */
X/* If so, then do it */
X/*********************************************************************/
MoveRight()
X{
switch (Type) {
X
X	/*  WHITE PIECES  */
X	case W_TYPE   : /*  */
X		if (IS_FREE(Column+2,Row) && IS_FREE(Column+1,Row+1)) {
X			PUTCH(Column-1,Row,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column+2,Row,W_CHAR);
X			PUTCH(Column+1,Row+1,W_CHAR);
X			Column +=1;
X			}
X		else goto beepout;
X		goto out;
X	case W_TYPE-1 :  /*  */
X		if (IS_FREE(Column+1,Row-1) && IS_FREE(Column+2,Row) && 
X		    IS_FREE(Column+1,Row+1)) {
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column,Row,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column+1,Row-1,W_CHAR);
X			PUTCH(Column+2,Row,W_CHAR);
X			PUTCH(Column+1,Row+1,W_CHAR);
X			Column +=1;
X			}
X		else goto beepout;
X		goto out;
X	case W_TYPE-2 :  /*  */
X		if (IS_FREE(Column+2,Row) && IS_FREE(Column+1,Row-1)) {
X			PUTCH(Column-1,Row,NO_CHAR);
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column+2,Row,W_CHAR);
X			PUTCH(Column+1,Row-1,W_CHAR);
X			Column +=1;
X			}
X		else goto beepout;
X		goto out;
X	case W_TYPE-3 :  /*  */
X		if (IS_FREE(Column+1,Row-1) && IS_FREE(Column+1,Row) && 
X		    IS_FREE(Column+1,Row+1)) {
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column-1,Row,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column+1,Row-1,W_CHAR);
X			PUTCH(Column+1,Row,W_CHAR);
X			PUTCH(Column+1,Row+1,W_CHAR);
X			Column +=1;
X			}
X		else goto beepout;
X		goto out;
X
X	/*  RED PIECES  */
X	case R_TYPE   : /*  */
X		if (IS_FREE(Column,Row+1) && IS_FREE(Column+2,Row)) {
X			PUTCH(Column-1,Row,NO_CHAR);
X			PUTCH(Column-1,Row+1,NO_CHAR);
X			PUTCH(Column+2,Row,R_CHAR);
X			PUTCH(Column,Row+1,R_CHAR);
X			Column +=1;
X			}
X		else goto beepout;
X		goto out;
X	case R_TYPE-1 : /*  */
X		if (IS_FREE(Column+1,Row-1) && IS_FREE(Column+1,Row) && 
X		    IS_FREE(Column+2,Row+1)) {
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column,Row,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column+1,Row-1,R_CHAR);
X			PUTCH(Column+1,Row,R_CHAR);
X			PUTCH(Column+2,Row+1,R_CHAR);
X			Column +=1;
X			}
X		else goto beepout;
X		goto out;
X	case R_TYPE-2 : /*  */
X		if (IS_FREE(Column+2,Row-1) && IS_FREE(Column+2,Row)) {
X			PUTCH(Column-1,Row,NO_CHAR);
X			PUTCH(Column+1,Row-1,NO_CHAR);
X			PUTCH(Column+2,Row,R_CHAR);
X			PUTCH(Column+2,Row-1,R_CHAR);
X			Column +=1;
X			}
X		else goto beepout;
X		goto out;
X	case R_TYPE-3 : /*  */
X		if (IS_FREE(Column+1,Row-1) && IS_FREE(Column+1,Row) && 
X		    IS_FREE(Column+1,Row+1)) {
X			PUTCH(Column-1,Row-1,NO_CHAR);
X			PUTCH(Column,Row,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column+1,Row-1,R_CHAR);
X			PUTCH(Column+1,Row,R_CHAR);
X			PUTCH(Column+1,Row+1,R_CHAR);
X			Column +=1;
X			}
X		else goto beepout;
X		goto out;
X
X	/*  TAN PIECES  */
X	case T_TYPE   :
X	case T_TYPE-1 :
X	case T_TYPE-2 :
X	case T_TYPE-3 : /*  */
X		if (IS_FREE(Column+2,Row) && IS_FREE(Column+2,Row+1)) {
X			PUTCH(Column,Row,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column+2,Row,T_CHAR);
X			PUTCH(Column+2,Row+1,T_CHAR);
X			Column +=1;
X			}
X		else goto beepout;
X		goto out;
X
X	/*  YELLOW PIECES  */
X	case Y_TYPE   :
X	case Y_TYPE-2 : /* checked */
X		if (IS_FREE(Column+2,Row) && IS_FREE(Column+1,Row+1)) {
X			PUTCH(Column,Row,NO_CHAR);
X			PUTCH(Column-1,Row+1,NO_CHAR);
X			PUTCH(Column+2,Row,Y_CHAR);
X			PUTCH(Column+1,Row+1,Y_CHAR);
X			Column +=1;
X			}
X		else goto beepout;
X		goto out;
X	case Y_TYPE-1 :
X	case Y_TYPE-3 : /*  */
X		if (IS_FREE(Column+1,Row-1) && IS_FREE(Column+2,Row) && 
X		    IS_FREE(Column+2,Row+1)) {
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column,Row,NO_CHAR);
X			PUTCH(Column+1,Row+1,NO_CHAR);
X			PUTCH(Column+1,Row-1,Y_CHAR);
X			PUTCH(Column+2,Row,Y_CHAR);
X			PUTCH(Column+2,Row+1,Y_CHAR);
X			Column +=1;
X			}
X		else goto beepout;
X		goto out;
X
X	/*  GREEN PIECES  */
X	case G_TYPE   :
X	case G_TYPE-2 : /* checked */
X		if (IS_FREE(Column+1,Row) && IS_FREE(Column+2,Row+1)) {
X			PUTCH(Column-1,Row,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column+1,Row,G_CHAR);
X			PUTCH(Column+2,Row+1,G_CHAR);
X			Column +=1;
X			}
X		else goto beepout;
X		goto out;
X	case G_TYPE-1 :
X	case G_TYPE-3 : /*  */
X		if (IS_FREE(Column+1,Row-1) && IS_FREE(Column+1,Row) && 
X		    IS_FREE(Column,Row+1)) {
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column-1,Row,NO_CHAR);
X			PUTCH(Column-1,Row+1,NO_CHAR);
X			PUTCH(Column+1,Row-1,G_CHAR);
X			PUTCH(Column+1,Row,G_CHAR);
X			PUTCH(Column,Row+1,G_CHAR);
X			Column +=1;
X			}
X		else goto beepout;
X		goto out;
X
X	/*  BLUE PIECES  */
X	case B_TYPE   : /* checked */
X		if (IS_FREE(Column+2,Row) && IS_FREE(Column+2,Row+1)) {
X			PUTCH(Column-1,Row,NO_CHAR);
X			PUTCH(Column+1,Row+1,NO_CHAR);
X			PUTCH(Column+2,Row,B_CHAR);
X			PUTCH(Column+2,Row+1,B_CHAR);
X			Column +=1;
X			}
X		else goto beepout;
X		goto out;
X	case B_TYPE-1 : /* checked */
X		if (IS_FREE(Column+2,Row-1) && IS_FREE(Column+1,Row) && 
X		    IS_FREE(Column+1,Row+1)) {
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column,Row,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column+2,Row-1,B_CHAR);
X			PUTCH(Column+1,Row,B_CHAR);
X			PUTCH(Column+1,Row+1,B_CHAR);
X			Column +=1;
X			}
X		else goto beepout;
X		goto out;
X	case B_TYPE-2 : /* checked */
X		if (IS_FREE(Column,Row-1) && IS_FREE(Column+2,Row)) {
X			PUTCH(Column-1,Row-1,NO_CHAR);
X			PUTCH(Column-1,Row,NO_CHAR);
X			PUTCH(Column,Row-1,B_CHAR);
X			PUTCH(Column+2,Row,B_CHAR);
X			Column +=1;
X			}
X		else goto beepout;
X		goto out;
X	case B_TYPE-3 : /* checked */
X		if (IS_FREE(Column+1,Row-1) && IS_FREE(Column+1,Row) && 
X		    IS_FREE(Column+1,Row+1)) {
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column,Row,NO_CHAR);
X			PUTCH(Column-1,Row+1,NO_CHAR);
X			PUTCH(Column+1,Row-1,B_CHAR);
X			PUTCH(Column+1,Row,B_CHAR);
X			PUTCH(Column+1,Row+1,B_CHAR);
X			Column +=1;
X			}
X		else goto beepout;
X		goto out;
X
X	/*  VIOLET PIECES  */
X	case V_TYPE   :
X	case V_TYPE-2 : /* checked */
X		if (IS_FREE(Column+3,Row)) {
X			PUTCH(Column-1,Row,NO_CHAR);
X			PUTCH(Column+3,Row,V_CHAR);
X			Column +=1;
X			}
X		else goto beepout;
X		goto out;
X	case V_TYPE-1 :
X	case V_TYPE-3 : /* checked */
X		if (IS_FREE(Column+1,Row-1) && IS_FREE(Column+1,Row) && 
X		    IS_FREE(Column+1,Row+1) && IS_FREE(Column+1,Row+2)) {
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column,Row,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column,Row+2,NO_CHAR);
X			PUTCH(Column+1,Row-1,V_CHAR);
X			PUTCH(Column+1,Row,V_CHAR);
X			PUTCH(Column+1,Row+1,V_CHAR);
X			PUTCH(Column+1,Row+2,V_CHAR);
X			Column +=1;
X			}
X		else goto beepout;
X		goto out;
X	default : 
X		printf("illegal piece Type=%d!!\n",Type);
X		exit();
X	}
beepout:
X	if (Beep) beep();
out:
X	refresh();
X}
X
END_OF_FILE
if test 6676 -ne `wc -c <'MoveR.c'`; then
    echo shar: \"'MoveR.c'\" unpacked with wrong size!
fi
# end of 'MoveR.c'
fi
if test -f 'NewP.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'NewP.c'\"
else
echo shar: Extracting \"'NewP.c'\" \(3120 characters\)
sed "s/^X//" >'NewP.c' <<'END_OF_FILE'
X
X#include <tam.h>
X#include <termio.h>
X#include "tet.h"
X/*********************************************************************/
X/* A new piece is created on the game board if possible */
X/* returns 0 if unable to do it */
X/*********************************************************************/
NewPiece()
X{	
XFallingDown = 0;			/* true when fall key is pressed */
Type = ((int)(mrand48() % 4) + 4) * 4;	/* random number 4 8 16 20 24 or 28 */
X/* printf("DEBUG:NewPiece Type = %d\n",Type); */
X
switch (Type) {
X	case W_TYPE : /* checked  */
X	    if (IS_FREE(STARTCOL-1,STARTROW) && IS_FREE(STARTCOL,STARTROW) &&
X		IS_FREE(STARTCOL+1,STARTROW) && IS_FREE(STARTCOL,STARTROW+1)) {
X		PUTCH(STARTCOL-1,STARTROW,W_CHAR);
X		PUTCH(STARTCOL,STARTROW,W_CHAR);
X		PUTCH(STARTCOL+1,STARTROW,W_CHAR);
X		PUTCH(STARTCOL,STARTROW+1,W_CHAR);
X		}
X	    else {
X	return(0);
X	}
X	break;
X	case R_TYPE : /* checked */
X	    if (IS_FREE(STARTCOL-1,STARTROW) && IS_FREE(STARTCOL,STARTROW) &&
X	       IS_FREE(STARTCOL+1,STARTROW) && IS_FREE(STARTCOL-1,STARTROW+1)) {
X		PUTCH(STARTCOL-1,STARTROW,R_CHAR);
X		PUTCH(STARTCOL,STARTROW,R_CHAR);
X		PUTCH(STARTCOL+1,STARTROW,R_CHAR);
X		PUTCH(STARTCOL-1,STARTROW+1,R_CHAR);
X		}
X	    else return(0);
X	break;
X	case T_TYPE : /* checked */
X	    if (IS_FREE(STARTCOL,STARTROW) && IS_FREE(STARTCOL,STARTROW+1) &&
X	       IS_FREE(STARTCOL+1,STARTROW) && IS_FREE(STARTCOL+1,STARTROW+1)) {
X		PUTCH(STARTCOL,STARTROW,T_CHAR);
X		PUTCH(STARTCOL,STARTROW+1,T_CHAR);
X		PUTCH(STARTCOL+1,STARTROW,T_CHAR);
X		PUTCH(STARTCOL+1,STARTROW+1,T_CHAR);
X		}
X	    else return(0);
X	break;
X	case Y_TYPE : /* checked */
X	   if (IS_FREE(STARTCOL-1,STARTROW+1) && IS_FREE(STARTCOL,STARTROW+1) &&
X		IS_FREE(STARTCOL,STARTROW) && IS_FREE(STARTCOL+1,STARTROW)) {
X		PUTCH(STARTCOL-1,STARTROW+1,Y_CHAR);
X		PUTCH(STARTCOL,STARTROW+1,Y_CHAR);
X		PUTCH(STARTCOL,STARTROW,Y_CHAR);
X		PUTCH(STARTCOL+1,STARTROW,Y_CHAR);
X		}
X	    else return(0);
X	break;
X	case G_TYPE : { /* checked */
X	    if (IS_FREE(STARTCOL-1,STARTROW) && IS_FREE(STARTCOL,STARTROW) &&
X	       IS_FREE(STARTCOL,STARTROW+1) && IS_FREE(STARTCOL+1,STARTROW+1)) {
X		PUTCH(STARTCOL-1,STARTROW,G_CHAR);
X		PUTCH(STARTCOL,STARTROW,G_CHAR);
X		PUTCH(STARTCOL,STARTROW+1,G_CHAR);
X		PUTCH(STARTCOL+1,STARTROW+1,G_CHAR);
X		}
X	    else return(0);
X	break; }
X	case B_TYPE : /* checked */
X	    if (IS_FREE(STARTCOL-1,STARTROW) && IS_FREE(STARTCOL,STARTROW) &&
X	       IS_FREE(STARTCOL+1,STARTROW) && IS_FREE(STARTCOL+1,STARTROW+1)) {
X		PUTCH(STARTCOL-1,STARTROW,B_CHAR);
X		PUTCH(STARTCOL,STARTROW,B_CHAR);
X		PUTCH(STARTCOL+1,STARTROW,B_CHAR);
X		PUTCH(STARTCOL+1,STARTROW+1,B_CHAR);
X		}
X	    else return(0);
X	break;
X	case V_TYPE : /* checked */
X	    if (IS_FREE(STARTCOL-1,STARTROW) && IS_FREE(STARTCOL,STARTROW) &&
X		IS_FREE(STARTCOL+1,STARTROW) && IS_FREE(STARTCOL+2,STARTROW)) {
X		PUTCH(STARTCOL-1,STARTROW,V_CHAR);
X		PUTCH(STARTCOL,STARTROW,V_CHAR);
X		PUTCH(STARTCOL+1,STARTROW,V_CHAR);
X		PUTCH(STARTCOL+2,STARTROW,V_CHAR);
X		}
X	    else return(0);
X	break;
X	default : printf("illegal piece Type=%d!!\n",Type); exit();
X	}
refresh();
Row=STARTROW; Column=STARTCOL;	/* all pieces start at same point */
X}
END_OF_FILE
if test 3120 -ne `wc -c <'NewP.c'`; then
    echo shar: \"'NewP.c'\" unpacked with wrong size!
fi
# end of 'NewP.c'
fi
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(2323 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
This program has been through so many ports and rewrites that the
lineage is completely lost. To my knowledge it does not contain
any copyrighted code. The last identifiable author is Quentin Neill
but unfortunately he has not included his email address in any of
the documentation. I have hacked in some UNIXpc specific stuff but
the majority of the code is Quentin's. 
X
Hans Jespersen           ..!uunet!attcan!hjespers
X
X--------------------Original README-----------------------------------
X
X        This is a Unix SysV implementation of a game that appeared on
comp.binaries.amiga a while ago. The author, Quentin Neill,
saw it on an amiga here at work, and ported it to curses 
X(on his own time, of course ;-)  ).
X	I'm not too sure about the history of tetrix.  Someone 
said that the game originated in Russia, and that it is quite old.
We became enthralled with the game on an Amiga, almost to the point
of addiction.  That version had some documentation, but I never had
the chance to read it - I only played.  I considered writing a version
in machine language for my Franklin junker at home, but settled on a
C implementation for unix machines.
X	The object of the game is to keep the board clear for as long as
possible.  Pieces consisting of four blocks (hence the name TETRix) in the
seven possible arrangements are sent down one at a time.  The player's
job is to find the best fit for the piece in the pile of blocks that have
already fallen.  He can rotate each piece and move it from side to side.  
If the piece just played causes a complete row of blocks, that row is 
erased and all blocks above it move down one row.  Points are awarded for
completed rows - more for rows higher up on the board.  A piece may
be dropped from a height for additional points when the player feels it 
is oriented correctly.  The game is over when no more pieces can be formed
at the top of the board.
X	There is one variable INIT_PAUSE in tet.c that compensates for
different machine speeds.  Set this higher if tetrix screams, and the 
time between each piece's movement will lengthen.  Set it lower if
it crawls along too slowly.  On a Tower 32/800 with about 45 users on a
busy day, we do well with the value set at about 300.  On a Tower 32/200
with one user, the value was set at 1500.
X
X	Good luck!					Quentin Neill
X
END_OF_FILE
if test 2323 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'Rotate.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Rotate.c'\"
else
echo shar: Extracting \"'Rotate.c'\" \(6226 characters\)
sed "s/^X//" >'Rotate.c' <<'END_OF_FILE'
X
X#include <tam.h>
X#include <termio.h>
X#include "tet.h"
X/*********************************************************************/
X/* Switch on type of piece, find out if I can rotate */
X/* If so, then do it */
X/*********************************************************************/
Rotate()
X{
switch (Type) {
X	/*  WHITE PIECES  */
X	case W_TYPE   :  /* checked */
X		if (IS_FREE(Column,Row-1)) {
X			PUTCH(Column-1,Row,NO_CHAR);
X			PUTCH(Column,Row-1,W_CHAR);
X			Type--;
X			}
X		else goto beepout;
X		goto out;
X	case W_TYPE-1 :  /* checked */
X		if (IS_FREE(Column-1,Row)) {
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column-1,Row,W_CHAR);
X			Type--;
X			}
X		else goto beepout;
X		goto out;
X	case W_TYPE-2 :  /* checked */
X		if (IS_FREE(Column,Row+1)) {
X			PUTCH(Column+1,Row,NO_CHAR);
X			PUTCH(Column,Row+1,W_CHAR);
X			Type--;
X			}
X		else goto beepout;
X		goto out;
X	case W_TYPE-3 :  /* checked */
X		if (IS_FREE(Column+1,Row)) {
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column+1,Row,W_CHAR);
X			Type = W_TYPE;
X			}
X		else goto beepout;
X		goto out;
X
X	/*  RED PIECES  */
X	case R_TYPE   : /* checked */
X		if (IS_FREE(Column,Row-1) && IS_FREE(Column,Row+1) && 
X		    IS_FREE(Column+1,Row+1)) {
X			PUTCH(Column-1,Row,NO_CHAR);
X			PUTCH(Column-1,Row+1,NO_CHAR);
X			PUTCH(Column+1,Row,NO_CHAR);
X			PUTCH(Column,Row-1,R_CHAR);
X			PUTCH(Column,Row+1,R_CHAR);
X			PUTCH(Column+1,Row+1,R_CHAR);
X			Type--;
X			}
X		else goto beepout;
X		goto out;
X	case R_TYPE-1 : /* checked */
X		if (IS_FREE(Column-1,Row) && IS_FREE(Column+1,Row-1) && 
X		    IS_FREE(Column+1,Row)) {
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column+1,Row+1,NO_CHAR);
X			PUTCH(Column-1,Row,R_CHAR);
X			PUTCH(Column+1,Row-1,R_CHAR);
X			PUTCH(Column+1,Row,R_CHAR);
X			Type--;
X			}
X		else goto beepout;
X		goto out;
X	case R_TYPE-2 : /* checked  */
X		if (IS_FREE(Column-1,Row-1) && IS_FREE(Column,Row-1) && 
X		    IS_FREE(Column,Row+1)) {
X			PUTCH(Column-1,Row,NO_CHAR);
X			PUTCH(Column+1,Row-1,NO_CHAR);
X			PUTCH(Column+1,Row,NO_CHAR);
X			PUTCH(Column-1,Row-1,R_CHAR);
X			PUTCH(Column,Row-1,R_CHAR);
X			PUTCH(Column,Row+1,R_CHAR);
X			Type--;
X			}
X		else goto beepout;
X		goto out;
X	case R_TYPE-3 : /* checked */
X		if (IS_FREE(Column-1,Row) && IS_FREE(Column-1,Row+1) && 
X		    IS_FREE(Column+1,Row)) {
X			PUTCH(Column-1,Row-1,NO_CHAR);
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column-1,Row,R_CHAR);
X			PUTCH(Column-1,Row+1,R_CHAR);
X			PUTCH(Column+1,Row,R_CHAR);
X			Type = R_TYPE;
X			}
X		else goto beepout;
X		goto out;
X
X	/*  TAN PIECES  */
X	case T_TYPE   :
X	case T_TYPE-1 :
X	case T_TYPE-2 :
X	case T_TYPE-3 : goto out;
X
X	/*  YELLOW PIECES  */
X	case Y_TYPE   :
X	case Y_TYPE-2 :  /* checked */
X		if (IS_FREE(Column,Row-1) && IS_FREE(Column+1,Row+1)) {
X			PUTCH(Column-1,Row+1,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column,Row-1,Y_CHAR);
X			PUTCH(Column+1,Row+1,Y_CHAR);
X			Type--;
X			}
X		else goto beepout;
X		goto out;
X	case Y_TYPE-1 :
X	case Y_TYPE-3 : /* checked */
X		if (IS_FREE(Column-1,Row+1) && IS_FREE(Column,Row+1)) {
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column+1,Row+1,NO_CHAR);
X			PUTCH(Column-1,Row+1,Y_CHAR);
X			PUTCH(Column,Row+1,Y_CHAR);
X			Type = Y_TYPE;
X			}
X		else goto beepout;
X		goto out;
X
X	/*  GREEN PIECES  */
X	case G_TYPE   :
X	case G_TYPE-2 : /* checked */
X		if (IS_FREE(Column-1,Row+1) && IS_FREE(Column,Row-1)) {
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column+1,Row+1,NO_CHAR);
X			PUTCH(Column-1,Row+1,G_CHAR);
X			PUTCH(Column,Row-1,G_CHAR);
X			Type--;
X			}
X		else goto beepout;
X		goto out;
X	case G_TYPE-1 :
X	case G_TYPE-3 : /* checked */
X		if (IS_FREE(Column,Row+1) && IS_FREE(Column+1,Row+1)) {
X			PUTCH(Column-1,Row+1,NO_CHAR);
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column,Row+1,G_CHAR);
X			PUTCH(Column+1,Row+1,G_CHAR);
X			Type = G_TYPE;
X			}
X		else goto beepout;
X		goto out;
X
X
X	/*  BLUE PIECES  */
X	case B_TYPE   : /* checked */
X		if (IS_FREE(Column,Row-1) && IS_FREE(Column,Row+1) && 
X		    IS_FREE(Column+1,Row-1)) {
X			PUTCH(Column-1,Row,NO_CHAR);
X			PUTCH(Column+1,Row,NO_CHAR);
X			PUTCH(Column+1,Row+1,NO_CHAR);
X			PUTCH(Column,Row-1,B_CHAR);
X			PUTCH(Column,Row+1,B_CHAR);
X			PUTCH(Column+1,Row-1,B_CHAR);
X			Type--;
X			}
X		else goto beepout;
X		goto out;
X	case B_TYPE-1 : /* checked */
X		if (IS_FREE(Column-1,Row-1) && IS_FREE(Column-1,Row) && 
X		    IS_FREE(Column+1,Row)) {
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column+1,Row-1,NO_CHAR);
X			PUTCH(Column-1,Row-1,B_CHAR);
X			PUTCH(Column-1,Row,B_CHAR);
X			PUTCH(Column+1,Row,B_CHAR);
X			Type--;
X			}
X		else goto beepout;
X		goto out;
X	case B_TYPE-2 : /* checked  */
X		if (IS_FREE(Column-1,Row+1) && IS_FREE(Column,Row-1) && 
X		    IS_FREE(Column,Row+1)) {
X			PUTCH(Column-1,Row-1,NO_CHAR);
X			PUTCH(Column-1,Row,NO_CHAR);
X			PUTCH(Column+1,Row,NO_CHAR);
X			PUTCH(Column-1,Row+1,B_CHAR);
X			PUTCH(Column,Row-1,B_CHAR);
X			PUTCH(Column,Row+1,B_CHAR);
X			Type--;
X			}
X		else goto beepout;
X		goto out;
X	case B_TYPE-3 : /* checked */
X		if (IS_FREE(Column-1,Row) && IS_FREE(Column+1,Row) && 
X		    IS_FREE(Column+1,Row+1)) {
X			PUTCH(Column-1,Row+1,NO_CHAR);
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column-1,Row,B_CHAR);
X			PUTCH(Column+1,Row,B_CHAR);
X			PUTCH(Column+1,Row+1,B_CHAR);
X			Type = B_TYPE;
X			}
X		else goto beepout;
X		goto out;
X
X	/*  VIOLET PIECES  */
X	case V_TYPE   :
X	case V_TYPE-2 : /* checked */
X		if (IS_FREE(Column,Row-1) && IS_FREE(Column,Row+1) && 
X		    IS_FREE(Column,Row+2)) {
X			PUTCH(Column-1,Row,NO_CHAR);
X			PUTCH(Column+1,Row,NO_CHAR);
X			PUTCH(Column+2,Row,NO_CHAR);
X			PUTCH(Column,Row-1,V_CHAR);
X			PUTCH(Column,Row+1,V_CHAR);
X			PUTCH(Column,Row+2,V_CHAR);
X			Type--;
X			}
X		else goto beepout;
X		goto out;
X	case V_TYPE-1 :
X	case V_TYPE-3 : /* checked */
X		if (IS_FREE(Column-1,Row) && IS_FREE(Column+1,Row) && 
X		    IS_FREE(Column+2,Row)) {
X			PUTCH(Column,Row-1,NO_CHAR);
X			PUTCH(Column,Row+1,NO_CHAR);
X			PUTCH(Column,Row+2,NO_CHAR);
X			PUTCH(Column-1,Row,V_CHAR);
X			PUTCH(Column,Row,V_CHAR);
X			PUTCH(Column+1,Row,V_CHAR);
X			PUTCH(Column+2,Row,V_CHAR);
X			Type = V_TYPE;
X			}
X		else goto beepout;
X		goto out;
X	default : 
X		printf("illegal piece Type=%d!!\n",Type); 
X		exit();
X	}
beepout:
X	if (Beep) beep();
out:
X	refresh();
X}
X
END_OF_FILE
if test 6226 -ne `wc -c <'Rotate.c'`; then
    echo shar: \"'Rotate.c'\" unpacked with wrong size!
fi
# end of 'Rotate.c'
fi
if test -f 'tet.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'tet.c'\"
else
echo shar: Extracting \"'tet.c'\" \(9746 characters\)
sed "s/^X//" >'tet.c' <<'END_OF_FILE'
X/* Tetrix by quentin */
X/* UNIXpc hacks by Hans Jespersen */
X
X#include <signal.h>
X#include <sys/ioctl.h>
X#include <fcntl.h>
X#include <stdio.h>
X#include <tam.h>
X#include <sys/termio.h>
X#include "tet.h"
X
X
X
X
X/* Definitions related to the operation of the program */
X
X#define	DFLT_PAUSE	200
X
X
X
X
X/********** Some global variable declarations ************/
int Type;		/* type specifies rotation, shape and color of blocks */
int Row;		/* Row of pivot point of block */
int Column;		/* Column of pivot point of block */
int Pause;		/* Time between movements this block */
int CurrentPause;	/* Time between movements per level */
int FallingDown;	/* True when space bar is pressed */
int Beep;
char Key;		/* holds last key polled */
X
X#define SCORE_FILE	"/usr/tmp/.TetScores"
char ScoreString[10];
struct ScoreStruct {
X	char Name[10];
X	int Score;
X} High[10];
int ThisScore,HighsChanged;
X		
char *ttyname();
char combuf[2];
struct termio origtty, tty;
char Board[BOARD_WIDE][BOARD_HIGH];
char Temp[BOARD_WIDE][BOARD_HIGH];	/* temp storage for TestRows */
X
X/* debug flash to screen */
X#define FLASHMSG(x)
X/*
X#define FLASHMSG(x)	      { mvaddstr(23,0,"                "); \
X				mvaddstr(23,0,x); \
X				refresh(); }
X*/
X#define UPSCORE(x)    { ThisScore += x; \
X			sprintf((char *)ScoreString,"%-d",ThisScore); \
X			mvaddstr(1,46,ScoreString); }
X
X#define NULL_KEY	'\0'
X#define FALL_KEY	' '
X#define RIGHT_KEY	'l'
X#define LEFT_KEY	'j'
X#define ROTATE_KEY	'k'
X#define L_RIGHT_KEY	'f'		/* for south paws */
X#define L_LEFT_KEY	's'
X#define L_ROTATE_KEY	'd'
X#define QUIT_KEY	'q'
X#define BEEP_KEY	'b'
X#define BOSS_KEY	'\033'
X#define PLAY_KEY	'p'
X#define SCORE_KEY	'h'
X#define MENU_KEY	'm'
X
X/**************************************************MAIN*****/
main()
X{
X	Init();
X	for ( ; ; ) {
X		NewGame();
X		Play();
X		ScoreIt();
X		DrawScore();
X		}
X}
X
X/*************************************************************/
X
Init()
X{
X	register char *ttnam, *p;
X	register int x,y,i,fd;
X	int timein;
X
X	time(&timein);		/* get start time */
X	srand48(timein);	/* start rand randomly */
X
X	ttnam = ttyname (0); 
X	close (0); 
X	open (ttnam, O_NDELAY);
X	/*
X	 * setup raw mode, no echo
X	 */
X	ioctl (0, TCGETA, &origtty);
X	ioctl (0, TCGETA, &tty);
X	tty.c_iflag &= 077;
X	tty.c_oflag &= 077700;
X	tty.c_lflag = 0201;
X	tty.c_cc[4] =  1;
X	ioctl (1, TCSETAW, &tty);
X	signal(SIGINT, SIG_IGN);
X	
X	Beep=0;
X	HighsChanged = 0;
X	ScoreIt();
X	initscr();
X	clear();
X	refresh();
X	/* initilialize board to spaces */
X	for (x=0; x<BOARD_WIDE; x++) 
X		for (y=0; y<BOARD_HIGH; y++) 
X			PUTCH(x,y,NO_CHAR);
X	erase();
X	DrawMenu();
X	refresh();
X}
X
X/**************************************************************/
NewGame()
X{
X	register int x,y;
X
X	CurrentPause=0;
X
X	while (!CurrentPause) {
X		GetKey();
X		switch (Key) {
X			case BEEP_KEY   : Beep = !Beep ;
X					  if (Beep) beep(); 
X					  break;
X			case SCORE_KEY  : DrawScore(); break;
X			case MENU_KEY	: DrawMenu(); break;
X			case BOSS_KEY	: Boss(); break;
X			case PLAY_KEY	: CurrentPause=DFLT_PAUSE; break;
X			case QUIT_KEY   : Leave();
X			}
X	}
X	/* initilialize board to spaces */
X	for (x=0; x<BOARD_WIDE; x++) 
X		for (y=0; y<BOARD_HIGH; y++) 
X			PUTCH(x,y,NO_CHAR);
X	ThisScore=0;
X	mvaddstr(1,42,"|  ......  |");
X	UPSCORE(0);
X
X}
X
X/******************************************************************/
DrawMenu()
X{
X	register int y;
X	erase(); 
X
X	/* draw score border */
X	mvaddstr(0,42,".----------.");
X	mvaddstr(1,42,"|  ......  |");
X	mvaddstr(2,42,"`----------'");
X	UPSCORE(0);
X
X	/* draw menu */
X	mvaddstr( 4,35,".---------------------------.");
X	mvaddstr( 5,35,"|                           |");
X	mvaddstr( 6,35,"|      ..   Menu   ..       |");
X	mvaddstr( 7,35,"|                           |");
X	mvaddstr( 8,35,"|   h     .... high scores  |");
X	mvaddstr( 9,35,"|   b     .... toggle beep  |");
X	mvaddstr(10,35,"|   p     .... play         |");
X	mvaddstr(11,35,"|   q     .... quit         |");
X	mvaddstr(12,35,"|                           |");
X	mvaddstr(13,35,"| s or j  .... move left    |");
X	mvaddstr(14,35,"| d or k  .... rotate piece |");
X	mvaddstr(15,35,"| f or l  .... move right   |");
X	mvaddstr(16,35,"|  spc    .... fall piece   |");
X	mvaddstr(17,35,"|  esc    .... pause        |");
X	mvaddstr(18,35,"|                           |");
X	mvaddstr(19,35,"| LATEST: allow concurrent  |");
X	mvaddstr(20,35,"|    high score setting     |");
X	mvaddstr(21,35,"`---------------------------'");
X
X	/* draw game border */
X	mvaddstr(4,10, ".----------------------.");
X	mvaddstr(21,10,"`----------------------'");
X	for (y=5; y<21; y++)
X		mvaddstr(y,10,"|                      |");
X
X	/* display the title */
X	mvaddstr(3,20,"TETRIX");
X	refresh();
X}
X
X/**************************************************************/
Play()
X{
while ((Key != QUIT_KEY) && NewPiece()) {
X	FallingDown = 0;
X	do {	/* do until we can't Advance the piece */
X		if (FallingDown) 
X			Pause = 0;
X		else 
X			Pause = CurrentPause;
X		while (Pause) {		/* do this until pause runs out */
X			Pause--;
X			switch (Key) {
X				case BOSS_KEY     : Boss(); break;
X				case QUIT_KEY     : CurrentPause = 0;
X				case FALL_KEY     : FallingDown = 1;
X						    UPSCORE(20-Row);
X						    Pause = 0; break;
X				case RIGHT_KEY    :
X				case L_RIGHT_KEY  : MoveRight(); break;
X				case LEFT_KEY     :
X				case L_LEFT_KEY   : MoveLeft(); break;
X				case ROTATE_KEY   :
X				case L_ROTATE_KEY : Rotate(); break;
X				case NULL_KEY     : break;
X				default           : if (Beep) beep();
X				}
X			GetKey();
X			}
X		} while (AdvancePiece());
X	UPSCORE(5);
X	TestRows();
X	}
X}
X
X/*********************************************************************/
ScoreIt()
X{
X	register int  oldmask,fd,i,j;
X
X	oldmask = umask(0);
X	if ((fd=open(SCORE_FILE,O_CREAT|O_RDONLY,0666)) != -1) {
X		read(fd,High,sizeof(High));
X		close(fd);
X	}
X	else {
X	for(i=0; i<10; i++)
X		High[i].Score = 0;
X	for(i=0; i<10; i++)
X		strncpy("         ",High[i].Name,10);
X	}
X	umask(oldmask);
X
X	for (i=0; i<10; i++)		/* place this guy */
X		if (High[i].Score <= ThisScore) break;
X
X	if (i < 10 )			/* insert this score */
X	{
X		HighsChanged = 1;
X		for (j=9; j>i; j--)		/* move down others */
X			if (High[j-1].Score)
X			{
X				High[j].Score = High[j-1].Score;
X				strncpy(High[j].Name,High[j-1].Name,10);
X			}
X		cuserid((char *) High[i].Name);
X		High[i].Score = ThisScore;
X	}
X
X	if (HighsChanged)
X	{
X		if ((fd=open(SCORE_FILE,O_RDWR)) != -1) {
X			write(fd,High,sizeof(High));
X			close(fd);
X		}
X		else mvaddstr(22,0,"Couldn't open high score file.");
X	}
X	
X}
X
X/***********************************************************************/
DrawScore()
X{
X	register int j;
X
X	mvaddstr( 5,35,"|     Hit 'm' for menu      |");
X	mvaddstr( 6,35,"|                           |");
X	mvaddstr( 7,35,"|        HIGH SCORES        |");
X	mvaddstr( 8,35,"| 1.                        |");
X	mvaddstr( 9,35,"| 2.                        |");
X	mvaddstr(10,35,"| 3.                        |");
X	mvaddstr(11,35,"| 4.                        |");
X	mvaddstr(12,35,"| 5.                        |");
X	mvaddstr(13,35,"| 6.                        |");
X	mvaddstr(14,35,"| 7.                        |");
X	mvaddstr(15,35,"| 8.                        |");
X	mvaddstr(16,35,"| 9.                        |");
X	mvaddstr(17,35,"|10.                        |");
X	mvaddstr(18,35,"|                           |");
X	mvaddstr(19,35,"|                           |");
X	mvaddstr(20,35,"|                           |");
X	
X	for (j=0; j<10; j++)
X	   if (High[j].Score)
X	   {
X	      move(j+8,41);
X	      printw("%-s",(char *)High[j].Name);
X	      move(j+8,54);
X	      printw("%d",High[j].Score);
X	   }
X	refresh();
X
X}
X
X/*********************************************************************/
Boss()
X{	register int x,y;
X
X	clear();
X	refresh();
X	ioctl (0, TCSETA, &origtty);
X	system("sh </dev/tty >/dev/tty");
X	ioctl (1, TCSETAW, &tty);
X	clear();
X	DrawMenu();
X	/* restore board */
X	for (x=0; x<BOARD_WIDE; x++) 
X		for (y=0; y<BOARD_HIGH; y++) 
X			PUTCH(x,y,Board[x][y]);
X	refresh();
X
X}
X
X/*********************************************************************/
GetKey()
X{
X/*	fflush(stdout); */
X	Key = NULL_KEY;
X	top:
X	if (read (0, combuf, 1) == 0) 
X		return;
X	else Key = (*combuf&0177); 
X	goto top;
X}
X
X/************************************************************************/
X/* Could be a macro for speed but cpp runs out of tree space in CanMove */
IS_FREE(x,y)
int x,y;
X{
X	if ((y < 0) || (y >= BOARD_HIGH) || (x < 0) || (x >= BOARD_WIDE))
X		return(0);
X	if (Board[x][y] != NO_CHAR)
X		return(0);
X	else return(1);
X}
X
X/*********************************************************************/
TestRows()
X{	register int x,y,tempy,fullrow;
X	int marked[BOARD_HIGH];
X
for (y=0; y<BOARD_HIGH; y++) {
X	marked[y] = 0;
X	for (x=0; x<BOARD_WIDE; x++)
X		Temp[x][y] = NO_CHAR;
X	}
X
X/* main loop to traverse Board, looking for fullrows */
X/* as it looks, it copies non full ones over to Temp */
tempy=BOARD_HIGH-1;
for (y=BOARD_HIGH-1; y>=0; y--) {
X	fullrow = 1;
X	for (x=0; x<BOARD_WIDE; x++)		/* check for any holes at all */
X		if (IS_FREE(x,y)) { fullrow = 0; break; }
X	if (fullrow) {
X		marked[y]++;
X		CurrentPause--;			/* speed up the game */
X	}
X	else    {
X		for (x=0; x<BOARD_WIDE; x++)
X			Temp[x][tempy] = Board[x][y];
X		tempy--;
X		}
X	}
X
X/* flash the rows that will die */
for (tempy=1; tempy<5; tempy++)
X	for (y=BOARD_HIGH-1; y>=0; y--) 
X		if (marked[y]) {	
X			UPSCORE(30-y);
X			for (x=0; x<BOARD_WIDE; x++)	
X				PUTCH(x,y,BRITE_CHAR);
X			refresh();
X			for (x=0; x<BOARD_WIDE; x++)	
X				PUTCH(x,y,NO_CHAR);
X			refresh();
X			}
X
X/* Move temp back to Board */
for (y=BOARD_HIGH-1; y>=0; y--) {
X	for (x=0; x<BOARD_WIDE; x++)
X		PUTCH(x,y,Temp[x][y]);
X	refresh();
X	}
X}
X
X/***********************************************************/
Leave()
X{
X	erase();
X	mvaddstr(22,48,"Tetrix says Bye\n");
X	mvaddstr(23,0,"");
X	refresh();
X	sleep(1);
X	ioctl (0, TCSETA, &origtty);
X	exit(0);
X}
END_OF_FILE
if test 9746 -ne `wc -c <'tet.c'`; then
    echo shar: \"'tet.c'\" unpacked with wrong size!
fi
# end of 'tet.c'
fi
if test -f 'tet.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'tet.h'\"
else
echo shar: Extracting \"'tet.h'\" \(1161 characters\)
sed "s/^X//" >'tet.h' <<'END_OF_FILE'
X#define NO_TYPE	0
X#define NO_CHAR	' '
X#define BRITE_CHAR '$'
X
X/* type numbers 1-3, 4-7, 9-11 etc represent the white, red, blue etc */
X/* pieces at different rotations */
X#define G_TYPE	4		/* Green pieces */
X#define G_CHAR	'G'
X#define R_TYPE	8		/* Red pieces */
X#define R_CHAR	'R'
X#define T_TYPE  12		/* Tan pieces */
X#define T_CHAR	'O'
X#define W_TYPE	16		/* White pieces */
X#define W_CHAR	'W'
X#define V_TYPE	20		/* Violet pieces */
X#define V_CHAR	'V'
X#define B_TYPE	24		/* Blue pieces */
X#define B_CHAR	'B'
X#define Y_TYPE	28		/* Yellow pieces */
X#define Y_CHAR	'Y'
X
X#define MINX 15		/* defines corner screen position */
X#define MINY 1
X
X#define BOARD_WIDE 10
X#define BOARD_HIGH 20
X
X#define MAXX BOARD_WIDE+MINX
X#define MAXY BOARD_HIGH+MINY
X
X#define STARTROW 1		/* defines starting position of pieces */
X#define STARTCOL 5
X
extern int Type, Row, Column, Pause, CurrentSpeed, FallingDown, Beep;
extern char Board[BOARD_WIDE][BOARD_HIGH];
X
extern void PUTCH();
X
X/* Macros */
X/* test whether a square is empty and legal */
X/*
X#define IS_FREE(x,y)  (((y >= 0) && (y < BOARD_HIGH) && \
X			(x >= 0) && (x < BOARD_WIDE)) && \
X			(Board[x][y] == NO_CHAR))
X*/
IS_FREE();
END_OF_FILE
if test 1161 -ne `wc -c <'tet.h'`; then
    echo shar: \"'tet.h'\" unpacked with wrong size!
fi
# end of 'tet.h'
fi
if test -f 'window.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'window.c'\"
else
echo shar: Extracting \"'window.c'\" \(1345 characters\)
sed "s/^X//" >'window.c' <<'END_OF_FILE'
X/**********************************************************\
X* Bugs : a bit-mapped arcade game for the AT&T UNIX PC.    *
X*                                                          *
X* By : Hans Jespersen                                      *
X*                                                          *
X* Copyright 1989, Hans Jespersen                           *
X*                                                          *
X\**********************************************************/
X
X#include <sys/window.h>
X#include <stdio.h>
X#include <termio.h>
X#include <tam.h>
X#include <fcntl.h>
X#include "tet.h"
X
extern unsigned short patwhite[];
extern unsigned short patblack[];
extern unsigned short patgray[];
unsigned short pathex[16] = {
X	0x8888, 0x5555, 0x2222, 0x5555,
X	0x8888, 0x5555, 0x2222, 0x5555,
X	0x8888, 0x5555, 0x2222, 0x5555,
X	0x8888, 0x5555, 0x2222, 0x5555,
X};
int wn;
X
void PUTCH( x, y, z)
int x, y, z;
X{
X	Board[x][y] = z;
X	if( z == NO_CHAR )
X	   wrastop(0,0,0,0,0,0,0,100+x*20,56+y*10,19,9,SRCPAT,DSTSRC,patblack);
X	else if( z == G_CHAR || z == R_CHAR || z == T_CHAR )
X	   wrastop(0,0,0,0,0,0,0,100+x*20,56+y*10,19,9,SRCPAT,DSTSRC,patwhite);
X	else if( z == W_CHAR || z == V_CHAR )
X	   wrastop(0,0,0,0,0,0,0,100+x*20,56+y*10,19,9,SRCPAT,DSTSRC,patgray);
X	else
X	   wrastop(0,0,0,0,0,0,0,100+x*20,56+y*10,19,9,SRCPAT,DSTSRC,pathex);
X}
END_OF_FILE
if test 1345 -ne `wc -c <'window.c'`; then
    echo shar: \"'window.c'\" unpacked with wrong size!
fi
# end of 'window.c'
fi
echo shar: End of archive 1 \(of 1\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have the archive.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0