-
Notifications
You must be signed in to change notification settings - Fork 128
/
lightp.c
159 lines (140 loc) · 3.43 KB
/
lightp.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/* LIGHTP- LIGHT PROCESSOR */
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/
/* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */
/* WRITTEN BY R. M. SUPNIK */
#include "funcs.h"
#include "vars.h"
logical lightp_(obj)
integer obj;
{
/* System generated locals */
logical ret_val;
/* Local variables */
integer flobts;
integer i;
ret_val = TRUE_;
/* !ASSUME WINS */
flobts = FLAMBT + LITEBT + ONBT;
if (obj != oindex_1.candl) {
goto L20000;
}
/* !CANDLE? */
if (findex_1.orcand != 0) {
goto L19100;
}
/* !FIRST REF? */
findex_1.orcand = 1;
/* !YES, CANDLES ARE */
cevent_1.ctick[cindex_1.cevcnd - 1] = 50;
/* !BURNING WHEN SEEN. */
L19100:
if (prsvec_1.prsi == oindex_1.candl) {
goto L10;
}
/* !IGNORE IND REFS. */
if (prsvec_1.prsa != vindex_1.trnofw) {
goto L19200;
}
/* !TURN OFF? */
i = 513;
/* !ASSUME OFF. */
if ((objcts_1.oflag1[oindex_1.candl - 1] & ONBT) != 0) {
i = 514;
}
/* !IF ON, DIFFERENT. */
cevent_1.cflag[cindex_1.cevcnd - 1] = FALSE_;
/* !DISABLE COUNTDOWN. */
objcts_1.oflag1[oindex_1.candl - 1] &= ~ ONBT;
rspeak_(i);
return ret_val;
L19200:
if (prsvec_1.prsa != vindex_1.burnw && prsvec_1.prsa != vindex_1.trnonw) {
goto L10;
}
if ((objcts_1.oflag1[oindex_1.candl - 1] & LITEBT) != 0) {
goto L19300;
}
rspeak_(515);
/* !CANDLES TOO SHORT. */
return ret_val;
L19300:
if (prsvec_1.prsi != 0) {
goto L19400;
}
/* !ANY FLAME? */
rspeak_(516);
/* !NO, LOSE. */
prsvec_1.prswon = FALSE_;
return ret_val;
L19400:
if (prsvec_1.prsi != oindex_1.match || ! ((objcts_1.oflag1[oindex_1.match
- 1] & ONBT) != 0)) {
goto L19500;
}
i = 517;
/* !ASSUME OFF. */
if ((objcts_1.oflag1[oindex_1.candl - 1] & ONBT) != 0) {
i = 518;
}
/* !IF ON, JOKE. */
objcts_1.oflag1[oindex_1.candl - 1] |= ONBT;
cevent_1.cflag[cindex_1.cevcnd - 1] = TRUE_;
/* !RESUME COUNTDOWN. */
rspeak_(i);
return ret_val;
L19500:
if (prsvec_1.prsi != oindex_1.torch || ! ((objcts_1.oflag1[oindex_1.torch
- 1] & ONBT) != 0)) {
goto L19600;
}
if ((objcts_1.oflag1[oindex_1.candl - 1] & ONBT) != 0) {
goto L19700;
}
/* !ALREADY ON? */
newsta_(oindex_1.candl, 521, 0, 0, 0);
/* !NO, VAPORIZE. */
return ret_val;
L19600:
rspeak_(519);
/* !CANT LIGHT WITH THAT. */
return ret_val;
L19700:
rspeak_(520);
/* !ALREADY ON. */
return ret_val;
L20000:
if (obj != oindex_1.match) {
bug_(6, obj);
}
if (prsvec_1.prsa != vindex_1.trnonw || prsvec_1.prso != oindex_1.match) {
goto L20500;
}
if (findex_1.ormtch != 0) {
goto L20100;
}
/* !ANY MATCHES LEFT? */
rspeak_(183);
/* !NO, LOSE. */
return ret_val;
L20100:
--findex_1.ormtch;
/* !DECREMENT NO MATCHES. */
objcts_1.oflag1[oindex_1.match - 1] |= flobts;
cevent_1.ctick[cindex_1.cevmat - 1] = 2;
/* !COUNTDOWN. */
rspeak_(184);
return ret_val;
L20500:
if (prsvec_1.prsa != vindex_1.trnofw || (objcts_1.oflag1[oindex_1.match -
1] & ONBT) == 0) {
goto L10;
}
objcts_1.oflag1[oindex_1.match - 1] &= ~ flobts;
cevent_1.ctick[cindex_1.cevmat - 1] = 0;
rspeak_(185);
return ret_val;
/* HERE FOR FALSE RETURN */
L10:
ret_val = FALSE_;
return ret_val;
} /* lightp_ */