void A_OverlayFlags (int layer, int flags, bool set)
A_OverlayFlags
Availability
ZandroX only. Does not exist in Zandronum 3.2. Behaviour follows GZDoom's DECORATE
A_OverlayFlags.Works in netgames. A player's client runs its own layers and takes each layer's jumps from the server — see Psprite layers.
Usage
Sets or clears PSPF_ flags on a layer. These flags control how closely an
overlay is tied to the weapon that created it.
A new layer starts with PSPF_ADDWEAPON, PSPF_ADDBOB, PSPF_POWDOUBLE, PSPF_CVARFAST and
PSPF_PIVOTPERCENT set, as in UZDoom, so out of the box it moves, bobs and speeds up with the
gun, and pivots by a share of its frame. Every other flag starts off: it is drawn with the
weapon's alpha and render style rather than its own.
Flags persist on the layer until changed. They are not reset when the layer's state changes, so setting them once on the layer's first frame is the normal pattern.
The weapon and flash layers (PSP_WEAPON, PSP_FLASH) take every flag, as any other layer does,
except that they always bob and speed up as they always did.
Differs from UZDoom. There, clearing
PSPF_ADDBOB,PSPF_POWDOUBLEorPSPF_CVARFASTonPSP_WEAPONstops the weapon's own bob or speed-up. Here those three are ignored on the weapon and flash layers.
Parameters
-
int layerThe layer to change.
0means the layer whose state is currently executing — see OverlayID. Does nothing if the layer does not exist. -
int flagsFlags to set or clear. Multiple flags can be combined with
|. The following are available:-
PSPF_ADDWEAPON — (on by default) the layer's offset is added to the weapon layer's offset, so the overlay moves with the gun as the gun's own states reposition it. Clear it and the overlay stays where
A_OverlayOffsetput it, independent of what the weapon is doing. -
PSPF_ADDBOB — (on by default) the weapon bob is added to the layer's offset, so the overlay sways with the player's movement. Clear it for an overlay that should stay pinned to the screen — a HUD panel or a reticle — while the gun bobs underneath it.
-
PSPF_POWDOUBLE — (on by default) the layer's state durations are halved while the player has
PowerDoubleFiringSpeed(or the Skulltag double-firing-speed effect). Without it, a speed-boosted weapon would animate at double rate while its overlays crawled along at normal speed and fell out of sync. -
PSPF_CVARFAST — (on by default) the layer obeys the
sv_fastweaponsserver variable, the same way the weapon layer does. Without it, overlays keep their authored timing regardless of the CVar. -
PSPF_ALPHA — the layer is drawn with its own alpha, as set by
A_OverlayAlpha, instead of inheriting the weapon's. Without this flag,A_OverlayAlpharecords a value that is never used. -
PSPF_FORCEALPHA — in GZDoom, applies the layer's alpha even under a render style that enforces its own, and does not require
PSPF_ALPHAalongside it. In ZandroX this is currently identical toPSPF_ALPHA— the renderer applies the layer alpha whenever either flag is set, and neither can override a style that enforces its own alpha. The flag is accepted so GZDoom-authored code ports across unchanged; treat the two as one flag for now. -
PSPF_RENDERSTYLE — the layer is drawn with its own render style, as set by
A_OverlayRenderStyle, instead of inheriting the weapon's. Has no effect unlessA_OverlayRenderStylehas actually been called on the layer. -
PSPF_FORCESTYLE — in GZDoom, exempts the layer from powerups that impose a render style on everything the player is drawing — a Blursphere, which otherwise makes the weapon and all its overlays fuzzy along with the player. In ZandroX this is currently identical to
PSPF_RENDERSTYLEand grants no such exemption. -
PSPF_FLIP — mirrors the layer's pixels horizontally, without moving it. Use it to reuse a right-hand sprite as a left hand.
-
PSPF_MIRROR — reflects the layer's position about the centre of the view, keeping the pixels' orientation. Combine with
PSPF_FLIPfor a properly handed mirror image: one moves the sprite to the other side, the other flips what it depicts. -
PSPF_PLAYERTRANSLATED — draws the layer with the player's colour translation, the same one applied to their body sprite. For overlays that depict the player themselves — a gloved hand, an arm — so they match the player's team or colour choice.
-
PSPF_INTERPOLATE — smooths the layer's movement between tics rather than snapping it to each new offset, so motion driven by
A_OverlayOffsetis fluid at frame rates above 35 fps. Its scale, turn and corners are eased too. Note that anA_OverlayOffsetcall with neitherWOF_ADDnorWOF_INTERPOLATEturns interpolation off for that tic, so a deliberate instant jump still reads as instant, and clearing this flag ends the tic's easing at once. -
PSPF_PIVOTPERCENT — (on by default)
A_OverlayPivotreads its pivot as a share of the frame's width and height. Clear it to give the pivot in pixels.
-
-
bool settruesets the given flags,falseclears them. Flags not named inflagsare left alone either way.
Examples
A muzzle-glow overlay that behaves like part of the weapon: it follows the gun's offset and bob, speeds up with the player's power-ups, and draws additively at half alpha over the top of the weapon.
The whole configuration is done on the layer's first frame, with a 0-tic state so it costs no
time. OverlayID() is used instead of hardcoding 1001 so the sequence keeps working if the
layer id changes. PSPF_ADDWEAPON and PSPF_ADDBOB are already on by default and are named
here only to make the intent explicit.
ACTOR GlowGun : Pistol
{
States
{
Fire:
PISG A 4
PISG B 6 A_FirePistol
PISG B 0 A_Overlay(1001, "Glow")
PISG C 4
PISG B 5 A_ReFire
Goto Ready
Glow:
GLOW A 0 A_OverlayFlags(OverlayID(), PSPF_ADDWEAPON|PSPF_ADDBOB|PSPF_POWDOUBLE|PSPF_ALPHA|PSPF_RENDERSTYLE, true)
GLOW A 0 A_OverlayRenderStyle(OverlayID(), STYLE_Add)
GLOW A 0 A_OverlayAlpha(OverlayID(), 0.5)
GLOW ABC 2 Bright
Stop
}
}
Layer 1001 puts the glow in front of the flash. PSPF_ALPHA and PSPF_RENDERSTYLE are what
make the following two calls take effect — without them the glow would silently draw with the
weapon's own opaque style.
A left hand built from the existing right-hand sprite, drawn behind the weapon:
Ready:
PISG A 1 A_Overlay(-2, "LeftHand", true)
PISG A 1 A_WeaponReady
Loop
LeftHand:
HAND A 0 A_OverlayFlags(OverlayID(), PSPF_FLIP|PSPF_MIRROR|PSPF_PLAYERTRANSLATED, true)
HAND A -1
Stop
PSPF_MIRROR moves it to the other side of the screen, PSPF_FLIP turns the sprite around so
the thumb is on the correct side, and PSPF_PLAYERTRANSLATED colours the glove to match the
player.
See also
- Psprite layers — what a layer carries, and what it inherits by default
- A_Overlay — create the layer these flags apply to
- A_OverlayAlpha — needs
PSPF_ALPHA - A_OverlayRenderStyle — needs
PSPF_RENDERSTYLE - A_OverlayOffset, A_OverlayScale, A_ClearOverlays, OverlayID