-
Notifications
You must be signed in to change notification settings - Fork 11
/
screens.zil
137 lines (121 loc) · 4 KB
/
screens.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
"The SPLIT & SCREEN operations allow you to divide the screen into two
parts: one that behaves as usual and another that you update without
scrolling.
<SPLIT INT>
divides the screen into two windows: #1 occupies INT lines, preferably
at the top of the screen, and #0 occupies the remainder of the screen.
<SPLIT 0>
restores the normal screen format.
<SCREEN INT>
causes subsequent screen output to fall into window #INT.
If INT is 1, the output cursor is moved to the upper left-hand corner;
if INT is 0, the output cursor is restored to its previous position.
You should be careful not to let window #1 scroll; output will be
unpredictable.
Only the more popular micro-computers support these operations.
To check whether the program is running on one, use this:"
<ROUTINE SPLIT-SCREEN? () <NOT <EQUAL? 0 <BAND 32 <GETB 0 1>>>>>
"Here's a fragment from Seastalker that splits the screen:"
<COND (<AND ,AUTOMATIC-SONAR ;"Did player SET SCOPE TO AUTO ?"
<SPLIT-SCREEN?>>
<SETG SCREEN-NOW-SPLIT T>
<START-SONAR?>)>
<TELL "The submarine glides smoothly out of the tank ...">
"And here are the routines that support it:"
<ROUTINE START-SONAR? ()
<COND (,SCREEN-NOW-SPLIT
<SPLIT <+ 3 <* 2 ,SONAR-RANGE>>>
<SETG SONAR-DIR 0> ;"to ensure update"
<I-SHOW-SONAR> ;"to update immediately"
<ENABLE <QUEUE I-SHOW-SONAR -1>>)>>
<ROUTINE I-SHOW-SONAR ()
<COND (<AND <FSET? ,SNARK ,INVISIBLE>
<FSET? ,FREIGHTER ,INVISIBLE>
<==? ,SONAR-LON ,SUB-LON>
<==? ,SONAR-LAT ,SUB-LAT>
<==? ,SONAR-DEP ,SUB-DEPTH>
<==? ,SONAR-DIR ,JOYSTICK-DIR>>
<COND (,DEBUG <TELL "[no sonar update]" CR>)>
<RFALSE>)
(T
<SCREEN 1>
<SHOW-SONARSCOPE>
<SCREEN 0>
<SETG SONAR-LON ,SUB-LON>
<SETG SONAR-LAT ,SUB-LAT>
<SETG SONAR-DEP ,SUB-DEPTH>
<SETG SONAR-DIR ,JOYSTICK-DIR>
<RFALSE>)>>
"In Seastalker, nothing happens unless the player 'turns on' the scope:"
<ROUTINE SONARSCOPE-F ("AUX" DEP N)
<COND (<REMOTE-VERB?> <RFALSE>)
(<VERB? LAMP-ON>
<COND (<SPLIT-SCREEN?>
<FSET ,SONARSCOPE ,ONBIT>
<PERFORM ,V?SET ,SONARSCOPE ,AUTOMATIC>
<RTRUE>)>)
(<NOT <FSET? ,SONARSCOPE ,ONBIT>>
<THIS-IS-IT ,SONARSCOPE>
<TELL "It's not turned on!" CR>
<RTRUE>)
(<VERB? LAMP-OFF>
<COND (,AUTOMATIC-SONAR
<PERFORM ,V?SET ,SONARSCOPE ,MANUAL>
<SETG AUTOMATIC-SONAR <>>
<RTRUE>)>)
(<VERB? ANALYZE EXAMINE READ LOOK-INSIDE LOOK-ON>
<FIXED-FONT-ON>
<TELL "(+=you, .=open water, *=obstacle)" CR>
<SET N <* 2 ,SONAR-RANGE>>
<REPEAT ()
<TELL "--">
<COND (<DLESS? N 0> <CRLF> <RETURN>)>>
<COND (,SCREEN-NOW-SPLIT
<FIXED-FONT-OFF>
<ALREADY ,PLAYER "looking at it">)
(T <SHOW-SONARSCOPE>)>
<RTRUE>)
(<AND <VERB? SET PUT MOVE-DIR> <DOBJ? SONARSCOPE>>
<COND (<IOBJ? AUTOMATIC>
<COND (,AUTOMATIC-SONAR
<ALREADY ,SONARSCOPE "set to automatic">)
(<SPLIT-SCREEN?>
<SETG AUTOMATIC-SONAR T>
<SETG SCREEN-NOW-SPLIT T>
<START-SONAR?>
<OKAY ,SONARSCOPE "set to automatic">)
(T <NOT-AVAILABLE>)>)
(<IOBJ? MANUAL>
<COND (<NOT ,AUTOMATIC-SONAR>
<ALREADY ,SONARSCOPE "set to manual">)
(<SPLIT-SCREEN?>
<SETG AUTOMATIC-SONAR <>>
<SETG SCREEN-NOW-SPLIT <>>
<SPLIT 0>
<DISABLE <INT I-SHOW-SONAR>>
<OKAY ,SONARSCOPE "set to manual">)
(T <NOT-AVAILABLE>)>)>)>>
"And there are times when the scope must be 'off':"
<ROUTINE SONAR-TO-MANUAL ()
<COND (<AND ,AUTOMATIC-SONAR <SPLIT-SCREEN?>>
<SETG AUTOMATIC-SONAR <>>
<SETG SCREEN-NOW-SPLIT <>>
<SPLIT 0>
<DISABLE <INT I-SHOW-SONAR>>
<TELL "The sonarscope automatically sets itself to manual." CR>)>>
"Finally, there's a little extra work for SAVE & RESTORE:"
<ROUTINE V-SAVE ()
<COND (,SCREEN-NOW-SPLIT <SPLIT 0>)>
<COND (<SAVE>
<TELL "Okay." CR>
<V-FIRST-LOOK>)
(T
<TELL ,FAILED CR>)>
<START-SONAR?>
<RTRUE>>
<ROUTINE V-RESTORE ()
<COND (,SCREEN-NOW-SPLIT <SPLIT 0>)>
<COND (<NOT <RESTORE>>
<TELL ,FAILED CR>
<START-SONAR?>
<RFALSE>)>>