dverb1.for 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. C TAKE-- BASIC TAKE SEQUENCE
  2. C
  3. C COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142
  4. C ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED
  5. C WRITTEN BY R. M. SUPNIK
  6. C
  7. C TAKE AN OBJECT (FOR VERBS TAKE, PUT, DROP, READ, ETC.)
  8. C
  9. LOGICAL FUNCTION TAKE(FLG)
  10. C
  11. C DECLARATIONS
  12. C
  13. IMPLICIT INTEGER (A-Z)
  14. LOGICAL FLG,OBJACT,OAPPLI,QOPEN,QHERE
  15. include 'parser.h'
  16. include 'gamestat.h'
  17. include 'state.h'
  18. COMMON /STAR/ MBASE,STRBIT
  19. include 'objects.h'
  20. include 'oflags.h'
  21. C
  22. include 'advers.h'
  23. C
  24. C FUNCTIONS AND DATA
  25. C
  26. QOPEN(O)=(IAND(OFLAG2(O),OPENBT).NE.0)
  27. C TAKE, PAGE 2
  28. C
  29. TAKE=.FALSE.
  30. C !ASSUME LOSES.
  31. OA=OACTIO(PRSO)
  32. C !GET OBJECT ACTION.
  33. IF(PRSO.LE.STRBIT) GO TO 100
  34. C !STAR?
  35. TAKE=OBJACT(X)
  36. C !YES, LET IT HANDLE.
  37. RETURN
  38. C
  39. 100 X=OCAN(PRSO)
  40. C !INSIDE?
  41. IF(PRSO.NE.AVEHIC(WINNER)) GO TO 400
  42. C !HIS VEHICLE?
  43. CALL RSPEAK(672)
  44. C !DUMMY.
  45. RETURN
  46. C
  47. 400 IF(IAND(OFLAG1(PRSO),TAKEBT).NE.0) GO TO 500
  48. IF(.NOT.OAPPLI(OA,0)) CALL RSPEAK(552+RND(5))
  49. RETURN
  50. C
  51. C OBJECT IS TAKEABLE AND IN POSITION TO BE TAKEN.
  52. C
  53. 500 IF((X.NE.0).OR. QHERE(PRSO,HERE)) GO TO 600
  54. IF(OADV(PRSO).EQ.WINNER) CALL RSPEAK(557)
  55. C !ALREADY GOT IT?
  56. RETURN
  57. C
  58. 600 IF(((X.NE.0).AND.(OADV(X).EQ.WINNER)).OR.
  59. & ((WEIGHT(0,PRSO,WINNER)+OSIZE(PRSO)).LE.MXLOAD))
  60. & GO TO 700
  61. CALL RSPEAK(558)
  62. C !TOO MUCH WEIGHT.
  63. RETURN
  64. C
  65. 700 TAKE=.TRUE.
  66. C !AT LAST.
  67. IF(OAPPLI(OA,0)) RETURN
  68. C !DID IT HANDLE?
  69. CALL NEWSTA(PRSO,0,0,0,WINNER)
  70. C !TAKE OBJECT FOR WINNER.
  71. OFLAG2(PRSO)=IOR(OFLAG2(PRSO),TCHBT)
  72. CALL SCRUPD(OFVAL(PRSO))
  73. C !UPDATE SCORE.
  74. OFVAL(PRSO)=0
  75. C !CANT BE SCORED AGAIN.
  76. IF(FLG) CALL RSPEAK(559)
  77. C !TELL TAKEN.
  78. RETURN
  79. C
  80. END
  81. C DROP- DROP VERB PROCESSOR
  82. C
  83. C DECLARATIONS
  84. C
  85. LOGICAL FUNCTION DROP(Z)
  86. IMPLICIT INTEGER (A-Z)
  87. LOGICAL Z
  88. LOGICAL F,PUT,OBJACT
  89. include 'parser.h'
  90. include 'gamestat.h'
  91. C
  92. C ROOMS
  93. include 'rindex.h'
  94. include 'objects.h'
  95. include 'oflags.h'
  96. C
  97. include 'advers.h'
  98. include 'verbs.h'
  99. C DROP, PAGE 2
  100. C
  101. DROP=.TRUE.
  102. C !ASSUME WINS.
  103. X=OCAN(PRSO)
  104. C !GET CONTAINER.
  105. IF(X.EQ.0) GO TO 200
  106. C !IS IT INSIDE?
  107. IF(OADV(X).NE.WINNER) GO TO 1000
  108. C !IS HE CARRYING CON?
  109. IF(IAND(OFLAG2(X),OPENBT).NE.0) GO TO 300
  110. CALL RSPSUB(525,ODESC2(X))
  111. C !CANT REACH.
  112. RETURN
  113. C
  114. 200 IF(OADV(PRSO).NE.WINNER) GO TO 1000
  115. C !IS HE CARRYING OBJ?
  116. 300 IF(AVEHIC(WINNER).EQ.0) GO TO 400
  117. C !IS HE IN VEHICLE?
  118. PRSI=AVEHIC(WINNER)
  119. C !YES,
  120. F=PUT(.TRUE.)
  121. C !DROP INTO VEHICLE.
  122. PRSI=0
  123. C !DISARM PARSER.
  124. RETURN
  125. C !DONE.
  126. C
  127. 400 CALL NEWSTA(PRSO,0,HERE,0,0)
  128. C !DROP INTO ROOM.
  129. IF(HERE.EQ.MTREE) CALL NEWSTA(PRSO,0,FORE3,0,0)
  130. CALL SCRUPD(OFVAL(PRSO))
  131. C !SCORE OBJECT.
  132. OFVAL(PRSO)=0
  133. C !CANT BE SCORED AGAIN.
  134. OFLAG2(PRSO)=IOR(OFLAG2(PRSO),TCHBT)
  135. C
  136. IF(OBJACT(X)) RETURN
  137. C !DID IT HANDLE?
  138. I=0
  139. C !ASSUME NOTHING TO SAY.
  140. IF(PRSA.EQ.DROPW) I=528
  141. IF(PRSA.EQ.THROWW) I=529
  142. IF((I.NE.0).AND.(HERE.EQ.MTREE)) I=659
  143. CALL RSPSUB(I,ODESC2(PRSO))
  144. RETURN
  145. C
  146. 1000 CALL RSPEAK(527)
  147. C !DONT HAVE IT.
  148. RETURN
  149. C
  150. END
  151. C PUT- PUT VERB PROCESSOR
  152. C
  153. C DECLARATIONS
  154. C
  155. LOGICAL FUNCTION PUT(FLG)
  156. IMPLICIT INTEGER (A-Z)
  157. LOGICAL TAKE,QOPEN,QHERE,OBJACT,FLG
  158. include 'parser.h'
  159. include 'gamestat.h'
  160. C
  161. C MISCELLANEOUS VARIABLES
  162. C
  163. COMMON /STAR/ MBASE,STRBIT
  164. include 'objects.h'
  165. include 'oflags.h'
  166. include 'advers.h'
  167. include 'verbs.h'
  168. C
  169. C FUNCTIONS AND DATA
  170. C
  171. QOPEN(R)=((IAND(OFLAG2(R),OPENBT)).NE.0)
  172. C PUT, PAGE 2
  173. C
  174. PUT=.FALSE.
  175. IF((PRSO.LE.STRBIT).AND.(PRSI.LE.STRBIT)) GO TO 200
  176. IF(.NOT.OBJACT(X)) CALL RSPEAK(560)
  177. C !STAR
  178. PUT=.TRUE.
  179. RETURN
  180. C
  181. 200 IF((QOPEN(PRSI))
  182. & .OR.(IAND(OFLAG1(PRSI),(DOORBT+CONTBT)).NE.0)
  183. & .OR.(IAND(OFLAG2(PRSI),VEHBT).NE.0)) GO TO 300
  184. CALL RSPEAK(561)
  185. C !CANT PUT IN THAT.
  186. RETURN
  187. C
  188. 300 IF(QOPEN(PRSI)) GO TO 400
  189. C !IS IT OPEN?
  190. CALL RSPEAK(562)
  191. C !NO, JOKE
  192. RETURN
  193. C
  194. 400 IF(PRSO.NE.PRSI) GO TO 500
  195. C !INTO ITSELF?
  196. CALL RSPEAK(563)
  197. C !YES, JOKE.
  198. RETURN
  199. C
  200. 500 IF(OCAN(PRSO).NE.PRSI) GO TO 600
  201. C !ALREADY INSIDE.
  202. CALL RSPSB2(564,ODESC2(PRSO),ODESC2(PRSI))
  203. PUT=.TRUE.
  204. RETURN
  205. C
  206. 600 IF((WEIGHT(0,PRSO,0)+WEIGHT(0,PRSI,0)+OSIZE(PRSO))
  207. & .LE.OCAPAC(PRSI)) GO TO 700
  208. CALL RSPEAK(565)
  209. C !THEN CANT DO IT.
  210. RETURN
  211. C
  212. C NOW SEE IF OBJECT (OR ITS CONTAINER) IS IN ROOM
  213. C
  214. 700 J=PRSO
  215. C !START SEARCH.
  216. 725 IF(QHERE(J,HERE)) GO TO 750
  217. C !IS IT HERE?
  218. J=OCAN(J)
  219. IF(J.NE.0) GO TO 725
  220. C !MORE TO DO?
  221. GO TO 800
  222. C !NO, SCH FAILS.
  223. C
  224. 750 SVO=PRSO
  225. C !SAVE PARSER.
  226. SVI=PRSI
  227. PRSA=TAKEW
  228. PRSI=0
  229. IF(.NOT.TAKE(.FALSE.)) RETURN
  230. C !TAKE OBJECT.
  231. PRSA=PUTW
  232. PRSO=SVO
  233. PRSI=SVI
  234. GO TO 1000
  235. C
  236. C NOW SEE IF OBJECT IS ON PERSON.
  237. C
  238. 800 IF(OCAN(PRSO).EQ.0) GO TO 1000
  239. C !INSIDE?
  240. IF(QOPEN(OCAN(PRSO))) GO TO 900
  241. C !OPEN?
  242. CALL RSPSUB(566,ODESC2(PRSO))
  243. C !LOSE.
  244. RETURN
  245. C
  246. 900 CALL SCRUPD(OFVAL(PRSO))
  247. C !SCORE OBJECT.
  248. OFVAL(PRSO)=0
  249. OFLAG2(PRSO)=IOR(OFLAG2(PRSO),TCHBT)
  250. CALL NEWSTA(PRSO,0,0,0,WINNER)
  251. C !TEMPORARILY ON WINNER.
  252. C
  253. 1000 IF(OBJACT(X)) RETURN
  254. C !NO, GIVE OBJECT A SHOT.
  255. CALL NEWSTA(PRSO,2,0,PRSI,0)
  256. C !CONTAINED INSIDE.
  257. PUT=.TRUE.
  258. RETURN
  259. C
  260. END
  261. C VALUAC- HANDLES VALUABLES/EVERYTHING
  262. C
  263. C DECLARATIONS
  264. C
  265. SUBROUTINE VALUAC(V)
  266. IMPLICIT INTEGER (A-Z)
  267. LOGICAL LIT,F,F1,TAKE,PUT,DROP,NOTVAL,QHERE
  268. include 'parser.h'
  269. include 'gamestat.h'
  270. include 'objects.h'
  271. include 'oflags.h'
  272. include 'verbs.h'
  273. C
  274. C FUNCTIONS AND DATA
  275. C
  276. NOTVAL(R)=(SAVEP.EQ.V).AND.(OTVAL(R).LE.0)
  277. C VALUAC, PAGE 2
  278. C
  279. F=.TRUE.
  280. C !ASSUME NO ACTIONS.
  281. I=579
  282. C !ASSUME NOT LIT.
  283. IF(.NOT.LIT(HERE)) GO TO 4000
  284. C !IF NOT LIT, PUNT.
  285. I=677
  286. C !ASSUME WRONG VERB.
  287. SAVEP=PRSO
  288. C !SAVE PRSO.
  289. SAVEH=HERE
  290. C !SAVE HERE.
  291. C
  292. 100 IF(PRSA.NE.TAKEW) GO TO 1000
  293. C !TAKE EVERY/VALUA?
  294. DO 500 PRSO=1,OLNT
  295. C !LOOP THRU OBJECTS.
  296. IF(.NOT.QHERE(PRSO,HERE).OR.
  297. & (IAND(OFLAG1(PRSO),VISIBT).EQ.0).OR.
  298. & (IAND(OFLAG2(PRSO),ACTRBT).NE.0).OR.
  299. & NOTVAL(PRSO)) GO TO 500
  300. IF((IAND(OFLAG1(PRSO),TAKEBT).EQ.0).AND.
  301. & (IAND(OFLAG2(PRSO),TRYBT).EQ.0)) GO TO 500
  302. F=.FALSE.
  303. CALL RSPSUB(580,ODESC2(PRSO))
  304. F1=TAKE(.TRUE.)
  305. IF(SAVEH.NE.HERE) RETURN
  306. 500 CONTINUE
  307. GO TO 3000
  308. C
  309. 1000 IF(PRSA.NE.DROPW) GO TO 2000
  310. C !DROP EVERY/VALUA?
  311. DO 1500 PRSO=1,OLNT
  312. IF((OADV(PRSO).NE.WINNER).OR.NOTVAL(PRSO))
  313. & GO TO 1500
  314. F=.FALSE.
  315. CALL RSPSUB(580,ODESC2(PRSO))
  316. F1=DROP(.TRUE.)
  317. IF(SAVEH.NE.HERE) RETURN
  318. 1500 CONTINUE
  319. GO TO 3000
  320. C
  321. 2000 IF(PRSA.NE.PUTW) GO TO 3000
  322. C !PUT EVERY/VALUA?
  323. DO 2500 PRSO=1,OLNT
  324. C !LOOP THRU OBJECTS.
  325. IF((OADV(PRSO).NE.WINNER)
  326. & .OR.(PRSO.EQ.PRSI).OR.NOTVAL(PRSO).OR.
  327. & (IAND(OFLAG1(PRSO),VISIBT).EQ.0)) GO TO 2500
  328. F=.FALSE.
  329. CALL RSPSUB(580,ODESC2(PRSO))
  330. F1=PUT(.TRUE.)
  331. IF(SAVEH.NE.HERE) RETURN
  332. 2500 CONTINUE
  333. C
  334. 3000 I=581
  335. IF(SAVEP.EQ.V) I=582
  336. C !CHOOSE MESSAGE.
  337. 4000 IF(F) CALL RSPEAK(I)
  338. C !IF NOTHING, REPORT.
  339. RETURN
  340. END