From 1a63450fe2af32699990a438072620a838759eba Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 13 Feb 2017 22:00:27 +0100 Subject: [PATCH] - fixed a few issues with actor bouncing logic. --- src/p_map.cpp | 9 +++++++-- src/scripting/thingdef.cpp | 2 -- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/p_map.cpp b/src/p_map.cpp index 435478756..e46c441db 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -3532,6 +3532,10 @@ bool P_BounceActor(AActor *mo, AActor *BlockingMobj, bool ontop) || ((mo->flags6 & MF6_NOBOSSRIP) && (BlockingMobj->flags2 & MF2_BOSS))) && (BlockingMobj->flags2 & MF2_REFLECTIVE)) || ((BlockingMobj->player == NULL) && (!(BlockingMobj->flags3 & MF3_ISMONSTER))))) { + // Rippers should not bounce off shootable actors, since they rip through them. + if ((mo->flags & MF_MISSILE) && (mo->flags2 & MF2_RIP) && BlockingMobj->flags & MF_SHOOTABLE) + return true; + if (mo->bouncecount>0 && --mo->bouncecount == 0) { if (mo->flags & MF_MISSILE) @@ -3549,6 +3553,7 @@ bool P_BounceActor(AActor *mo, AActor *BlockingMobj, bool ontop) { DAngle angle = BlockingMobj->AngleTo(mo) + ((pr_bounce() % 16) - 8); double speed = mo->VelXYToSpeed() * mo->wallbouncefactor; // [GZ] was 0.75, using wallbouncefactor seems more consistent + if (fabs(speed) < EQUAL_EPSILON) speed = 0; mo->Angles.Yaw = angle; mo->VelFromAngle(speed); mo->PlayBounceSound(true); @@ -3575,7 +3580,7 @@ bool P_BounceActor(AActor *mo, AActor *BlockingMobj, bool ontop) if (mo->BounceFlags & (BOUNCE_HereticType | BOUNCE_MBF)) { - mo->Vel.Z -= 2. / dot; + mo->Vel.Z -= 2. * dot; if (!(mo->BounceFlags & BOUNCE_MBF)) // Heretic projectiles die, MBF projectiles don't. { mo->flags |= MF_INBOUNCE; @@ -3591,7 +3596,7 @@ bool P_BounceActor(AActor *mo, AActor *BlockingMobj, bool ontop) else // Don't run through this for MBF-style bounces { // The reflected velocity keeps only about 70% of its original speed - mo->Vel.Z = (mo->Vel.Z - 2. / dot) * mo->bouncefactor; + mo->Vel.Z = (mo->Vel.Z - 2. * dot) * mo->bouncefactor; } mo->PlayBounceSound(true); diff --git a/src/scripting/thingdef.cpp b/src/scripting/thingdef.cpp index a43c741ce..d0b7df449 100644 --- a/src/scripting/thingdef.cpp +++ b/src/scripting/thingdef.cpp @@ -434,8 +434,6 @@ void LoadActors() // PASSMOBJ is irrelevant for normal missiles, but not for bouncers. defaults->flags2 |= MF2_PASSMOBJ; } - - } if (FScriptPosition::ErrorCounter > 0) {