2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
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
10 * $Logfile: /Freespace2/code/MissionUI/MissionScreenCommon.h $
19 #ifndef _MISSION_SCREEN_COMMON_HEADER_FILE
20 #define _MISSION_SCREEN_COMMON_HEADER_FILE
25 #define BACKGROUND_FRAME_TO_START_SHIP_ANIM 87
26 #define BUTTON_SLIDE_IN_FRAME 1
28 ///////////////////////////////////////////////////////
29 // Common to briefing/ship selection/weapons loadout
30 ///////////////////////////////////////////////////////
32 #define COMMON_BRIEFING_REGION 0
33 #define COMMON_SS_REGION 1
34 #define COMMON_WEAPON_REGION 2
35 #define COMMON_COMMIT_REGION 5
36 #define COMMON_HELP_REGION 6
37 #define COMMON_OPTIONS_REGION 7
38 #define NUM_COMMON_REGIONS 6
40 #define NUM_COMMON_BUTTONS 6
42 struct brief_common_buttons {
48 UI_BUTTON button; // because we have a class inside this struct, we need the constructor below..
50 brief_common_buttons(char *name, int x1, int y1, int xt1, int yt1, int h, int r = 0) : filename(name), x(x1), y(y1), xt(xt1), yt(yt1), hotspot(h), repeat(r) {}
53 extern brief_common_buttons Common_buttons[3][GR_NUM_RESOLUTIONS][NUM_COMMON_BUTTONS];
55 extern int Background_playing;
57 extern int Common_select_inited;
58 extern int Current_screen;
60 extern int Common_team;
62 extern int Drop_icon_mflag;
63 extern int Drop_on_wing_mflag;
64 extern int Brief_mouse_up_flag;
65 extern int Mouse_down_last_frame;
68 extern int Wing_slot_empty_bitmap;
69 extern int Wing_slot_disabled_bitmap;
71 extern int Flash_timer; // timestamp used to start flashing
72 extern int Flash_toggle; // timestamp used to toggle flashing
73 extern int Flash_bright; // state of button to flash
75 void common_button_do(int i);
77 // common_select_init() performs initialization common to the briefing/ship select/weapon select
78 // screens. This includes loading/setting the palette, loading the background animation, loading
79 // the screen switching animations, loading the button animation frames
80 void common_select_init();
81 int common_select_do(float frametime);
82 void common_select_close();
83 void common_draw_buttons();
84 void common_check_buttons();
85 void common_check_keys(int k);
86 void commit_pressed();
87 void common_render(float frametime);
88 void common_buttons_init(UI_WINDOW *ui_window);
89 void common_buttons_maybe_reload(UI_WINDOW *ui_window);
90 void common_render_selected_screen_button();
91 void common_reset_buttons();
92 void common_redraw_pressed_buttons();
93 void common_maybe_clear_focus();
94 void ship_select_common_init();
96 void common_set_interface_palette(char *filename = NULL); // set the interface palette
97 void common_free_interface_palette(); // restore game palette
99 void load_wing_icons(char *filename);
100 void unload_wing_icons();
102 void common_flash_button_init();
103 int common_flash_bright();
105 // functions for the multiplayer chat window
106 void common_render_chat_window();
107 void multi_chat_scroll_up();
108 void multi_chat_scroll_down();
110 void set_active_ui(UI_WINDOW *ui_window);
112 // music functions exported for multiplayer team selection screen to start briefing music
113 void common_music_init( int score_index );
114 void common_music_do();
115 void common_music_close();
117 int common_scroll_down_pressed(int *start, int size, int max_show);
118 int common_scroll_up_pressed(int *start, int size, int max_show);
120 //////////////////////////////////////////////////////////////////////////////////////
122 //////////////////////////////////////////////////////////////////////////////////////
124 #define MAX_WL_PRIMARY 3
125 #define MAX_WL_SECONDARY 4
126 #define MAX_WL_WEAPONS (MAX_WL_PRIMARY+MAX_WL_SECONDARY)
128 #define MAX_WING_SLOTS 4
129 #define MAX_WING_BLOCKS 3
130 #define MAX_WSS_SLOTS (MAX_WING_BLOCKS*MAX_WING_SLOTS)
132 #define WING_SLOT_FILLED (1<<0)
133 #define WING_SLOT_EMPTY (1<<1)
134 #define WING_SLOT_DISABLED (1<<2)
135 #define WING_SLOT_IS_PLAYER (1<<3)
136 #define WING_SLOT_LOCKED (1<<4)
138 #define WING_SLOT_IGNORE (WING_SLOT_DISABLED|WING_SLOT_LOCKED)
140 // different operations used in xx_apply()
141 #define WSS_DUMP_TO_LIST 0
142 #define WSS_GRAB_FROM_LIST 1
143 #define WSS_SWAP_SLOT_SLOT 2
144 #define WSS_SWAP_LIST_SLOT 3
147 #define NUM_ICON_FRAMES 6
148 #define ICON_FRAME_NORMAL 0
149 #define ICON_FRAME_HOT 1
150 #define ICON_FRAME_SELECTED 2
151 #define ICON_FRAME_PLAYER 3
152 #define ICON_FRAME_DISABLED 4
153 #define ICON_FRAME_DISABLED_HIGH 5
155 //////////////////////////////////////////////
157 //////////////////////////////////////////////
158 typedef struct wss_unit {
160 int wep[MAX_WL_WEAPONS];
161 int wep_count[MAX_WL_WEAPONS];
164 extern wss_unit Wss_slots_teams[MAX_TEAMS][MAX_WSS_SLOTS];
165 extern wss_unit *Wss_slots;
167 extern int Wss_num_wings; // number of player wings
168 extern int Wss_num_wings_teams[MAX_TEAMS];
170 //////////////////////////////////////////////
172 //////////////////////////////////////////////
173 extern int Wl_pool_teams[MAX_TEAMS][MAX_WEAPON_TYPES];
176 //////////////////////////////////////////////
178 //////////////////////////////////////////////
179 extern int Ss_pool_teams[MAX_TEAMS][MAX_SHIP_TYPES];
182 //////////////////////////////////////////////
184 //////////////////////////////////////////////
185 typedef struct loadout_data
187 char filename[MAX_FILENAME_LEN]; // mission filename
188 char last_modified[DATE_TIME_LENGTH]; // when mission was last modified
189 wss_unit unit_data[MAX_WSS_SLOTS]; // ship and weapon data
190 int weapon_pool[MAX_WEAPON_TYPES]; // available weapons
191 int ship_pool[MAX_SHIP_TYPES]; // available ships
194 extern loadout_data Player_loadout;
196 void wss_save_loadout();
197 void wss_restore_loadout();
198 void wss_direct_restore_loadout();
200 int wss_get_mode(int from_slot, int from_list, int to_slot, int to_list, int wl_ship_slot);
201 int store_wss_data(ubyte *block, int max_size, int sound,int player_index);
202 int restore_wss_data(ubyte *block);
204 ///////////////////////////////////////////////////////////
206 ///////////////////////////////////////////////////////////