DECALDEF

From ZDoom Wiki
Jump to navigation Jump to search

The DECALDEF lump allows the wad maker to redesign the decals that are left on walls by monsters or the player. Hitscan weapons and projectiles can leave decals; shootable actors (normally, monsters) can also leave blood decals on walls next to them.

You can also place decals on the map with a Decal thing (9200) or through ACS with SpawnDecal. Decals can be spawned in ZScript/DECORATE with A_SprayDecal.

DECALDEF has the following definition types:

  • Decal — definitions of the actual images to be used as decals, their colors, renderstyle, etc.
  • Animator — animators can stretch, scale, fade out and perform other changes to decals after those have been created. Animators can be attached to decals.
  • DecalGroup — allows grouping multiple decals together under one name, so a random decal will be picked from the list.
  • Generator — generator is an instruction that allows attaching decals to an actor (like a puff or a projectile). Using this is optional; decals can instead be attached to a puff/projectile using its Decal property.


Error.gif
Warning: All DECALDEF definitions are order-sensitive. This means that if one definition is referencing another (such as a DecalGroup referencing a Decal), the referenced definition must be placed earlier in the file. As such, it's recommended to add definitions in the following order:
  1. All animators
  2. Animator combiners
  3. All decals
  4. All decal groups
  5. Generators (if used)


Decal definition

The information of a decal begins with the decal itself followed by a generator to tell GZDoom which object will leave this decal. You can also specify a Decal ID in order to place decals directly on the map. The Decal ID must be a number between 1 and 65535 (inclusive). Several options can be used when defining a decal:

  • pic <graphics name>
This is the graphic ZDoom will paste on the wall.
  • shade "rr gg bb"
This allows you to recolor the picture using specific RGB values. The value is specified as a string containing 3 hexadecimal values.
  • x-scale <scale>
This scales the graphic on the x axis. 1.00 is default.
  • y-scale <scale>
This scales the graphic on the y axis. 1.00 is default.
  • flipx
This tells ZDoom to flip the graphic on the x axis when drawing it.
  • flipy
This tells ZDoom to flip the graphic on the y axis when drawing it.
  • randomflipx
This tells ZDoom to randomly flip the graphic on the x axis when drawing it.
  • randomflipy
This tells ZDoom to randomly flip the graphic on the y axis when drawing it.
  • solid
draws the decal non-translucent.
  • opaqueblood
Draws the decal non-shaded, i.e. the same way as sprites are drawn with the 'Normal' Renderstyle. This is useful when the decal is supposed to imitate the look of a sprite.
  • translucent <alpha>
Draws a translucent decal with the specified translucency. 0.0 means it's invisible, 1.0 means it's opaque
  • add <alpha>
Draws the decal with additive translucency. 0 means it's invisible, 1 means it's drawn in full intensity.
  • fuzzy
Draws the decal with a fuzz effect (like the spectre in Doom.)
  • fullbright
Draws the decal full bright regardless of the current lighting in the sector.
  • lowerdecal decalname
Draws another decal below this one. The BFG lightning effect uses this for example
  • colors "rr gg bb" "rr gg bb"
Creates a translation table. From a look at the implementation it doesn't look useful. If somebody has more information or some experience how to use it please post it here!
  • animator
Sets a Decal animator for the current decal

Note that not all of these must be used for each decal. However, the following example shows each in use.

decal MyDecal 4
{
    //The name of the graphic used by the decal:
    pic SCORCH1
    //The image will be shaded slightly green:
    shade "00 10 00" 
    //Scaled to 25% of the image's original size:
    x-scale 0.25
    y-scale 0.25
    //Will be randomly flipped along the X, or Y or both axes:
    randomflipx
    randomflipy
}
//Attaches this decal to the FrostMissile projectile class:
generator FrostMissile MyDecal

