FS2_Open
Open source remastering of the Freespace 2 engine
missionhotkey.cpp
Go to the documentation of this file.
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 the
6  * source.
7  *
8 */
9 
10 
11 
12 #include "freespace2/freespace.h"
13 #include "gamehelp/contexthelp.h"
15 #include "gamesnd/gamesnd.h"
16 #include "globalincs/alphacolors.h"
17 #include "globalincs/linklist.h"
18 #include "globalincs/pstypes.h"
19 #include "graphics/font.h"
20 #include "iff_defs/iff_defs.h"
21 #include "io/key.h"
22 #include "io/timer.h"
23 #include "mission/missionhotkey.h"
25 #include "object/object.h"
26 #include "parse/parselo.h"
27 #include "playerman/player.h"
28 #include "ship/ship.h"
29 #include "sound/audiostr.h"
30 #include "ui/ui.h"
31 #include "ui/uidefs.h"
32 #include "weapon/weapon.h"
33 
34 
35 static int Key_sets[MAX_KEYED_TARGETS] = {
36  KEY_F5,
37  KEY_F6,
38  KEY_F7,
39  KEY_F8,
40  KEY_F9,
41  KEY_F10,
42  KEY_F11,
43  KEY_F12
44 };
45 
47 
48 static int Hotkey_bits[MAX_SHIPS]; // bitfield indicating which hotkeys are used by each ship
49 
50 static int Hotkey_sets_saved; // have we saved the sets for this mission
51 
52 static int Mission_hotkey_save_timestamp; // timestamp used to tell us when we can save
53 #define HOTKEY_SAVE_TIME 15000 // save sets this number of milliseconds into the mission
54 
55 typedef struct {
56  int setnum;
58 } HK_save_info;
59 
62 
63 
64 static char *Hotkey_background_fname[GR_NUM_RESOLUTIONS] = {
65  "Hotkeys", // GR_640
66  "2_Hotkeys" // GR_1024
67 };
68 
69 static char *Hotkey_mask_fname[GR_NUM_RESOLUTIONS] = {
70  "Hotkeys-M", // GR_640
71  "2_Hotkeys-M" // GR_1024
72 };
73 
74 //#define GROUP_LIST_X 40
75 //#define GROUP_LIST_W 160
76 
77 // #define ICON_LIST_X 219
78 // #define ICON_LIST_W 8
79 
80 // #define ICON_LIST_X 280
81 // #define ICON_LIST_W 8
82 
83 //#define SHIP_LIST_X 242
84 //#define SHIP_LIST_X2 259
85 //#define SHIP_LIST_W 341
86 //#define SHIP_LIST_W2 324
87 
88 // #define SHIP_LIST_X 302
89 // #define SHIP_LIST_X2 319
90 // #define SHIP_LIST_W 281
91 // #define SHIP_LIST_W2 264
92 
93 // #define LIST_Y 70
94 // #define LIST_H 280
95 
96 /*
97 #define HOTKEY_X 575
98 #define HOTKEY_Y 41
99 */
100 
101 #define HOTKEY_LINE_HEADING 1
102 #define HOTKEY_LINE_WING 2
103 #define HOTKEY_LINE_SHIP 3
104 #define HOTKEY_LINE_SUBSHIP 4 // ship that is in a wing
105 
106 #define WING_FLAG 0x80000
107 
108 #define MAX_LINES 200
109 #define NUM_BUTTONS 10
110 #define LIST_BUTTONS_MAX 50
111 
112 #define SCROLL_UP_BUTTON 0
113 #define SCROLL_DOWN_BUTTON 1
114 #define CANCEL_BUTTON 2
115 #define CLEAR_BUTTON 3
116 #define RESET_BUTTON 4
117 #define ADD_HOTKEY_BUTTON 5
118 #define REMOVE_HOTKEY_BUTTON 6
119 #define HELP_BUTTON 7
120 #define OPTIONS_BUTTON 8
121 #define ACCEPT_BUTTON 9
122 
123 // coords for entire ship box
124 static int Hotkey_list_coords[GR_NUM_RESOLUTIONS][4] = {
125  {
126  // GR_640
127  29, // x
128  22, // y
129  502, // w
130  315 // h
131  },
132  {
133  // GR_1024
134  47, // x
135  35, // y
136  802, // w
137  505 // h
138  }
139 };
140 
141 // coords for big "F9" thing in the corner
142 static int Hotkey_function_name_coords[GR_NUM_RESOLUTIONS][4] = {
143  {
144  // GR_640
145  570, // x
146  14, // y
147  59, // w
148  22 // h
149  },
150  {
151  // GR_1024
152  912, // x
153  22, // y
154  94, // w
155  36 // h
156  }
157 };
158 
159 /*
160 #define FIELD_LEFT_EDGE 0
161 #define FIELD_F5 1
162 #define FIELD_F6 2
163 #define FIELD_F7 3
164 #define FIELD_F8 4
165 #define FIELD_F9 5
166 #define FIELD_F10 6
167 #define FIELD_F11 7
168 #define FIELD_F12 8
169 #define FIELD_ICON 9
170 #define FIELD_RIGHT_EDGE 10
171 // x coords of unseen field boundaries ( | field1 | field2 | ... | )
172 // entried will all be centered in fields except FIELD_SHIP which will be left justified
173 // an edge is named by the field on its left
174 static int Hotkey_field_edge[GR_NUM_RESOLUTIONS][11] = {
175  {
176  29, 56, 83, 110, 137, 164, 191, 218, 245, 280, 531
177  },
178  {
179  47, 91, 135, 179, 223, 267, 311, 355, 399, 448, 849
180  }
181 }
182 */
183 
184 static int Hotkey_function_field_width[GR_NUM_RESOLUTIONS] = {
185  27, // GR_640
186  44 // GR_1024
187 };
188 static int Hotkey_wing_icon_x[GR_NUM_RESOLUTIONS] = {
189  246, // GR_640
190  400 // GR_1024
191 };
192 static int Hotkey_ship_x[GR_NUM_RESOLUTIONS] = {
193  280, // GR_640
194  448 // GR_1024
195 };
196 
198  char *filename;
199  int x, y;
200  int hotspot;
201  UI_BUTTON button; // because we have a class inside this struct, we need the constructor below..
202 
203  hotkey_buttons(char *name, int x1, int y1, int h) : filename(name), x(x1), y(y1), hotspot(h) {}
204 };
205 
206 // button definitions
207 static hotkey_buttons Buttons[GR_NUM_RESOLUTIONS][NUM_BUTTONS] = {
208 //XSTR:OFF
209  {
210  // GR_640
211  hotkey_buttons("HKB_00", 1, 94, 0),
212  hotkey_buttons("HKB_01", 1, 133, 1),
213  hotkey_buttons("HKB_02", 15, 342, 2),
214  hotkey_buttons("HKB_03", 84, 342, 3),
215  hotkey_buttons("HKB_04", 161, 342, 4),
216  hotkey_buttons("HKB_05", 539, 5, 5),
217  hotkey_buttons("HKB_06", 539, 44, 6),
218  hotkey_buttons("HKB_07", 539, 431, 7),
219  hotkey_buttons("HKB_08", 539, 455, 8),
220  hotkey_buttons("HKB_09", 575, 432, 9)
221  },
222  {
223  // GR_1024
224  hotkey_buttons("2_HKB_00", 2, 150, 0),
225  hotkey_buttons("2_HKB_01", 2, 213, 1),
226  hotkey_buttons("2_HKB_02", 24, 548, 2),
227  hotkey_buttons("2_HKB_03", 135, 548, 3),
228  hotkey_buttons("2_HKB_04", 258, 548, 4),
229  hotkey_buttons("2_HKB_05", 862, 8, 5),
230  hotkey_buttons("2_HKB_06", 862, 71, 6),
231  hotkey_buttons("2_HKB_07", 863, 690, 7),
232  hotkey_buttons("2_HKB_08", 862, 728, 8),
233  hotkey_buttons("2_HKB_09", 920, 692, 9)
234  }
235 //XSTR:ON
236 };
237 
238 #define HOTKEY_NUM_TEXT 6
239 static UI_XSTR Hotkey_text[GR_NUM_RESOLUTIONS][HOTKEY_NUM_TEXT] = {
240  {
241  // GR_640
242  { "Cancel", 1516, 7, 392, UI_XSTR_COLOR_GREEN, -1, &Buttons[GR_640][CANCEL_BUTTON].button },
243  { "Clear", 1517, 85, 392, UI_XSTR_COLOR_GREEN, -1, &Buttons[GR_640][CLEAR_BUTTON].button },
244  { "Reset", 1518, 159, 392, UI_XSTR_COLOR_GREEN, -1, &Buttons[GR_640][RESET_BUTTON].button },
245  { "Help", 1519, 500, 440, UI_XSTR_COLOR_GREEN, -1, &Buttons[GR_640][HELP_BUTTON].button },
246  { "Options", 1520, 479, 464, UI_XSTR_COLOR_GREEN, -1, &Buttons[GR_640][OPTIONS_BUTTON].button },
247  { "Accept", 1521, 573, 413, UI_XSTR_COLOR_GREEN, -1, &Buttons[GR_640][ACCEPT_BUTTON].button }
248  },
249  {
250  // GR_1024
251  { "Cancel", 1516, 30, 629, UI_XSTR_COLOR_GREEN, -1, &Buttons[GR_1024][CANCEL_BUTTON].button },
252  { "Clear", 1517, 151, 629, UI_XSTR_COLOR_GREEN, -1, &Buttons[GR_1024][CLEAR_BUTTON].button },
253  { "Reset", 1518, 269, 629, UI_XSTR_COLOR_GREEN, -1, &Buttons[GR_1024][RESET_BUTTON].button },
254  { "Help", 1519, 800, 704, UI_XSTR_COLOR_GREEN, -1, &Buttons[GR_1024][HELP_BUTTON].button },
255  { "Options", 1520, 797, 743, UI_XSTR_COLOR_GREEN, -1, &Buttons[GR_1024][OPTIONS_BUTTON].button },
256  { "Accept", 1521, 902, 661, UI_XSTR_COLOR_GREEN, -1, &Buttons[GR_1024][ACCEPT_BUTTON].button }
257  }
258 };
259 
260 
261 
262 static struct {
263  const char *label;
264  int type;
265  int index;
266  int y; // Y coordinate of line
267 } Hotkey_lines[MAX_LINES];
268 
269 static int Cur_hotkey = 0;
270 static int Scroll_offset;
271 static int Num_lines;
272 static int Selected_line;
273 static int Background_bitmap;
274 static int Wing_bmp;
275 static UI_WINDOW Ui_window;
276 static UI_BUTTON List_buttons[LIST_BUTTONS_MAX]; // buttons for each line of text in list
277 //static UI_BUTTON List_region;
278 
280 
282 
283 
284 // function used in a couple of places to get the actual hotkey set number from a key value.
285 // not trivial since our current keysets (F5 - F12) do not have sequential keycodes
287 {
288  int i;
289 
290  for (i = 0; i < MAX_KEYED_TARGETS; i++ ) {
291  if ( Key_sets[i] == k ) {
292  return i;
293  }
294  }
295 
296  Int3(); // get allender
297  return 0;
298 }
299 
300 // function to maybe restore some hotkeys during the first N seconds of the mission
302 {
303  int i, index;
304 
305  for ( i = 0; i < Num_hotkeys_saved; i++ ) {
306  // don't process something that has no set
307  if ( Hotkey_saved_info[i].setnum == -1 )
308  continue;
309 
310  // the ship is present, add it to the given set.
311  index = ship_name_lookup(Hotkey_saved_info[i].name);
312  if ( index != -1 ) {
313  hud_target_hotkey_add_remove( Hotkey_saved_info[i].setnum, &Objects[Ships[index].objnum], HOTKEY_USER_ADDED );
314  Hotkey_saved_info[i].setnum = -1;
315  }
316  }
317 }
318 
319 // ---------------------------------------------------------------------
320 // mission_hotkey_set_defaults()
321 //
322 // Set up the hotkey lists for the player based on the mission designer
323 // defaults.
324 //
326 {
327  int i,j;
328  wing *wp;
329  ship *sp;
330  object *A;
331 
332  for ( i = 0; i < MAX_KEYED_TARGETS; i++ ) {
334  }
335 
336  // set the variable letting us know that we should save the hotkey sets
337  Hotkey_sets_saved = 0;
338  Mission_hotkey_save_timestamp = timestamp(HOTKEY_SAVE_TIME);
339 
340  // if we have hotkeys saved from the previous run of this mission, then simply keep the cleared
341  // sets, and let the restore code take care of it! This works because this function is currently
342  // only called from one place -- after the mission loads.
343  if ( Num_hotkeys_saved > 0 ) {
345  return;
346  }
347 
348  // Check for ships with a hotkey assigned
350  for ( A = GET_FIRST(&obj_used_list); A !=END_OF_LIST(&obj_used_list); A = GET_NEXT(A) ) {
351 
352  if ( (A == &obj_used_list) || (A->type != OBJ_SHIP) || ((Game_mode & GM_NORMAL) && (A == Player_obj)) ) {
353  continue;
354  }
355 
356  Assert(A->instance >= 0 && A->instance < MAX_SHIPS);
357  sp = &Ships[A->instance];
358 
359  if ( sp->hotkey == -1 )
360  continue;
361 
362  // if the hotkey is the last hotkey in the list, then don't add it either since this hotkey is a special
363  // marker to indicate that this ship should remain invisible in the hotkey screen until after mission
364  // starts
365  if ( sp->hotkey == MAX_KEYED_TARGETS )
366  continue;
367 
368  Assert(sp->objnum >= 0);
370  }
371 
372  // Check for wings with a hotkey assigned
373  for ( i = 0; i < Num_wings; i++ ) {
374  wp = &Wings[i];
375 
376  if ( wp->hotkey == -1 )
377  continue;
378 
379  // like ships, skip this wing if the hotkey is the last hotkey item
380  if ( wp->hotkey == MAX_KEYED_TARGETS )
381  continue;
382 
383  for ( j = 0; j < wp->current_count; j++ ) {
384  if ( wp->ship_index[j] == -1 )
385  continue;
386 
387  sp = &Ships[wp->ship_index[j]];
389  }
390  }
391 }
392 
393 // function to reset the saved hotkeys -- called when a new mission is loaded
395 {
396  Num_hotkeys_saved = 0;
397 }
398 
399 // next function called when we might want to save the hotkey sets for the player. We will save the hotkey
400 // sets N seconds into the mission
402 {
403  int i;
404  htarget_list *hitem, *plist;
405  HK_save_info *hkp;
406 
407  if ( !timestamp_elapsed(Mission_hotkey_save_timestamp) ) {
409  return;
410  }
411 
412  // no processing if we have saved them.
413  if ( Hotkey_sets_saved )
414  return;
415 
416  for ( i = 0; i < MAX_HOTKEY_TARGET_ITEMS; i++ )
417  Hotkey_saved_info[i].setnum = -1;
418 
419  Num_hotkeys_saved = 0;
420  hkp = &(Hotkey_saved_info[0]);
421 
422  for ( i = 0; i < MAX_KEYED_TARGETS; i++ ) {
423 
424  // get the list. do nothing if list is empty
425  plist = &(Player->keyed_targets[i]);
426  if ( EMPTY(plist) )
427  continue;
428 
429  for ( hitem = GET_FIRST(plist); hitem != END_OF_LIST(plist); hitem = GET_NEXT(hitem) ) {
430  Assert( Num_hotkeys_saved < MAX_HOTKEY_TARGET_ITEMS );
431  hkp->setnum = i;
432  strcpy_s( hkp->name, Ships[hitem->objp->instance].ship_name );
433  hkp++;
435  }
436  }
437 
438  Hotkey_sets_saved = 1;
439 }
440 
441 // function which gets called from MissionParse to maybe add a ship or wing to a hotkey set.
442 // this intermediate function is needed so that we don't blast over possibly saved hotkey sets
443 void mission_hotkey_mf_add( int set, int objnum, int how_to_add )
444 {
445  // if we are restoring hotkeys, and the timer hasn't elapsed, then return and let the
446  // hotkey restoration code deal with it
447  if ( Num_hotkeys_saved && !timestamp_elapsed(Mission_hotkey_save_timestamp) )
448  return;
449 
450  // we can add it to the set
451  hud_target_hotkey_add_remove( set, &Objects[objnum], how_to_add );
452 }
453 
455 {
456  htarget_list *hitem, *plist;
457  object *A;
458  int obj_valid, i;
459 
460  for ( i = 0; i < MAX_KEYED_TARGETS; i++ ) {
461  plist = &(Players[Player_num].keyed_targets[i]);
462  if ( EMPTY( plist ) ) // no items in list, then do nothing
463  continue;
464 
465  hitem = GET_FIRST(plist);
466  while ( hitem != END_OF_LIST(plist) ) {
467 
468  // ensure this object is still valid and in the obj_used_list
469  obj_valid = FALSE;
470  for ( A = GET_FIRST(&obj_used_list); A !=END_OF_LIST(&obj_used_list); A = GET_NEXT(A) ) {
471  if ( A->signature == hitem->objp->signature ) {
472  obj_valid = TRUE;
473  break;
474  }
475  }
476  if ( obj_valid == FALSE ) {
478 
479  temp = GET_NEXT(hitem);
480  list_remove( plist, hitem );
481  list_append( &htarget_free_list, hitem );
482  hitem->objp = NULL;
483  hitem = temp;
484  continue;
485  }
486  hitem = GET_NEXT( hitem );
487  } // end while
488  } // end for
489 }
490 
491 
492 // get the Hotkey_bits of a whole wing (bits must be set in all ships of wing for a hotkey bit to be set)
494 {
495  int i, total = 0xffffffff;
496 
497  Assert((n >= 0) && (n < Num_wings));
498  for (i=0; i<Wings[n].current_count; i++) {
499  int ship_index;
500 
501  // don't count the player ship for the total -- you cannot assign the player since bad things
502  // can happen on the hud.
503  ship_index = Wings[n].ship_index[i];
504  if ( &Ships[ship_index] == Player_ship )
505  continue;
506 
507  total &= Hotkey_bits[Wings[n].ship_index[i]];
508  }
509 
510  return total;
511 }
512 
513 // add a line of hotkey smuck to end of list
514 int hotkey_line_add(const char *text, int type, int index, int y)
515 {
516  if (Num_lines >= MAX_LINES)
517  return 0;
518 
519  Hotkey_lines[Num_lines].label = text;
520  Hotkey_lines[Num_lines].type = type;
521  Hotkey_lines[Num_lines].index = index;
522  Hotkey_lines[Num_lines].y = y;
523  return Num_lines++;
524 }
525 
526 // insert a line of hotkey smuck before line 'n'.
527 int hotkey_line_insert(int n, char *text, int type, int index)
528 {
529  int z;
530 
531  if (Num_lines >= MAX_LINES)
532  return 0;
533 
534  z = Num_lines++;
535  while (z > n) {
536  Hotkey_lines[z] = Hotkey_lines[z - 1];
537  z--;
538  }
539 
540  Hotkey_lines[z].label = text;
541  Hotkey_lines[z].type = type;
542  Hotkey_lines[z].index = index;
543  return z;
544 }
545 
546 // insert a line of hotkey smuck somewhere between 'start' and end of list such that it is
547 // sorted by name
548 int hotkey_line_add_sorted(char *text, int type, int index, int start)
549 {
550  int z;
551 
552  if (Num_lines >= MAX_LINES)
553  return -1;
554 
555  z = Num_lines - 1;
556  while ((z >= start) && ((Hotkey_lines[z].type == HOTKEY_LINE_SUBSHIP) || (stricmp(text, Hotkey_lines[z].label) < 0)))
557  z--;
558 
559  z++;
560  while ((z < Num_lines) && (Hotkey_lines[z].type == HOTKEY_LINE_SUBSHIP))
561  z++;
562 
563  return hotkey_line_insert(z, text, type, index);
564 }
565 
566 int hotkey_build_team_listing(int enemy_team_mask, int y, bool list_enemies)
567 {
568  ship_obj *so;
569  const char *str = NULL;
570  int i, j, s, z, start, team_mask;
571  int font_height = gr_get_font_height();
572 
573  if (list_enemies)
574  {
575  str = XSTR( "Enemy ships", 403);
576  team_mask = enemy_team_mask;
577  }
578  else
579  {
580  str = XSTR( "Friendly ships", 402);
581  team_mask = ~enemy_team_mask;
582  }
583 
584  for (i=0; i<MAX_SHIPS; i++)
585  if (iff_matches_mask(Ships[i].team, team_mask))
586  break;
587 
588  if (i >= MAX_SHIPS)
589  return y;
590 
592  y += 2;
593 
594  start = Num_lines;
595 
596  for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) {
597  int shipnum;
598 
599  // don't process non-ships, or the player ship
600  if ( (Game_mode & GM_NORMAL) && (so->objnum == OBJ_INDEX(Player_obj)) )
601  continue;
602 
603  shipnum = Objects[so->objnum].instance;
604 
605  // filter out cargo containers, navbouys, etc, and non-ships
606  if ( Ship_info[Ships[shipnum].ship_info_index].class_type < 0 || !(Ship_types[Ship_info[Ships[shipnum].ship_info_index].class_type].hud_bools & STI_HUD_HOTKEY_ON_LIST ))
607  continue;
608 
609  // don't process ships invisible to sensors, dying or departing
611  continue;
612 
613  // if a ship's hotkey is the last hotkey on the list, then maybe make the hotkey -1 if
614  // we are now in mission. Otherwise, skip this ship
615  if ( Ships[shipnum].hotkey == MAX_KEYED_TARGETS ) {
616  if ( !(Game_mode & GM_IN_MISSION) )
617  continue; // skip to next ship
618  Ships[shipnum].hotkey = -1;
619  }
620 
621  // be sure this ship isn't in a wing, and that the teams match
622  if ( iff_matches_mask(Ships[shipnum].team, team_mask) && (Ships[shipnum].wingnum < 0) ) {
623  hotkey_line_add_sorted(Ships[shipnum].ship_name, HOTKEY_LINE_SHIP, shipnum, start);
624  }
625  }
626 
627  for (i=0; i<Num_wings; i++) {
628  if (Wings[i].current_count && (Wings[i].ship_index[Wings[i].special_ship] >= 0) && iff_matches_mask(Ships[Wings[i].ship_index[Wings[i].special_ship]].team, team_mask)) {
629  // special check for the player's wing. If he's in a wing, and the only guy left, don't
630  // do anything
631  if ( (Player_ship->wingnum == i) && (Wings[i].current_count == 1) )
632  continue;
633 
634  // if a ship's hotkey is the last hotkey on the list, then maybe make the hotkey -1 if
635  // we are now in mission. Otherwise, skip this ship
636  if ( Wings[i].hotkey == MAX_KEYED_TARGETS ) {
637  if ( !(Game_mode & GM_IN_MISSION) )
638  continue; // skip to next ship
639  Wings[i].hotkey = -1;
640  }
641 
642  // don't add any wing data whose ships are hidden from sensors
643  for ( j = 0; j < Wings[i].current_count; j++ ) {
644  if ( Ships[Wings[i].ship_index[j]].flags & SF_HIDDEN_FROM_SENSORS )
645  break;
646  }
647  // if we didn't reach the end of the list, don't display the wing
648  if ( j < Wings[i].current_count )
649  continue;
650 
652  if (Wings[i].flags & WF_EXPANDED) {
653  for (j=0; j<Wings[i].current_count; j++) {
654  s = Wings[i].ship_index[j];
655  z = hotkey_line_insert(z + 1, Ships[s].ship_name, HOTKEY_LINE_SUBSHIP, s);
656  }
657  }
658  }
659  }
660 
661  for (i=start; i<Num_lines; i++) {
662  if (Hotkey_lines[i].type == HOTKEY_LINE_SUBSHIP)
663  y += font_height;
664  else
665  y += font_height + 2;
666 
667  Hotkey_lines[i].y = y;
668  }
669 
670  y += font_height + 8;
671  return y;
672 }
673 
675 {
676  int y, enemy_team_mask;
677 
678  Num_lines = y = 0;
679 
680  enemy_team_mask = iff_get_attackee_mask(Player_ship->team);
681 
682  y = hotkey_build_team_listing(enemy_team_mask, y, false);
683  y = hotkey_build_team_listing(enemy_team_mask, y, true);
684 }
685 
687 {
688  int y;
689 
690  if ((n < 0) || (n >= Num_lines))
691  return 0;
692 
693  y = Hotkey_lines[n].y - Hotkey_lines[Scroll_offset].y;
694  if ((y < 0) || (y + gr_get_font_height() > Hotkey_list_coords[gr_screen.res][3]))
695  return 0;
696 
697  return 1;
698 }
699 
701 {
702  if (Scroll_offset) {
703  Scroll_offset--;
704  Assert(Selected_line > Scroll_offset);
705  while (!hotkey_line_query_visible(Selected_line) || (Hotkey_lines[Selected_line].type == HOTKEY_LINE_HEADING))
706  Selected_line--;
707 
709 
710  } else
712 }
713 
715 {
716  if (Selected_line > 1) {
717  Selected_line--;
718  while (Hotkey_lines[Selected_line].type == HOTKEY_LINE_HEADING)
719  Selected_line--;
720 
721  if (Selected_line < Scroll_offset)
722  Scroll_offset = Selected_line;
723 
725 
726  } else
728 }
729 
731 {
732  if (Hotkey_lines[Num_lines - 1].y + gr_get_font_height() > Hotkey_lines[Scroll_offset].y + Hotkey_list_coords[gr_screen.res][3]) {
733  Scroll_offset++;
734  while (!hotkey_line_query_visible(Selected_line) || (Hotkey_lines[Selected_line].type == HOTKEY_LINE_HEADING)) {
735  Selected_line++;
736  Assert(Selected_line < Num_lines);
737  }
738 
740 
741  } else
743 }
744 
746 {
747  if (Selected_line < Num_lines - 1) {
748  Selected_line++;
749  while (Hotkey_lines[Selected_line].type == HOTKEY_LINE_HEADING)
750  Selected_line++;
751 
752  Assert(Selected_line > Scroll_offset);
753  while (!hotkey_line_query_visible(Selected_line))
754  Scroll_offset++;
755 
757 
758  } else
760 }
761 
763 {
764  int i, z;
765 
766  if (Hotkey_lines[Selected_line].type == HOTKEY_LINE_WING) {
767  i = Hotkey_lines[Selected_line].index;
768  Wings[i].flags ^= WF_EXPANDED;
770  for (z=0; z<Num_lines; z++)
771  if ((Hotkey_lines[z].type == HOTKEY_LINE_WING) && (Hotkey_lines[z].index == i)) {
772  Selected_line = z;
773  break;
774  }
775  }
776 }
777 
779 {
780  int i;
781  htarget_list *hitem, *plist;
782 
783  for (i=0; i<MAX_SHIPS; i++)
784  Hotkey_bits[i] = 0;
785 
786  for ( i=0; i<MAX_KEYED_TARGETS; i++ ) {
787  plist = &(Players[Player_num].keyed_targets[i]);
788  if ( EMPTY(plist) ) // no items in list, then do nothing
789  continue;
790 
791  for ( hitem = GET_FIRST(plist); hitem != END_OF_LIST(plist); hitem = GET_NEXT(hitem) ) {
792  Assert(hitem->objp->type == OBJ_SHIP);
793  Hotkey_bits[hitem->objp->instance] |= (1 << i);
794  }
795  }
796 }
797 
799 {
800  int i, b, z;
801 
802  z = Hotkey_lines[Selected_line].type;
803  if (z == HOTKEY_LINE_WING) {
804  z = Hotkey_lines[Selected_line].index;
805  b = ~get_wing_hotkeys(z);
806  for (i=0; i<Wings[z].current_count; i++)
807  Hotkey_bits[Wings[z].ship_index[i]] &= b;
808 
809  } else if ((z == HOTKEY_LINE_SHIP) || (z == HOTKEY_LINE_SUBSHIP)) {
810  Hotkey_bits[Hotkey_lines[Selected_line].index] = 0;
811  }
812 }
813 
815 {
816  ship_obj *so;
817  int i;
818 
819  for (i=0; i<MAX_KEYED_TARGETS; i++) {
821  for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) {
822  if ( Hotkey_bits[Objects[so->objnum].instance] & (1 << i) ) {
824  }
825  }
826  }
827 }
828 
829 void add_hotkey(int hotkey)
830 {
831  int i, z;
832 
833  z = Hotkey_lines[Selected_line].type;
834  if (z == HOTKEY_LINE_WING) {
835  z = Hotkey_lines[Selected_line].index;
836  for (i=0; i<Wings[z].current_count; i++)
837  Hotkey_bits[Wings[z].ship_index[i]] |= (1 << hotkey);
838 
839  } else if ((z == HOTKEY_LINE_SHIP) || (z == HOTKEY_LINE_SUBSHIP)) {
840  Hotkey_bits[Hotkey_lines[Selected_line].index] |= (1 << hotkey);
841  }
842 }
843 
845 {
846  int i, z;
847 
848  z = Hotkey_lines[Selected_line].type;
849  if (z == HOTKEY_LINE_WING) {
850  z = Hotkey_lines[Selected_line].index;
851  for (i=0; i<Wings[z].current_count; i++)
852  Hotkey_bits[Wings[z].ship_index[i]] &= ~(1 << Cur_hotkey);
853 
854  } else if ((z == HOTKEY_LINE_SHIP) || (z == HOTKEY_LINE_SUBSHIP)) {
855  Hotkey_bits[Hotkey_lines[Selected_line].index] &= ~(1 << Cur_hotkey);
856  }
857 }
858 
860 {
861  switch (n) {
862  case SCROLL_UP_BUTTON:
864  break;
865 
866  case SCROLL_DOWN_BUTTON:
868  break;
869 
870  case ADD_HOTKEY_BUTTON:
871  add_hotkey(Cur_hotkey);
873  break;
874 
876  remove_hotkey();
878  break;
879 
880  case ACCEPT_BUTTON:
881  save_hotkeys();
882  // fall through to CANCEL_BUTTON
883 
884  case CANCEL_BUTTON:
887  break;
888 
889  case HELP_BUTTON:
892  break;
893 
894  case OPTIONS_BUTTON:
897  break;
898 
899  case CLEAR_BUTTON:
900  clear_hotkeys();
902  break;
903 
904  case RESET_BUTTON:
905  reset_hotkeys();
907  break;
908  }
909 }
910 
911 // ---------------------------------------------------------------------
912 // mission_hotkey_init()
913 //
914 // Initialize the hotkey assignment screen system. Called when GS_STATE_HOTKEY_SCREEN
915 // is entered.
916 //
918 {
919  int i;
920  hotkey_buttons *b;
921 
922  // pause all weapon sounds
924 
925  // pause all game music
927 
928  reset_hotkeys();
929  common_set_interface_palette(); // set the interface palette
931  Ui_window.set_mask_bmap(Hotkey_mask_fname[gr_screen.res]);
932 
933  for (i=0; i<NUM_BUTTONS; i++) {
934  b = &Buttons[gr_screen.res][i];
935 
936  b->button.create(&Ui_window, "", b->x, b->y, 60, 30, i < 2 ? 1 : 0, 1);
937  // set up callback for when a mouse first goes over a button
939  b->button.set_bmaps(b->filename);
940  b->button.link_hotspot(b->hotspot);
941  }
942 
943  // add all xstr text
944  for(i=0; i<HOTKEY_NUM_TEXT; i++) {
945  Ui_window.add_XSTR(&Hotkey_text[gr_screen.res][i]);
946  }
947 
948  for (i=0; i<LIST_BUTTONS_MAX; i++) {
949  List_buttons[i].create(&Ui_window, "", 0, 0, 60, 30, (i < 2), 1);
950  List_buttons[i].hide();
951  List_buttons[i].disable();
952  }
953 
954  // set up hotkeys for buttons so we draw the correct animation frame when a key is pressed
957 
958  // ensure help overlay is off
961 
962  // load in relevant bitmaps
963  Background_bitmap = bm_load(Hotkey_background_fname[gr_screen.res]);
964  if (Background_bitmap < 0) {
965  // bitmap didnt load -- this is bad
966  Int3();
967  }
968  Wing_bmp = bm_load("WingDesignator");
969  if (Wing_bmp < 0) {
970  // bitmap didnt load -- this is bad
971  Int3();
972  }
973 
974  Scroll_offset = 0;
975  Selected_line = 1;
977 }
978 
979 // ---------------------------------------------------------------------
980 // mission_hotkey_close()
981 //
982 // Cleanup the hotkey assignment screen system. Called when GS_STATE_HOTKEY_SCREEN
983 // is left.
984 //
986 {
987  if (Background_bitmap)
988  bm_release(Background_bitmap);
989  if (Wing_bmp >= 0)
990  bm_release(Wing_bmp);
991 
992  // unpause all weapon sounds
994 
995  // unpause all game music
997 
998  Ui_window.destroy();
999  common_free_interface_palette(); // restore game palette
1000  game_flush();
1001 }
1002 
1003 // ---------------------------------------------------------------------
1004 // mission_hotkey_do_frame()
1005 //
1006 // Called once per frame to process user input for the Hotkey Assignment Screen
1007 //
1008 void mission_hotkey_do_frame(float frametime)
1009 {
1010  char buf[256];
1011  int i, k, w, h, y, z, line, hotkeys;
1012  int font_height = gr_get_font_height();
1013  int select_tease_line = -1; // line mouse is down on, but won't be selected until button released
1014  color circle_color;
1015 
1018  Ui_window.set_ignore_gadgets(1);
1019  }
1020 
1021  k = Ui_window.process() & ~KEY_DEBUGGED;
1022 
1023  if ( (k > 0) || B1_JUST_RELEASED ) {
1026  Ui_window.set_ignore_gadgets(0);
1027  k = 0;
1028  }
1029  }
1030 
1032  Ui_window.set_ignore_gadgets(0);
1033  }
1034 
1035  switch (k) {
1036  case KEY_DOWN: // scroll list down
1038  break;
1039 
1040  case KEY_UP: // scroll list up
1042  break;
1043 
1044  case KEY_PAGEDOWN: // scroll list down
1046  break;
1047 
1048  case KEY_PAGEUP: // scroll list up
1050  break;
1051 
1052  case KEY_CTRLED | KEY_ENTER:
1053  save_hotkeys();
1054  // fall through to next state -- allender changed this behavior since ESC should always cancel, no?
1055 
1056  case KEY_ESC:
1058  break;
1059 
1060  case KEY_TAB:
1061  case KEY_ENTER:
1062  case KEY_PADENTER:
1063  expand_wing();
1064  break;
1065 
1066  case KEY_EQUAL:
1067  case KEY_PADPLUS:
1068  add_hotkey(Cur_hotkey);
1069  break;
1070 
1071  case KEY_MINUS:
1072  case KEY_PADMINUS:
1073  remove_hotkey();
1074  break;
1075 
1076  case KEY_F2:
1078  break;
1079 
1080  case KEY_CTRLED | KEY_R:
1081  reset_hotkeys();
1082  break;
1083 
1084  case KEY_CTRLED | KEY_C:
1085  clear_hotkeys();
1086  break;
1087  } // end switch
1088 
1089  // ?
1090  for (i=0; i<MAX_KEYED_TARGETS; i++) {
1091  if (k == Key_sets[i])
1092  Cur_hotkey = i;
1093 
1094  if (k == (Key_sets[i] | KEY_SHIFTED))
1095  add_hotkey(i);
1096  }
1097 
1098  // handle pressed buttons
1099  for (i=0; i<NUM_BUTTONS; i++) {
1100  if (Buttons[gr_screen.res][i].button.pressed()) {
1102  break; // only need to handle 1 button @ a time
1103  }
1104  }
1105 
1106  for (i=0; i<LIST_BUTTONS_MAX; i++) {
1107  // check for tease line
1108  if (List_buttons[i].button_down()) {
1109  select_tease_line = i + Scroll_offset;
1110  }
1111 
1112  // check for selected list item
1113  if (List_buttons[i].pressed()) {
1114  Selected_line = i + Scroll_offset;
1115  List_buttons[i].get_mouse_pos(&z, NULL);
1116  z += Hotkey_list_coords[gr_screen.res][0]; // adjust to full screen space
1117  if ((z >= Hotkey_wing_icon_x[gr_screen.res]) && (z < (Hotkey_wing_icon_x[gr_screen.res]) + Hotkey_function_field_width[gr_screen.res])) {
1118  expand_wing();
1119  }
1120  }
1121 
1122  if (List_buttons[i].double_clicked()) {
1123  Selected_line = i + Scroll_offset;
1124  hotkeys = -1;
1125  switch (Hotkey_lines[Selected_line].type) {
1126  case HOTKEY_LINE_WING:
1127  hotkeys = get_wing_hotkeys(Hotkey_lines[Selected_line].index);
1128  break;
1129 
1130  case HOTKEY_LINE_SHIP:
1131  case HOTKEY_LINE_SUBSHIP:
1132  hotkeys = Hotkey_bits[Hotkey_lines[Selected_line].index];
1133  break;
1134  }
1135 
1136  if (hotkeys != -1) {
1137  if (hotkeys & (1 << Cur_hotkey))
1138  remove_hotkey();
1139  else
1140  add_hotkey(Cur_hotkey);
1141  }
1142  }
1143  }
1144 
1145  GR_MAYBE_CLEAR_RES(Background_bitmap);
1146  if (Background_bitmap >= 0) {
1147  gr_set_bitmap(Background_bitmap);
1148  gr_bitmap(0, 0, GR_RESIZE_MENU);
1149 
1150  } else
1151  gr_clear();
1152 
1153  Ui_window.draw();
1154  gr_init_color(&circle_color, 160, 160, 0);
1155 
1156  // draw the big "F10" in the little box
1157  gr_set_font(FONT2);
1159  strcpy_s(buf, Scan_code_text[Key_sets[Cur_hotkey]]);
1160  gr_get_string_size(&w, &h, buf);
1161  gr_printf_menu(Hotkey_function_name_coords[gr_screen.res][0] + (Hotkey_function_name_coords[gr_screen.res][2] - w) / 2, Hotkey_function_name_coords[gr_screen.res][1], buf);
1162 
1163  gr_set_font(FONT1);
1164  line = Scroll_offset;
1165  while (hotkey_line_query_visible(line)) {
1166  z = Hotkey_lines[line].index;
1167  y = Hotkey_list_coords[gr_screen.res][1] + Hotkey_lines[line].y - Hotkey_lines[Scroll_offset].y;
1168  hotkeys = 0;
1169  switch (Hotkey_lines[line].type) {
1170  case HOTKEY_LINE_HEADING:
1172 
1173  gr_get_string_size(&w, &h, Hotkey_lines[line].label);
1174  i = y + h / 2 - 1;
1175  gr_line(Hotkey_list_coords[gr_screen.res][0], i, Hotkey_ship_x[gr_screen.res] - 2, i, GR_RESIZE_MENU);
1176  gr_line(Hotkey_ship_x[gr_screen.res] + w + 1, i, Hotkey_list_coords[gr_screen.res][0] + Hotkey_list_coords[gr_screen.res][2], i, GR_RESIZE_MENU);
1177  break;
1178 
1179  case HOTKEY_LINE_WING:
1180  gr_set_bitmap(Wing_bmp);
1181  bm_get_info(Wing_bmp, NULL, &h, NULL);
1182  i = y + font_height / 2 - h / 2 - 1;
1183  gr_bitmap(Hotkey_wing_icon_x[gr_screen.res], i, GR_RESIZE_MENU);
1184 
1185 // i = y + font_height / 2 - 1;
1186 // gr_set_color_fast(&circle_color);
1187 // gr_circle(ICON_LIST_X + 4, i, 5, GR_RESIZE_MENU);
1188 
1189 // gr_set_color_fast(&Color_bright);
1190 // gr_line(ICON_LIST_X, i, ICON_LIST_X + 2, i, GR_RESIZE_MENU);
1191 // gr_line(ICON_LIST_X + 4, i - 4, ICON_LIST_X + 4, i - 2, GR_RESIZE_MENU);
1192 // gr_line(ICON_LIST_X + 6, i, ICON_LIST_X + 8, i, GR_RESIZE_MENU);
1193 // gr_line(ICON_LIST_X + 4, i + 2, ICON_LIST_X + 4, i + 4, GR_RESIZE_MENU);
1194 
1195  hotkeys = get_wing_hotkeys(Hotkey_lines[line].index);
1196  break;
1197 
1198  case HOTKEY_LINE_SHIP:
1199  case HOTKEY_LINE_SUBSHIP:
1200  hotkeys = Hotkey_bits[Hotkey_lines[line].index];
1201  break;
1202 
1203  default:
1204  Int3();
1205  }
1206 
1207  if (Hotkey_lines[line].type != HOTKEY_LINE_HEADING) {
1208  Assert( (line - Scroll_offset) < LIST_BUTTONS_MAX );
1209  List_buttons[line - Scroll_offset].update_dimensions(Hotkey_list_coords[gr_screen.res][0], y, Hotkey_list_coords[gr_screen.res][0] + Hotkey_list_coords[gr_screen.res][2] - Hotkey_list_coords[gr_screen.res][0], font_height);
1210  List_buttons[line - Scroll_offset].enable();
1211  if (hotkeys & (1 << Cur_hotkey)) {
1213 
1214  } else {
1215  if (line == Selected_line)
1217  else if (line == select_tease_line)
1219  else
1221  }
1222 
1223  } else {
1224  Assert( (line - Scroll_offset) < LIST_BUTTONS_MAX );
1225  List_buttons[line - Scroll_offset].disable();
1226  }
1227 
1228  // print active hotkeys associated for this line
1229  if (hotkeys) {
1230  for (i=0; i<MAX_KEYED_TARGETS; i++) {
1231  if (hotkeys & (1 << i)) {
1232  gr_printf_menu(Hotkey_list_coords[gr_screen.res][0] + Hotkey_function_field_width[gr_screen.res]*i, y, Scan_code_text[Key_sets[i]]);
1233  }
1234  }
1235 /*
1236  *buf = 0;
1237  for (i=0; i<MAX_KEYED_TARGETS; i++) {
1238  if (hotkeys & (1 << i)) {
1239  strcat_s(buf, Scan_code_text[Key_sets[i]]);
1240  strcat_s(buf, ", ");
1241  }
1242  }
1243 
1244  Assert(strlen(buf) > 1);
1245  buf[strlen(buf) - 2] = 0; // lose the ", " on the end
1246 
1247  gr_force_fit_string(buf, 255, GROUP_LIST_W);
1248  gr_printf_menu(GROUP_LIST_X, y, buf);*/
1249  }
1250 
1251  // draw ship/wing name
1252  strcpy_s(buf, Hotkey_lines[line].label);
1254  if (Hotkey_lines[line].type == HOTKEY_LINE_SUBSHIP) {
1255  // indent
1256  gr_force_fit_string(buf, 255, Hotkey_list_coords[gr_screen.res][0] + Hotkey_list_coords[gr_screen.res][2] - (Hotkey_ship_x[gr_screen.res]+20));
1257  gr_printf_menu(Hotkey_ship_x[gr_screen.res]+20, y, buf);
1258  } else {
1259  gr_force_fit_string(buf, 255, Hotkey_list_coords[gr_screen.res][0] + Hotkey_list_coords[gr_screen.res][2] - Hotkey_ship_x[gr_screen.res]);
1260  gr_printf_menu(Hotkey_ship_x[gr_screen.res], y, buf);
1261  }
1262 
1263  line++;
1264  }
1265 
1266  i = line - Scroll_offset;
1267  while (i < LIST_BUTTONS_MAX)
1268  List_buttons[i++].disable();
1269 
1270  // blit help overlay if active
1272 
1273  gr_flip();
1274 }
1275 
1277 {
1279 }
void game_flush()
Definition: fredstubs.cpp:83
#define NUM_BUTTONS
void remove_hotkey()
void set_highlight_action(void(*_user_function)(void))
Definition: button.cpp:375
#define HOTKEY_NUM_TEXT
#define HOTKEY_LINE_SHIP
int timestamp(int delta_ms)
Definition: timer.cpp:226
wing Wings[MAX_WINGS]
Definition: ship.cpp:128
#define KEY_PADENTER
Definition: key.h:171
int i
Definition: multi_pxo.cpp:466
void add_XSTR(char *string, int _xstr_id, int _x, int _y, UI_GADGET *_assoc, int _color_type, int _font_id=-1)
Definition: window.cpp:476
#define gr_clear
Definition: 2d.h:749
void reset_status()
Definition: button.cpp:78
int team
Definition: ship.h:606
#define KEY_DOWN
Definition: key.h:180
#define KEY_F10
Definition: key.h:152
int objnum
Definition: ship.h:537
int Game_mode
Definition: systemvars.cpp:24
GLfloat GLfloat GLfloat GLfloat h
Definition: Glext.h:7280
void gr_flip()
Definition: 2d.cpp:2113
#define KEY_F12
Definition: key.h:154
#define KEY_PAGEDOWN
Definition: key.h:178
#define GR_RESIZE_MENU
Definition: 2d.h:684
object * objp
Definition: hudtarget.h:52
GLuint index
Definition: Glext.h:5608
#define ACCEPT_BUTTON
#define MAX_SHIPS
Definition: globals.h:37
Assert(pm!=NULL)
#define KEY_F11
Definition: key.h:153
#define GR_NUM_RESOLUTIONS
Definition: 2d.h:651
general failure sound for any event
Definition: gamesnd.h:297
Definition: 2d.h:95
help pressed
Definition: gamesnd.h:293
int res
Definition: 2d.h:370
int max_h_unscaled
Definition: 2d.h:361
int bm_get_info(int handle, int *w, int *h, ubyte *flags, int *nframes, int *fps)
Gets info on the bitmap indexed by handle.
Definition: bmpman.cpp:769
CButton * team
#define STI_HUD_HOTKEY_ON_LIST
Definition: ship.h:991
#define MAX_KEYED_TARGETS
Definition: player.h:26
void mission_hotkey_do_frame(float frametime)
#define KEY_F8
Definition: key.h:150
#define KEY_F5
Definition: key.h:147
#define TRUE
Definition: pstypes.h:399
#define REMOVE_HOTKEY_BUTTON
object obj_used_list
Definition: object.cpp:53
#define GR_MAYBE_CLEAR_RES(bmap)
Definition: 2d.h:639
Definition: ship.h:1516
#define MAX_HOTKEY_TARGET_ITEMS
Definition: hudtarget.h:35
#define KEY_C
Definition: key.h:84
void help_overlay_set_state(int overlay_id, int resolution_index, int state)
void set_ignore_gadgets(int state)
Definition: window.cpp:471
virtual void hide(int n)
Definition: gadget.cpp:207
void gr_set_color_fast(color *dst)
Definition: 2d.cpp:1197
char name[NAME_LENGTH]
#define KEY_PAGEUP
Definition: key.h:175
Definition: ui.h:195
const char * label
void obj_merge_created_list(void)
Definition: object.cpp:651
void mission_hotkey_validate()
void gr_set_bitmap(int bitmap_num, int alphablend_mode, int bitblt_mode, float alpha)
Definition: 2d.cpp:2105
int max_w_unscaled
Definition: 2d.h:361
#define Int3()
Definition: pstypes.h:292
#define SCROLL_DOWN_BUTTON
#define KEY_MINUS
Definition: key.h:109
#define LIST_BUTTONS_MAX
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: Glext.h:7308
int bm_release(int handle, int clear_render_targets)
Frees both a bitmap's data and it's associated slot.
Definition: bmpman.cpp:2603
void expand_wing()
#define HOTKEY_OVERLAY
Definition: contexthelp.h:32
int signature
Definition: object.h:145
int hotkey
Definition: ship.h:1520
void hud_target_hotkey_clear(int k)
Definition: hudtarget.cpp:835
GLenum type
Definition: Gl.h:1492
#define HOTKEY_LINE_HEADING
#define B1_JUST_RELEASED
Definition: uidefs.h:50
void mission_hotkey_maybe_save_sets()
void add_hotkey(int hotkey)
int hotkey
Definition: ship.h:540
#define KEY_F7
Definition: key.h:149
int iff_get_attackee_mask(int attacker_team)
Definition: iff_defs.cpp:561
void hud_target_hotkey_add_remove(int k, object *ctarget, int how_to_add)
Definition: hudtarget.cpp:771
#define RESET_BUTTON
void common_set_interface_palette(char *filename)
int objnum
Definition: ship.h:1483
player Players[MAX_PLAYERS]
void destroy()
Definition: window.cpp:189
int button_down
Definition: fredview.cpp:100
void set_mask_bmap(char *fname)
Definition: window.cpp:75
int instance
Definition: object.h:150
int set_bmaps(char *ani_filename, int nframes=3, int start_frame=1)
Definition: gadget.cpp:71
void hotkey_build_listing()
void common_free_interface_palette()
void weapon_pause_sounds()
Definition: weapons.cpp:7248
#define HOTKEY_USER_ADDED
Definition: hudtarget.h:43
#define MAX_LINES
void mission_hotkey_reset_saved()
int wingnum
Definition: ship.h:623
int pressed()
Definition: button.cpp:325
#define KEY_SHIFTED
Definition: key.h:62
void hotkey_button_pressed(int n)
#define w(p)
Definition: modelsinc.h:68
int hotkey_line_insert(int n, char *text, int type, int index)
GLdouble GLdouble z
Definition: Glext.h:5451
#define KEY_ENTER
Definition: key.h:125
#define SF_HIDDEN_FROM_SENSORS
Definition: ship.h:464
int hotkey_line_add_sorted(char *text, int type, int index, int start)
void mission_hotkey_exit()
#define GR_640
Definition: 2d.h:652
int Num_wings
Definition: ship.cpp:120
HK_save_info Hotkey_saved_info[MAX_HOTKEY_TARGET_ITEMS]
GLdouble s
Definition: Glext.h:5321
int Num_hotkeys_saved
void save_hotkeys()
int current_count
Definition: ship.h:1530
#define KEY_R
Definition: key.h:99
Definition: ship.h:534
void hotkey_scroll_line_down()
void mission_hotkey_maybe_restore()
#define HOTKEY_SAVE_TIME
void mission_hotkey_init()
#define HOTKEY_LINE_SUBSHIP
object Objects[MAX_OBJECTS]
Definition: object.cpp:62
#define KEY_PADMINUS
Definition: key.h:166
GLclampd n
Definition: Glext.h:7286
const char * XSTR(const char *str, int index)
Definition: localize.cpp:851
#define KEY_F6
Definition: key.h:148
hotkey_buttons(char *name, int x1, int y1, int h)
#define OBJ_INDEX(objp)
Definition: object.h:235
user_click (mouse selects a control)
Definition: gamesnd.h:305
ship * Player_ship
Definition: ship.cpp:124
#define GM_IN_MISSION
Definition: systemvars.h:23
int hotkey_line_query_visible(int n)
bool end_string_at_first_hash_symbol(char *src)
Definition: parselo.cpp:3833
GLuint start
Definition: Gl.h:1502
#define OBJ_SHIP
Definition: object.h:32
int mission_hotkey_get_set_num(int k)
GLbitfield flags
Definition: Glext.h:6722
void set_hotkey(int keycode)
Definition: gadget.cpp:280
int y
#define HOTKEY_MISSION_FILE_ADDED
Definition: hudtarget.h:44
color Color_text_active
Definition: alphacolors.cpp:27
GLuint const GLchar * name
Definition: Glext.h:5608
__inline void gr_line(int x1, int y1, int x2, int y2, int resize_mode=GR_RESIZE_FULL)
Definition: 2d.h:791
void weapon_unpause_sounds()
Definition: weapons.cpp:7257
int bm_load(const char *real_filename)
Loads a bitmap so we can draw with it later.
Definition: bmpman.cpp:1119
color Color_text_subselected
Definition: alphacolors.cpp:26
GLboolean GLboolean GLboolean b
Definition: Glext.h:5781
void hotkey_scroll_screen_down()
ship Ships[MAX_SHIPS]
Definition: ship.cpp:122
#define SF_DEPARTING
Definition: ship.h:475
void update_dimensions(int _x, int _y, int _w, int _h)
Definition: gadget.cpp:187
color Color_text_selected
Definition: alphacolors.cpp:26
#define KEY_EQUAL
Definition: key.h:110
#define FONT1
Definition: font.h:65
scroll pressed (and scroll)
Definition: gamesnd.h:296
void link_hotspot(int num)
Definition: gadget.cpp:50
void create(UI_WINDOW *wnd, char *_text, int _x, int _y, int _w, int _h, int do_repeat=0, int ignore_focus=0)
Definition: button.cpp:26
#define KEY_ESC
Definition: key.h:124
#define NAME_LENGTH
Definition: globals.h:15
#define FONT2
Definition: font.h:66
void hotkey_scroll_line_up()
#define CLEAR_BUTTON
int get_wing_hotkeys(int n)
void create(int _x, int _y, int _w, int _h, int _flags, int _f_id=-1)
Definition: window.cpp:140
player * Player
void audiostream_unpause_all(bool via_sexp_or_script=false)
Definition: audiostr.cpp:1990
int gr_force_fit_string(char *str, int max_str, int max_width)
Definition: font.cpp:48
Definition: ui.h:584
screen gr_screen
Definition: 2d.cpp:46
void gr_get_string_size(int *w, int *h, const char *text, int len=9999)
Definition: font.cpp:196
Definition: ui.h:162
#define HELP_BUTTON
void mission_hotkey_mf_add(int set, int objnum, int how_to_add)
void mission_hotkey_close()
void enable(int n=1)
Definition: gadget.cpp:440
#define KEY_F2
Definition: key.h:144
int type
ship_obj Ship_obj_list
Definition: ship.cpp:162
int gr_get_font_height()
Definition: font.cpp:187
#define HOTKEY_LINE_WING
#define KEY_DEBUGGED
Definition: key.h:65
SCP_vector< ship_info > Ship_info
Definition: ship.cpp:164
void common_play_highlight_sound()
Definition: gamesnd.cpp:1151
#define OPTIONS_BUTTON
#define timestamp_elapsed(stamp)
Definition: timer.h:102
int hotkey_line_add(const char *text, int type, int index, int y)
void get_mouse_pos(int *xx, int *yy)
Definition: gadget.cpp:341
int hotkey_build_team_listing(int enemy_team_mask, int y, bool list_enemies)
#define KEY_CTRLED
Definition: key.h:64
#define KEY_TAB
Definition: key.h:127
void gr_bitmap(int _x, int _y, int resize_mode)
Definition: 2d.cpp:1303
#define KEY_UP
Definition: key.h:179
matrix * A
Definition: lua.cpp:444
#define UI_XSTR_COLOR_GREEN
Definition: ui.h:160
object * Player_obj
Definition: object.cpp:56
color Color_text_normal
Definition: alphacolors.cpp:26
#define WF_EXPANDED
Definition: ship.h:1507
#define SF_DYING
Definition: ship.h:447
int temp
Definition: lua.cpp:4996
int ship_index[MAX_SHIPS_PER_WING]
Definition: ship.h:1531
void reset_hotkeys()
color Color_text_heading
Definition: alphacolors.cpp:28
htarget_list keyed_targets[MAX_KEYED_TARGETS]
Definition: player.h:107
int iff_matches_mask(int team, int mask)
Definition: iff_defs.cpp:628
#define CANCEL_BUTTON
int Hotkey_overlay_id
int ship_name_lookup(const char *name, int inc_players)
Definition: ship.cpp:12900
int index
#define GM_NORMAL
Definition: systemvars.h:19
void launch_context_help()
void gamesnd_play_iface(int n)
Definition: gamesnd.cpp:260
void audiostream_pause_all(bool via_sexp_or_script=false)
Definition: audiostr.cpp:1978
void disable()
Definition: gadget.cpp:432
void draw()
Definition: window.cpp:220
void gr_set_font(int fontnum)
Definition: font.cpp:566
#define SCROLL_UP_BUTTON
char type
Definition: object.h:146
void hotkey_scroll_screen_up()
#define FALSE
Definition: pstypes.h:400
#define wp(p)
Definition: modelsinc.h:69
int process(int key_in=-1, int process_mouse=1)
Definition: window.cpp:401
int help_overlay_get_index(const char *overlay_name)
void clear_hotkeys()
#define KEY_PADPLUS
Definition: key.h:167
htarget_list htarget_free_list
Definition: hudtarget.cpp:98
#define ADD_HOTKEY_BUTTON
void _cdecl gr_printf_menu(int x, int y, const char *format,...)
Definition: font.cpp:314
void gameseq_post_event(int event)
#define stricmp(s1, s2)
Definition: config.h:271
void gr_init_color(color *c, int r, int g, int b)
Definition: 2d.cpp:1155
void help_overlay_maybe_blit(int overlay_id, int resolution_index)
int help_overlay_active(int overlay_id)
#define GR_1024
Definition: 2d.h:653
char ship_name[NAME_LENGTH]
Definition: ship.h:604
SCP_vector< ship_type_info > Ship_types
Definition: ship.cpp:168
void mission_hotkey_set_defaults()
#define KEY_F9
Definition: key.h:151
GLint y
Definition: Gl.h:1505
char ** Scan_code_text
int flags
Definition: ship.h:1556
int Player_num
#define strcpy_s(...)
Definition: safe_strings.h:67