1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
|
/*
* Copyright (C) Volition, Inc. 1999. All rights reserved.
*
* All source code herein is the property of Volition, Inc. You may not sell
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
#ifndef _MISSION_SCREEN_COMMON_HEADER_FILE
#define _MISSION_SCREEN_COMMON_HEADER_FILE
#include "globalincs/globals.h"
#include "gamesnd/gamesnd.h"
#include "model/model.h"
#include "ui/ui.h"
#define BACKGROUND_FRAME_TO_START_SHIP_ANIM 87
#define BUTTON_SLIDE_IN_FRAME 1
///////////////////////////////////////////////////////
// Common to briefing/ship selection/weapons loadout
///////////////////////////////////////////////////////
#define REVOLUTION_RATE 5.2f
#define COMMON_BRIEFING_REGION 0
#define COMMON_SS_REGION 1
#define COMMON_WEAPON_REGION 2
#define COMMON_COMMIT_REGION 5
#define COMMON_HELP_REGION 6
#define COMMON_OPTIONS_REGION 7
#define NUM_COMMON_REGIONS 6
#define NUM_COMMON_BUTTONS 6
struct brief_common_buttons {
const char *filename;
int x, y;
int xt, yt;
int hotspot;
int repeat;
UI_BUTTON button; // because we have a class inside this struct, we need the constructor below..
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) {}
};
extern brief_common_buttons Common_buttons[3][GR_NUM_RESOLUTIONS][NUM_COMMON_BUTTONS];
extern int Background_playing;
extern int Common_select_inited;
extern int Current_screen;
extern int Common_team;
extern int Drop_icon_mflag;
extern int Drop_on_wing_mflag;
extern int Brief_mouse_up_flag;
extern int Mouse_down_last_frame;
extern int Wing_slot_empty_bitmap;
extern int Wing_slot_disabled_bitmap;
extern UI_TIMESTAMP Flash_timer; // timestamp used to start flashing
extern UI_TIMESTAMP Flash_toggle; // timestamp used to toggle flashing
extern int Flash_bright; // state of button to flash
extern int anim_timer_start;
void common_button_do(int i);
//If new enums are added here be sure to also update the description for the API version in scripting\api\libs\ui.cpp - Mjn
enum class commit_pressed_status {
SUCCESS,
GENERAL_FAIL,
PLAYER_NO_WEAPONS,
NO_REQUIRED_WEAPON,
NO_REQUIRED_WEAPON_MULTIPLE,
BANK_GAP_ERROR,
PLAYER_NO_SLOT,
MULTI_PLAYERS_NO_SHIPS,
MULTI_NOT_ALL_ASSIGNED,
MULTI_NO_PRIMARY,
MULTI_NO_SECONDARY
};
// common_select_init() performs initialization common to the briefing/ship select/weapon select
// screens. This includes loading/setting the palette, loading the background animation, loading
// the screen switching animations, loading the button animation frames
void common_select_init(bool API_Access = false);
int common_select_do(float frametime);
void common_select_close();
void common_draw_buttons();
void common_check_buttons();
void common_check_keys(int k);
commit_pressed_status commit_pressed(bool API_Access = false);
void common_render(float frametime);
void common_buttons_init(UI_WINDOW *ui_window);
void common_buttons_maybe_reload(UI_WINDOW *ui_window);
void common_render_selected_screen_button();
void common_reset_buttons();
void common_redraw_pressed_buttons();
void common_maybe_clear_focus();
void ship_select_common_init(bool API_Access = false);
void common_setup_room_lights();
int mission_ui_background_load(const char *custom_background, const char *single_background, const char *multi_background = NULL);
void common_set_interface_palette(const char *filename = NULL); // set the interface palette
void common_free_interface_palette(); // restore game palette
void load_wing_icons(const char *filename);
void unload_wing_icons();
void common_flash_button_init();
int common_flash_bright();
void set_active_ui(UI_WINDOW *ui_window);
// music functions exported for multiplayer team selection screen to start briefing music
const char *common_music_get_filename(int score_index);
void common_music_init( int score_index );
void common_music_do();
void common_music_close();
int common_num_cutscenes_valid(int movie_type);
void common_maybe_play_cutscene(int movie_type, bool restart_music = false, int music = 0);
void common_play_cutscene(const char* filename, bool restart_music = false, int music = 0);
int common_scroll_down_pressed(int *start, int size, int max_show);
int common_scroll_up_pressed(int *start, int size, int max_show);
//////////////////////////////////////////////////////////////////////////////////////
// NEWSTUFF BEGIN
//////////////////////////////////////////////////////////////////////////////////////
#define MAX_WING_SLOTS 4
#define MAX_WING_BLOCKS 3
#define MAX_WSS_SLOTS (MAX_WING_BLOCKS*MAX_WING_SLOTS)
#define WING_SLOT_FILLED (1<<0)
#define WING_SLOT_EMPTY (1<<1)
#define WING_SLOT_IS_PLAYER (1<<3)
#define WING_SLOT_LOCKED (1<<4)
#define WING_SLOT_SHIPS_DISABLED (1<<5)
#define WING_SLOT_WEAPONS_DISABLED (1<<6)
#define WING_SLOT_DISABLED (WING_SLOT_SHIPS_DISABLED|WING_SLOT_WEAPONS_DISABLED)
#define WING_SLOT_IGNORE_SHIPS (WING_SLOT_SHIPS_DISABLED|WING_SLOT_LOCKED)
#define WING_SLOT_IGNORE_WEAPONS (WING_SLOT_WEAPONS_DISABLED|WING_SLOT_LOCKED)
// different operations used in xx_apply()
#define WSS_DUMP_TO_LIST 0
#define WSS_GRAB_FROM_LIST 1
#define WSS_SWAP_SLOT_SLOT 2
#define WSS_SWAP_LIST_SLOT 3
// icons
#define NUM_ICON_FRAMES 6
#define ICON_FRAME_NORMAL 0
#define ICON_FRAME_HOT 1
#define ICON_FRAME_SELECTED 2
#define ICON_FRAME_PLAYER 3
#define ICON_FRAME_DISABLED 4
#define ICON_FRAME_DISABLED_HIGH 5
//Colors
extern color Icon_colors[NUM_ICON_FRAMES];
extern shader Icon_shaders[NUM_ICON_FRAMES];
//////////////////////////////////////////////
// Slots
//////////////////////////////////////////////
typedef struct wss_unit {
int ship_class;
int wep[MAX_SHIP_WEAPONS];
int wep_count[MAX_SHIP_WEAPONS];
} wss_unit;
extern wss_unit Wss_slots_teams[MAX_TVT_TEAMS][MAX_WSS_SLOTS];
extern wss_unit *Wss_slots;
extern int Wss_num_wings; // number of player wings
extern int Wss_num_wings_teams[MAX_TVT_TEAMS];
//////////////////////////////////////////////
// Weapon pool
//////////////////////////////////////////////
extern int Wl_pool_teams[MAX_TVT_TEAMS][MAX_WEAPON_TYPES];
extern int *Wl_pool;
//////////////////////////////////////////////
// Ship pool
//////////////////////////////////////////////
extern int Ss_pool_teams[MAX_TVT_TEAMS][MAX_SHIP_CLASSES];
extern int *Ss_pool;
//////////////////////////////////////////////
// Saving loadout
//////////////////////////////////////////////
typedef struct loadout_data
{
char filename[MAX_FILENAME_LEN]; // mission filename
char last_modified[DATE_TIME_LENGTH]; // when mission was last modified
wss_unit unit_data[MAX_WSS_SLOTS]; // ship and weapon data
int weapon_pool[MAX_WEAPON_TYPES]; // available weapons
int ship_pool[MAX_SHIP_CLASSES]; // available ships
} loadout_data;
extern loadout_data Player_loadout;
void wss_save_loadout();
void wss_maybe_restore_loadout();
void wss_direct_restore_loadout();
int wss_get_mode(int from_slot, int from_list, int to_slot, int to_list, int wl_ship_slot);
int store_wss_data(ubyte *data, const unsigned int max_size, interface_snd_id sound, int player_index);
int restore_wss_data(ubyte *data);
class ship_info;
void draw_model_icon(int model_id, uint64_t flags, float closeup_zoom, int x1, int x2, int y1, int y2, ship_info* sip = NULL, int resize_mode = GR_RESIZE_FULL, const vec3d *closeup_pos = &vmd_zero_vector);
void draw_model_rotating(model_render_params *render_info, int model_id, int x1, int y1, int x2, int y2, float *rotation_buffer, const vec3d *closeup_pos=nullptr, float closeup_zoom = .65f, float rev_rate = REVOLUTION_RATE, uint64_t flags = MR_AUTOCENTER | MR_NO_FOGGING, int resize_mode=GR_RESIZE_FULL, int effect = 2);
void common_set_team_pointers(int team);
void common_reset_team_pointers();
void common_fire_stage_script_hook(int old_stage, int new_stage);
///////////////////////////////////////////////////////////
// NEWSTUFF END
///////////////////////////////////////////////////////////
#endif
|