I'll tell you what I did recently, although there may be quicker ways.
- Install CtP2 - a simple directory with no spaces like "C:\Games\CtP2AE" would be ideal.
- Download the original source code from here. Extract it to the same folder that ctp2_data is in.
- Download the latest Apolyton Edition (there should be a thread topped in the same forum as this thread) and extract it to your CtP2 folder. Doing this makes sure your ctp2_data is up to date and saves you updating things like pictures and sounds again from the repository.
- Set your environment variable:
In order to build, you need an environment variable named CDKDIR on your computer. In Windows XP/2000, go to Control
Panel->System->Advanced Tab->Environment Variables, and add it, with it's value set to [your source path]/bin, the directory with bison, flex, and other miscellaneous utilities in it. In the example above mine would be C:\Games\CtP2AE\bin
- If you get a problem compiling regarding "\tmp" then you need to create the temporary folder. In this case I created the folder C:\tmp.
- Download and install DirectX SDK Oct 2006 from here.
- Download and install the latest Windows SDK, I used 2008 from here.
- Download and install the VC++ Express Edition, because it's free, from here.
See this post on which lib and include directories to add.
If you're missing strmbasd.lib or the "...DirectShow\BaseClasses\Debug" folder (which you probably are if you followed this), then you need to compile it yourself. See this post on how to do so. Then the Debug folder will be created along with strmbasd.lib inside it.
- Download and install the latest version of TortoiseSVN from here.
- Update the source code to the latest with TortoiseSVN from DarkDust's server. See this page. Don't check out the whole repository. Remember to install the latest Apolyton Edition first, then checkout the folders you need to your local CtP2 install folder. If you run into problems check TortoiseSVN help files on how to checkout a local copy of the source.
- Remove any old database files (ones that remain unmodified after updating the source code) from ...ctp2_code\gs\database folder.
- Open civctp.dsw with File > Open Project in VC++. Allow it to release the source code bindings and convert to the new VC++ format. When opened you should see 6 elements to the left under the "solution explorer": "Crater", "ctp2", "dbgen", "fault", "geometric", "Plasma2". If you only see "ctp2" you probably opened civctp.dsp by accident.
( Note: When you exit VC++ the first time after opening/converting the old solution you will be asked to save the solution, do so. From here on you should only open civctp.sln.)
- Now attempt to compile the source using "Build > Build Solution" or F7 key.
Following these steps I was able to compile the source with no errors.
- "cannot open include file 'afxres.h'". If you installed the Windows SDK this can be found in \Microsoft SDKs\Windows\v6.1\Samples\winui\TSF\tsfapp. Add that folder to your include directories after the DXSDK includes and DirectShow\BaseClasses includes.
- "missing *.dll". If you're missing a .dll file simply copy it from the original ctp2.exe folder of "\ctp2_program\ctp" to the "\ctp2_code\ctp" folder, so you can run the newly compiled ctp2.exe from there. (As of writing (20-Sep-2009) you will only need to copy over mss32.dll.)
If you still get problems, read this thread, or better follow my path (starting from post #265) to getting the source to compile. As you may run into the same problems.
- To modify the source code on his server, you need to email DarkDust to get a user account.
If you're using VC6.0 you might need an older DXSDK. For release versions Martin uses a DXSDK from February 2002 with VC6.0, using those you can just follow the instructions in the source code readme.
Using the debug build. When you run the debug build for the first time if you get the MSVCRTD.DLL missing error download the one I've attached here and unzip it to the \ctp2_code\ctp folder. This dll is from the VC6 CD and not from a "download-dll.com" website.
To switch from the game to VC++ Express Edition cleanly, you will need to add this program argument:
in VC++ EE you can add these by right clicking "ctp2" in the solution explorer and clicking properties. Add in "configuration properties" > "debugging", in "command arguments". Do the same for "Crater".
I also use nointromovie (or you can remove the CD check and play without a CD, that also skips the intro). Other arguments (that I've yet to try) are notimeslice and runinbackground.