The source code for TR2/TR3 was briefly leaked online in March 2018 (see info).
This post will document my studies of the code.
First step is to get the project opened in an IDE.
I have Visual C++ 6.0 running on Windows 98 in a Vmware virtual machine.
The workspace file (.dsw) and project file (.dsp) were not recognized initially.
I found I had to convert the line endings in each file from Unix style to Windows style. I used Programmer’s Notepad to do this.
VC++ 6.0 said the project was created in a previous version so I guess the project was created in Visual Studio 97.
VC++ 6.0 has rather limited tools for exploring code so I opened the original workspace file (with corrected line endings) in VS 2013 Community. The project is converted but does not build successfully – too many errors.
C++ programs start executing at the “main” function or “WinMain” function for Windows C++ programs.
I found the “WinMain” function in “main.cpp” in the “PC Specific” folder.
This calls the “GameMain()” function which you can jump to by right clicking on the function name and selecting “Go to Definition”. This finds the “GameMain()” function in “smain.cpp”.
This is where the script file , “tombPC.dat”, is loaded.
“GameMain()” calls “GF_DoLevelSequence()” to start the game which is found in “gameflow.c”.
“GF_DoLevelSequence()” calls “GF_InterpretSequence()” which is also in “gameflow.c”.
“GF_InterpretSequence()” calls “StartGame()” in “Game.cpp”.
“StartGame()” is where the level is loaded, in “InitialiseLevel()” in “Setup.c”.
“StartGame()” calls “GameLoop()” also found in “Game.cpp”.
The program keeps executing in the while loop found in “GameLoop()” until the game is over.
Two functions are called repeatedly in the game loop.
“ControlPhase()” found in “Control.c” and “DrawPhaseGame()” found in “Draw.c”.
part 2
How to build source code in VS 2019
Please share TR source code?
ReplyDeleteAre you member of tombraiderforums.com?
ReplyDeleteIf so send me private message.
Here is version of source code modified so debug version can be compiled and built in modern Visual Studio.
Deletehttps://cdn.discordapp.com/attachments/417080820034174986/417459100381609984/TR3_ok.zip
Here is another version that may be the original source code released.
https://mega.nz/#!WgZRECjI!wgw5j0E0dArdLgWAb4njysb6hB6Ts291Nk1bsbWI2YM
Excuse me!!! Is there a way how we can build up the E3 version of Tomb Raider 3 (Run the Gauntlet) from using this source code?
ReplyDeleteI don't know. I wouldn't know how to do it. Maybe the Tomb Editor programmers would know how.
DeleteDo you know if the str files need to be converted to a Windows Style as well?
ReplyDeleteSorry I don't know. I used the source code from discord link in first comment and didn't have to change line endings.
DeleteDo you know how all of the Tomb Raider 2 data was taken to build up everything for the E3 version of Tomb Raider 3? ��
ReplyDeleteNo I don't.
DeleteHow many source codes are there for Tomb Raider 3?
ReplyDelete