dverb1.c 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. /* TAKE-- BASIC TAKE SEQUENCE */
  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. /* TAKE AN OBJECT (FOR VERBS TAKE, PUT, DROP, READ, ETC.) */
  8. logical take_(flg)
  9. logical flg;
  10. {
  11. /* System generated locals */
  12. integer i__1;
  13. logical ret_val;
  14. /* Local variables */
  15. integer oa;
  16. integer x;
  17. ret_val = FALSE_;
  18. /* !ASSUME LOSES. */
  19. oa = objcts_1.oactio[prsvec_1.prso - 1];
  20. /* !GET OBJECT ACTION. */
  21. if (prsvec_1.prso <= star_1.strbit) {
  22. goto L100;
  23. }
  24. /* !STAR? */
  25. ret_val = objact_();
  26. /* !YES, LET IT HANDLE. */
  27. return ret_val;
  28. L100:
  29. x = objcts_1.ocan[prsvec_1.prso - 1];
  30. /* !INSIDE? */
  31. if (prsvec_1.prso != advs_1.avehic[play_1.winner - 1]) {
  32. goto L400;
  33. }
  34. /* !HIS VEHICLE? */
  35. rspeak_(672);
  36. /* !DUMMY. */
  37. return ret_val;
  38. L400:
  39. if ((objcts_1.oflag1[prsvec_1.prso - 1] & TAKEBT) != 0) {
  40. goto L500;
  41. }
  42. if (! oappli_(oa, 0)) {
  43. i__1 = rnd_(5) + 552;
  44. rspeak_(i__1);
  45. }
  46. return ret_val;
  47. /* OBJECT IS TAKEABLE AND IN POSITION TO BE TAKEN. */
  48. L500:
  49. if (x != 0 || qhere_(prsvec_1.prso, play_1.here)) {
  50. goto L600;
  51. }
  52. if (objcts_1.oadv[prsvec_1.prso - 1] == play_1.winner) {
  53. rspeak_(557);
  54. }
  55. /* !ALREADY GOT IT? */
  56. return ret_val;
  57. L600:
  58. if (x != 0 && objcts_1.oadv[x - 1] == play_1.winner || weight_(0,
  59. prsvec_1.prso, play_1.winner) + objcts_1.osize[prsvec_1.prso - 1]
  60. <= state_1.mxload) {
  61. goto L700;
  62. }
  63. rspeak_(558);
  64. /* !TOO MUCH WEIGHT. */
  65. return ret_val;
  66. L700:
  67. ret_val = TRUE_;
  68. /* !AT LAST. */
  69. if (oappli_(oa, 0)) {
  70. return ret_val;
  71. }
  72. /* !DID IT HANDLE? */
  73. newsta_(prsvec_1.prso, 0, 0, 0, play_1.winner);
  74. /* !TAKE OBJECT FOR WINNER. */
  75. objcts_1.oflag2[prsvec_1.prso - 1] |= TCHBT;
  76. scrupd_(objcts_1.ofval[prsvec_1.prso - 1]);
  77. /* !UPDATE SCORE. */
  78. objcts_1.ofval[prsvec_1.prso - 1] = 0;
  79. /* !CANT BE SCORED AGAIN. */
  80. if (flg) {
  81. rspeak_(559);
  82. }
  83. /* !TELL TAKEN. */
  84. return ret_val;
  85. } /* take_ */
  86. /* DROP- DROP VERB PROCESSOR */
  87. /* DECLARATIONS */
  88. logical drop_(z)
  89. logical z;
  90. {
  91. /* System generated locals */
  92. logical ret_val;
  93. /* Local variables */
  94. logical f;
  95. integer i, x;
  96. ret_val = TRUE_;
  97. /* !ASSUME WINS. */
  98. x = objcts_1.ocan[prsvec_1.prso - 1];
  99. /* !GET CONTAINER. */
  100. if (x == 0) {
  101. goto L200;
  102. }
  103. /* !IS IT INSIDE? */
  104. if (objcts_1.oadv[x - 1] != play_1.winner) {
  105. goto L1000;
  106. }
  107. /* !IS HE CARRYING CON? */
  108. if ((objcts_1.oflag2[x - 1] & OPENBT) != 0) {
  109. goto L300;
  110. }
  111. rspsub_(525, objcts_1.odesc2[x - 1]);
  112. /* !CANT REACH. */
  113. return ret_val;
  114. L200:
  115. if (objcts_1.oadv[prsvec_1.prso - 1] != play_1.winner) {
  116. goto L1000;
  117. }
  118. /* !IS HE CARRYING OBJ? */
  119. L300:
  120. if (advs_1.avehic[play_1.winner - 1] == 0) {
  121. goto L400;
  122. }
  123. /* !IS HE IN VEHICLE? */
  124. prsvec_1.prsi = advs_1.avehic[play_1.winner - 1];
  125. /* !YES, */
  126. f = put_(1);
  127. /* !DROP INTO VEHICLE. */
  128. prsvec_1.prsi = 0;
  129. /* !DISARM PARSER. */
  130. return ret_val;
  131. /* !DONE. */
  132. L400:
  133. newsta_(prsvec_1.prso, 0, play_1.here, 0, 0);
  134. /* !DROP INTO ROOM. */
  135. if (play_1.here == rindex_1.mtree) {
  136. newsta_(prsvec_1.prso, 0, rindex_1.fore3, 0, 0);
  137. }
  138. scrupd_(objcts_1.ofval[prsvec_1.prso - 1]);
  139. /* !SCORE OBJECT. */
  140. objcts_1.ofval[prsvec_1.prso - 1] = 0;
  141. /* !CANT BE SCORED AGAIN. */
  142. objcts_1.oflag2[prsvec_1.prso - 1] |= TCHBT;
  143. if (objact_()) {
  144. return ret_val;
  145. }
  146. /* !DID IT HANDLE? */
  147. i = 0;
  148. /* !ASSUME NOTHING TO SAY. */
  149. if (prsvec_1.prsa == vindex_1.dropw) {
  150. i = 528;
  151. }
  152. if (prsvec_1.prsa == vindex_1.throww) {
  153. i = 529;
  154. }
  155. if (i != 0 && play_1.here == rindex_1.mtree) {
  156. i = 659;
  157. }
  158. rspsub_(i, objcts_1.odesc2[prsvec_1.prso - 1]);
  159. return ret_val;
  160. L1000:
  161. rspeak_(527);
  162. /* !DONT HAVE IT. */
  163. return ret_val;
  164. } /* drop_ */
  165. /* PUT- PUT VERB PROCESSOR */
  166. /* DECLARATIONS */
  167. logical put_(flg)
  168. logical flg;
  169. {
  170. /* System generated locals */
  171. logical ret_val;
  172. /* Local variables */
  173. integer j;
  174. integer svi, svo;
  175. ret_val = FALSE_;
  176. if (prsvec_1.prso <= star_1.strbit && prsvec_1.prsi <= star_1.strbit) {
  177. goto L200;
  178. }
  179. if (! objact_()) {
  180. rspeak_(560);
  181. }
  182. /* !STAR */
  183. ret_val = TRUE_;
  184. return ret_val;
  185. L200:
  186. if ((objcts_1.oflag2[prsvec_1.prsi - 1] & OPENBT) != 0 || (
  187. objcts_1.oflag1[prsvec_1.prsi - 1] & DOORBT +
  188. CONTBT) != 0 || (objcts_1.oflag2[prsvec_1.prsi - 1] &
  189. VEHBT) != 0) {
  190. goto L300;
  191. }
  192. rspeak_(561);
  193. /* !CANT PUT IN THAT. */
  194. return ret_val;
  195. L300:
  196. if ((objcts_1.oflag2[prsvec_1.prsi - 1] & OPENBT) != 0) {
  197. goto L400;
  198. }
  199. /* !IS IT OPEN? */
  200. rspeak_(562);
  201. /* !NO, JOKE */
  202. return ret_val;
  203. L400:
  204. if (prsvec_1.prso != prsvec_1.prsi) {
  205. goto L500;
  206. }
  207. /* !INTO ITSELF? */
  208. rspeak_(563);
  209. /* !YES, JOKE. */
  210. return ret_val;
  211. L500:
  212. if (objcts_1.ocan[prsvec_1.prso - 1] != prsvec_1.prsi) {
  213. goto L600;
  214. }
  215. /* !ALREADY INSIDE. */
  216. rspsb2_(564, objcts_1.odesc2[prsvec_1.prso - 1], objcts_1.odesc2[
  217. prsvec_1.prsi - 1]);
  218. ret_val = TRUE_;
  219. return ret_val;
  220. L600:
  221. if (weight_(0, prsvec_1.prso, 0) + weight_(0, prsvec_1.prsi,
  222. 0) + objcts_1.osize[prsvec_1.prso - 1] <= objcts_1.ocapac[
  223. prsvec_1.prsi - 1]) {
  224. goto L700;
  225. }
  226. rspeak_(565);
  227. /* !THEN CANT DO IT. */
  228. return ret_val;
  229. /* NOW SEE IF OBJECT (OR ITS CONTAINER) IS IN ROOM */
  230. L700:
  231. j = prsvec_1.prso;
  232. /* !START SEARCH. */
  233. L725:
  234. if (qhere_(j, play_1.here)) {
  235. goto L750;
  236. }
  237. /* !IS IT HERE? */
  238. j = objcts_1.ocan[j - 1];
  239. if (j != 0) {
  240. goto L725;
  241. }
  242. /* !MORE TO DO? */
  243. goto L800;
  244. /* !NO, SCH FAILS. */
  245. L750:
  246. svo = prsvec_1.prso;
  247. /* !SAVE PARSER. */
  248. svi = prsvec_1.prsi;
  249. prsvec_1.prsa = vindex_1.takew;
  250. prsvec_1.prsi = 0;
  251. if (! take_(0)) {
  252. return ret_val;
  253. }
  254. /* !TAKE OBJECT. */
  255. prsvec_1.prsa = vindex_1.putw;
  256. prsvec_1.prso = svo;
  257. prsvec_1.prsi = svi;
  258. goto L1000;
  259. /* NOW SEE IF OBJECT IS ON PERSON. */
  260. L800:
  261. if (objcts_1.ocan[prsvec_1.prso - 1] == 0) {
  262. goto L1000;
  263. }
  264. /* !INSIDE? */
  265. if ((objcts_1.oflag2[objcts_1.ocan[prsvec_1.prso - 1] - 1] &
  266. OPENBT) != 0) {
  267. goto L900;
  268. }
  269. /* !OPEN? */
  270. rspsub_(566, objcts_1.odesc2[prsvec_1.prso - 1]);
  271. /* !LOSE. */
  272. return ret_val;
  273. L900:
  274. scrupd_(objcts_1.ofval[prsvec_1.prso - 1]);
  275. /* !SCORE OBJECT. */
  276. objcts_1.ofval[prsvec_1.prso - 1] = 0;
  277. objcts_1.oflag2[prsvec_1.prso - 1] |= TCHBT;
  278. newsta_(prsvec_1.prso, 0, 0, 0, play_1.winner);
  279. /* !TEMPORARILY ON WINNER. */
  280. L1000:
  281. if (objact_()) {
  282. return ret_val;
  283. }
  284. /* !NO, GIVE OBJECT A SHOT. */
  285. newsta_(prsvec_1.prso, 2, 0, prsvec_1.prsi, 0);
  286. /* !CONTAINED INSIDE. */
  287. ret_val = TRUE_;
  288. return ret_val;
  289. } /* put_ */
  290. /* VALUAC- HANDLES VALUABLES/EVERYTHING */
  291. void valuac_(v)
  292. integer v;
  293. {
  294. /* System generated locals */
  295. integer i__1;
  296. /* Local variables */
  297. logical f;
  298. integer i;
  299. logical f1;
  300. integer savep, saveh;
  301. f = TRUE_;
  302. /* !ASSUME NO ACTIONS. */
  303. i = 579;
  304. /* !ASSUME NOT LIT. */
  305. if (! lit_(play_1.here)) {
  306. goto L4000;
  307. }
  308. /* !IF NOT LIT, PUNT. */
  309. i = 677;
  310. /* !ASSUME WRONG VERB. */
  311. savep = prsvec_1.prso;
  312. /* !SAVE PRSO. */
  313. saveh = play_1.here;
  314. /* !SAVE HERE. */
  315. /* L100: */
  316. if (prsvec_1.prsa != vindex_1.takew) {
  317. goto L1000;
  318. }
  319. /* !TAKE EVERY/VALUA? */
  320. i__1 = objcts_1.olnt;
  321. for (prsvec_1.prso = 1; prsvec_1.prso <= i__1; ++prsvec_1.prso) {
  322. /* !LOOP THRU OBJECTS. */
  323. if (! qhere_(prsvec_1.prso, play_1.here) || (objcts_1.oflag1[
  324. prsvec_1.prso - 1] & VISIBT) == 0 || (
  325. objcts_1.oflag2[prsvec_1.prso - 1] & ACTRBT) != 0 ||
  326. savep == v && objcts_1.otval[prsvec_1.prso - 1] <= 0) {
  327. goto L500;
  328. }
  329. if ((objcts_1.oflag1[prsvec_1.prso - 1] & TAKEBT) == 0 && (
  330. objcts_1.oflag2[prsvec_1.prso - 1] & TRYBT) == 0) {
  331. goto L500;
  332. }
  333. f = FALSE_;
  334. rspsub_(580, objcts_1.odesc2[prsvec_1.prso - 1]);
  335. f1 = take_(1);
  336. if (saveh != play_1.here) {
  337. return;
  338. }
  339. L500:
  340. ;
  341. }
  342. goto L3000;
  343. L1000:
  344. if (prsvec_1.prsa != vindex_1.dropw) {
  345. goto L2000;
  346. }
  347. /* !DROP EVERY/VALUA? */
  348. i__1 = objcts_1.olnt;
  349. for (prsvec_1.prso = 1; prsvec_1.prso <= i__1; ++prsvec_1.prso) {
  350. if (objcts_1.oadv[prsvec_1.prso - 1] != play_1.winner || savep == v
  351. && objcts_1.otval[prsvec_1.prso - 1] <= 0) {
  352. goto L1500;
  353. }
  354. f = FALSE_;
  355. rspsub_(580, objcts_1.odesc2[prsvec_1.prso - 1]);
  356. f1 = drop_(1);
  357. if (saveh != play_1.here) {
  358. return;
  359. }
  360. L1500:
  361. ;
  362. }
  363. goto L3000;
  364. L2000:
  365. if (prsvec_1.prsa != vindex_1.putw) {
  366. goto L3000;
  367. }
  368. /* !PUT EVERY/VALUA? */
  369. i__1 = objcts_1.olnt;
  370. for (prsvec_1.prso = 1; prsvec_1.prso <= i__1; ++prsvec_1.prso) {
  371. /* !LOOP THRU OBJECTS. */
  372. if (objcts_1.oadv[prsvec_1.prso - 1] != play_1.winner ||
  373. prsvec_1.prso == prsvec_1.prsi || savep == v &&
  374. objcts_1.otval[prsvec_1.prso - 1] <= 0 || (objcts_1.oflag1[
  375. prsvec_1.prso - 1] & VISIBT) == 0) {
  376. goto L2500;
  377. }
  378. f = FALSE_;
  379. rspsub_(580, objcts_1.odesc2[prsvec_1.prso - 1]);
  380. f1 = put_(1);
  381. if (saveh != play_1.here) {
  382. return;
  383. }
  384. L2500:
  385. ;
  386. }
  387. L3000:
  388. i = 581;
  389. if (savep == v) {
  390. i = 582;
  391. }
  392. /* !CHOOSE MESSAGE. */
  393. L4000:
  394. if (f) {
  395. rspeak_(i);
  396. }
  397. /* !IF NOTHING, REPORT. */
  398. } /* valuac_ */