]> icculus.org git repositories - taylor/freespace2.git/blob - include/missionscreencommon.h
fix issue with looping audio streams
[taylor/freespace2.git] / include / missionscreencommon.h
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
6  * the source.
7  */
8
9 /*
10  * $Logfile: /Freespace2/code/MissionUI/MissionScreenCommon.h $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * $NoKeywords: $
16  *
17  */
18
19 #ifndef _MISSION_SCREEN_COMMON_HEADER_FILE
20 #define _MISSION_SCREEN_COMMON_HEADER_FILE
21
22 #include "ui.h"
23 #include "weapon.h"
24
25 #define BACKGROUND_FRAME_TO_START_SHIP_ANIM     87
26 #define BUTTON_SLIDE_IN_FRAME                                           1
27
28 ///////////////////////////////////////////////////////
29 // Common to briefing/ship selection/weapons loadout
30 ///////////////////////////////////////////////////////
31
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
39
40 #define NUM_COMMON_BUTTONS      6
41
42 struct brief_common_buttons {   
43         const char *filename;
44         int x, y;
45         int xt, yt;
46         int hotspot;
47         int repeat;
48         UI_BUTTON button;  // because we have a class inside this struct, we need the constructor below..
49
50         brief_common_buttons(const 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) {}
51 };
52
53 extern brief_common_buttons Common_buttons[3][GR_NUM_RESOLUTIONS][NUM_COMMON_BUTTONS];
54
55 extern int Background_playing;
56
57 extern int Common_select_inited;
58 extern int Current_screen;
59
60 extern int Common_team;
61
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;
66
67
68 extern int Wing_slot_empty_bitmap;
69 extern int Wing_slot_disabled_bitmap;
70
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
74
75 void common_button_do(int i);
76
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();
95
96 void common_set_interface_palette(const char *filename = NULL);         // set the interface palette
97 void common_free_interface_palette();           // restore game palette
98
99 void load_wing_icons(const char *filename);
100 void unload_wing_icons();
101
102 void    common_flash_button_init();
103 int     common_flash_bright();
104
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();
109
110 void    set_active_ui(UI_WINDOW *ui_window);
111
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();
116
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);
119
120 //////////////////////////////////////////////////////////////////////////////////////
121 // NEWSTUFF BEGIN
122 //////////////////////////////////////////////////////////////////////////////////////
123
124 #define MAX_WL_PRIMARY                                                  3
125 #define MAX_WL_SECONDARY                                                4
126 #define MAX_WL_WEAPONS                                                  (MAX_WL_PRIMARY+MAX_WL_SECONDARY)
127
128 #define MAX_WING_SLOTS  4
129 #define MAX_WING_BLOCKS 3
130 #define MAX_WSS_SLOTS   (MAX_WING_BLOCKS*MAX_WING_SLOTS)
131
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)
137
138 #define WING_SLOT_IGNORE        (WING_SLOT_DISABLED|WING_SLOT_LOCKED)
139
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
145
146 // icons
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
154
155 //////////////////////////////////////////////
156 // Slots
157 //////////////////////////////////////////////
158 typedef struct wss_unit {
159         int     ship_class;
160         int     wep[MAX_WL_WEAPONS];
161         int     wep_count[MAX_WL_WEAPONS];
162 } wss_unit;
163
164 extern wss_unit Wss_slots_teams[MAX_TEAMS][MAX_WSS_SLOTS];
165 extern wss_unit *Wss_slots;
166
167 extern int Wss_num_wings; // number of player wings
168 extern int Wss_num_wings_teams[MAX_TEAMS];
169
170 //////////////////////////////////////////////
171 // Weapon pool
172 //////////////////////////////////////////////
173 extern int Wl_pool_teams[MAX_TEAMS][MAX_WEAPON_TYPES];
174 extern int *Wl_pool;
175
176 //////////////////////////////////////////////
177 // Ship pool
178 //////////////////////////////////////////////
179 extern int Ss_pool_teams[MAX_TEAMS][MAX_SHIP_TYPES];
180 extern int *Ss_pool;
181
182 //////////////////////////////////////////////
183 // Saving loadout
184 //////////////////////////////////////////////
185 typedef struct loadout_data 
186 {
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
192 } loadout_data;
193
194 extern loadout_data Player_loadout;
195
196 void wss_save_loadout();
197 void wss_restore_loadout();
198 void wss_direct_restore_loadout();
199
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);
203
204 ///////////////////////////////////////////////////////////
205 // NEWSTUFF END
206 ///////////////////////////////////////////////////////////
207
208 #endif
209