home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume19 / xblckbst / part04 < prev    next >
Encoding:
Text File  |  1993-04-27  |  40.8 KB  |  1,197 lines

  1. Newsgroups: comp.sources.x
  2. From: master@cats.UCSC.EDU (Mark Wedel)
  3. Subject: v19i047:  xblockbuster - a variation of the break-out type games, Part04/05
  4. Message-ID: <1993Mar17.160324.643@sparky.imd.sterling.com>
  5. X-Md4-Signature: cae37fbf85e9bfb669f0ed951a4abc83
  6. Date: Wed, 17 Mar 1993 16:03:24 GMT
  7. Approved: chris@sparky.imd.sterling.com
  8.  
  9. Submitted-by: master@cats.UCSC.EDU (Mark Wedel)
  10. Posting-number: Volume 19, Issue 47
  11. Archive-name: xblockbuster/part04
  12. Environment: X11R5
  13.  
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then unpack
  17. # it by saving it into a file and typing "sh file".  To overwrite existing
  18. # files, type "sh file -c".  You can also feed this as standard input via
  19. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  20. # will see the following message at the end:
  21. #        "End of archive 4 (of 5)."
  22. # Contents:  Makefile.noIm bricks.c xblockbuster.c xblockbuster.man
  23. # Wrapped by master@sleipner on Sat Mar 13 02:21:02 1993
  24. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  25. if test -f 'Makefile.noIm' -a "${1}" != "-c" ; then 
  26.   echo shar: Will not clobber existing file \"'Makefile.noIm'\"
  27. else
  28. echo shar: Extracting \"'Makefile.noIm'\" \(7028 characters\)
  29. sed "s/^X//" >'Makefile.noIm' <<'END_OF_FILE'
  30. X#
  31. X# Makefile for XBlockbuster
  32. X#
  33. XHDRS= xblockbuster.h patchlevel.h
  34. XSRCS = balls_pallet.c bricks.c deflection.c save.c score.c stage.c \
  35. X    xblockbuster.c 
  36. XOBJS = balls_pallet.o bricks.o deflection.o save.o score.o stage.o \
  37. X    xblockbuster.o 
  38. X
  39. X# Where you want the executable installed
  40. XBINDIR = /usr/games
  41. X# where you want the stages and scores stored
  42. XLIBDIR = /usr/games/lib/xblockbuster
  43. X# where to put the man page, and its extension
  44. XMANDIR = /usr/local/man/man6/
  45. XMANEXT = 6
  46. X
  47. X# Font to use for writing text.
  48. XFONT = 10x20
  49. X
  50. XCC = cc
  51. X# IF you want to change the FONT or LIBDIR, do it above
  52. XCFLAGS= -O -DFONT=\"${FONT}\"  -DSTAGEDIR=\"${LIBDIR}\"
  53. XLDFLAGS=
  54. XLIBS= -lm -lX11
  55. X
  56. Xall:    xblockbuster stagemm
  57. X
  58. Xxblockbuster: ${HDRS} ${OBJS} ${SRCS}
  59. X    $(CC) ${LDFLAGS} ${OBJS} ${LIBS} -o xblockbuster
  60. X
  61. Xstagemm: stagemm.c
  62. X    $(CC) stagemm.c -o stagemm
  63. X
  64. Xinstall:
  65. X    mkdir ${LIBDIR}
  66. X    cp -r STAGES* ${LIBDIR}
  67. X    chmod 666 ${LIBDIR}/STAGES*/scores
  68. X    chmod 777 ${LIBDIR}/STAGES*/save
  69. X    cp XBlockbuster.ad ${LIBDIR}
  70. X    cp xblockbuster ${BINDIR}/xblockbuster
  71. X    cp xblockbuster.man ${MANDIR}/xblockbuster.${MANEXT}
  72. X    cp stagemm ${BINDIR}/stagemm
  73. X    cp stagemm.man ${MANDIR}/stagemm.${MANEXT}
  74. X
  75. Xrealclean:
  76. X    rm -f $(OBJS) xblockbuster stagemm
  77. X
  78. Xdepend:
  79. X    makedepend -- $(SRCS) -- $(HDRS)
  80. X
  81. Xclean:
  82. X    rm -f $(OBJS)
  83. X
  84. X# DO NOT DELETE THIS LINE -- make depend depends on it.
  85. X
  86. Xballs_pallet.o: xblockbuster.h /usr/include/X11/Xlib.h
  87. Xballs_pallet.o: /usr/include/sys/types.h /usr/include/sys/stdtypes.h
  88. Xballs_pallet.o: /usr/include/sys/sysmacros.h /usr/include/X11/X.h
  89. Xballs_pallet.o: /usr/include/X11/Xfuncproto.h /usr/include/X11/Xosdefs.h
  90. Xballs_pallet.o: /usr/include/stddef.h /usr/include/X11/Xutil.h
  91. Xballs_pallet.o: /usr/include/X11/Xos.h /usr/include/string.h
  92. Xballs_pallet.o: /usr/include/fcntl.h /usr/include/sys/fcntlcom.h
  93. Xballs_pallet.o: /usr/include/sys/stat.h /usr/include/unistd.h
  94. Xballs_pallet.o: /usr/include/sys/time.h /usr/include/sys/time.h
  95. Xballs_pallet.o: /usr/include/X11/Xatom.h icons/ball.pr
  96. Xbricks.o: xblockbuster.h /usr/include/X11/Xlib.h /usr/include/sys/types.h
  97. Xbricks.o: /usr/include/sys/stdtypes.h /usr/include/sys/sysmacros.h
  98. Xbricks.o: /usr/include/X11/X.h /usr/include/X11/Xfuncproto.h
  99. Xbricks.o: /usr/include/X11/Xosdefs.h /usr/include/stddef.h
  100. Xbricks.o: /usr/include/X11/Xutil.h /usr/include/X11/Xos.h
  101. Xbricks.o: /usr/include/string.h /usr/include/fcntl.h
  102. Xbricks.o: /usr/include/sys/fcntlcom.h /usr/include/sys/stat.h
  103. Xbricks.o: /usr/include/unistd.h /usr/include/sys/time.h
  104. Xbricks.o: /usr/include/sys/time.h /usr/include/X11/Xatom.h icons/clear.pr
  105. Xbricks.o: icons/solid.pr icons/launchNE.pr icons/launchNW.pr icons/clear0.pr
  106. Xbricks.o: icons/solid0.pr icons/launchNE0.pr icons/launchNW0.pr
  107. Xbricks.o: icons/brick_0.pr icons/brick_1.pr icons/brick_2.pr icons/brick_3.pr
  108. Xbricks.o: icons/brick_4.pr icons/brick_5.pr icons/brick_6.pr icons/brick_7.pr
  109. Xbricks.o: icons/brick_8.pr icons/brick_9.pr icons/brick_a.pr icons/brick_b.pr
  110. Xbricks.o: icons/brick_c.pr icons/brick_d.pr icons/brick_e.pr icons/brick_j.pr
  111. Xbricks.o: icons/brick_A.pr icons/brick_C.pr icons/brick_D.pr icons/brick_E.pr
  112. Xbricks.o: icons/brick_G.pr icons/brick_H.pr icons/brick_L.pr icons/brick_M.pr
  113. Xbricks.o: icons/brick_P.pr icons/brick_R.pr icons/brick_S.pr icons/brick_T.pr
  114. Xbricks.o: icons/brick_U.pr icons/brick_W.pr icons/brick_X.pr
  115. Xbricks.o: icons/brick_a_alt.pr icons/brick_b_alt.pr icons/brick_c_alt.pr
  116. Xbricks.o: icons/brick_d_alt.pr icons/brick_e_alt.pr icons/brick_j_alt.pr
  117. Xbricks.o: icons/brick_S_alt.pr icons/brick_0_alt.pr icons/cursor.pr
  118. Xdeflection.o: xblockbuster.h /usr/include/X11/Xlib.h /usr/include/sys/types.h
  119. Xdeflection.o: /usr/include/sys/stdtypes.h /usr/include/sys/sysmacros.h
  120. Xdeflection.o: /usr/include/X11/X.h /usr/include/X11/Xfuncproto.h
  121. Xdeflection.o: /usr/include/X11/Xosdefs.h /usr/include/stddef.h
  122. Xdeflection.o: /usr/include/X11/Xutil.h /usr/include/X11/Xos.h
  123. Xdeflection.o: /usr/include/string.h /usr/include/fcntl.h
  124. Xdeflection.o: /usr/include/sys/fcntlcom.h /usr/include/sys/stat.h
  125. Xdeflection.o: /usr/include/unistd.h /usr/include/sys/time.h
  126. Xdeflection.o: /usr/include/sys/time.h /usr/include/X11/Xatom.h
  127. Xsave.o: xblockbuster.h /usr/include/X11/Xlib.h /usr/include/sys/types.h
  128. Xsave.o: /usr/include/sys/stdtypes.h /usr/include/sys/sysmacros.h
  129. Xsave.o: /usr/include/X11/X.h /usr/include/X11/Xfuncproto.h
  130. Xsave.o: /usr/include/X11/Xosdefs.h /usr/include/stddef.h
  131. Xsave.o: /usr/include/X11/Xutil.h /usr/include/X11/Xos.h /usr/include/string.h
  132. Xsave.o: /usr/include/fcntl.h /usr/include/sys/fcntlcom.h
  133. Xsave.o: /usr/include/sys/stat.h /usr/include/unistd.h /usr/include/sys/time.h
  134. Xsave.o: /usr/include/sys/time.h /usr/include/X11/Xatom.h
  135. Xscore.o: xblockbuster.h /usr/include/X11/Xlib.h /usr/include/sys/types.h
  136. Xscore.o: /usr/include/sys/stdtypes.h /usr/include/sys/sysmacros.h
  137. Xscore.o: /usr/include/X11/X.h /usr/include/X11/Xfuncproto.h
  138. Xscore.o: /usr/include/X11/Xosdefs.h /usr/include/stddef.h
  139. Xscore.o: /usr/include/X11/Xutil.h /usr/include/X11/Xos.h
  140. Xscore.o: /usr/include/string.h /usr/include/fcntl.h
  141. Xscore.o: /usr/include/sys/fcntlcom.h /usr/include/sys/stat.h
  142. Xscore.o: /usr/include/unistd.h /usr/include/sys/time.h
  143. Xscore.o: /usr/include/sys/time.h /usr/include/X11/Xatom.h
  144. Xstage.o: xblockbuster.h /usr/include/X11/Xlib.h /usr/include/sys/types.h
  145. Xstage.o: /usr/include/sys/stdtypes.h /usr/include/sys/sysmacros.h
  146. Xstage.o: /usr/include/X11/X.h /usr/include/X11/Xfuncproto.h
  147. Xstage.o: /usr/include/X11/Xosdefs.h /usr/include/stddef.h
  148. Xstage.o: /usr/include/X11/Xutil.h /usr/include/X11/Xos.h
  149. Xstage.o: /usr/include/string.h /usr/include/fcntl.h
  150. Xstage.o: /usr/include/sys/fcntlcom.h /usr/include/sys/stat.h
  151. Xstage.o: /usr/include/unistd.h /usr/include/sys/time.h
  152. Xstage.o: /usr/include/sys/time.h /usr/include/X11/Xatom.h
  153. Xxblockbuster.o: xblockbuster.h /usr/include/X11/Xlib.h
  154. Xxblockbuster.o: /usr/include/sys/types.h /usr/include/sys/stdtypes.h
  155. Xxblockbuster.o: /usr/include/sys/sysmacros.h /usr/include/X11/X.h
  156. Xxblockbuster.o: /usr/include/X11/Xfuncproto.h /usr/include/X11/Xosdefs.h
  157. Xxblockbuster.o: /usr/include/stddef.h /usr/include/X11/Xutil.h
  158. Xxblockbuster.o: /usr/include/X11/Xos.h /usr/include/string.h
  159. Xxblockbuster.o: /usr/include/fcntl.h /usr/include/sys/fcntlcom.h
  160. Xxblockbuster.o: /usr/include/sys/stat.h /usr/include/unistd.h
  161. Xxblockbuster.o: /usr/include/sys/time.h /usr/include/sys/time.h
  162. Xxblockbuster.o: /usr/include/X11/Xatom.h /usr/include/sys/dir.h
  163. Xxblockbuster.o: /usr/include/signal.h /usr/include/sys/signal.h
  164. Xxblockbuster.o: /usr/include/vm/faultcode.h icons/blockbuster.icon
  165. Xxblockbuster.o: /usr/include/X11/Xlib.h /usr/include/sys/types.h
  166. Xxblockbuster.o: /usr/include/sys/stdtypes.h /usr/include/sys/sysmacros.h
  167. Xxblockbuster.o: /usr/include/X11/X.h /usr/include/X11/Xfuncproto.h
  168. Xxblockbuster.o: /usr/include/X11/Xosdefs.h /usr/include/stddef.h
  169. Xxblockbuster.o: /usr/include/X11/Xutil.h /usr/include/X11/Xos.h
  170. Xxblockbuster.o: /usr/include/string.h /usr/include/fcntl.h
  171. Xxblockbuster.o: /usr/include/sys/fcntlcom.h /usr/include/sys/stat.h
  172. Xxblockbuster.o: /usr/include/unistd.h /usr/include/sys/time.h
  173. Xxblockbuster.o: /usr/include/sys/time.h /usr/include/X11/Xatom.h
  174. END_OF_FILE
  175. if test 7028 -ne `wc -c <'Makefile.noIm'`; then
  176.     echo shar: \"'Makefile.noIm'\" unpacked with wrong size!
  177. fi
  178. # end of 'Makefile.noIm'
  179. fi
  180. if test -f 'bricks.c' -a "${1}" != "-c" ; then 
  181.   echo shar: Will not clobber existing file \"'bricks.c'\"
  182. else
  183. echo shar: Extracting \"'bricks.c'\" \(12416 characters\)
  184. sed "s/^X//" >'bricks.c' <<'END_OF_FILE'
  185. X/*
  186. X * File:       bricks.c
  187. X * Author:     Eric Van Gestel
  188. X * Updated to X11, alternate brick support and color added by Mark S. Wedel
  189. X *
  190. X * For:                xblockbuster
  191. X */
  192. X#include "xblockbuster.h"
  193. Xstatic int    has_color=FALSE;
  194. X
  195. X
  196. XPixmap     launchNW_pr,launchNW0_pr,launchNE_pr,launchNE0_pr,
  197. X    solid_pr,solid0_pr,clear_pr,clear0_pr,
  198. X    brick_0_pr,brick_1_pr,brick_2_pr,brick_3_pr,brick_4_pr,
  199. X    brick_5_pr,brick_6_pr,brick_7_pr,brick_8_pr,brick_9_pr,
  200. X    brick_a_pr,brick_b_pr,brick_c_pr,brick_d_pr,brick_e_pr,
  201. X    brick_j_pr,brick_A_pr,brick_C_pr,brick_D_pr,brick_E_pr,
  202. X    brick_G_pr,brick_H_pr,brick_L_pr,brick_M_pr,brick_P_pr,
  203. X    brick_R_pr,brick_S_pr,brick_T_pr,brick_U_pr,brick_W_pr,
  204. X    brick_X_pr;
  205. X
  206. X
  207. X/* Include all the brick images */
  208. X#include "icons/clear.pr"
  209. X#include "icons/solid.pr"
  210. X#include "icons/launchNE.pr"
  211. X#include "icons/launchNW.pr"
  212. X#include "icons/clear0.pr"
  213. X#include "icons/solid0.pr"
  214. X#include "icons/launchNE0.pr"
  215. X#include "icons/launchNW0.pr"
  216. X#include "icons/brick_0.pr"
  217. X#include "icons/brick_1.pr"
  218. X#include "icons/brick_2.pr"
  219. X#include "icons/brick_3.pr"
  220. X#include "icons/brick_4.pr"
  221. X#include "icons/brick_5.pr"
  222. X#include "icons/brick_6.pr"
  223. X#include "icons/brick_7.pr"
  224. X#include "icons/brick_8.pr"
  225. X#include "icons/brick_9.pr"
  226. X#include "icons/brick_a.pr"
  227. X#include "icons/brick_b.pr"
  228. X#include "icons/brick_c.pr"
  229. X#include "icons/brick_d.pr"
  230. X#include "icons/brick_e.pr"
  231. X#include "icons/brick_j.pr"
  232. X#include "icons/brick_A.pr"
  233. X#include "icons/brick_C.pr"
  234. X#include "icons/brick_D.pr"
  235. X#include "icons/brick_E.pr"
  236. X#include "icons/brick_G.pr"
  237. X#include "icons/brick_H.pr"
  238. X#include "icons/brick_L.pr"
  239. X#include "icons/brick_M.pr"
  240. X#include "icons/brick_P.pr"
  241. X#include "icons/brick_R.pr"
  242. X#include "icons/brick_S.pr"
  243. X#include "icons/brick_T.pr"
  244. X#include "icons/brick_U.pr"
  245. X#include "icons/brick_W.pr"
  246. X#include "icons/brick_X.pr"
  247. X
  248. X/* Alternate bricks for some of the above - meant for color displays  - MSW */
  249. X#include "icons/brick_a_alt.pr"
  250. X#include "icons/brick_b_alt.pr"
  251. X#include "icons/brick_c_alt.pr"
  252. X#include "icons/brick_d_alt.pr"
  253. X#include "icons/brick_e_alt.pr"
  254. X#include "icons/brick_j_alt.pr"
  255. X#include "icons/brick_S_alt.pr"
  256. X#include "icons/brick_0_alt.pr"
  257. X
  258. X/* Our Cursor */
  259. X#include "icons/cursor.pr"
  260. X
  261. X
  262. Xvoid    do_brick_colors()
  263. X{
  264. X    Colormap    def_cmap;
  265. X    XColor        exact_def;
  266. X    Cursor          cursor;
  267. X    Pixmap        cursor_pr;
  268. X    int    count;
  269. X    char        *bricks="0123456789 #/\\abcdejA^CDEGHILMPRSTUW%X";
  270. X    char        option[30],*value;
  271. X
  272. X    for (count=0; count<=NUM_BRICK_TYPES; count++) {
  273. X        brick_color[count].bg = WhitePixel(display, screen_num);
  274. X        brick_color[count].fg = BlackPixel(display, screen_num);
  275. X    }
  276. X
  277. X
  278. X    def_cmap = DefaultColormap(display, screen_num);
  279. X
  280. X
  281. X    /* This cursor code should really be in xblockbuster.c, but
  282. X    since we are dealing with colormaps here, it is easier to place
  283. X    the cursor code here.  I re-color the cursor so that it does
  284. X    not show up on the screen. */
  285. X
  286. X    cursor_pr = XCreateBitmapFromData(display,win,cursor_bits, 
  287. X        cursor_width, cursor_height);
  288. X    exact_def.pixel = WhitePixel(display, screen_num);
  289. X    XQueryColor(display, def_cmap, &exact_def);
  290. X    cursor = XCreatePixmapCursor(display, cursor_pr, cursor_pr,
  291. X        &exact_def, &exact_def, 0, 0);
  292. X    XDefineCursor(display, win,cursor);
  293. X
  294. X    /* Figure we need at least a 5 bit display (32 colors) in order
  295. X    to support color bricks.  Probably not many 5, 6, or 7 bit displays
  296. X    out there, but you never know -MSW */
  297. X
  298. X    if (DefaultDepth(display,screen_num)<5) return;
  299. X    else has_color=TRUE;
  300. X
  301. X
  302. X    count=0;
  303. X    while (bricks[count]!='\0') {
  304. X        sprintf(option,"brick%c_fg",bricks[count]);
  305. X        value = XGetDefault(display, "XBlockbuster", option);
  306. X        if (value) {
  307. X            if (!XParseColor(display, def_cmap, value, &exact_def)) {
  308. X                printf("Couldn't find color %s for option %s\n",value,option);
  309. X            }
  310. X            else 
  311. X            if (!XAllocColor(display, def_cmap, &exact_def))
  312. X                printf("couldn't allocate color %s in option %s\n",value,option);
  313. X            else
  314. X                brick_color[count].fg=exact_def.pixel;
  315. X        }
  316. X
  317. X        sprintf(option,"brick%c_bg",bricks[count]);
  318. X        value = XGetDefault(display, "XBlockbuster", option);
  319. X        if (value) {
  320. X            if (!XParseColor(display, def_cmap, value, &exact_def)) {
  321. X            printf("Couldn't find color %s for option %s\n",value,option);
  322. X            }
  323. X            else 
  324. X            if (!XAllocColor(display, def_cmap, &exact_def))
  325. X                printf("couldn't allocate color %s in option %s\n",value,option);
  326. X            else
  327. X                brick_color[count].bg=exact_def.pixel;
  328. X        }
  329. X        count++;
  330. X    }
  331. X}
  332. X
  333. X
  334. Xvoid bricks_init()
  335. X{
  336. X
  337. X    char    *value;
  338. X    int    use_alt_bricks=FALSE;
  339. X
  340. X    do_brick_colors();
  341. X
  342. X
  343. X/* The width and height of these should really be keyed in from the defintions
  344. Xin the files themselves.  However, that would take a considerable amount of
  345. Xtyping effort that I don't feel like doing.  The width and height values are
  346. Xhardcoded into other areas of the program anyways.  I must admit that it
  347. Xwould be interesting to have different brick sizes, but in order to do that,
  348. Xit would also entail changing how the stages are stored  - MSW */
  349. X
  350. X    launchNW_pr = XCreateBitmapFromData(display,win,launchNW_bits, 64,16);
  351. X    launchNW0_pr = XCreateBitmapFromData(display,win,launchNW0_bits, 16,16);
  352. X    launchNE_pr = XCreateBitmapFromData(display,win,launchNE_bits, 64,16);
  353. X    launchNE0_pr = XCreateBitmapFromData(display,win,launchNE0_bits, 16,16);
  354. X    solid_pr =   XCreateBitmapFromData(display,win,solid_bits, 64,16);
  355. X    solid0_pr =  XCreateBitmapFromData(display,win,    solid0_bits, 16,16);
  356. X    clear_pr =   XCreateBitmapFromData(display,win,    clear_bits, 64,16);
  357. X    clear0_pr =  XCreateBitmapFromData(display,win,    clear0_bits, 16,16);
  358. X    brick_1_pr = XCreateBitmapFromData(display,win,    brick_1_bits, 64,16);
  359. X    brick_2_pr = XCreateBitmapFromData(display,win,    brick_2_bits, 64,16);
  360. X    brick_3_pr = XCreateBitmapFromData(display,win,    brick_3_bits, 64,16);
  361. X    brick_4_pr = XCreateBitmapFromData(display,win,    brick_4_bits, 64,16);
  362. X    brick_5_pr = XCreateBitmapFromData(display,win,    brick_5_bits, 64,16);
  363. X    brick_6_pr = XCreateBitmapFromData(display,win,    brick_6_bits, 64,16);
  364. X    brick_7_pr = XCreateBitmapFromData(display,win,    brick_7_bits, 64,16);
  365. X    brick_8_pr = XCreateBitmapFromData(display,win,    brick_8_bits, 64,16);
  366. X    brick_9_pr = XCreateBitmapFromData(display,win,    brick_9_bits, 64,16);
  367. X    brick_A_pr = XCreateBitmapFromData(display,win,    brick_A_bits, 64,16);
  368. X    brick_C_pr = XCreateBitmapFromData(display,win,    brick_C_bits, 64,16);
  369. X    brick_D_pr = XCreateBitmapFromData(display,win,    brick_D_bits, 64,16);
  370. X    brick_E_pr = XCreateBitmapFromData(display,win,    brick_E_bits, 64,16);
  371. X    brick_G_pr = XCreateBitmapFromData(display,win,    brick_G_bits, 64,16);
  372. X    brick_H_pr = XCreateBitmapFromData(display,win,    brick_H_bits, 64,16);
  373. X    brick_L_pr = XCreateBitmapFromData(display,win,    brick_L_bits, 64,16);
  374. X    brick_M_pr = XCreateBitmapFromData(display,win,    brick_M_bits, 64,16);
  375. X    brick_P_pr = XCreateBitmapFromData(display,win,    brick_P_bits, 64,16);
  376. X    brick_R_pr = XCreateBitmapFromData(display,win,    brick_R_bits, 64,16);
  377. X    brick_T_pr = XCreateBitmapFromData(display,win,    brick_T_bits, 64,16);
  378. X    brick_U_pr = XCreateBitmapFromData(display,win,    brick_U_bits, 64,16);
  379. X    brick_W_pr = XCreateBitmapFromData(display,win,    brick_W_bits, 64,16);
  380. X    brick_X_pr = XCreateBitmapFromData(display,win,    brick_X_bits, 64,16);
  381. X
  382. X
  383. X    /* Since everywhere else in the program uses the bitmap structures,
  384. X    the use_alt_bricks only needs to be local to determine which
  385. X    way to initialize the bitmap structures */
  386. X
  387. X    /* See if we should use the alternate bricks */
  388. X    value = XGetDefault(display, "XBlockbuster", "alternate_bricks");
  389. X    if (value) {
  390. X        if (strcasecmp(value,"true")==0) {
  391. X            use_alt_bricks=TRUE;
  392. X        }
  393. X    }
  394. X    /* only use the alternate bricks on a color system */
  395. X    if (use_alt_bricks && has_color) {
  396. X        brick_0_pr = XCreateBitmapFromData(display,win,    brick_0_alt_bits, 64,16);
  397. X        brick_a_pr = XCreateBitmapFromData(display,win,    brick_a_alt_bits, 64,16);
  398. X        brick_b_pr = XCreateBitmapFromData(display,win,    brick_b_alt_bits, 64,16);
  399. X        brick_c_pr = XCreateBitmapFromData(display,win,    brick_c_alt_bits, 64,16);
  400. X        brick_d_pr = XCreateBitmapFromData(display,win,    brick_d_alt_bits, 64,16);
  401. X        brick_e_pr = XCreateBitmapFromData(display,win,    brick_e_alt_bits, 64,16);
  402. X        brick_j_pr = XCreateBitmapFromData(display,win,    brick_j_alt_bits, 64,16);
  403. X        brick_S_pr = XCreateBitmapFromData(display,win,    brick_S_alt_bits, 64,16);
  404. X    }
  405. X    else {
  406. X        brick_0_pr = XCreateBitmapFromData(display,win,    brick_0_bits, 64,16);
  407. X        brick_a_pr = XCreateBitmapFromData(display,win,    brick_a_bits, 64,16);
  408. X        brick_b_pr = XCreateBitmapFromData(display,win,    brick_b_bits, 64,16);
  409. X        brick_c_pr = XCreateBitmapFromData(display,win,    brick_c_bits, 64,16);
  410. X        brick_d_pr = XCreateBitmapFromData(display,win,    brick_d_bits, 64,16);
  411. X        brick_e_pr = XCreateBitmapFromData(display,win,    brick_e_bits, 64,16);
  412. X        brick_j_pr = XCreateBitmapFromData(display,win,    brick_j_bits, 64,16);
  413. X        brick_S_pr = XCreateBitmapFromData(display,win,    brick_S_bits, 64,16);
  414. X    }
  415. X}
  416. X
  417. X
  418. X
  419. X
  420. X/*** address functions ***/
  421. X
  422. XPixmap        brick_addr( row, col )
  423. X    int             row, col;    /* col > 0 && col < MAX_COL */
  424. X{
  425. X    int             tmp = stage[row][col].nhits;
  426. X
  427. X    switch ( stage[row][col].code ) {
  428. X    case ' ':return ( clear_pr );
  429. X    case '#':return ( solid_pr );
  430. X    case '/':return ( launchNE_pr );
  431. X    case '\\':return ( launchNW_pr );
  432. X
  433. X    case '9':if ( !tmp-- )    return ( brick_9_pr );
  434. X    case '8':if ( !tmp-- )    return ( brick_8_pr );
  435. X    case '7':if ( !tmp-- )    return ( brick_7_pr );
  436. X    case '6':if ( !tmp-- )    return ( brick_6_pr );
  437. X    case '5':if ( !tmp-- )    return ( brick_5_pr );
  438. X    case '4':if ( !tmp-- )    return ( brick_4_pr );
  439. X    case '3':if ( !tmp-- )    return ( brick_3_pr );
  440. X    case '2':if ( !tmp-- )    return ( brick_2_pr );
  441. X    case '1':return ( brick_1_pr );
  442. X    case '0':return ( brick_0_pr );
  443. X    case 'a':return ( brick_a_pr );
  444. X    case 'b':return ( brick_b_pr );
  445. X    case 'c':return ( brick_c_pr );
  446. X    case 'd':return ( brick_d_pr );
  447. X    case 'e':return ( brick_e_pr );
  448. X    case 'j':return ( brick_j_pr );
  449. X    case 'A':return ( brick_A_pr );
  450. X    case '^':return ( solid_pr );
  451. X    case 'C':return ( brick_C_pr );
  452. X    case 'D':return ( brick_D_pr );
  453. X    case 'E':return ( brick_E_pr );
  454. X    case 'G':return ( brick_G_pr );
  455. X    case 'H':return ( brick_H_pr );
  456. X    case 'I':return ( clear_pr );
  457. X    case 'L':return ( brick_L_pr );
  458. X    case 'M':return ( brick_M_pr );
  459. X    case 'P':return ( brick_P_pr );
  460. X    case 'R':return ( brick_R_pr );
  461. X    case 'S':return ( brick_S_pr );
  462. X    case 'T':return ( brick_T_pr );
  463. X    case 'U':return ( brick_U_pr );
  464. X    case 'W':return ( brick_W_pr );
  465. X    case '%':return ( solid_pr );
  466. X    case 'X':return ( brick_X_pr );
  467. X
  468. X    default:
  469. X        perror( "Illegal map code" );
  470. X        exit( 1 );
  471. X    }
  472. X}
  473. X
  474. XPixmap        brick_addr0( row, col )
  475. X    int             row, col;    /* col == 0 || col == MAX_COL */
  476. X{
  477. X    switch ( stage[row][col].code ) {
  478. X    case ' ':return ( clear0_pr );
  479. X    case '#':return ( solid0_pr );
  480. X    case '/':return ( launchNE0_pr );
  481. X    case '\\':return ( launchNW0_pr );
  482. X
  483. X    default:
  484. X        perror( "Illegal map code" );
  485. X        exit( 1 );
  486. X    };
  487. X}
  488. X
  489. X
  490. X
  491. Xint        brick_value( row,col )
  492. Xint             row, col;    /* col > 0 && col < MAX_COL */
  493. X{
  494. X
  495. X    switch ( stage[row][col].code ) {
  496. X
  497. X    case '0':return(0);
  498. X    case '1':return(1);
  499. X    case '2':return(2-stage[row][col].nhits);
  500. X    case '3':return(3-stage[row][col].nhits);
  501. X    case '4':return(4-stage[row][col].nhits);
  502. X    case '5':return(5-stage[row][col].nhits);
  503. X    case '6':return(6-stage[row][col].nhits);
  504. X    case '7':return(7-stage[row][col].nhits);
  505. X    case '8':return(8-stage[row][col].nhits);
  506. X    case '9':return(9-stage[row][col].nhits);
  507. X    case ' ':return(10);
  508. X    case '#':return(11);
  509. X    case '/':return(12);
  510. X    case '\\':return(13);
  511. X    case 'a':return(14); 
  512. X    case 'b':return(15);
  513. X    case 'c':return(16);
  514. X    case 'd':return(17);
  515. X    case 'e':return(18);
  516. X    case 'j':return(19);
  517. X    case 'A':return(20);
  518. X    case '^':return(21);
  519. X    case 'C':return(22);
  520. X    case 'D':return(23);
  521. X    case 'E':return(24);
  522. X    case 'G':return(25);
  523. X    case 'H':return(26);
  524. X    case 'I':return(27);
  525. X    case 'L':return(28);
  526. X    case 'M':return(29);
  527. X    case 'P':return(30);
  528. X    case 'R':return(31);
  529. X    case 'S':return(32);
  530. X    case 'T':return(33);
  531. X    case 'U':return(34);
  532. X    case 'W':return(35);
  533. X    case '%':return(36);
  534. X    case 'X':return(37);
  535. X
  536. X    default:
  537. X        perror( "Illegal map code" );
  538. X        exit( 1 );
  539. X    }
  540. X}
  541. X
  542. X
  543. X
  544. X
  545. Xvoid draw_brick( row, col ) 
  546. Xint row, col;
  547. X{
  548. X    if (has_color) {
  549. X        XSetForeground(display, gc_color, brick_color[brick_value(row,col)].fg); 
  550. X        XSetBackground(display, gc_color, brick_color[brick_value(row,col)].bg);
  551. X    }
  552. X    XCopyPlane(display, brick_addr(row,col), win, gc_color, 0, 0, 
  553. X        64, 16, COL_X(col), ROW_Y(row), 1);
  554. X
  555. X}
  556. X
  557. Xvoid draw_brick0( row, col )
  558. Xint row, col;
  559. X{
  560. X    XCopyPlane(display, brick_addr0(row,col), win, gc, 0, 0,
  561. X        16, 16, COL_X(col), ROW_Y(row), 1);
  562. X}
  563. END_OF_FILE
  564. if test 12416 -ne `wc -c <'bricks.c'`; then
  565.     echo shar: \"'bricks.c'\" unpacked with wrong size!
  566. fi
  567. # end of 'bricks.c'
  568. fi
  569. if test -f 'xblockbuster.c' -a "${1}" != "-c" ; then 
  570.   echo shar: Will not clobber existing file \"'xblockbuster.c'\"
  571. else
  572. echo shar: Extracting \"'xblockbuster.c'\" \(9125 characters\)
  573. sed "s/^X//" >'xblockbuster.c' <<'END_OF_FILE'
  574. X/*
  575. X * Xblockbuster should run on any X11 system (bw or color) - MSW
  576. X *
  577. X *****************************************************************************
  578. X * Appearance ONLY shamelessly stolen from the real video game,
  579. X * wonderfully written by someone somewhere (I haven't got the foggiest).
  580. X *
  581. X * Move mouse to move pallet and keep the ball on the stage.
  582. X *
  583. X * Stages are built from various building blocks, some of which are based on
  584. X * recollection from analogous blocks in the video game, others, in particular
  585. X * the interesting ones, are new.
  586. X *
  587. X * The stages can be defined from the ascii map codes using any text editor.
  588. X * They must be numbered consecutively from 0 with the total number
  589. X * (i.e., one more than the highest number) available in the file nb_stages.
  590. X *
  591. X * -- Eric Van Gestel (ericvg@cs.kuleuven.ac.be)
  592. X */
  593. X
  594. X#include "xblockbuster.h"
  595. X#include <sys/dir.h>
  596. X#include <sys/stat.h>
  597. X#include <signal.h>
  598. X
  599. X#include "icons/blockbuster.icon"
  600. X#include "patchlevel.h"
  601. X
  602. Xint timer_active=FALSE,    /* has the user started the ball? */
  603. Xwindow_active=FALSE;    /* is the pointer in the window? */
  604. X
  605. X
  606. X
  607. Xvoid event_handler()
  608. X{
  609. X    XEvent    e;
  610. X    int    row,col,sleeptime;
  611. X    double    old_pallet_y;
  612. X    char    keystr[2],str[10];
  613. X    struct    timeval    tp,oldtp;
  614. X    struct     timezone tzp;
  615. X
  616. X    gettimeofday(&oldtp,&tzp);
  617. X    draw_pallet();
  618. X    while(1) {
  619. X    /* timer function to keep things moving at a constant speed.
  620. X    We read time before servicing events so that the amount of time
  621. X    it takes to perform the event should not slow down/speed up
  622. X    the game.  Note that other factors may control speed of the
  623. X    game (such as available cpu).  Even on my unloaded sun 3/60, I
  624. X    notice that many times that sleeptime was negative, even though
  625. X    the program uses less than 20% of the cpu time- MSW*/
  626. X
  627. X    gettimeofday(&tp, &tzp);
  628. X    sleeptime = ITIMER_DELAY - ((tp.tv_sec - oldtp.tv_sec)*1000000 +
  629. X            (tp.tv_usec - oldtp.tv_usec));
  630. X    if (sleeptime>0)
  631. X        usleep(sleeptime);
  632. X
  633. X    gettimeofday(&oldtp,&tzp);
  634. X
  635. X    if (timer_active && window_active) move_balls();
  636. X
  637. X    /* Event handling (if any events need to be handled) - MSW */
  638. X    if (XPending(display)) {
  639. X        XNextEvent(display, &e);
  640. X        switch (e.type) {
  641. X        case ButtonPress:
  642. X            switch (e.xbutton.button) {
  643. X            case Button3: /* right mouse button */
  644. X                /* Clear message area */
  645. X                XFillRectangle(display, win, gc_erase,
  646. X                0,0,STAGE_WIDTH_IN_PIXELS, MSG_HEIGHT);
  647. X                /* redo messages */
  648. X                XDrawImageString(display, win, gc,
  649. X                OFFSET_SPEED, font_height*2, stage_name,
  650. X                strlen(stage_name));
  651. X                if (score_incr>1) {
  652. X                 sprintf(str,"Bonus x%d",score_incr);
  653. X                XDrawImageString(display, win, gc,
  654. X                    OFFSET_SCORE, font_height*2, str, 
  655. X                    strlen(str));
  656. X                }
  657. X                print_balls();
  658. X                print_score();
  659. X                show_speeds();
  660. X                timer_active=TRUE;
  661. X                move_balls();
  662. X                break;
  663. X
  664. X            case Button2:
  665. X                draw_pallet(); /* erase old */
  666. X                pallet_y = (double) (pallet_yI = PALLET_MAX_Y+4);
  667. X                pallet_row = MAX_ROW - 1;
  668. X                draw_pallet(); /* draw new */
  669. X                break;
  670. X
  671. X            case Button1:
  672. X                draw_pallet(); /* erase old */
  673. X                if (pallet_yI > PALLET_MIN_Y) {
  674. X                    old_pallet_y = pallet_y;
  675. X                    pallet_y = (double) (pallet_yI -=16);
  676. X                    pallet_row--;
  677. X
  678. X                    /* See if the ball could have been
  679. X                    deflected as the pallete moved
  680. X                    upwards */
  681. X                    check_deflections(old_pallet_y);
  682. X                }
  683. X                draw_pallet(); /* draw new */
  684. X                break;
  685. X            }
  686. X        break;
  687. X
  688. X        case KeyPress:
  689. X            XLookupString((XKeyEvent*) &e,keystr,2, NULL, NULL);
  690. X            if (keystr[0]==27) {    /* Escape to save */
  691. X                if (!ball1.quadrant && !ball2.quadrant &&
  692. X                    !ball3.quadrant && last_busted_brick==NULL) {
  693. X                    XDrawImageString(display, win, gc,
  694. X                    OFFSET_BALLS, font_height,
  695. X                    "Saving...             ",
  696. X                    23);
  697. X                    save();
  698. X                    }
  699. X                else
  700. X                    XDrawImageString(display, win, gc,
  701. X                    OFFSET_BALLS, font_height,
  702. X                    "Not Saved...          ",
  703. X                    23);
  704. X            }
  705. X        break;
  706. X
  707. X        case MotionNotify:
  708. X            draw_pallet();    /* erase old pallet */
  709. X            pallet_x = (double) (pallet_xI =e.xmotion.x);
  710. X            mouse_yI = e.xmotion.y;
  711. X            draw_pallet();    /* draw new one */
  712. X            break;
  713. X
  714. X        case EnterNotify:
  715. X            window_active = TRUE;
  716. X            break;
  717. X
  718. X        case LeaveNotify:
  719. X            window_active = FALSE;
  720. X            break;
  721. X
  722. X        case Expose:
  723. X            /* redraw the stage */
  724. X
  725. X            for ( row = 0; row <= MAX_ROW; row++ ) {
  726. X                        draw_brick0( row, 0 );
  727. X                        for ( col = 1; col < MAX_COL; col++ )
  728. X                                draw_brick( row, col );
  729. X                        draw_brick0( row, MAX_COL );
  730. X            }
  731. X            draw_pallet();
  732. X            break;
  733. X
  734. X        default:
  735. X            printf("unknown event: %d\n",e.type);
  736. X            break;
  737. X        }
  738. X    }
  739. X    }
  740. X}
  741. X
  742. X
  743. Xvoid get_playground( argc, argv )
  744. Xint argc;
  745. Xchar *argv[];
  746. X{
  747. X    DIR        *dirp;
  748. X    struct direct    *dp;
  749. X    struct stat    st;
  750. X    int        len, found;
  751. X
  752. X    /* set default playground directory */
  753. X    strcpy( playground, STAGEDIR );
  754. X    strcat( playground, "/" );
  755. X    /* check for additional arguments (specific playground) */
  756. X    if ( argc > 1 ) {
  757. X        if ( argv[1][0] == '-' ) {
  758. X            /* list available playgrounds */
  759. X            printf( "available playgrounds are:\n" );
  760. X            printf( "\tdefault\n" );
  761. X            dirp = opendir(STAGEDIR);
  762. X            for( dp=readdir( dirp ); dp!=NULL; dp=readdir( dirp ) ) {
  763. X                if ( !strncmp( dp->d_name, "STAGES.", 7 ) )
  764. X                    printf( "\t%s\n", (dp->d_name)+7 );
  765. X            }
  766. X            closedir( dirp );
  767. X            exit( 0 );
  768. X        }
  769. X        /* it's a playground name or private directory */
  770. X        if( !strcmp( argv[1], "default" ) ) {
  771. X            /* just in case someone used default */
  772. X            strcat( playground, "STAGES" );
  773. X            return;
  774. X        }
  775. X        found = 0;
  776. X        len = strlen( argv[1] );
  777. X        dirp = opendir( STAGEDIR );
  778. X        for( dp=readdir( dirp ); dp!=NULL; dp=readdir( dirp ) ) {
  779. X            if ( dp->d_namlen == len+7 &&
  780. X                 !strcmp( (dp->d_name)+7, argv[1] ) ) {
  781. X                found++;
  782. X                break;
  783. X            }
  784. X        }
  785. X        closedir( dirp );
  786. X        if ( found )
  787. X            strcat( playground, dp->d_name );
  788. X        else {
  789. X            /* private dir */
  790. X            strcpy( playground, argv[1] );
  791. X            stat( playground, &st );
  792. X            if( !(st.st_mode & S_IFDIR) ) {
  793. X                printf( "private playground <%s> not a directory.\n",
  794. X                    playground );
  795. X                exit( 1 );
  796. X            }
  797. X        }
  798. X    } else {
  799. X        strcat( playground, "STAGES" );
  800. X    }
  801. X}
  802. X                
  803. X
  804. X/*** xblockbuster ***/
  805. Xvoid main( argc, argv )
  806. X    int             argc;
  807. X    char           *argv[];
  808. X
  809. X{
  810. X    XGCValues    xgcvalues;
  811. X    Pixmap        icon_image;
  812. X    XSizeHints    size_hints;
  813. X    XWMHints    wm_hints;
  814. X    XClassHint    class_hints;
  815. X
  816. X    /* who am i ? ['cuserid(3S)' is fooled by 'su(1)'] */
  817. X    login = getpwuid( getuid(  ) )->pw_name;
  818. X
  819. X    if ((display=XOpenDisplay(NULL))==NULL) {
  820. X        fprintf(stderr, "Unable to open display: %s\n",
  821. X            XDisplayName(NULL));
  822. X        exit(1);
  823. X    }
  824. X
  825. X    screen_num = DefaultScreen(display);
  826. X    win = XCreateSimpleWindow(display, RootWindow(display, screen_num),
  827. X        0, 0, STAGE_WIDTH_IN_PIXELS, STAGE_HEIGHT_IN_PIXELS,
  828. X        0, 2, WhitePixel(display, screen_num));
  829. X
  830. X
  831. X    XSelectInput(display, win, ExposureMask | ButtonPressMask |
  832. X        LeaveWindowMask | EnterWindowMask | KeyPressMask |
  833. X        PointerMotionMask);
  834. X
  835. X
  836. X    if ((font_info = XLoadQueryFont(display, FONT))==NULL) {
  837. X        fprintf(stderr,"Unable to load font %s\n",FONT);
  838. X        exit(1);
  839. X    }
  840. X    font_width= font_info->max_bounds.rbearing - font_info->min_bounds.lbearing;
  841. X    font_height=font_info->max_bounds.ascent + font_info->max_bounds.descent +1;
  842. X
  843. X
  844. X    xgcvalues.foreground = BlackPixel(display, screen_num);
  845. X    xgcvalues.background = WhitePixel(display, screen_num);
  846. X    xgcvalues.graphics_exposures = False;
  847. X    xgcvalues.font = font_info->fid;
  848. X
  849. X    /* create the various graphic contexts we need. gc and gc_color
  850. X    differ only in the we only change the colors on the gc_color context,
  851. X    and thus, it is only used for brick drawing.  gc_color really has no
  852. X    use on a black & white system */
  853. X
  854. X    gc = XCreateGC(display, win, GCFont | 
  855. X        GCForeground | GCBackground | GCGraphicsExposures, &xgcvalues);
  856. X    gc_color = XCreateGC(display, win, GCFont | 
  857. X        GCForeground | GCBackground | GCGraphicsExposures, &xgcvalues);
  858. X
  859. X    xgcvalues.function = GXclear;
  860. X    gc_erase = XCreateGC(display, win, GCForeground | GCBackground |
  861. X        GCFont | GCGraphicsExposures | GCFunction, &xgcvalues);
  862. X
  863. X    xgcvalues.function = GXxor;    /* Exclusive or */
  864. X
  865. X    gc_xor = XCreateGC(display, win, GCForeground | GCBackground |
  866. X        GCFont | GCGraphicsExposures | GCFunction, &xgcvalues);
  867. X
  868. X
  869. X    /* Create our icon for when the window is closed */
  870. X
  871. X    if  (!(icon_image = XCreateBitmapFromData(display, win,
  872. X        blockbuster_bits,blockbuster_width, blockbuster_height)))
  873. X    {
  874. X        fprintf(stderr, "Can't create icon pixmap\n");
  875. X        exit (1);
  876. X    }
  877. X
  878. X    size_hints.flags = PMinSize;
  879. X    size_hints.x = 0;
  880. X    size_hints.y = 0;
  881. X    size_hints.height = STAGE_HEIGHT_IN_PIXELS;
  882. X    size_hints.min_height = STAGE_HEIGHT_IN_PIXELS;
  883. X    size_hints.width = STAGE_WIDTH_IN_PIXELS;
  884. X    size_hints.min_width = STAGE_WIDTH_IN_PIXELS;
  885. X
  886. X    wm_hints.flags = InputHint | IconPixmapHint;
  887. X    wm_hints.input = True;
  888. X    wm_hints.icon_pixmap = icon_image;
  889. X
  890. X    class_hints.res_name = "XBlockbuster";
  891. X    class_hints.res_class =  "XBlockbuster";
  892. X
  893. X    XmbSetWMProperties(display, win, VERSION , VERSION,
  894. X        argv,argc, &size_hints, &wm_hints, &class_hints);
  895. X
  896. X
  897. X    XMapWindow(display, win);
  898. X    /* initialize random (used to determine next stage_nb) */
  899. X    srandom( time( 0 ) );
  900. X
  901. X    get_playground( argc, argv );
  902. X
  903. X    /* and off we go */
  904. X    bricks_init();
  905. X    ball_init();
  906. X    start_up(  );
  907. X    ball1.quadrant = ball2.quadrant = ball3.quadrant = 0;
  908. X
  909. X    event_handler();
  910. X
  911. X
  912. X}
  913. END_OF_FILE
  914. if test 9125 -ne `wc -c <'xblockbuster.c'`; then
  915.     echo shar: \"'xblockbuster.c'\" unpacked with wrong size!
  916. fi
  917. # end of 'xblockbuster.c'
  918. fi
  919. if test -f 'xblockbuster.man' -a "${1}" != "-c" ; then 
  920.   echo shar: Will not clobber existing file \"'xblockbuster.man'\"
  921. else
  922. echo shar: Extracting \"'xblockbuster.man'\" \(8915 characters\)
  923. sed "s/^X//" >'xblockbuster.man' <<'END_OF_FILE'
  924. X.TH XBLOCKBUSTER 6 "16 November 1992"
  925. X.br
  926. X.SH NAME
  927. Xxblockbuster \- game
  928. X.SH SYNOPSIS
  929. X.B xblockbuster
  930. X.I [play_ground]
  931. X.SH DESCRIPTION
  932. XThe play ground is either the anonymous public play ground (no argument),
  933. Xa named public playground or a privately owned directory.
  934. XThe list of available named public play grounds is obtained by giving "-"
  935. Xas the play ground argument.
  936. X.LP
  937. XThe object of the game is to collect as many points as possible by
  938. X.I busting
  939. Xthrough
  940. X.I blocks
  941. Xof various types with a ball that reflects from the blocks and from a pallet
  942. Xcontrolled by mouse movement.
  943. X.LP
  944. XThe ball must be seen as a high-energy particle that penetrates the block
  945. Xbefore being repelled.
  946. XIf it gets repelled into another block it will find its own way out again.
  947. XThis process, which often leads to surprises, is known as
  948. X.I tunnelling.
  949. X.br
  950. X(By design, tunnelling only occurs along a horizontal connection between blocks
  951. Xor along the vertical sides, so never vertically between blocks.)
  952. X.LP
  953. XAs the game progresses, balls are launched faster and faster.
  954. XWhen the speed has reached it maximum, the pallet is gradually,
  955. Xthough cumulatively, shrunk.
  956. XBe aware that the maximum launch speed (see below),
  957. Xand hence the point from which the pallet is shrunk,
  958. Xis only 2/3 of the speed limit, and the effect is much larger than that of
  959. Xhitting a speeder (but of course you may hit them often).
  960. X.LP
  961. XThe pallet is convex.
  962. XHence reflection is a function of both the incoming angle and the excentricity
  963. Xof the point of impact.
  964. XIf the pallet is sufficiently convex (differs from stage to stage), the ball
  965. Xmay even rebound.
  966. X.LP
  967. XThe mouse buttons control the pallet:
  968. XLEFT moves it up one row, MIDDLE moves it all the way down again.
  969. XEach ball is launched with the RIGHT mouse button.
  970. X.LP
  971. XA stage can be halted by closing the window, or moving the pointer out
  972. Xof the window.
  973. XBe advised however, that the game will resume immediately upon opening the
  974. Xwindow.
  975. X.LP
  976. XDuring a game, the score, number of balls left and speeds are shown.
  977. XThe speeds are represented by up to 3 thin lines (one for each ball),
  978. Xabove a thick line representing the speed limit.
  979. XThe short vertical bar indicates the launch speed
  980. X(black upon reaching the maximum launch speed, white below that).
  981. XIf, during a stage, you have busted a 'double' or 'triple' brick, your
  982. Xbonus multiplier will also be displayed at the top.
  983. X.LP
  984. XA game can be saved in between stages with the Escape key.
  985. XAt this point, as well as at the end of the game, your score is logged.
  986. XThe score board shows scores, number of balls left between parentheses if any
  987. Xand user name.
  988. XFinally, an indication of your current pallet shrinkage is given.
  989. X.SH NOTES
  990. X.LP
  991. XIn order to avoid infinite loops
  992. X(i.e., the ball(s) never reflecting from the pallet),
  993. Xa ball will, upon hitting too many solid bricks,
  994. Xundergo a horizontal shift,
  995. Xproportional to, but opposite to the current horizontal speed.
  996. X.LP
  997. XThe score board imposes a maximum on the number of entries for any given user
  998. Xname.
  999. XIf your current score didn't make it onto the score board,
  1000. Xit will be displayed at the bottom.
  1001. X.LP
  1002. XIf a score entry is detected which obviously must have originated from a saved
  1003. Xgame which for some reason "died", a `+' is appended and the entry will hence
  1004. Xforward be treated as any completed game.
  1005. X.LP
  1006. XA common problem players encounter is that of losing track of their mouse.
  1007. XBe advised that mouse movement only alters the horizontal pallet position,
  1008. Xbut the mouse of course may move vertically as well.
  1009. XIf your mouse is not neatly perpendicular to the reflection plate, you may
  1010. Xfind yourself outside the window, halting play.
  1011. XFor this reason the horizontal crosshair is shown at the window border,
  1012. Xhelping you to keep track of the mouse.
  1013. X.SH "CREATION OF PLAY GROUNDS"
  1014. XA private play ground can be created in any directory.
  1015. XThe stages can be defined from the ascii map codes using any text editor
  1016. XThey must be numbered consecutively from 0 with the total number
  1017. X(i.e., one more than the highest number) available in the file nb_stages.
  1018. XFurthermore a directory 'save' and an empty file 'scores' must be created.
  1019. X.LP
  1020. XIndividual stages can be tried in the public play ground "try" (q.v. 'try'),
  1021. Xprovided you have write access.
  1022. X.SH "TYPES OF BLOCKS"
  1023. X.sp
  1024. X.nf
  1025. X.na
  1026. XCODE\h'|7m'NAME\h'|24m'REPRESENTATION
  1027. X.sp
  1028. X\&' ' \h'|7m'clear space\h'|24m'white
  1029. X#\h'|7m'solid wall\h'|24m'black
  1030. X/,\\\h'|7m'launchpad\h'|24m'black with arrow (like solid wall)
  1031. X  The balls enters the stage diagonally at the tip of the arrow.
  1032. X.SS BRICKS
  1033. X.sp
  1034. X0\h'|7m'solid brick\h'|24m'75% gray
  1035. X  Scores 1 on each hit.
  1036. X.sp
  1037. X1-9\h'|7m'hit bricks\h'|24m'white with border (and slanted bars)
  1038. X  Requires as many hits as their are bars (plus 1),
  1039. X  each scoring equal to how often you have hit it.
  1040. X  The stage is over when no such bricks remain.
  1041. X.sp
  1042. Xa-e,j\h'|7m'bonus bricks\h'|24m'50% gray with value inscribed
  1043. X  Requires value/10+1 hits before scoring.
  1044. X.SS MAGIC
  1045. X.sp
  1046. XA\h'|7m'absorber\h'|24m'25% gray (no border)
  1047. X^\h'|7m'emitter\h'|24m'black (like solid wall)
  1048. X  The ball is absorbed and emitted (whilst being reflected).
  1049. X.sp
  1050. XC\h'|7m'clipper\h'|24m'pair of scissors between "> <"
  1051. X  (On 2nd hit) Clips 10% off the pallet.
  1052. X  By design, the remnants litter the screen!
  1053. X  [Until the end of the current stage only.]
  1054. X.sp
  1055. XD\h'|7m'double\h'|24m'"double"
  1056. X  (On 2nd hit) Doubles all subsequent hit values.
  1057. X  [Until the end of the current stage only.]
  1058. X.sp
  1059. XE\h'|7m'extra ball\h'|24m'"+O+"
  1060. X  (On 2nd hit) Adds an extra ball to the stock.
  1061. X.sp
  1062. XG\h'|7m'gap\h'|24m'the danger sign (! in a triangle)
  1063. X  (On 2nd hit) The ball is lost.
  1064. X  [As if it would have left the stage.]
  1065. X.sp
  1066. XH\h'|7m'halt\h'|24m'maze of small squares
  1067. X  Successively takes 10, 20 and 30% of the speed.
  1068. X.sp
  1069. XI\h'|7m'invisible brick\h'|24m'white (like open space)
  1070. X  Turns into a single hit brick when first hit, scoring 1.
  1071. X.sp
  1072. XL\h'|7m'launch ball\h'|24m'"=O="
  1073. X  (On 2nd hit) Launches an extra ball.
  1074. X  [Behaves like an 'extra ball' from 3 balls in game.]
  1075. X.sp
  1076. XM\h'|7m'mine\h'|24m'"kaboom" in dashed border
  1077. X  (On 3rd hit) Blows up all adjacent bricks (no score);
  1078. X  leaving debris 'refractor's.
  1079. X.sp
  1080. XP\h'|7m'pause\h'|24m'maze of small squares with launchpad images.
  1081. X  (On 8th hit) Takes 30% of the excessive launch speed.
  1082. X.sp
  1083. XR\h'|7m'refractor\h'|24m'dashed border with crosses
  1084. X  Interchanges motion along the axes.
  1085. X.sp
  1086. XS\h'|7m'speeder\h'|24m'concentric borders
  1087. X  Adds speed (up to the speed limit; then pallet shrinkage).
  1088. X.sp
  1089. XT\h'|7m'triple\h'|24m'"triple"
  1090. X  (On 3rd hit) Triples all subsequent hit values.
  1091. X  [Until the end of the current stage only.]
  1092. X.sp
  1093. XU\h'|7m'undo\h'|24m'"undo"
  1094. X  Restores the last block busted (with 0 hit count).
  1095. X.sp
  1096. XW\h'|7m'open window\h'|24m'bracketed set of vertical lines
  1097. X%\h'|7m'closed window\h'|24m'black (like solid wall)
  1098. X  Alternates between the two states upon each hit.
  1099. X.sp
  1100. XX\h'|7m'expander\h'|24m'a pallet image between "< >"
  1101. X  (On 4th hit) Expands the pallet.
  1102. X  [Equivalent to twice the full launch speed shrinkage.]
  1103. X  [Effective in the next stage only.]
  1104. X
  1105. X.fi
  1106. X.ad
  1107. X.SH X Defaults
  1108. X.LP
  1109. XThe resource name
  1110. X.I XBlockbuster
  1111. Xcan be used to control the color the bricks to be displayed.  Each brick
  1112. Xhas both a foreground and background color that can be displayed.  The
  1113. Xformat is brick\fIcode\fP_fg or brick\fIcode\fP_bg.
  1114. X.I code
  1115. Xrepresents the brick code, as detailed above.  Therefore a line such
  1116. Xas:
  1117. X.LP
  1118. XXBlockbuster.brick0_fg:        green
  1119. X
  1120. XMakes the foreground color of the solid brick green.
  1121. X.LP
  1122. XIn addition, the resource \fIalternate_bricks\fP
  1123. Xexists.  If selected,  alternate brick patterns will be used on color displays.
  1124. XThe alternate bricks tend to take coloring better than the standard bricks.
  1125. XIf you want to use alternate bricks, add the line:
  1126. X
  1127. XXBlockbuster.alternate_bricks:  True
  1128. X
  1129. Xto your .Xdefaults file.
  1130. X.LP
  1131. XThe coloring information and alternate brick request is ignored on
  1132. Xblack and white systems.
  1133. X
  1134. X
  1135. X.SH FILES
  1136. X.nf
  1137. X.na
  1138. Xstagemm\h'|30m'[optional] bookkeeping program
  1139. X
  1140. XThe location of the following is installation depedent.
  1141. Xstage.skel\h'|30m'skeleton stage
  1142. XSTAGES.\h'|30m'anonymous public play ground
  1143. XSTAGES.*\h'|30m'named public play grounds
  1144. X\h'|30m'(including a try out environment)
  1145. XXBlockbuster.ad\h'|30m'Sample Xdefaults for xblockbuster.
  1146. X.fi
  1147. X.ad
  1148. X
  1149. X.SH BUGS
  1150. XWhen two balls hit the same brick simultaneously,
  1151. Xone may leave a shadow on the stage.
  1152. X.LP
  1153. XSometimes a ball image is left when the window is re-opened.
  1154. X.LP
  1155. XIf the ball hits the bottom corners of the playing area, they will at times
  1156. Xreflect back in a reverse direction, instead of reflecting downward and
  1157. Xout of bounds.
  1158. X.LP
  1159. XXBlockbuster uses a public colormap for systems which use color.  If it is
  1160. Xunable to get all the colors it wants, it will use black and white for
  1161. Xthe bricks it was unable to color.  If using alternate bricks, it can be
  1162. Xdifficult to differentiate bricks without the coloring.
  1163. X.LP
  1164. XNone of the standard command line X arguements are interperted.  Likewise,
  1165. Xnone of the standard X defaults (in the .Xdefaults file) are used.
  1166. END_OF_FILE
  1167. if test 8915 -ne `wc -c <'xblockbuster.man'`; then
  1168.     echo shar: \"'xblockbuster.man'\" unpacked with wrong size!
  1169. fi
  1170. # end of 'xblockbuster.man'
  1171. fi
  1172. echo shar: End of archive 4 \(of 5\).
  1173. cp /dev/null ark4isdone
  1174. MISSING=""
  1175. for I in 1 2 3 4 5 ; do
  1176.     if test ! -f ark${I}isdone ; then
  1177.     MISSING="${MISSING} ${I}"
  1178.     fi
  1179. done
  1180. if test "${MISSING}" = "" ; then
  1181.     echo You have unpacked all 5 archives.
  1182.     rm -f ark[1-9]isdone
  1183. else
  1184.     echo You still need to unpack the following archives:
  1185.     echo "        " ${MISSING}
  1186. fi
  1187. ##  End of shell archive.
  1188. exit 0
  1189.  
  1190.  
  1191. exit 0 # Just in case...
  1192. -- 
  1193.   // chris@IMD.Sterling.COM            | Send comp.sources.x submissions to:
  1194. \X/  Amiga - The only way to fly!      |
  1195.  "It's intuitively obvious to the most |    sources-x@imd.sterling.com
  1196.   casual observer..."                  |
  1197.