TNT1

From ZDoom Wiki
Jump to navigation Jump to search

TNT1 is a special internal graphic name in ZDoom that functions as an invisible sprite. It can be used in Actor definitions in ZScript and DECORATE to make the actor invisible for the duration of the states that have this sprite attached. This sprite name can be combined with any frame letter.

A simple example: the actor below is visible 10 tics (using the sprite of Doom imp's fireball) and then invisible for 25 tics in a loop.

class Blink : Actor
{
    States
    {
    Spawn:
        BAL1 A 10 bright;
        TNT1 A 25;
        loop;
    }
}

This dummy sprite is also traditionally used for 0-tic states that exist only to have a function attached to them:

Fire:
    TNT1 A 0 A_JumpIfNoAmmo("Reload");
    MGUN A 1 A_FireCGun;
    ...
Note: It is strongly recommended to use TNT1 when there's a need to create an invisible sprite, rather than including a physical transparent image in your project for such purposes. Not only would that be entirely pointless, but it would also rob you of a few unique features provided by TNT1 (listed below).


Special features

  • TNT1 is not an actual image. It's a special internal instruction to not render the calling actor, and it doesn't occupy any space in the memory.
  • It is not possible to include an actual image named TNT1A0 in a PWAD; it'll be ignored by the engine.
  • TNT1 can be used with any frame letter. You can equally use TNT1A, TNT1B or any other valid frame letter.
  • TNT1 only affects the actor's rendering and implies no invisibility in terms of actor logic (other actors will still be able to target, chase and attack it). Functionally, it's identical to setting the calling actor's RenderStyle to 'None'.
  • 3D models' frames cannot be attached to TNT1 frames in an actor, because TNT1 stops the actor from rendering, including when there's a model attached to it.
  • If an actor whose sprites aren't loaded is dynamically spawned, its sprites will be remapped to TNT1 so it can exist without issues but not render. This can happen, for example, if a Heretic actor is summoned via console while running ZDoom with a Doom IWAD.
  • TNT1A0 cannot be used as a patch in TEXTURES because only existing images can be used this way (which TNT1 isn't). If there's a need to create a dummy empty definition in TEXTURES, simply don't define any patches for it.

Trivia

  • The name "TNT1" comes from TeamTNT.
  • Some mods occasionally include an empty graphic called NULLA0 to use as a blank sprite, and occasionally mod authors mistakenly assume that it's an existing internal name. In fact, it is not, and there's no reason at all to include an image like this in ZDoom; TNT1 should be used instead.

See also