~ubuntu-branches/ubuntu/vivid/inform/vivid

« back to all changes in this revision

Viewing changes to inform-6.31.1/include/trinitystat.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Christoph Nordholz
  • Date: 2008-05-26 22:09:44 UTC
  • mfrom: (2.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080526220944-ba7phz0d1k4vo7wx
Tags: 6.31.1+dfsg-1
* Remove a considerable number of files from the package
  due to unacceptable licensing terms.
* Repair library symlinks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
! Trinitystat.h
 
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.
 
7
 
 
8
! You must, of course, Replace DrawStatusLine; for this to work.
 
9
 
 
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
 
12
! false?
 
13
 
 
14
! If you have defined Constant DEBUG;, then you get an extra debugging verb.
 
15
! Typing "trinity" will switch statusline styles.
 
16
 
 
17
! Copyright (C) 2000 by Jonathan Rosebaugh. Released under GPL version 2.
 
18
! see http://www.gnu.org/copyleft/gpl.html
 
19
 
 
20
! This is necessary to compile with Graham's current Inform 6.21 compiler.
 
21
#ifndef WORDSIZE;
 
22
Constant TARGET_ZCODE;
 
23
Constant WORDSIZE 2;
 
24
#endif;
 
25
 
 
26
! Debugging verb
 
27
#ifdef DEBUG;
 
28
Object statline with trinity 0;
 
29
Verb meta "trinity"
 
30
* -> Trinity;
 
31
[TrinitySub;
 
32
statline.trinity = (~~(statline.trinity));
 
33
];
 
34
#endif;
 
35
 
 
36
! Z-Code version
 
37
#ifdef TARGET_ZCODE;
 
38
Array printed_text table 64;
 
39
 
 
40
#IFV5;
 
41
[ DrawStatusLine width posa posb i j;
 
42
if (statline.trinity)
 
43
{
 
44
  i = 0->33; if (i==0) i=80;
 
45
  font off;
 
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;
 
51
   else
 
52
   {   FindVisibilityLevels();
 
53
       if (visibility_ceiling == location)
 
54
           print (name) location;
 
55
       else print (The) visibility_ceiling;
 
56
   }
 
57
  @output_stream -3;
 
58
  j=(i-(printed_text-->0))/2;
 
59
  @set_cursor 1 j; print (name) location; spaces(j-1);
 
60
  style roman;
 
61
  @buffer_mode 1; @set_window 0; font on;
 
62
}
 
63
else {   @split_window 1; @set_window 1; @set_cursor 1 1; style reverse;
 
64
   width = 0->33; posa = width-26; posb = width-13;
 
65
   spaces width;
 
66
   @set_cursor 1 2;
 
67
   if (location == thedark) print (name) location;
 
68
   else
 
69
   {   FindVisibilityLevels();
 
70
       if (visibility_ceiling == location)
 
71
           print (name) location;
 
72
       else print (The) visibility_ceiling;
 
73
   }
 
74
   if ((0->1)&2 == 0)
 
75
   {   if (width > 76)
 
76
       {   @set_cursor 1 posa; print (string) SCORE__TX, sline1;
 
77
           @set_cursor 1 posb; print (string) MOVES__TX, sline2;
 
78
       }
 
79
       if (width > 63 && width <= 76)
 
80
       {   @set_cursor 1 posb; print sline1, "/", sline2;
 
81
       }
 
82
   }
 
83
   else
 
84
   {   @set_cursor 1 posa;
 
85
       print (string) TIME__TX;
 
86
       LanguageTimeOfDay(sline1, sline2);
 
87
   }
 
88
   @set_cursor 1 1; style roman; @set_window 0;
 
89
}
 
90
];
 
91
#ENDIF;
 
92
 
 
93
#endif; ! TARGET_ZCODE
 
94
 
 
95
! Glulx version
 
96
#ifdef TARGET_GLULX;
 
97
Array bluelalablankage-->1;
 
98
 
 
99
 
 
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)
 
103
            return;
 
104
 
 
105
        ! If there is no player location, we shouldn't try either.
 
106
        if (location == nothing || parent(player) == nothing)
 
107
            return;
 
108
 
 
109
        glk($002F, gg_statuswin); ! set_window
 
110
        StatusLineHeight(gg_statuswin_size);
 
111
 
 
112
        glk($0025, gg_statuswin, gg_arguments, gg_arguments+4);
 
113
        ! window_get_size
 
114
        width = gg_arguments-->0;
 
115
        height = gg_arguments-->1;
 
116
        posa = width-26; posb = width-13;
 
117
 
 
118
        glk($002A, gg_statuswin); ! window_clear
 
119
 
 
120
if (statline.trinity)
 
121
{
 
122
        if (location == thedark) {
 
123
            centerarea = (width/2) - (PrintAnyToArray(bluelalablankage,0, location)/2);
 
124
        }
 
125
        else {
 
126
            FindVisibilityLevels();
 
127
            if (visibility_ceiling == location)
 
128
                centerarea = (width/2) - ((PrintAnyToArray(bluelalablankage,0,
 
129
location)) / 2);
 
130
            else
 
131
                centerarea = (width/2) - (PrintAnyToArray(bluelalablankage,0,
 
132
visibility_ceiling)/2);
 
133
        }
 
134
        glk_window_move_cursor( gg_statuswin, centerarea, 0);
 
135
        if (visibility_ceiling == location)
 
136
            print (name) location;
 
137
        else
 
138
            print (The) visibility_ceiling;
 
139
}
 
140
else {
 
141
 
 
142
        glk($002B, gg_statuswin, 1, 0); ! window_move_cursor
 
143
        if (location == thedark) {
 
144
            print (name) location;
 
145
        }
 
146
        else {
 
147
            FindVisibilityLevels();
 
148
            if (visibility_ceiling == location)
 
149
                print (name) location;
 
150
            else
 
151
                print (The) visibility_ceiling;
 
152
        }
 
153
 
 
154
        if (width > 66) {
 
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;
 
159
        }
 
160
        if (width > 53 && width <= 66) {
 
161
            glk($002B, gg_statuswin, posb-1, 0); ! window_move_cursor
 
162
            print sline1, "/", sline2;
 
163
        }
 
164
}
 
165
        glk($002F, gg_mainwin); ! set_window
 
166
    ];
 
167
#endif; ! TARGET_GLULX
 
168
 
 
169