Bugs Release 2 (part 1 of 1)
Hans Jespersen
hjespersen at rose.waterloo.edu
Sat Feb 3 04:50:21 AEST 1990
Well, it's finally here. This is the second release of
my Space Invaders game call 'bugs' (I know I pick really
stupid names). I have cross-posted this to comp.sys.att
because some people complained last time that the distribution
in unix-pc wasn't sufficient. My appologies to anyone who
has to read this twice.
The following are things that have been added to 'bugs':
1) improved graphics
2) use srand() to properly seed rand() and make game start uniquely
3) pause until key pressed at start
4) flush input buffer before start of game
5) add mouse controls
6) add shared libraries and strip binary
7) make "score = 0" print correctly
8) add top-10 high score list
9) add 'make install'
10) clean up bugs.h so people can see what is modifiable
11) add option to play again
12) add base explosions
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!!
--
Hans Jespersen ..!uunet!attcan!hjespers
..!uunet!watmath!rose!hjespersen
"What a long strange trip it's been"
--------------------------cut here---------------------------------
# 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 bugs.c bugs.h game.c init.c move.c
# score.c shot.c sprites.c stars.c window.c
# Wrapped by root\@arakis on Wed Jan 31 17:03:56 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'\" \(608 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
include $(MAKEINC)/Makepre.h
X
XEXE = bugs
OBJ = bugs.o sprites.o window.o move.o init.o game.o shot.o stars.o score.o
BINDIR = /usr/games/bin
LIBDIR = /usr/games/lib
CC = /bin/cc
CFLAGS = -O
X
bugs: $(OBJ)
X $(LD) $(LDFLAGS) $(SHAREDLIB) -o $(EXE) $(OBJ)
X
bugs.o: bugs.c bugs.h
X
sprites.o: sprites.c bugs.h
X
window.o: window.c bugs.h
X
move.o: move.c bugs.h
X
init.o: init.c bugs.h
X
game.o: game.c bugs.h
X
shot.o: shot.c bugs.h
X
stars.o: stars.c bugs.h
X
score.o: score.c bugs.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 608 -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'\" \(728 characters\)
sed "s/^X//" >'NOTES' <<'END_OF_FILE'
The following are things that have been added to 'bugs':
X
X 1) improved graphics
X 2) use srand() to properly seed rand() and make game start uniquely
X 3) pause until key pressed at start
X 4) flush input buffer before start of game
X 5) add mouse controls
X 6) add shared libraries and strip binary
X 7) make "score = 0" print correctly
X 8) add top-10 high score list
X 9) add 'make install'
X 10) clean up bugs.h so people can see what is modifiable
X 11) add option to play again
X 12) add base explosions
X
The following are things still to be added:
X
X 1) eliminate screen flicker
X 2) add timer to erase ufo score
X 3) impliment shields properly
X 4) have game continue from were it left off when you die
X 6) add pause key
END_OF_FILE
if test 728 -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'\" \(2383 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
X/**********************************************************\
X* Bugs : a bit-mapped arcade game for the AT&T UNIX PC. *
X* *
X* Release 2 Jan. 31, 1990 *
X* *
X* By : Hans Jespersen *
X* *
X\**********************************************************/
X
X 'Bugs' is a Space Invaders type game. I tried to preserve
as many of the elements of the original game as possible. Any
differences will be immediately obvious.
X
X This is the second release of 'bugs'. All changes are
documented in the file NOTES.
X
The controls for the game are as follows :
X
X Keyboard Mouse
X
X 'a' - shoot - Middle Button
X 'j' - move left - Left Button
X 'k' - stop moving - (release)
X 'l' - move right - Right Button
X 'b' - toggle beeping
X 's' - blow away shelters
X 'q' - quit
X
X Anyone wishing to change these controls should look at bugs.h
Make sure you at least define SCORE_FILE (for highscores )
in bugs.h.
X
X Many other game aspects are modifiable by changing constants
that are defined in bugs.h. I am quite satisfied with the pace
of the game, but if you wish to speed things up (at the expense
of smoothness in most cases) try bumping up the increament
constants BUGINC, BASEINC, SHOTINC, etc. (these represent the
number of pixels to move each iteration).
X
X At each successive level you will notice that the bugs start
at a lower position. There are 6 levels. The 7th level starts
back where the first level did, however the number of shots
increases making play harder still. The same happens again after
the 12th level. In all there are 18 levels. My hat's off to
anyone who makes it through all 18 (I haven't). After the 18th
play continues forever at the highest difficulty.
X
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 2383 -ne `wc -c <'README'`; then
echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'bugs.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'bugs.c'\"
else
echo shar: Extracting \"'bugs.c'\" \(1172 characters\)
sed "s/^X//" >'bugs.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 "bugs.h"
X
main(argc,argv)
int argc;
char *argv[];
X{
X char c;
X
X if( argc != 1 ) {
X fprintf(stderr,"\nusage: bugs\n");
X fprintf(stderr," There aint no arguments dummy, just type 'bugs'\n");
X exit(-1);
X }
X defsprites(); /* Define the little critters */
X wininit(); /* Set up the full screen window */
X beepflag = FALSE;
X while( c != QUIT ){
X score = 0;
X printscore();
X chance = 41;
X level = 0;
X for(men = 2; men >= 0;) {
X initscreen( level ); /* Display initial screen */
X playgame();
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 clear();
X }
X cleanup();
X}
END_OF_FILE
if test 1172 -ne `wc -c <'bugs.c'`; then
echo shar: \"'bugs.c'\" unpacked with wrong size!
fi
# end of 'bugs.c'
fi
if test -f 'bugs.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'bugs.h'\"
else
echo shar: Extracting \"'bugs.h'\" \(2998 characters\)
sed "s/^X//" >'bugs.h' <<'END_OF_FILE'
X/**********************************************************\
X* Bugs : 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/* place to put highscore file */
X
X#define SCORE_FILE "/usr/games/lib/bugs.hs"
X
X/* controls (not including mouse) */
X
X#define KILL 's'
X#define SHOOT 'a'
X#define BEEP 'b'
X#define LEFTKEY 'j'
X#define STOPKEY 'k'
X#define RIGHTKEY 'l'
X#define QUIT 'q'
X
X/* increaments */
X
X#define DROPINC 12
X#define MOVEINC 8
X#define BASEINC 2
X#define SHOTINC 8
X#define UFOINC 2
X
X
X/* chance of getting a UFO */
X
X#define UFOCHANCE 3000
X
X/*
X * Things you won't want to modify
X */
X
X#define SCREEN_WIDTH 720
X#define SCREEN_HEIGHT 300
X
X#define BUG_WIDTH 32
X#define BUG_HEIGHT 24
X#define REAL_BUG_WIDTH 28
X#define BUGSCORE 30
X
X#define BASE_WIDTH 32
X#define BASE_HEIGHT 16
X#define REAL_BASE_WIDTH 28
X#define BASE_LEVEL SCREEN_HEIGHT - BASE_HEIGHT
X
X#define SHELTER_WIDTH 48
X#define SHELTER_HEIGHT 32
X#define SHELTER_LEVEL 236
X
X#define UFO_WIDTH 32
X#define UFO_HEIGHT 24
X
X#define SHOT_WIDTH 16
X#define SHOT_HEIGHT 16
X#define SHOT_OFFSET 12
X#define REAL_SHOT_WIDTH 3
X#define SHOTSCORE 10
X
X#define BANG_WIDTH 32
X#define BANG_HEIGHT 24
X
X#define MAXBUGS 50
X#define MAXSHOTS 10
X#define MAXSHELTERS 4
X#define MAXLEVEL 6
X
X#define TRUE 1
X#define FALSE 0
X
X#define RIGHT 1
X#define LEFT -1
X#define STOP 0
X
extern unsigned short patwhite[];
extern unsigned short patgray[];
extern unsigned short patltgray[];
extern unsigned short patblack[];
X
unsigned short screen[SCREEN_WIDTH * SCREEN_HEIGHT / 16];
unsigned short bug[2][BUG_WIDTH * BUG_HEIGHT / 16];
unsigned short base[BASE_WIDTH * BASE_HEIGHT / 16];
unsigned short shelter[SHELTER_WIDTH * SHELTER_HEIGHT / 16];
unsigned short ufo[UFO_WIDTH * UFO_HEIGHT / 16];
unsigned short shot[SHOT_WIDTH * SHOT_HEIGHT / 16];
unsigned short bang[BANG_WIDTH * BANG_HEIGHT / 16];
X
struct position
X{
X int x;
X int y;
X};
X
struct position buglist[MAXBUGS];
struct position shelterlist[MAXSHELTERS];
struct position shotlist[MAXSHOTS];
struct position myshot;
struct position mybase;
struct position ufopos;
X
int wn;
int nbugs;
int nshots;
int shotflag;
int bugflag;
int dropflag;
int beepflag;
int quitflag;
int shelterflag;
int ufoflag;
int score;
int men;
int bugnum;
int shotnum;
int bugdir;
int chance;
int level;
END_OF_FILE
if test 2998 -ne `wc -c <'bugs.h'`; then
echo shar: \"'bugs.h'\" unpacked with wrong size!
fi
# end of 'bugs.h'
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'\" \(3608 characters\)
sed "s/^X//" >'game.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 "bugs.h"
X
playgame()
X{
X int key;
X int moveflag;
X int xp, yp, bp, rp;
X
X flushinp();
X moveflag = 0;
X for(; 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 moveflag = LEFT;
X break;
X case MBUTL|MBUTR:
X break;
X case MBUTM:
X shoot();
X break;
X case MBUTM|MBUTL:
X shoot();
X break;
X case MBUTM|MBUTR:
X shoot();
X break;
X case MBUTALL:
X shoot();
X break;
X case MBUTR:
X moveflag = RIGHT;
X break;
X default:
X moveflag = STOP;
X }
X break;
X case KILL:
X killshelters();
X break;
X case SHOOT:
X shoot();
X break;
X case BEEP:
X togglebeep();
X break;
X case LEFTKEY:
X moveflag = LEFT;
X break;
X case STOPKEY:
X moveflag = STOP;
X break;
X case RIGHTKEY:
X moveflag = RIGHT;
X break;
X case QUIT:
X cleanup();
X }
X moveshot();
X movebug( bugnum );
X bugshoot( bugnum );
X movebase( moveflag );
X moveufo();
X }
X if( nbugs >= 0 )
X men--;
X else {
X if( level < MAXLEVEL )
X level++;
X else {
X if( chance > 20 )
X chance -= 20;
X level = 0;
X }
X }
X sleep( 5 );
X clear();
X}
X
togglebeep()
X{
X beepflag = 1 - beepflag;
X}
X
shoot()
X{
X if( !shotflag ) {
X myshot.x = mybase.x + SHOT_OFFSET;
X myshot.y = mybase.y;
X shotflag = TRUE;
X }
X}
X
killbug( index )
int index;
X{
X int i;
X
X wrastop(wn,bang,4,0,0,0,0,buglist[index].x,buglist[index].y,BANG_WIDTH,BANG_HEIGHT,SRCAND,DSTSRC,patblack);
X if(( index == bugnum ) && ( index == nbugs )) {
X movebug( index );
X wrastop(wn,bang,4,0,0,0,0,buglist[index].x,buglist[index].y,BANG_WIDTH,BANG_HEIGHT,SRCAND,DSTSRC,patblack);
X }
X else {
X for( i = index; i < nbugs; i++ )
X buglist[i] = buglist[i + 1];
X }
X if( index < bugnum )
X bugnum--;
X nbugs--;
X if( nbugs < 0 )
X quitflag = TRUE;
X score += BUGSCORE;
X printscore();
X}
X
killshot( index )
int index;
X{
X int i;
X
X wrastop(wn,shot,2,0,0,0,0,shotlist[index].x,shotlist[index].y,REAL_SHOT_WIDTH,SHOT_HEIGHT,SRCAND,DSTSRC,patblack);
X for( i = index; i < nshots; i++ )
X shotlist[i] = shotlist[i + 1];
X nshots--;
X}
X
killshelters()
X{
X int i;
X
X for( i = 0; i < MAXSHELTERS; i++ ) {
X wrastop(wn,shelter,4,0,0,0,0,shelterlist[i].x,shelterlist[i].y,SHELTER_WIDTH,SHELTER_HEIGHT,SRCAND,DSTSRC,patblack);
X shelterlist[i].x = -100;
X shelterlist[i].y = -100;
X }
X}
X
int collide( apos, awidth, aheight, bpos, bwidth, bheight )
struct position apos;
int awidth;
int aheight;
struct position bpos;
int bwidth;
int bheight;
X{
X if( (bpos.y >= apos.y - bheight) && (bpos.y <= apos.y + aheight) ){
X if( (bpos.x >= apos.x - bwidth) && (bpos.x <= apos.x + awidth) )
X return( TRUE );
X else
X return( FALSE );
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}
END_OF_FILE
if test 3608 -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'\" \(1580 characters\)
sed "s/^X//" >'init.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 "bugs.h"
X
initscreen( level )
int level;
X{
X int i,j,index;
X char menstr[15];
X
X srand( (long)time(0) );
X mybase.x = 16;
X mybase.y = BASE_LEVEL;
X wrastop(0,base,4,0,0,0,0,mybase.x,mybase.y,BASE_WIDTH,BASE_HEIGHT,SRCAND,DSTSRC,patwhite);
X if( level < 4 ){
X for (i = 0; i < MAXSHELTERS; i++) {
X shelterlist[i].x = i*154 + 105;
X shelterlist[i].y = SHELTER_LEVEL;
X wrastop(0,shelter,6,0,0,0,0,shelterlist[i].x,shelterlist[i].y,SHELTER_WIDTH,SHELTER_HEIGHT,SRCAND,DSTSRC,patwhite);
X }
X shelterflag = FALSE;
X }
X else
X shelterflag = TRUE;
X index = 0;
X for (i = 0; i < 10; i++) {
X for (j = 0; j < 5; j++) {
X buglist[index].x = i*64 + 32;
X buglist[index].y = j*36 + level*DROPINC + UFO_HEIGHT;
X wrastop(0,bug[0],4,0,0,0,0,buglist[index].x,buglist[index].y,BUG_WIDTH,BUG_HEIGHT,SRCAND,DSTSRC,patwhite);
X index++;
X }
X }
X strcpy( menstr, "men : " );
X menstr[13] = men + '0';
X menstr[14] = '\0';
X wcmd( wn, menstr );
X nbugs = MAXBUGS - 1;
X nshots = -1;
X dropflag = FALSE;
X shotflag = FALSE;
X bugflag = FALSE;
X ufoflag = FALSE;
X quitflag = FALSE;
X bugnum = 0;
X shotnum = 0;
X bugdir = RIGHT;
X}
END_OF_FILE
if test 1580 -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'\" \(3066 characters\)
sed "s/^X//" >'move.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 "bugs.h"
X
movebase( direction )
int direction;
X{
X int i;
X struct position tmpbase;
X
X if( direction != STOP )
X wrastop(wn,base,4,0,0,0,0,mybase.x,mybase.y,REAL_BASE_WIDTH,BASE_HEIGHT,SRCAND,DSTSRC,patblack);
X mybase.x += direction * BASEINC;
X if ( (mybase.x < 0) || (mybase.x + BASE_WIDTH > SCREEN_WIDTH) )
X mybase.x -= direction * BASEINC;
X wrastop(wn,base,4,0,0,0,0,mybase.x,mybase.y,REAL_BASE_WIDTH,BASE_HEIGHT,SRCAND,DSTSRC,patwhite);
X /* exclude laser canon from collision check */
X tmpbase.x = mybase.x;
X tmpbase.y = mybase.y + 4;
X for( i = 0; i <= nshots; i++ ) {
X if( collide( shotlist[i], REAL_SHOT_WIDTH, SHOT_HEIGHT, tmpbase, REAL_BASE_WIDTH, BASE_HEIGHT ) ) {
X quitflag = TRUE;
X explode();
X }
X }
X}
X
movebug(index)
int index;
X{
X int newbugflag;
X
X newbugflag = 1 - bugflag;
X wrastop(wn,bug[bugflag],4,0,0,0,0,buglist[index].x,buglist[index].y,REAL_BUG_WIDTH,BUG_HEIGHT,SRCAND,DSTSRC,patblack);
X if( (shelterflag == 0) && (buglist[index].y > SHELTER_LEVEL - BUG_HEIGHT) ) {
X shelterflag = TRUE;
X killshelters();
X }
X if( dropflag )
X buglist[index].y += DROPINC;
X else
X buglist[index].x += MOVEINC * bugdir;
X if( index <= nbugs )
X wrastop(wn,bug[newbugflag],4,0,0,0,0,buglist[index].x,buglist[index].y,REAL_BUG_WIDTH,BUG_HEIGHT,SRCAND,DSTSRC,patwhite);
X if( buglist[index].y >= BASE_LEVEL - BUG_HEIGHT ) {
X quitflag = TRUE;
X }
X if( index >= nbugs ) {
X bugflag = newbugflag;
X if( dropflag ) {
X dropflag = FALSE;
X bugdir *= LEFT;
X }
X else if( (bugdir == RIGHT ) && (buglist[nbugs].x > SCREEN_WIDTH - BUG_WIDTH - MOVEINC) )
X dropflag = TRUE;
X else if( (bugdir == LEFT) && (buglist[0].x < MOVEINC) )
X dropflag = TRUE;
X bugnum = 0;
X }
X else
X bugnum = index + 1;
X}
X
moveshot()
X{
X if( shotflag )
X movemyshot();
X if( nshots >= 0 )
X movebugshot( shotnum );
X}
X
moveufo()
X{
X int xpos;
X int ufoscore;
X
X if( ufoflag ) {
X wrastop(wn,ufo,4,0,0,0,0,ufopos.x,ufopos.y,UFO_WIDTH,UFO_HEIGHT,SRCAND,DSTSRC,patblack);
X ufopos.x -= UFOINC;
X if( ufopos.x < 0 )
X ufoflag = FALSE;
X else if( collide( myshot, REAL_SHOT_WIDTH, SHOT_HEIGHT, ufopos, UFO_WIDTH, UFO_HEIGHT ) ) {
X wrastop(wn,shot,2,0,0,0,0,myshot.x,myshot.y,REAL_SHOT_WIDTH,SHOT_HEIGHT,SRCAND,DSTSRC,patblack);
X if( beepflag ) beep();
X ufoscore = ((rand() % 4) + 1) * 100;
X score += ufoscore;
X xpos = (ufopos.x - (ufopos.x % 9)) / 9;
X wgoto( wn, 0, xpos );
X wprintf( wn, "%d", ufoscore );
X printscore();
X ufoflag = FALSE;
X shotflag = FALSE;
X }
X else
X wrastop(wn,ufo,4,0,0,0,0,ufopos.x,ufopos.y,UFO_WIDTH,UFO_HEIGHT,SRCAND,DSTSRC,patwhite);
X }
X else {
X if( rand() % UFOCHANCE == 0 ) {
X ufoflag = TRUE;
X ufopos.x = SCREEN_WIDTH;
X ufopos.y = 0;
X }
X }
X}
END_OF_FILE
if test 3066 -ne `wc -c <'move.c'`; then
echo shar: \"'move.c'\" unpacked with wrong size!
fi
# end of 'move.c'
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'\" \(1219 characters\)
sed "s/^X//" >'score.c' <<'END_OF_FILE'
X#include "bugs.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 1219 -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'\" \(3428 characters\)
sed "s/^X//" >'shot.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 "bugs.h"
X
movemyshot()
X{
X int index;
X
X wrastop(wn,shot,2,0,0,0,0,myshot.x,myshot.y,REAL_SHOT_WIDTH,SHOT_HEIGHT,SRCAND,DSTSRC,patblack);
X if( myshot.y < SHOTINC ) {
X shotflag = 0;
X myshot.y = BASE_LEVEL;
X }
X else {
X myshot.y -= SHOTINC;
X wrastop(wn,shot,2,0,0,0,0,myshot.x,myshot.y,REAL_SHOT_WIDTH,SHOT_HEIGHT,SRCAND,DSTSRC,patwhite);
X }
X for( index = 0; index <= nbugs; index++ ){
X if( collide( myshot, REAL_SHOT_WIDTH, SHOT_HEIGHT, buglist[index], REAL_BUG_WIDTH, BUG_HEIGHT ) ){
X wrastop(wn,shot,2,0,0,0,0,myshot.x,myshot.y,REAL_SHOT_WIDTH,SHOT_HEIGHT,SRCAND,DSTSRC,patblack);
X shotflag = 0;
X if( beepflag ) beep();
X killbug( index );
X }
X }
X for( index = 0; index <= nshots; index++ ){
X if( collide( myshot, REAL_SHOT_WIDTH, SHOT_HEIGHT, shotlist[index], REAL_SHOT_WIDTH, SHOT_HEIGHT ) ){
X wrastop(wn,shot,2,0,0,0,0,myshot.x,myshot.y,REAL_SHOT_WIDTH,SHOT_HEIGHT,SRCAND,DSTSRC,patblack);
X shotflag = 0;
X if( beepflag ) beep();
X killshot( index );
X score += SHOTSCORE;
X printscore();
X }
X }
X for( index = 0; index < MAXSHELTERS; index++ ){
X if( collide( myshot, REAL_SHOT_WIDTH, SHOT_HEIGHT, shelterlist[index], SHELTER_WIDTH, SHELTER_HEIGHT ) ){
X wrastop(wn,shot,2,0,0,0,0,myshot.x,myshot.y,REAL_SHOT_WIDTH,SHOT_HEIGHT,SRCAND,DSTSRC,patblack);
X shotflag = 0;
X if( beepflag ) beep();
X }
X }
X}
X
movebugshot( index )
int index;
X{
X int i;
X struct position tmpbase;
X
X /* exclude laser canon from collision check */
X tmpbase.x = mybase.x;
X tmpbase.y = mybase.y + 4;
X if( index <= nshots ) {
X if( shotlist[index].y <= BASE_LEVEL ) {
X wrastop(wn,shot,2,0,0,0,0,shotlist[index].x,shotlist[index].y,REAL_SHOT_WIDTH,SHOT_HEIGHT,SRCAND,DSTSRC,patblack);
X shotlist[index].y += SHOTINC;
X wrastop(wn,shot,2,0,0,0,0,shotlist[index].x,shotlist[index].y,REAL_SHOT_WIDTH,SHOT_HEIGHT,SRCAND,DSTSRC,patwhite);
X if( collide( shotlist[index], REAL_SHOT_WIDTH, SHOT_HEIGHT, tmpbase, REAL_BASE_WIDTH, BASE_HEIGHT ) ) {
X quitflag = TRUE;
X explode();
X }
X for( i = 0; i < MAXSHELTERS; i++ ){
X if( collide( shotlist[index], REAL_SHOT_WIDTH, SHOT_HEIGHT, shelterlist[i], SHELTER_WIDTH, SHELTER_HEIGHT ) ){
X wrastop(wn,shot,2,0,0,0,0,shotlist[index].x,shotlist[index].y,REAL_SHOT_WIDTH,SHOT_HEIGHT,SRCAND,DSTSRC,patblack);
X killshot( index );
X }
X }
X }
X else {
X killshot( index );
X }
X }
X if( ++shotnum >= MAXSHOTS )
X shotnum = 0;
X}
X
bugshoot( index )
int index;
X{
X if( nshots < MAXSHOTS - 1 ) {
X if( rand() % chance == 0 ) {
X nshots++;
X shotlist[nshots].x = buglist[index].x + BUG_WIDTH / 2;
X shotlist[nshots].y = buglist[index].y + BUG_HEIGHT;
X }
X }
X}
X
explode(){
X int i;
X
X for(i=0;i<150;i++){
X wrastop(wn,base,2,0,0,0,0,mybase.x,mybase.y,REAL_BASE_WIDTH,BASE_HEIGHT,SRCAND,DSTSRC,patwhite);
X wrastop(wn,base,2,0,0,0,0,mybase.x,mybase.y,REAL_BASE_WIDTH,BASE_HEIGHT,SRCAND,DSTSRC,patgray);
X wrastop(wn,base,2,0,0,0,0,mybase.x,mybase.y,REAL_BASE_WIDTH,BASE_HEIGHT,SRCAND,DSTSRC,patblack);
X wrastop(wn,base,2,0,0,0,0,mybase.x,mybase.y,REAL_BASE_WIDTH,BASE_HEIGHT,SRCAND,DSTSRC,patltgray);
X }
X}
END_OF_FILE
if test 3428 -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'\" \(16148 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 "bugs.h"
X
defsprites()
X{
X /* define bugs */
X
X bug[0][0] = 0x0000; /* ---- ---- ---- ---- */
X bug[0][2] = 0x001f; /* ---- ---- ---# #### */
X bug[0][4] = 0x001f; /* ---- ---- ---# #### */
X bug[0][6] = 0x001f; /* ---- ---- ---# #### */
X bug[0][8] = 0x003c; /* ---- ---- --## ##-- */
X bug[0][10] = 0x0078; /* ---- ---- -### #--- */
X bug[0][12] = 0x00f0; /* ---- ---- #### ---- */
X bug[0][14] = 0x03e0; /* ---- --## ###- ---- */
X bug[0][16] = 0xff80; /* #### #### #--- ---- */
X bug[0][18] = 0xffc0; /* #### #### ##-- ---- */
X bug[0][20] = 0xffe0; /* #### #### ###- ---- */
X bug[0][22] = 0xfff0; /* #### #### #### ---- */
X bug[0][24] = 0xf8f0; /* #### #--- #### ---- */
X bug[0][26] = 0xf070; /* #### ---- -### ---- */
X bug[0][28] = 0xf470; /* #### -#-- -### ---- */
X bug[0][30] = 0xf070; /* #### ---- -### ---- */
X bug[0][32] = 0xfff0; /* #### #### #### ---- */
X bug[0][34] = 0xfff0; /* #### #### #### ---- */
X bug[0][36] = 0xfff8; /* #### #### #### #--- */
X bug[0][38] = 0xfffc; /* #### #### #### ##-- */
X bug[0][40] = 0x001f; /* ---- ---- ---# #### */
X bug[0][42] = 0x000f; /* ---- ---- ---- #### */
X bug[0][44] = 0x000f; /* ---- ---- ---- #### */
X bug[0][46] = 0x001f; /* ---- ---- ---# #### */
X
X bug[0][1] = 0x0000; /* ---- ---- ---- ---- */
X bug[0][3] = 0x0f80; /* ---- #### #--- ---- */
X bug[0][5] = 0x0f80; /* ---- #### #--- ---- */
X bug[0][7] = 0x0f80; /* ---- #### #--- ---- */
X bug[0][9] = 0x03c0; /* ---- --## ##-- ---- */
X bug[0][11] = 0x01e0; /* ---- ---# ###- ---- */
X bug[0][13] = 0x00f0; /* ---- ---- #### ---- */
X bug[0][15] = 0x007c; /* ---- ---- -### ##-- */
X bug[0][17] = 0x001f; /* ---- ---- ---# #### */
X bug[0][19] = 0x003f; /* ---- ---- --## #### */
X bug[0][21] = 0x007f; /* ---- ---- -### #### */
X bug[0][23] = 0x00ff; /* ---- ---- #### #### */
X bug[0][25] = 0x00f1; /* ---- ---- #### ---# */
X bug[0][27] = 0x00e0; /* ---- ---- ###- ---- */
X bug[0][29] = 0x00e2; /* ---- ---- ###- --#- */
X bug[0][31] = 0x00e0; /* ---- ---- ###- ---- */
X bug[0][33] = 0x00ff; /* ---- ---- #### #### */
X bug[0][35] = 0x00ff; /* ---- ---- #### #### */
X bug[0][37] = 0x01ff; /* ---- ---# #### #### */
X bug[0][39] = 0x03ff; /* ---- --## #### #### */
X bug[0][41] = 0x0f80; /* ---- #### #--- ---- */
X bug[0][43] = 0x0f00; /* ---- #### ---- ---- */
X bug[0][45] = 0x0f00; /* ---- #### ---- ---- */
X bug[0][47] = 0x0f80; /* ---- #### #--- ---- */
X
X
X /* define more bugs */
X
X bug[1][0] = 0x0000; /* ---- ---- ---- ---- */
X bug[1][2] = 0x0000; /* ---- ---- ---- ---- */
X bug[1][4] = 0x0000; /* ---- ---- ---- ---- */
X bug[1][6] = 0x0000; /* ---- ---- ---- ---- */
X bug[1][8] = 0x0000; /* ---- ---- ---- ---- */
X bug[1][10] = 0x00ff; /* ---- ---- #### #### */
X bug[1][12] = 0x01ff; /* ---- ---# #### #### */
X bug[1][14] = 0x03cf; /* ---- --## ##-- #### */
X bug[1][16] = 0xff80; /* #### #### #--- ---- */
X bug[1][18] = 0xffc0; /* #### #### ##-- ---- */
X bug[1][20] = 0xffe0; /* #### #### ###- ---- */
X bug[1][22] = 0xfff0; /* #### #### #### ---- */
X bug[1][24] = 0xf8f0; /* #### #--- #### ---- */
X bug[1][26] = 0xf070; /* #### ---- -### ---- */
X bug[1][28] = 0xf470; /* #### -#-- -### ---- */
X bug[1][30] = 0xf070; /* #### ---- -### ---- */
X bug[1][32] = 0xfff0; /* #### #### #### ---- */
X bug[1][34] = 0xfff0; /* #### #### #### ---- */
X bug[1][36] = 0xfff0; /* #### #### #### ---- */
X bug[1][38] = 0xfff0; /* #### #### #### ---- */
X bug[1][40] = 0x00f0; /* ---- ---- #### ---- */
X bug[1][42] = 0x00f0; /* ---- ---- #### ---- */
X bug[1][44] = 0x00f0; /* ---- ---- #### ---- */
X bug[1][46] = 0x01f8; /* ---- ---# #### #--- */
X
X bug[1][1] = 0x0000; /* ---- ---- ---- ---- */
X bug[1][3] = 0x0000; /* ---- ---- ---- ---- */
X bug[1][5] = 0x0000; /* ---- ---- ---- ---- */
X bug[1][7] = 0x0000; /* ---- ---- ---- ---- */
X bug[1][9] = 0x0000; /* ---- ---- ---- ---- */
X bug[1][11] = 0x0ff0; /* ---- #### #### ---- */
X bug[1][13] = 0x0ff8; /* ---- #### #### #--- */
X bug[1][15] = 0x0f3c; /* ---- #### --## ##-- */
X bug[1][17] = 0x001f; /* ---- ---- ---# #### */
X bug[1][19] = 0x003f; /* ---- ---- --## #### */
X bug[1][21] = 0x007f; /* ---- ---- -### #### */
X bug[1][23] = 0x00ff; /* ---- ---- #### #### */
X bug[1][25] = 0x00f1; /* ---- ---- #### ---# */
X bug[1][27] = 0x00e0; /* ---- ---- ###- ---- */
X bug[1][29] = 0x00e2; /* ---- ---- ###- --#- */
X bug[1][31] = 0x00e0; /* ---- ---- ###- ---- */
X bug[1][33] = 0x00ff; /* ---- ---- #### #### */
X bug[1][35] = 0x00ff; /* ---- ---- #### #### */
X bug[1][37] = 0x00ff; /* ---- ---- #### #### */
X bug[1][39] = 0x00ff; /* ---- ---- #### #### */
X bug[1][41] = 0x00f0; /* ---- ---- #### ---- */
X bug[1][43] = 0x00f0; /* ---- ---- #### ---- */
X bug[1][45] = 0x00f0; /* ---- ---- #### ---- */
X bug[1][47] = 0x01f8; /* ---- ---# #### #--- */
X
X /* define base */
X
X base[0] = 0xf000; /* #### ---- ---- ---- */
X base[2] = 0xf000; /* #### ---- ---- ---- */
X base[4] = 0xf000; /* #### ---- ---- ---- */
X base[6] = 0xf000; /* #### ---- ---- ---- */
X base[8] = 0xfff0; /* #### #### #### ---- */
X base[10] = 0xfff8; /* #### #### #### #--- */
X base[12] = 0xfffc; /* #### #### #### ##-- */
X base[14] = 0xfffe; /* #### #### #### ###- */
X base[16] = 0xffff; /* #### #### #### #### */
X base[18] = 0xffff; /* #### #### #### #### */
X base[20] = 0xffff; /* #### #### #### #### */
X base[22] = 0xffff; /* #### #### #### #### */
X base[24] = 0xffff; /* #### #### #### #### */
X base[26] = 0xffff; /* #### #### #### #### */
X base[28] = 0x0000; /* ---- ---- ---- ---- */
X base[30] = 0x0000; /* ---- ---- ---- ---- */
X
X base[1] = 0x0000; /* ---- ---- ---- ---- */
X base[3] = 0x0000; /* ---- ---- ---- ---- */
X base[5] = 0x0000; /* ---- ---- ---- ---- */
X base[7] = 0x0000; /* ---- ---- ---- ---- */
X base[9] = 0x00ff; /* ---- ---- #### #### */
X base[11] = 0x01ff; /* ---- ---# #### #### */
X base[13] = 0x03ff; /* ---- --## #### #### */
X base[15] = 0x07ff; /* ---- -### #### #### */
X base[17] = 0x0fff; /* ---- #### #### #### */
X base[19] = 0x0fff; /* ---- #### #### #### */
X base[21] = 0x0fff; /* ---- #### #### #### */
X base[23] = 0x0fff; /* ---- #### #### #### */
X base[25] = 0x0fff; /* ---- #### #### #### */
X base[27] = 0x0fff; /* ---- #### #### #### */
X base[29] = 0x0000; /* ---- ---- ---- ---- */
X base[31] = 0x0000; /* ---- ---- ---- ---- */
X
X /* define shelter */
X
X shelter[0] = 0xff00; /* #### #### ---- ---- */
X shelter[3] = 0xff80; /* #### #### #--- ---- */
X shelter[6] = 0xffc0; /* #### #### ##-- ---- */
X shelter[9] = 0xffe0; /* #### #### ###- ---- */
X shelter[12] = 0xfff0; /* #### #### #### ---- */
X shelter[15] = 0xfff8; /* #### #### #### #--- */
X shelter[18] = 0xfffc; /* #### #### #### ##-- */
X shelter[21] = 0xfffe; /* #### #### #### ###- */
X shelter[24] = 0xffff; /* #### #### #### #### */
X shelter[27] = 0xffff; /* #### #### #### #### */
X shelter[30] = 0xffff; /* #### #### #### #### */
X shelter[33] = 0xffff; /* #### #### #### #### */
X shelter[36] = 0xffff; /* #### #### #### #### */
X shelter[39] = 0xffff; /* #### #### #### #### */
X shelter[42] = 0xffff; /* #### #### #### #### */
X shelter[45] = 0xffff; /* #### #### #### #### */
X shelter[48] = 0xffff; /* #### #### #### #### */
X shelter[51] = 0xffff; /* #### #### #### #### */
X shelter[54] = 0xffff; /* #### #### #### #### */
X shelter[57] = 0xffff; /* #### #### #### #### */
X shelter[60] = 0xffff; /* #### #### #### #### */
X shelter[63] = 0xffff; /* #### #### #### #### */
X shelter[66] = 0xffff; /* #### #### #### #### */
X shelter[69] = 0xffff; /* #### #### #### #### */
X shelter[72] = 0x00ff; /* ---- ---- #### #### */
X shelter[75] = 0x00ff; /* ---- ---- #### #### */
X shelter[78] = 0x00ff; /* ---- ---- #### #### */
X shelter[81] = 0x00ff; /* ---- ---- #### #### */
X shelter[84] = 0x00ff; /* ---- ---- #### #### */
X shelter[87] = 0x00ff; /* ---- ---- #### #### */
X shelter[90] = 0x00ff; /* ---- ---- #### #### */
X shelter[93] = 0x00ff; /* ---- ---- #### #### */
X
X shelter[1] = 0xffff; /* #### #### #### #### */
X shelter[4] = 0xffff; /* #### #### #### #### */
X shelter[7] = 0xffff; /* #### #### #### #### */
X shelter[10] = 0xffff; /* #### #### #### #### */
X shelter[13] = 0xffff; /* #### #### #### #### */
X shelter[16] = 0xffff; /* #### #### #### #### */
X shelter[19] = 0xffff; /* #### #### #### #### */
X shelter[22] = 0xffff; /* #### #### #### #### */
X shelter[25] = 0xffff; /* #### #### #### #### */
X shelter[28] = 0xffff; /* #### #### #### #### */
X shelter[31] = 0xffff; /* #### #### #### #### */
X shelter[34] = 0xffff; /* #### #### #### #### */
X shelter[37] = 0xffff; /* #### #### #### #### */
X shelter[40] = 0xffff; /* #### #### #### #### */
X shelter[43] = 0xffff; /* #### #### #### #### */
X shelter[46] = 0xffff; /* #### #### #### #### */
X shelter[49] = 0xffff; /* #### #### #### #### */
X shelter[52] = 0xffff; /* #### #### #### #### */
X shelter[55] = 0xffff; /* #### #### #### #### */
X shelter[58] = 0xffff; /* #### #### #### #### */
X shelter[61] = 0xffff; /* #### #### #### #### */
X shelter[64] = 0xffff; /* #### #### #### #### */
X shelter[67] = 0xffff; /* #### #### #### #### */
X shelter[70] = 0xffff; /* #### #### #### #### */
X shelter[73] = 0x0000; /* ---- ---- ---- ---- */
X shelter[76] = 0x0000; /* ---- ---- ---- ---- */
X shelter[79] = 0x0000; /* ---- ---- ---- ---- */
X shelter[82] = 0x0000; /* ---- ---- ---- ---- */
X shelter[85] = 0x0000; /* ---- ---- ---- ---- */
X shelter[88] = 0x0000; /* ---- ---- ---- ---- */
X shelter[91] = 0x0000; /* ---- ---- ---- ---- */
X shelter[94] = 0x0000; /* ---- ---- ---- ---- */
X
X shelter[2] = 0x00ff; /* ---- ---- #### #### */
X shelter[5] = 0x01ff; /* ---- ---# #### #### */
X shelter[8] = 0x03ff; /* ---- --## #### #### */
X shelter[11] = 0x07ff; /* ---- -### #### #### */
X shelter[14] = 0x0fff; /* ---- #### #### #### */
X shelter[17] = 0x1fff; /* ---# #### #### #### */
X shelter[20] = 0x3fff; /* --## #### #### #### */
X shelter[23] = 0x7fff; /* -### #### #### #### */
X shelter[26] = 0xffff; /* #### #### #### #### */
X shelter[29] = 0xffff; /* #### #### #### #### */
X shelter[32] = 0xffff; /* #### #### #### #### */
X shelter[35] = 0xffff; /* #### #### #### #### */
X shelter[38] = 0xffff; /* #### #### #### #### */
X shelter[41] = 0xffff; /* #### #### #### #### */
X shelter[44] = 0xffff; /* #### #### #### #### */
X shelter[47] = 0xffff; /* #### #### #### #### */
X shelter[50] = 0xffff; /* #### #### #### #### */
X shelter[53] = 0xffff; /* #### #### #### #### */
X shelter[56] = 0xffff; /* #### #### #### #### */
X shelter[59] = 0xffff; /* #### #### #### #### */
X shelter[62] = 0xffff; /* #### #### #### #### */
X shelter[65] = 0xffff; /* #### #### #### #### */
X shelter[68] = 0xffff; /* #### #### #### #### */
X shelter[71] = 0xffff; /* #### #### #### #### */
X shelter[74] = 0xff00; /* #### #### ---- ---- */
X shelter[77] = 0xff00; /* #### #### ---- ---- */
X shelter[80] = 0xff00; /* #### #### ---- ---- */
X shelter[83] = 0xff00; /* #### #### ---- ---- */
X shelter[86] = 0xff00; /* #### #### ---- ---- */
X shelter[89] = 0xff00; /* #### #### ---- ---- */
X shelter[92] = 0xff00; /* #### #### ---- ---- */
X shelter[95] = 0xff00; /* #### #### ---- ---- */
X
X /* define UFO */
X
X ufo[0] = 0xfff0; /* #### #### #### ---- */
X ufo[2] = 0xfff8; /* #### #### #### #--- */
X ufo[4] = 0xfffc; /* #### #### #### ##-- */
X ufo[6] = 0xfffe; /* #### #### #### ###- */
X ufo[8] = 0xffff; /* #### #### #### #### */
X ufo[10] = 0xffff; /* #### #### #### #### */
X ufo[12] = 0xffff; /* #### #### #### #### */
X ufo[14] = 0xffff; /* #### #### #### #### */
X ufo[16] = 0x0f0f; /* ---- #### ---- #### */
X ufo[18] = 0x0f0f; /* ---- #### ---- #### */
X ufo[20] = 0x0f0f; /* ---- #### ---- #### */
X ufo[22] = 0x0f0f; /* ---- #### ---- #### */
X ufo[24] = 0xffff; /* #### #### #### #### */
X ufo[26] = 0xffff; /* #### #### #### #### */
X ufo[28] = 0xffff; /* #### #### #### #### */
X ufo[30] = 0xffff; /* #### #### #### #### */
X ufo[32] = 0xfffe; /* #### #### #### ###- */
X ufo[34] = 0xfffc; /* #### #### #### ##-- */
X ufo[36] = 0xfff8; /* #### #### #### #--- */
X ufo[38] = 0xfff0; /* #### #### #### ---- */
X ufo[40] = 0x0000; /* ---- ---- ---- ---- */
X ufo[42] = 0x0000; /* ---- ---- ---- ---- */
X ufo[44] = 0x0000; /* ---- ---- ---- ---- */
X ufo[46] = 0x0000; /* ---- ---- ---- ---- */
X
X ufo[1] = 0x00ff; /* ---- ---- #### #### */
X ufo[3] = 0x01ff; /* ---- ---# #### #### */
X ufo[5] = 0x03ff; /* ---- --## #### #### */
X ufo[7] = 0x07ff; /* ---- -### #### #### */
X ufo[9] = 0x0fff; /* ---- #### #### #### */
X ufo[11] = 0x0fff; /* ---- #### #### #### */
X ufo[13] = 0x0fff; /* ---- #### #### #### */
X ufo[15] = 0x0fff; /* ---- #### #### #### */
X ufo[17] = 0x0f0f; /* ---- #### ---- #### */
X ufo[19] = 0x0f0f; /* ---- #### ---- #### */
X ufo[21] = 0x0f0f; /* ---- #### ---- #### */
X ufo[23] = 0x0f0f; /* ---- #### ---- #### */
X ufo[25] = 0x0fff; /* ---- #### #### #### */
X ufo[27] = 0x0fff; /* ---- #### #### #### */
X ufo[29] = 0x0fff; /* ---- #### #### #### */
X ufo[31] = 0x0fff; /* ---- #### #### #### */
X ufo[33] = 0x07ff; /* ---- -### #### #### */
X ufo[35] = 0x03ff; /* ---- --## #### #### */
X ufo[37] = 0x01ff; /* ---- ---# #### #### */
X ufo[39] = 0x00ff; /* ---- ---- #### #### */
X ufo[41] = 0x0000; /* ---- ---- ---- ---- */
X ufo[43] = 0x0000; /* ---- ---- ---- ---- */
X ufo[45] = 0x0000; /* ---- ---- ---- ---- */
X ufo[47] = 0x0000; /* ---- ---- ---- ---- */
X
X /* define shot */
X
X shot[1] = shot[2] = shot[3] = shot[4] = 0x0007;
X shot[5] = shot[6] = shot[7] = shot[8] = 0x0007;
X shot[9] = shot[10] = shot[11] = shot[12] = 0x0007;
X shot[13] = shot[14] = shot[15] = shot[0] = 0x0007;
X
X /* define explosion */
X
X bang[0] = bang[2] = bang[4] = bang[6] = 0xffff;
X bang[1] = bang[3] = bang[5] = bang[7] = 0xffff;
X bang[8] = bang[10] = bang[12] = bang[14] = 0xffff;
X bang[9] = bang[11] = bang[13] = bang[15] = 0xffff;
X bang[16] = bang[18] = bang[20] = bang[22] = 0xffff;
X bang[17] = bang[19] = bang[21] = bang[23] = 0xffff;
X bang[24] = bang[26] = bang[28] = bang[30] = 0xffff;
X bang[25] = bang[27] = bang[29] = bang[31] = 0xffff;
X bang[32] = bang[34] = bang[36] = bang[38] = 0xffff;
X bang[33] = bang[35] = bang[37] = bang[39] = 0xffff;
X bang[40] = bang[42] = bang[44] = bang[46] = 0xffff;
X bang[41] = bang[43] = bang[45] = bang[47] = 0xffff;
X}
END_OF_FILE
if test 16148 -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'\" \(616 characters\)
sed "s/^X//" >'stars.c' <<'END_OF_FILE'
X#include "bugs.h"
X
X#define WIDTH SCREEN_WIDTH / 8
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," Bugs, 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 616 -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'\" \(1405 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\**********************************************************/
X
X#include "bugs.h"
X#include <sys/font.h>
X
void wininit()
X{
X struct umdata um;
X struct icon myicon;
X int wid, i;
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, "Bugs" );
X wprintf( wn, "\033[=1C" );
X noecho();
X stars();
X clear();
X nodelay( 0,1 );
X wprompt( wn, "score : 0" );
X ioctl( wid, WIOCGETMOUSE, &um );
X um.um_flags = MSDOWN|MSUP;
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 um.um_icon = &myicon;
X ioctl( wid, WIOCSETMOUSE, &um );
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 wexit( 0 );
X}
END_OF_FILE
if test 1405 -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 Comp.sys.att
mailing list