act4.1 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132
  1. ; "SUBTITLE THE ENDGAME"
  2. <OR <GASSIGNED? END-GAME!-FLAG> <BLOAT 20000 0 0 500>>
  3. "============ ZORK END-GAME FUNCTIONS ============="
  4. <SETG END-GAME-EXISTS? T>
  5. ;"enable endgame"
  6. <SETG END-GAME!-FLAG <>>
  7. ;"endgame has begun?"
  8. <DEFMAC DOPEN ('OBJ) <FORM TRO .OBJ ,OPENBIT>>
  9. <DEFMAC DCLOSE ('OBJ) <FORM TRZ .OBJ ,OPENBIT>>
  10. <DEFINE DPR (OBJ)
  11. #DECL ((OBJ) OBJECT)
  12. <COND (<TRNN .OBJ ,OPENBIT> "open.")("closed.")>>
  13. ;"SUBTITLE Is There Life after Death?"
  14. <DEFINE TOMB-FUNCTION ()
  15. <COND (<VERB? "LOOK">
  16. <TELL ,TOMB-DESC1
  17. ,LONG-TELL1 <DPR <FIND-OBJ "TOMB">>
  18. ,TOMB-DESC2>)>>
  19. <DEFINE CRYPT-FUNCTION ("AUX" (EG? ,END-GAME!-FLAG))
  20. #DECL ((EG?) <OR ATOM FALSE>)
  21. <COND (<AND .EG? <VERB? "LOOK">>
  22. <TELL ,CRYPT-DESC
  23. ,LONG-TELL1
  24. <DPR <FIND-OBJ "TOMB">>>)>>
  25. <DEFINE CRYPT-OBJECT ("AUX" (EG? ,END-GAME!-FLAG)
  26. (C <FIND-OBJ "TOMB">))
  27. #DECL ((EG?) <OR ATOM FALSE> (C) OBJECT)
  28. <COND (<AND <NOT .EG?> <HEAD-FUNCTION>>)
  29. (<AND .EG? <VERB? "OPEN">>
  30. <COND (<NOT <TRNN .C ,OPENBIT>>
  31. <DOPEN .C>
  32. <TELL
  33. "The door of the crypt is extremely heavy, but it opens easily.">)
  34. (ELSE
  35. <TELL "The crypt is already open.">)>
  36. T)
  37. (<AND .EG? <VERB? "CLOSE">>
  38. <COND (<TRNN .C ,OPENBIT>
  39. <DCLOSE .C>
  40. <TELL "The crypt is closed.">)
  41. (ELSE <TELL "The crypt is already closed.">)>
  42. <COND (<==? ,HERE <FIND-ROOM "CRYPT">>
  43. <CLOCK-INT ,STRTE 3>)>)>>
  44. <DEFINE START-END ("AUX" (HERE ,HERE))
  45. #DECL ((HERE) ROOM)
  46. <COND (<==? .HERE <FIND-ROOM "CRYPT">>
  47. <COND (<LIT? .HERE>
  48. <CLOCK-INT ,STRTE 3>)
  49. (ELSE
  50. <TELL ,PASS-WORD-INST ,LONG-TELL1>
  51. <ENTER-END-GAME>)>)>>
  52. <DEFINE ENTER-END-GAME ("AUX" (LAMP <FIND-OBJ "LAMP">) (SWORD <FIND-OBJ "SWORD">)
  53. C (W ,WINNER))
  54. #DECL ((LAMP SWORD) OBJECT (C) <VECTOR FIX CEVENT> (W) ADV)
  55. <TRO .LAMP ,LIGHTBIT>
  56. <TRZ .LAMP ,ONBIT>
  57. <PUT <SET C <OLINT .LAMP>> 1 0>
  58. <PUT <2 .C> ,CTICK 350>
  59. <PUT <2 .C> ,CFLAG <>>
  60. <PUT ,SWORD-DEMON
  61. ,HACTION
  62. <COND (<TYPE? ,SWORD-GLOW OFFSET> ,SWORD-GLOW)
  63. (SWORD-GLOW)>>
  64. <PUT ,ROBBER-DEMON ,HACTION <>>
  65. <MAPF <>
  66. <FUNCTION (O "AUX" L)
  67. #DECL ((O) OBJECT (L) <OR FALSE VECTOR>)
  68. <COND (<SET L <OLINT .O>> <CLOCK-DISABLE <2 .L>>)>>
  69. <AOBJS .W>>
  70. <TRO .LAMP ,TOUCHBIT>
  71. <TRO .SWORD ,TOUCHBIT>
  72. <PUT <PUT .LAMP ,OROOM <>> ,OCAN <>>
  73. <PUT <PUT .SWORD ,OROOM <>> ,OCAN <>>
  74. <PUT .W ,AOBJS (.LAMP .SWORD)>
  75. <SETG END-GAME!-FLAG T>
  76. <SCORE-ROOM <FIND-ROOM "CRYPT">>
  77. <GOTO <FIND-ROOM "TSTRS">>
  78. <ROOM-DESC>>
  79. \
  80. ;"SUBTITLE It's All Done with Mirrors"
  81. <SETG MR1!-FLAG T>
  82. <SETG MR2!-FLAG T>
  83. <SETG MIRROR-OPEN!-FLAG <>>
  84. <SETG WOOD-OPEN!-FLAG <>>
  85. <SETG MRSWPUSH!-FLAG <>>
  86. <DEFINE MRGO ("AUX" (DIR <2 ,PRSVEC>) (NRM <MEMQ .DIR <REXITS ,HERE>>) (CEX <2 .NRM>)
  87. (TORM <CXROOM .CEX>) (MDIR ,MDIR))
  88. #DECL ((DIR) DIRECTION (NRM) <VECTOR DIRECTION CEXIT>
  89. (CEX) CEXIT (TORM) ROOM (MDIR) FIX)
  90. <COND (<MEMQ .DIR [<FIND-DIR "NORTH"> <FIND-DIR "SOUTH">]>
  91. <COND (<==? ,MLOC .TORM>
  92. <COND (<N-S .MDIR>
  93. <TELL "There is a wooden wall blocking your way.">)
  94. (<MIRBLOCK .DIR .MDIR>)>
  95. <>)
  96. (.TORM)>)
  97. (<==? ,MLOC .TORM>
  98. <COND (<N-S .MDIR> <GO-E-W .TORM .DIR>)
  99. (<MIRBLOCK .DIR .MDIR> <>)>)
  100. (.TORM)>>
  101. <DEFINE MIRBLOCK (DIR MDIR)
  102. #DECL ((DIR) DIRECTION (MDIR) FIX)
  103. <COND (<==? .DIR <FIND-DIR "SOUTH">>
  104. <SET MDIR <MOD <+ .MDIR 180> 360>>)>
  105. <COND (<OR <AND <==? .MDIR 270> <NOT ,MR1!-FLAG>>
  106. <AND <==? .MDIR 90> <NOT ,MR2!-FLAG>>>
  107. <TELL "There is a large broken mirror blocking your way.">)
  108. (ELSE
  109. <TELL "There is a large mirror blocking your way.">)>>
  110. <DEFINE GO-E-W (RM DIR
  111. "AUX" (SPR <STRINGP <RID .RM>>) (SPD <STRINGP <CHTYPE .DIR PSTRING>>)
  112. (STR ,MRESTR))
  113. #DECL ((RM) ROOM (DIR) DIRECTION (SPR SPD STR) STRING)
  114. <OR <==? <2 .SPD> !\E> <SET STR ,MRWSTR>>
  115. <FIND-ROOM <SUBSTRUC .SPR 0 3 .STR>>>
  116. <SETG MRESTR " E">
  117. <SETG MRWSTR "MRBW">
  118. <DEFMAC N-S ('FX) <FORM 0? <FORM MOD .FX 180>>>
  119. <DEFMAC E-W ('FX) <FORM OR <FORM ==? .FX 90> <FORM ==? .FX 270>>>
  120. <DEFINE EWTELL (RM "AUX" (EAST? <==? <4 <STRINGP <RID .RM>>> !\E>) M1? MWIN)
  121. #DECL ((RM) ROOM (EAST? MWIN M1?) <OR FALSE ATOM>)
  122. <SET MWIN
  123. <COND (<SET M1? <==? 180 <+ ,MDIR <COND (.EAST? 0) (180)>>>>
  124. ,MR1!-FLAG)
  125. (,MR2!-FLAG)>>
  126. <TELL
  127. "You are in a narrow room, whose "
  128. 0
  129. <COND (.EAST? "west") ("east")>
  130. " wall is a large ">
  131. <TELL <COND (.MWIN "mirror.") ( "wooden panel
  132. which once contained a mirror.")>>
  133. <AND .M1? ,MIRROR-OPEN!-FLAG <TELL <COND (.MWIN ,MIROPEN) (,PANOPEN)>>>
  134. <TELL "The opposite wall is solid rock.">>
  135. <DEFINE MRCEW ()
  136. <COND (<VERB? "LOOK">
  137. <EWTELL ,HERE>
  138. <TELL "Somewhat to the north" ,LONG-TELL1 ,GUARDSTR>)>>
  139. <DEFINE MRBEW ()
  140. <COND (<VERB? "LOOK">
  141. <EWTELL ,HERE>
  142. <TELL "To the north and south are large hallways.">)>>
  143. <DEFINE MRAEW ()
  144. <COND (<VERB? "LOOK">
  145. <EWTELL ,HERE>
  146. <TELL "To the north is a large hallway.">)>>
  147. ;"LOOK-TO -- takes room to north, room to south (if any), and instructions
  148. for describing what is north and south. These are interpreted as:
  149. STRING -- print it, T -- guardians are there, otherwise, nothing interesting.
  150. If the mirror is found to north or south, the corresponding instruction is
  151. set to T, and later innocuous messages are printed for the directions with
  152. nothing interesting in them."
  153. <DEFINE LOOK-TO (NSTR "OPTIONAL" (SSTR <>) (NTELL <>) (STELL <>) (HTELL T)
  154. "AUX" (NRM <>) (SRM <>) NORTH? (MDIR ,MDIR) MIR? (M1? <>) DIR)
  155. #DECL ((DIR) STRING (NSTR SSTR) <OR STRING FALSE>
  156. (NTELL STELL) <OR ATOM FALSE STRING>
  157. (HTELL NORTH? MIR? M1?) <OR ATOM FALSE> (RM) ROOM
  158. (NRM SRM) <OR ROOM FALSE> (MDIR) FIX)
  159. <AND <TYPE? .NSTR STRING> <SET NRM <FIND-ROOM .NSTR>>>
  160. <AND <TYPE? .SSTR STRING> <SET SRM <FIND-ROOM .SSTR>>>
  161. <AND .HTELL <TELL ,HALLWAY ,LONG-TELL1>>
  162. <COND (<TYPE? .NTELL ATOM>
  163. <TELL "Somewhat to the north" ,LONG-TELL1 ,GUARDSTR>)
  164. (<TYPE? .NTELL STRING> <TELL .NTELL>)>
  165. <COND (<TYPE? .STELL ATOM>
  166. <TELL "Somewhat to the south" ,LONG-TELL1 ,GUARDSTR>)
  167. (<TYPE? .STELL STRING> <TELL .STELL>)>
  168. <COND (<PROG ()
  169. <COND (<==? ,MLOC .NRM>
  170. <SET NORTH? <SET NTELL T>> <SET DIR "north">)
  171. (<==? ,MLOC .SRM>
  172. <SET NORTH? <>> <SET STELL T> <SET DIR "south">)>>
  173. <SET MIR?
  174. <COND (<OR <AND .NORTH? <G? .MDIR 180> <L? .MDIR 359>>
  175. <AND <NOT .NORTH?> <G? .MDIR 0> <L? .MDIR 179>>>
  176. <SET M1? T>
  177. ,MR1!-FLAG)
  178. (,MR2!-FLAG)>>
  179. <COND (<E-W .MDIR>
  180. <TELL <COND (.MIR? "A large mirror fills the ")
  181. ("A large panel fills the ")>
  182. 1
  183. .DIR
  184. " side of the hallway.">
  185. <AND .M1?
  186. ,MIRROR-OPEN!-FLAG
  187. <TELL <COND (.MIR? ,MIROPEN)(,PANOPEN)> ,LONG-TELL1>>
  188. <OR .MIR?
  189. <TELL "The shattered pieces of a mirror cover the floor.">>)
  190. (<TELL "The "
  191. 0
  192. .DIR
  193. " side of the room is divided by a wooden wall into small
  194. hallways to the ">
  195. <TELL .DIR 0 "east and ">
  196. <TELL .DIR 1 "west.">)>)>
  197. <AND .HTELL
  198. <COND (<AND <NOT .NTELL> <NOT .STELL>>
  199. <TELL "The corridor continues north and south.">)
  200. (<NOT .NTELL> <TELL "The corridor continues north.">)
  201. (<NOT .STELL> <TELL "The corridor continues south.">)>>
  202. T>
  203. <DEFINE MRDF ()
  204. <COND (<VERB? "LOOK">
  205. <LOOK-TO "FDOOR" "MRG" <> T>)>>
  206. <DEFINE MRCF ()
  207. <COND (<VERB? "LOOK">
  208. <LOOK-TO "MRG" "MRB" T>)>>
  209. <DEFINE MRBF ()
  210. <COND (<VERB? "LOOK">
  211. <LOOK-TO "MRC" "MRA">)>>
  212. <DEFINE MRAF ()
  213. <COND (<VERB? "LOOK">
  214. <LOOK-TO "MRB" <> <> "A passage enters from the south.">)>>
  215. "Infestation function for Sword-glow demon, tailored for end game"
  216. <DEFINE EG-INFESTED? (R "AUX" (M <FIND-ROOM "MRG">))
  217. #DECL ((R M) ROOM)
  218. <OR <==? .R .M>
  219. <AND <==? ,MLOC .M> <==? .R <FIND-ROOM "INMIR">>>
  220. <==? .R <FIND-ROOM "MRGE">>
  221. <==? .R <FIND-ROOM "MRGW">>>>
  222. <DEFINE GUARDIANS ()
  223. <COND (<VERB? "GO-IN">
  224. <TELL ,GUARDKILL ,LONG-TELL1>
  225. <JIGS-UP "">)
  226. (<VERB? "ATTAC">
  227. <TELL ,GUARD-ATTACK ,LONG-TELL1>
  228. <JIGS-UP "">)
  229. (<VERB? "HELLO">
  230. <TELL "The statues are impassive.">)>>
  231. <DEFINE MIRROR-DIR? (DIR RM "AUX" M (MDIR ,MDIR))
  232. #DECL ((MDIR) FIX (DIR) DIRECTION (RM) ROOM
  233. (M) <OR FALSE <VECTOR DIRECTION CEXIT>>)
  234. <AND <SET M <MEMQ <FIND-DIR "NORTH"> <REXITS .RM>>>
  235. <==? ,MLOC <CXROOM <2 .M>>>
  236. <COND (<OR <AND <==? .DIR <FIND-DIR "NORTH">>
  237. <G? .MDIR 180>
  238. <L? .MDIR 360>>
  239. <AND <==? .DIR <FIND-DIR "SOUTH">>
  240. <G? .MDIR 0>
  241. <L? .MDIR 180>>>
  242. 1)
  243. (2)>>>
  244. <DEFINE WALL-FUNCTION ("AUX" (HERE ,HERE) (NORTH? <>))
  245. #DECL ((HERE) ROOM (NORTH?) <OR FALSE FIX>)
  246. <COND (<AND ,END-GAME!-FLAG
  247. <N-S ,MDIR>
  248. <OR <SET NORTH? <MIRROR-DIR? <FIND-DIR "NORTH"> .HERE>>
  249. <MIRROR-DIR? <FIND-DIR "SOUTH"> .HERE>>>
  250. <COND (<VERB? "PUSH">
  251. <TELL "The structure won't budge.">)>)>>
  252. <DEFINE MIRROR-HERE? (RM "AUX" (SP <STRINGP <RID .RM>>) (MDIR ,MDIR))
  253. #DECL ((RM) ROOM (SP) STRING (MDIR) FIX)
  254. <COND (<==? <LENGTH .SP> 4>
  255. <COND (<==? 180 <+ .MDIR <COND (<==? <4 .SP> !\E> 0) (180)>>> 1)
  256. (2)>)
  257. (<N-S .MDIR> <>)
  258. (<MIRROR-DIR? <FIND-DIR "NORTH"> .RM>)
  259. (<MIRROR-DIR? <FIND-DIR "SOUTH"> .RM>)>>
  260. <DEFINE MIRROR-FUNCTION ("AUX" MIRROR)
  261. #DECL ((MIRROR) <OR FIX FALSE>)
  262. <COND (<NOT <SET MIRROR <MIRROR-HERE? ,HERE>>>
  263. <TELL
  264. "I can't see a mirror here.">)
  265. (<VERB? "C-INT">
  266. <SETG MIRROR-OPEN!-FLAG <>>
  267. <TELL "The mirror slams shut.">)
  268. (<VERB? "OPEN" "MOVE">
  269. <TELL
  270. "I don't see a way to open the mirror here.">)
  271. (<VERB? "LKIN">
  272. <COND (<OR <AND <1? .MIRROR> ,MR1!-FLAG> ,MR2!-FLAG>
  273. <TELL "A disheveled adventurer stares back at you.">)
  274. (<TELL "The mirror is broken into little pieces.">)>)
  275. (<VERB? "POKE" "MUNG">
  276. <COND (<1? .MIRROR>
  277. <COND (,MR1!-FLAG
  278. <SETG MR1!-FLAG <>>
  279. <TELL ,MIRBREAK ,LONG-TELL1>)
  280. (<TELL ,MIRBROKE ,LONG-TELL1>)>)
  281. (,MR2!-FLAG
  282. <SETG MR2!-FLAG <>>
  283. <TELL ,MIRBREAK ,LONG-TELL1>)
  284. (<TELL ,MIRBROKE ,LONG-TELL1>)>)
  285. (<OR <AND <1? .MIRROR> <NOT ,MR1!-FLAG>> <NOT ,MR2!-FLAG>>
  286. <TELL
  287. "Shards of a broken mirror are dangerous to play with.">)
  288. (<VERB? "PUSH">
  289. <TELL <COND (<1? .MIRROR>
  290. "The mirror is mounted on a wooden panel which moves slightly inward
  291. as you push, and back out when you let go. The mirror feels fragile.")
  292. (T
  293. "The mirror is unyielding, but seems rather fragile.")> ,LONG-TELL1>)>>
  294. <DEFINE PANEL-FUNCTION ("AUX" MIRROR)
  295. #DECL ((MIRROR) <OR FIX FALSE>)
  296. <COND (<NOT <SET MIRROR <MIRROR-HERE? ,HERE>>>
  297. <TELL
  298. "I can't see a panel here.">)
  299. (<VERB? "OPEN" "MOVE">
  300. <TELL
  301. "I don't see a way to open the panel here.">)
  302. (<VERB? "POKE" "MUNG">
  303. <COND (<1? .MIRROR>
  304. <COND (,MR1!-FLAG
  305. <TELL ,PANELBREAK ,LONG-TELL1>)
  306. (<TELL ,PANELBROKE ,LONG-TELL1>)>)
  307. (,MR2!-FLAG
  308. <TELL ,PANELBREAK ,LONG-TELL1>)
  309. (<TELL ,PANELBROKE ,LONG-TELL1>)>)
  310. (<VERB? "PUSH">
  311. <TELL <COND (<1? .MIRROR>
  312. "The wooden panel moves slightly inward as you push, and back out
  313. when you let go.")
  314. (T
  315. "The panel is unyielding.")>>)>>
  316. <GDECL (DIRVEC) <VECTOR [REST DIRECTION FIX]>>
  317. <DEFINE MIROUT ("AUX" DIR (MDIR ,MDIR) RM)
  318. #DECL ((DIR) <OR ATOM DIRECTION FIX> (MDIR) FIX (RM) <OR FALSE ROOM>)
  319. <COND (<==? <2 ,PRSVEC> <FIND-DIR "EXIT">> <SET DIR T>)
  320. (ELSE <SET DIR <2 <MEMQ <2 ,PRSVEC> ,DIRVEC>>>)>
  321. <COND (,MIRROR-OPEN!-FLAG
  322. <COND (<OR <NOT <TYPE? .DIR FIX>> <==? <MOD <+ .MDIR 270> 360> .DIR>>
  323. <COND (<N-S .MDIR>
  324. <MIREW>)
  325. (<MIRNS <L? .MDIR 180> T>)>)
  326. (<TELL ,NOWAY ,LONG-TELL1>
  327. <>)>)
  328. (,WOOD-OPEN!-FLAG
  329. <COND (<OR <NOT <TYPE? .DIR FIX>> <==? <MOD <+ .MDIR 180> 360> .DIR>>
  330. <COND (<SET RM <MIRNS <NOT <0? .MDIR>> T>>
  331. <TELL "As you leave, the door swings shut.">
  332. <SETG WOOD-OPEN!-FLAG <>>
  333. .RM)
  334. (<TELL ,NOWAY>)>)
  335. (<TELL ,NOWAY>
  336. <>)>)
  337. (<TELL ,NOWAY>
  338. <>)>>
  339. "MIRNS -- returns room in a given direction from the mirror (north or
  340. south as indicated by first argument). If second arg is T, then we
  341. are exiting, not moving the mirror, so don't worry about ends."
  342. <DEFINE MIRNS ("OPTIONAL" (NORTH? <L? ,MDIR 180>) (EXIT? <>)
  343. "AUX" (MLOC ,MLOC) (REX <REXITS .MLOC>) M EXIT)
  344. #DECL ((MLOC) ROOM (REX) EXIT (M) <OR FALSE <VECTOR DIRECTION>>
  345. (EXIT?) <OR ATOM FALSE> (EXIT) <OR DOOR ROOM CEXIT NEXIT>
  346. (NORTH?) <OR FALSE FIX ATOM>)
  347. <COND (<AND <NOT .EXIT?>
  348. <OR <AND .NORTH? <==? .MLOC ,NORTHEND>>
  349. <AND <NOT .NORTH?> <==? .MLOC ,SOUTHEND>>>>
  350. <>)
  351. (<SET M
  352. <MEMQ <COND (.NORTH? <FIND-DIR "NORTH">) (<FIND-DIR "SOUTH">)>
  353. .REX>>
  354. <SET EXIT <2 .M>>
  355. <COND (<TYPE? .EXIT CEXIT> <CXROOM .EXIT>)
  356. (<TYPE? .EXIT ROOM> .EXIT)>)>>
  357. <GDECL (NORTHEND SOUTHEND) ROOM>
  358. <DEFINE MIREW ()
  359. <FIND-ROOM <SUBSTRUC <STRINGP <RID ,MLOC>>
  360. 0
  361. 3
  362. <COND (<0? ,MDIR> ,MRWSTR)
  363. (,MRESTR)>>>>
  364. <DEFINE MIRIN ()
  365. <COND (<==? <MIRROR-HERE? ,HERE> 1>
  366. <COND (,MIRROR-OPEN!-FLAG <FIND-ROOM "INMIR">)
  367. (<TELL "The panel is closed."> <>)>)
  368. (<TELL "The structure blocks your way."> T)>>
  369. <DEFINE MREYE-ROOM ("AUX" O)
  370. #DECL ((O) <OR FALSE OBJECT>)
  371. <COND (<VERB? "LOOK">
  372. <TELL
  373. "You are in a small room, with narrow passages exiting to the north
  374. and south. A narrow red beam of light crosses the room at the north
  375. end, inches above the floor." ,LONG-TELL>
  376. <COND (<SET O <BEAM-STOPPED?>>
  377. <TELL " The beam is stopped halfway across the
  378. room by a " 1 <ODESC2 .O> " lying on the floor.">)
  379. (<TELL "" 1>)>
  380. <LOOK-TO "MRA" <> <> <> <>>)>>
  381. <DEFINE BEAM-STOPPED? ("AUX" (BEAM <FIND-OBJ "RBEAM">))
  382. #DECL ((BEAM) OBJECT)
  383. <MAPF <>
  384. <FUNCTION (O)
  385. #DECL ((O) OBJECT)
  386. <COND (<N==? .O .BEAM> <MAPLEAVE .O>)>>
  387. <ROBJS <FIND-ROOM "MREYE">>>>
  388. ; "This function cannot have its .PRSI and .PRSO's changed to <PRSI> etc!!"
  389. <DEFINE BEAM-FUNCTION ("AUX" (PRSO <PRSO>) (PRSI <PRSI>)
  390. (HERE ,HERE) (BEAM <FIND-OBJ "RBEAM">))
  391. #DECL ((PRSO PRSI) OBJECT (HERE) ROOM (BEAM) OBJECT)
  392. <COND (<VERB? "PUT" "POKE" "MUNG">
  393. <COND (<VERB? "PUT">
  394. <SET PRSI .PRSO>
  395. <SET PRSO <PRSI>>)>
  396. <COND (<OR <NOT .PRSI> <N==? .PRSO .BEAM>> <>)
  397. (<DROP-IF .PRSI>
  398. <INSERT-OBJECT .PRSI .HERE>
  399. <TELL
  400. "The beam is now interrupted by a " 1 <ODESC2 .PRSI> " lying on the floor.">)
  401. (<MEMQ .PRSI <ROBJS .HERE>>
  402. <TELL
  403. "The " 1 <ODESC2 .PRSI> " already breaks the beam.">)
  404. (<TELL
  405. "You can't break the beam with a " 1 <ODESC2 .PRSI> ".">)>)
  406. (<AND <VERB? "TAKE"> <==? <PRSO> .BEAM>>
  407. <TELL
  408. "No doubt you have a bottle of moonbeams as well.">)>>
  409. <DEFINE MRSWITCH ("AUX" (HERE ,HERE))
  410. #DECL ((HERE) ROOM)
  411. <COND (<VERB? "PUSH">
  412. <COND (,MRSWPUSH!-FLAG <TELL "The button is already depressed.">)
  413. (<TELL "The button becomes depressed.">
  414. <COND (<BEAM-STOPPED?>
  415. <CLOCK-ENABLE <CLOCK-INT ,MRINT 7>>
  416. <SETG MRSWPUSH!-FLAG T>
  417. <SETG MIRROR-OPEN!-FLAG T>)
  418. (<TELL "The button pops back out.">)>)>)
  419. (<VERB? "C-INT">
  420. <SETG MRSWPUSH!-FLAG <>>
  421. <SETG MIRROR-OPEN!-FLAG <>>
  422. <COND (<OR <==? <MIRROR-HERE? .HERE> 1>
  423. <==? .HERE <FIND-ROOM "INMIR">>>
  424. <TELL "The mirror quietly swings shut.">)
  425. (<==? .HERE <FIND-ROOM "MRANT">>
  426. <TELL "The button pops back to its original position.">)>)>>
  427. <SETG MDIR 270>
  428. <GDECL (MDIR) FIX (MLOC) ROOM>
  429. ;"mirror points... 0 = north"
  430. <SETG POLEUP!-FLAG 0>
  431. <GDECL (POLEUP!-FLAG) FIX>
  432. ;"pole raised?: 0 -- in hole or channel, 1 -- foor level, 2 -- in air"
  433. <DEFINE MAGIC-MIRROR ("AUX" (MDIR ,MDIR) (MLOC ,MLOC) (STARTER <>))
  434. #DECL ((MDIR) FIX (MLOC) ROOM (STARTER) <OR ATOM FALSE>)
  435. <COND (<VERB? "LOOK">
  436. <SET STARTER <==? .MLOC ,STARTROOM>>
  437. <TELL ,INSIDE-MIRROR-1 ,LONG-TELL>
  438. <COND (<AND .STARTER <==? .MDIR 270>>
  439. <COND (<NOT <0? ,POLEUP!-FLAG>>
  440. <TELL
  441. "has been lifted out
  442. of a hole carved in the stone floor. There is evidently enough
  443. friction to keep the pole from dropping back down." ,LONG-TELL1>)
  444. (ELSE
  445. <TELL "has been dropped
  446. into a hole carved in the stone floor.">)>)
  447. (<OR <0? .MDIR> <==? .MDIR 180>>
  448. <COND (<NOT <0? ,POLEUP!-FLAG>>
  449. <TELL "is positioned above
  450. the stone channel in the floor.">)
  451. (ELSE
  452. <TELL "has been dropped
  453. into the stone channel incised in the floor.">)>)
  454. (ELSE
  455. <TELL "is resting on the
  456. stone floor.">)>
  457. <TELL ,MIRROR-POLE-DESC
  458. ,LONG-TELL1
  459. <NTH ,LONGDIRS <+ </ .MDIR 45> 1>>
  460. ".">)>>
  461. <GDECL (LONGDIRS) <VECTOR [REST STRING]>>
  462. ;"MOVEMENT"
  463. <DEFINE MPANELS ("AUX" (MDIR ,MDIR))
  464. #DECL ((MDIR) FIX)
  465. <COND (<VERB? "PUSH">
  466. <COND (<NOT <0? ,POLEUP!-FLAG>>
  467. <AND <==? ,MLOC <FIND-ROOM "MRG">>
  468. <TELL "The movement of the structure alerts the Guardians.">
  469. <JIGS-UP ,GUARDKILL>>
  470. <COND (<OR <==? <PRSO> <FIND-OBJ "RDWAL">>
  471. <==? <PRSO> <FIND-OBJ "YLWAL">>>
  472. <SET MDIR <MOD <+ .MDIR 45> 360>>
  473. <TELL "The structure rotates clockwise.">)
  474. (<SET MDIR <MOD <+ .MDIR 315> 360>>
  475. <TELL "The structure rotates counterclockwise.">)>
  476. <TELL "The arrow on the compass rose now indicates "
  477. 1
  478. <NTH ,LONGDIRS <+ 1 </ .MDIR 45>>>
  479. ".">
  480. <COND (,WOOD-OPEN!-FLAG
  481. <SETG WOOD-OPEN!-FLAG <>>
  482. <TELL ,WOOD-CLOSES>)>
  483. <SETG MDIR .MDIR>)
  484. (<N-S .MDIR>
  485. <TELL "The short pole prevents the structure from rotating.">)
  486. (<TELL "The structure shakes slightly but doesn't move.">)>)>>
  487. <PSETG WOOD-CLOSES "The pine wall closes quietly.">
  488. <DEFINE MENDS ("AUX" (MDIR ,MDIR) RM (MRG <FIND-ROOM "MRG">) (MLOC ,MLOC))
  489. #DECL ((MDIR) FIX
  490. (RM) <OR FALSE ROOM> (MRG MLOC) ROOM)
  491. <COND (<VERB? "PUSH">
  492. <COND (<NOT <N-S .MDIR>>
  493. <TELL
  494. "The structure rocks back and forth slightly but doesn't move.">)
  495. (<==? <PRSO> <FIND-OBJ "OAKND">>
  496. <COND (<SET RM <MIRNS>> <MIRMOVE <0? .MDIR> .RM>)
  497. (<TELL
  498. "The structure has reached the end of the stone channel and won't
  499. budge.">)>)
  500. (<TELL "The pine wall swings open.">
  501. <AND <OR <==? .MLOC .MRG>
  502. <AND <==? .MLOC <FIND-ROOM "MRD">>
  503. <==? .MDIR 0>>
  504. <AND <==? .MLOC <FIND-ROOM "MRC">>
  505. <==? .MDIR 180>>>
  506. <TELL
  507. "The pine door opens into the field of view of the Guardians.">
  508. <JIGS-UP ,GUARDKILL>>
  509. <SETG WOOD-OPEN!-FLAG T>
  510. <CLOCK-ENABLE <CLOCK-INT ,PININ 5>>)>)
  511. (<VERB? "C-INT">
  512. <COND (,WOOD-OPEN!-FLAG
  513. <SETG WOOD-OPEN!-FLAG <>>
  514. <TELL ,WOOD-CLOSES>)>
  515. T)>>
  516. <DEFINE MIRMOVE (NORTH? RM
  517. "AUX" (MRG <FIND-ROOM "MRG">) (PU? <NOT <0? ,POLEUP!-FLAG>>))
  518. #DECL ((NORTH?) <OR FIX ATOM FALSE> (RM MRG) ROOM (PU?) <OR ATOM FALSE>)
  519. <TELL <COND (.PU? "The structure wobbles ")
  520. ("The structure slides ")>
  521. 1
  522. <COND (.NORTH? "north") ("south")>
  523. " and stops over another compass rose.">
  524. <SETG MLOC .RM>
  525. <AND <==? .RM .MRG>
  526. <==? ,HERE <FIND-ROOM "INMIR">>
  527. <COND (.PU?
  528. <TELL
  529. "The structure wobbles as it moves, alerting the Guardians.">)
  530. (<OR <NOT ,MR1!-FLAG> <NOT ,MR2!-FLAG>>
  531. <TELL
  532. "A Guardian notices a wooden structure creeping by, and his
  533. suspicions are aroused.">)
  534. (<OR ,MIRROR-OPEN!-FLAG ,WOOD-OPEN!-FLAG>
  535. <TELL
  536. "A Guardian notices the open side of the structure, and his suspicions
  537. are aroused.">)>
  538. <JIGS-UP ,GUARDKILL1>>
  539. T>
  540. <DEFINE SHORT-POLE ("AUX" (MDIR ,MDIR) (PU ,POLEUP!-FLAG))
  541. #DECL ((MDIR PU) FIX)
  542. <COND (<VERB? "RAISE">
  543. <COND (<==? .PU 2>
  544. <TELL "The pole cannot be raised further.">)
  545. (<SETG POLEUP!-FLAG 2>
  546. <TELL "The pole is now slightly above the floor.">)>)
  547. (<VERB? "PUSH" "LOWER">
  548. <COND (<0? .PU> <TELL "The pole cannot be lowered further.">)
  549. (<N-S .MDIR>
  550. <TELL "The pole is lowered into the channel.">
  551. <SETG POLEUP!-FLAG 0>
  552. T)
  553. (<AND <==? .MDIR 270> <==? ,MLOC <FIND-ROOM "MRB">>>
  554. <SETG POLEUP!-FLAG 0>
  555. <TELL "The pole is lowered into the stone hole.">)
  556. (<1? .PU>
  557. <TELL "The pole is already resting on the floor.">)
  558. (<SETG POLEUP!-FLAG 1>
  559. <TELL "The pole now rests on the stone floor.">)>)>>
  560. \
  561. ; "SUBTITLE The Spanish Inquisition"
  562. <SETG QVEC <REST <IVECTOR 15 '<>> 15>>
  563. <SETG NQVEC <IVECTOR 3 '<>>>
  564. <GDECL (NQVEC QVEC) <VECTOR [REST <OR QUESTION FALSE>]>>
  565. <SETG NQATT 0>
  566. ;"tries recorded for this question"
  567. <SETG INQOBJS ()>
  568. <GDECL (NUMS) <VECTOR [REST STRING]>
  569. (NQATT) FIX
  570. (INQOBJS) <LIST [REST OBJECT]>
  571. (NUMOBJS) <VECTOR [REST OBJECT FIX]>>
  572. <DEFINE CORRECT? (ANS CORRECT "AUX" (1CORR <1 .CORRECT>))
  573. #DECL ((ANS) <VECTOR [REST STRING]> (CORRECT) VECTOR
  574. (1CORR) <OR OBJECT ACTION FALSE STRING>)
  575. <REPEAT (W A)
  576. #DECL ((W) <OR ATOM FALSE> (A) STRING)
  577. <COND (<EMPTY? .ANS> <RETURN>)
  578. (<AND <NOT <EMPTY? <SET A <1 .ANS>>>>
  579. <SET W <LOOKUP .A ,WORDS>>
  580. <TYPE? ,.W BUZZ>>
  581. <SET ANS <REST .ANS>>)
  582. (ELSE <RETURN>)>>
  583. <COND (<TYPE? .1CORR STRING> <MEMBER <1 .ANS> .CORRECT>)
  584. (<REPEAT ((LV .ANS) STR ATM OBJ (ADJ <>) VAL)
  585. #DECL ((LV) <VECTOR [REST STRING]> (STR) STRING
  586. (ATM) <OR FALSE ATOM> (VAL) ANY
  587. (ADJ) <OR FALSE ADJECTIVE>
  588. (OBJ) <OR FALSE OBJECT>)
  589. <AND <EMPTY? <SET STR <1 .LV>>> <RETURN <>>>
  590. <COND (<SET ATM <LOOKUP .STR ,ACTIONS>>
  591. <RETURN <==? ,.ATM .1CORR>>)
  592. (<SET ATM <LOOKUP .STR ,WORDS>>
  593. <COND (<TYPE? <SET VAL ,.ATM> ADJECTIVE>
  594. <SET ADJ .VAL>)>)
  595. (<SET ATM <LOOKUP .STR ,OBJECT-OBL>>
  596. <COND (<SET OBJ <SEARCH-LIST .ATM ,INQOBJS .ADJ>>
  597. <RETURN <==? .OBJ .1CORR>>)>)>
  598. <SET LV <REST .LV>>>)>>
  599. <DEFINE INQUISITOR ("OPTIONAL" (ANS <>)
  600. "AUX" (NQV ,NQVEC) (QUES <1 .NQV>) (NQATT ,NQATT))
  601. #DECL ((ANS) <OR FALSE <VECTOR [REST STRING]>>
  602. (NQV) <VECTOR [REST QUESTION]> (QUES) QUESTION (NQATT) FIX)
  603. <COND (<VERB? "C-INT">
  604. <TELL "The booming voice asks:
  605. \"" 1 <QSTR .QUES> "\"">
  606. <CLOCK-INT ,INQIN 2>)
  607. (<AND .ANS ,INQSTART? <L? .NQATT 5>>
  608. <COND (<CORRECT? .ANS <QANS .QUES>>
  609. <TELL "The dungeon master says \"Excellent\".">
  610. <COND (<EMPTY? <SET NQV <REST .NQV>>>
  611. <TELL ,QUIZ-WIN ,LONG-TELL1>
  612. <DOPEN <FIND-OBJ "QDOOR">>
  613. <CLOCK-DISABLE ,INQIN>)
  614. (<SETG NQATT 0>
  615. <SETG NQVEC .NQV>
  616. <TELL "The booming voice asks:
  617. \""
  618. 1
  619. <QSTR <1 .NQV>>
  620. "\"">
  621. <CLOCK-INT ,INQIN 2>)>)
  622. (<SET NQATT <SETG NQATT <+ 1 .NQATT>>>
  623. <TELL "The dungeon master says \"You are wrong." 0>
  624. <COND (<==? .NQATT 5>
  625. <TELL ,INQ-LOSE ,LONG-TELL1>
  626. <CLOCK-DISABLE ,INQIN>)
  627. (<TELL " You have "
  628. 0
  629. <NTH ,NUMS <- 5 .NQATT>>
  630. " more chance">
  631. <TELL
  632. <COND (<==? .NQATT 4>
  633. ".\"")
  634. ("s.\"")>>)>)>)
  635. (<TELL "There is no reply.">)>>
  636. <SETG INQSTART? <>>
  637. ;"if D.M. has stated the rules."
  638. <DEFINE INQSTART ("AUX" (QV ,QVEC) (NQV <SETG NQVEC <TOP ,NQVEC>>))
  639. #DECL ((QV NQV) <VECTOR [REST QUESTION]>)
  640. <COND (<NOT ,INQSTART?>
  641. <CLOCK-ENABLE <CLOCK-INT ,INQIN 2>>
  642. <TELL ,QUIZ-RULES ,LONG-TELL1>
  643. <SETG INQSTART? T>
  644. <SELECT .QV .NQV>
  645. <TELL "The booming voice asks:
  646. \"" 1 <QSTR <1 .NQV>> "\"">)
  647. (<TELL
  648. "The Dungeonmaster gazes at you impatiently, and says, \"My conditions
  649. have been stated, abide by them or depart!\"">)>>
  650. <DEFINE ANSWER ("AUX" (LV ,LEXV) M (HERE ,HERE))
  651. #DECL ((LV M) <VECTOR [REST STRING]> (HERE) ROOM)
  652. <SET M <MEMBER "" .LV>>
  653. <COND (<AND .M <==? .HERE <FIND-ROOM "RIDDL">> <NOT ,RIDDLE-FLAG!-FLAG>>
  654. <COND (<CORRECT? <REST .M> '["WELL"]>
  655. <SETG RIDDLE-FLAG!-FLAG T>
  656. <TELL
  657. "There is a clap of thunder and the east door opens.">)>)
  658. (<AND .M ,END-GAME!-FLAG <==? .HERE <FIND-ROOM "FDOOR">>>
  659. <INQUISITOR <REST .M>>)
  660. (<TELL "No one seems to be listening.">)>>
  661. <DEFINE MASTER-ACTOR ("AUX" (HERE ,HERE) (PRSO <2 ,PRSVEC>))
  662. #DECL ((HERE) ROOM (PRSO) <OR FALSE OBJECT DIRECTION>)
  663. <COND (<NOT <TRNN <FIND-OBJ "QDOOR"> ,OPENBIT>> <TELL "There is no reply.">)
  664. (<VERB? "WALK">
  665. <COND (<OR <AND <OR <==? .PRSO <FIND-DIR "SOUTH">>
  666. <==? .PRSO <FIND-DIR "ENTER">>>
  667. <==? .HERE <FIND-ROOM "NCORR">>>
  668. <AND <OR <==? .PRSO <FIND-DIR "NORTH">>
  669. <==? .PRSO <FIND-DIR "ENTER">>>
  670. <==? .HERE <FIND-ROOM "SCORR">>>>
  671. <TELL
  672. "\"I am not permitted to enter the prison cell.\"">)
  673. (<TELL
  674. "\"I prefer to stay where I am, thank you.\"">)>)
  675. (<MEMQ <PRSA> ,MASTER-ACTIONS> <>)
  676. (<TELL "\"I cannot perform that action for you.\"">)>>
  677. <DEFINE MASTER-FUNCTION ()
  678. <COND (<VERB? "ATTAC">
  679. <JIGS-UP ,MASTER-ATTACK>)
  680. (<VERB? "TAKE">
  681. <TELL
  682. "\"I'm willing to accompany you, but not ride in your pocket!\"">)>>
  683. <GDECL (MASTER-ACTIONS) VECTOR>
  684. <DEFINE BDOOR-FUNCTION ()
  685. <COND (<VERB? "GO-IN">
  686. <CLOCK-ENABLE <CLOCK-INT ,FOLIN -1>>)
  687. (<VERB? "LOOK">
  688. <TELL
  689. "You are in a narrow north-south corridor. At the south end is a door
  690. and at the north end is an east-west corridor. The door is " ,LONG-TELL1
  691. <DPR <FIND-OBJ "QDOOR">>>)>>
  692. <DEFINE FDOOR-FUNCTION ()
  693. <COND (<VERB? "GO-IN">
  694. <CLOCK-INT ,FOLIN 0>)
  695. (<VERB? "LOOK">
  696. <LOOK-TO <> "MRD"
  697. "You are in a north-south hallway which ends in a large wooden door." <> <>>
  698. <TELL
  699. "The wooden door has a barred panel in it at about head height. The
  700. panel is " ,LONG-TELL
  701. <COND (<AND <CFLAG ,INQIN> <NOT <0? <CTICK ,INQIN>>>> "open")("closed")>>
  702. <TELL " and the door is " 1 <DPR <FIND-OBJ "QDOOR">>>
  703. T)>>
  704. <DEFINE WOOD-DOOR ()
  705. <COND (<VERB? "OPEN" "CLOSE">
  706. <TELL "The door won't budge.">)
  707. (<VERB? "KNOCK">
  708. <COND (,INQSTART?
  709. <TELL "There is no answer.">)
  710. (<INQSTART>)>)>>
  711. <SETG FOLFLAG T> ;"Following?"
  712. <DEFINE FOLLOW ("AUX" (WIN ,WINNER) (MAST <OACTOR <FIND-OBJ "MASTE">>)
  713. (HERE ,HERE) (MROOM <AROOM .MAST>))
  714. #DECL ((WIN MAST) ADV (HERE MROOM) ROOM)
  715. <COND (<VERB? "C-INT">
  716. <COND (<==? .HERE .MROOM>)
  717. (<N==? .HERE <FIND-ROOM "CELL">>
  718. <AND <MEMQ <AOBJ .MAST> <ROBJS .MROOM>>
  719. <PUT .MROOM
  720. ,ROBJS
  721. <SPLICE-OUT <AOBJ .MAST> <ROBJS .MROOM>>>>
  722. <PUT .MAST ,AROOM .HERE>
  723. <SETG FOLFLAG T>
  724. <INSERT-OBJECT <AOBJ .MAST> .HERE>
  725. <TELL <COND (<MEMQ .HERE <REXITS .MROOM>>
  726. "The dungeon master follows you.")
  727. ("The dungeon master catches up to you.")>>)
  728. (,FOLFLAG
  729. <TELL
  730. "You notice that the dungeon master does not follow.">
  731. <SETG FOLFLAG <>>
  732. T)>)
  733. (<==? .WIN .MAST>
  734. <CLOCK-INT ,FOLIN -1>
  735. <TELL "The dungeon master answers, 'I will follow.'">)>>
  736. <DEFINE STAY ()
  737. <COND (<==? ,WINNER <OACTOR <FIND-OBJ "MASTE">>>
  738. <CLOCK-INT ,FOLIN 0>
  739. <TELL "The dungeon master says, 'I will stay.'">)
  740. (<==? ,WINNER ,PLAYER>
  741. <TELL "You will be lost without me.">)>>
  742. \
  743. ;"SUBTITLE 'The end had come, and this was it; he dropped her in the Flaming Pit.'"
  744. <SETG LCELL 1> ;"cell in slot"
  745. <SETG PNUMB 1> ;"cell pointed at"
  746. <SETG ACELL <>> ;"cell player is in"
  747. <SETG DCELL <>> ;"cell d.m. is in"
  748. <GDECL (LCELL PNUMB ACELL DCELL) <OR FIX FALSE>>
  749. <DEFINE MOVIES (R "AUX" (CO ,COBJS))
  750. #DECL ((R) ROOM (CO VALUE) <LIST [REST OBJECT]>)
  751. <MAPF ,LIST
  752. <FUNCTION (O)
  753. #DECL ((O) OBJECT)
  754. <COND (<NOT <MEMQ .O .CO>> <MAPRET .O>)
  755. (ELSE <MAPRET>)>>
  756. <ROBJS .R>>>
  757. <DEFINE STUFF (R L1 L2)
  758. #DECL ((L1 L2) LIST (R) ROOM)
  759. <COND (<EMPTY? .L1> <SET L1 .L2>)
  760. (<EMPTY? .L2>)
  761. (ELSE
  762. <SET L1 <LIST !.L1 !.L2>> ;"on purpose, no sharing wanted -- pdl")>
  763. <MAPF <>
  764. <FUNCTION (O) #DECL ((O) OBJECT) <PUT .O ,OROOM .R>>
  765. .L1>
  766. <PUT .R ,ROBJS .L1>>
  767. <DEFINE CELL-MOVE ("AUX" (NEW ,PNUMB) (OLD ,LCELL) (CELL <FIND-ROOM "CELL">)
  768. (NCELL <FIND-ROOM "NCELL">) (PCELL <FIND-ROOM "PCELL">)
  769. (D <FIND-OBJ "ODOOR">) (CELLS ,CELLS) PO (ME ,PLAYER)
  770. (DM ,MASTER))
  771. #DECL ((NEW OLD) FIX (CELL) ROOM (CELLS) <UVECTOR [REST LIST]>
  772. (D) OBJECT (NCELL PCELL) ROOM (PO) LIST (ME DM) ADV)
  773. <PUT .CELLS .OLD <SET PO <MOVIES .CELL>>>
  774. <STUFF .CELL <NTH .CELLS .NEW> ,COBJS>
  775. <PUT .CELLS .NEW ()>
  776. <COND (<==? .OLD 4> <STUFF .NCELL .PO ,NOBJS>)
  777. (ELSE <STUFF .PCELL .PO ,POBJS>)>
  778. <DCLOSE <FIND-OBJ "CDOOR">>
  779. <DCLOSE .D>
  780. <COND (<==? .NEW 4> <TRO .D ,OVISON>)
  781. (ELSE <TRZ .D ,OVISON>)>
  782. <COND (<==? <AROOM .ME> .CELL>
  783. <SETG ACELL .OLD>
  784. <GOTO <COND (<==? .OLD 4> <TRO .D ,OVISON> .NCELL)
  785. (ELSE .PCELL)>
  786. .ME>)
  787. (<==? ,ACELL .NEW>
  788. <SETG ACELL <>>
  789. <GOTO <FIND-ROOM "CELL"> .ME>)>
  790. <COND (<==? <AROOM .DM> .CELL>
  791. <PUT .DM ,AROOM .PCELL>
  792. <SETG DCELL .OLD>)
  793. (<==? ,DCELL .NEW>
  794. <SETG DCELL <>>)>
  795. <SETG LCELL .NEW>>
  796. <DEFINE PARAPET ()
  797. <COND (<VERB? "LOOK">
  798. <TELL ,PARAPET-DESC
  799. ,LONG-TELL1
  800. <NTH ,NUMS ,PNUMB>
  801. "'.">)>>
  802. <DEFINE DIAL ("AUX" N)
  803. #DECL ((N) <OR FALSE <VECTOR [REST OBJECT FIX]>>)
  804. <COND (<VERB? "SET" "PUT" "MOVE" "TRNTO">
  805. <COND (<NOT <EMPTY? <PRSI>>>
  806. <COND (<SET N <MEMQ <PRSI> ,NUMOBJS>>
  807. <SETG PNUMB <2 .N>>
  808. <TELL "The dial now points to '" 1
  809. <NTH ,NUMS <2 .N>> "'.">)
  810. (<TELL "The dial face only contains numbers.">)>)
  811. (<TELL "You must specify what to set the dial to.">)>)
  812. (<VERB? "SPIN">
  813. <SETG PNUMB <+ 1 <MOD <RANDOM> 8>>>
  814. <TELL
  815. "The dial spins and comes to a stop pointing at '" 1 <NTH ,NUMS ,PNUMB> "'.">)>>
  816. <DEFINE DIALBUTTON ("AUX" (CDOOR <TRNN <FIND-OBJ "CDOOR"> ,OPENBIT>))
  817. #DECL ((CDOOR) <OR ATOM FALSE>)
  818. <COND (<VERB? "PUSH">
  819. <CELL-MOVE>
  820. <TELL
  821. "The button depresses with a slight click, and pops back.">
  822. <AND .CDOOR <TELL "The cell door is now closed.">>
  823. T)>>
  824. <DEFINE TAKE-FIVE ()
  825. <COND (<VERB? "TAKE">
  826. <PERFORM WAIT <FIND-VERB "WAIT">>)>>
  827. <DEFINE CELL-ROOM ()
  828. <COND (<VERB? "LOOK">
  829. <TELL
  830. "You are in a featureless prison cell. You can see "
  831. 1
  832. <COND (<TRNN <FIND-OBJ "CDOOR"> ,OPENBIT>
  833. "the east-west
  834. corridor outside the open wooden door in front of you.")
  835. ("only the flames
  836. and smoke of the pit out the small window in a closed door in front
  837. of you.")>>
  838. <COND (<==? ,LCELL 4>
  839. <TELL
  840. "Behind you is a bronze door which seems to be "
  841. 1
  842. <COND (<TRNN <FIND-OBJ "ODOOR"> ,OPENBIT>
  843. "open.")
  844. ("closed.")>>)>)>>
  845. <DEFINE PCELL-ROOM ()
  846. <COND (<VERB? "LOOK">
  847. <TELL
  848. "You are in a featureless prison cell. Its wooden door is securely
  849. fastened, and you can see only the flames and smoke of the pit out
  850. the small window." ,LONG-TELL1>)>>
  851. <DEFINE NCELL-ROOM ()
  852. <COND (<VERB? "LOOK">
  853. <TELL
  854. "You are in a featureless prison cell. Its wooden door is securely
  855. fastened, and you can see only the flames and smoke of the pit out
  856. its small window." ,LONG-TELL1>
  857. <TELL
  858. "On the other side of the cell is a bronze door which seems to be
  859. " 1 <DPR <FIND-OBJ "ODOOR">>>)>>
  860. <DEFINE NCORR-ROOM ()
  861. <COND (<VERB? "LOOK">
  862. <TELL ,EWC-DESC ,LONG-TELL1
  863. <DPR <FIND-OBJ "CDOOR">>>)>>
  864. <DEFINE SCORR-ROOM ()
  865. <COND (<VERB? "LOOK">
  866. <TELL
  867. "You are in an east-west corridor which turns north at its eastern
  868. and western ends. The walls of the corridor are marble. An
  869. additional passage leads south at the center of the corridor." ,LONG-TELL1>
  870. <COND (<==? ,LCELL 4>
  871. <TELL
  872. "In the center of the north wall of the passage is a bronze door
  873. which is " 1 <DPR <FIND-OBJ "ODOOR">>>)>)>>
  874. <DEFINE CELL-DOOR ()
  875. <COND (<VERB? "OPEN" "CLOSE">
  876. <OPEN-CLOSE <FIND-OBJ "CDOOR">
  877. "The wooden door opens."
  878. "The wooden door closes.">)>>
  879. <DEFINE BRONZE-DOOR ("AUX" (HERE ,HERE)
  880. (NCELL? <==? .HERE <FIND-ROOM "NCELL">>))
  881. #DECL ((NCELL?) <OR ATOM FALSE> (HERE) ROOM)
  882. <COND (<VERB? "OPEN" "CLOSE">
  883. <COND (<OR .NCELL?
  884. <AND <==? ,LCELL 4>
  885. <OR <==? .HERE <FIND-ROOM "CELL">>
  886. <==? .HERE <FIND-ROOM "SCORR">>>>>
  887. <OPEN-CLOSE <FIND-OBJ "ODOOR">
  888. "The bronze door opens."
  889. "The bronze door closes.">
  890. <COND (<AND .NCELL? <VERB? "OPEN">>
  891. <TELL
  892. "On the other side of the door is a narrow passage which opens out
  893. into a larger area.">)
  894. (T)>)
  895. (<TELL
  896. "I see no bronze door here.">)>)>>
  897. <DEFINE MAYBE-DOOR ()
  898. <COND (<NOT <TRNN <FIND-OBJ "ODOOR"> ,OPENBIT>>
  899. <COND (<==? ,LCELL 4>
  900. <TELL "The bronze door is closed.">)
  901. (<TELL "You can't go that way.">)>)>>
  902. <DEFINE LOCKED-DOOR ()
  903. <COND (<VERB? "OPEN">
  904. <TELL "The door is securely fastened.">)>>
  905. \
  906. "=========== The Ultimate Winnage =========="
  907. <DEFINE NIRVANA ()
  908. <COND (<VERB? "GO-IN">
  909. <DCLOSE <FIND-OBJ "ODOOR">>
  910. <TELL ,WIN-TOTALLY>
  911. <FINISH (". Won Totally!")>)>>
  912. \
  913. "=========== Doing it the Lazy Way ========="
  914. <DEFINE INCANT ("AUX" (LV ,LEXV) M)
  915. #DECL ((LV M) <VECTOR [REST STRING]>)
  916. <COND (<SET M <MEMBER "" .LV>>
  917. <INCANTATION <REST .M>>)>>
  918. <SETG SPELL!-FLAG <>>
  919. <GDECL (XUNM) STRING (WINNERS) <VECTOR [REST STRING]>>
  920. <DEFINE INCANTATION (LV "AUX" W1 W2 (UNM ,XUNM))
  921. #DECL ((LV) <VECTOR [REST STRING]> (UNM W1 W2) STRING)
  922. <COND (<OR ,SPELL!-FLAG <RTRNN <FIND-ROOM "MRANT"> ,RSEENBIT>>
  923. <TELL
  924. "Incantations are useless once you have gotten this far.">)
  925. (<OR <LENGTH? .LV 1> <EMPTY? <SET W1 <1 .LV>>>>
  926. <TELL "That incantation seems to have been a failure.">)
  927. (<EMPTY? <SET W2 <2 .LV>>>
  928. <COND (<AND ,SPELL!-FLAG <N=? .W1 ,SPELL!-FLAG>>
  929. <TELL "Sorry, only one incantation to a customer.">)
  930. (<OR ,END-GAME!-FLAG <MEMBER .UNM ,WINNERS>>
  931. <SET W2 <PW .UNM .W1>>
  932. <TELL "A hollow voice replies: \"" 0 .W1 " ">
  933. <TELL .W2 1 "\".">
  934. <SETG SPELL!-FLAG <STRING .W1>>)
  935. (<TELL "That spell has no obvious effect.">)>)
  936. (<OR <=? .W1 <PW .UNM .W2>>
  937. <=? .W2 <PW .UNM .W1>>>
  938. <TELL
  939. "As the last syllable of your spell fades into silence, darkness
  940. envelops you, and the earth shakes briefly. Then all is quiet.">
  941. <SETG SPELL!-FLAG <STRING .W1>>
  942. <ENTER-END-GAME>)
  943. (<TELL "That spell doesn't appear to have done anything useful.">)>>
  944. <SETG SWU <IUVECTOR 5 0>>
  945. <SETG KWU <IUVECTOR 5 0>>
  946. <SETG STR <ISTRING 5>>
  947. <DEFINE PW (UNM KEY "AUX" (SU ,SWU) (KU ,KWU) (STR ,STR) USUM)
  948. #DECL ((UNM KEY STR VALUE) STRING (SU KU) UVECTOR (USUM) FIX)
  949. <REPEAT ((S .UNM) (SU .SU) (K .KEY) (KU .KU))
  950. #DECL ((S K) STRING (SU KU) UVECTOR)
  951. <COND (<EMPTY? .SU> <RETURN T>)>
  952. <AND <EMPTY? .K> <SET K .KEY>>
  953. <AND <EMPTY? .S> <SET S .UNM>>
  954. <PUT .SU 1 <- <ASCII <1 .S>> 64>>
  955. <PUT .KU 1 <- <ASCII <1 .K>> 64>>
  956. <SET K <REST .K>>
  957. <SET S <REST .S>>
  958. <SET SU <REST .SU>>
  959. <SET KU <REST .KU>>>
  960. <SET USUM <+ <MOD <+ !.SU> 8> <* 8 <MOD <+ !.KU> 8>>>>
  961. <MAPR <>
  962. <FUNCTION (S) #DECL ((S) STRING) <PUT .S 1 <ASCII 0>>>
  963. .STR>
  964. <MAPR <>
  965. <FUNCTION (SU KU STR "AUX" (S <1 .SU>) (K <1 .KU>))
  966. #DECL ((SU KU) UVECTOR (STR) STRING (S K) FIX)
  967. <SET S <CHTYPE <ANDB <XORB <XORB .S .K> .USUM> 31> FIX>>
  968. <SET USUM <MOD <+ .USUM 1> 32>>
  969. <COND (<G? .S 26> <SET S <MOD .S 26>>)>
  970. <AND <0? .S> <SET S 1>>
  971. <PUT .STR 1 <ASCII <+ .S 64>>>>
  972. .SU
  973. .KU
  974. .STR>
  975. .STR>
  976. \
  977. <DEFINE TURNTO ()
  978. <COND (<OBJECT-ACTION>)
  979. (<TELL "That cannot be turned.">)>>
  980. "=========== CEVENTs and such ============="
  981. <OR <LOOKUP "COMPILE" <ROOT>>
  982. <LOOKUP "GROUP-GLUE" <GET INITIAL OBLIST>>
  983. <PROG ()
  984. <CEVENT 0 ,MRSWITCH <> "MRINT">
  985. <CEVENT 0 ,START-END T "STRTE">
  986. <CEVENT 0 ,MENDS <> "PININ">
  987. <CEVENT 0 ,INQUISITOR <> "INQIN">
  988. <CEVENT 0 ,FOLLOW <> "FOLIN">>>
  989. <GDECL (MRINT STRTE PININ INQIN FOLIN) CEVENT>
  990.