FS2_Open
Open source remastering of the Freespace 2 engine
missionscreencommon.h
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 #ifndef _MISSION_SCREEN_COMMON_HEADER_FILE
13 #define _MISSION_SCREEN_COMMON_HEADER_FILE
14 
15 #include "globalincs/globals.h"
16 #include "model/model.h"
17 #include "ui/ui.h"
18 
19 #define BACKGROUND_FRAME_TO_START_SHIP_ANIM 87
20 #define BUTTON_SLIDE_IN_FRAME 1
21 
23 // Common to briefing/ship selection/weapons loadout
25 #define REVOLUTION_RATE 5.2f
26 
27 #define COMMON_BRIEFING_REGION 0
28 #define COMMON_SS_REGION 1
29 #define COMMON_WEAPON_REGION 2
30 #define COMMON_COMMIT_REGION 5
31 #define COMMON_HELP_REGION 6
32 #define COMMON_OPTIONS_REGION 7
33 #define NUM_COMMON_REGIONS 6
34 
35 #define NUM_COMMON_BUTTONS 6
36 
38  char *filename;
39  int x, y;
40  int xt, yt;
41  int hotspot;
42  int repeat;
43  UI_BUTTON button; // because we have a class inside this struct, we need the constructor below..
44 
45  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) {}
46 };
47 
49 
50 extern int Background_playing;
51 
52 extern int Common_select_inited;
53 extern int Current_screen;
54 
55 extern int Common_team;
56 
57 extern int Drop_icon_mflag;
58 extern int Drop_on_wing_mflag;
59 extern int Brief_mouse_up_flag;
60 extern int Mouse_down_last_frame;
61 
62 
63 extern int Wing_slot_empty_bitmap;
64 extern int Wing_slot_disabled_bitmap;
65 
66 extern int Flash_timer; // timestamp used to start flashing
67 extern int Flash_toggle; // timestamp used to toggle flashing
68 extern int Flash_bright; // state of button to flash
69 
70 void common_button_do(int i);
71 
72 // common_select_init() performs initialization common to the briefing/ship select/weapon select
73 // screens. This includes loading/setting the palette, loading the background animation, loading
74 // the screen switching animations, loading the button animation frames
75 void common_select_init();
76 int common_select_do(float frametime);
77 void common_select_close();
78 void common_draw_buttons();
80 void common_check_keys(int k);
81 void commit_pressed();
82 void common_render(float frametime);
83 void common_buttons_init(UI_WINDOW *ui_window);
84 void common_buttons_maybe_reload(UI_WINDOW *ui_window);
90 
91 int mission_ui_background_load(const char *custom_background, const char *single_background, const char *multi_background = NULL);
92 
93 void common_set_interface_palette(char *filename = NULL); // set the interface palette
94 void common_free_interface_palette(); // restore game palette
95 
96 void load_wing_icons(char *filename);
97 void unload_wing_icons();
98 
100 int common_flash_bright();
101 
102 // functions for the multiplayer chat window
104 void multi_chat_scroll_up();
106 
107 void set_active_ui(UI_WINDOW *ui_window);
108 
109 // music functions exported for multiplayer team selection screen to start briefing music
110 void common_music_init( int score_index );
111 void common_music_do();
112 void common_music_close();
113 
114 int common_num_cutscenes_valid(int movie_type);
115 void common_maybe_play_cutscene(int movie_type, bool restart_music = false, int music = 0);
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 
121 // NEWSTUFF BEGIN
123 
124 #define MAX_WING_SLOTS 4
125 #define MAX_WING_BLOCKS 3
126 #define MAX_WSS_SLOTS (MAX_WING_BLOCKS*MAX_WING_SLOTS)
127 
128 #define WING_SLOT_FILLED (1<<0)
129 #define WING_SLOT_EMPTY (1<<1)
130 #define WING_SLOT_IS_PLAYER (1<<3)
131 #define WING_SLOT_LOCKED (1<<4)
132 #define WING_SLOT_SHIPS_DISABLED (1<<5)
133 #define WING_SLOT_WEAPONS_DISABLED (1<<6)
134 
135 #define WING_SLOT_DISABLED (WING_SLOT_SHIPS_DISABLED|WING_SLOT_WEAPONS_DISABLED)
136 #define WING_SLOT_IGNORE_SHIPS (WING_SLOT_SHIPS_DISABLED|WING_SLOT_LOCKED)
137 #define WING_SLOT_IGNORE_WEAPONS (WING_SLOT_WEAPONS_DISABLED|WING_SLOT_LOCKED)
138 
139 // different operations used in xx_apply()
140 #define WSS_DUMP_TO_LIST 0
141 #define WSS_GRAB_FROM_LIST 1
142 #define WSS_SWAP_SLOT_SLOT 2
143 #define WSS_SWAP_LIST_SLOT 3
144 
145 // icons
146 #define NUM_ICON_FRAMES 6
147 #define ICON_FRAME_NORMAL 0
148 #define ICON_FRAME_HOT 1
149 #define ICON_FRAME_SELECTED 2
150 #define ICON_FRAME_PLAYER 3
151 #define ICON_FRAME_DISABLED 4
152 #define ICON_FRAME_DISABLED_HIGH 5
153 
154 //Colors
157 
159 // Slots
161 typedef struct wss_unit {
165 } wss_unit;
166 
168 extern wss_unit *Wss_slots;
169 
170 extern int Wss_num_wings; // number of player wings
172 
174 // Weapon pool
177 extern int *Wl_pool;
178 
180 // Ship pool
183 extern int *Ss_pool;
184 
186 // Saving loadout
188 typedef struct loadout_data
189 {
190  char filename[MAX_FILENAME_LEN]; // mission filename
191  char last_modified[DATE_TIME_LENGTH]; // when mission was last modified
192  wss_unit unit_data[MAX_WSS_SLOTS]; // ship and weapon data
193  int weapon_pool[MAX_WEAPON_TYPES]; // available weapons
194  int ship_pool[MAX_SHIP_CLASSES]; // available ships
195 } loadout_data;
196 
198 
199 void wss_save_loadout();
202 
203 int wss_get_mode(int from_slot, int from_list, int to_slot, int to_list, int wl_ship_slot);
204 int store_wss_data(ubyte *block, int max_size, int sound,int player_index);
205 int restore_wss_data(ubyte *block);
206 
207 class ship_info;
208 void draw_model_icon(int model_id, int flags, float closeup_zoom, int x1, int x2, int y1, int y2, const ship_info* sip = NULL, int resize_mode = GR_RESIZE_FULL, const vec3d *closeup_pos = &vmd_zero_vector);
209 void draw_model_rotating(model_render_params *render_info, int model_id, int x1, int y1, int x2, int y2, float *rotation_buffer, vec3d *closeup_pos=NULL, float closeup_zoom = .65f, float rev_rate = REVOLUTION_RATE, int flags = MR_AUTOCENTER | MR_NO_FOGGING, int resize_mode=GR_RESIZE_FULL, int effect = 2);
210 
213 
215 // NEWSTUFF END
217 
218 #endif
void common_set_team_pointers(int team)
Definition: sound.cpp:39
void common_button_do(int i)
#define MAX_FILENAME_LEN
Definition: pstypes.h:324
void common_maybe_clear_focus()
void common_draw_buttons()
int i
Definition: multi_pxo.cpp:466
int Drop_on_wing_mflag
void common_free_interface_palette()
void common_buttons_maybe_reload(UI_WINDOW *ui_window)
GLfloat GLfloat GLfloat GLfloat h
Definition: Glext.h:7280
loadout_data Player_loadout
int Wss_num_wings
int Wl_pool_teams[MAX_TVT_TEAMS][MAX_WEAPON_TYPES]
int wss_get_mode(int from_slot, int from_list, int to_slot, int to_list, int wl_ship_slot)
void common_check_keys(int k)
void draw_model_icon(int model_id, int flags, float closeup_zoom, int x1, int x2, int y1, int y2, const ship_info *sip=NULL, int resize_mode=GR_RESIZE_FULL, const vec3d *closeup_pos=&vmd_zero_vector)
int Wss_num_wings_teams[MAX_TVT_TEAMS]
void unload_wing_icons()
void multi_chat_scroll_down()
Definition: pstypes.h:88
char filename[MAX_FILENAME_LEN]
#define GR_NUM_RESOLUTIONS
Definition: 2d.h:651
void common_maybe_play_cutscene(int movie_type, bool restart_music=false, int music=0)
int Brief_mouse_up_flag
void common_music_do()
int weapon_pool[MAX_WEAPON_TYPES]
Definition: 2d.h:95
CButton * team
GLclampf f
Definition: Glext.h:7097
Definition: 2d.h:82
int * Wl_pool
brief_common_buttons Common_buttons[3][GR_NUM_RESOLUTIONS][NUM_COMMON_BUTTONS]
#define MAX_WSS_SLOTS
void commit_pressed()
Definition: ui.h:195
int Wing_slot_empty_bitmap
void common_music_init(int score_index)
GLsizeiptr size
Definition: Glext.h:5496
int Flash_toggle
void common_reset_buttons()
void common_reset_team_pointers()
int wep_count[MAX_SHIP_WEAPONS]
int Common_select_inited
void common_redraw_pressed_buttons()
int common_flash_bright()
int restore_wss_data(ubyte *block)
void common_select_close()
void common_render_selected_screen_button()
int Drop_icon_mflag
GLdouble GLdouble GLdouble r
Definition: Glext.h:5337
#define NUM_ICON_FRAMES
#define MAX_SHIP_WEAPONS
Definition: globals.h:64
#define MAX_SHIP_CLASSES
Definition: globals.h:48
char * filename
void common_render_chat_window()
#define MAX_WEAPON_TYPES
Definition: globals.h:73
wss_unit unit_data[MAX_WSS_SLOTS]
void wss_maybe_restore_loadout()
int Wing_slot_disabled_bitmap
vec3d closeup_pos
Definition: ship.h:1327
void common_check_buttons()
color Icon_colors[NUM_ICON_FRAMES]
int * Ss_pool
void common_render(float frametime)
void ship_select_common_init()
void common_music_close()
int Common_team
int common_num_cutscenes_valid(int movie_type)
int common_select_do(float frametime)
unsigned char ubyte
Definition: pstypes.h:62
#define DATE_TIME_LENGTH
Definition: globals.h:19
shader Icon_shaders[NUM_ICON_FRAMES]
int Ss_pool_teams[MAX_TVT_TEAMS][MAX_SHIP_CLASSES]
struct wss_unit wss_unit
GLuint start
Definition: Gl.h:1502
#define GR_RESIZE_FULL
Definition: 2d.h:682
GLbitfield flags
Definition: Glext.h:6722
int Flash_bright
GLuint const GLchar * name
Definition: Glext.h:5608
int Mouse_down_last_frame
#define NUM_COMMON_BUTTONS
int common_scroll_up_pressed(int *start, int size, int max_show)
int wep[MAX_SHIP_WEAPONS]
int mission_ui_background_load(const char *custom_background, const char *single_background, const char *multi_background=NULL)
void multi_chat_scroll_up()
int Background_playing
void set_active_ui(UI_WINDOW *ui_window)
Definition: ui.h:584
void common_select_init()
wss_unit Wss_slots_teams[MAX_TVT_TEAMS][MAX_WSS_SLOTS]
struct loadout_data loadout_data
wss_unit * Wss_slots
void common_flash_button_init()
void draw_model_rotating(model_render_params *render_info, int model_id, int x1, int y1, int x2, int y2, float *rotation_buffer, vec3d *closeup_pos=NULL, float closeup_zoom=.65f, float rev_rate=REVOLUTION_RATE, int flags=MR_AUTOCENTER|MR_NO_FOGGING, int resize_mode=GR_RESIZE_FULL, int effect=2)
void common_buttons_init(UI_WINDOW *ui_window)
#define MAX_TVT_TEAMS
Definition: globals.h:57
int common_scroll_down_pressed(int *start, int size, int max_show)
void wss_save_loadout()
#define REVOLUTION_RATE
void common_set_interface_palette(char *filename=NULL)
brief_common_buttons(char *name, int x1, int y1, int xt1, int yt1, int h, int r=0)
float closeup_zoom
Definition: ship.h:1328
int Flash_timer
vec3d vmd_zero_vector
Definition: vecmat.cpp:24
#define MR_NO_FOGGING
Definition: model.h:884
int ship_pool[MAX_SHIP_CLASSES]
int Current_screen
void load_wing_icons(char *filename)
int store_wss_data(ubyte *block, int max_size, int sound, int player_index)
char last_modified[DATE_TIME_LENGTH]
void wss_direct_restore_loadout()
#define MR_AUTOCENTER
Definition: model.h:875