Pass player_info to do_secondary_weapon_select

This commit is contained in:
Kp 2016-10-02 00:34:45 +00:00
parent 888415f086
commit 86a4942883
3 changed files with 4 additions and 7 deletions

View file

@ -163,9 +163,9 @@ public:
#ifdef dsx
namespace dsx {
void do_primary_weapon_select(uint_fast32_t weapon_num);
void do_secondary_weapon_select(uint_fast32_t weapon_num);
struct player_info;
void do_secondary_weapon_select(player_info &, uint_fast32_t weapon_num);
void auto_select_primary_weapon(player_info &);
void auto_select_secondary_weapon(player_info &);
void select_primary_weapon(player_info &, const char *weapon_name, uint_fast32_t weapon_num, int wait_for_rearm);

View file

@ -234,6 +234,7 @@ int which_bomb()
namespace dsx {
static void do_weapon_n_item_stuff()
{
auto &player_info = get_local_plrobj().ctype.player_info;
if (Controls.state.fire_flare > 0)
{
Controls.state.fire_flare = 0;
@ -243,7 +244,6 @@ static void do_weapon_n_item_stuff()
if (allowed_to_fire_missile() && Controls.state.fire_secondary)
{
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;
}
@ -267,7 +267,7 @@ static void do_weapon_n_item_stuff()
const auto select_weapon = exchange(Controls.state.select_weapon, 0) - 1;
const auto weapon_num = select_weapon > 4 ? select_weapon - 5 : select_weapon;
if (select_weapon > 4)
do_secondary_weapon_select(weapon_num);
do_secondary_weapon_select(player_info, weapon_num);
else
do_primary_weapon_select(weapon_num);
}
@ -291,7 +291,6 @@ static void do_weapon_n_item_stuff()
#if defined(DXX_BUILD_DESCENT_II)
if (Controls.state.toggle_bomb > 0)
{
auto &player_info = get_local_plrobj().ctype.player_info;
auto &Secondary_last_was_super = player_info.Secondary_last_was_super;
int bomb = Secondary_last_was_super[PROXIMITY_INDEX]?PROXIMITY_INDEX:SMART_MINE_INDEX;
@ -317,7 +316,6 @@ static void do_weapon_n_item_stuff()
Controls.state.toggle_bomb = 0;
}
auto &player_info = get_local_plrobj().ctype.player_info;
if (Controls.state.energy_to_shield && (player_info.powerup_flags & PLAYER_FLAGS_CONVERTER))
transfer_energy_to_shield();
#endif

View file

@ -625,9 +625,8 @@ void do_primary_weapon_select(uint_fast32_t weapon_num)
select_primary_weapon(player_info, weapon_name, weapon_num, 1);
}
void do_secondary_weapon_select(uint_fast32_t weapon_num)
void do_secondary_weapon_select(player_info &player_info, uint_fast32_t weapon_num)
{
auto &player_info = get_local_plrobj().ctype.player_info;
#if defined(DXX_BUILD_DESCENT_I)
//added on 10/9/98 by Victor Rachels to add laser cycle
//end this section addition - Victor Rachels