Custom enemy attacks no longer heal players

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
lizardcommando
Posts: 1489
Joined: Thu Sep 07, 2006 12:24 pm
Location: Boringland, California

Custom enemy attacks no longer heal players

Post by lizardcommando »

I was told that I should report this by one of the mods so here it goes:

I remember that in older versions of ZDoom and GZdoom, in order to make enemy attacks and projectiles heal the player, all you had to do was change the "Damage" flag to a negative number. Now it seems like that no longer works. This is a feature that is needed for a small mod I created.

Is this a bug or was this intentionally removed?
ZzZombo
Posts: 315
Joined: Mon Jul 16, 2012 2:02 am

Re: Custom enemy attacks no longer heal players

Post by ZzZombo »

Why can't you heal with more conventional means? Like, givin' a health pack for the lazy, or using more direct approaches?
User avatar
lizardcommando
Posts: 1489
Joined: Thu Sep 07, 2006 12:24 pm
Location: Boringland, California

Re: Custom enemy attacks no longer heal players

Post by lizardcommando »

It was for a mod I created a while ago. The Pain Elemental's new attack purposely healed players by shooting a fireball that heals players by 5 HP.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Custom enemy attacks no longer heal players

Post by Graf Zahl »

This was changed because dealing negative damage is totally undefined behavior. If it worked it was by happenstance but even then it tended to do things that were just wrong.
Blue Shadow
Posts: 4949
Joined: Sun Nov 14, 2010 12:59 am

Re: Custom enemy attacks no longer heal players

Post by Blue Shadow »

But there is an explicit code for this, for projectiles only anyways, in PIT_CheckThing.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Custom enemy attacks no longer heal players

Post by Graf Zahl »

The relevant check is in P_DamageMobj.At the end of the day the damage infliction code cannot handle negative values. It has always been undefined behavior but some more recent changes made it impossible to keep this case working.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: Custom enemy attacks no longer heal players

Post by Matt »

Can't there be a check added to the beginning of DamageMobj to deal with negatives? There've got to be a lot of old (or not even necessarily that old) mods that were written on the assumption that this would work.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Custom enemy attacks no longer heal players

Post by Graf Zahl »

There is a check at the beginning to exit if the value is negative. I haven't tracked down the reason but rest assured, it was necessary because some changes to that function could no longer handle it.
Post Reply

Return to “Closed Bugs [GZDoom]”