SpecialBounceHit

From ZDoom Wiki
Jump to navigation Jump to search

Actor

virtual int SpecialBounceHit(Actor bounceMobj, Line bounceLine, readonly<SecPlane> bouncePlane)

Usage

Called by bouncing projectiles when they hit an actor, a line or a plane. This function will only be called if one of the bouncing flags is set (either directly or through the BounceType property):

Parameters

  • Actor bounceMobj
The actor the projectile collided with. Requires the BOUNCEONACTORS flag.
The line the projectiled collided with. Requires the BOUNCEONWALLS flag.
The plane the projectiled collided with. Requires BOUNCEONFLOORS for floors and BOUNCEONCEILINGS for ceilings.

Return values

Note: the MHIT* constants were added in GZDoom 4.12.0. Prior to that, numbers had to be used directly.

  • -1
MHIT_DEFAULT
(Default) The projectile utilizes its default bouncing behavior in accordance with its BounceFactor/WallBounceFactor
  • 0
MHIT_DESTROY
For actors and lines: the projectile explodes (enters its Death sequence).
For planes: the projectile slides along the plane instead of bouncing.
  • 1
MHIT_PASS
For actors: the projectile explodes (enters its Death sequence).
For planes and lines: the projectile slides along the plane/line instead of bouncing.

Examples

This version of DoomImpBall is affected by gravity and will slide along the floor instead of exploding or bouncing:

class BowlingBall : DoomImpBall
{
	Default
	{
		+BOUNCEONFLOORS
		-NOGRAVITY
	}

	override int SpecialBounceHit(Actor bounceMobj, Line bounceLine, readonly<SecPlane> bouncePlane)
	{
		return MHIT_PASS;
	}
}