Friday, 17 May 2019

Reading .zip files in Delphi and Python

Metasequoia uses a new default file format from version 4.7 which has extension *.mqoz.
This a just a *.zip file that contains an *.mqo file and a thumbnail.jpg file and maybe an *.mqx file.

Below are examples in Delphi 10.2 and Python 2.7 that show how to read the *.mqo inside the *.zip.

Sunday, 5 May 2019

Automatic mouse cursor move program

I needed a program to move the mouse cursor every so often to stop a PC from timing out while I was watching videos.

I didn't have admin rights for the PC so I could not adjust the timeout settings.


Monday, 22 April 2019

2: Tomb Raider 3 source code notes

Further investigation of the Tomb Raider 3 source code that was leaked online. See the first post in this series for details. [link]

I am studying the modified version mentioned in the comments of the first post (“TR3_ok”) because this version can be successfully built in Visual Studio 2013 as is. I wasn’t the genius who modified the code though.

To run the game, copy the “data” and “pix” folders from the retail version into the project’s folder.

Note on my PC I had to locate the project folder on a USB drive because the setup dialog for the game didn’t have any display resolution options if I used a project folder located on my system.

The leaked source code is not the version used for the retail game. It is an earlier version and some things are unfinished. The members of the discord channel refer to this version as Tomb Raider 2.1.

Be aware that the code contains some rude/offensive language by original programmers in the comments.

It seems that the source code was used for the PC and PSX versions of the game since blocks of code are contained in #ifdef PC_VERSION and #ifdef PSX_VERSION compiler directives. The modified version of the code I am using builds the PC version.

Thursday, 25 October 2018

Delphi Classes - fields

Some information I didn’t know about declaring fields in classes.

The var keyword is optional. However, if it is not used, then all field declarations must occur before any property or method declarations. After any property or method declarations, the var may be used to introduce any additional field declarations.
Source: http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Fields_(Delphi)


If a member's declaration appears without its own visibility specifier, the member has the same visibility as the one that precedes it. Members at the beginning of a class declaration that do not have a specified visibility are by default published, provided the class is compiled in the {$M+} state or is derived from a class compiled in the {$M+} state; otherwise, such members are public.
Source: http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Classes_and_Objects_(Delphi)

 

Thursday, 3 May 2018

Delphi 10.2 TQuaternion3D Example

Delphi’s System.Math.Vectors unit contains the TQuaternion3D class.

There is no information about the class in the Help so I post some code here so I remember how to use the class.

Following are some code snippets showing how to use quaternions to transform the mesh vertices in a model according to a skeletal hierarchy.

The procedures are used to build the models from old classic Tomb Raider games and export them to a 3D modelling program.

In Tomb Raider the animation data is stored as an (x,y,z) offset for the root bone and YXZ Euler angles for the rotations of all the bones.

In Tomb Raider a right handed coordinate system is used but the –Y axis is up so usually a further transformation is needed to get the models the right way up in other programs.

Here I do a 180 degree rotation about the X axis.

It is important to do this transformation last since then you don’t have to worry about adjusting the angles or offsets.

The code snippets also use System.Generics.Collections TStack and TList.

I also include a small example for the System.Math.Vectors TMatrix3D class which similarly has no Help topic.

Tuesday, 20 March 2018

Tomb Raider 3 source code notes

The source code for TR2/TR3 was briefly leaked online in March 2018 (see info).

This post will document my studies of the code.

Wednesday, 13 September 2017

3DS max 2016 Metasequoia (.MQO) Importer

Since the website with the Metasequoia importers/exporters for modern versions of 3DS max has disappeared I tried my hand at compiling sio29’s 3DS max 9 code for 3DS max 2016.