annotate helpwin.c @ 3:5a977ccbc7a9 default tip

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