diff --git a/src/playsim/p_map.cpp b/src/playsim/p_map.cpp index e487c5b9cd..ef5438afdf 100644 --- a/src/playsim/p_map.cpp +++ b/src/playsim/p_map.cpp @@ -3552,7 +3552,9 @@ bool FSlide::BounceWall(AActor *mo) double movelen; line_t *line; - if (!(mo->BounceFlags & BOUNCE_Walls)) + // The plane bounce flags need to be checked here in case it hit a ramp while + // moving along the xy axes. + if (!(mo->BounceFlags & (BOUNCE_Walls | BOUNCE_Ceilings | BOUNCE_Floors))) { return false; } @@ -3587,16 +3589,18 @@ bool FSlide::BounceWall(AActor *mo) if (floordist <= ceildist) { NextLowestFloorAt(mo->Sector, mo->X(), mo->Y(), mo->Z(), 0, mo->MaxStepHeight, nullptr, &ff); - mo->FloorBounceMissile(ff != nullptr ? *ff->top.plane : mo->floorsector->floorplane, ff != nullptr); - return true; + return !mo->FloorBounceMissile(ff != nullptr ? *ff->top.plane : mo->floorsector->floorplane, ff != nullptr); } else { NextHighestCeilingAt(mo->Sector, mo->X(), mo->Y(), mo->Z(), mo->Top(), 0, nullptr, &ff); - mo->FloorBounceMissile(ff != nullptr ? *ff->bottom.plane : mo->ceilingsector->ceilingplane, ff != nullptr); - return true; + return !mo->FloorBounceMissile(ff != nullptr ? *ff->bottom.plane : mo->ceilingsector->ceilingplane, ff != nullptr); } } + + if (!(mo->BounceFlags & BOUNCE_Walls)) + return false; + line = bestslideline; if (mo->flags & MF_MISSILE) diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index c79255cca1..09c97d2ff4 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -1782,9 +1782,13 @@ bool AActor::FloorBounceMissile (secplane_t &plane, bool is3DFloor) } } + DVector3 norm = plane.Normal(); + if (is3DFloor) + norm = -norm; + bool onsky; - if (plane.fC() < 0) + if (norm.Z < 0) { // on ceiling if (!(BounceFlags & BOUNCE_Ceilings)) return true; @@ -1815,10 +1819,6 @@ bool AActor::FloorBounceMissile (secplane_t &plane, bool is3DFloor) return true; } - DVector3 norm = plane.Normal(); - if (is3DFloor) - norm = -norm; - double dot = (Vel | norm) * 2; if (BounceFlags & (BOUNCE_HereticType | BOUNCE_MBF)) @@ -1846,7 +1846,7 @@ bool AActor::FloorBounceMissile (secplane_t &plane, bool is3DFloor) // Set bounce state if (BounceFlags & BOUNCE_UseBounceState) { - FName names[2] = { NAME_Bounce, plane.fC() < 0 ? NAME_Ceiling : NAME_Floor }; + FName names[2] = { NAME_Bounce, norm.Z < 0 ? NAME_Ceiling : NAME_Floor }; FState *bouncestate = FindState(2, names); if (bouncestate != nullptr) {