Article 12827 of alt.sources:
Newsgroups: alt.sources
Path: nntpd.lkg.dec.com!pa.dec.com!news1.digital.com!nntp-hub2.barrnet.net!nntp-ucb.barrnet.net!agate!howland.reston.ans.net!xlink.net!wega.fibronics.de!lif.de!layla.RoBIN.de!batman.RoBIN.de!news.omnilink.net!news.maz.net!news.ppp.net!news.ppp.de!nucleus!busters!buster
From: buster@isys.net (Andreas Burmester)
Subject: moty_0.82 1/5
Followup-To: alt.sources.d
Reply-To: buster@isys.net
Organization: private
Date: Tue, 12 Sep 1995 14:03:32 GMT
Message-ID: <DEsppx.wG@isys.net>
Lines: 1671


#! /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 5)."
# Contents:  moty_0.82 moty_0.82/README moty_0.82/Makefile
#   moty_0.82/mcrt.c moty_0.82/mhelp.c moty_0.82/mlarges.c
#   moty_0.82/mload.c moty_0.82/moty.c moty_0.82/moty.h
#   moty_0.82/mpasswd.c moty_0.82/mscreens.c moty_0.82/mtime.c
# Wrapped by buster@busters on Tue Sep 12 16:01:17 1995
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test ! -d 'moty_0.82' ; then
    echo shar: Creating directory \"'moty_0.82'\"
    mkdir 'moty_0.82'
