Bouncing projectiles don't hurt when hitting top/bottom

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.
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia
Contact:

Bouncing projectiles don't hurt when hitting top/bottom

Post by Marisa the Magician »

Bouncing projectiles explode/die as expected, but don't deal damage to the actor they hit. Linked here is an example to show this behaviour. I'd check if the bug happens on 4.2.1 but I can no longer compile it due to glibc updates and versioned symbol nonsense.
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia
Contact:

Re: Bouncing projectiles don't hurt when hitting top/bottom

Post by Marisa the Magician »

Is anyone ever going to bother with this? A crapton of mods trigger this bug, you know.
SanyaWaffles
Posts: 805
Joined: Thu Apr 25, 2013 12:21 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Windows 11 for the Motorola Powerstack II
Graphics Processor: nVidia with Vulkan support
Location: The Corn Fields
Contact:

Re: Bouncing projectiles don't hurt when hitting top/bottom

Post by SanyaWaffles »

This explains the weird behavior I've been experiencing with DD2's gem bombs.

Let me see if I can reproduce it.
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Bouncing projectiles don't hurt when hitting top/bottom

Post by Major Cooke »

There's a couple ways this could be fixed.

I could either move the P_DamageMobj call into P_ExplodeMissile that's found in PIT_CheckThing (p_map.cpp line 1565), ensuring P_ExplodeMissile accurately handles all future impact damage appropriately:

Code: Select all

damage = tm.thing->GetMissileDamage((tm.thing->flags4 & MF4_STRIFEDAMAGE) ? 3 : 7, 1);
if ((damage > 0) || (tm.thing->flags6 & MF6_FORCEPAIN) || (tm.thing->flags7 & MF7_CAUSEPAIN))
{
	int newdam = P_DamageMobj(thing, tm.thing, tm.thing->target, damage, tm.thing->DamageType);
	//...
Or I could go the simple route and insert P_DamageMobj here:

Code: Select all

if (Vel.Z != 0 && (BounceFlags & BOUNCE_Actors))
{
	bool res = P_BounceActor(this, onmo, true);
	// If the bouncer is a missile and has hit the other actor it needs to be exploded here
	// to be in line with the case when an actor's side is hit.
	if (!res && (flags & MF_MISSILE))
	{
		P_ExplodeMissile(this, nullptr, onmo);
	}
}
Which one seems better? The former, I can include a boolean that disables damage as needed.
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia
Contact:

Re: Bouncing projectiles don't hurt when hitting top/bottom

Post by Marisa the Magician »

wouldn't calling explodemissile cause the projectile to, you know, explode, even in cases where they might still keep bouncing?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Bouncing projectiles don't hurt when hitting top/bottom

Post by Graf Zahl »

Yes. It's also not the function inflicting the damage.
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Bouncing projectiles don't hurt when hitting top/bottom

Post by Major Cooke »

If neither of those are fitting solutions, what is?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Bouncing projectiles don't hurt when hitting top/bottom

Post by Graf Zahl »

That's the problem, I don't really know how to do it without causing unintended side effects.
SanyaWaffles
Posts: 805
Joined: Thu Apr 25, 2013 12:21 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Windows 11 for the Motorola Powerstack II
Graphics Processor: nVidia with Vulkan support
Location: The Corn Fields
Contact:

Re: Bouncing projectiles don't hurt when hitting top/bottom

Post by SanyaWaffles »

This is becoming extremely noticeable at times in my project. You can hit an enemy square on the top and there's no damage or whatever when using bouncing bombs. It's an extremely aggravating bug and there's no way to fix.
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Bouncing projectiles don't hurt when hitting top/bottom

Post by Major Cooke »

It might be worth going back to Cacodemon345's commits and finding out what he fixed.
Cacodemon345
Posts: 419
Joined: Fri Dec 22, 2017 1:53 am
Graphics Processor: ATI/AMD (Modern GZDoom)
Contact:

Re: Bouncing projectiles don't hurt when hitting top/bottom

Post by Cacodemon345 »

All I fixed is the missile not entering bouncing state when hit from top. I don't really believe it could cause any possible side-effects.
Cacodemon345
Posts: 419
Joined: Fri Dec 22, 2017 1:53 am
Graphics Processor: ATI/AMD (Modern GZDoom)
Contact:

Re: Bouncing projectiles don't hurt when hitting top/bottom

Post by Cacodemon345 »

Now that I look into the source code, P_XYMovement function calls P_BounceActor with "ontop = false" in two places. The only function where I found that function called with "ontop = true" is the main Actor Tick function.

When I used a breakpoint in line 1483 of p_map, I found that the code in PIT_CheckThing only reaches there with the non-bouncing projectile, it does not even reach there with the bouncing project when I used Marisa's bug reproduction example. When that happens, P_BounceActor is called with "ontop = true".

This means that there HAS to be some place in the code which uses the Actor Bounce flag to change something that causes that portion of PIT_CheckThing to be unreachable.

Edit: further testing reveals a oddity: CanCollideWith() is called more than once for the non-bouncing projectile when it does not actually hit, but is only called once when the bouncing projectile actually hits the monster.
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Bouncing projectiles don't hurt when hitting top/bottom

Post by Major Cooke »

I'm going to merge in this PR into QZDoom if no one has any qualms about it, since I very much am finding myself in need of it.
SanyaWaffles
Posts: 805
Joined: Thu Apr 25, 2013 12:21 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Windows 11 for the Motorola Powerstack II
Graphics Processor: nVidia with Vulkan support
Location: The Corn Fields
Contact:

Re: Bouncing projectiles don't hurt when hitting top/bottom

Post by SanyaWaffles »

If you do Cooke, when can you expect a build? This has been messing with one of my projects and I very much wish to test it out. I normally don't use qzdoom so I have no idea how frequently it gets updated. I also worry about it being out of date with recent GZDoom features.
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Bouncing projectiles don't hurt when hitting top/bottom

Post by Major Cooke »

I've merged it. It'll become available whenever the next build is scheduled, which is usually daily. The release times can be seen here.

Don't be, I usually keep it up to date whenever it's needed. I have contributor access to the repository so I can keep it up to date.
Post Reply

Return to “Closed Bugs [GZDoom]”