home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume17 / dinkum3 / part04 < prev    next >
Encoding:
Internet Message Format  |  1993-03-20  |  54.2 KB

  1. Path: uunet!paladin.american.edu!howland.reston.ans.net!zaphod.mps.ohio-state.edu!uwm.edu!ogicse!news.tek.com!master!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v17i009:  dinkum3 - australian text adventure game, V2.12, Part04/07
  5. Message-ID: <4520@master.CNA.TEK.COM>
  6. Date: 9 Feb 93 20:02:22 GMT
  7. Article-I.D.: master.4520
  8. Sender: news@master.CNA.TEK.COM
  9. Lines: 1937
  10. Approved: billr@saab.CNA.TEK.COM
  11. Xref: uunet comp.sources.games:1688
  12.  
  13. Submitted-by: Gary Allen <gary@sun.mech.uq.oz.au>
  14. Posting-number: Volume 17, Issue 9
  15. Archive-name: dinkum3/Part04
  16. Supersedes: dinkum2: Volume 15, Issue 36-43
  17. Environment: Unix, DOS
  18.  
  19.  
  20.  
  21. #! /bin/sh
  22. # This is a shell archive.  Remove anything before this line, then unpack
  23. # it by saving it into a file and typing "sh file".  To overwrite existing
  24. # files, type "sh file -c".  You can also feed this as standard input via
  25. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  26. # will see the following message at the end:
  27. #        "End of archive 4 (of 7)."
  28. # Contents:  opener.c pusher.c
  29. # Wrapped by billr@saab on Mon Feb  8 13:40:51 1993
  30. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  31. if test -f 'opener.c' -a "${1}" != "-c" ; then 
  32.   echo shar: Will not clobber existing file \"'opener.c'\"
  33. else
  34. echo shar: Extracting \"'opener.c'\" \(31331 characters\)
  35. sed "s/^X//" >'opener.c' <<'END_OF_FILE'
  36. X#define OPNR
  37. X#include "dink_sym.h"
  38. X#include "dink_glb.h"
  39. X
  40. X#if (PROTOTYPE)
  41. Xvoid dialer(int n)
  42. X#else
  43. Xvoid dialer(n)
  44. Xint n ;
  45. X#endif
  46. X/*****************************/
  47. X/*      "dial" command"      */
  48. X/*     Version:  Mk 1.1      */
  49. X/*      29 October 1989      */
  50. X/*****************************/
  51. X{
  52. X
  53. X/* deal with the question of "What is the combination?" */
  54. Xif (tag[V_what]) {
  55. Xprintf("I really don't know.  You might try looking around for a\n") ;
  56. Xprintf("series of numbers. Sometimes that can be a clue to the\n") ;
  57. Xprintf("actual combination.\n") ;
  58. X    return ;
  59. X}
  60. X
  61. X/* See if the combination was dialed in the right place */
  62. Xif ((n == R_office_mang)&&(Picture->Status >= S_open)) {
  63. X    if (tag[V_0] && tag[V_49] && tag[V_67] && tag[V_82]) {
  64. X        printf ("Click!! \n");
  65. X        Safe->Status = S_dialed ;
  66. X        return ; 
  67. X    }
  68. Xprintf ("You turned the dial but nothing happened.  I think you \n");   
  69. Xprintf ("dialed the wrong thing. \n");
  70. X    return ; 
  71. X}
  72. Xprintf ("How am I supposed to dial that? \n");
  73. X} /* --- end of the "dialer" subroutine --- */
  74. X
  75. X#if (PROTOTYPE)
  76. Xvoid inventer(void)
  77. X#else
  78. Xvoid inventer()
  79. X#endif
  80. X/*****************************/
  81. X/*   "inventory" command     */
  82. X/*     Version:  Mk 1.0      */
  83. X/*       11 March 1989       */
  84. X/*****************************/
  85. X{
  86. X#if (PROTOTYPE)
  87. Xvoid objector(OBJECT_STRUCT*) ;
  88. X#endif
  89. X
  90. Xregister int i;
  91. Xint j_ws ;
  92. XOBJECT_STRUCT *pnt, *point ;
  93. Xj_ws = 0 ;
  94. Xpnt = object ;
  95. Xfor (i = 0; i < Objcnt; i++) {
  96. X    if ((pnt++)->Location == B_have) {
  97. X        ++j_ws ;
  98. X        point = (pnt - 1) ;
  99. X    }
  100. X}
  101. Xif ((j_ws == 0)&&(gleep_count == 0)) {
  102. X    printf("You've got NOTHING!! \n") ;
  103. X    return ;
  104. X}
  105. Xif (j_ws >= 1) {
  106. X    if (j_ws == 1) {
  107. X        printf("You are carrying ") ;
  108. X        objector(point);
  109. X        printf ("\n") ;
  110. X    }
  111. X    else {
  112. X        printf ("You are carrying the following: \n");
  113. X        pnt = object ;
  114. X        for (i = 0; i < Objcnt; i++) {
  115. X            if ((pnt++)->Location == B_have) {
  116. X                printf("        ") ;
  117. X                point = (pnt - 1) ;
  118. X                objector(point);
  119. X                printf("\n") ;
  120. X            }
  121. X        }
  122. X    }
  123. X}
  124. Xif (gleep_count > 0) {
  125. X    if (gleep_count == 1) {
  126. X        printf("You have one gleep.\n") ;
  127. X        return ;
  128. X    }
  129. X    printf("You are carrying %d gleeps. \n",gleep_count) ;
  130. X}
  131. X
  132. X} /* --- end of the "inventor" subroutine --- */
  133. X#if (PROTOTYPE)
  134. Xvoid drinker(void)
  135. X#else
  136. Xvoid drinker()
  137. X#endif
  138. X/*****************************/
  139. X/*     "drink" command       */
  140. X/*     Version:  Mk 1.0      */
  141. X/*       11 March 1989       */
  142. X/*****************************/
  143. X{
  144. X#if (PROTOTYPE)
  145. Xvoid no_booze(void) ;
  146. X#endif
  147. X
  148. Xif (tag[V_can]) {
  149. X    if (Can->Location == B_have) {
  150. X        printf("The XXXX keeps on coming on ? \n") ;
  151. Xprintf("I think not, for there is no Fourex left for me to drink!\n") ;
  152. X    }
  153. X    else no_booze() ;
  154. X    return ;
  155. X}
  156. X
  157. Xif (tag[V_bottle]) {
  158. X    if (Bottle->Location == B_have) {
  159. Xprintf("Some greedy larrikin has drunk up all of the Black Swan! \n") ;
  160. X    printf("Bad on Him! There is none left for me! \n") ;
  161. X    return ;
  162. X    }
  163. X    no_booze() ;
  164. X    return ;
  165. X}
  166. X
  167. Xif (tag[V_water]) {
  168. X    printf("There is no water here that I am willing to drink.\n") ;
  169. X    return ;
  170. X}
  171. X    
  172. Xprintf ("What exactly do you want me to drink? \n");
  173. Xreturn; 
  174. X
  175. X} /* --- end of the "drinker" subroutine --- */
  176. X
  177. X#if (PROTOTYPE)
  178. Xvoid no_booze(void)
  179. X#else
  180. Xvoid no_booze()
  181. X#endif
  182. X/*****************************/
  183. X/*     Version:  Mk 1.0      */
  184. X/*     7 December 1992       */
  185. X/*****************************/
  186. X{
  187. Xprintf ("You don't have it in your possession to drink!\n");
  188. Xreturn ;
  189. X} /* --- end of the "no_booze" subroutine --- */
  190. X
  191. X#if (PROTOTYPE)
  192. Xvoid reader(int n)
  193. X#else
  194. Xvoid reader(n)
  195. Xint n ;
  196. X#endif
  197. X/*****************************/
  198. X/*      "read" command       */
  199. X/*     Version:  Mk 1.2      */
  200. X/*      23 December 1992     */
  201. X/*****************************/
  202. X{
  203. Xregister int i ;
  204. Xint m, sw_no_see ;
  205. X
  206. XOBJECT_STRUCT *point ;
  207. XREAD_STRUCT *pnt ;
  208. X
  209. X#if (PROTOTYPE)
  210. Xvoid rdtxt(int) ;
  211. XOBJECT_STRUCT* point_to_object(int) ;
  212. X#else
  213. XOBJECT_STRUCT* point_to_object() ;
  214. X#endif
  215. X
  216. X/* reject an isolated "read" command */
  217. Xif (tag[V_VERB_ONLY]) { 
  218. X        printf ("What exactly do you want me to read? \n");
  219. X        return;
  220. X}
  221. X
  222. Xsw_no_see = FALSE ;
  223. Xpnt = read_object ;
  224. Xfor (i = 0; i < Read_objcnt; i++) {
  225. X    m = pnt->ID ;
  226. X    if (!(pnt++)->Readable) continue ;
  227. X    if (tag[m]) {
  228. X        point = (OBJECT_STRUCT*)point_to_object(m) ;
  229. X        if (((point->Location == n)&&(point->Type == Z_unmovable))
  230. X            ||(point->Location == B_have)) rdtxt(m) ;
  231. X        else {
  232. X            if (point->Type == Z_unmovable) {
  233. X                sw_no_see = TRUE ;
  234. X                continue ;
  235. X            }
  236. X            else
  237. Xprintf ("I can't read it because it isn't in my possession. \n");
  238. X        }
  239. X        return ;
  240. X    }
  241. X}
  242. X
  243. X/* Deal with unreadable objects */
  244. Xif (sw_no_see) printf ("I don't see how I can read that.\n") ;
  245. Xelse printf("There is no way in which I can read that. \n");
  246. Xreturn ;
  247. X
  248. X} /* --- end of the subroutine "reader" --- */
  249. X
  250. X#if (PROTOTYPE)
  251. Xvoid locker(int n)
  252. X#else
  253. Xvoid locker(n)
  254. Xint n ;
  255. X#endif
  256. X/*****************************/
  257. X/*     "lock" command        */
  258. X/*      Version: Mk 1.0      */
  259. X/*      27 January 1992      */
  260. X/*****************************/
  261. X{
  262. Xif (tag[V_VERB_ONLY]) {
  263. X    printf ("What do you want me to lock? \n");
  264. X    return; 
  265. X}
  266. X
  267. Xif (room[n][M_unmov_obj]) {
  268. X    switch (n) {
  269. X
  270. X    /* Managers office */
  271. X    case R_office_mang:
  272. Xif (tag[V_safe]) {
  273. X    if (Picture->Status == S_open) { 
  274. X        if (tag[V_key]) {
  275. Xprintf("You can't lock a combination safe with a key (no keyhole)!\n") ;
  276. X            return ;
  277. X        }
  278. X
  279. X        switch (Safe->Status) { 
  280. X        case S_open:
  281. Xprintf("You close the safe and it locks with a \"click\". \n");
  282. X            break ;
  283. X
  284. X        case S_dialed:
  285. Xprintf("You give the safe's dial a twist, locking the safe. \n");
  286. X            break ;
  287. X
  288. X        default:
  289. X            printf("The safe is already locked!\n") ;
  290. X            return ;
  291. X        }
  292. X        Safe->Status = S_closed ;
  293. X    }
  294. X    else printf("I don't see a safe to lock.\n") ;
  295. X}
  296. Xelse  printf("You're wasting your time.  You can't lock that! \n");
  297. Xreturn;
  298. X
  299. X    /* office entrance */
  300. X    case R_office_entr:
  301. X    if (tag[V_door]) {
  302. X        if (tag[V_key]) {
  303. X            if (Key->Location != B_have) {
  304. Xprintf("You don't have the key to this door in your possession! \n");
  305. X                return ;
  306. X            }
  307. X        }
  308. X        else {
  309. X            printf ("With what shall I lock the door? \n");
  310. X            return;
  311. X        }
  312. X
  313. X        switch(Door->Status) {
  314. X        case S_open:
  315. Xprintf("You close the door and turn the key in the lock, locking the door.\n") ;
  316. X            break ;
  317. X        
  318. X        case S_kicked:
  319. Xprintf("The door has been kicked in! It'll never be locked again.\n");
  320. X            return;
  321. X        
  322. X        case S_unlocked:
  323. X        /* The door is closed but unlocked */
  324. Xprintf("You turn the key in the lock, locking the door.\n") ;
  325. X            break ;
  326. X        } /* end of the office entrance "switch" block */
  327. X
  328. X        room[R_office_entr][2] = R_WALL ;
  329. X        Door->Status = S_closed ;
  330. X        return; 
  331. X    }
  332. X
  333. X    default:
  334. Xprintf("I don't think that is the sort of thing one locks.\n") ;
  335. X    }  /* end of "lock" room scan switch */
  336. X} /* end of "unmovable action device" block */
  337. Xelse printf("There is nothing here that can be locked! \n");
  338. Xreturn ;
  339. X}  /* --- end of the "locker" subroutine --- */
  340. X
  341. X#if (PROTOTYPE)
  342. Xvoid unlocker(int n)
  343. X#else
  344. Xvoid unlocker(n)
  345. Xint n ;
  346. X#endif
  347. X/*****************************/
  348. X/*     "unlock" command      */
  349. X/*      Version: Mk 1.1      */
  350. X/*      16 September 1989    */
  351. X/*****************************/
  352. X{
  353. Xif (tag[V_VERB_ONLY]) {
  354. X    printf ("What do you want me to unlock? \n");
  355. X    return; 
  356. X}
  357. X
  358. Xif (room[n][M_unmov_obj]) {
  359. X    switch (n) {
  360. X
  361. X    /* Managers office */
  362. X    case R_office_mang:
  363. X        if (tag[V_safe]) {
  364. X            if (Picture->Status == S_open) { 
  365. Xprintf("This is a combination type safe (no key hole).  You must\n");
  366. Xprintf("dial a combination in order to open this safe. \n");
  367. X            }
  368. X            else printf("I don't see a safe to unlock.\n") ;
  369. X        }
  370. X        else 
  371. Xprintf("You're wasting your time.  You can't unlock that! \n");
  372. X        return;
  373. X
  374. X    /* office entrance */
  375. X    case R_office_entr:
  376. X    if (tag[V_door]) {
  377. X        switch(Door->Status) {
  378. X        case S_open:
  379. X            printf("The door is already open! \n");
  380. X            return;
  381. X        
  382. X        case S_kicked:
  383. X            printf("The door has been kicked in! \n");
  384. X            return;
  385. X        
  386. X        case S_unlocked:
  387. Xprintf("The door is already unlocked.  However it is still closed! \n");
  388. X            return;
  389. X        } /* end of the office entrance "switch" block */
  390. X
  391. X        /* The door has to still be unlocked */
  392. X        if (tag[V_key]) {
  393. X        if (Key->Location != B_have) {
  394. Xprintf("You don't have the key to this door in your possession! \n");
  395. X        }
  396. X        else {
  397. X            printf("You turn the key in the lock and ") ;
  398. X            printf("hear a satisfying \"click\".\n");
  399. X            Door->Status = S_unlocked ;
  400. X        }
  401. X        }
  402. X        else printf ("With what shall I unlock the door? \n");
  403. X        return; 
  404. X    }
  405. X
  406. X    default:
  407. Xprintf("I don't think that is the sort of thing one unlocks.\n") ;
  408. X    }  /* end of "unlock" room scan switch */
  409. X} /* end of "unmovable action device" block */
  410. Xelse printf("There is nothing here that can be unlocked! \n");
  411. Xreturn ;
  412. X}  /* --- end of the "unlocker" subroutine --- */
  413. X
  414. X#if (PROTOTYPE)
  415. Xvoid closer(int n)
  416. X#else
  417. Xvoid closer(n)
  418. Xint n ;
  419. X#endif
  420. X/*****************************/
  421. X/*     "close" command       */
  422. X/*     Version:  Mk 1.0      */
  423. X/*     12 November 1988      */
  424. X/*****************************/
  425. X{
  426. X/* scan "close" sentence */
  427. Xif (!room[n][M_unmov_obj]) {
  428. Xprintf("There is nothing here that can be closed! \n");
  429. X    return; 
  430. X}
  431. X
  432. Xif (tag[V_VERB_ONLY]) {
  433. X    printf ("What exactly do you want me to close? \n");
  434. X    return; 
  435. X}
  436. X
  437. Xswitch (n) {
  438. X    /* office door */
  439. X    case R_office_entr:
  440. X        if (!tag[V_door]) break ;
  441. X
  442. X        switch (Door->Status) {
  443. X        case S_kicked:
  444. Xprintf("The door has been kicked in!  It'll never be closed again.\n");
  445. X            return;
  446. X        
  447. X        case S_open:
  448. X            if (tag[V_key]) {
  449. X                if (Key->Location != B_have) {
  450. Xprintf("You don't have the key to this door in your possession! \n");
  451. X                }
  452. X                else {
  453. Xprintf("You close the office door and lock it with the key.\n") ;
  454. X                    room[R_office_entr][2] = R_WALL ;
  455. X                    Door->Status = S_closed ;
  456. X                }
  457. X                return ;
  458. X            }
  459. X            printf("The office door closes with a slam. \n");
  460. X            Door->Status = S_unlocked ;
  461. X            return ;
  462. X        
  463. X        default:
  464. X            printf("The office door is already closed! \n");
  465. X            return ;
  466. X        } /* end of the door status switch */
  467. X
  468. X    /* managers office */
  469. X    case R_office_mang:
  470. X    if ((!tag[V_picture])&&(!tag[V_safe])) break;
  471. X    if (tag[V_safe]) {
  472. X        if (Safe->Status != S_open) 
  473. X        printf("The safe is already closed. \n");
  474. X        else {
  475. X    printf("The safe door closes and locks with a \"click\". \n");
  476. X            Safe->Status = S_closed ;
  477. X        }
  478. X    }
  479. X    if (tag[V_picture]) {
  480. X        if (Picture->Status == S_closed) 
  481. X        printf("The platypus picture is already closed. \n");
  482. X        else  {
  483. Xprintf("The picture swings flush against the wall, hiding the safe.\n");
  484. X            Picture->Status = S_closed ;
  485. X        }
  486. X    }
  487. X    return ;
  488. X
  489. X} /* end of the "close" switch */
  490. X
  491. Xprintf ("I really don't see how one would close that? \n");
  492. Xreturn; 
  493. X} /* --- end of the "closer" subroutine --- */
  494. X
  495. X#if (PROTOTYPE)
  496. Xvoid opener(int n)
  497. X#else
  498. Xvoid opener(n)
  499. Xint n ;
  500. X#endif
  501. X/*****************************/
  502. X/*      "open" command       */
  503. X/*     Version:  Mk 2.1      */
  504. X/*     25 April 1990         */
  505. X/*****************************/
  506. X{
  507. Xregister int i, j ;
  508. Xint sw_found ;
  509. X
  510. XOBJECT_STRUCT *pnt, *point ;
  511. X
  512. X#if (PROTOTYPE)
  513. Xvoid boom(void), ender(int), gleeper(int) ; 
  514. Xvoid objector(OBJECT_STRUCT*) ;
  515. X#endif
  516. X
  517. X/* deal with a terse command */
  518. Xif (tag[V_VERB_ONLY]) {
  519. X    printf ("What exactly do you want me to open? \n");
  520. X    return;
  521. X}
  522. Xif (tag[V_can]) {
  523. X    if (Can->Location == B_have) 
  524. Xprintf("Some bugger has already drunk it up. The stubee is empty!\n");
  525. X    else printf("You don't have a can to open! \n") ;
  526. X    return; 
  527. X}
  528. X
  529. Xif (tag[V_letter]) {
  530. X    if (Letter->Location == B_have) {
  531. X        boom() ; /* cause an explosion */
  532. Xprintf("It's not polite to read other people's mail!!  As you lay\n") ;
  533. Xprintf("bleeding on the floor with your hands and arms blown away,\n") ;
  534. Xprintf("you realize that envelope actually contained a letter bomb!\n");
  535. Xprintf("(A trick widely used by terrorists in the 1970s).  However\n");
  536. Xprintf("the knowledge does you little good since your spirit soon\n");
  537. Xprintf("departs this mortal coil.\n");
  538. X        ender(F_died) ;
  539. X    }
  540. X    else printf("You don't have a letter to open!\n") ;
  541. X    return ;
  542. X}
  543. X
  544. Xif (tag[V_bottle]) {
  545. X    if (Bottle->Location == B_have)
  546. Xprintf("Some bugger has already drunk it up. The bottle is Empty! \n");
  547. X    else printf("You don't have a bottle to open! \n") ;
  548. X    return; 
  549. X}
  550. X
  551. Xif (tag[V_umbrella]) {
  552. X    if (Umbrella->Location == B_have) {
  553. Xprintf("You open the umbrella but find it's full of holes and\n");
  554. Xprintf("its clasp is broken.  As soon as you release it, the\n");
  555. Xprintf("umbrella snaps shut.\n") ;
  556. X    }
  557. X    else printf("You don't have an umbrella to open! \n") ;
  558. X    return; 
  559. X}
  560. X/* Now check to see if the location is consistent with the command */
  561. Xif (!room[n][M_unmov_obj]) {
  562. X    printf ("I don't understand what you want me to open. \n") ;
  563. X    return ;
  564. X}
  565. X
  566. Xswitch (n) {
  567. X    /* office entrance (door) */
  568. X    case R_office_entr:
  569. X        if (tag[V_door]) {
  570. X        switch (Door->Status) {
  571. X            case S_kicked:
  572. Xprintf("The door has been kicked in!  You don't need to open it.\n");
  573. X                return;
  574. X        
  575. X            case S_open:
  576. X                printf("The door is already open! \n");
  577. X                return ;
  578. X        
  579. X            case S_unlocked:
  580. Xprintf("As you push open the office door, the rusty hinges creak \n");
  581. Xprintf("from long disuse.  Darkness and stale air seem to exude \n");
  582. Xprintf("from the vacant office.  The way is free for you to enter. \n");
  583. X                room[R_office_entr][2] = R_office_hall ;
  584. X                Door->Status = S_open ;
  585. X                return ;
  586. X        
  587. X            case S_closed:
  588. X                if (tag[V_key]) {
  589. Xif (Key->Location != B_have) {
  590. X    printf("You don't have the key to this door in your possession! \n");
  591. X}
  592. Xelse {
  593. Xprintf("You turn the key in the lock and hear a satisfying \"click\".\n");
  594. Xprintf("Then you push open the office door, the rusty hinges creak \n");
  595. Xprintf("from long disuse.  Darkness and stale air seem to exude \n");
  596. Xprintf("from the vacant office.  The way is free for you to enter. \n");
  597. X    room[R_office_entr][2] = R_office_hall ;
  598. X    Door->Status = S_open ;
  599. X}
  600. X                }
  601. X                else {
  602. Xprintf("The office door is locked tight.");
  603. Xprintf("  You need to unlock it with a key. \n");
  604. X                }
  605. X                return ;
  606. X        } /* end of room status switch */
  607. X        } /* end of the door "if" block */
  608. X        break ;
  609. X
  610. X    /* managers office */
  611. X    case R_office_mang:
  612. X        if ((!tag[V_picture])&&(!tag[V_safe])) {
  613. Xprintf("I don't understand how I would open that.\n") ;
  614. X            return ;
  615. X        }
  616. X
  617. X        if (tag[V_picture]) {
  618. X            if (Picture->Status == S_closed) {
  619. Xprintf("You swing open the platypus picture revealing a large wall \n");
  620. Xprintf("safe with a combination dial. \n");
  621. X                Picture->Status = S_open ;
  622. X            }
  623. X            else {
  624. X                if (Safe->Status == S_closed) {
  625. Xprintf("The picture is already swung out.  The problem is to open \n");
  626. Xprintf("the safe!!  Hint:  Dial in a combination. \n");
  627. X                }
  628. X                else {
  629. Xprintf("The picture is already swung out.\n");
  630. X                }
  631. X            }
  632. X            return ;
  633. X        } /* end of the picture "if" block */
  634. X
  635. X        if (tag[V_safe]) {
  636. X            if (Picture->Status == S_closed) {
  637. Xprintf("I do not see a safe in this office for me to open.  Perhaps\n");
  638. Xprintf("there is a safe hidden in this office somewhere.\n");
  639. X                return ;
  640. X            }
  641. X
  642. X        switch (Safe->Status) {
  643. X        case S_closed:
  644. Xprintf("The safe is locked.  You must first dial the combination\n");
  645. Xprintf("in order to open it.  See if you can find the combination. \n");
  646. X            return ;
  647. X        
  648. X        case S_dialed:
  649. X    printf("The safe door swings open smoothly and easily. \n");
  650. X            Safe->Status = S_open ;
  651. X            sw_active = TRUE ;
  652. X            sw_found = FALSE ;
  653. X            point = object ;
  654. X            for (j = 0; j < Objcnt; j++) {
  655. X            if ((point++)->Location == B_in_safe) {
  656. Xprintf("Inside the safe, you see the following: \n");
  657. X                sw_found = TRUE ;
  658. X                pnt = object ;
  659. X                for (i = 0; i < Objcnt; i++) {
  660. X                    if (pnt->Location == B_in_safe) {
  661. X                        printf ("        ") ;
  662. X                        objector(pnt);
  663. X                        printf("\n") ;
  664. X                    }
  665. X                    pnt++ ;
  666. X                }                
  667. X                break ;
  668. X            }
  669. X            }
  670. X            if (gleep_safe != 0) {
  671. X                if (sw_found) {
  672. X                    if (gleep_safe == 1) 
  673. Xprintf("        one gleep\n") ;
  674. X                    else
  675. Xprintf("        %d gleeps\n", gleep_safe) ;
  676. X                }
  677. X                else {
  678. X                    if (gleep_safe == 1) 
  679. Xprintf("Inside the safe is one gleep.\n") ;
  680. X                    else
  681. Xprintf("Inside the safe are %d gleeps.\n", gleep_safe) ;
  682. X                    sw_found = TRUE ;
  683. X                }
  684. X            }
  685. X            if (!sw_found) printf("---The safe is empty.--- \n");
  686. X            return ;
  687. X
  688. X        case S_open:
  689. X            printf("The safe is already open! \n");
  690. X            return ;
  691. X        } /* end of the "safe" status switch */
  692. X        } /* end of the safe "if" block */
  693. X        return ; /* this return statement must remain */
  694. X
  695. X    /* Lift door(s) */
  696. X    case R_lift_entr:
  697. X        if (tag[V_door]||tag[V_lift]) {
  698. Xprintf("It is not exactly clear how I would open these doors.\n") ;
  699. Xprintf("However I see a push button next to the lift doors.\n") ;
  700. Xprintf("Perhaps if I pressed the button something would happen.\n") ;
  701. X        }
  702. X        else printf("I'm confused about what I should open.\n");
  703. X        return ;
  704. X        
  705. X} /* end of the "open" room switch */
  706. Xprintf ("I see nothing here that I can open. \n") ;
  707. X} /* --- end of the "opener" subroutine --- */
  708. X
  709. X#if (PROTOTYPE)
  710. Xvoid boom(void)
  711. X#else
  712. Xvoid boom()
  713. X#endif
  714. X{
  715. Xprintf("\n\n");
  716. Xprintf("BBBBBB      OOOOO        OOOOO      MM        MM      !!!\n");
  717. Xprintf("B    BB   OO     OO    OO     OO    M M      M M      !!!\n");
  718. Xprintf("B    BB   OO     OO    OO     OO    M  M    M  M      !!!\n");
  719. Xprintf("BBBBBB    OO     OO    OO     OO    M   M  M   M      !!!\n");
  720. Xprintf("B    BB   OO     OO    OO     OO    M    MM    M      !!!\n");
  721. Xprintf("B    BB   OO     OO    OO     OO    M          M\n");
  722. Xprintf("BBBBBB      OOOOO        OOOOO      M          M      !!!\n\n");
  723. X} /* --- end of the "boom" subroutine --- */
  724. X
  725. X#if (PROTOTYPE)
  726. Xvoid gleeper(int n)
  727. X#else
  728. Xvoid gleeper(n) 
  729. Xint n ;
  730. X#endif
  731. X/********************************************/
  732. X/*                                          */
  733. X/*           Gleeper Subroutine             */
  734. X/*                                          */
  735. X/*     Software by Gary A. Allen, Jr.       */
  736. X/*           Version: Mk 1.00               */
  737. X/* (c) Copyright 1989 by Gary A. Allen, Jr. */
  738. X/*                                          */
  739. X/********************************************/
  740. X{
  741. Xregister int i ;
  742. Xint count ;
  743. Xstatic int sw_glp_st = FALSE, cnt_down = 0 ;
  744. X
  745. X/* Gleep display routine */
  746. Xcount = room[n][M_gleep] ;
  747. X
  748. Xif (((Torch->Location == B_have)&&Torch->Status)
  749. X        ||(n < 186)||(n > 202)) { 
  750. X    if (count != 0) {
  751. X        sw_glp_st = TRUE ; /*  gleeps can now multiply */
  752. X        if (count != 1) 
  753. X               printf("There are %d gleeps here. \n",count) ;
  754. X        else printf("There is a gleep here. \n") ;
  755. X        return ;
  756. X    }
  757. X}
  758. X
  759. X/* Gleep reproduction routine */
  760. Xif (sw_glp_st == TRUE) {
  761. X    if (++cnt_down > 5) {
  762. X        cnt_down = 0 ;
  763. X        for (i = 0; i <= 9; i++) {
  764. X            if (room[gleep_spot[i]][M_gleep] == 0) continue;
  765. X            if (room[gleep_spot[i]][M_gleep] > 10000) 
  766. X                ++room[gleep_spot[i]][M_gleep] ;
  767. X            else room[gleep_spot[i]][M_gleep] <<= 1 ;
  768. X        }
  769. X    }
  770. X}
  771. X} /* --- end of "gleeper" subroutine --- */
  772. X
  773. X#if (PROTOTYPE)
  774. Xvoid clip_in(int ammo_flag)
  775. X#else
  776. Xvoid clip_in(ammo_flag)
  777. Xint ammo_flag ;
  778. X#endif
  779. X/********************************************/
  780. X/*                                          */
  781. X/*            Clip_In Subroutine            */
  782. X/*                                          */
  783. X/*     Software by Gary A. Allen, Jr.       */
  784. X/*           Version: Mk 2.00               */
  785. X/* (c) Copyright 1990 by Gary A. Allen, Jr. */
  786. X/*                                          */
  787. X/********************************************/
  788. X{
  789. X/* ammo clip insertion routine */
  790. Xif (Rifle->Location != B_have) {
  791. Xprintf("Galah!!  You don't have a rifle to put an ammo clip into.\n");
  792. X    return ;
  793. X}
  794. Xif (clip_flag != F_no_clip) {
  795. Xprintf("There is already an ammo clip in the rifle. \n") ;
  796. X    return ;
  797. X}
  798. Xif (((Clip->Location != B_have)&&(ammo_flag == F_normal_clip))
  799. X    ||((Org_clip->Location != B_have)&&(ammo_flag == F_org_clip))) {
  800. Xprintf("You don't possess an ammo clip to put into the rifle.\n");
  801. X    return ;
  802. X}
  803. X/* actually load the clip into the rifle */
  804. XRifle->Type = Z_alias ;
  805. Xcarry_count-- ;
  806. Xcarry_weight -= Clip->Weight  ;
  807. Xif (ammo_flag == F_normal_clip) {
  808. X    Clip->Location = B_unmade ;
  809. X    clip_flag = F_normal_clip ;
  810. X    Rifle->Status  = Clip->Status ;
  811. X}
  812. Xelse {
  813. X    Org_clip->Location = B_unmade ;
  814. X    clip_flag = F_org_clip ;
  815. X    Rifle->Status = Org_clip->Status ;
  816. X}
  817. Xprintf("The ammunition clip slides into the rifle with a \"click\".\n");
  818. Xprintf("You have %d bullets in the clip \n",
  819. X            Rifle->Status) ;
  820. Xif (Rifle->Status > 0) 
  821. X    printf("You cycle the M16's bolt once to chamber a round.\n");
  822. Xreturn ;
  823. X} /* --- end of the "clip_in" subroutine --- */
  824. X
  825. X#if (PROTOTYPE)
  826. Xvoid clip_out(int n)
  827. X#else
  828. Xvoid clip_out(n)
  829. Xint n ;
  830. X#endif
  831. X/********************************************/
  832. X/*                                          */
  833. X/*           Clip_Out Subroutine            */
  834. X/*                                          */
  835. X/*     Software by Gary A. Allen, Jr.       */
  836. X/*           Version: Mk 1.00               */
  837. X/* (c) Copyright 1989 by Gary A. Allen, Jr. */
  838. X/*                                          */
  839. X/********************************************/
  840. X{
  841. Xint ammo_flag ; 
  842. X
  843. X/* remove clip from rifle */
  844. Xif (Rifle->Location != B_have) {
  845. X    printf("You Bloody Galah!  ") ;
  846. X    printf("You don't have a rifle in your possession!\n");
  847. X    return ;
  848. X}
  849. Xif (clip_flag == F_no_clip) {
  850. X    printf("There is no clip in the rifle. \n") ;
  851. X    return ;
  852. X}
  853. X/* eject the clip from the rifle */
  854. XRifle->Type = Z_normal ;
  855. Xif (clip_flag == F_normal_clip) {
  856. X    Clip->Location = n ;
  857. X    ammo_flag = F_normal_clip ;
  858. X}
  859. Xelse {
  860. X    Org_clip->Location = n ;
  861. X    ammo_flag = F_org_clip ;
  862. X}
  863. X++room[n][M_obj_cnt] ;
  864. Xclip_flag = F_no_clip ;
  865. Xprintf("You press the \"eject\" button on the rifle and the ") ;
  866. Xprintf("magazine falls to the ground.\n") ;
  867. X
  868. Xif (Rifle->Status > 0) {
  869. Xprintf("You then cycle the M16's bolt once to clear the chamber. ");
  870. Xprintf("The unfired round\n") ;
  871. Xprintf("is ejected from the breech and rolls out of sight. \n") ;
  872. X    if (ammo_flag == F_normal_clip) Clip->Status = --Rifle->Status ;
  873. X    else Org_clip->Status = --Rifle->Status ;
  874. X}
  875. Xelse {
  876. X    if (ammo_flag == F_normal_clip) Clip->Status = 0 ;
  877. X    else Org_clip->Status = 0 ;
  878. X}
  879. XRifle->Status = 0 ;
  880. Xreturn ;
  881. X} /* --- end of the "clip_out" subroutine --- */
  882. X
  883. X#if (PROTOTYPE)
  884. Xvoid igniter(int n)
  885. X#else
  886. Xvoid igniter(n)
  887. Xint n ;
  888. X#endif
  889. X/********************************************/
  890. X/*                                          */
  891. X/*           Igniter Subroutine             */
  892. X/*                                          */
  893. X/*     Software by Gary A. Allen, Jr.       */
  894. X/*           Version: Mk 1.00               */
  895. X/* (c) Copyright 1989 by Gary A. Allen, Jr. */
  896. X/*                                          */
  897. X/********************************************/
  898. X{
  899. X#if (PROTOTYPE)
  900. Xvoid switcher(int) ;
  901. Xlong time(long*) ;
  902. X#else
  903. Xlong time() ;
  904. X#endif
  905. X
  906. X/* reject single verb command */
  907. Xif (tag[V_VERB_ONLY]) {
  908. X    printf("What exactly do you want me to set alight?\n") ;
  909. X    return ;
  910. X}
  911. X
  912. X/* deal with 'light torch' command */
  913. Xif (tag[V_torch]) {
  914. X    switcher(n) ;
  915. X    return ;
  916. X}
  917. X
  918. X/* see if the player has or requested matches */
  919. Xif (!tag[V_match]) {
  920. X    printf("What am I to light it with?\n") ;
  921. X    printf("(I am not prepared to rub two sticks together.)\n") ;
  922. X    return ;
  923. X}
  924. Xif (Matches->Location != B_have) {
  925. X    printf("I have no matches!\n") ;
  926. X    return ;
  927. X}
  928. Xelse {
  929. X/* reject spurious "ignite" command */
  930. X    if ((!tag[V_cap])&&(!tag[V_dynamite])
  931. X        &&(sent[2] != V_LINE_END)) {
  932. Xprintf("It would be a fire hazard to set that alight.\n");
  933. X        return ;
  934. X    }
  935. X
  936. X/* deal with spurious "light dynamite with match" */
  937. Xif (tag[V_dynamite]&&(Dynamite->Location != B_have)) {
  938. X    printf("You have no dynamite to ignite.\n") ;
  939. X    return ;
  940. X}
  941. X
  942. X/* deal with spurious "light cap with match" */
  943. Xif (tag[V_cap]&&(Dynamite->Location != B_have)
  944. X    &&(Cap->Location != B_have)) {
  945. Xprintf("You don't have one to ignite.\n") ;
  946. X    return ;
  947. X}
  948. X
  949. X/* light up the match(es) */
  950. X    if (tag[V_PLURAL]) {
  951. Xprintf("You open up the match box and strike ALL of the matches.\n");
  952. X        Matches->Location = B_destroyed ;
  953. X    }
  954. X    else {
  955. Xprintf("You take one match from the match box and ignite it.\n") ;
  956. X    }
  957. X}
  958. X
  959. X/* see if player selected burnable objects */
  960. Xif (tag[V_cap]&&(Cap->Location == B_have)) {
  961. Xprintf("You then ignite the fuse of the blasting cap.\n\n"); 
  962. Xprintf("Ssssssssssssssssssssssss........\n");
  963. X    clock_explode = time(0) + 11 ;
  964. X    sw_clock = TRUE ;
  965. X    flag_clock = V_cap ;
  966. X    return ;
  967. X}
  968. X
  969. Xif ((tag[V_cap]||tag[V_dynamite])&&
  970. X    (Dynamite->Location == B_have)) {
  971. X    if (Dynamite->Type == Z_alias) {
  972. Xprintf("You then ignite the fuse of the dynamite's blasting cap....\n");
  973. Xprintf("You need to very quickly get very far away from this thing!!");
  974. Xprintf("\n\nSsssssssssssssssssssssss........\n");
  975. X        clock_explode = time(0) + 11 ;
  976. X        sw_clock = TRUE ;
  977. X        flag_clock = V_dynamite ;
  978. X         return ;
  979. X    }
  980. X    else {
  981. Xprintf("You then ignite the dynamite. Which is an odd thing\n"); 
  982. Xprintf("to do since it doesn't have a blasting cap in it.  The\n");
  983. Xprintf
  984. X  ("\"dynamite\" (which is actually a very safe mining explosive)\n");
  985. Xprintf("burns for a few minutes, billowing out smelly black smoke\n");
  986. Xprintf("and eventually goes out leaving a few scant ashes behind.\n") ;
  987. X        Dynamite->Location = B_destroyed ;
  988. X         return ;
  989. X    }
  990. X}
  991. X
  992. X} /* -- end of the "igniter" subroutine --- */
  993. X
  994. X#if (PROTOTYPE)
  995. Xvoid hold_it(void)
  996. X#else
  997. Xvoid hold_it()
  998. X#endif
  999. X/********************************************/
  1000. X/*                                          */
  1001. X/*            Wait Subroutine               */
  1002. X/*                                          */
  1003. X/*     Software by Gary A. Allen, Jr.       */
  1004. X/*           Version: Mk 1.00               */
  1005. X/* (c) Copyright 1989 by Gary A. Allen, Jr. */
  1006. X/*                                          */
  1007. X/********************************************/
  1008. X{
  1009. X#if (PROTOTYPE)
  1010. Xchar getch(void) ;
  1011. X#endif
  1012. X
  1013. X#ifdef __TURBOC__
  1014. X/* Stop scrolling the screen until the user is ready */
  1015. Xprintf("               [Press any key to continue]\r") ;
  1016. Xgetch() ;
  1017. Xprintf("                                          \n") ;
  1018. X#endif
  1019. X
  1020. X#ifndef __TURBOC__
  1021. Xprintf("               [Press RETURN to continue]\n") ;
  1022. Xgetchar() ;
  1023. X#endif
  1024. X
  1025. X} /* --- end of the "hold_it" subroutine --- */
  1026. X
  1027. X#if (PROTOTYPE)
  1028. Xvoid eater(void)
  1029. X#else
  1030. Xvoid eater()
  1031. X#endif
  1032. X/********************************************/
  1033. X/*                                          */
  1034. X/*            Eater Subroutine              */
  1035. X/*                                          */
  1036. X/*     Software by Gary A. Allen, Jr.       */
  1037. X/*           Version: Mk 1.00               */
  1038. X/* (c) Copyright 1989 by Gary A. Allen, Jr. */
  1039. X/*                                          */
  1040. X/********************************************/
  1041. X{
  1042. X
  1043. X#if (PROTOTYPE)
  1044. Xvoid ender(int) ;
  1045. X#endif
  1046. X
  1047. X/* reject single verb command */
  1048. Xif (tag[V_VERB_ONLY]) {
  1049. X    printf("What exactly do you want me to swallow?\n") ;
  1050. X    return ;
  1051. X}
  1052. X
  1053. X/* deal with "eat (atropine) pill(s)" command */
  1054. Xif (tag[V_pill]) {
  1055. X    if (Pills->Location != B_have) {
  1056. Xprintf("You don't have the atropine pills in your possesion!\n") ;
  1057. X        return ;
  1058. X    }
  1059. X    if (tag[V_PLURAL]) {
  1060. Xprintf("You remove ALL of the pills from the packet and swallow\n");
  1061. Xprintf("the lot.  For a couple of minutes nothing happens, then you\n");
  1062. Xprintf("start seeing double and have nervous twitches. You then\n");
  1063. Xprintf("start shaking violently and collapse to the ground.\n") ;
  1064. Xprintf("Eventually you pass out and expire from atropine poisoning.\n");
  1065. X        ender(F_died) ;
  1066. X    }
  1067. X    if (--pill_count <= 0 ) {
  1068. X        Pills->Location = B_destroyed ;
  1069. X        carry_count-- ;
  1070. X        carry_weight -= Pills->Weight  ;
  1071. Xprintf("You swallow the last atropine pill and throw away the empty\n");
  1072. Xprintf("packet which disappears from sight.  ") ;
  1073. X    }
  1074. Xelse printf("You swallow one atropine pill.  ") ;
  1075. X        i_poison += 10 ;
  1076. X        if (i_poison >= 30) {
  1077. Xprintf("\nAfter a moment you have a violent seizure and die.\n") ;
  1078. X            ender(F_died) ;
  1079. X        }
  1080. X        if (i_poison >= 20) {
  1081. Xprintf("\nYou begin to shake violently and can barely stand.\n") ;
  1082. X            return ;
  1083. X        }
  1084. X        if (i_poison >= 15) {
  1085. Xprintf("\nYour hands become a bit jittery and your vision blurred.\n") ;
  1086. X            return ;
  1087. X        }
  1088. X        printf("The drug has no ill effect.\n") ;
  1089. X    return ;
  1090. X}
  1091. Xelse 
  1092. Xprintf("I am not inclined towards putting that into my mouth!\n") ;
  1093. X
  1094. X} /* --- end of the "eater" subroutine --- */
  1095. X
  1096. X#if (PROTOTYPE)
  1097. Xvoid ender(int i_quit)
  1098. X#else
  1099. Xvoid ender(i_quit)
  1100. Xint i_quit ;
  1101. X#endif
  1102. X/********************************************/
  1103. X/*                                          */
  1104. X/*            Ender Subroutine              */
  1105. X/*                                          */
  1106. X/*     Software by Gary A. Allen, Jr.       */
  1107. X/*           Version: Mk 1.00               */
  1108. X/* (c) Copyright 1989 by Gary A. Allen, Jr. */
  1109. X/*                                          */
  1110. X/********************************************/
  1111. X{
  1112. X#if (PROTOTYPE)
  1113. Xvoid hold_it(void), new_score(void), exit(int) ;
  1114. X#endif
  1115. X
  1116. X/* get last score */
  1117. Xnew_score() ;
  1118. X
  1119. Xif (Tank->Status != 0) sw_active = TRUE ; 
  1120. X
  1121. Xif (i_quit == F_died) { 
  1122. X    hold_it() ;
  1123. X    score -= 100 ;
  1124. Xprintf ("\nOh Dear!  You've just turned yourself into a corpse! \n\n");
  1125. Xprintf ("For getting killed you lose 100 points. \n\n") ;
  1126. X}
  1127. X
  1128. X/* Scoring Block */
  1129. Xfor(;;) {
  1130. Xif (!sw_active) {
  1131. X    if (score == 0) { 
  1132. X        printf("You concluded the game with no points.  ") ; 
  1133. X        printf("What a pitiful performance!!\n") ;
  1134. X    }
  1135. X    else {
  1136. Xprintf("You concluded the game with a miserable negative score\n") ;
  1137. Xprintf("of %d points.  Your score was better BEFORE you \n",score);
  1138. Xprintf("started playing (need I say more on how this reflects\n");
  1139. Xprintf("upon your limited aptitude at Dinkum).\n") ;
  1140. X    }
  1141. X    break ;  /* drop out of the scoring block */
  1142. X}
  1143. X
  1144. Xif (score == 0)  {
  1145. Xprintf("You concluded the game with no points ") ;
  1146. X    if (Tank->Status == 0) { 
  1147. Xprintf("and didn't drop a single gleep\n") ;
  1148. Xprintf("into the gleep tank. The word \"embarrassing\" sums it up!\n") ;
  1149. X    }
  1150. X    else {
  1151. X        if (Tank->Status > 1) {
  1152. Xprintf("but you did put %d gleeps\n",Tank->Status) ;
  1153. Xprintf("into the gleep tank.\n") ;
  1154. X        }
  1155. X        else {
  1156. Xprintf("but you did manage to find a gleep\n") ;
  1157. Xprintf("and put it in the gleep tank, (Hah!! What an achievement!).\n");
  1158. X        }
  1159. X    }
  1160. X}
  1161. X
  1162. Xelse {
  1163. Xif (score > 0)
  1164. Xprintf ("You concluded the game with %d points",score);
  1165. Xelse {
  1166. Xprintf("You concluded the game with a miserable negative score\n") ;
  1167. Xprintf("of %d points.  Your score was better BEFORE you \n",score);
  1168. Xprintf("started playing (need I say more on how this reflects\n");
  1169. Xprintf("upon your limited aptitude at Dinkum).  You ") ;
  1170. X    if (Tank->Status == 0) { 
  1171. Xprintf("also failed to\nget any gleeps into the tank.  At least ");
  1172. Xprintf("you're consistent.\n\n") ;
  1173. X    }
  1174. X    else {
  1175. Xprintf("managed\nto get something into the gleep tank.  However ");
  1176. Xprintf("it hardly\nmatters, considering your poor score.\n\n") ;
  1177. X    }
  1178. X    break ;  /* drop out of the scoring block */
  1179. X}
  1180. X    if (Tank->Status == 0) 
  1181. Xprintf(".\nHowever you placed no gleeps in the gleep tank.\n") ;
  1182. X    else {
  1183. X        if (Tank->Status > 1) {
  1184. Xprintf (" and placed %d gleeps\n",Tank->Status) ;
  1185. Xprintf ("in the gleep tank.  Good on you, Mate!\n") ;
  1186. X        }
  1187. X        else {
  1188. Xprintf(" but you did manage to find a gleep\n") ;
  1189. Xprintf("and put it in the gleep tank.\n") ;
  1190. X        }
  1191. X    }
  1192. X}
  1193. Xbreak ;  /* drop out of the scoring block */
  1194. X} /* end of the ifinite "for" loop scoring block */
  1195. X
  1196. X/* Closing Remark */
  1197. Xprintf("\nDinkum has ended.  If you are interested in more ") ;
  1198. Xprintf("information\nabout this program type:    dinkum -h\n") ;
  1199. Xexit(0);
  1200. X
  1201. X} /* --- end of "ender" routine --- */
  1202. X#if (PROTOTYPE)
  1203. XOBJECT_STRUCT* point_to_object(int find_id)
  1204. X#else
  1205. XOBJECT_STRUCT* point_to_object(find_id)
  1206. Xint find_id ;
  1207. X#endif
  1208. X/*****************************/
  1209. X/*  Object Pointer Function  */
  1210. X/*     Version:  Mk 1.0      */
  1211. X/*      9 January 1993       */
  1212. X/*****************************/
  1213. X{
  1214. X
  1215. Xregister int i;
  1216. XOBJECT_STRUCT *pnt ;
  1217. X
  1218. X#if (PROTOTYPE)
  1219. Xvoid bugs(int) ;
  1220. X#endif
  1221. Xpnt = object ;
  1222. Xfor (i = 0; i < Objcnt; i++) {
  1223. X    if (pnt->ID == find_id) return(pnt) ;
  1224. X    pnt++ ;
  1225. X}
  1226. Xprintf("Run time error detected in \"point_to_object\" function.\n") ;
  1227. Xprintf("\"find_id\" value was %d.\n", find_id) ;
  1228. Xbugs(Logic_error) ;
  1229. Xreturn(pnt) ;  /* this is just a dummy return for Lint */
  1230. X
  1231. X} /* --- end of "point_to_object" function --- */
  1232. X
  1233. END_OF_FILE
  1234. if test 31331 -ne `wc -c <'opener.c'`; then
  1235.     echo shar: \"'opener.c'\" unpacked with wrong size!
  1236. fi
  1237. # end of 'opener.c'
  1238. fi
  1239. if test -f 'pusher.c' -a "${1}" != "-c" ; then 
  1240.   echo shar: Will not clobber existing file \"'pusher.c'\"
  1241. else
  1242. echo shar: Extracting \"'pusher.c'\" \(20031 characters\)
  1243. sed "s/^X//" >'pusher.c' <<'END_OF_FILE'
  1244. X#define PUSHER
  1245. X#include "dink_sym.h"
  1246. X#include "dink_glb.h"
  1247. X
  1248. X#if (PROTOTYPE)
  1249. Xvoid pusher(int *n_arg)
  1250. X#else
  1251. Xvoid pusher(n_arg) 
  1252. Xint *n_arg ;
  1253. X#endif
  1254. X/********************************************************************/
  1255. X/*                                                                  */
  1256. X/*                  --- The Pusher Subroutine ---                   */
  1257. X/*                                                                  */
  1258. X/*  Software by Gary A. Allen, Jr. 14 June 1989,    Version: Mk 1.2 */
  1259. X/*           (c) Copyright 1988 by Gary A. Allen, Jr.               */
  1260. X/*                                                                  */
  1261. X/********************************************************************/
  1262. X{
  1263. Xregister int i ;
  1264. Xint n ;
  1265. Xstatic long delta_time, *time_arg = 0 ;
  1266. Xchar file_name[80] ;
  1267. X
  1268. X#if (PROTOTYPE)
  1269. Xvoid which_button(void) ; 
  1270. Xvoid lift_moves(void) ; 
  1271. Xvoid nothing_happens(void) ; 
  1272. Xvoid cubic(void) ; 
  1273. Xvoid no_gray(void) ; 
  1274. Xvoid no_switch(void) ; 
  1275. Xvoid no_cube(void) ; 
  1276. Xvoid describe(int) ;
  1277. Xint yes_no(void) ;
  1278. Xlong time(long*) ;
  1279. Xvoid ender(int) ;
  1280. X#else
  1281. Xlong time() ;
  1282. Xint yes_no() ;
  1283. X#endif
  1284. X/* pass the room pointer */
  1285. Xn = *n_arg ;
  1286. X
  1287. X/* reject an isolated "push" command */
  1288. Xif (tag[V_VERB_ONLY]) {
  1289. X    printf ("What exactly do you want me to push? \n");
  1290. X    return; 
  1291. X}
  1292. X
  1293. X/* Deal with the recorder */
  1294. Xif (tag[V_red_button] || tag[V_white_button] || tag[V_green_button]
  1295. X        || tag[V_orange_button]) {
  1296. X    if (Gong->Status == S_recorder) {
  1297. X    if (Recorder->Location == B_have) {
  1298. X        if (tag[V_red_button]) {
  1299. X            if (Recorder->Status != S_inactive) {
  1300. X                printf("--- The data recorder has stopped ") ;
  1301. X                if (Recorder->Status == S_playing)
  1302. X                    printf("playing. ---\n") ;
  1303. X                else printf("recording. ---\n") ;
  1304. X                Recorder->Status = S_inactive ;
  1305. X                fclose(fp) ;
  1306. X            }
  1307. X            else printf("Nothing happened!\n") ;
  1308. X            return ;
  1309. X        }
  1310. X        if (tag[V_white_button]) {
  1311. X            printf("Type in the file name for reading from:  ") ;
  1312. X            scanf("%s",file_name) ;
  1313. X            if ((fp = fopen(file_name,"r")) == 0) {
  1314. Xprintf("I could not open the file:  %s \n",file_name);
  1315. Xprintf("This file probably doesn't exit.\n") ;
  1316. Xprintf("Try pressing the white button again and using a different name.\n") ;
  1317. X            }
  1318. X            else Recorder->Status = S_playing ;
  1319. X            return ;
  1320. X        }
  1321. X        if (tag[V_green_button]) {
  1322. X            printf("Type in the file name for writing to:  ") ;
  1323. X            scanf("%s",file_name) ;
  1324. X            if ((fp = fopen(file_name,"w")) == 0) {
  1325. Xprintf ("I could not open the file:  %s \n",file_name);
  1326. Xprintf("Try pressing the green button again and using a different name.\n") ;
  1327. X            }
  1328. X            else {
  1329. X                Recorder->Status = S_recording ;
  1330. X                printf("--- Recording ---\n") ;
  1331. X            }
  1332. X            return ;
  1333. X        }
  1334. Xif (tag[V_orange_button]) {
  1335. X    printf("Dinkum's clock has been stopped.\n\n") ;
  1336. X    delta_time = time(time_arg) - (start_time + 3300L) ;
  1337. X
  1338. X    for (;;) {
  1339. X        printf("Do you wish to resume playing Dinkum?\n") ;
  1340. X        if (yes_no()) {
  1341. X            start_time = time(time_arg) - (delta_time + 3300L) ;
  1342. Xprintf("\n+----------------------------------------------------------+\n") ;
  1343. Xprintf("| Dinkum's clock is restarted with the same time remaining |\n") ;
  1344. Xprintf("| as when it was halted.                                   |\n") ;
  1345. Xprintf("+----------------------------------------------------------+\n\n");
  1346. X            describe(n) ;
  1347. X            return ;
  1348. X        }
  1349. X        else {
  1350. X            printf("Do you wish to quit Dinkum?\n") ;
  1351. X            if (yes_no()) ender(F_quit) ;
  1352. X        }
  1353. X    }
  1354. X}
  1355. X    }
  1356. X    else printf("You don't have the recorder in your possession!\n") ;
  1357. X    }
  1358. X    else printf("I have never seen a button of that color.\n") ;
  1359. X    return ;
  1360. X}
  1361. X
  1362. Xswitch (n) {
  1363. X/* Lift entrance at the ground level */
  1364. Xcase R_lift_entr:
  1365. X    if (tag[V_gray_button]) {
  1366. X        no_gray() ;
  1367. X        return ;
  1368. X    }
  1369. X    if (!tag[V_button]) {
  1370. X        if (!tag[V_blue_button]) {
  1371. X            printf ("I don't see why I should push that! \n");
  1372. X        }
  1373. X        else nothing_happens() ;
  1374. X        return ;
  1375. X    }
  1376. X    if (Lift_door->Status == S_flashing ) {
  1377. Xprintf ("You push the call button and there is a loud \"whirr\" from ");
  1378. Xprintf ("an electric motor. \nThe massive steel doors slide open ");
  1379. Xprintf ("revealing a huge lift that could hold \ntwenty men at once. ");
  1380. Xprintf ("The way is now open for you to enter. \n");
  1381. X        Lift_door->Status = S_open ;
  1382. X        room[R_lift_entr][2] = R_lift_inside ;
  1383. X        break ;
  1384. X    }
  1385. X    else {
  1386. X        if (Lift_door->Status == S_open) {
  1387. Xprintf ("You push the call button and there is a loud \"whirr\" from ");
  1388. Xprintf ("an electric motor. \nThe massive steel doors slide shut, ");
  1389. Xprintf ("closing off access to the lift.\n");
  1390. X            Lift_door->Status = S_flashing ;
  1391. X            room[R_lift_entr][2] = R_WALL ;
  1392. X            break ;
  1393. X        }
  1394. X        else {
  1395. Xprintf("You pushed the lift call button, but nothing happened.\n");
  1396. Xprintf("I think the electrical power has been turned off at the\n") ;
  1397. Xprintf("circuit breaker.\n") ;
  1398. X        break ;
  1399. X        }
  1400. X    }
  1401. X/* Lift Compartment */
  1402. Xcase R_lift_inside:
  1403. X    if (tag[V_gray_button]) {
  1404. X        no_gray() ;
  1405. X        return ;
  1406. X    }
  1407. X    /* scan push sentence */
  1408. X    /* zero level */
  1409. X    if (tag[V_0]) {
  1410. X        if (Lift->Status == L0) {
  1411. Xprintf ("You pushed the flashing button, but nothing happened.\n");
  1412. X            break ;
  1413. X        }
  1414. Xprintf ("The steel doors slam shut and you feel heavy as the lift ");
  1415. Xprintf ("accelerates \nupwards.  Finally the lift jerks to a halt ");
  1416. Xprintf ("and the doors whirr open.  \nSunlight is streaming in. ");
  1417. Xprintf ("Once again you are breathing the fresh air.\n");
  1418. X        Lift->Status = L0 ;
  1419. X        room[R_lift_inside][3] = R_lift_entr;
  1420. X        room[R_lift_inside][7] = R_lift_entr;
  1421. X        return ;
  1422. X    }
  1423. X    /* forty-ninth level */
  1424. X    if (tag[V_49]) {
  1425. X        if (Lift->Status == L49) {
  1426. Xprintf ("You pushed the forty-nine button, but nothing happened.\n");
  1427. X            return ;
  1428. X        }    
  1429. X        Lift->Status = L49 ;
  1430. X        room[R_lift_inside][3] = R_L49_entr;
  1431. X        room[R_lift_inside][7] = R_L49_entr;
  1432. X        lift_moves() ;
  1433. X        return ;
  1434. X    }
  1435. X    /* sixty-seventh level */
  1436. X    if (tag[V_67]) {
  1437. X        if (Lift->Status == L67) {
  1438. Xprintf ("You pushed the sixty-seven button, but nothing happened.\n");
  1439. X            return ;
  1440. X        }    
  1441. X        Lift->Status = L67;
  1442. X        room[R_lift_inside][3] = R_L67_entr;
  1443. X        room[R_lift_inside][7] = R_L67_entr;
  1444. X        lift_moves() ;
  1445. X        return ;
  1446. X    }
  1447. X
  1448. X    /* eighty-second level */
  1449. X    if (tag[V_82]) {
  1450. X        if (Lift->Status == L82) {
  1451. Xprintf ("You pushed the eighty-two button, but nothing happened.\n");
  1452. X            return ;
  1453. X        }    
  1454. X        Lift->Status  = L82;
  1455. X        room[R_lift_inside][3] = R_L82_entr;
  1456. X        room[R_lift_inside][7] = R_L82_entr;
  1457. Xprintf ("The steel doors slam shut and you feel a sense of ");
  1458. Xprintf ("weightlessness as \nthe lift plummets down the mine shaft. ");
  1459. Xprintf ("Finally the lift comes to a halt \n");
  1460. Xprintf ("and the doors whirr open. \n");
  1461. X        return ;
  1462. X    }
  1463. X    if (tag[V_blue_button]) {
  1464. X        nothing_happens() ;
  1465. X        return ;
  1466. X    }
  1467. Xprintf ("This lift can go only to levels 0, 49, 67, or 82 \n");
  1468. X    return ;
  1469. X
  1470. X/* inside the closet at the Iranian Parliament */
  1471. Xcase R_closet:
  1472. X    if (tag[V_gray_button]) {
  1473. X        no_gray() ;
  1474. X        return ;
  1475. X    }
  1476. X    if (tag[V_blue_button] || tag[V_button]) {
  1477. X        /* Is the command for the black cube */
  1478. X        if (Cube->Location != B_have) {
  1479. X            no_switch() ;
  1480. X        }
  1481. Xprintf("There is a bright flash of light! Then suddenly you are\n");
  1482. Xprintf("back in the hexagon chamber of the ancient spaceship.\n\n");
  1483. X        *n_arg = R_transporter ;
  1484. X    }
  1485. X    else no_switch() ;
  1486. X    return ;
  1487. X
  1488. X/* the transporter control panel room */
  1489. Xcase R_panel:
  1490. X    if (tag[V_button]) {
  1491. X        which_button() ;
  1492. X        return;
  1493. X    }
  1494. X    if (tag[V_blue_button]) {
  1495. X        if (Cube->Location==B_have) cubic() ;
  1496. X        else no_cube() ;
  1497. X        return ;
  1498. X    }
  1499. X    if (tag[V_gray_button]) {
  1500. X        if (!Transporter->Status) {
  1501. Xprintf("Lots of the \"Sanskrit\" text is flashing by on the display\n");
  1502. Xprintf("panel's CRTs.  There is a whirring noise coming out of the\n");
  1503. Xprintf("equipment around you which is increasing in both loudness\n");
  1504. Xprintf("and pitch. You've turned something on, that's for sure!\n") ;
  1505. X            Transporter->Status = TRUE ;
  1506. X        }
  1507. X        else nothing_happens() ;
  1508. X        return ;
  1509. X    }
  1510. Xdefault:
  1511. X    /* Semtex explosive detector */
  1512. X    if (tag[V_detector] || tag[V_yellow_button] ||
  1513. X        ((Cube->Location != B_have) &&
  1514. X        (Detector->Location == B_have))) { 
  1515. X            if (Detector->Location == B_have) {
  1516. X                /* press Semtex detector button */
  1517. Xprintf("You press the button on the Semtex explosive detector and\n");
  1518. X                for (i = 0; i <= 9; i++) {
  1519. X                    if ((n == i+207)||(n == i+228)) {
  1520. Xif (room[227-i][M_rm_type] == T_lethal) {
  1521. X    printf("hear a \"beep, beep, beep\".\n") ;
  1522. X    return ;
  1523. X}
  1524. X                    }
  1525. X                }
  1526. X                printf("the yellow light flashed.\n") ;
  1527. X            }
  1528. X            else {
  1529. Xprintf("You don't have the detector in your possession.\n") ;
  1530. X            }
  1531. X            return ;
  1532. X        }
  1533. X        /* Transporter return device */
  1534. X        if (Cube->Location == B_have) {
  1535. X            if ((Detector->Location == B_have) && 
  1536. X                (!tag[V_blue_button])) {
  1537. X                    which_button() ;
  1538. X                    return;
  1539. X            }
  1540. X            cubic() ;
  1541. X            return ;
  1542. X        }
  1543. X        if (tag[V_blue_button]) {
  1544. X            no_cube() ;
  1545. X            return ;
  1546. X        }
  1547. X        if (tag[V_gray_button]) {
  1548. X            no_gray() ;
  1549. X            return ;
  1550. X        }
  1551. X
  1552. Xprintf ("You can push as much as you like, but nothing will happen.\n");
  1553. X} /* end of the switch block */
  1554. Xreturn; 
  1555. X
  1556. X} /* --- end of the "pusher" subroutine --- */
  1557. X
  1558. X#if (PROTOTYPE)
  1559. Xvoid which_button(void) 
  1560. X#else
  1561. Xvoid which_button() 
  1562. X#endif
  1563. X/********************************************************************/
  1564. X/*                                                                  */
  1565. X/*  Software by Gary A. Allen, Jr. 8 December 1992  Version: Mk 1.0 */
  1566. X/*           (c) Copyright 1992 by Gary A. Allen, Jr.               */
  1567. X/*                                                                  */
  1568. X/********************************************************************/
  1569. X{
  1570. Xprintf("Which button do you want me to push? \n") ;
  1571. Xreturn; 
  1572. X} /* --- end of the "which_button" subroutine --- */
  1573. X
  1574. X#if (PROTOTYPE)
  1575. Xvoid lift_moves(void) 
  1576. X#else
  1577. Xvoid lift_moves() 
  1578. X#endif
  1579. X/********************************************************************/
  1580. X/*                                                                  */
  1581. X/*  Software by Gary A. Allen, Jr. 8 December 1992  Version: Mk 1.0 */
  1582. X/*           (c) Copyright 1992 by Gary A. Allen, Jr.               */
  1583. X/*                                                                  */
  1584. X/********************************************************************/
  1585. X{
  1586. Xprintf ("The steel doors slam shut and you feel the vibration of ");
  1587. Xprintf ("the lift \nmoving in its shaft. Finally the lift jerks ");
  1588. Xprintf ("to a halt and the doors whirr open. \n");
  1589. Xreturn; 
  1590. X} /* --- end of the "lift_moves" subroutine --- */
  1591. X
  1592. X#if (PROTOTYPE)
  1593. Xvoid nothing_happens(void) 
  1594. X#else
  1595. Xvoid nothing_happens() 
  1596. X#endif
  1597. X/********************************************************************/
  1598. X/*                                                                  */
  1599. X/*  Software by Gary A. Allen, Jr. 8 December 1992  Version: Mk 1.0 */
  1600. X/*           (c) Copyright 1992 by Gary A. Allen, Jr.               */
  1601. X/*                                                                  */
  1602. X/********************************************************************/
  1603. X{
  1604. Xprintf("Nothing happens!\n");
  1605. Xreturn; 
  1606. X} /* --- end of the "nothing_happens" subroutine --- */
  1607. X#if (PROTOTYPE)
  1608. Xvoid cubic(void) 
  1609. X#else
  1610. Xvoid cubic() 
  1611. X#endif
  1612. X/********************************************************************/
  1613. X/*                                                                  */
  1614. X/*              Press cube button in wrong place.                   */
  1615. X/*                                                                  */
  1616. X/*  Software by Gary A. Allen, Jr. 8 December 1992  Version: Mk 1.0 */
  1617. X/*           (c) Copyright 1992 by Gary A. Allen, Jr.               */
  1618. X/*                                                                  */
  1619. X/********************************************************************/
  1620. X{
  1621. Xprintf("You press the button on the cube but nothing happens.\n");
  1622. Xreturn; 
  1623. X} /* --- end of the "cubic" subroutine --- */
  1624. X#if (PROTOTYPE)
  1625. Xvoid no_gray(void) 
  1626. X#else
  1627. Xvoid no_gray() 
  1628. X#endif
  1629. X/********************************************************************/
  1630. X/*                                                                  */
  1631. X/*  Software by Gary A. Allen, Jr. 8 December 1992  Version: Mk 1.0 */
  1632. X/*           (c) Copyright 1992 by Gary A. Allen, Jr.               */
  1633. X/*                                                                  */
  1634. X/********************************************************************/
  1635. X{
  1636. Xprintf("I see no gray button to push!\n");
  1637. Xreturn; 
  1638. X} /* --- end of the "no_gray" subroutine --- */
  1639. X#if (PROTOTYPE)
  1640. Xvoid no_switch(void) 
  1641. X#else
  1642. Xvoid no_switch() 
  1643. X#endif
  1644. X/********************************************************************/
  1645. X/*                                                                  */
  1646. X/*  Software by Gary A. Allen, Jr. 8 December 1992  Version: Mk 1.0 */
  1647. X/*           (c) Copyright 1992 by Gary A. Allen, Jr.               */
  1648. X/*                                                                  */
  1649. X/********************************************************************/
  1650. X{
  1651. Xprintf("There is nothing here with a push button switch.\n");
  1652. Xreturn; 
  1653. X} /* --- end of the "no_switch" subroutine --- */
  1654. X#if (PROTOTYPE)
  1655. Xvoid no_cube(void) 
  1656. X#else
  1657. Xvoid no_cube() 
  1658. X#endif
  1659. X/********************************************************************/
  1660. X/*                                                                  */
  1661. X/*  Software by Gary A. Allen, Jr. 8 December 1992  Version: Mk 1.0 */
  1662. X/*           (c) Copyright 1992 by Gary A. Allen, Jr.               */
  1663. X/*                                                                  */
  1664. X/********************************************************************/
  1665. X{
  1666. Xprintf("You don't have the black cube with the blue button in your") ;
  1667. Xprintf(" possession!\n") ;
  1668. Xreturn; 
  1669. X} /* --- end of the "no_cube" subroutine --- */
  1670. X#if (PROTOTYPE)
  1671. Xvoid switcher(int n)
  1672. X#else
  1673. Xvoid switcher(n) 
  1674. Xint n ;
  1675. X#endif
  1676. X/********************************************************************/
  1677. X/*                                                                  */
  1678. X/*                --- The Switcher Subroutine ---                   */
  1679. X/*                                                                  */
  1680. X/*                                                                  */
  1681. X/*  Software by Gary A. Allen, Jr. 29 October 1989  Version: Mk 1.4 */
  1682. X/*           (c) Copyright 1988 by Gary A. Allen, Jr.               */
  1683. X/*                                                                  */
  1684. X/********************************************************************/
  1685. X{
  1686. Xint flag_switch, flag_rifle_md ;
  1687. X
  1688. X#if (PROTOTYPE)
  1689. Xvoid dialer(int) ;
  1690. X#endif
  1691. X
  1692. X/* deal with single verb commands */
  1693. Xif (tag[V_VERB_ONLY]) {
  1694. X    if (tag[V_turn]) printf("Turn what?\n") ;
  1695. X    if (tag[V_set]) printf("Set what?\n") ;
  1696. X    if (tag[V_select]) printf("Select what?\n") ;
  1697. X    if (tag[V_switch]) printf("Switch what?\n") ;
  1698. X    return ;
  1699. X}
  1700. X
  1701. X/* Deal with changing the safety on the rifle */
  1702. Xif (tag[V_safety]) {
  1703. X    if (Rifle->Location == B_have) {
  1704. X        if (tag[V_off]) {
  1705. X            rifle_flag = F_single ;
  1706. Xprintf("The M16 rifle is set to single shot mode ") ;
  1707. Xprintf("with the safey off.\n") ;
  1708. X            return ;
  1709. X        }
  1710. X        if (tag[V_on]) {
  1711. X            rifle_flag = F_safety ;
  1712. Xprintf("The M16 rifle's safety has been turned on.\n") ;
  1713. X            return ;
  1714. X        }
  1715. X        printf("How do you want the safety set?\n") ;
  1716. X    }
  1717. X    else printf("You're not holding the rifle!\n") ;
  1718. X    return ;
  1719. X}
  1720. X
  1721. X/* deal with special case "turn (safe) dial 0 49 67 82" */
  1722. Xif (tag[V_turn] && tag[V_dial] && (!tag[V_rifle])) {
  1723. X    dialer(n) ;
  1724. X    return ;
  1725. X}
  1726. X
  1727. X/* deal with special case "turn safe ..." */
  1728. Xif (tag[V_turn] && (!tag[V_dial]) && tag[V_safe]) {
  1729. X    if (n != R_office_mang) {
  1730. X        printf("There is no safe here to turn!\n") ;
  1731. X        return  ;
  1732. X    }
  1733. Xprintf("Since the safe is set in a concrete wall, turning it would\n");
  1734. Xprintf("be rather difficult!  Perhaps I should turn the safe's\n") ;
  1735. Xprintf("dial instead?\n") ;
  1736. X    return ;
  1737. X}
  1738. X
  1739. X/* initialize the local switches */
  1740. Xflag_switch = F_no_argument ; 
  1741. Xif (tag[V_on]) flag_switch = TRUE ;
  1742. Xif (tag[V_off]) flag_switch = FALSE ;
  1743. Xif (verb == V_light) flag_switch = TRUE ;
  1744. X
  1745. Xflag_rifle_md = F_no_argument ;
  1746. Xif (tag[V_safe]) flag_rifle_md = F_safety ;
  1747. Xif (tag[V_triple]) flag_rifle_md = F_triple ;
  1748. Xif (tag[V_single]) flag_rifle_md = F_single ;
  1749. Xif (tag[V_auto]) flag_rifle_md = F_auto ;
  1750. X
  1751. Xif ((flag_switch == F_no_argument)&&(flag_rifle_md == F_no_argument)) {
  1752. Xprintf("You will have to be a little more specific than that. \n") ;
  1753. X    return ;
  1754. X}
  1755. X
  1756. X/* see if it is a simple "on/off" power equipment switch command */
  1757. Xif ((!tag[V_torch])&&(!tag[V_rifle])&&
  1758. X    (flag_rifle_md == F_no_argument)) {
  1759. Xif (n == R_store_room) {
  1760. X    /* The circuit breaker is switched off */
  1761. X    if (flag_switch == FALSE) {
  1762. X    if (Circuit_breaker->Status) {
  1763. Xprintf ("As you pull the switch lever, there is a bright blue \n");
  1764. Xprintf ("arc and then all of the lights go out. \n");
  1765. X        Circuit_breaker->Status = FALSE ;
  1766. X        Lift_door->Status = S_closed ;
  1767. X        room[R_lift_entr][2] = R_WALL ;
  1768. X    }
  1769. X    else printf ("The circuit breaker is already turned off! \n");
  1770. X    return;
  1771. X    }
  1772. X    /* The circuit breaker is switched on */
  1773. X    if (flag_switch == TRUE) {
  1774. X    if (Circuit_breaker->Status) {
  1775. X    printf ("The circuit breaker is already turned on! \n");
  1776. X    }
  1777. X    else {
  1778. Xprintf ("As you pull the switch lever, there is a loud \"CLUNK\" \n");
  1779. Xprintf ("and you see a POWER ON light glowing. \n");
  1780. X        Circuit_breaker->Status = TRUE ;
  1781. X        Lift_door->Status = S_flashing ;
  1782. X    }
  1783. X    return;
  1784. X    }
  1785. X}          
  1786. X
  1787. X/* Deal with a garbage command */
  1788. Xprintf("I don't understand what you want me to switch. \n") ;
  1789. Xreturn ;
  1790. X} /* end of the simple "on/off" switch group */
  1791. X
  1792. X/* the switch command is to select an M16 rifle firing mode */
  1793. Xif (tag[V_rifle]) {
  1794. X    if (Rifle->Location == B_have) {
  1795. X
  1796. X        /* turn the rifle on naively */
  1797. X        if ((flag_switch==TRUE)||
  1798. X               ((flag_rifle_md==F_safety)&&(flag_switch==FALSE))) {
  1799. X            if (rifle_flag != F_safety) {
  1800. Xprintf("The rifle's safety is already off! \n") ; 
  1801. X                return;
  1802. X            }
  1803. X            rifle_flag = F_single ;
  1804. Xprintf("The M16 rifle has been set to single shot mode. \n") ;
  1805. X            return ;
  1806. X        } 
  1807. X/* turn on the safety */
  1808. X    if ((flag_switch==FALSE)||
  1809. X      ((flag_rifle_md==F_safety)&&((flag_switch==TRUE)||
  1810. X      (flag_switch==F_no_argument)))) {
  1811. X                if (rifle_flag == F_safety) {
  1812. Xprintf("The rifle's safety is already on! \n") ; 
  1813. X                return;
  1814. X                }
  1815. X            rifle_flag = F_safety ;
  1816. Xprintf("The M16 rifle's safety has now been turned on. \n") ;
  1817. X            return ;
  1818. X    } 
  1819. X        /* select single shot mode */  
  1820. X        if (flag_rifle_md == F_single) {
  1821. X            if (rifle_flag == F_single) {
  1822. Xprintf("The rifle has already been set to single shot mode.\n");
  1823. X                return;
  1824. X            }
  1825. X            rifle_flag = F_single ;
  1826. Xprintf("The M16 rifle has been set to single shot mode. \n") ;
  1827. X            return ;
  1828. X        } 
  1829. X        /* select triple fire mode */  
  1830. X        if (flag_rifle_md == F_triple) {
  1831. X            if (rifle_flag == F_triple) {
  1832. Xprintf("The rifle has already been set to triple fire mode.\n");
  1833. X                return;
  1834. X            }
  1835. X            rifle_flag = F_triple ;
  1836. Xprintf("The M16 rifle has been set to triple fire mode. \n") ;
  1837. X            return ;
  1838. X        } 
  1839. X        /* select to fully automatice mode */
  1840. X        if (flag_rifle_md == F_auto) {
  1841. X            if (rifle_flag == F_auto) {
  1842. Xprintf("The rifle has already been set to fully automatic.\n");
  1843. X                return;
  1844. X            }
  1845. X            rifle_flag = F_auto ;
  1846. Xprintf("The M16 rifle has been set to fully automatic. \n") ;
  1847. X            return ;
  1848. X        } 
  1849. X    }
  1850. X    /* This is the rifle nonpossession error handler */
  1851. X    else {
  1852. Xprintf("You don't have a rifle in your possession! \n") ;
  1853. X        return ;
  1854. X    }
  1855. X} /* end of the rifle mode switching block */
  1856. X
  1857. X/* the switch command is to turn the torch off or on. */
  1858. Xif (tag[V_torch]) {
  1859. X    if (Torch->Location == B_have) {
  1860. X        /* "switch torch on" command */
  1861. X        if (flag_switch==TRUE) {
  1862. X            if (Torch->Status) {
  1863. Xprintf("The torch is already turned on.\n") ;
  1864. X                return ;
  1865. X            }
  1866. Xprintf("An intense beam of light is projected from the torch.\n") ;
  1867. X            Torch->Status = TRUE ;
  1868. X            return ;
  1869. X        }
  1870. X        /* "switch torch off" command */
  1871. X        if (flag_switch==FALSE) {
  1872. X            if (!Torch->Status) {
  1873. Xprintf("The torch isn't switched on.\n") ;
  1874. X                return ;
  1875. X            }
  1876. Xprintf("The torch switches off with a \"click\".\n") ;
  1877. X            Torch->Status = FALSE ;
  1878. X            return ;
  1879. X        }
  1880. X    }
  1881. Xprintf("You don't have a torch in your possession to switch! \n") ;
  1882. X    return ;
  1883. X}
  1884. X
  1885. X} /* --- end of the "switcher" subroutine --- */
  1886. X
  1887. X#if (PROTOTYPE)
  1888. Xvoid new_score(void) 
  1889. X#else
  1890. Xvoid new_score() 
  1891. X#endif
  1892. X/* This subroutine calculates the score based on treasure in the safe */
  1893. X{
  1894. Xregister int i ;
  1895. XOBJECT_STRUCT *pnt ;
  1896. X
  1897. Xscore = 0 ;
  1898. Xpnt = object ;
  1899. Xfor (i = 0; i < Objcnt; i++) if ((pnt++)->Location == B_in_safe)  {
  1900. X        score += (pnt - 1)->Value ;
  1901. X} ;
  1902. X} /* --- end of the "new_score" subroutine --- */
  1903. X
  1904. END_OF_FILE
  1905. if test 20031 -ne `wc -c <'pusher.c'`; then
  1906.     echo shar: \"'pusher.c'\" unpacked with wrong size!
  1907. fi
  1908. # end of 'pusher.c'
  1909. fi
  1910. echo shar: End of archive 4 \(of 7\).
  1911. cp /dev/null ark4isdone
  1912. MISSING=""
  1913. for I in 1 2 3 4 5 6 7 ; do
  1914.     if test ! -f ark${I}isdone ; then
  1915.     MISSING="${MISSING} ${I}"
  1916.     fi
  1917. done
  1918. if test "${MISSING}" = "" ; then
  1919.     echo You have unpacked all 7 archives.
  1920.     rm -f ark[1-9]isdone
  1921. else
  1922.     echo You still need to unpack the following archives:
  1923.     echo "        " ${MISSING}
  1924. fi
  1925. ##  End of shell archive.
  1926. exit 0
  1927.