fi
if test -f 'moty_0.82/README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'moty_0.82/README'\"
else
echo shar: Extracting \"'moty_0.82/README'\" \(1411 characters\)
sed "s/^X//" >'moty_0.82/README' <<'END_OF_FILE'
XThis is moty_0.82, a curses(3) based, animated combinatorial game I
Xwrote a couple of years ago for Unices.
X
XSince I don't deliver a fancy Configure script, you have to edit the
XMakefile before compilation:
X
XBeside the usual things, you possibly have to add additional libraries
Xto be linked in to the LIBS line.
X
XSpecial attention is required for OPTIONS. -DHAVE_SELECT will probably
Xwork on most BSD based systems, while -DHAVE_POLL is good for SYSV.
X
XOnce MOTY is translated, call it with command line option "-h" to
Xfigure out what the command line options and the interactive commands
Xare.
X
XThe game itself and what it is all about is thought to be described by
Xtwo demonstration screens that are played automatically when MOTY is
Xcalled with "-d":
X
XWithin the first one, all things are done right and the screen is
Xsolved; the second one shows the behavior of various items when treaded
Xone way or the other and what should possibly not considered to be done
Xif you want to exit the screen successfully.
X
Xb.
X--
X                                                        __o
X                                                      _`\<,_
X                                                     (_)/ (_)
X-------------------------------------------------------------
XAndreas Burmester                  Internet: buster@isys.net
XPhn & FAX: +49 40 6900337
X-------------------------------------------------------------
END_OF_FILE
if test 1411 -ne `wc -c <'moty_0.82/README'`; then
    echo shar: \"'moty_0.82/README'\" unpacked with wrong size!
fi
# end of 'moty_0.82/README'
fi
if test -f 'moty_0.82/Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'moty_0.82/Makefile'\"
else
echo shar: Extracting \"'moty_0.82/Makefile'\" \(720 characters\)
sed "s/^X//" >'moty_0.82/Makefile' <<'END_OF_FILE'
X# Makefile for MOTY.
X
XCC	= cc
X
X# You might want to turn on any level of optimization.
XCFLAGS	= 
X
XLFLAGS	= -s
X
X# Set OPTIONS to -DHAVE_SELECT if you have a working select(2) system call,
X# to -DHAVE_POLL if you have a working poll(2) system call, or to none if
X# you have neither, respectively. The latter causes MOTY to do busy waiting.
XOPTIONS	= -DHAVE_SELECT
X
XTARGET	= moty
XOBJECTS	= moty.o mcrt.o mplay.o mtime.o mhelp.o mpasswd.o mlarges.o mload.o
XSCREENS	= mscreens.o
XLIBS	= -lcurses
X
X$(TARGET):	$(OBJECTS) $(SCREENS)
X	$(CC) -o $(TARGET) $(LFLAGS) $(OBJECTS) $(SCREENS) $(LIBS)
X
X$(OBJECTS):	moty.h
X
Xmscreens.c:	mscr_001-050 mscr_051-100 mscr_101-150 mscr_151-200
X	touch $@
X
X.c.o:
X	$(CC) -c $(CFLAGS) $(OPTIONS) $<
X
END_OF_FILE
if test 720 -ne `wc -c <'moty_0.82/Makefile'`; then
    echo shar: \"'moty_0.82/Makefile'\" unpacked with wrong size!
fi
# end of 'moty_0.82/Makefile'
fi
if test -f 'moty_0.82/mcrt.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'moty_0.82/mcrt.c'\"
else
echo shar: Extracting \"'moty_0.82/mcrt.c'\" \(9864 characters\)
sed "s/^X//" >'moty_0.82/mcrt.c' <<'END_OF_FILE'
X#include    "moty.h"
X
X/* >>>>>>>>>>>>>>>>>> CRT <<<<<<<<<<<<<<<<<<< */
X
X/* Terminal items */
X
X#define CRT (*crt)
X#define OLDCRT  (*oldcrt)
Xchar CRT[ROWMAX][2*COLMAX];
Xchar OLDCRT[ROWMAX][2*COLMAX];
XUBYTE dirty[ROWMAX];
X
Xvoid inicrt()
X{
X    int r,c;
X    char *s, *o;
X    if( crt == 0 )
X    {
X        crt = ualloc( sizeof(CRT) );
X        oldcrt = ualloc( sizeof(OLDCRT) );
X    }
X    s = (char *)crt;
X    o = (char *)oldcrt;
X    for( r = 0; r < ROWMAX; r++ )
X    {
X        dirty[r] = FALSE;
X        for( c = 0; c < 2*COLMAX; c++ )
X            *s++ = *o++ = ' ';
X    }
X}
X
Xvoid putdec(char *s, int len, int val)
X{
X    char *d;
X
X    d = &s[len - 1];
X    while( len-- )
X    {
X        *d-- = val % 10 + '0';
X        val /= 10;
X    }
X}
X
Xvoid prtdec(char *s, int len, int val)
X{
X    putdec(s,len,val);
X    addstr(s);
X}
X
Xvoid putldec(char *s, int len, int val)
X{
X    char *d;
X    d = &s[len - 1];
X    while( len-- )
X    {
X        *d-- = val % 10 + '0';
X        val /= 10;
X    }
X}
X
Xvoid prtldec(char *s, int len, int val)
X{
X    putldec(s,len,val);
X    addstr(s);
X}
X
X#define movebrc(r,c)    move(r + ROWOFF,c + COLOFF)
X#define vdaddr(r,c)     &CRT[r - 1][c + c - 2]
X#define vdputc(r,c,ch)  (*vdaddr(r,c) = ch)
X
Xvoid vdputs(int r, int c, char *s)
X{
X    char *d;
X
X    dirty[r - 1] = TRUE;
X    for( d = vdaddr(r,c); *s; )
X        *d++ = *s++;
X}
X
Xvoid prtframe()
X{
X    int i;
X    static char frames[] = "XX";
X    static char *speeds[] =
X    {
X        "fastissimo",
X        "fast",
X        "default",
X        "slow",
X        "boring"
X    };
X
X    movebrc(0,0);
X    for( i = 0; i <= COLMAX + 1; i++ )
X        addstr(frames);
X    for( i = 1; i <= ROWMAX; i++ )
X    {
X        movebrc(i,0); addstr(frames);
X        movebrc(i,2 * (COLMAX + 1)); addstr(frames);
X    }
X    movebrc(ROWMAX + 1,0);
X    for( i = 0; i <= COLMAX + 1; i++ )
X        addstr(frames);
X
X    mvaddstr(12,70,"TIME:");
X    mvaddstr(15,70,"HISCORE:");
X    mvaddstr(18,70,"SPEED:");
X    mvaddstr(19,70,speeds[speed]);
X    mvaddstr(21,70,"SCREEN #:");
X}
X
Xvoid prtscreen()
X{
X    int r,c;
X    UBYTE *dp;
X    char *cp,*op;
X
X    for( r = 0, dp = dirty; r < ROWMAX; r++, dp++ )
X        if( *dp )
X        {
X            *dp = FALSE;
X            cp = CRT[r];
X            op = OLDCRT[r];
X            for( c = 0; c < 2 * COLMAX; c++, cp++, op++ )
X                if( *cp != *op )
X                {
X                    movebrc(r + 1, c + 2);
X                    while( *cp != *op && c < 2 * COLMAX )
X                    {
X                        addch(*cp);
X                        *op++ = *cp++;
X                        c++;
X                    }
X                }
X        }
X    move(0,0);
X    refresh();
X    waitct();
X}
X
Xvoid vdobj(OBJ *op)
X{
X    char **s0;
X    char *s1,*s2;
X    short r, c;
X
X    r = op->row, c = op->col;
X
X    switch( op->kind )
X    {
X        case NOTHIN:
X            s1 = s2 = "    ";
X            break;
X        case SBRICK:
X        case LBRICK:
X        case RBRICK:
X            s1 = s2 = "XXXX";
X            break;
X        case PUSHER:
X        {
X            static char *this[][2] =
X            {
X                {   "O'`O",
X                    "`--'"
X                },
X                {   "@`'@",
X                    "-==-"
X                },
X                {   "O'`O",
X                    "`=='"
X                }
X            };
X
X            s0 = this[(op->state & GRINNING) ? 1 :
X                    (op->state & SLEEPING) ? 2 : 0];
X            s1 = *s0++;
X            s2 = *s0;
X            break;
X        }
X        case RBALL:
X        {
X            static char *this[][2] =
X            {
X                {   "/++\\",
X                    "\\++/"
X                },
X                {   "/++/",
X                    "/++/"
X                },
X                {   "\\++/",
X                    "/++\\"
X                },
X                {   "\\++\\",
X                    "\\++\\"
X                },
X                {   "/++\\",
X                    "\\++/"
X                },
X                {   "/.+\\",
X                    "\\++/"
X                },
X                {   "/ +\\",
X                    "\\++/"
X                },
X                {   "/ +\\",
X                    "\\+./"
X                },
X                {   "/ +\\",
X                    "\\+ /"
X                },
X                {   "/ .\\",
X                    "\\+ /"
X                },
X                {   "/  \\",
X                    "\\+ /"
X                },
X                {   "/  \\",
X                    "\\. /"
X                },
X                {   "   \\",
X                    "\\  /"
X                },
X                {   "   \\",
X                    "\\   "
X                },
X                {   "    ",
X                    "\\   "
X                }
X            };  
X            s0 = this[(op->state & CRUMBLING) >> 3];
X            s1 = *s0++;
X            s2 = *s0;
X            break;
X        }
X        case YBALL:
X        {
X            static char *this[][2] =
X            {
X                {   "/**\\",
X                    "\\**/"
X                },
X                {   "/**/",
X                    "/**/"
X                },
X                {   "\\**/",
X                    "/**\\"
X                },
X                {   "\\**\\",
X                    "\\**\\"
X                },
X                {   "/**\\",
X                    "\\**/"
X                },
X                {   "/.*\\",
X                    "\\**/"
X                },
X                {   "/ *\\",
X                    "\\**/"
X                },
X                {   "/ *\\",
X                    "\\*./"
X                },
X                {   "/ *\\",
X                    "\\* /"
X                },
X                {   "/ .\\",
X                    "\\* /"
X                },
X                {   "/  \\",
X                    "\\* /"
X                },
X                {   "/  \\",
X                    "\\. /"
X                },
X                {   "   \\",
X                    "\\  /"
X                },
X                {   "   \\",
X                    "\\   "
X                },
X                {   "    ",
X                    "\\   "
X                }
X            };  
X
X            s0 = this[(op->state & CRUMBLING) >> 3];
X            s1 = *s0++;
X            s2 = *s0;
X            break;
X        }
X        case PUMP:
X        {
X            static char t0[] = "XX", t1[] = "@@", t2[] = "  ";
X            short len,del,off;
X
X            switch( op->state & DIRECTION )
X            {
X                case UP:
X                    r++;
X                    off = -1;
X                    break;
X                case DOWN:
X                    off = 1;
X                    break;
X                case LEFT:
X                    c++; 
X                    off = -1;
X                    break;
X                case RIGHT:
X                    off = 1;
X                    break;
X            }
X            switch( op->state & PMP_STATE )
X            {
X                case PMP_IN:
X                    len = 1;
X                    del = (mtime != MAXTIME);
X                    break;
X                case PMP_HOUT:
X                    len = 2;
X                    del = FALSE;
X                    break;
X                case PMP_OUT:
X                    len = 3;
X                    del = FALSE;
X                    break;
X                case PMP_HIN:
X                    len = 2;
X                    del = TRUE;
X                    break;
X            }
X            if( !(op->state & PUMPING) )
X                del = FALSE;
X            if( op->state & 1 )         /* LEFT or RIGHT */
X            {
X                vdputs(r,c,t0);
X                vdputs(r+1,c,t0);
X                while( len-- )
X                {
X                    c += off;
X                    vdputs(r,c,t1);
X                    vdputs(r+1,c,t1);
X                }
X                if( del )
X                {
X                    c += off;
X                    vdputs(r,c,t2);
X                    vdputs(r+1,c,t2);
X                }
X            }
X            else                        /* UP or DOWN */
X            {
X                vdputs(r,c,t0);
X                vdputs(r,c+1,t0);
X                while( len-- )
X                {
X                    r += off;
X                    vdputs(r,c,t1);
X                    vdputs(r,c+1,t1);
X                }
X                if( del )
X                {
X                    r += off;
X                    vdputs(r,c,t2);
X                    vdputs(r,c+1,t2);
X                }
X            }
X            s1 = s2 = 0;
X            break;
X        }
X
X        case SPRING:
X            s1 = s2 =
X                (op->state & DEPRESSED)
X                ? 0
X                : (op->state & 1) ? "||||" : "====";    /* l/r || u/d */
X            break;
X
X    }
X    if( s1 )
X        vdputs(r++,c,s1);
X    if( s2 )
X        vdputs(r,c,s2);
X}
X
X/* first time putting & printing of all objects */
Xvoid putall()
X{
X    static char this[] = { '^','>','v','<' };
X    OBJ *op;
X    int i;
X    char *s;
X
X    s = (char *)crt;
X    for( i = 0; i < ROWMAX * 2 * COLMAX; i++ )
X            *s++ = ' ';
X    for( i = 0; i < ROWMAX; i++ )
X        dirty[i] = TRUE;
X
X    op = pusher;
X    for( i = 7; i ; i-- )
X    {
X        for( ; op->kind; op++ )
X        {
X            putobj(op);
X            if( (op->state & MOVING) && (op->kind != PUMP) )
X                vdputc(op->row+1,op->col+1,
X                    op->kind == RBRICK ? '@' : this[op->state & DIRECTION]);
X        }
X        op++;
X    }
X    prtscreen();
X}
X
Xvoid prttime()
X{
X    static char tis[] = "    ";
X    move(13,70);
X    prtdec(tis,4,mtime);
X}
X
Xvoid prthiscore()
X{
X    static char his[] = "       ";
X    move(16,70);
X    prtldec(his,7,hiscore);
X}
X
Xvoid prtsno(int scrno)
X{
X    static char scrns[] = "   ";
X    move(22,70);
X    prtdec(scrns,3,scrno);
X}
X
Xvoid prtstat(char *s)
X{   move(3,70);
X    addstr(s);
X}
X
Xvoid prtleft()
X{
X#if 0
X    static OBJ rest = { PUSHER, 0, 0, GRINNING};
X    rest.row = 16;
X    rest.col = 30;
X    vdobj(&rest);
X#endif
X}
END_OF_FILE
if test 9864 -ne `wc -c <'moty_0.82/mcrt.c'`; then
    echo shar: \"'moty_0.82/mcrt.c'\" unpacked with wrong size!
