home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-04-28 | 34.6 KB | 1,216 lines |
- diff -cr xblockbuster1.01/CHANGES xblockbuster1.02/CHANGES
- *** xblockbuster1.01/CHANGES Sat Mar 20 03:26:53 1993
- --- xblockbuster1.02/CHANGES Fri Apr 2 20:44:44 1993
- ***************
- *** 1,3 ****
- --- 1,49 ----
- + Changes from v1.01 to v1.02
- +
- + rand and srand are now used as defaults on HP machines.
- +
- + added whitepixel and blackpixel variables. Will make changing the
- + foreground/background color easier.
- +
- + cleaned up the code a bit so that it now compiles without any warnings
- + with gcc -Wall. It does give one warning in stagemm.c, however.
- +
- + added -display command line option.
- +
- + added -playground to command line arguements. Previously,
- + -playground was implicity assumed. Now, if you want to use a different
- + playground, you must give the -playground option.
- +
- + added -geometry command line option. Only placement information is
- + used, not size information (The size XBB comes up in is pretty much
- + the mininum that can be used. A larger window just has more white
- + area around it, so isn't useful either.)
- +
- + 'q' or 'Q' now quits the game immediately, without saving.
- +
- + MotionHints can now be used. I found little difference having it
- + turned on versus old style play (if running XBB on a remote host,
- + more packets were transmitted with motionhints on than before.) Turning
- + it on may help performance on slow machines. The definition is near
- + the top of the xblockbuster.h file. (Patches by Harvey J "Max" Thompson,
- + harveyt@sco.com)
- +
- + Cleaned up the window redraw code. It should not do extra refreshes
- + as it did before, and it should now re-write the top information also.
- +
- + Fixed the horizontal shift that is used when the ball gets into an
- + infinite loop. Under the previous method, it is possible that the
- + ball would not be shifted at all in loops. Also, if the ball was
- + moving very slowly, the shift might be none. Now, the ball will be
- + moved at least a certain amount if the ball is moving slowly.
- +
- + Added -nopause command line option. If this is selected, the game will
- + continue when the pointer is moved outside the window. This feature can
- + also be toggled during the game with the 'p' key.
- +
- + Better error messages are now in place. It will now give you some
- + idea of what file it failed on.
- +
- Changes from v1.00 to v1.01
-
- Fixed the Imakefile so StageDir now works properly.
- diff -cr xblockbuster1.01/Imakefile xblockbuster1.02/Imakefile
- *** xblockbuster1.01/Imakefile Mon Mar 22 20:18:02 1993
- --- xblockbuster1.02/Imakefile Fri Apr 2 21:00:29 1993
- ***************
- *** 1,4 ****
- --- 1,9 ----
- XCOMM $XConsortium: Imakefile,v 1.9 91/07/16 23:06:01 gildea Exp $
- + /* Change BINDIR and MANDIR (uncomment them first) if you want to install
- + * XBlockBuster other than the standard BINDIR and MANDIR, as defined by
- + * X11, on your system.
- + */
- +
- /* BINDIR = /usr/games/
- */
- /* MANDIR = /usr/local/man/man6
- ***************
- *** 14,19 ****
- --- 19,25 ----
- #endif
-
- STAGEDIR = StageDir
- +
- /* If your on a system V machine, add -DSYSV to DEFINES below */
-
- DEFINES = -DSTAGEDIR=\"$(STAGEDIR)\"
- Only in xblockbuster1.01: MANIFEST.BAK
- diff -cr xblockbuster1.01/README xblockbuster1.02/README
- *** xblockbuster1.01/README Mon Mar 22 20:07:43 1993
- --- xblockbuster1.02/README Tue Mar 30 20:19:06 1993
- ***************
- *** 15,20 ****
- --- 15,24 ----
- If you are on a System V machine, -DSYSV will need to be added to the
- DEFINES variable.
-
- + If XBlockBuster is seems slow, or is using a lot of network bandwidth,
- + try defining (uncommenting) the MOTION_HINTS line near the top
- + of xblockbuster.h. (see CHANGES file for more information.)
- +
- XBlockbuster can use the same playground that Blockbuster (the sunview
- version) does. If you want to use the same playground, set
- StageDir (Imakefile) or LIBDIR (Makefile.noIm) appropriately.
- ***************
- *** 24,33 ****
- If you have already installed the stages file for xblockbuster, and
- don't want to copy over them, change InstallLib in Imakefile to No.
-
- ! The Imakefile, as distributed, should work fine (unless on System V). You
- ! may still want to edit the Imakefile to change where the files will
- ! be installed. Once you have edited the Imakefile to your satisfaction,
- ! all that is needed is:
-
- 1) xmkmf
- 2) make
- --- 28,37 ----
- If you have already installed the stages file for xblockbuster, and
- don't want to copy over them, change InstallLib in Imakefile to No.
-
- ! The Imakefile, as distributed, should work fine (unless on System V,
- ! see above). You may still want to edit the Imakefile to change where the
- ! files will be installed. Once you have edited the Imakefile to your
- ! satisfaction, all that is needed is:
-
- 1) xmkmf
- 2) make
- ***************
- *** 116,130 ****
- Fix the BUGS as listed in the man page.
-
- NOTES:
- ! As far as I know, this should run on pretty much any system that
- ! has X installed. However, I am limited to only running it on a sun 3/60,
- ! so that is all it has been tested under (X11R5).
-
- I will maintain it and release patches as required.
-
- If you send me mail, please include a valid mail address as
- part of your signature. I have gotten at least a few letters where
- ! the mail address in the header was incorrect.
-
- Mark Wedel
- master@cats.ucsc.edu
- --- 120,141 ----
- Fix the BUGS as listed in the man page.
-
- NOTES:
- ! I have personally verified it works on the following:
-
- + sun 3/60, sunos 4.1.1 (both color and black & white)
- +
- + I have gotten reports it works on the following:
- +
- + SGI with IRIS 4.0.x
- +
- +
- I will maintain it and release patches as required.
-
- If you send me mail, please include a valid mail address as
- part of your signature. I have gotten at least a few letters where
- ! the mail address in the header was incorrect. Also, please be
- ! sure to state the version you are using (this should appear
- ! in both the window header, and the file patchlevel.h)
-
- Mark Wedel
- master@cats.ucsc.edu
- Common subdirectories: xblockbuster1.01/SKELS and xblockbuster1.02/SKELS
- Common subdirectories: xblockbuster1.01/STAGES and xblockbuster1.02/STAGES
- Common subdirectories: xblockbuster1.01/STAGES.try and xblockbuster1.02/STAGES.try
- Common subdirectories: xblockbuster1.01/STAGES.wacko and xblockbuster1.02/STAGES.wacko
- diff -cr xblockbuster1.01/balls_pallet.c xblockbuster1.02/balls_pallet.c
- *** xblockbuster1.01/balls_pallet.c Fri Mar 19 02:12:30 1993
- --- xblockbuster1.02/balls_pallet.c Fri Apr 2 17:48:36 1993
- ***************
- *** 52,59 ****
- (int)( (ball)->x ) - 8, (int)( (ball)->y ) - 8, 1)
-
- /* Procedure to draw the pallet */
- ! void
- ! draw_pallet( gc )
- GC gc;
- {
- XDrawLine( display, win, gc, pallet_xI - pallet_lengthI + 2, pallet_yI,
- --- 52,58 ----
- (int)( (ball)->x ) - 8, (int)( (ball)->y ) - 8, 1)
-
- /* Procedure to draw the pallet */
- ! void draw_pallet( gc )
- GC gc;
- {
- XDrawLine( display, win, gc, pallet_xI - pallet_lengthI + 2, pallet_yI,
- ***************
- *** 85,92 ****
-
- /* Procedure to show the speeds */
- #define SX OFFSET_SPEED + 70
- ! void
- ! show_speeds( )
- {
- int sp;
-
- --- 84,90 ----
-
- /* Procedure to show the speeds */
- #define SX OFFSET_SPEED + 70
- ! void show_speeds( )
- {
- int sp;
-
- ***************
- *** 202,212 ****
- case 'U': /* because it may undo another one */
- case 'W':
- case '%':
- ! if ( !( ++loop_nhits % LOOP_MAX ) )
- ! ball->x -=
- ! ball->x_speed * ( double ) ( loop_nhits / LOOP_MAX ) + 1;
- ! /* horizontal shift, trying to get out of a bounce loop */
- ! /* negative to try to avoid leaving the stage */
- break;
- default: /* non-solid brick */
- loop_nhits = 0;
- --- 200,220 ----
- case 'U': /* because it may undo another one */
- case 'W':
- case '%':
- ! if ( !( ++loop_nhits % LOOP_MAX ) ) {
- ! double shift = ( double ) ( loop_nhits / LOOP_MAX ) + 2.0;
- !
- ! if (fabs(ball->x_speed)>1.0)
- ! ball->x -= ball->x_speed * shift;
- ! else if (ball->x_speed<0)
- ! ball->x += shift;
- ! else ball->x -= shift;
- ! }
- !
- ! /* horizontal shift, trying to get out of a bounce loop
- ! * The shift should be the opposite direction the ball
- ! * is moving, which hopefully will prevent it from leaving
- ! * the stage
- ! */
- break;
- default: /* non-solid brick */
- loop_nhits = 0;
- ***************
- *** 510,517 ****
- }
- }
-
- ! void
- ! check_deflections(old_pallet_y )
- double old_pallet_y;
- {
- if (ball1.quadrant) check_ball(&ball1,old_pallet_y);
- --- 518,524 ----
- }
- }
-
- ! void check_deflections(old_pallet_y )
- double old_pallet_y;
- {
- if (ball1.quadrant) check_ball(&ball1,old_pallet_y);
- diff -cr xblockbuster1.01/bricks.c xblockbuster1.02/bricks.c
- *** xblockbuster1.01/bricks.c Tue Nov 17 22:39:17 1992
- --- xblockbuster1.02/bricks.c Fri Apr 2 20:38:19 1993
- ***************
- *** 86,93 ****
- char option[30],*value;
-
- for (count=0; count<=NUM_BRICK_TYPES; count++) {
- ! brick_color[count].bg = WhitePixel(display, screen_num);
- ! brick_color[count].fg = BlackPixel(display, screen_num);
- }
-
-
- --- 86,93 ----
- char option[30],*value;
-
- for (count=0; count<=NUM_BRICK_TYPES; count++) {
- ! brick_color[count].bg = whitepixel;
- ! brick_color[count].fg = blackpixel;
- }
-
-
- ***************
- *** 101,107 ****
-
- cursor_pr = XCreateBitmapFromData(display,win,cursor_bits,
- cursor_width, cursor_height);
- ! exact_def.pixel = WhitePixel(display, screen_num);
- XQueryColor(display, def_cmap, &exact_def);
- cursor = XCreatePixmapCursor(display, cursor_pr, cursor_pr,
- &exact_def, &exact_def, 0, 0);
- --- 101,107 ----
-
- cursor_pr = XCreateBitmapFromData(display,win,cursor_bits,
- cursor_width, cursor_height);
- ! exact_def.pixel = whitepixel;
- XQueryColor(display, def_cmap, &exact_def);
- cursor = XCreatePixmapCursor(display, cursor_pr, cursor_pr,
- &exact_def, &exact_def, 0, 0);
- ***************
- *** 282,288 ****
- case 'X':return ( brick_X_pr );
-
- default:
- ! perror( "Illegal map code" );
- exit( 1 );
- }
- }
- --- 282,288 ----
- case 'X':return ( brick_X_pr );
-
- default:
- ! fprintf(stderr, "Illegal map code, stage %s\n",stage_name );
- exit( 1 );
- }
- }
- ***************
- *** 297,303 ****
- case '\\':return ( launchNW0_pr );
-
- default:
- ! perror( "Illegal map code" );
- exit( 1 );
- };
- }
- --- 297,303 ----
- case '\\':return ( launchNW0_pr );
-
- default:
- ! fprintf(stderr, "Illegal map code, stage %s\n",stage_name );
- exit( 1 );
- };
- }
- ***************
- *** 350,356 ****
- case 'X':return(37);
-
- default:
- ! perror( "Illegal map code" );
- exit( 1 );
- }
- }
- --- 350,356 ----
- case 'X':return(37);
-
- default:
- ! fprintf(stderr, "Illegal map code, stage %s\n",stage_name );
- exit( 1 );
- }
- }
- diff -cr xblockbuster1.01/deflection.c xblockbuster1.02/deflection.c
- *** xblockbuster1.01/deflection.c Fri Oct 23 00:20:03 1992
- --- xblockbuster1.02/deflection.c Wed Mar 24 17:42:12 1993
- ***************
- *** 15,22 ****
-
- #include "xblockbuster.h"
-
- ! void
- ! brick_deflection( hit, ball )
- register int hit; /* enumeration { HORIZONTAL, VERTICAL } */
- register struct Ball *ball;
- {
- --- 15,21 ----
-
- #include "xblockbuster.h"
-
- ! void brick_deflection( hit, ball )
- register int hit; /* enumeration { HORIZONTAL, VERTICAL } */
- register struct Ball *ball;
- {
- ***************
- *** 53,60 ****
- }
- }
-
- ! void
- ! pallet_deflection( ball )
- register struct Ball *ball;
- {
- double excentricity, true_angle;
- --- 52,58 ----
- }
- }
-
- ! void pallet_deflection( ball )
- register struct Ball *ball;
- {
- double excentricity, true_angle;
- ***************
- *** 111,117 ****
- ball1.x < -pallet_length || ball1.x > pallet_length )
- break;
- ball1.angle = ( ball1.angle / 45 ) * M_PI_4;
- ! pallet_deflection( &ball1 );
- ball1.angle = ( ball1.angle * 45 ) / M_PI_4;
- printf( "==> quadrant: %d angle: %f\n", ball1.quadrant, ball1.angle );
- };
- --- 109,115 ----
- ball1.x < -pallet_length || ball1.x > pallet_length )
- break;
- ball1.angle = ( ball1.angle / 45 ) * M_PI_4;
- ! pallet_deflection( ball1 );
- ball1.angle = ( ball1.angle * 45 ) / M_PI_4;
- printf( "==> quadrant: %d angle: %f\n", ball1.quadrant, ball1.angle );
- };
- Common subdirectories: xblockbuster1.01/icons and xblockbuster1.02/icons
- diff -cr xblockbuster1.01/patchlevel.h xblockbuster1.02/patchlevel.h
- *** xblockbuster1.01/patchlevel.h Thu Mar 18 01:34:39 1993
- --- xblockbuster1.02/patchlevel.h Fri Mar 26 01:21:39 1993
- ***************
- *** 1 ****
- ! #define VERSION "XBlockBuster 1.01"
- --- 1 ----
- ! #define VERSION "XBlockBuster 1.02"
- diff -cr xblockbuster1.01/save.c xblockbuster1.02/save.c
- *** xblockbuster1.01/save.c Thu Mar 18 16:22:53 1993
- --- xblockbuster1.02/save.c Fri Mar 26 01:10:59 1993
- ***************
- *** 9,16 ****
-
- #include "xblockbuster.h"
-
- ! void
- ! start_up( )
- {
- FILE *fd;
- char sve[SAVEFILE_LENGTH];
- --- 9,15 ----
-
- #include "xblockbuster.h"
-
- ! void start_up( )
- {
- FILE *fd;
- char sve[SAVEFILE_LENGTH];
- ***************
- *** 47,54 ****
- }
- }
-
- ! void
- ! save( )
- {
- FILE *fd;
- char sve[SAVEFILE_LENGTH];
- --- 46,52 ----
- }
- }
-
- ! void save( )
- {
- FILE *fd;
- char sve[SAVEFILE_LENGTH];
- ***************
- *** 65,71 ****
- pallet_modif, launch_speed );
- for ( stage_nb_tmp = 0; stage_nb_tmp < MAX_NB_STAGES; )
- fprintf( fd, "%1d", stages[stage_nb_tmp++] );
- ! close( fd );
-
- show_score_board( ); /* BYE !! */
- }
- --- 63,69 ----
- pallet_modif, launch_speed );
- for ( stage_nb_tmp = 0; stage_nb_tmp < MAX_NB_STAGES; )
- fprintf( fd, "%1d", stages[stage_nb_tmp++] );
- ! fclose( fd );
-
- show_score_board( ); /* BYE !! */
- }
- diff -cr xblockbuster1.01/score.c xblockbuster1.02/score.c
- *** xblockbuster1.01/score.c Thu Mar 18 16:49:56 1993
- --- xblockbuster1.02/score.c Wed Mar 24 18:46:51 1993
- ***************
- *** 34,44 ****
- }
-
-
- ! void
- ! show_score_board( )
- {
- register int lows, s, ns,scorenum=0;
- ! int update = FALSE,made_it = FALSE,width;
- FILE *fd;
- char buf[PATH_LENGTH];
-
- --- 34,43 ----
- }
-
-
- ! void show_score_board( )
- {
- register int lows, s, ns,scorenum=0;
- ! int update = FALSE,made_it = FALSE,width=0;
- FILE *fd;
- char buf[PATH_LENGTH];
-
- ***************
- *** 124,130 ****
- else if (abs(score_board[s].balls_left)>0) width=1;
-
-
- ! sprintf( buf, "%7d %*.s(%*d) %c %8s ",
- score_board[s].score, (3-width)," ",
- width, abs(score_board[s].balls_left),
- score_board[s].balls_left>0 ? ' ' : '+',
- --- 123,129 ----
- else if (abs(score_board[s].balls_left)>0) width=1;
-
-
- ! sprintf( buf, "%7d %.*s(%*d) %c %8s ",
- score_board[s].score, (3-width)," ",
- width, abs(score_board[s].balls_left),
- score_board[s].balls_left>0 ? ' ' : '+',
- ***************
- *** 150,156 ****
- else if (balls_left >9) width=2;
- else if (balls_left >0) width=1;
-
- ! sprintf( buf, "%7d %*.s(%*d) %8s ",
- score, (3-width)," ",
- width, balls_left, login);
- }
- --- 149,155 ----
- else if (balls_left >9) width=2;
- else if (balls_left >0) width=1;
-
- ! sprintf( buf, "%7d %.*s(%*d) %8s ",
- score, (3-width)," ",
- width, balls_left, login);
- }
- diff -cr xblockbuster1.01/stage.c xblockbuster1.02/stage.c
- *** xblockbuster1.01/stage.c Sat Mar 20 03:27:18 1993
- --- xblockbuster1.02/stage.c Fri Apr 2 20:42:25 1993
- ***************
- *** 8,20 ****
-
- #include "xblockbuster.h"
-
- ! void
- ! get_stage( )
- {
- FILE *fd;
- char buf[MAX_COL + 3], stg[STAGEFILE_LENGTH];
- register int row, col, tmp;
- register char code;
-
- nbricks = 0;
- score_incr = 1;
- --- 8,21 ----
-
- #include "xblockbuster.h"
-
- ! void get_stage( )
- {
- FILE *fd;
- char buf[MAX_COL + 3], stg[STAGEFILE_LENGTH];
- register int row, col, tmp;
- register char code;
- + extern int errno;
- + extern char *sys_errlist[];
-
- nbricks = 0;
- score_incr = 1;
- ***************
- *** 24,30 ****
- /* open next stage file */
- sprintf( stg, STAGEFILE, playground, stage_nb );
- if ( !( fd = fopen(stg, "r"))) {
- ! perror( "Can't open stage" );
- exit( 1 );
- }
- /* clear msg, but leave the top line so the bonus remains on screen */
- --- 25,32 ----
- /* open next stage file */
- sprintf( stg, STAGEFILE, playground, stage_nb );
- if ( !( fd = fopen(stg, "r"))) {
- ! fprintf(stderr, "Can't open stage %d, error %s\n",
- ! stage_nb, sys_errlist[errno]);
- exit( 1 );
- }
- /* clear msg, but leave the top line so the bonus remains on screen */
- ***************
- *** 118,125 ****
-
- }
-
- ! void
- ! new_stage( )
- {
- FILE *fd;
- register int stage_index, stage_nb_tmp;
- --- 120,126 ----
-
- }
-
- ! void new_stage( )
- {
- FILE *fd;
- register int stage_index, stage_nb_tmp;
- diff -cr xblockbuster1.01/stagemm.c xblockbuster1.02/stagemm.c
- *** xblockbuster1.01/stagemm.c Sat Mar 13 00:55:57 1993
- --- xblockbuster1.02/stagemm.c Wed Mar 24 19:53:04 1993
- ***************
- *** 32,38 ****
- }
- /* read stage name */
- fscanf( fd, "%s\n", stage_name );
- ! printf( "%>>> %s:", stage_name );
-
- /* read pallet dimensions */
- fscanf( fd, "%d%d\n", &pallet_lengthI, &pallet_heightI );
- --- 32,38 ----
- }
- /* read stage name */
- fscanf( fd, "%s\n", stage_name );
- ! printf( ">>> %s:", stage_name );
-
- /* read pallet dimensions */
- fscanf( fd, "%d%d\n", &pallet_lengthI, &pallet_heightI );
- Only in xblockbuster1.02: stagemm.o
- diff -cr xblockbuster1.01/xblockbuster.c xblockbuster1.02/xblockbuster.c
- *** xblockbuster1.01/xblockbuster.c Mon Mar 22 01:02:53 1993
- --- xblockbuster1.02/xblockbuster.c Wed Mar 31 19:27:01 1993
- ***************
- *** 26,36 ****
- #include "icons/blockbuster.icon"
- #include "patchlevel.h"
-
- ! int timer_active=FALSE, /* has the user started the ball? */
- ! window_active=FALSE; /* is the pointer in the window? */
-
- -
- -
- void event_handler()
- {
- XEvent e;
- --- 26,35 ----
- #include "icons/blockbuster.icon"
- #include "patchlevel.h"
-
- ! int timer_active=FALSE; /* has the user started the ball? */
- ! static char *disp=NULL, *play="default";
- ! static int winposx=0, winposy=0,geomask,no_pause=FALSE;
-
- void event_handler()
- {
- XEvent e;
- ***************
- *** 39,44 ****
- --- 38,44 ----
- char keystr[2],str[10];
- struct timeval tp,oldtp;
- struct timezone tzp;
- + int window_active=FALSE; /* is the pointer in the window? */
-
- gettimeofday(&oldtp,&tzp);
- draw_pallet(gc_xor);
- ***************
- *** 129,141 ****
- --- 129,164 ----
- "Not Saved... ",
- 23);
- }
- + else if ((keystr[0] == 'q' ) || (keystr[0]=='Q')) {
- + XCloseDisplay(display);
- + exit(0);
- + }
- + else if ((keystr[0] == 'p') || (keystr[0] =='P')) {
- + if (no_pause) no_pause=FALSE;
- + else no_pause=TRUE;
- + }
- break;
-
- case MotionNotify:
- + #ifdef MOTION_HINTS
- + {
- + Window rw, cw;
- + int xw, yw, xr, yr, keys_buttons;
- + XQueryPointer(display,e.xmotion.window,
- + &rw, &cw, &xr, &yr, &xw, &yw,
- + &keys_buttons);
- + draw_pallet(gc_xor); /* erase old pallet */
- + pallet_x = (double)(pallet_xI=xw);
- + mouse_yI = yw;
- + draw_pallet(gc_xor); /* draw new one */
- + }
- + #else
- +
- draw_pallet(gc_xor); /* erase old pallet */
- pallet_x = (double) (pallet_xI =e.xmotion.x);
- mouse_yI = e.xmotion.y;
- draw_pallet(gc_xor); /* draw new one */
- + #endif
- break;
-
- case EnterNotify:
- ***************
- *** 143,149 ****
- break;
-
- case LeaveNotify:
- ! window_active = FALSE;
- break;
-
- case Expose:
- --- 166,173 ----
- break;
-
- case LeaveNotify:
- ! if (!no_pause)
- ! window_active = FALSE;
- break;
-
- case Expose:
- ***************
- *** 182,249 ****
- }
-
-
- ! void get_playground( argc, argv )
- ! int argc;
- ! char *argv[];
- {
- DIR *dirp;
- struct direct *dp;
- struct stat st;
- ! int len, found;
-
- -
- /* set default playground directory */
- strcpy( playground, STAGEDIR );
- strcat( playground, "/" );
- /* check for additional arguments (specific playground) */
- ! if ( argc > 1 ) {
- ! if ( argv[1][0] == '-' ) {
- ! /* list available playgrounds */
- ! printf( "available playgrounds are:\n" );
- ! printf( "\tdefault\n" );
- ! dirp = opendir(STAGEDIR);
- ! for( dp=readdir( dirp ); dp!=NULL; dp=readdir( dirp ) ) {
- ! if ( !strncmp( dp->d_name, "STAGES.", 7 ) )
- ! printf( "\t%s\n", (dp->d_name)+7 );
- ! }
- ! closedir( dirp );
- ! exit( 0 );
- ! }
- ! /* it's a playground name or private directory */
- ! if( !strcmp( argv[1], "default" ) ) {
- ! /* just in case someone used default */
- ! strcat( playground, "STAGES" );
- ! return;
- ! }
- ! found = 0;
- ! len = strlen( argv[1] );
- ! dirp = opendir( STAGEDIR );
- for( dp=readdir( dirp ); dp!=NULL; dp=readdir( dirp ) ) {
- ! if ( dp->d_namlen == len+7 &&
- ! !strcmp( (dp->d_name)+7, argv[1] ) ) {
- ! found++;
- ! break;
- ! }
- }
- closedir( dirp );
- ! if ( found )
- ! strcat( playground, dp->d_name );
- ! else {
- ! /* private dir */
- ! strcpy( playground, argv[1] );
- ! stat( playground, &st );
- ! if( !(st.st_mode & S_IFDIR) ) {
- ! printf( "private playground <%s> not a directory.\n",
- ! playground );
- ! exit( 1 );
- ! }
- ! }
- ! } else {
- strcat( playground, "STAGES" );
- }
- }
- -
-
- /*** xblockbuster ***/
- void main( argc, argv )
- int argc;
- --- 206,299 ----
- }
-
-
- ! void get_playground()
- {
- DIR *dirp;
- struct direct *dp;
- struct stat st;
- ! char path[PATH_LENGTH];
- !
-
- /* set default playground directory */
- strcpy( playground, STAGEDIR );
- strcat( playground, "/" );
- +
- /* check for additional arguments (specific playground) */
- ! if ((!strcmp(play,"list")) || (!strcmp(play,"help"))) {
- ! /* list available playgrounds */
- ! printf( "available playgrounds are:\n" );
- ! printf( "\tdefault\n" );
- ! dirp = opendir(STAGEDIR);
- for( dp=readdir( dirp ); dp!=NULL; dp=readdir( dirp ) ) {
- ! if ( !strncmp( dp->d_name, "STAGES.", 7 ) )
- ! printf( "\t%s\n", (dp->d_name)+7 );
- }
- closedir( dirp );
- ! exit( 0 );
- ! }
- ! /* it's a playground name or private directory */
- ! if( !strcmp( play, "default" ) ) {
- ! /* just in case someone used default */
- strcat( playground, "STAGES" );
- + return;
- }
- + sprintf(path,"%s/STAGES.%s",STAGEDIR,play);
- + stat(path, &st);
- + if (S_ISDIR(st.st_mode))
- + strcpy(playground, path);
- + else { /* private dir */
- + stat(play, &st);
- + if (!S_ISDIR(st.st_mode)) {
- + printf("Was not able to open playground %s.\n",play);
- + exit(1);
- + }
- + else strcpy(playground,play);
- + }
- }
-
- + void usage()
- + {
- + printf("Valid option command line arguements are:\n\n");
- + printf(" -display dispname - destination display\n");
- + printf("-playground playground - playground to use\n\n");
- + exit(0);
- + }
- +
- + void parse_args(argc, argv)
- + int argc;
- + char *argv[];
- + {
- +
- + int i,tmp;
- +
- + for (i=1; i<argc; i++) {
- + if (!strcmp(argv[i],"-display"))
- + if (++i==argc) usage();
- + else disp = argv[i];
- + else if (!strcmp(argv[i],"-playground"))
- + if (++i==argc) usage();
- + else play = argv[i];
- + else if (!strcmp(argv[i],"-geometry")) {
- + if (++i==argc) usage();
- + else geomask = XParseGeometry(argv[i], &winposx,
- + &winposy, &tmp, &tmp);
- + }
- + else if (!strcmp(argv[i],"-nopause"))
- + no_pause=TRUE;
- + else usage();
- + }
- + }
- +
- + void do_geometry()
- + {
- + if (geomask & XNegative)
- + winposx += WidthOfScreen(ScreenOfDisplay(display,screen_num))
- + - STAGE_WIDTH_IN_PIXELS - BORDER_WIDTH*2;
- + if (geomask & YNegative)
- + winposy += HeightOfScreen(ScreenOfDisplay(display,screen_num))
- + - STAGE_HEIGHT_IN_PIXELS - BORDER_WIDTH*2;
- + }
- +
- /*** xblockbuster ***/
- void main( argc, argv )
- int argc;
- ***************
- *** 261,267 ****
- /* who am i ? ['cuserid(3S)' is fooled by 'su(1)'] */
- login = getpwuid( getuid( ) )->pw_name;
-
- ! if ((display=XOpenDisplay(NULL))==NULL) {
- fprintf(stderr, "Unable to open display: %s\n",
- XDisplayName(NULL));
- exit(1);
- --- 311,320 ----
- /* who am i ? ['cuserid(3S)' is fooled by 'su(1)'] */
- login = getpwuid( getuid( ) )->pw_name;
-
- ! parse_args(argc, argv);
- ! get_playground();
- !
- ! if ((display=XOpenDisplay(disp))==NULL) {
- fprintf(stderr, "Unable to open display: %s\n",
- XDisplayName(NULL));
- exit(1);
- ***************
- *** 268,279 ****
- }
-
- screen_num = DefaultScreen(display);
- win = XCreateSimpleWindow(display, RootWindow(display, screen_num),
- ! 0, 0, STAGE_WIDTH_IN_PIXELS, STAGE_HEIGHT_IN_PIXELS,
- ! 0, 2, WhitePixel(display, screen_num));
-
- XSelectInput(display, win, ExposureMask | ButtonPressMask |
- LeaveWindowMask | EnterWindowMask | KeyPressMask |
- PointerMotionMask);
-
-
- --- 321,342 ----
- }
-
- screen_num = DefaultScreen(display);
- +
- + do_geometry();
- +
- + whitepixel = WhitePixel(display, screen_num);
- + blackpixel = BlackPixel(display, screen_num);
- +
- win = XCreateSimpleWindow(display, RootWindow(display, screen_num),
- ! winposx, winposy, STAGE_WIDTH_IN_PIXELS,
- ! STAGE_HEIGHT_IN_PIXELS, BORDER_WIDTH, blackpixel,
- ! whitepixel);
-
- XSelectInput(display, win, ExposureMask | ButtonPressMask |
- LeaveWindowMask | EnterWindowMask | KeyPressMask |
- + #ifdef MOTION_HINTS
- + PointerMotionHintMask |
- + #endif
- PointerMotionMask);
-
-
- ***************
- *** 285,292 ****
- font_height=font_info->max_bounds.ascent + font_info->max_bounds.descent +1;
-
-
- ! xgcvalues.foreground = BlackPixel(display, screen_num);
- ! xgcvalues.background = WhitePixel(display, screen_num);
-
-
- xgcvalues.graphics_exposures = False;
- --- 348,355 ----
- font_height=font_info->max_bounds.ascent + font_info->max_bounds.descent +1;
-
-
- ! xgcvalues.foreground = blackpixel;
- ! xgcvalues.background = whitepixel;
-
-
- xgcvalues.graphics_exposures = False;
- ***************
- *** 341,348 ****
- }
-
- size_hints.flags = PMinSize;
- ! size_hints.x = 0;
- ! size_hints.y = 0;
- size_hints.height = STAGE_HEIGHT_IN_PIXELS;
- size_hints.min_height = STAGE_HEIGHT_IN_PIXELS;
- size_hints.width = STAGE_WIDTH_IN_PIXELS;
- --- 404,412 ----
- }
-
- size_hints.flags = PMinSize;
- ! if (geomask!=0) size_hints.flags |= USPosition;
- ! size_hints.x = winposx;
- ! size_hints.y = winposy;
- size_hints.height = STAGE_HEIGHT_IN_PIXELS;
- size_hints.min_height = STAGE_HEIGHT_IN_PIXELS;
- size_hints.width = STAGE_WIDTH_IN_PIXELS;
- ***************
- *** 364,370 ****
- /* initialize random (used to determine next stage) */
- SRAND( time( 0 ) );
-
- - get_playground( argc, argv );
-
- /* and off we go */
- bricks_init();
- --- 428,433 ----
- ***************
- *** 382,388 ****
- /* Most SysV's don't have a usleep. Sone of them have select. */
-
- usleep( usecs )
- ! int usecs;
- {
- struct timeval timeout;
-
- --- 445,451 ----
- /* Most SysV's don't have a usleep. Sone of them have select. */
-
- usleep( usecs )
- ! unsigned usecs;
- {
- struct timeval timeout;
-
- diff -cr xblockbuster1.01/xblockbuster.h xblockbuster1.02/xblockbuster.h
- *** xblockbuster1.01/xblockbuster.h Sat Mar 20 03:27:34 1993
- --- xblockbuster1.02/xblockbuster.h Tue Mar 30 20:11:59 1993
- ***************
- *** 27,34 ****
- --- 27,42 ----
-
- #define FONT "10x20"
-
- + /* define if you want pointer motion hints used (read CHANGES file) */
- + /*#define MOTION_HINTS*/
- +
- + #ifdef hpux
- + #define RAND() rand()
- + #define SRAND(n) srand(n)
- + #else
- #define RAND() random()
- #define SRAND(n) srandom(n)
- + #endif
-
- /* You may need to uncomment some of these if your system does not have
- * them. If you need to do so, please let me know, so I can put them
- ***************
- *** 51,58 ****
- --- 59,68 ----
- GC gc, gc_erase, gc_color,gc_xor;
- XFontStruct *font_info;
- int screen_num, font_width, font_height,extra_draw;
- + unsigned long whitepixel, blackpixel;
-
- /*** windowing objects ***/
- + #define BORDER_WIDTH 2 /* borderwidth X puts around the window */
-
- #define BORDER 50
- #define MSG_HEIGHT font_height*2 + 4
- ***************
- *** 219,221 ****
- --- 229,267 ----
-
- #define ITIMER_DELAY 5000
-
- + /* Prototype some functions here */
- + #ifdef __GNUC__
- + void fclose(FILE *); /* system */
- + void fprintf(FILE*, char *, ...); /* system */
- + void fscanf(FILE *, char *, ...); /* system */
- + int gettimeofday(struct timeval*, struct timezone*); /* system */
- + void perror(char *); /* system */
- + void printf(char *, ...); /* system */
- + void rewind(FILE *); /* system */
- + int strcasecmp(char *, char*); /* system */
- + time_t time(time_t*); /* system */
- + void usleep(unsigned); /* system */
- +
- + int RAND(); /* system */
- + void SRAND(int); /* system */
- +
- + void ball_init(); /* balls_pallet.c */
- + void check_deflections(double ); /* balls_pallet.c */
- + void draw_all_balls(); /* balls_pallet.c */
- + void draw_pallet(GC); /* balls_pallet.c */
- + void move_balls(); /* balls_pallet.c */
- + void print_balls(); /* balls_pallet.c */
- + void print_score(); /* balls_pallet.c */
- + void show_speeds(); /* balls_paller.c */
- + void bricks_init(); /* bricks.c */
- + void draw_brick(int, int ) ; /* bricks.c */
- + void draw_brick0(int, int ) ; /* bricks.c */
- + void brick_deflection( int, struct Ball* ); /* deflection.c */
- + void pallet_deflection(struct Ball * ); /* deflection.c */
- + void save(); /* save.c */
- + void start_up(); /* save.c */
- + void get_stage(); /* stage.c */
- + void new_stage( ); /* stage.c */
- + void show_score_board( ); /* score.c */
- +
- + #endif
- diff -cr xblockbuster1.01/xblockbuster.man xblockbuster1.02/xblockbuster.man
- *** xblockbuster1.01/xblockbuster.man Tue Mar 23 00:32:13 1993
- --- xblockbuster1.02/xblockbuster.man Wed Mar 31 19:43:21 1993
- ***************
- *** 3,15 ****
- .SH NAME
- xblockbuster \- game
- .SH SYNOPSIS
- ! .B xblockbuster
- ! .I [play_ground]
- .SH DESCRIPTION
- ! The play ground is either the anonymous public play ground (no argument),
- ! a named public playground or a privately owned directory.
- ! The list of available named public play grounds is obtained by giving "-"
- ! as the play ground argument.
- .LP
- The object of the game is to collect as many points as possible by
- .I busting
- --- 3,19 ----
- .SH NAME
- xblockbuster \- game
- .SH SYNOPSIS
- ! .B xblockbuster -playground
- ! .I play_ground
- ! .B -display
- ! .I display
- ! .B -geometry
- ! .I geometry
- ! .B -nopause
- .SH DESCRIPTION
- ! XBlockbuster is a variation of the break-out type games, only a bit more
- ! complex in the type of bricks it has and effects the bricks have. It is
- ! X11 based.
- .LP
- The object of the game is to collect as many points as possible by
- .I busting
- ***************
- *** 45,54 ****
- LEFT moves it up one row, MIDDLE moves it all the way down again.
- Each ball is launched with the RIGHT mouse button.
- .LP
- ! A stage can be halted by closing the window, or moving the pointer out
- ! of the window.
- Be advised however, that the game will resume immediately upon opening the
- window.
- .LP
- During a game, the score, number of balls left and speeds are shown.
- The speeds are represented by up to 3 thin lines (one for each ball),
- --- 49,60 ----
- LEFT moves it up one row, MIDDLE moves it all the way down again.
- Each ball is launched with the RIGHT mouse button.
- .LP
- ! A stage can be halted by closing the window.
- Be advised however, that the game will resume immediately upon opening the
- window.
- + If no-pause has not
- + been selected (see below), moving the pointer out
- + of the XBlockBuster window will also stop the action.
- .LP
- During a game, the score, number of balls left and speeds are shown.
- The speeds are represented by up to 3 thin lines (one for each ball),
- ***************
- *** 63,68 ****
- --- 69,111 ----
- The score board shows scores, number of balls left between parentheses if any
- and user name.
- Finally, an indication of your current pallet shrinkage is given.
- + .LP
- + At any time, 'q' or 'Q' may be pressed to quit the present game. This quits
- + the game immediately, so may be useful if your boss is closing in. Also
- + useful if you mess up on the first stage, and thus, continuing play of that
- + game is no longer worth it.
- + .LP
- + \'P' or 'p' may be pressed during the game to toggle the no-pause option.
- + When no-pause is active, the game will continue even when the mouse pointer
- + is outside the window. With it turned off, action stops once the mouse
- + pointer is outside the window.
- + .SH COMMAND LINE OPTIONS
- + .TP 8
- + -playground \fIplayground\fR
- + This determines the playground to use. Either the directory containing
- + the score file, stages, and save directory can be given, or only the
- + final part after the STAGES name can be given for public play grounds.
- +
- + By default, the standard playground will be used if this option is
- + not given.
- +
- + To see a list of the public play grounds, enter \fIlist\fB as the
- + playground name.
- + .TP
- + -display \fIdisplay\fR
- + This is the display to run XBlockBuster on. If not otherwise specified,
- + the DISPLAY environmental variable will be used to determine the
- + display to use.
- + .TP
- + -geometry \fIgeometry\fR
- + This is the geometry to use for the XBlockBuster window. Only the
- + positioning, and not size, information is used. If size information
- + is given, it is just ignored.
- + .TP
- + -nopause
- + Determines if no-pause mode is on by default when the game is started up.
- + When no-pause mode is on, action continues if the mouse pointer is outside
- + the XBlockBuster window.
- .SH NOTES
- .LP
- In order to avoid infinite loops
- ***************
- *** 93,99 ****
- during play.
- .SH "CREATION OF PLAY GROUNDS"
- A private play ground can be created in any directory.
- ! The stages can be defined from the ascii map codes using any text editor
- They must be numbered consecutively from 0 with the total number
- (i.e., one more than the highest number) available in the file nb_stages.
- Furthermore a directory 'save' and an empty file 'scores' must be created.
- --- 136,142 ----
- during play.
- .SH "CREATION OF PLAY GROUNDS"
- A private play ground can be created in any directory.
- ! The stages can be defined from the ascii map codes using any text editor.
- They must be numbered consecutively from 0 with the total number
- (i.e., one more than the highest number) available in the file nb_stages.
- Furthermore a directory 'save' and an empty file 'scores' must be created.
- ***************
- *** 230,237 ****
- .SH BUGS
- When two balls hit the same brick simultaneously,
- one may leave a shadow on the stage.
- - .LP
- - Sometimes a ball image is left when the window is re-opened.
- .LP
- If the ball hits the bottom corners of the playing area, they will at times
- reflect back in a reverse direction, instead of reflecting downward and
- --- 273,278 ----
- Common subdirectories: xblockbuster1.01/STAGES/save and xblockbuster1.02/STAGES/save
- Common subdirectories: xblockbuster1.01/STAGES.try/save and xblockbuster1.02/STAGES.try/save
- Common subdirectories: xblockbuster1.01/STAGES.wacko/save and xblockbuster1.02/STAGES.wacko/save
-