/**********************************************************\ * Rocks : a bit-mapped arcade game for the AT&T UNIX PC. * * * * By : Hans Jespersen * * * * R.R.1 * * Terra Cotta, Ontario * * L0P 1N0 * * * \**********************************************************/ #include #include #include #include #include #include /* * Things you may want to modify */ #define SCORE_FILE "/usr/games/lib/rocks.hs" /* Highscore file */ #define FIRSTLEVEL 4 /* Default number of rocks on first level */ #define MAXROCKS 100 #define MAXTHRUST 8 /* Maximum speed of ship in pixels */ #define MAXSHOTS 10 /* Maximum number of shots at once */ #define RANGE 20 /* Range of shots in SHOTINC */ #define SHOTINC 8 /* Number of pixels to move shots */ /* Define which keys do what */ #define SHOOT 'a' #define BEEP 'b' #define LEFTKEY 'k' #define RIGHTKEY 'l' #define QUIT 'q' #ifdef MOUSE # define THRUST 't' /* use middle button of mouse instead */ # define HYPERSPACE ' ' #else # define THRUST ' ' # define HYPERSPACE 'j' #endif /* * Things you won't want to modify */ #define SCREEN_WIDTH 720 #define SCREEN_HEIGHT 300 #define WIDTH SCREEN_WIDTH / 8 #define LARGE_ROCK_WIDTH 64 #define LARGE_ROCK_HEIGHT 48 #define MEDIUM_ROCK_WIDTH 32 #define MEDIUM_ROCK_HEIGHT 24 #define SMALL_ROCK_WIDTH 16 #define SMALL_ROCK_HEIGHT 12 #define SHIP_WIDTH 16 #define SHIP_HEIGHT 16 #define SHOT_WIDTH 16 #define SHOT_HEIGHT 16 #define SPACE_HEIGHT SCREEN_HEIGHT + LARGE_ROCK_HEIGHT #define SIZE SCREEN_WIDTH * SPACE_HEIGHT / 16 #define TRUE 1 #define FALSE 0 #define RIGHT 1 #define LEFT -1 #define LARGE 2 #define MEDIUM 1 #define SMALL 0 extern unsigned short rockwidth[3]; extern unsigned short rockheight[3]; extern unsigned short patwhite[]; extern unsigned short patgray[]; extern unsigned short patltgray[]; extern unsigned short patblack[]; 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 ]; typedef struct position{ int x; int y; int xdelta; int ydelta; int size; } position; position rocklist[ MAXROCKS ]; position myship; position debrislist[ 3 ]; position shotlist[ MAXSHOTS ]; /* define globals */ int wn; int nrocks; int nshots; int beepflag; int quitflag; int score; int men; int level; int direction;