forked from historicalsource/zork2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gglobals.zil
342 lines (306 loc) · 8.91 KB
/
gglobals.zil
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
"Generic GLOBALS file for
The ZORK Trilogy
started on 7/28/83 by MARC"
"SUBTITLE GLOBAL OBJECTS"
<OBJECT GLOBAL-OBJECTS
(FLAGS RMUNGBIT INVISIBLE TOUCHBIT SURFACEBIT TRYTAKEBIT
OPENBIT SEARCHBIT TRANSBIT ONBIT RLANDBIT FIGHTBIT
STAGGERED WEARBIT)>
<OBJECT LOCAL-GLOBALS
(IN GLOBAL-OBJECTS)
(SYNONYM ZZMGCK)
(DESCFCN PATH-OBJECT)
(GLOBAL GLOBAL-OBJECTS)
(ADVFCN 0)
(FDESC "F")
(LDESC "F")
(PSEUDO "FOOBAR" V-WALK)
(CONTFCN 0)
(VTYPE 1)
(SIZE 0)
(CAPACITY 0)>
;"Yes, this synonym for LOCAL-GLOBALS needs to exist... sigh"
<OBJECT ROOMS
(IN TO ROOMS)>
<OBJECT INTNUM
(IN GLOBAL-OBJECTS)
(SYNONYM INTNUM)
(FLAGS TOOLBIT)
(DESC "number")>
<OBJECT PSEUDO-OBJECT
(IN LOCAL-GLOBALS)
(DESC "pseudo")
(ACTION CRETIN-FCN)>
<OBJECT IT
(IN GLOBAL-OBJECTS)
(SYNONYM IT THEM HER HIM)
(DESC "random object")
(FLAGS NDESCBIT TOUCHBIT)>
<OBJECT NOT-HERE-OBJECT
(DESC "such thing" ;"[not here]")
(ACTION NOT-HERE-OBJECT-F)>
<ROUTINE NOT-HERE-OBJECT-F ("AUX" TBL (PRSO? T) OBJ)
;"This COND is game independent (except the TELL)"
<COND (<AND <EQUAL? ,PRSO ,NOT-HERE-OBJECT>
<EQUAL? ,PRSI ,NOT-HERE-OBJECT>>
<TELL "Those things aren't here!" CR>
<RTRUE>)
(<EQUAL? ,PRSO ,NOT-HERE-OBJECT>
<SET TBL ,P-PRSO>)
(T
<SET TBL ,P-PRSI>
<SET PRSO? <>>)>
;"Here is the default 'cant see any' printer"
<SETG P-CONT <>>
<SETG QUOTE-FLAG <>>
<COND (<EQUAL? ,WINNER ,PLAYER>
<TELL "You can't see any ">
<NOT-HERE-PRINT .PRSO?>
<TELL " here!" CR>)
(T
<TELL "The " D ,WINNER " seems confused. \"I don't see any ">
<NOT-HERE-PRINT .PRSO?>
<TELL " here!\"" CR>)>
<RTRUE>>
;<ROUTINE FIND-NOT-HERE (TBL PRSO? "AUX" M-F OBJ)
;"Here is where special-case code goes. <MOBY-FIND .TBL> returns
number of matches. If 1, then P-MOBY-FOUND is it. One may treat
the 0 and >1 cases alike or different. It doesn't matter. Always
return RFALSE (not handled) if you have resolved the problem."
<SET M-F <MOBY-FIND .TBL>>
;<COND (,DEBUG
<TELL "[Moby-found " N .M-F " objects" "]" CR>)>
<COND (<AND <G? .M-F 1>
<SET OBJ <GETP <GET .TBL 1> ,P?GLOBAL>>>
<SET M-F 1>
<SETG P-MOBY-FOUND .OBJ>)>
<COND (<==? 1 .M-F>
;<COND (,DEBUG <TELL "[Namely: " D ,P-MOBY-FOUND "]" CR>)>
<COND (.PRSO? <SETG PRSO ,P-MOBY-FOUND>)
(T <SETG PRSI ,P-MOBY-FOUND>)>
<RFALSE>)
(<NOT .PRSO?>
<TELL "You wouldn't find any ">
<NOT-HERE-PRINT .PRSO?>
<TELL " there." CR>
<RTRUE>)
(T ,NOT-HERE-OBJECT)>>
;<ROUTINE GLOBAL-NOT-HERE-PRINT (OBJ)
;<COND (,P-MULT <SETG P-NOT-HERE <+ ,P-NOT-HERE 1>>)>
<SETG P-CONT <>>
<SETG QUOTE-FLAG <>>
<TELL "You can't see any">
<COND (<EQUAL? .OBJ ,PRSO> <PRSO-PRINT>)
(T <PRSI-PRINT>)>
<TELL " here." CR>>
<ROUTINE NOT-HERE-PRINT (PRSO?)
<COND (,P-OFLAG
<COND (,P-XADJ <PRINTB ,P-XADJN>)>
<COND (,P-XNAM <PRINTB ,P-XNAM>)>)
(.PRSO?
<BUFFER-PRINT <GET ,P-ITBL ,P-NC1> <GET ,P-ITBL ,P-NC1L> <>>)
(T
<BUFFER-PRINT <GET ,P-ITBL ,P-NC2> <GET ,P-ITBL ,P-NC2L> <>>)>>
<ROUTINE NULL-F ("OPTIONAL" A1 A2)
<RFALSE>>
/^L
"Objects shared by all three Zorks go here"
<GLOBAL LOAD-MAX 100>
<GLOBAL LOAD-ALLOWED 100>
<OBJECT BLESSINGS
(IN GLOBAL-OBJECTS)
(SYNONYM BLESSINGS GRACES)
(DESC "blessings")
(FLAGS NDESCBIT)>
<OBJECT STAIRS
(IN LOCAL-GLOBALS)
(SYNONYM STAIRS STEPS STAIRCASE STAIRWAY)
(ADJECTIVE STONE DARK MARBLE FORBIDDING STEEP)
(DESC "stairs")
(FLAGS NDESCBIT CLIMBBIT)
(ACTION STAIRS-F)>
<ROUTINE STAIRS-F ()
<COND (<VERB? THROUGH>
<TELL
"You should say whether you want to go up or down." CR>)>>
<OBJECT SAILOR
(IN GLOBAL-OBJECTS)
(SYNONYM SAILOR FOOTPAD AVIATOR)
(DESC "sailor")
(FLAGS NDESCBIT)
(ACTION SAILOR-FCN)>
<ROUTINE SAILOR-FCN ()
<COND (<VERB? TELL>
<SETG P-CONT <>>
<SETG QUOTE-FLAG <>>
<TELL "You can't talk to the sailor that way." CR>)
(<VERB? EXAMINE>
%<COND (<==? ,ZORK-NUMBER 3>
'<COND (<NOT <FSET? ,VIKING-SHIP ,INVISIBLE>>
<TELL
"He looks like a sailor." CR>
<RTRUE>)>)
(ELSE T)>
<TELL
"There is no sailor to be seen." CR>)
(<VERB? HELLO>
<SETG HS <+ ,HS 1>>
%<COND (<==? ,ZORK-NUMBER 3>
'<COND (<NOT <FSET? ,VIKING-SHIP ,INVISIBLE>>
<TELL
"The seaman looks up and maneuvers the boat toward shore. He cries out \"I
have waited three ages for someone to say those words and save me from
sailing this endless ocean. Please accept this gift. You may find it
useful!\" He throws something which falls near you in the sand, then sails
off toward the west, singing a lively, but somewhat uncouth, sailor song." CR>
<FSET ,VIKING-SHIP ,INVISIBLE>
<MOVE ,VIAL ,HERE>)
(<==? ,HERE ,FLATHEAD-OCEAN>
<COND (,SHIP-GONE
<TELL "Nothing happens anymore." CR>)
(T
<TELL "Nothing happens yet." CR>)>)
(T <TELL "Nothing happens here." CR>)>)
(T
'<COND (<0? <MOD ,HS 20>>
<TELL
"You seem to be repeating yourself." CR>)
(<0? <MOD ,HS 10>>
<TELL
"I think that phrase is getting a bit worn out." CR>)
(T
<TELL "Nothing happens here." CR>)>)>)>>
<OBJECT GROUND
(IN GLOBAL-OBJECTS)
(SYNONYM GROUND SAND DIRT FLOOR)
(DESC "ground")
(ACTION GROUND-FUNCTION)>
<ROUTINE GROUND-FUNCTION ()
<COND (<AND <VERB? PUT PUT-ON>
<EQUAL? ,PRSI ,GROUND>>
<PERFORM ,V?DROP ,PRSO>
<RTRUE>)
%<COND (<==? ,ZORK-NUMBER 1>
'(<EQUAL? ,HERE ,SANDY-CAVE>
<SAND-FUNCTION>))
(T
'(<NULL-F>
<RFALSE>))>
(<VERB? DIG>
<TELL "The ground is too hard for digging here." CR>)>>
<OBJECT GRUE
(IN GLOBAL-OBJECTS)
(SYNONYM GRUE)
(ADJECTIVE LURKING SINISTER HUNGRY SILENT)
(DESC "lurking grue")
(ACTION GRUE-FUNCTION)>
<ROUTINE GRUE-FUNCTION ()
<COND (<VERB? EXAMINE>
<TELL
"The grue is a sinister, lurking presence in the dark places of the
earth. Its favorite diet is adventurers, but its insatiable
appetite is tempered by its fear of light. No grue has ever been
seen by the light of day, and few have survived its fearsome jaws
to tell the tale." CR>)
(<VERB? FIND>
<TELL
"There is no grue here, but I'm sure there is at least one lurking
in the darkness nearby. I wouldn't let my light go out if I were
you!" CR>)
(<VERB? LISTEN>
<TELL
"It makes no sound but is always lurking in the darkness nearby." CR>)>>
<OBJECT LUNGS
(IN GLOBAL-OBJECTS)
(SYNONYM LUNGS AIR MOUTH BREATH)
(DESC "blast of air")
(FLAGS NDESCBIT)>
<OBJECT ME
(IN GLOBAL-OBJECTS)
(SYNONYM ME MYSELF SELF CRETIN)
(DESC "you")
(FLAGS ACTORBIT)
(ACTION CRETIN-FCN)>
<ROUTINE CRETIN-FCN ()
<COND (<VERB? TELL>
<SETG P-CONT <>>
<SETG QUOTE-FLAG <>>
<TELL
"Talking to yourself is said to be a sign of impending mental collapse." CR>)
(<AND <VERB? GIVE>
<EQUAL? ,PRSI ,ME>>
<PERFORM ,V?TAKE ,PRSO>
<RTRUE>)
(<VERB? MAKE>
<TELL "Only you can do that." CR>)
(<VERB? DISEMBARK>
<TELL "You'll have to do that on your own." CR>)
(<VERB? EAT>
<TELL "Auto-cannibalism is not the answer." CR>)
(<VERB? ATTACK MUNG>
<COND (<AND ,PRSI <FSET? ,PRSI ,WEAPONBIT>>
<JIGS-UP "If you insist.... Poof, you're dead!">)
(T
<TELL "Suicide is not the answer." CR>)>)
(<VERB? THROW>
<COND (<==? ,PRSO ,ME>
<TELL
"Why don't you just walk like normal people?" CR>)>)
(<VERB? TAKE>
<TELL "How romantic!" CR>)
(<VERB? EXAMINE>
<COND %<COND (<==? ,ZORK-NUMBER 1>
'(<EQUAL? ,HERE <LOC ,MIRROR-1> <LOC ,MIRROR-2>>
<TELL
"Your image in the mirror looks tired." CR>))
(<==? ,ZORK-NUMBER 3>
'(,INVIS
<TELL
"A good trick, as you are currently invisible." CR>))
(T
'(<NULL-F> <RTRUE>))>
(T
%<COND (<==? ,ZORK-NUMBER 3>
'<TELL
"What you can see looks pretty much as usual, sorry to say." CR>)
(ELSE
'<TELL
"That's difficult unless your eyes are prehensile." CR>)>)>)>>
<OBJECT ADVENTURER
(SYNONYM ADVENTURER)
(DESC "cretin")
(FLAGS NDESCBIT INVISIBLE SACREDBIT ACTORBIT)
(STRENGTH 0)
(ACTION 0)>
<OBJECT PATHOBJ
(IN GLOBAL-OBJECTS)
(SYNONYM TRAIL PATH)
(ADJECTIVE FOREST NARROW LONG WINDING)
(DESC "passage")
(FLAGS NDESCBIT)
(ACTION PATH-OBJECT)>
<ROUTINE PATH-OBJECT ()
<COND (<VERB? TAKE FOLLOW>
<TELL "You must specify a direction to go." CR>)
(<VERB? FIND>
<TELL "I can't help you there...." CR>)
(<VERB? DIG>
<TELL "Not a chance." CR>)>>
<OBJECT ZORKMID
(IN GLOBAL-OBJECTS)
(SYNONYM ZORKMID)
(DESC "zorkmid")
(ACTION ZORKMID-FUNCTION)>
<ROUTINE ZORKMID-FUNCTION ()
<COND (<VERB? EXAMINE>
<TELL
"The zorkmid is the unit of currency of the Great Underground Empire." CR>)
(<VERB? FIND>
<TELL
"The best way to find zorkmids is to go out and look for them." CR>)>>
<OBJECT HANDS
(IN GLOBAL-OBJECTS)
(SYNONYM PAIR HANDS HAND)
(ADJECTIVE BARE)
(DESC "pair of hands")
(FLAGS NDESCBIT TOOLBIT)>