Move Secondary_weapon to player_info
This commit is contained in:
parent
4ebf66ae7f
commit
b7a5f65d5b
|
@ -168,7 +168,6 @@ void do_secondary_weapon_select(uint_fast32_t weapon_num);
|
|||
}
|
||||
#endif
|
||||
extern player_selected_weapon<primary_weapon_index_t> Primary_weapon;
|
||||
extern sbyte Secondary_weapon;
|
||||
|
||||
void auto_select_primary_weapon();
|
||||
void auto_select_secondary_weapon();
|
||||
|
|
|
@ -109,6 +109,7 @@ struct player_info
|
|||
bool FakingInvul;
|
||||
bool lavafall_hiss_playing;
|
||||
uint8_t missile_gun;
|
||||
int8_t Secondary_weapon;
|
||||
stored_laser_level laser_level;
|
||||
array<uint8_t, MAX_SECONDARY_WEAPONS> secondary_ammo; // How much ammo of each type.
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
|
|
|
@ -1507,7 +1507,7 @@ static int attempt_to_steal_item_3(const vobjptr_t objp, const vobjptr_t player_
|
|||
if (maybe_steal_primary_weapon(player_num, Primary_weapon))
|
||||
return 1;
|
||||
|
||||
if (maybe_steal_secondary_weapon(player_num, Secondary_weapon))
|
||||
if (maybe_steal_secondary_weapon(player_num, player_num->ctype.player_info.Secondary_weapon))
|
||||
return 1;
|
||||
|
||||
// See what the player has and try to snag something.
|
||||
|
|
|
@ -241,7 +241,10 @@ static void do_weapon_n_item_stuff()
|
|||
}
|
||||
|
||||
if (allowed_to_fire_missile() && Controls.state.fire_secondary)
|
||||
Global_missile_firing_count += Weapon_info[Secondary_weapon_to_weapon_info[Secondary_weapon]].fire_count;
|
||||
{
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
Global_missile_firing_count += Weapon_info[Secondary_weapon_to_weapon_info[player_info.Secondary_weapon]].fire_count;
|
||||
}
|
||||
|
||||
if (Global_missile_firing_count) {
|
||||
do_missile_firing(0);
|
||||
|
|
|
@ -1137,13 +1137,12 @@ static void StartNewLevelSecret(int level_num, int page_in_textures)
|
|||
} else {
|
||||
if (PHYSFSX_exists(SECRETC_FILENAME,0))
|
||||
{
|
||||
int sw_save;
|
||||
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
const auto pw_save = Primary_weapon;
|
||||
sw_save = Secondary_weapon;
|
||||
const auto sw_save = player_info.Secondary_weapon;
|
||||
state_restore_all(1, secret_restore::survived, SECRETC_FILENAME, blind_save::no);
|
||||
Primary_weapon = pw_save;
|
||||
Secondary_weapon = sw_save;
|
||||
player_info.Secondary_weapon = sw_save;
|
||||
reset_special_effects();
|
||||
StartSecretLevel();
|
||||
// -- No: This is only for returning to base level: set_pos_from_return_segment();
|
||||
|
@ -1183,14 +1182,13 @@ void ExitSecretLevel(void)
|
|||
|
||||
if (PHYSFSX_exists(SECRETB_FILENAME,0))
|
||||
{
|
||||
int sw_save;
|
||||
|
||||
do_screen_message(TXT_SECRET_RETURN);
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
const auto pw_save = Primary_weapon;
|
||||
sw_save = Secondary_weapon;
|
||||
const auto sw_save = player_info.Secondary_weapon;
|
||||
state_restore_all(1, secret_restore::survived, SECRETB_FILENAME, blind_save::no);
|
||||
Primary_weapon = pw_save;
|
||||
Secondary_weapon = sw_save;
|
||||
player_info.Secondary_weapon = sw_save;
|
||||
} else {
|
||||
// File doesn't exist, so can't return to base level. Advance to next one.
|
||||
if (Entered_from_level == Last_level)
|
||||
|
|
|
@ -1139,15 +1139,16 @@ static void hud_set_primary_weapon_fontcolor(const int consider_weapon)
|
|||
__attribute_warn_unused_result
|
||||
static rgb_t hud_get_secondary_weapon_fontcolor(const int consider_weapon)
|
||||
{
|
||||
if (Secondary_weapon==consider_weapon)
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
if (player_info.Secondary_weapon == consider_weapon)
|
||||
return hud_rgb_red;
|
||||
else{
|
||||
if (get_local_player_secondary_ammo()[consider_weapon]>0)
|
||||
if (player_info.secondary_ammo[consider_weapon])
|
||||
{
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
const auto is_super = (consider_weapon >= 5);
|
||||
const int base_weapon = is_super ? consider_weapon - 5 : consider_weapon;
|
||||
auto &Secondary_last_was_super = get_local_plrobj().ctype.player_info.Secondary_last_was_super;
|
||||
auto &Secondary_last_was_super = player_info.Secondary_last_was_super;
|
||||
if (Secondary_last_was_super[base_weapon])
|
||||
{
|
||||
if (is_super)
|
||||
|
@ -1511,9 +1512,11 @@ static void hud_show_weapons(void)
|
|||
gr_string(bmwx - w, y - (line_spacing * 2), disp_primary_weapon_name, w, h);
|
||||
const char *disp_secondary_weapon_name;
|
||||
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
auto &Secondary_weapon = player_info.Secondary_weapon;
|
||||
disp_secondary_weapon_name = SECONDARY_WEAPON_NAMES_VERY_SHORT(Secondary_weapon);
|
||||
|
||||
snprintf(weapon_str, sizeof(weapon_str), "%s %u", disp_secondary_weapon_name, get_local_player_secondary_ammo()[Secondary_weapon]);
|
||||
snprintf(weapon_str, sizeof(weapon_str), "%s %u", disp_secondary_weapon_name, player_info.secondary_ammo[Secondary_weapon]);
|
||||
gr_get_string_size(weapon_str, &w, &h, nullptr);
|
||||
gr_string(bmwx - w, y - line_spacing, weapon_str, w, h);
|
||||
|
||||
|
@ -2470,10 +2473,12 @@ static void draw_weapon_box1(const local_multires_gauge_graphic multires_gauge_g
|
|||
if (weapon_box_user[1] == WBU_WEAPON)
|
||||
#endif
|
||||
{
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
auto &Secondary_weapon = player_info.Secondary_weapon;
|
||||
draw_weapon_box(1,Secondary_weapon);
|
||||
if (weapon_box_states[1] == WS_SET)
|
||||
{
|
||||
const auto ammo = get_local_player_secondary_ammo()[Secondary_weapon];
|
||||
const auto ammo = player_info.secondary_ammo[Secondary_weapon];
|
||||
if (Newdemo_state == ND_STATE_RECORDING)
|
||||
newdemo_record_secondary_ammo(ammo);
|
||||
draw_secondary_ammo_info(ammo, multires_gauge_graphic);
|
||||
|
@ -2687,7 +2692,9 @@ void show_reticle(int reticle_type, int secondary_display)
|
|||
laser_ready = allowed_to_fire_laser();
|
||||
missile_ready = allowed_to_fire_missile();
|
||||
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
primary_bm_num = (laser_ready && player_has_primary_weapon(Primary_weapon).has_all());
|
||||
auto &Secondary_weapon = player_info.Secondary_weapon;
|
||||
secondary_bm_num = (missile_ready && player_has_secondary_weapon(Secondary_weapon).has_all());
|
||||
|
||||
if (primary_bm_num && Primary_weapon == primary_weapon_index_t::LASER_INDEX && (get_local_player_flags() & PLAYER_FLAGS_QUAD_LASERS))
|
||||
|
@ -3164,14 +3171,15 @@ void draw_hud()
|
|||
if (Newdemo_state == ND_STATE_RECORDING)
|
||||
{
|
||||
int ammo;
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
if ((Primary_weapon == primary_weapon_index_t::VULCAN_INDEX && (ammo = get_local_player_vulcan_ammo(), true))
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
||
|
||||
(Primary_weapon == primary_weapon_index_t::OMEGA_INDEX && (ammo = get_local_plrobj().ctype.player_info.Omega_charge, true))
|
||||
(Primary_weapon == primary_weapon_index_t::OMEGA_INDEX && (ammo = player_info.Omega_charge, true))
|
||||
#endif
|
||||
)
|
||||
newdemo_record_primary_ammo(ammo);
|
||||
newdemo_record_secondary_ammo(get_local_player_secondary_ammo()[Secondary_weapon]);
|
||||
newdemo_record_secondary_ammo(player_info.secondary_ammo[player_info.Secondary_weapon]);
|
||||
}
|
||||
if (PlayerCfg.HudMode == HudType::Hidden) // no hud, "immersion mode"
|
||||
return;
|
||||
|
|
|
@ -2275,16 +2275,15 @@ void release_guided_missile(int player_num)
|
|||
void do_missile_firing(int drop_bomb)
|
||||
{
|
||||
int gun_flag=0;
|
||||
int bomb = which_bomb();
|
||||
int weapon = (drop_bomb) ? bomb : Secondary_weapon;
|
||||
fix fire_frame_overhead = 0;
|
||||
|
||||
Network_laser_track = object_none;
|
||||
|
||||
Assert(weapon < MAX_SECONDARY_WEAPONS);
|
||||
|
||||
auto &plrobj = get_local_plrobj();
|
||||
auto &Next_missile_fire_time = plrobj.ctype.player_info.Next_missile_fire_time;
|
||||
const auto bomb = which_bomb();
|
||||
auto &player_info = plrobj.ctype.player_info;
|
||||
const auto weapon = drop_bomb ? bomb : player_info.Secondary_weapon;
|
||||
assert(weapon < MAX_SECONDARY_WEAPONS);
|
||||
auto &Next_missile_fire_time = player_info.Next_missile_fire_time;
|
||||
if (GameTime64 - Next_missile_fire_time <= FrameTime) // if firing is prolonged by FrameTime overhead, let's try to fix that.
|
||||
fire_frame_overhead = GameTime64 - Next_missile_fire_time;
|
||||
|
||||
|
@ -2351,7 +2350,7 @@ void do_missile_firing(int drop_bomb)
|
|||
}
|
||||
|
||||
// don't autoselect if dropping prox and prox not current weapon
|
||||
if (!drop_bomb || Secondary_weapon == bomb)
|
||||
if (!drop_bomb || player_info.Secondary_weapon == bomb)
|
||||
auto_select_secondary_weapon(); //select next missile, if this one out of ammo
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1054,7 +1054,7 @@ void newdemo_record_start_demo()
|
|||
nd_write_byte(nd_record_v_player_shields = static_cast<int8_t>(f2ir(get_local_player_shields())));
|
||||
nd_write_int(nd_record_v_player_flags = get_local_player_flags().get_player_flags()); // be sure players flags are set
|
||||
nd_write_byte(static_cast<int8_t>(static_cast<primary_weapon_index_t>(Primary_weapon)));
|
||||
nd_write_byte(static_cast<int8_t>(static_cast<secondary_weapon_index_t>(Secondary_weapon)));
|
||||
nd_write_byte(static_cast<int8_t>(static_cast<secondary_weapon_index_t>(player_info.Secondary_weapon)));
|
||||
nd_record_v_start_frame = nd_record_v_frame_number = 0;
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
nd_record_v_player_afterburner = 0;
|
||||
|
@ -1332,8 +1332,9 @@ void newdemo_record_player_weapon(int weapon_type, int weapon_num)
|
|||
nd_write_byte( ND_EVENT_PLAYER_WEAPON );
|
||||
nd_write_byte(static_cast<int8_t>(nd_record_v_weapon_type = weapon_type));
|
||||
nd_write_byte(static_cast<int8_t>(nd_record_v_weapon_num = weapon_num));
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
nd_write_byte(weapon_type
|
||||
? static_cast<int8_t>(static_cast<secondary_weapon_index_t>(Secondary_weapon))
|
||||
? static_cast<int8_t>(static_cast<secondary_weapon_index_t>(player_info.Secondary_weapon))
|
||||
: static_cast<int8_t>(static_cast<primary_weapon_index_t>(Primary_weapon))
|
||||
);
|
||||
}
|
||||
|
@ -1855,6 +1856,7 @@ static int newdemo_read_demo_start(enum purpose_type purpose)
|
|||
nd_read_byte(&v);
|
||||
Primary_weapon = static_cast<primary_weapon_index_t>(v);
|
||||
}
|
||||
auto &Secondary_weapon = player_info.Secondary_weapon;
|
||||
nd_read_byte(&Secondary_weapon);
|
||||
if (purpose == PURPOSE_REWRITE)
|
||||
{
|
||||
|
@ -2524,10 +2526,11 @@ static int newdemo_read_frame_information(int rewrite)
|
|||
break;
|
||||
}
|
||||
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
if (weapon_type == 0)
|
||||
Primary_weapon = static_cast<primary_weapon_index_t>(weapon_num);
|
||||
else
|
||||
Secondary_weapon = static_cast<int>(weapon_num);
|
||||
player_info.Secondary_weapon = static_cast<int>(weapon_num);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -2546,16 +2549,17 @@ static int newdemo_read_frame_information(int rewrite)
|
|||
nd_write_byte(old_weapon);
|
||||
break;
|
||||
}
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
if ((Newdemo_vcr_state == ND_STATE_PLAYBACK) || (Newdemo_vcr_state == ND_STATE_FASTFORWARD) || (Newdemo_vcr_state == ND_STATE_ONEFRAMEFORWARD)) {
|
||||
if (weapon_type == 0)
|
||||
Primary_weapon = static_cast<primary_weapon_index_t>(weapon_num);
|
||||
else
|
||||
Secondary_weapon = static_cast<int>(weapon_num);
|
||||
player_info.Secondary_weapon = static_cast<int>(weapon_num);
|
||||
} else if ((Newdemo_vcr_state == ND_STATE_REWINDING) || (Newdemo_vcr_state == ND_STATE_ONEFRAMEBACKWARD)) {
|
||||
if (weapon_type == 0)
|
||||
Primary_weapon = static_cast<primary_weapon_index_t>(old_weapon);
|
||||
else
|
||||
Secondary_weapon = static_cast<int>(old_weapon);
|
||||
player_info.Secondary_weapon = static_cast<int>(old_weapon);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2942,10 +2946,11 @@ static int newdemo_read_frame_information(int rewrite)
|
|||
break;
|
||||
}
|
||||
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
if ((Newdemo_vcr_state == ND_STATE_REWINDING) || (Newdemo_vcr_state == ND_STATE_ONEFRAMEBACKWARD))
|
||||
get_local_player_secondary_ammo()[Secondary_weapon] = old_ammo;
|
||||
player_info.secondary_ammo[player_info.Secondary_weapon] = old_ammo;
|
||||
else if ((Newdemo_vcr_state == ND_STATE_PLAYBACK) || (Newdemo_vcr_state == ND_STATE_FASTFORWARD) || (Newdemo_vcr_state == ND_STATE_ONEFRAMEFORWARD))
|
||||
get_local_player_secondary_ammo()[Secondary_weapon] = new_ammo;
|
||||
player_info.secondary_ammo[player_info.Secondary_weapon] = new_ammo;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3315,6 +3320,7 @@ void newdemo_goto_end(int to_rewrite)
|
|||
|
||||
nd_read_byte(reinterpret_cast<int8_t *>(&energy));
|
||||
nd_read_byte(reinterpret_cast<int8_t *>(&shield));
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
get_local_player_energy() = i2f(energy);
|
||||
get_local_player_shields() = i2f(shield);
|
||||
int recorded_player_flags;
|
||||
|
@ -3333,7 +3339,7 @@ void newdemo_goto_end(int to_rewrite)
|
|||
{
|
||||
int8_t v;
|
||||
nd_read_byte(&v);
|
||||
Secondary_weapon = static_cast<secondary_weapon_index_t>(v);
|
||||
player_info.Secondary_weapon = static_cast<secondary_weapon_index_t>(v);
|
||||
}
|
||||
for (int i = 0; i < MAX_PRIMARY_WEAPONS; i++)
|
||||
{
|
||||
|
@ -3348,7 +3354,6 @@ void newdemo_goto_end(int to_rewrite)
|
|||
int8_t i;
|
||||
nd_read_byte(&i);
|
||||
const stored_laser_level laser_level(i);
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
if (player_info.laser_level != laser_level) {
|
||||
player_info.laser_level = laser_level;
|
||||
if (!to_rewrite)
|
||||
|
@ -3741,8 +3746,9 @@ static void newdemo_write_end()
|
|||
nd_write_byte((sbyte)(f2ir(get_local_player_energy())));
|
||||
nd_write_byte((sbyte)(f2ir(get_local_player_shields())));
|
||||
nd_write_int(get_local_player_flags().get_player_flags()); // be sure players flags are set
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
nd_write_byte(static_cast<int8_t>(static_cast<primary_weapon_index_t>(Primary_weapon)));
|
||||
nd_write_byte(static_cast<int8_t>(static_cast<secondary_weapon_index_t>(Secondary_weapon)));
|
||||
nd_write_byte(static_cast<int8_t>(static_cast<secondary_weapon_index_t>(player_info.Secondary_weapon)));
|
||||
byte_count += 8;
|
||||
|
||||
for (int i = 0; i < MAX_PRIMARY_WEAPONS; i++)
|
||||
|
@ -3752,7 +3758,6 @@ static void newdemo_write_end()
|
|||
nd_write_short(i);
|
||||
byte_count += (sizeof(short) * (MAX_PRIMARY_WEAPONS + MAX_SECONDARY_WEAPONS));
|
||||
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
nd_write_byte(player_info.laser_level);
|
||||
byte_count++;
|
||||
|
||||
|
|
|
@ -994,6 +994,7 @@ int state_save_all_sub(const char *filename, const char *desc)
|
|||
|
||||
//Save player info
|
||||
//PHYSFS_write(fp, &Players[Player_num], sizeof(player), 1);
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
state_write_player(fp, get_local_player(), get_local_player_shields(), get_local_plrobj().ctype.player_info);
|
||||
|
||||
// Save the current weapon info
|
||||
|
@ -1001,7 +1002,7 @@ int state_save_all_sub(const char *filename, const char *desc)
|
|||
int8_t v = static_cast<int8_t>(static_cast<primary_weapon_index_t>(Primary_weapon));
|
||||
PHYSFS_write(fp, &v, sizeof(int8_t), 1);
|
||||
}
|
||||
PHYSFS_write(fp, &Secondary_weapon, sizeof(sbyte), 1);
|
||||
PHYSFS_write(fp, &player_info.Secondary_weapon, sizeof(sbyte), 1);
|
||||
|
||||
// Save the difficulty level
|
||||
PHYSFS_write(fp, &Difficulty_level, sizeof(int), 1);
|
||||
|
@ -1173,7 +1174,6 @@ int state_save_all_sub(const char *filename, const char *desc)
|
|||
PHYSFS_write(fp, &Afterburner_charge, sizeof(fix), 1);
|
||||
|
||||
//save last was super information
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
{
|
||||
auto &Primary_last_was_super = player_info.Primary_last_was_super;
|
||||
array<uint8_t, MAX_PRIMARY_WEAPONS> last_was_super{};
|
||||
|
@ -1500,12 +1500,14 @@ int state_restore_all_sub(const char *filename, const secret_restore secret)
|
|||
if (Game_mode & GM_MULTI_COOP)
|
||||
get_local_player().objnum = coop_org_objnum;
|
||||
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
// Restore the weapon states
|
||||
{
|
||||
int8_t v;
|
||||
PHYSFS_read(fp, &v, sizeof(int8_t), 1);
|
||||
Primary_weapon = static_cast<primary_weapon_index_t>(v);
|
||||
}
|
||||
auto &Secondary_weapon = player_info.Secondary_weapon;
|
||||
PHYSFS_read(fp, &Secondary_weapon, sizeof(sbyte), 1);
|
||||
|
||||
select_primary_weapon(nullptr, Primary_weapon, 0);
|
||||
|
@ -1736,7 +1738,6 @@ int state_restore_all_sub(const char *filename, const secret_restore secret)
|
|||
}
|
||||
if (version>=12) {
|
||||
//read last was super information
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
auto &Primary_last_was_super = player_info.Primary_last_was_super;
|
||||
array<uint8_t, MAX_PRIMARY_WEAPONS> last_was_super;
|
||||
/* Descent 2 shipped with Primary_last_was_super and
|
||||
|
|
|
@ -118,7 +118,6 @@ namespace dcx {
|
|||
unsigned N_weapon_types;
|
||||
}
|
||||
player_selected_weapon<primary_weapon_index_t> Primary_weapon;
|
||||
sbyte Secondary_weapon;
|
||||
static sbyte Delayed_secondary;
|
||||
|
||||
// autoselect ordering
|
||||
|
@ -408,7 +407,8 @@ void CyclePrimary ()
|
|||
|
||||
void CycleSecondary ()
|
||||
{
|
||||
CycleWeapon<cycle_secondary_state>({}, Secondary_weapon);
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
CycleWeapon<cycle_secondary_state>({}, player_info.Secondary_weapon);
|
||||
}
|
||||
|
||||
|
||||
|
@ -470,6 +470,8 @@ void select_secondary_weapon(const char *const weapon_name, const uint_fast32_t
|
|||
|
||||
{
|
||||
auto &plrobj = get_local_plrobj();
|
||||
auto &player_info = plrobj.ctype.player_info;
|
||||
auto &Secondary_weapon = player_info.Secondary_weapon;
|
||||
if (Secondary_weapon != weapon_num) {
|
||||
auto &Next_missile_fire_time = plrobj.ctype.player_info.Next_missile_fire_time;
|
||||
if (wait_for_rearm)
|
||||
|
@ -625,7 +627,7 @@ void do_secondary_weapon_select(uint_fast32_t weapon_num)
|
|||
|
||||
{
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
current = Secondary_weapon;
|
||||
current = player_info.Secondary_weapon;
|
||||
auto &Secondary_last_was_super = player_info.Secondary_last_was_super;
|
||||
last_was_super = Secondary_last_was_super[weapon_num];
|
||||
has_flag = weapon_status.has_weapon_flag | weapon_status.has_ammo_flag;
|
||||
|
@ -699,7 +701,8 @@ void auto_select_primary_weapon()
|
|||
|
||||
void auto_select_secondary_weapon()
|
||||
{
|
||||
if (!player_has_secondary_weapon(Secondary_weapon).has_all())
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
if (!player_has_secondary_weapon(player_info.Secondary_weapon).has_all())
|
||||
auto_select_weapon<cycle_secondary_state>({});
|
||||
}
|
||||
|
||||
|
@ -719,7 +722,8 @@ void delayed_autoselect()
|
|||
}
|
||||
if (!Controls.state.fire_secondary)
|
||||
{
|
||||
const auto secondary_weapon = Secondary_weapon;
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
const auto secondary_weapon = player_info.Secondary_weapon;
|
||||
const auto delayed_secondary = Delayed_secondary;
|
||||
if (delayed_secondary != secondary_weapon)
|
||||
{
|
||||
|
@ -801,7 +805,8 @@ int pick_up_secondary(int weapon_index,int count)
|
|||
//we want to do a mini-auto-selection that applies to the drop bomb key
|
||||
|
||||
if (weapon_index_is_player_bomb(weapon_index) &&
|
||||
!weapon_index_is_player_bomb(Secondary_weapon)) {
|
||||
!weapon_index_is_player_bomb(player_info.Secondary_weapon))
|
||||
{
|
||||
auto &last = player_info.Secondary_last_was_super[PROXIMITY_INDEX];
|
||||
if (weapon_order < SOrderList(last ? SMART_MINE_INDEX : PROXIMITY_INDEX))
|
||||
last = (weapon_index == SMART_MINE_INDEX);
|
||||
|
@ -1395,7 +1400,9 @@ void DropSecondaryWeapon ()
|
|||
if (num_objects >= MAX_USED_OBJECTS)
|
||||
return;
|
||||
|
||||
auto &secondary_ammo = get_local_player_secondary_ammo()[Secondary_weapon];
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
auto &Secondary_weapon = player_info.Secondary_weapon;
|
||||
auto &secondary_ammo = player_info.secondary_ammo[Secondary_weapon];
|
||||
if (secondary_ammo == 0)
|
||||
{
|
||||
HUD_init_message_literal(HM_DEFAULT, "No secondary weapon to drop!");
|
||||
|
|
Loading…
Reference in a new issue