[comp.sources.games] v01i092: Asteroids for the Sun, Part01/02

games-request@basser.cs.su.oz.AU (07/16/87)

Submitted by: Rich Burridge <richb@sunk.oz.AU>
Comp.sources.games: Volume 1, Issue 92
Archive-name: asteroids/Part01



This is for SunOS v3.2 or later.  See the README for all the gory
details.  Due to the inherent design, this will still not work on a
color Sun, or on a monochrome screen in reverse video.  Someday, when I
get a moment, I'll sit down and fix that. 

    Rich.

Rich Burridge,            JANET richb%sunk.oz@uk.ac.ucl.cs
ACSnet  richb@sunk.oz     UUCP {seismo,hplabs,ukc}!munnari!sunk.oz!richb
PHONE: +61 3 811 9927     ARPAnet richb%sunk.oz@seismo.css.gov
MAIL: Sun Microsystems, 123 Camberwell Rd, Hawthorn, VICTORIA 3122, AUST


#! /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 2)."
# Contents:  Makefile README ast_stuff.c ast_sun.c asteroids.h
#   asteroids.help asteroids.hs asteroids.icon bltstuff.h main.cursor
# Wrapped by richb@sunk on Fri May 29 16:20:54 1987
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f Makefile -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"Makefile\"
else
echo shar: Extracting \"Makefile\" \(1061 characters\)
sed "s/^X//" >Makefile <<'END_OF_Makefile'
X#
X#  Makefile for the asteroids game.
X#  Written by Rich Burridge - Sun Microsystems Australia (Melbourne).
X#
X#  Version 3.0.  -  April 1987.
X#
X#  No responsibility is taken for any errors inherent either in the comments
X#  or the code of this program, but if reported to me then an attempt will
X#  be made to fix them.
X#
XBINARIES        = asteroids
XBINDIR          = .
XCFLAGS          = -g
XLDFLAGS         = -g
XOBJS            = ast_main.o ast_stuff.o ast_sun.o
XSRCS            = ast_main.c ast_stuff.c ast_sun.c
XLIBS            = -lsuntool -lsunwindow -lpixrect
XHDRS            = asteroids.h bltstuff.h
X#
X#  The following commands are declared:
X#
Xall:            $(BINARIES)
X
Xbackup:
X		cp ast_main.c ast_main.c~
X		cp ast_stuff.c ast_stuff.c~
X		cp ast_sun.c ast_sun.c~
X		cp asteroids.h asteroids.h~
X
Xlint:
X		lint $(SRCS) $(LIBS)
X
Xclean:
X		rm -f *.o core
X#
X#  General Makefile stuff.
X#
Xasteroids:      $(OBJS)
X		cc $(LDFLAGS) -o asteroids $(OBJS) $(LIBS)
X
Xast_main.o:     ast_main.c $(HDRS)
Xast_stuff.o:    ast_stuff.c $(HDRS)
Xast_sun.o:      ast_sun.c $(HDRS)
END_OF_Makefile
if test 1061 -ne `wc -c <Makefile`; then
    echo shar: \"Makefile\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f README -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"README\"
else
echo shar: Extracting \"README\" \(1581 characters\)
sed "s/^X//" >README <<'END_OF_README'
X
X        ASTEROIDS V3.0.
X        ---------------
X
XThis is the next major release of the games of Asteroids for the
XSun, and it is a rework of the program, to operate under SunView.
XThere are no design changes, these will probably be added in the
Xnext release which will be rewritten in NeWS (in about six months
Xtime).
X
XThis is the game of Asteroids for the Sun. The original version was
Xwritten in Pascal on an ICL Perq, by persons unknown, somewhere in
Xthe North of England in 1982. This version is based on the conversion
Xof that program to C by Brian Rippon and Graham Underwood for the
XICL Perq PNX O/S in 1983.
X
XThis should work on a Sun 2, but I didn't have one, so perhaps
Xsomeone can let me know what changes if any were needed.
X
XIMPORTANT NOTE: This game currently will not work correctly on a
Xcolor Sun. Hopefully this will be fixed in a future release.
X
XJust type "asteroids", to start the game.
X
XThere are three command line switches:
X
X-h         - Don't display the initial help message.
X-xnnn      - Initial width of the asteroids window (default 768).
X-ynnn      - Initial height of the asteroids window (default 900).
X
XThe smaller the window the higher the bonus scores.
XThere is a minimum size asteroids window of 500 x 500.
X
XSuggestions, flames, bugs, fixes and improvements to me.
X
X    Rich.
X
XRich Burridge,            JANET richb%sunk.oz@uk.ac.ucl.cs
XACSnet  richb@sunk.oz     UUCP {seismo,hplabs,ukc}!munnari!sunk.oz!richb
XPHONE: +61 3 811 9927     ARPAnet richb%sunk.oz@seismo.css.gov
XMAIL: Sun Microsystems, 123 Camberwell Rd, Hawthorn, VICTORIA 3122, AUST
END_OF_README
if test 1581 -ne `wc -c <README`; then
    echo shar: \"README\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f ast_stuff.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"ast_stuff.c\"
