Rocks Release 2 (part 1 of 1)

Hans Jespersen hjespersen at rose.waterloo.edu
Sat Feb 3 04:59:45 AEST 1990


Well, since I'm in the mood for posting I might as well
put up my new 'rocks' source.

The following are things that have been added to 'rocks' :

  1) add top-10 high score list.
  2) add mouse controls
  3) add shared libraries and strip binary.
  4) allow player to play again after first game.
  5) add hyperspace
  6) make rocks split from centre point (not upper-left corner)
  7) make "score = 0" print correctly.
  8) clean up rocks.h so people can understand what to modify.
  9) add "make install"
 10) add command line argument for start level (1-9)

A special thanks to all those who sent in suggestions on how 
to improve the game. I was planning on thanking each of you 
personally, but I am back at University for another term and
all my mail messages are at work on attcan. Perhaps when
I return in April I will get the chance. Thanks again guys.
 
I may add some new features in the future some of which are 
listed in the file "NOTES". If you have any additional ideas
please let me know. I can be reached at the email address 
below, which is forwarded to Waterloo when I am at school.

Enjoy.

-hans           

-- 
Hans Jespersen				..!uunet!attcan!hjespers 
					..!uunet!watmath!rose!hjespersen

		"What a long strange trip it's been"

--------------------------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 shell archive."
# Contents:  Makefile NOTES README game.c init.c move.c point.c rocks.c
#   rocks.h score.c shot.c sprites.c stars.c window.c
# Wrapped by root\@arakis on Wed Jan 31 17:04:15 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Makefile' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(839 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
include $(MAKEINC)/Makepre.h
X
X#Make sure you have looked over "rocks.h" and are happy 
X#with the controls and that you have defined SCORE_FILE
X#for the highscore file.
X
OBJ	= rocks.o sprites.o window.o init.o game.o move.o shot.o \
X	  stars.o point.o score.o
XEXE	= rocks
CC	= /bin/cc
X# define if you have a mouse
CFLAGS	= -O -DMOUSE
X# otherwise
X#CFLAGS	= -O
BINDIR	= /usr/games/bin
X
X$(EXE): $(OBJ)
X	$(LD) $(LDFLAGS) $(SHAREDLIB) -o $(EXE) $(OBJ)
X
rocks.o: rocks.c rocks.h
X
sprites.o: sprites.c rocks.h
X
window.o: window.c rocks.h
X
init.o: init.c rocks.h
X
game.o: game.c rocks.h
X
move.o: move.c rocks.h
X
shot.o: shot.c rocks.h
X
stars.o: stars.c rocks.h
X
point.o: point.c rocks.h
X
score.o: score.c rocks.h
X
install: $(EXE)
X	strip $(EXE)
X	mv $(EXE) $(BINDIR)
X
clean:
X	rm $(OBJ)
X
clobber:
X	rm $(OBJ) $(EXE) core
X
include $(MAKEINC)/Makepost.h
END_OF_FILE
if test 839 -ne `wc -c <'Makefile'`; then
    echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'NOTES' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'NOTES'\"
else
echo shar: Extracting \"'NOTES'\" \(829 characters\)
sed "s/^X//" >'NOTES' <<'END_OF_FILE'
The following are things that have been added to 'rocks' :
X
X  1) add top-10 high score list.
X  2) add mouse controls
X  3) add shared libraries and strip binary.
X  4) allow player to play again after first game.
X  5) add hyperspace
X  6) make rocks split from centre point (not upper-left corner)
X  7) make "score = 0" print correctly.
X  8) clean up rocks.h so people can understand what to modify.
X  9) add "make install"
X 10) add command line argument for start level (1-9)
X
The following are things still to add :
X
X  1) improve graphics
X  2) have game continue from were it left off when you die.
X  3) add killer UFOs.
X  4) add pause key.
X  5) increase number of ship positions (angles) to more than 8.
X  6) allow for mouse to control rotation as in arcade version
X     (ie. holding down button results in continuous rotation )
END_OF_FILE
if test 829 -ne `wc -c <'NOTES'`; then
    echo shar: \"'NOTES'\" unpacked with wrong size!
