xref: /csrg-svn/contrib/dungeon/objcts.F (revision 35973)
1*35973SbosticC OAPPLI- OBJECT SPECIAL ACTION ROUTINES
2*35973SbosticC
3*35973SbosticC COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142
4*35973SbosticC ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED
5*35973SbosticC WRITTEN BY R. M. SUPNIK
6*35973SbosticC
7*35973SbosticC DECLARATIONS
8*35973SbosticC
9*35973Sbostic	LOGICAL FUNCTION OAPPLI(RI,ARG)
10*35973Sbostic	IMPLICIT INTEGER (A-Z)
11*35973Sbostic	LOGICAL SOBJS,NOBJS
12*35973Sbostic	LOGICAL QOPEN,QON,LIT
13*35973Sbostic	LOGICAL MOVETO,RMDESC,CLOCKD
14*35973Sbostic	LOGICAL THIEFP,CYCLOP,TROLLP,BALLOP,LIGHTP
15*35973Sbostic	LOGICAL QEMPTY,QHERE,F,OPNCLS
16*35973Sbostic#include "parser.h"
17*35973Sbostic#include "gamestate.h"
18*35973Sbostic#include "state.h"
19*35973SbosticC
20*35973Sbostic	COMMON /BATS/ BATDRP(9)
21*35973SbosticC
22*35973SbosticC PUZZLE ROOM
23*35973SbosticC
24*35973Sbostic	COMMON /PUZZLE/ CPDR(16),CPWL(8),CPVEC(64)
25*35973Sbostic#include "rooms.h"
26*35973Sbostic#include "rflag.h"
27*35973Sbostic#include "rindex.h"
28*35973Sbostic#include "objects.h"
29*35973Sbostic#include "oflags.h"
30*35973Sbostic#include "oindex.h"
31*35973Sbostic#include "clock.h"
32*35973Sbostic
33*35973Sbostic#include "advers.h"
34*35973Sbostic#include "verbs.h"
35*35973Sbostic#include "flags.h"
36*35973SbosticC
37*35973SbosticC FUNCTIONS AND DATA
38*35973SbosticC
39*35973Sbostic	QOPEN(R)=and(OFLAG2(R),OPENBT).NE.0
40*35973Sbostic	QON(R)=and(OFLAG1(R),ONBT).NE.0
41*35973Sbostic	DATA MXSMP/99/
42*35973SbosticC OAPPLI, PAGE 2
43*35973SbosticC
44*35973Sbostic	IF(RI.EQ.0) GO TO 10
45*35973SbosticC						!ZERO IS FALSE APP.
46*35973Sbostic	IF(RI.LE.MXSMP) GO TO 100
47*35973SbosticC						!SIMPLE OBJECT?
48*35973Sbostic	IF(PRSO.GT.220) GO TO 5
49*35973Sbostic	IF(PRSO.NE.0) ODO2=ODESC2(PRSO)
50*35973Sbostic5	IF(PRSI.NE.0) ODI2=ODESC2(PRSI)
51*35973Sbostic	AV=AVEHIC(WINNER)
52*35973Sbostic	FLOBTS=FLAMBT+LITEBT+ONBT
53*35973Sbostic	OAPPLI=.TRUE.
54*35973SbosticC
55*35973Sbostic	GO TO (2000,5000,10000,11000,12000,15000,18000,
56*35973Sbostic&	 19000,20000,22000,25000,26000,32000,35000,39000,40000,
57*35973Sbostic&	 45000,47000,48000,49000,50000,51000,52000,54000,55000,
58*35973Sbostic&	 56000,57000,58000,59000,60000,61000,62000),
59*35973Sbostic&		(RI-MXSMP)
60*35973Sbostic	CALL BUG(6,RI)
61*35973SbosticC
62*35973SbosticC RETURN HERE TO DECLARE FALSE RESULT
63*35973SbosticC
64*35973Sbostic10	OAPPLI=.FALSE.
65*35973Sbostic	RETURN
66*35973SbosticC
67*35973SbosticC SIMPLE OBJECTS, PROCESSED EXTERNALLY.
68*35973SbosticC
69*35973Sbostic100	IF(RI.LT.32) OAPPLI=SOBJS(RI,ARG)
70*35973Sbostic	IF(RI.GE.32) OAPPLI=NOBJS(RI,ARG)
71*35973Sbostic	RETURN
72*35973SbosticC OAPPLI, PAGE 3
73*35973SbosticC
74*35973SbosticC O100--	MACHINE FUNCTION
75*35973SbosticC
76*35973Sbostic2000	IF(HERE.NE.MMACH) GO TO 10
77*35973SbosticC						!NOT HERE? F
78*35973Sbostic	OAPPLI=OPNCLS(MACHI,123,124)
79*35973SbosticC						!HANDLE OPN/CLS.
80*35973Sbostic	RETURN
81*35973SbosticC
82*35973SbosticC O101--	WATER FUNCTION
83*35973SbosticC
84*35973Sbostic5000	IF(PRSA.NE.FILLW) GO TO 5050
85*35973SbosticC						!FILL X WITH Y IS
86*35973Sbostic	PRSA=PUTW
87*35973SbosticC						!MADE INTO
88*35973Sbostic	I=PRSI
89*35973Sbostic	PRSI=PRSO
90*35973Sbostic	PRSO=I
91*35973SbosticC						!PUT Y IN X.
92*35973Sbostic	I=ODI2
93*35973Sbostic	ODI2=ODO2
94*35973Sbostic	ODO2=I
95*35973Sbostic5050	IF((PRSO.EQ.WATER).OR.(PRSO.EQ.GWATE)) GO TO 5100
96*35973Sbostic	CALL RSPEAK(561)
97*35973SbosticC						!WATER IS IND OBJ,
98*35973Sbostic	RETURN
99*35973SbosticC						!PUNT.
100*35973SbosticC
101*35973Sbostic5100	IF(PRSA.NE.TAKEW) GO TO 5400
102*35973SbosticC						!TAKE WATER?
103*35973Sbostic	IF((OADV(BOTTL).EQ.WINNER).AND.(OCAN(PRSO).NE.BOTTL))
104*35973Sbostic&		GO TO 5500
105*35973Sbostic	IF(OCAN(PRSO).EQ.0) GO TO 5200
106*35973SbosticC						!INSIDE ANYTHING?
107*35973Sbostic	IF(QOPEN(OCAN(PRSO))) GO TO 5200
108*35973SbosticC						!YES, OPEN?
109*35973Sbostic	CALL RSPEAK(525,ODESC2(OCAN(PRSO)))
110*35973SbosticC						!INSIDE, CLOSED, PUNT.
111*35973Sbostic	RETURN
112*35973SbosticC
113*35973Sbostic5200	CALL RSPEAK(615)
114*35973SbosticC						!NOT INSIDE OR OPEN,
115*35973Sbostic	RETURN
116*35973SbosticC						!SLIPS THRU FINGERS.
117*35973SbosticC
118*35973Sbostic5400	IF(PRSA.NE.PUTW) GO TO 5700
119*35973SbosticC						!PUT WATER IN X?
120*35973Sbostic	IF((AV.NE.0).AND.(PRSI.EQ.AV)) GO TO 5800
121*35973SbosticC						!IN VEH?
122*35973Sbostic	IF(PRSI.EQ.BOTTL) GO TO 5500
123*35973SbosticC						!IN BOTTLE?
124*35973Sbostic	CALL RSPSUB(297,ODI2)
125*35973SbosticC						!WONT GO ELSEWHERE.
126*35973Sbostic	CALL NEWSTA(PRSO,0,0,0,0)
127*35973SbosticC						!VANISH WATER.
128*35973Sbostic	RETURN
129*35973SbosticC
130*35973Sbostic5500	IF(QOPEN(BOTTL)) GO TO 5550
131*35973SbosticC						!BOTTLE OPEN?
132*35973Sbostic	CALL RSPEAK(612)
133*35973SbosticC						!NO, LOSE.
134*35973Sbostic	RETURN
135*35973SbosticC
136*35973Sbostic5550	IF(QEMPTY(BOTTL)) GO TO 5600
137*35973SbosticC						!OPEN, EMPTY?
138*35973Sbostic	CALL RSPEAK(613)
139*35973SbosticC						!NO, ALREADY FULL.
140*35973Sbostic	RETURN
141*35973SbosticC
142*35973Sbostic5600	CALL NEWSTA(WATER,614,0,BOTTL,0)
143*35973SbosticC						!TAKE WATER TO BOTTLE.
144*35973Sbostic	RETURN
145*35973SbosticC
146*35973Sbostic5700	IF((PRSA.NE.DROPW).AND.(PRSA.NE.POURW).AND.
147*35973Sbostic&		(PRSA.NE.GIVEW)) GO TO 5900
148*35973Sbostic	IF(AV.NE.0) GO TO 5800
149*35973SbosticC						!INTO VEHICLE?
150*35973Sbostic	CALL NEWSTA(PRSO,133,0,0,0)
151*35973SbosticC						!NO, VANISHES.
152*35973Sbostic	RETURN
153*35973SbosticC
154*35973Sbostic5800	CALL NEWSTA(WATER,0,0,AV,0)
155*35973SbosticC						!WATER INTO VEHICLE.
156*35973Sbostic	CALL RSPSUB(296,ODESC2(AV))
157*35973SbosticC						!DESCRIBE.
158*35973Sbostic	RETURN
159*35973SbosticC
160*35973Sbostic5900	IF(PRSA.NE.THROWW) GO TO 10
161*35973SbosticC						!LAST CHANCE, THROW?
162*35973Sbostic	CALL NEWSTA(PRSO,132,0,0,0)
163*35973SbosticC						!VANISHES.
164*35973Sbostic	RETURN
165*35973SbosticC OAPPLI, PAGE 4
166*35973SbosticC
167*35973SbosticC O102--	LEAF PILE
168*35973SbosticC
169*35973Sbostic10000	IF(PRSA.NE.BURNW) GO TO 10500
170*35973SbosticC						!BURN?
171*35973Sbostic	IF(OROOM(PRSO).EQ.0) GO TO 10100
172*35973SbosticC						!WAS HE CARRYING?
173*35973Sbostic	CALL NEWSTA(PRSO,158,0,0,0)
174*35973SbosticC						!NO, BURN IT.
175*35973Sbostic	RETURN
176*35973SbosticC
177*35973Sbostic10100	CALL NEWSTA(PRSO,0,HERE,0,0)
178*35973SbosticC						!DROP LEAVES.
179*35973Sbostic	CALL JIGSUP(159)
180*35973SbosticC						!BURN HIM.
181*35973Sbostic	RETURN
182*35973SbosticC
183*35973Sbostic10500	IF(PRSA.NE.MOVEW) GO TO 10600
184*35973SbosticC						!MOVE?
185*35973Sbostic	CALL RSPEAK(2)
186*35973SbosticC						!DONE.
187*35973Sbostic	RETURN
188*35973SbosticC
189*35973Sbostic10600	IF((PRSA.NE.LOOKUW).OR.(RVCLR.NE.0)) GO TO 10
190*35973Sbostic	CALL RSPEAK(344)
191*35973SbosticC						!LOOK UNDER?
192*35973Sbostic	RETURN
193*35973SbosticC
194*35973SbosticC O103--	TROLL, DONE EXTERNALLY.
195*35973SbosticC
196*35973Sbostic11000	OAPPLI=TROLLP(ARG)
197*35973SbosticC						!TROLL PROCESSOR.
198*35973Sbostic	RETURN
199*35973SbosticC
200*35973SbosticC O104--	RUSTY KNIFE.
201*35973SbosticC
202*35973Sbostic12000	IF(PRSA.NE.TAKEW) GO TO 12100
203*35973SbosticC						!TAKE?
204*35973Sbostic	IF(OADV(SWORD).EQ.WINNER) CALL RSPEAK(160)
205*35973SbosticC						!PULSE SWORD.
206*35973Sbostic	GO TO 10
207*35973SbosticC
208*35973Sbostic12100	IF((((PRSA.NE.ATTACW).AND.(PRSA.NE.KILLW)).OR.
209*35973Sbostic&		(PRSI.NE.RKNIF)).AND.
210*35973Sbostic&	  (((PRSA.NE.SWINGW).AND.(PRSA.NE.THROWW)).OR.
211*35973Sbostic&		(PRSO.NE.RKNIF))) GO TO 10
212*35973Sbostic	CALL NEWSTA(RKNIF,0,0,0,0)
213*35973SbosticC						!KILL KNIFE.
214*35973Sbostic	CALL JIGSUP(161)
215*35973SbosticC						!KILL HIM.
216*35973Sbostic	RETURN
217*35973SbosticC OAPPLI, PAGE 5
218*35973SbosticC
219*35973SbosticC O105--	GLACIER
220*35973SbosticC
221*35973Sbostic15000	IF(PRSA.NE.THROWW) GO TO 15500
222*35973SbosticC						!THROW?
223*35973Sbostic	IF(PRSO.NE.TORCH) GO TO 15400
224*35973SbosticC						!TORCH?
225*35973Sbostic	CALL NEWSTA(ICE,169,0,0,0)
226*35973SbosticC						!MELT ICE.
227*35973Sbostic	ODESC1(TORCH)=174
228*35973SbosticC						!MUNG TORCH.
229*35973Sbostic	ODESC2(TORCH)=173
230*35973Sbostic	OFLAG1(TORCH)=and(OFLAG1(TORCH), not(FLOBTS))
231*35973Sbostic	CALL NEWSTA(TORCH,0,STREA,0,0)
232*35973SbosticC						!MOVE TORCH.
233*35973Sbostic	GLACRF=.TRUE.
234*35973SbosticC						!GLACIER GONE.
235*35973Sbostic	IF(.NOT.LIT(HERE)) CALL RSPEAK(170)
236*35973SbosticC						!IN DARK?
237*35973Sbostic	RETURN
238*35973SbosticC
239*35973Sbostic15400	CALL RSPEAK(171)
240*35973SbosticC						!JOKE IF NOT TORCH.
241*35973Sbostic	RETURN
242*35973SbosticC
243*35973Sbostic15500	IF((PRSA.NE.MELTW).OR.(PRSO.NE.ICE)) GO TO 10
244*35973Sbostic	IF(and(OFLAG1(PRSI),FLOBTS).EQ.FLOBTS) GO TO 15600
245*35973Sbostic	CALL RSPSUB(298,ODI2)
246*35973SbosticC						!CANT MELT WITH THAT.
247*35973Sbostic	RETURN
248*35973SbosticC
249*35973Sbostic15600	GLACMF=.TRUE.
250*35973SbosticC						!PARTIAL MELT.
251*35973Sbostic	IF(PRSI.NE.TORCH) GO TO 15700
252*35973SbosticC						!MELT WITH TORCH?
253*35973Sbostic	ODESC1(TORCH)=174
254*35973SbosticC						!MUNG TORCH.
255*35973Sbostic	ODESC2(TORCH)=173
256*35973Sbostic	OFLAG1(TORCH)=and(OFLAG1(TORCH), not(FLOBTS))
257*35973Sbostic15700	CALL JIGSUP(172)
258*35973SbosticC						!DROWN.
259*35973Sbostic	RETURN
260*35973SbosticC
261*35973SbosticC O106--	BLACK BOOK
262*35973SbosticC
263*35973Sbostic18000	IF(PRSA.NE.OPENW) GO TO 18100
264*35973SbosticC						!OPEN?
265*35973Sbostic	CALL RSPEAK(180)
266*35973SbosticC						!JOKE.
267*35973Sbostic	RETURN
268*35973SbosticC
269*35973Sbostic18100	IF(PRSA.NE.CLOSEW) GO TO 18200
270*35973SbosticC						!CLOSE?
271*35973Sbostic	CALL RSPEAK(181)
272*35973Sbostic	RETURN
273*35973SbosticC
274*35973Sbostic18200	IF(PRSA.NE.BURNW) GO TO 10
275*35973SbosticC						!BURN?
276*35973Sbostic	CALL NEWSTA(PRSO,0,0,0,0)
277*35973SbosticC						!FATAL JOKE.
278*35973Sbostic	CALL JIGSUP(182)
279*35973Sbostic	RETURN
280*35973SbosticC OAPPLI, PAGE 6
281*35973SbosticC
282*35973SbosticC O107--	CANDLES, PROCESSED EXTERNALLY
283*35973SbosticC
284*35973Sbostic19000	OAPPLI=LIGHTP(CANDL)
285*35973Sbostic	RETURN
286*35973SbosticC
287*35973SbosticC O108--	MATCHES, PROCESSED EXTERNALLY
288*35973SbosticC
289*35973Sbostic20000	OAPPLI=LIGHTP(MATCH)
290*35973Sbostic	RETURN
291*35973SbosticC
292*35973SbosticC O109--	CYCLOPS, PROCESSED EXTERNALLY.
293*35973SbosticC
294*35973Sbostic22000	OAPPLI=CYCLOP(ARG)
295*35973SbosticC						!CYCLOPS
296*35973Sbostic	RETURN
297*35973SbosticC
298*35973SbosticC O110--	THIEF, PROCESSED EXTERNALLY
299*35973SbosticC
300*35973Sbostic25000	OAPPLI=THIEFP(ARG)
301*35973Sbostic	RETURN
302*35973SbosticC
303*35973SbosticC O111--	WINDOW
304*35973SbosticC
305*35973Sbostic26000	OAPPLI=OPNCLS(WINDO,208,209)
306*35973SbosticC						!OPEN/CLS WINDOW.
307*35973Sbostic	RETURN
308*35973SbosticC
309*35973SbosticC O112--	PILE OF BODIES
310*35973SbosticC
311*35973Sbostic32000	IF(PRSA.NE.TAKEW) GO TO 32500
312*35973SbosticC						!TAKE?
313*35973Sbostic	CALL RSPEAK(228)
314*35973SbosticC						!CANT.
315*35973Sbostic	RETURN
316*35973SbosticC
317*35973Sbostic32500	IF((PRSA.NE.BURNW).AND.(PRSA.NE.MUNGW)) GO TO 10
318*35973Sbostic	IF(ONPOLF) RETURN
319*35973SbosticC						!BURN OR MUNG?
320*35973Sbostic	ONPOLF=.TRUE.
321*35973SbosticC						!SET HEAD ON POLE.
322*35973Sbostic	CALL NEWSTA(HPOLE,0,LLD2,0,0)
323*35973Sbostic	CALL JIGSUP(229)
324*35973SbosticC						!BEHEADED.
325*35973Sbostic	RETURN
326*35973SbosticC
327*35973SbosticC O113--	VAMPIRE BAT
328*35973SbosticC
329*35973Sbostic35000	CALL RSPEAK(50)
330*35973SbosticC						!TIME TO FLY, JACK.
331*35973Sbostic	F=MOVETO(BATDRP(RND(9)+1),WINNER)
332*35973SbosticC						!SELECT RANDOM DEST.
333*35973Sbostic	F=RMDESC(0)
334*35973Sbostic	RETURN
335*35973SbosticC OAPPLI, PAGE 7
336*35973SbosticC
337*35973SbosticC O114--	STICK
338*35973SbosticC
339*35973Sbostic39000	IF(PRSA.NE.WAVEW) GO TO 10
340*35973SbosticC						!WAVE?
341*35973Sbostic	IF(HERE.EQ.MRAIN) GO TO 39500
342*35973SbosticC						!ON RAINBOW?
343*35973Sbostic	IF((HERE.EQ.POG).OR.(HERE.EQ.FALLS)) GO TO 39200
344*35973Sbostic	CALL RSPEAK(244)
345*35973SbosticC						!NOTHING HAPPENS.
346*35973Sbostic	RETURN
347*35973SbosticC
348*35973Sbostic39200	OFLAG1(POT)=or(OFLAG1(POT),VISIBT)
349*35973Sbostic	RAINBF=.NOT. RAINBF
350*35973SbosticC						!COMPLEMENT RAINBOW.
351*35973Sbostic	I=245
352*35973SbosticC						!ASSUME OFF.
353*35973Sbostic	IF(RAINBF) I=246
354*35973SbosticC						!IF ON, SOLID.
355*35973Sbostic	CALL RSPEAK(I)
356*35973SbosticC						!DESCRIBE.
357*35973Sbostic	RETURN
358*35973SbosticC
359*35973Sbostic39500	RAINBF=.FALSE.
360*35973SbosticC						!ON RAINBOW,
361*35973Sbostic	CALL JIGSUP(247)
362*35973SbosticC						!TAKE A FALL.
363*35973Sbostic	RETURN
364*35973SbosticC
365*35973SbosticC O115--	BALLOON, HANDLED EXTERNALLY
366*35973SbosticC
367*35973Sbostic40000	OAPPLI=BALLOP(ARG)
368*35973Sbostic	RETURN
369*35973SbosticC
370*35973SbosticC O116--	HEADS
371*35973SbosticC
372*35973Sbostic45000	IF(PRSA.NE.HELLOW) GO TO 45100
373*35973SbosticC						!HELLO HEADS?
374*35973Sbostic	CALL RSPEAK(633)
375*35973SbosticC						!TRULY BIZARRE.
376*35973Sbostic	RETURN
377*35973SbosticC
378*35973Sbostic45100	IF(PRSA.EQ.READW) GO TO 10
379*35973SbosticC						!READ IS OK.
380*35973Sbostic	CALL NEWSTA(LCASE,260,LROOM,0,0)
381*35973SbosticC						!MAKE LARGE CASE.
382*35973Sbostic	I=ROBADV(WINNER,0,LCASE,0)+ROBRM(HERE,100,0,LCASE,0)
383*35973Sbostic	CALL JIGSUP(261)
384*35973SbosticC						!KILL HIM.
385*35973Sbostic	RETURN
386*35973SbosticC OAPPLI, PAGE 8
387*35973SbosticC
388*35973SbosticC O117--	SPHERE
389*35973SbosticC
390*35973Sbostic47000	IF(CAGESF.OR.(PRSA.NE.TAKEW)) GO TO 10
391*35973SbosticC						!TAKE?
392*35973Sbostic	IF(WINNER.NE.PLAYER) GO TO 47500
393*35973SbosticC						!ROBOT TAKE?
394*35973Sbostic	CALL RSPEAK(263)
395*35973SbosticC						!NO, DROP CAGE.
396*35973Sbostic	IF(OROOM(ROBOT).NE.HERE) GO TO 47200
397*35973SbosticC						!ROBOT HERE?
398*35973Sbostic	F=MOVETO(CAGED,WINNER)
399*35973SbosticC						!YES, MOVE INTO CAGE.
400*35973Sbostic	CALL NEWSTA(ROBOT,0,CAGED,0,0)
401*35973SbosticC						!MOVE ROBOT.
402*35973Sbostic	AROOM(AROBOT)=CAGED
403*35973Sbostic	OFLAG1(ROBOT)=or(OFLAG1(ROBOT),NDSCBT)
404*35973Sbostic	CTICK(CEVSPH)=10
405*35973SbosticC						!GET OUT IN 10 OR ELSE.
406*35973Sbostic	RETURN
407*35973SbosticC
408*35973Sbostic47200	CALL NEWSTA(SPHER,0,0,0,0)
409*35973SbosticC						!YOURE DEAD.
410*35973Sbostic	RFLAG(CAGER)=or(RFLAG(CAGER),RMUNG)
411*35973Sbostic	RRAND(CAGER)=147
412*35973Sbostic	CALL JIGSUP(148)
413*35973SbosticC						!MUNG PLAYER.
414*35973Sbostic	RETURN
415*35973SbosticC
416*35973Sbostic47500	CALL NEWSTA(SPHER,0,0,0,0)
417*35973SbosticC						!ROBOT TRIED,
418*35973Sbostic	CALL NEWSTA(ROBOT,264,0,0,0)
419*35973SbosticC						!KILL HIM.
420*35973Sbostic	CALL NEWSTA(CAGE,0,HERE,0,0)
421*35973SbosticC						!INSERT MANGLED CAGE.
422*35973Sbostic	RETURN
423*35973SbosticC
424*35973SbosticC O118--	GEOMETRICAL BUTTONS
425*35973SbosticC
426*35973Sbostic48000	IF(PRSA.NE.PUSHW) GO TO 10
427*35973SbosticC						!PUSH?
428*35973Sbostic	I=PRSO-SQBUT+1
429*35973SbosticC						!GET BUTTON INDEX.
430*35973Sbostic	IF((I.LE.0).OR.(I.GE.4)) GO TO 10
431*35973SbosticC						!A BUTTON?
432*35973Sbostic	IF(WINNER.NE.PLAYER) GO TO (48100,48200,48300),I
433*35973Sbostic	CALL JIGSUP(265)
434*35973SbosticC						!YOU PUSHED, YOU DIE.
435*35973Sbostic	RETURN
436*35973SbosticC
437*35973Sbostic48100	I=267
438*35973Sbostic	IF(CAROZF) I=266
439*35973SbosticC						!SPEED UP?
440*35973Sbostic	CAROZF=.TRUE.
441*35973Sbostic	CALL RSPEAK(I)
442*35973Sbostic	RETURN
443*35973SbosticC
444*35973Sbostic48200	I=266
445*35973SbosticC						!ASSUME NO CHANGE.
446*35973Sbostic	IF(CAROZF) I=268
447*35973Sbostic	CAROZF=.FALSE.
448*35973Sbostic	CALL RSPEAK(I)
449*35973Sbostic	RETURN
450*35973SbosticC
451*35973Sbostic48300	CAROFF=.NOT.CAROFF
452*35973SbosticC						!FLIP CAROUSEL.
453*35973Sbostic	IF(.NOT.QHERE(IRBOX,CAROU)) RETURN
454*35973SbosticC						!IRON BOX IN CAROUSEL?
455*35973Sbostic	CALL RSPEAK(269)
456*35973SbosticC						!YES, THUMP.
457*35973Sbostic	OFLAG1(IRBOX)=xor(OFLAG1(IRBOX),VISIBT)
458*35973Sbostic	IF(CAROFF) RFLAG(CAROU)=and(RFLAG(CAROU), not(RSEEN))
459*35973Sbostic	RETURN
460*35973SbosticC
461*35973SbosticC O119--	FLASK FUNCTION
462*35973SbosticC
463*35973Sbostic49000	IF(PRSA.EQ.OPENW) GO TO 49100
464*35973SbosticC						!OPEN?
465*35973Sbostic	IF((PRSA.NE.MUNGW).AND.(PRSA.NE.THROWW)) GO TO 10
466*35973Sbostic	CALL NEWSTA(FLASK,270,0,0,0)
467*35973SbosticC						!KILL FLASK.
468*35973Sbostic49100	RFLAG(HERE)=or(RFLAG(HERE),RMUNG)
469*35973Sbostic	RRAND(HERE)=271
470*35973Sbostic	CALL JIGSUP(272)
471*35973SbosticC						!POISONED.
472*35973Sbostic	RETURN
473*35973SbosticC
474*35973SbosticC O120--	BUCKET FUNCTION
475*35973SbosticC
476*35973Sbostic50000	IF(ARG.NE.2) GO TO 10
477*35973SbosticC						!READOUT?
478*35973Sbostic	IF((OCAN(WATER).NE.BUCKE).OR.BUCKTF) GO TO 50500
479*35973Sbostic	BUCKTF=.TRUE.
480*35973SbosticC						!BUCKET AT TOP.
481*35973Sbostic	CTICK(CEVBUC)=100
482*35973SbosticC						!START COUNTDOWN.
483*35973Sbostic	CALL NEWSTA(BUCKE,290,TWELL,0,0)
484*35973SbosticC						!REPOSITION BUCKET.
485*35973Sbostic	GO TO 50900
486*35973SbosticC						!FINISH UP.
487*35973SbosticC
488*35973Sbostic50500	IF((OCAN(WATER).EQ.BUCKE).OR..NOT.BUCKTF) GO TO 10
489*35973Sbostic	BUCKTF=.FALSE.
490*35973Sbostic	CALL NEWSTA(BUCKE,291,BWELL,0,0)
491*35973SbosticC						!BUCKET AT BOTTOM.
492*35973Sbostic50900	IF(AV.NE.BUCKE) RETURN
493*35973SbosticC						!IN BUCKET?
494*35973Sbostic	F=MOVETO(OROOM(BUCKE),WINNER)
495*35973SbosticC						!MOVE ADVENTURER.
496*35973Sbostic	F=RMDESC(0)
497*35973SbosticC						!DESCRIBE ROOM.
498*35973Sbostic	RETURN
499*35973SbosticC OAPPLI, PAGE 9
500*35973SbosticC
501*35973SbosticC O121--	EATME CAKE
502*35973SbosticC
503*35973Sbostic51000	IF((PRSA.NE.EATW).OR.(PRSO.NE.ECAKE).OR.
504*35973Sbostic&		(HERE.NE.ALICE)) GO TO 10
505*35973Sbostic	CALL NEWSTA(ECAKE,273,0,0,0)
506*35973SbosticC						!VANISH CAKE.
507*35973Sbostic	OFLAG1(ROBOT)=and(OFLAG1(ROBOT), not(VISIBT))
508*35973Sbostic	OAPPLI=MOVETO(ALISM,WINNER)
509*35973SbosticC						!MOVE TO ALICE SMALL.
510*35973Sbostic	IZ=64
511*35973Sbostic	IR=ALISM
512*35973Sbostic	IO=ALICE
513*35973Sbostic	GO TO 52405
514*35973SbosticC
515*35973SbosticC O122--	ICINGS
516*35973SbosticC
517*35973Sbostic52000	IF(PRSA.NE.READW) GO TO 52200
518*35973SbosticC						!READ?
519*35973Sbostic	I=274
520*35973SbosticC						!CANT READ.
521*35973Sbostic	IF(PRSI.NE.0) I=275
522*35973SbosticC						!THROUGH SOMETHING?
523*35973Sbostic	IF(PRSI.EQ.BOTTL) I=276
524*35973SbosticC						!THROUGH BOTTLE?
525*35973Sbostic	IF(PRSI.EQ.FLASK) I=277+(PRSO-ORICE)
526*35973SbosticC						!THROUGH FLASK?
527*35973Sbostic	CALL RSPEAK(I)
528*35973SbosticC						!READ FLASK.
529*35973Sbostic	RETURN
530*35973SbosticC
531*35973Sbostic52200	IF((PRSA.NE.THROWW).OR.(PRSO.NE.RDICE).OR.(PRSI.NE.POOL))
532*35973Sbostic&		GO TO 52300
533*35973Sbostic	CALL NEWSTA(POOL,280,0,0,0)
534*35973SbosticC						!VANISH POOL.
535*35973Sbostic	OFLAG1(SAFFR)=or(OFLAG1(SAFFR),VISIBT)
536*35973Sbostic	RETURN
537*35973SbosticC
538*35973Sbostic52300	IF((HERE.NE.ALICE).AND.(HERE.NE.ALISM).AND.(HERE.NE.ALITR))
539*35973Sbostic&		GO TO 10
540*35973Sbostic	IF(((PRSA.NE.EATW).AND.(PRSA.NE.THROWW)).OR.
541*35973Sbostic&		(PRSO.NE.ORICE)) GO TO 52400
542*35973Sbostic	CALL NEWSTA(ORICE,0,0,0,0)
543*35973SbosticC						!VANISH ORANGE ICE.
544*35973Sbostic	RFLAG(HERE)=or(RFLAG(HERE),RMUNG)
545*35973Sbostic	RRAND(HERE)=281
546*35973Sbostic	CALL JIGSUP(282)
547*35973SbosticC						!VANISH ADVENTURER.
548*35973Sbostic	RETURN
549*35973SbosticC
550*35973Sbostic52400	IF((PRSA.NE.EATW).OR.(PRSO.NE.BLICE))
551*35973Sbostic&		GO TO 10
552*35973Sbostic	CALL NEWSTA(BLICE,283,0,0,0)
553*35973SbosticC						!VANISH BLUE ICE.
554*35973Sbostic	IF(HERE.NE.ALISM) GO TO 52500
555*35973SbosticC						!IN REDUCED ROOM?
556*35973Sbostic	OFLAG1(ROBOT)=or(OFLAG1(ROBOT),VISIBT)
557*35973Sbostic	IO=HERE
558*35973Sbostic	OAPPLI=MOVETO(ALICE,WINNER)
559*35973Sbostic	IZ=1/64
560*35973Sbostic	IR=ALICE
561*35973SbosticC
562*35973SbosticC  Do a size change, common loop used also by code at 51000
563*35973SbosticC
564*35973Sbostic52405	DO 52450 I=1,OLNT
565*35973SbosticC						!ENLARGE WORLD.
566*35973Sbostic	  IF((OROOM(I).NE.IO).OR.(OSIZE(I).EQ.10000))
567*35973Sbostic&		GO TO 52450
568*35973Sbostic	  OROOM(I)=IR
569*35973Sbostic	  OSIZE(I)=OSIZE(I)*IZ
570*35973Sbostic52450	CONTINUE
571*35973Sbostic	RETURN
572*35973SbosticC
573*35973Sbostic52500	CALL JIGSUP(284)
574*35973SbosticC						!ENLARGED IN WRONG ROOM.
575*35973Sbostic	RETURN
576*35973SbosticC
577*35973SbosticC O123--	BRICK
578*35973SbosticC
579*35973Sbostic54000	IF(PRSA.NE.BURNW) GO TO 10
580*35973SbosticC						!BURN?
581*35973Sbostic	CALL JIGSUP(150)
582*35973SbosticC						!BOOM
583*35973SbosticC						!
584*35973Sbostic	RETURN
585*35973SbosticC
586*35973SbosticC O124--	MYSELF
587*35973SbosticC
588*35973Sbostic55000	IF(PRSA.NE.GIVEW) GO TO 55100
589*35973SbosticC						!GIVE?
590*35973Sbostic	CALL NEWSTA(PRSO,2,0,0,PLAYER)
591*35973SbosticC						!DONE.
592*35973Sbostic	RETURN
593*35973SbosticC
594*35973Sbostic55100	IF(PRSA.NE.TAKEW) GO TO 55200
595*35973SbosticC						!TAKE?
596*35973Sbostic	CALL RSPEAK(286)
597*35973SbosticC						!JOKE.
598*35973Sbostic	RETURN
599*35973SbosticC
600*35973Sbostic55200	IF((PRSA.NE.KILLW).AND.(PRSA.NE.MUNGW)) GO TO 10
601*35973Sbostic	CALL JIGSUP(287)
602*35973SbosticC						!KILL, NO JOKE.
603*35973Sbostic	RETURN
604*35973SbosticC OAPPLI, PAGE 10
605*35973SbosticC
606*35973SbosticC O125--	PANELS INSIDE MIRROR
607*35973SbosticC
608*35973Sbostic56000	IF(PRSA.NE.PUSHW) GO TO 10
609*35973SbosticC						!PUSH?
610*35973Sbostic	IF(POLEUF.NE.0) GO TO 56100
611*35973SbosticC						!SHORT POLE UP?
612*35973Sbostic	I=731
613*35973SbosticC						!NO, WONT BUDGE.
614*35973Sbostic	IF(MOD(MDIR,180).EQ.0) I=732
615*35973SbosticC						!DIFF MSG IF N-S.
616*35973Sbostic	CALL RSPEAK(I)
617*35973SbosticC						!TELL WONT MOVE.
618*35973Sbostic	RETURN
619*35973SbosticC
620*35973Sbostic56100	IF(MLOC.NE.MRG) GO TO 56200
621*35973SbosticC						!IN GDN ROOM?
622*35973Sbostic	CALL RSPEAK(733)
623*35973SbosticC						!YOU LOSE.
624*35973Sbostic	CALL JIGSUP(685)
625*35973Sbostic	RETURN
626*35973SbosticC
627*35973Sbostic56200	I=831
628*35973SbosticC						!ROTATE L OR R.
629*35973Sbostic	IF((PRSO.EQ.RDWAL).OR.(PRSO.EQ.YLWAL)) I=830
630*35973Sbostic	CALL RSPEAK(I)
631*35973SbosticC						!TELL DIRECTION.
632*35973Sbostic	MDIR=MOD(MDIR+45+(270*(I-830)),360)
633*35973SbosticC						!CALCULATE NEW DIR.
634*35973Sbostic	CALL RSPSUB(734,695+(MDIR/45))
635*35973SbosticC						!TELL NEW DIR.
636*35973Sbostic	IF(WDOPNF) CALL RSPEAK(730)
637*35973SbosticC						!IF PANEL OPEN, CLOSE.
638*35973Sbostic	WDOPNF=.FALSE.
639*35973Sbostic	RETURN
640*35973SbosticC						!DONE.
641*35973SbosticC
642*35973SbosticC O126--	ENDS INSIDE MIRROR
643*35973SbosticC
644*35973Sbostic57000	IF(PRSA.NE.PUSHW) GO TO 10
645*35973SbosticC						!PUSH?
646*35973Sbostic	IF(MOD(MDIR,180).EQ.0) GO TO 57100
647*35973SbosticC						!MIRROR N-S?
648*35973Sbostic	CALL RSPEAK(735)
649*35973SbosticC						!NO, WONT BUDGE.
650*35973Sbostic	RETURN
651*35973SbosticC
652*35973Sbostic57100	IF(PRSO.NE.PINDR) GO TO 57300
653*35973SbosticC						!PUSH PINE WALL?
654*35973Sbostic	IF(((MLOC.EQ.MRC).AND.(MDIR.EQ.180)).OR.
655*35973Sbostic&	  ((MLOC.EQ.MRD).AND.(MDIR.EQ.0)).OR.
656*35973Sbostic&	   (MLOC.EQ.MRG)) GO TO 57200
657*35973Sbostic	CALL RSPEAK(736)
658*35973SbosticC						!NO, OPENS.
659*35973Sbostic	WDOPNF=.TRUE.
660*35973SbosticC						!INDICATE OPEN.
661*35973Sbostic	CFLAG(CEVPIN)=.TRUE.
662*35973SbosticC						!TIME OPENING.
663*35973Sbostic	CTICK(CEVPIN)=5
664*35973Sbostic	RETURN
665*35973SbosticC
666*35973Sbostic57200	CALL RSPEAK(737)
667*35973SbosticC						!GDN SEES YOU, DIE.
668*35973Sbostic	CALL JIGSUP(685)
669*35973Sbostic	RETURN
670*35973SbosticC
671*35973Sbostic57300	NLOC=MLOC-1
672*35973SbosticC						!NEW LOC IF SOUTH.
673*35973Sbostic	IF(MDIR.EQ.0) NLOC=MLOC+1
674*35973SbosticC						!NEW LOC IF NORTH.
675*35973Sbostic	IF((NLOC.GE.MRA).AND.(NLOC.LE.MRD)) GO TO 57400
676*35973Sbostic	CALL RSPEAK(738)
677*35973SbosticC						!HAVE REACHED END.
678*35973Sbostic	RETURN
679*35973SbosticC
680*35973Sbostic57400	I=699
681*35973SbosticC						!ASSUME SOUTH.
682*35973Sbostic	IF(MDIR.EQ.0) I=695
683*35973SbosticC						!NORTH.
684*35973Sbostic	J=739
685*35973SbosticC						!ASSUME SMOOTH.
686*35973Sbostic	IF(POLEUF.NE.0) J=740
687*35973SbosticC						!POLE UP, WOBBLES.
688*35973Sbostic	CALL RSPSUB(J,I)
689*35973SbosticC						!DESCRIBE.
690*35973Sbostic	MLOC=NLOC
691*35973Sbostic	IF(MLOC.NE.MRG) RETURN
692*35973SbosticC						!NOW IN GDN ROOM?
693*35973SbosticC
694*35973Sbostic	IF(POLEUF.NE.0) GO TO 57500
695*35973SbosticC						!POLE UP, GDN SEES.
696*35973Sbostic	IF(MROPNF.OR.WDOPNF) GO TO 57600
697*35973SbosticC						!DOOR OPEN, GDN SEES.
698*35973Sbostic	IF(MR1F.AND.MR2F) RETURN
699*35973SbosticC						!MIRRORS INTACT, OK.
700*35973Sbostic	CALL RSPEAK(742)
701*35973SbosticC						!MIRRORS BROKEN, DIE.
702*35973Sbostic	CALL JIGSUP(743)
703*35973Sbostic	RETURN
704*35973SbosticC
705*35973Sbostic57500	CALL RSPEAK(741)
706*35973SbosticC						!POLE UP, DIE.
707*35973Sbostic	CALL JIGSUP(743)
708*35973Sbostic	RETURN
709*35973SbosticC
710*35973Sbostic57600	CALL RSPEAK(744)
711*35973SbosticC						!DOOR OPEN, DIE.
712*35973Sbostic	CALL JIGSUP(743)
713*35973Sbostic	RETURN
714*35973SbosticC OAPPLI, PAGE 11
715*35973SbosticC
716*35973SbosticC O127--	GLOBAL GUARDIANS
717*35973SbosticC
718*35973Sbostic58000	IF((PRSA.NE.ATTACW).AND.(PRSA.NE.KILLW).AND.
719*35973Sbostic&	  (PRSA.NE.MUNGW)) GO TO 58100
720*35973Sbostic	CALL JIGSUP(745)
721*35973SbosticC						!LOSE.
722*35973Sbostic	RETURN
723*35973SbosticC
724*35973Sbostic58100	IF(PRSA.NE.HELLOW) GO TO 10
725*35973SbosticC						!HELLO?
726*35973Sbostic	CALL RSPEAK(746)
727*35973SbosticC						!NO REPLY.
728*35973Sbostic	RETURN
729*35973SbosticC
730*35973SbosticC O128--	GLOBAL MASTER
731*35973SbosticC
732*35973Sbostic59000	IF((PRSA.NE.ATTACW).AND.(PRSA.NE.KILLW).AND.
733*35973Sbostic&	  (PRSA.NE.MUNGW)) GO TO 59100
734*35973Sbostic	CALL JIGSUP(747)
735*35973SbosticC						!BAD IDEA.
736*35973Sbostic	RETURN
737*35973SbosticC
738*35973Sbostic59100	IF(PRSA.NE.TAKEW) GO TO 10
739*35973SbosticC						!TAKE?
740*35973Sbostic	CALL RSPEAK(748)
741*35973SbosticC						!JOKE.
742*35973Sbostic	RETURN
743*35973SbosticC
744*35973SbosticC O129--	NUMERAL FIVE (FOR JOKE)
745*35973SbosticC
746*35973Sbostic60000	IF(PRSA.NE.TAKEW) GO TO 10
747*35973SbosticC						!TAKE FIVE?
748*35973Sbostic	CALL RSPEAK(419)
749*35973SbosticC						!TIME PASSES.
750*35973Sbostic	DO 60100 I=1,3
751*35973SbosticC						!WAIT A WHILE.
752*35973Sbostic	  IF(CLOCKD(X)) RETURN
753*35973Sbostic60100	CONTINUE
754*35973Sbostic	RETURN
755*35973SbosticC
756*35973SbosticC O130--	CRYPT FUNCTION
757*35973SbosticC
758*35973Sbostic61000	IF(.NOT.ENDGMF) GO TO 45000
759*35973SbosticC						!IF NOT EG, DIE.
760*35973Sbostic	IF(PRSA.NE.OPENW) GO TO 61100
761*35973SbosticC						!OPEN?
762*35973Sbostic	I=793
763*35973Sbostic	IF(QOPEN(TOMB)) I=794
764*35973Sbostic	CALL RSPEAK(I)
765*35973Sbostic	OFLAG2(TOMB)=or(OFLAG2(TOMB),OPENBT)
766*35973Sbostic	RETURN
767*35973SbosticC
768*35973Sbostic61100	IF(PRSA.NE.CLOSEW) GO TO 45000
769*35973SbosticC						!CLOSE?
770*35973Sbostic	I=795
771*35973Sbostic	IF(QOPEN(TOMB)) I=796
772*35973Sbostic	CALL RSPEAK(I)
773*35973Sbostic	OFLAG2(TOMB)=and(OFLAG2(TOMB),not(OPENBT))
774*35973Sbostic	IF(HERE.EQ.CRYPT) CTICK(CEVSTE)=3
775*35973SbosticC						!IF IN CRYPT, START EG.
776*35973Sbostic	RETURN
777*35973SbosticC OAPPLI, PAGE 12
778*35973SbosticC
779*35973SbosticC O131--	GLOBAL LADDER
780*35973SbosticC
781*35973Sbostic62000	IF((CPVEC(CPHERE+1).EQ.-2).OR.(CPVEC(CPHERE-1).EQ.-3))
782*35973Sbostic&		GO TO 62100
783*35973Sbostic	CALL RSPEAK(865)
784*35973SbosticC						!NO, LOSE.
785*35973Sbostic	RETURN
786*35973SbosticC
787*35973Sbostic62100	IF((PRSA.EQ.CLMBW).OR.(PRSA.EQ.CLMBUW)) GO TO 62200
788*35973Sbostic	CALL RSPEAK(866)
789*35973SbosticC						!CLIMB IT?
790*35973Sbostic	RETURN
791*35973SbosticC
792*35973Sbostic62200	IF((CPHERE.EQ.10).AND.(CPVEC(CPHERE+1).EQ.-2))
793*35973Sbostic&		GO TO 62300
794*35973Sbostic	CALL RSPEAK(867)
795*35973SbosticC						!NO, HIT YOUR HEAD.
796*35973Sbostic	RETURN
797*35973SbosticC
798*35973Sbostic62300	F=MOVETO(CPANT,WINNER)
799*35973SbosticC						!TO ANTEROOM.
800*35973Sbostic	F=RMDESC(3)
801*35973SbosticC						!DESCRIBE.
802*35973Sbostic	RETURN
803*35973SbosticC
804*35973Sbostic	END
805