else
echo shar: Extracting \"ast_stuff.c\" \(7839 characters\)
sed "s/^X//" >ast_stuff.c <<'END_OF_ast_stuff.c'
X 
X/*  ast_stuff.c
X *
X *  Various functions and procedures used by the asteroids game.
X *  Written by Rich Burridge - SUN Microsystems Australia (Melbourne).
X *
X *  Version 3.0.  -  April 1987.
X *
X *  No responsibility is taken for any errors inherent either to the code
X *  or the comments of this program, but if reported to me then an attempt
X *  will be made to fix them.
X */
X
X#include <stdio.h>
X#include <strings.h>
X#include "bltstuff.h"
X#include "asteroids.h"
X#include <sys/types.h>
X#include <sys/timeb.h>
X#include <suntool/sunview.h>
X#include <suntool/canvas.h>
X
Xextern Pixfont *pf ;
Xextern Pixwin *pw ;
X
X/* For descriptions of these external variables, see ast_main.c */
X
Xextern char bonusstr[MAXLINE],new_key_vals[3][MAXLINE] ;
Xextern char old_key_vals[3][MAXLINE],path[MAXLINE],progname[MAXLINE] ;
Xextern char titlestring[MAXLINE],thisscore[MAXLINE] ;
X
Xextern struct hscore highscore[MAXHS] ;
Xextern struct timeb tstartflash,tlastflash ;
X
Xextern int basecount,bonusship,bonusshown,c,csi,csj,flashbonus,fuel ;
Xextern int fuellength,fuelmaxlength,fuelxoffset,givehelp,height ;
Xextern int key_stations[3],orgx,orgy,progstate,rr,score,scorei,scorethistank ;
Xextern int sfunc,width ;
X
X
Xaddscore(s)       /* Add up current total score. */
Xint s ;
X
X{
X  int s10 ;
X 
X  s10 = s*10 ;
X  score += s10 ;
X  scorethistank += s10 ;
X 
X  if (score > bonusship)
X    {
X      SPRINTF(bonusstr," ** Bonus Spaceship **    ") ;
X      startflashbonus() ;
X      basecount += 1 ;
X      bonusship *= 2 ;   /* double it. */
X    }
X  SPRINTF(titlestring," Score : %6d                Ships : %6d  ",score,basecount) ;
X  showtitle() ;
X}
X 
X 
Xclear_screen()
X
X{
X  BLT_SCRN(orgx,orgy,width,height,RCLR) ;
X}
X
X
Xdo_help_screen()
X 
X{
X  int x,y ;
X  int length = 0 ;         /* Length of longest help line. */
X  int nolines = 0 ;        /* Number of lines in help file. */
X  char line[MAXLINE] ;     /* Current line read from help file. */
X  FILE *tf ;               /* File descripter for help file. */
X  int texty = 20 ;         /* Initial y coordinate for help message. */
X  char helpname[MAXLINE] ; /* Full help file pathname. */
X 
X  SPRINTF(helpname,"%s%s",path,HELPNAME) ;
X  if ((tf = fopen(helpname,"r")) == NULL)
X    {
X      FPRINTF(stderr,"%s: can't open %s for help information.\n",
X              progname,helpname) ;
X      return ;
X    }
X  while (fgets(line,MAXLINE,tf) != NULL)
X    {
X      if (strlen(line) > length) length = strlen(line) ;
X      nolines++ ;
X    }
X  FCLOSE(tf) ;
X
X  x = (width - length*FONT_WIDTH - 20) / 2 ;
X  y = (height - nolines*15+texty) / 2 ;
X  draw_frame(x,y,length*FONT_WIDTH+20,nolines*15+texty) ;
X
X  tf = fopen(helpname,"r") ;
X  while (fgets(line,MAXLINE,tf) != NULL)
X    {
X      line[strlen(line)-1] = '\0' ;
X      SCHRFUNC(PIX_SRC) ;
X      WRITELN(x+10,y+texty,line) ;
X      texty += 15 ;
X    }
X  FCLOSE(tf) ;
X}
X
X
Xdoflashbonus()
X
X{
X  struct timeb tnow ;
X
X  ftime(&tnow) ;
X  if (numticks(&tnow,&tlastflash) > FLICKERTIME)
X    {
X      bonusshown = !bonusshown ;   /* on off on off every second. */
X      SCHRFUNC(RXOR) ;
X      WRITELN(orgx+6,orgy+FONT_HEIGHT-2,bonusstr) ;
X      tlastflash.time = tnow.time ;
X      tlastflash.millitm = tnow.millitm ;
X    }
X 
X/* See if time out, if so stop flash */
X  if (((tnow.time - tstartflash.time) > FLASHTIME) && !bonusshown)
X    {
X      flashbonus = 0 ;
X      addscore(0) ;      /* to put score back on screen. */
X    }
X}
X 
X
Xdraw_frame(x,y,fr_width,fr_height)
Xint x,y,fr_width,fr_height ;
X
X{
X  BLT_SCRN(x,y,fr_width,fr_height,RSET) ;
X  BLT_SCRN(x+1,y+1,fr_width-2,fr_height-2,RCLR) ;
X  BLT_SCRN(x+3,y+3,fr_width-6,fr_height-6,RSET) ;
X  BLT_SCRN(x+5,y+5,fr_width-10,fr_height-10,RCLR) ;
X}
X
X
Xfunction_keys(state)        /*  Set or reset the function keys. */
Xint state ;
X
X{
X  int count = 176 ;         /* 0xB0 -- the starting entry for strings. */
X  int fd,i ;
X
X  if ((fd = open("/dev/kbd",0,0)) < 0)
X    {
X      FPRINTF(stderr,"sidtool: can't open /dev/kbd\n") ;
X      exit(1) ;
X    }
X  for (i = 0; i < 3; i++)      /* Set up function keys. */
X    {
X      if (state == KEY_SET)
X        {
X          get_key(fd,key_stations[i],old_key_vals[i],count) ;
X          set_key(fd,key_stations[i],new_key_vals[i],count++) ;
X        }
X      else set_key(fd,key_stations[i],old_key_vals[i],count++) ;
X    }
X  CLOSE(fd) ;
X}
X
X
Xgetnewscore(x,y)      /* Get new user name for highscore. */
Xint x,y ;
X
X{
X  if (c)
X    {   
X      switch (c)
X        {
X          case BSPACE :
X          case DEL    : if (scorei)
X                          {
X                            scorei-- ;
X                            thisscore[scorei] = ' ' ;
X                            thisscore[scorei+1] = '\0' ;
X                            WRITELN(x,y,thisscore) ;
X                            thisscore[scorei] = '\0' ;
X                          }
X                        break ;
X          case CR     : thisscore[scorei] = '\0' ;
X                        if (!scorei) WRITELN(100,220,"   ** No name given. **") ;
X                        else
X                          { 
X                            csj = MAXHS - 1 ;
X                            while (--csj >= csi)
X                              {
X                                highscore[csj+1].score = highscore[csj].score ;
X                                STRCPY(highscore[csj+1].who,highscore[csj].who) ;
X                              } 
X                            highscore[csi].score = score ;
X                            STRCPY(highscore[csi].who,thisscore) ;
X                            puthighscore() ;
X                            progstate = DOEND ;
X                          }
X                        break ;
X          default     : if (c < ' ') break ;
X                        thisscore[scorei++] = c ;
X                        thisscore[scorei] = '\0' ;
X                        WRITELN(x,y,thisscore) ;
X        }
X      c = 0 ;
X    }
X}
X 
X 
Xget_options(argc,argv)
Xint argc ;
Xchar *argv[] ;
X
X{
X  char *arg ;
X  char *p ;      /* Pointer to string following argument flag. */
X
X  STRCPY(path,progname) ;         /* Extract full path name for asteroid files. */
X  if ((arg = rindex(path,'/')) == NULL) path[0] = '\0' ;
X  else *(++arg) = '\0' ;
X  STRCPY(titlestring,"  Asteroids  V3.0.              Rich Burridge.") ;
X
X  orgx = 0 ;
X  orgy = 0 ;
X  width = SWIDTH ;
X  height = SHEIGHT ;
X  givehelp = 1 ;
X  while (argc > 1 && (arg = argv[1])[0] == '-')
X    {
X      p = arg + 2 ;
X      switch (arg[1])
X        {
X          case 'h' : givehelp = 0 ;        /* Don't display help message. */
X                     break ;
X          case 'x' : width = atoi(p) ;     /* Width of asteroids window. */
X                     if (width < 500) width = 500 ;
X                     break ;
X          case 'y' : height = atoi(p) ;    /* Height of asteroids window. */
X                     if (height < 500) height = 500 ;
X                     break ;
X        }
X      argc-- ;
X      argv++ ;
X    }
X}
X
X
Xrint(r)
Xint r ;
X 
X{
X  rr = ((rr*4705 + 1) & 32767) ;
X  if (!r) r = 1 ;
X  return(rr % r) ;
X}
X
X
Xshowfuel()         /* Show how much fuel is left. */
X
X{
X  int howmuch ;
X
X  howmuch = (int)(fuelmaxlength * ((double)fuel / (double)FULLTANK)) ;
X  if (howmuch != fuellength)
X    {
X      BLT_SCRN(fuelxoffset,height-FONT_HEIGHT,fuelmaxlength,FONT_HEIGHT-2,RCLR) ;
X      fuellength = howmuch ;
X      BLT_SCRN(fuelxoffset,height-FONT_HEIGHT,fuellength,FONT_HEIGHT-2,RXNOR) ;
X    }
X}
X
X
Xshowtitle()      /* Display titlestring or bonus message. */
X
X{
X  if (!flashbonus)
X    {
X      SCHRFUNC(RRPL) ;
X      WRITELN(orgx+6,orgy+FONT_HEIGHT-2,titlestring) ;
X    }
X}
X
X
Xstartflashbonus()   /* start bonus flashing. */
X
X{
X  flashbonus = 1 ;
X  bonusshown = 1 ;
X  SCHRFUNC(RRPL) ;
X  WRITELN(orgx+6,orgy+FONT_HEIGHT-2,bonusstr) ;  /* Don't XOR the first one. */
X  ftime(&tstartflash) ;                          /* Get the time start. */
X  tlastflash.time = tstartflash.time ;
X  tlastflash.millitm = tstartflash.millitm ;
X}
END_OF_ast_stuff.c
if test 7839 -ne `wc -c <ast_stuff.c`; then
    echo shar: \"ast_stuff.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f ast_sun.c -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"ast_sun.c\"