fi
# end of 'NOTES'
fi
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(1840 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
X/**********************************************************\
X* Rocks : a bit-mapped arcade game for the AT&T UNIX PC.   *
X*                                                          *
X* Release 2      Jan. 31, 1990                             *
X*                                                          *
X* By : Hans Jespersen     ..!uunet!attcan!hjespers         *
X*                                                          *
X\**********************************************************/
X
X  'Rocks' is an Asteroids type game. I tried to preserve
as many of the elements of the original game as possible.
X
X  This is the second release of 'rocks'. All significant 
changes are documented in the file NOTES.
X
The controls for the game are as follows :
X
X	Compiled without -DMOUSE (see Makefile)
X
X	'a'	- shoot
X	'j'	- hyperspace
X	'k'	- rotate counter-clockwise
X	'l'	- rotate clockwise
X	<space> - thrust
X	'q'	- quit
X
X	Compiled with -DMOUSE (see Makefile)
X
X	'a'		- shoot
X	<space>		- hyperspace
X	LEFT BUTTON	- rotate counter-clockwise
X	RIGHT BUTTON	- rotate clockwise
X	MIDDLE BUTTON	- thrust
X	'q'		- quit
X
Anyone wishing to change these controls should look at rocks.h
X
A special thanks to all those who sent in suggestions on how 
to improve the game. I was planning on thanking each of you 
personally, but I am back at University for another term and
all my mail messages are at work on attcan. Perhaps when
I return in April I will get the chance. Thanks again guys.
X
I may add some new features in the future some of which are 
listed in the file "NOTES". If you have any additional ideas
please let me know. I can be reached at the email address 
below, which is forwarded to Waterloo when I am at school,
which thank god is not very much longer!!
X
XEnjoy.
X
X-hans           
X
X-- 
Hans Jespersen		  hjespers\@attcan.UUCP (uunet!attcan!hjespers) 
END_OF_FILE
if test 1840 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'game.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'game.c'\"
else
echo shar: Extracting \"'game.c'\" \(4503 characters\)
sed "s/^X//" >'game.c' <<'END_OF_FILE'
X/**********************************************************\
X* Rocks : a bit-mapped arcade game for the AT&T UNIX PC.   *
X*                                                          *
X* By : Hans Jespersen                                      *
X*                                                          *
X\**********************************************************/
X
X#include "rocks.h"
X
void collission_check();
int  explode;
X
playgame()
X{
X	int	key;
X	int	i;
X	int 	yp, xp, bp, rp;
X	
X	flushinp();
X	for(explode = FALSE; quitflag != TRUE ;) {
X		key = wgetc( wn );
X		switch( key ) {
X			case Mouse: 
X				wreadmouse( wn, &xp, &yp, &bp, &rp );
X				switch( bp ){
X					case MBUTL:
X						rotate( LEFT );
X						break;
X					case MBUTL|MBUTR:
X						break;
X					case MBUTM:
X						thrust();
X						break;
X					case MBUTM|MBUTL:
X						thrust();
X						rotate( LEFT );
X						break;
X					case MBUTM|MBUTR:
X						thrust();
X						rotate( RIGHT );
X						break;
X					case MBUTALL:
X						break;
X					case MBUTR:
X						rotate( RIGHT );
X						break;
X				}
X				break;
X			case BEEP:
X				togglebeep();
X				break;
X			case LEFTKEY:
X				rotate( LEFT );
X				break;
X			case RIGHTKEY:
X				rotate( RIGHT );
X				break;
X			case SHOOT:
X				shoot();
X				break;
X			case THRUST:
X				thrust();
X				break;
X			case HYPERSPACE:
X				hyperspace();
X				break;
X	       		case QUIT:
X				cleanup();
X		}
X		moverocks();
X		moveshots();
X		moveship();
X		printscreen();
X		collission_check();   
X	}
X	if( explode ){
X		debrislist[0].x = myship.x;
X		debrislist[0].y = myship.y;
X		debrislist[0].xdelta = -1;
X		debrislist[0].ydelta = 0;
X		debrislist[1].x = myship.x;
X		debrislist[1].y = myship.y;
X		debrislist[1].xdelta = 0;
X		debrislist[1].ydelta = 1;
X		debrislist[2].x = myship.x;
X		debrislist[2].y = myship.y;
X		debrislist[2].xdelta = 1;
X		debrislist[2].ydelta = -1;
X	}
X	for(i=0; i < RANGE + 5 ; i++){ 
X		moverocks();
X		moveshots();
X		if( explode )
X			movedebris();
X		else
X			moveship();
X		printscreen();
X	}
X	clear();
X}
X
rotate( which_way ) 
int which_way;
X{
X	wrastop(wn,ship[direction],2,screen,WIDTH,0,0,myship.x,myship.y,SHIP_WIDTH,SHIP_HEIGHT,SRCSRC,DSTCAM,0);
X	direction += which_way;
X	if ( direction == 8 )
X		direction = 0;
X	else if ( direction == -1 )
X		direction = 7;
X	wrastop(wn,ship[direction],2,screen,WIDTH,0,0,myship.x,myship.y,SHIP_WIDTH,SHIP_HEIGHT,SRCSRC,DSTOR,0);
X}
X
togglebeep()
X{
X	beepflag = 1 - beepflag;
X}
X
void collission_check()
X{
X	int i;
X
X	for (i = 0; i < nrocks;i++){
X		if ( collide( myship, SHIP_WIDTH, SHIP_HEIGHT, rocklist[i], rockwidth[ rocklist[i].size ], rockheight[ rocklist[i].size ] ) ){
X			quitflag = TRUE;
X			explode = TRUE;
X			men -= 1;  
X			level -= 1;
X		}
X	}
X}
X
X/*
X * General collision detection routine based on overlapping rectangles.
X * Wraparound is considered only for second (ie. b ) rectangle.
X */
X
int collide( apos, awidth, aheight, bpos, bwidth, bheight )
position apos;
int awidth;
int aheight;
position bpos;
int bwidth;
int bheight;
X{
X
X	/* check for regular y-axis overlap */
X	
X	if( (bpos.y >= apos.y - bheight) && (bpos.y <= apos.y + aheight) )
X	{
X
X		/* check for regular x-axis overlap */
X
X		if( (bpos.x >= apos.x - bwidth) && (bpos.x <= apos.x + awidth) )
X			return( TRUE );
X
X		/* check for wraparound x-axis overlap */
X
X		if( (bpos.x - SCREEN_WIDTH >= apos.x - bwidth) && 
X		    (bpos.x -SCREEN_WIDTH <= apos.x + awidth) )
X			return( TRUE );
X
X		else
X			return( FALSE );
X	}
X
X	/* check for wraparound y-axis overlap */
X
X	else if( (bpos.y - SCREEN_HEIGHT >= apos.y - bheight) && 
X		 (bpos.y - SCREEN_HEIGHT <= apos.y + aheight) )
X	{
X
X		/* check for regular x-axis overlap */
X
X		if( (bpos.x >= apos.x - bwidth) && (bpos.x <= apos.x + awidth) )
X			return( TRUE );
X
X		/* check for wraparound x-axis overlap */
X
X		if( (bpos.x - SCREEN_WIDTH >= apos.x - bwidth) && 
X		    (bpos.x - SCREEN_WIDTH <= apos.x + awidth) )
X			return( TRUE );
X
X		else
X			return( FALSE );
X	}
X
X	/* no overlap */
X	
X	else
X		return( FALSE );
X}
X
printscore()
X{
X	char scorestr[7];
X	char outstr[20];
X	int digit;
X	int tmpscore;
X	int index;
X	
X	tmpscore = score;
X	strcpy( outstr , "score : ");
X	for( index = 0; index <= 5; index++ )
X		scorestr[index] = ' ';
X	scorestr[6] = '\0';
X	if( tmpscore == 0 )
X		scorestr[5] = '0';
X	else{
X		for( index = 5; tmpscore > 0; index-- ) {
X			digit = tmpscore % 10;
X			tmpscore = (tmpscore - digit)/10;
X			scorestr[index] = digit + '0';
X		}
X	}
X	strcat( outstr, scorestr );
X	wprompt(wn,outstr);
X}
X
int randdir()
X{
X	int direction;
X
X	if ( rand() % 2 == 0 ) 
X		direction = -1;
X	else
X		direction = 1;
X	return( direction );
X}	
END_OF_FILE
if test 4503 -ne `wc -c <'game.c'`; then
    echo shar: \"'game.c'\" unpacked with wrong size!
fi
# end of 'game.c'
fi
if test -f 'init.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'init.c'\"
else
echo shar: Extracting \"'init.c'\" \(1691 characters\)
sed "s/^X//" >'init.c' <<'END_OF_FILE'
X/**********************************************************\
X* Rocks : a bit-mapped arcade game for the AT&T UNIX PC.   *
X*                                                          *
X* By : Hans Jespersen                                      *
X*                                                          *
X\**********************************************************/
X
X#include "rocks.h"
X
initscreen( level )
int level;
X{
X        int 		i,j,index;
X	char		menstr[15];
X	position	freezone; 
X
X	/* clean screen */    	
X
X       	wrastop(wn,screen,WIDTH,screen,WIDTH,0,0,0,0,SCREEN_WIDTH,SPACE_HEIGHT,SRCSRC,DSTCAM,0);
X	myship.x = SCREEN_WIDTH / 2;
X	myship.y = SCREEN_HEIGHT / 2;
X	freezone.x = myship.x - LARGE_ROCK_WIDTH;
X	freezone.y = myship.y - LARGE_ROCK_HEIGHT;
X	myship.xdelta = myship.ydelta = 0;
X        wrastop(0,ship[0],2,screen,WIDTH,0,0,myship.x,myship.y,16,16,SRCSRC,DSTOR,0);
X	nrocks = level;
X	srand( (long)time(0) );
X	for ( i = 0; i < nrocks; i++ ){
X		rocklist[i].size = LARGE;
X		rocklist[i].x = rand() % SCREEN_WIDTH;
X		rocklist[i].y = rand() % SPACE_HEIGHT;
X		while( collide( rocklist[i], LARGE_ROCK_WIDTH, LARGE_ROCK_HEIGHT, freezone, 2 * LARGE_ROCK_WIDTH, 2 * LARGE_ROCK_HEIGHT ) ){
X			rocklist[i].x = rand() % SCREEN_WIDTH;
X			rocklist[i].y = rand() % SPACE_HEIGHT;
X		}
X		rocklist[i].xdelta = randdir() * ((rand() % 2) + 1);
X		rocklist[i].ydelta = randdir() * ((rand() % 2) + 1);
X       		wrastop(0,rock[LARGE],8,screen,WIDTH,0,0,rocklist[i].x,rocklist[i].y,LARGE_ROCK_WIDTH,LARGE_ROCK_HEIGHT,SRCSRC,DSTOR,0);
X	}
X	printscreen();
X	strcpy( menstr, "men   :      " );
X	menstr[13] = men + '0';
X	menstr[14] = '\0';
X	wcmd( wn, menstr );
X	quitflag = FALSE;
X	direction = 0;
X	nshots = -1;
X}
END_OF_FILE
if test 1691 -ne `wc -c <'init.c'`; then
    echo shar: \"'init.c'\" unpacked with wrong size!
fi
# end of 'init.c'
fi
if test -f 'move.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'move.c'\"
else
echo shar: Extracting \"'move.c'\" \(6022 characters\)
sed "s/^X//" >'move.c' <<'END_OF_FILE'
X/**********************************************************\
X* Rocks : a bit-mapped arcade game for the AT&T UNIX PC.   *
X*                                                          *
X* By : Hans Jespersen                                      *
X*                                                          *
X\**********************************************************/
X
X#include "rocks.h"
X
movedebris()
X{
X	int i;
X
X	for( i = 0; i < 3; i++){
X	
X		/* 
X		 * move debris
X		 */
X	
X		debrislist[i].x += debrislist[i].xdelta;
X		debrislist[i].y += debrislist[i].ydelta;	
X	
X		/* 
X		 * check for wrap around 
X		 */
X	
X		if ( debrislist[i].x > SCREEN_WIDTH - SHIP_WIDTH )
X			debrislist[i].x = 0;
X		else if ( debrislist[i].x < 0 )
X			debrislist[i].x = SCREEN_WIDTH - SHIP_WIDTH;
X		if ( debrislist[i].y > SCREEN_HEIGHT - SHIP_HEIGHT )
X			debrislist[i].y = 0;
X		else if ( debrislist[i].y < 0 )
X			debrislist[i].y = SCREEN_HEIGHT - SHIP_HEIGHT;
X	
X		/*
X		 * place debris in new position 
X		 */
X	
X		wrastop(wn,debris[i],2,screen,WIDTH,0,0,debrislist[i].x,debrislist[i].y,SHIP_WIDTH,SHIP_HEIGHT,SRCSRC,DSTOR,0);
X	}
X}
X
moveship()
X{
X
X	/* 
X	 * move ship
X	 */
X
X	myship.x += myship.xdelta;
X	myship.y += myship.ydelta;	
X
X	/* 
X	 * check for wrap around 
X	 */
X
X	if ( myship.x > SCREEN_WIDTH - SHIP_WIDTH )
X		myship.x = 0;
X	else if ( myship.x < 0 )
X		myship.x = SCREEN_WIDTH - SHIP_WIDTH;
X	if ( myship.y > SCREEN_HEIGHT - SHIP_HEIGHT )
X		myship.y = 0;
X	else if ( myship.y < 0 )
X		myship.y = SCREEN_HEIGHT - SHIP_HEIGHT;
X
X	/*
X	 * place ship in new position 
X	 */
X
X	wrastop(wn,ship[direction],2,screen,WIDTH,0,0,myship.x,myship.y,SHIP_WIDTH,SHIP_HEIGHT,SRCSRC,DSTOR,0);
X}
X
moverocks()
X{
X	int i;
X
X	/*
X	 * erase screen bitmap
X	 */
X
X	wrastop(wn,0,0,screen,WIDTH,0,0,0,0,SCREEN_WIDTH,SCREEN_HEIGHT+LARGE_ROCK_HEIGHT,SRCPAT,DSTSRC,0);
X
X	/*
X	 * move each rock one at a time
X	 */
X
X	for ( i = 0; i < nrocks; i++ ){
X
X		/* move rock to new location */ 
X
X		rocklist[i].x += rocklist[i].xdelta; 
X		rocklist[i].y += rocklist[i].ydelta; 
X
X		/* check for wrap around */
X
X		if ( rocklist[i].x > SCREEN_WIDTH )
X			rocklist[i].x = 0;
X		else if ( rocklist[i].x < 0 )
X			rocklist[i].x = SCREEN_WIDTH;
X		if ( rocklist[i].y > SCREEN_HEIGHT )
X			rocklist[i].y = 0;
X		else if ( rocklist[i].y < 0 )
X			rocklist[i].y = SCREEN_HEIGHT; 
X
X		/* put rock in new location */
X
X		wrastop(wn,rock[rocklist[i].size],8,screen,WIDTH,0,0,rocklist[i].x,rocklist[i].y,rockwidth[ rocklist[i].size ],rockheight[ rocklist[i].size ],SRCSRC,DSTOR,0);
X	}
X}
X
moveshots()
X{
X	int i,j,splitflag = FALSE;
X	
X	/*
X	 * move shots one at a time
X 	 */
X
X	for ( i = 0; i <= nshots; i++ ){
X
X		/* move shot */
X
X		shotlist[i].x += shotlist[i].xdelta;
X		shotlist[i].y += shotlist[i].ydelta;
X
X		/* wrap around */
X
X		if ( shotlist[i].x >= SCREEN_WIDTH )
X			shotlist[i].x = 0;
X		else if ( shotlist[i].x < 0 )
X			shotlist[i].x = SCREEN_WIDTH - 1;
X		if ( shotlist[i].y >= SCREEN_HEIGHT )
X			shotlist[i].y = 0;
X		else if ( shotlist[i].y < 0 )
X			shotlist[i].y = SCREEN_HEIGHT - 1; 
X
X		/* print new shot */
X
X		point(shotlist[i].x, shotlist[i].y);
X
X		/* check for collisions between each rock and each shot */
X
X		for ( j = 0; (j <= nrocks) && (splitflag == FALSE); j++ ){
X			if( collide( shotlist[i], 1, 1, rocklist[j], rockwidth[rocklist[j].size], rockheight[rocklist[j].size ]) ){
X	
X				/* erase shot */
X
X				point(shotlist[i].x, shotlist[i].y);
X		
X				/* remove shot from shotlist */
X
X				removeshot( i );
X
X				/* update score */ 
X
X				score += (3 - rocklist[j].size ) * 100;
X				printscore();
X
X				/* split rock into smaller units */
X
X				split_rock( j );
X				splitflag = TRUE;
X			}
X		}
X		
X		/* reduce range of shot by one */
X
X		shotlist[i].size -= 1;
X
X		/* if shot has worn out erase it */
X
X		if ( shotlist[i].size == 0 ){
X			point(shotlist[i].x, shotlist[i].y);
X			removeshot( i );
X		}
X	}
X}
X
split_rock( index )
int index;
X{
X	int i;
X
X	wrastop(wn,rock[rocklist[index].size],8,screen,WIDTH,0,0,rocklist[index].x,rocklist[index].y,rockwidth[ rocklist[index].size ], rockheight[ rocklist[index].size ],SRCSRC,DSTCAM,0);
X	 if ( rocklist[index].size != SMALL ){
X		for ( i = 0; i < 2; i++ ){
X			rocklist[nrocks+i].x = rocklist[ index ].x + ( rockwidth[ rocklist[ index ].size ] / 2 );
X			rocklist[nrocks+i].y = rocklist[ index ].y + ( rockheight[ rocklist[ index ].size ] / 2 );
X			rocklist[nrocks+i].xdelta = randdir() * ((rand()%4)+(3-rocklist[nrocks+i].size));
X			rocklist[nrocks+i].ydelta = randdir() * ((rand()%4)+(3-rocklist[nrocks+i].size));
X			rocklist[nrocks+i].size = rocklist[ index ].size - 1;
X		}
X		nrocks += 2;
X	}
X	removerock( index );	
X	if( nrocks == 0 )
X		quitflag = TRUE;
X}
X
removerock( index )
int index;
X{
X	int i;
X
X	for( i = index; i < nrocks; i++ )
X		rocklist[ i ] = rocklist[ i + 1 ];
X	nrocks -= 1;
X}
X
removeshot( index )
int index;
X{
X	int i;
X
X	for( i = index; i < nshots; i++ )
X		shotlist[ i ] = shotlist[ i + 1 ];
X	nshots -= 1;
X}
X
printscreen()
X{
X	wrastop(wn,screen,WIDTH,screen,WIDTH,0,SCREEN_HEIGHT,0,0,SCREEN_WIDTH,LARGE_ROCK_HEIGHT,SRCSRC,DSTOR,0);
X	wrastop(wn,screen,WIDTH,0,0,0,0,0,0,SCREEN_WIDTH,SCREEN_HEIGHT,SRCSRC,DSTSRC,0);
X}
X
clearscreen()
X{
X	wrastop(wn,screen,WIDTH,screen,WIDTH,0,0,0,0,SCREEN_WIDTH,SPACE_HEIGHT,SRCSRC,DSTCAM,0);
X}
X
thrust()
X{
X	switch ( direction ) {
X	case	0:	myship.ydelta -= 1;
X			break;
X	case	1:	myship.xdelta += 1;
X			myship.ydelta -= 1;
X			break;
X	case	2:	myship.xdelta += 1;
X			break;
X	case	3:	myship.xdelta += 1;
X			myship.ydelta += 1;
X			break;
X	case	4:	myship.ydelta += 1;	
X			break;
X	case	5:	myship.xdelta -= 1;
X			myship.ydelta += 1;
X			break;
X	case 	6:	myship.xdelta -= 1;
X			break;
X	case 	7:	myship.xdelta -= 1;
X			myship.ydelta -= 1;
X			break;
X	}
X	if( myship.xdelta > MAXTHRUST )
X		myship.xdelta = MAXTHRUST;
X	else if( myship.xdelta < (-1 * MAXTHRUST ) )
X		myship.xdelta = -1 * MAXTHRUST;
X	if( myship.ydelta > MAXTHRUST )
X		myship.ydelta = MAXTHRUST;
X	else if( myship.ydelta < (-1 * MAXTHRUST ) )
X		myship.ydelta = -1 * MAXTHRUST;
X}
X
hyperspace() 
X{
X	myship.x = rand() % SCREEN_WIDTH;
X	myship.y = rand() % SCREEN_HEIGHT;
X	myship.xdelta = 0;
X	myship.ydelta = 0;
X}
END_OF_FILE
if test 6022 -ne `wc -c <'move.c'`; then
    echo shar: \"'move.c'\" unpacked with wrong size!
fi
# end of 'move.c'
fi
if test -f 'point.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'point.c'\"
else
echo shar: Extracting \"'point.c'\" \(471 characters\)
sed "s/^X//" >'point.c' <<'END_OF_FILE'
X#include "rocks.h"
X
X#define xtopixmask(x)	(dpixmask[((x) % 16)])
X
static unsigned short	dpixmask[16] =
X{
X	0x0001, 0x0002,	0x0004,	0x0008,	
X	0x0010, 0x0020,	0x0040,	0x0080,	
X	0x0100, 0x0200,	0x0400,	0x0800,
X	0x1000, 0x2000,	0x4000, 0x8000
X};
X
X
void point(x,y)
int x,y;
X{
X	unsigned short	bitmask;
X	int 		address;
X
X
X	/* Determine Address & Bit Mask For This Point */
X
X	address = y * 45; 
X	address += (int)(x / 16);
X
X	bitmask = xtopixmask(x);
X
X	screen[address] ^= bitmask;
X}
END_OF_FILE
if test 471 -ne `wc -c <'point.c'`; then
    echo shar: \"'point.c'\" unpacked with wrong size!
fi
# end of 'point.c'
fi
if test -f 'rocks.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'rocks.c'\"
else
echo shar: Extracting \"'rocks.c'\" \(1771 characters\)
sed "s/^X//" >'rocks.c' <<'END_OF_FILE'
X/**********************************************************\
X* Rocks : a bit-mapped arcade game for the AT&T UNIX PC.   *
X*                                                          *
X* By : Hans Jespersen                                      *
X*                                                          *
X\**********************************************************/
X
X#include "rocks.h"
X
unsigned short rockwidth[3] = { 	SMALL_ROCK_WIDTH,
X					MEDIUM_ROCK_WIDTH,
X					LARGE_ROCK_WIDTH } ;
X
unsigned short rockheight[3] = { 	SMALL_ROCK_HEIGHT,
X					MEDIUM_ROCK_HEIGHT,
X					LARGE_ROCK_HEIGHT } ;
X
main(argc,argv)
int argc;
char *argv[];
X{
X	char c;
X	int startlevel;
X
X	if( argc > 2 ) {
X		fprintf(stderr,"\nusage: %s [level]\n", argv[0]);
X		fprintf(stderr,"       valid levels are 1..9\n");
X		fprintf(stderr,"       default level is %d\n",FIRSTLEVEL);
X		exit(-1);
X	} 
X	else if( argc == 2 ){
X		startlevel = argv[1][0] - '0';
X		if( (startlevel < 1) || (startlevel > 9) || (strlen(argv[1]) > 1) ){
X			fprintf(stderr,"\nusage: %s [level]\n", argv[0]);
X			fprintf(stderr,"       valid levels are 1..9\n");
X			fprintf(stderr,"       default level is %d\n",FIRSTLEVEL);
X			exit(-1);
X		}
X	}
X	else
X		startlevel = FIRSTLEVEL;
X        defsprites();		/* Define the little critters */
X        wininit();		/* Set up the full screen window */
X	while( c != QUIT ){
X		score = 0;
X		printscore();
X		level = startlevel;
X		for(men = 2; men >= 0;) {
X		        initscreen( level );	/* Display initial screen */
X			playgame();
X			level++;
X		}
X		mvaddstr(5,35,"Hi Scores");
X		CheckHiScore( score );
X		DisplayHiScores();
X		wgoto( wn, 23, 21);
X		printf( "Hit <%c> to quit, <space> to continue." ,QUIT );
X		flushinp();
X		c = '\0';
X		while ( (c != QUIT) && (c != ' ') )
X			c = getchar();
X	}
X	cleanup();
X}
END_OF_FILE
if test 1771 -ne `wc -c <'rocks.c'`; then
    echo shar: \"'rocks.c'\" unpacked with wrong size!
fi
# end of 'rocks.c'
fi
if test -f 'rocks.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'rocks.h'\"
else
echo shar: Extracting \"'rocks.h'\" \(2907 characters\)
sed "s/^X//" >'rocks.h' <<'END_OF_FILE'
X/**********************************************************\
X* Rocks : a bit-mapped arcade game for the AT&T UNIX PC.   *
X*                                                          *
X* By : Hans Jespersen                                      *
X*                                                          *
X* R.R.1                                                    *
X* Terra Cotta, Ontario                                     *
X* L0P 1N0                                                  *
X*                                                          *
X\**********************************************************/
X
X#include <sys/window.h>
X#include <sys/mouse.h>
X#include <fcntl.h>
X#include <tam.h>
X#include <termio.h>
X#include <stdio.h>
X
X/* 
X * Things you may want to modify 
X */
X
X#define SCORE_FILE	"/usr/games/lib/rocks.hs"	/* Highscore file */
X#define FIRSTLEVEL	4	/* Default number of rocks on first level */
X#define MAXROCKS	100
X#define MAXTHRUST	8	/* Maximum speed of ship in pixels */
X#define MAXSHOTS	10	/* Maximum number of shots at once */
X#define RANGE		20	/* Range of shots in SHOTINC */
X#define SHOTINC		8	/* Number of pixels to move shots */
X
X/* Define which keys do what */
X
X#define SHOOT		'a'
X#define BEEP		'b'
X#define LEFTKEY		'k'
X#define RIGHTKEY	'l'
X#define QUIT		'q'
X
X#ifdef MOUSE
X#	define THRUST		't'	/* use middle button of mouse instead */
X#	define HYPERSPACE	' '
X#else
X#	define THRUST		' '
X#	define HYPERSPACE	'j'
X#endif
X
X
X/*
X * Things you won't want to modify
X */
X
X#define SCREEN_WIDTH    720
X#define SCREEN_HEIGHT   300
X#define WIDTH		SCREEN_WIDTH / 8
X
X#define LARGE_ROCK_WIDTH	64
X#define LARGE_ROCK_HEIGHT	48
X#define MEDIUM_ROCK_WIDTH	32
X#define MEDIUM_ROCK_HEIGHT	24	
X#define SMALL_ROCK_WIDTH	16	
X#define SMALL_ROCK_HEIGHT	12	
X#define SHIP_WIDTH		16
X#define SHIP_HEIGHT		16
X#define SHOT_WIDTH		16
X#define SHOT_HEIGHT		16
X
X#define SPACE_HEIGHT	SCREEN_HEIGHT + LARGE_ROCK_HEIGHT
X#define SIZE		SCREEN_WIDTH * SPACE_HEIGHT / 16
X
X#define TRUE		1
X#define FALSE		0
X
X#define RIGHT		1
X#define LEFT           -1
X
X#define LARGE		2
X#define MEDIUM		1
X#define SMALL		0
X
extern unsigned short rockwidth[3];
extern unsigned short rockheight[3];
X
extern unsigned short patwhite[];
extern unsigned short patgray[];
extern unsigned short patltgray[];
extern unsigned short patblack[];
X
unsigned short rock[ 3 ][ LARGE_ROCK_WIDTH * LARGE_ROCK_HEIGHT / 16 ];
unsigned short ship[ 8 ][ SHIP_WIDTH * SHIP_HEIGHT / 16 ];
unsigned short debris[ 3 ][ SHIP_WIDTH * SHIP_HEIGHT / 16 ];
unsigned short shot[ SHOT_WIDTH * SHOT_HEIGHT / 16 ];
unsigned short screen[ SIZE ];
X
typedef struct position{
X        int x;
X        int y;
X	int xdelta;
X	int ydelta;
X	int size;
X} position;
X
position rocklist[ MAXROCKS ];
position myship;
position debrislist[ 3 ];
position shotlist[ MAXSHOTS ];
X
X/* define globals */
X
int wn;
int nrocks;
int nshots;
int beepflag;
int quitflag;
int score;
int men;
int level;
int direction;
END_OF_FILE
if test 2907 -ne `wc -c <'rocks.h'`; then
    echo shar: \"'rocks.h'\" unpacked with wrong size!
fi
# end of 'rocks.h'
fi
if test -f 'score.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'score.c'\"
else
echo shar: Extracting \"'score.c'\" \(1220 characters\)
sed "s/^X//" >'score.c' <<'END_OF_FILE'
X#include "rocks.h"
X
char ScoreString[10];
struct ScoreStruct {
X	char	Name[10];
X	int	Score;
X} High[10];
X
CheckHiScore( ThisScore )
int ThisScore;
X{
X	int  oldmask,fd,i,j;
X	int  writeflag;
X
X	writeflag = FALSE;
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		mvaddstr(22,0,"Couldn't open high score file for read.");
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		writeflag = TRUE;
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 ( writeflag )
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 to write.");
X	}
X	
X}
X
DisplayHiScores()
X{
X	int i;
X	
X	mvaddstr( 7, 26, "   NAME		SCORE\n");
X	mvaddstr( 8, 26, "   ----		-----\n");
X	for( i=0; i<10; i++ ){
X		wgoto( wn, 9 + i, 25 );
X		printf(	"%2d. %s		%d\n", i+1, (char *)High[i].Name, High[i].Score);
X	}
X}
END_OF_FILE
if test 1220 -ne `wc -c <'score.c'`; then
    echo shar: \"'score.c'\" unpacked with wrong size!
