home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume18 / xboing / part21 < prev    next >
Encoding:
Internet Message Format  |  1993-09-13  |  59.4 KB

  1. Path: uunet!news.tek.com!news.cna.tek.com!not-for-mail
  2. From: billr@saab.cna.tek.com (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v18i080:  xboing - blockout variant with color and sound for X, Part21/30
  5. Date: 30 Aug 1993 10:29:01 -0700
  6. Organization: Tektronix, Inc., Redmond, OR
  7. Lines: 1697
  8. Approved: billr@saab.CNA.TEK.COM
  9. Message-ID: <25tdct$i1r@saab.cna.tek.com>
  10. NNTP-Posting-Host: saab.cna.tek.com
  11. Xref: uunet comp.sources.games:1880
  12.  
  13. Submitted-by: jck@kimba.catt.citri.edu.au (Justin Kibell)
  14. Posting-number: Volume 18, Issue 80
  15. Archive-name: xboing/part21
  16. Environment: X11, Xlib, XPM
  17.  
  18.  
  19.  
  20. #! /bin/sh
  21. # This is a shell archive.  Remove anything before this line, then unpack
  22. # it by saving it into a file and typing "sh file".  To overwrite existing
  23. # files, type "sh file -c".  You can also feed this as standard input via
  24. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  25. # will see the following message at the end:
  26. #        "End of archive 21 (of 30)."
  27. # Contents:  audio/RPLAYaudio.c bitmaps/kibell.xpm.uu level.c score.c
  28. #   xboing.man
  29. # Wrapped by billr@saab on Mon Aug 30 09:14:28 1993
  30. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  31. if test -f 'audio/RPLAYaudio.c' -a "${1}" != "-c" ; then 
  32.   echo shar: Will not clobber existing file \"'audio/RPLAYaudio.c'\"
  33. else
  34. echo shar: Extracting \"'audio/RPLAYaudio.c'\" \(3549 characters\)
  35. sed "s/^X//" >'audio/RPLAYaudio.c' <<'END_OF_FILE'
  36. X#include "include/copyright.h"
  37. X
  38. X/* RPLAYaudio.c - Use rplay to play sounds over network. Original source by
  39. X *                Joel J. Fleck II - <joel@cc.bellcore.com> 
  40. X *                 - I haven't the time to test this code. Should work though.
  41. X */
  42. X
  43. X/*
  44. X *  Include file dependencies:
  45. X */
  46. X
  47. X#include <stdio.h>
  48. X#include <fcntl.h>
  49. X#include <stdlib.h>
  50. X#include <stddef.h>
  51. X#include <ctype.h>
  52. X#include <errno.h>
  53. X#include <sys/stat.h>
  54. X#include <sys/fcntl.h>
  55. X
  56. X#include <rplay.h>
  57. X
  58. X#include "include/error.h"
  59. X#include "include/main.h"
  60. X#include "include/audio.h"
  61. X
  62. X/*
  63. X *  Internal macro definitions:
  64. X */
  65. X
  66. X/*
  67. X *  Internal type declarations:
  68. X */
  69. X
  70. X/*
  71. X *  Internal variable declarations:
  72. X */
  73. X
  74. Xstatic RPLAY       *rp;
  75. Xstatic int         rplay_fd;
  76. Xstatic char     errorString[255];
  77. X
  78. X#if NeedFunctionPrototypes
  79. Xint SetUpAudioSystem(Display *display)
  80. X#else
  81. Xint SetUpAudioSystem(display)
  82. X    Display *display;
  83. X#endif
  84. X{
  85. X    char hostname[256];
  86. X       char display_machine[256];
  87. X    char *displayname = XDisplayString(display);
  88. X
  89. X    /* Obtain the systems hostname */
  90. X    gethostname(hostname, 256);
  91. X
  92. X    if (strncmp(hostname, displayname, strlen(hostname)) != 0) 
  93. X    {
  94. X        /* Obtain the server name etc for rplay */
  95. X        strncpy(display_machine, displayname, strcspn(displayname,":"));
  96. X
  97. X        /* Connect to the rplay sound server */
  98. X        rplay_fd = rplay_open(display_machine);
  99. X    } 
  100. X    else 
  101. X    {
  102. X        /* Connect to the rplay sound server */
  103. X        rplay_fd = rplay_open("localhost");
  104. X    }
  105. X
  106. X    if ( rplay_fd == -1 ) 
  107. X    {
  108. X        /* Error while trying to connect to rplay sound server */
  109. X        rplay_perror("SetUpAudioSystem()");
  110. X        ErrorMessage("Error: Cannot connect to rplay sound server.");
  111. X        return False;
  112. X    } 
  113. X    else 
  114. X        return True;
  115. X}
  116. X
  117. X#if NeedFunctionPrototypes
  118. Xvoid FreeAudioSystem(void)
  119. X#else
  120. Xvoid FreeAudioSystem()
  121. X#endif
  122. X{
  123. X    /* Close the rplay sound server */
  124. X    rplay_close(rplay_fd);
  125. X    rplay_destroy(rp);
  126. X}
  127. X
  128. X#if NeedFunctionPrototypes
  129. Xstatic void flushAudioDevice(void)
  130. X#else
  131. Xstatic void flushAudioDevice()
  132. X#endif
  133. X{
  134. X    /* This is done when the sound is sent by setting the priority to highest
  135. X     * for every sound - I hope this works. JCK
  136. X     */
  137. X}
  138. X
  139. X#if NeedFunctionPrototypes
  140. Xvoid setNewVolume(unsigned int Volume)
  141. X#else
  142. Xvoid setNewVolume(Volume)
  143. X    unsigned int Volume;
  144. X#endif
  145. X{
  146. X    /* How do you do thism with rplay? */
  147. X}
  148. X
  149. X#if NeedFunctionPrototypes
  150. Xvoid audioDeviceEvents(void)
  151. X#else
  152. Xvoid audioDeviceEvents()
  153. X#endif
  154. X{
  155. X    /* None to do */
  156. X}
  157. X
  158. X#if NeedFunctionPrototypes
  159. Xvoid playSoundFile(char *filename, int volume)
  160. X#else
  161. Xvoid playSoundFile(filename, volume)
  162. X    char *filename;
  163. X    int volume;
  164. X#endif
  165. X{
  166. X    char soundfile[1024];
  167. X    char *str;
  168. X
  169. X    /* Clear any active audio for the new sound */
  170. X    flushAudioDevice();
  171. X
  172. X    /* Construct the sounds file path and use env var if exists */
  173. X    if ((str = getenv("XBOING_SOUND_DIR")) != NULL)
  174. X        sprintf(soundfile, "%s/%s.au", str, filename);
  175. X    else
  176. X        sprintf(soundfile, "%s/%s.au", SOUNDS_DIR, filename);
  177. X
  178. X    /* Create a connection to rplay server */
  179. X    if ((rp = rplay_create(RPLAY_PLAY)) == NULL) 
  180. X    {
  181. X        /* Cannot play sound for some reason */
  182. X        rplay_perror("playSoundFile()");
  183. X        ErrorMessage(errorString);
  184. X    } 
  185. X    else 
  186. X    {
  187. X        /* Volume for rplay is 1 to 255 instead of 1 to 100 */
  188. X        volume += 50;
  189. X
  190. X        /* Setup the sound for rplay */
  191. X        rplay_set(rp, RPLAY_APPEND, RPLAY_SOUND, soundfile, RPLAY_VOLUME, 
  192. X            volume, RPLAY_PRIORITY, 255, NULL);
  193. X
  194. X        /* Send the rplay packet */
  195. X        rplay(rplay_fd, rp);
  196. X    }
  197. X}
  198. X
  199. X#if NeedFunctionPrototypes
  200. Xvoid SetMaximumVolume(int Volume)
  201. X#else
  202. Xvoid SetMaximumVolume(Volume)
  203. X    int Volume;
  204. X#endif
  205. X{
  206. X}
  207. END_OF_FILE
  208. if test 3549 -ne `wc -c <'audio/RPLAYaudio.c'`; then
  209.     echo shar: \"'audio/RPLAYaudio.c'\" unpacked with wrong size!
  210. fi
  211. # end of 'audio/RPLAYaudio.c'
  212. fi
  213. if test -f 'bitmaps/kibell.xpm.uu' -a "${1}" != "-c" ; then 
  214.   echo shar: Will not clobber existing file \"'bitmaps/kibell.xpm.uu'\"
  215. else
  216. echo shar: Extracting \"'bitmaps/kibell.xpm.uu'\" \(15119 characters\)
  217. sed "s/^X//" >'bitmaps/kibell.xpm.uu' <<'END_OF_FILE'
  218. Xbegin 644 kibell.xpm
  219. XM+RH@6%!-("HO"G-T871I8R!C:&%R("H@:VEB96QL7WAP;5M=(#T@>PHB,C8P
  220. XM(#0P(#$V(#$B+`HB(`ES($YO;F4)8R!.;VYE(BP*(BX)8R`C1C!&,$8P1C!&
  221. XM,$8P(BP*(E@)8R`C13!%,$4P13!&,$8P(BP*(F\)8R`C1#!$,$0P1#!&,$8P
  222. XM(BP*(D\)8R`C0S!#,$,P0S!&,$8P(BP*(BL)8R`C0C!",$(P0C!&,$8P(BP*
  223. XM(D`)8R`C03!!,$$P03!&,$8P(BP*(B,)8R`C.3`Y,#DP.3!&,$8P(BP*(B0)
  224. XM8R`C.#`X,#@P.#!&,$8P(BP*(B4)8R`C-C`V,#<P-S!&,$8P(BP*(B8)8R`C
  225. XM-3`U,#8P-C!&,$8P(BP*(BH)8R`C-#`T,#4P-3!&,$8P(BP*(CT)8R`C,S`S
  226. XM,#0P-#!&,$8P(BP*(BT)8R`C,C`R,#(P,C!&,$8P(BP*(CL)8R`C,3`Q,#$P
  227. XM,3!&,$8P(BP*(CH)8R`C,#`P,#`P,#!&,$8P(BP*(B`@("`@("`@("`@("`@
  228. XM("`@("`@("`@+BXN("`@("`@("`@("`@("`@("`@("`@("XN("`@("`@("`@
  229. XM("`@("`@("`@("`@("`@("`@("`@+BXN("`@("`@("`@("`@("`@("`@("`@
  230. XM("`@("`@("`@("`@("`N+BXN+BXN+BXN+BX@("`@("`@("`@("`@("`@("`@
  231. XM("`@("`@("`@("`@("`@("`@("`@+BXN+BXN+BXN+BXN("`@("`@("`@("`@
  232. XM("`@("`@("`@("`@("`@("`@("`N+BX@("`@("`@("`@("`@("`@("`@("`@
  233. XM("`@("`@("`N+BX@("`@("`@("`@(BP*(B`@("`@("`@("`@("`@("`@("`@
  234. XM("!86%A86%A8("`@("`@("`@("`@("`@("!86%A86"`@("`@("`@("`@("`@
  235. XM("`@("`@("`@("`@("!86%A86%@@("`@("`@("`@("`@("`@("`@("`@("`@
  236. XM(%A86%A86%A86%A86%A86%A86%A86%A8("`@("`@("`@("`@("`@("`@("`@
  237. XM("`@("`@(%A86%A86%A86%A86%A86%A86%A86%A8("`@("`@("`@("`@("`@
  238. XM("`@("`@("`@("`@(%A86%A86"`@("`@("`@("`@("`@("`@("`@("`@("`@
  239. XM(%A86%A86"`@("`@("`@(BP*(B`@("`@("`@("`@("`@("`@("`@(%A86%A8
  240. XM6%A86"`@("`@("`@("`@("`@(%A86%A86%@@("`@("`@("`@("`@("`@("`@
  241. XM("`@("`@(%A86%A86%A8("`@("`@("`@("`@("`@("`@("!86%A86%A86%A8
  242. XM6%A86%A86%A86%A86%A86%A86%@@("`@("`@("`@("`@("`@("`@("`@(%A8
  243. XM6%A86%A86%A86%A86%A86%A86%A86%A86"`@("`@("`@("`@("`@("`@("`@
  244. XM("`@("`@6%A86%A86%@@("`@("`@("`@("`@("`@("`@("`@("`@6%A86%A8
  245. XM6%@@("`@("`@(BP*(B`@("`@("`@("`@("`@("`@("`@6%A86%A86%A86"`@
  246. XM("`@("`@("`@("`@6%A86%A86%@@("`@("`@("`@("`@("`@("`@("`@("`@
  247. XM6%AO6%A8;UA86"`@("`@("`@("`@("`@("`@(%A8;UA86&]86%AO6%A8;UA8
  248. XM6&]86%AO6%A8;UA86&]8("`@("`@("`@("`@("`@("`@("`@6&]86%AO6%A8
  249. XM;UA86&]86%AO6%A8;UA86&]86%@@("`@("`@("`@("`@("`@("`@("`@("!O
  250. XM6%A8;UA86&\@("`@("`@("`@("`@("`@("`@("`@("!86%AO6%A8;U@@("`@
  251. XM("`@(BP*(B`@("`@("`@("`@("`@("`@("`@;V]O;V]O;V]O("`@("`@("`@
  252. XM("`@(&]O;V]O;V]O;V\@("`@("`@("`@("`@("`@("`@("`@("`@;V]O;V]O
  253. XM;V]O("`@("`@("`@("`@("`@("`@(&]O;V]O;V]O;V]O;V]O;V]O;V]O;V]O
  254. XM;V]O;V]O;V]O;R`@("`@("`@("`@("`@("`@("`@;V]O;V]O;V]O;V]O;V]O
  255. XM;V]O;V]O;V]O;V]O;V\@("`@("`@("`@("`@("`@("`@("`@(&]O;V]O;V]O
  256. XM;V\@("`@("`@("`@("`@("`@("`@("`@(&]O;V]O;V]O;V\@("`@("`@(BP*
  257. XM(B`@("`@("`@("`@("`@("`@("!O;V]O;V]O;V]O("`@("`@("`@("`@;V]O
  258. XM;V]O;V]O;R`@("`@("`@("`@("`@("`@("`@("`@("!O;V]O;V]O;V]O("`@
  259. XM("`@("`@("`@("`@("`@(&]O;V]O;V]O;V]O;V]O;V]O;V]O;V]O;V]O;V]O
  260. XM;V]O;V\@("`@("`@("`@("`@("`@("`@(&]O;V]O;V]O;V]O;V]O("`@("`@
  261. XM("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@(&]O;V]O;V]O;V\@("`@
  262. XM("`@("`@("`@("`@("`@("`@(&]O;V]O;V]O;V\@("`@("`@(BP*(B`@("`@
  263. XM("`@("`@("`@("`@($]O3V]/;T]O3V\@("`@("`@("`@("!/;T]O3V]/;T]O
  264. XM("`@("`@("`@("`@("`@("`@("`@("`@(&]/;T]O3V]/;T\@("`@("`@("`@
  265. XM("`@("`@("`@("`@("`@("!/;T]O3V]/;T]O("`@("`@("!/;T]O3V]/;T\@
  266. XM("`@("`@("`@("`@("`@("`@("`@;T]O3V]/;T]O3V\@("`@("`@("`@("`@
  267. XM("`@("`@("`@("`@("`@("`@("`@("`@;T]O3V]/;T]O3R`@("`@("`@("`@
  268. XM("`@("`@("`@("`@3V]/;T]O3V]/;R`@("`@("`@(BP*(B`@("`@("`@("`@
  269. XM("`@("`@($]/3T]/3T]/3T\@("`@("`@("`@3T]/3T]/3T]/3T\@("`@("`@
  270. XM("`@("`@("`@("`@("`@("`@($]/3T]/3T]/3R`@("`@("`@("`@("`@("`@
  271. XM("`@("`@("`@($]/3T]/3T]/3R`@("`@("`@("`@3T]/3T]/3T\@("`@("`@
  272. XM("`@("`@("`@("`@("`@3T]/3T]/3T]/3R`@("`@("`@("`@("`@("`@("`@
  273. XM("`@("`@("`@("`@("`@("!/3T]/3T]/3T]/("`@("`@("`@("`@("`@("`@
  274. XM("`@("!/3T]/3T]/3T]/("`@("`@("`@(BP*(B`@("`@("`@("`@("`@("`@
  275. XM3RM/*T\K3RM/*R`@("`@("`@("!/*T\K3RM/*T\K3R`@("`@("`@("`@("`@
  276. XM("`@("`@("`@("`@*T\K3RM/*T\K3R`@("`@("`@("`@("`@("`@("`@("`@
  277. XM("`@($\K3RM/*T\K("`@("`@("`@("`@3RM/*T\K3RL@("`@("`@("`@("`@
  278. XM("`@("`@("`K3RM/*T\K3RM/("`@("`@("`@("`@("`@("`@("`@("`@("`@
  279. XM("`@("`@("`@("`K3RM/*T\K3RM/("`@("`@("`@("`@("`@("`@("`@("!/
  280. XM*T\K3RM/*T\K("`@("`@("`@(BP*(B`@("`@("`@("`@("`@("`@*RLK*RLK
  281. XM*RLK*R`@("`@("`@("LK*RLK*RLK*RLK("`@("`@("`@("`@("`@("`@("`@
  282. XM("`@("`K*RLK*RLK*RLK("`@("`@("`@("`@("`@("`@("`@("`@("`@*RLK
  283. XM*RLK*RLK("`@("`@("`@("`K*RLK*RLK*RL@("`@("`@("`@("`@("`@("`@
  284. XM("`K*RLK*RLK*RL@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
  285. XM("`@("LK*RLK*RLK*RL@("`@("`@("`@("`@("`@("`@("`@("LK*RLK*RLK
  286. XM*RL@("`@("`@("`@(BP*(B`@("`@("`@("`@("`@("`K*RLK*RLK*RLK("`@
  287. XM("`@("`K*RLK*RLK*RLK*RL@("`@("`@("`@("`@("`@("`@("`@("`@("`K
  288. XM*RLK*RLK*RL@("`@("`@("`@("`@("`@("`@("`@("`@("`K*RLK*RLK*RL@
  289. XM("`@("`@("`@("LK*RLK*RLK*RL@("`@("`@("`@("`@("`@("`@("LK*RLK
  290. XM*RLK*R`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@*RLK
  291. XM*RLK*RLK*R`@("`@("`@("`@("`@("`@("`@("`@*RLK*RLK*RLK*R`@("`@
  292. XM("`@("`@(BP*(B`@("`@("`@("`@("`@($`K0"M`*T`K0"M`("`@("`@($`K
  293. XM0"M`*T`K0"M`("`@("`@("`@("`@("`@("`@("`@("`@("`@($!`0$!`0$!`
  294. XM0$`@("`@("`@("`@("`@("`@("`@("`@("`@("!`0$!`0$!`0$`@("`@("`@
  295. XM("`@0$!`0$!`0$!`0"`@("`@("`@("`@("`@("`@("`@0$!`0$!`0$!`("`@
  296. XM("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("!`0$!`0$!`0$!`
  297. XM0"`@("`@("`@("`@("`@("`@("`@("!`0$!`0$!`0$!`0"`@("`@("`@("`@
  298. XM(BP*(B`@("`@("`@("`@("`@($!`0$!`0$!`0$`@("`@("!`0$!`0$!`0$!`
  299. XM0$`@("`@("`@("`@("`@("`@("`@("`@("`@("`@($!`0$!`0$!`0"`@("`@
  300. XM("`@("`@("`@("`@("`@("`@("`@($!`0$!`0$!`0"`@("`@("`@("!`0$!`
  301. XM0$!`0$!`0"`@("`@("`@("`@("`@("`@("!`0$!`0$!`0$!`("`@("`@("`@
  302. XM("`@("`@("`@("`@("`@("`@("`@("`@("`@("!`0$!`0$!`0$!`("`@("`@
  303. XM("`@("`@("`@("`@("`@("!`0$!`0$!`0$!`("`@("`@("`@("`@(BP*(B`@
  304. XM("`@("`@("`@("`@0$!`0$!`0$!`0$`@("`@0$!`0$!`0$!`0$!`0"`@("`@
  305. XM("`@("`@("`@("`@("`@("`@("`@("`@0$`C0$!`(T!`("`@("`@("`@("`@
  306. XM("`@("`@("`@("`@("`@0$`C0$!`(T!`0"`@("`@("`@(T!`0"-`0$`C0$!`
  307. XM("`@("`@("`@("`@("`@("`@($`C0$!`(T!`0",@("`@("`@("`@("`@("`@
  308. XM("`@("`@("`@("`@("`@("`@("`@($`C0$!`(T!`0",@("`@("`@("`@("`@
  309. XM("`@("`@("`@("-`0$`C0$!`(T`@("`@("`@("`@("`@(BP*(B`@("`@("`@
  310. XM("`@("`C(T`C(R-`(R,C0",@($`C(R-`(R,C0",C(T`@("`@("`@("`@("`@
  311. XM("`@("`@("`@("`@("`@("`C(R,C(R,C(R,C("`@("`@("`@("`@("`@("`@
  312. XM("`@("`@("`@(R,C(R,C(R,C("`@("`@(",C(R,C(R,C(R,C(R,@("`@("`@
  313. XM("`@("`@("`@("`@(R,C(R,C(R,C(R,@("`@("`@("`@("`@("`@("`@("`@
  314. XM("`@("`@("`@("`@("`@(R,C(R,C(R,C(R`@("`@("`@("`@("`@("`@("`@
  315. XM("`@(R,C(R,C(R,C(R`@("`@("`@("`@("`@(BP*(B`@("`@("`@("`@("`C
  316. XM(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R`@("`@("`@("`@("`@("`@("`@
  317. XM("`@("`@("`@("`C(R,C(R,C(R,@("`@("`@("`@("`@("`@("`@("`@("`@
  318. XM("`C(R,C(R,C(R,C("`@("`C(R,C(R,C(R,C(R,C("`@("`@("`@("`@("`@
  319. XM("`@("`C(R,C(R,C(R,C(R,@("`@("`@("`@("`@("`@("`@("`@("`@("`@
  320. XM("`@("`@("`@(R,C(R,C(R,C(R`@("`@("`@("`@("`@("`@("`@("`@(R,C
  321. XM(R,C(R,C(R`@("`@("`@("`@("`@(BP*(B`@("`@("`@("`@("0C)",D(R0C
  322. XM)",D(R0C)",D(R0C)",D(R0@("`@("`@("`@("`@("`@("`@("`@("`@("`@
  323. XM("`@(",D(R0C)",D(R`@("`@("`@("`@("`@("`@("`@("`@("`@("`D(R0C
  324. XM)",D(R0C)",D(R0C)",D(R0C)",D(R0@("`@("`@("`@("`@("`@("`@("`D
  325. XM(R0C)",D(R0C)",D(R0C)",D(R0C("`@("`@("`@("`@("`@("`@("`@("`@
  326. XM("`D(R0C)",D(R0C("`@("`@("`@("`@("`@("`@("`@("`C)",D(R0C)",D
  327. XM("`@("`@("`@("`@("`@(BP*(B`@("`@("`@("`@("0D)"0D)"0D)"0D)"0D
  328. XM)"0D)"0D)"0D("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@)"0D
  329. XM)"0D)"0D)"`@("`@("`@("`@("`@("`@("`@("`@("`@("0D)"0D)"0D)"0D
  330. XM)"0D)"0D)"0D)"0D)"0D("`@("`@("`@("`@("`@("`@("`@("0D)"0D)"0D
  331. XM)"0D)"0D)"0D)"0D)"0D)"`@("`@("`@("`@("`@("`@("`@("`@("0D)"0D
  332. XM)"0D)"0@("`@("`@("`@("`@("`@("`@("`@("0D)"0D)"0D)"0@("`@("`@
  333. XM("`@("`@("`@(BP*(B`@("`@("`@("`@)"0D)"0D)"0D)"0D)"0D)"0D)"0D
  334. XM)"`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`D)20E)"4D)20E
  335. XM("`@("`@("`@("`@("`@("`@("`@("`@("`@)20E)"4D)20E)"4D)20E)"4D
  336. XM)20E)"4D)20@("`@("`@("`@("`@("`@("`@("`@)20E)"4D)20E)"4D)20E
  337. XM)"4D)20E)"4D)2`@("`@("`@("`@("`@("`@("`@("`@)20E)"4D)20E)"4@
  338. XM("`@("`@("`@("`@("`@("`@("`@)"4D)20E)"4D)20@("`@("`@("`@("`@
  339. XM("`@(BP*(B`@("`@("`@("`E)24E)24E)24E)24E)24E)24E)24@("`@("`@
  340. XM("`@("`@("`@("`@("`@("`@("`@("`@("`@("`E)24E)24E)24@("`@("`@
  341. XM("`@("`@("`@("`@("`@("`@("`@)24E)24E)24E)24E)24E)24E)24E)24@
  342. XM("`@("`@("`@("`@("`@("`@("`@("`@)24E)24E)24E)24E)24E)24E)24E
  343. XM)24E)2`@("`@("`@("`@("`@("`@("`@("`@)24E)24E)24E)2`@("`@("`@
  344. XM("`@("`@("`@("`@("`@)24E)24E)24E)2`@("`@("`@("`@("`@("`@(BP*
  345. XM(B`@("`@("`@("4E)24E)24E)24E)24E)24E)24E)2`@("`@("`@("`@("`@
  346. XM("`@("`@("`@("`@("`@("`@("`@("4E)24E)24E)24@("`@("`@("`@("`@
  347. XM("`@("`@("`@("`@("`E)24E)24E)24E)24E)24E)24E)24E)24E)2`@("`@
  348. XM("`@("`@("`@("`@("`@("`E)24E)24E)24E)24E)24E)24E)24E)24@("`@
  349. XM("`@("`@("`@("`@("`@("`@("`E)24E)24E)24E("`@("`@("`@("`@("`@
  350. XM("`@("`@("`E)24E)24E)24E("`@("`@("`@("`@("`@("`@(BP*(B`@("`@
  351. XM("`@("4E)24E)24E)24E)24E)24E)24E)2`@("`@("`@("`@("`@("`@("`@
  352. XM("`@("`@("`@("`@("`@("4E)24E)24E)2`@("`@("`@("`@("`@("`@("`@
  353. XM("`@("`@("4E)24E)24E)24E)24E)24E)24E)24E)24E)24@("`@("`@("`@
  354. XM("`@("`@("`@("4E)24E)24E)24E)24@("`@("`@("`@("`@("`@("`@("`@
  355. XM("`@("`@("`@("`@("`E)24E)24E)24E("`@("`@("`@("`@("`@("`@("`@
  356. XM("`E)24E)24E)24E("`@("`@("`@("`@("`@("`@(BP*(B`@("`@("`@)24F
  357. XM)24E)24E)2`@("`E)24E)B4E)2`@("`@("`@("`@("`@("`@("`@("`@("`@
  358. XM("`@("`@("`@)28E)B4F)28E)B`@("`@("`@("`@("`@("`@("`@("`@("`@
  359. XM("8E)B4F)28E)B4F)2`@("`@("`E)B4F)28E)B4F("`@("`@("`@("`@("`@
  360. XM("`@("8E)B4F)28E)B4F("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
  361. XM("`@("`@("8E)B4F)28E)B4@("`@("`@("`@("`@("`@("`@("`@("4F)28E
  362. XM)B4F)28@("`@("`@("`@("`@("`@("`@(BP*(B`@("`@("`F)B8F)B8F)B8F
  363. XM)B`@("`F)B8F)B8F)B8@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
  364. XM("`F)B8F)B8F)B8F("`@("`@("`@("`@("`@("`@("`@("`@("`@)B8F)B8F
  365. XM)B8F)B8F("`@("`@("`@)B8F)B8F)B8F("`@("`@("`@("`@("`@("`@)B8F
  366. XM)B8F)B8F)B8@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
  367. XM)B8F)B8F)B8F)B`@("`@("`@("`@("`@("`@("`@("`@)B8F)B8F)B8F)B`@
  368. XM("`@("`@("`@("`@("`@("`@(BP*(B`@("`@("`F)B8F)B8F)B8F("`@("`F
  369. XM)B8F)B8F)B8@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`F)B8F
  370. XM)B8F)B8F("`@("`@("`@("`@("`@("`@("`@("`@("`F)B8F)B8F)B8F)B8@
  371. XM("`@("`@("`@)B8F)B8F)B8F("`@("`@("`@("`@("`@("`@)B8F)B8F)B8F
  372. XM)B`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@)B8F)B8F
  373. XM)B8F)B`@("`@("`@("`@("`@("`@("`@("`@)B8F)B8F)B8F)B`@("`@("`@
  374. XM("`@("`@("`@("`@(BP*(B`@("`@("8F)BHF)B8J)B8F("`@("`@)B8J)B8F
  375. XM*B8F("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("HJ*BHJ*BHJ*BH@
  376. XM("`@("`@("`@("`@("`@("`@("`@("`@("`J*BHJ*BHJ*BHJ*B`@("`@("`@
  377. XM("`@*BHJ*BHJ*BHJ("`@("`@("`@("`@("`@("`J*BHJ*BHJ*BHJ*B`@("`@
  378. XM("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`J*BHJ*BHJ*BHJ("`@
  379. XM("`@("`@("`@("`@("`@("`@("`J*BHJ*BHJ*BHJ("`@("`@("`@("`@("`@
  380. XM("`@("`@(BP*(B`@("`@*BHJ*BHJ*BHJ*BH@("`@("`@*BHJ*BHJ*BHJ("`@
  381. XM("`@("`@("`@("`@("`@("`@("`@("`@("`@("HJ*BHJ*BHJ*BH@("`@("`@
  382. XM("`@("`@("`@("`@("`@("`@("HJ*BHJ*BHJ*BHJ("`@("`@("`@("`J*BHJ
  383. XM*BHJ*BHJ("`@("`@("`@("`@("`@("`J*BHJ*BHJ*BHJ("`@("`@("`@("`@
  384. XM("`@("`@("`@("`@("`@("`@("`@("`@("`J*BHJ*BHJ*BHJ("`@("`@("`@
  385. XM("`@("`@("`@("`@("`J*BHJ*BHJ*BHJ("`@("`@("`@("`@("`@("`@("`@
  386. XM(BP*(B`@("`@*BHJ*BHJ*BHJ*B`@("`@("`@*BHJ*BHJ*BHJ("`@("`@("`@
  387. XM("`@("`@("`@("`@("`@("`@("`@*CTJ/2H]*CTJ/2`@("`@("`@("`@("`@
  388. XM("`@("`@("`@("`@*CTJ/2H]*CTJ/2H@("`@("`@("`@("H]*CTJ/2H]*CT@
  389. XM("`@("`@("`@("`@("`@(#TJ/2H]*CTJ/2H]("`@("`@("`@("`@("`@("`@
  390. XM("`@("`@("`@("`@("`@("`@(#TJ/2H]*CTJ/2H@("`@("`@("`@("`@("`@
  391. XM("`@("`@("H]*CTJ/2H]*CT@("`@("`@("`@("`@("`@("`@("`@(BP*(B`@
  392. XM("`]*CTJ/2H]*CTJ/2`@("`@("`@(#TJ/2H]*CTJ/2`@("`@("`@("`@("`@
  393. XM("`@("`@("`@("`@("`]/3T]/3T]/3T]/2`@("`@("`@("`@("`@("`@("`@
  394. XM("`@("`]/3T]/3T]/3T]/2`@("`@("`@("`@/3T]/3T]/3T]/3T@("`@("`@
  395. XM("`@("`@("`@/3T]/3T]/3T]/3T@("`@("`@("`@("`@("`@("`@("`@("`@
  396. XM("`@("`@("`@("`@(#T]/3T]/3T]/3T@("`@("`@("`@("`@("`@("`@("`@
  397. XM(#T]/3T]/3T]/3T@("`@("`@("`@("`@("`@("`@("`@(BP*(B`@(#T]/3T]
  398. XM/3T]/3T]("`@("`@("`@(#T]/3T]/3T]/2`@("`@("`@("`@("`@("`@("`@
  399. XM("`@("`@("`]/3T]/3T]/3T]("`@("`@("`@("`@("`@("`@("`@("`@("`]
  400. XM/3T]/3T]/3T]("`@("`@("`@("`]/3T]/3T]/3T]/2`@("`@("`@("`@("`@
  401. XM("`@/3T]/3T]/3T]/3T@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
  402. XM("`@("`@/3T]/3T]/3T]/2`@("`@("`@("`@("`@("`@("`@("`@/3T]/3T]
  403. XM/3T]/2`@("`@("`@("`@("`@("`@("`@("`@(BP*(B`@(#T]/3T]/3T]/3T]
  404. XM("`@("`@("`@(#T]/3T]/3T]/3T@("`@("`@("`@("`@("`@("`@("`@("`@
  405. XM(#T]/3T]/3T]/3T@("`@("`@("`@("`@("`@("`@("`@("`@(#T]/3T]/3T]
  406. XM/3T@("`@("`@("`@(#T]/3T]/3T]/3T]("`@("`@("`@("`@("`@("`@/3T]
  407. XM/3T]/3T]/2`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
  408. XM/3T]/3T]/3T]("`@("`@("`@("`@("`@("`@("`@("`@/3T]/3T]/3T]("`@
  409. XM("`@("`@("`@("`@("`@("`@("`@(BP*(B`@/3T]/3T]/3T]/3T@("`@("`@
  410. XM("`@("`]/3T]/3T]/3T@("`@("`@("`@("`@("`@("`@("`@("`@(#T]/3T]
  411. XM/3T]/3T@("`@("`@("`@("`@("`@("`@("`@("`@/3T]/3T]/3T]/3T@("`@
  412. XM("`@("`]/3T]/3T]/3T]/3T@("`@("`@("`@("`@("`@("`]/3T]/3T]/3T]
  413. XM/2`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`]/3T]/3T]
  414. XM/3T]("`@("`@("`@("`@(#T]/2`@("`@("`]/3T]/3T]/3T]("`@("`@("`@
  415. XM("`@(#T]/2`@("`@("`@(BP*(B`]/3T]/3T]/3T]/2`@("`@("`@("`@("`]
  416. XM/3T]/3T]/3T]("`@("`@("`@("`@("`@("`@("`@("`@/2T]+3TM/2T]+2`@
  417. XM("`@("`@("`@("`@("`@("`@("`@("`M/2T]+3TM/2T]+3T@("`@("`@/2T]
  418. XM+3TM/2T]+3TM("`@("`@("`@("`@("`@("`@("`]+3TM/2T]+3TM/2`@("`@
  419. XM("`@("`M/2T]+3TM/2`@("`@("`@("`@("`@("`@("`]+3TM/2T]+3TM("`@
  420. XM("`@("T]+3TM/2T]+3T@("`@("`M/2T]+3TM/2T]("`@("`@(#TM/2T]+3TM
  421. XM/2T@("`@("`@(BP*(B`M+2T]+2TM/2TM+2`@("`@("`@("`@("`@+2T]+2TM
  422. XM/2TM("`@("`@("`@("`@("`@("`@("`@("`@+2TM+2TM+2TM+2`@("`@("`@
  423. XM("`@("`@("`@("`@("`@("`M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM
  424. XM+2T@("`@("`@("`@("`@("`@("`@("`M+2TM+2TM+2TM+2TM+2TM+2TM+2TM
  425. XM+2TM+2TM+2`@("`@("`@("`@("`@("`@("`M+2TM+2TM+2TM+2TM+2TM+2TM
  426. XM+2TM+2TM+2T@("`@("`M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2T@("`@
  427. XM("`@(BP*(BTM+2TM+2TM+2TM("`@("`@("`@("`@("`@+2TM+2TM+2TM+2`@
  428. XM("`@("`@("`@("`@("`@("`@("`M+2TM.RTM+2TM("`@("`@("`@("`@("`@
  429. XM("`@("`@("`@("T[+2TM+2TM+3LM+2TM+2TM.RTM+2TM+2T[+2TM+2`@("`@
  430. XM("`@("`@("`@("`@("`@("`M+2TM+3LM+2TM+2TM.RTM+2TM+2T[+2TM+2TM
  431. XM+2`@("`@("`@("`@("`@("`@("`@+2TM+3LM+2TM+2TM.RTM+2TM+2T[+2TM
  432. XM+2`@("`@("`@+2TM.RTM+2TM+2T[+2TM+2TM+3LM+2TM+2`@("`@("`@(BP*
  433. XM(BTM+2TM+2TM+2T@("`@("`@("`@("`@("`@("TM+2TM+2TM+2T@("`@("`@
  434. XM("`@("`@("`@("`@("`[.SL[.SL[.SL[("`@("`@("`@("`@("`@("`@("`@
  435. XM("`@(#L[.SL[.SL[.SL[.SL[.SL[.SL[.SL[.SL[.SL@("`@("`@("`@("`@
  436. XM("`@("`@("`@("`@.SL[.SL[.SL[.SL[.SL[.SL[.SL[.SL[.SL[("`@("`@
  437. XM("`@("`@("`@("`@("`@.SL[.SL[.SL[.SL[.SL[.SL[.SL[.SL[("`@("`@
  438. XM("`@.SL[.SL[.SL[.SL[.SL[.SL[.SL[.SL[("`@("`@("`@(BP*(CLM.SL[
  439. XM.SL[.R`@("`@("`@("`@("`@("`@(#L[.SL[.RT[.SL[("`@("`@("`@("`@
  440. XM("`@("`@("`[.SL[.SL[.SL@("`@("`@("`@("`@("`@("`@("`@("`@(#L[
  441. XM.SL[.SL[.SL[.SL[.SL[.SL[.SL[.SL[("`@("`@("`@("`@("`@("`@("`@
  442. XM("`@("`@.SL[.SL[.SL[.SL[.SL[.SL[.SL[.SL[.R`@("`@("`@("`@("`@
  443. XM("`@("`@("`@(#L[.SL[.SL[.SL[.SL[.SL[.SL[.R`@("`@("`@("`@(#L[
  444. XM.SL[.SL[.SL[.SL[.SL[.SL[.R`@("`@("`@("`@(BP*(B`[.SL[.SL[.R`@
  445. XM("`@("`@("`@("`@("`@("`[.SL[.SL[.SL[.R`@("`@("`@("`@("`@("`@
  446. XM("`@(#LZ.SL[.CL@("`@("`@("`@("`@("`@("`@("`@("`@("`[.SLZ.SL@
  447. XM("`@(#H[.SLZ.SL[.CL[.R`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
  448. XM(#L[.CL[.SH[.SLZ.SL[.CL[.SH@("`@("`@("`@("`@("`@("`@("`@("`@
  449. XM("`@("`@.CL[.SH[.SLZ.SL[.CL[("`@("`@("`@("`@("`@("`@.SL[.CL[
  450. XM.SH[.SLZ.SL[("`@("`@("`@("`@("`@(BP*(B`@("`@("`@("`@("`@("`@
  451. XM("`@("`@("`@("`@.SH[.CLZ.SH[.B`@("`@("`@("`@("`@("`@("`@("`Z
  452. XM.CHZ.B`@("`@("`@("`@("`@("`@("`@("`@("`@("`@(#HZ.B`@("`@("`@
  453. XM.CHZ.CHZ.B`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@(#HZ
  454. XM.CHZ.CHZ.B`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
  455. XM("`@.CHZ.CHZ.CHZ("`@("`@("`@("`@("`@("`@("`@("`@.CHZ.CHZ.CHZ
  456. XM("`@("`@("`@("`@("`@("`@(BP*(B`@("`@("`@("`@("`@("`@("`@("`@
  457. XM("`@("`@(#HZ.CHZ.CHZ.B`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
  458. XM("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
  459. XM("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
  460. XM("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
  461. XM("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@("`@
  462. X0("`@("`@("`@("`@(GT["B`@
  463. X`
  464. Xend
  465. END_OF_FILE
  466. if test 15119 -ne `wc -c <'bitmaps/kibell.xpm.uu'`; then
  467.     echo shar: \"'bitmaps/kibell.xpm.uu'\" unpacked with wrong size!
  468. fi
  469. # end of 'bitmaps/kibell.xpm.uu'
  470. fi
  471. if test -f 'level.c' -a "${1}" != "-c" ; then 
  472.   echo shar: Will not clobber existing file \"'level.c'\"
  473. else
  474. echo shar: Extracting \"'level.c'\" \(15856 characters\)
  475. sed "s/^X//" >'level.c' <<'END_OF_FILE'
  476. X#include "include/copyright.h"
  477. X
  478. X/*
  479. X *  Include file dependencies:
  480. X */
  481. X
  482. X#include <stdio.h>
  483. X#include <stdlib.h>
  484. X#include <stddef.h>
  485. X#include <assert.h>
  486. X#include <X11/Xlib.h>
  487. X#include <X11/Xutil.h>
  488. X#include <X11/Xos.h>
  489. X#include <xpm.h>
  490. X
  491. X#include "bitmaps/life.xpm"
  492. X
  493. X#include "include/error.h"
  494. X#include "include/audio.h"
  495. X#include "include/special.h"
  496. X#include "include/intro.h"
  497. X#include "include/gun.h"
  498. X#include "include/init.h"
  499. X#include "include/stage.h"
  500. X#include "include/sfx.h"
  501. X#include "include/score.h"
  502. X#include "include/blocks.h"
  503. X#include "include/bonus.h"
  504. X#include "include/highscore.h"
  505. X#include "include/ball.h"
  506. X#include "include/main.h"
  507. X#include "include/mess.h"
  508. X#include "include/misc.h"
  509. X
  510. X#include "include/level.h"
  511. X
  512. X/*
  513. X *  Internal macro definitions:
  514. X */
  515. X
  516. X#define MAX_LIVES            6
  517. X#define START_LIVES            3
  518. X#define NEW_LIVE_SCORE_INC    100000L
  519. X
  520. X#define SHOTS_TO_KILL_SPECIAL    3
  521. X
  522. X#define BUF_SIZE            1024
  523. X
  524. X/*
  525. X *  Internal type declarations:
  526. X */
  527. X
  528. X#if NeedFunctionPrototypes
  529. Xstatic void DrawLevelTimeBonus(Display *display, Window window, int timebonus);
  530. X#else
  531. Xstatic void DrawLevelTimeBonus();
  532. X#endif
  533. X
  534. X/*
  535. X *  Internal variable declarations:
  536. X */
  537. X
  538. XPixmap        lifePixmap, lifeMask;    
  539. Xint         livesLeft = 3;
  540. Xu_long        level;
  541. Xu_long        startlevel;
  542. Xtime_t        gameTime;
  543. Xint            bonus = 1;
  544. Xchar         levelTitle[BUF_SIZE];
  545. Xint         bonusBlock = False;
  546. Xstatic int     bulletPos;
  547. Xstatic int     timeBonus;
  548. X
  549. X#if NeedFunctionPrototypes
  550. Xvoid InitialiseLevelInfo(Display *display, Window window, Colormap colormap)
  551. X#else
  552. Xvoid InitialiseLevelInfo(display, window, colormap)
  553. X    Display *display;
  554. X    Window window;
  555. X    Colormap colormap;
  556. X#endif
  557. X{
  558. X    XpmAttributes   attributes;
  559. X    int             XpmErrorStatus;
  560. X
  561. X    attributes.valuemask = XpmColormap;
  562. X    attributes.colormap = colormap;
  563. X
  564. X    /* Create xpm pixmap for the life */
  565. X    XpmErrorStatus = XpmCreatePixmapFromData(display, window, life_xpm, 
  566. X        &lifePixmap, &lifeMask, &attributes);
  567. X    HandleXPMError(display, XpmErrorStatus, "InitialiseLevelInfo()");
  568. X
  569. X    /* Free the xpm pixmap attributes */
  570. X    XpmFreeAttributes(&attributes);
  571. X}
  572. X
  573. X#if NeedFunctionPrototypes
  574. Xvoid DecLevelTimeBonus(Display *display, Window window)
  575. X#else
  576. Xvoid DecLevelTimeBonus(display, window)
  577. X    Display *display;
  578. X    Window window;
  579. X#endif
  580. X{
  581. X    /* Decrement the time bonus */
  582. X    timeBonus--;    
  583. X
  584. X    /* Cannot step back in time */
  585. X    if (timeBonus < 0) 
  586. X        timeBonus = 0;
  587. X    else
  588. X    {
  589. X        /* Draw the time bonus */
  590. X        DrawLevelTimeBonus(display, window, timeBonus);
  591. X    }
  592. X}
  593. X
  594. X#if NeedFunctionPrototypes
  595. Xint GetLevelTimeBonus(void)
  596. X#else
  597. Xint GetLevelTimeBonus()
  598. X#endif
  599. X{
  600. X    /* return the time bonus */
  601. X    return timeBonus;    
  602. X}
  603. X
  604. X#if NeedFunctionPrototypes
  605. Xvoid SetLevelTimeBonus(Display *display, Window window, int seconds)
  606. X#else
  607. Xvoid SetLevelTimeBonus(display, window, seconds)
  608. X    Display *display;
  609. X    Window window;
  610. X    int seconds;
  611. X#endif
  612. X{
  613. X    assert(timeBonus >= 0);
  614. X
  615. X    /* Reset the time bonus to desired time */
  616. X    timeBonus = seconds;    
  617. X
  618. X    /* Draw the time bonus */
  619. X    DrawLevelTimeBonus(display, window, timeBonus);
  620. X}
  621. X
  622. X#if NeedFunctionPrototypes
  623. Xstatic void DrawLevelTimeBonus(Display *display, Window window, int timebonus)
  624. X#else
  625. Xstatic void DrawLevelTimeBonus(display, window, timebonus)
  626. X    Display *display;
  627. X    Window window;
  628. X    int timebonus;
  629. X#endif
  630. X{
  631. X    int len, minutes, seconds;
  632. X    char str[10];
  633. X
  634. X    /* Work out the minutes and seconds using time bonus */
  635. X    minutes = timebonus / 60;
  636. X    seconds = timebonus % 60;
  637. X
  638. X    /* Construct a string with the time bonus and draw it */
  639. X    sprintf(str, "%02d:%02d", minutes, seconds);
  640. X    len = strlen(str);
  641. X
  642. X    /* Draw the text now thanks  - using title font for big numbers */
  643. X    XClearWindow(display, window);
  644. X    DrawText(display, window, 2, 7, titleFont, black, str, len);
  645. X
  646. X    /* The less time you have the more drastic the colour comes */
  647. X    if (timebonus <= 10)
  648. X        DrawText(display, window, 0, 5, titleFont, red, str, len);
  649. X    else if (timebonus <= 60)
  650. X        DrawText(display, window, 0, 5, titleFont, yellow, str, len);
  651. X    else 
  652. X        DrawText(display, window, 0, 5, titleFont, green, str, len);
  653. X}
  654. X
  655. X#if NeedFunctionPrototypes
  656. Xvoid DrawLife(Display *display, Window window, int x, int y)
  657. X#else
  658. Xvoid DrawLife(display, window, x, y)
  659. X    Display *display;
  660. X    Window window;
  661. X    int x;
  662. X    int y;
  663. X#endif
  664. X{
  665. X    /* Draw the life pixmap */
  666. X    RenderShape(display, window, lifePixmap, lifeMask, 
  667. X        x-12, y-12, 25, 24, True);
  668. X}
  669. X
  670. X#if NeedFunctionPrototypes
  671. Xvoid DisplayLevelInfo(Display *display, Window window, u_long level)
  672. X#else
  673. Xvoid DisplayLevelInfo(display, window, level)
  674. X    Display *display;
  675. X    Window window;
  676. X    u_long level;
  677. X#endif
  678. X{
  679. X    int i;
  680. X
  681. X    /* Clear the window for level information */
  682. X    XClearWindow(display, levelWindow);
  683. X
  684. X    /* Put the level number up */
  685. X    DrawOutNumber(display, levelWindow, level, 260, 0);
  686. X
  687. X    /* Draw out the lives left pixmaps */
  688. X    for (i = 0; i < livesLeft; i++)
  689. X        DrawLife(display, window, 175 - (i * 30), 21);
  690. X
  691. X    /* Draw the score in the score window */
  692. X    DisplayScore(display, scoreWindow, score);
  693. X
  694. X    /* Draw all the bullets in the ammo pouch ;-) */
  695. X    ReDrawBulletsLeft(display);
  696. X
  697. X    XFlush(display);
  698. X}
  699. X
  700. X#if NeedFunctionPrototypes
  701. Xvoid SetLevelNumber(int levelNum)
  702. X#else
  703. Xvoid SetLevelNumber(levelNum)
  704. X    int levelNum;
  705. X#endif
  706. X{
  707. X    level = (u_long) levelNum;
  708. X}
  709. X
  710. X#if NeedFunctionPrototypes
  711. Xvoid SetStartingLevel(int levelNum)
  712. X#else
  713. Xvoid SetStartingLevel(levelNum)
  714. X    int levelNum;
  715. X#endif
  716. X{
  717. X    startlevel = (u_long) levelNum;
  718. X}
  719. X
  720. X#if NeedFunctionPrototypes
  721. Xint GetStartingLevel(void)
  722. X#else
  723. Xint GetStartingLevel()
  724. X#endif
  725. X{
  726. X    return ((int) startlevel);
  727. X}
  728. X
  729. X#if NeedFunctionPrototypes
  730. Xvoid RedrawLevelInfo(Display *display, Window window)
  731. X#else
  732. Xvoid RedrawLevelInfo(display, window)
  733. X    Display *display;
  734. X    Window    window;
  735. X#endif
  736. X{
  737. X    DisplayLevelInfo(display, window, level);
  738. X}
  739. X
  740. X#if NeedFunctionPrototypes
  741. Xvoid FreeLevelInfo(Display *display)
  742. X#else
  743. Xvoid FreeLevelInfo(display)
  744. X    Display *display;
  745. X#endif
  746. X{
  747. X    /* Free the life pixmap  */
  748. X    if (lifePixmap)        XFreePixmap(display, lifePixmap);
  749. X    if (lifeMask)        XFreePixmap(display, lifeMask);
  750. X}
  751. X
  752. X#if NeedFunctionPrototypes
  753. Xvoid DeleteABullet(Display *display)
  754. X#else
  755. Xvoid DeleteABullet(display)
  756. X    Display *display;
  757. X#endif
  758. X{
  759. X    bulletPos = 192 - (GetNumberBullets() * 9);
  760. X
  761. X    /* Take a bullet away from ammo belt */
  762. X    EraseTheBullet(display, levelWindow, bulletPos, 43);
  763. X
  764. X    DecNumberBullets();
  765. X}
  766. X
  767. X#if NeedFunctionPrototypes
  768. Xvoid AddABullet(Display *display)
  769. X#else
  770. Xvoid AddABullet(display)
  771. X    Display *display;
  772. X#endif
  773. X{
  774. X    IncNumberBullets();
  775. X
  776. X    bulletPos = 192 - (GetNumberBullets() * 9);
  777. X
  778. X    /* Add a bullet to the ammo belt */
  779. X    DrawTheBullet(display, levelWindow, bulletPos, 43);
  780. X}
  781. X
  782. X#if NeedFunctionPrototypes
  783. Xvoid ReDrawBulletsLeft(Display *display)
  784. X#else
  785. Xvoid ReDrawBulletsLeft(display)
  786. X    Display *display;
  787. X#endif
  788. X{
  789. X    int x, i;
  790. X
  791. X    /* Draw the bullets in the ammo belt */
  792. X    for (i = 0; i < GetNumberBullets(); i++)
  793. X    {
  794. X        x = 192 - ((i+1) * 9);
  795. X        DrawTheBullet(display, levelWindow, x, 43);
  796. X    } 
  797. X}
  798. X
  799. X#if NeedFunctionPrototypes
  800. Xvoid DecExtraLife(Display *display)
  801. X#else
  802. Xvoid DecExtraLife(display)
  803. X    Display *display;
  804. X#endif
  805. X{
  806. X    /* Take a life */
  807. X    livesLeft--;
  808. X
  809. X    if (livesLeft < 0) 
  810. X        livesLeft = 0;
  811. X
  812. X    /* redraw the level info */
  813. X    DisplayLevelInfo(display, levelWindow, level);
  814. X}
  815. X
  816. X#if NeedFunctionPrototypes
  817. Xvoid AddExtraLife(Display *display)
  818. X#else
  819. Xvoid AddExtraLife(display)
  820. X    Display *display;
  821. X#endif
  822. X{
  823. X    /* Add a new life */
  824. X    livesLeft++;
  825. X
  826. X    /* Dont issue too many extra balls! */
  827. X    if (livesLeft >= MAX_LIVES) 
  828. X        livesLeft = MAX_LIVES;
  829. X    else
  830. X        SetCurrentMessage(display, messWindow, "Extra ball", True);
  831. X
  832. X    /* redraw the level info */
  833. X    DisplayLevelInfo(display, levelWindow, level);
  834. X}
  835. X
  836. X#if NeedFunctionPrototypes
  837. Xvoid CheckAndAddExtraLife(Display *display, long score)
  838. X#else
  839. Xvoid CheckAndAddExtraLife(display, score)
  840. X    Display *display;
  841. X    long score;
  842. X#endif
  843. X{
  844. X    static int ballInc = 0;
  845. X
  846. X    /* Add a new life? */
  847. X    if ((score) && ((score / NEW_LIVE_SCORE_INC) != ballInc)) 
  848. X    {
  849. X        /* Add a new life */
  850. X        AddExtraLife(display);
  851. X    }
  852. X
  853. X    /* Next inc before adding a new life */
  854. X    ballInc = score / NEW_LIVE_SCORE_INC;
  855. X}
  856. X
  857. X#if NeedFunctionPrototypes
  858. Xvoid HandleGameTimer(Display *display, Window window)
  859. X#else
  860. Xvoid HandleGameTimer(display, window)
  861. X    Display *display;
  862. X    Window window;
  863. X#endif
  864. X{
  865. X    static time_t oldTime = 0;
  866. X
  867. X    /* Time to decrement the timer */
  868. X    if (time(NULL) > oldTime)
  869. X    {
  870. X        /* Decrement the timer bonus */
  871. X        DecLevelTimeBonus(display, timeWindow);
  872. X        oldTime = time(NULL);
  873. X    }
  874. X}
  875. X
  876. X#if NeedFunctionPrototypes
  877. Xvoid CheckGameRules(Display *display, Window window)
  878. X#else
  879. Xvoid CheckGameRules(display, window)
  880. X    Display *display;
  881. X    Window window;
  882. X#endif
  883. X{
  884. X    int b = 0;
  885. X
  886. X    CheckAndAddExtraLife(display, score);
  887. X
  888. X    HandleGameTimer(display, window);
  889. X
  890. X    if (StillActiveBlocks() == False)
  891. X    {
  892. X        /* Turn off the x2 x4 bonuses */
  893. X        Togglex2Bonus(display, False);
  894. X        Togglex4Bonus(display, False);
  895. X        DrawSpecials(display);
  896. X
  897. X        /* How many balls still left after level */
  898. X        b = GetNumberOfActiveBalls();
  899. X        if (b > 1)
  900. X        {
  901. X            /* Put back on the status area the number of balls left */
  902. X            while (--b)
  903. X                AddExtraLife(display);
  904. X        }
  905. X
  906. X        /* Give the play a big head */
  907. X        if (noSound == False) playSoundFile("applause", 70);
  908. X
  909. X        /* Finished level now so set up bonus screen */
  910. X        mode = MODE_BONUS;
  911. X        SetupBonusScreen(display, mainWindow);
  912. X    }
  913. X}
  914. X
  915. X#if NeedFunctionPrototypes
  916. Xvoid UpdateHighScores(void)
  917. X#else
  918. Xvoid UpdateHighScores()
  919. X#endif
  920. X{
  921. X    time_t endTime;
  922. X    u_long theLevel;
  923. X
  924. X    /* Obtain the game duration in seconds - taking account for pauses */
  925. X    endTime = time(NULL) - gameTime - pausedTime;
  926. X
  927. X    /* Adjust the level so that the starting level is taken into account */
  928. X    theLevel = level - (u_long) GetStartingLevel() + 1L;
  929. X
  930. X    /* Update the high score table */
  931. X    (void) CheckAndAddScoreToHighScore(score, theLevel, endTime, PERSONAL);
  932. X    if (CheckAndAddScoreToHighScore(score, theLevel, endTime, GLOBAL) == False)
  933. X        ResetHighScore(PERSONAL);
  934. X    else
  935. X        ResetHighScore(GLOBAL);
  936. X}
  937. X
  938. X
  939. X#if NeedFunctionPrototypes
  940. Xvoid EndTheGame(Display *display, Window window)
  941. X#else
  942. Xvoid EndTheGame(display, window)
  943. X    Display *display;
  944. X    Window window;
  945. X#endif
  946. X{
  947. X    /* Game over man! */
  948. X    SetCurrentMessage(display, messWindow, "- Game Over - ", True);
  949. X
  950. X    if (noSound == False)
  951. X        playSoundFile("game_over", 100);
  952. X
  953. X    UpdateHighScores();
  954. X
  955. X    /* Reset game and setup for high score table */
  956. X    gameActive = False;
  957. X    SetLevelNumber(GetStartingLevel());
  958. X    ResetIntroduction();
  959. X    mode = MODE_HIGHSCORE;
  960. X
  961. X    TurnSpecialsOff(display);
  962. X}
  963. X
  964. X#if NeedFunctionPrototypes
  965. Xvoid DeadBall(Display *display, Window window)
  966. X#else
  967. Xvoid DeadBall(display, window)
  968. X    Display *display;
  969. X    Window window;
  970. X#endif
  971. X{
  972. X
  973. X    /* Decrement the number of lives left and display so */
  974. X    livesLeft--;
  975. X    DisplayLevelInfo(display, levelWindow, level);
  976. X
  977. X    /* Disable some of the specials */
  978. X    Togglex2Bonus(display, False);
  979. X    Togglex4Bonus(display, False);
  980. X    ToggleKiller(display, False);
  981. X    DrawSpecials(display);
  982. X
  983. X    SetCurrentMessage(display, messWindow, "Ball vapourised!", True);
  984. X
  985. X    if (livesLeft < 0 && GetAnActiveBall() == -1)
  986. X        EndTheGame(display, window);
  987. X    else 
  988. X    {
  989. X        if (noSound == False) playSoundFile("balllost", 100);
  990. X        ResetBallStart(display, window);
  991. X    }
  992. X}
  993. X
  994. X#if NeedFunctionPrototypes
  995. Xchar *GetLevelName(void)
  996. X#else
  997. Xchar *GetLevelName()
  998. X#endif
  999. X{
  1000. X    /* Return the name of the current level */
  1001. X    return (levelTitle);
  1002. X}
  1003. X
  1004. X#if NeedFunctionPrototypes
  1005. Xint ReadNextLevel(Display *display, Window window, char *levelName)
  1006. X#else
  1007. Xint ReadNextLevel(display, window, levelName)
  1008. X    Display *display;
  1009. X    Window window;
  1010. X    char *levelName;
  1011. X#endif
  1012. X{
  1013. X    FILE *levelFile;
  1014. X    int row, col, type;
  1015. X    char str[BUF_SIZE];
  1016. X    int    timeLimit = 180;
  1017. X
  1018. X    /* Clear all existing mess in structures */
  1019. X    ClearBlockArray();
  1020. X
  1021. X    /* Setup the new level data */
  1022. X    blocksExploding = 0;
  1023. X    colWidth     = PLAY_WIDTH / MAX_COL;
  1024. X    rowHeight     = PLAY_HEIGHT / MAX_ROW;
  1025. X    bonusBlock     = False;
  1026. X    ResetNumberBonus();
  1027. X
  1028. X    /* Open the new level data file for reading */
  1029. X    if ((levelFile = fopen(levelName, "r")) == NULL)
  1030. X    {
  1031. X        ErrorMessage("Cannot load level data - check level directory.");
  1032. X        return False;
  1033. X    }
  1034. X
  1035. X    /* Obtain the title string */
  1036. X    fgets(levelTitle, BUF_SIZE, levelFile);
  1037. X
  1038. X    /* Now get the time bonus from the level file */
  1039. X    fgets(str, BUF_SIZE, levelFile);
  1040. X    if (sscanf(str, "%d", &timeLimit) != 1)
  1041. X    {
  1042. X        ErrorMessage("Cannot parse level data - time bonus error.");
  1043. X        return False;
  1044. X    }
  1045. X
  1046. X    /* Set and draw the time limit for the level */
  1047. X    SetLevelTimeBonus(display, timeWindow, timeLimit);
  1048. X
  1049. X    for (row = 0; row < (MAX_ROW - 3); row++)
  1050. X    {
  1051. X        for (col = 0; col < MAX_COL; col++)
  1052. X        {
  1053. X            /* Get the next character from the level data file */
  1054. X            type = fgetc(levelFile);
  1055. X
  1056. X            switch (type)
  1057. X            {
  1058. X                case 'H' :    /* hyperspace block - walls are now gone */
  1059. X                    AddNewBlock(display, window, row, col, HYPERSPACE_BLK, 0);
  1060. X                    break;
  1061. X                    
  1062. X                case 'B' :    /* bullet block - ammo */
  1063. X                    AddNewBlock(display, window, row, col, BULLET_BLK, 0);
  1064. X                    break;
  1065. X                    
  1066. X                case 'r' :    /* A red block */
  1067. X                    AddNewBlock(display, window, row, col, RED_BLK, 0);
  1068. X                    break;
  1069. X                    
  1070. X                case 'g' :    /* A green block */
  1071. X                    AddNewBlock(display, window, row, col, GREEN_BLK, 0);
  1072. X                    break;
  1073. X                    
  1074. X                case 'b' :    /* A blue block */
  1075. X                    AddNewBlock(display, window, row, col, BLUE_BLK, 0);
  1076. X                    break;
  1077. X                    
  1078. X                case 't' :    /* A tan block */
  1079. X                    AddNewBlock(display, window, row, col, TAN_BLK, 0);
  1080. X                    break;
  1081. X                    
  1082. X                case 'p' :    /* A purple block */
  1083. X                    AddNewBlock(display, window, row, col, PURPLE_BLK, 0);
  1084. X                    break;
  1085. X                    
  1086. X                case 'y' :    /* A yellow block */
  1087. X                    AddNewBlock(display, window, row, col, YELLOW_BLK, 0);
  1088. X                    break;
  1089. X                    
  1090. X                case 'w' :    /* A solid wall block */
  1091. X                    AddNewBlock(display, window, row, col, BLACK_BLK, 0);
  1092. X                    break;
  1093. X                    
  1094. X                case '0' :    /* A counter block - no number */
  1095. X                    AddNewBlock(display, window, row, col, COUNTER_BLK, 0);
  1096. X                    break;
  1097. X                    
  1098. X                case '1' :    /* A counter block level 1 */
  1099. X                    AddNewBlock(display, window, row, col, COUNTER_BLK, 1);
  1100. X                    break;
  1101. X                    
  1102. X                case '2' : /* A counter block level 2 */
  1103. X                    AddNewBlock(display, window, row, col, COUNTER_BLK, 2);
  1104. X                    break;
  1105. X                    
  1106. X                case '3' : /* A counter block level 3 */
  1107. X                    AddNewBlock(display, window, row, col, COUNTER_BLK, 3);
  1108. X                    break;
  1109. X                    
  1110. X                case '4' : /* A counter block level 4 */
  1111. X                    AddNewBlock(display, window, row, col, COUNTER_BLK, 4);
  1112. X                    break;
  1113. X                    
  1114. X                case '5' : /* A counter block level 5  - highest */
  1115. X                    AddNewBlock(display, window, row, col, COUNTER_BLK, 5);
  1116. X                    break;
  1117. X                    
  1118. X                case 'X' : /* A bomb block - arggh! */
  1119. X                    AddNewBlock(display, window, row, col, BOMB_BLK, 0);
  1120. X                    break;
  1121. X
  1122. X                case 'D' : /* A death block */
  1123. X                    AddNewBlock(display, window, row, col, DEATH_BLK, 
  1124. X                        SHOTS_TO_KILL_SPECIAL);
  1125. X                    break;
  1126. X
  1127. X                case 'L' : /* An extra ball block */
  1128. X                    AddNewBlock(display, window, row, col, EXTRABALL_BLK, 0);
  1129. X                    break;
  1130. X
  1131. X                case 'M' : /* A machine gun block */
  1132. X                    AddNewBlock(display, window, row, col, MGUN_BLK, 
  1133. X                        SHOTS_TO_KILL_SPECIAL);
  1134. X                    break;
  1135. X
  1136. X                case 'W' : /* A wall off block */
  1137. X                    AddNewBlock(display, window, row, col, WALLOFF_BLK, 
  1138. X                        SHOTS_TO_KILL_SPECIAL);
  1139. X                    break;
  1140. X
  1141. X                case '?' : /* A random changing block */
  1142. X                    AddNewBlock(display, window, row, col, RANDOM_BLK, 0);
  1143. X                    break;
  1144. X
  1145. X                case 'm' : /* A multiple ball block */
  1146. X                    AddNewBlock(display, window, row, col, MULTIBALL_BLK, 
  1147. X                        SHOTS_TO_KILL_SPECIAL);
  1148. X                    break;
  1149. X
  1150. X                case 's' : /* A sticky block */
  1151. X                    AddNewBlock(display, window, row, col, STICKY_BLK, 
  1152. X                        SHOTS_TO_KILL_SPECIAL);
  1153. X                    break;
  1154. X
  1155. X                case 'R' :    /* reverse block - switch paddle control */
  1156. X                    AddNewBlock(display, window, row, col, REVERSE_BLK, 
  1157. X                        SHOTS_TO_KILL_SPECIAL);
  1158. X                    break;
  1159. X                    
  1160. X                case '<' :    /* shrink paddle block - make paddle smaller */
  1161. X                    AddNewBlock(display, window, row, col, PAD_SHRINK_BLK, 
  1162. X                        SHOTS_TO_KILL_SPECIAL);
  1163. X                    break;
  1164. X                    
  1165. X                case '>' :    /* expand paddle block - make paddle bigger */
  1166. X                    AddNewBlock(display, window, row, col, PAD_EXPAND_BLK, 
  1167. X                        SHOTS_TO_KILL_SPECIAL);
  1168. X                    break;
  1169. X                    
  1170. X                default:
  1171. X                    break;
  1172. X            }
  1173. X        }
  1174. X
  1175. X        /* Get the newline */
  1176. X        type = fgetc(levelFile);
  1177. X    }
  1178. X
  1179. X    /* Close our level data file */
  1180. X    if (fclose(levelFile) < 0)
  1181. X        WarningMessage("Cannot close level data file.");
  1182. X
  1183. X    return True;
  1184. X}
  1185. END_OF_FILE
  1186. if test 15856 -ne `wc -c <'level.c'`; then
  1187.     echo shar: \"'level.c'\" unpacked with wrong size!
  1188. fi
  1189. # end of 'level.c'
  1190. fi
  1191. if test -f 'score.c' -a "${1}" != "-c" ; then 
  1192.   echo shar: Will not clobber existing file \"'score.c'\"
  1193. else
  1194. echo shar: Extracting \"'score.c'\" \(5369 characters\)
  1195. sed "s/^X//" >'score.c' <<'END_OF_FILE'
  1196. X#include "include/copyright.h"
  1197. X
  1198. X/*
  1199. X *  Include file dependencies:
  1200. X */
  1201. X
  1202. X#include <stdio.h>
  1203. X#include <stdlib.h>
  1204. X#include <stddef.h>
  1205. X#include <X11/Xlib.h>
  1206. X#include <X11/Xutil.h>
  1207. X#include <X11/Xos.h>
  1208. X#include <xpm.h>
  1209. X
  1210. X#include "bitmaps/digit0.xpm"
  1211. X#include "bitmaps/digit1.xpm"
  1212. X#include "bitmaps/digit2.xpm"
  1213. X#include "bitmaps/digit3.xpm"
  1214. X#include "bitmaps/digit4.xpm"
  1215. X#include "bitmaps/digit5.xpm"
  1216. X#include "bitmaps/digit6.xpm"
  1217. X#include "bitmaps/digit7.xpm"
  1218. X#include "bitmaps/digit8.xpm"
  1219. X#include "bitmaps/digit9.xpm"
  1220. X
  1221. X#include "include/error.h"
  1222. X#include "include/init.h"
  1223. X#include "include/special.h"
  1224. X#include "include/misc.h"
  1225. X
  1226. X#include "include/score.h"
  1227. X
  1228. X/*
  1229. X *  Internal macro definitions:
  1230. X */
  1231. X
  1232. X#define NUM_DIGITS    10
  1233. X
  1234. X/*
  1235. X *  Internal type declarations:
  1236. X */
  1237. X
  1238. X/*
  1239. X *  Internal variable declarations:
  1240. X */
  1241. X
  1242. XPixmap    digitPixmaps[NUM_DIGITS];
  1243. XPixmap    digitPixmapsM[NUM_DIGITS];
  1244. X
  1245. Xu_long score = 0L;
  1246. X
  1247. X
  1248. X#if NeedFunctionPrototypes
  1249. Xvoid InitialiseScoreDigits(Display *display, Window window, Colormap colormap)
  1250. X#else
  1251. Xvoid InitialiseScoreDigits(display, window, colormap)
  1252. X    Display *display;
  1253. X    Window window;
  1254. X    Colormap colormap;
  1255. X#endif
  1256. X{
  1257. X    XpmAttributes   attributes;
  1258. X    int             XpmErrorStatus;
  1259. X
  1260. X    attributes.valuemask = XpmColormap;
  1261. X    attributes.colormap = colormap;
  1262. X
  1263. X    /* Create all xpm pixmap digits from the files */
  1264. X    XpmErrorStatus = XpmCreatePixmapFromData(display, window, digit0_xpm, 
  1265. X        &digitPixmaps[0], &digitPixmapsM[0], &attributes);
  1266. X    HandleXPMError(display, XpmErrorStatus, "InitialiseScoreDigits()");
  1267. X
  1268. X    XpmErrorStatus = XpmCreatePixmapFromData(display, window, digit1_xpm, 
  1269. X        &digitPixmaps[1], &digitPixmapsM[1], &attributes);
  1270. X    HandleXPMError(display, XpmErrorStatus, "InitialiseScoreDigits()");
  1271. X
  1272. X    XpmErrorStatus = XpmCreatePixmapFromData(display, window, digit2_xpm, 
  1273. X        &digitPixmaps[2], &digitPixmapsM[2], &attributes);
  1274. X    HandleXPMError(display, XpmErrorStatus, "InitialiseScoreDigits()");
  1275. X
  1276. X    XpmErrorStatus = XpmCreatePixmapFromData(display, window, digit3_xpm, 
  1277. X        &digitPixmaps[3], &digitPixmapsM[3], &attributes);
  1278. X    HandleXPMError(display, XpmErrorStatus, "InitialiseScoreDigits()");
  1279. X
  1280. X    XpmErrorStatus = XpmCreatePixmapFromData(display, window, digit4_xpm, 
  1281. X        &digitPixmaps[4], &digitPixmapsM[4], &attributes);
  1282. X    HandleXPMError(display, XpmErrorStatus, "InitialiseScoreDigits()");
  1283. X
  1284. X    XpmErrorStatus = XpmCreatePixmapFromData(display, window, digit5_xpm, 
  1285. X        &digitPixmaps[5], &digitPixmapsM[5], &attributes);
  1286. X    HandleXPMError(display, XpmErrorStatus, "InitialiseScoreDigits()");
  1287. X
  1288. X    XpmErrorStatus = XpmCreatePixmapFromData(display, window, digit6_xpm, 
  1289. X        &digitPixmaps[6], &digitPixmapsM[6], &attributes);
  1290. X    HandleXPMError(display, XpmErrorStatus, "InitialiseScoreDigits()");
  1291. X
  1292. X    XpmErrorStatus = XpmCreatePixmapFromData(display, window, digit7_xpm, 
  1293. X        &digitPixmaps[7], &digitPixmapsM[7], &attributes);
  1294. X    HandleXPMError(display, XpmErrorStatus, "InitialiseScoreDigits()");
  1295. X
  1296. X    XpmErrorStatus = XpmCreatePixmapFromData(display, window, digit8_xpm, 
  1297. X        &digitPixmaps[8], &digitPixmapsM[8], &attributes);
  1298. X    HandleXPMError(display, XpmErrorStatus, "InitialiseScoreDigits()");
  1299. X
  1300. X    XpmErrorStatus = XpmCreatePixmapFromData(display, window, digit9_xpm, 
  1301. X        &digitPixmaps[9], &digitPixmapsM[9], &attributes);
  1302. X    HandleXPMError(display, XpmErrorStatus, "InitialiseScoreDigits()");
  1303. X
  1304. X    /* Free the xpm pixmap attributes */
  1305. X    XpmFreeAttributes(&attributes);
  1306. X}
  1307. X
  1308. X#if NeedFunctionPrototypes
  1309. Xstatic void DrawDigit(Display *display, Window window, int digit, int x, int y)
  1310. X#else
  1311. Xstatic void DrawDigit(display, window, digit, x, y)
  1312. X    Display *display;
  1313. X    Window window;
  1314. X    int digit;
  1315. X    int x;
  1316. X    int y;
  1317. X#endif
  1318. X{
  1319. X    /* Draw the digit in the window */
  1320. X    RenderShape(display, window, 
  1321. X        digitPixmaps[digit], digitPixmapsM[digit], x, y, 30, 40, True);
  1322. X}
  1323. X
  1324. X#if NeedFunctionPrototypes
  1325. Xvoid DrawOutNumber(Display *display, Window window, u_long score, int x, int y)
  1326. X#else
  1327. Xvoid DrawOutNumber(display, window, score, x, y)
  1328. X    Display *display;
  1329. X    Window window;
  1330. X    u_long score;
  1331. X    int x;
  1332. X    int y;
  1333. X#endif
  1334. X{
  1335. X    int digit;
  1336. X
  1337. X    /* Get the digit that we want from the score */
  1338. X    if (score / 10)
  1339. X        DrawOutNumber(display, window, (score / 10), x - 32, y);
  1340. X
  1341. X    /* Work out the digit needed to draw */
  1342. X    digit = (score % 10);
  1343. X
  1344. X    DrawDigit(display, window, digit, x - 32, y);
  1345. X}
  1346. X
  1347. X#if NeedFunctionPrototypes
  1348. Xvoid AddToScore(u_long inc)
  1349. X#else
  1350. Xvoid AddToScore(inc)
  1351. X    u_long inc;
  1352. X#endif
  1353. X{
  1354. X    /* Take into account any score bonuses */
  1355. X    if (x2Bonus == True)
  1356. X        inc *= 2;
  1357. X    else if (x4Bonus == True)
  1358. X        inc *= 4;
  1359. X
  1360. X    /* Increment the score */
  1361. X    score += inc;
  1362. X}
  1363. X
  1364. X#if NeedFunctionPrototypes
  1365. Xvoid DisplayScore(Display *display, Window window, u_long score)
  1366. X#else
  1367. Xvoid DisplayScore(display, window, score)
  1368. X    Display *display;
  1369. X    Window window;
  1370. X    u_long score;
  1371. X#endif
  1372. X{
  1373. X    /* Erase the old score in the window */
  1374. X    XClearWindow(display, window);
  1375. X
  1376. X    /* Draw a zero if no score */
  1377. X    if (score == 0L)
  1378. X        RenderShape(display, window, 
  1379. X            digitPixmaps[0], digitPixmapsM[0], 192, 0, 30, 40, True);
  1380. X    else
  1381. X        /* Draw the score digits rescursively */
  1382. X        DrawOutNumber(display, window, score, 224, 0);
  1383. X}
  1384. X
  1385. X#if NeedFunctionPrototypes
  1386. Xvoid FreeScoreDigits(Display *display)
  1387. X#else
  1388. Xvoid FreeScoreDigits(display)
  1389. X    Display *display;
  1390. X#endif
  1391. X{
  1392. X    int i;
  1393. X
  1394. X    /* Free the memory associated with the digit pixmaps */
  1395. X    for (i = 0; i < NUM_DIGITS; i++)
  1396. X    {
  1397. X        /* Free the digits pixmap and mask */
  1398. X        if (digitPixmaps[i])    XFreePixmap(display, digitPixmaps[i]);
  1399. X        if (digitPixmapsM[i])    XFreePixmap(display, digitPixmapsM[i]);
  1400. X    }
  1401. X}
  1402. X
  1403. END_OF_FILE
  1404. if test 5369 -ne `wc -c <'score.c'`; then
  1405.     echo shar: \"'score.c'\" unpacked with wrong size!
  1406. fi
  1407. # end of 'score.c'
  1408. fi
  1409. if test -f 'xboing.man' -a "${1}" != "-c" ; then 
  1410.   echo shar: Will not clobber existing file \"'xboing.man'\"
  1411. else
  1412. echo shar: Extracting \"'xboing.man'\" \(15702 characters\)
  1413. sed "s/^X//" >'xboing.man' <<'END_OF_FILE'
  1414. X.TH XBOING 6 "August 1993" "X Version 11"
  1415. X.SH NAME
  1416. X
  1417. X\fIxboing\fP \- An X Window System based blockout clone. V1.7
  1418. X
  1419. X.SH SYNOPSIS
  1420. X
  1421. X\fIxboing\fP [-version] [-usage] [-help] [-sync] [-display <displayName>] [-speed <1-10>] [-scores] [-keys] [-sound] [-setup] [-nosfx] [-nograb] [-maxvol <1-100>] [-startlevel <1-MAXLEVELS>] [-usedefcmap]
  1422. X
  1423. X    -speed <n>         - The game speed, 1 - 9. 9=Fast
  1424. X    -maxvol <n>        - The maximum volume as percentage
  1425. X    -startlevel <n>    - The starting level for game.
  1426. X    -help              - Produce this help message.
  1427. X    -sync              - Turn on X synchronisation.
  1428. X    -usage             - Print a brief help message.
  1429. X    -version           - Print out the current version.
  1430. X    -scores            - Print out current highscores.
  1431. X    -keys              - Use keys instead of mouse control.
  1432. X    -sound             - Turn audio ON for game.
  1433. X    -setup             - Print setup information.
  1434. X    -nosfx             - Turn off special effects.
  1435. X    -nograb            - Turn pointer grabbing off.
  1436. X    -usedefcmap        - Use the default colourmap.
  1437. X    -display <display> - Set the display for the game.
  1438. X
  1439. X.SH DESCRIPTION
  1440. X
  1441. X\fIXBoing\fP is a simple blockout type game where you have a paddle which you control to bounce a ball around the game area destroying blocks with the proton ball. 
  1442. X
  1443. XEach block carries a different point value. The more blocks you destroy, the better your score. The person with the highest score wins.
  1444. X
  1445. XThe play area is filled with blocks and other objects. You have a paddle that
  1446. Xcan move from left to right at the bottom of the arena. You move the paddle
  1447. Xso that the proton ball bounces around blowing up blocks does not go past the
  1448. Xpaddle and out the bottom, much like a pinball game.
  1449. X
  1450. XThe blocks exhibit different behaviour. The bomb block when hit will explode all
  1451. Xblocks around it. If another bomb is beside it then it will go off also. The
  1452. Xsolid wall brick will not explode unless next a bomb. The ammunition block will
  1453. Xgive you four bullets and so on. Special blocks such as reverse and machine gun will only last for one level.
  1454. X
  1455. XThere are random blocks that change their colour and therefore their points every now and then. They add a bit of change to the levels.
  1456. X
  1457. XThere is a pirate symbol that will kill your ball if touched. You can shoot this block 3 times to kill it but you will lose 1000 points. Keep away from the Death block, it kills your ball!
  1458. XThe walls off block will turn the wall bounce off on both the left and right side of the playing area. This will mean the ball will not bounce off but continue through the wall and wrap around to the other side respectively.
  1459. X
  1460. XThe reverse block will when hit reverse the controls to the paddle. This block should be avoided as it makes the game really hard. Hitting another reverse while already in reverse mode will turn it off.
  1461. X
  1462. XThe teleport block will teleport the ball somewhere else on that level. It will not place you too close to the bottom of the screen or on another block.
  1463. X
  1464. XThe sticky paddle block will stick the ball to your paddle each time it is hit and wait until you press space to shoot it off again. This can be a #$%$#@! and also useful for lining up shots for hard bricks.
  1465. X
  1466. XThere is a machine gun block that allows you to shoot much faster. Note that you will also go through your bullets at a great rate. Can be fun to let off a burst every now and then. Erases counter blocks very fast.
  1467. X
  1468. XAn extra ball symbol may appear and when shot or hit with another ball it will give you an extra ball!
  1469. X
  1470. XThere is a shrink paddle block that will shrink you paddle to a smaller size for the level. If you currently have the smallest paddle then it has no effect.
  1471. X
  1472. XThere is an expand paddle block that will grow you paddle to a larger size for the level. If you currently have the largest paddle then it has no effect.
  1473. X
  1474. XYou can use the bullets to shoot the last pesky blocks or to collet lots of
  1475. XYou can use the bullets to shoot the last pesky blocks or to collet lots of
  1476. Xbonus coins. You will be given 4 bullets when a new level starts. If you lose
  1477. Xa ball you will be given a token 2 bullets. Use bullets wisely as you will
  1478. Xhate yourself when there is one brick left and the ball is missing it for ever.
  1479. X
  1480. XThroughout the game the bonus coins will appear. Collect these for bonus points when the level is finished. Sometimes the coin may appear as a x2 or x4 symbol which will indicate that the scoring from now onwards will be multiplied by 2 or 4 respectively. Note: if you get a x2 then x4 then x2 you will go back to x2 mode. Also note that this x2 or x4 mode will be disabled after each ball death.
  1481. X
  1482. XIf you collect more than 10 bonuses during a level the killer mode is activated which will turn the ball red and the ball will plough through all blocks except the solid ones and finish off the level very quickly. You will also receive the SUPER BONUS on the bonus screen.
  1483. X
  1484. XThe bonus screen will tell you how you went in the last level. Your bonuses
  1485. Xwill be added and the bullet and level bonus will be added. You get 500 points
  1486. Xfor each bullet not used. You get 3000 points for each bonus and if you get
  1487. Xmore than 10 bonuses you get a SUPER BONUS of 50000 points. You also get a new
  1488. Xball every 100,000 points. Pressing space will skip the bonus animations when
  1489. Xthe bonus screen appears. Your bonus score will still be added.
  1490. X
  1491. XThere is a level timer that counts down while playing the level. If you don't
  1492. Xcomplete the level in time you will not get the time bonus which is 100 points
  1493. Xper second remaining. You will also miss out on the level bonus if your time runs out.
  1494. X
  1495. XThe ball will be automatically shot off the paddle after about 5 seconds unless you press the space bar. You can always press P to pause the game.
  1496. X
  1497. XIf the ball gets stuck in an infinite loop it will automatically tilt the board if the ball hasn't hit the paddle after a certain time span. The time span is about 8 seconds I think.
  1498. X
  1499. XXBoing was started like many other projects to learn Xlib better. I had the
  1500. XXPM library and was already using it in a Motif application. I thought that it
  1501. Xwould be cool to have nice colour pictures/animations in an Xlib game. So I
  1502. Xdid. Without the XPM library I would be still playing with the colours I think.
  1503. X
  1504. X.SH OPTIONS
  1505. X
  1506. XThe \fIspeed\fP option will adjust the speed of the overall game. It will except integer numbers between 1 and 9. This option is a little dodgy. The speed of the game can be changed from within the game as well. See Game Control. The default value is 1.
  1507. X
  1508. XThe \fImaxvol\fP option allows you to adjust the maximum volume to be used for the sound effects if sound is supported. It doesn't mean all sounds will be this volume but they will use that volume as the top volume to scale against.
  1509. X
  1510. XThe \fIstartlevel\fP option allows you to set the starting level for your games. Note that when your score is placed in the highscore table the level number is the number of levels completed and not the level number attained. Also, in the bonus screen your level bonus will be the number of levels completed multiplied by the level bonus value and not the current level number!
  1511. X
  1512. XThe \fIhelp\fP option will display a brief one line description of all the command line options used with xboing.
  1513. X
  1514. XThe \fIsync\fP option will turn on the X Window System synchronisation of all Xlib calls which means that all calls are flushed by the X server before continuing. This will cause the game to become slower but enable some debugging. The default is OFF.
  1515. X
  1516. XThe \fIusage\fP option will print a very brief synopsis of all the command line options and there value ranges.
  1517. X
  1518. XThe \fIversion\fP option prints the version of xboing that you are running.
  1519. X
  1520. XThe \fIscores\fP option will print both the roll of honour and your personal best scores to standard out. This can be useful if you are not running the program on an X window display and still want to see what the scores are.
  1521. X
  1522. XThe \fIkeys\fP option will enable the use of the keyboard for game control. Within the game you may press <g> to toggle between mouse and key control. The default is MOUSE control.
  1523. X
  1524. XThe \fIsound\fP option will enable sound to be turned on if possible. The default is OFF.
  1525. X
  1526. XThe \fIsetup\fP option is useful when you have just compiled the program. It will display the paths of the level & sound directories and also give you some information on other things.
  1527. X
  1528. XThe \fInosfx\fP option will turn OFF special effects. The special effect in question at this stage is the explosion shake. Turning it off will speed the game up a little bit. The default is ON. Servers without backing store will have it turn off automatically as the shaking is shocking.
  1529. X
  1530. XThe \fInograb\fP option will make xboing not grab the pointer when the game is visible. Pointer grabbing has the effect of stopping you move the pointer outside the game window. This is useful as it constrains the mouse and you don't get colourmap flashes. The default is ON.
  1531. X
  1532. XThe \fIusedefcmap\fP option will make xboing try to use the default colourmap. This will be fine if the default colourmap is reasonabily empty. If you have a complex picture on your background then this option will not work and xboing will be unable to allocate enough colours.
  1533. X
  1534. XThe \fIdisplay\fP option will allow you to force the game to be viewed on another display. The format of the display name is <xserver:0.0> like most other programs where xserver is the name of the display. The default is your display of course.
  1535. X
  1536. XYou may also set three environment variables used by xboing. They specify the location of the level files, sounds and the highscore file. They are listed below.
  1537. X
  1538. XXBOING_SCORE_FILE = the highscore file to be used.
  1539. XXBOING_LEVELS_DIR = the directory containing the levels.
  1540. XXBOING_SOUND_DIR  = the directory containing the sounds.
  1541. X
  1542. XThey will override the settings that are compiled into the program.
  1543. X
  1544. X.SH GAME CONTROL
  1545. X.PP
  1546. XYou must have specified "-keys" on the command line to use the keys for
  1547. Xthe paddle control. The default is to use the mouse control method.
  1548. X.nf
  1549. X
  1550. XJ = Paddle Left
  1551. XLeftArrow = Paddle Left
  1552. XK = Shoot bullet
  1553. XL = Paddle Right
  1554. XRightArrow = Paddle Right
  1555. X
  1556. XAll Mouse Buttons = Shoot Bullet/Start ball
  1557. X
  1558. XUse the mouse to move the paddle left and right by moving the mouse 
  1559. Xleft and right. The paddle will follow the mouse pointer. This is
  1560. Xthe best method and easiest to use by far.
  1561. X
  1562. XSpace   = Start game
  1563. XEscape  = End game and return to introduction.
  1564. Xi       = iconify the game and pause.
  1565. XH       = View roll of honour.
  1566. Xh       = View personal highscores.
  1567. Xp       = Pause game.
  1568. Xd       = Kill the ball.
  1569. Xa       = Toggle audio on/off
  1570. Xs       = Toggle special effects on/off
  1571. Xc       = Cycle through the intro screens.
  1572. X1-9    = Game speed where 9 is fastest.
  1573. Xq       = Quit XBoing
  1574. X
  1575. XNote: Highscores are saved at the end of each game.
  1576. X.fi
  1577. X.PP
  1578. X.SH SCORING
  1579. X
  1580. XEach blocks has a certain point score. Some blocks such as the counter block will have more than one score associated with it.
  1581. X
  1582. X.nf
  1583. Xred = 100
  1584. Xblue = 110
  1585. Xgreen = 120
  1586. Xyellow = 140
  1587. Xtan = 130
  1588. Xpurple = 150
  1589. Xbomb = 50 plus the surrounding blocks points
  1590. Xwall = 0
  1591. Xpirate = 100
  1592. Xreverse = 100
  1593. Xammo = 50 plus bullets
  1594. Xcounter = 200 (each number). 
  1595. X.fi
  1596. X
  1597. XEach time the paddle is hit with the ball your earn 10 points. I'm nice.
  1598. X
  1599. XThere are death symbols (a pirate) that when hit by a ball will kill the ball. You can shoot them but you will lose 1000 points.
  1600. X
  1601. XThe bonus coins are 3000 points - but only added to score if you reach the end of the level and go through the bonus screen.
  1602. X
  1603. XIf you collect more than 10 bonus coins you get a Super Bonus of 50,000 points. Each remaining bullet after a level is worth 500 points.
  1604. X
  1605. XAt the end of each level you are awarded a level bouns which is level <n> x 1000 points. So for level 20 you get 20,000 points! If you fail to complete the level in the time allotted you will not receive a level bonus.
  1606. X
  1607. XThere are now two highscore files. One displays the global scores which will be your best score to date. The other is a personal high score table with all your attempts.
  1608. X
  1609. X.SH SOUND SUPPORT
  1610. X
  1611. XXboing has limited support for sound. It has sound code for the following machines :-
  1612. X
  1613. XHP, SUN, NCD Xterminals, LINUX PC Soundblaster, RPLAY sound system.
  1614. X
  1615. XMost support and use the SUN .au format sound files. The linux version just sends the data down to the audio device which may cause slight clicking sounds due to the audio file header. Future versions of xboing will support other machines if patches are sent to me or if I learn the sound format. SGI will be next but they have their own format, argghh. I am not going to have heaps of converted files all over the place in different formats as the archive would be HUGE.
  1616. X
  1617. X.SH LEVELS
  1618. X
  1619. XThe levels are not increasingly harder to play - some are but some are easy. This is because it takes ages to create and design levels. The paddle does get smaller as the game goes on. This makes it REALLY hard. I may also add a ball speedup feature.
  1620. X
  1621. XThe level data is a simple ASCII file format that can be edited. The levels
  1622. Xare loaded when required from the directory specified when the game was made.
  1623. X
  1624. XYou can create more levels if you like making sure that they are in the correct
  1625. Xformat and that they have a correct filename format.
  1626. X
  1627. XCopy level0.data to level??.data and use that for the editing of new levels.
  1628. X
  1629. Xlevel format:    (case sensitive)
  1630. X
  1631. X    w = wall block
  1632. X    r = red block
  1633. X    g = green block
  1634. X    b = blue block
  1635. X    t = tan block
  1636. X    p = purple block
  1637. X    y = yellow block
  1638. X    X = Bomb
  1639. X    B = Ammo
  1640. X    . = blank
  1641. X    D = Death
  1642. X    R = Reverse
  1643. X    H = Teleport
  1644. X    L = Extra ball
  1645. X    M = Machine Gun
  1646. X    W = Walls off
  1647. X    ? = Random block
  1648. X    m = Multiple balls
  1649. X    s = sticky block
  1650. X    < = Shrink paddle block
  1651. X    > = Grow paddle block
  1652. X
  1653. XThe format of the level is shown in the newlevel.data file in the source distribution in the levels directory.
  1654. X
  1655. XMake sure you have a level title and a time bonus in seconds.
  1656. X
  1657. X.SH NOTES
  1658. X
  1659. XObatin all new versions from ftp.x.org or a mirror site.
  1660. X
  1661. X.SH REDISTRIBUTION 
  1662. X
  1663. X(c) Copyright 1993, Justin C. Kibell, All Rights Reserved
  1664. X
  1665. XPermission to use, copy, modify, and distribute this software and its documentation without written agreement is hereby granted. You cannot sell this software without written permission from the author. This entire copyright notice must appear in all copies of this software.
  1666. X
  1667. XIN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  1668. X
  1669. XTHE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE AUTHOR HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  1670. X
  1671. X.SH AUTHOR
  1672. X
  1673. XJustin C. Kibell - Systems Programmer - CATT Centre CITRI Melbourne - Victoria - Australia.  email: jck@citri.edu.au
  1674. XSnailMail: 1/17 Albert Road, North Warrandyte, Victoria, Australia, 3113
  1675. X
  1676. XComputer Science Graduate - Royal Melbourne Institute of Technology (RMIT) - Australia
  1677. X
  1678. X.SH BUGS
  1679. X
  1680. XSee README documents in source distribution for list of bugs and bug fixes. 
  1681. X
  1682. XMail all bug reports/suggestions to jck@citri.edu.au specifying the version and machine type you are using. Use 'uname -a' to explain the machine type. Please note the version of X11 that you have installed as well, ie: X11R5, X11R4, etc.
  1683. X
  1684. XPlease note that xboing will run like a pig on the xnews X server distributed with Sun machines. Please try to use the MIT X Server that comes with the X Window System.
  1685. END_OF_FILE
  1686. if test 15702 -ne `wc -c <'xboing.man'`; then
  1687.     echo shar: \"'xboing.man'\" unpacked with wrong size!
  1688. fi
  1689. # end of 'xboing.man'
  1690. fi
  1691. echo shar: End of archive 21 \(of 30\).
  1692. cp /dev/null ark21isdone
  1693. MISSING=""
  1694. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ; do
  1695.     if test ! -f ark${I}isdone ; then
  1696.     MISSING="${MISSING} ${I}"
  1697.     fi
  1698. done
  1699. if test "${MISSING}" = "" ; then
  1700.     echo You have unpacked all 30 archives.
  1701.     echo "Now execute sdecode.sh to build files."
  1702.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1703. else
  1704.     echo You still need to unpack the following archives:
  1705.     echo "        " ${MISSING}
  1706. fi
  1707. ##  End of shell archive.
  1708. exit 0
  1709.