Getting OJP Source Code
OJP's source is stored under what is called "revision
control", meaning that the files are stored on a remote server in a way
that remembers the changes that have been made to files. This
remote server is called the repository.
There are two ways to access these files:
- HTTP - Using your web browser you can directly
access the latest version of all of OJP's files by going here.
However, this method doesn't allow users to download the entire
repository at once; to examine different revisions of files;
or to commit changes. This method is not
recommend except for casual examination of individual files.
- TortoiseSVN - This program allows full access to the OJP
repository
from the comfort of Windows Explorer. It also lets users to
automatically "update" their working copies with the latest code from
the repository with the click of a button. OJP's developers
use TortoiseSVN. See
Accessing OJP's Repository with TortoiseSVN.
- Install TortoiseSVN. You can get the
latest version @
tortoisesvn.tigris.org . This tutorial was written
for TortoiseSVN v1.4.0.
- Create a new folder in
Windows Explorer. This folder will contain your local
(working) copy of the OJP repository. (Screenshot 1)
- Right
click on the new folder and click on SVN Checkout. (Screenshot 1)
- Paste in https://OpenSVN.csie.org/ojp/
for the URL of Repository. (Screenshot 1)
- Click Ok.
- Click Yes
to accept the security certificate for the repository. The
resulting initial download of the repository is long,
so now would be a good time to break for a snack or bathroom break.
- Congradulations, you now have a working local copy of the
OJP
repository! At this point, you might want to consult the Compiling and Debugging OJP
tutorial if you're interested in playing around with OJP's code.
Using OJP Enhanced's Autobuilder
Files needed to for this
process:
- Microsoft
Visual C++ 2005 Express Edition
- Windows®
Server 2003 SP1 Platform SDK Web Install
- TortoiseSVN
Before Starting:
- Install Microsoft Visual C++ 2005 Express Edition
- Install Windows® Server 2003 SP1 Platform SDK
- Install TortoiseSVN
Steps:
- Configure Visual Studios Express to be able to use the Windows® Server 2003 SP1 Platform SDK
- Update the Visual C++ directories in the
Projects and Solutions section in the Options dialog box. (Screenshot 1, Screenshot 2, Screenshot 3, Screenshot 4)
- Update the corewin_express.vsprops file.(Screenshot 1, Screenshot 2)
- In a text editor comment out lines 441 - 444 of
AppSettings.htm by putting a // in front of them. (Screenshot 1, Screenshot 2)
- Setup TortoiseSVN to access the OJP repository.
- Update the repository.
- Right click on the folder containing the
repository and click on SVN Update. (Screenshot 1)
- Compiling OJP DLL's, making OJP PK3's, and making an OJP Installer.
- Go to <Hard Drive
Name>\<OJP Repository Folder>\Enhanced\ where you
will find the following files: CompileOJP.bat, MakePK3.bat,
MakeWindowsInstaller.bat, and ojp_enhanced_installscript.iss. (Screenshot 1)
- If you do not want to make an installer and
just want to make the .pk3's (IE, ojp_enhanceddlls.pk3 and ojp_enhancedstuff.pk3) you need to run the CompileOJP.bat batch file.
After the CompileOJP.bat batch file is complete you need to run the
MakePK3.bat batch file. After the MakePK3.bat batch file is complete, 2
pk3's (ojp_enhanceddlls.pk3 and ojp_enhancedstuff.pk3) should be
found at <Hard Drive Name>\<OJP Repository
Folder>\Enhanced\.
- If you do wish to make an installer, just run
the MakeWindowsInstaller.bat batch file, after it is complete an
InstallOJPEnhanced.exe will appear at <Hard Drive
Name>\<OJP Repository Folder>\Enhanced\.
- Setting the correct revision number.
- To know which is the correct revision number
you must right click the repository folder followed by clicking the SVN Update option. You will spot "Completed At revision
<number here>" at the window that is opened after the
updates are applied if there are any updates to apply. (Screenshot 1)
- To have the correct revision number on your
compiled OJP you must first edit bg_public.h (notepad is recommended)
which is located at <Hard Drive Name>\<OJP
Repository Folder>\Enhanced\source\game\. Once inside the file,
find CURRENT_OJPENHANCED_CLIENTVERSION and edit the revision number to
the correct one. (Screenshot 1)
- You must then edit the
ojp_enhanced_installscript.iss script file (notepad is recommended)
which is located at <Hard Drive Name>\<OJP
Repository Folder>\Enhanced\. Once inside the file, find AppVerName and edit the revision number to the correct one. (Screenshot 1)
- To prevent conflict when updating the
repository, you need to revert the files edited. Right click on the
repository folder, select TortoiseSVN, and select "Revert...".
Only use revert if the only change you've made was to update the
revision number! (Screenshot 1, Screenshot 2)
This section covers how to compile
and/or debug OJP in Visual Studios 2005. This
Tutorial is Incomplete!
Compiling:
- Open the solution file (.sln).
- Select Build->Configuration Manager
from the menu bar.
- On the Active
solution configuration pulltab, select Final.
- Click Close.
- Select Build->Build Solution
from
the menu bar.
- The resulting dlls will be in the
/ojpbasic or /ojpenhanced folders (depending on which distribution
you're compiling).
Debugging:
- Open the solution file (.sln).
- Select Build->Configuration Manager
from the menu bar.
- On the Active
solution configuration pulltab, select Debug.
- Right click on your JK2game
project in the Solution Explorer.
- Click on Set as Startup Project.
- Right click on your JK2game
project
again.
- Select Properties.
- Click on Debugging
under Configuration Properties.
- Set Command to point
to the jamp.exe
in your GameData folder wherever your copy of JKA is installed.
- Add the following to the beginning of your Command
Arguments
"+set fs_cdpath "<your JKA /GameData>" +set fs_game
"<ojpbasic/ojpenhanced>" +set fs_dirbeforepak 1 +set
sv_pure 0 +set viewlog 1". Where <your
JKA /GameData> is the location of your /GameData
folder of your JKA install. And
<ojpbasic/ojpenhanced> is either ojpbasic
or ojpenhanced based on which
distribution you're using. Example:
+set fs_cdpath "d:\games\Jedi Knight Academy\GameData" +set fs_game
ojpenhanced +set fs_dirbeforepak 1 +set sv_pure 0 +set viewlog 1
- Set Working Directory to "../..".
- (Skip this step if you last compiled in the Debug
solution configuration) Select Build->Rebuild
Solution from the menu bar.
- From
the menu bar, select Debug->Start Debugging.
Troubleshooting Debugger Problems
Problem |
Solution |
Modified dlls don't
take effect.
Modified
dlls get overwritten. |
Doublecheck
Command Arguments setting. The sv_pure 0 settings is
especially important. |
I'm
getting a assert error whenever someone presses alt fire while flying
the Asteroids version of the Y-Wing! |
It's a bug in
the Y-Wing's NPC file. Its weapon should be set to WP_BLASTER instead
of WP_NONE.
The bug is harmless as it doesn't break anything. It's best
to
either fix the file or just not fly the Y-Wing while debugging. |
Build Configurations
This is a list of the
possible build configurations of the OJP source code and what they do:
- Debug - Configured
for debugger. Flags set to generate additional debugging
related code and messages. This mode also supposedly is a bit
more forgiving about memory issues.
- Debug(Final)
- This is the Final build configuration simply set up to run with the
Visual Studios debugger. This is the recommended standard
work configuration.
- Final -
Configured for building project for final release. Code is
optimized for speed and all debugging related stuff is
removed. Use this mode if you're compiling your code for
release to the public.
- Release
- Unknown
Code Preprocessors
This is a list of known code preprocessor flags used in the OJP source
code:
- BUILDING_REF_GL
- Unknown, doesn't seem to be used.
- JK2AWARDS
- This enables the awards system originally used in Quake 3.
Unfortunately, the system does not work if enabled.
- MISSIONPACK
- Unknown (probably Quake 3 related), doesn't seem to be used.
- QAGAME
- This preprocessor indicates that it's the compiler is compiling for
the game side of the .dll code.
- UI_EXPORTS - This preprocessor
indicates that it's the compiler is compiling for the ui side of the
.dll code.
- _USRDLL
- Used to be used by the Visual Studios compiler to properly compile
the .dlls. It's not used anymore.
- _WINDOWS - Indicates that the
program is a Windows application. Used by compiler I think.
Editing Guidelines
- Document
your work as much as possible. Be sure to add mentions of
your work in the readme and other project documents.
- Make
your work as clean and tight as possible.
- Follow
the coding guidelines. Try to keep your code as separated
from
other code as is reasonable. Label EVERY coding change (from
basejka)
with appropriate coding tags. If you're creating a new
feature, you'll
get to determine what the tag name will be. Try to pick
something that
is simple and easy to search for.