First, I'll need to set some things straight: you'll not going to download
the infamous AvP2 source code here, because that would be illegal. In the
following lines, I'll briefly describe what is needed to set up the toolkit
to build binaries (cres.dll, sres.dll, cshell.dll, object.lto and the
AVP2Serv.exe) from AvP2.
Step 1: Read the readme's
Actually, the title should be "Read the readme's and the .bat's", because
there are some important steps mentioned there to set up the build environment.
So, in the readme:
2) Add this line to your autoexec.bat file:
CALL c:\proj\avp2\source\setbui~1.bat
Opening the mentioned Setbuildvars.bat, we'll find the following:
@echo off
REM This file can be different on each person's machine doing a build. It
REM sets the environment variables that MakeDist.bat and SrcBackup.bat use.
set PROJ_DIR=C:\PROJ
set LT2_DIR=%PROJ_DIR%\LT2
set AVP2_DIR=%PROJ_DIR%\AVP2
set AVP2_BUILD_DIR=%AVP2_DIR%\AVP2
set MSDEV_PATH=c:\program files\microsoft visual studio\common\msdev98\bin
set SS_PATH=c:\program files\microsoft visual studio\vss\win32
set PATH=%PATH%;"%MSDEV_PATH%";"%SS_PATH%"
The environment variables that are needed to be set for a successful
build are LT2_DIR, AVP2_DIR and AVP2_BUILD_DIR. The last one
(AVP2_BUILD_DIR) represents the place where the compiled binaries will
be copied after the build.
LT2_DIR and AVP2_DIR represent the folders containing the lithtech
needed toolkit and the sources for AvP2.
The readme tells us that we should somehow set or create these environment
variables to the right values. On older operating systems (Windows 98,
Windows ME) that is done by adding the mentioned line to C:\autoexec.bat.
On Windows XP, you can add these variables by right-click-ing on the
'My Computer' icon, choose 'Properties', select the 'Advanced' tab and
click the 'Environment Variables' on the lower part of the dialog.
In the window that will appear you can add the mentioned environment variables
as user variables.
Step 2: Download and install the DirectX SDK
If you plan to compile the client shell, you'll need to download the DirectX
software development kit. The download is pretty big:
[url= http://www.microsoft.com/downloads/details.aspx?FamilyId=4B78A58A-E672-4B83-A28E-72B5E93BD60A&displaylang=en] http://www.microsoft.com/downloads/details.aspx?FamilyId=4B78A58A-E672-4B83-A28E-72B5E93BD60A&displaylang=en[/url]
As an alternative, an archive was created using as base the package for
Dev-CPP:
dx9sdk_barebone.7z
Either way, you'll need to install the sdk, or (in the second case) extract
the archive somewhere on your hard disk:
Step 3: Extract and prepare the source code
Use yor favourite archiving tool to extract the source code from it's archive.
Since we'll be using the latest DirectX SDK (DX9) we'll need to make a small
change to one of the header files, D3DStateChange.h. First, browse to it:
Add the following line to it:
Now it's time to open Visual C++ 6 and prepare the project files.
Step 4: Prepairing the workspace A few words: it seems that Visual C++ 6 is the only compiler that can build
these sources. The free version of Visual Studion 2005 (the express edition)
with the Windows Platform SDK doesn't cut it (it doesn't like overloaded
function pointers, if I recall corectly).
So, open Visual C, and open the AvP2.dsw file: 'File'->'Open Workspace' and
choose the source_folder\proj\AvP2\AvP2.dsw file.
First, we'll need to tell the compiler where to find the header files and
the libraries from the DirectX SDK. So, click on the 'Tools' menu, and select
'Options':
In the dialog that appears, you'll first add the 'Include files' (enable gif
animations for the next two pictures):
Then, set up the the libraries folders:
Last words You now have a build system ready. Hit F5 and select to build all projects.
After building the binaries, you can use them in your .rez files.
Good luck with source code modding.