xref: /csrg-svn/contrib/dungeon/lightp.F (revision 35973)
1*35973SbosticC LIGHTP-	LIGHT PROCESSOR
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 LIGHTP(OBJ)
10*35973Sbostic	IMPLICIT INTEGER (A-Z)
11*35973Sbostic	LOGICAL QON
12*35973Sbostic#include "parser.h"
13*35973Sbostic#include "gamestate.h"
14*35973Sbostic#include "objects.h"
15*35973Sbostic#include "oflags.h"
16*35973Sbostic#include "oindex.h"
17*35973Sbostic#include "clock.h"
18*35973Sbostic
19*35973Sbostic#include "verbs.h"
20*35973Sbostic#include "flags.h"
21*35973SbosticC
22*35973SbosticC FUNCTIONS AND DATA
23*35973SbosticC
24*35973Sbostic	QON(R)=and(OFLAG1(R),ONBT).NE.0
25*35973SbosticC LIGHTP, PAGE 2
26*35973SbosticC
27*35973Sbostic	LIGHTP=.TRUE.
28*35973SbosticC						!ASSUME WINS
29*35973Sbostic	FLOBTS=FLAMBT+LITEBT+ONBT
30*35973Sbostic	IF(OBJ.NE.CANDL) GO TO 20000
31*35973SbosticC						!CANDLE?
32*35973Sbostic	IF(ORCAND.NE.0) GO TO 19100
33*35973SbosticC						!FIRST REF?
34*35973Sbostic	ORCAND=1
35*35973SbosticC						!YES, CANDLES ARE
36*35973Sbostic	CTICK(CEVCND)=50
37*35973SbosticC						!BURNING WHEN SEEN.
38*35973SbosticC
39*35973Sbostic19100	IF(PRSI.EQ.CANDL) GO TO 10
40*35973SbosticC						!IGNORE IND REFS.
41*35973Sbostic	IF(PRSA.NE.TRNOFW) GO TO 19200
42*35973SbosticC						!TURN OFF?
43*35973Sbostic	I=513
44*35973SbosticC						!ASSUME OFF.
45*35973Sbostic	IF(QON(CANDL)) I=514
46*35973SbosticC						!IF ON, DIFFERENT.
47*35973Sbostic	CFLAG(CEVCND)=.FALSE.
48*35973SbosticC						!DISABLE COUNTDOWN.
49*35973Sbostic	OFLAG1(CANDL)=and(OFLAG1(CANDL), not(ONBT))
50*35973Sbostic	CALL RSPEAK(I)
51*35973Sbostic	RETURN
52*35973SbosticC
53*35973Sbostic19200	IF((PRSA.NE.BURNW).AND.(PRSA.NE.TRNONW)) GO TO 10
54*35973Sbostic	IF(and(OFLAG1(CANDL),LITEBT).NE.0) GO TO 19300
55*35973Sbostic	CALL RSPEAK(515)
56*35973SbosticC						!CANDLES TOO SHORT.
57*35973Sbostic	RETURN
58*35973SbosticC
59*35973Sbostic19300	IF(PRSI.NE.0) GO TO 19400
60*35973SbosticC						!ANY FLAME?
61*35973Sbostic	CALL RSPEAK(516)
62*35973SbosticC						!NO, LOSE.
63*35973Sbostic	PRSWON=.FALSE.
64*35973Sbostic	RETURN
65*35973SbosticC
66*35973Sbostic19400	IF((PRSI.NE.MATCH).OR. .NOT.QON(MATCH)) GO TO 19500
67*35973Sbostic	I=517
68*35973SbosticC						!ASSUME OFF.
69*35973Sbostic	IF(QON(CANDL)) I=518
70*35973SbosticC						!IF ON, JOKE.
71*35973Sbostic	OFLAG1(CANDL)=or(OFLAG1(CANDL),ONBT)
72*35973Sbostic	CFLAG(CEVCND)=.TRUE.
73*35973SbosticC						!RESUME COUNTDOWN.
74*35973Sbostic	CALL RSPEAK(I)
75*35973Sbostic	RETURN
76*35973SbosticC
77*35973Sbostic19500	IF((PRSI.NE.TORCH).OR. .NOT.QON(TORCH)) GO TO 19600
78*35973Sbostic	IF(QON(CANDL)) GO TO 19700
79*35973SbosticC						!ALREADY ON?
80*35973Sbostic	CALL NEWSTA(CANDL,521,0,0,0)
81*35973SbosticC						!NO, VAPORIZE.
82*35973Sbostic	RETURN
83*35973SbosticC
84*35973Sbostic19600	CALL RSPEAK(519)
85*35973SbosticC						!CANT LIGHT WITH THAT.
86*35973Sbostic	RETURN
87*35973SbosticC
88*35973Sbostic19700	CALL RSPEAK(520)
89*35973SbosticC						!ALREADY ON.
90*35973Sbostic	RETURN
91*35973SbosticC
92*35973Sbostic20000	IF(OBJ.NE.MATCH) CALL BUG(6,OBJ)
93*35973Sbostic	IF((PRSA.NE.TRNONW).OR.(PRSO.NE.MATCH)) GO TO 20500
94*35973Sbostic	IF(ORMTCH.NE.0) GO TO 20100
95*35973SbosticC						!ANY MATCHES LEFT?
96*35973Sbostic	CALL RSPEAK(183)
97*35973SbosticC						!NO, LOSE.
98*35973Sbostic	RETURN
99*35973SbosticC
100*35973Sbostic20100	ORMTCH=ORMTCH-1
101*35973SbosticC						!DECREMENT NO MATCHES.
102*35973Sbostic	OFLAG1(MATCH)=or(OFLAG1(MATCH),FLOBTS)
103*35973Sbostic	CTICK(CEVMAT)=2
104*35973SbosticC						!COUNTDOWN.
105*35973Sbostic	CALL RSPEAK(184)
106*35973Sbostic	RETURN
107*35973SbosticC
108*35973Sbostic20500	IF((PRSA.NE.TRNOFW).OR.(and(OFLAG1(MATCH),ONBT).EQ.0))
109*35973Sbostic&		GO TO 10
110*35973Sbostic	OFLAG1(MATCH)=and(OFLAG1(MATCH), not(FLOBTS))
111*35973Sbostic	CTICK(CEVMAT)=0
112*35973Sbostic	CALL RSPEAK(185)
113*35973Sbostic	RETURN
114*35973SbosticC
115*35973SbosticC HERE FOR FALSE RETURN
116*35973SbosticC
117*35973Sbostic10	LIGHTP=.FALSE.
118*35973Sbostic	RETURN
119*35973Sbostic	END
120