home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume15 / dinkum2 / part02 < prev    next >
Encoding:
Text File  |  1993-01-26  |  53.9 KB  |  1,791 lines

  1. Path: uunet!news.tek.com!master!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v15i037:  dinkum2 - australian text adventure game, Part02/07
  5. Message-ID: <4193@master.CNA.TEK.COM>
  6. Date: 14 Jan 93 03:25:43 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 1779
  9. Approved: billr@saab.CNA.TEK.COM
  10. Xref: uunet comp.sources.games:1536
  11.  
  12. Submitted-by: Gary Allen <gary@sun.mech.uq.oz.au>
  13. Posting-number: Volume 15, Issue 37
  14. Archive-name: dinkum2/Part02
  15. Supersedes: dinkum: Volume 15, Issue 21-26
  16. Environment: Unix, DOS
  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 2 (of 7)."
  27. # Contents:  dinkum.c pusher.c
  28. # Wrapped by billr@saab on Wed Jan 13 19:20:18 1993
  29. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  30. if test -f 'dinkum.c' -a "${1}" != "-c" ; then 
  31.   echo shar: Will not clobber existing file \"'dinkum.c'\"
  32. else
  33. echo shar: Extracting \"'dinkum.c'\" \(32399 characters\)
  34. sed "s/^X//" >'dinkum.c' <<'END_OF_FILE'
  35. X#define DINKUM.C
  36. X#include "dink_sym.h"
  37. X#include "dink_glb.h"
  38. X#include <stdlib.h>
  39. X#define Failed        0
  40. X#define Request        1
  41. X
  42. X/* ---------------- Version Date --------------- */
  43. Xchar *lb_date = "5 January 1993" ;
  44. X/* --------------------------------------------- */
  45. X
  46. X/*  ---- Version Number  ---- */
  47. Xchar *lb_version = "2.3" ;
  48. X/*  ------------------------- */
  49. X
  50. X/* ---------------- Version Type --------------- */
  51. Xchar *lb_share = "[GAMES.SOURCES Version]" ;
  52. X/* --------------------------------------------- */
  53. X
  54. X/*  ---- Serial Number  ---- */
  55. X#define S_number     1
  56. Xint serial = S_number ;
  57. X/*  ------------------------ */
  58. X/* Global variables local to this file only */
  59. Xint sw_help = FALSE, sw_null = FALSE, sw_number = FALSE, sw_standard = FALSE ;
  60. X
  61. X/* MAIN PROGRAM --- MAIN PROGRAM --- MAIN PROGRAM --- MAIN PROGRAM */
  62. Xvoid main(argc,argv)
  63. X/*********************************************************************/
  64. X/*                                                                   */
  65. X/*                   --- The Dinkum Program ---                      */
  66. X/*                                                                   */
  67. X/* Software by Gary A. Allen, Jr.  5 January 1993   Version: Mk 2.3  */
  68. X/*            (c) Copyright 1993 by Gary A. Allen, Jr.               */
  69. X/*                                                                   */
  70. X/*********************************************************************/
  71. X
  72. Xint argc ;
  73. Xchar *argv[] ;
  74. X{
  75. Xregister int i, j ;
  76. X
  77. Xint dig_1, dig_2, sw_loop ;
  78. Xint pnt, i_rand1, i_rand2, i_rand3, loc[3] ;
  79. Xlong l_pass, l_time, l_base, start_time, *time_arg = 0 ;
  80. Xchar chr, cmd[8] ;
  81. X
  82. Xstruct monster_struct *mnstr ;
  83. X
  84. X#if (PROTOTYPE)
  85. X/* Function prototypes */
  86. Xvoid cmd_switch(char[8], int, int, char *[]) ;
  87. Xvoid bugs(int), help(void) ;
  88. Xvoid kelly(int), long_descp(int), objlooker(int), killer(int) ;
  89. Xvoid gleeper(int), actor(int), ender(int), closer(int), opener(int) ;
  90. Xvoid dialer(int), taker(int), dropper(int), describe(int) ;
  91. Xvoid igniter(int), switcher(int), unlocker(int), sounder(int) ;
  92. Xvoid loader(void), eater(void), filler(void), looker(int), exit(int) ;
  93. Xvoid monster(int[3]), new_score(void), boom(void), parse(void) ;
  94. Xint mover(int,int[3]) ; 
  95. Xvoid inventer(void), drinker(void), reader(int), pusher(int*);
  96. Xvoid cheater(void) ; 
  97. Xvoid pass(void), unloader(int) ;
  98. Xlong time(long*) ;
  99. Xchar getch(void), getche(void) ;
  100. X#endif
  101. X
  102. X/* Software security */
  103. Xif (serial != S_number) exit(0) ;  /* abort if serial number changed */
  104. X
  105. X/* Scan the after the DOS/Unix command for switches or file name */
  106. Xif (argc > 1) {
  107. Xfor (i = 1; i <= argc-1; i++) {
  108. X    /* Flush command vector */
  109. X    for (j = 0; j <= 7; j++) cmd[j] = '\0' ;
  110. X    /* Get command vector */
  111. X    sscanf(argv[i],"%c%c%c%c%c%c%c%c%c", &chr, &cmd[0], &cmd[1],
  112. X        &cmd[2], &cmd[3], &cmd[4], &cmd[5], &cmd[6], &cmd[7]) ;
  113. X    sw_null = FALSE ;
  114. X    if (chr == '?') help() ;
  115. X    if (chr == '-') {
  116. X        for (j = 0; j <= 7; j++) {
  117. X            cmd_switch(cmd, j, i, argv) ;
  118. X            if (sw_number) {
  119. X                i++ ;
  120. X                sw_number = FALSE ;
  121. X                break ;
  122. X            }
  123. X            if (sw_null) break ;
  124. X        } /* end of command "for" loop */
  125. X
  126. X        if (j > 7) {
  127. Xprintf("\n!!!! Too many commands on one \"-\" switch group.\n") ;
  128. Xprintf("!!!! Break up the commands into several \"-\" switch groups.\n") ;
  129. X            bugs(Failed) ;
  130. X        }  
  131. X    } /* end of the "-" marker block */
  132. X
  133. X    /* Deal with garbage on the command line */
  134. X    else {
  135. Xprintf ("\n!!!! The following on the command line was not understood:  %s \n",
  136. X    argv[i]);
  137. X        bugs(Failed) ;
  138. X    } /* Nondefault scratch file opening block */
  139. X
  140. X} /* end of argument token "for" loop */
  141. X
  142. Xif (sw_help) help() ;
  143. X} /* end of the command switch block */
  144. X
  145. X/* Deal with someone cheating with switch "-s" */
  146. Xif (sw_standard && (!sw_wizard)) {
  147. X    printf("!!!! Command line switch -s is unknown.\n") ;
  148. X    bugs(Failed) ;
  149. X}
  150. X/* Software security */
  151. Xif (serial != S_number) exit(0) ;  /* abort if serial number changed */
  152. X
  153. X/* Initialize the program */
  154. Xsw_warned = FALSE ;
  155. Xl_time = time(time_arg) ;
  156. Xl_base = l_time/10 ;
  157. Xl_base *= 10 ;
  158. Xl_pass = l_time - l_base ;
  159. Xdig_1 = (int)l_pass ;
  160. Xloc[2] = 0 ;     /* zero out the "old" location */
  161. X
  162. Xprintf("                    ") ;
  163. Xprintf("                   --- Dinkum --- \n");
  164. Xprintf("                    ") ;
  165. Xprintf("     (c) Copyright 1993 by Gary A. Allen, Jr.\n") ;
  166. Xprintf("                    ") ;
  167. Xprintf("  All Rights Reserved. Version %s, %s\n\n",
  168. X    lb_version, lb_date);
  169. X
  170. Xprintf("Would like some initial help with Dinkum?\n") ;
  171. X
  172. Xfor (;;) {
  173. X
  174. X#ifndef __TURBOC__
  175. X    do {
  176. X        printf("(Answer:  Yes or No) ") ; 
  177. X    } while ('\n' == (chr = getchar())) ;
  178. X
  179. X    while ('\n' != getchar()) ;
  180. X#endif
  181. X
  182. X#ifdef __TURBOC__
  183. X    printf("\n") ;
  184. X    do {
  185. X        printf("(Answer:  Yes or No) ") ; 
  186. X    } while ('\n' == (chr = getch())) ;
  187. X    printf("\n") ;
  188. X#endif
  189. X
  190. X    if (('n' == chr)||('N' == chr)||('y' == chr)||('Y' == chr)) {
  191. X        if (('y' == chr)||('Y' == chr)) {
  192. Xprintf("\nG'day Mate!  Welcome to \"Dinkum\" the Australian adventure");
  193. Xprintf("\ngame.  In Dinkum you'll search for treasure in the\n") ;
  194. Xprintf("Australian Outback.  You give the commands and I'll do the\n");
  195. Xprintf("dangerous work. I understand most plain English sentences.\n");
  196. Xprintf("If you want me to go east then type \"Will you please go\n");
  197. Xprintf("east?\" and press the RETURN or ENTER key.  If you don't\n") ;
  198. Xprintf("enjoy typing then just type \"e\" and press RETURN.  I'll\n");
  199. Xprintf("still go east.  After you have gathered up some things\n") ;
  200. Xprintf("you can see what you have by typing \"inventory\".\n") ;
  201. Xprintf("Sometimes you can learn more about an object by typing\n");
  202. Xprintf("\"examine NAME-OF-OBJECT\".  I understand many other\n") ;
  203. Xprintf("commands and words.  However I'll let you have the fun of\n") ;
  204. Xprintf("finding out what I can and can not understand. Good luck!\n\n");
  205. X        }
  206. X        break ;
  207. X    }
  208. X}
  209. X
  210. X/* produce two random numbers ranging from 0-9 based on system clock*/
  211. Xl_time = time(time_arg) ;
  212. Xstart_time = l_time ;
  213. Xl_base = l_time/10 ;
  214. Xl_base *= 10 ;
  215. Xl_pass = l_time - l_base ;
  216. Xdig_2 = (int)l_pass ;
  217. X
  218. X/* generate the actual random array pointers */
  219. Xif (sw_standard) {
  220. X    i_rand1 = 2 ; 
  221. X    i_rand2 = 3 ;
  222. X    i_rand3 = 1 ;
  223. X}
  224. Xelse {
  225. X    i_rand3 = (dig_1 + dig_2)/2 ;
  226. X    i_rand2 = dig_2/3 ;
  227. X    i_rand1 = (dig_1/3) + 1 ;
  228. X}
  229. X
  230. Xprintf("\nIt's a hot summer day (in January) in ") ;
  231. Xprintf("Queensland, Australia.\n") ;
  232. Xloc[1] = R_meadow ;
  233. Xloc[0] = R_meadow ;
  234. X
  235. X/* Software security */
  236. Xif (serial != S_number) exit(0) ;  /* abort if serial number changed */
  237. X
  238. X/* load objects into the rooms */
  239. Xfor (i = 0; i <= obj_init_max; i++) 
  240. X    object[obj_init[i][0]][J_loc] = obj_init[i][i_rand1] ;
  241. X
  242. Xif (sw_script) object[O_recorder][J_loc] = R_meadow ;
  243. X
  244. Xcarry_count = 0 ;
  245. Xcarry_weight = 0 ;
  246. X
  247. Xfor (i = 0; i <= objcnt; i++) {
  248. X    j = object[i][J_loc] ;
  249. X    if ((j >= 0) && (object[i][J_type] != Z_unmovable))
  250. X         ++room[j][M_obj_cnt] ;
  251. X}
  252. X
  253. X/* Initialize the Monsters */
  254. Xif ((monster_start = (struct monster_struct *)calloc((unsigned)(enemy_max+1),
  255. X        sizeof(struct monster_struct))) == 0) {
  256. X    printf("\n---- PROBLEMS ----\n") ;
  257. X    printf("RAM memory is full!\n") ; 
  258. X    printf(" PROGRAM ABORTED\n") ;
  259. X    exit(0) ;
  260. X}
  261. X
  262. XNed = (monster_start + N_ned) ;        /* point to the Ned Kelly structure */
  263. XGuards = (monster_start + N_guards) ;  /* point to the Guards structure */
  264. XWombat = (monster_start + N_wombat) ;  /* point to the Wombat structure */
  265. XMullah = (monster_start + N_mullah) ;  /* point to the Mullah structure */
  266. X
  267. X/* Load up the monster data structure */
  268. Xfor (i = 0; i <= enemy_max; i++) { 
  269. X    mnstr = (monster_start + i) ;     /* point to the monster */
  270. X
  271. X     /* locate the monster */
  272. X    if (i == 0) mnstr->Location = B_unmade ;
  273. X    else mnstr->Location = mon_init[i-1][i_rand2] ;
  274. X
  275. X    /* All monsters are initially asleep */
  276. X    mnstr->Status = F_asleep ;
  277. X
  278. X    /* Load Type numbers for the different monsters */
  279. X    switch(i) {
  280. X    case 2:
  281. X    case 3:
  282. X    case 4:
  283. X    case 5:
  284. X        mnstr->Type = N_drop_bear ;
  285. X        break ;
  286. X    case 6:
  287. X    case 7:
  288. X    case 8:
  289. X    case 9:
  290. X    case 10:
  291. X    case 11:
  292. X    case 12:
  293. X    case 13:
  294. X        mnstr->Type = N_hoop_snake ;
  295. X        break ;
  296. X    default:
  297. X        mnstr->Type = i ;
  298. X    } /* end of the monster Type switch block */
  299. X
  300. X    /* Monsters are initially healthy */
  301. X    mnstr->Hits = 0 ;    
  302. X
  303. X    j = mnstr->Location ;
  304. X    if (j != B_unmade) ++room[j][M_monster] ;
  305. X} /* end of the monster data structure loadup "for" loop */
  306. X/* load the gleep reproductive locations and seed gleep */
  307. Xfor (i = 0; i <= 9; i++)  
  308. X    gleep_spot[i] = gleep_init[i][i_rand2] ;
  309. Xroom[gleep_spot[0]-1][M_gleep] = 1 ; /* seed a nonreproductive spot */ 
  310. X
  311. X/* load safe passage for end-game killing passages  */
  312. Xroom[218 + i_rand3][M_rm_type] = T_short_descp ;
  313. X
  314. X/* Beginning of outer infinite "for" loop */
  315. Xfor(;;) {
  316. X/* special action routine */
  317. Xnew_score() ;  /* update the score */
  318. X
  319. X/* See if the game has timed out */
  320. Xl_time = time(time_arg) ;
  321. Xif ((!sw_warned) && (l_time > start_time + 3300)) {
  322. X    sw_warned = TRUE ;
  323. X    start_time = l_time ;
  324. Xprintf("There's suddenly a puff of blue smoke which fills the room\n") ;
  325. Xprintf("with a hazy cloud.  Slowly this cloud coalesces into a\n") ;
  326. Xprintf("ghostly human form.  This ethereal being is wearing a grey\n") ;
  327. Xprintf("flannel suit, a bowler hat, and glancing at a gold pocket\n") ;
  328. Xprintf("watch which is attached to a long golden chain.  You can\n");
  329. Xprintf("hear \"Waltzing Matilda\" being played softly in the\n") ;
  330. Xprintf("background.  You know what?  I think this ethereal being\n") ;
  331. Xprintf("is none other than the ghost of Banjo Patterson!  With\n") ;
  332. Xprintf("this realization Banjo looks up in your direction and\n") ;
  333. Xprintf("begins to speak:\n\n") ;
  334. Xprintf("\"Sorry mate, you've been at this for too long!  You've\n") ;
  335. Xprintf("got five more minutes to go and then you're history!\"\n\n") ;
  336. Xprintf("Then just as suddenly Banjo Patterson dissolves back into\n") ;
  337. Xprintf("smoke and disappears from view.\n\n") ;
  338. X}
  339. Xif (sw_warned && (l_time > start_time + 300)) {
  340. Xprintf("You hear someone clearing his throat behind you.  You turn\n") ;
  341. Xprintf("around and see Banjo Patterson has appeared once again.  An\n");
  342. Xprintf("old brass chain is hanging from mid air next to Banjo.  On\n") ;
  343. Xprintf("the end of the chain is a white porcelain tear drop shaped\n");
  344. Xprintf("nob with the word \"PULL\" written on it in black letters.\n") ;
  345. Xprintf("Banjo reaches for the nob and says the following:\n\n\"Sorry") ;
  346. Xprintf(" mate, your time has come!  Better luck next time!\"\n\n");
  347. Xprintf("He gives the chain a quick jerk and everything around you\n") ;
  348. Xprintf("slowly fades from view.\n\n") ;
  349. X    ender(F_quit) ;
  350. X}
  351. X
  352. Xkelly(loc[0]) ; /* check if Ned Kelly can do something */
  353. X/* Check if there is a long description */
  354. Xif ((!((room[R_hideout][M_monster] > 0) && (loc[0] == R_hideout))) &&
  355. X    (!((monster_flag == F_monster_active) && (loc[2] == loc[0])))) {
  356. X
  357. X    loc[2] = 0 ;
  358. X
  359. X/* Check if there is to be a long room description */
  360. Xif (room[loc[0]][M_rm_type] == T_long_descp) long_descp(loc[0]) ;
  361. Xelse {
  362. X    describe(loc[0]) ;  /* short description */
  363. X
  364. X    /* describe unmovable action objects and status */
  365. X    if (room[loc[0]][M_rm_type] == T_action_obj) actor(loc[0]) ;
  366. X}
  367. X
  368. Xobjlooker(loc[0]) ; /* Check if there are objects in the room */
  369. Xgleeper(loc[0]) ;   /* check for gleeps and update the gleep count */
  370. X
  371. X/* see if the spaceship's transporter is active */
  372. Xif (sw_transport) {
  373. X    if (loc[0] == R_ship_passage) sw_transport = FALSE ;
  374. X    else if (loc[0] == R_transport) {
  375. X        loc[0] = R_closet ;
  376. X        sw_transport = FALSE ;
  377. Xprintf("\nSuddenly radiant energy seems to surge from the hexagons\n");
  378. Xprintf("around you.  Then there is a bright flash and you find\n");
  379. Xprintf("yourself in.....\n\n") ;
  380. Xprintf("A closet stinking of moth balls full of nondescript junk.\n") ;
  381. Xprintf("The only exit is to the north through a curtain hanging\n");
  382. Xprintf("over the entrance.\n\n") ; 
  383. X    }
  384. X} /* end of the "transporter" block */
  385. X} /* end of long description check block */
  386. X
  387. Xfor(;;) {
  388. Xsw_loop = FALSE ;
  389. X
  390. X/* monster check */
  391. Xif ((room[loc[0]][M_monster] > 0)||(monster_flag != F_no_monster)) {
  392. X    if (monster_flag == F_wounded) monster_flag = F_monster_active ;
  393. X    else monster(loc) ;
  394. X} /* end of the monster check block */
  395. X
  396. X/* parse in the command */
  397. Xparse();
  398. X
  399. X/* poison check */
  400. X/* remove atropine drug with each game cycle */
  401. Xif (i_poison > 0) --i_poison ;
  402. Xelse {
  403. X    /* accumulate poison if holding the orange clip */
  404. X    if (object[O_org_clip][J_loc] == B_have) {
  405. X        --i_poison ;
  406. X        switch (i_poison) {
  407. X        case -20:
  408. X    printf("You've developed a nervous tick near your eye.\n") ;
  409. X            break ;
  410. X        case -30:
  411. X    printf("You're hands are starting to shake ") ;
  412. X    printf("and you're sweating like a pig.\n") ;    
  413. X            break ;
  414. X        case -35:
  415. X    printf("You're shaking so bad you can barely stand and you ");
  416. X    printf("could lose your lunch\nat any moment.\n") ;
  417. X            break ;
  418. X        case -40:
  419. Xprintf("The toxic fumes coming off of the orange ammo clip you were ") ;
  420. Xprintf("carrying finally\ncaught up with you.  You fall over DEAD!\n") ;
  421. X            ender(F_died) ;
  422. X        }
  423. X    }
  424. X    /* remove poison after release of orange clip */
  425. X    else if (i_poison < 0) ++i_poison ;
  426. X} /* end of the poison check block */
  427. X
  428. X/* clock check */
  429. Xif (sw_clock) {
  430. X    switch (flag_clock) {
  431. X    /* see if the blasting cap is to explode */
  432. X    case V_cap:
  433. X        if (time(time_arg) > clock_explode) {
  434. X            if (object[O_cap][J_loc] == B_have) {
  435. Xprintf("                           POP!!\n") ;
  436. Xprintf("The blasting cap which you were stupidly holding in your\n") ;
  437. Xprintf("hand just blew up and took two of your fingers with it!\n") ;
  438. Xprintf("Good thing you've got another eight fingers to spare!\n\n") ;
  439. X                carry_count-- ;
  440. X                carry_weight -= object[O_cap][J_weight];
  441. X            }
  442. X            else {
  443. Xprintf("Far down the tunnel you hear a POP!\n") ;
  444. Xprintf("The blasting cap has finally exploded, not that it\n");
  445. Xprintf("achieved much except make a loud noise.\n\n") ;
  446. X            }
  447. X            object[O_cap][J_loc] = B_destroyed ;
  448. X            sw_clock = FALSE ;
  449. X        }
  450. X        break ;
  451. X    
  452. X    /* see if the dynamite is to explode */
  453. X    case V_dynamite:
  454. X        if (time(time_arg) > clock_explode) {
  455. X            /* player dies if he is holding the dynamite */
  456. X            if (object[O_dynamite][J_loc] == B_have) {
  457. X            boom() ;
  458. X
  459. Xprintf("The dynamite which you were holding and had earlier ignited\n");
  460. Xprintf("the fuse has finally exploded.  That was a rather noisy\n");
  461. Xprintf("and messy way to commit suicide!  Needless to say there is\n");
  462. Xprintf("nothing left of you but a greasy spot.\n") ;
  463. X            ender(F_died) ;
  464. X            }
  465. X            /* player dies if too close during explosion */
  466. X            else {
  467. X                if (((loc[0] <= 185) && (loc[0] >= 178))
  468. X                  || ((loc[0] <= 170) && (loc[0] >= 166))) {
  469. X                    boom() ;
  470. X
  471. Xprintf("You weren't far enough away from the dynamite when it\n");
  472. Xprintf("exploded!  The shock wave was still strong enough to blow\n");
  473. Xprintf("your brains out your ears.  Next time try to get to the\n") ;
  474. Xprintf("upper level before the dynamite goes off.\n") ;
  475. X                    ender(F_died) ;
  476. X                }
  477. X
  478. X                /* dynamite explodes and player survives */
  479. X                else {
  480. Xprintf("Far down the tunnel you hear a low BOOM!\n") ;
  481. Xprintf("That dynamite you set burning has finally exploded.\n\n");
  482. X
  483. X/* open up the passage to the UFO */
  484. Xif (object[O_dynamite][J_loc] == R_blast_point) {
  485. X    room[R_blast_point][1] = 186 ;
  486. X    room[R_blast_point][M_descp] = 55 ;
  487. X                    }
  488. X                }
  489. X            }
  490. X            object[O_dynamite][J_loc] = B_destroyed ;
  491. X            sw_clock = FALSE ;
  492. X        } /* end of the dynamite explodes block */
  493. X        break ;
  494. X    }
  495. X} /* end of the clock block */
  496. X
  497. X/* the command is a simple move command */
  498. Xif (tag[V_MOVE]) {
  499. X    if (mover(verb,loc)) break ;
  500. X    continue ;
  501. X} /* end of the "move" block */
  502. X
  503. X/* complicated command decoder */
  504. Xswitch (verb) {
  505. X/* "help" command */
  506. Xcase V_help:
  507. Xcase V_info:
  508. Xprintf("There is no help available.  You're on your own!\n") ;
  509. X    break ;
  510. X/* "quit" command */
  511. Xcase V_quit:
  512. X    ender(F_quit) ;
  513. X
  514. X/* "question" command */
  515. Xcase V_QUESTION:
  516. X    if (tag[V_VERB_ONLY]) {
  517. X        if (tag[V_how]) {
  518. Xprintf("That's for you to figure out.\n") ;
  519. X            break ;
  520. X        }
  521. Xprintf("I don't have a clue!\n") ;
  522. X        break ;
  523. X    }
  524. X
  525. X    /* Question "Where am I?" */
  526. X    if (tag[V_where] && tag[V_am]) {
  527. X        tag[V_VERB_ONLY] = TRUE ; /* This is for "looker" */
  528. X        looker(loc[0]) ;
  529. X        break ;
  530. X    }
  531. X
  532. X    /* Question "What have I got?" */
  533. X    if (tag[V_what] && tag[V_have]) {
  534. X        inventer() ;
  535. X        break ;
  536. X    }
  537. X
  538. X    /* Question which can't be processed */
  539. Xprintf("You asked a question.  Unfortunately I have no answers.\n") ;
  540. X    break ;
  541. X
  542. X/* "inventory" command */
  543. Xcase V_inventory: 
  544. Xcase V_invent:
  545. X    inventer() ;
  546. X    break;
  547. X
  548. X/* "close" command  */
  549. Xcase V_close:
  550. Xcase V_shut:
  551. X    closer(loc[0]) ;
  552. X    break;
  553. X
  554. X/* "open" command  */
  555. Xcase V_open:
  556. Xcase V_swing:
  557. X    opener(loc[0]) ;
  558. X    break;
  559. X
  560. X/* "dial" command  */
  561. Xcase V_dial:
  562. Xcase V_combination:
  563. X    dialer(loc[0]) ;
  564. X    break ;
  565. X/* "drink" command */
  566. Xcase V_drink: 
  567. X    drinker() ;
  568. X    break ;
  569. X
  570. X/* "ignite" command */
  571. Xcase V_ignite: 
  572. Xcase V_light: 
  573. X    igniter(loc[0]) ;
  574. X    break ;
  575. X
  576. X/* "read" command  */
  577. Xcase V_read:
  578. X    reader(loc[0]) ;
  579. X    break;
  580. X/* "push" command  */
  581. Xcase V_push:
  582. Xcase V_press:
  583. X    pusher(&loc[0]) ; 
  584. X    break ;
  585. X/* "turn", "switch" command */
  586. Xcase V_switch:
  587. Xcase V_turn:
  588. Xcase V_select:
  589. Xcase V_set:
  590. X    switcher(loc[0]) ;
  591. X    break ;
  592. X/* "shoot" command  */
  593. Xcase V_shoot:
  594. Xcase V_fire:
  595. Xcase V_kill:
  596. X    killer(loc[0]) ;
  597. X    break;
  598. X/* "unlock" command  */
  599. Xcase V_unlock:
  600. X    unlocker(loc[0]) ;
  601. X    break;
  602. X/* "eat" command  */
  603. Xcase V_eat:
  604. Xcase V_swallow:
  605. X    eater() ;
  606. X    break;
  607. X/* "fill" command  */
  608. Xcase V_fill:
  609. X    filler() ;
  610. X    break;
  611. X/* "sound" command  */
  612. Xcase V_sound:
  613. Xcase V_bang:
  614. Xcase V_hit:
  615. Xcase V_strike:
  616. X    sounder(loc[0]) ;
  617. X    break;
  618. X
  619. X/* "SVC" wizard move command */
  620. Xcase V_svc:
  621. X    if (sw_wizard) {
  622. X        printf ("Enter room coordinate number:  ");
  623. X        scanf ("%d",&loc[0]);
  624. X        sw_loop = TRUE ;
  625. X        break ;
  626. X    }
  627. X    else cheater() ;
  628. X
  629. X/* "STATS" game statistics */
  630. Xcase V_stats :
  631. X        printf("      --- Dinkum --- \n");
  632. X        printf("Version: %s, %s\n\n", lb_version, lb_date);
  633. X        printf("i_rand1 = %d, i_rand2 = %d, i_rand3 = %d\n",
  634. X            i_rand1, i_rand2, i_rand3) ;
  635. X        printf("Room Number = %d\n", loc[0]) ;
  636. X        printf("Room object count = %d \n",
  637. X            room[loc[0]][M_obj_cnt]) ;
  638. X        printf("Room monster count = %d\n",
  639. X            room[loc[0]][M_monster]) ; 
  640. X        printf("Gleeps on room's floor count = %d\n",
  641. X            room[loc[0]][M_gleep]) ;
  642. X        printf("Poison level = %d\n",i_poison) ;
  643. X        printf("Gleep count = %d\n", gleep_count) ;
  644. X        printf("carry_count = %d, carry_weight = %d\n",
  645. X            carry_count, carry_weight) ;
  646. X        break ;
  647. X
  648. X/* "SU" wizard initiation command */
  649. Xcase V_su:
  650. X    pass() ;
  651. X    break ;
  652. X
  653. X/* "JSYS" wizard command which deactivates a monster */
  654. Xcase V_jsys:
  655. X    if (sw_wizard) monster_flag = F_no_monster ;
  656. X    else cheater() ;
  657. X    break ;
  658. X
  659. X/* "score" command */
  660. Xcase V_score: 
  661. X    new_score() ;
  662. X    if ((gleep_score == 0)&&(score == 0)) {
  663. Xprintf("You haven't scored anything at all, Bozo! Try putting\n");
  664. Xprintf("a valuable into the safe or find some gleeps.\n") ;
  665. X        break ;
  666. X    }
  667. X    if (score == 0) { 
  668. X        if (gleep_score > 1) {
  669. Xprintf("You haven't scored any points but you splashed ") ;
  670. Xprintf ("%d gleeps into the gleep tank.\n",gleep_score) ;
  671. X        }
  672. X        else {
  673. Xprintf("You haven't scored any points at all but you did put a\n");
  674. Xprintf ("gleep in the gleep tank (big deal!).\n") ;
  675. X        }
  676. X    }
  677. X    else {
  678. Xprintf ("You scored %d points ",score) ;
  679. X        if (gleep_score == 0) 
  680. Xprintf ("but have yet to put any gleeps in the gleep tank.\n") ;
  681. X        else {
  682. X            if (gleep_score > 1) 
  683. Xprintf ("and put %d gleeps into the gleep tank.\n",gleep_score) ;
  684. X    
  685. X            else 
  686. Xprintf ("and put a gleep in the gleep tank.\n") ;
  687. X        }
  688. X    }
  689. X    break ;
  690. X/* "enter" command  */
  691. Xcase V_enter:
  692. Xswitch (loc[0]) {
  693. X    /* Lift entrance at the ground level */
  694. X    case R_lift_entr:
  695. X        if (room[R_lift_entr][2] == R_wall) {
  696. Xprintf("I can't do it!  The lift door needs to be opened.\n") ;
  697. X            continue ;
  698. X        }
  699. X        pnt = V_east ;
  700. X        break ;
  701. X    /* office door */
  702. X    case R_office_entr:
  703. X        if (room[R_office_entr][2] == R_wall) {
  704. Xprintf("I can't go in!  The office door needs to be opened.\n") ;
  705. X            continue ;
  706. X        }
  707. X        pnt = V_east ;
  708. X        break ;
  709. X    /* Lift entrance at level #49 */
  710. X    case R_L49_entr:
  711. X        pnt = V_east ;
  712. X        break ;
  713. X    /* Entrance to Ned Kelly's hideout */
  714. X    case R_hideout_entr:
  715. X        pnt = V_east ;
  716. X        break ;
  717. X
  718. X    /* Enter gleep tank (and suicide) */
  719. X    case R_gleep_tank:
  720. X        if (tag[V_tank]) {
  721. Xprintf("\nYou climb up onto the edge of the gleep tank and dip your\n");
  722. Xprintf("foot into the dark blue fluid.  Suddenly the fluid begins a\n");
  723. Xprintf("furious boiling that instantly reduces your foot into\n") ;
  724. Xprintf("bleached white bones.  The shock and pain disturbs your\n");
  725. Xprintf("balance and you fall into the horrible stuff!!  There is\n");
  726. Xprintf("once again a furious boiling.  Eventually the fluid stills\n");
  727. Xprintf("and becomes clear again.  On the bottom of the tank can\n") ;
  728. Xprintf("be seen a white, clean, \"medical school quality\" human\n");
  729. Xprintf("skeleton.\n") ;
  730. X            ender(F_died) ;
  731. X        }
  732. X    default:
  733. X    printf("I don't understand exactly how to enter. \n");
  734. X        continue ;
  735. X} /* end of the "enter" switch block */
  736. Xif (mover(pnt,loc)) sw_loop = TRUE ;
  737. Xbreak ;
  738. X
  739. X/* "exit" command  */
  740. Xcase V_exit:
  741. Xcase V_leave:
  742. Xcase V_depart:
  743. Xswitch (loc[0]) {
  744. X    /* Lift entrance at the ground level */
  745. X    case R_lift_inside:
  746. X        pnt = V_west ;
  747. X        break ;
  748. X    /* office door */
  749. X    case R_office_hall:
  750. X        pnt = V_west ;
  751. X        break ;
  752. X    /* Ned Kelly's hideout */
  753. X    case R_hideout :
  754. X        pnt = V_west ;
  755. X        break ;
  756. X    default:
  757. Xprintf("I don't understand exactly how you want to exit.\n");
  758. X        continue ;
  759. X} /* end of the "depart" switch block */
  760. Xif (mover(pnt,loc)) sw_loop = TRUE ;
  761. Xbreak ;
  762. X
  763. X/* "dig" command */
  764. Xcase V_dig:
  765. Xprintf("You get on your knees and scrape away at the ground for\n") ;
  766. Xprintf("awhile. Except for getting your hands dirty you didn't\n") ;
  767. Xprintf("achieve much.\n") ;
  768. X    break ;
  769. X
  770. X/* "stand" command */
  771. Xcase V_stand:
  772. Xprintf("You're standing there very nicely.  However you're not\n");
  773. Xprintf("achieving much by doing so.\n") ;
  774. X    break ;
  775. X
  776. X/* "load" rifle command */
  777. Xcase V_load:
  778. X    loader() ;
  779. X    break ;
  780. X
  781. X/* "unload" rifle command */
  782. Xcase V_unload:
  783. X    unloader(loc[0]) ;
  784. X    break ;
  785. X
  786. X/* "pull" command */
  787. Xcase V_pull:
  788. X    if (tag[V_trigger]) {
  789. X        /* alias in the "shoot" command */
  790. X        verb = V_shoot ;
  791. X        tag[V_VERB_ONLY] = TRUE ;
  792. X        killer(loc[0]) ;   /* "pull trigger" */
  793. X    }
  794. X    else  printf("I don't see how I could pull that.\n") ;
  795. X    break ;
  796. X
  797. X/* "climb" command */
  798. Xcase V_climb:
  799. Xprintf("I'm not climbing anything!  (I'm afraid of heights.)\n") ;
  800. X    break ;
  801. X
  802. X/* "swim" command */
  803. Xcase V_swim:
  804. Xprintf("I'm not going for a swim!  (I'm afraid of the water.)\n") ;
  805. X    break ;
  806. X
  807. X/* Go backwards to previous location */
  808. Xcase V_back:
  809. X    loc[0] = loc[1] ;
  810. X    sw_loop = TRUE ;
  811. X    break ;
  812. X/* "take", "get", "lift" command */
  813. Xcase V_take:
  814. Xcase V_get:
  815. Xcase V_lift:
  816. Xcase V_pick:
  817. Xcase V_grab:
  818. Xcase V_remove:
  819. Xcase V_attach:
  820. Xcase V_hold:
  821. X    taker(loc[0]) ;
  822. X    break ;
  823. X/* "drop", "throw", "put" command */
  824. Xcase V_drop:
  825. Xcase V_throw:
  826. Xcase V_put:
  827. Xcase V_fling:
  828. Xcase V_insert:
  829. Xcase V_give:
  830. Xcase V_eject:
  831. Xcase V_slow_drop:
  832. X    dropper(loc[0]) ;
  833. X    break ;
  834. X
  835. X/* "look" command */
  836. Xcase V_look:
  837. Xcase V_l:
  838. Xcase V_examine:
  839. Xcase V_describe:
  840. X    looker(loc[0]) ;
  841. X    break;
  842. X
  843. X/* gibberish command */
  844. Xdefault:
  845. Xprintf("Huh?  You will have to make yourself clearer! \n");
  846. X
  847. X} /* end of "decoder" switch */
  848. Xif (sw_loop) break ;
  849. X} /* end of the inner infinite "for" loop */
  850. X} /* end of the outer infinite "for" loop */
  851. X
  852. X} /* --- end of Main routine --- */
  853. X
  854. Xvoid cmd_switch(cmd, cmd_arg, i_point, argv)
  855. X/*****************************************************/
  856. X/*                                                   */
  857. X/*         --- Command line Switch Parser ---        */
  858. X/*                                                   */
  859. X/*  (c) Copyright 1992,   University of Queensland   */
  860. X/*        Program written by Gary A. Allen, Jr.      */
  861. X/*           Version:  Mk 1.1   24 February 1992     */
  862. X/*                                                   */
  863. X/*****************************************************/
  864. X
  865. Xchar cmd[8], *argv[] ;
  866. Xint cmd_arg, i_point ;
  867. X{
  868. X
  869. X#if (PROTOTYPE)
  870. Xvoid bugs(int)  ;
  871. X#endif
  872. X
  873. Xswitch (cmd[cmd_arg]) {
  874. Xcase '\0':
  875. Xcase -1:
  876. X    sw_null = TRUE ;
  877. X    return ;
  878. X
  879. X/* Activate save script capability */
  880. Xcase 's':
  881. Xcase 'S':
  882. X    sw_script = TRUE ;
  883. X    break ;
  884. X
  885. X/* Version verification command switch */
  886. Xcase 'v':
  887. X    if ((cmd[cmd_arg+1] == 'e')&&(cmd[cmd_arg+2] == 'r')) {
  888. X        printf("Version: %s, Serial Number: %06d %s \n", 
  889. X            lb_version, serial, lb_share) ;
  890. X        bugs(Request) ;
  891. X    }
  892. X    else {
  893. X        printf("!!!! Command line switch -v is unknown.\n") ;
  894. X        bugs(Failed) ;
  895. X    }
  896. X
  897. X/* Wizard mode command switch */
  898. Xcase 'w':
  899. Xcase 'W':
  900. X    pass() ;
  901. X    break ;
  902. X
  903. X/* Standard matrix load command switch */
  904. Xcase 'x':
  905. Xcase 'X':
  906. X    sw_standard = TRUE ;
  907. X    break ;
  908. X
  909. X/* Rubbish option to supress a warning */
  910. Xcase 'y':
  911. Xcase 'Y':
  912. X    sw_number = TRUE ;
  913. X    printf("y = %d\n", atoi(argv[i_point+1])) ;
  914. X    return ;
  915. X
  916. X/* Help option */
  917. Xcase '?':
  918. Xcase 'h':
  919. Xcase 'H':
  920. X    sw_help = TRUE ;
  921. X    return ;
  922. X
  923. Xcase ' ':
  924. Xcase '-':
  925. Xcase '1':
  926. Xcase '2':
  927. Xcase '3':
  928. Xcase '4':
  929. Xcase '5':
  930. Xcase '6':
  931. Xcase '7':
  932. Xcase '8':
  933. Xcase '9':
  934. X    return ;
  935. X
  936. Xdefault:
  937. Xprintf("!!!! Command line switch -%c is unknown.\n", cmd[cmd_arg]) ;
  938. X    bugs(Failed) ;
  939. X}
  940. X} /* --- end of the cmd_switch subroutine --- */
  941. X
  942. Xvoid bugs(i_type)
  943. X/***************************************************************/
  944. X/*                                                             */
  945. X/*       (c) Copyright 1992,   University of Queensland        */
  946. X/*            Program written by Gary A. Allen, Jr.            */
  947. X/*             Version:  Mk 1.0        24 April 1992           */
  948. X/*                                                             */
  949. X/***************************************************************/
  950. Xint i_type ;
  951. X{
  952. Xswitch(i_type) {
  953. Xcase Failed:
  954. X    printf("!!!! If confused, type:  dinkum -h \n");
  955. X    printf("!!!! --- Program ABORTED --- \n");
  956. X    break ;
  957. X
  958. Xcase Request:
  959. X    printf("Program terminated by user request.\n") ;
  960. X    break ;
  961. X}
  962. Xexit (0) ; 
  963. X} /* --- end of the "bugs" subroutine --- */
  964. X
  965. Xvoid help() 
  966. X/*****************************************************/
  967. X/*                                                   */
  968. X/*                    Help Routine                   */
  969. X/*                                                   */
  970. X/*  (c) Copyright 1992,   University of Queensland   */
  971. X/*        Program written by Gary A. Allen, Jr.      */
  972. X/*           Version:  Mk 1.0    24 April 1992       */
  973. X/*                                                   */
  974. X/*****************************************************/
  975. X{
  976. Xchar chr ;
  977. X
  978. Xprintf("                    --- Dinkum --- \n");
  979. Xprintf("       (c) Copyright 1993 by Gary A. Allen, Jr.\n") ;
  980. Xprintf("   All Rights Reserved. Version: %s, %s\n\n", 
  981. X        lb_version, lb_date);
  982. X
  983. Xprintf("      Dinkum is a text style \"adventure\" game.\n\n") ;
  984. X
  985. Xprintf("You are free to use, copy and distribute Dinkum provided:\n") ;
  986. Xprintf("       NO FEE IS CHARGED FOR USE, COPYING OR DISTRIBUTION.\n") ;
  987. Xprintf("       THIS PROGRAM IS FOR PRIVATE, NONCOMMERICAL USE ONLY.\n");
  988. Xprintf("       THE PROGRAM MAY NOT BE MODIFIED IN ANY WAY.\n\n") ;
  989. X
  990. Xprintf("This program is provided AS IS without any warranty,\n") ;
  991. Xprintf("expressed or implied, including but not limited to fitness\n") ;
  992. Xprintf("for any particular purpose.\n\n") ;
  993. X
  994. X/* keep the screen from scrolling */
  995. X#ifndef __TURBOC__
  996. Xprintf("         [Press RETURN or ENTER to continue]") ;
  997. Xchr = getchar() ;
  998. X#endif
  999. X
  1000. X#ifdef __TURBOC__
  1001. Xprintf("  [Press \"q\" to quit or any other key to continue]") ;
  1002. Xchr = getche() ;
  1003. Xprintf("\r                                                        \r") ;
  1004. X#endif
  1005. X
  1006. Xif ((chr == 'q')||(chr == 'Q')) exit (0) ;
  1007. X
  1008. Xprintf("If you start the game by typing \"dinkum -s\" rather than \n");
  1009. Xprintf("simply \"dinkum\" then the game creates a \"data recorder\" \n"); 
  1010. Xprintf("which appears in the beginning  of  the game.  The data \n"); 
  1011. Xprintf("recorder acts like a tape recorder allowing the user to \n"); 
  1012. Xprintf("save moves and play them back in the current  or  later \n"); 
  1013. Xprintf("games.  The generated file is in ASCII format  and  can \n"); 
  1014. Xprintf("be  edited  after  finishing  Dinkum.    Type  \"examine \n"); 
  1015. Xprintf("recorder\" after having taken it and Dinkum will explain \n"); 
  1016. Xprintf("how to use it.  This data  recorder  has  a  couple  of \n"); 
  1017. Xprintf("important  limitations:   Unlike  most adventure games, \n"); 
  1018. Xprintf("Dinkum is  dynamic,  viz.  the  game changes every time \n"); 
  1019. Xprintf("you play it.  So if you record  a  script  for  a  game \n"); 
  1020. Xprintf("which takes you to a room where you find a  weapon  and \n"); 
  1021. Xprintf("then to another room where you find a monster, then the \n"); 
  1022. Xprintf("next time you use  that script you may find the monster \n"); 
  1023. Xprintf("where you  previously  found  the  weapon (leading to a \n"); 
  1024. Xprintf("fairly short game). The other limitation  of  the  data \n"); 
  1025. Xprintf("recorder is if you use the \"dinkum -s\" switch then  you \n"); 
  1026. Xprintf("will  not  be  admitted  into  the  end  game  with the \n"); 
  1027. Xprintf("consequence being that  \"winning\" Dinkum is impossible. \n"); 
  1028. Xprintf("To win Dinkum you must  play  it  \"on your own\" without \n"); 
  1029. Xprintf("the unfair advantage of script files and data recorders.\n\n");
  1030. X
  1031. X/* keep the screen from scrolling */
  1032. X#ifndef __TURBOC__
  1033. Xprintf("         [Press RETURN or ENTER to continue]") ;
  1034. Xchr = getchar() ;
  1035. X#endif
  1036. X
  1037. X#ifdef __TURBOC__
  1038. Xprintf("  [Press \"q\" to quit or any other key to continue]") ;
  1039. Xchr = getche() ;
  1040. Xprintf("\r                                                        \r") ;
  1041. X#endif
  1042. X
  1043. Xif ((chr == 'q')||(chr == 'Q')) exit (0) ;
  1044. X
  1045. Xprintf("When corresponding please state the current version of\n") ;
  1046. Xprintf("Dinkum which you are using.  Contributions and questions\n") ;
  1047. Xprintf("about this program should be sent to the following address:\n\n") ;
  1048. Xprintf("          E-mail address:     gary@sun.mech.uq.oz.au\n\n") ;
  1049. Xprintf("          Postal address:     Gary A. Allen, Jr. \n");
  1050. Xprintf("                              P.O. Box 13\n") ;       
  1051. Xprintf("                              St. Lucia, Queensland  4067\n");
  1052. Xprintf("                              Australia\n") ;
  1053. X
  1054. Xexit(0);
  1055. X} /* ---- end of the "help" subroutine ---- */
  1056. X
  1057. Xvoid cheater() 
  1058. X/*****************************************************/
  1059. X/*                                                   */
  1060. X/*  (c) Copyright 1992,   University of Queensland   */
  1061. X/*        Program written by Gary A. Allen, Jr.      */
  1062. X/*           Version:  Mk 1.0   9 December 1992      */
  1063. X/*                                                   */
  1064. X/*****************************************************/
  1065. X{
  1066. Xprintf("Rather than cheat at this game by using a disassembler, you\n");
  1067. Xprintf("should send the author $150 and he'll gladly send you\n") ;
  1068. Xprintf("the source code.  If you just want a clue, then send $20\n") ;
  1069. Xprintf("with your question and he'll provide the answer.  You can find\n") ;
  1070. Xprintf("the author's address by typing:  dinkum -h\n") ;
  1071. X        exit(0) ;
  1072. X} /* ---- end of the "cheater" subroutine ---- */
  1073. X
  1074. Xint mover(direction,loc)
  1075. X/*****************************************************/
  1076. X/*                                                   */
  1077. X/*  (c) Copyright 1992,   University of Queensland   */
  1078. X/*        Program written by Gary A. Allen, Jr.      */
  1079. X/*           Version:  Mk 1.0  17 December 1992      */
  1080. X/*                                                   */
  1081. X/*****************************************************/
  1082. Xint direction, loc[3] ;
  1083. X{
  1084. X
  1085. X#if (PROTOTYPE)
  1086. X/* Function prototypes */
  1087. Xvoid long_descp(int), ender(int), boom(void) ;
  1088. X#endif
  1089. X
  1090. X/* see if this movement prohibits blasting caps */
  1091. Xif (((direction == V_u)||(direction == V_up)) &&
  1092. X        ((loc[0] == R_manhole_1)||(loc[0] == R_manhole_2))) {
  1093. X
  1094. X    if (object[O_cap][J_loc] == B_have) {
  1095. Xprintf("As you were climbing up through the hole in the ceiling,\n");
  1096. Xprintf("the blasting cap slipped from your grasp and fell to the\n") ;
  1097. Xprintf("floor below where it detonated on impact.  The explosion\n") ;
  1098. Xprintf("was deafening, but caused no damage.\n") ;
  1099. X        carry_count-- ;
  1100. X        carry_weight -= object[O_cap][J_weight] ;
  1101. X        object[O_cap][J_loc] = B_destroyed; 
  1102. X    }
  1103. X    else {
  1104. X        if ((object[O_dynamite][J_loc] == B_have)&&
  1105. X            (object[O_dynamite][J_type] == Z_alias)) {
  1106. X            boom() ;
  1107. X
  1108. Xprintf("As you were climbing up through the hole in the ceiling,\n");
  1109. Xprintf("the dynamite with the blasting cap inside slipped from\n") ;
  1110. Xprintf("your grasp and fell to the floor below where it detonated\n") ;
  1111. Xprintf("on impact.  At that point you literally became a human\n");
  1112. Xprintf("cannon ball as the shock wave carried you up the vertical\n");
  1113. Xprintf("passage and splattered you into protoplasmic jelly on the\n");
  1114. Xprintf("ceiling above.\n") ; 
  1115. X            ender(F_died) ;
  1116. X        }
  1117. X    }
  1118. X} /* end of the cap/manhole block */
  1119. X
  1120. Xdirection-- ;
  1121. Xif (room[loc[0]][direction] == R_wall) {
  1122. X    printf("You can't go that way. \n");
  1123. X    return(FALSE) ;
  1124. X}
  1125. X
  1126. X/* save previous location */
  1127. Xloc[1] = loc[0] ;
  1128. Xloc[0] = room[loc[0]][direction] ;
  1129. X
  1130. X/* See if player walked into a lethal room */
  1131. Xif (room[loc[0]][M_rm_type] == T_lethal) {
  1132. X    long_descp(loc[0]) ;
  1133. X    ender(F_died) ;
  1134. X}
  1135. Xreturn(TRUE) ;
  1136. X} /* --- end of the "mover" function --- */
  1137. END_OF_FILE
  1138. if test 32399 -ne `wc -c <'dinkum.c'`; then
  1139.     echo shar: \"'dinkum.c'\" unpacked with wrong size!
  1140. fi
  1141. # end of 'dinkum.c'
  1142. fi
  1143. if test -f 'pusher.c' -a "${1}" != "-c" ; then 
  1144.   echo shar: Will not clobber existing file \"'pusher.c'\"
  1145. else
  1146. echo shar: Extracting \"'pusher.c'\" \(18897 characters\)
  1147. sed "s/^X//" >'pusher.c' <<'END_OF_FILE'
  1148. X#define PUSHER
  1149. X#include "dink_sym.h"
  1150. X#include "dink_glb.h"
  1151. X
  1152. Xvoid pusher(n_arg) 
  1153. X/********************************************************************/
  1154. X/*                                                                  */
  1155. X/*                  --- The Pusher Subroutine ---                   */
  1156. X/*                                                                  */
  1157. X/*  Software by Gary A. Allen, Jr. 14 June 1989,    Version: Mk 1.2 */
  1158. X/*           (c) Copyright 1988 by Gary A. Allen, Jr.               */
  1159. X/*                                                                  */
  1160. X/********************************************************************/
  1161. Xint *n_arg ;
  1162. X{
  1163. Xregister int i ;
  1164. Xint n ;
  1165. Xchar file_name[80] ;
  1166. X
  1167. X#if (PROTOTYPE)
  1168. Xvoid which_button(void) ; 
  1169. Xvoid lift_moves(void) ; 
  1170. Xvoid nothing_happens(void) ; 
  1171. Xvoid cubic(void) ; 
  1172. Xvoid no_gray(void) ; 
  1173. Xvoid no_switch(void) ; 
  1174. Xvoid no_cube(void) ; 
  1175. X#endif
  1176. X/* pass the room pointer */
  1177. Xn = *n_arg ;
  1178. X
  1179. X/* reject an isolated "push" command */
  1180. Xif (tag[V_VERB_ONLY]) {
  1181. X    printf ("What exactly do you want me to push? \n");
  1182. X    return; 
  1183. X}
  1184. X
  1185. X/* Deal with the recorder */
  1186. Xif ((tag[V_red_button] || tag[V_white_button] || tag[V_green_button])) {
  1187. X    if (sw_script) {
  1188. X    if (object[O_recorder][J_loc] == B_have) {
  1189. X        if (tag[V_red_button]) {
  1190. X            if (sw_recording || sw_playing) {
  1191. X                if (sw_recording) {
  1192. X                    sw_recording = FALSE;
  1193. Xprintf("--- The data recorder has stopped recording. ---\n") ;
  1194. X                }
  1195. X                else sw_playing = FALSE;
  1196. X                fclose(fp) ;
  1197. X            }
  1198. X            else printf("Nothing happened!\n") ;
  1199. X            return ;
  1200. X        }
  1201. X        if (tag[V_white_button]) {
  1202. X            printf("Type in the file name for reading from:  ") ;
  1203. X            scanf("%s",file_name) ;
  1204. X            if ((fp = fopen(file_name,"r")) == 0) {
  1205. Xprintf("I could not open the file:  %s \n",file_name);
  1206. Xprintf("This file probably doesn't exit.\n") ;
  1207. Xprintf("Try pressing the white button again and using a different name.\n") ;
  1208. X            }
  1209. X            else sw_playing = TRUE ;
  1210. X            return ;
  1211. X        }
  1212. X        if (tag[V_green_button]) {
  1213. X            printf("Type in the file name for writing to:  ") ;
  1214. X            scanf("%s",file_name) ;
  1215. X            if ((fp = fopen(file_name,"w")) == 0) {
  1216. Xprintf ("I could not open the file:  %s \n",file_name);
  1217. Xprintf("Try pressing the green button again and using a different name.\n") ;
  1218. X            }
  1219. X            else {
  1220. X                sw_recording = TRUE ;
  1221. X                printf("--- Recording ---\n") ;
  1222. X            }
  1223. X            return ;
  1224. X        }
  1225. X    }
  1226. X    else printf("You don't have the recorder in your possession!\n") ;
  1227. X    }
  1228. X    else printf("I have never seen a button of that color.\n") ;
  1229. X    return ;
  1230. X}
  1231. X
  1232. Xswitch (n) {
  1233. X/* Lift entrance at the ground level */
  1234. Xcase R_lift_entr:
  1235. X    if (tag[V_gray_button]) {
  1236. X        no_gray() ;
  1237. X        return ;
  1238. X    }
  1239. X    if (!tag[V_button]) {
  1240. X        if (!tag[V_blue_button]) {
  1241. X            printf ("I don't see why I should push that! \n");
  1242. X        }
  1243. X        else nothing_happens() ;
  1244. X        return ;
  1245. X    }
  1246. X    if (room[R_lift_entr][M_rm_status] == S_flashing ) {
  1247. Xprintf ("You push the call button and there is a loud \"whirr\" from ");
  1248. Xprintf ("an electric motor. \nThe massive steel doors slide open ");
  1249. Xprintf ("revealing a huge lift that could hold \ntwenty men at once. ");
  1250. Xprintf ("The way is now open for you to enter. \n");
  1251. X        room[R_lift_entr][M_rm_status] = S_open ;
  1252. X        room[R_lift_entr][2] = R_lift_inside ;
  1253. X        break ;
  1254. X    }
  1255. X    else {
  1256. X        if (room[R_lift_entr][M_rm_status] == S_open) {
  1257. Xprintf ("You push the call button and there is a loud \"whirr\" from ");
  1258. Xprintf ("an electric motor. \nThe massive steel doors slide shut, ");
  1259. Xprintf ("closing off access to the lift.\n");
  1260. X            room[R_lift_entr][M_rm_status] = S_flashing ;
  1261. X            room[R_lift_entr][2] = R_wall ;
  1262. X            break ;
  1263. X        }
  1264. X        else {
  1265. Xprintf("You pushed the lift call button, but nothing happened.\n");
  1266. Xprintf("I think the electrical power has been turned off at the\n") ;
  1267. Xprintf("circuit breaker.\n") ;
  1268. X        break ;
  1269. X        }
  1270. X    }
  1271. X/* Lift Compartment */
  1272. Xcase R_lift_inside:
  1273. X    if (tag[V_gray_button]) {
  1274. X        no_gray() ;
  1275. X        return ;
  1276. X    }
  1277. X    /* scan push sentence */
  1278. X    /* zero level */
  1279. X    if (tag[V_0]) {
  1280. X        if (room[R_lift_inside][M_rm_status]== S_L0) {
  1281. Xprintf ("You pushed the flashing button, but nothing happened.\n");
  1282. X            break ;
  1283. X        }
  1284. Xprintf ("The steel doors slam shut and you feel heavy as the lift ");
  1285. Xprintf ("accelerates \nupwards.  Finally the lift jerks to a halt ");
  1286. Xprintf ("and the doors whirr open.  \nSunlight is streaming in. ");
  1287. Xprintf ("Once again you are breathing the fresh air.\n");
  1288. X        room[R_lift_inside][M_rm_status] = S_L0;
  1289. X        room[R_lift_inside][3] = R_lift_entr;
  1290. X        room[R_lift_inside][7] = R_lift_entr;
  1291. X        return ;
  1292. X    }
  1293. X    /* forty-ninth level */
  1294. X    if (tag[V_49]) {
  1295. X        if (room[R_lift_inside][M_rm_status]== S_L49) {
  1296. Xprintf ("You pushed the forty-nine button, but nothing happened.\n");
  1297. X            return ;
  1298. X        }    
  1299. X        room[R_lift_inside][M_rm_status] = S_L49 ;
  1300. X        room[R_lift_inside][3] = R_L49_entr;
  1301. X        room[R_lift_inside][7] = R_L49_entr;
  1302. X        lift_moves() ;
  1303. X        return ;
  1304. X    }
  1305. X    /* sixty-seventh level */
  1306. X    if (tag[V_67]) {
  1307. X        if (room[R_lift_inside][M_rm_status]== S_L67) {
  1308. Xprintf ("You pushed the sixty-seven button, but nothing happened.\n");
  1309. X            return ;
  1310. X        }    
  1311. X        room[R_lift_inside][M_rm_status] = S_L67;
  1312. X        room[R_lift_inside][3] = R_L67_entr;
  1313. X        room[R_lift_inside][7] = R_L67_entr;
  1314. X        lift_moves() ;
  1315. X        return ;
  1316. X    }
  1317. X
  1318. X    /* eighty-second level */
  1319. X    if (tag[V_82]) {
  1320. X        if (room[R_lift_inside][M_rm_status]== S_L82) {
  1321. Xprintf ("You pushed the eighty-two button, but nothing happened.\n");
  1322. X            return ;
  1323. X        }    
  1324. X        room[R_lift_inside][M_rm_status] = S_L82;
  1325. X        room[R_lift_inside][3] = R_L82_entr;
  1326. X        room[R_lift_inside][7] = R_L82_entr;
  1327. Xprintf ("The steel doors slam shut and you feel a sense of ");
  1328. Xprintf ("weightlessness as \nthe lift plummets down the mine shaft. ");
  1329. Xprintf ("Finally the lift comes to a halt \n");
  1330. Xprintf ("and the doors whirr open. \n");
  1331. X        return ;
  1332. X    }
  1333. X    if (tag[V_blue_button]) {
  1334. X        nothing_happens() ;
  1335. X        return ;
  1336. X    }
  1337. Xprintf ("This lift can go only to levels 0, 49, 67, or 82 \n");
  1338. X    return ;
  1339. X
  1340. X/* inside the closet at the Iranian Parliament */
  1341. Xcase R_closet:
  1342. X    if (tag[V_gray_button]) {
  1343. X        no_gray() ;
  1344. X        return ;
  1345. X    }
  1346. X    if (tag[V_blue_button] || tag[V_button]) {
  1347. X        /* Is the command for the black cube */
  1348. X        if (object[O_cube][J_loc] != B_have) {
  1349. X            no_switch() ;
  1350. X        }
  1351. Xprintf("There is a bright flash of light! Then suddenly you are\n");
  1352. Xprintf("back in the hexagon chamber of the ancient spaceship.\n\n");
  1353. X        *n_arg = R_transport ;
  1354. X    }
  1355. X    else no_switch() ;
  1356. X    return ;
  1357. X
  1358. X/* the transporter control panel room */
  1359. Xcase R_panel:
  1360. X    if (tag[V_button]) {
  1361. X        which_button() ;
  1362. X        return;
  1363. X    }
  1364. X    if (tag[V_blue_button]) {
  1365. X        if (object[O_cube][J_loc]==B_have) cubic() ;
  1366. X        else no_cube() ;
  1367. X        return ;
  1368. X    }
  1369. X    if (tag[V_gray_button]) {
  1370. X        if (sw_transport != TRUE) {
  1371. Xprintf("Lots of the \"Sanskrit\" text is flashing by on the display\n");
  1372. Xprintf("panel's CRTs.  There is a whirring noise coming out of the\n");
  1373. Xprintf("equipment around you which is increasing in both loudness\n");
  1374. Xprintf("and pitch. You've turned something on, that's for sure!\n") ;
  1375. X            sw_transport = TRUE ;
  1376. X        }
  1377. X        else nothing_happens() ;
  1378. X        return ;
  1379. X    }
  1380. Xdefault:
  1381. X    /* Semtex explosive detector */
  1382. X    if (tag[V_detector] || tag[V_yellow_button] ||
  1383. X        ((object[O_cube][J_loc] != B_have) &&
  1384. X        (object[O_detector][J_loc] == B_have))) { 
  1385. X            if (object[O_detector][J_loc] == B_have) {
  1386. X                /* press Semtex detector button */
  1387. Xprintf("You press the button on the Semtex explosive detector and\n");
  1388. X                for (i = 0; i <= 9; i++) {
  1389. X                    if ((n == i+207)||(n == i+228)) {
  1390. Xif (room[227-i][M_rm_type] == T_lethal) {
  1391. X    printf("hear a \"beep, beep, beep\".\n") ;
  1392. X    return ;
  1393. X}
  1394. X                    }
  1395. X                }
  1396. X                printf("the yellow light flashed.\n") ;
  1397. X            }
  1398. X            else {
  1399. Xprintf("You don't have the detector in your possession.\n") ;
  1400. X            }
  1401. X            return ;
  1402. X        }
  1403. X        /* Transporter return device */
  1404. X        if (object[O_cube][J_loc] == B_have) {
  1405. X            if ((object[O_detector][J_loc] == B_have) && 
  1406. X                (!tag[V_blue_button])) {
  1407. X                    which_button() ;
  1408. X                    return;
  1409. X            }
  1410. X            cubic() ;
  1411. X            return ;
  1412. X        }
  1413. X        if (tag[V_blue_button]) {
  1414. X            no_cube() ;
  1415. X            return ;
  1416. X        }
  1417. X        if (tag[V_gray_button]) {
  1418. X            no_gray() ;
  1419. X            return ;
  1420. X        }
  1421. X
  1422. Xprintf ("You can push as much as you like, but nothing will happen.\n");
  1423. X} /* end of the switch block */
  1424. Xreturn; 
  1425. X
  1426. X} /* --- end of the "pusher" subroutine --- */
  1427. X
  1428. Xvoid which_button() 
  1429. X/********************************************************************/
  1430. X/*                                                                  */
  1431. X/*  Software by Gary A. Allen, Jr. 8 December 1992  Version: Mk 1.0 */
  1432. X/*           (c) Copyright 1992 by Gary A. Allen, Jr.               */
  1433. X/*                                                                  */
  1434. X/********************************************************************/
  1435. X{
  1436. Xprintf("Which button do you want me to push? \n") ;
  1437. Xreturn; 
  1438. X} /* --- end of the "which_button" subroutine --- */
  1439. X
  1440. Xvoid lift_moves() 
  1441. X/********************************************************************/
  1442. X/*                                                                  */
  1443. X/*  Software by Gary A. Allen, Jr. 8 December 1992  Version: Mk 1.0 */
  1444. X/*           (c) Copyright 1992 by Gary A. Allen, Jr.               */
  1445. X/*                                                                  */
  1446. X/********************************************************************/
  1447. X{
  1448. Xprintf ("The steel doors slam shut and you feel the vibration of ");
  1449. Xprintf ("the lift \nmoving in its shaft. Finally the lift jerks ");
  1450. Xprintf ("to a halt and the doors whirr open. \n");
  1451. Xreturn; 
  1452. X} /* --- end of the "lift_moves" subroutine --- */
  1453. X
  1454. Xvoid nothing_happens() 
  1455. X/********************************************************************/
  1456. X/*                                                                  */
  1457. X/*  Software by Gary A. Allen, Jr. 8 December 1992  Version: Mk 1.0 */
  1458. X/*           (c) Copyright 1992 by Gary A. Allen, Jr.               */
  1459. X/*                                                                  */
  1460. X/********************************************************************/
  1461. X{
  1462. Xprintf("Nothing happens!\n");
  1463. Xreturn; 
  1464. X} /* --- end of the "nothing_happens" subroutine --- */
  1465. Xvoid cubic() 
  1466. X/********************************************************************/
  1467. X/*                                                                  */
  1468. X/*              Press cube button in wrong place.                   */
  1469. X/*                                                                  */
  1470. X/*  Software by Gary A. Allen, Jr. 8 December 1992  Version: Mk 1.0 */
  1471. X/*           (c) Copyright 1992 by Gary A. Allen, Jr.               */
  1472. X/*                                                                  */
  1473. X/********************************************************************/
  1474. X{
  1475. Xprintf("You press the button on the cube but nothing happens.\n");
  1476. Xreturn; 
  1477. X} /* --- end of the "cubic" subroutine --- */
  1478. Xvoid no_gray() 
  1479. X/********************************************************************/
  1480. X/*                                                                  */
  1481. X/*  Software by Gary A. Allen, Jr. 8 December 1992  Version: Mk 1.0 */
  1482. X/*           (c) Copyright 1992 by Gary A. Allen, Jr.               */
  1483. X/*                                                                  */
  1484. X/********************************************************************/
  1485. X{
  1486. Xprintf("I see no gray button to push!\n");
  1487. Xreturn; 
  1488. X} /* --- end of the "no_gray" subroutine --- */
  1489. Xvoid no_switch() 
  1490. X/********************************************************************/
  1491. X/*                                                                  */
  1492. X/*  Software by Gary A. Allen, Jr. 8 December 1992  Version: Mk 1.0 */
  1493. X/*           (c) Copyright 1992 by Gary A. Allen, Jr.               */
  1494. X/*                                                                  */
  1495. X/********************************************************************/
  1496. X{
  1497. Xprintf("There is nothing here with a push button switch.\n");
  1498. Xreturn; 
  1499. X} /* --- end of the "no_switch" subroutine --- */
  1500. Xvoid no_cube() 
  1501. X/********************************************************************/
  1502. X/*                                                                  */
  1503. X/*  Software by Gary A. Allen, Jr. 8 December 1992  Version: Mk 1.0 */
  1504. X/*           (c) Copyright 1992 by Gary A. Allen, Jr.               */
  1505. X/*                                                                  */
  1506. X/********************************************************************/
  1507. X{
  1508. Xprintf("You don't have the black cube with the blue button in your") ;
  1509. Xprintf(" possession!\n") ;
  1510. Xreturn; 
  1511. X} /* --- end of the "no_cube" subroutine --- */
  1512. Xvoid switcher(n) 
  1513. X/********************************************************************/
  1514. X/*                                                                  */
  1515. X/*                --- The Switcher Subroutine ---                   */
  1516. X/*                                                                  */
  1517. X/*                                                                  */
  1518. X/*  Software by Gary A. Allen, Jr. 29 October 1989  Version: Mk 1.4 */
  1519. X/*           (c) Copyright 1988 by Gary A. Allen, Jr.               */
  1520. X/*                                                                  */
  1521. X/********************************************************************/
  1522. Xint n ;
  1523. X{
  1524. Xint flag_switch, flag_rifle_md ;
  1525. X
  1526. X#if (PROTOTYPE)
  1527. Xvoid dialer(int) ;
  1528. X#endif
  1529. X
  1530. X/* deal with single verb commands */
  1531. Xif (tag[V_VERB_ONLY]) {
  1532. X    if (tag[V_turn]) printf("Turn what?\n") ;
  1533. X    if (tag[V_set]) printf("Set what?\n") ;
  1534. X    if (tag[V_select]) printf("Select what?\n") ;
  1535. X    if (tag[V_switch]) printf("Switch what?\n") ;
  1536. X    return ;
  1537. X}
  1538. X
  1539. X/* Deal with changing the safety on the rifle */
  1540. Xif (tag[V_safety]) {
  1541. X    if (object[O_rifle][J_loc] == B_have) {
  1542. X        if (tag[V_off]) {
  1543. X            rifle_flag = F_single ;
  1544. Xprintf("The M16 rifle is set to single shot mode ") ;
  1545. Xprintf("with the safey off.\n") ;
  1546. X            return ;
  1547. X        }
  1548. X        if (tag[V_on]) {
  1549. X            rifle_flag = F_safety ;
  1550. Xprintf("The M16 rifle's safety has been turned on.\n") ;
  1551. X            return ;
  1552. X        }
  1553. X    printf("How do you want the safety set?\n") ;
  1554. X    }
  1555. X    else printf("You're not holding the rifle!\n") ;
  1556. X    return ;
  1557. X}
  1558. X
  1559. X/* deal with special case "turn (safe) dial 0 49 67 82" */
  1560. Xif (tag[V_turn] && tag[V_dial] && (!tag[V_rifle])) {
  1561. X    dialer(n) ;
  1562. X    return ;
  1563. X}
  1564. X
  1565. X/* deal with special case "turn safe ..." */
  1566. Xif (tag[V_turn] && (!tag[V_dial]) && tag[V_safe]) {
  1567. X    if (n != R_office_mang) {
  1568. Xprintf("There is no safe here to turn!\n") ;
  1569. X        return  ;
  1570. X    }
  1571. Xprintf("Since the safe is set in a concrete wall, turning it would\n");
  1572. Xprintf("be rather difficult!  Perhaps I should turn the safe's\n") ;
  1573. Xprintf("dial instead?\n") ;
  1574. X    return ;
  1575. X}
  1576. X
  1577. X/* initialize the local switches */
  1578. Xflag_switch = F_no_argument ; 
  1579. Xif (tag[V_on]) flag_switch = TRUE ;
  1580. Xif (tag[V_off]) flag_switch = FALSE ;
  1581. Xif (verb == V_light) flag_switch = TRUE ;
  1582. X
  1583. Xflag_rifle_md = F_no_argument ;
  1584. Xif (tag[V_safe]) flag_rifle_md = F_safety ;
  1585. Xif (tag[V_triple]) flag_rifle_md = F_triple ;
  1586. Xif (tag[V_single]) flag_rifle_md = F_single ;
  1587. Xif (tag[V_auto]) flag_rifle_md = F_auto ;
  1588. X
  1589. Xif ((flag_switch == F_no_argument)&&(flag_rifle_md == F_no_argument)) {
  1590. Xprintf("You will have to be a little more specific than that. \n") ;
  1591. X    return ;
  1592. X}
  1593. X
  1594. X/* see if it is a simple "on/off" power equipment switch command */
  1595. Xif ((!tag[V_torch])&&(!tag[V_rifle])&&
  1596. X    (flag_rifle_md == F_no_argument)) {
  1597. Xif (n == R_store_room) {
  1598. X    /* The circuit breaker is switched off */
  1599. X    if (flag_switch == FALSE) {
  1600. X    if (room[R_store_room][M_rm_status] == S_off) {
  1601. X        printf ("The circuit breaker is already turned off! \n");
  1602. X    }
  1603. X    else {
  1604. Xprintf ("As you pull the switch lever, there is a bright blue \n");
  1605. Xprintf ("arc and then all of the lights go out. \n");
  1606. X        room[R_store_room][M_rm_status] = S_off ;
  1607. X        room[R_lift_entr][M_rm_status] = S_closed ;
  1608. X    }
  1609. X    return;
  1610. X    }
  1611. X    /* The circuit breaker is switched on */
  1612. X    if (flag_switch == TRUE) {
  1613. X    if (room[R_store_room][M_rm_status] == S_on) {
  1614. X    printf ("The circuit breaker is already turned on! \n");
  1615. X    }
  1616. X    else {
  1617. Xprintf ("As you pull the switch lever, there is a loud \"CLUNK\" \n");
  1618. Xprintf ("and you see a POWER ON light glowing. \n");
  1619. X        room[R_store_room][M_rm_status] = S_on ;
  1620. X        room[R_lift_entr][M_rm_status] = S_flashing ;
  1621. X    }
  1622. X    return;
  1623. X    }
  1624. X}          
  1625. X
  1626. X/* Deal with a garbage command */
  1627. Xprintf("I don't understand what you want me to switch. \n") ;
  1628. Xreturn ;
  1629. X} /* end of the simple "on/off" switch group */
  1630. X
  1631. X/* the switch command is to select an M16 rifle firing mode */
  1632. Xif (tag[V_rifle]) {
  1633. X    if (object[O_rifle][J_loc] == B_have) {
  1634. X
  1635. X        /* turn the rifle on naively */
  1636. X        if ((flag_switch==TRUE)||
  1637. X               ((flag_rifle_md==F_safety)&&(flag_switch==FALSE))) {
  1638. X            if (rifle_flag != F_safety) {
  1639. Xprintf("The rifle's safety is already off! \n") ; 
  1640. X                return;
  1641. X            }
  1642. X            rifle_flag = F_single ;
  1643. Xprintf("The M16 rifle has been set to single shot mode. \n") ;
  1644. X            return ;
  1645. X        } 
  1646. X/* turn on the safety */
  1647. X    if ((flag_switch==FALSE)||
  1648. X      ((flag_rifle_md==F_safety)&&((flag_switch==TRUE)||
  1649. X      (flag_switch==F_no_argument)))) {
  1650. X                if (rifle_flag == F_safety) {
  1651. Xprintf("The rifle's safety is already on! \n") ; 
  1652. X                return;
  1653. X                }
  1654. X            rifle_flag = F_safety ;
  1655. Xprintf("The M16 rifle's safety has now been turned on. \n") ;
  1656. X            return ;
  1657. X    } 
  1658. X        /* select single shot mode */  
  1659. X        if (flag_rifle_md == F_single) {
  1660. X            if (rifle_flag == F_single) {
  1661. Xprintf("The rifle has already been set to single shot mode.\n");
  1662. X                return;
  1663. X            }
  1664. X            rifle_flag = F_single ;
  1665. Xprintf("The M16 rifle has been set to single shot mode. \n") ;
  1666. X            return ;
  1667. X        } 
  1668. X        /* select triple fire mode */  
  1669. X        if (flag_rifle_md == F_triple) {
  1670. X            if (rifle_flag == F_triple) {
  1671. Xprintf("The rifle has already been set to triple fire mode.\n");
  1672. X                return;
  1673. X            }
  1674. X            rifle_flag = F_triple ;
  1675. Xprintf("The M16 rifle has been set to triple fire mode. \n") ;
  1676. X            return ;
  1677. X        } 
  1678. X        /* select to fully automatice mode */
  1679. X        if (flag_rifle_md == F_auto) {
  1680. X            if (rifle_flag == F_auto) {
  1681. Xprintf("The rifle has already been set to fully automatic.\n");
  1682. X                return;
  1683. X            }
  1684. X            rifle_flag = F_auto ;
  1685. Xprintf("The M16 rifle has been set to fully automatic. \n") ;
  1686. X            return ;
  1687. X        } 
  1688. X    }
  1689. X    /* This is the rifle nonpossession error handler */
  1690. X    else {
  1691. Xprintf("You don't have a rifle in your possession! \n") ;
  1692. X        return ;
  1693. X    }
  1694. X} /* end of the rifle mode switching block */
  1695. X
  1696. X/* the switch command is to turn the torch off or on. */
  1697. Xif (tag[V_torch]) {
  1698. X    if (object[O_torch][J_loc] == B_have) {
  1699. X        /* "switch torch on" command */
  1700. X        if (flag_switch==TRUE) {
  1701. X            if (object[O_torch][J_property]) {
  1702. Xprintf("The torch is already turned on.\n") ;
  1703. X                return ;
  1704. X            }
  1705. Xprintf("An intense beam of light is projected from the torch.\n") ;
  1706. X            object[O_torch][J_property] = TRUE ;
  1707. X            return ;
  1708. X        }
  1709. X        /* "switch torch off" command */
  1710. X        if (flag_switch==FALSE) {
  1711. X            if (!object[O_torch][J_property]) {
  1712. Xprintf("The torch isn't switched on.\n") ;
  1713. X                return ;
  1714. X            }
  1715. Xprintf("The torch switches off with a \"click\".\n") ;
  1716. X            object[O_torch][J_property] = FALSE ;
  1717. X            return ;
  1718. X        }
  1719. X    }
  1720. Xprintf("You don't have a torch in your possession to switch! \n") ;
  1721. X    return ;
  1722. X}
  1723. X
  1724. X} /* --- end of the "switcher" subroutine --- */
  1725. X
  1726. Xvoid new_score() 
  1727. X/* This subroutine calculates the score based on treasure in the safe */
  1728. X{
  1729. Xint i ;
  1730. X    score = 0 ;
  1731. X for (i = 0; i <= objcnt; i++) if (object[i][J_loc] == B_in_safe)  {
  1732. X        score += object[i][J_value] ;
  1733. X    } ;
  1734. X} /* --- end of the "new_score" subroutine --- */
  1735. X
  1736. END_OF_FILE
  1737. if test 18897 -ne `wc -c <'pusher.c'`; then
  1738.     echo shar: \"'pusher.c'\" unpacked with wrong size!
  1739. fi
  1740. # end of 'pusher.c'
  1741. fi
  1742. echo shar: End of archive 2 \(of 7\).
  1743. cp /dev/null ark2isdone
  1744. MISSING=""
  1745. for I in 1 2 3 4 5 6 7 ; do
  1746.     if test ! -f ark${I}isdone ; then
  1747.     MISSING="${MISSING} ${I}"
  1748.     fi
  1749. done
  1750. if test "${MISSING}" = "" ; then
  1751.     echo You have unpacked all 7 archives.
  1752.     rm -f ark[1-9]isdone
  1753. else
  1754.     echo You still need to unpack the following archives:
  1755.     echo "        " ${MISSING}
  1756. fi
  1757. ##  End of shell archive.
  1758. exit 0
  1759.