Added is3DFloor parameter to SpecialBounceHit

Allows for better plane bounce handling e.g. flipping the normal.
This commit is contained in:
Boondorl 2025-02-10 14:11:27 -05:00 committed by Ricardo Luís Vaz Silva
parent 047e1e8b74
commit 567a180d2b
4 changed files with 8 additions and 8 deletions

View file

@ -891,7 +891,7 @@ public:
// Called when bouncing to allow for custom behavior.
// Returns -1 for normal behavior, 0 to stop, and 1 to keep going.
// (virtual on the script side only)
int SpecialBounceHit(AActor* bounceMobj, line_t* bounceLine, secplane_t* bouncePlane);
int SpecialBounceHit(AActor* bounceMobj, line_t* bounceLine, secplane_t* bouncePlane, bool is3DFloor);
// Returns true if it's okay to switch target to "other" after being attacked by it.
bool CallOkayToSwitchTarget(AActor *other);

View file

@ -3608,7 +3608,7 @@ bool FSlide::BounceWall(AActor *mo)
if (mo->flags & MF_MISSILE)
{
switch (mo->SpecialBounceHit(nullptr, line, nullptr))
switch (mo->SpecialBounceHit(nullptr, line, nullptr, false))
{
case 1: return true;
case 0: return false;
@ -3708,7 +3708,7 @@ bool P_BounceActor(AActor *mo, AActor *BlockingMobj, bool ontop)
default: break;
}
switch (mo->SpecialBounceHit(BlockingMobj, nullptr, nullptr))
switch (mo->SpecialBounceHit(BlockingMobj, nullptr, nullptr, false))
{
case 1: return true;
case 0: return false;

View file

@ -1743,7 +1743,7 @@ bool AActor::FloorBounceMissile (secplane_t &plane, bool is3DFloor)
{
if (flags & MF_MISSILE)
{
switch (SpecialBounceHit(nullptr, nullptr, &plane))
switch (SpecialBounceHit(nullptr, nullptr, &plane, is3DFloor))
{
// This one is backwards for some reason...
case 1: return false;
@ -3420,15 +3420,15 @@ int AActor::SpecialMissileHit (AActor *victim)
}
// This virtual method only exists on the script side.
int AActor::SpecialBounceHit(AActor* bounceMobj, line_t* bounceLine, secplane_t* bouncePlane)
int AActor::SpecialBounceHit(AActor* bounceMobj, line_t* bounceLine, secplane_t* bouncePlane, bool is3DFloor)
{
IFVIRTUAL(AActor, SpecialBounceHit)
{
VMValue params[4] = { (DObject*)this, bounceMobj, bounceLine, bouncePlane };
VMValue params[] = { (DObject*)this, bounceMobj, bounceLine, bouncePlane, is3DFloor };
VMReturn ret;
int retval;
ret.IntAt(&retval);
VMCall(func, params, 4, &ret, 1);
VMCall(func, params, 5, &ret, 1);
return retval;
}
else return -1;

View file

@ -581,7 +581,7 @@ class Actor : Thinker native
}
// This is called when a missile bounces off something.
virtual int SpecialBounceHit(Actor bounceMobj, Line bounceLine, readonly<SecPlane> bouncePlane)
virtual int SpecialBounceHit(Actor bounceMobj, Line bounceLine, readonly<SecPlane> bouncePlane, bool is3DFloor = false)
{
return MHIT_DEFAULT;
}