Pass player_info to auto_select_secondary_weapon
This commit is contained in:
parent
00ccd3f6f6
commit
1be7344d56
|
@ -169,9 +169,10 @@ void do_secondary_weapon_select(uint_fast32_t weapon_num);
|
|||
#endif
|
||||
|
||||
void auto_select_primary_weapon();
|
||||
void auto_select_secondary_weapon();
|
||||
#ifdef dsx
|
||||
namespace dsx {
|
||||
struct player_info;
|
||||
void auto_select_secondary_weapon(player_info &);
|
||||
void select_primary_weapon(const char *weapon_name, uint_fast32_t weapon_num, int wait_for_rearm);
|
||||
void select_secondary_weapon(const char *weapon_name, uint_fast32_t weapon_num, int wait_for_rearm);
|
||||
|
||||
|
|
|
@ -1411,7 +1411,8 @@ static int maybe_steal_flag_item(const vobjptr_t playerobjp, const PLAYER_FLAG f
|
|||
// ----------------------------------------------------------------------------
|
||||
static int maybe_steal_secondary_weapon(const vobjptr_t playerobjp, int weapon_num)
|
||||
{
|
||||
if (auto &secondary_ammo = playerobjp->ctype.player_info.secondary_ammo[weapon_num])
|
||||
auto &player_info = playerobjp->ctype.player_info;
|
||||
if (auto &secondary_ammo = player_info.secondary_ammo[weapon_num])
|
||||
if (d_rand() < THIEF_PROBABILITY) {
|
||||
if (weapon_index_is_player_bomb(weapon_num))
|
||||
{
|
||||
|
@ -1423,7 +1424,7 @@ static int maybe_steal_secondary_weapon(const vobjptr_t playerobjp, int weapon_n
|
|||
Stolen_items[Stolen_item_index] = Secondary_weapon_to_powerup[weapon_num];
|
||||
thief_message("%s stolen!", SECONDARY_WEAPON_NAMES(weapon_num)); // Danger! Danger! Use of literal! Danger!
|
||||
if (-- secondary_ammo == 0)
|
||||
auto_select_secondary_weapon();
|
||||
auto_select_secondary_weapon(player_info);
|
||||
|
||||
// -- compress_stolen_items();
|
||||
digi_play_sample_once(SOUND_WEAPON_STOLEN, F1_0);
|
||||
|
|
|
@ -2353,7 +2353,7 @@ void do_missile_firing(int drop_bomb)
|
|||
|
||||
// don't autoselect if dropping prox and prox not current weapon
|
||||
if (!drop_bomb || player_info.Secondary_weapon == bomb)
|
||||
auto_select_secondary_weapon(); //select next missile, if this one out of ammo
|
||||
auto_select_secondary_weapon(player_info); //select next missile, if this one out of ammo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -711,15 +711,14 @@ void auto_select_primary_weapon()
|
|||
auto_select_weapon<cycle_primary_state>({});
|
||||
}
|
||||
|
||||
void auto_select_secondary_weapon()
|
||||
namespace dsx {
|
||||
|
||||
void auto_select_secondary_weapon(player_info &player_info)
|
||||
{
|
||||
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>({});
|
||||
}
|
||||
|
||||
namespace dsx {
|
||||
|
||||
void delayed_autoselect(player_info &player_info)
|
||||
{
|
||||
if (!Controls.state.fire_primary)
|
||||
|
@ -1532,7 +1531,7 @@ void DropSecondaryWeapon ()
|
|||
|
||||
if (secondary_ammo == 0)
|
||||
{
|
||||
auto_select_secondary_weapon();
|
||||
auto_select_secondary_weapon(player_info);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue