Projectiles w/ 0 Damage bug [more in post]

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: Projectiles w/ 0 Damage bug [more in post]

Re: Projectiles w/ 0 Damage bug [more in post]

by randi » Sat Apr 14, 2012 9:49 pm

Should be fixed, but since this doesn't come with an example I can just load up and run, it is untested.

Re: Projectiles w/ 0 Damage bug [more in post]

by FDARI » Sat Nov 12, 2011 9:10 pm

Given that a bugfix like this is implemented, all cases that are now corrected to take FORCEPAIN into account could very easily be extended to take a new flag (ALWAYSPAIN) into account. The flag would need to be defined / set up normally (I have never added a flag, but it is clearly doable) and referenced (checked) at only one point (under the checkforcepain-label).

Extending A_Explode is always a thought. If noone beats me to it, I'll probably give it a try at some point. I'm also trying to submit fixes for all bugs within my realm of knowledge (which encompasses almost, but not quite, anything not directly pertaining to output).

Unfortunately I'm not in a position to work and test as much as I would like to. Before I do anything further with this bug, I'd really like to know if I have corrected too much, or left uncorrected something that needs to be corrected. Well... Correcting the code might be quicker than correcting me. Afterall, it's just a choice between a specific "goto" and "return".

Re: Projectiles w/ 0 Damage bug [more in post]

by NeuralStunner » Sat Nov 12, 2011 4:29 pm

This is making me wish for a flag to force pain checks for 0-damage attacks. (As in, an actor would still "roll" for Pain even when taking no damage from the flagged projectile/puff.)

Actually I'd be fine with a way to allow +FORCEPAIN on 0-damage [wiki]A_Explode[/wiki] calls...

Re: Projectiles w/ 0 Damage bug [more in post]

by FDARI » Sat Nov 12, 2011 8:30 am

I've made a patch, completely untested for now.

Enclosed is a list of intended changes, to help you verify that I've done what I think I've done, and to help the devs find changes that should not have been made.
Spoiler: Changes
What sort of bugs might be introduced in this version?

Checks for friendly fire and invulnerabilities are not the first that are made. It may be that all checks that may cause "return" should be performed before any checks that may cause "goto checkforcepain" (replaces dopain, which missed a few points).

I haven't the time and capacity to investigate and correct that right now.

Ladies and gentlemen; please review.
Attachments
p_damagemobj.bug.zdoom.txt
(10.55 KiB) Downloaded 33 times

Re: Projectiles w/ 0 Damage bug [more in post]

by FDARI » Sun Mar 27, 2011 2:57 pm

Expected and documented I see. I read the code, not the wiki. What I'd like to know is which of the occurences above that cause unexpected behaviour. Damage factor reducing damage to 0 is one such.

EDIT: More specifically; in what cases where the code jumps out with "return" should "FORCEPAIN" be checked first?

Re: Projectiles w/ 0 Damage bug [more in post]

by Мichаеlis » Sat Mar 26, 2011 12:51 am

FDARI wrote: Invulnerability (when not foiled by damage flags or inflicting actor +FOILINVUL): Returns. *
*Player invulnerability turns out to be fully handled later in code, but the inflictor flag MF3_FOILINVUL seems ineffective against players.
Isn't it expected behavior?
[wiki]Actor_flags#Projectile[/wiki]
FOILINVUL
Can hurt invulnerable monsters (but not players).

Re: Projectiles w/ 0 Damage bug [more in post]

by FDARI » Wed Mar 23, 2011 6:10 pm

What is the correct behaviour for damage factor? I'd expect it to treat the resultant amount of damage (may be 0) exactly as it would an equal amount of unmodified damage.

In P_DamageMobj the following seem effectively to have precedence over +FORCEPAIN:
  • Health at 0 or lower: Dead, rightly feel no pain. Returns from the function before pain processing.*
    *Death after damage also avoids painhandling.
  • Spectral (when damage does not apply to spectral being): Returns.
  • Invulnerability (when not foiled by damage flags or inflicting actor +FOILINVUL): Returns. *
    * Is this behaviour different for players? Damage processings seems to continue normally unless the player has PPF_NOTHRUSTWHENINVUL.
    *Player invulnerability turns out to be fully handled later in code, but the inflictor flag MF3_FOILINVUL seems ineffective against players.
  • Actor is dormant (and damage is not forced): Returns.
  • Some more spectral complexity that I don't think is relevant. (Altought if DoSpecialDamage returns -1 pain processing will be omitted.)
  • If PowerDamage or PowerProtection cause damage to change to 0, the function returns.
  • DamageFactor appears to be very special:
    - First, any type specific damage factor is applied. If it reduces damage to 0 or less, the function returns.
    - Then, a general damage factor (probably 1 by default) is applied. If it reduces damage to 0 or less, the function returns.
  • Any non-forced damage will now go through TakeSpecialDamage. A result of -1 causes immediate return.
  • If damage is reduced to 0 or less by team-damage factor, the function returns.
  • If monster damage is reduced to 0 or less by armour, the function returns.
  • If wound-state is executed, pain-state is not.
