| MCS' Coding Tips
Adding walls and sprites to MapEdit definition files
Written by MCS
Tips - "Success"!
Original Wolf 3D
|You used FloEdit to add new walls and/or sprites to your addon. And you're using MapEdit as your favourite mapeditor. Here's what you'll need to do in order to use your new stuff in MapEdit.
I'm assuming that you're using MapEdit's latest version 8.4 It's stable and comes with some excellent documentation about how to design levels. If you don't have it yet, you can download it from our Utilities page here.
This information should work with previous versions too, but since I don't have these versions, I didn't test it.
When editing Wolfenstein, MapEdit uses 2 definition files:
MAPDATA.WL6 definitions for walls, doors and elevators
OBJDATA.WL6 definitions for static sprites and enemies
Each of these files contains three columns.
The first column represents the identifier of the object, the second deals with the representation of the object in the MapEdit legend, while the third column contains the description of the object.
Technically, you can have up to 64 different wall types in Wolfenstein, without having to make modifications to the engine.
The original game comes with 49 wall types (FloEdit Map-ID 1 to 49, index #0 up to 97), so it's possible to add another 15 pairs of walls.
Caution: FloEdit will allow you to add more pairs (up to 50, actually) but they won't be visible in the game, unless you alter the engine in some way, which won't be discussed here.
Now open up your MAPDATA.WL6 file and locate this block:
0030 7680 Beige panel-wood trim
0031 7630 GS-Hitler
0032 c0e0 Jammed door
0033 3010 Side of doorway
0035 40e0 Jammed locked door
0036 1f40 Garbled image 1
0037 1e40 Garbled image 2
0038 1d40 Garbled image 3
0039 1c40 Garbled image 4
003a 1b40 Garbled image 5
003b 1a40 Garbled image 6
003c 1940 Garbled image 7
003d 1840 Garbled image 8
003e 1740 Garbled image 9
003f 1540 Garbled image 10
The FIRST two lines of this block deal with the LAST two textures in the original VSWAP.
Apparently, the authors of MapEdit didn't realize that the additional identifiers would just display the doors and doorways as "dead" objects.
But that's OK.. this means that the definitions of your extra wall textures are already in there, just alter the descriptions starting from the third line of the block, and you're ready to use your new walls ingame. That's all.
In order to add new sprites, you'll need to add them to the engine first, by following the instructions in FloEdit's helptext.
If all went well, you added some code in either WL_DEF.H, WL_ACT1.C and WL_GAME.C
Let's say you wanted to have 3 extra sprites. In your WL_GAME.C, you'll find something like this:
case 73: // TRUCK AND SPEAR!
case 75: // new sprite 1
case 76: // new sprite 2
case 77: // new sprite 3
The purple lines were added by you :-)
Now we'll just have to insert the new identifiers in OBJDATA.WL6
The problem is, MapEdit is using hexadecimal format to store the identifiers, so we have to convert our new decimal values to hexadecimal ones.
In case you're not familiar with the hexadecimal notation, do the following:
In Windows, fire up the calculator (CALC.EXE) In the menu bar, choose View and set to Scientific.
Now enter 75 and check the "Hex" bullet. The display will show "4B". Write that down.
Switch back to "Dec" and enter 76. The display should now read "4C". Repeat as necessary.
Now open your OBJDATA.WL6 and add the new values with leading zeroes as follows:
004b 7001 New sprite 1
004c 7002 New sprite 2
004d 7003 New sprite 3
You're now ready to test your new sprites ingame.
This information is valid for all kinds of sprites (statics, bonus objects, treasures etc.) EXCEPT guards. If you'll need to know how to add a new guard to MapEdit, please refer to the adding a new enemy tutorial.