]> icculus.org git repositories - taylor/freespace2.git/blob - src/gamehelp/gameplayhelp.cpp
added copyright header
[taylor/freespace2.git] / src / gamehelp / gameplayhelp.cpp
1 /*
2  * Copyright (C) Volition, Inc. 1999.  All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell 
5  * or otherwise commercially exploit the source or things you created based on
6  * the source.
7  */
8
9 /*
10  * $Logfile: /Freespace2/code/GameHelp/GameplayHelp.cpp $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * Module for displaying in-game help
16  *
17  * $Log$
18  * Revision 1.3  2002/06/09 04:41:17  relnev
19  * added copyright header
20  *
21  * Revision 1.2  2002/05/07 03:16:44  theoddone33
22  * The Great Newline Fix
23  *
24  * Revision 1.1.1.1  2002/05/03 03:28:09  root
25  * Initial import.
26  *
27  * 
28  * 8     9/08/99 2:38p Jefff
29  * sound pausing going to menu from game
30  * 
31  * 7     9/01/99 2:56p Jefff
32  * a few control key description changes
33  * 
34  * 6     7/29/99 4:43p Jefff
35  * updated for fs2 -- fixed buttons, added "press esc" text, hi-res
36  * support, the works.
37  * 
38  * 5     7/15/99 9:20a Andsager
39  * FS2_DEMO initial checkin
40  * 
41  * 4     1/30/99 5:08p Dave
42  * More new hi-res stuff.Support for nice D3D textures.
43  * 
44  * 3     10/13/98 9:28a Dave
45  * Started neatening up freespace.h. Many variables renamed and
46  * reorganized. Added AlphaColors.[h,cpp]
47  * 
48  * 2     10/07/98 10:52a Dave
49  * Initial checkin.
50  * 
51  * 1     10/07/98 10:48a Dave
52  * 
53  * 21    6/17/98 11:01a Lawrance
54  * ensure translated descriptions appear in the online help
55  * 
56  * 20    6/09/98 10:31a Hoffoss
57  * Created index numbers for all xstr() references.  Any new xstr() stuff
58  * added from here on out should be added to the end if the list.  The
59  * current list count can be found in FreeSpace.cpp (search for
60  * XSTR_SIZE).
61  * 
62  * 19    5/17/98 3:33p Lawrance
63  * Add 'target last ship to send transmission' key to online help
64  * 
65  * 18    5/15/98 8:36p Lawrance
66  * Add 'target ship that last sent transmission' target key
67  * 
68  * 17    5/09/98 4:52p Lawrance
69  * Implement padlock view (up/rear/left/right)
70  * 
71  * 16    4/27/98 10:11a Lawrance
72  * Add in disabled beep for missing buttons
73  * 
74  * 15    4/25/98 1:25p Lawrance
75  * Change screen shot key to Print Scrn
76  * 
77  * 14    4/22/98 2:50p John
78  * Made PrintScreen actually be Shift+PrintScreen.
79  * 
80  * 13    4/18/98 9:21p Lawrance
81  * show correct key binding for screen shots
82  * 
83  * 12    4/11/98 7:59p Lawrance
84  * Allow space, tab and enter to cycle through pages
85  * 
86  * 11    4/05/98 7:44p Lawrance
87  * remove obsolete 'show goals' binding
88  * 
89  * 10    4/02/98 11:40a Lawrance
90  * check for #ifdef DEMO instead of #ifdef DEMO_RELEASE
91  * 
92  * 9     4/01/98 2:22p Lawrance
93  * remove hotkey references in on-line help for demo builds
94  * 
95  * 8     3/31/98 4:57p Lawrance
96  * update text for taking a screen shot
97  * 
98  * 7     3/30/98 1:31p Lawrance
99  * Take out debug key help
100  * 
101  * 6     3/25/98 5:34p Dave
102  * First rev of multiplayer online key help.
103  * 
104  * 5     3/25/98 2:16p Dave
105  * Select random default image for newly created pilots. Fixed several
106  * multi-pause messaging bugs. Begin work on online help for multiplayer
107  * keys.
108  * 
109  * 4     3/18/98 12:03p John
110  * Marked all the new strings as externalized or not.
111  * 
112  * 3     3/16/98 5:53p Lawrance
113  * Fix bug that was causing joystick only bindings to mess up
114  * 
115  * 2     3/09/98 9:54p Lawrance
116  * integrate new art for gameplay help
117  * 
118  * 1     3/09/98 5:05p Lawrance
119  *
120  * $NoKeywords: $
121  */
122
123 #include "contexthelp.h"
124 #include "gamesequence.h"
125 #include "freespace.h"
126 #include "key.h"
127 #include "bmpman.h"
128 #include "2d.h"
129 #include "timer.h"
130 #include "math.h"
131 #include "mouse.h"
132 #include "controlsconfig.h"
133 #include "ui.h"
134 #include "gamesnd.h"
135 #include "missionscreencommon.h"
136 #include "alphacolors.h"
137 #include "beam.h"
138 #include "audiostr.h"
139
140 // text positioning constats
141 #define TITLE_Y                 35
142 #define Y_START                 70
143 #define X_OFFSET_1              70
144
145 // pixel offset for description of key from where key binding starts
146 #define KEY_DESCRIPTION_OFFSET  193     
147
148 // different gameplay help pages
149 #define GP_FIRST_SCREEN                                                                 0               // keep up to date
150
151 #define GP_HELP_BASIC_KEYS                                                              0
152 #define GP_HELP_MOVEMENT_KEYS                                                   1
153 #define GP_HELP_COMMON_TARGET_KEYS                                      2
154 #define GP_HELP_ADVANCED_TARGET_KEYS                            3
155 #define GP_HELP_MESSAGING                                                               4
156 #define GP_HELP_WEAPON_KEYS                                                     5
157 #define GP_HELP_THROTTLE_AND_ETS_KEYS                           6
158 #define GP_HELP_VIEW_KEYS                                                               7
159 #define GP_HELP_MISC_KEYS                                                               8
160 #define GP_HELP_MULTI_KEYS                                                              9
161
162 #define GP_LAST_SCREEN_SINGLE                                                   8               // keep up to date
163 #define GP_LAST_SCREEN_MULTI                                                    9               // keep up to date
164
165 // set this to GP_LAST_SCREEN_SINGLE or GP_LAST_SCREEN_MULTI based upon what game mode we're in
166 int Gp_last_screen;
167
168 #define NUM_BUTTONS                                             3
169 #define PREVIOUS_PAGE_BUTTON                    0
170 #define NEXT_PAGE_BUTTON                                1
171 #define CONTINUE_BUTTON                                 2
172
173 struct gameplay_help_buttons {
174         char *filename;
175         int x, y;
176         int hotspot;
177         int tab;
178         int flags;
179         UI_BUTTON button;  // because we have a class inside this struct, we need the constructor below..
180
181         gameplay_help_buttons(char *name, int x1, int y1, int h) : filename(name), x(x1), y(y1), hotspot(h) {}
182 };
183
184 static gameplay_help_buttons Buttons[GR_NUM_RESOLUTIONS][NUM_BUTTONS] = {
185 //XSTR:OFF
186         {
187                 gameplay_help_buttons("F1B_00", 15,     389,    0),
188                 gameplay_help_buttons("F1B_01", 60,     389,    1),
189                 gameplay_help_buttons("F1B_02", 574,    431,    2)
190         },
191         {
192                 gameplay_help_buttons("2_F1B_00",       24,     622,    0),
193                 gameplay_help_buttons("2_F1B_01",       96,     622,    1),
194                 gameplay_help_buttons("2_F1B_02",       919,    689,    2)
195         },
196 //XSTR:ON
197 };
198
199 #define GAME_HELP_NUM_TEXT              2
200 static UI_XSTR Game_help_text[GR_NUM_RESOLUTIONS][GAME_HELP_NUM_TEXT] = {
201         { // GR_640
202                 { "Press ESC to return to the game",    1441,   263,    389,    UI_XSTR_COLOR_GREEN, -1, NULL },
203                 { "Continue",           1069,           571,    413,    UI_XSTR_COLOR_GREEN, -1, &Buttons[gr_screen.res][CONTINUE_BUTTON].button }
204         }, 
205         { // GR_1024
206                 { "Press ESC to return to the game",    1441,   421,    622,    UI_XSTR_COLOR_GREEN, -1, NULL },
207                 { "Continue",           1069,           928,    663,    UI_XSTR_COLOR_GREEN, -1, &Buttons[gr_screen.res][CONTINUE_BUTTON].button }
208         }
209 };
210
211 static char *Game_help_filename[GR_NUM_RESOLUTIONS] = {
212         "F1",
213         "2_F1"
214 };
215
216 static char *Game_help_mask_filename[GR_NUM_RESOLUTIONS] = {
217         "F1-m",
218         "2_F1-m"
219 };
220
221 static UI_WINDOW Ui_window;
222 static int Background_bitmap;
223 static int Gameplay_help_inited = 0;
224
225 static int Current_help_page;
226
227 // generate a line for the on-line help for a control item with specified id
228 // input:       id              =>      index for control item within Control_config[]
229 //                              buf     => buffer with enough space to hold ouput string
230 char *gameplay_help_control_text(int id, char *buf)
231 {
232         int                     has_key=0, has_joy=0;
233         config_item     *ci;
234
235         ci = &Control_config[id];
236
237         if ( ci->key_id >= 0 ) {
238                 sprintf(buf, textify_scancode(ci->key_id));
239                 has_key=1;
240         }
241
242         if ( ci->joy_id >= 0 ) {
243                 if ( has_key ) {
244                         strcat(buf, XSTR( ", ", 129));
245                 }
246                 strcat(buf, Joy_button_text[ci->joy_id]);
247                 has_joy=1;
248         }
249
250         if ( !has_key && !has_joy ) {
251                 strcpy(buf, XSTR( "no binding", 130));
252         }
253
254         strcat(buf, XSTR( " - ", 131));
255         strcat(buf, ci->text);
256
257         return buf;
258 }
259
260 void gameplay_help_blit_control_line(int x, int y, int id)
261 {
262         int                     has_key=0, has_joy=0;
263         char                    buf[256];
264         config_item     *ci;
265
266         ci = &Control_config[id];
267
268         buf[0] = 0;
269
270         if ( ci->key_id >= 0 ) {
271                 sprintf(buf, textify_scancode(ci->key_id));
272                 has_key=1;
273         }
274
275         if ( ci->joy_id >= 0 ) {
276                 if ( has_key ) {
277                         strcat(buf, XSTR( ", ", 129));
278                 }
279                 strcat(buf, Joy_button_text[ci->joy_id]);
280                 has_joy=1;
281         }
282
283         if ( !has_key && !has_joy ) {
284                 strcpy(buf, XSTR( "no binding", 130));
285         }
286
287         gr_string(x,y,buf);
288
289 //      gr_string(x+KEY_DESCRIPTION_OFFSET,y,ci->text);
290         gr_string(x+KEY_DESCRIPTION_OFFSET, y, XSTR(ci->text, CONTROL_CONFIG_XSTR + id));
291 }
292
293 void gameplay_help_blit_control_line_raw(int x, int y, char *control_text, char *control_description)
294 {
295         gr_string(x,y,control_text);
296         gr_string(x+KEY_DESCRIPTION_OFFSET,y,control_description);
297 }
298
299 // game_play_help_set_title() will display the title for the help screen and
300 // set the font for the rest of the screen
301 void gameplay_help_set_title(char *title)
302 {
303         int sy=TITLE_Y;
304         char buf[128];
305
306         gr_set_color_fast(&Color_bright);
307         gr_printf(0x8000,sy,title);
308         sprintf(buf, XSTR( "Page %d of %d", 132),  Current_help_page+1, Gp_last_screen+1);
309         gr_printf(0x8000,sy+gr_get_font_height()+2,buf);
310         gr_set_color_fast(&Color_normal);
311 }
312
313 // called once when the gameplay help state is entered
314 void gameplay_help_init()
315 {
316         int i;
317         gameplay_help_buttons *b;
318
319         if ( Gameplay_help_inited ) {
320                 return;
321         }
322
323         common_set_interface_palette("InterfacePalette");  // set the interface palette
324         Ui_window.create(0, 0, gr_screen.max_w, gr_screen.max_h, 0);
325         Ui_window.set_mask_bmap(Game_help_mask_filename[gr_screen.res]);
326
327         for (i=0; i<NUM_BUTTONS; i++) {
328                 b = &Buttons[gr_screen.res][i];
329
330                 b->button.create(&Ui_window, "", b->x, b->y, 60, 30, 0, 1);
331                 // set up callback for when a mouse first goes over a button
332                 b->button.set_highlight_action(common_play_highlight_sound);
333                 b->button.set_bmaps(b->filename);
334                 b->button.link_hotspot(b->hotspot);
335         }
336
337         // add all xstrs
338         for (i=0; i<GAME_HELP_NUM_TEXT; i++)
339         {
340                 Ui_window.add_XSTR(&Game_help_text[gr_screen.res][i]);
341         }
342
343         // set the proper last screen # based upon game mode
344         if(Game_mode & GM_MULTIPLAYER){
345                 Gp_last_screen = GP_LAST_SCREEN_MULTI;
346         } else {
347                 Gp_last_screen = GP_LAST_SCREEN_SINGLE;
348         }
349
350         // setup hotkeys so lights flash when keys are pressed
351         Buttons[gr_screen.res][CONTINUE_BUTTON].button.set_hotkey(KEY_CTRLED | KEY_ENTER);
352         Buttons[gr_screen.res][PREVIOUS_PAGE_BUTTON].button.set_hotkey(KEY_LEFT);
353         Buttons[gr_screen.res][NEXT_PAGE_BUTTON].button.set_hotkey(KEY_RIGHT);
354
355         Background_bitmap = bm_load(Game_help_filename[gr_screen.res]);
356
357         Current_help_page = GP_HELP_BASIC_KEYS;
358         Gameplay_help_inited = 1;
359 }
360
361 // called when moving to the previous help page
362 void gameplay_help_goto_prev_screen()
363 {
364         Current_help_page--;
365         if (Current_help_page < GP_FIRST_SCREEN) {
366                 Current_help_page = Gp_last_screen;
367         }
368         gamesnd_play_iface(SND_SWITCH_SCREENS);
369
370 }
371
372 // called when proceeding to the next help page
373 void gameplay_help_goto_next_screen()
374 {
375         Current_help_page++;
376         if (Current_help_page > Gp_last_screen) {
377                 Current_help_page = GP_FIRST_SCREEN;
378         }
379         gamesnd_play_iface(SND_SWITCH_SCREENS);
380 }
381
382 // called when the screen is exited
383 void gameplay_help_leave()
384 {
385         // unpause all game sounds
386         beam_unpause_sounds();
387         audiostream_unpause_all();
388
389         gameseq_post_event(GS_EVENT_PREVIOUS_STATE);
390         game_flush();
391 }
392
393 // deal with a keypress on the gameplay help screen
394 void gameplay_help_process_key(int k)
395 {
396         switch ( k ) {
397                 case KEY_ESC:
398                         gameplay_help_leave();
399                         break;
400
401                 case KEY_ENTER:
402                 case KEY_SPACEBAR:
403                 case KEY_TAB:
404                         //gameplay_help_goto_next_screen();
405                         Buttons[gr_screen.res][NEXT_PAGE_BUTTON].button.press_button();
406                         break;
407
408                 case KEY_SHIFTED | KEY_TAB:
409                         Buttons[gr_screen.res][PREVIOUS_PAGE_BUTTON].button.press_button();
410 //                      gameplay_help_goto_prev_screen();
411                         break;
412
413                 default:
414                         break;
415
416         } // end switch
417 }
418
419 // deal with buttons being pressed on the gameplay help screen
420 void gameplay_help_button_pressed(int n)
421 {
422         switch (n) {
423
424         case PREVIOUS_PAGE_BUTTON:
425                 gameplay_help_goto_prev_screen();
426                 break;
427
428         case NEXT_PAGE_BUTTON:
429                 gameplay_help_goto_next_screen();
430                 break;
431
432         case CONTINUE_BUTTON:
433                 gameplay_help_leave();
434                 gamesnd_play_iface(SND_COMMIT_PRESSED);
435                 break;
436
437         default:
438                 Int3();
439                 break;
440         }
441 }
442
443 // Draw the help text onto the screen
444 void gameplay_help_draw_text()
445 {
446         int x_offset, y_offset, separation;
447
448         separation = gr_get_font_height() + 3;
449
450         switch ( Current_help_page ) {
451
452                 case GP_HELP_BASIC_KEYS:
453                         gameplay_help_set_title(XSTR( "Basic Keys", 133));
454                         x_offset=X_OFFSET_1;
455                         y_offset=Y_START;
456
457                         y_offset += separation;
458                         gameplay_help_blit_control_line(x_offset, y_offset,END_MISSION);
459
460                         y_offset += separation;
461                         gameplay_help_blit_control_line(x_offset, y_offset,FIRE_PRIMARY);
462
463                         y_offset += separation;
464                         gameplay_help_blit_control_line(x_offset, y_offset,MAX_THROTTLE);
465
466                         y_offset += separation;
467                         gameplay_help_blit_control_line(x_offset, y_offset,ZERO_THROTTLE);
468
469                         y_offset += separation;
470                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_NEXT);
471
472                         y_offset += separation;
473                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_PREV);
474
475                         y_offset += separation;
476                         gameplay_help_blit_control_line(x_offset, y_offset,TOGGLE_AUTO_TARGETING);
477
478                         y_offset += separation;
479                         y_offset += separation;
480
481                         gr_set_color_fast(&Color_bright);
482                         gr_printf(0x8000,y_offset,XSTR( "Function Keys", 134));
483                         gr_set_color_fast(&Color_normal);
484
485                         y_offset += separation;
486                         y_offset += separation;
487
488                         gameplay_help_blit_control_line_raw(x_offset,y_offset, XSTR( "F1", 135), XSTR( "context-sensitive help", 136));
489
490                         y_offset += separation;
491                         gameplay_help_blit_control_line_raw(x_offset,y_offset, XSTR( "F2", 137), XSTR( "options screen (available anywhere in game)", 138));
492
493                         #ifndef FS2_DEMO
494                         y_offset += separation;
495                         gameplay_help_blit_control_line_raw(x_offset,y_offset, XSTR( "F3", 139), XSTR( "hotkey assignment", 140));
496                         #endif
497
498                         y_offset += separation;
499                         gameplay_help_blit_control_line_raw(x_offset,y_offset, XSTR( "F4", 141), XSTR( "HUD message scroll-back", 142));
500
501                         #ifndef FS2_DEMO
502                         y_offset += separation;
503                         gameplay_help_blit_control_line_raw(x_offset,y_offset, XSTR( "F5...F12", 143), XSTR( "hotkeys", 144));
504                         #endif
505
506                         y_offset += separation;
507                         gameplay_help_blit_control_line_raw(x_offset,y_offset, XSTR( "Shift-Esc", 145), XSTR( "quit FreeSpace 2 immediately", 146));
508
509                         break;
510
511                 case GP_HELP_MOVEMENT_KEYS:
512                         gameplay_help_set_title(XSTR( "Movement Keys", 147));
513                         x_offset=X_OFFSET_1;
514                         y_offset=Y_START;
515
516                         gameplay_help_blit_control_line(x_offset, y_offset,FORWARD_THRUST);
517
518                         y_offset += separation;
519                         gameplay_help_blit_control_line(x_offset, y_offset,MAX_THROTTLE);
520
521                         y_offset += separation;
522                         gameplay_help_blit_control_line(x_offset, y_offset,ONE_THIRD_THROTTLE);
523
524                         y_offset += separation;
525                         gameplay_help_blit_control_line(x_offset, y_offset,TWO_THIRDS_THROTTLE);
526
527                         y_offset += separation;
528                         gameplay_help_blit_control_line(x_offset, y_offset,MINUS_5_PERCENT_THROTTLE);
529
530                         y_offset += separation;
531                         gameplay_help_blit_control_line(x_offset, y_offset,PLUS_5_PERCENT_THROTTLE);
532
533                         y_offset += separation;
534                         gameplay_help_blit_control_line(x_offset, y_offset,ZERO_THROTTLE);
535
536                         y_offset += separation;
537                         gameplay_help_blit_control_line(x_offset, y_offset,AFTERBURNER);
538
539                         y_offset += separation;
540                         gameplay_help_blit_control_line(x_offset, y_offset,REVERSE_THRUST);
541
542                         y_offset += separation;
543                         gameplay_help_blit_control_line(x_offset, y_offset,PITCH_FORWARD);
544
545                         y_offset += separation;
546                         gameplay_help_blit_control_line(x_offset, y_offset,PITCH_BACK);
547
548                         y_offset += separation;
549                         gameplay_help_blit_control_line(x_offset, y_offset,YAW_LEFT);
550
551                         y_offset += separation;
552                         gameplay_help_blit_control_line(x_offset, y_offset,YAW_RIGHT);
553
554                         y_offset += separation;
555                         gameplay_help_blit_control_line(x_offset, y_offset,BANK_LEFT);
556
557                         y_offset += separation;
558                         gameplay_help_blit_control_line(x_offset, y_offset,BANK_RIGHT);
559
560                         y_offset += separation;
561                         gameplay_help_blit_control_line(x_offset, y_offset,BANK_WHEN_PRESSED);
562                         break;
563
564                 case GP_HELP_COMMON_TARGET_KEYS:
565                         gameplay_help_set_title(XSTR( "Basic Targeting Keys", 148));
566                         x_offset=X_OFFSET_1;
567                         y_offset=Y_START;
568
569                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_NEXT);
570
571                         y_offset += separation;
572                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_PREV);
573
574                         y_offset += separation;
575                         gameplay_help_blit_control_line(x_offset, y_offset,TOGGLE_AUTO_TARGETING);
576
577                         y_offset += separation;
578                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_SHIP_IN_RETICLE);
579
580                         y_offset += separation;
581                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_NEXT_CLOSEST_HOSTILE);
582
583                         y_offset += separation;
584                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_PREV_CLOSEST_HOSTILE);
585
586                         y_offset += separation;
587                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_NEXT_CLOSEST_FRIENDLY);
588
589                         y_offset += separation;
590                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_PREV_CLOSEST_FRIENDLY);
591
592                         y_offset += separation;
593                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_NEXT_SUBOBJECT);
594
595                         y_offset += separation;
596                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_PREV_SUBOBJECT);
597
598                         y_offset += separation;
599                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_SUBOBJECT_IN_RETICLE);
600
601                         y_offset += separation;
602                         gameplay_help_blit_control_line(x_offset, y_offset,MATCH_TARGET_SPEED);
603
604                         y_offset += separation;
605                         gameplay_help_blit_control_line(x_offset, y_offset,TOGGLE_AUTO_MATCH_TARGET_SPEED);
606                         break;
607
608                 case GP_HELP_ADVANCED_TARGET_KEYS:
609                         gameplay_help_set_title(XSTR( "Advanced Targeting Keys", 149));
610                         x_offset=X_OFFSET_1;
611                         y_offset=Y_START;
612
613                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_CLOSEST_SHIP_ATTACKING_SELF);
614
615                         y_offset += separation;
616                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_CLOSEST_SHIP_ATTACKING_TARGET);
617
618                         y_offset += separation;
619                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_LAST_TRANMISSION_SENDER);
620
621                         y_offset += separation;
622                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_TARGETS_TARGET);
623
624                         y_offset += separation;
625                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_NEXT_ESCORT_SHIP);
626
627                         y_offset += separation;
628                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_CLOSEST_REPAIR_SHIP);
629
630                         y_offset += separation;
631                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_NEXT_UNINSPECTED_CARGO);
632
633                         y_offset += separation;
634                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_PREV_UNINSPECTED_CARGO);
635
636                         y_offset += separation;
637                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_NEWEST_SHIP);
638
639                         y_offset += separation;
640                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_NEXT_BOMB);
641
642                         y_offset += separation;
643                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_PREV_BOMB);
644
645                         y_offset += separation;
646                         gameplay_help_blit_control_line(x_offset, y_offset,STOP_TARGETING_SHIP);
647
648                         y_offset += separation;
649                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_NEXT_LIVE_TURRET);
650
651                         y_offset += separation;
652                         gameplay_help_blit_control_line(x_offset, y_offset,TARGET_PREV_LIVE_TURRET);
653
654                         y_offset += separation;
655                         gameplay_help_blit_control_line(x_offset, y_offset,STOP_TARGETING_SUBSYSTEM);
656
657                         #ifndef FS2_DEMO
658
659                         y_offset += separation;
660                         gameplay_help_blit_control_line_raw(x_offset, y_offset, XSTR( "F5...F12", 143), XSTR( "Select target assigned to that hotkey", 150));
661
662                         y_offset += separation;
663                         gameplay_help_blit_control_line_raw(x_offset, y_offset, XSTR( "Shift-F5...F12", 151), XSTR( "Add/remove target from that hotkey", 152));
664
665                         y_offset += separation;
666                         gameplay_help_blit_control_line_raw(x_offset, y_offset, XSTR( "Alt-Shift-F5...F12", 153), XSTR( "Clear that hotkey", 154));
667
668                         #endif
669
670                         break;
671
672                 case GP_HELP_MESSAGING:
673                         gameplay_help_set_title(XSTR( "Messaging Keys", 155));
674                         x_offset=X_OFFSET_1;
675                         y_offset=Y_START;
676
677                         gameplay_help_blit_control_line(x_offset, y_offset,SQUADMSG_MENU);
678
679                         y_offset += separation;
680                         gameplay_help_blit_control_line(x_offset, y_offset,REARM_MESSAGE);
681
682                         y_offset += separation;
683                         gameplay_help_blit_control_line(x_offset, y_offset,ATTACK_MESSAGE);
684
685                         y_offset += separation;
686                         gameplay_help_blit_control_line(x_offset, y_offset,DISARM_MESSAGE);
687
688                         y_offset += separation;
689                         gameplay_help_blit_control_line(x_offset, y_offset,DISABLE_MESSAGE);
690
691                         y_offset += separation;
692                         gameplay_help_blit_control_line(x_offset, y_offset,CAPTURE_MESSAGE);
693
694                         y_offset += separation;
695                         gameplay_help_blit_control_line(x_offset, y_offset,ENGAGE_MESSAGE);
696
697                         y_offset += separation;
698                         gameplay_help_blit_control_line(x_offset, y_offset,FORM_MESSAGE);
699
700                         y_offset += separation;
701                         gameplay_help_blit_control_line(x_offset, y_offset,IGNORE_MESSAGE);
702
703                         y_offset += separation;
704                         gameplay_help_blit_control_line(x_offset, y_offset,PROTECT_MESSAGE);
705
706                         y_offset += separation;
707                         gameplay_help_blit_control_line(x_offset, y_offset,COVER_MESSAGE);
708
709                         y_offset += separation;
710                         gameplay_help_blit_control_line(x_offset, y_offset,WARP_MESSAGE);
711
712                         #ifndef FS2_DEMO
713                         y_offset += separation;
714                         gameplay_help_blit_control_line_raw(x_offset, y_offset, XSTR( "F5...F12", 143), XSTR( "send specified order to these target(s)", 156));
715                         #endif
716                         break;
717
718                 case GP_HELP_WEAPON_KEYS:
719                         gameplay_help_set_title(XSTR( "Weapon Keys", 157));
720                         x_offset=X_OFFSET_1;
721                         y_offset=Y_START;
722
723                         gameplay_help_blit_control_line(x_offset, y_offset,FIRE_PRIMARY);
724
725                         y_offset += separation;
726                         gameplay_help_blit_control_line(x_offset, y_offset,FIRE_SECONDARY);
727
728                         y_offset += separation;
729                         gameplay_help_blit_control_line(x_offset, y_offset,CYCLE_NEXT_PRIMARY);
730
731                         y_offset += separation;
732                         gameplay_help_blit_control_line(x_offset, y_offset,CYCLE_PREV_PRIMARY);
733
734                         y_offset += separation;
735                         gameplay_help_blit_control_line(x_offset, y_offset,CYCLE_SECONDARY);
736
737                         y_offset += separation;
738                         gameplay_help_blit_control_line(x_offset, y_offset,CYCLE_NUM_MISSLES);
739
740                         y_offset += separation;
741                         gameplay_help_blit_control_line(x_offset, y_offset,LAUNCH_COUNTERMEASURE);
742                         break;
743
744                 case GP_HELP_THROTTLE_AND_ETS_KEYS:
745                         gameplay_help_set_title(XSTR( "Energy Management Keys", 158));
746                         x_offset=X_OFFSET_1;
747                         y_offset=Y_START;
748
749                         gameplay_help_blit_control_line(x_offset, y_offset,SHIELD_EQUALIZE);
750
751                         y_offset += separation;
752                         gameplay_help_blit_control_line(x_offset, y_offset,SHIELD_XFER_TOP);
753
754                         y_offset += separation;
755                         gameplay_help_blit_control_line(x_offset, y_offset,SHIELD_XFER_BOTTOM);
756
757                         y_offset += separation;
758                         gameplay_help_blit_control_line(x_offset, y_offset,SHIELD_XFER_LEFT);
759
760                         y_offset += separation;
761                         gameplay_help_blit_control_line(x_offset, y_offset,SHIELD_XFER_RIGHT);
762
763                         y_offset += separation;
764                         gameplay_help_blit_control_line(x_offset, y_offset,INCREASE_WEAPON);
765
766                         y_offset += separation;
767                         gameplay_help_blit_control_line(x_offset, y_offset,DECREASE_WEAPON);
768
769                         y_offset += separation;
770                         gameplay_help_blit_control_line(x_offset, y_offset,INCREASE_SHIELD);
771
772                         y_offset += separation;
773                         gameplay_help_blit_control_line(x_offset, y_offset,DECREASE_SHIELD);
774
775                         y_offset += separation;
776                         gameplay_help_blit_control_line(x_offset, y_offset,INCREASE_ENGINE);
777
778                         y_offset += separation;
779                         gameplay_help_blit_control_line(x_offset, y_offset,DECREASE_ENGINE);
780
781                         y_offset += separation;
782                         gameplay_help_blit_control_line(x_offset, y_offset,ETS_EQUALIZE);
783 /*
784                         y_offset += separation;
785                         gameplay_help_blit_control_line(x_offset, y_offset,XFER_LASER);
786
787                         y_offset += separation;
788                         gameplay_help_blit_control_line(x_offset, y_offset,XFER_SHIELD);
789 */
790                         break;
791
792                 case GP_HELP_MISC_KEYS:
793                         gameplay_help_set_title(XSTR( "Miscellaneous Keys", 159));
794                         x_offset=X_OFFSET_1;
795                         y_offset=Y_START;
796
797                         // ending mission
798                         //
799                         y_offset += separation;
800                         gameplay_help_blit_control_line(x_offset, y_offset,END_MISSION);
801
802                         y_offset += separation;
803                         gameplay_help_blit_control_line_raw(x_offset,y_offset, XSTR( "ESC", 160), XSTR( "invoke abort mission popup", 161));
804
805                         // time compression
806                         //
807                         y_offset += separation;
808                         gameplay_help_blit_control_line(x_offset, y_offset,TIME_SPEED_UP);
809
810                         y_offset += separation;
811                         gameplay_help_blit_control_line(x_offset, y_offset,TIME_SLOW_DOWN);
812
813                         // radar keys
814                         //
815                         y_offset += separation;
816                         gameplay_help_blit_control_line(x_offset, y_offset,RADAR_RANGE_CYCLE);
817
818                         // escort view keys
819                         //
820                         y_offset += separation;
821                         gameplay_help_blit_control_line(x_offset, y_offset,ADD_REMOVE_ESCORT);
822
823                         y_offset += separation;
824                         gameplay_help_blit_control_line(x_offset, y_offset,ESCORT_CLEAR);
825
826                         // Pause, Print Screenshot
827                         y_offset += separation;
828                         gameplay_help_blit_control_line_raw(x_offset,y_offset, XSTR( "Pause", 162), XSTR( "pause game", 163));            
829
830                         y_offset += separation;
831                         gameplay_help_blit_control_line_raw(x_offset,y_offset, XSTR( "Print Scrn", 164), XSTR( "take screen shot", 165));            
832
833                         break;
834
835                 case GP_HELP_VIEW_KEYS:
836                         gameplay_help_set_title(XSTR( "View Keys", 166));
837                         x_offset=X_OFFSET_1;
838                         y_offset=Y_START;
839
840                         gameplay_help_blit_control_line(x_offset, y_offset,PADLOCK_UP);
841
842                         y_offset += separation;
843                         gameplay_help_blit_control_line(x_offset, y_offset,PADLOCK_DOWN);
844
845                         y_offset += separation;
846                         gameplay_help_blit_control_line(x_offset, y_offset,PADLOCK_LEFT);
847
848                         y_offset += separation;
849                         gameplay_help_blit_control_line(x_offset, y_offset,PADLOCK_RIGHT);
850
851                         y_offset += separation;
852                         gameplay_help_blit_control_line(x_offset, y_offset,VIEW_CHASE);
853
854                         y_offset += separation;
855                         gameplay_help_blit_control_line(x_offset, y_offset,VIEW_EXTERNAL);
856
857                         y_offset += separation;
858                         gameplay_help_blit_control_line(x_offset, y_offset,VIEW_EXTERNAL_TOGGLE_CAMERA_LOCK);
859
860                         y_offset += separation;
861                         gameplay_help_blit_control_line(x_offset, y_offset,VIEW_SLEW);
862
863                         y_offset += separation;
864                         gameplay_help_blit_control_line(x_offset, y_offset,VIEW_DIST_INCREASE);
865
866                         y_offset += separation;
867                         gameplay_help_blit_control_line(x_offset, y_offset,VIEW_DIST_DECREASE);
868
869                         y_offset += separation;
870                         gameplay_help_blit_control_line(x_offset, y_offset,VIEW_CENTER);
871
872                         y_offset += separation;
873                         gameplay_help_blit_control_line(x_offset, y_offset,VIEW_OTHER_SHIP);
874                         break;
875
876                 case GP_HELP_MULTI_KEYS:
877                         gameplay_help_set_title(XSTR( "Multiplayer Keys", 167));
878                         x_offset=X_OFFSET_1;
879                         y_offset=Y_START;
880
881                         // ingame messaging
882                         gr_set_color_fast(&Color_bright);
883                         gr_printf(0x8000,y_offset,XSTR( "Ingame messaging keys (tap for text, hold for voice)", 168));
884                         gr_set_color_fast(&Color_normal);
885                         
886                         y_offset += separation;
887                         
888                         y_offset += separation;
889                         gameplay_help_blit_control_line(x_offset, y_offset,MULTI_MESSAGE_ALL);
890
891                         y_offset += separation;
892                         gameplay_help_blit_control_line(x_offset, y_offset,MULTI_MESSAGE_FRIENDLY);
893
894                         y_offset += separation;
895                         gameplay_help_blit_control_line(x_offset, y_offset,MULTI_MESSAGE_HOSTILE);
896
897                         y_offset += separation;
898                         gameplay_help_blit_control_line(x_offset, y_offset,MULTI_MESSAGE_TARGET);
899
900                         break;
901
902         } //    end switch              
903 }
904
905 // gameplay_help_do_frame() is the function that displays help when acutally playing the game
906 void gameplay_help_do_frame(float frametime)
907 {
908         int i, k;       
909
910         // ensure the gameplay help interface has been initialized
911         if (!Gameplay_help_inited) {
912                 Int3();
913                 return;
914         }
915
916         // make sure game sounds are paused
917         beam_pause_sounds();
918         audiostream_pause_all();
919
920         k = Ui_window.process() & ~KEY_DEBUGGED;
921         gameplay_help_process_key(k);
922
923         for (i=0; i<NUM_BUTTONS; i++){
924                 if (Buttons[gr_screen.res][i].button.pressed()){
925                         gameplay_help_button_pressed(i);
926                 }
927         }
928         
929         GR_MAYBE_CLEAR_RES(Background_bitmap);
930         if (Background_bitmap >= 0) {
931                 gr_set_bitmap(Background_bitmap);
932                 gr_bitmap(0, 0);
933         }
934
935         Ui_window.draw();
936
937         gameplay_help_draw_text();
938         gr_flip();
939 }
940
941
942 // called once when leaving the gameplay help state
943 void gameplay_help_close()
944 {
945         if ( Gameplay_help_inited ) {
946                 if (Background_bitmap >= 0) {
947                         bm_unload(Background_bitmap);
948                 }
949
950                 Ui_window.destroy();
951                 common_free_interface_palette();                // restore game palette
952                 game_flush();
953         }
954
955         Gameplay_help_inited = 0;
956 }
957