fi
# end of 'score.c'
fi
if test -f 'shot.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'shot.c'\"
else
echo shar: Extracting \"'shot.c'\" \(2032 characters\)
sed "s/^X//" >'shot.c' <<'END_OF_FILE'
X/**********************************************************\
X* Rocks : a bit-mapped arcade game for the AT&T UNIX PC.   *
X*                                                          *
X* By : Hans Jespersen                                      *
X*                                                          *
X\**********************************************************/
X
X#include "rocks.h"
X
shoot()
X{
X	if( nshots < MAXSHOTS - 1 ) {
X		nshots++;
X		shotlist[nshots].size = RANGE;
X		switch ( direction ){
X			case 0:	shotlist[nshots].x = myship.x + .5 * SHIP_WIDTH;
X				shotlist[nshots].y = myship.y; 
X				shotlist[nshots].xdelta = 0; 
X				shotlist[nshots].ydelta = -1 * SHOTINC; 
X				break;
X			case 1:	shotlist[nshots].x = myship.x + SHIP_WIDTH;
X				shotlist[nshots].y = myship.y; 
X				shotlist[nshots].xdelta = SHOTINC; 
X				shotlist[nshots].ydelta = -1 * SHOTINC; 
X				break;
X			case 2:	shotlist[nshots].x = myship.x + SHIP_WIDTH;
X				shotlist[nshots].y = myship.y + .5 * SHIP_HEIGHT -2; 
X				shotlist[nshots].xdelta = 2 * SHOTINC; 
X				shotlist[nshots].ydelta = 0; 
X				break;
X			case 3:	shotlist[nshots].x = myship.x + SHIP_WIDTH;
X				shotlist[nshots].y = myship.y + SHIP_HEIGHT -3; 
X				shotlist[nshots].xdelta = SHOTINC; 
X				shotlist[nshots].ydelta = SHOTINC; 
X				break;
X			case 4:	shotlist[nshots].x = myship.x + .5 * SHIP_WIDTH;
X				shotlist[nshots].y = myship.y + SHIP_HEIGHT; 
X				shotlist[nshots].xdelta = 0; 
X				shotlist[nshots].ydelta = SHOTINC;
X				break;
X			case 5:	shotlist[nshots].x = myship.x;
X				shotlist[nshots].y = myship.y + SHIP_HEIGHT -3; 
X				shotlist[nshots].xdelta = -1 * SHOTINC; 
X				shotlist[nshots].ydelta = SHOTINC; 
X				break;
X			case 6:	shotlist[nshots].x = myship.x;
X				shotlist[nshots].y = myship.y + .5*SHIP_HEIGHT -2; 
X				shotlist[nshots].xdelta = -2 * SHOTINC; 
X				shotlist[nshots].ydelta = 0; 
X				break;
X			case 7:	shotlist[nshots].x = myship.x;
X				shotlist[nshots].y = myship.y; 
X				shotlist[nshots].xdelta = -1 * SHOTINC; 
X				shotlist[nshots].ydelta = -1 * SHOTINC; 
X				break;
X		}
X	}
X}
END_OF_FILE
if test 2032 -ne `wc -c <'shot.c'`; then
    echo shar: \"'shot.c'\" unpacked with wrong size!
