50 static int Hotkey_sets_saved;
52 static int Mission_hotkey_save_timestamp;
53 #define HOTKEY_SAVE_TIME 15000 // save sets this number of milliseconds into the mission
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
106 #define WING_FLAG 0x80000
108 #define MAX_LINES 200
109 #define NUM_BUTTONS 10
110 #define LIST_BUTTONS_MAX 50
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
238 #define HOTKEY_NUM_TEXT 6
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;
291 if ( Key_sets[i] == k ) {
307 if ( Hotkey_saved_info[i].setnum == -1 )
314 Hotkey_saved_info[
i].
setnum = -1;
337 Hotkey_sets_saved = 0;
365 if ( sp->
hotkey == MAX_KEYED_TARGETS )
380 if ( wp->
hotkey == MAX_KEYED_TARGETS )
413 if ( Hotkey_sets_saved )
417 Hotkey_saved_info[i].setnum = -1;
420 hkp = &(Hotkey_saved_info[0]);
438 Hotkey_sets_saved = 1;
462 if (
EMPTY( plist ) )
476 if ( obj_valid ==
FALSE ) {
495 int i, total = 0xffffffff;
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;
536 Hotkey_lines[
z] = Hotkey_lines[z - 1];
540 Hotkey_lines[
z].label = text;
541 Hotkey_lines[
z].type =
type;
542 Hotkey_lines[
z].index =
index;
569 const char *str = NULL;
575 str =
XSTR(
"Enemy ships", 403);
576 team_mask = enemy_team_mask;
580 str =
XSTR(
"Friendly ships", 402);
581 team_mask = ~enemy_team_mask;
648 if ( j <
Wings[i].current_count )
661 for (i=start; i<Num_lines; i++) {
665 y += font_height + 2;
667 Hotkey_lines[
i].y =
y;
670 y += font_height + 8;
676 int y, enemy_team_mask;
690 if ((n < 0) || (n >= Num_lines))
693 y = Hotkey_lines[
n].y - Hotkey_lines[Scroll_offset].y;
704 Assert(Selected_line > Scroll_offset);
716 if (Selected_line > 1) {
721 if (Selected_line < Scroll_offset)
722 Scroll_offset = Selected_line;
736 Assert(Selected_line < Num_lines);
747 if (Selected_line < Num_lines - 1) {
752 Assert(Selected_line > Scroll_offset);
767 i = Hotkey_lines[Selected_line].index;
770 for (z=0; z<Num_lines; z++)
802 z = Hotkey_lines[Selected_line].type;
804 z = Hotkey_lines[Selected_line].index;
807 Hotkey_bits[
Wings[z].ship_index[i]] &= b;
810 Hotkey_bits[Hotkey_lines[Selected_line].index] = 0;
833 z = Hotkey_lines[Selected_line].type;
835 z = Hotkey_lines[Selected_line].index;
837 Hotkey_bits[
Wings[z].ship_index[i]] |= (1 << hotkey);
840 Hotkey_bits[Hotkey_lines[Selected_line].index] |= (1 << hotkey);
848 z = Hotkey_lines[Selected_line].type;
850 z = Hotkey_lines[Selected_line].index;
852 Hotkey_bits[
Wings[z].ship_index[i]] &= ~(1 << Cur_hotkey);
855 Hotkey_bits[Hotkey_lines[Selected_line].index] &= ~(1 << Cur_hotkey);
936 b->
button.
create(&Ui_window,
"", b->
x, b->
y, 60, 30, i < 2 ? 1 : 0, 1);
949 List_buttons[
i].
create(&Ui_window,
"", 0, 0, 60, 30, (i < 2), 1);
950 List_buttons[
i].
hide();
964 if (Background_bitmap < 0) {
968 Wing_bmp =
bm_load(
"WingDesignator");
987 if (Background_bitmap)
1011 int i, k,
w,
h,
y,
z, line, hotkeys;
1013 int select_tease_line = -1;
1091 if (k == Key_sets[i])
1109 select_tease_line = i + Scroll_offset;
1113 if (List_buttons[i].pressed()) {
1114 Selected_line = i + Scroll_offset;
1122 if (List_buttons[i].double_clicked()) {
1123 Selected_line = i + Scroll_offset;
1125 switch (Hotkey_lines[Selected_line].
type) {
1132 hotkeys = Hotkey_bits[Hotkey_lines[Selected_line].index];
1136 if (hotkeys != -1) {
1137 if (hotkeys & (1 << Cur_hotkey))
1146 if (Background_bitmap >= 0) {
1164 line = Scroll_offset;
1166 z = Hotkey_lines[line].index;
1167 y = Hotkey_list_coords[
gr_screen.
res][1] + Hotkey_lines[line].y - Hotkey_lines[Scroll_offset].y;
1169 switch (Hotkey_lines[line].
type) {
1182 i = y + font_height / 2 - h / 2 - 1;
1200 hotkeys = Hotkey_bits[Hotkey_lines[line].index];
1208 Assert( (line - Scroll_offset) < LIST_BUTTONS_MAX );
1210 List_buttons[line - Scroll_offset].
enable();
1211 if (hotkeys & (1 << Cur_hotkey)) {
1215 if (line == Selected_line)
1217 else if (line == select_tease_line)
1224 Assert( (line - Scroll_offset) < LIST_BUTTONS_MAX );
1225 List_buttons[line - Scroll_offset].
disable();
1231 if (hotkeys & (1 << i)) {
1266 i = line - Scroll_offset;
1267 while (i < LIST_BUTTONS_MAX)
void set_highlight_action(void(*_user_function)(void))
int timestamp(int delta_ms)
void add_XSTR(char *string, int _xstr_id, int _x, int _y, UI_GADGET *_assoc, int _color_type, int _font_id=-1)
GLfloat GLfloat GLfloat GLfloat h
#define GR_NUM_RESOLUTIONS
#define list_append(head, elem)
general failure sound for any event
int bm_get_info(int handle, int *w, int *h, ubyte *flags, int *nframes, int *fps)
Gets info on the bitmap indexed by handle.
#define STI_HUD_HOTKEY_ON_LIST
#define MAX_KEYED_TARGETS
void mission_hotkey_do_frame(float frametime)
#define REMOVE_HOTKEY_BUTTON
#define END_OF_LIST(head)
#define GR_MAYBE_CLEAR_RES(bmap)
#define MAX_HOTKEY_TARGET_ITEMS
void help_overlay_set_state(int overlay_id, int resolution_index, int state)
void set_ignore_gadgets(int state)
void gr_set_color_fast(color *dst)
void obj_merge_created_list(void)
void mission_hotkey_validate()
void gr_set_bitmap(int bitmap_num, int alphablend_mode, int bitblt_mode, float alpha)
#define SCROLL_DOWN_BUTTON
GLenum GLuint GLenum GLsizei const GLchar * buf
int bm_release(int handle, int clear_render_targets)
Frees both a bitmap's data and it's associated slot.
void hud_target_hotkey_clear(int k)
#define HOTKEY_LINE_HEADING
void mission_hotkey_maybe_save_sets()
void add_hotkey(int hotkey)
int iff_get_attackee_mask(int attacker_team)
void hud_target_hotkey_add_remove(int k, object *ctarget, int how_to_add)
void common_set_interface_palette(char *filename)
player Players[MAX_PLAYERS]
void set_mask_bmap(char *fname)
int set_bmaps(char *ani_filename, int nframes=3, int start_frame=1)
void hotkey_build_listing()
void common_free_interface_palette()
void weapon_pause_sounds()
#define HOTKEY_USER_ADDED
void mission_hotkey_reset_saved()
void hotkey_button_pressed(int n)
int hotkey_line_insert(int n, char *text, int type, int index)
#define SF_HIDDEN_FROM_SENSORS
int hotkey_line_add_sorted(char *text, int type, int index, int start)
void mission_hotkey_exit()
HK_save_info Hotkey_saved_info[MAX_HOTKEY_TARGET_ITEMS]
void hotkey_scroll_line_down()
void mission_hotkey_maybe_restore()
void mission_hotkey_init()
#define HOTKEY_LINE_SUBSHIP
object Objects[MAX_OBJECTS]
const char * XSTR(const char *str, int index)
user_click (mouse selects a control)
int hotkey_line_query_visible(int n)
bool end_string_at_first_hash_symbol(char *src)
int mission_hotkey_get_set_num(int k)
void set_hotkey(int keycode)
#define HOTKEY_MISSION_FILE_ADDED
GLuint const GLchar * name
__inline void gr_line(int x1, int y1, int x2, int y2, int resize_mode=GR_RESIZE_FULL)
void weapon_unpause_sounds()
int bm_load(const char *real_filename)
Loads a bitmap so we can draw with it later.
color Color_text_subselected
GLboolean GLboolean GLboolean b
void hotkey_scroll_screen_down()
void update_dimensions(int _x, int _y, int _w, int _h)
color Color_text_selected
scroll pressed (and scroll)
void link_hotspot(int num)
void create(UI_WINDOW *wnd, char *_text, int _x, int _y, int _w, int _h, int do_repeat=0, int ignore_focus=0)
void hotkey_scroll_line_up()
int get_wing_hotkeys(int n)
void create(int _x, int _y, int _w, int _h, int _flags, int _f_id=-1)
void audiostream_unpause_all(bool via_sexp_or_script=false)
int gr_force_fit_string(char *str, int max_str, int max_width)
void gr_get_string_size(int *w, int *h, const char *text, int len=9999)
void mission_hotkey_mf_add(int set, int objnum, int how_to_add)
void mission_hotkey_close()
SCP_vector< ship_info > Ship_info
void common_play_highlight_sound()
#define timestamp_elapsed(stamp)
int hotkey_line_add(const char *text, int type, int index, int y)
void get_mouse_pos(int *xx, int *yy)
#define list_remove(head, elem)
int hotkey_build_team_listing(int enemy_team_mask, int y, bool list_enemies)
void gr_bitmap(int _x, int _y, int resize_mode)
#define UI_XSTR_COLOR_GREEN
int ship_index[MAX_SHIPS_PER_WING]
htarget_list keyed_targets[MAX_KEYED_TARGETS]
int iff_matches_mask(int team, int mask)
int ship_name_lookup(const char *name, int inc_players)
void launch_context_help()
void gamesnd_play_iface(int n)
void audiostream_pause_all(bool via_sexp_or_script=false)
void gr_set_font(int fontnum)
void hotkey_scroll_screen_up()
int process(int key_in=-1, int process_mouse=1)
int help_overlay_get_index(const char *overlay_name)
htarget_list htarget_free_list
#define ADD_HOTKEY_BUTTON
void _cdecl gr_printf_menu(int x, int y, const char *format,...)
void gameseq_post_event(int event)
void gr_init_color(color *c, int r, int g, int b)
void help_overlay_maybe_blit(int overlay_id, int resolution_index)
int help_overlay_active(int overlay_id)
char ship_name[NAME_LENGTH]
SCP_vector< ship_type_info > Ship_types
void mission_hotkey_set_defaults()