Source Code

   TUTORIAL 1: Changing the Ceiling Colors

   Before id Software ever released the source code, I was wanting to change the blasted ceiling colors. That, and the code that specified which level the secret elevator had to be on in each level. Changing the ceiling colors is so easy, it's one of the first things you can do. A knowledge of the hexadecimal number system will help you here, but for those who don't know (and don't want to learn), you can go back up to my Source Code main page and download WOLFPAL.GIF. It's a map of Wolfenstein's palette, plus a quick and easy way to find the hexadecimal values for a particular color index. You'll need that two-digit hex value to change the ceiling color to the color of your choice, as you will see below.

Step 1.
   Open up your favorite text editor. (I actually use DOS Edit.)
Step 2.
   Open the file WL_DRAW.C from your Wolfy source code directory.
Step 3.
   Do a text/ASCII search for "vgaCeiling", or if you haven't changed anything yet, go right down to line 946.

   Okay, now you will see a huge mess of letters and numbers, separated by commas. They all start with "0x", and are followed by 4 characters, usually a combination of letters and numbers. These are hexadecimal values. They represent the palette index number for a particular color in the Wolfenstein palette. A color index, by the way, is which position in the palette (00-ff in hex, 0-255 in decimal) each color is stored at. Notice how the first line starts with a whole bunch of "0x1d1d"'s. "1d" is hex for 29. Palette index 29 is that dull, boring gray that is the entirety of Episode 1 (except the secret level).

Notice how the hex value for each ceiling color is repeated, so that it's really listed twice for each level. (Hence "1d1d", instead of just "1d".) If you put a different value for one of the "1d"s, such as "dd" which is brown, the ceiling will have vertical stripes on it -- one set of gray, one set of brown. I'm just saying this because it's true. I highly recommend against it. It looks ugly. (Plus the stripes aren't in perspective, so it looks like there's no roof, just a striped sky. Trippy.)

The first line of values is Episode 1, and the 10 values from left to right are for levels 1 to 10, respectively. The levels are just listed in sequential order, basically.

   Here's a screenshot to show you what the code will look like.

Source code image

   Okay, let's get in there and mess things up!

Step 4.
   Go to the value for the first level of the first episode (that 0x1d1d in the corner) and change the "1d1d" portion of the code to something else. You can pick something custom from the palette, or try one of these: "0xcece" for a funky peach, "0x9898" for a medium blue, "0x1818" for light gray, "0x6f6f" for a medium green, etc. Oh yeah, and don't put the quotes in there.
Step 5.
   Save the file and go compile and link it to a new EXE.
Step 6.
   Try it out in the game.

   That's it! Aren't ceiling colors easy? Remember, ceiling colors really do have an impact on the appearance and atmosphere of your level. I recommend picking a ceiling color that matches, or at least goes with, the primary ambient color of the walls you will be using. I.e., pick a nice brown ceiling like "0xdddd" for a level with lots of wood walls. Okay, now go have fun.


On to the next tutorial: Changing the Music on Each Level


[ Welcome ] [ News ] [ About the Bunker ] [ Add-ons ] [ Design Tips ]
[ Source Code ] [ My Project ] [ Links ]