| This article or section should contain one or more images. Please spruce up the article by adding an image. |
Pegging refers to a special texture rendering behavior for sidedef walls, where the middle texture is positioned in a certain way. Specifically, it refers to flagging a linedef with either Lower Unpegged or Upper Unpegged.
In SRB2, the middle texture is usually rendered as a "false wall", i.e., the player can pass right through it. However, the positioning of the texture is a little complicated. By default, middle textures appear on the ceiling, making for the common "walls in the sky" mistake that beginning mappers often run into. One can use Lower Unpegged to stick the middle texture to the floor, or Upper Unpegged to stick the middle texture to the ceiling (which is the same as the default behavior, but it's more elegant to set it explicitly). Upper and Lower Unpegged are also used to make the Upper and Lower textures render from the top and bottom of the wall, respectively, rather than the other way around.
Of the two, Lower Unpegged is the more commonly used option.
Contents |
In SRB2 Doom Builder, make a map or open an existing one. Select one or more two-sided linedefs and then right-click to bring up the "Edit Linedef" dialog.
Under "Flags", one can check either Lower Unpegged or Upper Unpegged (highlighted in red) to set the effect. Here, we'll be making a tall grass border like the ones seen in Greenflower Zone, so check Lower Unpegged.
Now you need to set the correct textures. Switch to the "Sidedefs" tab. You only need to set certain textures and options for the effect to work; the others have no bearing on how it looks.
As highlighted, only the middle textures and the texture offsets (more on the latter, later) have an effect on pegging. Also, for most cases, one must set both the front and back sidedefs to the same settings, since the middle textures will be seen from both sides.
Because pegging affects middle textures, set both the front and back middle textures to GFZGRASS. The other textures can be left as they are. For now, leave all texture offsets at 0. Here's how the dialog will look afterwards. Apply the changes by clicking "OK", and then save your map and test it.
One of the screenshots above should show what the result will be. Notice how if you checked Lower Unpegged, the middle GFZGRASS texture is tacked to the floor, while otherwise, it's tacked to the ceiling.
And that's it. The way to manipulate middle textures is as simple as checking "Lower Unpegged" or "Upper Unpegged". This is a very useful tool in making maps.
One quirk of pegging is that it's not obvious how to set it for FOFs. If you try setting the target sector's linedef textures to GFZGRASS and then check "Lower Unpegged", you're probably going to get this:
instead of this:
The GFZGRASS will appear on the target sector's real floor, rather than the FOF. And setting the texture on the control sector itself doesn't work, either (as the control sector actually uses the middle texture for the FOF's walls.) The way to set up GFZGRASS on FOFs is actually by a trick, or illusion: Set the texture's Y offset to the appropriate height. The GFZGRASS itself should still be set on the target sector.
The FOF's top height, in the screenshot, is 192 (above the real floor, which is at 0), so set each texture's Y offset to 192 as well. Here's how it should look. Save your changes and then try it out! The result should be that of the second screenshot above. It looks like this above the FOF:
A side effect to this is that the ground's lower texture is shifted too, due to the Y offset. Also, the GFZGRASS can only be set on the FOF using this method, and a second middle texture can't be set on the ground itself. However, both of these side effects are usually accepted in favor of the FOF effect.
If these side effects are unwanted, there is a slightly more complicated way you can do it, using an intangible FOF without flats. This will create an additional FOF on top of the already existing one, and render only the sides, which are set to a grass border texture. The floor height of this FOF should be the ceiling height of the regular one, and the ceiling height should be 8 fracunits above that (for GFZGRASS, taller middle textures will need a taller FOF).