Pass player_info to pick_up_primary
This commit is contained in:
parent
2bd5b80451
commit
c94cec40d0
|
@ -193,12 +193,12 @@ has_weapon_result player_has_secondary_weapon(const player_info &, int weapon_nu
|
|||
#ifdef dsx
|
||||
namespace dsx {
|
||||
int pick_up_secondary(int weapon_index,int count);
|
||||
int pick_up_primary(player_info &, int weapon_index);
|
||||
|
||||
//called when a primary weapon is picked up
|
||||
//returns true if actually picked up
|
||||
}
|
||||
#endif
|
||||
int pick_up_primary(int weapon_index);
|
||||
|
||||
//called when ammo (for the vulcan cannon) is picked up
|
||||
|
||||
|
|
|
@ -218,7 +218,8 @@ static int pick_up_energy(void)
|
|||
|
||||
static int pick_up_primary_or_energy(int weapon_index)
|
||||
{
|
||||
const auto used = pick_up_primary(weapon_index);
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
const auto used = pick_up_primary(player_info, weapon_index);
|
||||
if (used || (Game_mode & GM_MULTI))
|
||||
return used;
|
||||
return pick_up_energy();
|
||||
|
@ -458,7 +459,7 @@ int do_powerup(const vobjptridx_t obj)
|
|||
++ player_info.laser_level;
|
||||
powerup_basic(10, 0, 10, LASER_SCORE, "%s %s %d",TXT_LASER,TXT_BOOSTED_TO, player_info.laser_level+1);
|
||||
update_laser_weapon_info();
|
||||
pick_up_primary (primary_weapon_index_t::LASER_INDEX);
|
||||
pick_up_primary(player_info, primary_weapon_index_t::LASER_INDEX);
|
||||
used=1;
|
||||
}
|
||||
if (!used && !(Game_mode & GM_MULTI) )
|
||||
|
@ -486,7 +487,7 @@ int do_powerup(const vobjptridx_t obj)
|
|||
|
||||
case POW_VULCAN_WEAPON:
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
if ((used = pick_up_primary(primary_weapon_index_t::VULCAN_INDEX)) != 0) {
|
||||
if ((used = pick_up_primary(player_info, primary_weapon_index_t::VULCAN_INDEX)) != 0) {
|
||||
vulcan_ammo_to_add_with_cannon = obj->ctype.powerup_info.count;
|
||||
if (vulcan_ammo_to_add_with_cannon < VULCAN_WEAPON_AMMO_AMOUNT) vulcan_ammo_to_add_with_cannon = VULCAN_WEAPON_AMMO_AMOUNT;
|
||||
pick_up_vulcan_ammo(player_info, vulcan_ammo_to_add_with_cannon);
|
||||
|
@ -514,7 +515,7 @@ int do_powerup(const vobjptridx_t obj)
|
|||
case POW_GAUSS_WEAPON: {
|
||||
int ammo = obj->ctype.powerup_info.count;
|
||||
|
||||
used = pick_up_primary((get_powerup_id(obj) == POW_VULCAN_WEAPON)
|
||||
used = pick_up_primary(player_info, (get_powerup_id(obj) == POW_VULCAN_WEAPON)
|
||||
? primary_weapon_index_t::VULCAN_INDEX
|
||||
: primary_weapon_index_t::GAUSS_INDEX
|
||||
);
|
||||
|
@ -566,7 +567,7 @@ int do_powerup(const vobjptridx_t obj)
|
|||
break;
|
||||
|
||||
case POW_OMEGA_WEAPON:
|
||||
used = pick_up_primary(primary_weapon_index_t::OMEGA_INDEX);
|
||||
used = pick_up_primary(player_info, primary_weapon_index_t::OMEGA_INDEX);
|
||||
if (used)
|
||||
player_info.Omega_charge = obj->ctype.powerup_info.count;
|
||||
if (!used && !(Game_mode & GM_MULTI) )
|
||||
|
|
|
@ -893,12 +893,12 @@ uint_fast32_t SOrderList (uint_fast32_t num)
|
|||
return search_weapon_order_list<cycle_secondary_state>(num);
|
||||
}
|
||||
|
||||
namespace dsx {
|
||||
//called when a primary weapon is picked up
|
||||
//returns true if actually picked up
|
||||
int pick_up_primary(int weapon_index)
|
||||
int pick_up_primary(player_info &player_info, int weapon_index)
|
||||
{
|
||||
ushort flag = HAS_PRIMARY_FLAG(weapon_index);
|
||||
auto &player_info = get_local_plrobj().ctype.player_info;
|
||||
|
||||
if (weapon_index != primary_weapon_index_t::LASER_INDEX &&
|
||||
(player_info.primary_weapon_flags & flag))
|
||||
|
@ -920,7 +920,6 @@ int pick_up_primary(int weapon_index)
|
|||
}
|
||||
|
||||
#if defined(DXX_BUILD_DESCENT_II)
|
||||
namespace dsx {
|
||||
void check_to_use_primary_super_laser(player_info &player_info)
|
||||
{
|
||||
if (!(player_info.primary_weapon_flags & HAS_SUPER_LASER_FLAG))
|
||||
|
@ -935,10 +934,8 @@ void check_to_use_primary_super_laser(player_info &player_info)
|
|||
}
|
||||
PALETTE_FLASH_ADD(7,14,21);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace dsx {
|
||||
static void maybe_autoselect_vulcan_weapon(player_info &player_info)
|
||||
{
|
||||
#if defined(DXX_BUILD_DESCENT_I)
|
||||
|
|
Loading…
Reference in a new issue