Instructions below relate to using Windows 7 to compile Doom3.gpl using Microsoft Visual Studio 2013 Community edition (not tested or checked on Windows 8/8.1 or Windows 10 - modified code as per below DOES NOT build with Visual Studio 2015). Code is extracted and used with minor modification (explained below).(!)
items required to produce a successful build.How to install
The installation process for Visual Studio 2013
differs slightly to that of Visual Studio 2010 in that a number of components previously requiring separate download are now included by default during install (although still optional so need to be selected for inclusion), i.e. Microsoft Visual C++ library.
- Install Visual Studio Community 2013, Multibyte MFC Library and the DirectX SDK to the suggested location(s) - typically "C:\Program Files (x86)\[path to install]" which allows the software to set up default system paths for reference within the project.
How to use
- Create a separate project/development folder and in to it unpack/extract the contents of Doom3.gpl.zip (this should be a completely separate folder/location to the Visual Studio 2013 installation files/directories, the location the eventual game/project is to be worked upon).
The source code likely won't compile without error by default but it shouldn't need any modification itself, all necessary changes are typically simple edits to the projects properties and settings.Step 1: project update
The below loads the *.sln file into Visual Studio (may need to be opened from the application if more than one version of Visual Studio is available) and updates the data to be fully compatible with 2013.
- Browse the 'doom3' project/development folder just created and find "\neo".
- Double-click "doom.sln" (.solution file).
Step 2: project properties
- Visual Studio 2013 will open the project asking if it's OK to update to latest version. Click "Yes/Agree" (this is necessary for the files to be compiled with VS2013, without it build fails).
When the *.sln project file opens in Visual Studio the program will want to update the selected files
Files are displayed in the status bar as they are parsed and updated
Setting up the projects environment, settings and properties. Once the project is loaded and updated, next;
- In the Solution Explorer (panel on the right) right-click "Game" (under "dlls") and select "Properties" from the menu, then;
- In "Configuration Properties" expand "C/C++" properties and left-click "Preprocessor".
- To the right, click "Preprocessor Definitions" - currently displaying "DEBUG;%(PreprocessorDefinitions)".
- Type "_XKEYCHECK_H;" between "DEBUG;" and "%(PreprocessorDefinitions)", i.e. "DEBUG;_XKEYCHECK_H;%(PreprocessorDefinitions)" (important note: "DEBUG;" may display as "_DEBUG;", "DEBUG;", "_NDEBUG;" or "NDEBUG;" et al if the project has been previously built and/or cleaned, or depending upon the build type selected [see below]).
- Click "Apply" then "OK".
The above prevents an "xkeyword.h" error causing a failed build - "324 error C1189: #error : The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to fine the forbidden macro".
Step 3: modify snd_system.cpp
- Ensure Visual Studio 2013 lists the correct 'version' data in 'debug' settings, the "VC" (Visual C/C++) version used should be shown as "12" for Visual Studio 2013 (optional may not be required). To access, in the Solution Explorer right-click "Solution 'doom3' (7 projects)" and select "Properties" from the menu that appears. Expand "Common Properties" and select "Debug Source Files".
Make sure the correct "VC" is listed, for 2013 it should be "12"
Step 4: Build
- In the Solution Explorer, expand "DoomDLL", then "Sound". Double-click "snd_system.cpp" to edit and scroll down to line 167;
common->Printf( "%8d kB total OpenAL audio memory used\n", ( alGetInteger( alGetEnumValue( "AL_EAX_RAM_SIZE" ) ) - alGetInteger( alGetEnumValue( "AL_EAX_RAM_FREE" ) ) ) >> 10 );
And replace with the follow;
common->Printf( "%8d kB total OpenAL audio memory used\n", ( alGetInteger( alGetEnumValue( (ALubyte *) "AL_EAX_RAM_SIZE" ) ) - alGetInteger( alGetEnumValue( (ALubyte *) "AL_EAX_RAM_FREE" ) ) ) >> 10 );
Save the file. This prevents the following error in "snd_system.cpp" causing a failed build - "252 error C2664: 'ALenum (ALubyte *)' : cannot convert argument 1 from 'const char ' to 'ALubyte *'"
If the code is to be used as is without modifying anything, before compiling the 'build type' should be set to "Release" or "Dedicated Release" to ensure all the files and data are included in the appropriate *.exe, *.dll and other core files.
- In the Solution Explorer right-click "Solution 'doom' (7 projects)", select "Configuration Manager...". In the properties window that appears select a compile option under "Active solution configuration:", i.e. "Release" or "Dedicated Release". Click "Close".
The built type may need to be set to "Release" or "Dedicated Release"
- To compile the source code right-click "Solution 'doom' (7 projects)" and select "Build Solution" - Visual Studio will build the project producing the necessary files (see below).
If successful a series of files are produced and saved to "build\Win32\Dedicated Release
" in the project directory (where the source files were unpacked and the *.sln was double-clicked - note: a separate folder is created per build type within which output is saved). These are;
Once available copy to actual development folder (should contain folder/directory structure replicating that of Doom 3).Other useful doom3.gpl topics
- Changing the name of DOOM3.exe
(custom naming DOOM3.exe)
- Changing the Doom3.exe shortcut & program iconAdditional Information
The following information ostensibly pertains to using Visual Studio 2015 but may also be useful to Visual Studio 2013 in some situations.