Page 1 of 1

.TRK file format

Posted: Fri Aug 03, 2012 5:50 pm
by dev
Heres .trk file format as 010 editor template. I hope it will help someone.

Code: Select all

//--------------------------------------
//--- 010 Editor v4.0.2 Binary Template
//
// File:
// Author:
// Revision:
// Purpose:
//--------------------------------------

struct Angle {
	UCHAR prc;
	UCHAR ang;
};

struct Point {
	USHORT x;
	USHORT y;
};

struct Pitstop {
	Point pos;
	Angle ang;
};

struct Entity {
	UCHAR id;
	UCHAR unknown;

	Point pos;
	Angle ang;
};

struct Line {
	USHORT x0;
	USHORT y0;
	USHORT x1;
	USHORT y1;
};

struct Texture_Line {
    int col:4;
    int len:12;
};

struct TRKINFO {
    CHAR header[4];
    CHAR unknown0[4];

    UCHAR world_size;
    UCHAR water_level;	
    USHORT view_angle;
	USHORT rotation;
	UCHAR zoom;
	UCHAR sf_line;
};

BitfieldDisablePadding();
TRKINFO info;

if( info.header != " GR" ){
    return -1;
}

UINT texture_line_count;
Texture_Line texture_lines[ texture_line_count ];

USHORT heightmap_size;
UCHAR heightmap[ heightmap_size ];

USHORT entity_count;
Entity entities[ entity_count ];

UCHAR pitstop_count;
Pitstop pitstops[ pitstop_count ];

UCHAR checkpoint_count;
Line checkpoints[ checkpoint_count ];

UCHAR limiter_count;
if( limiter_count > 0 ){
    Line limiters[ limiter_count ];
}

USHORT ai_line_count;
if( ai_line_count > 0 ){
    Point ai_line[ ai_line_count ];
}

UCHAR ai_pitline_count;
if( ai_pitline_count > 0 ){
    Point ai_pitline[ ai_pitline_count ];
}

CHAR unknown1[ 2 ];
CHAR author[ 30 ];
CHAR description[ 500 ];
//CHAR unknown2[ 20 ];
//CHAR reserved[ 9611 ];