Sprite States

by Michael “LHutz” Israel

In order to add a sprite to states.vc for example:

Shela0
Shelb0
Shelc0

Lampa0

You want the Shel to animation for 5 ticks

S_SHEL(‘SHEL’, 0, 5.0 / 35.0, S_SHEL1) { }
S_SHEL1(‘SHEL’, 1, 5.0 / 35.0, S_SHEL2) { }
S_SHEL2(‘SHEL’, 2, 5.0 / 35.0, S_SHEL) { }

To create Lamp as a static image type the following code

S_LAMP(‘LAMP’, 0, -1, S_NULL) { }

The format for a sprite is:

(For this tutorial VaVoomC is shown next to DDF—to make seeing how to convert easier.)

To add graphics into VaVoom you must add entries into states.vc that tells VaVoom where the lumps are located in the wad and how the lumps relate to each other. (The first graphic, the one that ends in ‘a’, is coded as ‘0’ in states.vc)

For example, UZIGA0 would be written in states.vc as:

S_UZIG(‘UZIG’, 0, -1.0, S_NULL) { } | UZIG:A:-1:NORMAL:NOTHING; 

Because there is only one image, –1.0 instructs VaVoom, that it is a still image.

S_NULL instructs VaVoom that it is the only image in the sequence.

If you had three images: firea0, fireb0, and firec0 that showed for three ticks you would write the following code:

S_FIRE(‘FIRE’, 0, 3.0 / 35.0, S_FIRE1) { } | FIRE:A:3:NORMAL:NOTHING,
S_FIRE1(‘FIRE’, 1, 3.0 / 35.0, S_FIRE2) { } | FIRE:B:3:NORMAL:NOTHING,
S_FIRE2(‘FIRE’, 2, 3.0 / 35.0, S_FIRE) { } | FIRE:C:3:NORMAL:NOTHING;

The second number tells what image to use; think of it as a=0, b=1, and so on.

The 3.0 / 35.0 tells the computer that the image lasts for 3 ticks, and that 35 ticks takes about a second. (The speed in ticks should always be divided by 35.)

Vavoom takes care of rotation angles—you just need to tell it what image to use.

It you include –1.0 and S_NULL at any time it will cause the last image to remain on the screen forever. (Let’s say you want to render BLODA0, BLODB0, BLODC0, and leave BLODC0 on the screen forever type to following.)

S_BLOD(‘BLOD’, 0, 3.0 / 35.0, S_BLOD1) { } | BLOD:A:3:NORMAL:NOTHING
S_BLOD1(‘BLOD’, 1, 3.0 / 35.0, S_BLOD2) { } | BLOD:B:3:NORMAL:NOTHING
S_BLOD2(‘BLOD’, 2, -1.0, S_NULL) { } | BLOD:C:-1:NORMAL:NOTHING;

The { } holds special commands that you may want to use to customize an image; such as lighting or weapon effects.

S_UZIG(‘UZIG’, 0, 1.0 / 35.0, S_UZIG) { A_WeaponReady(); } | UZIG:A:NORMAL:READY;

Tells the computer that S_UZIG is a UZI that is a ready weapon.

S_LITE(‘LAMP’, 0 | FF_FULLBRIGHT, 2.0 / 35.0, S_LITE1) { } | LAMP:A:2:BRIGHT:NOTHING,
S_LITE1(‘LAMP’, 1 | FF_FULLBRIGHT, 2.0 / 35.0, S_LITE) { } | LAMP:B:2:BRIGHT:NOTHING;

Tells the computer that the graphic is always bright. (On the left is VaVoomC, and on the right is DDF.)