home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume17 / napoleon / part01 < prev    next >
Encoding:
Text File  |  1993-03-03  |  54.3 KB  |  1,595 lines

  1. Subject:  v17i038:  napoleon - text adventure game, Part01/04
  2. Newsgroups: comp.sources.games
  3. Approved: billr@saab.CNA.TEK.COM
  4.  
  5. Submitted-by: pc123@cus.cam.ac.uk (Pete Chown)
  6. Posting-number: Volume 17, Issue 38
  7. Archive-name: napoleon/Part01
  8. Environment: Unix, ASNI-C
  9.  
  10.     [From the author...]
  11.     [[Napoleon is a text adventure game, in the long tradition of such
  12.       games.  It is reasonably modern, though, in that it recognises
  13.       sentences of reasonable complexity.  It uses the GNU history library
  14.       to provide an editable command history.]]
  15.  
  16. #! /bin/sh
  17. # This is a shell archive.  Remove anything before this line, then unpack
  18. # it by saving it into a file and typing "sh file".  To overwrite existing
  19. # files, type "sh file -c".  You can also feed this as standard input via
  20. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  21. # will see the following message at the end:
  22. #        "End of archive 1 (of 4)."
  23. # Contents:  README MANIFEST custom.c lang.y napoleon.0
  24. # Wrapped by billr@saab on Thu Mar  4 09:46:52 1993
  25. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  26. if test -f 'README' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'README'\"
  28. else
  29. echo shar: Extracting \"'README'\" \(4561 characters\)
  30. sed "s/^X//" >'README' <<'END_OF_FILE'
  31. XWelcome to Napoleon!
  32. X
  33. XCompiling the game shouldn't be too difficult.  Here is how to set it
  34. Xup for your system:
  35. X
  36. X1.  Configuring the Makefile:
  37. X=============================
  38. X
  39. XThe SYSTEM line in the Makefile may well need changing for your
  40. Xsystem.  If you are not on Unix, it should contain simply -DPURE_ANSI.
  41. XOtherwise it should contain -DUNIX along with the following:
  42. X
  43. X-DHAS_UNISTD to tell it that it should include the header file
  44. Xunistd.h (not all systems have this file).
  45. X
  46. X-DHAS_STDLIB if your machine has stdlib.h.
  47. X
  48. X-DHAS_XMALLOC to tell it that your system has xmalloc() built into a
  49. Xlibrary, and it should not be redefined by the program.  Most systems
  50. Xdo not have this, but there are a few that do.
  51. X
  52. X-DDAVID_PILLINGS_BISON must be defined if you are compiling on the
  53. XAcorn Archimedes using David Pilling's port of Bison.  This port is a
  54. Xlittle strange, as there is no alloca() function available, and the
  55. Xcompilation must then proceed differently.
  56. X
  57. XYou will need bison or yacc - note that the line in the makefile
  58. Xgiving YACC=... must be set to
  59. X
  60. XYACC=bison -dy
  61. X
  62. Xor
  63. X
  64. XYACC=yacc -d
  65. X
  66. XNote the difference in arguments depending on which program you decide
  67. Xto use.
  68. X
  69. XIf you haven't got gcc, you will have to change the C compiler options
  70. Xto suit your compiler.
  71. X
  72. X2.  Installing the readline library:
  73. X====================================
  74. X
  75. XIf you are building on Unix you must also have access to the GNU
  76. Xreadline library - your commands are stored in a history and can be
  77. Xrecalled in much the same way as under Bash.  If you build with
  78. XPURE_ANSI defined, you will not need this, but if you build for Unix
  79. Xyou will.  It should be installed the same directory as the Napoleon
  80. Xsource, so that when you are in that directory:
  81. X
  82. Xreadline/libreadline.a
  83. X
  84. Xis the built library.  The current version of the readline library is
  85. Xreadline-1.1.tar.Z, available for FTP from the usual places that keep
  86. XGNU programs.  Be careful with this tar file, because it has got
  87. Xmessed up somehow so that if you untar it naively it will splat loads
  88. Xof files into the current directory (most GNU tar files untar
  89. Xeverything into a subdirectory).
  90. X
  91. XYou should therefore create the directory
  92. X
  93. Xreadline
  94. X
  95. Xand untar readline-1.1.tar.Z into it.  Then build the readline library
  96. Xas explained by its own documentation (usually just a case of typing
  97. X"make").
  98. X
  99. X3.  Building:
  100. X=============
  101. X
  102. XNow type "make" in the Napoleon directory.  It should be as easy as
  103. Xthat.
  104. X
  105. X4.  Possible problems:
  106. X======================
  107. X
  108. XIf you don't have an ANSI conforming compiler you will find it
  109. Xvirtually impossible to build the game.  It doesn't normally matter
  110. Xwhether you have ANSI header files - but the exception is stdarg.h.
  111. XIf you only have the old style varargs.h you will probably experience
  112. Xdifficulties.
  113. X
  114. XA lot of C compilers don't like having the GPL stored in one
  115. Xexceedingly long string.  This is a problem - I want to keep all the
  116. Xdata in with the code, it makes it much easier to do things with the
  117. Xexecutable once you have it, and I can't think of any other way of
  118. Xincorporating the GPL than to put it in as a string.
  119. X
  120. XIf you are using a pure System V Unix, you may have problems with the
  121. Xtermios library.  I can't really advise, since I don't have access to
  122. Xsuch a machine, but if you get it working I would be interested in
  123. Xhaving any patches that you needed to apply.
  124. X
  125. XSun OS seems to have a big problem.  It is not supplied with a
  126. Xstdarg.h, so you have to use gcc rather than its built in cc.  On the
  127. Xother hand, it doesn't have a difftime() function in its library.  To
  128. Xget round this, I have included the GNU library's difftime.c in the
  129. Xdistribution; to use it, simply add difftime.o to the list of object
  130. Xfiles in the Makefile.  Note that it might not work - ANSI doesn't
  131. Xspecify the format that times are stored in.  I have not come across a
  132. Xmachine where it doesn't, however.
  133. X
  134. XSome machines don't have the tmac.andoc file used to compile the
  135. Xmanpage.  If you are in this position, simply use napoleon.0, which is
  136. Xpre-compiled.
  137. X
  138. XSome machines have versions of yacc that produce output that conflicts
  139. Xwith the compiler.  This is very boring, and there isn't much I can do
  140. Xabout it...  just edit the output from yacc so it works.  Or use bison
  141. Xif you have it.
  142. X
  143. X5.  Other things:
  144. X=================
  145. X
  146. XNapoleon was written by Pete Chown; I can be contacted as:
  147. X
  148. Xpc123@phx.cam.ac.uk
  149. X...!uunet!uknet!camphx!pc123
  150. Xpc123@camphx.uucp
  151. X
  152. XI also have an account on the FSF machines:
  153. X
  154. Xpc@gnu.ai.mit.edu
  155. X
  156. XTry that if messages to the other addresses bounce.
  157. X
  158. XNapoleon is subject to the GNU General Public Licence.
  159. END_OF_FILE
  160. if test 4561 -ne `wc -c <'README'`; then
  161.     echo shar: \"'README'\" unpacked with wrong size!
  162. fi
  163. # end of 'README'
  164. fi
  165. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  166.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  167. else
  168. echo shar: Extracting \"'MANIFEST'\" \(703 characters\)
  169. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  170. X   File Name        Archive #    Description
  171. X-----------------------------------------------------------
  172. X MANIFEST                   1    This shipping list
  173. X Makefile                   2    
  174. X README                     1    
  175. X adv.h                      4    
  176. X copyright                  4    
  177. X custom.c                   1    
  178. X describe.c                 3    
  179. X difftime.c                 3    
  180. X file.c                     3    
  181. X lang.y                     1    
  182. X lex.c                      3    
  183. X line.c                     3    
  184. X napoleon.0                 1    
  185. X napoleon.nr                3    
  186. X noughts.c                  3    
  187. X objects.c                  2    
  188. X parse.c                    3    
  189. X quads.c                    2    
  190. X toplev.c                   4    
  191. END_OF_FILE
  192. if test 703 -ne `wc -c <'MANIFEST'`; then
  193.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  194. fi
  195. # end of 'MANIFEST'
  196. fi
  197. if test -f 'custom.c' -a "${1}" != "-c" ; then 
  198.   echo shar: Will not clobber existing file \"'custom.c'\"
  199. else
  200. echo shar: Extracting \"'custom.c'\" \(25896 characters\)
  201. sed "s/^X//" >'custom.c' <<'END_OF_FILE'
  202. X/* Copyright (C) 1992 Pete Chown.
  203. X
  204. X   Here is my latest adventure game, Napoleon (see the documentation
  205. X   if you don't know why it's called that).  Have fun... (don't cheat,
  206. X   even though you've got the source :-) ).
  207. X
  208. X   This game is free software; you can redistribute it and/or modify
  209. X   it under the terms of the GNU General Public License as published by
  210. X   the Free Software Foundation; either version 1, or (at your option)
  211. X   any later version.
  212. X
  213. X   The game is distributed in the hope that it will be useful, but
  214. X   WITHOUT ANY WARRANTY; without even the implied warranty of
  215. X   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  216. X   General Public License for more details.
  217. X
  218. X   The GNU General Public License is often shipped with GNU software, and
  219. X   is generally kept in a file called COPYING or LICENSE.  If you do not
  220. X   have a copy of the license, write to the Free Software Foundation,
  221. X   675 Mass Ave, Cambridge, MA 02139, USA. */
  222. X
  223. X#include "adv.h"
  224. X#include "lang.h"
  225. X
  226. X#define RESERVED_FOR_VERBOSITY_FLAG 0
  227. X#define RUSGREVE 1
  228. X#define PRENDERGAST 2
  229. X#define B_DOOR 3
  230. X#define S_DOOR 4
  231. X#define G_DOOR 5
  232. X#define GRANDMASTER 6
  233. X#define PRINCESS 7
  234. X#define MAGPIE 8
  235. X#define BUTLER 9
  236. X#define MOUSECOUNTER 10
  237. X#define ELEPHANTS 11
  238. X#define ELEPHANTFOLLOW 12
  239. X#define WAITCOUNT 13
  240. X#define WATERSPRITE 14
  241. X#define TENNIS 15
  242. X#define BIN 16
  243. X
  244. Xunsigned char flags [128];
  245. X
  246. Xstatic void remove_persons_objects(void)
  247. X{
  248. X  while(objects [yaccplayer].inside != 0)
  249. X  {
  250. X    int obj = objects [yaccplayer].inside;
  251. X
  252. X    detachfromchain(obj);
  253. X    addtochain(obj,59,& objects [59].inside);
  254. X  }
  255. X}
  256. X
  257. Xextern void twirl(void)
  258. X{
  259. X  int i;
  260. X  bool gotsomething = FALSE;
  261. X
  262. X  if(all) addfirstdescendants(getroom(yaccplayer));
  263. X  for(i = 0;i < listedobjects;i++)
  264. X  {
  265. X    if(objectlist [i] == 103) {
  266. X      format("You twirl the chair round and round, but nothing happens.");
  267. X    } else {
  268. X      format("How ever could you turn that?");
  269. X    }
  270. X  }
  271. X  listedobjects = 0;
  272. X  if(all && ! gotsomething) format("There is nothing here that you can reall"
  273. X"y turn!");
  274. X}
  275. X
  276. Xextern void turn(void)
  277. X{
  278. X  twirl();
  279. X}
  280. X
  281. Xextern int premove(int player,int dest)
  282. X{
  283. X  switch(dest)
  284. X  {
  285. X  case 6: case 20: case 55: case 56: /* Leaving the rickety wooden rooms */
  286. X    if(getroom(yaccplayer) < 6) {
  287. X      format("\nYou are suspended for a moment in absolute darkness, then a "
  288. X"voice pipes up, 'Always keep tight hold of nurse, /For fear of finding somet"
  289. X"hing worse!'\n\nSuddenly you emerge into daylight:\n");
  290. X    }
  291. X    break;
  292. X  case 15: /* poolside, going down */
  293. X    if(flags [WATERSPRITE] < 2) {
  294. X      format("You wisely decide not to go for a swim in the garden pond.\n");
  295. X      return 0;
  296. X    }
  297. X    break;
  298. X  case 18:
  299. X    if(flags [GRANDMASTER] != 4) flags [GRANDMASTER] = 1;
  300. X    break;
  301. X  case 19:
  302. X    if(flags [GRANDMASTER] == 4) format("You slip east while the Grandmaster"
  303. X" is still thinking over his recent failed match.");
  304. X    if(flags [GRANDMASTER] == 3) {
  305. X      format("The Grandmaster says, 'You won't get into there by buttering m"
  306. X"e up!'\n\nYou find that you are unable to go east.  Looking round, you see t"
  307. X"he Grandmaster making a magic sign.");
  308. X      return 0;
  309. X    }
  310. X    if(flags [GRANDMASTER] < 3) {
  311. X      format("You find that you are unable to go east.  Looking round, you s"
  312. X"ee the Grandmaster making a magic sign.");
  313. X      return 0;
  314. X    }
  315. X    break;
  316. X  case 17:
  317. X    if(flags [GRANDMASTER] != 3) {
  318. X      format("You find that you are unable to go south.  Looking round, you "
  319. X"see the Grandmaster making a magic sign.");
  320. X      return 0;      
  321. X    } else format("You slip south while the Grandmaster is basking in his vi"
  322. X"ctory.");
  323. X    break;
  324. X  case 37: /* Going up the tree */
  325. X    if(flags [MAGPIE] == 0) {
  326. X      format("As you start to climb the tree, the magpie flies full into you"
  327. X"r face, screeching angrily.  You lose your footing and fall to the ground.");
  328. X      return 0;
  329. X    }
  330. X    break;
  331. X  case 45: /* Going through the bronze door */
  332. X    if(flags [B_DOOR] == 0) {
  333. X      format("But the door is closed and locked!\n");
  334. X      return 0;
  335. X    }
  336. X    break;
  337. X  case 46: /* Going through the silver door */
  338. X    if(flags [S_DOOR] == 0) {
  339. X      format("But the door is closed and locked!\n");
  340. X      return 0;
  341. X    }
  342. X    break;
  343. X  case 47: /* Going through the golden door */
  344. X    if(flags [G_DOOR] == 0) {
  345. X      format("But the door is closed and locked!\n");
  346. X      return 0;
  347. X    }
  348. X    break;
  349. X  case 51: /* Leaving the elephants */
  350. X    if(getroom(player) == 52) {
  351. X      if(flags [MOUSECOUNTER] != 0) {
  352. X    format("You find that there is a step up, with a large overhang, which you "
  353. X"cannot negotiate while you are a mouse.  Perhaps a real mouse could climb up"
  354. X", but you lack practice.\n");
  355. X    return 0;
  356. X      } else {
  357. X    format("\nAs you leave one of the elephants starts following you.");
  358. X    objects [160 /* elephant */].objtype.virtual = 0;
  359. X    flags [ELEPHANTFOLLOW] = 1;
  360. X      }
  361. X    }
  362. X    break;
  363. X  case 99: /* One of the funny moves in the enchanted maze */
  364. X    switch(getroom(player))
  365. X    {
  366. X    case 31: 
  367. X      dest = delay > 9 ? 29 : 32;
  368. X      format("\nAs you move, you are startled by a number of green flashes!");
  369. X      break;
  370. X    case 32: dest = delay > 9 ? 33 : 27; break;
  371. X    case 33: dest = delay > 9 ? 34 : 31; break;
  372. X    case 34: dest = delay > 9 ? 29 : 35; break;
  373. X    case 35: dest = delay > 9 ? 33 : 38; break;
  374. X    default: fail();
  375. X    }
  376. X    break;
  377. X  }
  378. X  return dest;
  379. X}
  380. X
  381. Xextern void postmove(void)
  382. X{
  383. X  switch(getroom(yaccplayer))
  384. X  {
  385. X  case 22: /* Rusgreve's room */
  386. X    flags [RUSGREVE] |= 1;
  387. X    break;
  388. X  case 23: /* Prendergast's room */
  389. X    flags [PRENDERGAST] |= 1;
  390. X    break;
  391. X  case 47: /* Princess' room */
  392. X    flags [PRINCESS] |= 1;
  393. X    break;
  394. X  case 54: /* Lions' room */
  395. X    if(flags [MOUSECOUNTER] == 0) {
  396. X      format("As you enter the lions' den, they reveal that they are not onl"
  397. X"y ready for tummy tickles, and they gobble you up.\n");
  398. X      dead = TRUE;
  399. X    } else {
  400. X      format("\nThe lions don't notice the little mouse scampering across th"
  401. X"e floor.");
  402. X    }
  403. X    break;
  404. X  case 52: /* Elephants' room */
  405. X    if(flags [MOUSECOUNTER] != 0) flags [ELEPHANTS] = 1; else {
  406. X      if(flags [ELEPHANTS] == 1) {
  407. X    format("\nAs you try to enter the elephants' room, one of them collides wit"
  408. X"h you, and tramples you underfoot.\n");
  409. X    dead = TRUE;
  410. X      }
  411. X    }
  412. X    break;
  413. X  }
  414. X  if(flags [ELEPHANTFOLLOW] == 1) {
  415. X    detachfromchain(160 /* elephant */);
  416. X    addtochain(160,getroom(yaccplayer),& objects [getroom(yaccplayer)].inside);
  417. X  }
  418. X}
  419. X
  420. Xextern void postdescription(int player)
  421. X{
  422. X  if(flags [GRANDMASTER] == 1) {
  423. X    flags [GRANDMASTER] = 2;
  424. X    format("The Grandmaster says, 'Will you do me the honour of joining me i"
  425. X"n a game of noughts and crosses, young adventurer?'\n");
  426. X  }
  427. X
  428. X  if(flags [RUSGREVE] == 1) {
  429. X    format("Rusgreve says, 'I am not the leaker.'\n");
  430. X    flags [RUSGREVE] = 2;
  431. X  }
  432. X  if(flags [RUSGREVE] == 3) {
  433. X    format("Rusgreve says, 'Prendergast would say I was the leaker.'\n");
  434. X    flags [RUSGREVE] = 4;
  435. X  }
  436. X  if(flags [RUSGREVE] == 5) {
  437. X    format("Rusgreve says, 'Prendergast, I don't know how you put me up to t"
  438. X"his silly game, but I'm certainly not going on with it!'\n");
  439. X    flags [RUSGREVE] = 6;
  440. X  }
  441. X
  442. X  if(flags [PRENDERGAST] == 1) {
  443. X    format("Prendergast says, 'I am not the leaker.'\n");
  444. X    flags [PRENDERGAST] = 2;
  445. X  }
  446. X  if(flags [PRENDERGAST] == 3) {
  447. X    format("Prendergast says, 'Rusgreve would say I was the leaker.'\n");
  448. X    flags [PRENDERGAST] = 4;
  449. X  }
  450. X
  451. X  if(flags [PRINCESS] == 1) {
  452. X    flags [PRINCESS] = 2;
  453. X    format("The Princess says, 'Excellent!  I knew someone would come to res"
  454. X"cue me, it's part of being a princess really.  Now, to make sure you are gen"
  455. X"uine, I will just ask you a little question:  Who is it that has been leakin"
  456. X"g information from the Bureau?'\n");
  457. X  }
  458. X
  459. X  switch(getroom(player))
  460. X  {
  461. X  case 12: /* Tennis court */
  462. X    if(flags [TENNIS] == 0) {
  463. X      format("Suddenly two people enter the tennis courts.  'Ah, someone els"
  464. X"e.  Let's have a game of quadruples,' exclaims one in a public school accent"
  465. X".  The game begins...\n\n");
  466. X      if(quadruples()) {
  467. X    format("\n'Uuuh!' calls a linesman, which roughly translates to 'out'.\n'YO"
  468. X"U CANNOT BE SERIOUS!' yells one of the public schools, flinging down his rac"
  469. X"quet.  However the public school pair are experienced at this, and manage to"
  470. X" leave the court with all their rackets (one broken) and the trophies, which"
  471. X" they grabbed before anyone could stop them.\n\nThe umpire then comes up to "
  472. X"you, and says, 'I'm most dreadfully sorry about this, but all the trophies s"
  473. X"eem to have gone.  What can I give you?'\nHe casts his eyes around, and sees"
  474. X" something that looks like the Olympic torch.  He gives it to you, 'I'm sorr"
  475. X"y but this is all that is left!'\n\nFinally he too leaves the court.\n");
  476. X    detachfromchain(164);
  477. X    addtochain(164,yaccplayer,& objects [yaccplayer].inside);
  478. X      } else {
  479. X    format("\n'Thanks for the game old boy,' says one of the other players, as "
  480. X"they walk off with the two trophies, for the game's two winners.\n");
  481. X      }
  482. X      flags [TENNIS] = 1;
  483. X    }
  484. X    break;
  485. X  case 36: /* Climbable tree room */
  486. X    if(flags [MAGPIE] == 0) format("In the tree, a magpie chirps noisily.\n");
  487. X    break;
  488. X  case 44: /* Bronze door room */
  489. X    if(flags [B_DOOR] == 0) format("A heavy wooden door with a bronze lock b"
  490. X"locks progress to the south.\n");
  491. X    break;
  492. X  case 45: /* Silver door room */
  493. X    if(flags [S_DOOR] == 0) format("A heavy wooden door with a silver lock b"
  494. X"locks progress to the south.\n");
  495. X    break;
  496. X  case 46: /* Golden door room */
  497. X    if(flags [G_DOOR] == 0) format("A heavy wooden door with a golden lock b"
  498. X"locks progress to the south.\n");
  499. X    break;
  500. X  case 50: /* Bridge */
  501. X    if(flags [ELEPHANTFOLLOW] == 1) {
  502. X      format("The bridge holds up for a moment, and then collapses as a huge"
  503. X" elephant stamps onto it.\n");
  504. X      dead = TRUE;
  505. X    }
  506. X    break;
  507. X  case 52: /* Elephants' room */
  508. X    if(flags [ELEPHANTS] == 1) format("The elephants are jumping around in a"
  509. X" violent frenzy.\n");
  510. X    else format("The elephants watch you calmly.\n");
  511. X    break;
  512. X  }
  513. X}
  514. X
  515. Xextern bool dogreeting(int who)
  516. X{
  517. X  switch(who)
  518. X  {
  519. X  case 104: /* The Grandmaster */
  520. X    format("The Grandmaster says 'The compliments of the day to you, my youn"
  521. X"g friend.'");
  522. X    return TRUE;
  523. X  case 142: /* Rusgreve */
  524. X    format("Rusgreve says, 'Good morning to you Sir.'");
  525. X    return TRUE;
  526. X  case 143: /* Prendergast */
  527. X    format("Prendergast says, 'Mmmm.  Morning.' and then busies himself with"
  528. X" what he was doing without appearing to notice you properly.");
  529. X    return TRUE;
  530. X  case 156: /* Princess */
  531. X    format("The Princess says, 'Good morning.'");
  532. X  }
  533. X
  534. X  return FALSE;
  535. X}
  536. X
  537. Xextern bool dofarewell(int who)
  538. X{
  539. X  return FALSE;
  540. X}
  541. X
  542. Xextern bool referred_to(int recipient)
  543. X{
  544. X  if(recipient == 156 /* princess */)
  545. X  {
  546. X    if(subject == 140 /* butler */) {
  547. X      format("The Princess says, 'Good.  I'll allow you to rescue me.'\n\nPr"
  548. X"endergast's voice suddenly comes into your mind, 'Stand by.  We're going to "
  549. X"get you out.'\n\nThe room suddenly swims about you, and you find yourself ba"
  550. X"ck in your office.  The Princess isn't there, of course; she is waking up in"
  551. X" the room where she was asleep.\n\nCongratulations, you've completed Napoleo"
  552. X"n with a score of 99.5%% (as with all games of this type there is an impossi"
  553. X"ble puzzle that stops you getting a full score).  Have a nice day, your prom"
  554. X"pt should be reappearing about now...\n\n");
  555. X      finished = TRUE;
  556. X    } else {
  557. X      format("The Princess says, 'I don't think so.'");
  558. X    }
  559. X
  560. X    return TRUE;
  561. X  }
  562. X
  563. X  return FALSE;
  564. X}
  565. X
  566. Xextern void doyes(int who)
  567. X{
  568. X  switch(who)
  569. X  {
  570. X  case 104: /* Grandmaster */
  571. X    if(flags [GRANDMASTER] == 2) {
  572. X      format("The Grandmaster says, 'Excellent!  My friend, we shall begin a"
  573. X"t once.  We will play best of three games.  Now some have said that being \""
  574. X"X\" gives an advantage and they can then beat the best.  I say let them play"
  575. X" against the best, and we shall see.  So you may start in the first game.'");
  576. X      switch(playnoughts()) {
  577. X      case 0:
  578. X    format("The Grandmaster looks a little bit surprised and irritated.  He bow"
  579. X"s slightly, and says gruffly, 'Thank you for the game.'");
  580. X    flags [GRANDMASTER] = 4;
  581. X    break;
  582. X      case 1:
  583. X    format("The Grandmaster smiles and says, 'You are a promising young player."
  584. X"  With a few more years practice you will be really quite good!'");
  585. X    flags [GRANDMASTER] = 3;
  586. X    break;
  587. X      case 2:
  588. X    format("The Grandmaster chuckles to himself, and says, 'I don't think you w"
  589. X"ere really playing very hard.  Do you want to try again?'");
  590. X    break;
  591. X      }
  592. X    } else format("The Grandmaster says, 'I didn't think I was offering a ga"
  593. X"me.  I don't play with any riff-raff, you know!'");
  594. X    break;
  595. X  }
  596. X}
  597. X
  598. Xextern void dono(int who)
  599. X{
  600. X  switch(who)
  601. X  {
  602. X  case 104: /* Grandmaster */
  603. X    format("The Grandmaster says, 'I'm so sorry, I was looking forward to th"
  604. X"e game.'");
  605. X    break;
  606. X  }
  607. X}
  608. X
  609. Xextern void examineobject(int examiner,int this)
  610. X{
  611. X  switch(examiner)
  612. X  {
  613. X  case 104: /* The Grandmaster */
  614. X    format("The Grandmaster says, 'You are still young, and a pursuit of kno"
  615. X"wledge is a fine thing - but you cannot expect to acquire all the secrets of"
  616. X" the Universe in a single hour.'");
  617. X    break;
  618. X  case 125: /* The piano teacher */
  619. X    format("Rather unsympathetically, the teacher says, 'If you put half as "
  620. X"much effort into the piano as you put into your wild daydreams you would be "
  621. X"playing in the orchestra by now.'");
  622. X    break;
  623. X  case 142: /* Rusgreve */
  624. X    format("Rusgreve says, 'I don't know anything about that, sir.'");
  625. X    break;
  626. X  case 143: /* Prendergast */
  627. X    format("Prendergast says, 'Intriguing.  Hmm... no, no, I don't know.'");
  628. X    break;
  629. X  case 156: /* Princess */
  630. X    format("The Princess says, 'You're supposed to be rescuing me, not invit"
  631. X"ing me to look at things you've collected up around this horrible place.'");
  632. X    break;
  633. X  }
  634. X}
  635. X
  636. Xextern void justput(int what,int destination,int *chain)
  637. X{
  638. X  switch(destination)
  639. X  {
  640. X  case 108: /* Piano */
  641. X    if(what == 123 /* Punch card */) {
  642. X      destroy(123); /* Remove the punch card */
  643. X      format("The piano starts playing itself - the resulting music is only "
  644. X"marred by a loud clunking sound as the card mechanism turns over.\n\nThe pia"
  645. X"no teacher says, 'So you did do your practice this week after all.  In that "
  646. X"case, I can give you this - your parents asked me to give it to you when you"
  647. X" had achieved enough application not to do anything silly with it.'\n\nShe g"
  648. X"ives you a strange looking silver key.\n\n'And remember,' continues the teac"
  649. X"her, 'if you go looking for princesses firstly your piano playing will get n"
  650. X"o better, and secondly your quest is likely to be stopped by someone you kno"
  651. X"w very well.'\n");
  652. X      detachfromchain(124);
  653. X      addtochain(124,yaccplayer,& objects [yaccplayer].inside); /* Give you the key */
  654. X    }
  655. X    break;
  656. X  case 161: case 162: /* Vending machine or its slot */
  657. X    if(what == 145 /* 10p coin */) {
  658. X      destroy(145);
  659. X      detachfromchain(157 /* dictating machine */);
  660. X      addtochain(157,yaccplayer,& objects [yaccplayer].inside);
  661. X      format("The vending machine gives you a nice flashy new dictating mach"
  662. X"ine.\n");
  663. X    } else {
  664. X      format("You find that you can't get that into the slot.\n");
  665. X      detachfromchain(what);
  666. X      addtochain(what,yaccplayer,& objects [yaccplayer].inside); 
  667. X    }
  668. X    break;
  669. X  }
  670. X}
  671. X
  672. Xextern void play(int what)
  673. X{
  674. X  switch(what)
  675. X  {
  676. X  case 108: /* Piano */
  677. X    format("The piano makes a rather nasty donging sound, but nothing else h"
  678. X"appens.\n\nThe piano teacher says, 'What was that?  Do you actually do the p"
  679. X"ractice I set you?'\n");
  680. X    break;
  681. X  default:
  682. X    if(objects [what].objtype.alive) {
  683. X      format("Rusgreve's voice suddenly intrudes on your mind: 'Oi!  No hank"
  684. X"y panky, or we'll court martial you for breaching good order and military di"
  685. X"scipline!'\n\nYou wisely desist from whatever it was that you were thinking "
  686. X"of doing.\n");
  687. X    } else {
  688. X      format("You begin playing with %s.  It takes you back to when you were"
  689. X" young.\n",quickname("the",what));
  690. X    }
  691. X  }
  692. X}
  693. X
  694. Xextern void playnandc(int who)
  695. X{
  696. X  if(ispresent(who,yaccplayer)) {
  697. X    if(objects [who].objtype.alive) {
  698. X      if(who == 104 /* Grandmaster */) {
  699. X    doyes(104);
  700. X      } else {
  701. X    format("I don't think %s will want to play.\n",objects [who].longname);
  702. X      }
  703. X    } else {
  704. X      format("%s doesn't seem able to play, somehow.\n",quickname("The",who));
  705. X    }
  706. X  } else {
  707. X    format("I can't see anyone like that here.");
  708. X  }
  709. X}
  710. X
  711. Xextern bool wantsit(int destination,int what)
  712. X{
  713. X  switch(destination)
  714. X  {
  715. X  case 143: /* Prendergast */
  716. X    if(what == 144 /* coffee */) {
  717. X      destroy(144);
  718. X      format("Prendergast takes the coffee, and says distractedly, 'Mmm.  Th"
  719. X"anks very much.  Errm, here's 10p for the coffee machine.'");
  720. X      detachfromchain(145);
  721. X      addtochain(145,yaccplayer,& objects [yaccplayer].inside);
  722. X      return TRUE;
  723. X    }
  724. X    break;
  725. X  case 140: /* Butler */
  726. X    if(what == 124 /* silver key */) {
  727. X      detachfromchain(124);
  728. X      addtochain(124,49,& objects [49].inside);
  729. X      detachfromchain(159 /* potion */);
  730. X      addtochain(159,yaccplayer,& objects [yaccplayer].inside);
  731. X      format("The butler says, 'That's a very kind tip, Sir.  Please have th"
  732. X"is little bottle as a thank you for your kindness.  Being a butler never mak"
  733. X"es much to put on one side for retirement...'");
  734. X      return TRUE;
  735. X    }
  736. X  }
  737. X
  738. X  format("%s isn't wanted.",quickname("The",what));
  739. X
  740. X  return FALSE;
  741. X}
  742. X
  743. Xextern void throw(int overwhat)
  744. X{
  745. X  bool changingroom = getroom(yaccplayer) == 24 && overwhat == 24 /* balcony */,dontdrop = FALSE;
  746. X
  747. X  if(getroom(yaccplayer) == 14 && flags [WATERSPRITE] == 1 && 
  748. X     (overwhat == 163 /* sprite */ || overwhat == 0) && objectlist [0] == 164 /* torch */) {
  749. X    format("The water sprite is hit by the torch, and a huge cloud of steam "
  750. X"is produced.  When everything clears and you can see again, the torch and wa"
  751. X"ter sprite have both gone.  The pond is now empty of water and a hole leads "
  752. X"down.\n");
  753. X    destroy(163);
  754. X    destroy(164);
  755. X    dontdrop = TRUE;
  756. X    flags [WATERSPRITE] = 2;
  757. X  }
  758. X
  759. X  if(changingroom) {
  760. X    detachfromchain(yaccplayer);
  761. X    addtochain(yaccplayer,55,& objects [55].inside);
  762. X  }
  763. X
  764. X  if(! dontdrop) drop();
  765. X
  766. X  if(changingroom) {
  767. X    detachfromchain(yaccplayer);
  768. X    addtochain(yaccplayer,24,& objects [24].inside);
  769. X  }
  770. X}
  771. X
  772. Xextern void jump(int whatover)
  773. X{
  774. X  switch(getroom(yaccplayer))
  775. X  {
  776. X  case 24: /* Balcony */
  777. X    if(whatover == 126 /* Balcony */ || whatover == 0) {
  778. X      format("You panic horribly a moment before you would have jumped.  The"
  779. X" shock causes you to partially awaken from your dream.  But instead of findi"
  780. X"ng yourself in bed, you find that...\n");
  781. X      detachfromchain(yaccplayer);
  782. X      addtochain(yaccplayer,1,& objects [1].inside);
  783. X      descr = TRUE;
  784. X      /* Person's objects are taken away */
  785. X      remove_persons_objects();
  786. X    } else {
  787. X      format("You jump around, and nearly go over the side in your excitemen"
  788. X"t!");
  789. X    }
  790. X    break;
  791. X  case 50: /* Bridge */
  792. X    if(whatover == 0) {
  793. X      format("You dive over the side of the bridge, and into the cold water."
  794. X"  The shock causes you to partially awaken from your dream.  But instead of "
  795. X"finding yourself in bed, you find that...\n");
  796. X      detachfromchain(yaccplayer);
  797. X      addtochain(yaccplayer,1,& objects [1].inside);
  798. X      descr = TRUE;
  799. X    } else {
  800. X      format("You jump around, and nearly go over the side in your excitemen"
  801. X"t!");
  802. X    }
  803. X    break;
  804. X  case 37: /* Up the tree */
  805. X    format("You jump out of the tree, and fall rather painfully onto the flo"
  806. X"or.");
  807. X    detachfromchain(yaccplayer);
  808. X    addtochain(yaccplayer,36,& objects [36].inside);
  809. X    descr = TRUE;
  810. X    break;
  811. X  default:
  812. X    format("You jump around for a bit, then you feel silly and stop.");
  813. X    break;
  814. X  }
  815. X}
  816. X
  817. Xextern void touch(int what)
  818. X{
  819. X  if(what == 120 /* plate */) {
  820. X    format("You get a small electric shock from the plate.  Just enough to j"
  821. X"olt you some way towards waking up.  For a moment the room swims about you, "
  822. X"then Prendergast's voice cuts into your mind, 'Ah, yes, let's see what of yo"
  823. X"ur kit we can salvage... oops... botheration, we can't get anything that was"
  824. X" in the lab now... let's see what's there...'");
  825. X    detachfromchain(yaccplayer);
  826. X    addtochain(yaccplayer,1,& objects [1].inside);
  827. X    descr = TRUE;
  828. X    /* Person's objects are taken away */
  829. X    remove_persons_objects();
  830. X    /* Objects are given to the person from the storeroom */
  831. X    while(! objects [objects [17].inside].objtype.virtual)
  832. X    {
  833. X      int obj = objects [17].inside;
  834. X
  835. X      detachfromchain(obj);
  836. X      addtochain(obj,1,& objects [1].inside);
  837. X    }
  838. X  } else {
  839. X    if(objects [what].objtype.alive) {
  840. X      format("Rusgreve's voice suddenly intrudes on your mind: 'Oi!  No hank"
  841. X"y panky, or we'll court martial you for breaching good order and military di"
  842. X"scipline!'\n\nYou wisely desist from whatever it was that you were thinking "
  843. X"of doing.\n");
  844. X    } else {
  845. X      format("You touch %s, but nothing happens.",quickname("the",what));
  846. X    }
  847. X  }
  848. X}
  849. X
  850. Xextern void unlock(int what,int whatwith)
  851. X{
  852. X  if(what != 148 && what != 149 && what != 150) {
  853. X    format("You can't unlock that!");
  854. X    return;
  855. X  }
  856. X  if(whatwith != 124 && whatwith != 146 && whatwith != 147 && whatwith != 0) {
  857. X    format("You won't unlock anything with that!");
  858. X    return;
  859. X  }
  860. X  if(whatwith != 0) {
  861. X    if((what == 148 && whatwith != 147) || (what == 149 && whatwith != 124)
  862. X    || (what == 150 && whatwith != 146)) {
  863. X      format("The key doesn't fit.\n");
  864. X      return;
  865. X    }
  866. X  } else {
  867. X    if((what == 148 && ! ispresent(yaccplayer,147)) || (what == 149 && ! ispresent(yaccplayer,124))
  868. X    || (what == 150 && ! ispresent(yaccplayer,146))) {
  869. X      format("You don't seem to have the appropriate key.\n");
  870. X      return;
  871. X    }
  872. X  }
  873. X  format("The door glides silently up and out of sight.\n");
  874. X  switch(what)
  875. X  {
  876. X  case 148: flags [B_DOOR]++; destroy(148); break;
  877. X  case 149: flags [S_DOOR]++; destroy(149); break;
  878. X  case 150: flags [G_DOOR]++; destroy(150); break;
  879. X  default: fail();
  880. X  }
  881. X}
  882. X
  883. Xextern void record(int what,int whatwith)
  884. X{
  885. X  if(whatwith == 0) whatwith = 157 /* dictating machine */ ;
  886. X  if(whatwith != 157) {
  887. X    format("You can't record anything on that!");
  888. X    return;
  889. X  }
  890. X
  891. X  if(! ispresent(yaccplayer,157)) {
  892. X    format("You don't seem to have access to one of those.");
  893. X    return;
  894. X  }
  895. X
  896. X  if(what == 158 /* magpie */)
  897. X  {
  898. X    format("You start recording the magpie's squawks.  After a while you get"
  899. X" bored and start to replay them; the magpie, hearing a rival goes flapping a"
  900. X"way in search of it.  Finally you stop the tape and rejoice in the sudden si"
  901. X"lence.");
  902. X    flags [MAGPIE] = 1;
  903. X  } else {
  904. X    format("You record %s.",quickname("the",what));
  905. X  }
  906. X}
  907. X
  908. Xextern void drink(int what)
  909. X{
  910. X  switch(what)
  911. X  {
  912. X  case 144: /* coffee */
  913. X    format("You take a big swig of coffee.");
  914. X    break;
  915. X  case 159: /* potion */
  916. X    format("You drink some of the potion.  You immediately turn into a horri"
  917. X"ble smelly mouse!  Your possessions shrink with you, so you can still manage"
  918. X" to carry them (just).");
  919. X    flags [MOUSECOUNTER] = 10;
  920. X    break;
  921. X  default:
  922. X    format("You wisely refrain from trying to drink that!");
  923. X    break;
  924. X  }
  925. X}
  926. X
  927. Xextern void precommand(void)
  928. X{
  929. X  if(flags [MOUSECOUNTER] > 0) {
  930. X    if(--flags [MOUSECOUNTER] == 0) {
  931. X      format("You suddenly change back to human form.\n");
  932. X      if(getroom(yaccplayer) == 52 /* elephants room */) {
  933. X    format("During the transformation, one of the elephants collides with you, "
  934. X"squashing you almost without seeing you.\n");
  935. X    dead = TRUE;
  936. X      }
  937. X    }
  938. X  }
  939. X}
  940. X
  941. Xextern void do_wait(void)
  942. X{
  943. X  format("You wait...");
  944. X  switch(getroom(yaccplayer))
  945. X  {
  946. X  case 48: /* River bank */
  947. X    if(++flags [WAITCOUNT] == 2) {
  948. X      format("Suddenly one of the 'logs' opens its eyes.  You realise with p"
  949. X"anic that it isn't a log at all, but a crocodile.  However, the elephant mov"
  950. X"es towards the bank, extending its trunk.  'Another two feet, please,' it sa"
  951. X"ys, and the crocodile takes its trunk in capable jaws.  The elephant has sto"
  952. X"pped following you.\n");
  953. X      flags [ELEPHANTFOLLOW] = 0;
  954. X    }
  955. X    break;
  956. X  case 14: /* poolside */
  957. X    if(flags [WATERSPRITE] == 0) {
  958. X      format("Suddenly the water forms itself into a ghastly, semi-human for"
  959. X"m: a water sprite.  You recoil instinctively, avoiding being dragged under t"
  960. X"he water by its first attempt to grasp you, but it is rearing further out of"
  961. X" the water all the time...\n");
  962. X      detachfromchain(163);
  963. X      addtochain(163,14,& objects [14].inside);
  964. X      objects [163].objtype.virtual = 0;
  965. X      flags [WATERSPRITE] = 1;
  966. X    }
  967. X    break;
  968. X  }
  969. X}
  970. X
  971. Xextern void kiss(int what)
  972. X{
  973. X  if(what == 156 /* princess */) {
  974. X    format("The Princess slaps your face.  'I know that's what you're suppos"
  975. X"ed to do in fairy stories, but I already know I'm not in one of them because"
  976. X" you're hardly Prince Charming, are you?'\n");
  977. X  } else {
  978. X    if(objects [what].objtype.alive) {
  979. X      format("Rusgreve's voice suddenly intrudes on your mind: 'Oi!  No hank"
  980. X"y panky, or we'll court martial you for breaching good order and military di"
  981. X"scipline!'\n\nYou wisely desist from whatever it was that you were thinking "
  982. X"of doing.\n");
  983. X    } else {
  984. X      format("You feel a bit silly, but you kiss %s just the same.\n",quickname("the",what));
  985. X    }
  986. X  }
  987. X}
  988. X
  989. Xextern void search(int what)
  990. X{
  991. X  if(what == 136 /* Prendergast's bin */ && flags [BIN] == 0) {
  992. X    format("Among lots of other funny stuff, you find a bronze key.");
  993. X    flags [BIN] = 1;
  994. X    detachfromchain(147); /* bronze key */
  995. X    addtochain(147,yaccplayer,& objects [yaccplayer].inside);
  996. X  } else {
  997. X    format("You don't find anything.");
  998. X  }
  999. X}
  1000. X
  1001. Xextern void climb(int what)
  1002. X{
  1003. X  switch(what)
  1004. X  {
  1005. X  case 165: /* Tree, in the clearing */
  1006. X    direction = UP;
  1007. X    moveplayer();
  1008. X    break;
  1009. X  default:
  1010. X    format("You can't climb that!");
  1011. X    break;
  1012. X  }
  1013. X}
  1014. END_OF_FILE
  1015. if test 25896 -ne `wc -c <'custom.c'`; then
  1016.     echo shar: \"'custom.c'\" unpacked with wrong size!
  1017. fi
  1018. # end of 'custom.c'
  1019. fi
  1020. if test -f 'lang.y' -a "${1}" != "-c" ; then 
  1021.   echo shar: Will not clobber existing file \"'lang.y'\"
  1022. else
  1023. echo shar: Extracting \"'lang.y'\" \(5597 characters\)
  1024. sed "s/^X//" >'lang.y' <<'END_OF_FILE'
  1025. X%{ /* Hey emacs, this file is in -*- Fundamental -*- mode */
  1026. X
  1027. X/* Copyright (C) 1992 Pete Chown.
  1028. X
  1029. X   Here is my latest adventure game, Napoleon (see the documentation
  1030. X   if you don't know why it's called that).  Have fun... (don't cheat,
  1031. X   even though you've got the source :-) ).
  1032. X
  1033. X   This game is free software; you can redistribute it and/or modify
  1034. X   it under the terms of the GNU General Public License as published by
  1035. X   the Free Software Foundation; either version 1, or (at your option)
  1036. X   any later version.
  1037. X
  1038. X   The game is distributed in the hope that it will be useful, but
  1039. X   WITHOUT ANY WARRANTY; without even the implied warranty of
  1040. X   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  1041. X   General Public License for more details.
  1042. X
  1043. X   The GNU General Public License is often shipped with GNU software, and
  1044. X   is generally kept in a file called COPYING or LICENSE.  If you do not
  1045. X   have a copy of the license, write to the Free Software Foundation,
  1046. X   675 Mass Ave, Cambridge, MA 02139, USA. */
  1047. X
  1048. X/* You should be editing lang.y.  Do NOT EDIT lang.c as your edits will
  1049. X   just be thrown away. */
  1050. X
  1051. X#include "adv.h"
  1052. X
  1053. X%}
  1054. X
  1055. X%union {
  1056. X  char string [20];
  1057. X  int integer;
  1058. X}
  1059. X
  1060. X%token NORTH SOUTH WEST EAST NORTHWEST NORTHEAST SOUTHWEST SOUTHEAST
  1061. X%token UP DOWN INVENTORY LOAD LOOK QUIT SAVE SCORE GO EXAMINE ALL
  1062. X%token EVERYTHING IN INTO ON OFF TO GET DROP TAKE PUT INV RESTORE
  1063. X%token ONTO UNDER UNDERNEATH AT BELOW THE AND READ TWIRL TURN
  1064. X%token SAY ASK ABOUT YES NO HELLO HI GOODBYE BYE HACK PLAY WITH
  1065. X%token NOUGHTS CROSSES GIVE THROW OVER JUMP TOUCH UNLOCK OPEN BRIEF
  1066. X%token VERBOSE NORMAL RECORD DRINK WAIT KISS SEARCH CLIMB
  1067. X
  1068. X%token QUOTE FULLSTOP COMMA SEMICOLON
  1069. X
  1070. X%token <string> NOUN ADJECTIVE
  1071. X
  1072. X%type <integer> object noun_group
  1073. X
  1074. X%start line
  1075. X
  1076. X%%
  1077. X
  1078. Xline:        paragraph
  1079. X    |    command
  1080. X
  1081. Xparagraph:    sentence
  1082. X    |    sentence separator paragraph
  1083. X    |
  1084. X
  1085. Xcommand:    QUIT                { dead = TRUE; }
  1086. X    |    SAVE                { savegame(); }
  1087. X    |    load                { loadgame(); }
  1088. X    |    HACK                { hack(); }
  1089. X    |    BRIEF                { flags [0] = 1; }
  1090. X    |    VERBOSE                { flags [0] = 2; }
  1091. X    |    NORMAL                { flags [0] = 0; }
  1092. X
  1093. Xload:        LOAD
  1094. X    |    RESTORE
  1095. X
  1096. Xsentence:    GO direction            { moveplayer(); }
  1097. X    |    direction            { moveplayer(); }
  1098. X    |    special
  1099. X    |    fullsentence
  1100. X    |    direct_speech
  1101. X
  1102. Xdirection:    NORTH                { direction = NORTH; }
  1103. X    |    SOUTH                { direction = SOUTH; }
  1104. X    |    WEST                { direction = WEST; }
  1105. X    |    EAST                { direction = EAST; }
  1106. X    |    NORTHWEST            { direction = NORTHWEST; }
  1107. X    |    NORTHEAST            { direction = NORTHEAST; }
  1108. X    |    SOUTHWEST            { direction = SOUTHWEST; }
  1109. X    |    SOUTHEAST            { direction = SOUTHEAST; }
  1110. X    |    UP                { direction = UP; }
  1111. X    |    DOWN                { direction = DOWN; }
  1112. X
  1113. Xspecial:    LOOK                { descr = TRUE; looked = TRUE; }
  1114. X    |    SCORE                { format("You have visited %d%% of the game.",score); }
  1115. X    |    inventory            { inventory(yaccplayer); }
  1116. X
  1117. Xinventory:    INVENTORY
  1118. X    |    INV
  1119. X
  1120. Xseparator:    FULLSTOP
  1121. X    |    SEMICOLON
  1122. X
  1123. Xfullsentence:    examine objects            { examine(); }
  1124. X    |    READ objects            { do_read(); }
  1125. X    |    get objects            { get(); }
  1126. X    |    DROP objects            { drop(); }
  1127. X    |    THROW objects            { throw(0); }
  1128. X    |    THROW objects OVER object    { throw($4); }
  1129. X    |    THROW objects DOWN        { throw(0); }
  1130. X    |    THROW objects AT object        { throw($4); }
  1131. X    |    PUT objects in object        { put($4,& objects [$4].inside); }
  1132. X    |    PUT objects on object        { put($4,& objects [$4].above); }
  1133. X    |    PUT objects under object    { put($4,& objects [$4].below); }
  1134. X    |    turn_variant
  1135. X    |    play_variant
  1136. X    |    GIVE objects TO object        { give($4); }
  1137. X    |    GIVE object objects        { give($2); }
  1138. X    |    JUMP                { jump(0); }
  1139. X    |    JUMP OVER object        { jump($3); }
  1140. X    |    TOUCH object            { touch($2); }
  1141. X    |    UNLOCK object            { unlock($2,0); }
  1142. X    |    OPEN object            { unlock($2,0); }
  1143. X    |    UNLOCK object WITH object    { unlock($2,$4); }
  1144. X    |    OPEN object WITH object        { unlock($2,$4); }
  1145. X    |    RECORD object            { record($2,0); }
  1146. X    |    RECORD object WITH object    { record($2,$4); }
  1147. X    |    RECORD object ON object        { record($2,$4); }
  1148. X    |    DRINK object            { drink($2); }
  1149. X    |    WAIT                { do_wait(); }
  1150. X    |    KISS object            { kiss($2); }
  1151. X    |    SEARCH object            { search($2); }
  1152. X    |    LOOK IN object            { search($3); }
  1153. X    |    CLIMB object            { climb($2); }
  1154. X
  1155. Xexamine:    EXAMINE
  1156. X    |    LOOK AT
  1157. X
  1158. Xget:        TAKE
  1159. X    |    GET
  1160. X
  1161. Xin:        IN
  1162. X    |    INTO
  1163. X
  1164. Xon:        ON
  1165. X    |    ONTO
  1166. X
  1167. Xunder:        UNDER
  1168. X    |    UNDERNEATH
  1169. X    |    BELOW
  1170. X
  1171. Xobjects:    ALL                { all = TRUE; }
  1172. X    |    object                { addobject($1); }
  1173. X    |    object COMMA objects        { addobject($1); }
  1174. X    |    object AND objects        { addobject($1); }
  1175. X    |    object COMMA AND objects    { addobject($1); }
  1176. X
  1177. Xobject:        noun_group            { $$ = $1; if($$ < 1) YYERROR; }
  1178. X    |    THE noun_group            { $$ = $2; if($$ < 1) YYERROR; }
  1179. X
  1180. Xnoun_group:    NOUN                { $$ = getobject($1); }
  1181. X    |    adjective noun_group        { $$ = $2; }
  1182. X
  1183. Xadjective:    ADJECTIVE            { addadjective($1); }
  1184. X
  1185. Xturn_variant:    TWIRL objects            { twirl(); }
  1186. X    |    TWIRL ON objects        { twirl(); }
  1187. X    |    TURN objects            { turn(); }
  1188. X
  1189. Xplay_variant:    PLAY object            { play($2); }
  1190. X    |    PLAY WITH object        { play($3); }
  1191. X    |    PLAY NOUGHTS AND CROSSES    { playnandc(104); }
  1192. X    |    PLAY NOUGHTS AND CROSSES WITH object    { playnandc($6); }
  1193. X
  1194. Xdirect_speech:    SAY TO object quote speech quote    { speech($3,0); }
  1195. X    |    SAY quote speech quote TO object    { speech($6,0); }
  1196. X    |    SAY quote speech quote        { speech(getbeastie(),0); }
  1197. X    |    object COMMA speech        { speech($1,0); }
  1198. X    |    ASK object ABOUT ssf objects csf    { speech($2,1); }
  1199. X
  1200. Xquote:        QUOTE
  1201. X    |
  1202. X
  1203. Xspeech:        ssf speech_text csf
  1204. X
  1205. Xssf:                        { speechflag = TRUE; }
  1206. X
  1207. Xcsf:                        { speechflag = FALSE; }
  1208. X
  1209. Xspeech_text:    greeting            { said = 0; }
  1210. X    |    LOOK AT object            { said = 1; subject = $3; }
  1211. X    |    EXAMINE object            { said = 1; subject = $2; }
  1212. X    |    YES                { said = 2; }
  1213. X    |    NO                { said = 3; }
  1214. X    |    farewell            { said = 4; }
  1215. X    |    object                { said = 5; subject = $1; }
  1216. X
  1217. Xgreeting:    HELLO
  1218. X    |    HI
  1219. X
  1220. Xfarewell:    GOODBYE
  1221. X    |    BYE
  1222. X
  1223. X%%
  1224. X
  1225. X#ifdef DAVID_PILLINGS_BISON
  1226. X
  1227. X#include "lex.c"
  1228. X#include "parse.c"
  1229. X
  1230. X#endif
  1231. END_OF_FILE
  1232. if test 5597 -ne `wc -c <'lang.y'`; then
  1233.     echo shar: \"'lang.y'\" unpacked with wrong size!
  1234. fi
  1235. # end of 'lang.y'
  1236. fi
  1237. if test -f 'napoleon.0' -a "${1}" != "-c" ; then 
  1238.   echo shar: Will not clobber existing file \"'napoleon.0'\"
  1239. else
  1240. echo shar: Extracting \"'napoleon.0'\" \(14166 characters\)
  1241. sed "s/^X//" >'napoleon.0' <<'END_OF_FILE'
  1242. XNAPOLEON(1)                 386BSD Reference Manual                NAPOLEON(1)
  1243. X
  1244. XNAME
  1245. X     napoleon - adventure game
  1246. X
  1247. XSYNOPSIS
  1248. X     napoleon
  1249. X
  1250. XDESCRIPTION
  1251. X     Napoleon is a traditional text adventure game.  On the other hand it is
  1252. X     modern in the sense that it has a yacc/bison parser to allow you to type
  1253. X     more complex commands than the traditional two words.
  1254. X
  1255. X     You already know what an adventure game is, I expect... so all that re-
  1256. X     mains is to set the scene for this particular one:
  1257. X
  1258. XINTRODUCTION
  1259. X     It was an alarmingly dark night.  In Rusgreve's office, a solitary candle
  1260. X     burned, and spluttered fitfully in the slight breeze.  The Council of War
  1261. X     began.  Prendergast lit a smelly cigarette.
  1262. X
  1263. X     Rusgreve began to explain the problem.  'The difficulty is,' he said,
  1264. X     'someone is going to have to go in without us having first obtained prop-
  1265. X     er information.  It isn't going to be me.'
  1266. X
  1267. X     Many, many weeks previously, the investigation had begun.  At first, Rus-
  1268. X     greve had claimed there was nothing to worry about.  After a time, that
  1269. X     became a bigger worry than the things people might have worried about,
  1270. X     and so he rewrote history so that in fact he had been concerned all
  1271. X     along.  The delay rather hindered the efforts to gain information about
  1272. X     the people involved prior to sending in an agent.
  1273. X
  1274. X     Many, many years previously, the so-called Napoleon gang had been normal
  1275. X     criminals - yes, they did a bit of time here, and yes, there was the odd
  1276. X     bungled attack there.  Then things changed for the better (although it
  1277. X     was worse for everyone else).  The first and most important change was
  1278. X     that Rusgreve took over as director of the Criminal Re- education Bureau,
  1279. X     responsible for placing crooks in the nick for re-education.
  1280. X
  1281. X     The second, and less important change was that the Napoleon gang were
  1282. X     joined by a fourth member.  This member was known as Professor R. P. P.
  1283. X     Tinthywinkle-Croack.  Rusgreve pointed out early on how surprising it was
  1284. X     that one of the Napoleon gang was using his real name.  Unfortunately it
  1285. X     rapidly became obvious that this was not so.  Information was passed out
  1286. X     to the Napoleons which was supposed to be top secret, for your eyes only,
  1287. X     printed on red paper.  This led to the uncharitable starting to believe
  1288. X     that somewhere in the CRB, a leaker was at work.  An immediate Public En-
  1289. X     quiry was set up, which served only to pass still more information into
  1290. X     the hands of Joe Public (who Rusgreve always suspected of being a secret
  1291. X     Communist - others only suspected Rusgreve of being a little simple).
  1292. X
  1293. X     One particular piece of information which got into the hands of the
  1294. X     Napoleon gang was the knowledge of how to idea-flip.  Prendergast was
  1295. X     originally employed to try to research this topic, in order that it could
  1296. X     be directed at miscreants, as part of the re-education programme.  We
  1297. X     asked him to explain it to the Council of War so that it could be quoted
  1298. X     below:
  1299. X
  1300. X     When you dream, you populate your dreams with other people.  However
  1301. X     those people don't know that they were in your dream (unless you tell
  1302. X     them, yes, Rusgreve).  Now if we can bring sufficient energy to bear on
  1303. X     the problem, we can arrange it so that people's dreams come true; they
  1304. X     don't know it, and neither does anyone else unless some action is taken
  1305. X     to transport people to them.  But when this happens, two people can meet
  1306. X     in a dream, and both people will remember the same dream when they wake
  1307. X     up.
  1308. X
  1309. X     Now this is not just of academic interest.  Many people saw a lot of po-
  1310. X     tential in this system for creating everything from idyllic gardens to
  1311. X     death traps (the use the Napoleon gang were eventually to find).
  1312. X
  1313. X     What was not appreciated was that people's dreams were not being realised
  1314. X     individually but instead everyone who placed their dreams at the disposal
  1315. X     of the idea-flipping machine had their dreams combined into a single very
  1316. X     large system.  In the end portions of the system became quite well
  1317. X     ordered.  In places this was because people deliberately dreamed in such
  1318. X     a way as to create improved order while in others it was due simply to
  1319. X     people with efficient minds dreaming.
  1320. X
  1321. X     This caused the Napoleon gang a lot of problems.  The point was that they
  1322. X     wanted to create death traps to which people could be whisked as soon as
  1323. X     they fell asleep.  But the majority of the dreamland was neutral or good,
  1324. X     since wide publication of the invention had been prevented;  apart from
  1325. X     the Napoleon gang, everyone who knew about the invention was concerned
  1326. X     with creating safe places for people to go.
  1327. X
  1328. X     However there are nasty places.  These, however, have been watered down
  1329. X     by the proximity of good areas.  They are now much more what you make of
  1330. X     them than unreservedly bad.  That is, you have to survive by your wits.
  1331. X
  1332. X     Next Rusgreve himself gave a short briefing to the meeting, reading from
  1333. X     a large pad in front of him on the table:
  1334. X
  1335. X     Now it wouldn't be so bad if the Napoleon gang hadn't managed to steer
  1336. X     anyone to the unpleasant areas, but they have.  They created for them-
  1337. X     selves a complex of rooms with exits leading to all the bad places; then
  1338. X     they entered the dreamland looking for someone important who could be
  1339. X     kidnapped and held hostage there.  And they found someone: the Princess
  1340. X     Caroline, who was dreaming naturally and was unaware that she had moved
  1341. X     from dream to semi reality.
  1342. X
  1343. X     She has been asleep ever since, and cannot be woken.  It has been put
  1344. X     about that she is ill, but those people knowing about the idea-flipping
  1345. X     secret know that she is not ill.  So do the Napoleon gang, who have asked
  1346. X     for a large fee in return for releasing her.  But someone's going to have
  1347. X     to go into the dreamland to let her out.
  1348. X
  1349. X     'Well volunteered,' said Rusgreve to you at about this point.
  1350. X
  1351. X     'Hmmm,' said Prendergast, 'I suppose we could easily put someone into the
  1352. X     Napoleon gang's rooms that lead to all the nasty bits.  It's just if they
  1353. X     get killed, they won't come back, just like the Princess Caroline
  1354. X     didn't.'
  1355. X
  1356. X     'We won't get anywhere without taking a few risks,' said Rusgreve, kind-
  1357. X     ly.
  1358. X
  1359. X     'We don't know what unpleasant things the Napoleon gang might have put
  1360. X     there for unexpected visitors, though,' said Prendergast.
  1361. X
  1362. X     The exchanges went on for quite some time.  In the end Rusgreve, as di-
  1363. X     rector of the Bureau, overruled all objections and annouced that Some-
  1364. X     thing Must be Done.  You are on your way.
  1365. X
  1366. X     'Alright then,' said Prendergast with a sigh.  'We'll be able to keep
  1367. X     watch over you until you leave the Napoleons' place for the various nasty
  1368. X     bits, and make sure nothing too nasty happens.  But we won't be able to
  1369. X     help you operate whatever the Napoleons have put there, and we won't be
  1370. X     able to help you once you get past there into the rest of the dreamland.'
  1371. X
  1372. X
  1373. X     'And good luck,' finished Rusgreve. 'We appreciate what you are doing.
  1374. X     We will give you the papers you need to carry out this mission to the
  1375. X     best of your ability - and remember the most important thing.  Read the
  1376. X     scroll in the office at the centre of the Napoleons' headquarters.'
  1377. X
  1378. XSHEET 604
  1379. X     Target Information -- Napoleon Gang (sheet # 604)
  1380. X
  1381. X     Up to date information on the Napoleons is difficult to come by.  Over
  1382. X     the last few years they have moved from being really quite ordinary crim-
  1383. X     inals who we have been able to have a try at re-educating sometimes to
  1384. X     their present form.
  1385. X
  1386. X     It is popularly believed that they 'hit the big time' as the leader liked
  1387. X     to put it, when the information on idea- flipping fell into their hands,
  1388. X     apparently leaked by someone at the Bureau.  We would like to stress that
  1389. X     this is almost certainly not the case and it is thought to be highly un-
  1390. X     likely that anyone at the Bureau could have been responsible for the sud-
  1391. X     den rise to power that the Napoleon gang have experienced.
  1392. X
  1393. X     The reason we haven't got much information to place in this report is
  1394. X     that the Napoleons have become very accustomed to secrecy.  Last year one
  1395. X     of our operatives had to pretend to be a window-cleaner after he was seen
  1396. X     fixing an electronic device to their window frame.  It is believed that
  1397. X     his cover may have been compromised by someone at the Bureau and everyone
  1398. X     is urged to be uncommonly vigilant to prevent unauthorised activities
  1399. X     such as leaking from being carried on.  The attached device subsequently
  1400. X     only ever recorded people berating the Bureau for inefficiency in catch-
  1401. X     ing criminals.
  1402. X
  1403. X     The Napoleon gang is, however, known to have three members, as well as
  1404. X     Professor R. P. P. Tinthywinkle-Croack.  Apart from the Professor, all
  1405. X     the members use false names, and so the accuracy of what follows cannot
  1406. X     be guaranteed.
  1407. X
  1408. X     Napoleon target # 1: Richard Entwhistle-SmytheCumbert
  1409. X
  1410. X     Commonly uses the alias of Fred Smith.
  1411. X
  1412. X     Served five years in jail for robbery with violence, while the Napoleons
  1413. X     were in a less subtle phase.
  1414. X
  1415. X     Commonly believed to be the leader of the outfit, RESC seemed to be the
  1416. X     first to hear of the opportunity available with the idea-flipping ma-
  1417. X     chine.  He approached Professor Tinthywinkle-Croack to bring him in on
  1418. X     the project.  The meeting was monitored, but unfortunately took place in
  1419. X     a language for which a translator could not be found for another three
  1420. X     weeks, by which time it was, of course, far too late.
  1421. X
  1422. X     If you see RESC, take great care.  He may attack with a savagery learnt
  1423. X     during his days as a robber.  He may try to trick you, using his undoubt-
  1424. X     ed verbal skill.  He may ignore you and hope you go away.  He might at-
  1425. X     tempt to recruit you, and we wouldn't want that, would we?
  1426. X
  1427. X     RESC may be recognised in the dreamland by his tendency to end up leading
  1428. X     what ever bizarre operation someone has 'dreamed' up.  One of nature's
  1429. X     leaders, he will lead you into compromising the Bureau if you are not
  1430. X     careful.  Be warned.  If you change sides, the whole arsenal of the Bu-
  1431. X     reau's sophisticated tools will be pointed at you.
  1432. X
  1433. X     Napoleon target # 2: Charlie Zzzwocke
  1434. X
  1435. X     Changed his name by Deed Poll in order that he could take part in a bank
  1436. X     fraud.
  1437. X
  1438. X
  1439. X     Commonly uses the alias of Uncle Z, which is not very convincing, but you
  1440. X     believe that that is his name when he is standing over you asking whether
  1441. X     you want to buy any insurance.
  1442. X
  1443. X     A natural thug, he is available for any operation involving crimes of vi-
  1444. X     olence in a dark alley.  He was brought into the fraud because someone
  1445. X     realised that the person most at risk was the one with the funny name -
  1446. X     and predictably Zzzwocke got caught.  He served three months at an open
  1447. X     prison before absconding.
  1448. X
  1449. X     While on the run, he took part in an attack on a bank.  Unfortunately the
  1450. X     bank had folded several months previously and there was now nothing in
  1451. X     the branch except a pile of old paying-in slips.  He took these, and
  1452. X     started to run out before falling over the doormat and letting his gun
  1453. X     off across the street.  RESC saw him and thought him the ideal gang mem-
  1454. X     ber - frightening to anyone not wanting insurance, but not intelligent
  1455. X     enough to have leadership ambitions.  RESC removed him from under the
  1456. X     noses of the police.
  1457. X
  1458. X     Of all the gang members, Zzzwocke is the least at home in dreamland.
  1459. X     'Namby-pamby' pursuits like dreaming are not for him, and a sudden shock
  1460. X     will sometimes cause him to wake up.
  1461. X
  1462. X     Napoleon target # 3: Brian Turner
  1463. X
  1464. X     [ Note: the above name is believed to be too ordinary to be correct.
  1465. X     Would anyone who would like to suggest an alternative name please contact
  1466. X     the information desk on the number shown below. ]
  1467. X
  1468. X     Not using any aliases, Brian Turner is a supremely confident talker who
  1469. X     could sell double glazing to... well, anyone really.  He has been in-
  1470. X     volved in organised crime ever since his childhood, when he 'organised'
  1471. X     people to distract the store detective while his friends helped them-
  1472. X     selves to chocolate bars.  Predictably, he got caught, and was cautioned.
  1473. X
  1474. X     Later he turned his attention to selling timeshare holidays.  This ended
  1475. X     when he got so good at it that he sold himself one, forgetting all the
  1476. X     bad points, like that it was still just a hole in the ground.
  1477. X
  1478. X     Later he turned his attention to getting people to put thousands of
  1479. X     pounds in brown envelopes and leave them in the hotel safe.  One of the
  1480. X     people he did this to was our own Rusgreve, and this was the reason why
  1481. X     Rusgreve decided to go into crime prevention, in order to get his own
  1482. X     back.  This particular misdeed therefore had repercussions for the crime
  1483. X     statistics far beyond its own ability to increment them.
  1484. X
  1485. X     Finally, he joined the Napoleons when a man who had just been cheated
  1486. X     turned nasty.  That man was Mr Zzzwocke.
  1487. X
  1488. X     If you have any further information to add to this dossier, please ring
  1489. X     4733 and ask for Peabody.
  1490. X
  1491. X     If you believe that your cover may have been compromised, please ring
  1492. X     8955 and ask to speak to the Editor.
  1493. X
  1494. XSHEET 904
  1495. X     Target Information -- Bureau Leaker (sheet # 904)
  1496. X
  1497. X     (this page intentionally left blank)
  1498. X
  1499. X     If you have any further information to add to this dossier, please ring
  1500. X     4733 and ask for Peabody.
  1501. X
  1502. X     If you believe that your cover may have been compromised, please ring
  1503. X     8955 and ask to speak to the Editor.
  1504. X
  1505. X
  1506. XDIAGNOSTICS
  1507. X     Exit status is always 0.  All errors are reported interactively by the
  1508. X     program.
  1509. X
  1510. XBUGS
  1511. X     Surely not?
  1512. X
  1513. XHISTORY
  1514. X     This is the first version.  History is just about to start... :-)
  1515. X
  1516. XBSD Experimental               February 28, 1993                             6
  1517. X
  1518. X
  1519. X
  1520. X
  1521. X
  1522. X
  1523. X
  1524. X
  1525. X
  1526. X
  1527. X
  1528. X
  1529. X
  1530. X
  1531. X
  1532. X
  1533. X
  1534. X
  1535. X
  1536. X
  1537. X
  1538. X
  1539. X
  1540. X
  1541. X
  1542. X
  1543. X
  1544. X
  1545. X
  1546. X
  1547. X
  1548. X
  1549. X
  1550. X
  1551. X
  1552. X
  1553. X
  1554. X
  1555. X
  1556. X
  1557. X
  1558. X
  1559. X
  1560. X
  1561. X
  1562. X
  1563. X
  1564. X
  1565. X
  1566. X
  1567. X
  1568. X
  1569. X
  1570. X
  1571. X
  1572. END_OF_FILE
  1573. if test 14166 -ne `wc -c <'napoleon.0'`; then
  1574.     echo shar: \"'napoleon.0'\" unpacked with wrong size!
  1575. fi
  1576. # end of 'napoleon.0'
  1577. fi
  1578. echo shar: End of archive 1 \(of 4\).
  1579. cp /dev/null ark1isdone
  1580. MISSING=""
  1581. for I in 1 2 3 4 ; do
  1582.     if test ! -f ark${I}isdone ; then
  1583.     MISSING="${MISSING} ${I}"
  1584.     fi
  1585. done
  1586. if test "${MISSING}" = "" ; then
  1587.     echo You have unpacked all 4 archives.
  1588.     rm -f ark[1-9]isdone
  1589. else
  1590.     echo You still need to unpack the following archives:
  1591.     echo "        " ${MISSING}
  1592. fi
  1593. ##  End of shell archive.
  1594. exit 0
  1595.