[3.7.2] A_CustomMissile reverses pitch with CMF_OFFSETPITCH

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
Melodica
Posts: 75
Joined: Sun Feb 14, 2016 10:35 am
Preferred Pronouns: She/Her
Location: Chile

[3.7.2] A_CustomMissile reverses pitch with CMF_OFFSETPITCH

Post by Melodica »

I've encountered this problem while playing Space Hunter. if A_CustomMissile uses the CMF_OFFSETPITCH flag, it will reverse the pitch of the projectile, causing, for example, actors to aim downwards instead of upwards when firing at their target and vice versa. Made a quick test wad, and it confirms this. It only seems to affect the function when CMF_OFFSETPITCH is used. I've attached the wad file I made to test it out. Each time the actor fires a projectile, it will log "CMF_OFFSETPITCH" if it uses the flag, and "no flags" if it doesn't. I tested this file on 3.7.1, and the problem doesn't exist there.
Attachments
a_custommissile-CMF_OFFSETPITCH-test.wad
(10.08 KiB) Downloaded 36 times
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: [3.7.2] A_CustomMissile reverses pitch with CMF_OFFSETPI

Post by Graf Zahl »

Yes, this was reversed, because it used the wrong sign. Instead of offsetting from the actual pitch it offsetted from the inverse pitch.
Amazing that some mod managed to get something working out of that broken option.

The big problem with this one is that there is no good solution. It can either break a handful of mods using it or be forever broken with new code.
User avatar
Kinsie
Posts: 7399
Joined: Fri Oct 22, 2004 9:22 am
Graphics Processor: nVidia with Vulkan support
Location: MAP33
Contact:

Re: [3.7.2] A_CustomMissile reverses pitch with CMF_OFFSETPI

Post by Kinsie »

A_CustomMissile is depreciated, isn't it? I'd say revert it to the older behaviour to avoid breaking older/Zandronum-based mods, and continue shepherding new mods towards using A_SpawnProjectile instead.
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: [3.7.2] A_CustomMissile reverses pitch with CMF_OFFSETPI

Post by Graf Zahl »

Yeah, that can be done. Ironically that's how it was supposed to be done initially, but the fix somehow got messed up and implemented incorrectly.

EDIT: Looking at that piece of code, something must have gone horribly wrong at some point in time. The math makes no sense whatsoever, my guess is that some bug got introduced during floatification of the engine and all the attempts to fix it made things worse. :(
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: [3.7.2] A_CustomMissile reverses pitch with CMF_OFFSETPI

Post by Graf Zahl »

Ugh, this was a bit tricky to investigate.
This was a bit tricky to investigate, but I think I got it figured out now.

The original fix was about the inverted base pitch in A_CustomMissile. When that got fixed, A_SpawnProjectile got accidentally its offset pitch inverted because the factor was applied in the wrong place.
Now that the offset pitch got corrected, A_CustomMissile suddenly had the combined pitch wrong because the workaround now negated something it shouldn't have.

I solved it by completely separating both code paths. A_CustomMissile now uses the exact same code as it did in 2016 and A_SpawnProjectile uses the correct formula - at least I hope it does. This pitch-sign madness is giving me headaches because ZDoom's coordinate system makes no sense.

Question: Does this warrant a new release? It's a pretty serious bug in my opinion.
There's two other ones I'd like to check out first, but after that I think 3.7.3 needs to be done.
User avatar
Kinsie
Posts: 7399
Joined: Fri Oct 22, 2004 9:22 am
Graphics Processor: nVidia with Vulkan support
Location: MAP33
Contact:

Re: [3.7.2] A_CustomMissile reverses pitch with CMF_OFFSETPI

Post by Kinsie »

Graf Zahl wrote:Question: Does this warrant a new release? It's a pretty serious bug in my opinion.
There's two other ones I'd like to check out first, but after that I think 3.7.3 needs to be done.
There have been enough big bug fixes recently that another bug-fix release is probably warranted.
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: [3.7.2] A_CustomMissile reverses pitch with CMF_OFFSETPI

Post by Graf Zahl »

Not really. This was the first one that applies to 3.7.2 as well.
But I consider this a big one.
User avatar
Hexereticdoom
Posts: 654
Joined: Thu Aug 08, 2013 1:30 pm
Graphics Processor: nVidia with Vulkan support
Location: Spain
Contact:

Re: [3.7.2] A_CustomMissile reverses pitch with CMF_OFFSETPI

Post by Hexereticdoom »

Rightly, I already noticed a few days ago something weird using 3.7.2 version with my Doom and Heretic gameplay mods... Some special effects were working wrongly, and also some monster attack patterns were unexpectedly being performed in an inverse way, specially when the player is at a different height than the attacker.

So then, while 3.7.3 is on the way, I think the best thing will be to make myself a hotfix update for both mods, replacing the old deprecated function with the newer A_SpawnProjectile to avoid more related issues... :|

Edit: Sorry, forget it. Too much work and too much testing needed, and if next release of GZDoom is going to have restored the A_CustomMissile's old pitch behaviour, I prefer better to wait until then. :nope:
Post Reply

Return to “Closed Bugs [GZDoom]”