There is one explicit check of forcepain: When armour reduces damage sustained by a player, to 0 or less. If forcepain is checked, a jump to the label "dopain" is executed. The dopain label is found after checks for NOPAIN and PAINLESS flags, so if pain is not supposed to be inflicted, 0 damage will cause pain anyway.

I think the "dopain" label is an attempt at the quick fix I had in mind, but perhaps not the ideal one. In any of the above scenarios where pain should be a possibility, "return" could be replaced with "goto checkpain", which would be a label immediately before the full pain-handling code. (Starting by checking the +NOPAIN and +PAINLESS flags, which are ignored when jumping with "goto Dopain".)

Re: Projectiles w/ 0 Damage bug [more in post]

by Graf Zahl » Sat Mar 12, 2011 4:49 am

No, because currently none of the developers is actively working on fixing bugs and for the foreseeable future that's not going to change. I don't have any time at the moment and Randy also seems to be busy with other things.

Re: Projectiles w/ 0 Damage bug [more in post]

by Lord Misfit » Sat Mar 12, 2011 2:11 am

Just a little curious, has anything new happened concerning this particular bug? o.o

Re: Projectiles w/ 0 Damage bug [more in post]

by NeuralStunner » Mon Feb 28, 2011 2:26 pm

Lord Misfit wrote:It was set to (0) before, actually. o.o
It was worth a shot. Hopefully this can be tracked down easily enough, though.

Is this a similar situation to A_Explode requiring at least 1 Damage to enforce Pain? Just asking because I was hoping it too might see a solution in the process. ;)

Re: Projectiles w/ 0 Damage bug [more in post]

by Lord Misfit » Mon Feb 28, 2011 11:05 am

Okay, thanks for clearing that up for me Graf. :)

Re: Projectiles w/ 0 Damage bug [more in post]

by Graf Zahl » Mon Feb 28, 2011 10:54 am

It looks like the damage factor checks are overriding the FORCEPAIN flag - which clearly is a bug.

Re: Projectiles w/ 0 Damage bug [more in post]

by Lord Misfit » Mon Feb 28, 2011 10:03 am

Sorry for the derpy-sounding response, maybe it's because I just woke up briefly and got a message about it and I'm not fully conscious, but does that mean you do or don't see this as a bug/problem? z.o; Brain's not fully turned on right now and about to fall back to sleep. :P

Re: Projectiles w/ 0 Damage bug [more in post]

by Graf Zahl » Mon Feb 28, 2011 5:59 am

Lord Misfit wrote: but it seems certain monsters which have their 'DamageFactor "Normal"' set to below "1" aren't even being forced into their pain states.

Quoted to highlight the actual problem here. Yes, that's indeed not correct.

Re: Projectiles w/ 0 Damage bug [more in post]

by Lord Misfit » Mon Feb 28, 2011 3:28 am

It was set to (0) before, actually. o.o

Also, I think I've found that if DamageFactor reduces the damage taken by the monster from said attack to under 1, it will not enforce +FORCEPAIN. This is very strange and bug-like to me because if there's no reduction-type damagefactors for a monster and a (0) damage projectile with +FORCEPAIN hits them it still forces them into their pain state like it should. >.>

I tested both a fastprojectile version of my attack and a normal style based on the DoomImpBall. I set the damage to (1) and then (2) on both. For (1), it didn't work, but for (2) it worked on 4 out of 5 of my enemies with reducing DamageFactors on them [0.75, 0.75, 0.5, 0.5 and 0.33 base damagefactors in that order, and only the 0.33 one failed to be put into pain]. However on the two with 0.5 damagefactor, I also have it they gain defense/attack buffs when put below 37.5% of their total health, and once THAT happens, those monsters no longer are forced into pain by the (2) damage version of either type of projectile.

Due to this, it seems to me there's a check for when damagefactor is being enforced that makes a projectile ignore it's +FORCEPAIN flag if the amount of damage it ends up inflicting on the monster in question is under 1 [or 0]. Still doesn't explain why a normal (0) damage projectile that hits a typical monster with no "DamageFactor"s given to it will still enforce +FORCEPAIN on said monsters though. :|

Top