fi
# end of 'shot.c'
fi
if test -f 'sprites.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sprites.c'\"
else
echo shar: Extracting \"'sprites.c'\" \(8526 characters\)
sed "s/^X//" >'sprites.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\**********************************************************/
X
X#include "rocks.h"
X
defsprites()
X{
X	int i;
X
X	/* define large */
X
X        rock[LARGE][0] = rock[LARGE][1] = rock[LARGE][2] = rock[LARGE][3] = 0xffff;
X	for ( i = 4; i < 188; i += 4 ){
X		rock[LARGE][i] = 0x0001;
X		rock[LARGE][i+1] = 0x0000;
X		rock[LARGE][i+2] = 0x0000;
X		rock[LARGE][i+3] = 0x8000;
X	}
X        rock[LARGE][188] = rock[LARGE][189] = rock[LARGE][190] = rock[LARGE][191] = 0xffff;
X
X	/* define medium */
X
X        rock[MEDIUM][0] = rock[MEDIUM][1] = 0xffff;
X	rock[MEDIUM][2] = rock[MEDIUM][3] = 0x0000;
X	for ( i = 4; i < 92 ; i += 4 ){
X		rock[MEDIUM][i] = 0x0001;
X		rock[MEDIUM][i+1] = 0x8000;
X		rock[MEDIUM][i+2] = 0x0000;
X		rock[MEDIUM][i+3] = 0x0000;
X	}
X        rock[MEDIUM][92] = rock[MEDIUM][93] = 0xffff;
X
X	/* define small */
X
X        rock[SMALL][0] = 0xffff;
X	rock[SMALL][1] = rock[SMALL][2] = rock[SMALL][3] = 0x0000;
X	for ( i = 4; i < 44 ; i += 4 ){
X		rock[SMALL][i] = 0x8001;
X		rock[SMALL][i+1] = 0x0000;
X		rock[SMALL][i+2] = 0x0000;
X		rock[SMALL][i+3] = 0x0000;
X	}
X        rock[SMALL][44] = 0xffff;
X
X	debris[0][0] = 0x0100;		/*	---- ---# ---- ----	*/
X	debris[0][1] = 0x0100;		/*	---- ---# ---- ----	*/
X	debris[0][2] = 0x0080;		/*	---- ---- #--- ----	*/
X	debris[0][3] = 0x0080;		/*	---- ---- #--- ----	*/
X	debris[0][4] = 0x0040;		/*	---- ---- -#-- ---- 	*/
X	debris[0][5] = 0x0040;		/* 	---- ---- -#-- ----	*/
X	debris[0][6] = 0x0020;		/*	---- ---- --#- ----	*/
X	debris[0][7] = 0x0020;		/*	---- ---- --#- ----	*/
X	debris[0][8] = 0x0010;		/*	---- ---- ---# ----	*/
X	debris[0][9] = 0x0010;		/*	---- ---- ---# ----	*/
X	debris[0][10] = 0x0008;		/*	---- ---- ---- #---	*/
X	debris[0][11] = 0x0000;		/*	---- ---- ---- ----	*/
X
X	debris[1][0] = 0x0100;		/*	---- ---# ---- ----	*/
X	debris[1][1] = 0x0100;		/*	---- ---# ---- ----	*/
X	debris[1][2] = 0x0200;		/*	---- --#- ---- ----	*/
X	debris[1][3] = 0x0200;		/*	---- --#- ---- ----	*/
X	debris[1][4] = 0x0400;		/*	---- -#-- ---- ---- 	*/
X	debris[1][5] = 0x0400;		/* 	---- -#-- ---- ----	*/
X	debris[1][6] = 0x0800;		/*	---- #--- ---- ----	*/
X	debris[1][7] = 0x0800;		/*	---- #--- ---- ----	*/
X	debris[1][8] = 0x1000;		/*	---# ---- ---- ----	*/
X	debris[1][9] = 0x1000;		/*	---# ---- ---- ----	*/
X	debris[1][10] = 0x2000;		/*	--#- ---- ---- ----	*/
X	debris[1][11] = 0x0000;		/*	---- ---- ---- ----	*/
X
X	debris[2][0] = 0x0000;		/*	---- ---- ---- ----	*/
X	debris[2][1] = 0x0000;		/*	---- ---- ---- ----	*/
X	debris[2][2] = 0x0000;		/*	---- ---- ---- ----	*/
X	debris[2][3] = 0x0000;		/*	---- ---- ---- ----	*/
X	debris[2][4] = 0x0000;		/*	---- ---- ---- ---- 	*/
X	debris[2][5] = 0x0000;		/* 	---- ---- ---- ----	*/
X	debris[2][6] = 0x0000;		/*	---- ---- ---- ----	*/
X	debris[2][7] = 0x0000;		/*	---- ---- ---- ----	*/
X	debris[2][8] = 0x0000;		/*	---- ---- ---- ----	*/
X	debris[2][9] = 0x0000;		/*	---- ---- ---- ----	*/
X	debris[2][10] = 0x3ff8;		/*	--## #### #### #---	*/
X	debris[2][11] = 0x0000;		/*	---- ---- ---- ----	*/
X
X	ship[0][0] = 0x0100;		/*	---- ---# ---- ----	*/
X	ship[0][1] = 0x0100;		/*	---- ---# ---- ----	*/
X	ship[0][2] = 0x0380;		/*	---- --## #--- ----	*/
X	ship[0][3] = 0x0380;		/*	---- --## #--- ----	*/
X	ship[0][4] = 0x07c0;		/*	---- -### ##-- ---- 	*/
X	ship[0][5] = 0x07c0;		/* 	---- -### ##-- ----	*/
X	ship[0][6] = 0x0fe0;		/*	---- #### ###- ----	*/
X	ship[0][7] = 0x0fe0;		/*	---- #### ###- ----	*/
X	ship[0][8] = 0x1ff0;		/*	---# #### #### ----	*/
X	ship[0][9] = 0x1ff0;		/*	---# #### #### ----	*/
X	ship[0][10] = 0x3ff8;		/*	--## #### #### #---	*/
X	ship[0][11] = 0x0000;		/*	---- ---- ---- ----	*/
X
X	ship[1][0] = 0x0000;		/*	---- ---- ---- ----	*/
X	ship[1][1] = 0xc000;		/*	##-- ---- ---- ---- 	*/
X	ship[1][2] = 0x7000;		/*	-### ---- ---- ----	*/
X	ship[1][3] = 0x7c00;		/*	-### ##-- ---- ----	*/
X	ship[1][4] = 0x3f00;		/*	--## #### ---- ----	*/
X	ship[1][5] = 0x3fc0;		/*	--## #### ##-- ----	*/
X	ship[1][6] = 0x1ff0;		/*	---# #### #### ----	*/
X	ship[1][7] = 0x1fc0;		/*	---# #### ##-- ----	*/
X	ship[1][8] = 0x0f00;		/*	---- #### ---- ----	*/
X	ship[1][9] = 0x0c00;		/*	---- ##-- ---- ----	*/
X	ship[1][10] = 0x0000;		/*	---- ---- ---- ----	*/
X	ship[1][11] = 0x0000;		/*	---- ---- ---- ----	*/
X
X	ship[2][0] = 0x0000;		/*	---- ---- ---- ----	*/
X	ship[2][1] = 0x0000;		/*	---- ---- ---- ----	*/
X	ship[2][2] = 0x0004;		/*	---- ---- ---- -#--	*/
X	ship[2][3] = 0x001c;		/*	---- ---- ---# ##--	*/
X	ship[2][4] = 0x00fc;		/*	---- ---- #### ##--	*/
X	ship[2][5] = 0x07fc;		/*	---- -### #### ##--	*/
X	ship[2][6] = 0x3ffc;		/*	--## #### #### ##--	*/
X	ship[2][7] = 0x07fc;		/*	---- -### #### ##--	*/
X	ship[2][8] = 0x00fc;		/*	---- ---- #### ##--	*/
X	ship[2][9] = 0x001c;		/*	---- ---- ---# ##--	*/
X	ship[2][10] = 0x0004;		/*	---- ---- ---- -#--	*/
X	ship[2][11] = 0x0000;		/*	---- ---- ---- ----	*/
X
X	ship[3][0] = 0x0000;		/*	---- ---- ---- ---- 	*/
X	ship[3][1] = 0x0000;		/*	---- ---- ---- ----	*/
X	ship[3][2] = 0x0c00;		/*	---- ##-- ---- ----	*/
X	ship[3][3] = 0x0f00;		/*	---- #### ---- ---- 	*/
X	ship[3][4] = 0x1fc0;		/*	---# #### ##-- ----	*/
X	ship[3][5] = 0x1ff0;		/*	---# #### #### ----	*/
X	ship[3][6] = 0x3fc0;		/*	--## #### ##-- ----	*/
X	ship[3][7] = 0x3f00;		/*	--## #### ---- ----	*/
X	ship[3][8] = 0x7c00;		/*	-### ##-- ---- ----	*/
X	ship[3][9] = 0x7000;		/*	-### ---- ---- ----	*/
X	ship[3][10] = 0xc000;		/*	##-- ---- ---- ----	*/
X	ship[3][11] = 0x0000;		/*	---- ---- ---- ----	*/
X
X	ship[4][0] = 0x0000;		/*	---- ---- ---- ----	*/
X	ship[4][1] = 0x3ff8;		/*	--## #### #### #---	*/
X	ship[4][2] = 0x1ff0;		/*	---# #### #### ----	*/
X	ship[4][3] = 0x1ff0;		/*	---# #### #### ----	*/
X	ship[4][4] = 0x0fe0;		/*	---- #### ###- ----	*/
X	ship[4][5] = 0x0fe0;		/*	---- #### ###- ----	*/
X	ship[4][6] = 0x07c0;		/*	---- -### ##-- ----	*/
X	ship[4][7] = 0x07c0;		/*	---- -### ##-- ----	*/
X	ship[4][8] = 0x0380;		/*	---- --## #--- ----	*/
X	ship[4][9] = 0x0380;		/*	---- --## #--- ----	*/
X	ship[4][10] = 0x0100;		/*	---- ---# ---- ----	*/
X	ship[4][11] = 0x0100;		/*	---- ---# ---- ----	*/
X
X	ship[5][0] = 0x0000;		/*	---- ---- ---- ----	*/
X	ship[5][1] = 0x0000;		/*	---- ---- ---- ----	*/
X	ship[5][2] = 0x0030;		/*	---- ---- --## ----	*/
X	ship[5][3] = 0x00f0;		/*	---- ---- #### ----	*/
X	ship[5][4] = 0x03f8;		/*	---- --## #### #---	*/
X	ship[5][5] = 0x0ff8;		/*	---- #### #### #---	*/
X	ship[5][6] = 0x03fc;		/*	---- --## #### ##--	*/
X	ship[5][7] = 0x00fc;		/*	---- ---- #### ##--	*/
X	ship[5][8] = 0x003e;		/*	---- ---- --## ###-	*/
X	ship[5][9] = 0x000e;		/*	---- ---- ---- ###-	*/
X	ship[5][10] = 0x0003;		/*	---- ---- ---- --##	*/
X	ship[5][11] = 0x0000;		/*	---- ---- ---- ----	*/
X
X	ship[6][0] = 0x0000;		/*	---- ---- ---- ----	*/
X	ship[6][1] = 0x0000;		/*	---- ---- ---- ----	*/
X	ship[6][2] = 0x2000;		/*	--#- ---- ---- ----	*/
X	ship[6][3] = 0x3800;		/*	--## #--- ---- ----	*/
X	ship[6][4] = 0x3f00;		/*	--## #### ---- ----	*/
X	ship[6][5] = 0x3fe0;		/*	--## #### ###- ----	*/
X	ship[6][6] = 0x3ffc;		/*	--## #### #### ##--	*/
X	ship[6][7] = 0x3fe0;		/*	--## #### ###- ----	*/
X	ship[6][8] = 0x3f00;		/*	--## #### ---- ----	*/
X	ship[6][9] = 0x3800;		/*	--## #--- ---- ----	*/
X	ship[6][10] = 0x2000;		/*	--#- ---- ---- ----	*/
X	ship[6][11] = 0x0000;		/*	---- ---- ---- ----	*/
X
X	ship[7][0] = 0x0000;		/*	---- ---- ---- ----	*/
X	ship[7][1] = 0x0003;		/*	---- ---- ---- --##	*/
X	ship[7][2] = 0x000e;		/*	---- ---- ---- ###-	*/
X	ship[7][3] = 0x003e;		/*	---- ---- --## ###-	*/
X	ship[7][4] = 0x00fc;		/*	---- ---- #### ##--	*/
X	ship[7][5] = 0x03fc;		/*	---- --## #### ##--	*/
X	ship[7][6] = 0x0ff8;		/*	---- #### #### #---	*/
X	ship[7][7] = 0x03f8;		/*	---- --## #### #---	*/
X	ship[7][8] = 0x00f0;		/*	---- ---- #### ----	*/
X	ship[7][9] = 0x0030;		/*	---- ---- --## ----	*/
X	ship[7][10] = 0x0000;		/*	---- ---- ---- ----	*/
X	ship[7][11] = 0x0000;		/*	---- ---- ---- ----	*/
X
X	shot[0] = 0x0001;		/*	---- ---- ---- ---#	*/
X	shot[1] = 0x0000;		/*	---- ---- ---- ----	*/
X	shot[2] = 0x0000;		/*	---- ---- ---- ----	*/
X	shot[3] = 0x0000;		/*	---- ---- ---- ----	*/
X	shot[4] = 0x0000;		/*	---- ---- ---- ----	*/
X	shot[5] = 0x0000;		/*	---- ---- ---- ----	*/
X	shot[6] = 0x0000;		/*	---- ---- ---- ----	*/
X	shot[7] = 0x0000;		/*	---- ---- ---- ----	*/
X	shot[8] = 0x0000;		/*	---- ---- ---- ----	*/
X	shot[9] = 0x0000;		/*	---- ---- ---- ----	*/
X	shot[10] = 0x0000;		/*	---- ---- ---- ----	*/
X	shot[11] = 0x0000;		/*	---- ---- ---- ----	*/
X}
END_OF_FILE
if test 8526 -ne `wc -c <'sprites.c'`; then
    echo shar: \"'sprites.c'\" unpacked with wrong size!
