In Doom, a sprite is a series of images that can be used to display a thing. In the original Doom, adding or changing sprites (and flats) was a complicated process involving patches to the IWAD. ZDoom handles these graphics differently, allowing you to easily add or change sprites with a PWAD.
Sprite image names have the format:
where NNNN is an arbitrary name for the sprite, F is a letter specifying the frame position (walking1, walking2, shooting, etc), and A specifies the angle.
There are three "reserved" sprite names that have specific effects.
- TNT1 A
- Originally introduced by TeamTNT in Boom, TNT1 frame A is an invisible sprite. Even if graphics are provided (for example, a TNT1A0 lump), it will remain invisible. For actors needing to be invisible, use TNT1.
- ---- A
- This sprite is interpreted as "keep previous sprite". The frame letter is irrelevant, so A is generally used. An example is the GenericFreezeDeath state in Actor. To be parsed correctly, this name requires to be within quotes (e.g., "----" A -1). This must not be used for the first frame of an actor as it will spawn the Missing Actor object instead (dark red sign with a yellow exclamation point).
- #### #
- This sprite is interpreted as ----, but with the difference that it allows overriding selectively either the sprite or the letter, or both. Using #### for the sprite means "keep previous sprite" and using # for the letter means "keep previous letter". An example is the GenericFreezeDeath state in Actor. To be parsed correctly, this name requires to be within quotes (e.g., "####" "#" -1). This must not be used for the first frame of an actor as it will spawn the Missing Actor object instead (dark red sign with a yellow exclamation point).
(New from A_SpawnItemEx can now utilize SXF_TRANSFERSPRITEFRAME, allowing use of the two preserving names above for the first frame of the initializing actor. This only works with A_SpawnItemEx, and should not be attempted with anything else.): Actors spawned with
You can have 29 frames of animation for any one sprite name, one for each letter of the alphabet plus [, \ or ]. For example POSSA1 is the first walking frame of the zombie trooper, POSSG1 is the pain frame (the animations themselves can be controlled with DEHACKED or DECORATE ).
If you require additional frames beyond [\], you can simply create a new sprite name. For instance, after using POSS]0, it would make sense to use POS2A0.
Sprites can also be defined in TEXTURES.
Generally, items and decorations have only one angle, denoted by a 0 (zero) after their frame letter. E.g. BON1A0 will be used to represent the health bonus no matter which angle you are looking at it from. Moving actors such as monsters and players typically have eight rotations in the original games. ZDoom however allows you to have up to 16 rotations for each sprite. Here is a table that shows what character to use for each angle:
|Sprite angle keys
for each amount
e.g POSSA9 would be used to represent the trooper at an angle of 22.5 degrees. POSSAA is the trooper from a 67.5 degree angle.
Every sprite image can have one alternative mirrored position. Simply add another frame letter and angle notation after the first in the image name. For example, for POSSA2A8, the actual image with this name will be flipped to show the trooper from the 315 degree angle.
Note that positioning of the frame's "original" and the mirror is important. The frame not being mirrored goes first, along with the number.
If for example, a sprite's 90 degree angle is facing to the right, it should be named like POSSA7A3. Otherwise, if it's facing to the left, it should be POSSA3A7. This is because the first side defined (in this case, the 270 degree frame known as 'angle 7') is destined to be the "original" sprite, which the engine will then mirror if another frame is defined after that one.
It's also possible to change sprite frame references to mimic, for example, a character's right leg going forward and stepping down with POSSA8C2, so actors can be more precise, even if it's not exactly the same. This can be used to help with flow, such as a big monster's walking cycle.
Conflicting sprite names
ZDoom supports Doom/Doom II, Heretic, Hexen, and Strife. Enemies or items from any of these games can be brought into any other game. However, this brings to light the fact that some sprites have the same name in one game as another sprite in another game. For example, the Doom Cacodemon uses sprites named HEAD*, but the Heretic Iron Lich uses the same name. To avoid conflicts and allow all sprites to coexist peacefully, a change was made to ZDoom which changes the name of the sprite ZDoom will look for, so long as it is looking at a PWAD. (That way the original IWADs will still work unchanged.)
Sprites are renamed as follows:
BLOD → BLUD (this makes it the same as Doom's blood sprite) HEAD → LICH
ARM1 → AR_1 ARM2 → AR_2 ARM3 → AR_3 ARM4 → AR_4 BARL → ZBAR BLOD → BLUD (this makes it the same as Doom's blood sprite) CAND → BCAN EGGM → PRKM GIBS → POL5 (this makes it the same as Doom's gib sprite) ROCK → ROKK SUIT → ZSUI TRE1 → ZTRE TRE2 → TRES WATR → HWAT MNTRF → MNTRU (these lines make MNTRG → MNTRV the minotaur attack MNTRH → MNTRW frames the same as MNTRI → MNTRX in Heretic to avoid MNTRJ → MNTRY having to patch the MNTRK → MNTRZ actor itself) ARTIINVU → ARTIDEFN (this separates it from INVU → DEFN Heretic's invulnerability item)
ARM1 → ARM3 ARM2 → ARM4 BAR1 → BARC BARL → BBAR BLST → MAUL BLOD → BLUD (this makes it the same as Doom's blood sprite) CNDL → KNDL LOGG → LOGW MISL → SMIS PMAP → SMAP POT1 → MPOT SHRD → SHAR SHT2 → MPUF SPID → STLK TLMP → TECH TRE1 → TRET TRCH → TRHL VASE → VAZE
The upshot of this is that if you want to include custom Iron Lich graphics, you will now use the new sprite, LICH*, rather than HEAD*. If you then wanted to include Cacodemon graphics, you could safely add HEAD* graphics and there will be no conflicts.