With any of the three following setups of development tools it is possible to make source code changes to Wolfenstein and compile successfully.
BORLAND C++ 3.0/3.1 was the tool used by Id and with it changes can be made to any C- or assembly file.
Using Turbo C++ 3.0 there are two (2) C-files that should not be re-compiled: ID_CA.C and ID_SD.C (there will be graphical flaws if they are re-compiled). For how to avoid re-compiling these two files see below.
Whether there are any assembly files that should not be re-compiled/re-assembled unless one uses the assembler that was part of the BORLAND C++ 3.0/3.1 software purchase I can't say for sure, but my advise is then not to change any assembly file without a backup of the original corresponding object file.
The project file that comes with the source code released by Id needs to be changed. To do this the integrated development environment (IDE) must be started. Using Turbo C++ this program file is called TC.EXE, (in BORLAND C++ it is called BC.EXE). TC.EXE is located in the 'bin' directory of where Turbo C++ was installed. For example on my computer the file is - E:\TC\BIN\TC.EXE
To make things easier the 'bin' directory should be in the environment PATH. For example on my computer this command is in the C:\AUTOEXEC.BAT file: set PATH=%PATH%;E:\TC\BIN (%PATH% means the current PATH - just add our directory)
To start the IDE and automatically load the wanted project file, change directory to where the source code was installed (if you are in Windows prior to 95 close it and thus return to DOS, if you are in Windows95 or above start the DOS promt - press ALT-ENTER if it does not start up in full screen mode). On my computer I need to issue the following three commands to start the IDE:
E: <ENTER>
CD \WOLFSRC <ENTER>
TC <ENTER>
If I hadn't changed the PATH in AUTOEXEC.BAT the last command would have been:
E:\TC\BIN\TC <ENTER>
(<ENTER> of course means press the ENTER/RETURN key)
Now you are in the IDE (if it doesn't start check that you have done everything corresponding to your setup). The IDE is a "windowed" environment and if any windows are open just close them by clicking on the small icon in the upper left corner (if your mouse doesn't work in DOS, press Ctrl-F4 repeatedly until all windows are gone). It is easy to use the IDE without the use of a mouse (if you are completely lost without the mouse, don't worry, you don't have to use IDE interactively once the project file has been changed), to carry out menu commands press F10, use left- and right arrow keys to move the highlight and the down arrow key to pull down a menu. If you want to try everything to make your mouse work and you are in the DOS promt - press ALT-ENTER to display the IDE in a window, if it looks ok maybe your mouse also works.
To check that the project file (WOLF3D.PRJ) has been loaded, open the Project-menu. Both "Open project..." and "Close project" should be active. If "Close project" is "grayed" no project file has been loaded and you should check whether the current directory is the right one.
The number and kind of changes that have to be made to the project file depend upon which tool(s) you are using (see above for the three possible setups). No matter which tool you have, you must change the options for directories. Open the Options menu, higlight Directories... and press <ENTER> (to move between the input fields and the "buttons" in this dialog box press <TAB>).
The two object files SIGNON.OBJ and GAMEPAL.OBJ must be included in the project. They should be placed in the subdirectory OBJ of where the source code is located. This is automatically done when the orginal code released by Id is unzipped. To make changes to the loaded project, pull down the "Window" menu and select "Project" - all files in the project will be listed in the window. To maximize this window click the small icon in the upper right corner or select "Window" | "Zoom". In the original project file the two afore-mentioned files are conspisious since their location is given as an absolute path. This is not what you want, so first the two files must be removed from the project and then added using the correct relative path. To remove the files, simply highlight them one at a time and press DEL(ETE). To add them from the correct location first press INS(ERT). A dialog box will open (to quit any such dialog box in the IDE without making any changes press ESC(APE)). Change whatever is in the Name field to "*.OBJ" - skip the quotation marks. Press TAB to move focus to the Files box. This box lists files and subdirectories of the current directory. To change to another directory, highlight it and press ENTER. The parent directory is marked by to periods (..). When you are in the OBJ subdirectory you should see the two wanted files listed. Highlight them in succession and press the Add button (to press a button without the mouse, move the highlight to it by pressing TAB then press SPACE(BAR)). When both files have been added press the Done button. In the project window the two files should now be present with Location marked as OBJ. For all the other files the location should be a single period (.) indicating the same directory as the project file itself.
If you use BORLAND C++ 3.0/3.1 you could now compile and link by choosing "Compile" | "Build all". You could do the same thing if you have Turbo C++ and Turbo Assembler but the resulting WOLF3D.EXE file would have some differences from the original that would result in graphical errors when the game is played. To avoid this error the two files ID_CA.C and ID_SD.C should be removed from the project, and the two corresponding precompiled object files ID_CA.OBJ and ID_SD.OBJ should be placed in the OBJ subdirectory together with GAMEPAL.OBJ and SIGNON.OBJ and then added to the project. If you don't have the assembler, all assembly files must be removed from the project and the corresponding precompiled/assembled object files must be moved to the OBJ subdirectory and must be added to the project. The files in question are:
| Remove | Add |
|---|---|
| C0.ASM | OBJ\C0.OBJ |
| H_LDIV.ASM | OBJ\H_LDIV.OBJ |
| ID_SD_A.ASM | OBJ\ID_SD_A.OBJ |
| ID_US_A.ASM | OBJ\ID_US_A.OBJ |
| ID_VH_A.ASM | OBJ\ID_VH_A.OBJ |
| ID_VL_A.ASM | OBJ\ID_VL_A.OBJ |
| JABHACK.ASM | - No corresponing file, but this is no problem - |
| WHACK_A.ASM | OBJ\WHACK_A.OBJ |
| WL_ASM.ASM | OBJ\WL_ASM.OBJ |
| WL_DR_A.ASM | OBJ\WL_DR_A.OBJ |
After having made all the necessary changes to the project (you could of course make more changes than what is necessary, for example if you don't plan to make any changes to the assembly files you could remove them and add the object files as described above even if you have got the assembler) select "Compile" | "Build" all from inside the IDE. If you receive any error message, check that you have done everything as described above. If it compiles and links sucessfully the resulting WOLF3D.EXE file is placed in the OBJ subdirectory together with all the object files.
In the IDE you can open editor windows and start changing the source code, but if you are used to Windows even a first class DOS editor may not seem as a first choice with its limited space (you can select "Options"|"Environment"|"Preferences" and change from 25 to 43 or 50 lines though). If you are in the IDE and have made any changes to the source code save the file(s) and select "Compile"|"Make". The difference between "Make" and "Build all" is that with "Make" only source files that are newer than the corresponding object files are re-compiled before the linking thus saving time. It is easy to "make" or "build" a project from without the IDE. To (re)make the Wolfenstein project issue the following command from the DOS command line:
TC /m WOLF3D.PRJ
To build it (re-compile all files) the command is:
TC /b WOLF3D.PRJ
For the commands to work the project directory must be the working/current directory and the TC.EXE program must be in the PATH (see above). If any of the two doesn't hold, the full path must be given as appropriate. Any of the commands above starts the IDE, loads the project, makes/builds it, writes messages to the DOS console and exits the IDE. If you use Windows the best sort of editor you can use is therefor one which will let you issue a DOS command and catch the output in a window. My choice as editor (and the one from which the screen shots are taken) is Programmer's File Editor (PFE). It is FREEWARE and is availble both in a 16 bit and a 32 bit version from all the major shareware sites. The 16 bit version is preferable if you want to collect files in projects (see the exellent help file that comes with the editor for details).
Turbo C++ comes with a tool called GREP located in the same directory as the compiler. GREP lets you search for text strings in one or more files. For example to search for the text string "SD_PlaySound" in the Wolfenstein C-files you would change to the source code directory and issue the following command:
GREP "SD_PlaySound" *.C
All the lines in all the C-files containing "SD_PlaySound" would be listed. You can see the benefit of having such listings caught in a window of its own.