fi
# end of 'sprites.c'
fi
if test -f 'stars.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'stars.c'\"
else
echo shar: Extracting \"'stars.c'\" \(584 characters\)
sed "s/^X//" >'stars.c' <<'END_OF_FILE'
X#include "rocks.h"
X
X#define SSIZE 	SCREEN_WIDTH * SCREEN_HEIGHT / 16 
X#define NSTARS 	100
X
stars() 
X{
X	char c;
X	int i,x,z;
X
X	srand48( (long)time(0) );
X       	wrastop(wn,screen,WIDTH,screen,WIDTH,0,0,0,0,SCREEN_WIDTH,SCREEN_HEIGHT,SRCSRC,DSTCAM,0);
X	for ( i = 0; i < NSTARS; i++ ){
X		x = lrand48() % (SSIZE - 1);
X		z = lrand48() % 16;
X		screen[ x ] |= (1 << z);
X	}
X	mvaddstr(10,30,"    Rocks, 1989");
X	mvaddstr(12,30," By Hans Jespersen");
X	mvaddstr(23,30,"Hit Any Key To Start");
X       	wrastop(wn,screen,WIDTH,0,0,0,0,0,0,SCREEN_WIDTH,SCREEN_HEIGHT,SRCSRC,DSTXOR,0);
X	getchar();
X}
END_OF_FILE
if test 584 -ne `wc -c <'stars.c'`; then
    echo shar: \"'stars.c'\" unpacked with wrong size!
