mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- Fixed: WeaponGiver did not give half ammo when dropped.
SVN r4238 (trunk)
This commit is contained in:
parent
5dc034c2ed
commit
ecdde24bda
2 changed files with 35 additions and 4 deletions
|
@ -730,10 +730,41 @@ bool AWeaponGiver::TryPickup(AActor *&toucher)
|
|||
master = weap = static_cast<AWeapon*>(Spawn(di->Name, 0, 0, 0, NO_REPLACE));
|
||||
if (weap != NULL)
|
||||
{
|
||||
fixed_t dropammofactor;
|
||||
weap->ItemFlags &= ~IF_ALWAYSPICKUP; // use the flag of this item only.
|
||||
weap->flags = (weap->flags & ~MF_DROPPED) | (this->flags & MF_DROPPED);
|
||||
if (AmmoGive1 >= 0) weap->AmmoGive1 = AmmoGive1;
|
||||
if (AmmoGive2 >= 0) weap->AmmoGive2 = AmmoGive2;
|
||||
|
||||
// If we're not overriding the ammo given amounts, then apply dropped
|
||||
// item modifications if needed.
|
||||
if (weap->flags & MF_DROPPED)
|
||||
{
|
||||
dropammofactor = G_SkillProperty(SKILLP_DropAmmoFactor);
|
||||
if (dropammofactor < 0)
|
||||
{
|
||||
dropammofactor = FRACUNIT/2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dropammofactor = FRACUNIT;
|
||||
}
|
||||
|
||||
if (AmmoGive1 < 0)
|
||||
{
|
||||
weap->AmmoGive1 = FixedMul(weap->AmmoGive1, dropammofactor);
|
||||
}
|
||||
else
|
||||
{
|
||||
weap->AmmoGive1 = AmmoGive1;
|
||||
}
|
||||
if (AmmoGive2 < 0)
|
||||
{
|
||||
weap->AmmoGive2 = FixedMul(weap->AmmoGive2, dropammofactor);
|
||||
}
|
||||
else
|
||||
{
|
||||
weap->AmmoGive2 = AmmoGive2;
|
||||
}
|
||||
weap->BecomeItem();
|
||||
}
|
||||
else return false;
|
||||
|
|
|
@ -3023,14 +3023,14 @@ void ModifyDropAmount(AInventory *inv, int dropamount)
|
|||
{
|
||||
// Half ammo when dropped by bad guys.
|
||||
inv->Amount = inv->GetClass()->Meta.GetMetaInt (AIMETA_DropAmount, MAX(1, FixedMul(inv->Amount, dropammofactor)));
|
||||
inv->ItemFlags|=flagmask;
|
||||
inv->ItemFlags |= flagmask;
|
||||
}
|
||||
else if (inv->IsKindOf (RUNTIME_CLASS(AWeapon)))
|
||||
{
|
||||
// The same goes for ammo from a weapon.
|
||||
static_cast<AWeapon *>(inv)->AmmoGive1 = FixedMul(static_cast<AWeapon *>(inv)->AmmoGive1, dropammofactor);
|
||||
static_cast<AWeapon *>(inv)->AmmoGive2 = FixedMul(static_cast<AWeapon *>(inv)->AmmoGive2, dropammofactor);
|
||||
inv->ItemFlags|=flagmask;
|
||||
inv->ItemFlags |= flagmask;
|
||||
}
|
||||
else if (inv->IsKindOf (RUNTIME_CLASS(ADehackedPickup)))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue