//--------------------------------------
//--- 010 Editor v3.1 Binary Template
//
// File: GT6 Track Path Editor .bin
// Author: Outspacer
// Revision: 1.0.0
// Purpose:
//--------------------------------------
BigEndian();
// HEADER
struct HEADER
{
    char file_id[6]; // ="GT6TER"
    int  version; // =105 version ???
    byte reserved[6]; // ={0,0,0,0,0,0}
    int  name_start; // offset from start of file
    int  name_count; // =1
    int  info_start;
    int  info_count; // =1
    int  path_start;
    int  path_count; // = number of user anchors + 2 for the home straight
    int  objects_start;
    int  objects_count; // = number of trackside objects and curbs
    int  section5_start;
    int  section5_count;
};
// INFO
enum <int> theme_t
{
    Death_Valley = 1,
    Eifel        = 2,
    Andalusia    = 3,
    //Death_Valley_Flat = 4,
    Eifel_Flat   = 5,
    //Andalusia_Flat = 6,
};
struct timestamp_t
{
    uint year   : 6; // since 1970
    uint month  : 4;
    uint mday   : 5;
    uint hour   : 5;
    uint minute : 6;
    uint second : 6;
};
struct INFO
{
    theme_t     theme; // 1=death valley, 2=Eifel, 5=Eifel Flat, 3=Andalusia
    double      track_width;
    byte        connected; // 0=open, 1=connected
    timestamp_t timestamp;
    byte        bank_angle; // 0=very gentle, ..., 4=very steep
};
// PATH
enum <byte> segment_type_t
{
    straight = 0,
    curve    = 1,
};
enum <byte> radius_t
{
    increased = 0,
    decreased = 1,
};
struct HOME_STRAIGHT
{
    segment_type_t  start_type; // =0, straight
    double          start_x;
    double          start_y;
    double          start_a;
                                // (missing byte here breaks the pattern of the path_section)
    segment_type_t  end_type;   // =0, straight
    double          end_x;
    double          end_y;
    double          end_a;
    byte            reserved;   // =0
};
struct ANCHOR
{
    segment_type_t  type;   // for preceding segment
    double          x;
    double          y;
    double          a;
    radius_t        radius; // for preceding segment
};
// OBJECTS
enum <byte> side_t
{
    right = 0,
    left  = 1,
};
enum <byte> dist_from_track_t
{
    edge  = 1, // used for curbing
    close = 2,
    far   = 3,
    deep  = 4, // both close and far regions
};
enum <byte> object_type_t
{
                                // dist_from_track, length
// eifel / eifel flat:
    curbing             =  6,   // edge, 25
    trees               =  1,   // far, 100
    woods               =  2,   // far, 100
    field_of_rapeseed   =  3,   // deep, 100
    billboard           = 20,   // far, 100
    marshall_post       = 14,   // close, 100
    tent                = 21,   // deep, 100
    grandstand          = 13,   // deep, 100
    circuit_gate        = 12,   // deep, 100
    raised_bank         =  9,   // deep, 200
// death valley:
    grass               =  0,   // far, 90
    cactus              =  4,   // close, 40
    cactus_cluster      =  5,   // far, 60
    banner              = 16,   // close, 100
    electrical_wire     = 10,   // far, 350
    //tent              = 21,   // far, 50
    rocks               =  8,   // far, 60
// andalusia:
    //curbing           =  6,   // edge, 100
    //trees             =  1,   // close, 20
    //woods             =  2,   // far, 100
    //sign              = billboard, // close, 30
    //marshall_post     = 14,   // close, 20
    building            =  7,   // deep, 40
    spectators          = 19,   // close, 100
    //grandstand        = 13,   // close, 20
    //circuit_gate      = 12,   // close, 20
    gate                = 22,   // close, 20
    rally_gate          = 18,   // close, 20
    //rocks             =  8    // deep, 100
// 11, 15, 17, 23...
};
struct OBJECT
{
    side_t              side;
    dist_from_track_t   dist_from_track;
    object_type_t       type;
    double              length; // ??? seen 20, 25, 30, 40, 50, 60, 90, 100, 200, 350
    double              position; // distance around the track (measured from the start of the home straight?)
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HEADER          header;
char            name[header.info_start - header.name_start];
INFO            info;
HOME_STRAIGHT   home_straight;
ANCHOR          anchors[header.path_count - 2];
OBJECT          objects[header.objects_count];