[2.1.2] ::HandlePickup()

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 a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: [2.1.2] ::HandlePickup()

by Carnevil » Mon Jul 17, 2006 4:45 am

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.

by Graf Zahl » Mon Jul 17, 2006 4:02 am

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. ;)

[2.1.2] ::HandlePickup()

by Carnevil » 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.

Top