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