.lvz File format description for Continuum .37
Description written by Ryan Murphy (aka Mine GO BOOM) on 02/12/2002.


This is a quick decription of the current .lvz format for continuum .37. This information would probably change with most changes to continuum to allow more features (such as a request for text display instead of images that have text in them). But most additions would probably only create more sub-sections of a compressed section, so if you do wish to make a program that reads from .lvz's, allow them to gracefully handle unknown data in the compressed section (after decompression of course). Also, gracefully handle a section note being allowed to decompress, because the .lvz may become corrupt. One last finally suggesting if you would create a program for this: do not always trust the compression size information. Someone could easily edit one of them to 2 billion, and cause unwanted errors from your program. That said, let me dive into how a .lvz is structure on the compression part, and then get into the sub-sections.

 The first 8 bytes of every .lvz file:
4-len str	Type - Should always be 'CONT'. This varifies you have a .lvz. If not, don't continue on. This string is not NULL ended.
i32		Count - How many compressed sections are in this .lvz.

 After this, if the count is > 0, there should be a compressed header:
4-len str	Type - Should be 'CONT' also. If not, the compression header is bad, and do not use.
i32		Decompress Size - The size of the data after it would be decompressed. This is the value you should set your out-buffer for the zlib's compression call.
i32		File Time - This can either be a file time, if this compressed section is a file, or it could be 0. If 0, then is a special compressed section. The file time is the standard time_t format used by windows/unix.
i32		Compressed Size - The size of the compressed data in the .lvz. This is how many bytes you'll need to read to get your required data.
Null-end str	File Name - This string is always null ended. If no file time, the File Name should be blank (just the 0x00), but do not always count on it.
* data *	Compressed data - This should be the length of the Compressed size. Read this all in, and then run it through zlib's decompress function.

 Once you have the decompressed data, you can take action on it, or store it for later use. The compressed header with the compressed data at the end will repeat till the number of headers equals the count (if the .lvz is made correctly), or till the end of the file.

 The decompressed data can be 1 of two types for the current .lvz format. The first type is more often found in .lvzs, and this is the file type. Files are determined by having a File Time not equal to 0, and having a File Name length not being 0. Please be warned, future formats of .lvz's may change one or the other of these checks, so a good safety feature would be that files require both of these to be true. Files are normally just saved to the proper folder and the correct file time set to it. If you do not know how to set file times, its is not 100% important for most DeBuildLevel like programs.

 The only other current decompressed data type is the Object section. The object section is determined by having a File Time equal to 0 and the File Name length being 0.

 Object Section always starts with this 12 byte header:
4-len str	Type - Should be 'CLV1'. Future .lvz formats will have different types, so handle this gracefully. If not a CLV1, can ignore this decompressed data section, since it is of an unknown type for the Continuum .37 .lvz format.
i32		Object Count - How many object definitions are in this Object Section.
i32		Image Count - How many image definitions are in this Object Section.

 After the Object Section header, you would loop through the Object Count reading 10 bytes at a time till you hit the Object Count. Each of these 10 byte sections are the Object definitions:
i1		Map Object - A bool-like value. If true, this is a Map Object. If false, then is a Screen Object.
i15		Object ID - The value for this object id, for use with *objon for example.
i16		X Coord - The X coord value, in pixels, this object will be displayed on. More info later.
i16		Y Coord - The Y coord value, in pixels.
i8		Image Number - Which of the Image Definitions this object will use for its graphic.
i8		Layer - Which layer it will be displayed on. Values for this later,
i12		Display Time - How long will display for, in 1/10th of a second.
i4		Display Mode - Which display mode this object uses. Values later.

 After finish looping through the Object Count, you now would loop through for the Image Count. The Image Definition are not pre-determined lengths though. Image Definition:
i16		X Count - How many columns are in this image. Used for animations.
i16		Y Count - How many rows are in this image.
i16		Display Time - How long to display each frame for. This is in 1/10th of a second.
Null-end str	File Name - This will be null ended. This is which file this image uses. The file name is not required to be included with the .lvz, and maybe in another .lvz package, or a non-zone downloaded image that users place in their folders themselves. So do not expect this file to always be in this .lvz or to be in the folder.



 And thats it. That is all that a .lvz can be. If you wish to test your program for creating a .lvz, I have created a DeBuildLevel program that follows these guidelines above to be pretty strict to how continuum will load from it. It will also stop at the first sign of trouble, and print a debug message for you to be able to use.


Layer Values:
0 = BelowAll
1 = AfterBackground
2 = AfterTiles
3 = AfterWeapons
4 = AfterShips
5 = AfterGauges
6 = AfterChat
7 = TopMost

Display Mode Values:
0 = ShowAlways
1 = EnterZone
2 = EnterArena
3 = Kill
4 = Death
5 = ServerControlled


    Document approved for release by the developer of the current .lvz format, PriitK.