[2.1.2] ::HandlePickup()

Bugs that have been investigated and resolved somehow.

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.
Post Reply
User avatar
Carnevil
Posts: 307
Joined: Sat Aug 23, 2003 4:46 pm

[2.1.2] ::HandlePickup()

Post by Carnevil »

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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

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. ;)
User avatar
Carnevil
Posts: 307
Joined: Sat Aug 23, 2003 4:46 pm

Post by Carnevil »

Ah, alright. I see it now. The powerup giver spawns the powerup, runs TryPickup(), and THEN it the check works out properly.

My bad :) It works fine. Thanks Graf.
Post Reply

Return to “Closed Bugs [GZDoom]”