From ZDoom Wiki
Jump to navigation Jump to search

void A_WeaponOffset [(double wx [, double wy [, int flags]]])]


This function can only be called on weapons. Offsets a weapon by the defined amount of wx and wy similar to the Offset frame keyword. This function has the following differences from the aforementioned function:

  • Offsets are floats, not integers.
  • Offsets are not lost when firing a weapon.
  • Offsets stack on top of weapon bobbing and behave independently, allowing you to use A_WeaponReady without losing offsets.
  • Specifying the default coordinates does not serve as a preservative. They are absolute.
  • Offsets can go beyond screen limitations.
  • Because this is an action function itself, Decorate expressions can be used.

This function is the same as calling A_OverlayOffset with the layer parameter set to PSPF_WEAPON.


  • wx: adjusts horizontal position based on positive (right) or negative (left) numbers. Default is 0.
  • wy: adjusts vertical position. Larger values lower the weapon, and vice versa. Default is 32.
  • flags: flags can be combined with the | separator. Default is 0:
  • WOF_KEEPXwx parameter will not be used.
  • WOF_KEEPYwy parameter will not be used.
  • 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.


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