Tomb Raider Forums  

Go Back   Tomb Raider Forums > Tomb Raider Level Editor and Modding > Tomb Raider Modding

Reply
 
Thread Tools
Old 24-06-15, 20:25   #61
ggctuk
Member
 
ggctuk's Avatar
 
Joined: Mar 2005
Posts: 9,405
Default

This certainly looks like a very intriguing little tool. It'd open up all sorts of applications once done.
ggctuk is online now   Reply With Quote
Old 26-06-15, 17:20   #62
Sardoc
Member
 
Sardoc's Avatar
 
Joined: Aug 2013
Posts: 1,294
Default

I've had a go at TR2-ported Vilcabamba and...

I have a question about the colour of the water here. http://s3.postimg.org/b9rwfxcs1/Water.jpg

How did you achieve it? I mean, was it converted from the PC or PSX version of Vilcabamba level file?

The reason why I'm asking is because I'd love to know if the water colour is PSX-exclusive, or maybe it's in the PC level files as well, just not supported by the Glide exe?
Sardoc is offline   Reply With Quote
Old 27-06-15, 22:08   #63
b122251
Member
 
b122251's Avatar
 
Joined: Aug 2013
Posts: 686
Default

Quote:
Originally Posted by Sardoc View Post
I have a question about the colour of the water here.
How did you achieve it? I mean, was it converted from the PC or PSX version of Vilcabamba level file?

The reason why I'm asking is because I'd love to know if the water colour is PSX-exclusive, or maybe it's in the PC level files as well, just not supported by the Glide exe?
There is no water colour variable in the level files. Just a bit that declares that a room is flooded or not. The colour of the water is determined by the engine the level runs on. This water colour is just the colour of all water in the PC version of TR2. This copy was made from the PC version of City of Vilcabamba. However, if I had used the PSX data, the water would have looked the same.
I hope this answers your question.
Sorry about the long wait.
b122251 is offline   Reply With Quote
Old 27-06-15, 22:56   #64
Sardoc
Member
 
Sardoc's Avatar
 
Joined: Aug 2013
Posts: 1,294
Default

Quote:
Originally Posted by b122251 View Post
There is no water colour variable in the level files. Just a bit that declares that a room is flooded or not. The colour of the water is determined by the engine the level runs on. This water colour is just the colour of all water in the PC version of TR2. This copy was made from the PC version of City of Vilcabamba. However, if I had used the PSX data, the water would have looked the same.
I hope this answers your question.
Sorry about the long wait.
Rrright, so I understand it's hardcoded then.

Got another question, seeing as you've recently finished TR3 support. Does TR3 actually support STARTANIM when it's put in the script file (Tombpc.dat)?

Today I was trying to enable Lara's unused waking up animation that I had found in High Security Compound level, similarly to what was going at the start of TR2's Offshore Rig or Home Sweet Home. Now, I was able to change TR2's starting animation no problem, I just had to change the STARTANIM state ID. However, with TR3, when I added STARTANIM to the script file, either the animation just didn't play, or the game crashed. That's why I wonder if TR3 actually supports it.
Sardoc is offline   Reply With Quote
Old 27-06-15, 23:28   #65
b122251
Member
 
b122251's Avatar
 
Joined: Aug 2013
Posts: 686
Default

Quote:
Originally Posted by Sardoc View Post
Does TR3 actually support STARTANIM when it's put in the script file (Tombpc.dat)?
I don't know.
I don't really edit Tombpc.dat. I just edit the .TR2 files.
b122251 is offline   Reply With Quote
Old 28-06-15, 00:07   #66
Sardoc
Member
 
Sardoc's Avatar
 
Joined: Aug 2013
Posts: 1,294
Default

Quote:
Originally Posted by b122251 View Post
I don't know.
I don't really edit Tombpc.dat. I just edit the .TR2 files.
Ok. No problem. I'll just keep tinkering with it until either it works, or I ragequit. Whichever happens first.
Sardoc is offline   Reply With Quote
Old 08-07-15, 10:17   #67
b122251
Member
 
b122251's Avatar
 
Joined: Aug 2013
Posts: 686
Default A little update

Hi everybody,
I thought I'd give you all a little update. I'm still working on TRMOD, and having a lot of difficulty with some files.
Firstly, I'm working on support for TR1 on Sega Saturn. It can now edit Items, Static Meshes, Sound Sources, Lights, Floordata and Vertices. It can also flood rooms with water and change the collision data. I still need to work on the editing of the world geometry, but that data is stored a little strangely. But the TR1 Sega Saturn support is not that much of a problem.

What IS a problem is the PS1 support for TR2 and TR3. I already understand most of the file formats of these two, but the real difficulty lies in the data before NumRooms. Usually, in TR level files, data is preceded by a few bytes stating either how long the data is, or how many items there are in the block of data following it. I can't seem to find this indicator for the data before NumRooms in PS1 TR2 and TR3 files. If anybody knows about this, please tell me, so that I can continue.

Even more annoying is my problem with *.tr4 files. TR4 files use zlib compression. I need to be able to compress and decompress this data. There are several ways of doing this, but most of them don't work.
If anybody knows of a stable way to add zlib compression to a VB.NET project, please tell me, so that I can continue.

So that's where development is now:
• TR1 PC (PHD/TUB) 100% Completed.
• TR1 PS1 (PSX) 100% Completed.
• TR1 SAT (SAT) 70% Completed. (Still need to add editing geometry)
• TR2 PC (TR2) 100% Completed.
• TR2 PS1 (PSX) 0% Completed. (Can't navigate the file)
• TR3 PC (TR2) 100% Completed.
• TR3 PS1 (PSX) 0% Completed. (Can't navigate the file)
• TR4 PC (TR4) 10% Completed. (Know the file structure, but can't properly compress/decompress it)
• TR5 PC (TRC) 0% Completed. (Still need to start)

Greetings,
b122251
b122251 is offline   Reply With Quote
Old 08-07-15, 17:31   #68
ggctuk
Member
 
ggctuk's Avatar
 
Joined: Mar 2005
Posts: 9,405
Default

Don't know if this is relevant, but meta2tr can open and decompress the geometry of a PC TR4 level.
ggctuk is online now   Reply With Quote
Old 09-07-15, 01:44   #69
sapper
Member
 
sapper's Avatar
 
Joined: Sep 2007
Posts: 1,684
Default

I don't know VB.net so cannot help but does this post at StackOverflow help?

http://stackoverflow.com/questions/1...n-visual-basic

http://msdn.microsoft.com/en-us/libr...atestream.aspx

EDIT: Sorry it looks like the compression used in above is not zlib.
What about using NuGet package manager to install zlib into your project?

Last edited by sapper; 09-07-15 at 02:30.
sapper is offline   Reply With Quote
Old 09-07-15, 06:59   #70
Active Man
Member
 
Joined: Nov 2006
Posts: 406
Default

I am afraid that, as long as VB is concerned, I join the club together with sapper, but I think that I could still be of some help, having faced the same requirement in a project I was working on about two years ago.
I also used .NET framework on Windows, the only difference being that I used C#, but I think that you shouldn't have any issues in translating between these two .NET languages. Feel free to ask here for help, in any case.

Anyway, from here onwards I will be assuming the following:
  1. You are using the Visual Studio IDE
  2. You have access to the NuGet Package Manager
  3. You do not have anything against using the zlibnet library.

The first option is really only so that you can quickly acquire the required library - you could do it in any other IDE manually, it's just a bit easier this way.
Roughly, here are the steps that you'd need to do:
  • In Visual Studio, go to Tools->NuGet Package Manager->Manage NuGet Packages for Solution. When the dialog pops up, click on the upper-right corner search box and type in: "zlib" without quotation marks. If nothing gets found, also make sure that the option "All" is highlighted on the left, inside the "Online" group of options. The search should come up with "zlib.net" near the top - click on that and make sure it has the following metadata on the right: Version: 1.0.4.0, Last Published: 24.5.2012. The Description must mention that the library is a 100% managed version of ZLIB. This will save you having to P/Invoke to precompiled libraries in any way, so it's definitely an easier and cleaner solution, and you certainly shouldn't face serious performance penalties because of it. If you validated it, click on Install and make sure you confirm that you want said library to automatically be added to your project.
  • Now that you have this useful library, close the NuGet Package Manager and make sure that zlibnet is added to your project References. To do so, bring up the Solution Explorer tab, locate your project icon, click the associated drop-down triangle icon and you should see a References option in the drop-down list that appears. You should see zlibnet in this list. If so, you're done with the first part.
  • What remains to be done now is just simply calling the respective library functions in your own program code when you want some data decompressed or compressed. The aforementioned project I worked on before had the requirement of simply compressing already prepared, uncompressed files, so the solution was to make a tiny class which offers certain wrapper methods with which these tasks could easily be achieved. If you want to do it like that as well, here are the basics steps needed to do so (in C#). I will be assuming you are working under your own namespace already, so I won't be mentioning any of my own in the code.
    The class is a simple static class with two methods: DecompressFile and CompressFile, with specific overloads for every individual one of these. You could, of course, modify the class and add your own additional methods if you require in-memory decompression/compression which does not necessarily rely upon files. Feel free to ask here on what kind of modification are you interested in, if any. Here goes the basic C# code:
    Code:
    public class FileCompression
        {
            public static void CompressFile(FileStream inFile, FileStream outFile)
            {
                MemoryStream compressed = new MemoryStream();
                compressed = ZLibNet.ZLibCompressor.Compress(inFile);
                inFile.Close();
    
                byte[] buffer = compressed.GetBuffer();
                outFile.Write(buffer, 0, buffer.Length);
                outFile.Close();
            }
    
            public static MemoryStream CompressFile(FileStream inFile)
            {
                MemoryStream compressed = new MemoryStream();
                compressed = ZLibNet.ZLibCompressor.Compress(inFile);
                inFile.Close();
    
                return compressed;
            }
    
            public static void DecompressFile(FileStream inFile, out byte[] outBuffer)
            {
                MemoryStream decompressed = ZLibNet.ZLibCompressor.DeCompress(inFile);
    
                outBuffer = decompressed.GetBuffer();
            }
    
            public static MemoryStream DecompressFile(FileStream inFile)
            {
                return ZLibNet.ZLibCompressor.DeCompress(inFile);
            }
        }
    As you can see, this allows you to easily get access to the decompressed/compressed memory streams acquired from the appropriate file streams. All this could simply be done only using memory streams as well, or with a modification of the previous class which would have an additional overload per function, featuring, for example, a method whose prototype is:
    Code:
    public static void DecompressFile(FileStream inFile, out byte[] outBuffer, int startByteInFile, int endByteInFile);
    - this would allow you to specify, for example, the beginning and ending offsets of the first texture block of the .tr4 file and let it decompress it for you into a memory stream.
    Of course, you must make sure the FileStreams you pass in as arguments have been properly initialized, with flags allowing the stream to be used for reading or writing.
    When you have created this class on your own, you are ready to call its respective methods and decompress/compress any file you wish. The first CompressFile overload deals with the situation when you simply want to compress a complete file into an output file. The second overload of said function deals with an input file and outputs a compressed memory stream. Finally, the first DecompressFile overload I provided is meant to output the decompressed file stream to a byte buffer you provide as an argument.
    The final DecompressFile overload simply decompresses the given file stream to a memory stream, but as I said before, it could easily be extended to handle a bit more complex problems too.

That would be it for now. Also, sorry for replying with a relatively long delay.
Active Man is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 13:51.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Tomb Raider Forums is not owned or operated by CDE Entertainment Ltd.
Lara Croft and Tomb Raider are trademarks of CDE Entertainment Ltd.