When trying to get some of Skulltag's new items to work under ZDoom 2.1.0, I noticed a bug that's preventing some of them from working properly. It's still present in 2.1.2, so here goes.
Basically, whenever you pick up an item, ZDoom goes through each object in the player's inventory, and asks it whether or not it's okay to pick up the item, via the function ::HandlePickup(). Each item subclass (AWeapon, AAmmo, APowerup, etc.) has its own handling of this function. They all start off by checking to see if the item being picked up is of the same class as the item in the inventory.
The problem is that even if you pick up an item of the same class as something in your inventory, this check fails. For example, just now I gave myself the InvulnerabilitySphere. Then, when I give myself another one, APowerup::HandlePickup() is called, and when it compares the class of the item I'm giving to myself ("InvulnerabilitySphere") and the same thing that I just gave to myself that's now in my inventory ("PowerInvulnerable"). The classes don't match, and the function returns false when really it should return true.
I'm not sure what other classes this happens with, but it definitely seems to happen with powerups.
[2.1.2] ::HandlePickup()
Moderator: GZDoom Developers
Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49234
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
This is not a bug. The InvulnerabilitySphere item never goes into the inventory. All it does is to create a PowerInvulnerable item, set up its properties and give that to the player.
The second InvulnerabilitySphere you are giving the player gives another PowerInvulnerable item which in turn is handled by the already active one in the inventory.
The base class isn't called Powerupgiver for nothing.
The second InvulnerabilitySphere you are giving the player gives another PowerInvulnerable item which in turn is handled by the already active one in the inventory.
The base class isn't called Powerupgiver for nothing.
