2
! This library gives the ability to switch between the normal statusline and a
3
! Trinity style statusline. It works for both the Z-Machine and Glulx, and
4
! should work on all three compilers. (G.N.'s Z-Machine compiler, A.P.'s Glulx
5
! compiler, and A.P.'s biplatform compiler.) It has only been tested on the
6
! biplatform compiler, though.
8
! You must, of course, Replace DrawStatusLine; for this to work.
10
! An object is supplied, statline, with a property trinity. If trinity is true,
11
! then you will have a Trinity-style line. Guess what happens if trinity is
14
! If you have defined Constant DEBUG;, then you get an extra debugging verb.
15
! Typing "trinity" will switch statusline styles.
17
! Copyright (C) 2000 by Jonathan Rosebaugh. Released under GPL version 2.
18
! see http://www.gnu.org/copyleft/gpl.html
20
! This is necessary to compile with Graham's current Inform 6.21 compiler.
22
Constant TARGET_ZCODE;
28
Object statline with trinity 0;
32
statline.trinity = (~~(statline.trinity));
38
Array printed_text table 64;
41
[ DrawStatusLine width posa posb i j;
44
i = 0->33; if (i==0) i=80;
46
@split_window 1; @buffer_mode 0; @set_window 1;
47
style reverse; @set_cursor 1 1; spaces(i);
48
printed_text-->0 = 64;
49
@output_stream 3 printed_text;
50
if (location == thedark) print (name) location;
52
{ FindVisibilityLevels();
53
if (visibility_ceiling == location)
54
print (name) location;
55
else print (The) visibility_ceiling;
58
j=(i-(printed_text-->0))/2;
59
@set_cursor 1 j; print (name) location; spaces(j-1);
61
@buffer_mode 1; @set_window 0; font on;
63
else { @split_window 1; @set_window 1; @set_cursor 1 1; style reverse;
64
width = 0->33; posa = width-26; posb = width-13;
67
if (location == thedark) print (name) location;
69
{ FindVisibilityLevels();
70
if (visibility_ceiling == location)
71
print (name) location;
72
else print (The) visibility_ceiling;
76
{ @set_cursor 1 posa; print (string) SCORE__TX, sline1;
77
@set_cursor 1 posb; print (string) MOVES__TX, sline2;
79
if (width > 63 && width <= 76)
80
{ @set_cursor 1 posb; print sline1, "/", sline2;
85
print (string) TIME__TX;
86
LanguageTimeOfDay(sline1, sline2);
88
@set_cursor 1 1; style roman; @set_window 0;
93
#endif; ! TARGET_ZCODE
97
Array bluelalablankage-->1;
100
[ DrawStatusLine width height posa posb centerarea;
101
! If we have no status window, we must not try to redraw it.
102
if (gg_statuswin == 0)
105
! If there is no player location, we shouldn't try either.
106
if (location == nothing || parent(player) == nothing)
109
glk($002F, gg_statuswin); ! set_window
110
StatusLineHeight(gg_statuswin_size);
112
glk($0025, gg_statuswin, gg_arguments, gg_arguments+4);
114
width = gg_arguments-->0;
115
height = gg_arguments-->1;
116
posa = width-26; posb = width-13;
118
glk($002A, gg_statuswin); ! window_clear
120
if (statline.trinity)
122
if (location == thedark) {
123
centerarea = (width/2) - (PrintAnyToArray(bluelalablankage,0, location)/2);
126
FindVisibilityLevels();
127
if (visibility_ceiling == location)
128
centerarea = (width/2) - ((PrintAnyToArray(bluelalablankage,0,
131
centerarea = (width/2) - (PrintAnyToArray(bluelalablankage,0,
132
visibility_ceiling)/2);
134
glk_window_move_cursor( gg_statuswin, centerarea, 0);
135
if (visibility_ceiling == location)
136
print (name) location;
138
print (The) visibility_ceiling;
142
glk($002B, gg_statuswin, 1, 0); ! window_move_cursor
143
if (location == thedark) {
144
print (name) location;
147
FindVisibilityLevels();
148
if (visibility_ceiling == location)
149
print (name) location;
151
print (The) visibility_ceiling;
155
glk($002B, gg_statuswin, posa-1, 0); ! window_move_cursor
156
print (string) SCORE__TX, sline1;
157
glk($002B, gg_statuswin, posb-1, 0); ! window_move_cursor
158
print (string) MOVES__TX, sline2;
160
if (width > 53 && width <= 66) {
161
glk($002B, gg_statuswin, posb-1, 0); ! window_move_cursor
162
print sline1, "/", sline2;
165
glk($002F, gg_mainwin); ! set_window
167
#endif; ! TARGET_GLULX