A_ClearOverlays

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

native int A_ClearOverlays(int sstart = 0, int sstop = 0, bool safety = true)

Usage

Removes a range of layers between [start,stop]. If no value or 0 is used for both, it will clear all but the hardcoded layers. Returns the number of layers cleared that were active between the range.

Note: When there's a need to remove only one layer, the same number must be passed to both arguments. Skipping one of them will cause the function to do nothing.


Parameters

  • int start
The low end of the range to clear through. If 0 including stop, clears all current overlays except hardcoded ones.
  • int stop
The high end of the range to clear through. If 0 including start, clears all current overlays except hardcoded ones.
  • bool safety
Enabled by default, the hardcoded layers above are protected from wiping as this may cause problems with switching away from weapons, as there is no active layer to allow switching with. Use extreme caution when disabling.

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