From 08e5e1c145e8bd7d02a16013115ae1f5c38fa5bb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 29 Jan 2016 12:44:38 +0100 Subject: [PATCH] - restored the velocity threshold checks in A_MaceBallImpact2 and A_DeathBallImpact to their original Heretic form, minus the check for floorz, to account for potential positioning issues with slopes. These checks had some major issues: * they calculated incorrect positive values for hitting a ceiling * the way they used the plane equations made some incorrect assumptions. * velz has the velocity reduction from bouncing already factored in from the calling code so doing it here again is not necessary. --- src/g_heretic/a_hereticweaps.cpp | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/src/g_heretic/a_hereticweaps.cpp b/src/g_heretic/a_hereticweaps.cpp index d4a63c144a..899514139d 100644 --- a/src/g_heretic/a_hereticweaps.cpp +++ b/src/g_heretic/a_hereticweaps.cpp @@ -512,21 +512,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MaceBallImpact2) } if (self->flags & MF_INBOUNCE) { - fixed_t floordist = self->Z() - self->floorz; - fixed_t ceildist = self->ceilingz - self->Z(); - fixed_t vel; - - // NOTE: The assumptions being made here about the plane to use for bouncing off are dead wrong. - // http://forum.zdoom.org/viewtopic.php?f=2&t=50449 - if (floordist <= ceildist) - { - vel = MulScale32 (self->velz, self->Sector->floorplane.c); - } - else - { - vel = MulScale32 (self->velz, self->Sector->ceilingplane.c); - } - if (vel < 2) + if (self->velz < 2*FRACUNIT) { goto boom; } @@ -624,21 +610,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact) } if (self->flags & MF_INBOUNCE) { - fixed_t floordist = self->Z() - self->floorz; - fixed_t ceildist = self->ceilingz - self->Z(); - fixed_t vel; - - // NOTE: The assumptions being made here about the plane to use for bouncing off are dead wrong. - // http://forum.zdoom.org/viewtopic.php?f=2&t=50449 - if (floordist <= ceildist) - { - vel = MulScale32 (self->velz, self->Sector->floorplane.c); - } - else - { - vel = MulScale32 (self->velz, self->Sector->ceilingplane.c); - } - if (vel < 2) + if (self->velz < 2*FRACUNIT) { goto boom; }