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