on the road to V0.70

master V0.70
Sylvain PILLOT 7 months ago
parent 14d1eb0e33
commit 1e205b188f
  1. 4
      CMakeLists.txt
  2. 128
      CppOutRun.layout
  3. BIN
      assets-cg/backgrnd/canyon.png
  4. BIN
      assets-cg/backgrnd/rockline.png
  5. BIN
      assets-cg/backgrnd/snowmount.png
  6. BIN
      assets-cg/decos/common/cc_void.png
  7. BIN
      fxlink-image-2022.02.17-21h40-1.png
  8. BIN
      fxlink-image-2022.02.17-21h40-2.png
  9. BIN
      fxlink-image-2022.02.17-21h40-3.png
  10. BIN
      fxlink-image-2022.02.17-21h40-4.png
  11. BIN
      fxlink-image-2022.02.17-21h41-1.png
  12. 3
      src/colors.h
  13. 6
      src/include/circuit.h
  14. 586
      src/main.cc
  15. 378
      src/src/circuit.cc
  16. 2
      src/src/drawstuff.cc
  17. 11
      src/src/menus.cc

@ -53,6 +53,7 @@ set(ASSETS_cg
assets-cg/decos/common/cc_bigleaf.png
assets-cg/decos/common/cc_smallleaf.png
assets-cg/decos/common/cc_rocks.png
assets-cg/decos/common/cc_void.png
assets-cg/player/player.png
assets-cg/clouds/sky1.png
@ -61,6 +62,9 @@ set(ASSETS_cg
assets-cg/backgrnd/mountain.png
assets-cg/backgrnd/treeline.png
assets-cg/backgrnd/canyon.png
assets-cg/backgrnd/rockline.png
assets-cg/backgrnd/snowmount.png
assets-cg/billboard/leftturn.png
assets-cg/billboard/rightturn.png

@ -2,136 +2,124 @@
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Release" />
<File name="src/src/cars.cc" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/include/drawstuff.h" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1019" topLine="8" />
<Cursor1 position="622" topLine="0" />
</Cursor>
</File>
<File name="src/include/menus.h" open="1" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/src/segment.cc" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="2" zoom_2="0">
<Cursor>
<Cursor1 position="251" topLine="0" />
<Cursor1 position="230" topLine="30" />
</Cursor>
</File>
<File name="src/src/menus.cc" open="1" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/include/segment.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="7903" topLine="146" />
<Cursor1 position="210" topLine="0" />
</Cursor>
<Folding>
<Collapse line="309" />
</Folding>
</File>
<File name="src/src/drawstuff.cc" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/src/cars.cc" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2642" topLine="49" />
<Cursor1 position="1019" topLine="8" />
</Cursor>
<Folding>
<Collapse line="33" />
<Collapse line="40" />
<Collapse line="76" />
</Folding>
</File>
<File name="TODO.txt" open="1" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="CMakeLists.txt" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="251" topLine="0" />
<Cursor1 position="1414" topLine="47" />
</Cursor>
</File>
<File name="src/fixed.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/src/menus.cc" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="778" topLine="0" />
<Cursor1 position="6008" topLine="75" />
</Cursor>
<Folding>
<Collapse line="315" />
</Folding>
</File>
<File name="src/include/clouds.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/include/camera.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="306" topLine="0" />
<Cursor1 position="221" topLine="0" />
</Cursor>
</File>
<File name="src/src/circuit.cc" open="1" top="1" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/src/camera.cc" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="30741" topLine="513" />
<Cursor1 position="370" topLine="0" />
</Cursor>
<Folding>
<Collapse line="178" />
<Collapse line="246" />
<Collapse line="262" />
<Collapse line="288" />
<Collapse line="333" />
<Collapse line="379" />
</Folding>
</File>
<File name="src/include/segment.h" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/src/circuit.cc" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="210" topLine="0" />
<Cursor1 position="799" topLine="0" />
</Cursor>
<Folding>
<Collapse line="433" />
<Collapse line="501" />
<Collapse line="517" />
<Collapse line="543" />
<Collapse line="588" />
<Collapse line="634" />
</Folding>
</File>
<File name="src/include/drawstuff.h" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/include/cars.h" open="0" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="622" topLine="0" />
<Cursor1 position="332" topLine="0" />
</Cursor>
</File>
<File name="src/include/cars.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="TODO.txt" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="332" topLine="0" />
<Cursor1 position="251" topLine="0" />
</Cursor>
</File>
<File name="src/src/camera.cc" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/fixed.h" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="370" topLine="0" />
<Cursor1 position="778" topLine="0" />
</Cursor>
</File>
<File name="src/src/segment.cc" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="2" zoom_2="0">
<File name="src/parameters.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="230" topLine="30" />
<Cursor1 position="399" topLine="0" />
</Cursor>
</File>
<File name="src/include/camera.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/src/drawstuff.cc" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="221" topLine="0" />
<Cursor1 position="2642" topLine="49" />
</Cursor>
<Folding>
<Collapse line="33" />
<Collapse line="40" />
<Collapse line="76" />
</Folding>
</File>
<File name="src/colors.h" open="1" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/include/circuit.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="607" topLine="0" />
<Cursor1 position="865" topLine="48" />
</Cursor>
</File>
<File name="src/parameters.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/main.cc" open="1" top="1" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="399" topLine="0" />
<Cursor1 position="19568" topLine="253" />
</Cursor>
<Folding>
<Collapse line="276" />
<Collapse line="304" />
</Folding>
</File>
<File name="src/src/clouds.cc" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="203" topLine="0" />
</Cursor>
</File>
<File name="src/main.cc" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/colors.h" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5823" topLine="162" />
<Cursor1 position="607" topLine="0" />
</Cursor>
<Folding>
<Collapse line="99" />
<Collapse line="104" />
<Collapse line="110" />
<Collapse line="118" />
<Collapse line="126" />
<Collapse line="146" />
<Collapse line="169" />
<Collapse line="175" />
<Collapse line="181" />
<Collapse line="187" />
<Collapse line="204" />
<Collapse line="217" />
<Collapse line="228" />
<Collapse line="233" />
</Folding>
</File>
<File name="src/include/circuit.h" open="1" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/include/menus.h" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1423" topLine="48" />
<Cursor1 position="251" topLine="0" />
</Cursor>
</File>
<File name="CMakeLists.txt" open="1" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/include/clouds.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1215" topLine="18" />
<Cursor1 position="306" topLine="0" />
</Cursor>
</File>
</CodeBlocks_layout_file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

@ -24,6 +24,9 @@
#define LIGHT_EARTH 0xFDC6
#define DARK_EARTH 0xCC40
#define LIGHT_ORANGE 0xFD4D
#define DARK_ORANGE 0xFBEB
#define DAY_BLUE_SKY 0x017F
#endif // PARAMETERS_H

@ -60,7 +60,7 @@ enum Decoration
};
void initData( void );
void createCircuit( void );
void createCircuit( int circuitNumber );
void putBillBoards( void );
void createClouds( void );
void createTraffic( void );
@ -77,8 +77,8 @@ void drawCircuitSegment( uint16_t index );
void drawDecoration( uint16_t index );
void drawTraffic( uint16_t index );
void drawClouds( int offset );
void drawFarBackground( int offset );
void drawNearBackground( int offset );
void drawFarBackground( int offset, int currentbiome );
void drawNearBackground( int offset, int currentbiome );
void freeDecoration( void );
void prepareDecoration( int biometoload );

@ -41,11 +41,10 @@ int CurrentCircuitBiome = PLAINS;
std::vector<Segment*> circuit;
int MAX_SEGMENT=0;
camera *cam;
std::vector<Clouds*> nuages;
std::vector<Cars*> traffic;
int MAX_SEGMENT=0;
camera *cam;
bool stop = false;
@ -248,12 +247,7 @@ int main(void)
usb_open(interfaces, GINT_CALL_NULL);
#endif
prof_t perf_update, perf_create, perf_project, perf_render;
int32_t start_time = 99000000;
uint32_t score=99999;
uint8_t stage=0;
uint8_t selectedCircuit=0;
uint32_t time_update=0, time_create=0, time_project=0, time_render=0;
prof_init();
@ -261,420 +255,348 @@ int main(void)
drawStartTitle();
bool exitflag = false;
bool exitToOS = false;
do
{
exitflag = false;
stage = drawMainMenu();
if (stage==0 || stage==1)
prof_t perf_update, perf_create, perf_project, perf_render;
int32_t start_time = 99000000;
uint32_t score=99999;
uint8_t stage=0;
uint8_t selectedCircuit=0;
uint32_t time_update=0, time_create=0, time_project=0, time_render=0;
exitToOS = false;
stop = false;
bool exitflag = false;
do
{
selectedCircuit = drawMenuCircuitSelect();
if (selectedCircuit != -1) exitflag=true;
exitflag = false;
stage = drawMainMenu();
if (stage==0 || stage==1)
{
selectedCircuit = drawMenuCircuitSelect();
if (selectedCircuit != -1) exitflag=true;
}
else if (stage==2)
{
// Option Menu TO BE DONE
}
else if (stage==3)
{
drawCredit();
}
else if (stage==4)
{
// Exit Menu TO BE DONE
// quick and dirty
exitToOS = true;
exitflag=true;
}
}
else if (stage==3)
while (!exitflag);
if (exitToOS==false)
{
drawCredit();
}
stage = selectedCircuit;
}
while (!exitflag);
if (selectedCircuit==0) CurrentCircuitBiome = PLAINS;
else if (selectedCircuit==1) CurrentCircuitBiome = DESERT;
else if (selectedCircuit==2) CurrentCircuitBiome = USA;
else if (selectedCircuit==3) CurrentCircuitBiome = FINLAND;
else if (selectedCircuit==4) CurrentCircuitBiome = AFRICA;
else if (selectedCircuit==5) CurrentCircuitBiome = PLAINS;
else if (selectedCircuit==6) CurrentCircuitBiome = DESERT;
else if (selectedCircuit==7) CurrentCircuitBiome = USA;
else if (selectedCircuit==8) CurrentCircuitBiome = FINLAND;
else if (selectedCircuit==9) CurrentCircuitBiome = AFRICA;
else CurrentCircuitBiome = PLAINS;
stage = selectedCircuit;
if (selectedCircuit==0) CurrentCircuitBiome = PLAINS;
else if (selectedCircuit==1) CurrentCircuitBiome = DESERT;
else if (selectedCircuit==2) CurrentCircuitBiome = USA;
else if (selectedCircuit==3) CurrentCircuitBiome = FINLAND;
else if (selectedCircuit==4) CurrentCircuitBiome = AFRICA;
else if (selectedCircuit==5) CurrentCircuitBiome = PLAINS;
else if (selectedCircuit==6) CurrentCircuitBiome = DESERT;
else if (selectedCircuit==7) CurrentCircuitBiome = USA;
else if (selectedCircuit==8) CurrentCircuitBiome = FINLAND;
else if (selectedCircuit==9) CurrentCircuitBiome = AFRICA;
else CurrentCircuitBiome = PLAINS;
int nbInterestingSegments = (MAX_RENDER_DISTANCE / SEGMENT_LENGTH); // the number of segments to be projected considering the rendering distance
int nbInterestingSegments = (MAX_RENDER_DISTANCE / SEGMENT_LENGTH); // the number of segments to be projected considering the rendering distance
perf_create = prof_make();
prof_enter(perf_create);
initData( ); // Positioning of the Camera
createCircuit( selectedCircuit ); // Creates the circuit
perf_create = prof_make();
prof_enter(perf_create);
putBillBoards();
initData( ); // Positioning of the Camera
createCircuit(); // Creates the circuit
createClouds(); // Creates the Sky and Clouds
createTraffic(); // Creates the cars
prepareDecoration( CurrentCircuitBiome ); // Prepares the multiple variations of Decoration (image scaling)
prepareTraffic(); // Prepares the multiple variations of Cars (image scaling)
putBillBoards();
prof_leave(perf_create);
time_create = prof_time(perf_create);
createClouds(); // Creates the Sky and Clouds
createTraffic(); // Creates the cas
prepareDecoration( CurrentCircuitBiome ); // Prepares the multiple variations of Decoration (image scaling)
prepareTraffic(); // Prepares the multiple variations of Cars (image scaling)
//--------------
MAX_SEGMENT = circuit.size();
prof_leave(perf_create);
time_create = prof_time(perf_create);
int indexstart = 0;
int indexend = 0;
//--------------
MAX_SEGMENT = circuit.size();
uint32_t maxDistance = (MAX_SEGMENT-nbInterestingSegments-5)*SEGMENT_LENGTH;
int indexstart = 0;
int indexend = 0;
uint32_t dt=0;
uint16_t l=0;
uint32_t remaining_time;
uint32_t maxDistance = (MAX_SEGMENT-nbInterestingSegments-5)*SEGMENT_LENGTH;
while (!stop)
{
uint32_t dt=0;
uint16_t l=0;
uint32_t remaining_time;
perf_update = prof_make();
prof_enter(perf_update);
while (!stop)
{
get_inputs( dt, indexstart );
perf_update = prof_make();
prof_enter(perf_update);
dt = ((float) (time_update+time_render+time_project) / 1000.0);
get_inputs( dt, indexstart );
start_time -= (time_update+time_render+time_project);
if (start_time<0) start_time=0;
remaining_time = ((float) (start_time) / 1000000.0);
dt = ((float) (time_update+time_render+time_project) / 1000.0);
//--------------
if (fround(cam->cZ)<=0) cam->cZ=fixdouble(0.0);
if (fround(cam->cZ)>=maxDistance) cam->cZ=fixdouble(maxDistance);
start_time -= (time_update+time_render+time_project);
if (start_time<0) start_time=0;
remaining_time = ((float) (start_time) / 1000000.0);
indexstart = fround(cam->cZ) / SEGMENT_LENGTH;
if (indexstart<0) indexstart=0;
//--------------
if (fround(cam->cZ)<=0) cam->cZ=fixdouble(0.0);
if (fround(cam->cZ)>=maxDistance) cam->cZ=fixdouble(maxDistance);
indexend = indexstart+nbInterestingSegments+1;
if (indexstart>MAX_SEGMENT-nbInterestingSegments-2) indexstart=MAX_SEGMENT-nbInterestingSegments-2;
indexstart = fround(cam->cZ) / SEGMENT_LENGTH;
if (indexstart<0) indexstart=0;
indexend = indexstart+nbInterestingSegments+1;
if (indexstart>MAX_SEGMENT-nbInterestingSegments-2) indexstart=MAX_SEGMENT-nbInterestingSegments-2;
prof_leave(perf_update);
time_update = prof_time(perf_update);
//--------------
prof_leave(perf_update);
time_update = prof_time(perf_update);
perf_project = prof_make();
prof_enter(perf_project);
//--------------
perf_project = prof_make();
prof_enter(perf_project);
if (BDrawCars)
{
updateTraffic( dt, maxDistance );
if (BDrawCars)
for (int k=0; k<traffic.size(); k++) // Need to project 1 more segment than actual drawing
{
updateTraffic( dt, maxDistance );
for (int k=0; k<traffic.size(); k++) // Need to project 1 more segment than actual drawing
uint16_t CarSegment = traffic[k]->wZ / SEGMENT_LENGTH;
if (CarSegment>=indexstart && CarSegment<indexend)
{
uint16_t CarSegment = traffic[k]->wZ / SEGMENT_LENGTH;
if (CarSegment>=indexstart && CarSegment<indexend)
{
//traffic[k]->visible = true;
circuit[CarSegment]->CarList.push_back(k);
}
//else
//traffic[k]->visible = false;
//traffic[k]->visible = true;
circuit[CarSegment]->CarList.push_back(k);
}
//else
//traffic[k]->visible = false;
}
}
minYRoad = SCREEN_HEIGHT;
minYRoad = SCREEN_HEIGHT;
float roadpart = f2float(cam->cX)/(float) ROAD_WIDTH;
float roadpart = f2float(cam->cX)/(float) ROAD_WIDTH;
// Update car positions : car with higher speed change line not to collide with player
if (BDrawCars)
for( int l=0; l<circuit[indexstart]->CarList.size(); l++ ) // For all cars inside that road segment
{
uint8_t indexCar = circuit[indexstart]->CarList[l];
// Update car positions : car with higher speed change line not to collide with player
if (BDrawCars)
for( int l=0; l<circuit[indexstart]->CarList.size(); l++ ) // For all cars inside that road segment
{
uint8_t indexCar = circuit[indexstart]->CarList[l];
if (traffic[indexCar]->wX>(roadpart-0.25f) && traffic[indexCar]->wX<(roadpart+0.25f) && traffic[indexCar]->Speed>speed)
{
if (traffic[indexCar]->wX>-0.25) traffic[indexCar]->wX-=0.5; // if we are on one of the most right lanes, we overtake by the left
else traffic[indexCar]->wX=-0.25; // else we change to the lane on the right
}
}
if (traffic[indexCar]->wX>(roadpart-0.25f) && traffic[indexCar]->wX<(roadpart+0.25f) && traffic[indexCar]->Speed>speed)
{
if (traffic[indexCar]->wX>-0.25) traffic[indexCar]->wX-=0.5; // if we are on one of the most right lanes, we overtake by the left
else traffic[indexCar]->wX=-0.25; // else we change to the lane on the right
}
}
if (BDrawCars)
for( int l=0; l<circuit[indexstart+1]->CarList.size(); l++ ) // For all cars inside that road segment
{
uint8_t indexCar = circuit[indexstart+1]->CarList[l];
if (BDrawCars)
for( int l=0; l<circuit[indexstart+1]->CarList.size(); l++ ) // For all cars inside that road segment
{
uint8_t indexCar = circuit[indexstart+1]->CarList[l];
if (traffic[indexCar]->wX>(roadpart-0.15f) && traffic[indexCar]->wX<(roadpart+0.15f) && traffic[indexCar]->Speed<speed)
{
speed = 2.0;
}
}
if (traffic[indexCar]->wX>(roadpart-0.15f) && traffic[indexCar]->wX<(roadpart+0.15f) && traffic[indexCar]->Speed<speed)
{
speed = 2.0;
}
}
uint16_t cumulCurve=0;
for (int k=indexstart; k<=indexend; k++) // Need to project 1 more segment than actual drawing
{
projectCircuitFP( k ); // We project the current segment
uint16_t cumulCurve=0;
for (int k=indexstart; k<=indexend; k++) // Need to project 1 more segment than actual drawing
{
projectCircuitFP( k ); // We project the current segment
if (circuit[k]->Y < minYRoad) // This is a trick to save precious time while drawing the Sky
minYRoad = circuit[k]->Y;
if (circuit[k]->Y < minYRoad) // This is a trick to save precious time while drawing the Sky
minYRoad = circuit[k]->Y;
circuit[k]->CumulatedCurve = cumulCurve; // This is the curve accumulated when we are drawing curves
cumulCurve += circuit[k]->Curve;
circuit[k]->CumulatedCurve = cumulCurve; // This is the curve accumulated when we are drawing curves
cumulCurve += circuit[k]->Curve;
if (BDrawCars)
for( int l=0; l<circuit[k]->CarList.size(); l++ ) // For all cars inside that road segment
{
uint8_t indexCar = circuit[k]->CarList[l];
traffic[indexCar]->Project3DFP( cam, k );
}
}
if (BDrawCars)
for( int l=0; l<circuit[k]->CarList.size(); l++ ) // For all cars inside that road segment
{
uint8_t indexCar = circuit[k]->CarList[l];
traffic[indexCar]->Project3DFP( cam, k );
}
}
prof_leave(perf_project);
time_project = prof_time(perf_project);
//--------------
perf_render = prof_make();
prof_enter(perf_render);
prof_leave(perf_project);
time_project = prof_time(perf_project);
//--------------
drawSky( DAY_BLUE_SKY );
perf_render = prof_make();
prof_enter(perf_render);
if (BDrawClds)
drawClouds( l % 396 );
drawFarBackground( deltaFarbackground, CurrentCircuitBiome );
drawNearBackground( deltaNearbackground, CurrentCircuitBiome );
drawSky( DAY_BLUE_SKY );
cam->cY = fix( 300+2*CS ) + interpolatePositionY(fround(cam->cZ) );
if (BDrawClds)
drawClouds( l % 396 );
for( int k=indexend-1; k>=indexstart; k--)
{
currentcurve = circuit[k]->CumulatedCurve;
drawFarBackground( deltaFarbackground );
drawNearBackground( deltaNearbackground );
if (BDrawRoad)
drawCircuitSegment( k );
cam->cY = fix( 300+2*CS ) + interpolatePositionY(fround(cam->cZ) );
if (BDrawDeco)
drawDecoration( k );
for( int k=indexend-1; k>=indexstart; k--)
{
currentcurve = circuit[k]->CumulatedCurve;
if (BDrawCars)
for( int l=0; l<circuit[k]->CarList.size(); l++ ) // For all cars inside that road segment
{
uint8_t indexCar = circuit[k]->CarList[l];
drawTraffic( indexCar );
}
if (BDrawRoad)
drawCircuitSegment( k );
circuit[k]->CarList.clear();
}
if (BDrawDeco)
drawDecoration( k );
if (BDrawCars)
for( int l=0; l<circuit[k]->CarList.size(); l++ ) // For all cars inside that road segment
{
uint8_t indexCar = circuit[k]->CarList[l];
drawTraffic( indexCar );
}
int mod_base=20;
int mod_comp=10;
circuit[k]->CarList.clear();
}
if (abs(speed)<1.0) mod_base = 30, mod_comp = 15;
else if (abs(speed)<2.0) mod_base = 20, mod_comp = 10;
else if (abs(speed)<3.0) mod_base = 16, mod_comp = 8;
else if (abs(speed)<4.0) mod_base = 12, mod_comp = 6;
else if (abs(speed)<5.0) mod_base = 8, mod_comp = 4;
else mod_base = 4, mod_comp = 2;
int mod_base=20;
int mod_comp=10;
if ((speed==0) || (l%mod_base<=mod_comp)) // the small rick to have the speed impression on wheels and to have the correct view of the car during turns
{
if (viewside==-2) dsubimage( SCREEN_CX-40, SCREEN_HEIGHT-46, &player, 99,1,80,46, DIMAGE_NONE);
else if (viewside==-1) dsubimage( SCREEN_CX-37, SCREEN_HEIGHT-46, &player, 181,1,74,46, DIMAGE_NONE);
else if (viewside==0) dsubimage( SCREEN_CX-36, SCREEN_HEIGHT-46, &player, 257,1,72,46, DIMAGE_NONE);
else if (viewside==1) dsubimage( SCREEN_CX-37, SCREEN_HEIGHT-46, &player, 331,1,74,46, DIMAGE_NONE);
else if (viewside==2) dsubimage( SCREEN_CX-40, SCREEN_HEIGHT-46, &player, 407,1,80,46, DIMAGE_NONE);
}
else
{
if (viewside==-2) dsubimage( SCREEN_CX-40, SCREEN_HEIGHT-46, &player, 99,49,80,46, DIMAGE_NONE);
else if (viewside==-1) dsubimage( SCREEN_CX-37, SCREEN_HEIGHT-46, &player, 181,49,74,46, DIMAGE_NONE);
else if (viewside==0) dsubimage( SCREEN_CX-36, SCREEN_HEIGHT-46, &player, 257,49,72,46, DIMAGE_NONE);
else if (viewside==1) dsubimage( SCREEN_CX-37, SCREEN_HEIGHT-46, &player, 331,49,74,46, DIMAGE_NONE);
else if (viewside==2) dsubimage( SCREEN_CX-40, SCREEN_HEIGHT-46, &player, 407,49,80,46, DIMAGE_NONE);
}
if (abs(speed)<1.0) mod_base = 30, mod_comp = 15;
else if (abs(speed)<2.0) mod_base = 20, mod_comp = 10;
else if (abs(speed)<3.0) mod_base = 16, mod_comp = 8;
else if (abs(speed)<4.0) mod_base = 12, mod_comp = 6;
else if (abs(speed)<5.0) mod_base = 8, mod_comp = 4;
else mod_base = 4, mod_comp = 2;
score = fround(cam->cZ)/100;
if ((speed==0) || (l%mod_base<=mod_comp)) // the small rick to have the speed impression on wheels and to have the correct view of the car during turns
{
if (viewside==-2) dsubimage( SCREEN_CX-40, SCREEN_HEIGHT-46, &player, 99,1,80,46, DIMAGE_NONE);
else if (viewside==-1) dsubimage( SCREEN_CX-37, SCREEN_HEIGHT-46, &player, 181,1,74,46, DIMAGE_NONE);
else if (viewside==0) dsubimage( SCREEN_CX-36, SCREEN_HEIGHT-46, &player, 257,1,72,46, DIMAGE_NONE);
else if (viewside==1) dsubimage( SCREEN_CX-37, SCREEN_HEIGHT-46, &player, 331,1,74,46, DIMAGE_NONE);
else if (viewside==2) dsubimage( SCREEN_CX-40, SCREEN_HEIGHT-46, &player, 407,1,80,46, DIMAGE_NONE);
}
else
{
if (viewside==-2) dsubimage( SCREEN_CX-40, SCREEN_HEIGHT-46, &player, 99,49,80,46, DIMAGE_NONE);
else if (viewside==-1) dsubimage( SCREEN_CX-37, SCREEN_HEIGHT-46, &player, 181,49,74,46, DIMAGE_NONE);
else if (viewside==0) dsubimage( SCREEN_CX-36, SCREEN_HEIGHT-46, &player, 257,49,72,46, DIMAGE_NONE);
else if (viewside==1) dsubimage( SCREEN_CX-37, SCREEN_HEIGHT-46, &player, 331,49,74,46, DIMAGE_NONE);
else if (viewside==2) dsubimage( SCREEN_CX-40, SCREEN_HEIGHT-46, &player, 407,49,80,46, DIMAGE_NONE);
}
float drawspeed = (float) (speed*5.0f);
score = fround(cam->cZ)/100;
dsubimage( 5, 5, &speedhud, 0, 117, 37, 13, DIMAGE_NONE); // speed logo
dsubimage( 135, 5, &speedhud, 0, 130, 37, 13, DIMAGE_NONE); // timer logo
//dprint( 1, 1, C_BLACK, "Crt=%.3D ms", time_create );
dsubimage( 245, 5, &speedhud, 37, 117, 38, 13, DIMAGE_NONE); // speed logo
dsubimage( 245, 25, &speedhud, 37, 130, 38, 13, DIMAGE_NONE); // timer logo
//dprint( 1, 15, C_RED, "Prj=%.3D ms", time_project );
//dprint( 1, 30, C_RED, "Rdr=%.3D ms", time_render );
//dprint( 1, 45, C_RED, "Upd=%.3D ms", time_update );
//dprint( 1, 1, C_BLACK, "Dt=%.3D ms", dt );
dfont(&speedfont);
if (drawspeed==0.0)
{
dprint_opt(122,3, C_RGB(0,0,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "0 :", drawspeed );
dprint_opt(120,1, C_RGB(255,0,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "0 :", drawspeed );
}
else
{
dprint_opt(122,3, C_RGB(0,0,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.1f :", drawspeed );
dprint_opt(120,1, C_RGB(255,0,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.1f :", drawspeed ); //the ':' char corresponds to "Km/h"
}
dprint_opt(233,3, C_RGB(0,0,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.3D ;", remaining_time );
dprint_opt(230,1, C_RGB(255,255,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.3D ;", remaining_time ); // the ';' char corresponds to "s"
float drawspeed = (float) (speed*5.0f);
dprint_opt(390,3, C_RGB(0,0,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.3D", score );
dprint_opt(388,1, C_RGB(255,255,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.3D", score ); // the ';' char corresponds to "s"
dprint_opt(390,23, C_RGB(0,0,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.3D", stage );
dprint_opt(388,21, C_RGB(255,255,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.3D", stage ); // the ';' char corresponds to "s"
dsubimage( 5, 5, &speedhud, 0, 117, 37, 13, DIMAGE_NONE); // speed logo
dsubimage( 135, 5, &speedhud, 0, 130, 37, 13, DIMAGE_NONE); // timer logo
dsubimage( 245, 5, &speedhud, 37, 117, 38, 13, DIMAGE_NONE); // speed logo
dsubimage( 245, 25, &speedhud, 37, 130, 38, 13, DIMAGE_NONE); // timer logo
if (drawspeed==0.0) dsubimage( 48, 25, &speedhud, 0, 0, 76, 13, DIMAGE_NONE);
else if (drawspeed<3.30) dsubimage( 48, 25, &speedhud, 0, 13, 76, 13, DIMAGE_NONE);
else if (drawspeed<6.70) dsubimage( 48, 25, &speedhud, 0, 26, 76, 13, DIMAGE_NONE);
else if (drawspeed<10.0) dsubimage( 48, 25, &speedhud, 0, 39, 76, 13, DIMAGE_NONE);
else if (drawspeed<13.3) dsubimage( 48, 25, &speedhud, 0, 52, 76, 13, DIMAGE_NONE);
else if (drawspeed<16.7) dsubimage( 48, 25, &speedhud, 0, 65, 76, 13, DIMAGE_NONE);
else if (drawspeed<20.0) dsubimage( 48, 25, &speedhud, 0, 78, 76, 13, DIMAGE_NONE);
else if (drawspeed<23.3) dsubimage( 48, 25, &speedhud, 0, 91, 76, 13, DIMAGE_NONE);
else dsubimage( 48, 25, &speedhud, 0, 104, 76, 13, DIMAGE_NONE);
dfont(&speedfont);
if (drawspeed==0.0)
{
dprint_opt(122,3, C_RGB(0,0,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "0 :", drawspeed );
dprint_opt(120,1, C_RGB(255,0,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "0 :", drawspeed );
}
else
{
dprint_opt(122,3, C_RGB(0,0,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.1f :", drawspeed );
dprint_opt(120,1, C_RGB(255,0,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.1f :", drawspeed ); //the ':' char corresponds to "Km/h"
}
//dupdate();
r61524_display(gint_vram, 0, DHEIGHT, R61524_DMA_WAIT);
dprint_opt(233,3, C_RGB(0,0,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.3D ;", remaining_time );
dprint_opt(230,1, C_RGB(255,255,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.3D ;", remaining_time ); // the ';' char corresponds to "s"
dprint_opt(390,3, C_RGB(0,0,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.3D", score );
dprint_opt(388,1, C_RGB(255,255,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.3D", score ); // the ';' char corresponds to "s"
dprint_opt(390,23, C_RGB(0,0,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.3D", stage );
dprint_opt(388,21, C_RGB(255,255,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.3D", stage ); // the ';' char corresponds to "s"
if (drawspeed==0.0) dsubimage( 48, 25, &speedhud, 0, 0, 76, 13, DIMAGE_NONE);
else if (drawspeed<3.30) dsubimage( 48, 25, &speedhud, 0, 13, 76, 13, DIMAGE_NONE);
else if (drawspeed<6.70) dsubimage( 48, 25, &speedhud, 0, 26, 76, 13, DIMAGE_NONE);
else if (drawspeed<10.0) dsubimage( 48, 25, &speedhud, 0, 39, 76, 13, DIMAGE_NONE);
else if (drawspeed<13.3) dsubimage( 48, 25, &speedhud, 0, 52, 76, 13, DIMAGE_NONE);
else if (drawspeed<16.7) dsubimage( 48, 25, &speedhud, 0, 65, 76, 13, DIMAGE_NONE);
else if (drawspeed<20.0) dsubimage( 48, 25, &speedhud, 0, 78, 76, 13, DIMAGE_NONE);
else if (drawspeed<23.3) dsubimage( 48, 25, &speedhud, 0, 91, 76, 13, DIMAGE_NONE);
else dsubimage( 48, 25, &speedhud, 0, 104, 76, 13, DIMAGE_NONE);
//dprint( 1, 1, C_BLACK, "FPS=%.3D ms", 1000/dt );
/*
#if 0
dprint( 1, 210, C_WHITE, "Decs: %c", BDrawDeco==true?'Y':'N' ); // Key F1
dprint( 67, 210, C_WHITE, "Clds: %c", BDrawClds==true?'Y':'N' ); // Key F2
dprint( 133, 210, C_WHITE, "Cars: %c", BDrawCars==true?'Y':'N' ); // Key F3
dprint( 199, 210, C_WHITE, "DtR: %.1f", ((float) (time_render) / 1000.0) ); // Key F4
dprint( 265, 210, C_WHITE, "ScrSht" ); // Key F5
dprint( 331, 210, C_WHITE, "RecVid" ); // Key F6
#endif // 1
#if 0
if (ShowDebug1)
{
Segment* currentSeg = circuit[indexstart];
dprint( 1, 1, C_RED, "Crt=%.3D ms", time_create );
dprint( 1, 15, C_RED, "Prj=%.3D ms", time_project );
dprint( 1, 29, C_RED, "Rdr=%.3D ms", time_render );
dprint( 1, 55, C_WHITE, "It=%d", l);
dprint( 1, 69, C_GREEN, "St=%d ", indexstart );
dprint( 1, 83, C_GREEN, "En=%d", indexend );
dprint( 1, 97, C_RED, "Sz= %d", circuit.size() );
dprint( 100, 55, C_WHITE, "SzSgmt=%d bytes", sizeof(Segment) );
dprint( 100, 69, C_WHITE, ">XYZc=(%d,%d,%.0lf,%d)", circuit[indexstart]->wX, circuit[indexstart]->wY, circuit[indexstart]->wZ, circuit[indexstart]->Curve );
dprint( 100, 83, C_WHITE, ">XYZc=(%d,%d,%.0lf,%d)", circuit[indexend]->wX, circuit[indexend]->wY, circuit[indexend]->wZ, circuit[indexstart]->Curve );
dprint( 100, 97, C_WHITE, "C[i]Adr= %p", &currentSeg),
dprint( 320, 1, C_WHITE, "CamX=%d", fround( cam->cX ) );
dprint( 320, 15, C_WHITE, "CamY=%d", fround( cam->cY ) );
dprint( 320, 29, C_WHITE, "CamZ=%d", fround( cam->cZ ) );
dprint( 320, 55, C_WHITE, "Dir=%d", direction );
dprint( 320, 69, C_WHITE, "Spd=%.1f", speed );
dprint( 320, 83, C_WHITE, "Dz =%.1f", speed*dt );
dprint( 320, 97, C_WHITE, "dt =%.3D ms", dt );
}
if (ShowDebug2)
{
#if 0
dprint( 1, 1, C_RED, "Crt=%.3D ms", time_create );
dprint( 1, 15, C_RED, "Prj=%.3D ms", time_project );
dprint( 1, 29, C_RED, "Rdr=%.3D ms", time_render );
dprint( 1, 50, C_BLACK, "ISt_Z=%.1lf", circuit[indexstart]->wZ);
dprint( 1, 65, C_BLACK, "IEd_Z=%.1lf", circuit[indexend]->wZ);
for( int k=indexend-1; k>=indexstart; k--)
{
dprint( 100, 1+10*k-indexstart, C_WHITE, "S[%d]=%d", k, circuit[k]->DScale );
}
for( int k=0; k<nuages.size(); k++)
{
dprint( 250, 1+10*k, C_WHITE, "Cl[%d]=(%d,%d,%d)", k, nuages[k]->X, nuages[k]->Y, nuages[k]->type );
}
#endif // 0
for( int k=0; k<traffic.size(); k++)
{
if (traffic[k]->visible == true) dprint( 1, 1+10*k, C_GREEN, "Car %d Sc=%d wZ=%.0lf / Seg=%d X=%d Y=%d", k, traffic[k]->DScale, traffic[k]->wZ, traffic[k]->segnum, traffic[k]->X, traffic[k]->Y, traffic[k]->S );
else dprint( 1, 1+10*k, C_RED, "Car %d Sc=%d wZ=%.0lf / Seg=%d X=%d Y=%d", k, traffic[k]->DScale, traffic[k]->wZ, traffic[k]->segnum, traffic[k]->X, traffic[k]->Y, traffic[k]->S );
}
}
if (ShowDebug3)
{
dprint( 1, 1, C_BLACK, "S");
for( int k=0; k<=indexend-indexstart; k++)
{
int nbCars=circuit[indexstart+k]->CarList.size();
dprint( 25+k*25, 1, C_BLACK, "%d", indexstart+k );
dprint( 25+k*25, 11, C_RED, "%d", nbCars );
for( int l=0; l<nbCars; l++ ) // For all cars inside that road segment
{
dprint( 1, 33+10*l, C_BLACK, "C" );
dprint( 25+k*25, 33+10*l, C_BLACK, "%d", circuit[indexstart+k]->CarList[l]);
}
}
}
#endif
*/
/*
for( int k=indexend-1; k>=indexstart; k--)
{
circuit[k]->CarList.clear();
}
*/
//dupdate();
r61524_display(gint_vram, 0, DHEIGHT, R61524_DMA_WAIT);
prof_leave(perf_render);
time_render = prof_time(perf_render);
#if IS_FXLIB==1
if (screenshot && usb_is_open())
{
usb_fxlink_screenshot(false);
screenshot = false;
}
prof_leave(perf_render);
time_render = prof_time(perf_render);
if(record && usb_is_open())
{
usb_fxlink_videocapture(false);
}
#if IS_FXLIB==1
if (screenshot && usb_is_open())
{
usb_fxlink_screenshot(false);
screenshot = false;
}
if(record && usb_is_open())
{
usb_fxlink_videocapture(false);
}
#endif
l++;
l++;
}
circuit.clear();
nuages.clear();
traffic.clear();
freeDecoration();
freeTraffic();
}
}
while (exitToOS==false);
prof_quit();
@ -682,12 +604,8 @@ int main(void)
usb_close();
#endif
circuit.clear();
nuages.clear();
delete cam;
freeDecoration();
freeTraffic();
return 1;
}

@ -28,11 +28,11 @@ extern bool ShowDebug1;
extern bopti_image_t car1, car2, car3, car4, car5, car6, car7, car8;
extern bopti_image_t pl_tree1, pl_tree2, pl_tree3, pl_tree4, dt_tree1, dt_tree2, dt_tree3, dt_tree4, us_tree4, fi_tree1, fi_tree2, fi_tree4;
extern bopti_image_t cc_bigleaf, cc_smallleaf, cc_rocks, af_bigleaf, dt_smallleaf, fi_rocks;
extern bopti_image_t cc_void, cc_bigleaf, cc_smallleaf, cc_rocks, af_bigleaf, dt_smallleaf, fi_rocks;
extern bopti_image_t sky1, sky2, sky3;
extern bopti_image_t mountain;
extern bopti_image_t treeline;
extern bopti_image_t mountain, canyon, snowmount;
extern bopti_image_t treeline, rockline;
extern bopti_image_t leftturn, rightturn, uphill, downhill;
extern bopti_image_t checkpoint, startlights, stoplights, waitlights;
@ -146,33 +146,288 @@ void initData( void )
}
void createCircuit( void )
void createCircuit( int circuitNumber )
{
addStartLine( PLAINS );
addStraightLine( L_VERYSHORT, PLAINS );
addStraightLine( L_VERYSHORT, DESERT );
addStraightLine( L_VERYSHORT, USA );
addStraightLine( L_VERYSHORT, FINLAND );
addStraightLine( L_VERYSHORT, AFRICA );
addCurvyHill( L_MEDIUM, H_BIG, UP_HILL, C_HARD, LEFT_CURVE, USA );
addCurvyHill( L_MEDIUM, H_BIG, UP_HILL, C_HARD, LEFT_CURVE, DESERT );
addStraightLine( L_VERYSHORT, DESERT );
addCurvyHill( L_MEDIUM, H_BIG, DOWN_HILL, C_HARD, RIGHT_CURVE, DESERT );
addCheckPoint( PLAINS );
addStraightLine( L_VERYSHORT, PLAINS );
addCheckPoint( DESERT );
addCurve( L_SHORT, C_HARD, LEFT_CURVE, DESERT );
addCurve( L_SHORT, C_HARD, RIGHT_CURVE, DESERT );
addStraightLine( L_LONG, DESERT );
addHill( L_MEDIUM, H_BIG, UP_HILL, DESERT );
addHill( L_MEDIUM, H_BIG, DOWN_HILL, PLAINS );
addStraightLine( L_VERYLONG, PLAINS );
addCurve( L_SHORT, C_HARD, LEFT_CURVE, PLAINS );
addStraightLine( L_VERYLONG, DESERT );
addCurve( L_SHORT, C_EASY, LEFT_CURVE, DESERT );
addCheckPoint( PLAINS );
addFinishLine( DESERT );
addStraightLine( L_VERYSHORT, PLAINS );
if (circuitNumber==0)
{
addStartLine( PLAINS );
addStraightLine( L_VERYSHORT, PLAINS );
addStraightLine( L_VERYSHORT, PLAINS );
addStraightLine( L_VERYSHORT, PLAINS );
addStraightLine( L_VERYSHORT, PLAINS );
addStraightLine( L_VERYSHORT, PLAINS );
addCurvyHill( L_MEDIUM, H_BIG, UP_HILL, C_HARD, LEFT_CURVE, PLAINS );
addCurvyHill( L_MEDIUM, H_BIG, UP_HILL, C_HARD, LEFT_CURVE, PLAINS );
addStraightLine( L_VERYSHORT, PLAINS );
addCurvyHill( L_MEDIUM, H_BIG, DOWN_HILL, C_HARD, RIGHT_CURVE, PLAINS );
addCheckPoint( PLAINS );
addStraightLine( L_VERYSHORT, PLAINS );
addCheckPoint( PLAINS );
addCurve( L_SHORT, C_HARD, LEFT_CURVE, PLAINS );
addCurve( L_SHORT, C_HARD, RIGHT_CURVE, PLAINS );
addStraightLine( L_LONG, PLAINS );
addHill( L_MEDIUM, H_BIG, UP_HILL, PLAINS );
addHill( L_MEDIUM, H_BIG, DOWN_HILL, PLAINS );
addStraightLine( L_VERYLONG, PLAINS );
addCurve( L_SHORT, C_HARD, LEFT_CURVE, PLAINS );
addStraightLine( L_VERYLONG, PLAINS );
addCurve( L_SHORT, C_EASY, LEFT_CURVE, PLAINS );
addCheckPoint( PLAINS );
addFinishLine( PLAINS );
addStraightLine( L_VERYSHORT, PLAINS );
}
else if (circuitNumber==1)
{
addStartLine( DESERT );
addStraightLine( L_VERYSHORT, DESERT );
addStraightLine( L_VERYSHORT, DESERT );
addStraightLine( L_VERYSHORT, DESERT );
addStraightLine( L_VERYSHORT, DESERT );
addStraightLine( L_VERYSHORT, DESERT );
addCurvyHill( L_MEDIUM, H_BIG, UP_HILL, C_HARD, LEFT_CURVE, DESERT );
addCurvyHill( L_MEDIUM, H_BIG, UP_HILL, C_HARD, LEFT_CURVE, DESERT );
addStraightLine( L_VERYSHORT, DESERT );
addCurvyHill( L_MEDIUM, H_BIG, DOWN_HILL, C_HARD, RIGHT_CURVE, DESERT );
addCheckPoint( DESERT );
addStraightLine( L_VERYSHORT, DESERT );
addCheckPoint( DESERT );
addCurve( L_SHORT, C_HARD, LEFT_CURVE, DESERT );
addCurve( L_SHORT, C_HARD, RIGHT_CURVE, DESERT );
addStraightLine( L_LONG, DESERT );
addHill( L_MEDIUM, H_BIG, UP_HILL, DESERT );
addHill( L_MEDIUM, H_BIG, DOWN_HILL, DESERT );
addStraightLine( L_VERYLONG, DESERT );
addCurve( L_SHORT, C_HARD, LEFT_CURVE, DESERT );
addStraightLine( L_VERYLONG, DESERT );
addCurve( L_SHORT, C_EASY, LEFT_CURVE, DESERT );
addCheckPoint( DESERT );
addFinishLine( DESERT );
addStraightLine( L_VERYSHORT, DESERT );
}
else if (circuitNumber==2)
{
addStartLine( USA );
addStraightLine( L_VERYSHORT, USA );
addStraightLine( L_VERYSHORT, USA );
addStraightLine( L_VERYSHORT, USA );
addStraightLine( L_VERYSHORT, USA );
addStraightLine( L_VERYSHORT, USA );
addCurvyHill( L_MEDIUM, H_BIG, UP_HILL, C_HARD, LEFT_CURVE, USA );
addCurvyHill( L_MEDIUM, H_BIG, UP_HILL, C_HARD, LEFT_CURVE, USA );
addStraightLine( L_VERYSHORT, USA );
addCurvyHill( L_MEDIUM, H_BIG, DOWN_HILL, C_HARD, RIGHT_CURVE, USA );
addCheckPoint( USA );
addStraightLine( L_VERYSHORT, USA );
addCheckPoint( USA );
addCurve( L_SHORT, C_HARD, LEFT_CURVE, USA );
addCurve( L_SHORT, C_HARD, RIGHT_CURVE, USA );
addStraightLine( L_LONG, USA );
addHill( L_MEDIUM, H_BIG, UP_HILL, USA );
addHill( L_MEDIUM, H_BIG, DOWN_HILL, USA );
addStraightLine( L_VERYLONG, USA );
addCurve( L_SHORT, C_HARD, LEFT_CURVE, USA );
addStraightLine( L_VERYLONG, USA );
addCurve( L_SHORT, C_EASY, LEFT_CURVE, USA );
addCheckPoint( USA );
addFinishLine( USA );
addStraightLine( L_VERYSHORT, USA );
}
else if (circuitNumber==3)
{
addStartLine( FINLAND );
addStraightLine( L_VERYSHORT, FINLAND );
addStraightLine( L_VERYSHORT, FINLAND );
addStraightLine( L_VERYSHORT, FINLAND );
addStraightLine( L_VERYSHORT, FINLAND );
addStraightLine( L_VERYSHORT, FINLAND );
addCurvyHill( L_MEDIUM, H_BIG, UP_HILL, C_HARD, LEFT_CURVE, FINLAND );
addCurvyHill( L_MEDIUM, H_BIG, UP_HILL, C_HARD, LEFT_CURVE, FINLAND );
addStraightLine( L_VERYSHORT, FINLAND );
addCurvyHill( L_MEDIUM, H_BIG, DOWN_HILL, C_HARD, RIGHT_CURVE, FINLAND );
addCheckPoint( FINLAND );
addStraightLine( L_VERYSHORT, FINLAND );
addCheckPoint( FINLAND );
addCurve( L_SHORT, C_HARD, LEFT_CURVE, FINLAND );
addCurve( L_SHORT, C_HARD, RIGHT_CURVE, FINLAND );
addStraightLine( L_LONG, FINLAND );
addHill( L_MEDIUM, H_BIG, UP_HILL, FINLAND );
addHill( L_MEDIUM, H_BIG, DOWN_HILL, FINLAND );
addStraightLine( L_VERYLONG, FINLAND );
addCurve( L_SHORT, C_HARD, LEFT_CURVE, FINLAND );
addStraightLine( L_VERYLONG, FINLAND );
addCurve( L_SHORT, C_EASY, LEFT_CURVE, FINLAND );
addCheckPoint( FINLAND );
addFinishLine( FINLAND );
addStraightLine( L_VERYSHORT, FINLAND );
}
else if (circuitNumber==4)
{
addStartLine( AFRICA );
addStraightLine( L_VERYSHORT, AFRICA );
addStraightLine( L_VERYSHORT, AFRICA );
addStraightLine( L_VERYSHORT, AFRICA );
addStraightLine( L_VERYSHORT, AFRICA );
addStraightLine( L_VERYSHORT, AFRICA );
addCurvyHill( L_MEDIUM, H_BIG, UP_HILL, C_HARD, LEFT_CURVE, AFRICA );
addCurvyHill( L_MEDIUM, H_BIG, UP_HILL, C_HARD, LEFT_CURVE, AFRICA );
addStraightLine( L_VERYSHORT, AFRICA );
addCurvyHill( L_MEDIUM, H_BIG, DOWN_HILL, C_HARD, RIGHT_CURVE, AFRICA );
addCheckPoint( AFRICA );
addStraightLine( L_VERYSHORT, AFRICA );
addCheckPoint( AFRICA );
addCurve( L_SHORT, C_HARD, LEFT_CURVE, AFRICA );
addCurve( L_SHORT, C_HARD, RIGHT_CURVE, AFRICA );
addStraightLine( L_LONG, AFRICA );
addHill( L_MEDIUM, H_BIG, UP_HILL, AFRICA );
addHill( L_MEDIUM, H_BIG, DOWN_HILL, AFRICA );
addStraightLine( L_VERYLONG, AFRICA );
addCurve( L_SHORT, C_HARD, LEFT_CURVE, AFRICA );
addStraightLine( L_VERYLONG, AFRICA );
addCurve( L_SHORT, C_EASY, LEFT_CURVE, AFRICA );
addCheckPoint( AFRICA );
addFinishLine( AFRICA );
addStraightLine( L_VERYSHORT, AFRICA );
}
if (circuitNumber==5)
{
addStartLine( PLAINS );
addStraightLine( L_VERYSHORT, PLAINS );
addStraightLine( L_VERYSHORT, PLAINS );
addStraightLine( L_VERYSHORT, PLAINS );
addStraightLine( L_VERYSHORT, PLAINS );
addStraightLine( L_VERYSHORT, PLAINS );
addCurvyHill( L_MEDIUM, H_BIG, UP_HILL, C_HARD, LEFT_CURVE, PLAINS );
addCurvyHill( L_MEDIUM, H_BIG, UP_HILL, C_HARD, LEFT_CURVE, PLAINS );
addStraightLine( L_VERYSHORT, PLAINS );
addCurvyHill( L_MEDIUM, H_BIG, DOWN_HILL, C_HARD, RIGHT_CURVE, PLAINS );
addCheckPoint( PLAINS );
addStraightLine( L_VERYSHORT, PLAINS );
addCheckPoint( PLAINS );
addCurve( L_SHORT, C_HARD, LEFT_CURVE, PLAINS );
addCurve( L_SHORT, C_HARD, RIGHT_CURVE, PLAINS );
addStraightLine( L_LONG, PLAINS );
addHill( L_MEDIUM, H_BIG, UP_HILL, PLAINS );
addHill( L_MEDIUM, H_BIG, DOWN_HILL, PLAINS );
addStraightLine( L_VERYLONG, PLAINS );
addCurve( L_SHORT, C_HARD, LEFT_CURVE, PLAINS );
addStraightLine( L_VERYLONG, PLAINS );
addCurve( L_SHORT, C_EASY, LEFT_CURVE, PLAINS );
addCheckPoint( PLAINS );
addFinishLine( PLAINS );
addStraightLine( L_VERYSHORT, PLAINS );
}
else if (circuitNumber==6)
{
addStartLine( DESERT );
addStraightLine( L_VERYSHORT, DESERT );
addStraightLine( L_VERYSHORT, DESERT );
addStraightLine( L_VERYSHORT, DESERT );
addStraightLine( L_VERYSHORT, DESERT );
addStraightLine( L_VERYSHORT, DESERT );
addCurvyHill( L_MEDIUM, H_BIG, UP_HILL, C_HARD, LEFT_CURVE, DESERT );
addCurvyHill( L_MEDIUM, H_BIG, UP_HILL, C_HARD, LEFT_CURVE, DESERT );
addStraightLine( L_VERYSHORT, DESERT );
addCurvyHill( L_MEDIUM, H_BIG, DOWN_HILL, C_HARD, RIGHT_CURVE, DESERT );
addCheckPoint( DESERT );
addStraightLine( L_VERYSHORT, DESERT );
addCheckPoint( DESERT );
addCurve( L_SHORT, C_HARD, LEFT_CURVE, DESERT );
addCurve( L_SHORT, C_HARD, RIGHT_CURVE, DESERT );
addStraightLine( L_LONG, DESERT );
addHill( L_MEDIUM, H_BIG, UP_HILL, DESERT );
addHill( L_MEDIUM, H_BIG, DOWN_HILL, DESERT );
addStraightLine( L_VERYLONG, DESERT );
addCurve( L_SHORT, C_HARD, LEFT_CURVE, DESERT );
addStraightLine( L_VERYLONG, DESERT );
addCurve( L_SHORT, C_EASY, LEFT_CURVE, DESERT );
addCheckPoint( DESERT );
addFinishLine( DESERT );
addStraightL