else
echo shar: Extracting \"ast_sun.c\" \(2293 characters\)
sed "s/^X//" >ast_sun.c <<'END_OF_ast_sun.c'
X 
X/*  ast_sun.c
X *
X *  SUN dependent functions and procedures used by the asteroids game.
X *  Written by Rich Burridge - SUN Microsystems Australia (Melbourne).
X *
X *  Version 3.0.  -  April 1987.
X *
X *  No responsibility is taken for any errors inherent either to the code
X *  or the comments of this program, but if reported to me then an attempt
X *  will be made to fix them.
X */
X
X#include <stdio.h>
X#include <strings.h>
X#include <sundev/kbd.h>
X#include <sys/ioctl.h>
X#include <sys/types.h>
X#include <sundev/kbio.h>
X#include "bltstuff.h"
X#include "asteroids.h"
X#include <sys/timeb.h>
X#include <suntool/sunview.h>
X#include <suntool/canvas.h>
X 
XCursor nullcur,syscur ;          /* Asteroids cursors. */
XPixfont *pf ;
X
Xextern Canvas canvas ;
Xextern Pixwin *pw ;
X
Xshort nullcur_data[] = {
X  0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0, 0, 0, 0, 0, 0
X} ;
Xmpr_static(nullcur_pr,16,16,1,nullcur_data) ;
X
Xshort syscur_data[] = {
X#include "main.cursor"
X} ;
Xmpr_static(syscur_pr,16,16,1,syscur_data) ;
X
Xint sfunc ;
X 
X
Xget_key(fd,station,value,count)
Xint fd,station,count ;
Xchar value[MAXLINE] ;
X
X{
X  struct kiockey key ;
X
X  key.kio_tablemask = 0 ;
X  key.kio_entry = count ;
X  key.kio_station = station ;
X  IOCTL(fd,(int) KIOCGETKEY,(char *) &key) ;
X  STRCPY(value,key.kio_string) ;
X}
X
X
Xiocursormode(m)               /* Set the current cursor display mode. */
Xint m ;
X
X{
X  switch (m)
X    {
X      case OFFCURSOR   : nullcur = window_get(canvas,WIN_CURSOR) ;
X                         cursor_set(nullcur,CURSOR_IMAGE,&nullcur_pr,0) ;
X                         window_set(canvas,WIN_CURSOR,nullcur,0) ;
X                         break ;
X      case TRACKCURSOR : syscur = window_get(canvas,WIN_CURSOR) ;
X                         cursor_set(syscur,CURSOR_IMAGE,&syscur_pr,0) ;
X                         cursor_set(syscur,CURSOR_OP,PIX_SRC ^ PIX_DST,0) ;
X                         window_set(canvas,WIN_CURSOR,syscur,0) ;
X    }
X}
X
X
Xset_key(fd,station,value,count)
Xint fd,station,count ;
Xchar value[MAXLINE] ;
X
X{
X  struct kiockey key ;
X
X  key.kio_tablemask = 0 ;
X  key.kio_entry = count ;
X  key.kio_station = station ;
X  STRCPY(key.kio_string,value) ;
X  IOCTL(fd,(int) KIOCSETKEY,(char *) &key) ;
X}
X
X
Xwrite_bold(x,y,text)
Xint x,y ;
Xchar text[MAXLINE] ;
X
X{
X  pw_text(pw,x,y,ROR,pf,text) ;
X  pw_text(pw,x+1,y,ROR,pf,text) ;
X}
END_OF_ast_sun.c
if test 2293 -ne `wc -c <ast_sun.c`; then
    echo shar: \"ast_sun.c\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f asteroids.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"asteroids.h\"
