A_CheckLOF

From ZDoom Wiki
Jump to: navigation, search

A_CheckLOF (state jump, int flags = 0, float range = 0, float minrange = 0, float angle = 0, float pitch = 0, float offsetheight = 0, float offsetwidth = 0, int ptr_target = AAPTR_DEFAULT) (New from 2.7.1)


Usage

Performs a would-be-hitscan/line of fire test to see if anything other than the target is encountered along the way. If the target would be hit, jump to the specified state.

Parameters

  • jump: Actor state jump, used if the target or another acceptable victim blocks the line of fire.
  • flags: The following flags can be combined by using the | character between the constant names:
    • CLOFF_NOAIM_VERT -- Disables vertical aiming.
    • CLOFF_NOAIM_HORZ -- Disables horizontal aiming.
    • CLOFF_AIM_VERT_NOOFFSET -- Do not adjust aim (pitch) according to height offset. Will aim from whatever origin the other flags indicate (base/feet of actor, or calculated hitscan height). (New from 2.7.1)
    • CLOFF_FROMBASE -- Move origin to actor's base
    • CLOFF_MUL_HEIGHT -- Multiply height offset by actor's height. (If called by a player, takes into account whether they are crouching or not.)
    • CLOFF_MUL_WIDTH -- Multiply width offset by actor's radius.
    • CLOFF_JUMPENEMY -- Allows jumping if an enemy breaks the line of fire.
    • CLOFF_JUMPFRIEND -- Same as the above, but the monsters must be friendly.
    • CLOFF_JUMPOBJECT -- Anything that isn't a monster can cause the jump.
    • CLOFF_JUMPNONHOSTILE -- Actors in the way that are not attacking the calling actor will trigger the jump.
    • CLOFF_SKIPENEMY -- Always act as if there are no enemies in the way to block the shot.
    • CLOFF_SKIPFRIEND -- Same as the above, only with friendlies.
    • CLOFF_SKIPOBJECT -- Same as CLOFF_SKIPENEMY, but applies to non-monsters.
    • CLOFF_SKIPNONHOSTILE -- Pretends monsters not attacking the calling actor between itself and the desired target are non-obstructive.
    • CLOFF_JUMP_ON_MISS -- Treat not hitting any actor (thin air, walls, floors, ceilings) as a success. (New from 2.7.1)

The following do not apply to the actor targeted by the line of fire check.

  • CLOFF_MUSTBESHOOTABLE -- Ignore actors that are not shootable (checks SHOOTABLE and NONSHOOTABLE).
  • CLOFF_MUSTBEGHOST -- Ignore actors that are not ghosts.
  • CLOFF_IGNOREGHOST -- Ignore actors that are ghosts.
  • CLOFF_MUSTBESOLID -- Ignore actors that are not solid.

Miscellaneous flags:

  • CLOFF_SKIPTARGET -- Ignores the target actor breaking the ray -- none of the other filters apply to the target actor, only towards intercepting actors.
  • CLOFF_BEYONDTARGET -- Requires CLOFF_SKIPTARGET. Trace past the targeted actor (only useful if checking for some of the additional jump qualifiers).
  • CLOFF_ALLOWNULL -- Cast the ray even if target is null. When there is no target, caller aim (pitch, angle) is used regardless of aim-flags.
  • CLOFF_CHECKPARTIAL -- Perform the check even if the target itself is actually out of range. (Useful if the actor is still interested in closer intercepting actors)

Combo Flags:

  • CLOFF_SKIPOBSTACLES -- Implies the SKIPENEMY, SKIPFRIEND, SKIPOBJECT, SKIPNONHOSTILE flags. Partial overriding is allowed with combinations such as CLOFF_SKIPOBSTACLES|CLOFF_JUMPFRIEND.
  • CLOFF_NOAIM -- Implies NOAIM_VERT and NOAIM_HORZ.
  • range: Range of the check.
  • minrange: Fail if the line of fire is blocked too near the shooting actor.
  • angle: Offsets the aim by this angle. Base aim depends on flags; on target by default.
  • pitch: Offset your aim by this angle (vertical). Base aim depends on flags; on target by default.
  • offsetheight: Offset the line of fire's point of origin by this value. The base height depends on flags; hitscan emulation (around the middle) by default. When pitch is determined by aiming for target, aim is adjusted to correct for this offset.
  • offsetwidth: Offset the line of fire's point of origin by this value (horizonal). Aim is not adjusted to correct for this value.
  • ptr_target: Pick an actor to aim for, AAPTR_DEFAULT picks TARGET (to ensure no actor is targeted, use AAPTR_NULL)

Examples

Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contibutions are greatly appreciated.