Bit of a long post, sorry if I'm rambling or missing something. Sleepy headed...
Weapons can override player called overlays just like player called overlays can override weapons. The difference between the two is, those created by weapons are destroyed when switching to another weapon.
Inventory ones, same deal. If the calling item vanishes, the overlays are gone too.
However, the player body can only create overlays belonging to it. I.e. If a weapon were to try making an overlay based on a state belonging to the player and not the weapon itself, it wouldn't work.
Also, the only shared piece between weapons and players for overlays is whether a layer number is occupied or not. So if you have an already active layer on 2000 set by the weapon, the player can still perform
if (A_Overlay("Null",2000,true)) to see if that spot's taken or not without actually invoking a new overlay.
As long as you don't use the internal hardcoded layers [-1, 1] and 1000 (flash state) (unless you know what you're doing and proceed with great care), you'll be fine.
Easiest way to avoid overriding any is to make a
constant enum starting at 2.
Code: Select all
enum
{
Overlay_ChaingunBarrel = 2, //Will be free from accidental overriding.
Overlay_ChaingunCounter, //Auto increments by one every time. So 3
Overlay_ChaingunFire, // 4
};
Because actors themselves don't have overlays currently, there's no internally defined hard coded layers to worry about (should this get in) because they were never meant to have weapons and stuff.
Bit of a long post, sorry if I'm rambling or missing something. Sleepy headed...
Weapons can override player called overlays just like player called overlays can override weapons. The difference between the two is, those created by weapons are destroyed when switching to another weapon.
Inventory ones, same deal. If the calling item vanishes, the overlays are gone too.
However, the player body can only create overlays belonging to it. I.e. If a weapon were to try making an overlay based on a state belonging to the player and not the weapon itself, it wouldn't work.
Also, the only shared piece between weapons and players for overlays is whether a layer number is occupied or not. So if you have an already active layer on 2000 set by the weapon, the player can still perform [b]if (A_Overlay("Null",2000,true))[/b] to see if that spot's taken or not without actually invoking a new overlay.
As long as you don't use the internal hardcoded layers [-1, 1] and 1000 (flash state) (unless you know what you're doing and proceed with great care), you'll be fine.
Easiest way to avoid overriding any is to make a [url=http://zdoom.org/wiki/Constants]constant enum[/url] starting at 2.
[code]enum
{
Overlay_ChaingunBarrel = 2, //Will be free from accidental overriding.
Overlay_ChaingunCounter, //Auto increments by one every time. So 3
Overlay_ChaingunFire, // 4
};[/code]
Because actors themselves don't have overlays currently, there's no internally defined hard coded layers to worry about (should this get in) because they were never meant to have weapons and stuff. :P