A_OverlayOffset

From ZDoom Wiki
Jump to navigation Jump to search


Note: While the function described on this page is defined in the Actor class, it only works when called either from a PlayerPawn state, or from one of the StateProvider states handled by PSprite, such as Weapon's Ready/Fire/etc. state sequences or a CustomInventory's Use state sequence. It will have no effect in any other context (such as calling it from a weapon's DoEffect override). If there's a need to achieve a similar effect from a different context, obtain a pointer to the necessary PSprite and modify its fields directly.

Actor

action native void A_OverlayOffset(int layer = PSP_WEAPON, double wx = 0, double wy = 32, int flags = 0)

Usage

Works just like A_WeaponOffset, but allows applying offsets to a specific layer rather than just on the main layer (aka PSP_WEAPON).

Note: by default layers besides PSP_WEAPON will follow PSP_WEAPON's offsets, and their own offsets set by A_OverlayOffset will be added on top of the main layer's offsets. This can be changed by disabling the PSPF_ADDWEAPON flag with A_OverlayFlags. If this is done, A_OverlayOffset's offsets become absolute values.

Parameters

  • int layer
The ID of the layer to adjust.
  • double wx
Adjusts horizontal position based on positive (right) or negative (left) numbers. Default is 0.
  • double wy
Adjusts vertical position. Larger values lower the weapon, and vice versa. Default is 0.
Note: If PSPF_ADDWEAPON flag is disabled on the layer in question, then wy has to be explicitly set to WEAPONTOP (or 32) in order to match the main layer's position.
  • int flags
Flags can be combined with |:
  • WOF_KEEPXwx parameter will not be used, keeping the horizontal offset as-is.
  • WOF_KEEPYwy parameter will not be used, keeping the vertical offset as-is.
  • WOF_ADD — Adds the current x and y parameters to the current offsets instead of overriding them. Also implies interpolation (see below).
  • WOF_INTERPOLATE — Interpolates the offset between tics, smoothing out the animation.

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 contributions are greatly appreciated.


See Also