-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathmisc.zil
3660 lines (3354 loc) · 87.6 KB
/
misc.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
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"MISC for BEYOND ZORK:
Copyright (C)1987 Infocom, Inc. All Rights Reserved."
"*** ZCODE STARTS HERE ***"
<OBJECT GLOBAL-OBJECTS
(FLAGS LOCATION LIGHTED INDOORS MAPPED PLACE NODESC
NOARTICLE PROPER VOWEL PLURAL NOALL SEEN PART
TOUCHED SURFACE CONTAINER OPENABLE DOORLIKE OPENED
TRANSPARENT LOCKED TAKEABLE TRYTAKE CLOTHING WORN
LIVING PERSON FEMALE MUNGED TOOL VEHICLE FERRIC
READABLE MANUALLY WIELDED WEAPON MONSTER SLEEPING
STRICKEN SURPRISED NAMED BUOYANT NEUTRALIZED
IDENTIFIED USED VIEWED NAMEABLE)>
<OBJECT LOCAL-GLOBALS
(LOC GLOBAL-OBJECTS)
(DESC "that")
(FLAGS NODESC)>
<OBJECT ROOMS
(FLAGS NODESC NOARTICLE)
(DESC "that")>
<OBJECT DUMMY-OBJECT
(FLAGS NODESC NOARTICLE)
(DESC "nothing")>
<GLOBAL WINNER:OBJECT 0>
<GLOBAL TAB " ">
<GLOBAL PERIOD ".|">
<GLOBAL PTAB ".| ">
<GLOBAL YOU-SEE "You see ">
<GLOBAL LYOU-SEE ", you see ">
<GLOBAL CANT "You can't ">
<GLOBAL DONT "You don't ">
<GLOBAL YOU-HEAR "You hear ">
<GLOBAL ALREADY "You're already ">
<GLOBAL BRACKET "]| ">
<GLOBAL IMPOSSIBLY "You couldn't possibly ">
<GLOBAL XTHE "The ">
<GLOBAL LTHE "the ">
<GLOBAL COMMA-AND ", and ">
<GLOBAL SINTO " into ">
<GLOBAL WITH " with ">
<GLOBAL CYOU "You ">
<GLOBAL AND " and ">
<GLOBAL CYOUR "Your ">
<GLOBAL SIN " in ">
<GLOBAL SON " on ">
<GLOBAL SIS " is ">
<GLOBAL STO " to ">
<GLOBAL XA "A ">
<GLOBAL STHE " the ">
<GLOBAL GLANCES-AT " glances at ">
<GLOBAL NOTHING "There's nothing ">
<GLOBAL AT-MOMENT " at the moment.|">
<GLOBAL CTHELADY "The old woman">
<GLOBAL SFIRST " first.|">
<GLOBAL PERQ ".\"|">
<GLOBAL HOST 0> "Host machine ID."
<GLOBAL VT220:FLAG <>> "Charsets available?"
<GLOBAL COLORS?:FLAG <>> "Color available?"
<GLOBAL GRAPHICS?:FLAG <>> "Graphics available?"
<GLOBAL CWIDTH:NUMBER 0> "Pixel width of mono chars."
<GLOBAL CHEIGHT:NUMBER 0> "Pixel height of mono chars."
<GLOBAL WIDTH:NUMBER 0> "Character width of screen."
<GLOBAL HEIGHT:NUMBER 0> "Character height of screen."
<GLOBAL SWIDTH:NUMBER 0> "Width of status bars (in characters)."
<GLOBAL BARWIDTH:NUMBER 0> "Width of a complete status bar."
<GLOBAL DWIDTH:NUMBER 0> "Width of status line and DBOX window."
<GLOBAL BOXWIDTH:NUMBER 0> "Justify and display width for DBOX."
<GLOBAL MOUSEDGE:NUMBER 0> "Left edge of mouse mindow."
<GLOBAL BAR-RES:NUMBER 0> "Number of pixels/character."
<GLOBAL DHEIGHT:NUMBER 0> "Current height of DBOX."
<GLOBAL MAX-DHEIGHT:NUMBER 0> "Maximum height of DBOX."
<GLOBAL STAT-ROUTINE <>> "Vector to stat-printing routine."
<GLOBAL BGND:NUMBER ,C-BLACK>
<GLOBAL FORE:NUMBER ,C-WHITE>
<GLOBAL INCOLOR:NUMBER ,C-CYAN>
<GLOBAL GCOLOR:NUMBER ,C-RED>
<ROUTINE GO ()
<SETG HERE ,HILLTOP>
<MOVE ,PLAYER ,HERE>
<SETG WINNER ,PLAYER>
<SETG LIT? T>
<INITVARS>
<STARTUP>
<SETUP-CHARACTER>
<SETG WINDIR <- <RANDOM 8> 1>>
<QUEUE ,I-BREEZE>
<V-REFRESH>
<CRLF>
<V-LOOK>
<DO-MAIN-LOOP>
<AGAIN>>
<ROUTINE DO-MAIN-LOOP ("AUX" X)
<REPEAT ()
<SET X <MAIN-LOOP>>>>
<GLOBAL P-MULT?:FLAG <>>
<ROUTINE MAIN-LOOP ("AUX" ICNT OCNT NUM CNT OBJ TBL (V <>)
PTBL OBJ1 TMP X)
<SET CNT 0>
<SET OBJ <>>
<SET PTBL T>
<COND (<NOT <HERE? QCONTEXT-ROOM>>
<SETG QCONTEXT <>>
<SETG QCONTEXT-ROOM <>>)>
<SETG P-WON <PARSER>>
<COND (<T? ,P-WON>
<SET ICNT <GET ,P-PRSI ,P-MATCHLEN>>
<SET OCNT <GET ,P-PRSO ,P-MATCHLEN>>
<COND (<AND <T? ,P-IT-OBJECT>
<ACCESSIBLE? ,P-IT-OBJECT>>
<SET TMP <>>
<REPEAT ()
<COND (<IGRTR? CNT .ICNT>
<RETURN>)
(<EQUAL? <GET ,P-PRSI .CNT> ,IT>
<PUT ,P-PRSI .CNT ,P-IT-OBJECT>
<SET TMP T>
<RETURN>)>>
<COND (<ZERO? .TMP>
<SET CNT 0>
<REPEAT ()
<COND (<IGRTR? CNT .OCNT>
<RETURN>)
(<EQUAL? <GET ,P-PRSO .CNT> ,IT>
<PUT ,P-PRSO .CNT ,P-IT-OBJECT>
<RETURN>)>>)>
<SET CNT 0>)>
<SET NUM 1>
<COND (<ZERO? .OCNT>
<SET NUM 0>)
(<G? .OCNT 1>
<SET TBL ,P-PRSO>
<SET OBJ <>>
<COND (<T? .ICNT>
<SET OBJ <GET ,P-PRSI 1>>)>
<SET NUM .OCNT>)
(<G? .ICNT 1>
<SET PTBL <>>
<SET TBL ,P-PRSI>
<SET OBJ <GET ,P-PRSO 1>>
<SET NUM .ICNT>)>
<COND (<AND <ZERO? .OBJ>
<EQUAL? .ICNT 1>>
<SET OBJ <GET ,P-PRSI 1>>)>
<COND (<VERB? WALK>
<SET V <PERFORM ,PRSA ,PRSO>>)
(<ZERO? .NUM>
<COND (<NOT <BAND <GETB ,P-SYNTAX ,P-SBITS> ,P-SONUMS>>
<SET V <PERFORM ,PRSA>>
<SETG PRSO <>>)
(<ZERO? ,LIT?>
<PCLEAR>
<TOO-DARK>)
(T
<PCLEAR>
<TELL "[There isn't anything to ">
<SET TMP <GET ,P-ITBL ,P-VERBN>>
<COND (<SET X <TALKING?>>
<TELL "talk to">)
(<OR <T? ,P-MERGED>
<T? ,P-OFLAG>>
<PRINTB <GET .TMP 0>>)
(T
<SET X <GETB .TMP 3>>
<WORD-PRINT <GETB .TMP 2> .X>)>
<TELL ".]" CR>
<SET V <>>)>)
; (<AND <T? .PTBL>
<G? .NUM 1>
<VERB? COMPARE>>
<SET V <PERFORM ,PRSA ,OBJECT-PAIR>>)
(T
<SET X 0>
<SETG P-MULT? <>>
<COND (<G? .NUM 1>
<SETG P-MULT? T>)>
<SET TMP <>>
<REPEAT ()
<COND (<IGRTR? CNT .NUM>
<COND (<G? .X 0>
<TELL "[The ">
<COND (<NOT <EQUAL? .X .NUM>>
<TELL "other ">)>
<TELL "object">
<COND (<NOT <EQUAL? .X 1>>
<TELL "s">)>
<TELL " that you mentioned ">
<COND (<NOT <EQUAL? .X 1>>
<TELL "are">)
(T <TELL "is">)>
<TELL "n't here.]" CR>)
(<ZERO? .TMP>
<REFERRING>)>
<RETURN>)>
<COND (<T? .PTBL>
<SET OBJ1 <GET ,P-PRSO .CNT>>)
(T
<SET OBJ1 <GET ,P-PRSI .CNT>>)>
<COND (<OR <G? .NUM 1>
<EQUAL? <GET <GET ,P-ITBL ,P-NC1> 0>
,W?ALL ,W?EVERYTHING>>
<COND (<EQUAL? .OBJ1 ,NOT-HERE-OBJECT>
<INC X>
<AGAIN>)
(<AND <EQUAL? ,P-GETFLAGS ,P-ALL>
<DONT-ALL? .OBJ1 .OBJ>>
<AGAIN>)
(<NOT <ACCESSIBLE? .OBJ1>>
<AGAIN>)
(<EQUAL? .OBJ1 ,PLAYER>
<AGAIN>)>
<COND (<EQUAL? .OBJ1 ,IT>
<COND (<NOT <IS? ,P-IT-OBJECT ,NOARTICLE>>
<TELL ,XTHE>)>
<TELL D ,P-IT-OBJECT>)
(T
<COND (<NOT <IS? .OBJ1 ,NOARTICLE>>
<TELL ,XTHE>)>
<TELL D .OBJ1>)>
<TELL ": ">)>
<SET TMP T>
<SETG PRSO .OBJ1>
<SETG PRSI .OBJ>
<COND (<ZERO? .PTBL>
<SETG PRSO .OBJ>
<SETG PRSI .OBJ1>)>
<SETG PSEUDO-PRSO? <>>
<COND (<EQUAL? ,PRSO ,PSEUDO-OBJECT>
<SETG PSEUDO-PRSO? T>)>
<SET V <PERFORM ,PRSA ,PRSO ,PRSI>>
<COND (<EQUAL? .V ,M-FATAL>
<RETURN>)>>)>
<COND (<EQUAL? .V ,M-FATAL>
<SETG P-CONT <>>)>)
(T
<SETG P-CONT <>>)>
<COND (<AND <T? ,P-WON>
<NOT <EQUAL? .V ,M-FATAL>>
<NOT <SET X <GAMEVERB?>>>>
<SET V <CLOCKER>>)>
<SETG PRSA <>>
<SETG PRSO <>>
<SETG PRSI <>>
<RFALSE>>
<ROUTINE DONT-ALL? (O I "AUX" L X)
<SET L <LOC .O>>
<COND (<OR <ZERO? .L>
<EQUAL? .O .I>>
<RTRUE>)
(<VERB? TAKE>
<COND (<EQUAL? .L ,WINNER>
<RTRUE>)
; (<IN? .L ,WINNER>
<RTRUE>)
(<AND <ZERO? ,LIT?>
<NOT <IN? .L ,WINNER>>>
<RTRUE>)
(<IS? .O ,NOALL>
<RTRUE>)
(<AND <NOT <IS? .O ,TAKEABLE>>
<NOT <IS? .O ,TRYTAKE>>>
<RTRUE>)
(<AND <IS? .L ,CONTAINER>
<NOT <IS? .L ,OPENED>>>
<RTRUE>)
(<T? .I>
<COND (<NOT <EQUAL? .L .I>>
<RTRUE>)
(<SEE-INSIDE? .I>
<RFALSE>)>
<RTRUE>)
(<EQUAL? .L <LOC ,PLAYER>>
<RFALSE>)
(<AND <NOT <IS? .L ,TAKEABLE>>
<SEE-INSIDE? .L>>
<RFALSE>)
(T
<RTRUE>)>)
(<SET X <PUTTING?>>
<COND (<IS? .O ,WORN>
<RTRUE>)
(<IS? .O ,WIELDED>
<RTRUE>)
(<EQUAL? .L ,WINNER>
<RFALSE>)
(T
<RTRUE>)>)
(T
<RFALSE>)>>
<GLOBAL C-INTS:NUMBER ,C-TABLE-LENGTH>
<ROUTINE DEQUEUE (RTN)
<SET RTN <QUEUED? .RTN>>
<COND (<T? .RTN>
<COPYT .RTN 0 ,C-INTLEN>)>
<RFALSE>>
<ROUTINE QUEUED? (RTN "AUX" TBL LEN)
<SET TBL <REST ,C-TABLE ,C-INTS>>
<SET LEN </ <- <REST ,C-TABLE ,C-TABLE-LENGTH> .TBL> ,C-INTLEN>>
<COND (<L? .LEN 1>
<RFALSE>)
(<SET RTN <INTBL? .RTN .TBL .LEN 132>>
<COND (<ZERO? <GET .RTN ,C-TICK>>
<RFALSE>)>
<RETURN .RTN>)>
<RFALSE>>
"This version of QUEUE automatically enables as well."
<ROUTINE QUEUE (RTN "OPT" (TICK -1) "AUX" C E (INT <>))
<SET E <REST ,C-TABLE ,C-TABLE-LENGTH>>
<SET C <REST ,C-TABLE ,C-INTS>>
<REPEAT ()
<COND (<EQUAL? .C .E>
<COND (<T? .INT>
<SET C .INT>)
(T
<COND (<L? ,C-INTS ,C-INTLEN>
; <SAY-ERROR "QUEUE">
<RTRUE>)>
<SETG C-INTS <- ,C-INTS ,C-INTLEN>>
<SET INT <REST ,C-TABLE ,C-INTS>>)>
<PUT .INT ,C-RTN .RTN>
<RETURN>)
(<EQUAL? <GET .C ,C-RTN> .RTN>
<SET INT .C>
<RETURN>)
(<ZERO? <GET .C ,C-RTN>>
<SET INT .C>)>
<SET C <REST .C ,C-INTLEN>>>
<COND (<G? .INT ,CLOCK-HAND>
<SET TICK <- <+ .TICK 3>>>)>
<PUT .INT ,C-TICK .TICK>
<RETURN .INT>>
<GLOBAL CLOCK-WAIT?:FLAG <>>
<GLOBAL CLOCK-HAND:NUMBER <>>
<GLOBAL MOVES:NUMBER 0>
<ROUTINE CLOCKER ("AUX" (FLG 0) (Q? 0) E TICK RTN X OSTAT NSTAT MAX DELTA)
<COND (<T? ,CLOCK-WAIT?>
<SETG CLOCK-WAIT? <>>
<RFALSE>)>
<SETG CLOCK-HAND <REST ,C-TABLE ,C-INTS>>
<SET E <REST ,C-TABLE ,C-TABLE-LENGTH>>
<REPEAT ()
<COND (<EQUAL? ,CLOCK-HAND .E>
<INC MOVES>
<COND (<REFRESH-STATS?>
<SET FLG T>)>
<RETURN>)
(<GET ,CLOCK-HAND ,C-RTN>
<SET TICK <GET ,CLOCK-HAND ,C-TICK>>
<COND (<L? .TICK -1>
<PUT ,CLOCK-HAND ,C-TICK <- <- .TICK> 3>>
<SET Q? ,CLOCK-HAND>)
(<T? .TICK>
<COND (<G? .TICK 0>
<SET TICK <- .TICK 1>>
<PUT ,CLOCK-HAND ,C-TICK .TICK>)>
<COND (<T? .TICK>
<SET Q? ,CLOCK-HAND>)>
<COND (<NOT <G? .TICK 0>>
<SET RTN <GET ,CLOCK-HAND ,C-RTN>>
<COND (<ZERO? .TICK>
<COPYT ,CLOCK-HAND 0 ,C-INTLEN>
; <PUT ,CLOCK-HAND ,C-RTN 0>)>
<SET X <APPLY .RTN>>
<COND (<T? .X>
<SET FLG T>)>
<COND (<AND <ZERO? .Q?>
<GET ,CLOCK-HAND ,C-RTN>>
<SET Q? T>)>)>)>)>
<SETG CLOCK-HAND <REST ,CLOCK-HAND ,C-INTLEN>>
<COND (<ZERO? .Q?>
<SETG C-INTS <+ ,C-INTS ,C-INTLEN>>)>>
<RETURN .FLG>>
<GLOBAL NO-REFRESH:NUMBER -1> "Which stat NOT to refresh."
<ROUTINE REFRESH-STATS? ("AUX" (CNT 0) (ANY 0)
STAT OSTAT NSTAT DELTA MAX RATE)
<SET RATE ,NORMAL-RATE>
<COND (<AND <IN? ,SCABBARD ,PLAYER>
<IS? ,SCABBARD ,WORN>
<NOT <IS? ,SCABBARD ,NEUTRALIZED>>>
<SET RATE ,BLESSED-RATE>)>
<SET STAT ,ENDURANCE>
<REPEAT ()
<SET OSTAT <GET ,STATS .STAT>>
<SET MAX <GET ,MAXSTATS .STAT>>
<COND (<AND <EQUAL? .STAT ,INTELLIGENCE>
<WEARING-MAGIC? ,HELM>>)
(<EQUAL? ,NO-REFRESH .STAT>
<SETG NO-REFRESH -1>)
(<NOT <EQUAL? .OSTAT .MAX>>
<SET DELTA <PERCENT .RATE .MAX>>
<COND (<L? .DELTA 1>
<SET DELTA 1>)>
<COND (<G? .OSTAT .MAX>
<SET NSTAT <- .OSTAT .DELTA>>
<COND (<L? .NSTAT .MAX>
<SET NSTAT .MAX>)>)
(T
<SET NSTAT <+ .OSTAT .DELTA>>
<COND (<G? .NSTAT .MAX>
<SET NSTAT .MAX>)>)>
<PUT ,STATS .STAT .NSTAT>
<COND (<ZERO? ,DMODE>)
(<OR <EQUAL? ,IN-DBOX ,SHOWING-STATS>
<AND <T? ,BMODE>
<EQUAL? .STAT ,ENDURANCE>>>
<SHOW-STAT .STAT>)>
<INC ANY>
<COND (<EQUAL? .NSTAT .MAX>
<INC CNT>
<PUTB ,NEW-STATS .CNT .STAT>)>)>
<COND (<IGRTR? STAT ,LUCK>
<RETURN>)>>
<COND (<ZERO? .ANY>
<RFALSE>)
(<ZERO? ,DMODE>
<UPPER-SLINE>)
(<ZERO? ,VT220>
<APPLE-STATS>)>
<COND (<ZERO? .CNT>
<RFALSE>)
(<ZERO? ,SAY-STAT>
<RFALSE>)>
<COND (<NOT <EQUAL? ,HOST ,MACINTOSH>>
<HLIGHT ,H-BOLD>)>
<TELL ,TAB "[Your ">
<SET ANY .CNT>
<REPEAT ()
<TELL <GET ,STAT-NAMES <GETB ,NEW-STATS .ANY>>>
<COND (<DLESS? ANY 1>
<RETURN>)
(<EQUAL? .ANY 1>
<TELL ,AND>)
(T
<TELL ", ">)>>
<TELL C ,SP>
<COND (<G? .CNT 1>
<TELL B ,W?ARE>)
(T
<TELL B ,W?IS>)>
<TELL " back to normal.]" CR>
<HLIGHT ,H-NORMAL>
<SOUND ,S-BEEP>
<COND (<ZERO? ,AUTO>)
(<EQUAL? <GETB ,NEW-STATS 1> ,ENDURANCE>
<BMODE-OFF>)>
<RTRUE>>
<ROUTINE INITVARS ("AUX" X)
<SETG HOST <LOWCORE INTID>> ; "Establish host machine ID."
<SETG COLORS? <BAND <LOWCORE (ZVERSION 1)> 1>>
<SETG GRAPHICS? <BAND <LOWCORE FLAGS> 8>>
<SETG BAR-RES 8>
<COND (<EQUAL? ,HOST ,MACINTOSH>
<PUTB ,TCHARS ,FIRST-MAC-ARROW ,MAC-UP-ARROW>
<PUTB ,TCHARS <+ ,FIRST-MAC-ARROW 1> ,MAC-DOWN-ARROW>
<SETG BAR-RES 6>)>
<HLIGHT ,H-MONO>
<SETG CWIDTH <LOWCORE (FWRD 0)>> ; "Pixel width of chars."
<SETG CHEIGHT <LOWCORE (FWRD 1)>> ; "Pixel height of chars."
<SET X <FONT ,F-NEWFONT>> ; "For IBM."
<SET X <FONT ,F-DEFAULT>>
<HLIGHT ,H-NORMAL>
<SET X <LOWCORE HWRD>> ; "Get pixel width of screen."
<SETG WIDTH </ .X ,CWIDTH>> ; "Screen width in chars."
<COND (<G? ,WIDTH 80>
<SETG WIDTH 80>)>
<SET X <LOWCORE VWRD>> ; "Get pixel height of screen."
<SETG HEIGHT </ .X ,CHEIGHT>> ; "Screen width in chars."
<SETG DWIDTH <- ,WIDTH %<+ ,MWIDTH 3>>> ; "Width of DBOX."
<SETG BOXWIDTH ,DWIDTH>
<COND (<EQUAL? ,HOST ,APPLE-2C>
<DEC BOXWIDTH>)>
<SETG MOUSEDGE <- <- ,WIDTH ,MWIDTH> 1>>
<SETG SWIDTH <+ </ ,STATMAX ,BAR-RES> 1>>
<SETG BARWIDTH <+ <+ ,LABEL-WIDTH ,SWIDTH> 5>>
<SETG CAN-UNDO 0>
<SETG STAT-ROUTINE ,RAWBAR>
<SETG VT220 T>
<SETG MAX-DHEIGHT ,NORMAL-DHEIGHT>
<SETG DHEIGHT ,MAX-DHEIGHT>
<SETG MAP-ROUTINE ,CLOSE-MAP>
<COND (<OR <T? ,VT100>
<EQUAL? ,HOST ,APPLE-2E ,APPLE-2C>
<AND <ZERO? ,GRAPHICS?>
<EQUAL? ,HOST ,IBM>>>
<SETUP-APPLE-MODE>)>
<RFALSE>>
<ROUTINE SETUP-APPLE-MODE ()
<SETG VT220 <>>
<SETG GRAPHICS? <>>
<SETG STAT-ROUTINE ,BAR-NUMBER>
<SETG MAX-DHEIGHT %<- ,NORMAL-DHEIGHT 1>>
<SETG MAP-ROUTINE ,FAR-MAP>
<SETG DHEIGHT ,MAX-DHEIGHT>
<RFALSE>>
<ROUTINE CENTER (Y X)
<DO-CURSET .Y </ <- ,WIDTH .X> 2>>
<RFALSE>>
<ROUTINE DO-CURSET (Y X)
<COND (<NOT <EQUAL? 1 ,CWIDTH ,CHEIGHT>>
<DEC X>
<SET X <* .X ,CWIDTH>>
<INC X>
<DEC Y>
<SET Y <* .Y ,CHEIGHT>>
<INC Y>)>
<CURSET .Y .X>
<RFALSE>>
<ROUTINE TO-TOP-WINDOW ("AUX" X)
<SET X <FONT ,F-DEFAULT>>
<SCREEN ,S-WINDOW>
<BUFOUT <>>
<HLIGHT ,H-NORMAL>
<HLIGHT ,H-MONO>
<COLOR ,GCOLOR ,BGND>
<RFALSE>>
<ROUTINE TO-BOTTOM-WINDOW ("AUX" X)
<SET X <FONT ,F-DEFAULT>>
<SCREEN ,S-TEXT>
<BUFOUT T>
<HLIGHT ,H-NORMAL>
<COLOR ,FORE ,BGND>
<RFALSE>>
<GLOBAL OLD-HERE:OBJECT <>>
<ROUTINE V-REFRESH ("AUX" REDGE X)
<SET X <LOWCORE FLAGS>>
<LOWCORE FLAGS <BAND .X #2 1111111111111011>>
<SETG OLD-HERE <>>
<SETG P-WALK-DIR <>>
<COLOR ,FORE ,BGND>
<CLEAR -1>
<COND (<ZERO? ,DMODE>
<SPLIT 2>
<TO-BOTTOM-WINDOW>
<RTRUE>)>
<SETG NEW-DBOX ,IN-DBOX>
<SPLIT 12>
<COND (<ZERO? ,VT220>
<APPLE-STATS>
<COND (<EQUAL? ,HOST ,APPLE-2C>
<2C-BOX>)
(<EQUAL? ,HOST ,IBM>
<IBM-BOX>)>
<RTRUE>)>
<TO-TOP-WINDOW>
<SET X <FONT ,F-NEWFONT>>
<SET REDGE <- <- ,WIDTH ,MWIDTH> 1>>
<DO-CURSET 2 1>
<PRINTC ,TLC>
<SET X .REDGE>
<REPEAT ()
<PRINTC ,TOP>
<COND (<DLESS? X 3>
<RETURN>)>>
<PRINTC ,TRC>
<DO-CURSET 12 1>
<PRINTC ,BLC>
<SET X .REDGE>
<REPEAT ()
<PRINTC ,BOT>
<COND (<DLESS? X 3>
<RETURN>)>>
<PRINTC ,BRC>
<SET X 3>
<REPEAT ()
<DO-CURSET .X 1>
<PRINTC ,RSID>
<DO-CURSET .X .REDGE>
<PRINTC ,LSID>
<COND (<IGRTR? X 11>
<RETURN>)>>
<SETG DHEIGHT ,MAX-DHEIGHT>
<TO-BOTTOM-WINDOW>
<COND (<EQUAL? ,PRIOR ,SHOWING-STATS>
<SHOW-RANK>
<DISPLAY-STATS>)
(<T? ,BMODE>
<BATTLE-MODE-ON>)>
<RTRUE>>
<ROUTINE IBM-BOX ("AUX" REDGE X)
<TO-TOP-WINDOW>
<SET X <FONT ,F-NEWFONT>>
<SET REDGE <- <- ,WIDTH ,MWIDTH> 1>>
<CURSET 3 1>
<PRINTC ,IBM-TLC>
<SET X .REDGE>
<REPEAT ()
<PRINTC ,IBM-HORZ>
<COND (<DLESS? X 3>
<RETURN>)>>
<PRINTC ,IBM-TRC>
<DO-CURSET 12 1>
<PRINTC ,IBM-BLC>
<SET X .REDGE>
<REPEAT ()
<PRINTC ,IBM-HORZ>
<COND (<DLESS? X 3>
<RETURN>)>>
<PRINTC ,IBM-BRC>
<SET X 4>
<REPEAT ()
<DO-CURSET .X 1>
<PRINTC ,IBM-VERT>
<DO-CURSET .X .REDGE>
<PRINTC ,IBM-VERT>
<COND (<IGRTR? X 11>
<RETURN>)>>
<TO-BOTTOM-WINDOW>
<RTRUE>>
<ROUTINE 2C-BOX ("AUX" CNT X)
<TO-TOP-WINDOW>
<SET X <FONT ,F-NEWFONT>>
; "Draw bottom edge."
<SET X <- <- ,WIDTH ,MWIDTH> 2>> ; "Right edge."
<SET CNT 2>
<CURSET 12 2>
<REPEAT ()
<PRINTC ,APPLE-HORZ>
<COND (<IGRTR? CNT .X>
<RETURN>)>>
; "Do sides."
<SET X 1>
<REPEAT ()
<CURSET .X 1>
<PRINTC ,APPLE-RIGHT>
<CURSET .X .CNT>
<PRINTC ,APPLE-LEFT>
<COND (<IGRTR? X 11>
<RETURN>)>>
<TO-BOTTOM-WINDOW>
<RTRUE>>
<ROUTINE DISPLAY-PLACE ("AUX" (DIR 0) LEN X DEST END)
<SET LEN <GETB ,ROOMS-MAPPED 0>>
<COND (<ZERO? .LEN>)
(<ZERO? ,OLD-HERE>)
(<SET DEST <INTBL? ,OLD-HERE <REST ,ROOMS-MAPPED 1> .LEN 1>>
<SET END <REST ,ROOMS-MAPPED .LEN>>
<COND (<L? .DEST .END>
<SET X <- 0 <- .END .DEST>>>
<COPYT <REST .DEST 1> .DEST .X>)>
<PUTB ,ROOMS-MAPPED 0 <- .LEN 1>>)>
<SETUP-SLINE>
<SAY-HERE>
<CENTER-SLINE>
<SHOW-SLINE>
<COND (<OR <EQUAL? ,P-WALK-DIR <> ,P?UP ,P?DOWN>
<EQUAL? ,P-WALK-DIR ,P?IN ,P?OUT>>
<NEW-MAP>)
(T
<REPEAT ()
<COND (<EQUAL? ,P-WALK-DIR <GETB ,PDIR-LIST .DIR>>
<SET X <+ .DIR 4>>
<COND (<G? .X ,I-NW>
<SET X <- .X 8>>)>
<SET LEN <GETP ,HERE <GETB ,PDIR-LIST .X>>>
<COND (<ZERO? .LEN>
<NEW-MAP>
<RETURN>)>
<SET LEN <BAND <GET .LEN ,XTYPE> 127>>
<INC LEN>
<SET X <GET ,YOFFS .DIR>>
<COND (<EQUAL? ,MAP-ROUTINE ,CLOSE-MAP>
<SET X <+ .X .X>>)>
<SET X <* .X .LEN>>
<SETG MAPY <+ ,MAPY .X>>
<SET X <GET ,XOFFS .DIR>>
<COND (<EQUAL? ,MAP-ROUTINE ,CLOSE-MAP>
<SET X <+ .X .X>>)>
<SET X <* .X .LEN>>
<SETG MAPX <+ ,MAPX .X>>
<COND (<OR <L? ,MAPY 1>
<G? ,MAPY %<- ,MHEIGHT 2>>
<L? ,MAPX 1>
<G? ,MAPX %<- ,MWIDTH 2>>>
<NEW-MAP>
<RETURN>)>
; <APPLY ,MAP-ROUTINE ,HERE ,MAPY ,MAPX>
<DRAW-MAP>
<RETURN>)>
<COND (<IGRTR? DIR ,I-NW>
<RETURN>)>>)>
<SHOW-MAP>
<COND (<AND <T? ,DMODE>
<EQUAL? ,PRIOR 0 ,SHOWING-ROOM>>
<SETG DBOX-TOP 0>
<UPDATE-ROOMDESC>)>
<SETG OLD-HERE ,HERE>
<RTRUE>>
<ROUTINE REFRESH-MAP ("OPT" (NEW T))
<COND (<ZERO? ,DMODE>
<LOWER-SLINE>
<RFALSE>)>
<SETG SAME-COORDS .NEW>
<WINDOW ,SHOWING-ROOM>
<NEW-MAP>
<SHOW-MAP>
<RFALSE>>
<ROUTINE SHOW-MAP ("AUX" X)
<TO-TOP-WINDOW>
<COND (<T? ,VT220>
<SET X <FONT ,F-NEWFONT>>)>
<DO-CURSET 1 <- ,WIDTH ,MWIDTH>>
<PRINTT ,MAP ,MWIDTH ,MHEIGHT>
<TO-BOTTOM-WINDOW>
<RFALSE>>
<ROUTINE SHOW-RANK ("OPT" (RIGHT-EDGE ,DWIDTH) "AUX" LEN X)
<SETUP-SLINE>
<TELL C ,SP>
<PRINT-TABLE ,CHARNAME>
<DIROUT ,D-TABLE-OFF>
<SET LEN <GET ,AUX-TABLE 0>>
<COPYT <REST ,AUX-TABLE 2> ,SLINE .LEN>
<PUT ,AUX-TABLE 0 0>
<DIROUT ,D-TABLE-ON ,AUX-TABLE>
<ANNOUNCE-RANK>
<PRINTC ,SP>
<DIROUT ,D-TABLE-OFF>
<SET LEN <GET ,AUX-TABLE 0>>
<SET X <REST ,SLINE <- .RIGHT-EDGE .LEN>>>
<COPYT <REST ,AUX-TABLE 2> .X .LEN>
<SHOW-SLINE 1 .RIGHT-EDGE>
<RTRUE>>
<GLOBAL RANK:NUMBER 0>
<ROUTINE ANNOUNCE-RANK ("AUX" (LEVEL 0) STAT)
<SET STAT <GET ,STATS ,EXPERIENCE>>
<TELL "Level ">
<REPEAT ()
<COND (<L? .STAT <GET ,THRESHOLDS .LEVEL>>
<RETURN>)
(<IGRTR? LEVEL ,MAX-LEVEL>
<SET LEVEL 0>
<PUT ,STATS ,EXPERIENCE 0>
<COND (<IGRTR? RANK 2>
<SET RANK 2>)>
<RETURN>)>>
<TELL N .LEVEL C ,SP>
<COND (<IS? ,PLAYER ,FEMALE>
<TELL "Fem">)
(T
<TELL "M">)>
<TELL "ale " <GET ,RANK-NAMES ,RANK>>
<RETURN .LEVEL>>
<ROUTINE SETUP-SLINE ()
<PUTB ,SLINE 0 ,SP>
<COPYT ,SLINE <REST ,SLINE 1> %<- 0 <- ,SLINE-LENGTH 1>>>
<PUT ,AUX-TABLE 0 0>
<DIROUT ,D-TABLE-ON ,AUX-TABLE>
<RFALSE>>
<ROUTINE CENTER-SLINE ("AUX" X LEN)
<DIROUT ,D-TABLE-OFF>
<SET LEN <GET ,AUX-TABLE 0>>
<SET X <REST ,SLINE </ <- ,DWIDTH .LEN> 2>>>
<COPYT <REST ,AUX-TABLE 2> .X .LEN>
<RFALSE>>
<ROUTINE SHOW-SLINE ("OPT" (Y 1) (RIGHT-EDGE ,DWIDTH) "AUX" X)
<TO-TOP-WINDOW>
<DO-CURSET .Y 1>
<COND (<EQUAL? .RIGHT-EDGE ,WIDTH>)
(<T? ,VT220>
<SET X <FONT ,F-NEWFONT>>
<PRINTC 58>
<SET X <FONT ,F-DEFAULT>>)
(<EQUAL? ,HOST ,APPLE-2C>
<SET X <FONT ,F-NEWFONT>>
<PRINTC ,APPLE-RIGHT>
<SET X <FONT ,F-DEFAULT>>)
(T
<TELL C ,SP>)>
<HLIGHT ,H-INVERSE>
<PRINTT ,SLINE .RIGHT-EDGE>
<HLIGHT ,H-NORMAL>
<HLIGHT ,H-MONO>
<COND (<EQUAL? .RIGHT-EDGE ,WIDTH>)
(<T? ,VT220>
<SET X <FONT ,F-NEWFONT>>
<PRINTC 57>
<SET X <FONT ,F-DEFAULT>>)
(<EQUAL? ,HOST ,APPLE-2C>
<SET X <FONT ,F-NEWFONT>>
<PRINTC ,APPLE-LEFT>
<SET X <FONT ,F-DEFAULT>>)
(T
<TELL C ,SP>)>
<TO-BOTTOM-WINDOW>
<RFALSE>>
<ROUTINE SAY-HERE ("AUX" X)
<COND (<HERE? DEATH>)
(<ZERO? ,LIT?>
<TELL "Darkness">
<RTRUE>)>
<TELL D ,HERE>
<SET X <LOC ,PLAYER>>
<COND (<IS? .X ,VEHICLE>
<TELL C ,COMMA>
<COND (<AND <EQUAL? .X ,SADDLE>
<IN? ,SADDLE ,DACT>>
<TELL ,SON A ,DACT>
<RTRUE>)>
<ON-IN .X>)>
<RTRUE>>
<ROUTINE PRINT-SPACES (N)
<REPEAT ()
<COND (<DLESS? N 0>
<RTRUE>)>
<TELL C ,SP>>>
<GLOBAL MAPX:NUMBER ,CENTERX>
<GLOBAL MAPY:NUMBER ,CENTERY>
<GLOBAL MAP-ROUTINE <>>
<GLOBAL SAME-COORDS:FLAG <>>
<ROUTINE NEW-MAP ("AUX" TBL X)
<COND (<T? ,SAME-COORDS>
<SETG SAME-COORDS <>>)
(T
<SETG MAPX ,CENTERX>
<SETG MAPY ,CENTERY>
<SET TBL <GETPT ,HERE ,P?COORDS>>
<COND (<T? .TBL>
<SET X <GETB .TBL 0>>
<COND (<T? .X>
<SETG MAPX .X>)>
<SET X <GETB .TBL 1>>
<COND (<T? .X>
<SETG MAPY .X>)>)>)>
<DRAW-MAP>
<RTRUE>>
<ROUTINE DRAW-MAP ()
<COPYT ,ROOMS-MAPPED 0 ,ROOMS-MAPPED-LENGTH>
<PUTB ,MAP 0 ,SP>
<COPYT ,MAP <REST ,MAP 1> %<- 0 <- ,MAP-SIZE 1>>>
<APPLY ,MAP-ROUTINE ,HERE ,MAPY ,MAPX>
<RFALSE>>
<ROUTINE CLOSE-MAP (RM Y X "AUX" DIR TBL CHAR TYPE LEN DEST
NY NX YOFF XOFF CTBL)
<SET LEN <GETB ,ROOMS-MAPPED 0>>
<COND (<OR <ZERO? .LEN>
<NOT <SET CHAR
<INTBL? .RM <REST ,ROOMS-MAPPED 1> .LEN 1>>>>
<COND (<IGRTR? LEN %<- ,ROOMS-MAPPED-LENGTH 1>>
; <SAY-ERROR "CLOSE-MAP <1>">
<RTRUE>)>
<PUTB ,ROOMS-MAPPED .LEN .RM>
<PUTB ,ROOMS-MAPPED 0 .LEN>)>
<COND (<AND <G? .Y -1>
<L? .Y ,MHEIGHT>
<G? .X -1>
<L? .X ,MWIDTH>>
<COND (<T? ,VT220>
<SET CHAR <SMART-CHAR? .RM>>)
(T
<SET CHAR <DUMB-CHAR? .RM>>)>
<PUTB <REST ,MAP <* .Y ,MWIDTH>> .X .CHAR>
; <COND (<T? ,DRAW>
<SHOW-DRAWING .Y .X .CHAR>)>)>
<MAKE .RM ,MAPPED>
<SET DIR -1>
<REPEAT ()
<COND (<IGRTR? DIR ,I-NW>
<UNMAKE .RM ,MAPPED>
<RTRUE>)>
<SET LEN 0>
<SET DEST <>> ; "Very important!"
<SET TYPE <>>
<SET CTBL ,XCHARS> ; "Assume exit edges."
; "Get attributes of a direction."
<SET TBL <GETP .RM <GETB ,PDIR-LIST .DIR>>>
<COND (<T? .TBL>
<SET TYPE <GET .TBL ,XTYPE>>
<SET LEN <BAND .TYPE 255>>
<SET TYPE <MSB .TYPE>>)>
<COND (<OR <ZERO? .TBL>
<EQUAL? .TYPE ,NO-EXIT ,SORRY-EXIT ; ,FSORRY-EXIT>
<NOT <BTST .LEN ,MARKBIT>>>
<SET CTBL ,NXCHARS>)
(<EQUAL? .TYPE ,FCONNECT>
<SET DEST -1>
<SET LEN <BAND .LEN 127>>
<COND (<ZERO? .LEN>
<SET CTBL ,NXCHARS>)>)
(T
<SET DEST <GET .TBL ,XROOM>>
<COND (<OR <ZERO? .DEST>
<NOT <IN? .DEST ,ROOMS>>>
; <SAY-ERROR "CLOSE-MAP <3>">
<RFALSE>)
(<OR <EQUAL? .TYPE ,SHADOW-EXIT>
<AND <EQUAL? .TYPE ,DCONNECT>
<NOT <IS? <GET .TBL ,XDATA>
,OPENED>>>>
<SET CTBL ,NXCHARS>)>)>
<SET LEN <BAND .LEN 127>>
<SET YOFF <GET ,YOFFS .DIR>> ; "Establish offsets."
<SET XOFF <GET ,XOFFS .DIR>>
<SET NY <+ .Y .YOFF>> ; "Do room edge."
<SET NX <+ .X .XOFF>>
<COND (<OR <L? .NY 0>
<G? .NY %<- ,MHEIGHT 1>>
<L? .NX 0>
<G? .NX %<- ,MWIDTH 1>>>
<AGAIN>)>
<SET CHAR <GETB .CTBL .DIR>>
<COND (<ZERO? ,VT220>
<SET CHAR <GETB ,SHITCHARS .DIR>>
<COND (<EQUAL? .CTBL ,NXCHARS>
<SET CHAR ,SP>)>)
(<HERE? .RM>
<SET CHAR <+ .CHAR 17>>)>
<PUTB <REST ,MAP <* .NY ,MWIDTH>> .NX .CHAR>
; <COND (<T? ,DRAW>
<SHOW-DRAWING .NY .NX .CHAR>)>
<COND (<OR <ZERO? .TBL> ; "If no exit ..."
<ZERO? .TYPE>
<ZERO? .DEST> ; "Or no connection ..."
<L? .Y 0>
<G? .Y %<- ,MHEIGHT 1>>
<L? .X 0>
<G? .X %<- ,MWIDTH 1>>>
<AGAIN>)>
<SET LEN <+ .LEN <BAND .LEN #2 11111110>>>
<SET CHAR <GETB ,MCHARS .DIR>> ; "Continue the path."
<COND (<EQUAL? .TYPE ,X-EXIT>
<COND (<BTST .DIR 1>
<SET CHAR ,XCROSS>
<COND (<ZERO? ,VT220>
<SET CHAR %<ASCII !\X>>)>)
(T
<SET CHAR ,HVCROSS>
<COND (<ZERO? ,VT220>
<SET CHAR %<ASCII !\+>>)>)>)
(<EQUAL? .CTBL ,NXCHARS> ; "For closed doors."