nrooms.c 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. /* RAPPL2- SPECIAL PURPOSE ROOM ROUTINES, PART 2 */
  2. /*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
  3. /* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
  4. /* WRITTEN BY R. M. SUPNIK */
  5. #include "funcs.h"
  6. #include "vars.h"
  7. static void ewtell_ P((integer, integer));
  8. static void lookto_ P((integer, integer, integer, integer, integer));
  9. logical rappl2_(ri)
  10. integer ri;
  11. {
  12. /* Initialized data */
  13. const integer newrms = 38;
  14. /* System generated locals */
  15. integer i__1;
  16. logical ret_val;
  17. /* Local variables */
  18. integer i;
  19. integer j;
  20. ret_val = TRUE_;
  21. switch (ri - newrms + 1) {
  22. case 1: goto L38000;
  23. case 2: goto L39000;
  24. case 3: goto L40000;
  25. case 4: goto L41000;
  26. case 5: goto L42000;
  27. case 6: goto L43000;
  28. case 7: goto L44000;
  29. case 8: goto L45000;
  30. case 9: goto L46000;
  31. case 10: goto L47000;
  32. case 11: goto L48000;
  33. case 12: goto L49000;
  34. case 13: goto L50000;
  35. case 14: goto L51000;
  36. case 15: goto L52000;
  37. case 16: goto L53000;
  38. case 17: goto L54000;
  39. case 18: goto L55000;
  40. case 19: goto L56000;
  41. case 20: goto L57000;
  42. case 21: goto L58000;
  43. case 22: goto L59000;
  44. case 23: goto L60000;
  45. }
  46. bug_(70, ri);
  47. return ret_val;
  48. /* R38-- MIRROR D ROOM */
  49. L38000:
  50. if (prsvec_1.prsa == vindex_1.lookw) {
  51. lookto_(rindex_1.fdoor, rindex_1.mrg, 0, 682, 681);
  52. }
  53. return ret_val;
  54. /* R39-- MIRROR G ROOM */
  55. L39000:
  56. if (prsvec_1.prsa == vindex_1.walkiw) {
  57. jigsup_(685);
  58. }
  59. return ret_val;
  60. /* R40-- MIRROR C ROOM */
  61. L40000:
  62. if (prsvec_1.prsa == vindex_1.lookw) {
  63. lookto_(rindex_1.mrg, rindex_1.mrb, 683, 0, 681);
  64. }
  65. return ret_val;
  66. /* R41-- MIRROR B ROOM */
  67. L41000:
  68. if (prsvec_1.prsa == vindex_1.lookw) {
  69. lookto_(rindex_1.mrc, rindex_1.mra, 0, 0, 681);
  70. }
  71. return ret_val;
  72. /* R42-- MIRROR A ROOM */
  73. L42000:
  74. if (prsvec_1.prsa == vindex_1.lookw) {
  75. lookto_(rindex_1.mrb, 0, 0, 684, 681);
  76. }
  77. return ret_val;
  78. /* RAPPL2, PAGE 3 */
  79. /* R43-- MIRROR C EAST/WEST */
  80. L43000:
  81. if (prsvec_1.prsa == vindex_1.lookw) {
  82. ewtell_(play_1.here, 683);
  83. }
  84. return ret_val;
  85. /* R44-- MIRROR B EAST/WEST */
  86. L44000:
  87. if (prsvec_1.prsa == vindex_1.lookw) {
  88. ewtell_(play_1.here, 686);
  89. }
  90. return ret_val;
  91. /* R45-- MIRROR A EAST/WEST */
  92. L45000:
  93. if (prsvec_1.prsa == vindex_1.lookw) {
  94. ewtell_(play_1.here, 687);
  95. }
  96. return ret_val;
  97. /* R46-- INSIDE MIRROR */
  98. L46000:
  99. if (prsvec_1.prsa != vindex_1.lookw) {
  100. return ret_val;
  101. }
  102. /* !LOOK? */
  103. rspeak_(688);
  104. /* !DESCRIBE */
  105. /* NOW DESCRIBE POLE STATE. */
  106. /* CASES 1,2-- MDIR=270 & MLOC=MRB, POLE IS UP OR IN HOLE */
  107. /* CASES 3,4-- MDIR=0 V MDIR=180, POLE IS UP OR IN CHANNEL */
  108. /* CASE 5-- POLE IS UP */
  109. i = 689;
  110. /* !ASSUME CASE 5. */
  111. if (findex_1.mdir == 270 && findex_1.mloc == rindex_1.mrb) {
  112. i = min(findex_1.poleuf,1) + 690;
  113. }
  114. if (findex_1.mdir % 180 == 0) {
  115. i = min(findex_1.poleuf,1) + 692;
  116. }
  117. rspeak_(i);
  118. /* !DESCRIBE POLE. */
  119. i__1 = findex_1.mdir / 45 + 695;
  120. rspsub_(694, i__1);
  121. /* !DESCRIBE ARROW. */
  122. return ret_val;
  123. /* RAPPL2, PAGE 4 */
  124. /* R47-- MIRROR EYE ROOM */
  125. L47000:
  126. if (prsvec_1.prsa != vindex_1.lookw) {
  127. return ret_val;
  128. }
  129. /* !LOOK? */
  130. i = 704;
  131. /* !ASSUME BEAM STOP. */
  132. i__1 = objcts_1.olnt;
  133. for (j = 1; j <= i__1; ++j) {
  134. if (qhere_(j, play_1.here) && j != oindex_1.rbeam) {
  135. goto L47200;
  136. }
  137. /* L47100: */
  138. }
  139. i = 703;
  140. L47200:
  141. rspsub_(i, objcts_1.odesc2[j - 1]);
  142. /* !DESCRIBE BEAM. */
  143. lookto_(rindex_1.mra, 0, 0, 0, 0);
  144. /* !LOOK NORTH. */
  145. return ret_val;
  146. /* R48-- INSIDE CRYPT */
  147. L48000:
  148. if (prsvec_1.prsa != vindex_1.lookw) {
  149. return ret_val;
  150. }
  151. /* !LOOK? */
  152. i = 46;
  153. /* !CRYPT IS OPEN/CLOSED. */
  154. if ((objcts_1.oflag2[oindex_1.tomb - 1] & OPENBT) != 0) {
  155. i = 12;
  156. }
  157. rspsub_(705, i);
  158. return ret_val;
  159. /* R49-- SOUTH CORRIDOR */
  160. L49000:
  161. if (prsvec_1.prsa != vindex_1.lookw) {
  162. return ret_val;
  163. }
  164. /* !LOOK? */
  165. rspeak_(706);
  166. /* !DESCRIBE. */
  167. i = 46;
  168. /* !ODOOR IS OPEN/CLOSED. */
  169. if ((objcts_1.oflag2[oindex_1.odoor - 1] & OPENBT) != 0) {
  170. i = 12;
  171. }
  172. if (findex_1.lcell == 4) {
  173. rspsub_(707, i);
  174. }
  175. /* !DESCRIBE ODOOR IF THERE. */
  176. return ret_val;
  177. /* R50-- BEHIND DOOR */
  178. L50000:
  179. if (prsvec_1.prsa != vindex_1.walkiw) {
  180. goto L50100;
  181. }
  182. /* !WALK IN? */
  183. cevent_1.cflag[cindex_1.cevfol - 1] = TRUE_;
  184. /* !MASTER FOLLOWS. */
  185. cevent_1.ctick[cindex_1.cevfol - 1] = -1;
  186. return ret_val;
  187. L50100:
  188. if (prsvec_1.prsa != vindex_1.lookw) {
  189. return ret_val;
  190. }
  191. /* !LOOK? */
  192. i = 46;
  193. /* !QDOOR IS OPEN/CLOSED. */
  194. if ((objcts_1.oflag2[oindex_1.qdoor - 1] & OPENBT) != 0) {
  195. i = 12;
  196. }
  197. rspsub_(708, i);
  198. return ret_val;
  199. /* RAPPL2, PAGE 5 */
  200. /* R51-- FRONT DOOR */
  201. L51000:
  202. if (prsvec_1.prsa == vindex_1.walkiw) {
  203. cevent_1.ctick[cindex_1.cevfol - 1] = 0;
  204. }
  205. /* !IF EXITS, KILL FOLLOW. */
  206. if (prsvec_1.prsa != vindex_1.lookw) {
  207. return ret_val;
  208. }
  209. /* !LOOK? */
  210. lookto_(0, rindex_1.mrd, 709, 0, 0);
  211. /* !DESCRIBE SOUTH. */
  212. i = 46;
  213. /* !PANEL IS OPEN/CLOSED. */
  214. if (findex_1.inqstf) {
  215. i = 12;
  216. }
  217. /* !OPEN IF INQ STARTED. */
  218. j = 46;
  219. /* !QDOOR IS OPEN/CLOSED. */
  220. if ((objcts_1.oflag2[oindex_1.qdoor - 1] & OPENBT) != 0) {
  221. j = 12;
  222. }
  223. rspsb2_(710, i, j);
  224. return ret_val;
  225. /* R52-- NORTH CORRIDOR */
  226. L52000:
  227. if (prsvec_1.prsa != vindex_1.lookw) {
  228. return ret_val;
  229. }
  230. /* !LOOK? */
  231. i = 46;
  232. if ((objcts_1.oflag2[oindex_1.cdoor - 1] & OPENBT) != 0) {
  233. i = 12;
  234. }
  235. /* !CDOOR IS OPEN/CLOSED. */
  236. rspsub_(711, i);
  237. return ret_val;
  238. /* R53-- PARAPET */
  239. L53000:
  240. if (prsvec_1.prsa == vindex_1.lookw) {
  241. i__1 = findex_1.pnumb + 712;
  242. rspsub_(712, i__1);
  243. }
  244. return ret_val;
  245. /* R54-- CELL */
  246. L54000:
  247. if (prsvec_1.prsa != vindex_1.lookw) {
  248. return ret_val;
  249. }
  250. /* !LOOK? */
  251. i = 721;
  252. /* !CDOOR IS OPEN/CLOSED. */
  253. if ((objcts_1.oflag2[oindex_1.cdoor - 1] & OPENBT) != 0) {
  254. i = 722;
  255. }
  256. rspeak_(i);
  257. i = 46;
  258. /* !ODOOR IS OPEN/CLOSED. */
  259. if ((objcts_1.oflag2[oindex_1.odoor - 1] & OPENBT) != 0) {
  260. i = 12;
  261. }
  262. if (findex_1.lcell == 4) {
  263. rspsub_(723, i);
  264. }
  265. /* !DESCRIBE. */
  266. return ret_val;
  267. /* R55-- PRISON CELL */
  268. L55000:
  269. if (prsvec_1.prsa == vindex_1.lookw) {
  270. rspeak_(724);
  271. }
  272. /* !LOOK? */
  273. return ret_val;
  274. /* R56-- NIRVANA CELL */
  275. L56000:
  276. if (prsvec_1.prsa != vindex_1.lookw) {
  277. return ret_val;
  278. }
  279. /* !LOOK? */
  280. i = 46;
  281. /* !ODOOR IS OPEN/CLOSED. */
  282. if ((objcts_1.oflag2[oindex_1.odoor - 1] & OPENBT) != 0) {
  283. i = 12;
  284. }
  285. rspsub_(725, i);
  286. return ret_val;
  287. /* RAPPL2, PAGE 6 */
  288. /* R57-- NIRVANA AND END OF GAME */
  289. L57000:
  290. if (prsvec_1.prsa != vindex_1.walkiw) {
  291. return ret_val;
  292. }
  293. /* !WALKIN? */
  294. rspeak_(726);
  295. score_(0);
  296. /* moved to exit routine CLOSE(DBCH) */
  297. exit_();
  298. /* R58-- TOMB ROOM */
  299. L58000:
  300. if (prsvec_1.prsa != vindex_1.lookw) {
  301. return ret_val;
  302. }
  303. /* !LOOK? */
  304. i = 46;
  305. /* !TOMB IS OPEN/CLOSED. */
  306. if ((objcts_1.oflag2[oindex_1.tomb - 1] & OPENBT) != 0) {
  307. i = 12;
  308. }
  309. rspsub_(792, i);
  310. return ret_val;
  311. /* R59-- PUZZLE SIDE ROOM */
  312. L59000:
  313. if (prsvec_1.prsa != vindex_1.lookw) {
  314. return ret_val;
  315. }
  316. /* !LOOK? */
  317. i = 861;
  318. /* !ASSUME DOOR CLOSED. */
  319. if (findex_1.cpoutf) {
  320. i = 862;
  321. }
  322. /* !OPEN? */
  323. rspeak_(i);
  324. /* !DESCRIBE. */
  325. return ret_val;
  326. /* R60-- PUZZLE ROOM */
  327. L60000:
  328. if (prsvec_1.prsa != vindex_1.lookw) {
  329. return ret_val;
  330. }
  331. /* !LOOK? */
  332. if (findex_1.cpushf) {
  333. goto L60100;
  334. }
  335. /* !STARTED PUZZLE? */
  336. rspeak_(868);
  337. /* !NO, DESCRIBE. */
  338. if ((objcts_1.oflag2[oindex_1.warni - 1] & TCHBT) != 0) {
  339. rspeak_(869);
  340. }
  341. return ret_val;
  342. L60100:
  343. cpinfo_(880, findex_1.cphere);
  344. /* !DESCRIBE ROOM. */
  345. return ret_val;
  346. } /* rappl2_ */
  347. /* LOOKTO-- DESCRIBE VIEW IN MIRROR HALLWAY */
  348. /* DECLARATIONS */
  349. static void lookto_(nrm, srm, nt, st, ht)
  350. integer nrm;
  351. integer srm;
  352. integer nt;
  353. integer st;
  354. integer ht;
  355. {
  356. /* System generated locals */
  357. integer i__1;
  358. /* Local variables */
  359. integer i, m1, dir, mrbf;
  360. rspeak_(ht);
  361. /* !DESCRIBE HALL. */
  362. rspeak_(nt);
  363. /* !DESCRIBE NORTH VIEW. */
  364. rspeak_(st);
  365. /* !DESCRIBE SOUTH VIEW. */
  366. dir = 0;
  367. /* !ASSUME NO DIRECTION. */
  368. if ((i__1 = findex_1.mloc - play_1.here, abs(i__1)) != 1) {
  369. goto L200;
  370. }
  371. /* !MIRROR TO N OR S? */
  372. if (findex_1.mloc == nrm) {
  373. dir = 695;
  374. }
  375. if (findex_1.mloc == srm) {
  376. dir = 699;
  377. }
  378. /* !DIR=N/S. */
  379. if (findex_1.mdir % 180 != 0) {
  380. goto L100;
  381. }
  382. /* !MIRROR N-S? */
  383. rspsub_(847, dir);
  384. /* !YES, HE SEES PANEL */
  385. rspsb2_(848, dir, dir);
  386. /* !AND NARROW ROOMS. */
  387. goto L200;
  388. L100:
  389. m1 = mrhere_(play_1.here);
  390. /* !WHICH MIRROR? */
  391. mrbf = 0;
  392. /* !ASSUME INTACT. */
  393. if (m1 == 1 && ! findex_1.mr1f || m1 == 2 && ! findex_1.mr2f) {
  394. mrbf = 1;
  395. }
  396. i__1 = mrbf + 849;
  397. rspsub_(i__1, dir);
  398. /* !DESCRIBE. */
  399. if (m1 == 1 && findex_1.mropnf) {
  400. i__1 = mrbf + 823;
  401. rspeak_(i__1);
  402. }
  403. if (mrbf != 0) {
  404. rspeak_(851);
  405. }
  406. L200:
  407. i = 0;
  408. /* !ASSUME NO MORE TO DO. */
  409. if (nt == 0 && (dir == 0 || dir == 699)) {
  410. i = 852;
  411. }
  412. if (st == 0 && (dir == 0 || dir == 695)) {
  413. i = 853;
  414. }
  415. if (nt + st + dir == 0) {
  416. i = 854;
  417. }
  418. if (ht != 0) {
  419. rspeak_(i);
  420. }
  421. /* !DESCRIBE HALLS. */
  422. } /* lookto_ */
  423. /* EWTELL-- DESCRIBE E/W NARROW ROOMS */
  424. /* DECLARATIONS */
  425. static void ewtell_(rm, st)
  426. integer rm;
  427. integer st;
  428. {
  429. /* System generated locals */
  430. integer i__1;
  431. /* Local variables */
  432. integer i;
  433. logical m1;
  434. /* NOTE THAT WE ARE EAST OR WEST OF MIRROR, AND */
  435. /* MIRROR MUST BE N-S. */
  436. m1 = findex_1.mdir + (rm - rindex_1.mrae) % 2 * 180 == 180;
  437. i = (rm - rindex_1.mrae) % 2 + 819;
  438. /* !GET BASIC E/W STRING. */
  439. if (m1 && ! findex_1.mr1f || ! m1 && ! findex_1.mr2f) {
  440. i += 2;
  441. }
  442. rspeak_(i);
  443. if (m1 && findex_1.mropnf) {
  444. i__1 = (i - 819) / 2 + 823;
  445. rspeak_(i__1);
  446. }
  447. rspeak_(825);
  448. rspeak_(st);
  449. } /* ewtell_ */