#include <vector>
#include "../fixed.h"

enum Length
{
    L_VERYSHORT = 25,
    L_SHORT     = 50,
    L_MEDIUM    = 100,
    L_LONG      = 200,
    L_VERYLONG  = 400
};

enum HillSize
{
    H_VERYSMALL  = 20,
    H_SMALL  = 40,
    H_MEDIUM = 60,
    H_BIG    = 80,
    H_VERYBIG = 100
};

enum HillType
{
    UP_HILL = +1,
    DOWN_HILL = -1
};

enum CurveStrength
{
    C_VERYEASY = 2,
    C_EASY   = 4,
    C_MEDIUM = 6,
    C_HARD   = 8,
    C_VERYHARD = 10
};

enum CurveType
{
    LEFT_CURVE = -1,
    RIGHT_CURVE = +1
};

enum Decoration
{
    TREE1 = 0,
    TREE2 = 1,
    TREE3 = 2,
    TREE4 = 3,
    LEAF1 = 4,
    LEAF2 = 5,
    ROCKS = 6,
    LEFTTURN = 7,
    RIGHTTURN = 8,
    UPHILL = 9,
    DOWNHILL = 10,
    CHECK = 11,
    STARTLIGHT = 12,
    STOPLIGHT = 13,
    WAITLIGHT = 14
};

void initData( void );
void createCircuit( int circuitNumber );
void putBillBoards( void );
void createMilestones( uint8_t nblap );
void createClouds( void );
void createTraffic( uint16_t maxSegment );

void projectCircuitFP( void );
void projectCircuitFP( uint16_t index );

void updateTraffic( float dt, double maxdistance );

void drawCircuitSegment( uint16_t index );
void drawDecoration( uint16_t index );
void drawTraffic( uint16_t index );
void drawClouds( void );
void drawFarBackground( int offset, int currentbiome );
void drawNearBackground( int offset, int currentbiome );

void freeDecoration( void );
void prepareDecoration( int biometoload );

void freeTraffic( void );
void prepareTraffic( void );

void addCheckPoint( int8_t biome, uint8_t extra );
void addStartLine( int8_t biome, uint8_t extra );
void addFinishLine( int8_t biome, uint8_t extra );
void addStraightLine( Length l, int8_t biome );
void addCurve( Length l, CurveStrength s, CurveType t, int8_t biome );
void addHill( Length l, HillSize s, HillType t, int8_t biome );
void addCurvyHill( Length l, HillSize s, HillType t, CurveStrength cs, CurveType ct, int8_t biome );

fixed_t interpolatePositionX( double currentZ );
fixed_t interpolatePositionY( double currentZ );
uint16_t findIndex( double currentZ );
