actors.c 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. /* AAPPLI- APPLICABLES FOR ADVENTURERS */
  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. logical aappli_(ri)
  8. integer ri;
  9. {
  10. /* System generated locals */
  11. logical ret_val;
  12. /* Local variables */
  13. logical f;
  14. integer i;
  15. if (ri == 0) {
  16. goto L10;
  17. }
  18. /* !IF ZERO, NO APP. */
  19. ret_val = TRUE_;
  20. /* !ASSUME WINS. */
  21. switch (ri) {
  22. case 1: goto L1000;
  23. case 2: goto L2000;
  24. }
  25. /* !BRANCH ON ADV. */
  26. bug_(11, ri);
  27. /* COMMON FALSE RETURN. */
  28. L10:
  29. ret_val = FALSE_;
  30. return ret_val;
  31. /* A1-- ROBOT. PROCESS MOST COMMANDS GIVEN TO ROBOT. */
  32. L1000:
  33. if (prsvec_1.prsa != vindex_1.raisew || prsvec_1.prso != oindex_1.rcage) {
  34. goto L1200;
  35. }
  36. cevent_1.cflag[cindex_1.cevsph - 1] = FALSE_;
  37. /* !ROBOT RAISED CAGE. */
  38. play_1.winner = aindex_1.player;
  39. /* !RESET FOR PLAYER. */
  40. f = moveto_(rindex_1.cager, play_1.winner);
  41. /* !MOVE TO NEW ROOM. */
  42. newsta_(oindex_1.cage, 567, rindex_1.cager, 0, 0);
  43. /* !INSTALL CAGE IN ROOM. */
  44. newsta_(oindex_1.robot, 0, rindex_1.cager, 0, 0);
  45. /* !INSTALL ROBOT IN ROOM. */
  46. advs_1.aroom[aindex_1.arobot - 1] = rindex_1.cager;
  47. /* !ALSO MOVE ROBOT/ADV. */
  48. findex_1.cagesf = TRUE_;
  49. /* !CAGE SOLVED. */
  50. objcts_1.oflag1[oindex_1.robot - 1] &= ~ NDSCBT;
  51. objcts_1.oflag1[oindex_1.spher - 1] |= TAKEBT;
  52. return ret_val;
  53. L1200:
  54. if (prsvec_1.prsa != vindex_1.drinkw && prsvec_1.prsa != vindex_1.eatw) {
  55. goto L1300;
  56. }
  57. rspeak_(568);
  58. /* !EAT OR DRINK, JOKE. */
  59. return ret_val;
  60. L1300:
  61. if (prsvec_1.prsa != vindex_1.readw) {
  62. goto L1400;
  63. }
  64. /* !READ, */
  65. rspeak_(569);
  66. /* !JOKE. */
  67. return ret_val;
  68. L1400:
  69. if (prsvec_1.prsa == vindex_1.walkw || prsvec_1.prsa == vindex_1.takew ||
  70. prsvec_1.prsa == vindex_1.dropw || prsvec_1.prsa == vindex_1.putw
  71. || prsvec_1.prsa == vindex_1.pushw || prsvec_1.prsa ==
  72. vindex_1.throww || prsvec_1.prsa == vindex_1.turnw ||
  73. prsvec_1.prsa == vindex_1.leapw) {
  74. goto L10;
  75. }
  76. rspeak_(570);
  77. /* !JOKE. */
  78. return ret_val;
  79. /* AAPPLI, PAGE 3 */
  80. /* A2-- MASTER. PROCESS MOST COMMANDS GIVEN TO MASTER. */
  81. L2000:
  82. if ((objcts_1.oflag2[oindex_1.qdoor - 1] & OPENBT) != 0) {
  83. goto L2100;
  84. }
  85. rspeak_(783);
  86. /* !NO MASTER YET. */
  87. return ret_val;
  88. L2100:
  89. if (prsvec_1.prsa != vindex_1.walkw) {
  90. goto L2200;
  91. }
  92. /* !WALK? */
  93. i = 784;
  94. /* !ASSUME WONT. */
  95. if (play_1.here == rindex_1.scorr && (prsvec_1.prso == xsrch_1.xnorth ||
  96. prsvec_1.prso == xsrch_1.xenter) || play_1.here == rindex_1.ncorr
  97. && (prsvec_1.prso == xsrch_1.xsouth || prsvec_1.prso ==
  98. xsrch_1.xenter)) {
  99. i = 785;
  100. }
  101. rspeak_(i);
  102. return ret_val;
  103. L2200:
  104. if (prsvec_1.prsa == vindex_1.takew || prsvec_1.prsa == vindex_1.dropw ||
  105. prsvec_1.prsa == vindex_1.putw || prsvec_1.prsa ==
  106. vindex_1.throww || prsvec_1.prsa == vindex_1.pushw ||
  107. prsvec_1.prsa == vindex_1.turnw || prsvec_1.prsa ==
  108. vindex_1.spinw || prsvec_1.prsa == vindex_1.trntow ||
  109. prsvec_1.prsa == vindex_1.follow || prsvec_1.prsa ==
  110. vindex_1.stayw || prsvec_1.prsa == vindex_1.openw ||
  111. prsvec_1.prsa == vindex_1.closew || prsvec_1.prsa ==
  112. vindex_1.killw) {
  113. goto L10;
  114. }
  115. rspeak_(786);
  116. /* !MASTER CANT DO IT. */
  117. return ret_val;
  118. } /* aappli_ */
  119. /* THIEFD- INTERMOVE THIEF DEMON */
  120. /* DECLARATIONS */
  121. void thiefd_()
  122. {
  123. /* System generated locals */
  124. integer i__1, i__2;
  125. /* Local variables */
  126. integer i, j, nr;
  127. logical once;
  128. integer rhere;
  129. /* !SET UP DETAIL FLAG. */
  130. once = FALSE_;
  131. /* !INIT FLAG. */
  132. L1025:
  133. rhere = objcts_1.oroom[oindex_1.thief - 1];
  134. /* !VISIBLE POS. */
  135. if (rhere != 0) {
  136. hack_1.thfpos = rhere;
  137. }
  138. if (hack_1.thfpos == play_1.here) {
  139. goto L1100;
  140. }
  141. /* !THIEF IN WIN RM? */
  142. if (hack_1.thfpos != rindex_1.treas) {
  143. goto L1400;
  144. }
  145. /* !THIEF NOT IN TREAS? */
  146. /* THIEF IS IN TREASURE ROOM, AND WINNER IS NOT. */
  147. if (rhere == 0) {
  148. goto L1050;
  149. }
  150. /* !VISIBLE? */
  151. newsta_(oindex_1.thief, 0, 0, 0, 0);
  152. /* !YES, VANISH. */
  153. rhere = 0;
  154. if (qhere_(oindex_1.still, rindex_1.treas) || objcts_1.oadv[
  155. oindex_1.still - 1] == -oindex_1.thief) {
  156. newsta_(oindex_1.still, 0, 0, oindex_1.thief, 0);
  157. }
  158. L1050:
  159. i__1 = -oindex_1.thief;
  160. i = robadv_(i__1, hack_1.thfpos, 0, 0);
  161. /* !DROP VALUABLES. */
  162. if (qhere_(oindex_1.egg, hack_1.thfpos)) {
  163. objcts_1.oflag2[oindex_1.egg - 1] |= OPENBT;
  164. }
  165. goto L1700;
  166. /* THIEF AND WINNER IN SAME ROOM. */
  167. L1100:
  168. if (hack_1.thfpos == rindex_1.treas) {
  169. goto L1700;
  170. }
  171. /* !IF TREAS ROOM, NOTHING. */
  172. if ((rooms_1.rflag[hack_1.thfpos - 1] & RLIGHT) != 0) {
  173. goto L1400;
  174. }
  175. if (hack_1.thfflg) {
  176. goto L1300;
  177. }
  178. /* !THIEF ANNOUNCED? */
  179. if (rhere != 0 || prob_(70, 70)) {
  180. goto L1150;
  181. }
  182. /* !IF INVIS AND 30%. */
  183. if (objcts_1.ocan[oindex_1.still - 1] != oindex_1.thief) {
  184. goto L1700;
  185. }
  186. /* !ABORT IF NO STILLETTO. */
  187. newsta_(oindex_1.thief, 583, hack_1.thfpos, 0, 0);
  188. /* !INSERT THIEF INTO ROOM. */
  189. hack_1.thfflg = TRUE_;
  190. /* !THIEF IS ANNOUNCED. */
  191. return;
  192. L1150:
  193. if (rhere == 0 || (objcts_1.oflag2[oindex_1.thief - 1] & FITEBT)
  194. == 0) {
  195. goto L1200;
  196. }
  197. if (winnin_(oindex_1.thief, play_1.winner)) {
  198. goto L1175;
  199. }
  200. /* !WINNING? */
  201. newsta_(oindex_1.thief, 584, 0, 0, 0);
  202. /* !NO, VANISH THIEF. */
  203. objcts_1.oflag2[oindex_1.thief - 1] &= ~ FITEBT;
  204. if (qhere_(oindex_1.still, hack_1.thfpos) || objcts_1.oadv[
  205. oindex_1.still - 1] == -oindex_1.thief) {
  206. newsta_(oindex_1.still, 0, 0, oindex_1.thief, 0);
  207. }
  208. return;
  209. L1175:
  210. if (prob_(90, 90)) {
  211. goto L1700;
  212. }
  213. /* !90% CHANCE TO STAY. */
  214. L1200:
  215. if (rhere == 0 || prob_(70, 70)) {
  216. goto L1250;
  217. }
  218. /* !IF VISIBLE AND 30% */
  219. newsta_(oindex_1.thief, 585, 0, 0, 0);
  220. /* !VANISH THIEF. */
  221. if (qhere_(oindex_1.still, hack_1.thfpos) || objcts_1.oadv[
  222. oindex_1.still - 1] == -oindex_1.thief) {
  223. newsta_(oindex_1.still, 0, 0, oindex_1.thief, 0);
  224. }
  225. return;
  226. L1300:
  227. if (rhere == 0) {
  228. goto L1700;
  229. }
  230. /* !ANNOUNCED. VISIBLE? */
  231. L1250:
  232. if (prob_(70, 70)) {
  233. return;
  234. }
  235. /* !70% CHANCE TO DO NOTHING. */
  236. hack_1.thfflg = TRUE_;
  237. i__1 = -oindex_1.thief;
  238. i__2 = -oindex_1.thief;
  239. nr = robrm_(hack_1.thfpos, 100, 0, 0, i__1) + robadv_(
  240. play_1.winner, 0, 0, i__2);
  241. i = 586;
  242. /* !ROBBED EM. */
  243. if (rhere != 0) {
  244. i = 588;
  245. }
  246. /* !WAS HE VISIBLE? */
  247. if (nr != 0) {
  248. ++i;
  249. }
  250. /* !DID HE GET ANYTHING? */
  251. newsta_(oindex_1.thief, i, 0, 0, 0);
  252. /* !VANISH THIEF. */
  253. if (qhere_(oindex_1.still, hack_1.thfpos) || objcts_1.oadv[
  254. oindex_1.still - 1] == -oindex_1.thief) {
  255. newsta_(oindex_1.still, 0, 0, oindex_1.thief, 0);
  256. }
  257. if (nr != 0 && ! lit_(hack_1.thfpos)) {
  258. rspeak_(406);
  259. }
  260. rhere = 0;
  261. goto L1700;
  262. /* !ONWARD. */
  263. /* NOT IN ADVENTURERS ROOM. */
  264. L1400:
  265. newsta_(oindex_1.thief, 0, 0, 0, 0);
  266. /* !VANISH. */
  267. rhere = 0;
  268. if (qhere_(oindex_1.still, hack_1.thfpos) || objcts_1.oadv[
  269. oindex_1.still - 1] == -oindex_1.thief) {
  270. newsta_(oindex_1.still, 0, 0, oindex_1.thief, 0);
  271. }
  272. if ((rooms_1.rflag[hack_1.thfpos - 1] & RSEEN) == 0) {
  273. goto L1700;
  274. }
  275. i__1 = -oindex_1.thief;
  276. i = robrm_(hack_1.thfpos, 75, 0, 0, i__1);
  277. /* !ROB ROOM 75%. */
  278. if (hack_1.thfpos < rindex_1.maze1 || hack_1.thfpos > rindex_1.maz15 ||
  279. play_1.here < rindex_1.maze1 || play_1.here > rindex_1.maz15) {
  280. goto L1500;
  281. }
  282. i__1 = objcts_1.olnt;
  283. for (i = 1; i <= i__1; ++i) {
  284. /* !BOTH IN MAZE. */
  285. if (! qhere_(i, hack_1.thfpos) || prob_(60, 60) || (
  286. objcts_1.oflag1[i - 1] & VISIBT + TAKEBT) !=
  287. VISIBT + TAKEBT) {
  288. goto L1450;
  289. }
  290. rspsub_(590, objcts_1.odesc2[i - 1]);
  291. /* !TAKE OBJECT. */
  292. if (prob_(40, 20)) {
  293. goto L1700;
  294. }
  295. i__2 = -oindex_1.thief;
  296. newsta_(i, 0, 0, 0, i__2);
  297. /* !MOST OF THE TIME. */
  298. objcts_1.oflag2[i - 1] |= TCHBT;
  299. goto L1700;
  300. L1450:
  301. ;
  302. }
  303. goto L1700;
  304. L1500:
  305. i__1 = objcts_1.olnt;
  306. for (i = 1; i <= i__1; ++i) {
  307. /* !NOT IN MAZE. */
  308. if (! qhere_(i, hack_1.thfpos) || objcts_1.otval[i - 1] != 0 ||
  309. prob_(80, 60) || (objcts_1.oflag1[i - 1] &
  310. VISIBT + TAKEBT) != VISIBT +
  311. TAKEBT) {
  312. goto L1550;
  313. }
  314. i__2 = -oindex_1.thief;
  315. newsta_(i, 0, 0, 0, i__2);
  316. objcts_1.oflag2[i - 1] |= TCHBT;
  317. goto L1700;
  318. L1550:
  319. ;
  320. }
  321. /* NOW MOVE TO NEW ROOM. */
  322. L1700:
  323. if (objcts_1.oadv[oindex_1.rope - 1] == -oindex_1.thief) {
  324. findex_1.domef = FALSE_;
  325. }
  326. if (once) {
  327. goto L1800;
  328. }
  329. once = ! once;
  330. L1750:
  331. --hack_1.thfpos;
  332. /* !NEXT ROOM. */
  333. if (hack_1.thfpos <= 0) {
  334. hack_1.thfpos = rooms_1.rlnt;
  335. }
  336. if ((rooms_1.rflag[hack_1.thfpos - 1] & RLAND + RSACRD +
  337. REND) != RLAND) {
  338. goto L1750;
  339. }
  340. hack_1.thfflg = FALSE_;
  341. /* !NOT ANNOUNCED. */
  342. goto L1025;
  343. /* !ONCE MORE. */
  344. /* ALL DONE. */
  345. L1800:
  346. if (hack_1.thfpos == rindex_1.treas) {
  347. return;
  348. }
  349. /* !IN TREASURE ROOM? */
  350. j = 591;
  351. /* !NO, DROP STUFF. */
  352. if (hack_1.thfpos != play_1.here) {
  353. j = 0;
  354. }
  355. i__1 = objcts_1.olnt;
  356. for (i = 1; i <= i__1; ++i) {
  357. if (objcts_1.oadv[i - 1] != -oindex_1.thief || prob_(70, 70)
  358. || objcts_1.otval[i - 1] > 0) {
  359. goto L1850;
  360. }
  361. newsta_(i, j, hack_1.thfpos, 0, 0);
  362. j = 0;
  363. L1850:
  364. ;
  365. }
  366. return;
  367. } /* thiefd_ */