fi
# end of 'moty_0.82/mcrt.c'
fi
if test -f 'moty_0.82/mhelp.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'moty_0.82/mhelp.c'\"
else
echo shar: Extracting \"'moty_0.82/mhelp.c'\" \(2251 characters\)
sed "s/^X//" >'moty_0.82/mhelp.c' <<'END_OF_FILE'
X/* >>>>>>>>>>>>>>>>>> HELP <<<<<<<<<<<<<<<<<< */
X
X#include "moty.h"
X
Xvoid explain()
X{
X    static char *clo[] =
X    {   
X        "<Screen #>",
X        "-d   Demo",
X        "-k   Hacked Mode",
X        /* "-k   Don't Flush KBD Buffer", */
X        "-s   slow",
X        "-ss  even slower",
X        "-f   fast",
X        "-ff  fastissimo",
X        "-h   WYSIWYG"
X    };
X    static char *iac[][2] =
X    {
X        {"'8','k','e','w'","Up"},
X        {"'4','h','a','s'","Left"},
X        {"'6','l','d','f'","Right"},
X        {"'2','j','x','z'","Down"},
X        {"ESC","Restart Screen"},
X        {"^L,^R","Refresh Screen"},
X        {"'r'","Escape to Previous Screen"},
X        {"'c'","Escape to Next Screen"},
X        {"'q','!'","Quit MOTY"},
X        {"<anything else>","Stop Moving (Non-Hacked)"}
X    };
X    static char *discl[] = {
X"MOTY was originally developed by K. Schittenhelm and T. Albertz for a",
X"home computer.",
X"",
X"When I first saw it, I was instantaneously fascinated by it's seeming-",
X"ly simple logic, nevertheless it turned out to be increasingly diffi-",
X"cult to play. A while later I started to rewrite it 'from scratch' in",
X"C to have it on my own platform and to port it to various environments.",
X"One result is what you got.",
X"",
X"This implementation is declared to be a ShareWare product. If you want",
X"to get registered, send an appropiate check to",
X"",
X">>   Andreas Burmester, Zoppoter Str. 2, D-22049 Hamburg, Germany.",
X"",
X"You can also contact me via EMail, my current net address is",
X"",
X">>   buster@isys.net",
X"",
X"Credits to Schittenhelm & Albertz, who had all the ideas."
X    };
X
X    int i;
X
X    move(0,0);
X    larges(VERSION);
X    mvaddstr(8,21,"on a \"");
X    addstr(longname());
X    addstr("\" terminal.");
X
X    mvaddstr(10,2,"Command Line Options:");
X    for( i = 0; i < DIM(clo); i++ )
X        mvaddstr(12+i,4,clo[i]);
X    mvaddstr(10,32,"Interactive Commands:");
X    for( i = 0; i < DIM(iac); i++ )
X    {
X        mvaddstr(12+i,34,iac[i][0]);
X        mvaddstr(12+i,52,iac[i][1]);
X    }
X    mvaddstr(23,60,"--> make a move ");
X    refresh();
X    nodelay(stdscr,FALSE);
X    getch();
X    clear();
X    mvaddstr(0,2,"Miscellany:");
X    for( i = 0; i < DIM(discl); i++ )
X        mvaddstr(2+i,4,discl[i]);
X    mexit0();
X}
END_OF_FILE
if test 2251 -ne `wc -c <'moty_0.82/mhelp.c'`; then
    echo shar: \"'moty_0.82/mhelp.c'\" unpacked with wrong size!