else
echo shar: Extracting \"asteroids.h\" \(4265 characters\)
sed "s/^X//" >asteroids.h <<'END_OF_asteroids.h'
X 
X/*  asteroids.h
X *
X *  Definitions used by the asteroids game.
X *  Written by Rich Burridge - SUN Microsystems Australia (Melbourne).
X *
X *  Version 3.0.  -  April 1987.
X *
X *  No responsibility is taken for any errors inherent either to the code
X *  or the comments of this program, but if reported to me then an attempt
X *  will be made to fix them.
X */
X
Xextern char *sprintf() ;
X
X#define  CLOSE        (void) close       /* To make lint happy. */
X#define  FCLOSE       (void) fclose
X#define  FCNTL        (void) fcntl
X#define  FPRINTF      (void) fprintf
X#define  IOCTL        (void) ioctl
X#define  NICE         (void) nice
X#define  PRINTF       (void) printf
X#define  READ         (void) read
X#define  SCANF        (void) scanf
X#define  SPRINTF      (void) sprintf
X#define  STRCPY       (void) strcpy
X#define  WRITE        (void) write
X
X#define  BYTESPERWORD  2
X#define  BHEIGHT       15
X#define  BSIZE         2*BHEIGHT+1
X
X/*
X *   Macros to test and set bits.
X *   i,j are the x,y offsets from pointer.
X *   scan is the scan length of the area pointed at.
X */
X 
X#define SETON(i,j,scan,ptr)  (*(ptr+(scan*(j))+(i)/16) |= (1 << (017 - ((i) & 017))))
X#define SETOFF(i,j,scan,ptr) (*(ptr+(scan*(j))+(i)/16) &= ~(1 << (017 - ((i) & 017))))
X#define BITSET(i,j,scan,ptr) \
X              (((*(ptr+(scan*(j))+(i)/16)) &(1 << (017 - ((i) & 017)))) ? (1):(0))
X 
X#define  BIDLE     0
X#define  BWAITING  1
X#define  BACTIVE   2
X#define  BDYING    3
X 
X#define  MAXHS     5      /* Max records held in high score file. */
X#define  AFACTOR   120
X#define  BFACTOR   256
X#define  REFUEL    6000   /* fill up tanks every REFUEL points scored per ship */
X 
X#define  MAXDIFF   15000
X#define  MAXLINE      80      /* Maximum string length. */
X
X#ifndef  CTRLQ
X#define  CTRLQ        17      /* Used to restart the asteroids game. */
X#endif
X#ifndef  CTRLS
X#define  CTRLS        19      /* Used to halt the asteroids game. */
X#endif
X
X/* Definitions for asteroid keys. */
X#define  K_QUIT       'q'     /* Quit the asteroids game. */
X#define  K_GO         'g'     /* Turn the rocket motor on. */
X#define  K_STOP       's'     /* Turn the rocket motor off. */
X#define  K_TELEPORT   't'     /* Jump through hyperspace. */
X
X/* Key definitions used by getnewscore. */
X#define  BSPACE       8       /* Backspace. */
X#define  CR           13      /* Carriage Return. */
X#define  DEL          127     /* Delete. */
X
X#define  FLASHTIME    4       /* Seconds */
X#define  FLICKERTIME  20      /* Jiffies */
X#define  FONT_HEIGHT  16      /* Height of font within asteroids. */
X#define  FONT_WIDTH   8       /* Width of standard character font. */
X#define  FULLTANK     50000   /* Full fuel tanks */
X#define  HELPNAME     "asteroids.help"     /* Name of the initial help file. */
X#define  RETURN       13      /* Certain useful ASCII constants. */
X
X#define  OFFCURSOR    0       /* Modes for the mouse cursor. */
X#define  TRACKCURSOR  1
X
X#define  KEY_SET      0       /* Used for function key setup. */
X#define  KEY_RESET    1
X
X/* States for the asteroids automation. */
X#define  HELP         0       /* Display initial help screen. */
X#define  GETRET       1       /* Wait for user to press return. */
X#define  STARTUP      2       /* Perform initialisation. */
X#define  UPDATE       3       /* Main loop  to update screen. */
X#define  EXPIRED      4       /* Player is dead. Terminate gracefully. */
X#define  NEXTLINE     5       /* Get new username for highscore. */
X#define  DOEND        6       /* Finally show highscores and end. */
X#define  SCORE        7       /* Get RETURN after highscores. */
X#define  CTRLSHIT     8       /* ^S has been hit, do nothing until ^Q. */
X
X/* Asteroid event values. */
X#define  LEFTUP       1       /* Left mouse button up. */
X#define  LEFTDOWN     2       /* Left mouse button down. */
X#define  BUTMIDDLE    3       /* Middle mouse button. */
X#define  RIGHTUP      4       /* Right mouse button up. */
X#define  RIGHTDOWN    5       /* Right mouse button down. */
X
X#define  SWIDTH     768       /* Maximum screen width. */
X#define  SHEIGHT    900       /* Maximum screen height. */
X
X/* Set the function to be used for characters. */
X#define  SCHRFUNC(f)  (sfunc = f)
X
Xstruct hscore
X         {
X           char who[MAXLINE] ;
X           int score ;
X         } ;
END_OF_asteroids.h
if test 4265 -ne `wc -c <asteroids.h`; then
    echo shar: \"asteroids.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f asteroids.help -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"asteroids.help\"
