Lost Heaven modding
Advertisement
Lost Heaven modding
Klz.png

Файлы описывают коллизии конкретной миссии - границы объектов: земля, стены домов, невидимые стены и т.д. В файле приводятся ссылки на 4ds объекты из scene.4ds и scene2.bin и их границы в виде: коробки (прямоугольный параллелепипед), цилиндра или сферы.

Распаковываются из a1.dta
в папки Mafia\Missions\Mission*
редактируются с помощью MWE, TreeRE

Формат файлa[]

Описание структуры файла для 010 Editor'a.

От ASM

/////////////////////////////////// KLZ Header
uint32 Signature  // GifC
uint32 Version    // 5
uint32 CollisionDataOffset
uint32 NumLinks
uint32 _Unknown[2]

/////////////////////////////////// Links

uint32 LinkNameOffsetTable[NumLinks] // offsets relative from file start
{
  uint32 Flags
  char Name[]
} LinkNameTable[NumLinks]  // the entries are aligned to 4 byte boundaries, gaps are padded with 0x20

////////////////////////////////// Collision Data Header
float32 GridMinX
float32 GridMinY
float32 GridMaxX
float32 GridMaxY
float32 CellWidth
float32 CellHeight
uint32 GridWidth
uint32 GridHeight

uint32 Unknown
uint32 Reserved[2]
uint32 Reserved
uint32 NumFaces

uint32 Reserved
uint32 NumXTOBBs

uint32 Reserved
uint32 NumAAABBs

uint32 Reserved
uint32 NumSpheres

uint32 Reserved
uint32 NumOBBs

uint32 Reserved
uint32 NumCylinders

uint32 Reserved
uint32 NumUnknownType  // always 0

uint32 Unknown

/////////////////////////////////// Collision Grid Cell Boundaries

float32 CellBoundariesX[GridWidth+1]
float32 CellBoundariesY[GridHeight+1]

/////////////////////////////////// Collision Data
uint32 CollisionDataMagic // always 0x3E2D6123

// Notes on triangle collision data:
//  - the indices need to be sorted according to worldspace x in ascending order
//  - the SortInfo field provides info on the original order of the vertices as they appear
//    in the mesh's index buffer for  that face
//    0 - if the vertices are already in correct order or merely shifted
//    1 - otherwise

{
 uint32 Properties  // Material (8 bit) | Flags (8 bit) | SortInfo (8 bit) | 0 (8 bit)
 uint32 Indices[3]  // (Link (index into LinkNameOffsetTable) (16bit) 
                   // | Index of vertex in mesh's vertex buffer (16 bit))

 // plane the triangle lies in
 vector3 Normal  // needs to point in opposite direction compared to the mesh face normal (IIRC!), 
                 // i.e. if the mesh face normal is (1 0 0), the col face normal needs to be (-1 0 0)
 float Distance
} FaceColData[NumFaces]

{
 uint32 Properties // Material(8 bit) | Flags (8 bit) | 0 (8 bit) | 0x81 (8 bit)
 uint32 Link // index into LinkNameOffsetTable

 vector3 Min
 vector3 Max
} ABBColData[NumAABBs]

{
 uint32 Properties // Material(8 bit) | Flags (8 bit) | 0 (8 bit) | 0x80 (8 bit)
 uint32 Link

 // AABB
 vector3 Min
 vector3 Max

 vector3 Extends[2]
 matrix4x4 Transform
 matrix4x4 InverseTransform
} XTOBBColData[NumXTOBBs]

/////////////////////////////////// height for cylinders is encoded in grid
{
 int32 Properties // Material(8 bit) | Flags (8 bit) | 0 (8 bit) | 0x84 (8 bit)
 uint32 Link

 vector2 Position  // cylinders only have a 2d position!
 float Radius
} CylinderColData[NumCylinders]

// Note that while OBB col data describes a regular OBB it may only be used for creating
// flat collision rectangles like for walls etc. For 'real' OBBs, use XTOBBs.
{
 uint32 Properties // Material(8 bit) | Flags (8 bit) | 0 (8 bit) | 0x83 (8 bit)
 uint32 Link

 vector3 Extends[2]
 matrix4x4 Transform
 matrix4x4 InverseTransform
} OBBColData[NumOBBs]

{
 uint32 Properties // Material(8 bit) | Flags (8 bit) | 0 (8 bit) | 0x82 (8 bit)
 uint32 Link

 vector3 Position
 float Radius
} SphereColData[NumSpheres]

// Collision Grid
//
// The primitives defined above are referenced by those cells of the grid that are intersected
// by the corresponding primitive.
//
// There're restrictions on the order in which references may appear in each cell:
//   - References to primitives (boxes, spheres, ...) need to be stored before references to triangles
//   - Triangle references need to be sorted according to worldspace x of first indexed vertex
//     note that first indexed vertex is always the one with smallest worldspace x of the triangle,
//     see face col data description above
//
// Failing to obey these rules causes certain collision data to be ignored

uint32 CollisionGridMagic // always 0x3E2D6223

{
 uint32 NumObjects
 uint32 Reserved[2]
 float32 Height

 uint32 References[NumObjects]  // Format: (Type (8 bit)) | (Offset into array of Type (24 bit)))
                 // Type can be
             //   0x00 - Face
             //   0x80 - XTOBB
             //   0x81 - AABB
             //   0x82 - Sphere
             //   0x83 - OBB
             //   0x84 - Cylinder

 ubyte8 Flags[NumObjects]  // needs to be aligned to 4 bytes, purpose unknown
} Cells[GridWidth*GridHeight]

источник

Advertisement