- fixed ammo usage issues with Dehacked modified weapons that switch attack code pointers. Unless Dehacked specifies an 'ammo use' value for a weapon any Dehacked modified weapon determines ammo use by attack function, like Doom did originally, and not by the weapon's AmmoUse property. This also addresses that the Cells/BFG shot value always modified the BFG itself.
- fixed: A_Saw depleted ammo after the attack so it still went through with it, even though it was out of ammo. SVN r3522 (trunk)
This commit is contained in:
parent
35f0b32a7f
commit
b044c134d3
6 changed files with 129 additions and 25 deletions
|
|
@ -430,11 +430,12 @@ bool AWeapon::ShouldStay ()
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
bool AWeapon::CheckAmmo (int fireMode, bool autoSwitch, bool requireAmmo)
|
||||
bool AWeapon::CheckAmmo (int fireMode, bool autoSwitch, bool requireAmmo, int ammocount)
|
||||
{
|
||||
int altFire;
|
||||
int count1, count2;
|
||||
int enough, enoughmask;
|
||||
int lAmmoUse1;
|
||||
|
||||
if ((dmflags & DF_INFINITE_AMMO) || (Owner->player->cheats & CF_INFINITEAMMO))
|
||||
{
|
||||
|
|
@ -457,7 +458,16 @@ bool AWeapon::CheckAmmo (int fireMode, bool autoSwitch, bool requireAmmo)
|
|||
count1 = (Ammo1 != NULL) ? Ammo1->Amount : 0;
|
||||
count2 = (Ammo2 != NULL) ? Ammo2->Amount : 0;
|
||||
|
||||
enough = (count1 >= AmmoUse1) | ((count2 >= AmmoUse2) << 1);
|
||||
if (ammocount >= 0 && (WeaponFlags & WIF_DEHAMMO))
|
||||
{
|
||||
lAmmoUse1 = ammocount;
|
||||
}
|
||||
else
|
||||
{
|
||||
lAmmoUse1 = AmmoUse1;
|
||||
}
|
||||
|
||||
enough = (count1 >= lAmmoUse1) | ((count2 >= AmmoUse2) << 1);
|
||||
if (WeaponFlags & (WIF_PRIMARY_USES_BOTH << altFire))
|
||||
{
|
||||
enoughmask = 3;
|
||||
|
|
@ -492,11 +502,11 @@ bool AWeapon::CheckAmmo (int fireMode, bool autoSwitch, bool requireAmmo)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
bool AWeapon::DepleteAmmo (bool altFire, bool checkEnough)
|
||||
bool AWeapon::DepleteAmmo (bool altFire, bool checkEnough, int ammouse)
|
||||
{
|
||||
if (!((dmflags & DF_INFINITE_AMMO) || (Owner->player->cheats & CF_INFINITEAMMO)))
|
||||
{
|
||||
if (checkEnough && !CheckAmmo (altFire ? AltFire : PrimaryFire, false))
|
||||
if (checkEnough && !CheckAmmo (altFire ? AltFire : PrimaryFire, false, false, ammouse))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -504,7 +514,14 @@ bool AWeapon::DepleteAmmo (bool altFire, bool checkEnough)
|
|||
{
|
||||
if (Ammo1 != NULL)
|
||||
{
|
||||
Ammo1->Amount -= AmmoUse1;
|
||||
if (ammouse >= 0 && (WeaponFlags & WIF_DEHAMMO))
|
||||
{
|
||||
Ammo1->Amount -= ammouse;
|
||||
}
|
||||
else
|
||||
{
|
||||
Ammo1->Amount -= AmmoUse1;
|
||||
}
|
||||
}
|
||||
if ((WeaponFlags & WIF_PRIMARY_USES_BOTH) && Ammo2 != NULL)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue