3
|
1 /* $Id: helpwin.c,v 1.1.1.1 1997/12/06 05:41:29 darius Exp $ */
|
|
2
|
|
3 /*
|
|
4 * helpwin.c
|
|
5 * copyright 1991 ERic mehlhaff
|
|
6 * Free to use, hack, etc. Just keep these credits here.
|
|
7 * Use of this code may be dangerous to your health and/or system.
|
|
8 * Its use is at your own risk.
|
|
9 * I assume no responsibility for damages, real, potential, or imagined,
|
|
10 * resulting from the use of it.
|
|
11 *
|
|
12 * Hacked into paradise by Bill Dyess
|
|
13 */
|
|
14
|
|
15 #include <stdio.h>
|
|
16 #include <math.h>
|
|
17 #include <signal.h>
|
|
18 #include <sys/types.h>
|
|
19
|
|
20
|
|
21 #include "Wlib.h"
|
|
22 #include "defs.h"
|
|
23 #include "struct.h"
|
|
24 #include "data.h"
|
|
25
|
|
26 #ifdef SVR4
|
|
27 #include <string.h>
|
|
28 #else
|
|
29 #include <strings.h>
|
|
30 #endif
|
|
31
|
|
32
|
|
33 /* this is a set of routines that makes up a multi column help window,
|
|
34 ** and shows just what the keymaps current keymap representation of the
|
|
35 ** keys are.
|
|
36 **
|
|
37 ** fillhelp() handles the filling in if the strings for the help window
|
|
38 ** update_Help_to_Keymap() checks the keymap and sets it up in hte
|
|
39 ** help window.
|
|
40 **
|
|
41
|
|
42 **
|
|
43 ** Format for each entry is follows:
|
|
44 ** first character is the hard-coded character representation for the key
|
|
45 ** in the keymap. Useful for when you re-key things. This could confuse
|
|
46 ** people who do'nt know the keymap format.
|
|
47 **
|
|
48 ** the next few spaces are either spaces or keys that also do that
|
|
49 ** function. Note that if you have more than 3 keys set to do the same
|
|
50 ** thing, they will not be displayed.
|
|
51 ** So, you could, I suppose map everything to 'Q' and it would not
|
|
52 ** show, but that's a pretty bizarre situation.
|
|
53 **
|
|
54
|
|
55 **
|
|
56 ** Bugs & Comments:
|
|
57 ** You have to be sure that helpWin is defined to be big enough to handle
|
|
58 ** all the messages. That's pretty much a trial&error by-hand thing
|
|
59 ** at this point
|
|
60 **
|
|
61 ** BZZZT! Not anymore, done automatically [BDyess]
|
|
62 */
|
|
63
|
|
64 /* fills in the help window to note all keys also mapped to the
|
|
65 ** listed functions
|
|
66 */
|
|
67 void update_Help_to_Keymap();
|
|
68
|
|
69 char *help_message[] =
|
|
70 {
|
|
71 " 0 Set speed 0",
|
|
72 " 1 Set speed 1",
|
|
73 " 2 Set speed 2",
|
|
74 " 3 Set speed 3",
|
|
75 " 4 Set speed 4",
|
|
76 " 5 Set speed 5",
|
|
77 " 6 Set speed 6",
|
|
78 " 7 Set speed 7",
|
|
79 " 8 Set speed 8",
|
|
80 " 9 Set speed 9",
|
|
81 "^0 Set speed 10",
|
|
82 "^1 Set speed 11",
|
|
83 "^2 Set speed 12",
|
|
84 "^3 Set speed 13",
|
|
85 "^4 Set speed 14",
|
|
86 "^5 Set speed 15",
|
|
87 "^6 Set speed 16",
|
|
88 "^7 Set speed 17",
|
|
89 "^8 Set speed 18",
|
|
90 "^9 Set speed 19",
|
|
91 "^) Set speed 20",
|
|
92 "^! Set speed 21",
|
|
93 "^@ Set speed 22",
|
|
94 "^# Set speed 23",
|
|
95 "^$ Set speed 24",
|
|
96 "^% Set speed 25",
|
|
97 "^^ Set speed 26",
|
|
98 "^& Set speed 27",
|
|
99 "^* Set speed 28",
|
|
100 "^( Set speed 29",
|
|
101 " % speed = maximum",
|
|
102 " # speed = 1/2 maximum",
|
|
103 " < slow speed 1",
|
|
104 " > speed up 1",
|
|
105 " ` Afterburners",
|
|
106 " - Engage warp",
|
|
107 " k Set course",
|
|
108 " p Fire phaser",
|
|
109 " t Fire photon torpedo",
|
|
110 " f Fire plasma torpedo",
|
|
111 " C Switch special weapon",
|
|
112 " d detonate enemy torps",
|
|
113 " D detonate own torps",
|
|
114 " L List players",
|
|
115 " P List planets",
|
|
116 " S Status graph toggle",
|
|
117 " ] Put up shields",
|
|
118 " [ Put down shields",
|
|
119 " u Shield toggle",
|
|
120 " s Shield toggle",
|
|
121 " i Info on player/planet",
|
|
122 " I Extended info on player",
|
|
123 "^i Info on a planet",
|
|
124 " b Bomb planet",
|
|
125 " z Beam up armies",
|
|
126 " x Beam down armies",
|
|
127 " { Cloak",
|
|
128 " } Uncloak",
|
|
129 " T Toggle tractor beam",
|
|
130 " y Toggle pressor beam",
|
|
131 " _ Turn on tractor beam",
|
|
132 " ^ Turn on pressor beam",
|
|
133 " $ Turn off tractor/pressor beam",
|
|
134 " R Enter repair mode",
|
|
135 " o Orbit planet or dock to outpost",
|
|
136 " e Docking permission toggle",
|
|
137 " r Refit (change ship type)",
|
|
138 " Q Quit",
|
|
139 " q Fast Quit",
|
|
140 " ? Message window toggle",
|
|
141 " c Cloaking device toggle",
|
|
142 " l Lock on to player/planet",
|
|
143 " ; Lock on to planet",
|
|
144 " h Help window toggle",
|
|
145 " w War declarations window",
|
|
146 " N Planet names toggle",
|
|
147 " V Rotate local planet display",
|
|
148 " B Rotate galactic planet display",
|
|
149 " * Send in practice robot",
|
|
150 " E Send Distress signal",
|
|
151 " F Send armies carried report",
|
|
152 " U Show rankings window",
|
|
153 " m Message Window Zoom",
|
|
154 " ' Message Zoom + start to Team",
|
|
155 " / Toggle sorted player list",
|
|
156 " : Toggle message logging",
|
|
157 " ! activate kitchen sink",
|
|
158 " + Show UDP options window",
|
|
159 " = Update all",
|
|
160 " , Ping stats window",
|
|
161 " M Show MOTD window",
|
|
162 #if 0
|
|
163 " . NetstatWindow",
|
|
164 " \\ LagMeter",
|
|
165 #endif
|
|
166
|
|
167 #ifdef SHORT_PACKETS
|
|
168 " ~ Toggle PacketWindow",
|
|
169 " \\ Update small",
|
|
170 " | Update medium",
|
|
171 #endif /* SHORT_PACKETS */
|
|
172
|
|
173 " (space) Unmap special windows",
|
|
174
|
|
175 #ifdef TIMER
|
|
176 " @ Reset dashboard timer",
|
|
177 "^t Cycle timer",
|
|
178 #endif /* TIMER */
|
|
179 "^m Toggle map zoom",
|
|
180 #ifdef WIDE_PLIST
|
|
181 " K Cycle playerlist",
|
|
182 #endif /* WIDE_PLIST */
|
|
183
|
|
184 #ifdef MACROS
|
|
185 " X Enter Macro Mode",
|
|
186 " X? Show current Macros",
|
|
187 #endif /* MACROS */
|
|
188
|
|
189 " & Reread .paradiserc",
|
|
190 " ) Rotate galaxy clockwise",
|
|
191 " ( Rotate galaxy counter-clockwise",
|
|
192 #ifdef RECORDER
|
|
193 "^r Stop recording",
|
|
194 #endif
|
|
195 #ifdef SOUND
|
|
196 "^s Sound window toggle",
|
|
197 #endif
|
|
198 #ifdef TOOLS
|
|
199 " \" Toggle shell tools window",
|
|
200 #endif
|
|
201 #ifdef AMIGA
|
|
202 " A Flush queued speech",
|
|
203 "HELP Show Amiga keys/info",
|
|
204 #endif
|
|
205 0
|
|
206 };
|
|
207
|
|
208 int helpmessages = (sizeof(help_message) / sizeof(char *));
|
|
209 /* this is the number of help messages there are */
|
|
210
|
|
211 #define MAXHELP 40
|
|
212 /* maximum length in characters of key explanation */
|
|
213
|
|
214
|
|
215 void
|
|
216 fillhelp()
|
|
217 {
|
|
218 register int i = 0, row, column;
|
|
219 char helpmessage[MAXHELP];
|
|
220
|
|
221
|
|
222 /* 4 column help window. THis may be changed depending on font size */
|
|
223 for (column = 0; column < 4; column++) {
|
|
224 for (row = 1; row < helpmessages / 4 + 2; row++) {
|
|
225 if (help_message[i] == 0)
|
|
226 break;
|
|
227 else {
|
|
228 strcpy(helpmessage, help_message[i]);
|
|
229 update_Help_to_Keymap(helpmessage);
|
|
230 W_WriteText(helpWin, MAXHELP * column, row - 1, textColor,
|
|
231 helpmessage, strlen(helpmessage), W_RegularFont);
|
|
232 i++;
|
|
233 }
|
|
234 }
|
|
235 if (help_message[i] == 0)
|
|
236 break;
|
|
237 }
|
|
238 }
|
|
239
|
|
240
|
|
241 /* this takes the help messages and puts in the keymap, so the player can
|
|
242 * see just what does what!
|
|
243 *
|
|
244 * ordinary format: "U Show rankings window",
|
|
245 * translatedd here to "[ sE Computer options window",
|
|
246 */
|
|
247 void
|
|
248 update_Help_to_Keymap(helpmessage)
|
|
249 char helpmessage[];
|
|
250 {
|
|
251 int i, num_mapped = 0, key;
|
|
252
|
|
253 key = helpmessage[1];
|
|
254 if (helpmessage[0] == '^') {
|
|
255 /* control character */
|
|
256 key += 128;
|
|
257 }
|
|
258 if ((int) strlen(helpmessage) < 6) {
|
|
259 return;
|
|
260 }
|
|
261 for (i = 0; i < 256; i++) {
|
|
262 if (myship->s_keymap[i] != key)
|
|
263 continue;
|
|
264 if (i == key)
|
|
265 continue; /* it's already there! don't add it! */
|
|
266
|
|
267 /* we've found a key mapped to key! */
|
|
268 /* the key is i */
|
|
269 num_mapped += 1 + (i > 127) ? 1 : 0;
|
|
270 if (num_mapped > 3)
|
|
271 continue; /* we've found too many! */
|
|
272
|
|
273 /* put the key in the string */
|
|
274 if (i > 127) {
|
|
275 helpmessage[1 + num_mapped] = '^';
|
|
276 helpmessage[2 + num_mapped] = i - 128;
|
|
277 } else {
|
|
278 helpmessage[2 + num_mapped] = i;
|
|
279 }
|
|
280 }
|
|
281
|
|
282
|
|
283 /* clear spaces if any area available */
|
|
284 /* switch (num_mapped)
|
|
285 {
|
|
286 case 0:
|
|
287 helpmessage[3] = ' ';
|
|
288 case 1:
|
|
289 helpmessage[4] = ' ';
|
|
290 case 2:
|
|
291 helpmessage[5] = ' ';
|
|
292 case 3:
|
|
293 default:
|
|
294 helpmessage[6] = ' ';
|
|
295 }
|
|
296 */
|
|
297 return;
|
|
298 }
|