home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume18 / xmpb / part07 < prev    next >
Encoding:
Internet Message Format  |  1993-07-11  |  59.7 KB

  1. Path: uunet!news.tek.com!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v18i007:  xmpb - multiplayer space combat for X, Part07/08
  5. Date: 26 Jun 1993 00:33:01 GMT
  6. Organization: Tektronix, Inc, Redmond, OR, USA
  7. Lines: 2773
  8. Approved: billr@saab.CNA.TEK.COM
  9. Message-ID: <20g5ft$6sq@ying.cna.tek.com>
  10. NNTP-Posting-Host: saab.cna.tek.com
  11. Xref: uunet comp.sources.games:1797
  12.  
  13. Submitted-by: ddp@deakin.edu.au (Damien De Paoli)
  14. Posting-number: Volume 18, Issue 7
  15. Archive-name: xmpb/Part07
  16. Environment: X11, Xlib
  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 7 (of 8)."
  27. # Contents:  beam.npc bitmaps/bigrock bitmaps/cloud.2 bitmaps/debris.1
  28. #   bitmaps/debris.2 bitmaps/medrock bitmaps/shortdeaddude
  29. #   calc_angle.c calc_shields.c clear_lock.man collide.c costab.c
  30. #   describe.c describe.man do_stars.c harry.npc john.npc ml2.npc
  31. #   operators.h pcomp.h rad2.npc rad3.npc read_ship.c retire.c
  32. #   retire.man save.h save_load.c shop.icon shop_ui.h sin.c sintab.c
  33. #   thrust.c ud_win.c weapon.h
  34. # Wrapped by billr@saab on Fri Jun 25 16:30:16 1993
  35. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  36. if test -f 'beam.npc' -a "${1}" != "-c" ; then 
  37.   echo shar: Will not clobber existing file \"'beam.npc'\"
  38. else
  39. echo shar: Extracting \"'beam.npc'\" \(559 characters\)
  40. sed "s/^X//" >'beam.npc' <<'END_OF_FILE'
  41. XNPC
  42. XName = BeamJack
  43. XShip = LightHouse
  44. XEnergyMax = 1000
  45. XLShieldMax = 1200
  46. XRShieldMax = 1200
  47. XBShieldMax = 800
  48. XSolar = 6
  49. XShortRange = none
  50. XEngine = none
  51. XRepair = 9
  52. XLongRange = 1
  53. XJammer = 6
  54. XTC = 1
  55. X
  56. XWeapons
  57. XHLaser
  58. XLLaser
  59. X
  60. Xvar 
  61. X    num
  62. Xend
  63. X
  64. XState start
  65. X{
  66. X    set B2 = 1;
  67. X    choose();
  68. X    1 -> beam;
  69. X}
  70. X
  71. XState beam
  72. X{
  73. X    set Jamming = 0;
  74. X    if(!EnemyAvail)
  75. X        choose();
  76. X
  77. X    set B1 = 0;
  78. X    while(EnemyAvail && Angle != EnemyAngle)
  79. X        set TurnTo = EnemyAngle;
  80. X    set B1 = 1;
  81. X}
  82. X
  83. XProc choose
  84. X{
  85. X    set B1 = 0;
  86. X    set Jamming = 1;
  87. X    if(NumEnemies)
  88. X    {
  89. X        set SelectEnemy = 0;
  90. X        return;
  91. X    }
  92. X}
  93. X
  94. XStart start
  95. END_OF_FILE
  96. if test 559 -ne `wc -c <'beam.npc'`; then
  97.     echo shar: \"'beam.npc'\" unpacked with wrong size!
  98. fi
  99. # end of 'beam.npc'
  100. fi
  101. if test -f 'bitmaps/bigrock' -a "${1}" != "-c" ; then 
  102.   echo shar: Will not clobber existing file \"'bitmaps/bigrock'\"
  103. else
  104. echo shar: Extracting \"'bitmaps/bigrock'\" \(2273 characters\)
  105. sed "s/^X//" >'bitmaps/bigrock' <<'END_OF_FILE'
  106. X#define bigrock_width 50
  107. X#define bigrock_height 50
  108. Xstatic char bigrock_bits[] = {
  109. X   0x00, 0x00, 0xce, 0xc3, 0x01, 0x00, 0x00, 0x00, 0x20, 0xce, 0xc3, 0x01,
  110. X   0x00, 0x00, 0x00, 0xfc, 0xf1, 0xff, 0x1f, 0x00, 0x00, 0x00, 0xfe, 0xf1,
  111. X   0xff, 0x5f, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00,
  112. X   0xee, 0xff, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0xef, 0x7f, 0xff, 0x7f, 0x00,
  113. X   0x00, 0x80, 0xef, 0xbf, 0xcf, 0xbf, 0x00, 0x00, 0x88, 0xf7, 0xfb, 0xdf,
  114. X   0xaf, 0x01, 0x00, 0xf8, 0xff, 0xff, 0xfb, 0xff, 0x07, 0x00, 0xf0, 0xbf,
  115. X   0xff, 0xf3, 0xff, 0x27, 0x00, 0xfe, 0xff, 0xff, 0xef, 0xff, 0xf9, 0x00,
  116. X   0xfe, 0x9f, 0xff, 0xff, 0xfc, 0xf9, 0x00, 0xfc, 0x9b, 0x7d, 0xff, 0xfb,
  117. X   0x7f, 0x00, 0xfc, 0xbf, 0x9f, 0xff, 0xff, 0xbf, 0x01, 0x7c, 0xdf, 0xfe,
  118. X   0xfb, 0xbf, 0xff, 0x00, 0xfc, 0x9f, 0xff, 0xfb, 0xff, 0xff, 0x01, 0xff,
  119. X   0xff, 0xf3, 0xeb, 0xf7, 0xf3, 0x00, 0xbf, 0xff, 0xff, 0xdf, 0xef, 0xff,
  120. X   0x00, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xff, 0x00, 0xf8, 0xff, 0xff, 0xff,
  121. X   0xff, 0xff, 0x00, 0xf6, 0xfb, 0xf7, 0xfb, 0xff, 0xfb, 0x00, 0xf7, 0xff,
  122. X   0xfd, 0xff, 0xff, 0xff, 0x03, 0x3f, 0xff, 0xfe, 0xf7, 0xff, 0xff, 0x03,
  123. X   0xff, 0xdf, 0xef, 0xbb, 0xff, 0xbf, 0x03, 0xef, 0xf7, 0xef, 0x7f, 0xfe,
  124. X   0xf9, 0x03, 0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0x03, 0xbf, 0xdd, 0xff,
  125. X   0xff, 0xff, 0xfe, 0x03, 0xfe, 0xff, 0xff, 0xfc, 0xef, 0xf9, 0x03, 0xfe,
  126. X   0xcf, 0xfb, 0xfe, 0xe7, 0xdd, 0x03, 0xfc, 0xe7, 0xaf, 0xfe, 0xff, 0xdf,
  127. X   0x03, 0xfe, 0xef, 0xff, 0x7b, 0xff, 0xff, 0x03, 0xfc, 0xef, 0xff, 0xff,
  128. X   0xff, 0xfd, 0x03, 0xfc, 0xff, 0xd9, 0xbc, 0xf6, 0xff, 0x00, 0xfc, 0xff,
  129. X   0xc3, 0xbc, 0xee, 0xfd, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xfd, 0x00,
  130. X   0xf8, 0xd7, 0xff, 0xff, 0xff, 0xff, 0x00, 0xe0, 0xff, 0xf7, 0xff, 0xff,
  131. X   0x07, 0x00, 0xc0, 0xff, 0x7f, 0xff, 0xff, 0x07, 0x00, 0xc0, 0xff, 0xff,
  132. X   0xfd, 0xfd, 0x3d, 0x00, 0x80, 0xff, 0xff, 0xbf, 0xbf, 0x39, 0x00, 0x00,
  133. X   0x7e, 0xf3, 0xfe, 0xff, 0x0f, 0x00, 0x80, 0xff, 0xf8, 0xff, 0xfe, 0x07,
  134. X   0x00, 0x00, 0xfe, 0xff, 0xdb, 0xff, 0x01, 0x00, 0x00, 0xe6, 0xff, 0xff,
  135. X   0xff, 0x03, 0x00, 0x00, 0xf4, 0xff, 0xff, 0xff, 0x05, 0x00, 0x00, 0xe0,
  136. X   0xff, 0x3f, 0x1b, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x3f, 0x18, 0x00, 0x00,
  137. X   0x00, 0x00, 0x5e, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x0f, 0x00,
  138. X   0x00, 0x00};
  139. END_OF_FILE
  140. if test 2273 -ne `wc -c <'bitmaps/bigrock'`; then
  141.     echo shar: \"'bitmaps/bigrock'\" unpacked with wrong size!
  142. fi
  143. # end of 'bitmaps/bigrock'
  144. fi
  145. if test -f 'bitmaps/cloud.2' -a "${1}" != "-c" ; then 
  146.   echo shar: Will not clobber existing file \"'bitmaps/cloud.2'\"
  147. else
  148. echo shar: Extracting \"'bitmaps/cloud.2'\" \(434 characters\)
  149. sed "s/^X//" >'bitmaps/cloud.2' <<'END_OF_FILE'
  150. X#define cloud_width 19
  151. X#define cloud_height 19
  152. Xstatic char cloud_bits[] = {
  153. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x40, 0x08, 0x00,
  154. X   0x80, 0x08, 0x00, 0x60, 0xf8, 0x00, 0x38, 0x12, 0x03, 0x08, 0x10, 0x02,
  155. X   0x04, 0x80, 0x02, 0x48, 0x06, 0x02, 0x28, 0x10, 0x01, 0x10, 0xe0, 0x00,
  156. X   0x48, 0x28, 0x00, 0x10, 0x41, 0x00, 0x10, 0x42, 0x00, 0x20, 0x47, 0x00,
  157. X   0xc0, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  158. END_OF_FILE
  159. if test 434 -ne `wc -c <'bitmaps/cloud.2'`; then
  160.     echo shar: \"'bitmaps/cloud.2'\" unpacked with wrong size!
  161. fi
  162. # end of 'bitmaps/cloud.2'
  163. fi
  164. if test -f 'bitmaps/debris.1' -a "${1}" != "-c" ; then 
  165.   echo shar: Will not clobber existing file \"'bitmaps/debris.1'\"
  166. else
  167. echo shar: Extracting \"'bitmaps/debris.1'\" \(437 characters\)
  168. sed "s/^X//" >'bitmaps/debris.1' <<'END_OF_FILE'
  169. X#define debris_width 19
  170. X#define debris_height 19
  171. Xstatic char debris_bits[] = {
  172. X   0x00, 0x20, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x08, 0x03, 0x00, 0x04, 0x02,
  173. X   0x00, 0x02, 0x01, 0x00, 0x01, 0x01, 0x80, 0x80, 0x00, 0x80, 0x80, 0x00,
  174. X   0x40, 0x40, 0x00, 0x20, 0x40, 0x00, 0x10, 0x20, 0x00, 0x08, 0x20, 0x00,
  175. X   0x04, 0x10, 0x00, 0x06, 0x10, 0x00, 0x18, 0x08, 0x00, 0x60, 0x08, 0x00,
  176. X   0x80, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00};
  177. END_OF_FILE
  178. if test 437 -ne `wc -c <'bitmaps/debris.1'`; then
  179.     echo shar: \"'bitmaps/debris.1'\" unpacked with wrong size!
  180. fi
  181. # end of 'bitmaps/debris.1'
  182. fi
  183. if test -f 'bitmaps/debris.2' -a "${1}" != "-c" ; then 
  184.   echo shar: Will not clobber existing file \"'bitmaps/debris.2'\"
  185. else
  186. echo shar: Extracting \"'bitmaps/debris.2'\" \(437 characters\)
  187. sed "s/^X//" >'bitmaps/debris.2' <<'END_OF_FILE'
  188. X#define debris_width 19
  189. X#define debris_height 19
  190. Xstatic char debris_bits[] = {
  191. X   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  192. X   0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0xfe, 0x81, 0x00, 0x04, 0x80, 0x00,
  193. X   0x18, 0x80, 0x00, 0x20, 0x80, 0x00, 0x40, 0x80, 0x00, 0x80, 0x80, 0x00,
  194. X   0x00, 0x03, 0x01, 0x00, 0x04, 0x01, 0x00, 0x08, 0x01, 0x00, 0x10, 0x01,
  195. X   0x00, 0x60, 0x01, 0x00, 0x80, 0x01, 0x00, 0x00, 0x01};
  196. END_OF_FILE
  197. if test 437 -ne `wc -c <'bitmaps/debris.2'`; then
  198.     echo shar: \"'bitmaps/debris.2'\" unpacked with wrong size!
  199. fi
  200. # end of 'bitmaps/debris.2'
  201. fi
  202. if test -f 'bitmaps/medrock' -a "${1}" != "-c" ; then 
  203.   echo shar: Will not clobber existing file \"'bitmaps/medrock'\"
  204. else
  205. echo shar: Extracting \"'bitmaps/medrock'\" \(515 characters\)
  206. sed "s/^X//" >'bitmaps/medrock' <<'END_OF_FILE'
  207. X#define medrock_width 23
  208. X#define medrock_height 23
  209. Xstatic char medrock_bits[] = {
  210. X   0x00, 0x4d, 0x00, 0xf0, 0xfe, 0x01, 0xd0, 0xff, 0x0b, 0xda, 0xdf, 0x04,
  211. X   0xfc, 0xef, 0x0f, 0xfe, 0xff, 0x37, 0xbe, 0xfb, 0x1f, 0xbe, 0xef, 0x3f,
  212. X   0xff, 0xff, 0x3e, 0xfc, 0xff, 0x3f, 0xfd, 0xff, 0x7f, 0xbf, 0xbd, 0x77,
  213. X   0xff, 0xff, 0x7f, 0xfe, 0xff, 0x7e, 0xce, 0xff, 0x7f, 0xfe, 0xb4, 0x3e,
  214. X   0xfd, 0xff, 0x3f, 0xf0, 0xff, 0x07, 0xf8, 0x3f, 0x17, 0x70, 0xfe, 0x0f,
  215. X   0xd0, 0xff, 0x07, 0xc0, 0x3f, 0x01, 0x00, 0x19, 0x00};
  216. END_OF_FILE
  217. if test 515 -ne `wc -c <'bitmaps/medrock'`; then
  218.     echo shar: \"'bitmaps/medrock'\" unpacked with wrong size!
  219. fi
  220. # end of 'bitmaps/medrock'
  221. fi
  222. if test -f 'bitmaps/shortdeaddude' -a "${1}" != "-c" ; then 
  223.   echo shar: Will not clobber existing file \"'bitmaps/shortdeaddude'\"
  224. else
  225. echo shar: Extracting \"'bitmaps/shortdeaddude'\" \(458 characters\)
  226. sed "s/^X//" >'bitmaps/shortdeaddude' <<'END_OF_FILE'
  227. X#define shortdeaddude_width 19
  228. X#define shortdeaddude_height 19
  229. Xstatic char shortdeaddude_bits[] = {
  230. X   0x80, 0x03, 0x00, 0x40, 0x05, 0x00, 0xc0, 0x07, 0x00, 0x44, 0x04, 0x00,
  231. X   0x88, 0x83, 0x00, 0x10, 0x61, 0x00, 0xe0, 0x1f, 0x00, 0xc0, 0x07, 0x00,
  232. X   0xc0, 0x07, 0x00, 0xc0, 0x07, 0x00, 0x80, 0x03, 0x00, 0xc0, 0x07, 0x00,
  233. X   0x40, 0x04, 0x00, 0x20, 0x04, 0x00, 0x20, 0x04, 0x00, 0x14, 0x28, 0x00,
  234. X   0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  235. END_OF_FILE
  236. if test 458 -ne `wc -c <'bitmaps/shortdeaddude'`; then
  237.     echo shar: \"'bitmaps/shortdeaddude'\" unpacked with wrong size!
  238. fi
  239. # end of 'bitmaps/shortdeaddude'
  240. fi
  241. if test -f 'calc_angle.c' -a "${1}" != "-c" ; then 
  242.   echo shar: Will not clobber existing file \"'calc_angle.c'\"
  243. else
  244. echo shar: Extracting \"'calc_angle.c'\" \(847 characters\)
  245. sed "s/^X//" >'calc_angle.c' <<'END_OF_FILE'
  246. X/* calc_angle.c - *** put a one line description here */
  247. X
  248. X#if !defined(lint)
  249. Xstatic char sccs_id[] = "@(#)calc_angle.c 1.4 92/11/24 XMPB";
  250. X#endif
  251. X#include <math.h>
  252. X#include "player.h"
  253. X
  254. Xint calc_angles(w)
  255. Xwinptr w;
  256. X{
  257. X    float na,dela;
  258. X    int nx,ny;
  259. X   
  260. X    if(w->tl)
  261. X    {
  262. X        na = w->angle - w->max_angle_v;
  263. X    }
  264. X    else
  265. X    if(w->tr)
  266. X    {
  267. X        na = w->angle + w->max_angle_v;
  268. X    }
  269. X    else
  270. X    {
  271. X        na = w->angle;
  272. X    }
  273. X    
  274. X    if(na <0.0 ) na +=360.0;
  275. X    dela = na-w->angle;
  276. X    if(dela > 180.0) na -=360.0;
  277. X    if(dela < -180.0) na+=360.0;
  278. X
  279. X#define FABS(x) ((x)>0.0?(x):-(x))
  280. X#define FSGN(x)  (x>0.0?1.0:-1.0)
  281. X
  282. X    if(w->max_angle_v >= FABS(na-w->angle))
  283. X    {
  284. X        w->angle = na;
  285. X    }
  286. X    else
  287. X    {
  288. X        w->angle += FSGN(na-w->angle)*w->max_angle_v;
  289. X    }
  290. X    w->dela = (int)dela;
  291. X
  292. X    if(w->angle < 0.0) w->angle += 360.0;
  293. X    if(w->angle >= 360.0) w->angle -=360;
  294. X}
  295. X
  296. END_OF_FILE
  297. if test 847 -ne `wc -c <'calc_angle.c'`; then
  298.     echo shar: \"'calc_angle.c'\" unpacked with wrong size!
  299. fi
  300. # end of 'calc_angle.c'
  301. fi
  302. if test -f 'calc_shields.c' -a "${1}" != "-c" ; then 
  303.   echo shar: Will not clobber existing file \"'calc_shields.c'\"
  304. else
  305. echo shar: Extracting \"'calc_shields.c'\" \(640 characters\)
  306. sed "s/^X//" >'calc_shields.c' <<'END_OF_FILE'
  307. X/* calc_shields.c - *** Routines for pre calcing shield positions */
  308. X
  309. Xstatic char sccs_id[] = " @(#)calc_shields.c 1.2 92/11/24 XMPB";
  310. X#include "player.h"
  311. X
  312. Xextern winptr first_win;
  313. Xextern int mysintab[],mycostab[];
  314. X
  315. Xprecalc()
  316. X{
  317. X    winptr t;
  318. X
  319. X    t = first_win;
  320. X    
  321. X    while(t)
  322. X    {
  323. X        t->p1x = t->sx+50*mysintab[(int)t->angle]/32768;
  324. X        t->p1y = t->sy+50*mycostab[(int)t->angle]/32768;
  325. X        t->p2x = t->sx+40*mysintab[((int)t->angle+135)%360]/32768;
  326. X        t->p2y = t->sy+40*mycostab[((int)t->angle+135)%360]/32768;
  327. X        t->p3x = t->sx+40*mysintab[((int)t->angle+225)%360]/32768;
  328. X        t->p3y = t->sy+40*mycostab[((int)t->angle+225)%360]/32768;
  329. X    
  330. X        t = t->next;
  331. X    }
  332. X}
  333. X
  334. END_OF_FILE
  335. if test 640 -ne `wc -c <'calc_shields.c'`; then
  336.     echo shar: \"'calc_shields.c'\" unpacked with wrong size!
  337. fi
  338. # end of 'calc_shields.c'
  339. fi
  340. if test -f 'clear_lock.man' -a "${1}" != "-c" ; then 
  341.   echo shar: Will not clobber existing file \"'clear_lock.man'\"
  342. else
  343. echo shar: Extracting \"'clear_lock.man'\" \(548 characters\)
  344. sed "s/^X//" >'clear_lock.man' <<'END_OF_FILE'
  345. X.TH Xmpb 6
  346. X.SH NAME
  347. Xclear_lock - clear a lock file 
  348. X.SH SYPNOSIS
  349. X.ta 4n
  350. X\fIclear_lock\fR Name
  351. X
  352. X.SH DESCRIPTION
  353. X
  354. X    This program is here if you manage to break our game, or we just stuffed up again.  When you start a game, xmpb locks your characters file.  You cannot go to the shop if this lock is still there.  
  355. X
  356. XSo if things have gone funny, then just type:
  357. X
  358. Xclear_lock Name   -  Where Name is the name of the locked character.
  359. X
  360. X
  361. XIf this program doesn't work:
  362. X
  363. XUsage: clear_lock Name
  364. X
  365. X
  366. X- You have not given one parameter to the clear_lock program
  367. X
  368. END_OF_FILE
  369. if test 548 -ne `wc -c <'clear_lock.man'`; then
  370.     echo shar: \"'clear_lock.man'\" unpacked with wrong size!
  371. fi
  372. # end of 'clear_lock.man'
  373. fi
  374. if test -f 'collide.c' -a "${1}" != "-c" ; then 
  375.   echo shar: Will not clobber existing file \"'collide.c'\"
  376. else
  377. echo shar: Extracting \"'collide.c'\" \(2266 characters\)
  378. sed "s/^X//" >'collide.c' <<'END_OF_FILE'
  379. X#include <stdio.h>
  380. X#include <sys/time.h>
  381. X#include <math.h>
  382. X
  383. Xline_2_rect(x1,y1,x2,y2,cx,cy,w,h)
  384. Xint x1,y1;
  385. Xint x2,y2;
  386. Xint cx,cy;
  387. Xint w;
  388. Xint h;
  389. X{
  390. X    int mask1,mask2;
  391. X
  392. X    int maxx,minx,maxy,miny;
  393. X
  394. X    /*
  395. X    **    Calculate the sides of the rectangle
  396. X    */
  397. X    maxx = cx + w/2;
  398. X    minx = cx - w/2;
  399. X    
  400. X    maxy = cy + h/2;
  401. X    miny = cy - h/2;
  402. X
  403. Xreiterate:
  404. X
  405. X    mask1 = 0;
  406. X    mask2 = 0;
  407. X
  408. X    /*
  409. X    **    Get the masks for the endpoints
  410. X    */
  411. X    mask1 = endpmask(x1,y1,minx,maxx,miny,maxy);
  412. X    mask2 = endpmask(x2,y2,minx,maxx,miny,maxy);
  413. X
  414. X    if(mask1 & mask2)
  415. X    {
  416. X        /*
  417. X        **    There was no intersection
  418. X        */
  419. X
  420. X        return 0;
  421. X    }
  422. X    else if((mask1 == 0) && (mask2 == 0))
  423. X    {
  424. X        /*
  425. X        **    Both ends inside the rectangle, so definite
  426. X        **    collision
  427. X        */
  428. X        return 1;
  429. X    }
  430. X    else
  431. X    {
  432. X        /*
  433. X        **    There might have been an intersection
  434. X        */
  435. X        if(mask1)
  436. X        {
  437. X            /*
  438. X            **    Point 1 is outside the rectangle
  439. X            */
  440. X            if(mask1 & 1)
  441. X            {
  442. X                int x,y;
  443. X
  444. X                x = x1; y = y1;
  445. X
  446. X                x1 = minx;
  447. X
  448. X                y1 = y + (minx - x) * (y2 - y)/(x2 - x);
  449. X                goto reiterate;
  450. X            }
  451. X            if(mask1 & 2)
  452. X            {
  453. X                int x,y;
  454. X
  455. X                x = x1; y = y1;
  456. X
  457. X                x1 = maxx;
  458. X
  459. X                y1 =  y - ((x - maxx) * (y2 - y)/(x2 - x));
  460. X                goto reiterate;
  461. X            }
  462. X            if(mask1 & 4)
  463. X            {
  464. X                int x,y;
  465. X
  466. X                x = x1; y = y1;
  467. X
  468. X                y1 = miny;
  469. X
  470. X                x1 = x + (miny - y) * (x2 - x)/(y2 - y);
  471. X                goto reiterate;
  472. X            }
  473. X            if(mask1 & 8)
  474. X            {
  475. X                int x,y;
  476. X
  477. X                x = x1; y = y1;
  478. X
  479. X                y1 = miny;
  480. X
  481. X                x1 = x - ((y - maxy) * (x2 - x)/(y2 - y));
  482. X                goto reiterate;
  483. X            }
  484. X        }
  485. X        else
  486. X        {
  487. X            /*
  488. X            **    Point 2 is outside the rectangle
  489. X            */
  490. X            if(mask2 & 1)
  491. X            {
  492. X                int x,y;
  493. X
  494. X                x = x2; y = y2;
  495. X
  496. X                x2 = minx;
  497. X
  498. X                y2 = y + (minx - x) * (y1 - y)/(x1 - x);
  499. X                goto reiterate;
  500. X            }
  501. X            if(mask2 & 2)
  502. X            {
  503. X                int x,y;
  504. X
  505. X                x = x2; y = y2;
  506. X
  507. X                x2 = maxx;
  508. X
  509. X                y2 = y - ((x - maxx) * (y1 - y)/(x1 - x));
  510. X                goto reiterate;
  511. X            }
  512. X            if(mask2 & 4)
  513. X            {
  514. X                int x,y;
  515. X
  516. X                x = x2; y = y2;
  517. X
  518. X                y2 = miny;
  519. X
  520. X                x2 = x + (miny - y) * (x1 - x)/(y1 - y);
  521. X                goto reiterate;
  522. X            }
  523. X            if(mask2 & 8)
  524. X            {
  525. X                int x,y;
  526. X
  527. X                x = x2; y = y2;
  528. X
  529. X                y2 = maxy;
  530. X
  531. X                x2 = x - ((y - maxy) * (x1 - x)/(y1 - y));
  532. X                goto reiterate;
  533. X            }
  534. X        }
  535. X    }
  536. X}
  537. X
  538. Xint endpmask(x1,y1,minx,maxx,miny,maxy)
  539. Xint x1,y1;
  540. Xint minx,maxx;
  541. Xint miny,maxy;
  542. X{
  543. X    int m = 0;
  544. X
  545. X    if(x1 < minx)
  546. X        m |= 1;
  547. X    if(x1 > maxx)
  548. X        m |= 2;
  549. X    if(y1 < miny)
  550. X        m |= 4;
  551. X    if(y1 > maxy)
  552. X        m |= 8;
  553. X
  554. X    return m;
  555. X}
  556. END_OF_FILE
  557. if test 2266 -ne `wc -c <'collide.c'`; then
  558.     echo shar: \"'collide.c'\" unpacked with wrong size!
  559. fi
  560. # end of 'collide.c'
  561. fi
  562. if test -f 'costab.c' -a "${1}" != "-c" ; then 
  563.   echo shar: Will not clobber existing file \"'costab.c'\"
  564. else
  565. echo shar: Extracting \"'costab.c'\" \(2323 characters\)
  566. sed "s/^X//" >'costab.c' <<'END_OF_FILE'
  567. Xint mycostab[] = {
  568. X32768,
  569. X32763,32748,32723,32688,32643,32588,32523,32449,32364,32270,
  570. X32165,32051,31928,31794,31651,31498,31336,31164,30982,30791,
  571. X30591,30381,30163,29935,29697,29451,29196,28932,28659,28377,
  572. X28087,27788,27481,27165,26841,26509,26169,25821,25465,25101,
  573. X24730,24351,23964,23571,23170,22762,22347,21926,21497,21062,
  574. X20621,20173,19720,19260,18794,18323,17846,17364,16876,16384,
  575. X15886,15383,14876,14364,13848,13327,12803,12275,11743,11207,
  576. X10668,10125,9580,9032,8480,7927,7371,6812,6252,5690,
  577. X5126,4560,3993,3425,2855,2285,1714,1143,571,0,
  578. X-571,-1143,-1714,-2285,-2855,-3425,-3993,-4560,-5126,-5690,
  579. X-6252,-6812,-7371,-7927,-8480,-9032,-9580,-10125,-10668,-11207,
  580. X-11743,-12275,-12803,-13327,-13848,-14364,-14876,-15383,-15886,-16383,
  581. X-16876,-17364,-17846,-18323,-18794,-19260,-19720,-20173,-20621,-21062,
  582. X-21497,-21926,-22347,-22762,-23170,-23571,-23964,-24351,-24730,-25101,
  583. X-25465,-25821,-26169,-26509,-26841,-27165,-27481,-27788,-28087,-28377,
  584. X-28659,-28932,-29196,-29451,-29697,-29935,-30163,-30381,-30591,-30791,
  585. X-30982,-31164,-31336,-31498,-31651,-31794,-31928,-32051,-32165,-32270,
  586. X-32364,-32449,-32523,-32588,-32643,-32688,-32723,-32748,-32763,-32768,
  587. X-32763,-32748,-32723,-32688,-32643,-32588,-32523,-32449,-32364,-32270,
  588. X-32165,-32051,-31928,-31794,-31651,-31498,-31336,-31164,-30982,-30791,
  589. X-30591,-30381,-30163,-29935,-29697,-29451,-29196,-28932,-28659,-28377,
  590. X-28087,-27788,-27481,-27165,-26841,-26509,-26169,-25821,-25465,-25101,
  591. X-24730,-24351,-23964,-23571,-23170,-22762,-22347,-21926,-21497,-21062,
  592. X-20621,-20173,-19720,-19260,-18794,-18323,-17846,-17364,-16876,-16384,
  593. X-15886,-15383,-14876,-14364,-13848,-13327,-12803,-12275,-11743,-11207,
  594. X-10668,-10125,-9580,-9032,-8480,-7927,-7371,-6812,-6252,-5690,
  595. X-5126,-4560,-3993,-3425,-2855,-2285,-1714,-1143,-571,0,
  596. X571,1143,1714,2285,2855,3425,3993,4560,5126,5690,
  597. X6252,6812,7371,7927,8480,9032,9580,10125,10668,11207,
  598. X11743,12275,12803,13327,13848,14364,14876,15383,15886,16384,
  599. X16876,17364,17846,18323,18794,19260,19720,20173,20621,21062,
  600. X21497,21926,22347,22762,23170,23571,23964,24351,24730,25101,
  601. X25465,25821,26169,26509,26841,27165,27481,27788,28087,28377,
  602. X28659,28932,29196,29451,29697,29935,30163,30381,30591,30791,
  603. X30982,31164,31336,31498,31651,31794,31928,32051,32165,32270,
  604. X32364,32449,32523,32588,32643,32688,32723,32748,32763,32768
  605. X};
  606. END_OF_FILE
  607. if test 2323 -ne `wc -c <'costab.c'`; then
  608.     echo shar: \"'costab.c'\" unpacked with wrong size!
  609. fi
  610. # end of 'costab.c'
  611. fi
  612. if test -f 'describe.c' -a "${1}" != "-c" ; then 
  613.   echo shar: Will not clobber existing file \"'describe.c'\"
  614. else
  615. echo shar: Extracting \"'describe.c'\" \(1285 characters\)
  616. sed "s/^X//" >'describe.c' <<'END_OF_FILE'
  617. X#include "player.h"
  618. X#include "save.h"
  619. X
  620. Xint euid;
  621. Xextern save default_save;
  622. X
  623. Xmain(argc, argv)
  624. Xint argc;
  625. Xchar *argv[];
  626. X{
  627. X    save *dude;
  628. X    int i;
  629. X
  630. X    euid = geteuid();
  631. X    /*
  632. X    if(argc!=2) 
  633. X    {
  634. X        printf("Usage: %s Name\n", argv[0]);
  635. X        exit(1);
  636. X    }
  637. X*/
  638. X    argc--;
  639. X    i=1;
  640. X    while(i <= argc)
  641. X    {
  642. X        dude=load_dude(argv[i]);
  643. X        if(dude==&(default_save))
  644. X        {
  645. X            struct header h;
  646. X            FILE *fp;
  647. X            char buf[160];
  648. X
  649. X            setuid(euid);
  650. X            buf[0]=0;
  651. X            strcpy(buf, NPCDIR);
  652. X            strcat(buf, argv[i]);
  653. X            strcat(buf, ".no");
  654. X            fp=fopen(buf,"rb");
  655. X            if(!fp)
  656. X                fprintf(stderr, "\nNo such Combatant: %s\n", argv[i]);
  657. X            else
  658. X            {
  659. X                fread(&h, sizeof(struct header),1,fp);
  660. X                fclose(fp);
  661. X                printf("\n=====================\n");
  662. X                printf("Name: %s\n", h.Name);
  663. X                printf("Ship: %s\n", h.Ship);
  664. X                if(h.cash_earned>0)
  665. X                    printf("Value of ship: %d\n", h.cash_earned/(1+h.num_played)+350000);
  666. X                else
  667. X                    printf("Value of ship: 350000\n");
  668. X
  669. X                printf("kills: %d\n", h.kills);
  670. X                printf("=====================\n");
  671. X            }
  672. X        }
  673. X        else
  674. X        {
  675. X
  676. X            printf("\n=====================\n");
  677. X            printf("Name: %s\n", dude->Name);
  678. X            printf("Ship: %s\n", dude->Ship);
  679. X            printf("Value of ship: %d\n", dude->ship_value);
  680. X            printf("kills: %d\n", dude->kills);
  681. X            printf("=====================\n");
  682. X        }
  683. X        i++;
  684. X    }
  685. X}
  686. END_OF_FILE
  687. if test 1285 -ne `wc -c <'describe.c'`; then
  688.     echo shar: \"'describe.c'\" unpacked with wrong size!
  689. fi
  690. # end of 'describe.c'
  691. fi
  692. if test -f 'describe.man' -a "${1}" != "-c" ; then 
  693.   echo shar: Will not clobber existing file \"'describe.man'\"
  694. else
  695. echo shar: Extracting \"'describe.man'\" \(850 characters\)
  696. sed "s/^X//" >'describe.man' <<'END_OF_FILE'
  697. X.TH Xmpb 6
  698. X.SH NAME
  699. Xdescribe - describe your opponents
  700. X.SH SYPNOSIS
  701. X.ta 4n
  702. X\fIdescribe\fR Name
  703. X
  704. X.SH DESCRIPTION
  705. X
  706. X    This is part of the Xmpb package.
  707. X
  708. X    The describe program is used to obtain some basic details about your opposition.  The describe program will tell you their name, ship, how much their ship is worth and how many kills they have.  This means you can describe either an opposition player, or NPC.
  709. X
  710. XTo use describe,
  711. X
  712. Xdescribe Name  -  Where Name is the name of the character to describe.
  713. X
  714. X
  715. XIf this program doesn't work:
  716. X
  717. XUsage: describe Name
  718. X
  719. X
  720. X- You have not given one parameter to the describe program
  721. X
  722. X
  723. XNo such player
  724. X
  725. X- This is because the name given is not the same as the one you typed in when you play xmpb.  Watch out for extra spaces.  Or of course, the character might not exist.
  726. X
  727. X.SH SEE ALSO
  728. X
  729. Xxmpb(6),npcc(6),shop(6),retire(6)
  730. END_OF_FILE
  731. if test 850 -ne `wc -c <'describe.man'`; then
  732.     echo shar: \"'describe.man'\" unpacked with wrong size!
  733. fi
  734. # end of 'describe.man'
  735. fi
  736. if test -f 'do_stars.c' -a "${1}" != "-c" ; then 
  737.   echo shar: Will not clobber existing file \"'do_stars.c'\"
  738. else
  739. echo shar: Extracting \"'do_stars.c'\" \(1989 characters\)
  740. sed "s/^X//" >'do_stars.c' <<'END_OF_FILE'
  741. X/* do_stars.c - ***  */
  742. X
  743. X#if !defined(lint)
  744. Xstatic char sccs_id[] = "@(#)do_stars.c 1.9 93/04/22 XMPB";
  745. X#endif
  746. X#include "player.h"
  747. X
  748. Xdo_stars(w)
  749. Xwinptr w;
  750. X{
  751. X    int i;
  752. X
  753. X    for(i=0;i<STARSPERPLANE;i++)
  754. X    {
  755. X        w->stars1[i].lx = w->stars1[i].x;
  756. X        w->stars1[i].ly = w->stars1[i].y;
  757. X        w->stars2[i].lx = w->stars2[i].x;
  758. X        w->stars2[i].ly = w->stars2[i].y;
  759. X
  760. X        w->stars1[i].x -= w->xv/49152;
  761. X        w->stars1[i].y += w->yv/49152;
  762. X        w->stars1[i].x = (w->stars1[i].x+PLAYW)%PLAYW;
  763. X        w->stars1[i].y = (w->stars1[i].y+PLAYH)%PLAYH;
  764. X
  765. X        w->stars2[i].x -= w->xv/32768;
  766. X        w->stars2[i].y += w->yv/32768;
  767. X        w->stars2[i].x = (w->stars2[i].x+PLAYW)%PLAYW;
  768. X        w->stars2[i].y = (w->stars2[i].y+PLAYH)%PLAYH;
  769. X    }
  770. X}
  771. X
  772. Xdraw_stars(w)
  773. Xwinptr w;
  774. X{
  775. X    int i;
  776. X
  777. X    for(i=0;i<STARSPERPLANE;i++)
  778. X    {
  779. X        XCopyPlane(w->theDisplay,(w->stars1[i].pm->spm),w->back_buffer,w->bbgc,0,0,w->stars1[i].pm->w,w->stars1[i].pm->h,w->stars1[i].x+OFFSET,w->stars1[i].y+OFFSET,1);
  780. X        XCopyPlane(w->theDisplay,(w->stars2[i].pm->spm),w->back_buffer,w->bbgc,0,0,w->stars2[i].pm->w,w->stars2[i].pm->h,w->stars2[i].x+OFFSET,w->stars2[i].y+OFFSET,1);
  781. X/*
  782. X        XDrawPoint(w->theDisplay,w->back_buffer,w->bbgc,w->stars1[i].x,w->stars1[i].y);
  783. X        XDrawPoint(w->theDisplay,w->back_buffer,w->bbgc,w->stars2[i].x,w->stars2[i].y);
  784. X*/
  785. X        XFlush(w->theDisplay);
  786. X    }
  787. X}
  788. Xdraw_last_stars(w)
  789. Xwinptr w;
  790. X{
  791. X    int i;
  792. X
  793. X    for(i=0;i<STARSPERPLANE;i++)
  794. X    {
  795. X        XCopyPlane(w->theDisplay,(w->stars1[i].pm->spm),w->theWindow,w->theGC,0,0,w->stars1[i].pm->w,w->stars1[i].pm->h,w->stars1[i].lx,w->stars1[i].ly,1);
  796. X        XCopyPlane(w->theDisplay,(w->stars2[i].pm->spm),w->theWindow,w->theGC,0,0,w->stars2[i].pm->w,w->stars2[i].pm->h,w->stars2[i].lx,w->stars2[i].ly,1);
  797. X    }
  798. X}
  799. X
  800. X
  801. Xinit_stars(w)
  802. Xwinptr w;
  803. X{
  804. X    int i;
  805. X    int c;
  806. X
  807. X    for(i=0;i<STARSPERPLANE;i++)
  808. X    {
  809. X        w->stars1[i].x = rand()%PLAYW;
  810. X        w->stars1[i].y = rand()%PLAYH;
  811. X        c = rand()%5;
  812. X        c /=2;
  813. X        w->stars1[i].pm = &(w->spm[c]);
  814. X        w->stars2[i].x = rand()%PLAYW;
  815. X        w->stars2[i].y = rand()%PLAYH;
  816. X        c = rand()%5;
  817. X        c /=2;
  818. X        w->stars2[i].pm = &(w->spm[c]);
  819. X    }
  820. X}
  821. END_OF_FILE
  822. if test 1989 -ne `wc -c <'do_stars.c'`; then
  823.     echo shar: \"'do_stars.c'\" unpacked with wrong size!
  824. fi
  825. # end of 'do_stars.c'
  826. fi
  827. if test -f 'harry.npc' -a "${1}" != "-c" ; then 
  828.   echo shar: Will not clobber existing file \"'harry.npc'\"
  829. else
  830. echo shar: Extracting \"'harry.npc'\" \(2414 characters\)
  831. sed "s/^X//" >'harry.npc' <<'END_OF_FILE'
  832. XNPC
  833. XName = Harry
  834. XShip = Buster
  835. XEnergyMax = 1000
  836. XLShieldMax = 600
  837. XRShieldMax = 600
  838. XBShieldMax = 400
  839. XSolar = 2
  840. XShortRange = 1
  841. XEngine = 3
  842. XRepair = 2
  843. XLongRange = 1
  844. X
  845. XWeapons 
  846. XPulse
  847. X
  848. Xvar 
  849. X    lastangle
  850. X    lastdist
  851. X    repairitem
  852. Xend
  853. X
  854. XState start
  855. X{
  856. X    repairitem = 7;
  857. X    set B2 = 1;
  858. X
  859. X    -> watch;
  860. X}
  861. X
  862. XState watch
  863. X{
  864. X    if(LongState < 90 )    
  865. X    {
  866. X        if(Speed > 5) 
  867. X            -> stop;
  868. X        repairitem = LongRange;
  869. X        repair();
  870. X    }
  871. X    set B1 = 0;
  872. X    NumEnemies > 0 -> spotted;
  873. X    repair();
  874. X}
  875. X
  876. XState spotted
  877. X{
  878. X    set SelectEnemy = 0;
  879. X    lastangle = EnemyAngle;
  880. X    lastdist = EnemyDist;
  881. X
  882. X    -> fight;
  883. X}
  884. X
  885. XProc gonna_hit
  886. X{
  887. X    if(XVel*XPos > 45000) return 1;
  888. X    if(YVel*YPos > 45000) return 1;
  889. X
  890. X    return 0;
  891. X}
  892. X
  893. XState fight
  894. X{
  895. X    var
  896. X        d
  897. X        a
  898. X        m
  899. X        i
  900. X        acc
  901. X        mina
  902. X        maxa
  903. X    end
  904. X
  905. X    !EnemyAvail -> watch;
  906. X
  907. X    m = EnemyDist/(50+VelAtAngle(Angle)) - 1;
  908. X
  909. X    if(Energy > 200 || gonna_hit())
  910. X        set B3 = 1;
  911. X    else
  912. X        set B3 = 0;
  913. X
  914. X    a = AngleTo(EnemyXPos+m*EnemyXVel-m*XVel,EnemyYPos+m*EnemyYVel-m*YVel);
  915. X
  916. X    d = (Angle -a + 360)%360;
  917. X
  918. X    if(d < 170 || d > 190)
  919. X        set TurnTo = a;
  920. X
  921. X    if(EnemyDist < 100)
  922. X        acc = 30;
  923. X    else
  924. X    if(EnemyDist < 200)
  925. X        acc = 6;
  926. X    else
  927. X    if(EnemyDist < 500)
  928. X        acc = 3;
  929. X    else
  930. X        acc = 2;
  931. X
  932. X    maxa = (a+acc)%360;
  933. X    mina = (a+360-acc)%360;
  934. X
  935. X    if(EnemyDist < 1000 && EnemyDist > 0 &&(Angle - 360 < maxa && Angle > mina))
  936. X    {
  937. X        set B1 = 1;
  938. X    }
  939. X    else
  940. X        set B1 = 0;
  941. X
  942. X    set Balance = 1;
  943. X    repair();
  944. X
  945. X    Speed > 90 -> stop;
  946. X}
  947. X
  948. XState stop
  949. X{
  950. X    set B3 = 0;
  951. X    set B1 = 0;
  952. X    while(Angle != ((Direction + 180)%360))
  953. X        set TurnTo = (Direction + 180)%360;
  954. X    while(Speed > 4 && (EnemyDist > 500 || EnemyDist == 0))
  955. X    {
  956. X        set TurnTo = (Direction + 180)%360;
  957. X        set B3 = 1;
  958. X    }
  959. X    set B3 = 0;
  960. X    -> watch;
  961. X}
  962. X
  963. XProc repair
  964. X{
  965. X    var 
  966. X        r
  967. X    end
  968. X
  969. X    if(repairitem == RepairItem && repairitem != 7) return;
  970. X    r = RepairItem;
  971. X    set RepairToggle = 1;
  972. X    while(RepairItem != repairitem && RepairItem != r)
  973. X        set RepairToggle = 1;
  974. X    if(RepairItem == r) 
  975. X    {
  976. X        if(LongState < 100 && LongState != -1 && repairitem != LongRange)
  977. X        {
  978. X            repairitem = LongRange;
  979. X            return;
  980. X        }
  981. X        if(SolarState < 100 && SolarState != -1 && repairitem != Solar)
  982. X        {
  983. X            repairitem = Solar;
  984. X            return;
  985. X        }
  986. X        if(RepairState < 100 && RepairState != -1 && repairitem != Repair)
  987. X        {
  988. X            repairitem = Repair;
  989. X            return;
  990. X        }
  991. X        if(EngineState < 100 && EngineState != -1 && repairitem != Engine)
  992. X        {
  993. X            repairitem = Engine;
  994. X            return;
  995. X        }
  996. X        if(ShortState < 100 && ShortState != -1 && Energy > 300)
  997. X        {
  998. X            repairitem = Engine;
  999. X            return;
  1000. X        }
  1001. X        repairitem = 7;
  1002. X    }
  1003. X    return;
  1004. X}
  1005. X
  1006. X    
  1007. XStart start
  1008. END_OF_FILE
  1009. if test 2414 -ne `wc -c <'harry.npc'`; then
  1010.     echo shar: \"'harry.npc'\" unpacked with wrong size!
  1011. fi
  1012. # end of 'harry.npc'
  1013. fi
  1014. if test -f 'john.npc' -a "${1}" != "-c" ; then 
  1015.   echo shar: Will not clobber existing file \"'john.npc'\"
  1016. else
  1017. echo shar: Extracting \"'john.npc'\" \(947 characters\)
  1018. sed "s/^X//" >'john.npc' <<'END_OF_FILE'
  1019. XNPC
  1020. XName = John
  1021. XShip = Walker
  1022. XEnergyMax = 1400
  1023. XLShieldMax = 900
  1024. XRShieldMax = 900
  1025. XBShieldMax = 700
  1026. XSolar = 5
  1027. XShortRange = 1
  1028. XEngine = 3
  1029. XRepair = 9
  1030. XLongRange = 9
  1031. XJammer = 9
  1032. XTC = 3
  1033. X
  1034. XWeapons
  1035. XMagneto
  1036. X
  1037. Xvar
  1038. Xend
  1039. X
  1040. XProc aim
  1041. X{
  1042. Xvar
  1043. X    aa1
  1044. X    aa2
  1045. X    num
  1046. Xend
  1047. X    num = NumEnemies;
  1048. X    set SelectEnemy = 0;
  1049. X
  1050. X    aa1 = aa2;
  1051. X    WaitFrame;
  1052. X    aa2 = EnemyAngle;
  1053. X    if(aa2 == -1)
  1054. X        aa2 = aa1;
  1055. X    else
  1056. X        set TurnTo = (EnemyAngle + (aa2 - aa1) * 4) % 360;
  1057. X
  1058. X    return;
  1059. X}
  1060. X
  1061. XProc slow
  1062. X{
  1063. Xvar
  1064. X    oldbs
  1065. Xend
  1066. X
  1067. X    set B1 = 0;
  1068. X    set TurnTo = (Direction + 180) % 360;
  1069. X    while(Speed > 5)
  1070. X    {
  1071. X        set TurnTo = (Direction + 180) % 360;
  1072. X    }
  1073. X    set B3 =0;
  1074. X    return;
  1075. X}
  1076. X
  1077. XState go_get_him
  1078. X{
  1079. X    Entry
  1080. X    {
  1081. X        aim();
  1082. X        set B3 = 1;
  1083. X    }
  1084. X
  1085. X    aim();
  1086. X    if(EnemyDist < 3000)
  1087. X    {
  1088. X        slow();
  1089. X        1 -> start;
  1090. X    }
  1091. X}
  1092. X
  1093. XState start
  1094. X{
  1095. X    set Jamming = 1;
  1096. X    NumEnemies;
  1097. X    set SelectEnemy = 0;
  1098. X    if(EnemyAvail)
  1099. X    {
  1100. X        if(EnemyDist > 3500)
  1101. X            1 -> go_get_him;
  1102. X        aim();
  1103. X        if(Energy < 100)
  1104. X            set B1 =0;
  1105. X        else
  1106. X        {
  1107. X            set Target = 1;
  1108. X            set B1 =1;
  1109. X        }
  1110. X    }
  1111. X}
  1112. X
  1113. XStart start
  1114. END_OF_FILE
  1115. if test 947 -ne `wc -c <'john.npc'`; then
  1116.     echo shar: \"'john.npc'\" unpacked with wrong size!
  1117. fi
  1118. # end of 'john.npc'
  1119. fi
  1120. if test -f 'ml2.npc' -a "${1}" != "-c" ; then 
  1121.   echo shar: Will not clobber existing file \"'ml2.npc'\"
  1122. else
  1123. echo shar: Extracting \"'ml2.npc'\" \(1534 characters\)
  1124. sed "s/^X//" >'ml2.npc' <<'END_OF_FILE'
  1125. XNPC
  1126. XName = Rammer
  1127. XShip = BigNose
  1128. XEnergyMax = 10000
  1129. XLShieldMax = 800
  1130. XRShieldMax = 800
  1131. XBShieldMax = 600
  1132. XSolar = 9
  1133. XShortRange = 1
  1134. XEngine = 2
  1135. XRepair = 9
  1136. XLongRange = 4
  1137. XJammer = 5
  1138. XTC = none
  1139. X
  1140. XWeapons
  1141. XRail
  1142. XAtom
  1143. X
  1144. Xvar
  1145. X    num
  1146. X    last
  1147. Xend
  1148. X
  1149. XState close
  1150. X{
  1151. X    if ( ! EnemyAvail)
  1152. X        1 -> main;
  1153. X    set B1 =1;
  1154. X    if(EnemyAngle!=-1)
  1155. X    {
  1156. X        set TurnTo=AngleTo((EnemyXPos+11*EnemyXVel- 11*XVel),(EnemyYPos+11*EnemyYVel- 11*YVel));
  1157. X        last = EnemyAngle;
  1158. X    }
  1159. X    set Balance =1;
  1160. X    if (EnemyDist > 1500)
  1161. X        1 -> find;
  1162. X}
  1163. X
  1164. XState kill
  1165. X{
  1166. X    if( ! EnemyAvail)
  1167. X        1 ->main;
  1168. X    if(EnemyAngle!=-1)
  1169. X    {
  1170. X        last = EnemyAngle;
  1171. X        set TurnTo = AngleTo((EnemyXPos+9*EnemyXVel- 9*XVel),(EnemyYPos+9*EnemyYVel- 9*YVel));
  1172. X    }
  1173. X    else
  1174. X    {
  1175. X        set B3 =0;
  1176. X    }
  1177. X    if(EnemyDist < 1000)
  1178. X        1 -> close;
  1179. X    else
  1180. X        set B1 =0;
  1181. X    set Balance =1;
  1182. X    set RepairToggle =1;
  1183. X    if (EnemyDist > 3000)
  1184. X    {
  1185. X        set B1 =0;
  1186. X        1 -> find;
  1187. X    }    
  1188. X}
  1189. X
  1190. XState slowdown
  1191. X{
  1192. X    set TurnTo = (180 + Direction)%360;
  1193. X    1 -> slow;
  1194. X}
  1195. X
  1196. XState slow
  1197. X{
  1198. X    set B3 =1;
  1199. X    while (Speed > 20);
  1200. X    set B3 =0;
  1201. X    1 -> find;
  1202. X}
  1203. X    
  1204. XState find
  1205. X{
  1206. X    var
  1207. X        mod
  1208. X    end
  1209. X
  1210. X    set B3 =1;
  1211. X    set Balance =1;
  1212. X    set RepairToggle =1;
  1213. X    num = NumEnemies - 1;
  1214. X    set SelectEnemy = 0;
  1215. X    if (Speed > 50)
  1216. X    {
  1217. X        set B3 =0;
  1218. X         1 -> slowdown;
  1219. X    }
  1220. X    if(EnemyAngle!=-1)
  1221. X        last = EnemyAngle;
  1222. X    if (EnemyDist < 3500)
  1223. X    {
  1224. X        1 -> kill;
  1225. X    }
  1226. X    else
  1227. X    {
  1228. X        mod = EnemyDist/1000;
  1229. X        if(EnemyAvail)    
  1230. X        {
  1231. X            if(EnemyAngle!=-1)
  1232. X                set TurnTo=AngleTo((EnemyXPos+mod*EnemyXVel-mod*XVel),(EnemyYPos+mod*EnemyYVel-mod*YVel));
  1233. X            set B1 =0;
  1234. X        }
  1235. X    }
  1236. X}
  1237. X
  1238. XState main
  1239. X{
  1240. X    set B2 = 1;
  1241. X    num = NumEnemies - 1;
  1242. X    set SelectEnemy = 0;
  1243. X    1 -> find;
  1244. X}
  1245. X
  1246. XStart main
  1247. END_OF_FILE
  1248. if test 1534 -ne `wc -c <'ml2.npc'`; then
  1249.     echo shar: \"'ml2.npc'\" unpacked with wrong size!
  1250. fi
  1251. # end of 'ml2.npc'
  1252. fi
  1253. if test -f 'operators.h' -a "${1}" != "-c" ; then 
  1254.   echo shar: Will not clobber existing file \"'operators.h'\"
  1255. else
  1256. echo shar: Extracting \"'operators.h'\" \(779 characters\)
  1257. sed "s/^X//" >'operators.h' <<'END_OF_FILE'
  1258. X#define NO_REGS 10
  1259. X
  1260. X#define ANDR 0
  1261. X#define LODI 1
  1262. X#define LODM 2
  1263. X#define STOM 3
  1264. X#define XORR 4
  1265. X#define LTER 5
  1266. X#define ORR  6
  1267. X#define JMPI 7
  1268. X#define EQR  8
  1269. X#define LTR  9
  1270. X#define GTR  10
  1271. X#define GTER 11
  1272. X#define NOTR 12
  1273. X#define JMPC 13
  1274. X#define INPR 14
  1275. X#define OUPR 15
  1276. X#define JSRC 16
  1277. X#define RET  17
  1278. X#define RETC 18
  1279. X#define ADDR 19
  1280. X#define SUBR 20
  1281. X#define MULR 21
  1282. X#define DIVR 22
  1283. X
  1284. X/* Input ports */
  1285. X#define SHIELD1PORT 1
  1286. X#define SHIELD2PORT 2
  1287. X#define SHIELD3PORT 3
  1288. X#define RADARMODEPORT 4
  1289. X
  1290. X/* Output ports */
  1291. X#define  BUTTON1PORT 1
  1292. X#define  BUTTON2PORT 2
  1293. X#define  BALANCEPORT 4
  1294. X#define  RADARPORT   5
  1295. X#define  STARTTURNLPORT 6
  1296. X
  1297. X
  1298. Xstruct ins
  1299. X{
  1300. X    int ins;
  1301. X    int o1,o2,o3;
  1302. X};
  1303. X
  1304. Xstruct comp
  1305. X{
  1306. X    int *data;
  1307. X    struct ins *text;
  1308. X    int pc;
  1309. X    int sp;
  1310. X    int stack[STACK_SIZE];
  1311. X    int regs[NO_REGS];
  1312. X};
  1313. END_OF_FILE
  1314. if test 779 -ne `wc -c <'operators.h'`; then
  1315.     echo shar: \"'operators.h'\" unpacked with wrong size!
  1316. fi
  1317. # end of 'operators.h'
  1318. fi
  1319. if test -f 'pcomp.h' -a "${1}" != "-c" ; then 
  1320.   echo shar: Will not clobber existing file \"'pcomp.h'\"
  1321. else
  1322. echo shar: Extracting \"'pcomp.h'\" \(2576 characters\)
  1323. sed "s/^X//" >'pcomp.h' <<'END_OF_FILE'
  1324. X#ifndef PCOMP_H
  1325. X#define PCOMP_H
  1326. X
  1327. X#include "player.h"
  1328. X
  1329. X#define NO_REGS 10
  1330. X#define MAX_SYMB_LEN 30
  1331. X
  1332. X#define ANDR 0
  1333. X#define LODI 1
  1334. X#define LODM 2
  1335. X#define STOM 3
  1336. X#define XORR 4
  1337. X#define LTER 5
  1338. X#define ORR  6
  1339. X#define JMPI 7
  1340. X#define EQR  8
  1341. X#define LTR  9
  1342. X#define GTR  10
  1343. X#define GTER 11
  1344. X#define NOTR 12
  1345. X#define JMPC 13
  1346. X#define INPR 14
  1347. X#define OUPR 15
  1348. X#define JSRC 16
  1349. X#define RET  17
  1350. X#define RETC 18
  1351. X#define ADDR 19
  1352. X#define SUBR 20
  1353. X#define MULR 21
  1354. X#define DIVR 22
  1355. X#define MODR 23
  1356. X#define PUSHR 24
  1357. X#define POPR 25
  1358. X#define PUSHM 26
  1359. X#define POPM 27
  1360. X#define JSRI 28
  1361. X#define MOVR 29
  1362. X#define WAIT 30
  1363. X
  1364. X/* Input ports */
  1365. X#define SHIELD1PORT 1
  1366. X#define SHIELD2PORT 2
  1367. X#define SHIELD3PORT 3
  1368. X#define RADARMODEPORT 4
  1369. X#define XPOSPORT 5
  1370. X#define YPOSPORT 6
  1371. X#define XVELPORT 7
  1372. X#define YVELPORT 8
  1373. X#define ANGLEPORT 10
  1374. X#define SPEEDPORT 13
  1375. X#define ENEMYSPEEDPORT 14
  1376. X#define ENEMYDIRECTIONPORT 15
  1377. X#define ENEMYANGLEPORT 16
  1378. X#define TARGETSTATEPORT 17
  1379. X#define SOLARSTATEPORT 18
  1380. X#define JAMSTATEPORT 19
  1381. X#define SHORTSTATEPORT 20
  1382. X#define LONGSTATEPORT 21
  1383. X#define ENGINESTATEPORT 22
  1384. X#define REPAIRSTATEPORT 23
  1385. X#define CURRWEAPPORT 24
  1386. X#define ENEMYDISTPORT 25
  1387. X#define NUMENEMIESPORT 26
  1388. X#define ENERGYPORT 27
  1389. X#define ENEMYAVAILPORT 28
  1390. X#define DIRECTIONPORT 29
  1391. X#define DISTTOPORT 30
  1392. X#define ANGLETOPORT 31
  1393. X#define ENEMYXPOSPORT 32
  1394. X#define ENEMYYPOSPORT 33
  1395. X#define ENEMYXVELPORT 34
  1396. X#define ENEMYYVELPORT 35
  1397. X#define REPAIRITEMPORT 36
  1398. X#define VELATANGPORT 37
  1399. X#define CURRWEAPSTATEPORT 38
  1400. X
  1401. X/* Output ports */
  1402. X#define BUTTON1PORT 1 /* fire */
  1403. X#define BUTTON2PORT 2 /* Toggle weap */
  1404. X#define BUTTON3PORT 3 /* Thrust */
  1405. X#define BALANCEPORT 4
  1406. X#define RADARPORT   5
  1407. X#define SELECTEPORT 6
  1408. X#define CLOAKPORT 7
  1409. X#define GRABPORT 8
  1410. X#define SHIELDREGENPORT 9
  1411. X#define TURNLEFTPORT 10
  1412. X#define TURNRIGHTPORT 11
  1413. X#define QUITPORT 12
  1414. X#define TURNTOPORT 13
  1415. X#define TARGETPORT 14
  1416. X#define REPAIRTOGGLEPORT 15
  1417. X#define REPAIRSELITEMPORT 16
  1418. X
  1419. Xstruct header
  1420. X{
  1421. X    int majvers;
  1422. X    int minvers;
  1423. X    char Name[40];
  1424. X    char Ship[40];    
  1425. X    int start;
  1426. X    int no_vars;
  1427. X    int no_ins;
  1428. X    int does_have_weap[20];
  1429. X    int ls_max,rs_max,bs_max;
  1430. X    int energy_max;
  1431. X    int qual[10];
  1432. X    int num_played;
  1433. X    int cash_earned;    
  1434. X    int kills;
  1435. X};
  1436. X
  1437. Xstruct ins
  1438. X{
  1439. X    int ins;
  1440. X    int o1,o2,o3;
  1441. X};
  1442. X#define STACK_SIZE 1000
  1443. Xstruct comp
  1444. X{
  1445. X    int *data;
  1446. X    struct ins *text;
  1447. X    int pc;
  1448. X    int sp;
  1449. X    int fp;
  1450. X    int stack[STACK_SIZE];
  1451. X    int regs[NO_REGS];
  1452. X    int turnto;
  1453. X    int turnabs;
  1454. X    
  1455. X    int curr_enemy;
  1456. X    winptr ce;
  1457. X    int no_seen;
  1458. X
  1459. X    int can_see_enemy[MAXHOST];
  1460. X    int close[MAXHOST];
  1461. X    int closest[MAXHOST];
  1462. X    winptr cptr[MAXHOST];
  1463. X    char states[100][MAX_SYMB_LEN+1];
  1464. X    int no_states;
  1465. X    int stp[100];
  1466. X    char fname[100];
  1467. X};
  1468. X
  1469. X#endif
  1470. END_OF_FILE
  1471. if test 2576 -ne `wc -c <'pcomp.h'`; then
  1472.     echo shar: \"'pcomp.h'\" unpacked with wrong size!
  1473. fi
  1474. # end of 'pcomp.h'
  1475. fi
  1476. if test -f 'rad2.npc' -a "${1}" != "-c" ; then 
  1477.   echo shar: Will not clobber existing file \"'rad2.npc'\"
  1478. else
  1479. echo shar: Extracting \"'rad2.npc'\" \(2199 characters\)
  1480. sed "s/^X//" >'rad2.npc' <<'END_OF_FILE'
  1481. XNPC
  1482. XName = rad2npc
  1483. XShip = Oldsmobile
  1484. XEnergyMax = 10000
  1485. XLShieldMax = 1200
  1486. XRShieldMax = 1200
  1487. XBShieldMax = 800
  1488. XSolar = 9
  1489. XShortRange = 1
  1490. XEngine = 2
  1491. XRepair = 9
  1492. XLongRange = 1
  1493. XJammer = 1
  1494. XTC = 1
  1495. X
  1496. XWeapons
  1497. XPulse
  1498. X
  1499. Xvar
  1500. X    u
  1501. X    d
  1502. X    l
  1503. X    r
  1504. X    angto
  1505. X    aa1
  1506. X    aa2
  1507. Xend
  1508. X
  1509. XProc dir
  1510. X{
  1511. X    if (r && u) 
  1512. X    {
  1513. X        angto=225;
  1514. X        set TurnTo = 225;
  1515. X        return;
  1516. X    }
  1517. X    if (r && d) 
  1518. X    {
  1519. X        angto=315;
  1520. X        set TurnTo = 315;
  1521. X        return;
  1522. X    }
  1523. X    if (l && u) 
  1524. X    {
  1525. X        angto=135;
  1526. X        set TurnTo = 135;
  1527. X        return;
  1528. X    }
  1529. X    if (l && d) 
  1530. X    {
  1531. X        angto=45;
  1532. X        set TurnTo = 45;
  1533. X        return;
  1534. X    }
  1535. X    if (r)
  1536. X    {
  1537. X        angto=270;
  1538. X        set TurnTo = 270;
  1539. X        return;
  1540. X    }
  1541. X    if (l)
  1542. X    {
  1543. X        angto=90;
  1544. X        set TurnTo = 90;
  1545. X        return;
  1546. X    }
  1547. X    if (d)
  1548. X    {
  1549. X        angto=0;
  1550. X        set TurnTo = 0;
  1551. X        return;
  1552. X    }
  1553. X    if (u)
  1554. X    {
  1555. X        angto=180;
  1556. X        set TurnTo = 180;
  1557. X        return;
  1558. X    }
  1559. X    return;
  1560. X}
  1561. X
  1562. X
  1563. XProc attack
  1564. X{
  1565. Xvar
  1566. X        num
  1567. X    a1
  1568. X    a2
  1569. Xend
  1570. X    set B1 = 1;
  1571. X    set B3 = 1;
  1572. X    a2 = EnemyAngle;
  1573. X    while(EnemyDist < 1000)
  1574. X    {
  1575. X        num=NumEnemies;
  1576. X        set SelectEnemy = 0;
  1577. X        set RepairToggle = 1;
  1578. X        set Balance = 1;
  1579. X
  1580. X        if(! EnemyAvail)
  1581. X        {
  1582. X            set B1 = 0;
  1583. X            set B3 = 0;
  1584. X            return;
  1585. X        }
  1586. X
  1587. X        a1 = a2;
  1588. X        a2 = EnemyAngle;
  1589. X        set TurnTo = EnemyAngle + (a2 - a1) * 4;
  1590. X    }
  1591. X    set B1 = 0;
  1592. X    set B3 = 0;
  1593. X    return;
  1594. X}
  1595. X
  1596. XProc aim
  1597. X{
  1598. Xvar
  1599. X    num
  1600. Xend
  1601. X    num = NumEnemies;
  1602. X    set SelectEnemy = 0;
  1603. X
  1604. X    aa1 = aa2;
  1605. X    aa2 = EnemyAngle;
  1606. X    set TurnTo = EnemyAngle + (aa2 - aa1) * 4;
  1607. X
  1608. X    if(EnemyDist < 1000) 
  1609. X        attack();
  1610. X    return;
  1611. X}
  1612. X
  1613. X
  1614. XProc thrust
  1615. X{
  1616. Xvar
  1617. X    num
  1618. X    i
  1619. X    thrustTime
  1620. Xend
  1621. X    num = NumEnemies;
  1622. X    set SelectEnemy = 0;
  1623. X    set B3 = 1;
  1624. X    aa2 = EnemyAngle;
  1625. X    if(EnemyDist < 2000)
  1626. X        thrustTime = 10;
  1627. X    else
  1628. X        thrustTime = EnemyDist / 600;
  1629. X    i = 0;
  1630. X    while (i < thrustTime)
  1631. X    {
  1632. X        aim();
  1633. X        i = i + 1;
  1634. X    }
  1635. X    set B3 = 0;
  1636. X    return;
  1637. X}
  1638. X
  1639. X
  1640. XProc drift
  1641. X{
  1642. Xvar
  1643. X    i
  1644. Xend
  1645. X    set B3 = 0;
  1646. X    i = 0;
  1647. X    while (i < 4)
  1648. X    {
  1649. X        aim();
  1650. X        i = i + 1;
  1651. X    }
  1652. X    return;
  1653. X}
  1654. X
  1655. X
  1656. XProc seek
  1657. X{
  1658. X    if(NumEnemies > 0)
  1659. X        thrust();
  1660. X    drift();
  1661. X    return;
  1662. X}
  1663. X
  1664. X
  1665. XState loop
  1666. X{
  1667. X    r = 0;
  1668. X    l = 0;
  1669. X    u = 0;
  1670. X    d = 0;
  1671. X
  1672. X    set RepairToggle = 1;
  1673. X    set Balance= 1;
  1674. X
  1675. X    if (XPos*XVel > 50000 && XVel > 0) r = 1;
  1676. X    if (XPos*XVel > 50000 && XVel < 0) l = 1;
  1677. X    if (YPos*YVel > 50000 && YVel > 0) u = 1;
  1678. X    if (YPos*YVel > 50000 && YVel < 0) d = 1;
  1679. X
  1680. X    if (r || l || u || d)
  1681. X    {
  1682. X        dir();
  1683. X        set B1 =0;
  1684. X        if (angto == Angle)
  1685. X        {
  1686. X            set B3 = 1;
  1687. X        }
  1688. X    }
  1689. X    else
  1690. X        seek();
  1691. X}
  1692. X
  1693. XState main
  1694. X{
  1695. X    set B2 = 1;
  1696. X    angto = -500;
  1697. X    1 -> loop;
  1698. X}
  1699. X
  1700. XStart main
  1701. END_OF_FILE
  1702. if test 2199 -ne `wc -c <'rad2.npc'`; then
  1703.     echo shar: \"'rad2.npc'\" unpacked with wrong size!
  1704. fi
  1705. # end of 'rad2.npc'
  1706. fi
  1707. if test -f 'rad3.npc' -a "${1}" != "-c" ; then 
  1708.   echo shar: Will not clobber existing file \"'rad3.npc'\"
  1709. else
  1710. echo shar: Extracting \"'rad3.npc'\" \(2209 characters\)
  1711. sed "s/^X//" >'rad3.npc' <<'END_OF_FILE'
  1712. XNPC
  1713. XName = rad3npc
  1714. XShip = Oldsmobile
  1715. XEnergyMax = 10000
  1716. XLShieldMax = 1200
  1717. XRShieldMax = 1200
  1718. XBShieldMax = 800
  1719. XSolar = 9
  1720. XShortRange = 1
  1721. XEngine = 2
  1722. XRepair = 9
  1723. XLongRange = 1
  1724. XJammer = 1
  1725. XTC = 1
  1726. X
  1727. XWeapons
  1728. XPulse
  1729. XBomb
  1730. XRail
  1731. X
  1732. Xvar
  1733. X    u
  1734. X    d
  1735. X    l
  1736. X    r
  1737. X    angto
  1738. X    aa1
  1739. X    aa2
  1740. Xend
  1741. X
  1742. XProc dir
  1743. X{
  1744. X    if (r && u) 
  1745. X    {
  1746. X        angto=225;
  1747. X        set TurnTo = 225;
  1748. X        return;
  1749. X    }
  1750. X    if (r && d) 
  1751. X    {
  1752. X        angto=315;
  1753. X        set TurnTo = 315;
  1754. X        return;
  1755. X    }
  1756. X    if (l && u) 
  1757. X    {
  1758. X        angto=135;
  1759. X        set TurnTo = 135;
  1760. X        return;
  1761. X    }
  1762. X    if (l && d) 
  1763. X    {
  1764. X        angto=45;
  1765. X        set TurnTo = 45;
  1766. X        return;
  1767. X    }
  1768. X    if (r)
  1769. X    {
  1770. X        angto=270;
  1771. X        set TurnTo = 270;
  1772. X        return;
  1773. X    }
  1774. X    if (l)
  1775. X    {
  1776. X        angto=90;
  1777. X        set TurnTo = 90;
  1778. X        return;
  1779. X    }
  1780. X    if (d)
  1781. X    {
  1782. X        angto=0;
  1783. X        set TurnTo = 0;
  1784. X        return;
  1785. X    }
  1786. X    if (u)
  1787. X    {
  1788. X        angto=180;
  1789. X        set TurnTo = 180;
  1790. X        return;
  1791. X    }
  1792. X    return;
  1793. X}
  1794. X
  1795. X
  1796. XProc attack
  1797. X{
  1798. Xvar
  1799. X        num
  1800. X    a1
  1801. X    a2
  1802. Xend
  1803. X    set B1 = 1;
  1804. X    set B3 = 1;
  1805. X    a2 = EnemyAngle;
  1806. X    while(EnemyDist < 1000)
  1807. X    {
  1808. X        num=NumEnemies;
  1809. X        set SelectEnemy = 0;
  1810. X        set RepairToggle = 1;
  1811. X        set Balance = 1;
  1812. X
  1813. X        if(! EnemyAvail)
  1814. X        {
  1815. X            set B1 = 0;
  1816. X            set B3 = 0;
  1817. X            return;
  1818. X        }
  1819. X
  1820. X        a1 = a2;
  1821. X        a2 = EnemyAngle;
  1822. X        set TurnTo = EnemyAngle + (a2 - a1) * 4;
  1823. X    }
  1824. X    set B1 = 0;
  1825. X    set B3 = 0;
  1826. X    return;
  1827. X}
  1828. X
  1829. XProc aim
  1830. X{
  1831. Xvar
  1832. X    num
  1833. Xend
  1834. X    num = NumEnemies;
  1835. X    set SelectEnemy = 0;
  1836. X
  1837. X    aa1 = aa2;
  1838. X    aa2 = EnemyAngle;
  1839. X    set TurnTo = EnemyAngle + (aa2 - aa1) * 4;
  1840. X
  1841. X    if(EnemyDist < 1000) 
  1842. X        attack();
  1843. X    return;
  1844. X}
  1845. X
  1846. X
  1847. XProc thrust
  1848. X{
  1849. Xvar
  1850. X    num
  1851. X    i
  1852. X    thrustTime
  1853. Xend
  1854. X    num = NumEnemies;
  1855. X    set SelectEnemy = 0;
  1856. X    set B3 = 1;
  1857. X    aa2 = EnemyAngle;
  1858. X    if(EnemyDist < 2000)
  1859. X        thrustTime = 10;
  1860. X    else
  1861. X        thrustTime = EnemyDist / 600;
  1862. X    i = 0;
  1863. X    while (i < thrustTime)
  1864. X    {
  1865. X        aim();
  1866. X        i = i + 1;
  1867. X    }
  1868. X    set B3 = 0;
  1869. X    return;
  1870. X}
  1871. X
  1872. X
  1873. XProc drift
  1874. X{
  1875. Xvar
  1876. X    i
  1877. Xend
  1878. X    set B3 = 0;
  1879. X    i = 0;
  1880. X    while (i < 4)
  1881. X    {
  1882. X        aim();
  1883. X        i = i + 1;
  1884. X    }
  1885. X    return;
  1886. X}
  1887. X
  1888. X
  1889. XProc seek
  1890. X{
  1891. X    if(NumEnemies > 0)
  1892. X        thrust();
  1893. X    drift();
  1894. X    return;
  1895. X}
  1896. X
  1897. X
  1898. XState loop
  1899. X{
  1900. X    r = 0;
  1901. X    l = 0;
  1902. X    u = 0;
  1903. X    d = 0;
  1904. X
  1905. X    set RepairToggle = 1;
  1906. X    set Balance= 1;
  1907. X
  1908. X    if (XPos*XVel > 50000 && XVel > 0) r = 1;
  1909. X    if (XPos*XVel > 50000 && XVel < 0) l = 1;
  1910. X    if (YPos*YVel > 50000 && YVel > 0) u = 1;
  1911. X    if (YPos*YVel > 50000 && YVel < 0) d = 1;
  1912. X
  1913. X    if (r || l || u || d)
  1914. X    {
  1915. X        dir();
  1916. X        set B1 =0;
  1917. X        if (angto == Angle)
  1918. X        {
  1919. X            set B3 = 1;
  1920. X        }
  1921. X    }
  1922. X    else
  1923. X        seek();
  1924. X}
  1925. X
  1926. XState main
  1927. X{
  1928. X    set B2 = 1;
  1929. X    angto = -500;
  1930. X    1 -> loop;
  1931. X}
  1932. X
  1933. XStart main
  1934. END_OF_FILE
  1935. if test 2209 -ne `wc -c <'rad3.npc'`; then
  1936.     echo shar: \"'rad3.npc'\" unpacked with wrong size!
  1937. fi
  1938. # end of 'rad3.npc'
  1939. fi
  1940. if test -f 'read_ship.c' -a "${1}" != "-c" ; then 
  1941.   echo shar: Will not clobber existing file \"'read_ship.c'\"
  1942. else
  1943. echo shar: Extracting \"'read_ship.c'\" \(1533 characters\)
  1944. sed "s/^X//" >'read_ship.c' <<'END_OF_FILE'
  1945. X/* read_ship.c - *** Routines for reading in bitmaps */
  1946. X
  1947. X#if !defined(lint)
  1948. Xstatic char sccs_id[] = "@(#)read_ship.c 1.6 92/11/17 XMPB";
  1949. X#endif
  1950. X#include "player.h"
  1951. X
  1952. Xextern int euid;
  1953. Xextern int installed;
  1954. X
  1955. X/*
  1956. X* Read the stars bitmaps for the player structure
  1957. X*/
  1958. Xread_stars(w)
  1959. Xwinptr w;
  1960. X{
  1961. X    int xh,yh;
  1962. X    
  1963. X    char *bitmapfile;
  1964. X    char *bitmapfilestartptr;
  1965. X
  1966. Xseteuid(euid);
  1967. X    /* Allocate a string to hold the bitmapfile's directory
  1968. X       and the filename. "saturn1" is the longest. */
  1969. X    if(installed)
  1970. X    {
  1971. X        bitmapfile = (char *) malloc(strlen(BITMAPDIR)+strlen("saturn1")+1);
  1972. X        strcpy(bitmapfile,BITMAPDIR);
  1973. X    }
  1974. X    else
  1975. X    {
  1976. X        bitmapfile = (char *) malloc(10+strlen("saturn1")+1);
  1977. X        strcpy(bitmapfile,"./bitmaps/");
  1978. X    }
  1979. X    
  1980. X    /* Set a pointer to point into the start of the string where
  1981. X       the filename will be added. Each time the filename will
  1982. X       be overwritten with a new one. */
  1983. X    if(installed)
  1984. X        bitmapfilestartptr = bitmapfile + strlen(BITMAPDIR);
  1985. X    else
  1986. X        bitmapfilestartptr = bitmapfile + 10;
  1987. X
  1988. X    strcpy(bitmapfilestartptr,"star1");
  1989. X    XReadBitmapFile(w->theDisplay,w->theWindow,bitmapfile,
  1990. X            &(w->spm[0].w),&(w->spm[0].h),&(w->spm[0].spm),&xh,&yh);
  1991. X
  1992. X    strcpy(bitmapfilestartptr,"star2");
  1993. X    XReadBitmapFile(w->theDisplay,w->theWindow,bitmapfile,
  1994. X            &(w->spm[1].w),&(w->spm[1].h),&(w->spm[1].spm),&xh,&yh);
  1995. X
  1996. X    strcpy(bitmapfilestartptr,"saturn1");
  1997. X    XReadBitmapFile(w->theDisplay,w->theWindow,bitmapfile,
  1998. X            &(w->spm[2].w),&(w->spm[2].h),&(w->spm[2].spm),&xh,&yh);
  1999. Xseteuid(getuid());
  2000. X}
  2001. END_OF_FILE
  2002. if test 1533 -ne `wc -c <'read_ship.c'`; then
  2003.     echo shar: \"'read_ship.c'\" unpacked with wrong size!
  2004. fi
  2005. # end of 'read_ship.c'
  2006. fi
  2007. if test -f 'retire.c' -a "${1}" != "-c" ; then 
  2008.   echo shar: Will not clobber existing file \"'retire.c'\"
  2009. else
  2010. echo shar: Extracting \"'retire.c'\" \(1766 characters\)
  2011. sed "s/^X//" >'retire.c' <<'END_OF_FILE'
  2012. X#include "player.h"
  2013. X#include "save.h"
  2014. X
  2015. Xint euid;
  2016. Xextern  save default_save; 
  2017. X
  2018. Xmain(argc, argv)
  2019. Xint argc;
  2020. Xchar *argv[];
  2021. X{
  2022. X    save *dude, temp;
  2023. X    int no;
  2024. X    char buf[160];
  2025. X    char buf2[160];
  2026. X    char pwd[MAX_NAME_SIZE];
  2027. X    FILE *fp, *fp2;
  2028. X    int dude_written;
  2029. X
  2030. X    euid = geteuid();
  2031. X    seteuid(getuid());
  2032. X
  2033. X    no =0;
  2034. X    if(argc!=2) 
  2035. X    {
  2036. X        printf("Usage: %s Name\n", argv[0]);
  2037. X        exit(1);
  2038. X    }
  2039. X    dude=load_dude(argv[1]);
  2040. X    if(dude==&default_save)
  2041. X    {
  2042. X        fprintf(stderr,"No such player\n");
  2043. X        exit(0);
  2044. X    }
  2045. X    if(getuid() != euid)
  2046. X    {
  2047. XKLUDGE:
  2048. X    printf("\nType in your passord: ");
  2049. X    gets(pwd);
  2050. X    if(strcmp(dude->password, pwd))
  2051. X        goto KLUDGE;
  2052. X    }
  2053. X    /*
  2054. X    ** Save in hall of fame 
  2055. X    */
  2056. X    
  2057. X    buf[0]=0;
  2058. X    buf2[0]=0;
  2059. X    strcpy(buf, SAVEDIR);
  2060. X    strcat(buf, "hall.of.fame");
  2061. X    strcpy(buf2, buf);
  2062. X    strcat(buf2, "2");
  2063. Xseteuid(euid);
  2064. X    fp=fopen(buf,"rb");
  2065. Xseteuid(getuid());
  2066. X    if(!fp)
  2067. X    {
  2068. Xseteuid(euid);
  2069. X        fp=fopen(buf,"wb");
  2070. Xseteuid(getuid());
  2071. X        if(!fp)
  2072. X        {
  2073. X            perror("Cannot create hall of fame\n");
  2074. X            exit(0);
  2075. X        }
  2076. X        fwrite(dude, sizeof(save), 1, fp);
  2077. X        fclose(fp);
  2078. X        exit(0);
  2079. X    }
  2080. X
  2081. X    dude_written=0;
  2082. Xseteuid(euid);
  2083. X    fp2=fopen(buf2,"wb");
  2084. Xseteuid(getuid());
  2085. X    if(!fp2)
  2086. X    {
  2087. X       perror("Cannot create hall of fame\n");
  2088. X       exit(0);
  2089. X    }
  2090. X    while(no++,fread(&temp, sizeof(save), 1, fp))
  2091. X    {
  2092. X        if(!dude_written && ((dude->kills == temp.kills && dude->credits > temp.credits) || (dude->kills > temp.kills)))
  2093. X        {
  2094. X            if(no <= 20-dude_written)
  2095. X                fwrite(dude, sizeof(save), 1, fp2);
  2096. X            dude_written=1;
  2097. X        }
  2098. X        if(no <= 20-dude_written)
  2099. X        fwrite(&temp, sizeof(save), 1, fp2);
  2100. X    }
  2101. X    if(!dude_written && no <= 20)
  2102. X        fwrite(dude, sizeof(save), 1, fp2);    
  2103. X    fclose(fp);
  2104. X    fclose(fp2);
  2105. X    unlink(buf);
  2106. X    rename(buf2, buf);
  2107. X    buf[0]=0;
  2108. X    strcpy(buf, SAVEDIR);
  2109. X    strcat(buf, argv[1]);
  2110. X    strcat(buf, ".xms");
  2111. Xseteuid(euid);
  2112. X    unlink(buf);
  2113. Xseteuid(getuid());
  2114. X}
  2115. END_OF_FILE
  2116. if test 1766 -ne `wc -c <'retire.c'`; then
  2117.     echo shar: \"'retire.c'\" unpacked with wrong size!
  2118. fi
  2119. # end of 'retire.c'
  2120. fi
  2121. if test -f 'retire.man' -a "${1}" != "-c" ; then 
  2122.   echo shar: Will not clobber existing file \"'retire.man'\"
  2123. else
  2124. echo shar: Extracting \"'retire.man'\" \(761 characters\)
  2125. sed "s/^X//" >'retire.man' <<'END_OF_FILE'
  2126. X.TH Xmpb 6
  2127. X.SH NAME
  2128. Xretire - retire a character
  2129. X.SH SYPNOSIS
  2130. X.ta 4n
  2131. X\fIretire\fR Name
  2132. X
  2133. X.SH DESCRIPTION
  2134. X
  2135. X    This is part of the Xmpb package.
  2136. X
  2137. X    The retire program is used to retire your character when you just don't have enough cash left to fix the ship up.  When you retire a character, then they will be put into the hall of fame.
  2138. X
  2139. XTo use retire,
  2140. X
  2141. Xretire Name   - Where Name is the name of the character to retire.
  2142. X
  2143. X
  2144. XIf this program doesn't work:
  2145. X
  2146. XUsage: retire Name
  2147. X
  2148. X
  2149. X- You have not given one parameter to the retire program
  2150. X
  2151. X
  2152. XNo such player
  2153. X
  2154. X- This is because the name given is not the same as the one you typed in when you play xmpb.  Watch out for extra spaces.  Or of course, the character might not exist.
  2155. X
  2156. X.SH SEE ALSO
  2157. Xxmpb(6),npcc(6),shop(6),describe(6)
  2158. END_OF_FILE
  2159. if test 761 -ne `wc -c <'retire.man'`; then
  2160.     echo shar: \"'retire.man'\" unpacked with wrong size!
  2161. fi
  2162. # end of 'retire.man'
  2163. fi
  2164. if test -f 'save.h' -a "${1}" != "-c" ; then 
  2165.   echo shar: Will not clobber existing file \"'save.h'\"
  2166. else
  2167. echo shar: Extracting \"'save.h'\" \(484 characters\)
  2168. sed "s/^X//" >'save.h' <<'END_OF_FILE'
  2169. X/* save.h - *** Structure for saving */
  2170. X
  2171. X/*   @(#)save.h 1.10 93/03/26 XMPB  */
  2172. X
  2173. X#define MAX_WEAPONS 20
  2174. X
  2175. Xstruct save_s
  2176. X{
  2177. X    char Name[MAX_NAME_SIZE],Ship[MAX_NAME_SIZE];
  2178. X    char password[10];
  2179. X    int energy_max;
  2180. X    int credits;   /* cash on hand and what earned */
  2181. X    int ls_max,rs_max,bs_max;
  2182. X    int quality[NUM_ITEMS+1];
  2183. X    int state[NUM_ITEMS+1];
  2184. X    int does_have_weap[MAX_WEAPONS];
  2185. X    int weap_on_status[MAX_WEAPONS];
  2186. X    int kills;
  2187. X    int ship_value;
  2188. X};
  2189. X
  2190. Xtypedef struct save_s save;
  2191. X
  2192. Xsave *load_dude();
  2193. END_OF_FILE
  2194. if test 484 -ne `wc -c <'save.h'`; then
  2195.     echo shar: \"'save.h'\" unpacked with wrong size!
  2196. fi
  2197. # end of 'save.h'
  2198. fi
  2199. if test -f 'save_load.c' -a "${1}" != "-c" ; then 
  2200.   echo shar: Will not clobber existing file \"'save_load.c'\"
  2201. else
  2202. echo shar: Extracting \"'save_load.c'\" \(822 characters\)
  2203. sed "s/^X//" >'save_load.c' <<'END_OF_FILE'
  2204. X#include "player.h"
  2205. X#include "save.h"
  2206. X#include "save.c"
  2207. X
  2208. Xextern int euid;
  2209. Xchar fn[100];
  2210. X
  2211. Xsave *load_dude(name)
  2212. Xchar *name;
  2213. X{
  2214. X    int i;
  2215. X    FILE *fp;
  2216. X    save *temp;
  2217. X
  2218. X    strcpy(fn,SAVEDIR);
  2219. X    strcat(fn, name);
  2220. X    strcat(fn, ".xms");
  2221. X
  2222. Xseteuid(euid);
  2223. X    fp=fopen(fn, "rb");
  2224. Xseteuid(getuid());
  2225. X    if(!fp) {
  2226. X        return &(default_save);
  2227. X    }
  2228. X    temp=(save *) malloc (sizeof(save));
  2229. X    if(!temp) 
  2230. X    {
  2231. X        fprintf(stderr,"Not enough memory");
  2232. X        exit(1);
  2233. X    }
  2234. X    fread(temp, sizeof(save), 1, fp);
  2235. X    fclose(fp);
  2236. X    return temp;
  2237. X}
  2238. X
  2239. Xsave_dude(s)
  2240. Xsave *s;
  2241. X{
  2242. X    FILE *fp;
  2243. X
  2244. X    fn[0]=0;
  2245. X    strcpy(fn,SAVEDIR);
  2246. X    strcat(fn, s->Name);
  2247. X    strcat(fn, ".xms");
  2248. Xseteuid(euid);
  2249. X    fp=fopen(fn, "wb");
  2250. Xseteuid(getuid());
  2251. X    if(!fp) {
  2252. X        perror("Cannot save file");
  2253. X        exit(1);
  2254. X    }
  2255. X     fwrite(s, sizeof(save), 1, fp);
  2256. X    fclose(fp);
  2257. X
  2258. X}
  2259. END_OF_FILE
  2260. if test 822 -ne `wc -c <'save_load.c'`; then
  2261.     echo shar: \"'save_load.c'\" unpacked with wrong size!
  2262. fi
  2263. # end of 'save_load.c'
  2264. fi
  2265. if test -f 'shop.icon' -a "${1}" != "-c" ; then 
  2266.   echo shar: Will not clobber existing file \"'shop.icon'\"
  2267. else
  2268. echo shar: Extracting \"'shop.icon'\" \(2190 characters\)
  2269. sed "s/^X//" >'shop.icon' <<'END_OF_FILE'
  2270. X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
  2271. X */
  2272. X    0x2000,    0x0000,    0x0000,    0x0000,
  2273. X    0x0200,    0x0000,    0x0000,    0x0000,
  2274. X    0x8000,    0x0000,    0x0000,    0x0000,
  2275. X    0x0440,    0x0000,    0x0000,    0x0000,
  2276. X    0x4008,    0x0000,    0x0000,    0x0000,
  2277. X    0x0120,    0x0000,    0x0000,    0x0000,
  2278. X    0x0800,    0x0000,    0x0000,    0x0000,
  2279. X    0x0008,    0x0000,    0x0000,    0x0000,
  2280. X    0x0000,    0x0000,    0x0000,    0x0000,
  2281. X    0x0004,    0x0000,    0x0000,    0x0000,
  2282. X    0x0000,    0x0000,    0x0000,    0x0000,
  2283. X    0x0004,    0x0000,    0x0000,    0x0000,
  2284. X    0x0002,    0x0001,    0x0000,    0x0000,
  2285. X    0x0004,    0x0006,    0x8000,    0x0000,
  2286. X    0x0002,    0x0008,    0x6000,    0x0000,
  2287. X    0x0004,    0x0010,    0x1000,    0x0000,
  2288. X    0x0002,    0x0060,    0x0800,    0x0000,
  2289. X    0x0000,    0x0080,    0x0600,    0x0000,
  2290. X    0x0007,    0x8100,    0x0100,    0x0000,
  2291. X    0x0004,    0x8600,    0x0080,    0x0000,
  2292. X    0x0004,    0x8800,    0x0040,    0x0000,
  2293. X    0x0004,    0x9000,    0x0030,    0x0000,
  2294. X    0x0004,    0xE000,    0x0008,    0x0000,
  2295. X    0x0004,    0x8000,    0x0004,    0x0000,
  2296. X    0x0005,    0x0000,    0x0003,    0x0000,
  2297. X    0x0006,    0x0000,    0x0000,    0x8000,
  2298. X    0x0018,    0x0000,    0x0000,    0x4000,
  2299. X    0x0020,    0x0000,    0x0000,    0x3000,
  2300. X    0x00C0,    0x0000,    0x0000,    0x0800,
  2301. X    0x01FF,    0xFFFF,    0xFFFF,    0xFE00,
  2302. X    0x0080,    0x0000,    0x0000,    0x0400,
  2303. X    0x0080,    0x0000,    0x0000,    0x0400,
  2304. X    0x0080,    0x0000,    0x0000,    0x0400,
  2305. X    0x009F,    0xFC00,    0x00FF,    0xE400,
  2306. X    0x0090,    0x8400,    0x0084,    0x2400,
  2307. X    0x0090,    0x8400,    0x0084,    0x2400,
  2308. X    0x0090,    0x8400,    0x0084,    0x2400,
  2309. X    0x0090,    0x8400,    0x0084,    0x2400,
  2310. X    0x009F,    0xFC00,    0x00FF,    0xE400,
  2311. X    0x0090,    0x8400,    0x0084,    0x2400,
  2312. X    0x0090,    0x8400,    0x0084,    0x2400,
  2313. X    0x0090,    0x8400,    0x0084,    0x2400,
  2314. X    0x0090,    0x8400,    0x0084,    0x2400,
  2315. X    0x009F,    0xFC00,    0x00FF,    0xE400,
  2316. X    0x0080,    0x0000,    0x0000,    0x0400,
  2317. X    0x0080,    0x00FF,    0xFC00,    0x0400,
  2318. X    0x0080,    0x0080,    0x0400,    0x0400,
  2319. X    0x0080,    0x0080,    0x0400,    0x0400,
  2320. X    0x0080,    0x0080,    0x0400,    0x0400,
  2321. X    0x0080,    0x0080,    0x0400,    0x0400,
  2322. X    0x0080,    0x0080,    0x0400,    0x0400,
  2323. X    0x0080,    0x0080,    0x0400,    0x0400,
  2324. X    0x0080,    0x0080,    0x6400,    0x0400,
  2325. X    0x0080,    0x0080,    0x6400,    0x0400,
  2326. X    0x0080,    0x0080,    0x0400,    0x0400,
  2327. X    0x0080,    0x0080,    0x0400,    0x0400,
  2328. X    0x0080,    0x0080,    0x0400,    0x0400,
  2329. X    0x0080,    0x0080,    0x0400,    0x0400,
  2330. X    0x0080,    0x0080,    0x0400,    0x0400,
  2331. X    0x0080,    0x0080,    0x0400,    0x0400,
  2332. X    0x0080,    0x0080,    0x0400,    0x0400,
  2333. X    0x0080,    0x0080,    0x0400,    0x0400,
  2334. X    0x0080,    0x0080,    0x0400,    0x0400,
  2335. X    0x00FF,    0xFFFF,    0xFFFF,    0xFC00,
  2336. END_OF_FILE
  2337. if test 2190 -ne `wc -c <'shop.icon'`; then
  2338.     echo shar: \"'shop.icon'\" unpacked with wrong size!
  2339. fi
  2340. # end of 'shop.icon'
  2341. fi
  2342. if test -f 'shop_ui.h' -a "${1}" != "-c" ; then 
  2343.   echo shar: Will not clobber existing file \"'shop_ui.h'\"
  2344. else
  2345. echo shar: Extracting \"'shop_ui.h'\" \(1368 characters\)
  2346. sed "s/^X//" >'shop_ui.h' <<'END_OF_FILE'
  2347. X#ifndef    shop_HEADER
  2348. X#define    shop_HEADER
  2349. X
  2350. Xextern Attr_attribute    INSTANCE;
  2351. X
  2352. Xtypedef struct {
  2353. X    Xv_opaque    Shop;
  2354. X    Xv_opaque    controls1;
  2355. X    Xv_opaque    MenuButton;
  2356. X    Xv_opaque    canvas;
  2357. X    Xv_opaque    controls2;
  2358. X    Xv_opaque    BuyButton;
  2359. X    Xv_opaque    SellButton;
  2360. X    Xv_opaque    RepairButton;
  2361. X    Xv_opaque    ShowButton;
  2362. X    Xv_opaque   InShipLabel;
  2363. X    Xv_opaque   InShopLabel;
  2364. X} MainWinObjs;
  2365. X
  2366. Xtypedef struct {
  2367. X    Xv_opaque    pwdWin;
  2368. X    Xv_opaque    controls4;
  2369. X    Xv_opaque    pwdText;
  2370. X} pwdWinObjs;
  2371. X
  2372. Xextern pwdWinObjs    *pwdWinObjsInit();
  2373. X
  2374. Xextern Xv_opaque    pwdWin_create();
  2375. Xextern Xv_opaque    Controls4_create();
  2376. Xextern Xv_opaque    pwdWinPwdText_create();
  2377. X
  2378. Xextern MainWinObjs    *MainWinObjsInit();
  2379. X
  2380. Xextern Xv_opaque    MainWin_create();
  2381. Xextern Xv_opaque    Controls1_create();
  2382. Xextern Xv_opaque    MenuButton_create();
  2383. Xextern Xv_opaque    Canvas_create();
  2384. Xextern Xv_opaque    Controls2_create();
  2385. Xextern Xv_opaque    BuyButton_create();
  2386. Xextern Xv_opaque    SellButton_create();
  2387. Xextern Xv_opaque    RepairButton_create();
  2388. Xextern Xv_opaque    ShowButton_create();
  2389. Xextern Xv_opaque    InShipLabel_create();
  2390. Xextern Xv_opaque    InShopLabel_create();
  2391. X
  2392. X
  2393. Xstruct menu_p {
  2394. X    char menu_name[40]; 
  2395. X    char menu_item[40][40];
  2396. X    Menu MenuPointer;
  2397. X    char descr[40][480];
  2398. X    int     cost[40];
  2399. X    struct menu_p *next;
  2400. X};
  2401. X
  2402. Xstruct menu_p *head, *curr;
  2403. X
  2404. Xint lastButtonPos;
  2405. XDisplay *disp;
  2406. XGC othergc,gc;
  2407. XXv_window win;
  2408. Xint pos, ypos;
  2409. XXv_opaque base, pwd;
  2410. X
  2411. XMainWinObjs *MainWin;
  2412. X
  2413. X#endif
  2414. END_OF_FILE
  2415. if test 1368 -ne `wc -c <'shop_ui.h'`; then
  2416.     echo shar: \"'shop_ui.h'\" unpacked with wrong size!
  2417. fi
  2418. # end of 'shop_ui.h'
  2419. fi
  2420. if test -f 'sin.c' -a "${1}" != "-c" ; then 
  2421.   echo shar: Will not clobber existing file \"'sin.c'\"
  2422. else
  2423. echo shar: Extracting \"'sin.c'\" \(332 characters\)
  2424. sed "s/^X//" >'sin.c' <<'END_OF_FILE'
  2425. X/* %M% - ***  */
  2426. X
  2427. Xstatic char sccs_id[] = "%Z%%M% %I% %E% XMPB";
  2428. X#include <math.h>
  2429. X
  2430. Xmain()
  2431. X{
  2432. X
  2433. X    int i;
  2434. Xprintf("int mysintab[] = {\n");
  2435. X    for(i=0;i<361;i++)
  2436. X    {
  2437. X        double a;
  2438. X
  2439. X        a = (double)i/180.0*M_PI;
  2440. X        printf("%d",(int)(32768.0*sin(a)));
  2441. X        if(i != 360) printf(",");
  2442. X        if(i%10 == 0) printf("\n");    
  2443. X        
  2444. X    }
  2445. Xprintf("};\n");
  2446. X    return 0;
  2447. X}
  2448. X    
  2449. END_OF_FILE
  2450. if test 332 -ne `wc -c <'sin.c'`; then
  2451.     echo shar: \"'sin.c'\" unpacked with wrong size!
  2452. fi
  2453. # end of 'sin.c'
  2454. fi
  2455. if test -f 'sintab.c' -a "${1}" != "-c" ; then 
  2456.   echo shar: Will not clobber existing file \"'sintab.c'\"
  2457. else
  2458. echo shar: Extracting \"'sintab.c'\" \(2319 characters\)
  2459. sed "s/^X//" >'sintab.c' <<'END_OF_FILE'
  2460. Xint mysintab[] = {
  2461. X0,
  2462. X571,1143,1714,2285,2855,3425,3993,4560,5126,5690,
  2463. X6252,6812,7371,7927,8480,9032,9580,10125,10668,11207,
  2464. X11743,12275,12803,13327,13848,14364,14876,15383,15886,16383,
  2465. X16876,17364,17846,18323,18794,19260,19720,20173,20621,21062,
  2466. X21497,21926,22347,22762,23170,23571,23964,24351,24730,25101,
  2467. X25465,25821,26169,26509,26841,27165,27481,27788,28087,28377,
  2468. X28659,28932,29196,29451,29697,29935,30163,30381,30591,30791,
  2469. X30982,31164,31336,31498,31651,31794,31928,32051,32165,32270,
  2470. X32364,32449,32523,32588,32643,32688,32723,32748,32763,32768,
  2471. X32763,32748,32723,32688,32643,32588,32523,32449,32364,32270,
  2472. X32165,32051,31928,31794,31651,31498,31336,31164,30982,30791,
  2473. X30591,30381,30163,29935,29697,29451,29196,28932,28659,28377,
  2474. X28087,27788,27481,27165,26841,26509,26169,25821,25465,25101,
  2475. X24730,24351,23964,23571,23170,22762,22347,21926,21497,21062,
  2476. X20621,20173,19720,19260,18794,18323,17846,17364,16876,16383,
  2477. X15886,15383,14876,14364,13848,13327,12803,12275,11743,11207,
  2478. X10668,10125,9580,9032,8480,7927,7371,6812,6252,5690,
  2479. X5126,4560,3993,3425,2855,2285,1714,1143,571,0,
  2480. X-571,-1143,-1714,-2285,-2855,-3425,-3993,-4560,-5126,-5690,
  2481. X-6252,-6812,-7371,-7927,-8480,-9032,-9580,-10125,-10668,-11207,
  2482. X-11743,-12275,-12803,-13327,-13848,-14364,-14876,-15383,-15886,-16384,
  2483. X-16876,-17364,-17846,-18323,-18794,-19260,-19720,-20173,-20621,-21062,
  2484. X-21497,-21926,-22347,-22762,-23170,-23571,-23964,-24351,-24730,-25101,
  2485. X-25465,-25821,-26169,-26509,-26841,-27165,-27481,-27788,-28087,-28377,
  2486. X-28659,-28932,-29196,-29451,-29697,-29935,-30163,-30381,-30591,-30791,
  2487. X-30982,-31164,-31336,-31498,-31651,-31794,-31928,-32051,-32165,-32270,
  2488. X-32364,-32449,-32523,-32588,-32643,-32688,-32723,-32748,-32763,-32768,
  2489. X-32763,-32748,-32723,-32688,-32643,-32588,-32523,-32449,-32364,-32270,
  2490. X-32165,-32051,-31928,-31794,-31651,-31498,-31336,-31164,-30982,-30791,
  2491. X-30591,-30381,-30163,-29935,-29697,-29451,-29196,-28932,-28659,-28377,
  2492. X-28087,-27788,-27481,-27165,-26841,-26509,-26169,-25821,-25465,-25101,
  2493. X-24730,-24351,-23964,-23571,-23170,-22762,-22347,-21926,-21497,-21062,
  2494. X-20621,-20173,-19720,-19260,-18794,-18323,-17846,-17364,-16876,-16384,
  2495. X-15886,-15383,-14876,-14364,-13848,-13327,-12803,-12275,-11743,-11207,
  2496. X-10668,-10125,-9580,-9032,-8480,-7927,-7371,-6812,-6252,-5690,
  2497. X-5126,-4560,-3993,-3425,-2855,-2285,-1714,-1143,-571,0
  2498. X};
  2499. END_OF_FILE
  2500. if test 2319 -ne `wc -c <'sintab.c'`; then
  2501.     echo shar: \"'sintab.c'\" unpacked with wrong size!
  2502. fi
  2503. # end of 'sintab.c'
  2504. fi
  2505. if test -f 'thrust.c' -a "${1}" != "-c" ; then 
  2506.   echo shar: Will not clobber existing file \"'thrust.c'\"
  2507. else
  2508. echo shar: Extracting \"'thrust.c'\" \(1070 characters\)
  2509. sed "s/^X//" >'thrust.c' <<'END_OF_FILE'
  2510. X/* thrust.c - *** Routines to incorporate thrusting */
  2511. X
  2512. Xstatic char sccs_id[] = "@(#)thrust.c 1.11 92/11/24 XMPB";
  2513. X
  2514. X#include <math.h>
  2515. X#include "player.h"
  2516. X
  2517. X
  2518. X/*
  2519. X*    Do we have enough energy to thrust
  2520. X*/
  2521. Xenough_e_to_thr(w)
  2522. Xwinptr w;
  2523. X{
  2524. X    if(w->energy_curr > THRUST_E_USE)  /* defined in player.h */
  2525. X        return 1;
  2526. X    return 0;
  2527. X}
  2528. X
  2529. X/*
  2530. X*    Decide which pictures to show when thrusting
  2531. X*/
  2532. Xupdate_thrust(w)
  2533. Xwinptr w;
  2534. X{
  2535. X    /*
  2536. X    *    If we can't thrust, don't
  2537. X    */
  2538. X    if(!enough_e_to_thr(w) || w->state[ENGINE] < 1)
  2539. X        w->t2 = 0;
  2540. X
  2541. X    /*
  2542. X    *    If the keys to turn are off (i.e. not turning)
  2543. X    */
  2544. X    if(w->tr == 0  && w->tl == 0)
  2545. X    {
  2546. X        if(w->t2)    /* are we thrusting    */
  2547. X        {
  2548. X            w->t1 = 1;    /* Sides on */
  2549. X            w->t3 = 1;
  2550. X        }
  2551. X        else
  2552. X        {
  2553. X            w->t1 = 0;    /* Sides off */
  2554. X            w->t3 = 0;
  2555. X        }
  2556. X    }
  2557. X    else if(w->tl)     /* Turning left */
  2558. X    {
  2559. X        if(w->t2)
  2560. X        {
  2561. X            w->t1 = 0;
  2562. X            w->t3 = 1;
  2563. X        }
  2564. X        else
  2565. X        {
  2566. X            w->t3 = 1;
  2567. X            w->t1 = 0;
  2568. X        }
  2569. X    }
  2570. X    else if(w->tr)     /* Turning right */
  2571. X    {
  2572. X        if(w->t2)
  2573. X        {
  2574. X            w->t3 = 0;
  2575. X            w->t1 = 1;
  2576. X        }
  2577. X        else
  2578. X        {
  2579. X            w->t1 = 1;
  2580. X            w->t3 = 0;
  2581. X        }
  2582. X    }
  2583. X}
  2584. X
  2585. END_OF_FILE
  2586. if test 1070 -ne `wc -c <'thrust.c'`; then
  2587.     echo shar: \"'thrust.c'\" unpacked with wrong size!
  2588. fi
  2589. # end of 'thrust.c'
  2590. fi
  2591. if test -f 'ud_win.c' -a "${1}" != "-c" ; then 
  2592.   echo shar: Will not clobber existing file \"'ud_win.c'\"
  2593. else
  2594. echo shar: Extracting \"'ud_win.c'\" \(2411 characters\)
  2595. sed "s/^X//" >'ud_win.c' <<'END_OF_FILE'
  2596. X/* ud_win.c - *** Handle button presses etc. */
  2597. X
  2598. Xstatic char sccs_id[] = "@(#)ud_win.c 1.17 92/11/24 XMPB";
  2599. X
  2600. X#include "player.h"
  2601. X
  2602. Xextern int weap_energy[NO_WEAPONS];        /* what energy does the weapon use */
  2603. Xextern int load_rate[NO_WEAPONS];        /* how fast does it load */
  2604. Xextern winptr first_win;
  2605. X
  2606. X/*
  2607. X*    Do all of the firing, changing weapons, and thrusting controlled 
  2608. X*    by the mouse for all of the players
  2609. X*/
  2610. Xupdate_win_input()
  2611. X{
  2612. X    winptr t;
  2613. X
  2614. X    t = first_win;
  2615. X    while(t)
  2616. X    {
  2617. X        /*
  2618. X        *    Can't do anything if you're dead!
  2619. X        */
  2620. X        if(t->exploding)
  2621. X            goto kludge2;
  2622. X
  2623. X        /*
  2624. X        *    They want to thrust
  2625. X        */
  2626. X        if(t->b3)
  2627. X        {
  2628. X            t->t2 = 1;
  2629. X        }
  2630. X        else
  2631. X        {
  2632. X            t->t2 = 0;
  2633. X        }
  2634. X
  2635. X        /* 
  2636. X        *    continue loading all weapons  
  2637. X        */
  2638. X        {
  2639. X            int i;
  2640. X        
  2641. X            for(i=0;i<NO_WEAPONS;i++)
  2642. X            {
  2643. X                if(t->load_status[i] > 0) 
  2644. X                    t->load_status[i]--;
  2645. X            }
  2646. X        }
  2647. X
  2648. X        if(t->b1 && t->b2 && t->curr_weap != -1)
  2649. X        {
  2650. X            int i = t->curr_weap;
  2651. X            t->curr_weap++;
  2652. X            t->curr_weap %= NO_WEAPONS;
  2653. X
  2654. X            /*
  2655. X            *    During a "nailstorm", go to the next ready weapon
  2656. X            */
  2657. X            while((!t->does_have_weap[t->curr_weap] || t->load_status[t->curr_weap] != 0 || t->weap_on_status[t->curr_weap] == 0) && i != t->curr_weap)
  2658. X            {
  2659. X                t->curr_weap++;
  2660. X                t->curr_weap %= NO_WEAPONS;
  2661. X            }
  2662. X            t->changed_last_frame = 1;
  2663. X        }
  2664. X        else    
  2665. X        /*
  2666. X        *    Change weapons only if we didn't change last frame
  2667. X        */    
  2668. X        if(t->b2 && !(t->changed_last_frame) && t->curr_weap != -1)
  2669. X        {
  2670. X            int cw,noweap=0;
  2671. X            /* 
  2672. X            *    Go to the next weapon
  2673. X            */
  2674. X            cw = t->curr_weap%NO_WEAPONS;
  2675. X            
  2676. X            t->curr_weap++;
  2677. X            t->curr_weap %= NO_WEAPONS;
  2678. X    
  2679. X            /*
  2680. X            *    Make sure the ship has the weapon
  2681. X            */
  2682. X            while(!t->does_have_weap[t->curr_weap])
  2683. X            {
  2684. X                t->curr_weap++;
  2685. X                t->curr_weap %= NO_WEAPONS;
  2686. X                if(t->curr_weap == cw)
  2687. X                {
  2688. X                    if(!t->does_have_weap[t->curr_weap]) noweap = 1;
  2689. X                    break;
  2690. X                }
  2691. X            }
  2692. X            if(noweap)
  2693. X                t->curr_weap = -1;
  2694. X
  2695. X            /*
  2696. X            *    Don't allow a weapon change next frame
  2697. X            */
  2698. X            t->changed_last_frame = 1;
  2699. X        }
  2700. X        else 
  2701. X        {
  2702. X            /*
  2703. X            *    Ok they can change next frame
  2704. X            */
  2705. X            t->changed_last_frame = 0;
  2706. X        }
  2707. X
  2708. X        
  2709. X        /*
  2710. X        *    Fire weapons if we have enough energy and the weapon is loaded
  2711. X        *    and on
  2712. X        */    
  2713. X        if(t->b1 && (t->load_status[t->curr_weap] == 0) && 
  2714. X            (t->energy_curr > weap_energy[t->curr_weap]) && 
  2715. X            (t->weap_on_status[t->curr_weap]) && t->curr_weap != -1)
  2716. X        {
  2717. X            fire_weapon(t);
  2718. X        }
  2719. X        
  2720. X        /*
  2721. X        *    Do the pics for thrust
  2722. X        */
  2723. X        update_thrust(t);
  2724. Xkludge2:
  2725. X        t = t->next;
  2726. X    }
  2727. X}
  2728. END_OF_FILE
  2729. if test 2411 -ne `wc -c <'ud_win.c'`; then
  2730.     echo shar: \"'ud_win.c'\" unpacked with wrong size!
  2731. fi
  2732. # end of 'ud_win.c'
  2733. fi
  2734. if test -f 'weapon.h' -a "${1}" != "-c" ; then 
  2735.   echo shar: Will not clobber existing file \"'weapon.h'\"
  2736. else
  2737. echo shar: Extracting \"'weapon.h'\" \(964 characters\)
  2738. sed "s/^X//" >'weapon.h' <<'END_OF_FILE'
  2739. Xchar weap_file_names[NO_WEAPONS][30] = {"pulse","bomb","seeker","","rail","massdrive", "mine","","atom","magneto","hvypulse","", "dunno", "dunno2",""};
  2740. Xchar weap_names[NO_WEAPONS][20] = 
  2741. X   {"Pulse Rifle    ",
  2742. X    "Energy Bomb    ",
  2743. X    "Seeker Bomb(T) ",
  2744. X    "Light Laser    ",
  2745. X    "Rail Gun       ",
  2746. X    "Mass Driver    ", 
  2747. X    "Mine           ",
  2748. X    "Heavy Laser    ",
  2749. X    "Atomic Spray   ",
  2750. X    "Magneto Disc(T)",
  2751. X    "Hvy Pulse Rifle",
  2752. X    "Black Death    ",
  2753. X    "Clover Launch  ",
  2754. X    "Vortex Gun     ",
  2755. X    "Missile        "};
  2756. X
  2757. Xint weap_maxlife[NO_WEAPONS] = {20,15,80,0,80,40,5000,0,30,100,30,10,35,60,100};
  2758. Xint weap_velocit[NO_WEAPONS] = {50,30,20,0,50,20,-5,0,40,40,55,40,60,50,80};
  2759. Xint weap_energy[NO_WEAPONS]  = {10,50,100,50,70,30,180,80,25,130,20,400,30,50,70};
  2760. Xint weap_damage[NO_WEAPONS] = {10,45,80,40,50,25,180,35,2,60,20,400,30,45,55};
  2761. Xint load_rate[NO_WEAPONS] = {1,3,10,4,3,2,8,9,1,18,2,400,3,4,3};
  2762. Xint weap_damage_prob[NO_WEAPONS] = {30,60,10,50,160,40,50,65,20,50,25,200,45,40,120};
  2763. END_OF_FILE
  2764. if test 964 -ne `wc -c <'weapon.h'`; then
  2765.     echo shar: \"'weapon.h'\" unpacked with wrong size!
  2766. fi
  2767. # end of 'weapon.h'
  2768. fi
  2769. echo shar: End of archive 7 \(of 8\).
  2770. cp /dev/null ark7isdone
  2771. MISSING=""
  2772. for I in 1 2 3 4 5 6 7 8 ; do
  2773.     if test ! -f ark${I}isdone ; then
  2774.     MISSING="${MISSING} ${I}"
  2775.     fi
  2776. done
  2777. if test "${MISSING}" = "" ; then
  2778.     echo You have unpacked all 8 archives.
  2779.     rm -f ark[1-9]isdone
  2780. else
  2781.     echo You still need to unpack the following archives:
  2782.     echo "        " ${MISSING}
  2783. fi
  2784. ##  End of shell archive.
  2785. exit 0
  2786.