From 1ab3d4dd09fad639ba2d798a71e627bc608f4999 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 27 Jan 2019 14:00:23 +0100 Subject: [PATCH] - fixed: When A_SpawnProjectile got fixed, this fix broke the old A_CustomMissile function because the added workaround was overlooked. This now separates the code more clearly into the twp paths to make the differences easier to see and compare. --- src/p_actionfunctions.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index 3681843291..6aa3b490c1 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -972,13 +972,26 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnProjectile) if ( (CMF_ABSOLUTEPITCH|CMF_OFFSETPITCH) & flags) { - if (CMF_OFFSETPITCH & flags) + if (!(flags & CMF_BADPITCH)) { - Pitch += missile->Vel.Pitch(); + if (CMF_OFFSETPITCH & flags) + { + Pitch += missile->Vel.Pitch(); + } + missilespeed = fabs(Pitch.Cos() * missile->Speed); + missile->Vel.Z = -Pitch.Sin() * missile->Speed; + } + else + { + // Replicate the bogus calculation from A_CustomMissile in its entirety. + // This tried to do the right thing but in the process effectively inverted the base pitch. + if (CMF_OFFSETPITCH & flags) + { + Pitch -= missile->Vel.Pitch(); + } + missilespeed = fabs(Pitch.Cos() * missile->Speed); + missile->Vel.Z = Pitch.Sin() * missile->Speed; } - missilespeed = fabs(Pitch.Cos() * missile->Speed); - missile->Vel.Z = Pitch.Sin() * missile->Speed; - if (!(flags & CMF_BADPITCH)) missile->Vel.Z *= -1; } else {