[Bugfix] Vel3DFromAngle pitch + angle backwards

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
Major Cooke
Posts: 8176
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

[Bugfix] Vel3DFromAngle pitch + angle backwards

Post by Major Cooke »

Bugfix

The action function call was passing the pitch and angle values to the internal function invertedly.

Code: Select all

	void Vel3DFromAngle(DAngle angle, DAngle pitch, double speed)
	{
		double cospitch = pitch.Cos();
		Vel.X = speed * cospitch * angle.Cos();
		Vel.Y = speed * cospitch * angle.Sin();
		Vel.Z = speed * -pitch.Sin();
	}
As you can see from my commit, they were sent in backwards, which resulted in very unpredictable and erratic behavior upon my usage of the function.
User avatar
Rachael
Posts: 13575
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: [Bugfix] Vel3DFromAngle pitch + angle backwards

Post by Rachael »

Several things:

1. While it's good that you've taken initiative to fix this bug, a full bug report is still needed - particularly testable samples to verify the bug itself and verify the fix. Please see here. You did good in at least articulating what is going on, though, so that's good. Kudos for that. :)

2. Is this repairing code you've personally submitted previously? (Doesn't make much difference in this case, but it does help, at least for me, personally, to know)

3. Lastly, how long has the bug been present in GZDoom? If this bug has endured at least one release cycle, then we should expect that mods may have already been made which expect this buggy behavior. "Fixing" it may require a version check, depending on how widespread the use of this function is. This particular caveat applies because it affects how mods function - but if, as you say, the function was too unpredictable, anyway, then this issue might not apply.
User avatar
Major Cooke
Posts: 8176
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: [Bugfix] Vel3DFromAngle pitch + angle backwards

Post by Major Cooke »

1. I don't post examples for things like this because I want to make sure, first and foremost, that it's actually the correct thing to bugfix. Otherwise I'm wasting my time and effort, especially over something clearly small and simple.

2. No.

3. No idea. And I don't know where to look either for its since Graf mass-exported many times.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49073
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [Bugfix] Vel3DFromAngle pitch + angle backwards

Post by Graf Zahl »

This was wrong. The internal code did not use this function so I hadn't noticed yet and if someone had used it, noticing that the arguments were swapped without reporting it, I cannot help those people.
Post Reply

Return to “Closed Bugs [GZDoom]”