diff --git a/CMakeLists.txt b/CMakeLists.txt index 9376c52..1abcaa2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,10 @@ set(ASSETS_cg assets-cg/clouds/sky3.png assets-cg/backgrnd/mountain.png assets-cg/backgrnd/treeline.png + assets-cg/billboard/leftturn.png + assets-cg/billboard/rightturn.png + assets-cg/billboard/uphill.png + assets-cg/billboard/downhill.png ) fxconv_declare_assets(${ASSETS_cg} WITH_METADATA) diff --git a/CppOutRun.layout b/CppOutRun.layout index 7aa6b18..730afab 100644 --- a/CppOutRun.layout +++ b/CppOutRun.layout @@ -2,24 +2,34 @@ - + - + - + - + + + + + + + + + + + - + - + - + @@ -37,41 +47,26 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -79,17 +74,22 @@ - + - + - + - + - + + + + + + diff --git a/assets-cg/billboard/downhill.png b/assets-cg/billboard/downhill.png new file mode 100644 index 0000000..c62d1e0 Binary files /dev/null and b/assets-cg/billboard/downhill.png differ diff --git a/assets-cg/billboard/fxconv-metadata.txt b/assets-cg/billboard/fxconv-metadata.txt new file mode 100644 index 0000000..7e05b58 --- /dev/null +++ b/assets-cg/billboard/fxconv-metadata.txt @@ -0,0 +1,5 @@ +*.png: + type: bopti-image + profile: p4 + name_regex: (.*)\.png \1 + diff --git a/assets-cg/billboard/leftturn.png b/assets-cg/billboard/leftturn.png new file mode 100644 index 0000000..9086706 Binary files /dev/null and b/assets-cg/billboard/leftturn.png differ diff --git a/assets-cg/billboard/rightturn.png b/assets-cg/billboard/rightturn.png new file mode 100644 index 0000000..bf106bb Binary files /dev/null and b/assets-cg/billboard/rightturn.png differ diff --git a/assets-cg/billboard/uphill.png b/assets-cg/billboard/uphill.png new file mode 100644 index 0000000..43b1ecd Binary files /dev/null and b/assets-cg/billboard/uphill.png differ diff --git a/assets-cg/trees/tree1.png b/assets-cg/trees/tree1.png index 0d09464..deaa279 100644 Binary files a/assets-cg/trees/tree1.png and b/assets-cg/trees/tree1.png differ diff --git a/assets-cg/trees/tree2.png b/assets-cg/trees/tree2.png index f9c50af..7698a12 100644 Binary files a/assets-cg/trees/tree2.png and b/assets-cg/trees/tree2.png differ diff --git a/assets-cg/trees/tree3.png b/assets-cg/trees/tree3.png index 8f0e971..cf952a3 100644 Binary files a/assets-cg/trees/tree3.png and b/assets-cg/trees/tree3.png differ diff --git a/assets-cg/trees/tree4.png b/assets-cg/trees/tree4.png index 54ec506..89013db 100644 Binary files a/assets-cg/trees/tree4.png and b/assets-cg/trees/tree4.png differ diff --git a/assets-cg/trees/tree5.png b/assets-cg/trees/tree5.png index 7cdb96c..4438aaf 100644 Binary files a/assets-cg/trees/tree5.png and b/assets-cg/trees/tree5.png differ diff --git a/src/include/circuit.h b/src/include/circuit.h index 332d530..e8b04cf 100644 --- a/src/include/circuit.h +++ b/src/include/circuit.h @@ -47,11 +47,16 @@ enum Decoration OAKTREE = 2, CACTUS = 3, BIGLEAF = 4, - SMALLLEAF = 5 + SMALLLEAF = 5, + LEFTTURN = 6, + RIGHTTURN = 7, + UPHILL = 8, + DOWNHILL = 9 }; void initData( void ); void createCircuit( void ); +void putBillBoards( void ); void createClouds( void ); void createTraffic( void ); @@ -79,6 +84,7 @@ void prepareTraffic( void ); 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 ); diff --git a/src/main.cc b/src/main.cc index 80648d8..323a1d0 100644 --- a/src/main.cc +++ b/src/main.cc @@ -26,10 +26,11 @@ extern bopti_image_t car1, car2, car3, car4, car5, car6, car7, car8; extern bopti_image_t tree1, tree2, tree3, tree4, tree5, tree6; +extern bopti_image_t leftturn, rightturn, uphill, downhill; extern bopti_image_t player; extern bopti_image_t sky1, sky2, sky3; -extern bopti_image_t mountain; -extern bopti_image_t treeline; +extern bopti_image_t mountain, treeline; + std::vector circuit; @@ -256,6 +257,9 @@ int main(void) initData( ); // Positioning of the Camera createCircuit(); // Creates the circuit + + putBillBoards(); + createClouds(); // Creates the Sky and Clouds createTraffic(); // Creates the cas prepareDecoration(); // Prepares the multiple variations of Decoration (image scaling) diff --git a/src/parameters.h b/src/parameters.h index 0d435b5..20ca50f 100644 --- a/src/parameters.h +++ b/src/parameters.h @@ -22,7 +22,7 @@ #define NB_CARS_TRAFFIC 100 #define MAX_SUBIMAGES_TREES 12 -#define NB_TREES_TYPES 6 +#define NB_TREES_TYPES 10 #define MAX_SUBIMAGES_CARS 12 #define NB_CARS_TYPES 8 diff --git a/src/src/circuit.cc b/src/src/circuit.cc index 8893572..af7a8e6 100644 --- a/src/src/circuit.cc +++ b/src/src/circuit.cc @@ -30,6 +30,8 @@ extern bopti_image_t tree1, tree2, tree3, tree4, tree5, tree6; extern bopti_image_t sky1, sky2, sky3; extern bopti_image_t mountain; extern bopti_image_t treeline; +extern bopti_image_t leftturn, rightturn, uphill, downhill; + bopti_image_t *scaledTrees[NB_TREES_TYPES][MAX_SUBIMAGES_TREES] = { 0 }; bopti_image_t *scaledCars[NB_CARS_TYPES][MAX_SUBIMAGES_CARS] = { 0 }; @@ -147,7 +149,9 @@ void createCircuit( void ) */ addStraightLine( L_VERYSHORT, PLAINS ); + 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 ); //addStraightLine( L_VERYSHORT, PLAINS ); //addStraightLine( L_VERYSHORT, DESERT ); addCurve( L_SHORT, C_HARD, LEFT_CURVE, DESERT ); @@ -171,6 +175,73 @@ void createCircuit( void ) //addStraightLine( L_VERYLONG, DESERT ); }; +void putBillBoards( void ) +{ + + for (int k = 0; kCurve; + int currentcurve = circuit[k]->Curve; + int nextslope = circuit[k+3]->Slope; + int currentslope = circuit[k]->Slope; + + if (nextcurve==currentcurve && nextslope==currentslope) + { + // no turn and no hill + } + else if (nextcurve==currentcurve && nextslope!=currentslope) + { + // no turn but hill + if (nextslope>0) //uphill + { + circuit[k]->RDeco=UPHILL; + circuit[k]->LDeco=UPHILL; + } + else if (nextslope<0) //downhill + { + circuit[k]->RDeco=DOWNHILL; + circuit[k]->LDeco=DOWNHILL; + } + } + else if (nextcurve!=currentcurve && nextslope==currentslope) + { + // no turn but hill + if (nextcurve<0) //uphill + { + circuit[k]->RDeco=LEFTTURN; + circuit[k]->LDeco=LEFTTURN; + } + else if (nextcurve>0) //downhill + { + circuit[k]->RDeco=RIGHTTURN; + circuit[k]->LDeco=RIGHTTURN; + } + } + else if (nextcurve!=currentcurve && nextslope!=currentslope) + { + // no turn but hill + if (nextcurve<0) //uphill + { + circuit[k]->RDeco=LEFTTURN; + if (nextslope>0) circuit[k]->LDeco=UPHILL; + else if (nextslope<0) circuit[k]->LDeco=DOWNHILL; + } + else if (nextcurve>0) //downhill + { + circuit[k]->LDeco=RIGHTTURN; + if (nextslope>0) circuit[k]->RDeco=UPHILL; + else if (nextslope<0) circuit[k]->RDeco=DOWNHILL; + } + } + + + if (nextcurve<0 && currentcurve!=nextcurve) circuit[k]->RDeco=LEFTTURN; + if (nextcurve>0 && currentcurve!=nextcurve) circuit[k]->LDeco=RIGHTTURN; + } + +} + + void createClouds( void ) { @@ -317,6 +388,40 @@ 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 ) +{ + double lastZ=0; + int16_t lastY=0; + + uint16_t lastIndex = circuit.size(); + if (lastIndex!=0) + { + lastY=circuit[lastIndex-1]->wY; + lastZ=circuit[lastIndex-1]->wZ+SEGMENT_LENGTH; + } + + srand( rtc_ticks() ); + + for( int i=0; ienvironment = biome; + circuit.push_back( seg ); + } + } +} + + void projectCircuitFP( void ) { for( int i=0; iwidth * scale); int height = (int) ((float) src->height * scale);