Fixed incorrect autooff behavior on ceiling bounce (#2837)

* Fixed incorrect autooff behavior on ceiling bounce

* Fixed incorrect Actor bouncing behavior
This commit is contained in:
Boondorl 2024-11-26 05:59:20 -05:00 committed by GitHub
parent f911088074
commit 1d35ff8bc7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View file

@ -3792,7 +3792,8 @@ 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 -= 2. * dot;
mo->Vel *= mo->bouncefactor;
}
mo->PlayBounceSound(true);
@ -3803,8 +3804,11 @@ bool P_BounceActor(AActor *mo, AActor *BlockingMobj, bool ontop)
}
else if (mo->BounceFlags & (BOUNCE_AutoOff | BOUNCE_AutoOffFloorOnly))
{
if (!(mo->flags & MF_NOGRAVITY) && (mo->Vel.Z < 3.))
mo->BounceFlags &= ~BOUNCE_TypeMask;
if (mo->Vel.Z >= 0 || (mo->BounceFlags & BOUNCE_AutoOff))
{
if (!(mo->flags & MF_NOGRAVITY) && (mo->Vel.Z < 3.))
mo->BounceFlags &= ~BOUNCE_TypeMask;
}
}
}
if (mo->BounceFlags & BOUNCE_UseBounceState)

View file

@ -1857,7 +1857,7 @@ bool AActor::FloorBounceMissile (secplane_t &plane, bool is3DFloor)
if (norm.Z > 0 || (BounceFlags & BOUNCE_AutoOff))
{
// AutoOff only works when bouncing off a floor, not a ceiling (or in compatibility mode.)
if (!(flags & MF_NOGRAVITY) && ((Vel | norm) < 3))
if (!(flags & MF_NOGRAVITY) && (norm.Z < 0 || ((Vel | norm) < 3)))
BounceFlags &= ~BOUNCE_TypeMask;
}
}