]> icculus.org git repositories - taylor/freespace2.git/blob - include/missionscreencommon.h
Initial revision
[taylor/freespace2.git] / include / missionscreencommon.h
1 /*
2  * $Logfile: /Freespace2/code/MissionUI/MissionScreenCommon.h $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * $NoKeywords: $
8  *
9  */
10
11 #ifndef _MISSION_SCREEN_COMMON_HEADER_FILE
12 #define _MISSION_SCREEN_COMMON_HEADER_FILE
13
14 #include "ui.h"
15 #include "weapon.h"
16
17 #define BACKGROUND_FRAME_TO_START_SHIP_ANIM     87
18 #define BUTTON_SLIDE_IN_FRAME                                           1
19
20 ///////////////////////////////////////////////////////
21 // Common to briefing/ship selection/weapons loadout
22 ///////////////////////////////////////////////////////
23
24 #define COMMON_BRIEFING_REGION                                  0
25 #define COMMON_SS_REGION                                                        1
26 #define COMMON_WEAPON_REGION                                            2
27 #define COMMON_COMMIT_REGION                                            5
28 #define COMMON_HELP_REGION                                                      6
29 #define COMMON_OPTIONS_REGION                                           7
30 #define NUM_COMMON_REGIONS                                                      6
31
32 #define NUM_COMMON_BUTTONS      6
33
34 struct brief_common_buttons {   
35         char *filename;
36         int x, y;
37         int xt, yt;
38         int hotspot;
39         int repeat;
40         UI_BUTTON button;  // because we have a class inside this struct, we need the constructor below..
41
42         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) {}
43 };
44
45 extern brief_common_buttons Common_buttons[3][GR_NUM_RESOLUTIONS][NUM_COMMON_BUTTONS];
46
47 extern int Background_playing;
48
49 extern int Common_select_inited;
50 extern int Current_screen;
51
52 extern int Common_team;
53
54 extern int Drop_icon_mflag;
55 extern int Drop_on_wing_mflag;
56 extern int Brief_mouse_up_flag;
57 extern int Mouse_down_last_frame;
58
59
60 extern int Wing_slot_empty_bitmap;
61 extern int Wing_slot_disabled_bitmap;
62
63 extern int Flash_timer;                         //      timestamp used to start flashing
64 extern int Flash_toggle;                        // timestamp used to toggle flashing
65 extern int Flash_bright;                        // state of button to flash
66
67 void common_button_do(int i);
68
69 // common_select_init() performs initialization common to the briefing/ship select/weapon select
70 // screens.  This includes loading/setting the palette, loading the background animation, loading
71 // the screen switching animations, loading the button animation frames
72 void    common_select_init();   
73 int     common_select_do(float frametime);
74 void    common_select_close();
75 void    common_draw_buttons();
76 void    common_check_buttons();
77 void    common_check_keys(int k);
78 void    commit_pressed();
79 void    common_render(float frametime);
80 void    common_buttons_init(UI_WINDOW *ui_window);
81 void    common_buttons_maybe_reload(UI_WINDOW *ui_window);
82 void    common_render_selected_screen_button();
83 void    common_reset_buttons();
84 void    common_redraw_pressed_buttons();
85 void  common_maybe_clear_focus();
86 void ship_select_common_init();
87
88 void common_set_interface_palette(char *filename = NULL);               // set the interface palette
89 void common_free_interface_palette();           // restore game palette
90
91 void load_wing_icons(char *filename);
92 void unload_wing_icons();
93
94 void    common_flash_button_init();
95 int     common_flash_bright();
96
97 // functions for the multiplayer chat window
98 void common_render_chat_window();
99 void multi_chat_scroll_up();
100 void multi_chat_scroll_down();
101
102 void    set_active_ui(UI_WINDOW *ui_window);
103
104 // music functions exported for multiplayer team selection screen to start briefing music
105 void common_music_init( int score_index );
106 void common_music_do();
107 void common_music_close();
108
109 int common_scroll_down_pressed(int *start, int size, int max_show);
110 int common_scroll_up_pressed(int *start, int size, int max_show);
111
112 //////////////////////////////////////////////////////////////////////////////////////
113 // NEWSTUFF BEGIN
114 //////////////////////////////////////////////////////////////////////////////////////
115
116 #define MAX_WL_PRIMARY                                                  3
117 #define MAX_WL_SECONDARY                                                4
118 #define MAX_WL_WEAPONS                                                  (MAX_WL_PRIMARY+MAX_WL_SECONDARY)
119
120 #define MAX_WING_SLOTS  4
121 #define MAX_WING_BLOCKS 3
122 #define MAX_WSS_SLOTS   (MAX_WING_BLOCKS*MAX_WING_SLOTS)
123
124 #define WING_SLOT_FILLED                                (1<<0)
125 #define WING_SLOT_EMPTY                                 (1<<1)
126 #define WING_SLOT_DISABLED                              (1<<2)
127 #define WING_SLOT_IS_PLAYER                     (1<<3)
128 #define WING_SLOT_LOCKED                                (1<<4)
129
130 #define WING_SLOT_IGNORE        (WING_SLOT_DISABLED|WING_SLOT_LOCKED)
131
132 // different operations used in xx_apply()
133 #define WSS_DUMP_TO_LIST                0
134 #define WSS_GRAB_FROM_LIST              1
135 #define WSS_SWAP_SLOT_SLOT              2
136 #define WSS_SWAP_LIST_SLOT              3
137
138 // icons
139 #define NUM_ICON_FRAMES                                 6
140 #define ICON_FRAME_NORMAL                               0
141 #define ICON_FRAME_HOT                                  1
142 #define ICON_FRAME_SELECTED                     2
143 #define ICON_FRAME_PLAYER                               3
144 #define ICON_FRAME_DISABLED                     4
145 #define ICON_FRAME_DISABLED_HIGH                5
146
147 //////////////////////////////////////////////
148 // Slots
149 //////////////////////////////////////////////
150 typedef struct wss_unit {
151         int     ship_class;
152         int     wep[MAX_WL_WEAPONS];
153         int     wep_count[MAX_WL_WEAPONS];
154 } wss_unit;
155
156 extern wss_unit Wss_slots_teams[MAX_TEAMS][MAX_WSS_SLOTS];
157 extern wss_unit *Wss_slots;
158
159 extern int Wss_num_wings; // number of player wings
160 extern int Wss_num_wings_teams[MAX_TEAMS];
161
162 //////////////////////////////////////////////
163 // Weapon pool
164 //////////////////////////////////////////////
165 extern int Wl_pool_teams[MAX_TEAMS][MAX_WEAPON_TYPES];
166 extern int *Wl_pool;
167
168 //////////////////////////////////////////////
169 // Ship pool
170 //////////////////////////////////////////////
171 extern int Ss_pool_teams[MAX_TEAMS][MAX_SHIP_TYPES];
172 extern int *Ss_pool;
173
174 //////////////////////////////////////////////
175 // Saving loadout
176 //////////////////////////////////////////////
177 typedef struct loadout_data 
178 {
179         char                            filename[MAX_FILENAME_LEN];                             // mission filename
180         char                            last_modified[DATE_TIME_LENGTH];        // when mission was last modified
181         wss_unit                        unit_data[MAX_WSS_SLOTS];                       // ship and weapon data
182         int                             weapon_pool[MAX_WEAPON_TYPES];  // available weapons
183         int                             ship_pool[MAX_SHIP_TYPES];                      // available ships
184 } loadout_data;
185
186 extern loadout_data Player_loadout;
187
188 void wss_save_loadout();
189 void wss_restore_loadout();
190 void wss_direct_restore_loadout();
191
192 int wss_get_mode(int from_slot, int from_list, int to_slot, int to_list, int wl_ship_slot);
193 int store_wss_data(ubyte *block, int max_size, int sound,int player_index);
194 int restore_wss_data(ubyte *block);
195
196 ///////////////////////////////////////////////////////////
197 // NEWSTUFF END
198 ///////////////////////////////////////////////////////////
199
200 #endif
201