fi
# end of 'stars.c'
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'\" \(1423 characters\)
sed "s/^X//" >'window.c' <<'END_OF_FILE'
X/**********************************************************\
X* Rocks : a bit-mapped arcade game for the AT&T UNIX PC.   *
X*                                                          *
X* By : Hans Jespersen                                      *
X*                                                          *
X\**********************************************************/
X
X#include "rocks.h"
X#include <sys/font.h>
X
void wininit()
X{
X	int wid, i;
X	struct umdata mouse;
X	struct icon myicon;
X
X	close( 0 );
X	close( 1 );
X	close( 2 );
X	wid = open( "/dev/window",O_RDWR );
X	dup( 0 );
X	dup( 0 );
X        winit();
X        if( !iswind() ) {
X                fprintf(stderr,"\nSorry, you must use bit-mapped display!\n");
X                wexit(-1);
X        }
X        wn = wcreate( 0, 0, 25, 80, NBORDER );
X	wuser( wn, "Rocks" );
X	wprintf( wn, "\033[=1C" );
X	noecho();
X	stars();
X        clear();
X	nodelay( 0,1 );
X	wprompt( wn, "score :      0" );
X	ioctl( wid, WIOCGETMOUSE, &mouse );
X	mouse.um_flags = MSDOWN;
X	myicon.ic_fc.fc_hs = 0;
X	myicon.ic_fc.fc_vs = 0;
X	myicon.ic_fc.fc_ha = 0;
X	myicon.ic_fc.fc_va = 0;
X	myicon.ic_fc.fc_hi = 0;
X	myicon.ic_fc.fc_vi = 0;
X	for( i=0; i < 64; i+=2 )
X		myicon.ic_raster[i] = 0x0000; 
X	mouse.um_icon = &myicon;
X	ioctl( wid, WIOCSETMOUSE, &mouse );
X	keypad( 0, 1 );
X}
X 
void cleanup()
X{
X        clear();
X	wprintf( wn, "\033[=0C" );
X        wdelete( wn );		/* Quick, the boss is comming */
X        exit( 0 );
X}
END_OF_FILE
if test 1423 -ne `wc -c <'window.c'`; then
    echo shar: \"'window.c'\" unpacked with wrong size!
fi
# end of 'window.c'
fi
echo shar: End of shell archive.
exit 0



More information about the Unix-pc.sources mailing list