-
Notifications
You must be signed in to change notification settings - Fork 0
WRLD
WRLD is a format used in GTA Liberty City Stories, GTA Vice City Stories, and Manhunt 2.
It stores all data needed for rendering game locations: geometry, textures, and object-placement information.
The RenderWare equivalent is the BSP format, whose root section is also called world.
The following programs can work with this format:
GTA Stories IMG Tool
GTA LCS Texture Editor
by HackMan128
Stories WRLD Tool
LCS IPL generator
by Heromant
GTA Stories Map Converter v1.0
Manhunt2 PS2 to PC Level Converter
by MAJEST1C_R3
There are three types of WRLD:
Master WRLD
Slave WRLD
Triggered WRLD
The Master WRLD is the main WRLD.
It has the .lvz extension and stores the most commonly used models and textures, interior parameters, and other data.
The Master WRLD also contains an array of headers for Slave WRLD and Triggered WRLD files.
A Slave WRLD is a secondary WRLD.
It contains additional models and textures for the current map section, as well as object placement coordinates.
These coordinates are relative to a local coordinate system. Global coordinates can be calculated with the WRLD groups in the Master WRLD.
If a resource exists in both the Slave WRLD and the Master WRLD, the game uses the resource from the Slave WRLD.
A Triggered WRLD is a secondary WRLD that is loaded when a special trigger is called.
For example, this is used for buildings that are blown up or changed during the game.
Triggered WRLD contains only models and textures.
Vice City Stories also contains an additional WRLD type called AREA.
AREA contains models and textures and is linked to WRLD.
Global WRLD header size: 32 bytes.
0x00 4b: signature "DLRW"
0x04 4b: WRLD type:
1 - Master WRLD
0 - Slave WRLD
0x08 4b: WRLD size
0x0C 4b: address of the beginning of the global section.
This is the address table for all subsections in the WRLD.
0x10 4b: address of the beginning of the global section, repeated
0x14 4b: number of offsets in the global section
0x18 4b: address of the continuation of the subordinate World in the IMG archive.
Not used for the master. Equals zero.
0x1C 4b: unused, always 0
Master WRLD header size: 800 bytes.
0x20 4b: address of the identifier table for resources stored in the WRLD
Loop that reads each Slave WRLD group from the IMG archive:
{
4b: address of the array of Slave WRLD starts
4b: WRLD group offset along X
}
End of loop
4b: number of all resources in the level.
This includes one Master WRLD plus all Slave WRLD files subordinate to it.
Xb: alignment, 0xAAAA...
0x320 4b: number of rows in the table that defines timeobjects.
One row is 4 bytes.
0x324 4b: address of the table that gives certain map objects timeobject properties,
depending on time of day or game-process state.
0x328 4b: number of rows in the 2dfx effects table.
One row is 48 bytes.
0x32C 4b: address of the 2dfx effects table
0x330 4b: number of Slave WRLD files with interiors.
One row is 6 bytes.
0x334 4b: offset to the interior loading table
0x338 4b: number of radar-attached textures.
LCS only.
0x33C 4b: address of the array of radar-attached texture starts.
LCS only.
2b - trigger
2b - IPL ID
1b - position in the WRLD group
1b - WRLD group number
2b - unknown
2b - interior Slave WRLD number
Radar textures are stored in CHK.
Like WRLD files, they are loaded from IMG by headers in the LVZ.
In LCS, the number of radar textures is always equal to the number of Slave WRLD files.
Triggered WRLD files do not have radar textures.
0x00 4b: signature "xet"
0x04 4b: radar texture number.
For example, if the number is 45, the CHK contains texture radar45.
0x08 4b: CHK size
0x0C 4b: address of the beginning of the global section.
This is the address table for all subsections in the CHK.
0x10 4b: address of the beginning of the global section, repeated
0x14 4b: number of offsets in the global section
0x18 4b: address of the CHK continuation in IMG
0x1C 4b: unused, always 0
Slave WRLD header size: 48 bytes.
0x20 4b: address of the identifier table for resources stored in the WRLD
0x24 2b: number of resources in the WRLD
0x26 2b: unknown, usually 0x12
0x28 32b: 8 addresses to IPL sections.
The last offset points to the end of the last table.
0x48 2b: number of linked Triggered WRLD files
0x4A 2b: flag.
Purpose unknown, usually 0x12.
0x4C 4b: address of the linked Triggered WRLD table
2b - trigger
2b - linked Slave WRLD number
This table is located immediately after the Slave WRLD header and has a fixed number of offsets.
Each offset is a Longint and points to a specific location in the internal binary table of scaling and IPL data.
The last offset in the table points to the technical sector AAAAAAAA.
This sector is needed by the engine and signals the end of IPL loading.
Row length: 80 bytes.
The number of rows is defined in the header.
0x00 2b - IPL ID.
One model can consist of several resources.
A logical AND with 0x7FFF must be performed to get the real ID.
0x02 2b - resource ID
0x04 8b - global XYZ and bounding-sphere radius.
Each value is stored as a half-precision float.
0x0C 4b - alignment
0x10 64b - matrix 4x4
The matrix 4x4 is used to store:
model coordinates
model scale, through vectors from the matrix
model rotation angle on the map, through a quaternion from the matrix
Using this table, the game engine finds the needed resource in the WRLD based on the resource ID.
One table row is:
4 bytes for the Master WRLD
8 bytes for a subordinate WRLD
The number of resources in the WRLD is stored in the header.
4b: resource ID.
Only present for subordinate WRLD.
For the Master WRLD, this is defined by the row-number counter.
4b: offset to resource
The common FAT is usually located at the very end of the file.
It points to all offsets that refer directly to models, textures, and IPL data.
It is used to convert offsets from local status to global status.
local - from the beginning of the file
global - from the beginning of the memory buffer