mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 13:11:33 +00:00
- Since GetParentAmmo is now virtual, BackpackItem and the "give ammo" cheat should call GetParentAmmo to determine base ammo classes.
This commit is contained in:
parent
cea97e5cc6
commit
68091db598
2 changed files with 14 additions and 13 deletions
|
@ -249,11 +249,10 @@ class BackpackItem : Inventory
|
|||
uint end = AllActorClasses.Size();
|
||||
for (uint i = 0; i < end; ++i)
|
||||
{
|
||||
let type = AllActorClasses[i];
|
||||
let ammotype = (class<Ammo>)(AllActorClasses[i]);
|
||||
|
||||
if (type.GetParentClass() == 'Ammo')
|
||||
if (ammotype && GetDefaultByType(ammotype).GetParentAmmo() == ammotype)
|
||||
{
|
||||
let ammotype = (class<Ammo>)(type);
|
||||
let ammoitem = Ammo(other.FindInventory(ammotype));
|
||||
int amount = GetDefaultByType(ammotype).BackpackAmount;
|
||||
// extra ammo in baby mode and nightmare mode
|
||||
|
@ -314,20 +313,22 @@ class BackpackItem : Inventory
|
|||
{
|
||||
for (let probe = Owner.Inv; probe != NULL; probe = probe.Inv)
|
||||
{
|
||||
if (probe.GetParentClass() == 'Ammo')
|
||||
let ammoitem = Ammo(probe);
|
||||
|
||||
if (ammoitem && ammoitem.GetParentAmmo() == ammoitem.GetClass())
|
||||
{
|
||||
if (probe.Amount < probe.MaxAmount || sv_unlimited_pickup)
|
||||
if (ammoitem.Amount < ammoitem.MaxAmount || sv_unlimited_pickup)
|
||||
{
|
||||
int amount = Ammo(probe).Default.BackpackAmount;
|
||||
int amount = ammoitem.Default.BackpackAmount;
|
||||
// extra ammo in baby mode and nightmare mode
|
||||
if (!bIgnoreSkill)
|
||||
{
|
||||
amount = int(amount * G_SkillPropertyFloat(SKILLP_AmmoFactor));
|
||||
}
|
||||
probe.Amount += amount;
|
||||
if (probe.Amount > probe.MaxAmount && !sv_unlimited_pickup)
|
||||
ammoitem.Amount += amount;
|
||||
if (ammoitem.Amount > ammoitem.MaxAmount && !sv_unlimited_pickup)
|
||||
{
|
||||
probe.Amount = probe.MaxAmount;
|
||||
ammoitem.Amount = ammoitem.MaxAmount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,14 +99,14 @@ extend class PlayerPawn
|
|||
// he doesn't have it already, and set each to its maximum.
|
||||
for (i = 0; i < AllActorClasses.Size(); ++i)
|
||||
{
|
||||
type = (class<Inventory>)(AllActorClasses[i]);
|
||||
let ammotype = (class<Ammo>)(AllActorClasses[i]);
|
||||
|
||||
if (type != null && type.GetParentClass() == "Ammo")
|
||||
if (ammotype && GetDefaultByType(ammotype).GetParentAmmo() == ammotype)
|
||||
{
|
||||
let ammoitem = FindInventory(type);
|
||||
let ammoitem = FindInventory(ammotype);
|
||||
if (ammoitem == NULL)
|
||||
{
|
||||
ammoitem = Inventory(Spawn (type));
|
||||
ammoitem = Inventory(Spawn (ammotype));
|
||||
ammoitem.AttachToOwner (self);
|
||||
ammoitem.Amount = ammoitem.MaxAmount;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue