Friday, 26 May 2017

WIP: TR42PRJ

Version: 0.71
Status: Released

An attempt to replicate aktrekker’s TR2PRJ program for the TRLE community.

I noticed aktrekker’s program gets some of the geometry incorrect, especially some split sectors and some sectors beneath horizontal doors.

Unlike aktrekker’s program I only extract geometry so rooms will have to be manually reconnected, retextured, and triggers, objects and lights added.

aktrekker’s program seems to convert black in the textures to magenta instead of alpha to magenta so I fixed this too.

Source and release at GitHub. [link]

If building from source you need to download the Vampyre Imaging Library. The latest released version does not compile under Delphi XE7 so get the version from Mercurial repository. [link]

Since I don’t know how aktrekker extracted textures and created doors I may in future add ability to import TR2PRJ’s prj file and inject this data into the prj I create.

Usage:
  • Open .TR4 file
  • Click Save As to save .prj and .tga file

Monday, 1 May 2017

Delphi TOpenDialog option ofExtensionDifferent


ofExtensionDifferent doesn’t appear to be set in Windows 8.1.

The following example from [link] fails.

procedure TForm1.Button1Click(Sender: TObject);
var 
Done: Boolean;
filenamestring : String;
begin
  OpenPictureDialog1.DefaultExt := GraphicExtension(TIcon);
  filenamestring := GraphicFileMask(TIcon);
  OpenPictureDialog1.FileName := filenamestring;
  OpenPictureDialog1.Filter := GraphicFilter(TIcon);
  OpenPictureDialog1.Options := [ ofFileMustExist, ofHideReadOnly, ofNoChangeDir ];
  Done := False;
  while not Done do
  begin
  if OpenPictureDialog1.Execute then
    begin
    if not (ofExtensionDifferent in OpenPictureDialog1.Options) then
      begin
      Application.Icon.LoadFromFile(OpenPictureDialog1.FileName);
      Done := True;
      end
    else
//      OpenPictureDialog1.Options := OpenPictureDialog1.Options - ofExtensionDifferent;
    end
  else { User cancelled }
    Done := True;
  end;
end;
 
 
CodeTyphon (Lazarus fork) doesn't have this problem.