44 #define IS_BANK_PRIMARY(x) (x < MAX_SHIP_PRIMARY_BANKS)
45 #define IS_BANK_SECONDARY(x) (x >= MAX_SHIP_PRIMARY_BANKS)
47 #define IS_LIST_PRIMARY(x) (Weapon_info[x].subtype != WP_MISSILE)
48 #define IS_LIST_SECONDARY(x) (Weapon_info[x].subtype == WP_MISSILE)
72 #define WEAPON_ANIM_LOOP_FRAME 52 // frame (from 0) to loop weapon anim
74 #define WEAPON_ICON_FRAME_NORMAL 0
75 #define WEAPON_ICON_FRAME_HOT 1
76 #define WEAPON_ICON_FRAME_SELECTED 2
77 #define WEAPON_ICON_FRAME_DISABLED 3
80 #define NUM_WEAPON_SETTINGS 2
82 #define MAX_WEAPON_BUTTONS 8
83 #define MIN_WEAPON_BUTTONS 7
84 #define NUM_WEAPON_BUTTONS (Uses_apply_all_button ? MAX_WEAPON_BUTTONS : MIN_WEAPON_BUTTONS)
87 #define WL_BUTTON_SCROLL_PRIMARY_UP 0
88 #define WL_BUTTON_SCROLL_PRIMARY_DOWN 1
89 #define WL_BUTTON_SCROLL_SECONDARY_UP 2
90 #define WL_BUTTON_SCROLL_SECONDARY_DOWN 3
91 #define WL_BUTTON_RESET 4
92 #define WL_BUTTON_DUMMY 5
93 #define WL_BUTTON_MULTI_LOCK 6
94 #define WL_BUTTON_APPLY_ALL 7
107 wl_buttons(
char *
name,
int x1,
int y1,
int xt1,
int yt1,
int h) : filename(name), x(x1), y(y1), xt(xt1), yt(yt1), hotspot(h) {}
147 "weaponloadoutmulti-m",
148 "2_weaponloadoutmulti-m"
152 "weaponloadoutmulti-mb",
153 "2_weaponloadoutmulti-mb"
182 "WeaponLoadoutMulti",
183 "2_WeaponLoadoutMulti"
186 "WeaponLoadoutMultib",
187 "2_WeaponLoadoutMultib"
191 static int Uses_apply_all_button = 0;
196 static int Num_weapon_select_regions;
199 static bitmap* WeaponSelectMaskPtr;
200 static ubyte* WeaponSelectMaskData;
201 static int Weaponselect_mask_w, Weaponselect_mask_h;
202 static int WeaponSelectMaskBitmap;
203 static int Weapon_slot_bitmap;
209 #define MAX_WEAPON_ICONS_ON_SCREEN 8
262 static int Weapon_anim_class = -1;
263 static int Last_wl_ship_class;
304 static int Wl_delta_x, Wl_delta_y;
346 static int Selected_wl_slot = -1;
347 static int Selected_wl_class = -1;
348 static int Hot_wl_slot = -1;
349 static int Hot_weapon_icon = -1;
350 static int Hot_weapon_bank = -1;
351 static int Hot_weapon_bank_icon = -1;
354 static int Wl_mouse_down_on_region = -1;
358 #define WEAPON_DESC_WIPE_TIME 1.5f // time in seconds for wipe to occur (over WEAPON_DESC_MAX_LENGTH number of chars)
359 #define WEAPON_DESC_MAX_LINES 7 // max lines in the description incl. title
360 #define WEAPON_DESC_MAX_LENGTH 50 // max chars per line of description text
361 static int Weapon_desc_wipe_done = 0;
362 static float Weapon_desc_wipe_time_elapsed = 0.0f;
405 #define WEAPON_SELECT_NUM_TEXT 2
460 if (Selected_wl_class < 0)
463 if (!
stricmp(str,
"@weapon_desc")) {
489 Carried_wl_icon.
num = 0;
518 Carried_wl_icon.
from_x=mx;
519 Carried_wl_icon.
from_y=my;
531 if ( Carried_wl_icon.
from_x != mx || Carried_wl_icon.
from_y != my) {
543 int pilot_index, start_index, end_index,
i;
549 for ( i = start_index; i < end_index; i++ ) {
556 if ( pilot_index == -1 ) {
557 Error(
LOCATION,
"Parse object doesn't have a pilot subsystem\n");
716 static float WeapSelectScreenShipRot = 0.0f;
718 static int display_type = -1;
720 if ( Selected_wl_slot == -1 ) {
730 if (ship_class < 0 || ship_class >= static_cast<int>(
Ship_info.size()))
732 Warning(
LOCATION,
"Invalid ship class (%d) passed for render_overhead_view", ship_class);
738 if (Last_wl_ship_class != ship_class) {
739 if (Last_wl_ship_class != -1) {
742 Last_wl_ship_class = ship_class;
746 wl_ship = &Wl_ships[ship_class];
806 Warning(
LOCATION,
"Unable to load overhead image for ship '%s', generating one instead", sip->
name);
831 mprintf((
"Couldn't load model file in missionweaponchoice.cpp\n"));
842 rot_angles.
p = -(
PI_2);
858 WeapSelectScreenShipRot +=
PI2 * frametime / rev_rate;
859 while (WeapSelectScreenShipRot >
PI2){
860 WeapSelectScreenShipRot -=
PI2;
863 rot_angles.
p = -0.6f;
870 rot_angles.
h = WeapSelectScreenShipRot;
884 light_dir.
xyz.x = 0.5;
885 light_dir.
xyz.y = 2.0f;
886 light_dir.
xyz.z = -2.0f;
930 for(x = 0; x < pm->
n_guns; x++)
932 if((
Wss_slots[Selected_wl_slot].wep[x] == Selected_wl_class && Hot_weapon_bank < 0) || x == Hot_weapon_bank)
969 if (curve == 0 || curve == 2)
972 if (curve == 0 || curve == 1) {
980 if (curve == 0 || curve == 1) {
1025 if (curve == 1 || curve == 3)
1032 if (curve == 1 || curve == 2) {
1039 if (curve == 1 || curve == 2) {
1114 if ( ship_class == - 1 )
1117 Assert(ship_class >= 0 && ship_class < static_cast<int>(
Ship_info.size()));
1118 Assert( Wl_icons != NULL );
1178 if ( Wl_mouse_down_on_region != region_index ) {
1188 if ( weapon_class >= 0 ) {
1189 Selected_wl_class = weapon_class;
1200 int *wep, *wep_count;
1202 if ( Selected_wl_slot == -1 )
1214 if ( wep[index] < 0 || wep_count[index] <= 0 ) {
1222 Selected_wl_class = wep[
index];
1258 int first_frame = -1;
1259 int num_frames = 0,
i;
1262 Assert( Wl_icons != NULL );
1264 icon = &Wl_icons[weapon_class];
1277 if ( first_frame == -1 && icon->
model_index == -1)
1323 Assert( Wl_icons != NULL );
1326 icon = &Wl_icons[
i];
1356 for ( i = 0; i < static_cast<int>(
Ship_info.size()); i++ ) {
1357 wl_ship = &Wl_ships[
i];
1372 for ( i = 0; i < static_cast<int>(
Ship_info.size()); i++ ) {
1373 wl_ship = &Wl_ships[
i];
1397 Selected_wl_slot = -1;
1434 if ( Selected_wl_slot == -1 ) {
1438 if (
Wss_slots[Selected_wl_slot].ship_class < 0 ) {
1455 if ( Selected_wl_class >= 0 )
1472 if (
Plist[i] >= 0 ) {
1473 Selected_wl_class =
Plist[
i];
1480 if (
Slist[i] >= 0 ) {
1481 Selected_wl_class =
Slist[
i];
1492 Selected_wl_slot = slot_num;
1493 if ( Selected_wl_slot >= 0 ) {
1504 if ( wi_index < 0 ) {
1520 if ( wi_index < 0 ) {
1536 Assert(ship_class >= 0 && ship_class < static_cast<int>(
Ship_info.size()));
1576 if ( wep[i] == -1 ) {
1607 if ( pilot_index == -1 )
1646 check_flag =
Ship_info[ship_class].allowed_weapons[wep[
i]];
1651 check_flag =
Ship_info[ship_class].allowed_bank_restricted_weapons[
i][wep[
i]];
1667 int original_ship_class,
i;
1677 if ( ship_class < 0 )
1682 if ( original_ship_class != ship_class ) {
1688 if ( sa_index >= 0 ) {
1694 int ship_index = -1;
1697 Assert(ship_index != -1);
1715 if (
Slist[i] == wi_index )
1719 if ( i == Slist_size )
1720 Slist[Slist_size++] = wi_index;
1724 if (
Plist[i] == wi_index )
1728 if ( i == Plist_size )
1729 Plist[Plist_size++] = wi_index;
1744 if ( wi_index >= 0 ) {
1745 if ( (wep_count[i] > 0) && ((
Wl_pool[wi_index] - wep_count[i]) >= 0) ) {
1755 if ( (
Wl_pool[wi_index] <= 0) || (wep_count[i] == 0) ) {
1757 int wep_pool_index, wep_precedence_index, new_wi_index = -1;
1758 for ( wep_pool_index = 0; wep_pool_index <
MAX_WEAPON_TYPES; wep_pool_index++ ) {
1760 if (
Wl_pool[wep_pool_index] <= 0 ) {
1775 new_wi_index = wep_pool_index;
1780 if ( new_wi_index >= 0 ) {
1785 if ( new_wi_index >= 0 ) {
1786 wep[
i] = new_wi_index;
1787 wi_index = new_wi_index;
1791 int new_wep_count = wep_count[
i];
1794 int secondary_bank_index;
1795 secondary_bank_index = i-3;
1796 if ( secondary_bank_index < 0 ) {
1798 secondary_bank_index = 0;
1803 wep_count[
i] =
MIN(new_wep_count,
Wl_pool[wi_index]);
1804 Assert(wep_count[i] >= 0);
1806 if ( wep_count[i] <= 0 ) {
1882 Wl_icons = Wl_icons_teams[
team];
1969 Weapon_anim_class = -1;
1973 Last_wl_ship_class = -1;
1987 nprintf((
"Alan",
"weapon_select_init() returning without doing anything\n"));
1995 nprintf((
"Alan",
"entering weapon_select_init()\n"));
2001 Uses_apply_all_button = 1;
2005 Uses_apply_all_button = 0;
2010 WeaponSelectMaskBitmap =
bm_load(Wl_loadout_select_mask[Uses_apply_all_button][
gr_screen.
res]);
2011 if (WeaponSelectMaskBitmap < 0) {
2021 Weaponselect_mask_w = -1;
2022 Weaponselect_mask_h = -1;
2026 WeaponSelectMaskData = (
ubyte*)WeaponSelectMaskPtr->
data;
2027 Assert(WeaponSelectMaskData != NULL);
2028 bm_get_info(WeaponSelectMaskBitmap, &Weaponselect_mask_w, &Weaponselect_mask_h);
2033 Num_weapon_select_regions = 0;
2090 Weapon_slot_bitmap =
bm_load(
"weapon_slot");
2123 if ( Selected_wl_slot == -1 ) {
2140 if (
Wss_slots[Selected_wl_slot].wep_count[bank_num] < 0 ) {
2174 Hot_weapon_icon =
index;
2181 if ( Wl_mouse_down_on_region != region_index ){
2198 int dropped_on_slot, is_moved, mx, my;
2200 dropped_on_slot = 0;
2201 Assert(Selected_wl_slot >= 0);
2207 Hot_weapon_bank_icon =
index;
2218 if ( Carried_wl_icon.
from_x != mx || Carried_wl_icon.
from_y != my) {
2219 dropped_on_slot = 1;
2228 if ( Carried_wl_icon.
from_x != mx || Carried_wl_icon.
from_y != my) {
2234 if ( (index < 3) && (
Wss_slots[Selected_wl_slot].wep_count[index] >= 0) )
2235 Hot_weapon_bank =
index;
2237 if ( index >= 3 && (
Wss_slots[Selected_wl_slot].wep_count[index] >= 0) )
2238 Hot_weapon_bank =
index;
2242 return dropped_on_slot;
2277 int *weapon_desc_coords;
2278 int *weapon_title_coords;
2284 weapon_desc_coords = Wl_new_weapon_desc_coords_multi[
gr_screen.
res];
2285 weapon_title_coords = Wl_new_weapon_title_coords_multi[
gr_screen.
res];
2287 weapon_desc_coords = Wl_new_weapon_desc_coords[
gr_screen.
res];
2288 weapon_title_coords = Wl_new_weapon_title_coords[
gr_screen.
res];
2293 if (!Weapon_desc_wipe_done) {
2297 int i,
w,
h, curr_len;
2300 for (i=0; i<2; i++) {
2301 curr_len = strlen(Weapon_desc_lines[i]);
2303 if (bright_char_index < curr_len) {
2305 bright_char[
i] = Weapon_desc_lines[
i][bright_char_index];
2306 Weapon_desc_lines[
i][bright_char_index] =
'\0';
2310 gr_string(weapon_title_coords[0], weapon_title_coords[1]+(line_height*i), Weapon_desc_lines[i],
GR_RESIZE_MENU);
2315 gr_printf_menu(weapon_title_coords[0]+w, weapon_title_coords[1]+(line_height*i),
"%c", bright_char[i]);
2318 Weapon_desc_lines[
i][bright_char_index] = bright_char[
i];
2323 gr_string(weapon_title_coords[0], weapon_title_coords[1]+(line_height*i), Weapon_desc_lines[i],
GR_RESIZE_MENU);
2329 curr_len = strlen(Weapon_desc_lines[i]);
2331 if (bright_char_index < curr_len) {
2333 bright_char[
i] = Weapon_desc_lines[
i][bright_char_index];
2334 Weapon_desc_lines[
i][bright_char_index] =
'\0';
2338 gr_string(weapon_desc_coords[0], weapon_desc_coords[1]+(line_height*(i-2)), Weapon_desc_lines[i],
GR_RESIZE_MENU);
2343 gr_printf_menu(weapon_desc_coords[0]+w, weapon_desc_coords[1]+(line_height*(i-2)),
"%c", bright_char[i]);
2346 Weapon_desc_lines[
i][bright_char_index] = bright_char[
i];
2351 gr_string(weapon_desc_coords[0], weapon_desc_coords[1]+(line_height*(i-2)), Weapon_desc_lines[i],
GR_RESIZE_MENU);
2356 Weapon_desc_wipe_time_elapsed += frametime;
2359 Weapon_desc_wipe_done = 1;
2368 gr_string(weapon_title_coords[0], weapon_title_coords[1] + line_height, Weapon_desc_lines[1],
GR_RESIZE_MENU);
2371 gr_string(weapon_desc_coords[0], weapon_desc_coords[1] + line_height * 2, Weapon_desc_lines[4],
GR_RESIZE_MENU);
2372 gr_string(weapon_desc_coords[0], weapon_desc_coords[1] + line_height * 3, Weapon_desc_lines[5],
GR_RESIZE_MENU);
2383 int currchar_src = 0, currline_dest = 2, currchar_dest = 0,
i;
2385 int title_len = strlen(
Weapon_info[Selected_wl_class].title);
2388 Weapon_desc_wipe_time_elapsed = 0.0f;
2389 Weapon_desc_wipe_done = 0;
2397 while (Weapon_desc_lines[0][currchar_src] !=
' ') {
2399 if (currchar_src <= 0) {
2400 currchar_src = title_len;
2405 Weapon_desc_lines[0][currchar_src] =
'\0';
2406 strcpy_s(Weapon_desc_lines[1], &(Weapon_desc_lines[0][currchar_src+1]));
2409 Weapon_desc_lines[1][0] =
'\0';
2414 if (
Weapon_info[Selected_wl_class].desc != NULL) {
2415 while (
Weapon_info[Selected_wl_class].desc[currchar_src] !=
'\0') {
2416 if (
Weapon_info[Selected_wl_class].desc[currchar_src] ==
'\n') {
2418 if (currchar_src != 0) {
2419 Weapon_desc_lines[currline_dest][currchar_dest] =
'\0';
2425 Weapon_desc_lines[currline_dest][currchar_dest] =
Weapon_info[Selected_wl_class].
desc[currchar_src];
2437 Weapon_desc_lines[currline_dest][currchar_dest] =
'\0';
2439 Weapon_desc_lines[
i][0] =
'\0';
2451 int k, wl_choice, snazzy_action;
2456 wl_choice =
snazzy_menu_do(WeaponSelectMaskData, Weaponselect_mask_w, Weaponselect_mask_h, Num_weapon_select_regions, Weapon_select_region, &snazzy_action, 0);
2458 if ( wl_choice >= 0 ) {
2460 nprintf((
"Alan",
"got one\n"));
2465 Hot_weapon_icon = -1;
2466 Hot_weapon_bank = -1;
2467 Hot_weapon_bank_icon = -1;
2475 Wl_mouse_down_on_region = wl_choice;
2478 if ( wl_choice > -1 ) {
2584 switch (wl_choice) {
2676 int *weapon_ani_coords;
2678 weapon_ani_coords = Wl_weapon_ani_coords_multi[
gr_screen.
res];
2680 weapon_ani_coords = Wl_weapon_ani_coords[
gr_screen.
res];
2683 if(Selected_wl_class != -1 && Wl_icons[Selected_wl_class].model_index != -1) {
2684 static float WeapSelectScreenWeapRot = 0.0f;
2690 weapon_ani_coords[0],
2691 weapon_ani_coords[1],
2694 &WeapSelectScreenWeapRot,
2701 }
else if ( Weapon_anim_class != -1 && ( Selected_wl_class == Weapon_anim_class )) {
2703 if ( Weapon_anim_class != Selected_wl_class )
2710 Weapon_ui_window.
draw();
2731 sx = mx + Wl_delta_x;
2732 sy = my + Wl_delta_y;
2770 half_x = sx +((56 - half_x) / 2);
2771 half_y = sy +((28 - half_y) / 2);
2779 if ( mx == Carried_wl_icon.
from_x && my == Carried_wl_icon.
from_y ) {
2790 diffx = abs(Carried_wl_icon.
from_x-mx);
2791 diffy = abs(Carried_wl_icon.
from_y-my);
2792 if ( (diffx > 2) || (diffy > 2) ) {
2813 if ( Weapon_anim_class != Selected_wl_class) {
2863 nprintf((
"Alan",
"weapon_select_close() returning without doing anything\n"));
2867 nprintf((
"Alan",
"Entering weapon_select_close()\n"));
2882 Selected_wl_class = -1;
2885 if(Weapon_slot_bitmap != -1)
2903 int number_to_draw = (num >= 10000) ? 9999 : num;
2904 Assert(number_to_draw >= 0);
2906 sprintf(buf,
"%d", number_to_draw);
2930 color *color_to_draw = NULL;
2933 if ( Selected_wl_slot == -1 )
2936 icon = &Wl_icons[
index];
2950 if ( (Hot_weapon_icon > -1 && Hot_weapon_icon == hot_mask)
2951 || (Hot_weapon_bank_icon > -1 && Hot_weapon_bank_icon == hot_bank_mask))
2961 if ( Selected_wl_class > -1 ) {
2962 if ( Selected_wl_class == select_mask) {
3012 half_x = x +((56 - half_x) / 2);
3013 half_y = y +((28 - half_y) / 2);
3020 if ( draw_num_flag != 0 ) {
3033 int *wep, *wep_count;
3047 if(Weapon_slot_bitmap != -1)
3063 if ( (wep[i] != -1) && (wep_count[i] > 0) )
3078 Assert( list_count >= 0 && list_count < 8 );
3082 if(Wl_icons[weapon_class].can_use)
3092 Wl_pool[weapon_class], 1, list_count, -1, weapon_class);
3128 int weapon_class, mx, my;
3147 if ( weapon_class < 0 )
3153 if (
Wl_pool[weapon_class] <= 0 ) {
3172 int mx, my, *wep, *wep_count;
3176 if ( Selected_wl_slot == -1 )
3191 if ( (wep[num] < 0) || (wep_count[num] <= 0) ) {
3195 Assert(Wl_icons[wep[num]].can_use);
3205 Carried_wl_icon.
from_x = mx;
3206 Carried_wl_icon.
from_y = my;
3260 int i, j, sidx, pilot_index, max_count;
3267 if ( pilot_index == -1 )
3308 if ( (slot->
wep_count[sidx] > 0) && (slot->
wep[sidx] >= 0) )
3331 if ( weapon_class < 0 )
3334 if ( weapon_class == Weapon_anim_class )
3344 p = strchr(
Weapon_info[weapon_class].anim_filename,
'.' );
3348 strcpy_s(animation_filename,
"2_");
3369 Weapon_anim_class = weapon_class;
3371 if ( Wl_icons[weapon_class].model_index >= 0 )
3407 if ( (slot->
wep_count[i] > 0) && (slot->
wep[i] >= 0) ) {
3434 if ( (slot->
wep_count[sidx] > 0) && (slot->
wep[sidx] >= 0) ) {
3462 tmp = slot->
wep[from_bank];
3463 slot->
wep[from_bank] = slot->
wep[to_bank];
3464 slot->
wep[to_bank] = tmp;
3478 int max_count, overflow;
3484 if ( (slot->
wep[bank] < 0) || (slot->
wep_count[bank] <= 0) ) {
3489 overflow = slot->
wep_count[bank] - max_count;
3490 if ( overflow > 0 ) {
3506 int class_mismatch_flag, forced_update;
3517 return forced_update;
3521 if ( from_bank == to_bank ) {
3523 return forced_update;
3527 if ( slot->
wep[from_bank] == -1 || slot->
wep_count[from_bank] <= 0 ) {
3528 return forced_update;
3533 return forced_update;
3542 if (!class_mismatch_flag) {
3558 sprintf(txt,
XSTR(
"This bank is unable to carry %s weaponry", 1628), display_name);
3562 }
else if (pl != NULL) {
3566 return forced_update;
3578 slot->
wep[to_bank] = -1;
3586 if ( class_mismatch_flag ) {
3589 slot->
wep[from_bank] = -1;
3605 if ( slot->
wep[from_bank] == slot->
wep[to_bank] ) {
3606 int dest_max, dest_can_fit, source_can_give;
3609 dest_can_fit = dest_max - slot->
wep_count[to_bank];
3611 if ( dest_can_fit <= 0 ) {
3613 return forced_update;
3617 source_can_give =
MIN(dest_can_fit, slot->
wep_count[from_bank]);
3619 if ( source_can_give > 0 ) {
3620 slot->
wep_count[to_bank] += source_can_give;
3621 slot->
wep_count[from_bank] -= source_can_give;
3625 return forced_update;
3630 if ( slot->
wep[from_bank] != slot->
wep[to_bank] ) {
3643 return forced_update;
3658 if ( slot->
wep[from_bank] == -1 || slot->
wep_count[from_bank] <= 0 ) {
3664 slot->
wep[from_bank] = -1;
3703 if (
Wl_pool[from_list] <= 0 ) {
3722 sprintf(txt,
XSTR(
"This bank is unable to carry %s weaponry", 1628), display_name);
3726 }
else if (pl != NULL) {
3745 if (
Wl_pool[from_list] < max_fit ) {
3749 Wl_pool[from_list] -= max_fit;
3752 slot->
wep[to_bank] = from_list;
3789 if (
Wl_pool[from_list] <= 0 ) {
3808 sprintf(txt,
XSTR(
"This bank is unable to carry %s weaponry", 1628), display_name);
3812 }
else if (pl != NULL) {
3823 slot->
wep[to_bank] = -1;
3835 if (
Wl_pool[from_list] < max_fit ) {
3838 Wl_pool[from_list] -= max_fit;
3841 slot->
wep[to_bank] = from_list;
3856 int wl_apply(
int mode,
int from_bank,
int from_list,
int to_bank,
int to_list,
int ship_slot,
int player_index,
bool dont_play_sound)
3864 if(player_index == -1){
3889 if ( (sound >= 0) && (player_index == -1) && !dont_play_sound) {
3918 int wl_drop(
int from_bank,
int from_list,
int to_bank,
int to_list,
int ship_slot,
int player_index,
bool dont_play_sound)
3926 if(player_index == -1){
3943 mode =
wss_get_mode(from_bank, from_list, to_bank, to_list, ship_slot);
3945 update =
wl_apply(mode, from_bank, from_list, to_bank, to_list, ship_slot, player_index, dont_play_sound);
3962 int source_wss_slot, cur_wss_slot;
3963 int cur_wing_block, cur_wing_slot, cur_bank;
3964 int weapon_type_to_add,
result;
3971 char *wep_display_name;
3975 bool error_flag =
false;
3982 source_wss_slot = Selected_wl_slot;
3983 if (source_wss_slot == -1)
3984 source_wss_slot = 0;
3993 for (cur_wing_slot = 0; cur_wing_slot <
MAX_WING_SLOTS; cur_wing_slot++)
3995 Assert( Wss_slots != NULL );
3998 cur_wss_slot = cur_wing_block * MAX_WING_SLOTS + cur_wing_slot;
4001 sip = &
Ship_info[Wss_slots[cur_wss_slot].ship_class];
4005 if (cur_wss_slot == source_wss_slot)
4028 wl_drop(cur_bank, -1, -1, Wss_slots[cur_wss_slot].wep[cur_bank], cur_wss_slot, -1,
true);
4031 if (Wss_slots[source_wss_slot].wep[cur_bank] < 0)
4035 weapon_type_to_add = Wss_slots[source_wss_slot].wep[cur_bank];
4043 wep_display_name =
buf;
4055 sprintf(temp,
XSTR(
"%s is unable to carry %s weaponry", 1629), ship_name, wep_display_name);
4056 error_messages.push_back(temp);
4069 sprintf(temp,
XSTR(
"%s is unable to carry %s weaponry in primary bank %d", 1630), ship_name, wep_display_name, cur_bank+1);
4072 error_messages.push_back(temp);
4080 result =
wl_drop(-1, weapon_type_to_add, cur_bank, -1, cur_wss_slot, -1,
true);
4083 if ((result == 0) || (result == 2))
4087 error_messages.push_back(temp);
4101 SCP_string full_error_message =
"The following errors were encountered:\n";
4107 for (i = 0; i < error_messages.size(); i++)
4110 is_duplicate =
false;
4111 for (j = 0; j <
i; j++)
4113 if (error_messages[i] == error_messages[j])
4115 is_duplicate =
true;
4123 full_error_message +=
"\n";
4124 full_error_message += error_messages[
i];
void light_add_directional(const vec3d *dir, float intensity, float r, float g, float b, float spec_r, float spec_g, float spec_b, bool specular)
void gr_rect(int x, int y, int w, int h, int resize_mode)
int wl_dump_to_list(int from_bank, int to_list, int ship_slot, int *sound)
int ss_return_saindex(int slot_num)
void bm_unlock(int handle)
Unlocks a bitmap.
int Plist[MAX_WEAPON_TYPES]
void set_highlight_action(void(*_user_function)(void))
void multi_ts_lock_pressed()
void wl_render_icon_count(int num, int x, int y)
UI_XSTR Weapon_select_text[GR_NUM_RESOLUTIONS][WEAPON_SELECT_NUM_TEXT]
struct screen3d::@234::@236 xyw
int secondary_ammo[MAX_SHIP_SECONDARY_BANKS]
#define IS_BANK_SECONDARY(x)
#define MY_NET_PLAYER_NUM
char tech_model[MAX_FILENAME_LEN]
#define WL_BUTTON_APPLY_ALL
void wl_reset_team_pointers()
void add_XSTR(char *string, int _xstr_id, int _x, int _y, UI_GADGET *_assoc, int _color_type, int _font_id=-1)
int primary_bank_weapons[MAX_SHIP_PRIMARY_BANKS]
void wl_unload_all_anims()
#define GR_RESIZE_MENU_NO_OFFSET
#define MAX_SHIP_PRIMARY_BANKS
char weapon_select_background[GR_NUM_RESOLUTIONS][MAX_FILENAME_LEN]
#define WEAPON_ICON_FRAME_NORMAL
#define ICON_SHIP_SECONDARY_3
void wl_apply_current_loadout_to_all_ships_in_current_wing()
int secondary_bank_weapons[MAX_SHIP_SECONDARY_BANKS]
#define SUBSYS_STATUS_NO_CHANGE
void weapon_select_init_team(int team_num)
GLfloat GLfloat GLfloat GLfloat h
wl_icon_info Wl_icons_teams[MAX_TVT_TEAMS][MAX_WEAPON_TYPES]
void wl_redraw_pressed_buttons()
brief_common_buttons Common_buttons[3][GR_NUM_RESOLUTIONS][NUM_COMMON_BUTTONS]
polymodel * model_get(int model_num)
weapon_info Weapon_info[MAX_WEAPON_TYPES]
void do_mouse_over_list_weapon(int index)
void wl_weapon_desc_start_wipe()
#define MOUSE_LEFT_BUTTON
const char * wl_tooltip_handler(const char *str)
int wl_carried_icon_moved()
#define gr_end_view_matrix
void draw_model_icon(int model_id, int flags, float closeup_zoom, int x, int y, int w, int h, const ship_info *sip, int resize_mode, const vec3d *closeup_pos)
void multi_send_anti_timeout_ping()
int ss_return_original_ship_class(int slot_num)
matrix * vm_angles_2_matrix(matrix *m, const angles *a)
SCP_vector< p_object > Parse_objects
void vm_rotate_matrix_by_angles(matrix *orient, const angles *tangles)
__inline void gr_circle(int xc, int yc, int d, int resize_mode=GR_RESIZE_FULL)
drop a ship icon on a wing slot
#define NUM_WEAPON_SETTINGS
int snazzy_menu_do(ubyte *data, int mask_w, int mask_h, int num_regions, MENU_REGION *regions, int *action, int poll_key, int *key)
int Cmdline_weapon_choice_3d
int allowed_bank_restricted_weapons[MAX_SHIP_WEAPONS][MAX_WEAPON_TYPES]
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
struct wl_ship_class_info wl_ship_class_info
#define GR_NUM_RESOLUTIONS
#define WL_BUTTON_SCROLL_SECONDARY_UP
int Player_weapon_precedence[MAX_WEAPON_TYPES]
#define NETINFO_FLAG_OBSERVER
__inline void gr_string(int x, int y, const char *string, int resize_mode=GR_RESIZE_FULL)
#define WEAPON_DESC_MAX_LENGTH
int secondary_banks[MAX_SHIP_SECONDARY_BANKS]
int subsystem_stricmp(const char *str1, const char *str2)
general failure sound for any event
void wl_free_ship_class_data()
int ss_disabled_slot(int slot_num, bool ship_selection)
char anim_filename[MAX_FILENAME_LEN]
#define ICON_SHIP_PRIMARY_1
int bm_get_info(int handle, int *w, int *h, ubyte *flags, int *nframes, int *fps)
Gets info on the bitmap indexed by handle.
void set_flags(uint flags)
struct vec3d::@225::@227 xyz
void wl_bash_ship_weapons(ship_weapon *swp, wss_unit *slot)
void model_render_immediate(model_render_params *render_info, int model_num, matrix *orient, vec3d *pos, int render, bool sort)
struct carried_icon carried_icon
#define WEAPON_ICON_FRAME_HOT
#define IS_BANK_PRIMARY(x)
void common_check_buttons()
#define WL_BUTTON_MULTI_LOCK
void weapon_select_do(float frametime)
int primary_ammo[MAX_SHIP_PRIMARY_BANKS]
#define GR_MAYBE_CLEAR_RES(bmap)
model_subsystem * subsystems
void set_detail_level_lock(int detail_level_lock)
void wl_reset_selected_slot()
int common_scroll_up_pressed(int *start, int size, int max_show)
void wl_set_team_pointers(int team)
void help_overlay_set_state(int overlay_id, int resolution_index, int state)
void gr_set_color_fast(color *dst)
int restricted_loadout_flag[MAX_SHIP_WEAPONS]
void weapon_select_close_team()
int primary_bank_weapons[MAX_SHIP_PRIMARY_BANKS]
void common_buttons_maybe_reload(UI_WINDOW *ui_window)
#define WEAPON_ICON_FRAME_DISABLED
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
void set_active_ui(UI_WINDOW *ui_window)
void gr_set_bitmap(int bitmap_num, int alphablend_mode, int bitblt_mode, float alpha)
#define WSS_GRAB_FROM_LIST
#define ICON_SHIP_SECONDARY_2
#define COMMON_WEAPON_REGION
int Mouse_down_last_frame
GLenum GLuint GLenum GLsizei const GLchar * buf
void wl_set_disabled_weapons(int ship_class)
const char *(* tooltip_handler)(const char *text)
int bm_release(int handle, int clear_render_targets)
Frees both a bitmap's data and it's associated slot.
void wl_render_overhead_view(float frametime)
void ss_return_name(int wing_block, int wing_slot, char *name)
void snazzy_menu_add_region(MENU_REGION *region, const char *text, int mask, int key, int click_sound)
#define gr_end_proj_matrix
int ss_valid_slot(int slot_num)
#define BMP_AABITMAP
antialiased bitmap
void weapon_select_init()
void generic_anim_unload(generic_anim *ga)
void maybe_select_new_ship_weapon(int index)
#define WL_BUTTON_SCROLL_PRIMARY_UP
int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *keyframe, int can_drop_frames, int dir_type)
Loads a bitmap sequance so we can draw with it.
void wl_update_parse_object_weapons(p_object *pobjp, wss_unit *slot)
int mouse_get_pos_unscaled(int *xpos, int *ypos)
void shadows_end_render()
int wep_count[MAX_SHIP_WEAPONS]
#define IS_LIST_PRIMARY(x)
void common_reset_buttons()
void common_set_interface_palette(char *filename)
void common_flash_button_init()
__inline void gr_set_clip(int x, int y, int w, int h, int resize_mode=GR_RESIZE_FULL)
void draw_forced(int frame_num)
void wl_reset_to_defaults()
#define gr_set_view_matrix
void wl_init_pool(team_data *td)
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
#define MAX_SHIP_SECONDARY_BANKS
int wl_calc_missile_fit(int wi_index, int capacity)
int icon_bmaps[NUM_ICON_FRAMES]
void set_mask_bmap(char *fname)
matrix shadows_start_render(matrix *eye_orient, vec3d *eye_pos, float fov, float aspect, float veryneardist, float neardist, float middist, float fardist)
int set_bmaps(char *ani_filename, int nframes=3, int start_frame=1)
void wl_render_icon(int index, int x, int y, int num, int draw_num_flag, int hot_mask, int hot_bank_mask, int select_mask)
void batch_render_all(int stream_buffer)
int wl_slots_all_empty(wss_unit *slot)
char pof_file[MAX_FILENAME_LEN]
#define gr_set_proj_matrix
void common_redraw_pressed_buttons()
int wl_calc_ballistic_fit(int wi_index, int capacity)
int Slist[MAX_WEAPON_TYPES]
int common_select_do(float frametime)
int do_mouse_over_ship_weapon(int index)
int ss_wing_slot_is_console_player(int index)
void wl_render_weapon_desc()
void wl_maybe_flash_button()
int primary_bank_ammo[MAX_SHIP_PRIMARY_BANKS]
void send_game_chat_packet(net_player *from, const char *msg, int msg_mode, net_player *to, const char *expr, int server_msg)
int multi_ts_disabled_slot(int slot_num, int player_index)
void g3_set_view_matrix(const vec3d *view_pos, const matrix *view_matrix, float zoom)
int Weapon_title_max_width[GR_NUM_RESOLUTIONS]
#define WSS_WEAPON_SELECT
void model_clear_instance(int model_num)
int Cmdline_ship_choice_3d
void weapon_select_common_init()
#define WEAPON_ICON_FRAME_SELECTED
#define WEAPON_SELECT_NUM_TEXT
void multi_ts_commit_pressed()
void draw_wing_block(int wb_num, int hot_slot, int selected_slot, int class_select, bool ship_selection)
void generic_anim_render(generic_anim *ga, float frametime, int x, int y, bool menu)
sprintf(buf,"(%f,%f,%f)", v3->xyz.x, v3->xyz.y, v3->xyz.z)
int wl_update_ship_weapons(int objnum, wss_unit *slot)
int weaponry_pool[MAX_WEAPON_TYPES]
void wl_maybe_reset_selected_slot()
void weapon_select_close()
void weapon_select_render(float frametime)
#define ICON_SHIP_PRIMARY_0
int primary_banks[MAX_SHIP_PRIMARY_BANKS]
ubyte g3_rotate_vertex(vertex *dest, const vec3d *src)
int secondary_bank_weapons[MAX_SHIP_SECONDARY_BANKS]
#define NUM_COMMON_REGIONS
#define NETINFO_FLAG_TEAM_CAPTAIN
void common_select_init()
bitmap * bm_lock(int handle, ubyte bpp, ubyte flags, bool nodebug)
Locks down the bitmap indexed by bitmapnum.
void send_wss_update_packet(int team_num, ubyte *wss_data, int size)
void wl_get_ship_weapons(int ship_index, int *wep, int *wep_count)
void common_set_team_pointers(int team)
#define NETINFO_FLAG_GAME_HOST
#define ICON_FRAME_DISABLED
int secondary_bank_ammo_capacity[MAX_SHIP_SECONDARY_BANKS]
int wss_get_mode(int from_slot, int from_list, int to_slot, int to_list, int wl_ship_slot)
void maybe_select_wl_slot(int block, int slot)
#define SIF_BALLISTIC_PRIMARIES
int model_load(char *filename, int n_subsystems, model_subsystem *subsystems, int ferror=1, int duplicate=0)
void wl_draw_ship_weapons(int index)
struct wl_bitmap_group wl_bitmap_group
#define CF_TYPE_INTERFACE
void model_page_in_textures(int modelnum, int ship_info_index=-1)
int g3_project_vertex(vertex *point)
void wl_init_ship_class_data()
int secondary_bank_ammo[MAX_SHIP_SECONDARY_BANKS]
void common_check_keys(int k)
void common_render_selected_screen_button()
vec3d * vm_vec_unrotate(vec3d *dest, const vec3d *src, const matrix *m)
int eval_weapon_flag_for_game_type(int weapon_flags)
int Cmdline_shadow_quality
object Objects[MAX_OBJECTS]
GLint GLint GLint GLint GLint x
void draw_wl_icon_with_number(int list_count, int weapon_class)
bool Glowpoint_use_depth_buffer
#define WEAPON_DESC_MAX_LINES
const char * XSTR(const char *str, int index)
struct wl_icon_info wl_icon_info
bool end_string_at_first_hash_symbol(char *src)
int Weapon_select_background_bitmap
void maybe_select_new_weapon(int index)
void _cdecl void void _cdecl Error(const char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
#define MAX_WEAPON_ICONS_ON_SCREEN
GLuint const GLchar * name
#define MULTI_TS_MAX_TVT_TEAMS
__inline void gr_line(int x1, int y1, int x2, int y2, int resize_mode=GR_RESIZE_FULL)
int weaponry_count[MAX_WEAPON_TYPES]
void common_buttons_init(UI_WINDOW *ui_window)
#define COMMON_HELP_REGION
#define ICON_FRAME_SELECTED
int bm_load(const char *real_filename)
Loads a bitmap so we can draw with it later.
GLboolean GLboolean GLboolean b
void wl_init_icon_lists()
struct generic_anim::@239::@241 ani
#define NUM_WEAPON_BUTTONS
#define MULTI_PERM_OBSERVER(np)
void wl_add_index_to_list(int wi_index)
int wl_icon_being_carried()
int wl_swap_slot_slot(int from_bank, int to_bank, int ship_slot, int *sound, net_player *pl)
void wl_get_ship_class_weapons(int ship_class, int *wep, int *wep_count)
int common_scroll_down_pressed(int *start, int size, int max_show)
scroll pressed (and scroll)
color Icon_colors[NUM_ICON_FRAMES]
void link_hotspot(int num)
int wl_drop(int from_bank, int from_list, int to_bank, int to_list, int ship_slot, int player_index, bool dont_play_sound)
void create(UI_WINDOW *wnd, char *_text, int _x, int _y, int _w, int _h, int do_repeat=0, int ignore_focus=0)
#define COMMON_COMMIT_REGION
int wep[MAX_SHIP_WEAPONS]
GLubyte GLubyte GLubyte GLubyte w
int Weapon_select_overlay_id
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, float closeup_zoom, float rev_rate, int flags, int resize_mode, int effect)
void create(int _x, int _y, int _w, int _h, int _flags, int _f_id=-1)
void wl_reset_carried_icon()
void gr_get_string_size(int *w, int *h, const char *text, int len=9999)
void generic_anim_init(generic_anim *ga)
void wl_swap_weapons(int ship_slot, int from_bank, int to_bank)
void wl_get_default_weapons(int ship_class, int slot_num, int *wep, int *wep_count)
void weapon_button_do(int i)
int drop_icon_on_slot(int bank_num)
int store_wss_data(ubyte *block, int max_size, int sound, int player_index)
int wl_get_ship_class(int wl_slot)
#define COMMON_OPTIONS_REGION
#define WSS_SWAP_SLOT_SLOT
#define IS_LIST_SECONDARY(x)
SCP_vector< ship_info > Ship_info
void common_play_highlight_sound()
void stop_weapon_animation()
void weapon_buttons_init()
void multi_common_voice_display_status()
ptr_u data
Pointer to data, or maybe offset into VRAM.
BM_TYPE bm_get_type(int handle)
Returns the image type of the given bitmap handle.
#define CF_MAX_FILENAME_LENGTH
#define WSS_SWAP_LIST_SLOT
wl_ship_class_info Wl_ships[MAX_SHIP_CLASSES]
void wl_remove_weps_from_pool(int *wep, int *wep_count, int ship_class)
void wl_get_parseobj_weapons(int sa_index, int ship_class, int *wep, int *wep_count)
void wl_load_icons(int weapon_class)
void weapon_check_buttons()
void wl_dump_carried_icon()
#define ICON_SHIP_SECONDARY_1
void gr_bitmap(int _x, int _y, int resize_mode)
#define UI_XSTR_COLOR_GREEN
team_data Team_data[MAX_TVT_TEAMS]
#define WEAPON_DESC_WIPE_TIME
char pofbitmap_name[MAX_FILENAME_LEN]
#define NETPLAYER_STATE_WEAPON_SELECT
void pick_from_ship_slot(int num)
int mission_ui_background_load(const char *custom_background, const char *single_background, const char *multi_background)
bool gr_unsize_screen_posf(float *x, float *y, float *w, float *h, int resize_mode)
#define ICON_SHIP_PRIMARY_2
int bm_unload(int handle, int clear_render_targets, bool nodebug)
Unloads a bitmap's data, but not the bitmap info.
char filename[MAX_FILENAME_LEN]
subsys_status * Subsys_status
#define MAX_WEAPON_BUTTONS
void wl_saturate_bank(int ship_slot, int bank)
#define WL_BUTTON_SCROLL_SECONDARY_DOWN
void wl_synch_interface()
char alt_name[NAME_LENGTH]
void gamesnd_play_iface(int n)
#define COMMON_BRIEFING_REGION
#define ICON_SHIP_SECONDARY_0
void send_wss_request_packet(short player_id, int from_slot, int from_index, int to_slot, int to_index, int wl_ship_slot, int ship_class, int mode, net_player *p)
int wl_apply(int mode, int from_bank, int from_list, int to_bank, int to_list, int ship_slot, int player_index, bool dont_play_sound)
char overhead_filename[MAX_FILENAME_LEN]
int common_flash_bright()
int wl_swap_list_slot(int from_list, int to_bank, int ship_slot, int *sound, net_player *pl)
int help_overlay_get_index(const char *overlay_name)
int generic_anim_stream(generic_anim *ga)
int wl_get_pilot_subsys_index(p_object *pobjp)
void draw_brackets_square(int x1, int y1, int x2, int y2, int resize_mode)
net_player Net_players[MAX_PLAYERS]
void maybe_drop_icon_on_slot(int bank_num)
void lcl_translate_wep_name_gr(char *name)
int timer_get_milliseconds()
void _cdecl gr_printf_menu(int x, int y, const char *format,...)
drop a ship icon back to the list
void wl_set_selected_slot(int slot_num)
int wl_grab_from_list(int from_list, int to_bank, int ship_slot, int *sound, net_player *pl)
void wl_set_carried_icon(int from_bank, int from_slot, int weapon_class)
void help_overlay_maybe_blit(int overlay_id, int resolution_index)
int help_overlay_active(int overlay_id)
int allowed_weapons[MAX_WEAPON_TYPES]
void start_weapon_animation(int weapon_class)
int Num_player_weapon_precedence
#define ICON_FRAME_NORMAL
void wl_cull_illegal_weapons(int ship_class, int *wep, int *wep_count)
void model_unload(int modelnum, int force=0)
UI_WINDOW Weapon_ui_window
#define WL_BUTTON_SCROLL_PRIMARY_DOWN
#define g3_start_frame(zbuffer_flag)
void wl_maybe_reset_selected_weapon_class()
int ss_return_ship(int wing_block, int wing_slot, int *ship_index, p_object **ppobjp)
void wl_pick_icon_from_list(int index)