Sunday, 20 April 2014

Writing a StrPix-like program with Lazarus – 2

To write a program to modify a *.wad we need some *.wad files. If you don’t have TRLE installed you can get it from any of the links below. The *.wad files are found in the graphics folder. TRLE was also included on a separate disc with Tomb Raider Chronicles (TR5) for PC.

If you don’t want to install TRLE you can download some *.wad files at this link.

Next we need to know the file format of the *.wad file. Fortunately others have done the hard work for us and IceBerg has published the information.

Normally we would need to write our own code to open the *.wad and extract the data but since there is source code available for WadExplorer and StrPix we could possibly use their code to open the *.wad.

StrPix extracts the geometry and texture data whereas WadExplorer extracts the animation data as well so we will use IceBerg’s code which will make it easier to add animation features to our program if we decide to (and are able to).

StrPix will be our main reference so download the source code.

PixStr is similar to StrPix but has some different features so download the source code for study.

Next up we need Lazarus.

I use the version of Lazarus known as CodeTyphon. This version includes lots of extras not distributed with the standard Lazarus. Download CodeTyphon from the website below.

Follow the installation instructions at the site and build the BigIDE. This will add all the third party packages and components.

CodeTyphon installation guide

In this tutorial I am using CodeTyphon version 4.80 on Windows 8.1 32 bit.

The CodeTyphon version of the Lazarus IDE is named Typhon32 or Typhon64 (no, it’s not supposed to be Typhoon) but I’ll still call it Lazarus.

Double click the Typhon shortcut on your desktop to start Lazarus.


The first time Lazarus starts it may have a new project open ready for us to use. If not, go to the Project menu and select New Project …. In the dialog select Application and press OK.


To test that your Lazarus installation is working, press the Run button to build your program and run it.


If everything is fine you should have a program window that you can move, resize and minimize. Close the program by clicking on its close control (red X in top right corner).


Congratulations you have created a Lazarus program.

By default, CodeTyphon starts with a dark theme (Twilight). If you want your theme to match the screenshots go to the Tools menu and select Options.

In the dialog select Editor > Display > Colors and change the theme to Default.


prev  | next

No comments:

Post a Comment