else
echo shar: Extracting \"asteroids.help\" \(1225 characters\)
sed "s/^X//" >asteroids.help <<'END_OF_asteroids.help'
X            WELCOME TO THE GAME OF ASTEROIDS.
X
XThe object of the game, is to destroy the asteroids before
Xthey destroy you.
X
XYou control the spaceship which initially starts in the
Xcentre of the window.
X
XHolding down the LEFT button of the mouse rotates the
Xspaceship anticlockwise.
XHolding down the RIGHT button of the mouse rotates the
Xspaceship clockwise.
XPressing the MIDDLE button will fire a missile out of the
Xfront of the spaceship.
X
XYou can enter hyperspace by pressing the 't' or the R3 function
Xkey. This will return you to the screen in a random position.
X
XYou can turn your rocket motors on with 'g' or the R1 function
Xkey. Pressing 's' or the R2 function key will turn your rocket
Xmotors off.
X
XTo quit the game at any time, just press the q key.
X
XRotating the shapeship, moving or entering hyperspace uses up fuel.
XRunning out of fuel will eventually render you helpless.
X
XFuel tanks are refilled every 6000 points scored per spaceship,
Xand for each new spaceship.
X
XYou get a new spaceship every 10000 points. There are bonus
Xpoints for each set of asteroids you destroy. Also the smaller
Xyour window, the more bonus you get.
X
XYou have three spaceships to start with. Good luck!!
X
XHit RETURN to start the game.
END_OF_asteroids.help
if test 1225 -ne `wc -c <asteroids.help`; then
    echo shar: \"asteroids.help\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f asteroids.hs -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"asteroids.hs\"
