[2.1.2] ::HandlePickup()
Posted: Mon Jul 17, 2006 3:39 am
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.
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.