fi
# end of 'moty_0.82/mhelp.c'
fi
if test -f 'moty_0.82/mlarges.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'moty_0.82/mlarges.c'\"
else
echo shar: Extracting \"'moty_0.82/mlarges.c'\" \(7147 characters\)
sed "s/^X//" >'moty_0.82/mlarges.c' <<'END_OF_FILE'
X#include    "moty.h"
X
X#define LPC         9
X#define CRTWIDTH    80
X
Xchar cwidth[] =
X{
X    0x02,0x02,0x05,0x07,0x07,0x07,0x07,0x04,
X    0x04,0x04,0x07,0x06,0x03,0x06,0x03,0x07,
X    0x07,0x05,0x07,0x07,0x07,0x07,0x07,0x07,
X    0x07,0x07,0x03,0x03,0x06,0x07,0x06,0x07,
X    0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,
X    0x07,0x04,0x07,0x07,0x07,0x07,0x07,0x07,
X    0x07,0x07,0x07,0x07,0x06,0x07,0x07,0x07,
X    0x07,0x07,0x07,0x05,0x07,0x05,0x07,0x07,
X    0x04,0x07,0x07,0x07,0x07,0x07,0x07,0x07,
X    0x07,0x04,0x06,0x06,0x04,0x08,0x07,0x07,
X    0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07,
X    0x07,0x07,0x07,0x05,0x02,0x05,0x07,0x07
X};
X
Xchar cg[][LPC] =
X{
X    { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
X    { 0xC0,0xC0,0xC0,0xC0,0x00,0x00,0xC0,0x00,0x00 },
X    { 0xD8,0xD8,0xD8,0x00,0x00,0x00,0x00,0x00,0x00 },
X    { 0x6C,0x6C,0xFE,0x6C,0xFE,0x6C,0x6C,0x00,0x00 },
X    { 0x30,0x7E,0xB0,0x7C,0x32,0xFC,0x30,0x00,0x00 },
X    { 0x00,0xE6,0xEC,0x18,0x30,0x6E,0xCE,0x00,0x00 },
X    { 0x70,0xD8,0xD8,0x70,0xDA,0xCC,0x7A,0x00,0x00 },
X    { 0x30,0x60,0xC0,0x00,0x00,0x00,0x00,0x00,0x00 },
X    { 0x30,0x60,0xC0,0xC0,0xC0,0x60,0x30,0x00,0x00 },
X    { 0xC0,0x60,0x30,0x30,0x30,0x60,0xC0,0x00,0x00 },
X    { 0x10,0xD6,0x7C,0xC6,0x7C,0xD6,0x10,0x00,0x00 },
X    { 0x00,0x30,0x30,0xFC,0x30,0x30,0x00,0x00,0x00 },
X    { 0x00,0x00,0x00,0x00,0x00,0x60,0x60,0xC0,0x00 },
X    { 0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00 },
X    { 0x00,0x00,0x00,0x00,0x00,0xE0,0xE0,0x00,0x00 },
X    { 0x00,0x06,0x0C,0x18,0x30,0x60,0xC0,0x00,0x00 },
X    { 0x7C,0xC6,0xCE,0xDE,0xF6,0xE6,0x7C,0x00,0x00 },
X    { 0x70,0xF0,0x30,0x30,0x30,0x30,0x78,0x00,0x00 },
X    { 0x7C,0xC6,0x06,0x1C,0x70,0xC0,0xFE,0x00,0x00 },
X    { 0x7C,0xC6,0x06,0x3C,0x06,0xC6,0x7C,0x00,0x00 },
X    { 0xC0,0xC0,0xCC,0xCC,0xFE,0x0C,0x0C,0x00,0x00 },
X    { 0xFE,0xC0,0xFC,0x06,0x06,0xC6,0x7C,0x00,0x00 },
X    { 0x7C,0xC6,0xC0,0xFC,0xC6,0xC6,0x7C,0x00,0x00 },
X    { 0xFE,0xC6,0x0C,0x18,0x30,0x30,0x30,0x00,0x00 },
X    { 0x7C,0xC6,0xC6,0x7C,0xC6,0xC6,0x7C,0x00,0x00 },
X    { 0x7C,0xC6,0xC6,0x7E,0x06,0xC6,0x7C,0x00,0x00 },
X    { 0x00,0x00,0xE0,0xE0,0x00,0xE0,0xE0,0x00,0x00 },
X    { 0x00,0x00,0x60,0x00,0x00,0x60,0x60,0xC0,0x00 },
X    { 0x1C,0x30,0x60,0xC0,0x60,0x30,0x1C,0x00,0x00 },
X    { 0x00,0x00,0xFE,0x00,0xFE,0x00,0x00,0x00,0x00 },
X    { 0xE0,0x30,0x18,0x0C,0x18,0x30,0xE0,0x00,0x00 },
X    { 0x7C,0xC6,0x06,0x1C,0x30,0x00,0x30,0x00,0x00 },
X    { 0x3C,0x66,0xDA,0xD6,0xDC,0x60,0x3E,0x00,0x00 },
X    { 0x38,0x6C,0xC6,0xC6,0xFE,0xC6,0xC6,0x00,0x00 },
X    { 0xFC,0xC6,0xC6,0xFC,0xC6,0xC6,0xFC,0x00,0x00 },
X    { 0x7C,0xC6,0xC0,0xC0,0xC0,0xC6,0x7C,0x00,0x00 },
X    { 0xFC,0xC6,0xC6,0xC6,0xC6,0xC6,0xFC,0x00,0x00 },
X    { 0xFE,0xC0,0xC0,0xF8,0xC0,0xC0,0xFE,0x00,0x00 },
X    { 0xFE,0xC0,0xC0,0xF8,0xC0,0xC0,0xC0,0x00,0x00 },
X    { 0x7C,0xC6,0xC0,0xCE,0xC6,0xC6,0x7C,0x00,0x00 },
X    { 0xC6,0xC6,0xC6,0xFE,0xC6,0xC6,0xC6,0x00,0x00 },
X    { 0xF0,0x60,0x60,0x60,0x60,0x60,0xF0,0x00,0x00 },
X    { 0x1E,0x0C,0x0C,0x0C,0x0C,0xCC,0x78,0x00,0x00 },
X    { 0xC6,0xCC,0xD8,0xF0,0xD8,0xCC,0xC6,0x00,0x00 },
X    { 0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xFE,0x00,0x00 },
X    { 0xC6,0xEE,0xD6,0xC6,0xC6,0xC6,0xC6,0x00,0x00 },
X    { 0xC6,0xC6,0xE6,0xF6,0xDE,0xCE,0xC6,0x00,0x00 },
X    { 0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00 },
X    { 0xFC,0xC6,0xC6,0xFC,0xC0,0xC0,0xC0,0x00,0x00 },
X    { 0x7C,0xC6,0xC6,0xC6,0xDA,0xCC,0x7A,0x00,0x00 },
X    { 0xFC,0xC6,0xC6,0xFC,0xD8,0xCC,0xC6,0x00,0x00 },
X    { 0x7C,0xC6,0xC0,0x7C,0x06,0xC6,0x7C,0x00,0x00 },
X    { 0xFC,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00 },
X    { 0xC6,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00 },
X    { 0xC6,0xC6,0xC6,0xC6,0xC6,0x6C,0x38,0x00,0x00 },
X    { 0xC6,0xC6,0xC6,0xC6,0xD6,0xEE,0xC6,0x00,0x00 },
X    { 0xC6,0xC6,0x6C,0x38,0x6C,0xC6,0xC6,0x00,0x00 },
X    { 0xC6,0xC6,0xC6,0x7E,0x06,0x06,0x7C,0x00,0x00 },
X    { 0xFE,0x06,0x0C,0x38,0x60,0xC0,0xFE,0x00,0x00 },
X    { 0xF8,0xC0,0xC0,0xC0,0xC0,0xC0,0xF8,0x00,0x00 },
X    { 0x00,0xC0,0x60,0x30,0x18,0x0C,0x06,0x00,0x00 },
X    { 0xF8,0x18,0x18,0x18,0x18,0x18,0xF8,0x00,0x00 },
X    { 0x00,0x38,0x6C,0xC6,0x00,0x00,0x00,0x00,0x00 },
X    { 0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00 },
X    { 0xC0,0x60,0x30,0x00,0x00,0x00,0x00,0x00,0x00 },
X    { 0x00,0x00,0x78,0x0C,0x7C,0xCC,0x7A,0x00,0x00 },
X    { 0xC0,0xC0,0xDC,0xE6,0xC6,0xE6,0xDC,0x00,0x00 },
X    { 0x00,0x00,0x7C,0xC6,0xC0,0xC6,0x7C,0x00,0x00 },
X    { 0x06,0x06,0x76,0xCE,0xC6,0xCE,0x76,0x00,0x00 },
X    { 0x00,0x00,0x7C,0xC6,0xFE,0xC0,0x7C,0x00,0x00 },
X    { 0x1C,0x36,0x30,0xFC,0x30,0x30,0x30,0x00,0x00 },
X    { 0x00,0x00,0x76,0xCE,0xCE,0xCE,0x76,0x06,0x7C },
X    { 0xC0,0xC0,0xDC,0xE6,0xC6,0xC6,0xC6,0x00,0x00 },
X    { 0x60,0x00,0xE0,0x60,0x60,0x60,0xF0,0x00,0x00 },
X    { 0x0C,0x00,0x1C,0x0C,0x0C,0x0C,0x0C,0xCC,0x78 },
X    { 0xC0,0xC0,0xCC,0xD8,0xF0,0xD8,0xCC,0x00,0x00 },
X    { 0xE0,0x60,0x60,0x60,0x60,0x60,0xF0,0x00,0x00 },
X    { 0x00,0x00,0xEE,0xDB,0xDB,0xDB,0xDB,0x00,0x00 },
X    { 0x00,0x00,0xDC,0xE6,0xC6,0xC6,0xC6,0x00,0x00 },
X    { 0x00,0x00,0x7C,0xC6,0xC6,0xC6,0x7C,0x00,0x00 },
X    { 0x00,0x00,0xDC,0xE6,0xE6,0xE6,0xDC,0xC0,0xC0 },
X    { 0x00,0x00,0x76,0xCE,0xCE,0xCE,0x76,0x06,0x06 },
X    { 0x00,0x00,0xDC,0xE6,0xC0,0xC0,0xC0,0x00,0x00 },
X    { 0x00,0x00,0x7E,0xC0,0x7C,0x06,0xFC,0x00,0x00 },
X    { 0x30,0x30,0xFC,0x30,0x30,0x36,0x1C,0x00,0x00 },
X    { 0x00,0x00,0xC6,0xC6,0xC6,0xC6,0x7C,0x00,0x00 },
X    { 0x00,0x00,0xC6,0xC6,0xC6,0x6C,0x38,0x00,0x00 },
X    { 0x00,0x00,0xC6,0xC6,0xC6,0xD6,0x6C,0x00,0x00 },
X    { 0x00,0x00,0xC6,0x6C,0x38,0x6C,0xC6,0x00,0x00 },
X    { 0x00,0x00,0xC6,0xC6,0xC6,0xC6,0x7E,0x06,0x7C },
X    { 0x00,0x00,0xFE,0x0C,0x38,0x60,0xFE,0x00,0x00 },
X    { 0x38,0x60,0x60,0xC0,0x60,0x60,0x38,0x00,0x00 },
X    { 0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x00,0x00 },
X    { 0xE0,0x30,0x30,0x18,0x30,0x30,0xE0,0x00,0x00 },
X    { 0x00,0x00,0x00,0x76,0xDC,0x00,0x00,0x00,0x00 },
X    { 0x38,0x38,0x38,0xFE,0x7C,0x38,0xFE,0x00,0x00 },
X    { 0x1B,0x06,0x00,0x00,0xDC,0xE6,0xC0,0xC0,0xC0 },
X    { 0x00,0x00,0x00,0x00,0x7E,0xC0,0x7C,0x06,0xFC },
X    { 0x00,0x00,0x30,0x30,0xFC,0x30,0x30,0x36,0x1C },
X    { 0x00,0x00,0x00,0x00,0xC6,0xC6,0xC6,0xC6,0x7C },
X    { 0x00,0x00,0x00,0x00,0xC6,0xC6,0xC6,0x6C,0x38 },
X    { 0x00,0x00,0x00,0x00,0xC6,0xC6,0xC6,0xD6,0x6C },
X    { 0x00,0x00,0x00,0x00,0xC6,0x6C,0x38,0x6C,0xC6 }
X};
X
X/* print a centered large string */
Xvoid larges(char *s)
X{
X    char c,*t;
X    int row,col,pixel,coloff;
X
X    coloff = CRTWIDTH + 2;
X    for( t = s; *t; t++ )
X        coloff -= cwidth[*t - ' '] + 2;
X    coloff >>= 1;
X
X    for( row = 0; row < LPC; row++ )
X    {
X        if( row == 7 )          /* detect blank descending lines */
X        {
X            pixel = 0;
X            for( t = s; *t; t++ )
X                pixel |= cg[*t - ' '][row];
X            if( pixel == 0 ) break; /* get outta here */
X        }
X        for( col = coloff; col; col-- )
X            addch(' ');
X        t = s; 
X        while( c = *t++ )
X        {
X            pixel = cg[c - ' '][row];
X            for( col = cwidth[c - ' ']; col; col-- )
X            {
X                addch( (pixel & 0x80) ? c : ' ' );
X                pixel += pixel;
X            }
X            if( *t )
X                addstr("  ");
X        }
X        clrtoeol();
X        addch('\n');
X    }
X}
END_OF_FILE
if test 7147 -ne `wc -c <'moty_0.82/mlarges.c'`; then
    echo shar: \"'moty_0.82/mlarges.c'\" unpacked with wrong size!
fi
# end of 'moty_0.82/mlarges.c'
fi
if test -f 'moty_0.82/mload.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'moty_0.82/mload.c'\"
else
echo shar: Extracting \"'moty_0.82/mload.c'\" \(6215 characters\)
sed "s/^X//" >'moty_0.82/mload.c' <<'END_OF_FILE'
X/* >>>>>>>>>>>>>>>>> LOADER <<<<<<<<<<<<<<<<< */
X
X/* Screens related routines. */
X
X#include    "moty.h"
X
X
X/* >>>>>>>>>>>>> COMMAND REDIRECTION <<<<<<<< */
X
X#define STOP        0004        /* UP, DOWN etc. in MOTY.H */
X
Xstatic char cmd2key[] = "86245";
X
X#define CC(count,dir)   count * 16 + dir
X
Xstatic UBYTE demo1[] =
X{
X    CC(15,STOP), CC(15,STOP), CC(2,UP), CC(8,LEFT), CC(2,DOWN),
X    CC(6,LEFT), CC(4,UP), CC(2,RIGHT), CC(2,DOWN), CC(14,RIGHT),
X    CC(12,LEFT), CC(8,UP), CC(2,LEFT), CC(1,DOWN), CC(15,STOP),
X    CC(2,LEFT), CC(8,DOWN), CC(1,RIGHT),CC(11,STOP), CC(12,RIGHT),
X    CC(6,UP), CC(2,RIGHT), CC(3,STOP), CC(2,DOWN), CC(10,STOP),
X    CC(10,RIGHT), CC(2,UP), CC(6,RIGHT), CC(4,DOWN), CC(2,LEFT),
X    CC(2,UP), CC(12,LEFT), CC(10,RIGHT), CC(8,DOWN), CC(2,RIGHT),
X    CC(5,UP), CC(2,RIGHT), CC(4,UP), CC(1,LEFT), CC(1,STOP), 0
X};
X
Xstatic UBYTE demo2[] =
X{
X    CC(15,STOP), CC(15,STOP), CC(15,LEFT), CC(4,LEFT), CC(6,DOWN),
X    CC(4,LEFT), CC(2,UP), CC(4,RIGHT), CC(2,DOWN), CC(2,RIGHT),
X    CC(2,UP), CC(2,LEFT), CC(2,UP), CC(13,RIGHT), CC(2,DOWN),
X    CC(2,RIGHT), CC(1,UP), CC(1,DOWN), CC(15,STOP), CC(13,STOP),
X    CC(6,DOWN), CC(15,LEFT), CC(1,LEFT), CC(15,STOP), CC(1,STOP),
X    CC(4,LEFT), CC(2,UP), CC(1,RIGHT), CC(15,STOP), CC(8,RIGHT),
X    CC(2,UP), CC(12,RIGHT), CC(2,DOWN), CC(3,LEFT), CC(15,STOP),
X    CC(4,RIGHT), CC(2,DOWN), CC(2,RIGHT), CC(15,STOP), CC(15,STOP),
X    CC(10,STOP), CC(2,RIGHT), CC(15,STOP), CC(8,STOP), CC(14,LEFT),
X    CC(4,UP), CC(2,LEFT), CC(1,DOWN), CC(8,STOP), CC(6,RIGHT),
X    CC(4,DOWN), CC(15,STOP), CC(2,LEFT), CC(1,DOWN), CC(10,STOP),
X    CC(3,LEFT), CC(8,STOP), CC(7,LEFT), CC(8,STOP), CC(8,RIGHT),
X    CC(4,UP), CC(2,RIGHT), CC(2,UP), CC(10,LEFT), CC(10,STOP),
X    CC(1,LEFT), CC(3,RIGHT), CC(15,STOP), CC(15,STOP), CC(10,STOP),
X    CC(14,RIGHT), CC(3,UP), 0
X};
X
Xstatic UBYTE *cmdptr;
Xstatic UBYTE cmdcnt;
X
Xstatic int democmd()
X{
X    UBYTE cmd;
X
X    if( keybcmd() )             /* exit if keyboard was hit */
X        mexit1();
X    if( cmdcnt == 0 )           /* get 1st count */
X        cmdcnt = *cmdptr >> 4;
X    cmd = cmd2key[*cmdptr & 0xf];
X    if( --cmdcnt == 0 )         /* get to next command */
X    {
X        cmdptr++;
X        if( *cmdptr )           /* end of command string ? */
X            cmdcnt = *cmdptr >> 4;
X        else
X            getcmd = keybcmd;   /* ya, redirect command input to keyboard */
X    }
X    return cmd;
X}
X
X/* >>>>>>>>>>>>>>>>> LOADER <<<<<<<<<<<<<<<<< */
X
Xtypedef UBYTE SCRN[88];     /* we are the only one who know about them */
Xextern SCRN screens[MAXSCREENS + 2];
X
Xstatic int lditem;
Xstatic UBYTE *scrnp;
Xstatic OBJ *op;
X
Xstatic int getitem(int first)
X{
X    UBYTE *ip;
X    int irow,icol;
X
X    if( first )
X    {
X        ip = scrnp;
X        irow = 0; icol = -1;
X    }
X    do
X    {
X        if( ++icol == 16 )
X            icol = 0, irow++;
X        lditem = ( icol & 1 ) ? *ip & 0xf : *++ip >> 4;
X    } while( lditem == 0 && irow < 11 );
X    if( irow == 11 )
X        lditem = 0;
X    op->row = irow + irow + 1;
X    op->col = icol + icol + 1;
X    op->state = 0;
X    return lditem;
X}
X
X/* only interface to outer world */
Xvoid iniobj(int scrno)
X{
X    if( pusher == 0 )           /* then we're called the 1st time */
X    {
X        pusher = ualloc( MAXOBJS * sizeof(OBJ) );
X        yballs = pusher + 1;    /* at fixed pos. too */
X    }
X    scrnp = (UBYTE *)screens[scrno] - 1;
X
X    /* direct command input routine */
X    if( scrno < MAXSCREENS )
X        getcmd = keybcmd;           /* get commands from keyboard */
X    else
X    {
X        getcmd = democmd;
X        cmdptr = (scrno == MAXSCREENS) ? demo2 : demo1;
X        cmdcnt = 0;
X    }
X
X    op = yballs;
X    getitem(TRUE);
X    do
X    {
X        if( lditem == 0xf )         /* process PUSHER */
X        {
X            pusher->kind = PUSHER;
X            pusher->row = op->row;
X            pusher->col = op->col;
X            pusher->state = 0;
X        }
X        else
X        {
X            switch( lditem )        /* & YBALLs */
X            {
X                case 8:
X                    op->state = RIGHT | MOVING;
X                    break;
X                case 9:
X                    break;
X                case 0xb:
X                    op->state = DOWN | MOVING;
X                    break;
X                default:
X                    continue;
X            }
X            op->kind = YBALL;
X            op++;
X        }
X    } while( getitem(FALSE) );
X    op->kind = NOTHIN;
X
X    rballs = ++op;
X    getitem(TRUE);
X    do
X        if( lditem == 5 )
X        {
X            op->kind = RBALL;
X            op++;
X        }
X    while( getitem(FALSE) );
X    op->kind = NOTHIN;
X
X    sbricks = ++op;
X    getitem(TRUE);
X    do
X        if( lditem == 1 )
X        {
X            op->kind = SBRICK;
X            op++;
X        }
X    while( getitem(FALSE) );
X    op->kind = NOTHIN;
X
X    lbricks = ++op;
X    getitem(TRUE);
X    do
X        if( lditem == 2 || lditem == 3 )
X        {
X            op->kind = LBRICK;
X            op->state = ( lditem == 2 ) ? RIGHT | MOVING : DOWN | MOVING;
X            op++;
X        }
X    while( getitem(FALSE) );
X    op->kind = NOTHIN;
X
X    rbricks = ++op;
X    getitem(TRUE);
X    do
X        if( lditem == 4 )
X        {
X            op->kind = RBRICK;
X            op->state = RIGHT | MOVING;
X            op++;
X        }
X    while( getitem(FALSE) );
X    op->kind = NOTHIN;
X
X    springs = ++op;
X    getitem(TRUE);
X    do
X        if( lditem == 0xa || lditem == 0xc )
X        {
X            op->kind = SPRING;
X            op->state = ( lditem == 0xa ) ? RIGHT : DOWN;
X            op++;
X        }
X    while( getitem(FALSE) );
X    op->kind = NOTHIN;
X
X    pumps = ++op;
X    getitem(TRUE);
X    do
X    {
X        switch( lditem )
X        {
X            case 6:
X                op->state = DOWN;
X                break;
X            case 7:
X                op->state = UP;
X                break;
X            case 0xd:
X                op->state = RIGHT;
X                break;
X            case 0xe:
X                op->state = LEFT;
X                break;
X            default:
X                continue;
X        }
X        op->kind = PUMP;
X        op++;
X    } while( getitem(FALSE) );
X    op->kind = NOTHIN;
X    if( pumps->kind )               /* start with 1st pump */
X        pumps->state |= PUMPING;
X}
END_OF_FILE
if test 6215 -ne `wc -c <'moty_0.82/mload.c'`; then
    echo shar: \"'moty_0.82/mload.c'\" unpacked with wrong size!
fi
# end of 'moty_0.82/mload.c'
fi
if test -f 'moty_0.82/moty.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'moty_0.82/moty.c'\"
else
echo shar: Extracting \"'moty_0.82/moty.c'\" \(2350 characters\)
sed "s/^X//" >'moty_0.82/moty.c' <<'END_OF_FILE'
X#define __MAIN
X
X#include    "moty.h"
X
X/* >>>>>>>>>>>>>>>>>> MAIN <<<<<<<<<<<<<<<<<< */
X
Xvoid *ualloc(size_t size)
X{
X    void *result;
X    if( result = malloc(size) )
X        return result;
X    addstr("No chance, not enough memoty...");
X    mexit0();
X    return 0;   /* to shut up syntax checker... */
X}
X
Xint main(int argc,char **argv)
X{   
X    char *s,*c;
X
X    if( (int)initscr() == ERR )
X    {
X        fputs("Curses initialization failed.\n",stderr);
X        return -1;
X    }
X    cbreak();
X    noecho();
X    nodelay(stdscr,TRUE);
X    leaveok(stdscr,TRUE);
X    typeahead(-1);
X/*
X    clear();
X    refresh();
X*/
X    if( LINES < 24 || COLS < 80 )
X    {
X        addstr("Unsufficient Screen Dimensions.");
X        mexit0();
X    }
X
X    board = ualloc( sizeof(BOARD) );
X
X    for( argv++; *argv; argv++ )
X    {
X        s = *argv;
X        if( *s == '-' )
X            switch( tolower(*++s) )
X            {
X                case 'd':
X                    demo = TRUE;
X                    break;
X                case 's':
X                    speed = tolower(*++s) == 's' ? 4 : 3;
X                    break;
X                case 'f':
X                    speed = tolower(*++s) == 'f' ? 0 : 1;
X                    break;
X                case 'k':
X                    hacking = TRUE;
X                    break;
X                case 'h':
X                    explain();
X                    break;
X                default:
X                    addstr("Wot exactly do ya mean?");
X                    mexit0();
X            }
X        else
X        {
X            level = 0;
X            while( *s >= '0' && *s <= '9' )
X                level = 10 * level + *s++ - '0';
X            level--;
X            if( level < 0 || level >= MAXSCREENS )
X                level = 0;
X        }
X    }
X
X    signal(SIGINT,mexit1);
X    if( demo )
X        play(MAXSCREENS + 1), play(MAXSCREENS);
X    else
X    {
X        if( level )
X            if( !reqpwd(level) )
X                level = 0;
X        while( level < MAXSCREENS )
X        {
X            setjmp(escape);
X            while( !play(level) )
X                ;
X            if( ++level % 5 == 0 )     /* got to give password? */
X                prtpwd(level - 1);
X        }
X    }
X    mexit1();
X    return 0;
X}
X
Xvoid mexit0()
X{
X    refresh();
X    noraw();
X    echo();
X    endwin();
X    exit(0);
X}
X
Xvoid mexit1()
X{
X    move(23,0);
X    mexit0();
X}
END_OF_FILE
if test 2350 -ne `wc -c <'moty_0.82/moty.c'`; then
    echo shar: \"'moty_0.82/moty.c'\" unpacked with wrong size!
fi
# end of 'moty_0.82/moty.c'
fi
if test -f 'moty_0.82/moty.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'moty_0.82/moty.h'\"
else
echo shar: Extracting \"'moty_0.82/moty.h'\" \(3326 characters\)
sed "s/^X//" >'moty_0.82/moty.h' <<'END_OF_FILE'
X/* >>>>>>>>>>>>>>>>> HEADER <<<<<<<<<<<<<<<<< */
X
X#include <stdlib.h>
X#include <limits.h>
X#include <setjmp.h>
X#include <signal.h>
X#include <curses.h>
X#include <sys/types.h>
X#include <sys/times.h>
X#include <sys/time.h>
X
X#ifdef  __MAIN
X#define EXT
X#define EXTIVAR(typ,nam,val)    typ nam = val
X#else
X#define EXT extern
X#define EXTIVAR(typ,nam,val)    extern typ nam
X#endif
X
X#define VERSION     "MOTY #0.82"
X
X#ifndef TRUE
X#define TRUE        (-1)
X#define FALSE       0
X#endif
X
X#define ESC         '\x1b'
X
X#define DIM(a)      ( sizeof(a) / sizeof(*a) )
X
Xtypedef unsigned char   UBYTE;
Xtypedef char        SBYTE;
Xtypedef unsigned short  UWORD;
Xtypedef short       SWORD;
X
X#define BRAKES      TRUE    /* in MOTY.C */
X#define VERBOSE     TRUE    /* in MPLAY.C */
X
X#define ROWMAX      22
X#define COLMAX      32
X#define ROWDIM      (ROWMAX+2)
X#define COLDIM      (COLMAX+2)
X
X#define ROWOFF      0
X#define COLOFF      0
X
X#define MAXSCREENS  200
X#define MAXOBJS     (16 * 11 + 7)
X#define MAXTIME     5000
X
X/* objects */
X#define NOTHIN      0
X#define RIM         1
X#define PUSHER      2
X#define SBRICK      3
X#define LBRICK      4
X#define RBRICK      5
X#define RBALL       6
X#define YBALL       7
X#define SPRING      8
X#define PUMP        9
X
X/* directions & states */
X#define UP          0000
X#define RIGHT       0001
X#define DOWN        0002
X#define LEFT        0003
X#define DIRECTION   0003        /* mask for above */
X#define GRINNING    0004        /* PUSHER only */
X#define SLEEPING    0010        /* ditto */
X#define MOVING      0004        /* LBRICKs & RBRICKs at start & YBALLs only */
X#define DEPRESSED   0004        /* SPRINGs */
X#define CRUMBLE1    0010        /* init & incr. of a crumbling BALL */
X#define CRUMBEND    0170        /* last state of a crumbling BALL */
X#define CRUMBLING   0170        /* mask for CRUMBLE */
X
X#define PUMPING     0004        /* PUMPs */
X#define PMP_IN      0000
X#define PMP_HOUT    0010
X#define PMP_OUT     0020
X#define PMP_HIN     0030
X#define PMP_STATE   0030
X
Xtypedef struct { UBYTE kind,row,col,state; } OBJ;
Xtypedef OBJ *BTYPE;
X
X#define BOARD       (*board)
XEXT BTYPE BOARD[ROWDIM][COLDIM];
X
XEXT OBJ rim
X#ifdef  __MAIN
X    = { RIM, 0, 0, 0 }
X#endif
X    ,
X    nil
X#ifdef  __MAIN
X    = { NOTHIN, 0, 0, 0 }
X#endif
X    ,
X    *pusher,*sbricks,*lbricks,*rbricks,
X    *yballs,*rballs,*springs,*pumps;
X
XEXT int tilt,finish,mtime;
XEXTIVAR(int,hacking,FALSE);
XEXTIVAR(int,prtall,TRUE);
XEXTIVAR(int,kbflush,TRUE);
XEXTIVAR(int,demo,FALSE);
XEXTIVAR(int,level,0);
XEXTIVAR(int,speed,2);
XEXTIVAR(long,hiscore,0);
XEXT jmp_buf escape,demoret;
X
X/* prototypes */
X
XEXT int(*getcmd)();             /* pointer to func that returns command */
Xextern int keybcmd();           /* get a command from keyboard */
X
X/* MOTY */
Xvoid *ualloc(size_t);
Xvoid mexit0();
Xvoid mexit1();
X
X/* MTIME */
Xvoid ctplay();
Xvoid ctnplay();
Xvoid waitct();
X
X/* MHELP */
Xvoid explain();
X
X/* MPASSWD */
Xvoid prtpwd(int);
Xint reqpwd(int);
X
X/* MCRT */
Xvoid inicrt();
Xvoid putdec(char *, int, int);
Xvoid prtdec(char *, int, int);
Xvoid putldec(char *, int, int);
Xvoid prtldec(char *, int, int);
Xvoid vdputs(int, int, char *);
Xvoid prtframe();
Xvoid prtscreen();
Xvoid vdobj(OBJ *);
Xvoid putall();
Xvoid prttime();
Xvoid prthiscore();
Xvoid prtsno(int);
Xvoid prtstat(char *);
Xvoid prtleft();
X
X/* MPLAY */
Xint play(int);
X
X/* MLOAD */
Xvoid iniobj(int);
END_OF_FILE
if test 3326 -ne `wc -c <'moty_0.82/moty.h'`; then
    echo shar: \"'moty_0.82/moty.h'\" unpacked with wrong size!
fi
# end of 'moty_0.82/moty.h'
fi
if test -f 'moty_0.82/mpasswd.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'moty_0.82/mpasswd.c'\"
else
echo shar: Extracting \"'moty_0.82/mpasswd.c'\" \(2858 characters\)
sed "s/^X//" >'moty_0.82/mpasswd.c' <<'END_OF_FILE'
X#include "moty.h"
X
Xstatic long lpwds[] =
X{   0x2D86ABF2L, 0x16B6FD39L, 0x2C86B869L, 0x34D74BF2L, 0x2A961BB3L, 
X    0x32BE886EL, 0x33D6D579L, 0x25867B25L, 0x32CE2555L, 0x2C9698E1L, 
X    0x33A21CABL, 0x32BE496FL, 0x21B2996EL, 0x30A6F610L, 0x21CE3A69L, 
X    0x2D974CAFL, 0x22A6D8AFL, 0x2EBEFCE5L, 0x25CB2BF2L, 0x34873D25L, 
X    0x30972AF9L, 0x254104A8L, 0x33BEEA63L, 0x30E72BECL, 0x27E72BF3L, 
X    0x10511593L, 0x33BECA64L, 0x33C21CABL, 0x33D24872L, 0x34CA1B70L, 
X    0x33A2FBF4L, 0x34CA18EBL, 0x34CA18E5L, 0x36875B34L, 0x30870D61L, 
X    0x3296C878L, 0x2CBE1DB2L, 0x2A86DBE9L, 0x15552656L, 0x2EC12A6AL,
X};
X
Xstatic UBYTE knowpwd[DIM(lpwds)];       /* all FALSE */
X
X/* check the entered password - return index if ok, else -1 */
Xstatic int chkpwd(char *s)
X{
X    int i;
X    long l;
X    
X    /* encode passwd */
X    l = 0L;
X    for( i = 5; i; i-- )
X        l = (l << 6) + *s++ - ' ';
X    /* do we have an entry like that? */
X    for( i = 0; i < DIM(lpwds); i++ )
X        if( l == lpwds[i] )
X            return i;
X    return -1;      /* sorry, no */
X}
X
X/* get a decoded password */
Xstatic char *getpwd(int index)
X{
X    static char result[] = "12345";
X    int i;
X    long l;
X    char *s;
X
X    s = &result[4];
X    l = lpwds[index];
X    for( i = 5; i; i-- )
X    {
X        *s-- = (l & 0x3f) + ' ';
X        l >>= 6;
X    }
X    return result;
X}
X
Xstatic void prtrange(int pwd)
X{
X    static char this[] = "#000-#000";
X
X    pwd = 5 * pwd + 1;
X    putdec(&this[1],3,pwd);
X    putdec(&this[6],3,pwd + 4);
X    move(8,0);
X    larges(this);
X}
X
X/* print a password */
Xvoid prtpwd(int screen)
X{
X    screen /= 5;
X    if( knowpwd[screen] )
X        return;
X    clear();
X    prtall = TRUE;
X    larges("PASSWORD");
X    prtrange(screen);
X    move(16,0);
X    larges(getpwd(screen));
X    knowpwd[screen] = TRUE;
X    refresh();
X    nodelay(stdscr,FALSE);
X    getch();
X    nodelay(stdscr,TRUE);
X}
X
Xint reqpwd(int screen)
X{
X    char buffer[] = "12345" ,*bufp;
X    int ch;
X
X    if( screen < 0 || screen >= MAXSCREENS )
X        return FALSE;
X    if( screen % 5 == 0 )   /* for 5, we need the password of 0-4 */
X        screen--;
X    screen /= 5;
X    if( knowpwd[screen] )
X        return TRUE;
X    clear();
X    prtall = TRUE;
X    larges("Enter PWD");
X    prtrange(screen);
X    for( bufp = buffer; *bufp; bufp++ )
X        *bufp = '_';
X    move(16,0);
X    larges(buffer);
X    refresh();
X    for( bufp = buffer; *bufp; bufp++ )
X    {
X        do
X        {
X            nodelay(stdscr,FALSE);
X            ch = getch();
X            nodelay(stdscr,TRUE);
X            if( ch < ' ' )
X                return FALSE;
X            if( ch >= 'a' && ch <= 'z' )
X                ch -= 0x20;
X        }
X        while( ch < '0' || (ch > '9' && ch < 'A') || ch > 'Z' );
X        *bufp = ch;
X        move(16,0);
X        larges(buffer);
X        refresh();
X    }
X    return  knowpwd[screen] = (chkpwd(buffer) == screen);
X}
END_OF_FILE
if test 2858 -ne `wc -c <'moty_0.82/mpasswd.c'`; then
    echo shar: \"'moty_0.82/mpasswd.c'\" unpacked with wrong size!
fi
# end of 'moty_0.82/mpasswd.c'
fi
if test -f 'moty_0.82/mscreens.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'moty_0.82/mscreens.c'\"
else
echo shar: Extracting \"'moty_0.82/mscreens.c'\" \(1342 characters\)
sed "s/^X//" >'moty_0.82/mscreens.c' <<'END_OF_FILE'
X/* >>>>>>>>>>>>>>>>> SCREEN <<<<<<<<<<<<<<<<< */
X
X/* This are all MOTY screens. */
X
X#include "moty.h"
X
Xchar screens[MAXSCREENS + 2][88] =
X{
X
X#include "mscr_001-050"
X#include "mscr_051-100"
X#include "mscr_101-150"
X#include "mscr_151-200"
X
X    {
X        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X        0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
X        0xA0,0x09,0x00,0x00,0x00,0x00,0x0F,0x0A,
X        0x16,0x11,0x20,0x00,0x00,0x00,0x11,0x61,
X        0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,
X        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,
X        0x00,0x00,0x00,0x55,0x55,0x00,0x00,0x50,
X        0x09,0x05,0x00,0x00,0x00,0x00,0x50,0x50,
X        0x17,0x11,0xD9,0x00,0x00,0x0E,0x11,0x71
X    },
X    {
X        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
X        0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,
X        0x00,0x01,0x10,0x00,0x00,0x01,0x10,0x00,
X        0x09,0x01,0x10,0x00,0x00,0x00,0x00,0x00,
X        0x00,0x01,0x10,0x05,0x00,0x05,0x50,0x00,
X        0x00,0x01,0xD8,0x00,0x00,0x0E,0x10,0x00,
X        0x00,0x05,0x50,0x00,0x00,0x01,0x10,0x00,
X        0x00,0x00,0x00,0x0F,0x00,0x01,0x10,0x90,
X        0x00,0x01,0x10,0x00,0x00,0x01,0x10,0x00
X    }
X};
END_OF_FILE
if test 1342 -ne `wc -c <'moty_0.82/mscreens.c'`; then
    echo shar: \"'moty_0.82/mscreens.c'\" unpacked with wrong size!
fi
# end of 'moty_0.82/mscreens.c'
fi
if test -f 'moty_0.82/mtime.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'moty_0.82/mtime.c'\"
else
echo shar: Extracting \"'moty_0.82/mtime.c'\" \(1278 characters\)
sed "s/^X//" >'moty_0.82/mtime.c' <<'END_OF_FILE'
X/* >>>>>>>>>>>>>>>>> TIMER <<<<<<<<<<<<<<<<<< */
X
X#include "moty.h"
X
X#ifdef HAVE_SELECT
X/* #include <sys/select.h> */
Xstatic void waittcs(unsigned int tcs)
X{
X    struct timeval tv;
X    tv.tv_sec = tcs / CLK_TCK;
X    tv.tv_usec = (tcs % CLK_TCK) * (1000000L / CLK_TCK);
X    select(0,(fd_set *)0,(fd_set *)0,(fd_set *)0,&tv);
X}
X#endif
X
X#ifdef HAVE_POLL
X
X#include <stropts.h>
X#include <poll.h>
X
Xstatic void waittcs(unsigned int tcs)
X{
X    poll((struct poll *)0,0,(1000 / CLK_TCK) * tcs);
X}
X#endif
X
X#if !defined HAVE_SELECT && !defined HAVE_POLL
Xstatic void waittcs(unsigned int tcs)
X{
X    while( last > times(&tmsbuf) )
X        ;
X}
X#endif
X
Xstatic struct tms tmsbuf;
Xstatic clock_t last, diff;
X
X/* set 'em */
Xstatic void setct(short msec)
X{
X    diff = ((clock_t)CLK_TCK * msec) / 1000 + 1;
X    last = times(&tmsbuf);
X}
X
Xvoid ctplay()
X{
X    static short speeds[] = { 5,60,100,150,250 /*160*/ };
X    setct(speeds[speed]);
X}
X
Xvoid ctnplay()
X{
X    setct(150);
X}
X
Xvoid waitct()
X{
X    clock_t now = times(&tmsbuf);
X    
X    last += diff;
X    if( now >= last )
X    {
X        last = now;
X#if BRAKES
X        mvaddch(1,78,' ');
X        move(0,0);
X#endif
X    }
X    else
X    {
X#if BRAKES
X        mvaddch(1,78,'o');
X        move(0,0);
X#endif
X        waittcs((unsigned int)(last - now));
X    }
X}
END_OF_FILE
if test 1278 -ne `wc -c <'moty_0.82/mtime.c'`; then
    echo shar: \"'moty_0.82/mtime.c'\" unpacked with wrong size!
fi
# end of 'moty_0.82/mtime.c'
fi
echo shar: End of archive 1 \(of 5\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 4 5 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 5 archives.
    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
-- 
                                                        __o
                                                      _`\<,_
                                                     (_)/ (_)
-------------------------------------------------------------
Andreas Burmester                  Internet: buster@isys.net
Phn & FAX: +49 40 6900337
-------------------------------------------------------------