else
echo shar: Extracting \"asteroids.hs\" \(0 character\)
sed "s/^X//" >asteroids.hs <<'END_OF_asteroids.hs'
END_OF_asteroids.hs
if test 0 -ne `wc -c <asteroids.hs`; then
    echo shar: \"asteroids.hs\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f asteroids.icon -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"asteroids.icon\"
else
echo shar: Extracting \"asteroids.icon\" \(1933 characters\)
sed "s/^X//" >asteroids.icon <<'END_OF_asteroids.icon'
X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
X */
X	0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8000,0x0000,0x0000,0x0001,
X	0xBFFF,0xFFFF,0xFFFF,0xFFFD,0xBFFF,0xFFFF,0xFFFF,0xFFFD,
X	0xBFFF,0xFFFF,0xFFFF,0xFFFD,0xBFFF,0xFFFF,0xFFFF,0xFFFD,
X	0xBFFF,0xFFFF,0xFFFF,0xFFFD,0xBFFF,0xFF7F,0xFEFF,0xFFFD,
X	0xBFFF,0xFE3F,0xFC7F,0xFF3D,0xBFFF,0xFF7F,0xFEFF,0xFF3D,
X	0xB3FF,0xFFBF,0xFDFF,0xFFFD,0xB3FF,0xFFDF,0xFBFF,0xFFFD,
X	0xBFFF,0xFFDF,0xFBFF,0xFF3D,0xBFFF,0xFFEF,0xF7FF,0xFF3D,
X	0xBFFF,0xFFEF,0xF7FF,0xFFFD,0xBFFF,0xFFF7,0xEFFF,0xFFFD,
X	0xBFFF,0xFFC0,0x03FF,0xFFFD,0xBFFF,0xFF80,0x01FF,0xFFFD,
X	0xBFFF,0xFF8F,0xF1FF,0xFFFD,0xBFFF,0xFF1F,0xF8FF,0xFFFD,
X	0xBFFF,0xFF1F,0xF8FF,0xFFFD,0xBFFF,0xFE3F,0xFC7F,0xFFCD,
X	0xBFFF,0xFE3F,0xFC7F,0xFFCD,0xBFFF,0x0000,0x0000,0xFFFD,
X	0xB3FF,0x0000,0x0000,0xFFFD,0xB3FF,0x0000,0x0000,0xFFFD,
X	0xBFFF,0xC7FF,0xFFE3,0xFFFD,0xBFFF,0xE3FF,0xFFC7,0xFFFD,
X	0xBFFF,0xE3FF,0xFFC7,0xFFFD,0xBFFF,0xF1FF,0xFF8F,0xFFFD,
X	0xBFFF,0xF1FF,0xFF8F,0xFFFD,0xBFFF,0xF8FF,0xFF1F,0xFFFD,
X	0xBFFF,0xF8FF,0xFF1F,0xFFFD,0xBFFF,0xFC7F,0xFE3F,0xFFFD,
X	0xBFFF,0xFC7F,0xFE3F,0xFFFD,0xBFFF,0xFE3F,0xFC7F,0xFFFD,
X	0xBFFF,0xFE3F,0xFC7F,0xFFFD,0xBFFF,0xFF1F,0xF8FF,0xFFFD,
X	0xBFFF,0xFF00,0x00FF,0xFFFD,0xBFFF,0xFF00,0x00FF,0xFFFD,
X	0xBFFF,0xFF80,0x01FF,0xFFFD,0xBFFF,0xFFFF,0xFFFF,0xF9FD,
X	0xBFCF,0xFFFF,0xFFFF,0xF9FD,0xBFCF,0xFFFF,0xFFFF,0xFFFD,
X	0xBFFF,0xFFFF,0xFFFF,0xFFFD,0xBFFF,0xFFFF,0xFFFF,0xFFFD,
X	0xBFFF,0xFFFF,0xFFFF,0xFFFD,0xBFFF,0xFFFF,0xFFFF,0xFFFD,
X	0xBFFF,0xFFFF,0xFFFF,0xFFFD,0xBFFF,0xFFFF,0xFFFF,0xFFFD,
X	0xBFFF,0xFFFF,0xFFFF,0xFFFD,0xBFFF,0xFFFF,0xFF3F,0xFFFD,
X	0xBFF9,0xFFFF,0xFF3F,0xFFFD,0xBFF9,0xFFFF,0xFFFF,0xFFFD,
X	0xBFFF,0xFFFF,0xFFFF,0xF9FD,0xBFFF,0xFFFF,0xFFFF,0xF9FD,
X	0xBFFF,0xFFFF,0xFFFF,0xFFFD,0xBFFF,0xFFFF,0xFFFF,0xFFFD,
X	0xBFFF,0xFFFF,0xF9FF,0xFFFD,0xBFFF,0xFFFF,0xF9FF,0xFFFD,
X	0xBFFF,0xFFFF,0xFFFF,0xFFFD,0xBFFF,0xFFFF,0xFFFF,0xFFFD,
X	0x8000,0x0000,0x0000,0x0001,0xFFFF,0xFFFF,0xFFFF,0xFFFF
END_OF_asteroids.icon
if test 1933 -ne `wc -c <asteroids.icon`; then
    echo shar: \"asteroids.icon\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f bltstuff.h -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"bltstuff.h\"
