Added bounce virtual

This commit is contained in:
Boondorl 2023-01-19 19:58:04 -05:00 committed by Rachael Alexanderson
commit 5a74e79b92
4 changed files with 54 additions and 0 deletions

View file

@ -1546,6 +1546,17 @@ void AActor::PlayBounceSound(bool onfloor)
bool AActor::FloorBounceMissile (secplane_t &plane)
{
if (flags & MF_MISSILE)
{
switch (SpecialBounceHit(nullptr, nullptr, &plane))
{
// This one is backwards for some reason...
case 1: return false;
case 0: return true;
default: break;
}
}
// [ZZ] if bouncing missile hits a damageable sector(plane), it dies
if (P_ProjectileHitPlane(this, -1) && bouncecount > 0)
{
@ -3197,6 +3208,21 @@ int AActor::SpecialMissileHit (AActor *victim)
else return -1;
}
// This virtual method only exists on the script side.
int AActor::SpecialBounceHit(AActor* bounceMobj, line_t* bounceLine, secplane_t* bouncePlane)
{
IFVIRTUAL(AActor, SpecialBounceHit)
{
VMValue params[4] = { (DObject*)this, bounceMobj, bounceLine, bouncePlane };
VMReturn ret;
int retval;
ret.IntAt(&retval);
VMCall(func, params, 4, &ret, 1);
return retval;
}
else return -1;
}
bool AActor::AdjustReflectionAngle (AActor *thing, DAngle &angle)
{
if (flags2 & MF2_DONTREFLECT) return true;