In this example, the image "SCORCH1" is read, and shaded slightly green. It is then scaled to 25% its normal size, and randomly flipped on the two axes. To place this decal on a map with the decal thing, use an ID number of 4. The generator instruction attaches it to the Mage's FrostMissile.

Blood decals

The engine is hardcoded to use either the decalgroup BloodSplat or the decalgroup BloodSmear for blood splattered on walls. This depends on the damage inflicted:

  • Less than 15: one BloodSplat decal (about 60% chance of no decal at all if damage is less than 11);
  • Less than 25: two BloodSplat decals;
  • 25 or more: either three BloodSplat decals (nearly 91% chance) or one BloodSmear decal (about 9% chance).

These decals are then projected on nearby walls, if possible, according to the direction of the attack, slightly altered by random noise.

TraceBleed and TraceBleedAngle are ZScript functions that can manually place blood decals (without changing their internal names).

Decal generator

Note: Using generator is not required: decals can be attached to projectiles/puffs with the Decal actor property in ZScript/DECORATE.

The generator keyword allows attaching a decal to a projectile or puff:

generator FrostMissile MyDecal

Using None instead of an actual decal name, clears the decal that was previously assigned to the generator.

An optional keyword can be added after generator to exempt a generator definition from being error-reported by the engine if the referenced actor or decal definitions do not exist.

Decal groups

The following example shows a decal which randomly selects between two different decals to paste. The decals are set up as usual, and a "decalgroup" header is added, with the names of the two (or more) decals to use. The generator then references the decalgroup.

decal MyDecal1
{
	pic PLASMA1
	shade "08 08 08"
	randomflipx
	randomflipy
}
decal MyDecal2
{
	pic PLASMA2
	shade "08 08 08"
	randomflipx
	randomflipy
}
decalgroup MyDecal
{
	MyDecal1        1
	MyDecal2        1
}

Decal animators

Decal animators describe how a decal is changed after it has been created. Animators are defined as follows:

animatortype AnimatorName
{
  <properties>
  ...
}

Any decal animator defined this way can be specified in a decal definition by using the Animator keyword.

Animator types are listed below.

Fader

Fader is an animator that fades a decal out by reducing its opacity. The syntax is:

fader FaderName
{
   DecayStart <seconds>
   DecayTime <seconds>
}
  • DecayStart
The time in seconds the decal remains unchanged until the fading process starts.
  • DecayTime
The time in seconds it takes for the decal to completely fade out and disappear.

Stretcher

Stretcher is an animator that stretches the decal to a defined size. The syntax is:

stretcher StretcherName
{
   GoalX <size>
   GoalY <size>
   StretchStart <seconds>
   StretchTime <seconds>
}
  • GoalX
The final horizontal scaling factor of the decal
  • GoalY
The final vertical scaling factor of the decal
  • StretchStart
The time in seconds the decal remains unchanged until the stretching process starts
  • StretchTime
The time in seconds how long the stretching process will take.

Slider

Slider is an animator that slides the decal along the wall. The syntax is:

slider SliderName
{
   DistX <size>
   DistY <size>
   SlideStart <seconds>
   SlideTime <seconds>
}
  • DistX
The distance the decal moves in X-direction
  • DistY
The distance the decal moves in Y-direction
  • SlideStart
The time in seconds the decal remains unchanged until the sliding process starts
  • SlideTime
The time in seconds how long the sliding process will take.

ColorChanger

ColorChanger gradually alters the color of a decal. The syntax is:

colorchanger ChangerName
{
   Color "rr gg bb"
   FadeStart <seconds>
   FadeTime <seconds>
}
  • Color
The color the decal should change into.
  • FadeStart
The time in seconds the decal remains unchanged until the changing process starts
  • FadeTime
The time in seconds how long the changing process will take.

Combiner

Combiner is a method to group multiple animators (since decals themselves can't have more than one animator attached). The syntax is:

Combiner CombinerName
{
   AnimatorName
   AnimatorName
   ...
}

Each AnimatorName must specify a previously defined animator.

See also