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.

http://www.skribblerz.com/editortools.htm

http://www.tombraiderchronicles.com/tr5/editor/index.html

http://www.aspidetr.com/tools/tomb-raider-level-editor/tomb-raider-level-editor-windows-vista-xp/

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

http://www.skribblerz.com/resources.htm

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.

TombRaiderWAD.zip

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).

WADE11sources.zip

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

strpix3_sourcecode.zip

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

http://www.aspidetr.com/tools/pixstr/pixstr-2-2-rev-2/

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.

http://www.pilotlogic.com/sitejoom/index.php/downloads/viewcategory/30-codetyphon

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.

TyhonShortCut

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.

NewProjectOpenInLazarus

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

RunButton

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).

RunningProgram

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.

ChangeTheme

prev  | next

No comments:

Post a Comment