void A_OverlayScale (int layer, float scalex = 1, float scaley = 0, int flags = 0)
A_OverlayScale
Availability
ZandroX only. Does not exist in Zandronum 3.2. Behaviour follows GZDoom's DECORATE
A_OverlayScale.Works in netgames. A player's client runs its own layers and takes each layer's jumps from the server — see Psprite layers.
Usage
Resizes a layer. 1.0 is the sprite's authored size; 2.0 is double,
0.5 is half. Scaling is about the layer's pivot, the top left corner of its frame unless
A_OverlayPivot or A_OverlayPivotAlign moved it,
and the layer's offset is not scaled, as in UZDoom.
Negative scales are accepted and flip the sprite about its pivot along that axis. For a
horizontal flip in place, prefer PSPF_FLIP — see A_OverlayFlags.
Scale persists on the layer until changed; it is not reset by a state change.
Parameters
-
int layerThe layer to resize.
0means the layer whose state is currently executing — see OverlayID. Does nothing if the layer does not exist. -
float scalexHorizontal scale factor. Default
1. -
float scaleyVertical scale factor. A value of
0means "square": copyscalex, unlessWOF_ZEROYis given. This is a convenience, not a degenerate case —A_OverlayScale(5, 2.0)doubles the layer in both directions, which is what you almost always want. A layer scaled to0on either axis is not drawn.The substitution happens before
WOF_ADDis applied, soA_OverlayScale(5, 0.1, 0, WOF_ADD)adds0.1to both axes. -
int flagsMultiple flags can be combined with
|. The sameWOF_flags asA_OverlayOffset, applied to the scale axes:-
WOF_KEEPX — leave the horizontal scale untouched;
scalexis ignored. -
WOF_KEEPY — leave the vertical scale untouched;
scaleyis ignored. -
WOF_ADD — add to the current scale instead of replacing it.
-
WOF_INTERPOLATE — eases the change over the tic, as
WOF_ADDdoes too; without either, the new scale shows at once. -
WOF_ZEROY — a
scaleyof0stays0instead of copyingscalex.
Setting both
WOF_KEEPXandWOF_KEEPYmakes the call do nothing.Note that
WOF_KEEPYis applied after the square-scale substitution, soA_OverlayScale(5, 2.0, 0, WOF_KEEPY)sets the horizontal scale to2.0and leaves the vertical one alone, rather than making it square. -
Examples
A muzzle flash that punches in — starting at 150% and shrinking back to normal over three tics — on its own layer so the weapon sprite underneath is untouched.
ACTOR PunchFlashGun : Pistol
{
States
{
Fire:
PISG A 4
PISG B 6 A_FirePistol
PISG B 0 A_Overlay(1001, "BigFlash")
PISG C 4
PISG B 5 A_ReFire
Goto Ready
BigFlash:
GLOW A 1 Bright A_OverlayScale(OverlayID(), 1.5)
GLOW A 1 Bright A_OverlayScale(OverlayID(), 1.25)
GLOW A 1 Bright A_OverlayScale(OverlayID(), 1.0)
Stop
}
}
Each call passes scaley as its default 0, so all three are square scales — the flash shrinks
evenly rather than squashing.
A layer that stretches horizontally only, growing 10% per tic while keeping its height:
GLOW A 1 A_OverlayScale(OverlayID(), 0.1, 0, WOF_ADD|WOF_KEEPY)
See also
- Psprite layers — the layer model
- A_OverlayOffset — the same
WOF_flags, applied to position - A_OverlayFlags —
PSPF_FLIPandPSPF_MIRRORfor mirroring - A_Overlay, A_ClearOverlays, A_OverlayAlpha, A_OverlayRenderStyle, OverlayID