Various bouncing fixes

Fixed bounce flag checks being inversed on 3D floors. Decoupled wall bouncing flag from floor/ceiling flags since they relied on it in the case of hitting steep ramps. Fixed wall bounces that actually bounce off planes not returning the correct value.
This commit is contained in:
Boondorl 2024-11-26 23:43:21 -05:00 committed by Rachael Alexanderson
parent 859bca4476
commit a88516bbd2
No known key found for this signature in database
GPG key ID: 26A8ACCE97115EE0
2 changed files with 15 additions and 11 deletions

View file

@ -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)

View file

@ -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)
{