else
echo shar: Extracting \"bltstuff.h\" \(1606 characters\)
sed "s/^X//" >bltstuff.h <<'END_OF_bltstuff.h'
X
X/*  bltstuff.h
X *
X *  RasterOp definitions used by the Asteroids program.
X *  Written by Rich Burridge - SUN Microsystems Australia (Melbourne).
X *
X *  Version 3.0.  -  April 1987.
X *
X *  No responsibility is taken for any errors inherent either to the code
X *  or the comments of this program, but if reported to me then an attempt
X *  will be made to fix them.
X */
X
X#define  RRPL           PIX_SRC                  /* RASTEROP codes. */
X#define  ROR            PIX_SRC | PIX_DST
X#define  RXOR           PIX_SRC ^ PIX_DST
X#define  RCLR           PIX_CLR
X#define  RSET           PIX_SET
X#define  RINV           PIX_NOT(PIX_DST)
X#define  RXNOR          PIX_SRC ^ PIX_NOT(PIX_DST)
X
X/* Machine independent rasterop calls. */
X
X/* Manipulate a portion of the screen with itself. */
X#define  BLT_SCRN(sx,sy,w,h,op) \
X         (pw_writebackground(pw,sx,sy,w,h,op))
X
X/* Move a screen raster to an offscreen area. */
X#define  BLT_SCRN_TO_MEM(mem,mx,my,w,h,op,sx,sy) \
X         (pw_read(mem,mx,my,w,h,op,pw,sx,sy))
X
X/* Move an offscreen raster area to the screen. */
X#define  BLT_MEM_TO_SCRN(sx,sy,w,h,op,mem,mx,my) \
X         (pw_write(pw,sx,sy,w,h,op,mem,mx,my))
X
X/* Move an offscreen raster area to another offscreen raster area. */
X#define  BLT_MEM(mem1,mx1,my1,w,h,op,mem2,mx2,my2) \
X         ((void) pr_rop(mem1,mx1,my1,w,h,op,mem2,mx2,my2))
X
X/* Draw a line of type op,in a raster area. */
X#define  LINE(area,x1,y1,x2,y2,op) \
X         (pr_vector(area,x1,y1,x2,y2,op,1))
X
X/* Write text at x,y using rasterop function sfunc and font pf. */
X#define  WRITELN(x,y,text) \
X         (pw_text(pw,x,y,sfunc,pf,text))
END_OF_bltstuff.h
if test 1606 -ne `wc -c <bltstuff.h`; then
    echo shar: \"bltstuff.h\" unpacked with wrong size!
fi
# end of overwriting check
fi
if test -f main.cursor -a "${1}" != "-c" ; then 
  echo shar: Will not over-write existing file \"main.cursor\"
else
echo shar: Extracting \"main.cursor\" \(193 characters\)
sed "s/^X//" >main.cursor <<'END_OF_main.cursor'
X/* Format_version=1, Width=16, Height=16, Depth=1, Valid_bits_per_item=16
X */
X	0x8000,0xC000,0xE000,0xF000,0xF800,0xFC00,0xFE00,0xF000,
X	0xD800,0x9800,0x0C00,0x0C00,0x0600,0x0600,0x0300,0x0300
END_OF_main.cursor
if test 193 -ne `wc -c <main.cursor`; then
    echo shar: \"main.cursor\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 1 \(of 2\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked both 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