Dynamic lights and coronae - Doom Legacy Wiki

Dynamic lights and coronae

From Doom Legacy Wiki

Jump to: navigation, search
Nimrod by Ebola
Nimrod by Ebola
Suck A Sage by DarkWolf
Suck A Sage by DarkWolf

Coronae (plural of corona) are those circles of light you see attached to certain sprites in Legacy's hardware modes. Coronae are dynamic lights that add atmosphere to torches, monster projectiles and other entities. Many maps have come out that use coronae as light sources that resemble engines like Quake etc.

As you can see, these coronae are not attached to any sprites, or are they? These coronae are in fact objects that have clear sprites. These objects have also had some of their attributes changed via Dehacked.

Contents

Choose A Sprite

First off, decide which object you wish to make into a free floating corona, this can be any of the objects that have a corona when in Doom Legacy's hardware mode. For this example, let's use the tall red torch.

The first step is to load new sprites for the tall red torch that are completely transparent. You can do this by making a 1x1 image with a cyan (or whatever color your image editor uses for the transparent color). Load this image to each frame of the sprite so that your corona is by itself.

Transparent Image vs. Invisible Flag

Why did we use a transparent images instead of setting "completely invisible" in Dehacked? For some reason if you set this flag neither the sprite nor the corona appears. Don't worry though, the 1x1 image won't take up much space in your WAD.

Editing Tutorials

There's still a problem with our corona. It blocks movement as if it were still a torch. To solve this, load up Dehacked and go to the tall red torch in the Things editor. Make sure the obstacle bit is unchecked, also check the floating and no gravity bits. This will allow you to place the corona anywhere in the level without it falling to the ground. You could also set "hangs from ceiling" if you always want the corona to be near the ceiling.

Placing Coronae

This is where FraggleScript comes in. To place our corona, we'll use FraggleScript's spawn function. Here's the syntax.

spawn(int type, int x, int y, {int angle}, {int z})

If you're new to FraggleScript this can look confusing. So I'll break it down:

spawn() is the function, obviously we'll be creating an entity.

int type is the type of object you want to spawn. Int means that we should be entering an integer (whole numbers), but how do we know what number corresponds to which thing? Luckily, you don't have to memorize any numbers, just use the names in the things.h lump in the legacy.wad. Make sure you include things.h in your script though (see example further down).

int x is the X position the object will be spawned in. If you never paid attention in algebra, most map editors will give you the coordinates (x,y) of your mouse cursor.

int y is the Y position.

int angle is the angle the object will face. This number is actually optional, but you need to specify it when you want to specify an int z value. Since our corona doesn't need to be facing a particular direction, enter 0.

int z is the Z position, also known as the height of the object. Map editors will not give you a Z coordinate because the original Doom was only meant to have objects created either on the floor or ceiling. The height of an object is not relative to the floor height, so if you have a room where the floor height is 128 and the ceiling is 256 and you want to spawn the corona in the middle of the room, int z needs to be 192. If you make a mistake you can end up spawning an object above, or below the room, which isn't good. By the way, int z is optional, if you don't use it the object is spawned at the floor or ceiling (if it's a hanging object). If you use int z though, you must specify int angle.

Spawning Example

[scripts]
include("things.h");
script 1 { spawn(CANDLE, -128, 184, 0, 296); spawn(CANDLE, -128, 456, 0, 296); spawn(CANDLE, -128, 184, 0, 264); spawn(CANDLE, -128, 456, 0, 264); } startscript(1);

This is an example of spawning four coronae at four points in the map. The include("things.h"); will allow you to use names for objects instead of numbers. You'll probably want to have this line in many of your scripts, even if you're not using a corona.

Changing Properties

We can use FraggleScript with the function setcorona. When you use this function make sure to use include("things.h"); as in the previous example. Here are a couple of variations you can use:

setcorona(int type, LIGHT_COLOR, "XXXXXXXX")

This sets the color of the light that comes off the corona. The light color changes the color of the light that hits the wall, floor or ceiling. The int type corresponds to the corona you wish to change. These can be found in things.h just like the map objects. XX XX XX XX refers to a hex color code, the first pair are Red, the second Green, the third Blue and the fourth is the alpha (opacity). The sets of numbers can range from 00-FF. With the alpha, FF is the maximum opacity while 00 is the minimum. For example E4A5457F is this color and is 50% opaque.

setcorona(int type, CORONA_COLOR, "XXXXXXXX")

This does the same as above, but changes the color of the corona (the circle of light coming off the object).

setcorona(int type, LIGHT_RADIUS, fixed value)

This changes how far the light shines out from the object. Fixed value changes the radius.

setcorona(int type, CORONA_SIZE, fixed value)

This changes the size of the actual corona. Fixed value changes the size.

setcorona(int type, CORONA_OFFX, int value)

This changes the X offset the corona appears at on the sprite. Int value changes the X offset.

setcorona(int type, CORONA_OFFY, int value)

This changes the Y offset the corona appears at on the sprite. Int value changes the Y offset.

setcorona(int type, CORONA_TYPE, int option)

This changes how the corona behaves, here are the options:

UNDEFINED_SPR - No corona or light, incase you need to remove a corona from an object that normally has one.

CORONA_SPR - ? Seems to do the same as above, although I don't think it's supposed to.

DYNLIGHT_SPR - Light only, no corona, like the imp's fireball.

LIGHT_SPR - Corona and light, flickers ever few seconds.

ROCKET_SPR - Flickers rapidly.

Property Example

[scripts]
include("things.h");
script 1 { setcorona(COLUMN_L, LIGHT_COLOR, "FF0000FF"); setcorona(COLUMN_L, CORONA_SIZE, 100.0); setcorona(COLUMN_L, CORONA_COLOR, "0000FF00"); setcorona(COLUMN_L, LIGHT_RADIUS, 100.0); } startscript(1);

Altered Lamp Corona

Personal tools