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