home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume15 / dinkum / part05 < prev    next >
Encoding:
Internet Message Format  |  1993-01-26  |  48.5 KB

  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: v15i025:  dinkum - australian text adventure game, Part05/06
  5. Message-ID: <3983@master.CNA.TEK.COM>
  6. Date: 29 Nov 92 20:31:58 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 1867
  9. Approved: billr@saab.CNA.TEK.COM
  10. Xref: uunet comp.sources.games:1524
  11.  
  12. Submitted-by: Gary Allen <gary@sun.mech.uq.oz.au>
  13. Posting-number: Volume 15, Issue 25
  14. Archive-name: dinkum/Part05
  15. Environment: Unix, DOS
  16.  
  17.  
  18.  
  19. #! /bin/sh
  20. # This is a shell archive.  Remove anything before this line, then unpack
  21. # it by saving it into a file and typing "sh file".  To overwrite existing
  22. # files, type "sh file -c".  You can also feed this as standard input via
  23. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  24. # will see the following message at the end:
  25. #        "End of archive 5 (of 6)."
  26. # Contents:  actor.c opener.c parse.c
  27. # Wrapped by billr@saab on Sun Nov 29 12:25:49 1992
  28. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  29. if test -f 'actor.c' -a "${1}" != "-c" ; then 
  30.   echo shar: Will not clobber existing file \"'actor.c'\"
  31. else
  32. echo shar: Extracting \"'actor.c'\" \(18250 characters\)
  33. sed "s/^X//" >'actor.c' <<'END_OF_FILE'
  34. X#define ACTOR
  35. X#include "dink_sym.h"
  36. X#include "dink_glb.h"
  37. Xvoid actor(n)
  38. X/********************************************************************/
  39. X/*                                                                  */
  40. X/*  Software by Gary A. Allen, Jr.  12 March 1989,  Version: Mk 1.1 */
  41. X/*           (c) Copyright 1989 by Gary A. Allen, Jr.               */
  42. X/*                                                                  */
  43. X/********************************************************************/
  44. Xint n ;
  45. X{
  46. X#ifdef __TURBOC__
  47. Xvoid objector(int) ;
  48. X#endif
  49. X
  50. Xint i ;
  51. Xstatic int sw_door_kick = FALSE ;
  52. X
  53. Xswitch(n) {
  54. X
  55. X    /* mine elevator */
  56. X    case R_lift_entr:
  57. X        if (room[R_lift_entr][M_rm_status] == S_closed) {
  58. Xprintf("The lift doors are closed and the lift call button ");
  59. Xprintf("is not glowing. It \nseems the electrical power has ");
  60. Xprintf("been turned off at the main switch. \n"); }
  61. X        if (room[R_lift_entr][M_rm_status] == S_flashing) {
  62. Xprintf("The lift doors are closed.  However the call button");
  63. Xprintf(" is flashing. There \nis the sound of electrical equipment ");
  64. Xprintf("humming within the mine lift. \n"); }
  65. X        if (room[R_lift_entr][M_rm_status] == S_open) {
  66. Xprintf("The lift doors are standing open. \n");
  67. X        }
  68. X        break;
  69. X    /* office building door */
  70. X    case R_office_entr:
  71. X        switch(room[R_office_entr][M_rm_status]) {
  72. X            case S_open:
  73. Xprintf("      --- The office front door is open. --- \n");
  74. X                break;
  75. X            case S_kicked:
  76. X                if (!sw_door_kick) {
  77. Xprintf("The lock of the front door has been shot at several times.\n"); 
  78. Xprintf("The door itself has been kicked in and is broken off at\n") ;
  79. Xprintf("the hinges.  The passage way is free to enter.\n");
  80. X                sw_door_kick = TRUE ;
  81. X                }
  82. X                else {
  83. Xprintf("The front door of the office has been kicked in. \n") ;
  84. X                }
  85. X                break ;
  86. X            default:
  87. Xprintf("The office has a front door with a sun faded sign \n"); 
  88. Xprintf("upon which is written:  \"Sorry, We are CLOSED\". \n");
  89. Xprintf("      --- The office door is shut. --- \n");
  90. X                break ;
  91. X        }
  92. X        break ;
  93. X    /* Site Managers Office */
  94. X    case R_office_mang:
  95. X        if (room[R_office_mang][M_rm_status] == S_closed) {
  96. Xprintf("On the wall is a picture of a platypus wearing a hat with");
  97. X        printf(" corks \ndangling from the hat's rim.\n");
  98. X            break;
  99. X        }
  100. Xif ((room[R_office_mang][M_rm_status] == S_revealed)||
  101. X    (room[n][M_rm_status] ==S_dialed)) {
  102. Xprintf("Before you is a picture hinged to the wall that has been ");
  103. Xprintf("swung \nopen revealing a closed combination dial wall safe.\n");
  104. X            break;}
  105. X        if (room[n][M_rm_status] == S_open) {
  106. Xprintf("Before you is a picture hinged to the wall that has been");
  107. Xprintf(" swung \nout revealing a wall safe with an open door.\n");
  108. X        for (i=0; i <= objcnt; i++) {
  109. X            if (object[i][J_loc] == B_in_safe) 
  110. X                goto safelist;
  111. X        }
  112. X        if (gleep_safe != 0) {
  113. Xprintf("There is nothing in the safe except ") ;
  114. X            if (gleep_safe == 1) 
  115. X                printf("a single gleep.\n") ;
  116. X            else
  117. X                printf("%d gleeps.\n",gleep_safe) ;
  118. X            break ;
  119. X        }
  120. X        printf("---The safe is empty.--- \n");
  121. X        break ;
  122. Xsafelist:
  123. X        printf ("You see the following inside the safe: \n");
  124. X        for (i=0; i <= objcnt; i++) {
  125. X            if (object[i][J_loc] == B_in_safe) {
  126. X                printf ("        ");
  127. X                objector(i) ;
  128. X                printf ("\n") ;
  129. X            }
  130. X        }                
  131. X        if (gleep_safe != 0) {
  132. X            printf ("        ");
  133. X            if (gleep_safe == 1) 
  134. X                printf("one gleep\n") ;
  135. X            else
  136. X                printf("%d gleeps\n",gleep_safe) ;
  137. X        }
  138. X            break;
  139. X        }
  140. X
  141. X    /* store room */
  142. X    case R_store_room:
  143. Xprintf("There is a 1500 Volt circuit breaker box on the wall");
  144. X        if (room[n][M_rm_status] == S_off) 
  145. Xprintf(" which has \na switch set in the \"off\" position. \n"); 
  146. X        else
  147. Xprintf(" which has \na switch set in the \"on\" position. \n"); 
  148. X        break;
  149. X
  150. X    /* lift compartment */
  151. X    case R_lift_inside:
  152. X        if (room[n][M_rm_status] == S_L0) 
  153. Xprintf("The level button with the number zero is flashing. \n"); 
  154. X        if (room[n][M_rm_status] == S_L49) 
  155. Xprintf("The level button with the number forty-nine is flashing. \n"); 
  156. X        if (room[n][M_rm_status] == S_L67) 
  157. Xprintf("The level button with the number sixty-seven is flashing. \n");
  158. X        if (room[n][M_rm_status] == S_L82) 
  159. Xprintf("The level button with the number eighty-two is flashing. \n"); 
  160. X        break;
  161. X
  162. X} 
  163. X} /* --- end of subroutine "actor"--- */
  164. X
  165. Xvoid objector(i)
  166. Xint i ;
  167. X{
  168. Xstatic char *obj[] = {
  169. X"an empty can of Fourex beer",
  170. X"a cigarette butt",
  171. X"an empty bottle of Black Swan Lager",
  172. X"an old doormat with \"ACME Gold Mines Ltd.\" written on it",
  173. X"a large brass key",
  174. X"a ripped and bent up umbrella",
  175. X"a two meter length of fishing tackle without a hook",
  176. X"a broken drill bit",
  177. X"a very old but detailed map of the ACME Mine",       /*  5  */
  178. X"a fragment of a map showing the ACME Mine",
  179. X"a sheet of paper with some writing on it",
  180. X"a gold bar weighing ten kilograms",
  181. X"a hydraulic jack which is rusted solid",
  182. X"a large stick of dynamite",
  183. X"an M16 ammo clip designed to hold up to 200 rounds",
  184. X"a fountain pen which is dried up and useless",
  185. X"an orange M16 ammo clip which is glowing a faint pale blue",
  186. X"a mechanical pencil without any leads",
  187. X"an unloaded, fully automatic M16 infantry rifle",    /*  10 */
  188. X"a piece of copper wire",
  189. X"a short length of galvanized iron pipe",
  190. X"a blasting cap with 20 cm. of fuse attached",
  191. X"a box of \"Red Head\" matches",
  192. X"a diamond ring with a three carat flawless blue diamond",
  193. X"a can opener",
  194. X"a bright red ruby the size of an egg",               /*  15 */
  195. X"an antique sterling silver teapot with \"N.K.\" engraved on it",
  196. X"a silver Syracusian Dekadrachma coin",
  197. X"an electrical extension cord",
  198. X"a $100 dollar bill",
  199. X"an autographed photo of Sir Joh",
  200. X"an old folding chair",
  201. X"a burned out light bulb",
  202. X"a packet containing atropine pills",
  203. X"a high quality artificial saphire",
  204. X"a huge uncut emerald",
  205. X"an oily rag",
  206. X"a burned out fluorescent tube",
  207. X"a filthy worn out carpet",
  208. X"a branch from a gum tree",
  209. X"a thick airmail letter, marked \"Postage Due\"",
  210. X"a cork from a wine bottle",
  211. X"a high intensity battery powered torch",
  212. X"an old cockroach trap",
  213. X"an empty butane cigarette lighter",
  214. X"a small black cube with a blue push button on one side", 
  215. X"an ancient and priceless gong clapper made of ivory and gold",
  216. X"a Semtex explosive detector with a push button switch",
  217. X"a broken shoe lace",
  218. X"a dirty old comb",
  219. X"a Cornetto ice cream cone wrapper",
  220. X"a bald automobile tyre",
  221. X"an empty broken egg shell",
  222. X"a broken piece of brick",
  223. X"a one meter length of rope",
  224. X"an empty package of Stradbroke cigarettes",
  225. X"a broken automobile fan belt",
  226. X"a used automobile oil filter",
  227. X"a short piece of string"
  228. X};
  229. X
  230. X/* Deal with transformed objects */
  231. Xif (object[i][J_type] == Z_alias) {
  232. X    if (i == O_rifle) {
  233. Xprintf("an M16 infantry rifle with an ammunition clip inserted") ;
  234. X        return ;
  235. X    }
  236. X    if (i == O_dynamite) {
  237. Xprintf("a large stick of dynamite with a fuse type blasting cap") ;
  238. X        return ;
  239. X    }
  240. X}
  241. Xelse printf("%s",obj[i]) ;
  242. X} /* --- end of subroutine "objector"--- */
  243. Xvoid killer(n)
  244. X/********************************************************************/
  245. X/*                                                                  */
  246. X/*  Software by Gary A. Allen, Jr. 22 January 1989  Version: Mk 1.3 */
  247. X/*           (c) Copyright 1989 by Gary A. Allen, Jr.               */
  248. X/*                                                                  */
  249. X/********************************************************************/
  250. Xint n ;
  251. X{
  252. X#ifdef __TURBOC__
  253. Xvoid ender(int) ;
  254. X#endif
  255. Xregister int i, j ;
  256. Xint hits, j_point, i_10, i_fract ;
  257. Xint sw_kill, target_k_flag, sw_see, sw_other_object ;
  258. Xstatic int sw_hurt = FALSE ;
  259. X
  260. Xif (tag[V_VERB_ONLY]&&(verb == V_kill)) {
  261. Xprintf("It may be obvious to you, but you are going to have to tell\n");
  262. Xprintf("me exactly what it is you want to have killed, and \n") ;
  263. Xprintf("with what sort of weapon. \n") ;
  264. X    return;
  265. X}
  266. X
  267. X/* set the subroutine local flags */
  268. Xif (verb == V_kill) sw_kill = FALSE ;
  269. Xif (verb == V_shoot) sw_kill = TRUE;
  270. Xtarget_k_flag = V_NULL ;
  271. Xsw_see =  FALSE ;
  272. Xsw_other_object = FALSE ;
  273. Xif (tag[V_ned]) {
  274. X    if (enemy[N_ned][E_location] == B_destroyed) {
  275. Xprintf("Forget it, you drongo!! Ned Kelly is already dead!\n") ;
  276. X        return ;
  277. X    }
  278. X    if (enemy[N_ned][E_status] == F_asleep) {
  279. Xprintf("There is no Ned Kelly here for me to kill! \n") ;
  280. X        return ;
  281. X    }
  282. X    j_point = 0 ; 
  283. X    sw_see =  TRUE ;
  284. X    target_k_flag = V_ned ;
  285. X}
  286. X
  287. Xif (tag[V_bear]) {
  288. X    for (j = 2; j <= 5; j++) {
  289. X        if (enemy[j][E_status] != F_asleep) {
  290. X            j_point = j ; 
  291. X            goto bear_see ;
  292. X        }
  293. X    }
  294. X    printf("I see no drop bear for me to kill! \n") ;
  295. X    return ;
  296. Xbear_see:
  297. X    sw_see =  TRUE ;
  298. X    target_k_flag = V_bear ;
  299. X}
  300. X
  301. Xif (tag[V_wombat]) {
  302. X    if (enemy[N_wombat][E_status] == F_asleep) {
  303. X        printf("I see no wombat for me to kill!\n");
  304. X        return ;
  305. X    }
  306. X    j_point = N_wombat ; 
  307. X    sw_see =  TRUE ;
  308. X    target_k_flag = V_wombat ;
  309. X}
  310. X
  311. Xif (tag[V_snake]) {
  312. X    for (j = 6; j <= 13; j++) {
  313. X        if (enemy[j][E_status] != F_asleep) {
  314. X            j_point = j ; 
  315. X            goto hoop_see ;
  316. X        }
  317. X    }
  318. X    printf("I see no hoop snake for me to kill! \n") ;
  319. X    return ;
  320. Xhoop_see:
  321. X    sw_see =  TRUE ;
  322. X    target_k_flag = V_snake ;
  323. X}
  324. X
  325. Xif (tag[V_rifle]) sw_kill = TRUE ;
  326. X
  327. X/* see if the safe is being shot at */
  328. Xif (tag[V_safe]&&(n == R_office_mang)) {
  329. Xprintf("The safe is made out of harden steel.  You'll only waste ") ;
  330. Xprintf("ammunition \nshooting at it.  Try to open it instead. \n") ;
  331. Xreturn ;
  332. X}
  333. X
  334. X/* see if the target is in the room or holding it */
  335. Xfor (j=0; j <= objcnt; j++) {
  336. X    if (tag[object[j][J_parse_id]]){
  337. X         if (object[j][J_parse_id] == V_rifle) continue ;
  338. X        sw_other_object = TRUE ;
  339. X        if (object[j][J_loc] == n) {
  340. X            sw_see =  TRUE ;
  341. X            target_k_flag = object[j][J_parse_id] ;
  342. X            break ;
  343. X        }
  344. X        if (object[j][J_loc] == B_have) {
  345. Xprintf("I will ***NOT*** shoot at something that I'm holding!!\n");
  346. X            return ;
  347. X        }
  348. X    }
  349. X}
  350. X
  351. Xif (tag[V_rifle] && (!sw_other_object)) tag[V_VERB_ONLY] = TRUE ;
  352. X
  353. Xif ((!tag[V_VERB_ONLY]) && (!tag[V_DIRECTION])) {
  354. X    if (!sw_see) {
  355. X        printf("I don't see it here to shoot at it. \n") ;
  356. X        return; 
  357. X    }
  358. X
  359. X    if (target_k_flag == V_NULL) {
  360. Xprintf("It may be obvious to you, but you are going to have to tell\n");
  361. Xprintf("me exactly what it is you want to have killed.\n");
  362. X        return ;
  363. X    }
  364. X}
  365. X
  366. X/* resolve killing errors */
  367. Xif (!sw_kill) {
  368. X    printf("What weapon am I suppose to use? \n") ;
  369. X    return ;
  370. X}
  371. X
  372. Xif (object[O_rifle][J_loc] != B_have) {
  373. Xprintf("I would do that.  Only there is one small problem.... \n") ;
  374. X    printf("You don't have a rifle in your possesion! \n") ;
  375. X    return ;
  376. X}
  377. X/* Shoot the gun (or at least try to) */
  378. Xprintf("You pull the trigger... \n\n") ;
  379. Xif (clip_flag == F_no_clip) {
  380. Xprintf("Nothing happens!  \n") ;
  381. Xprintf("Your rifle doesn't have an ammunition clip in it.\n") ;
  382. X    return ;
  383. X}
  384. Xif (object[O_rifle][J_property] <= 0) {
  385. X    printf("Nothing happens!  The ammo clip is out of bullets.\n") ;
  386. X    return ;
  387. X}
  388. Xswitch(rifle_flag) {
  389. Xcase F_safety:
  390. X    printf("Nothing happens!  The rifle's safety is still on.\n");
  391. X    return ;
  392. X            
  393. Xcase F_single:
  394. X    printf("Bam! \n\n") ;
  395. X    --object[O_rifle][J_property] ;
  396. X    if (clip_flag == F_normal_clip) hits = 1;
  397. X        else hits = 100 ;
  398. X    break ;
  399. X
  400. Xcase F_triple:
  401. X    if (object[O_rifle][J_property] >= 3) {
  402. X        printf("Bam! Bam! Bam! \n\n") ;
  403. X        object[O_rifle][J_property] -= 3 ;
  404. X        if (clip_flag == F_normal_clip) hits = 3;
  405. X            else hits = 300 ;
  406. X    }
  407. X    else {
  408. X        for (i = 1; i <= object[O_rifle][J_property]; i++) 
  409. X            printf("Bam! ") ;
  410. X            printf("\n\nYou've run out of bullets. \n\n") ;
  411. X        if (clip_flag == F_normal_clip) 
  412. X            hits = object[O_rifle][J_property];
  413. X            else hits = object[O_rifle][J_property]*100 ;
  414. X        object[O_rifle][J_property] = 0 ;
  415. X    }
  416. X    break ;
  417. X
  418. Xcase F_auto:
  419. X    if (object[O_rifle][J_property] >= 30) {
  420. X        for (i = 1; i <= 3; i++) 
  421. Xprintf("Bam! Bam! Bam! Bam! Bam! Bam! Bam! Bam! Bam! Bam! \n") ;
  422. X        object[O_rifle][J_property] -= 30 ;
  423. X        hits = 30;
  424. X    }
  425. X    else {
  426. X        i_10 = object[O_rifle][J_property]/10 ;
  427. X        i_fract = object[O_rifle][J_property]-(i_10*10) ;
  428. X        for (i = 1; i <= i_10; i++) 
  429. Xprintf("Bam! Bam! Bam! Bam! Bam! Bam! Bam! Bam! Bam! Bam! \n") ;
  430. X        for (i = 1; i <= i_fract; i++) 
  431. X            printf("Bam! ") ;
  432. X            printf("\n\nYou've run out of bullets. \n") ;
  433. X        if (clip_flag == F_normal_clip) 
  434. X            hits = object[O_rifle][J_property];
  435. X            else hits = object[O_rifle][J_property]*100 ;
  436. X        object[O_rifle][J_property] = 0 ;
  437. X    }
  438. X    printf("\n") ;
  439. X    break ;
  440. X}
  441. X
  442. X/* Target Seen block */
  443. Xif (sw_see) {
  444. X    /* Toggle the hurt switch if this is the first hit */
  445. X    if (enemy[j_point][E_hits] == 0)  sw_hurt = FALSE ;
  446. X    enemy[j_point][E_hits] += hits ;
  447. X
  448. X    switch(target_k_flag) {
  449. X    case V_ned:
  450. Xprintf("Ned Kelly keels over dead.  His body suddenly glows a bright ");
  451. Xprintf("orange like it\nis being consummed by a heatless flame ");
  452. Xprintf("and then the late Ned Kelly disappears\ninto a puff of ") ;
  453. Xprintf("blue smoke. \n\n") ;
  454. Xprintf("By the way, the recently deceased bushranger ***was*** ");
  455. Xprintf("wearing iron body\narmour.  However thin sheets of iron ");
  456. Xprintf("would just barely work against nineteenth\ncentury firearms ");
  457. Xprintf("at long range.  Against a modern infantry rifle, Ned's\n");
  458. Xprintf("armour offered about as much protection as a dunny paper ");
  459. Xprintf("bandage. \n") ;
  460. X        enemy[N_ned][E_location] = B_destroyed ;
  461. X        enemy[N_ned][E_status] = F_asleep ;
  462. X        monster_flag = F_no_monster ;
  463. X        room[R_hideout][M_monster] = 0 ;
  464. X    
  465. X        /* create Ned Kelly's silver teapot */
  466. X        ++room[R_hideout][M_obj_cnt] ;
  467. X        object[O_teapot][J_loc] = R_hideout ;
  468. X        return ;
  469. X
  470. X    /* shoot the drop bear */
  471. X    case V_bear:
  472. X        if (enemy[j_point][E_hits] < 30) {
  473. X            if (enemy[j_point][E_hits] == 1) {
  474. Xprintf("Your bullet hit the drop bear causing it to howl in ");
  475. Xprintf("anguish.  However drop\n");
  476. Xprintf("bears are pretty tough and just one bullet isn't ");
  477. Xprintf("going to kill it.\n") ;
  478. X            }
  479. X            else {
  480. X                if (!sw_hurt) {
  481. Xprintf("You've hit the drop bear and it is bleeding fairly ");
  482. Xprintf("heavily.\n");
  483. Xprintf("Unfortunately it is still alive and kicking and wants ") ;
  484. Xprintf("your blood \n");
  485. Xprintf("in payment for its.\n") ;
  486. X                    sw_hurt = TRUE ;
  487. X                }
  488. X                else {
  489. Xprintf("You've hit the drop bear again.  It is weakening but still ");
  490. Xprintf("alive.\n");
  491. X                }
  492. X            }
  493. X            monster_flag = F_wounded ;
  494. X            goto mad_bear ;
  495. X        }
  496. X
  497. X        if (rifle_flag == F_single) {
  498. Xprintf("That last bullet was the straw which broke the drop ") ;
  499. Xprintf("bear's back.\n") ;
  500. Xprintf("The blasted thing is finally dead! \n") ;
  501. X        }
  502. X        else {
  503. Xprintf("The bullets riddled the drop bear with holes, killing it ") ;
  504. Xprintf("instantly. \n") ; 
  505. X        }
  506. Xprintf("Suddenly the drop bear's corpse turns into a cloud of greasy ");
  507. Xprintf("blue smoke,\n") ;
  508. Xprintf("which floats away without a trace.\n") ;
  509. X        sw_hurt = FALSE ;
  510. X        enemy[j_point][E_location] = B_destroyed ;
  511. X        enemy[j_point][E_status] = F_asleep ;
  512. X        monster_flag = F_no_monster ;
  513. X        room[n][M_monster] = 0 ;
  514. X        return ;
  515. X        /* shoot the mutant wombat */
  516. X    case V_wombat:
  517. X        if (enemy[N_wombat][E_hits] < 300) {
  518. X            if (enemy[N_wombat][E_hits] == 1) {
  519. Xprintf("Your bullet hit the wombat causing it some minor discomfort.");
  520. Xprintf("  Judging from its \n");
  521. Xprintf("behavior, killing this beast is going to be tough! \n") ;
  522. X            }
  523. X            else {
  524. X                if (!sw_hurt) {
  525. Xprintf("You've hit the wombat and gotten its attention ") ;
  526. Xprintf("but you've not\n");
  527. Xprintf("seriously wounded it.  In fact, you've made it more fierce ");
  528. Xprintf("than before.\n");
  529. X                    sw_hurt = TRUE ;
  530. X                }
  531. X                else {
  532. Xprintf("You've hit the wombat again, but it is still going ");
  533. Xprintf("strong.\n");
  534. X                }
  535. X            }
  536. X            monster_flag = F_wounded ;
  537. X            return ;
  538. X        }
  539. X
  540. X        if (rifle_flag == F_single) {
  541. Xprintf("That last bullet was the straw which broke the ") ;
  542. Xprintf("wombat's back.\n") ;
  543. Xprintf("The blasted thing is finally dead!\n\n") ;
  544. X        }
  545. X        else {
  546. Xprintf("The bullets did the trick on the wretched thing.  It's ") ;
  547. Xprintf("dead as a doornail.\n\n") ;
  548. X        }
  549. Xprintf("Suddenly the wombat's corpse starts to glow with an intense");
  550. Xprintf(" white light.\n") ;
  551. Xprintf("There is then a crackling sound as its body starts to burn.");
  552. Xprintf("  You can\n");
  553. Xprintf("smell the stench of burning hair.  Then the white light");
  554. Xprintf(" begins to dim,\n");
  555. Xprintf("leaving no trace left of the once formidable monster.\n");
  556. X        sw_hurt = FALSE ;
  557. X        enemy[N_wombat][E_location] = B_destroyed ;
  558. X        enemy[N_wombat][E_status] = F_asleep ;
  559. X        monster_flag = F_no_monster ;
  560. X        room[n][M_monster] = 0 ;
  561. X        return ;
  562. X    /* shoot the hoop snake */
  563. X    case V_snake:
  564. X        if ((rifle_flag == F_single)&&
  565. X            (enemy[j_point][E_hits] < 3)) {
  566. X            if (enemy[j_point][E_hits] == 1) {
  567. Xprintf("Your bullet hit the hoop snake.  However the hoop snake's ");
  568. Xprintf("thick scales \n");
  569. Xprintf("slowed the bullet down.  The hoop snake is now hissing ");
  570. Xprintf("furiously. \n") ;
  571. X            }
  572. X            else {
  573. Xprintf("You've hit the hoop snake again, and it's hurting.  However ");
  574. Xprintf("it is still \n");
  575. Xprintf("alive and full of venom. \n") ;
  576. X            }
  577. X            monster_flag = F_wounded ;
  578. X            return ;
  579. X        }
  580. X
  581. X        if (rifle_flag == F_single) {
  582. Xprintf("The bullet hit the hoop snake finishing the horrible ") ;
  583. Xprintf("creature off. \n") ;
  584. X        }
  585. X        else {
  586. Xprintf("The bullets hit the hoop snake splatting it into a mass of ") ;
  587. Xprintf("mince meat. \n") ; 
  588. X        }
  589. Xprintf("Suddenly the bullet holed snake glows red and whooshes ");
  590. Xprintf("into a cloud \n") ;
  591. Xprintf("steam, leaving no traces behind.\n\n") ;
  592. X        enemy[j_point][E_location] = B_destroyed ;
  593. X        enemy[j_point][E_status] = F_asleep ;
  594. X        monster_flag = F_no_monster ;
  595. X        room[n][M_monster] = 0 ;
  596. X        return ;
  597. X
  598. X    case V_can:
  599. X    case V_beer:
  600. X    case V_fourex:
  601. X    case V_Fourex:
  602. Xprintf("The can is hit by a bullet and flies off out of sight.\n");
  603. X        object[O_can][J_loc] = B_destroyed ;
  604. X        return;
  605. X
  606. X
  607. X    case V_bottle:
  608. X    case V_lager:
  609. Xprintf("It is hit by a bullet and shatters into a million pieces.\n");
  610. X        object[O_bottle][J_loc] = B_destroyed ;
  611. X        return;
  612. X
  613. X    } /* end of target switch group */
  614. X} /* end of the "target seen" block */
  615. X/* There was no target specified so the shot was wasted */
  616. Xif (tag[V_VERB_ONLY]) { 
  617. Xprintf("You didn't specify a target. So the rifle was pointed\n") ;
  618. Xprintf("in a random direction and the ammunition wasted.\n") ;
  619. X}
  620. Xelse 
  621. Xprintf("Except for wasting ammunition, nothing much happened.\n") ;
  622. Xreturn ;
  623. X
  624. Xmad_bear:
  625. Xif (enemy[j_point][E_hits] < 10) return ;
  626. Xprintf("\nThe drop bear has been shot at so many times, that it ");
  627. Xprintf("has gone mad\n") ;
  628. Xprintf("with rage.  It leaps three meters and rips out your ") ;
  629. Xprintf("throat with a\n");
  630. Xprintf("single swish of its claws.  You die instantly. \n") ;
  631. Xender(F_died) ;
  632. X} /* --- end of the 'killer' subroutine --- */
  633. END_OF_FILE
  634. if test 18250 -ne `wc -c <'actor.c'`; then
  635.     echo shar: \"'actor.c'\" unpacked with wrong size!
  636. fi
  637. # end of 'actor.c'
  638. fi
  639. if test -f 'opener.c' -a "${1}" != "-c" ; then 
  640.   echo shar: Will not clobber existing file \"'opener.c'\"
  641. else
  642. echo shar: Extracting \"'opener.c'\" \(12761 characters\)
  643. sed "s/^X//" >'opener.c' <<'END_OF_FILE'
  644. X#define OPNR
  645. X#include "dink_sym.h"
  646. X#include "dink_glb.h"
  647. X
  648. Xvoid dialer(n)
  649. X/*****************************/
  650. X/*      "dial" command"      */
  651. X/*     Version:  Mk 1.1      */
  652. X/*      29 October 1989      */
  653. X/*****************************/
  654. Xint n ;
  655. X{
  656. X
  657. X/* deal with the question of "What is the combination?" */
  658. Xif (tag[V_what]) {
  659. Xprintf("I really don't know.  You might try looking around for a\n") ;
  660. Xprintf("series of numbers. Sometimes that can be a clue to the\n") ;
  661. Xprintf("actual combination.\n") ;
  662. X    return ;
  663. X}
  664. X
  665. X/* See if the combination was dialed in the right place */
  666. Xif ((n == R_office_mang)&&
  667. X    (room[R_office_mang][M_rm_status] >= S_revealed)) {
  668. X    if (tag[V_0] && tag[V_49] && tag[V_67] && tag[V_82]) {
  669. X        printf ("Click!! \n");
  670. X        room[R_office_mang][M_rm_status] = S_dialed ;
  671. X        return ; 
  672. X    }
  673. Xprintf ("You turned the dial but nothing happened.  I think you \n");   
  674. Xprintf ("dialed the wrong thing. \n");
  675. X    return ; 
  676. X}
  677. Xprintf ("How am I supposed to dial that? \n");
  678. X} /* --- end of the "dialer" subroutine --- */
  679. X
  680. Xvoid inventer()
  681. X/*****************************/
  682. X/*   "inventory" command     */
  683. X/*     Version:  Mk 1.0      */
  684. X/*       11 March 1989       */
  685. X/*****************************/
  686. X{
  687. X#ifdef __TURBOC__
  688. Xvoid objector(int) ;
  689. X#endif
  690. X
  691. Xregister int i;
  692. Xint i_ws, j_ws ;
  693. Xi_ws = 0 ;
  694. Xj_ws = 0 ;
  695. Xfor (i = 0; i <= objcnt; i++) if (object[i][J_loc] == B_have)  {
  696. X    ++j_ws;
  697. X    i_ws = i ;
  698. X    } ;
  699. Xif ((j_ws == 0)&&(gleep_count == 0)) {
  700. X    printf("You've got NOTHING!! \n") ;
  701. X    return ;
  702. X}
  703. Xif (j_ws >= 1) {
  704. X    if (j_ws == 1) {
  705. X        printf("You are carrying ") ;
  706. X        objector(i_ws);
  707. X        printf ("\n") ;
  708. X    }
  709. X    else {
  710. X        printf ("You are carrying the following: \n");
  711. X        for (i = 0; i <= objcnt; i++) {
  712. X            if (object[i][J_loc] == B_have) {
  713. X                printf ("        ") ;
  714. X                objector(i);
  715. X                printf ("\n") ;
  716. X            }
  717. X        }
  718. X    }
  719. X}
  720. Xif (gleep_count > 0) {
  721. X    if (gleep_count == 1) {
  722. X        printf("You have one gleep.\n") ;
  723. X        return ;
  724. X    }
  725. X    printf("You are carrying %d gleeps. \n",gleep_count) ;
  726. X}
  727. X
  728. X} /* --- end of the "inventor" subroutine --- */
  729. Xvoid drinker()
  730. X/*****************************/
  731. X/*     "drink" command       */
  732. X/*     Version:  Mk 1.0      */
  733. X/*       11 March 1989       */
  734. X/*****************************/
  735. X{
  736. X
  737. Xif (tag[V_can]) {
  738. X    if (object[O_can][J_loc] == B_have) {
  739. X        printf("The XXXX keeps on coming on ? \n") ;
  740. Xprintf("I think not, for there is no Fourex left for me to drink!\n") ;
  741. X    }
  742. X    else goto no_booze ;
  743. X    return ;
  744. X}
  745. X
  746. Xif (tag[V_bottle]) {
  747. X    if (object[O_bottle][J_loc] == B_have) {
  748. Xprintf("Some greedy larrikin has drunk up all of the Black Swan! \n") ;
  749. X    printf("Bad on Him! There is none left for me! \n") ;
  750. X    return ;
  751. X    }
  752. Xno_booze:
  753. X    printf ("You don't have it in your possession to drink!\n");
  754. X    return ;
  755. X}
  756. X
  757. Xif (tag[V_water]) {
  758. X    printf("There is no water here that I am willing to drink.\n") ;
  759. X    return ;
  760. X}
  761. X    
  762. Xprintf ("What exactly do you want me to drink? \n");
  763. Xreturn; 
  764. X
  765. X} /* --- end of the "drinker" subroutine --- */
  766. Xvoid reader()
  767. X/*****************************/
  768. X/*      "read" command       */
  769. X/*     Version:  Mk 1.1      */
  770. X/*        21 April 1989      */
  771. X/*****************************/
  772. X{
  773. X#ifdef __TURBOC__
  774. Xvoid rdtxt(int) ;
  775. X#endif
  776. X
  777. Xint k ;
  778. X
  779. X/* reject an isolated "read" command */
  780. Xif (tag[V_VERB_ONLY]) { 
  781. X        printf ("What exactly do you want me to read? \n");
  782. X        return;
  783. X}
  784. X
  785. Xfor (;;) {
  786. X    /* map from the manager's office */
  787. X    if (tag[V_map]) {
  788. X        k = O_map_frag ;
  789. X        break;
  790. X    }
  791. X
  792. X    /* Qadaffi's letter */
  793. X    if (tag[V_letter]) {
  794. X        k = O_letter ;
  795. X        break ;
  796. X    }
  797. X
  798. X    /* paper from the safe */
  799. X    if (tag[V_paper]) {
  800. X        k = O_paper ;
  801. X        break;
  802. X    }
  803. X
  804. X    /* Deal with unreadable objects */
  805. X    printf("There is no way in which I can read that. \n");
  806. X        return ;
  807. X} /* end of the infinite for loop */
  808. X
  809. Xif (object[k][J_loc] == B_have) rdtxt(k) ;
  810. Xelse printf ("I can't read it because it isn't in my possession. \n");
  811. X}         /* --- end of the subroutine "reader" --- */
  812. X
  813. Xvoid unlocker(n)
  814. X/*****************************/
  815. X/*     "unlock" command      */
  816. X/*      Version: Mk 1.1      */
  817. X/*      16 September 1989    */
  818. X/*****************************/
  819. Xint n ;
  820. X{
  821. Xif (tag[V_VERB_ONLY]) {
  822. X    printf ("What do you want me to unlock? \n");
  823. X    return; 
  824. X}
  825. X
  826. Xif (room[n][M_rm_type] == T_action_obj) {
  827. X    switch (n) {
  828. X
  829. X    /* Managers office */
  830. X    case R_office_mang:
  831. X        if (tag[V_safe]) {
  832. Xprintf("This is a combination type safe (no key hole).  You must\n");
  833. Xprintf("dial a combination in order to open this safe. \n");
  834. X        }
  835. X        else 
  836. Xprintf("You're wasting your time.  You can't unlock that! \n");
  837. X        return;
  838. X
  839. X    /* office entrance */
  840. X    case R_office_entr:
  841. X    if (tag[V_door]) {
  842. X        if (room[R_office_entr][M_rm_status] == S_open) {
  843. X            printf("The door is already open! \n");
  844. X            return;
  845. X        }
  846. X        if (room[R_office_entr][M_rm_status] == S_kicked) {
  847. X            printf("The door has been kicked in! \n");
  848. X            return;
  849. X        }
  850. X        if (room[R_office_entr][M_rm_status] == S_unlocked) {
  851. Xprintf("The door is already unlocked.  However it is still closed! \n");
  852. X            return;
  853. X        }
  854. X        /* The door has to still be unlocked */
  855. X        if (tag[V_key]) {
  856. X        if (object[O_key][J_loc] != B_have) {
  857. Xprintf("You don't have the key to this door in your possession! \n");
  858. X        }
  859. X        else {
  860. X            printf("You turn the key in the lock and ") ;
  861. X            printf("hear a satisfying \"click\".\n");
  862. X            room[R_office_entr][M_rm_status] = S_unlocked ;
  863. X        }
  864. X        }
  865. X        else printf ("With what shall I unlock the door? \n");
  866. X        return; 
  867. X    }
  868. X
  869. X    default:
  870. Xprintf("I don't think that is the sort of thing one unlocks.\n") ;
  871. X    }  /* end of "unlock" room scan switch */
  872. X} /* end of "unmovable action device" block */
  873. Xelse printf("There is nothing here that can be unlocked! \n");
  874. Xreturn ;
  875. X}  /* --- end of the "unlocker" subroutine --- */
  876. X
  877. Xvoid closer(n)
  878. X/*****************************/
  879. X/*     "close" command       */
  880. X/*     Version:  Mk 1.0      */
  881. X/*     12 November 1988      */
  882. X/*****************************/
  883. Xint n ;
  884. X{
  885. X/* scan "close" sentence */
  886. Xif (room[n][M_rm_type] != T_action_obj) {
  887. Xprintf("There is nothing here that can be closed! \n");
  888. X    return; 
  889. X}
  890. X
  891. Xif (tag[V_VERB_ONLY]) {
  892. X    printf ("What exactly do you want me to close? \n");
  893. X    return; 
  894. X}
  895. X
  896. Xswitch (n) {
  897. X    /* office door */
  898. X    case R_office_entr:
  899. X        if (!tag[V_door]) break ;
  900. X        if (room[R_office_entr][M_rm_status] == S_kicked) {
  901. Xprintf("The door has been kicked in!  It'll never be closed again.\n");
  902. X            return;
  903. X        }
  904. X        if (room[R_office_entr][M_rm_status] == S_open) {
  905. X        printf("The office door closes with a slam. \n");
  906. X            room[R_office_entr][2] = -1 ;
  907. X            room[R_office_entr][M_rm_status] = S_closed ;
  908. X            return ;
  909. X        }
  910. X        else printf("The office door is already closed! \n");
  911. X        return ;
  912. X
  913. X    /* managers office */
  914. X    case R_office_mang:
  915. X    if ((!tag[V_picture])&&(!tag[V_safe])) break;
  916. X    if (tag[V_safe]) {
  917. X        if (room[R_office_mang][M_rm_status] < S_dialed) 
  918. X        printf("The safe is already closed. \n");
  919. X        else {
  920. X    printf("The safe door closes and locks with a \"click\". \n");
  921. X            room[R_office_mang][M_rm_status] = S_revealed ;
  922. X        }
  923. X    }
  924. X    if (tag[V_picture]) {
  925. X        if (room[R_office_mang][M_rm_status] == S_closed) 
  926. X        printf("The platypus picture is already closed. \n");
  927. X        else  {
  928. Xprintf("The picture swings flush against the wall, hiding the safe.\n");
  929. X            room[R_office_mang][M_rm_status] = S_closed ;
  930. X        }
  931. X    }
  932. X    return ;
  933. X
  934. X} /* end of the "close" switch */
  935. Xprintf ("I really don't see how one would close that? \n");
  936. Xreturn; 
  937. X} /* --- end of the "closer" subroutine --- */
  938. X
  939. Xvoid opener(n)
  940. X/*****************************/
  941. X/*      "open" command       */
  942. X/*     Version:  Mk 2.1      */
  943. X/*     25 April 1990         */
  944. X/*****************************/
  945. Xint n ;
  946. X{
  947. X#ifdef __TURBOC__
  948. Xvoid boom(void), ender(int), objector(int) ;
  949. X#endif
  950. X
  951. Xregister int i ;
  952. X
  953. X/* deal with a terse command */
  954. Xif (tag[V_VERB_ONLY]) {
  955. X    printf ("What exactly do you want me to open? \n");
  956. X    return; }
  957. Xif (tag[V_can]) {
  958. X    if (object[O_can][J_loc] == B_have) 
  959. Xprintf("Some bugger has already drunk it up. The stubee is empty!\n");
  960. X    else printf("You don't have a can to open! \n") ;
  961. X    return; 
  962. X}
  963. X
  964. Xif (tag[V_letter]) {
  965. X    if (object[O_letter][J_loc] == B_have) {
  966. X        boom() ; /* cause an explosion */
  967. Xprintf("It's not polite to read other people's mail!!  As you lay\n") ;
  968. Xprintf("bleeding on the floor with your hands and arms blown away,\n") ;
  969. Xprintf("you realize that envelope actually contained a letter bomb!\n");
  970. Xprintf("(A trick widely used by terrorists in the 1970s).  However\n");
  971. Xprintf("the knowledge does you little good since your spirit soon\n");
  972. Xprintf("departs this mortal coil.\n");
  973. X        ender(F_died) ;
  974. X    }
  975. X    else printf("You don't have a letter to open!\n") ;
  976. X    return ;
  977. X}
  978. X
  979. Xif (tag[V_bottle]) {
  980. X    if (object[O_bottle][J_loc] == B_have)
  981. Xprintf("Some bugger has already drunk it up. The bottle is Empty! \n");
  982. X    else printf("You don't have a bottle to open! \n") ;
  983. X    return; 
  984. X}
  985. X
  986. Xif (tag[V_umbrella]) {
  987. X    if (object[O_umbrella][J_loc] == B_have) {
  988. Xprintf("You open the umbrella but find it's full of holes and\n");
  989. Xprintf("its clasp is broken.  As soon as you release it, the\n");
  990. Xprintf("umbrella snaps shut.\n") ;
  991. X    }
  992. X    else printf("You don't have an umbrella to open! \n") ;
  993. X    return; 
  994. X}
  995. X/* Now check to see if the location is consistent with the command */
  996. Xif (room[n][M_rm_type] != T_action_obj) { 
  997. X    printf ("I don't understand what you want me to open. \n") ;
  998. X    return ;
  999. X}
  1000. X
  1001. Xswitch (n) {
  1002. X    /* office entrance (door) */
  1003. X    case R_office_entr:
  1004. X        if (tag[V_door]) {
  1005. X        switch (room[R_office_entr][M_rm_status]) {
  1006. X            case S_kicked:
  1007. Xprintf("The door has been kicked in!  You don't need to open it.\n");
  1008. X                return;
  1009. X        
  1010. X            case S_open:
  1011. X                printf("The door is already open! \n");
  1012. X                return ;
  1013. X        
  1014. X            case S_unlocked:
  1015. Xprintf("As you push open the office door, the rusty hinges creak \n");
  1016. Xprintf("from long disuse.  Darkness and stale air seem to exude \n");
  1017. Xprintf("from the vacant office.  The way is free for you to enter. \n");
  1018. X                room[R_office_entr][2] = R_office_hall ;
  1019. X            room[R_office_entr][M_rm_status] = S_open ;
  1020. X                return ;
  1021. X        
  1022. X            case S_closed:
  1023. Xprintf("The office door is locked tight.");
  1024. Xprintf("  You need to unlock it with a key. \n");
  1025. X                return ;
  1026. X        } /* end of room status switch */
  1027. X        } /* end of the door "if" block */
  1028. X        break ;
  1029. X
  1030. X    /* managers office */
  1031. X    case R_office_mang:
  1032. X        if ((!tag[V_picture])&&(!tag[V_safe])) {
  1033. Xprintf("I don't understand how I would open that.\n") ;
  1034. X            return ;
  1035. X        }
  1036. X
  1037. X        if (tag[V_picture]) {
  1038. X        switch (room[R_office_mang][M_rm_status]) {
  1039. X        case S_closed:
  1040. Xprintf("You swing open the platypus picture revealing a large wall \n");
  1041. Xprintf("safe with a combination dial. \n");
  1042. X            room[R_office_mang][M_rm_status] = S_revealed ;
  1043. X            break ;
  1044. X        default:
  1045. Xprintf("The picture is already swung out.  The problem is to open \n");
  1046. Xprintf("the safe!!  Hint:  Dial in a combination. \n");
  1047. X            return ;
  1048. X        }
  1049. X        } /* end of the picture "if" block */
  1050. X
  1051. X        if (tag[V_safe]) {
  1052. X        switch (room[R_office_mang][M_rm_status]) {
  1053. X        case S_closed:
  1054. Xprintf("I can see no safe in this office for me to open.  Perhaps\n");
  1055. Xprintf("there is a safe hidden in this office somewhere.\n");
  1056. X            return ;
  1057. X
  1058. X        case S_revealed:
  1059. Xprintf("The safe is locked.  You must first dial the combination\n");
  1060. Xprintf("in order to open it.  See if you can find the combination. \n");
  1061. X            return ;
  1062. X        
  1063. X        case S_dialed:
  1064. X    printf("The safe door swings open smoothly and easily. \n");
  1065. X            room[R_office_mang][M_rm_status] = S_open ;
  1066. X            sw_active = TRUE ;
  1067. X            for (i=0; i <= objcnt; i++) 
  1068. X            if (object[i][J_loc] == B_in_safe) {
  1069. Xprintf ("Inside the safe, you see the following: \n");
  1070. X                for (i=0; i <= objcnt; i++) {
  1071. X                if (object[i][J_loc] == B_in_safe) {
  1072. X                    printf ("        ") ;
  1073. X                    objector(i);
  1074. X                    printf ("\n") ;
  1075. X                }
  1076. X                }                
  1077. X                return ;
  1078. X            }
  1079. X        printf("---The safe is empty.--- \n");
  1080. X            return ;
  1081. X
  1082. X        case S_open:
  1083. X            printf("The safe is already open! \n");
  1084. X            return ;
  1085. X        } /* end of the "safe" status switch */
  1086. X        } /* end of the safe "if" block */
  1087. X        return ; /* this return statement must remain */
  1088. X
  1089. X    /* Lift door(s) */
  1090. X    case R_lift_entr:
  1091. X        if (tag[V_door]||tag[V_lift]) {
  1092. Xprintf("It is not exactly clear how I would open these doors.\n") ;
  1093. Xprintf("However I see a push button next to the lift doors.\n") ;
  1094. Xprintf("Perhaps if I pressed the button something would happen.\n") ;
  1095. X        }
  1096. X        else printf("I'm confused about what I should open.\n");
  1097. X        return ;
  1098. X        
  1099. X} /* end of the "open" room switch */
  1100. Xprintf ("I see nothing here that I can open. \n") ;
  1101. X} /* --- end of the "opener" subroutine --- */
  1102. X
  1103. Xvoid boom()
  1104. X{
  1105. Xprintf("\n\n");
  1106. Xprintf("BBBBBB      OOOOO        OOOOO      MM        MM      !!!\n");
  1107. Xprintf("B    BB   OO     OO    OO     OO    M M      M M      !!!\n");
  1108. Xprintf("B    BB   OO     OO    OO     OO    M  M    M  M      !!!\n");
  1109. Xprintf("BBBBBB    OO     OO    OO     OO    M   M  M   M      !!!\n");
  1110. Xprintf("B    BB   OO     OO    OO     OO    M    MM    M      !!!\n");
  1111. Xprintf("B    BB   OO     OO    OO     OO    M          M\n");
  1112. Xprintf("BBBBBB      OOOOO        OOOOO      M          M      !!!\n\n");
  1113. X} /* --- end of the "boom" subroutine --- */
  1114. END_OF_FILE
  1115. if test 12761 -ne `wc -c <'opener.c'`; then
  1116.     echo shar: \"'opener.c'\" unpacked with wrong size!
  1117. fi
  1118. # end of 'opener.c'
  1119. fi
  1120. if test -f 'parse.c' -a "${1}" != "-c" ; then 
  1121.   echo shar: Will not clobber existing file \"'parse.c'\"
  1122. else
  1123. echo shar: Extracting \"'parse.c'\" \(14440 characters\)
  1124. sed "s/^X//" >'parse.c' <<'END_OF_FILE'
  1125. X#define PARSE
  1126. X#include "dink_sym.h"
  1127. X#include "dink_glb.h"
  1128. X#include <string.h>
  1129. Xvoid parse()
  1130. X/*********************************************************/
  1131. X/*                                                       */
  1132. X/*      --- English Language Parsing Subroutine ---      */
  1133. X/*                                                       */
  1134. X/*  This subroutine parses a sentence of up to nineteen  */
  1135. X/*  words and decodes the words into integers and passes */
  1136. X/*  a twenty element vector back to the calling          */
  1137. X/*  program.  The digit 0, implies an unused word.  The  */
  1138. X/*  digit -1 (V_LINE_END), indicates end of sentence.    */
  1139. X/*                                                       */
  1140. X/*      Program by Gary A. Allen, Jr.   5 March 1990     */
  1141. X/*        (c) Copywrite 1990 by Gary A. Allen, Jr.       */
  1142. X/*                                                       */
  1143. X/*********************************************************/
  1144. X{
  1145. X#ifdef __TURBOC__ 
  1146. Xchar getche(void) ;
  1147. Xvoid purge(int, int*) ;
  1148. X#endif
  1149. X
  1150. Xregister int i, j ;
  1151. Xint m, n, j_point, jacc, i_ws, sw_adverb, sw_purge, j_purge, sw_punct ;
  1152. Xint sw_movement, sw_adverb_fnd ;
  1153. Xint j_old = 0 ; /* this is to keep Lint happy */
  1154. X/* a sentence can have 19 words of 15 letters */ 
  1155. Xchar words[20][15], word[15] ;
  1156. Xchar letter ;
  1157. X
  1158. X/* flush the "sent vector" */
  1159. Xfor (i=0; i<=19; i++) sent[i]=0 ;
  1160. X
  1161. X/* flush the tag vector */
  1162. Xfor (i=0; i<= tag_max; i++) tag[i] = FALSE ;
  1163. X
  1164. X/* Parse and load in the words */
  1165. Xinput:
  1166. Xsw_punct = FALSE ;
  1167. Xfor (i=0; i <= 18; i++) {
  1168. X    for (j=0; j <= 14; j++) {
  1169. X#ifndef __TURBOC__
  1170. X        letter = getchar() ;    
  1171. X#endif
  1172. X
  1173. X#ifdef __TURBOC__
  1174. X        letter = getche() ;    
  1175. X#endif
  1176. X
  1177. X        switch (letter) {
  1178. X            case '\n':
  1179. X            case 13 :
  1180. X                if ((i == 0) && (j == 0)) goto input ;
  1181. X                words[i][j] = '\0' ;  
  1182. X                goto decode; 
  1183. X
  1184. X            case 8:
  1185. X                if (sw_punct) {
  1186. X                    if (--i < 0) i = 0 ;
  1187. X                    j = j_old ;
  1188. X                    sw_punct = FALSE ;
  1189. X                }
  1190. X                else if (--j < 0) j = 0 ;
  1191. X                --j ;
  1192. X                continue ;
  1193. X
  1194. X            case '\"':
  1195. X            case ' ':
  1196. X            case ',':
  1197. X            case '.':
  1198. X            case ';':
  1199. X            case ':':
  1200. X            case '?':
  1201. X            case '!':
  1202. X            case '&':
  1203. X            case '{':
  1204. X            case '}':
  1205. X            case '[':
  1206. X            case ']':
  1207. X            case ')':
  1208. X            case '(':
  1209. X            case '\'':
  1210. X            case '`':
  1211. X            case '\t':
  1212. X                words[i][j] = '\0' ;  
  1213. X                sw_punct = TRUE ;
  1214. X                j_old = j ;
  1215. X                break;
  1216. X
  1217. X            default:
  1218. X                words[i][j] = letter ;
  1219. X                sw_punct = FALSE ;
  1220. X                continue ;
  1221. X        }
  1222. X        break ;
  1223. X    }
  1224. X    if (j > 14) {
  1225. Xprintf("\nYou're saying nonsense! Type the sentence again. \n");
  1226. X        break ;
  1227. X    }
  1228. X    if (j == 0) i-- ;
  1229. X}
  1230. Xif (i > 18) 
  1231. Xprintf ("\nYour sentence is too long. Type something shorter! \n") ;
  1232. X
  1233. X#ifndef __TURBOC__
  1234. X/* Purge the input buffer */
  1235. X    for (;;) if ('\n' == getchar()) break ;
  1236. Xgoto input;
  1237. X/* decode the words from the known vocabulary */
  1238. Xdecode:
  1239. X#endif
  1240. X
  1241. X#ifdef __TURBOC__
  1242. Xgoto input;
  1243. X/* decode the words from the known vocabulary */
  1244. Xdecode:
  1245. Xprintf("\n") ;
  1246. X#endif
  1247. X
  1248. Xm=i ;
  1249. Xjacc=0;
  1250. Xfor (i=0; i<=m; i++) {
  1251. X    for (j=0; j<=14; j++) {
  1252. X        word[j] = words[i][j] ; 
  1253. X    }
  1254. X    for (j=0; j<=letmax; j++) {
  1255. X        n = strcmp (word,vocab[j]);
  1256. X        if (n == 0) {
  1257. X            if ((j>9)&&(j<20)) j -= 10;
  1258. X            sent[jacc++]=j+1 ;
  1259. X            break; 
  1260. X        }
  1261. X    }
  1262. X}
  1263. X
  1264. Xif (jacc == 0) {
  1265. X    printf ("Nothing you said was understandable! Try again. \n");
  1266. X    goto input; 
  1267. X}
  1268. X/* mark last word */
  1269. Xsent[jacc] = V_LINE_END ;
  1270. X/* Check to see if this is a simple move command */
  1271. Xif (sent[0] <= 10) {
  1272. X    tag[V_MOVE] = TRUE ;
  1273. X    tag[V_DIRECTION] = TRUE ;
  1274. X    verb = sent[0] ;
  1275. X    return ; 
  1276. X}
  1277. X/* adjective and "in/out" preposition scan */
  1278. Xsw_purge = FALSE ;
  1279. Xfor (j = 0; j <= jacc-1; j++) {
  1280. X
  1281. X    /* check for adjectives*/
  1282. X    for (i = 0; i <= adj_max; i++) {
  1283. X        if (sent[j] == adjective[i][Aj_adj]) {
  1284. X
  1285. X        /* does a noun have to be ignored ? */
  1286. X        if (adjective[i][Aj_adj_cmd] == F_ignore) {
  1287. X        if (adjective[i][Aj_trig_noun] != sent[j+1]) break ;
  1288. X        }
  1289. X
  1290. X        /* does a noun have to be replaced? */
  1291. X        if (adjective[i][Aj_adj_cmd] == F_replace) {
  1292. X            if (adjective[i][Aj_trig_noun] == sent[j+1]) {
  1293. X            sent[j+1] = adjective[i][Aj_act_noun] ;
  1294. X            }
  1295. X        }
  1296. X        sw_purge = TRUE ;
  1297. X        j_purge = j ;
  1298. X        }
  1299. X    }
  1300. X}
  1301. X
  1302. X/* purge processed adjective from sentence */
  1303. Xif (sw_purge) purge(j_purge, &jacc) ;
  1304. X/* Verb grammer check */
  1305. X/* see if the sentence is of a command sentax */
  1306. Xfor (i = 0; i <= verb_max; i++) {
  1307. X    if (sent[0] == verb_table[i]) goto synonym ;
  1308. X}
  1309. X/* the first word is --not-- a verb, so one must be swapped in */
  1310. Xif (jacc != 1) for (j = 1; j <= jacc-1; j++) {
  1311. X    /* Check to see if the word is a move command */
  1312. X    if (sent[j] <= 10) {
  1313. X        tag[V_MOVE] = TRUE ;
  1314. X        i_ws = sent[0] ;
  1315. X        sent[0] = sent[j] ;
  1316. X        sent[j] = i_ws ;
  1317. X        goto synonym ;
  1318. X    }
  1319. X    /* if not a move command then check the verb table */
  1320. X    for (i = 0; i <= verb_max; i++) {
  1321. X        if (sent[j] == verb_table[i]) {
  1322. X            i_ws = sent[0] ;
  1323. X            sent[0] = sent[j] ;
  1324. X            sent[j] = i_ws ;
  1325. X            goto synonym ;
  1326. X        }
  1327. X    }
  1328. X}
  1329. X
  1330. X/* Check to see if this is a "question" sentence */
  1331. Xfor (i = 0; i <= quest_max; i++) {
  1332. X    if (sent[0] == quest[i]) {
  1333. X        /* shift the sentence over and load in "question" */ 
  1334. X        for (j = jacc; j >= 0; j--) sent[j+1] = sent[j] ;
  1335. X        sent[0] = V_QUESTION ;
  1336. X        tag[V_QUESTION] = TRUE ; 
  1337. X        if (++jacc == 2) {
  1338. X        /* Sentence is a one word command */
  1339. X            tag[V_VERB_ONLY] = TRUE ;
  1340. X            tag[sent[1]] = TRUE ;
  1341. X            verb = V_QUESTION ;
  1342. X            return ;
  1343. X        }
  1344. X        goto synonym ;
  1345. X    } 
  1346. X}
  1347. X
  1348. X/* Verb error routine */
  1349. Xprintf ("If there was a verb in that sentence, I didn't understand ") ;
  1350. Xprintf ("it.\n") ;
  1351. Xgoto input ;
  1352. X
  1353. Xsynonym:
  1354. X/* prescan for verb connected movement commands */
  1355. Xswitch(sent[0]) { 
  1356. Xcase V_go:
  1357. Xcase V_move:
  1358. Xcase V_walk:
  1359. Xcase V_run:
  1360. Xcase V_jump:
  1361. Xcase V_bop:
  1362. Xcase V_hop:
  1363. Xcase V_stroll:
  1364. Xcase V_saunter:
  1365. Xcase V_swagger:
  1366. X    sw_movement = TRUE ;
  1367. X    break ;
  1368. Xdefault:
  1369. X    sw_movement = FALSE ;
  1370. X}
  1371. X
  1372. X/* adverb scan, sent[0] is the verb */
  1373. Xsw_adverb = FALSE ;
  1374. Xsw_adverb_fnd = FALSE ;
  1375. Xfor (i = 0; i <= adv_max; i++) {
  1376. X    for (j = 1; j <= jacc-1; j++) {
  1377. X        /* see if this is an adverb */
  1378. X        if (sent[j] == adverb[i][Av_adv]) {
  1379. X            j_point = j ;
  1380. X            sw_adverb = TRUE ;
  1381. X
  1382. X            /* does the sentence have the companion verb? */
  1383. X            if (adverb[i][Av_verb_old] == sent[0]) {
  1384. X                sent[0] = adverb[i][Av_verb_new] ;
  1385. X                sw_adverb = FALSE ;
  1386. X                sw_adverb_fnd = TRUE ;
  1387. X
  1388. X            /* purge processed adverb from sentence */
  1389. X                purge(j, &jacc) ;
  1390. X            }
  1391. X        }
  1392. X    }
  1393. X}
  1394. X
  1395. X/* purge unprocessed adverb from sentence */
  1396. Xif (sw_adverb && (!sw_movement)) purge(j_point, &jacc) ;
  1397. X/* scan the sentence for the movement direction */
  1398. Xif ((!sw_adverb_fnd) && sw_movement) {
  1399. X    for (j = 0; j <= jacc-1; j++) {
  1400. X        if (sent[j] <= 10) {
  1401. X            tag[V_MOVE] = TRUE ;
  1402. X            tag[V_DIRECTION] = TRUE ;
  1403. X            verb = sent[j] ;
  1404. X            return ;
  1405. X        }
  1406. X        if (sent[j] == V_LINE_END) break ;
  1407. X    }
  1408. X    printf("Where to?  In what direction?\n") ;
  1409. X    goto input ;
  1410. X} 
  1411. X
  1412. Xtag[sent[0]] = TRUE ;  /* activate the tag for the verb */
  1413. Xif (jacc == 1) {
  1414. X/* Sentence is a one word command */
  1415. X    tag[V_VERB_ONLY] = TRUE ;
  1416. X    verb = sent[0] ;
  1417. X    if (sent[0] <= 4) return ; /* first 5 elements are reserved */
  1418. X    return ;
  1419. X}
  1420. X
  1421. X/* Load the "tag" matrix for detected words and synonyms */
  1422. Xfor (j=1; j <= 19; j++) {
  1423. X    if (sent[j] == V_LINE_END) break ;
  1424. X    if (sent[j] <= 10) tag[V_DIRECTION] = TRUE ;
  1425. X    if (sent[j] <= 4) continue ; /* first 5 elements are reserved */
  1426. X    tag[sent[j]] = TRUE ;  /* activate an element for each word */
  1427. X
  1428. X    /* Deal with synonym nouns */
  1429. X    switch(sent[j]) {
  1430. X
  1431. X    case V_automatic:
  1432. X    case V_AUTO:
  1433. X        tag[V_auto] = TRUE ;
  1434. X        continue ;
  1435. X    case V_bar:
  1436. X        tag[V_gold] = TRUE ;
  1437. X        continue ;
  1438. X
  1439. X    case V_beer:
  1440. X    case V_fourex:
  1441. X    case V_Fourex:
  1442. X        tag[V_can] = TRUE ;
  1443. X        continue ;
  1444. X
  1445. X    case V_cockroaches:
  1446. X        tag[V_PLURAL] = TRUE ;
  1447. X        tag[V_cockroach] = TRUE ;
  1448. X        continue ;
  1449. X    case V_diamond:
  1450. X        tag[V_ring] = TRUE ;
  1451. X        continue ;
  1452. X    case V_doormat:
  1453. X        tag[V_mat] = TRUE ;
  1454. X        continue ;
  1455. X
  1456. X    case V_drop:
  1457. X        tag[V_bear] = TRUE ;
  1458. X        continue ;
  1459. X
  1460. X    case V_everything:
  1461. X        tag[V_all] = TRUE ;
  1462. X        continue ;
  1463. X
  1464. X    case V_lager:
  1465. X        tag[V_bottle] = TRUE ;
  1466. X        continue ;
  1467. X
  1468. X    case V_fuse:
  1469. X        tag[V_cap] = TRUE ;
  1470. X        continue ;
  1471. X
  1472. X    case V_gleeps:
  1473. X        tag[V_PLURAL] = TRUE ;
  1474. X        tag[V_gleep] = TRUE ;
  1475. X        continue ;
  1476. X
  1477. X    case V_hoop:
  1478. X        tag[V_snake] = TRUE ;
  1479. X        continue ;
  1480. X
  1481. X    case V_M16:
  1482. X    case V_m16:
  1483. X    case V_gun:
  1484. X        tag[V_rifle] = TRUE ;
  1485. X        continue ;
  1486. X
  1487. X    case V_kangaroos:
  1488. X        tag[V_PLURAL] = TRUE ;
  1489. X        tag[V_kangaroo] = TRUE ;
  1490. X        continue ;
  1491. X
  1492. X    case V_magazine:
  1493. X    case V_ammo:
  1494. X        tag[V_clip] = TRUE ;
  1495. X        continue ;
  1496. X
  1497. X    case V_mail:
  1498. X    case V_envelope:
  1499. X        tag[V_letter] = TRUE ;
  1500. X        continue ;
  1501. X
  1502. X    case V_matches:
  1503. X        tag[V_PLURAL] = TRUE ;
  1504. X        tag[V_match] = TRUE ;
  1505. X        continue ;
  1506. X
  1507. X    case V_Ned:
  1508. X    case V_kelly:
  1509. X    case V_Kelly:
  1510. X        tag[V_ned] = TRUE ;
  1511. X        continue ;
  1512. X
  1513. X    case V_off_q:
  1514. X        tag[V_off] = TRUE ;
  1515. X        continue ;
  1516. X
  1517. X    case V_on_q:
  1518. X        tag[V_on] = TRUE ;
  1519. X        continue ;
  1520. X    case V_plan:
  1521. X        tag[V_map] = TRUE ;
  1522. X        continue ;
  1523. X
  1524. X    case V_painting:
  1525. X        tag[V_picture] = TRUE ;
  1526. X        continue ;
  1527. X
  1528. X    case V_doors:
  1529. X        tag[V_PLURAL] = TRUE ;
  1530. X        tag[V_door] = TRUE ;
  1531. X        continue ;
  1532. X
  1533. X    case V_pills:
  1534. X    case V_packet:
  1535. X        tag[V_PLURAL] = TRUE ;
  1536. X    case V_atropine:
  1537. X        tag[V_pill] = TRUE ;
  1538. X        continue ;
  1539. X
  1540. X    case V_safety:
  1541. X    case V_SAFE:
  1542. X        tag[V_safe] = TRUE ;
  1543. X        continue ;
  1544. X    case V_silver:
  1545. X        tag[V_coin] = TRUE ;
  1546. X        continue ;
  1547. X
  1548. X    case V_spinifexes:
  1549. X        tag[V_PLURAL] = TRUE ;
  1550. X        tag[V_spinifex] = TRUE ;
  1551. X        continue ;
  1552. X
  1553. X    case V_stick:
  1554. X        tag[V_dynamite] = TRUE ;
  1555. X        continue ;
  1556. X
  1557. X    case V_switch:
  1558. X        tag[V_button] = TRUE ;
  1559. X        continue ;
  1560. X
  1561. X    case V_treasure:
  1562. X        tag[V_all] = TRUE ;
  1563. X        continue ;
  1564. X
  1565. X    case V_I:
  1566. X        tag[V_single] = TRUE ;
  1567. X        continue ;
  1568. X
  1569. X    case V_III:
  1570. X        tag[V_triple] = TRUE ;
  1571. X        continue ;
  1572. X
  1573. X    case V_zero:
  1574. X        tag[V_0] = TRUE ;
  1575. X        continue ;
  1576. X
  1577. X    case V_forty_nine:
  1578. X        tag[V_49] = TRUE ;
  1579. X        continue ;
  1580. X
  1581. X    case V_sixty_seven:
  1582. X        tag[V_67] = TRUE ;
  1583. X        continue ;
  1584. X
  1585. X    case V_eighty_two:
  1586. X        tag[V_82] = TRUE ;
  1587. X        continue ;
  1588. X
  1589. X    default:
  1590. X        continue ;
  1591. X    }
  1592. X} /* end of sentence tag word scan */
  1593. Xverb = sent[0] ;
  1594. Xreturn ;
  1595. X
  1596. X} /* --- end of "parse" subroutine --- */
  1597. X
  1598. Xvoid purge(k_start, k_finish)
  1599. X/***********************************/
  1600. X/*                                 */
  1601. X/*   Sentence Purging Subroutine   */
  1602. X/*                                 */
  1603. X/* Version: Mk 1.0  3 March 1990   */
  1604. X/*                                 */
  1605. X/***********************************/
  1606. X
  1607. Xint k_start, *k_finish ;
  1608. X{
  1609. Xregister int k ;
  1610. Xint k_end ;
  1611. X
  1612. Xk_end = *k_finish ;
  1613. Xfor (k = k_start; k <= k_end-1; k++) sent[k] = sent[k+1] ;
  1614. X*k_finish = --k_end ;
  1615. X} /* --- end of "purge" subroutine --- */
  1616. X
  1617. Xvoid filler()
  1618. X/***********************************/
  1619. X/*                                 */
  1620. X/*        Looker Subroutine        */
  1621. X/*                                 */
  1622. X/* Version: Mk 1.0  18 August 1989 */
  1623. X/*                                 */
  1624. X/***********************************/
  1625. X{
  1626. X
  1627. Xif (tag[V_VERB_ONLY]) {
  1628. X    printf("Fill what?\n") ;
  1629. X    return ;
  1630. X}
  1631. Xif (tag[V_can]) {
  1632. X    if (object[O_can][J_loc] != B_have) 
  1633. Xprintf("You don't have the Fourex can in your possession!\n") ;
  1634. Xelse printf("I can't do it!  There's a hole in the can's bottom.\n") ;
  1635. X    return ;
  1636. X}
  1637. Xif (tag[V_bottle]) {
  1638. X    if (object[O_bottle][J_loc] != B_have) 
  1639. Xprintf("You don't have the bottle in your possession!\n") ;
  1640. Xelse printf("I can't do it!  The bottle has a crack in it's bottom.\n");
  1641. X    return ;
  1642. X}
  1643. Xprintf("I can't fill that!\n") ;
  1644. X} /* --- end of the "filler" subroutine --- */
  1645. X
  1646. Xvoid looker(n)
  1647. X/***********************************/
  1648. X/*                                 */
  1649. X/*        Looker Subroutine        */
  1650. X/*                                 */
  1651. X/* Version: Mk 1.0  18 August 1989 */
  1652. X/*                                 */
  1653. X/***********************************/
  1654. Xint n ;
  1655. X{
  1656. X#ifdef __TURBOC__
  1657. Xvoid long_descp(int), describe(int), objlooker(int), gleeper(int) ;
  1658. Xvoid actor(int), rdtxt(int) ;
  1659. X#endif
  1660. X
  1661. Xint m ;
  1662. X
  1663. X/* an isolated "look" means to just look at the room */
  1664. Xif (tag[V_VERB_ONLY]) { 
  1665. X    /* goto long description test*/
  1666. X    if ((room[n][M_rm_type] == T_was_long)||(n == R_lift_inside))
  1667. X       long_descp(n);
  1668. X    else describe (n) ;
  1669. X    objlooker(n) ; /* Check if there are objects in the room */
  1670. X    gleeper(n) ;   /* check for gleeps and update the gleep count */
  1671. X    /* describe unmovable action objects and status */
  1672. X    if (room[n][M_rm_type] == T_action_obj) actor(n) ;
  1673. X    return ;
  1674. X}
  1675. X
  1676. X/* Gleep tank */
  1677. Xif (tag[V_tank]) {
  1678. X    if (n == R_gleep_tank) {
  1679. Xprintf("You look inside the gleep tank and see a blue fluid which\n") ;
  1680. Xprintf("smells of chlorine") ;
  1681. X        if (gleep_score == 0) {
  1682. Xprintf(".\n") ;
  1683. X            return ;
  1684. X        }
  1685. X        if (gleep_score == 1) {
  1686. Xprintf(" and a single gleep submerged in the fluid.\n") ;
  1687. X            return ;
  1688. X        }
  1689. Xprintf(" and %d gleeps submerged in the fluid.\n",
  1690. X        gleep_score) ;
  1691. X        return ;
  1692. X    }
  1693. X    else {
  1694. X        printf("There is no gleep tank here!\n") ;
  1695. X        return ;
  1696. X    }
  1697. X}
  1698. X
  1699. X/* wall safe */
  1700. Xif (tag[V_safe]) {
  1701. X    if ((n == R_office_mang)&&
  1702. X        (room[R_office_mang][M_rm_status] >= S_revealed)) {
  1703. X        m = O_safe ;
  1704. X        rdtxt(m);
  1705. X    }
  1706. X    else printf("I see no safe here for me to describe.\n");
  1707. X    return ;
  1708. X}
  1709. X
  1710. Xfor (;;) {
  1711. X    /* map from the manager's office */
  1712. X    if (tag[V_map]) {
  1713. X        m = O_map_frag ;
  1714. X        break ;
  1715. X    }
  1716. X
  1717. X    /* Fourex can */
  1718. X    if (tag[V_can]) {
  1719. X        m = O_can ;
  1720. X        break ;
  1721. X    }
  1722. X
  1723. X    /* Atropine pills */
  1724. X    if (tag[V_pill]) {
  1725. X        m = O_pills ;
  1726. X        break ;
  1727. X    }
  1728. X
  1729. X    /* Qadaffi's letter bomb */
  1730. X    if (tag[V_letter]) {
  1731. X        m = O_letter ;
  1732. X        break ;
  1733. X    }
  1734. X
  1735. X    /* paper from the safe */
  1736. X    if (tag[V_paper]) {
  1737. X         m = O_paper ;
  1738. X        break ;
  1739. X    }
  1740. X
  1741. X    /* ammo clip */            
  1742. X    if (tag[V_clip]) {
  1743. X        m = O_clip ;
  1744. X        break ;
  1745. X    }
  1746. X
  1747. X    /* orange clip */
  1748. X    if (tag[V_org_clip]) {
  1749. X        m = O_org_clip ;
  1750. X        break ;
  1751. X    }
  1752. X
  1753. X    /* rifle */
  1754. X    if (tag[V_rifle]) {
  1755. X        m = O_rifle ;
  1756. X        break ;
  1757. X    }
  1758. X
  1759. X    /* Semtex detector */
  1760. X    if (tag[V_detector]) {
  1761. X        m = O_detector ;
  1762. X        break ;
  1763. X    }
  1764. X    /* Deal with unreadable objects */
  1765. X    printf("There is nothing more that I can describe about it.\n");
  1766. X    return ;
  1767. X} /* end of infinite for block */
  1768. X
  1769. Xif (object[m][J_loc] == B_have) rdtxt(m);
  1770. Xelse 
  1771. Xprintf("I can examine an object only if it is in my possession.\n");
  1772. X
  1773. X} /* --- end of the "looker" subroutine --- */
  1774. X
  1775. Xvoid pass()
  1776. X/***********************************/
  1777. X/*                                 */
  1778. X/*        Password Subroutine      */
  1779. X/*                                 */
  1780. X/* Version: Mk 1.0  29 July 1989   */
  1781. X/*                                 */
  1782. X/***********************************/
  1783. X{
  1784. X
  1785. X#ifdef __TURBOC__
  1786. Xvoid exit(int);
  1787. Xchar getch(void) ;
  1788. X#endif
  1789. X
  1790. Xregister int i ;
  1791. Xchar chr ;
  1792. Xstatic char *passwd = "2Xngootx7Ysd4Du9" ;
  1793. X
  1794. X/* Request password */
  1795. Xprintf("Enter password:  ") ;
  1796. X
  1797. X#ifndef __TURBOC__
  1798. Xfor (i = 2; i <= 7; i++) {
  1799. X    chr = getchar() ;
  1800. X    if (chr+i-1 != passwd[i]) exit(0) ;
  1801. X}    
  1802. Xif (getchar() != '\n') exit(0) ;
  1803. Xprintf(".\n") ;  /* indicate that the password was accepted */
  1804. X#endif
  1805. X
  1806. X#ifdef __TURBOC__
  1807. Xfor (i = 2; i <= 7; i++) {
  1808. X    chr = getch() ;
  1809. X    if (chr+i-1 != passwd[i]) { 
  1810. X        for (;;) if (getch() == 3) break ;
  1811. X        printf("\r                    \n") ;
  1812. X        exit(0) ;
  1813. X    }
  1814. X}
  1815. Xprintf("\r.                     \n") ;
  1816. X#endif
  1817. X
  1818. Xsw_wizard = TRUE ; /* toggle wizard switch */
  1819. X
  1820. X} /* --- end of the "pass" subroutine */
  1821. END_OF_FILE
  1822. if test 14440 -ne `wc -c <'parse.c'`; then
  1823.     echo shar: \"'parse.c'\" unpacked with wrong size!
  1824. fi
  1825. # end of 'parse.c'
  1826. fi
  1827. echo shar: End of archive 5 \(of 6\).
  1828. cp /dev/null ark5isdone
  1829. MISSING=""
  1830. for I in 1 2 3 4 5 6 ; do
  1831.     if test ! -f ark${I}isdone ; then
  1832.     MISSING="${MISSING} ${I}"
  1833.     fi
  1834. done
  1835. if test "${MISSING}" = "" ; then
  1836.     echo You have unpacked all 6 archives.
  1837.     rm -f ark[1-9]isdone
  1838. else
  1839.     echo You still need to unpack the following archives:
  1840.     echo "        " ${MISSING}
  1841. fi
  1842. ##  End of shell archive.
  1843. exit 0
  1844.