- Changed AWeaponGiver to keep the weapon actor around instead of respawning a new

one for each call.
- Fixed: AWeaponGiver::TryPickup checked the wrong item for ammo to give.
- fixed: FRandom::Random2(int mask) must return the difference between 2 byte values
  for compatibility.
- fixed: The sound name world/volcano/shoot was accidentally destroyed in the source.


SVN r1671 (trunk)
This commit is contained in:
Christoph Oelckers 2009-06-19 21:00:18 +00:00
commit e11cac7e89
4 changed files with 28 additions and 13 deletions

View file

@ -618,23 +618,30 @@ IMPLEMENT_CLASS(AWeaponGiver)
bool AWeaponGiver::TryPickup(AActor *&toucher)
{
FDropItem *di = GetDropItems();
AWeapon *weap;
if (di != NULL)
{
const PClass *ti = PClass::FindClass(di->Name);
if (ti->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
{
AWeapon *weap = static_cast<AWeapon*>(Spawn(di->Name, 0, 0, 0, NO_REPLACE));
if (weap != NULL)
if (master == NULL)
{
weap->ItemFlags &= ~IF_ALWAYSPICKUP; // use the flag of this item only.
if (weap->AmmoGive1 >= 0) weap->AmmoGive1 = AmmoGive1;
if (weap->AmmoGive2 >= 0) weap->AmmoGive2 = AmmoGive2;
bool res = weap->CallTryPickup(toucher);
if (!res) weap->Destroy();
else GoAwayAndDie();
return res;
master = weap = static_cast<AWeapon*>(Spawn(di->Name, 0, 0, 0, NO_REPLACE));
if (weap != NULL)
{
weap->ItemFlags &= ~IF_ALWAYSPICKUP; // use the flag of this item only.
if (AmmoGive1 >= 0) weap->AmmoGive1 = AmmoGive1;
if (AmmoGive2 >= 0) weap->AmmoGive2 = AmmoGive2;
weap->BecomeItem();
}
else return false;
}
weap = barrier_cast<AWeapon*>(master);
bool res = weap->CallTryPickup(toucher);
if (res) GoAwayAndDie();
return res;
}
}
return false;