diff --git a/CMakeLists.txt b/CMakeLists.txt
index c4a6318..840f4d8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,7 @@ set(SOURCES
src/src/camera.cc
src/src/circuit.cc
src/src/drawstuff.cc
+ src/src/clouds.cc
# ...
)
@@ -31,6 +32,9 @@ set(ASSETS_cg
assets-cg/trees/tree2.png
assets-cg/trees/tree3.png
assets-cg/player/player.png
+ assets-cg/clouds/sky1.png
+ assets-cg/clouds/sky2.png
+ assets-cg/clouds/sky3.png
)
fxconv_declare_assets(${ASSETS_cg} WITH_METADATA)
diff --git a/CppOutRun.cbp b/CppOutRun.cbp
index 259bbe9..70e132b 100644
--- a/CppOutRun.cbp
+++ b/CppOutRun.cbp
@@ -31,12 +31,14 @@
+
+
diff --git a/CppOutRun.layout b/CppOutRun.layout
index c7a55ba..ad57dc2 100644
--- a/CppOutRun.layout
+++ b/CppOutRun.layout
@@ -2,29 +2,14 @@
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -32,9 +17,14 @@
-
+
-
+
+
+
+
+
+
@@ -42,9 +32,19 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
@@ -52,9 +52,14 @@
+
+
+
+
+
-
+
diff --git a/assets-cg/clouds/fxconv-metadata.txt b/assets-cg/clouds/fxconv-metadata.txt
new file mode 100644
index 0000000..7e05b58
--- /dev/null
+++ b/assets-cg/clouds/fxconv-metadata.txt
@@ -0,0 +1,5 @@
+*.png:
+ type: bopti-image
+ profile: p4
+ name_regex: (.*)\.png \1
+
diff --git a/assets-cg/clouds/sky1.png b/assets-cg/clouds/sky1.png
new file mode 100755
index 0000000..3228d27
Binary files /dev/null and b/assets-cg/clouds/sky1.png differ
diff --git a/assets-cg/clouds/sky2.png b/assets-cg/clouds/sky2.png
new file mode 100755
index 0000000..021f5da
Binary files /dev/null and b/assets-cg/clouds/sky2.png differ
diff --git a/assets-cg/clouds/sky3.png b/assets-cg/clouds/sky3.png
new file mode 100755
index 0000000..3204044
Binary files /dev/null and b/assets-cg/clouds/sky3.png differ
diff --git a/src/include/circuit.h b/src/include/circuit.h
index 4db76b2..752ac86 100644
--- a/src/include/circuit.h
+++ b/src/include/circuit.h
@@ -45,6 +45,7 @@ enum Decoration
void initData( void );
void createCircuit( void );
+void createClouds( void );
void projectCircuitFP( void );
void projectCircuitFP( uint16_t index );
@@ -54,6 +55,7 @@ void printCircuit( int i );
void drawCircuitSegment( uint16_t index );
void drawDecoration( uint16_t index );
+void drawClouds( int offset );
void freeDecoration( void );
void prepareDecoration( void );
diff --git a/src/include/clouds.h b/src/include/clouds.h
new file mode 100644
index 0000000..1f8158a
--- /dev/null
+++ b/src/include/clouds.h
@@ -0,0 +1,27 @@
+#ifndef CLOUDS_H
+#define CLOUDS_H
+
+#include
+
+
+enum CloudType
+{
+ SMALLCLOUD = 0,
+ MEDIUMCLOUD = 1,
+ BIGCLOUD = 2
+};
+
+
+class Clouds
+{
+ public:
+ Clouds();
+ Clouds( int16_t x, int16_t y, int8_t t );
+ ~Clouds();
+
+ int16_t X;
+ int16_t Y;
+ int8_t type;
+};
+
+#endif // CLOUDS_H
diff --git a/src/main.cc b/src/main.cc
index 378afdc..09e3fa7 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -12,7 +12,6 @@
#include
#include
-#include
#include "include/camera.h"
@@ -20,18 +19,20 @@
#include "parameters.h"
#include "include/circuit.h"
#include "include/drawstuff.h"
-
+#include "include/clouds.h"
extern bopti_image_t car1, car2, car3, car4, car5, car6, car7, car8;
extern bopti_image_t tree1, tree2, tree3;
extern bopti_image_t player;
+extern bopti_image_t sky1, sky2, sky3;
std::vector circuit;
int MAX_SEGMENT=0;
camera *cam;
+std::vector nuages;
bool stop = false;
@@ -158,6 +159,7 @@ int main(void)
prof_enter(perf_create);
createCircuit();
+ createClouds();
prepareDecoration();
prof_leave(perf_create);
@@ -217,6 +219,7 @@ int main(void)
prof_enter(perf_render);
drawSky( );
+ drawClouds( l % 396 );
cam->cY = fix( 300 ) + interpolatePositionY(fround(cam->cZ));
@@ -233,7 +236,7 @@ int main(void)
{
Segment* currentSeg = circuit[indexstart];
- dprint( 1, 1, C_RED, "Cra=%.3D ms", time_create );
+ 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 );
@@ -258,7 +261,7 @@ int main(void)
}
if (ShowDebug2)
{
- dprint( 1, 1, C_RED, "Cra=%.3D ms", time_create );
+ 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 );
@@ -266,12 +269,18 @@ int main(void)
{
dprint( 100, 1+10*k-indexstart, C_WHITE, "S[%d]=%d", k, circuit[k]->DScale );
}
+
+ for( int k=0; kX, nuages[k]->Y, nuages[k]->type );
+ }
+
}
dsubimage( SCREEN_CX-36, SCREEN_HEIGHT-48, &player, 257,1,72,46, DIMAGE_NONE);
- //dupdate();
- r61524_display(gint_vram, 0, DHEIGHT, R61524_DMA_WAIT);
+ dupdate();
+ //r61524_display(gint_vram, 0, DHEIGHT, R61524_DMA_WAIT);
prof_leave(perf_render);
@@ -296,6 +305,7 @@ int main(void)
circuit.clear();
+ nuages.clear();
delete cam;
freeDecoration();
diff --git a/src/src/circuit.cc b/src/src/circuit.cc
index 8d34929..7a5fe64 100644
--- a/src/src/circuit.cc
+++ b/src/src/circuit.cc
@@ -1,13 +1,18 @@
#include "../include/circuit.h"
#include "../include/segment.h"
#include "../include/camera.h"
+#include "../include/clouds.h"
#include "../parameters.h"
+
#include
+#include
+#include
#include "../include/drawstuff.h"
extern std::vector circuit;
+extern std::vector nuages;
extern camera *cam;
extern uint16_t currentcurve;
extern uint8_t shiftcolor;
@@ -17,6 +22,7 @@ extern bool ShowDebug1;
extern bopti_image_t car1, car2, car3, car4, car5, car6, car7, car8;
extern bopti_image_t tree1, tree2, tree3;
+extern bopti_image_t sky1, sky2, sky3;
bopti_image_t *scaledTrees[3][25] = { 0 };
@@ -140,11 +146,48 @@ void createCircuit( void )
addStraightLine( L_VERYSHORT );
addCurve( L_SHORT, C_EASY, LEFT_CURVE );
addHill( L_MEDIUM, H_BIG, UP_HILL );
+ addHill( L_MEDIUM, H_BIG, DOWN_HILL );
addCurve( L_SHORT, C_HARD, RIGHT_CURVE );
- addStraightLine( L_LONG );
+ addStraightLine( L_VERYLONG );
+ addCurve( L_SHORT, C_HARD, LEFT_CURVE );
+ addStraightLine( L_VERYLONG );
+ addCurve( L_SHORT, C_EASY, LEFT_CURVE );
+ addHill( L_MEDIUM, H_BIG, UP_HILL );
+ addHill( L_MEDIUM, H_BIG, DOWN_HILL );
+ addCurve( L_SHORT, C_HARD, RIGHT_CURVE );
+ addStraightLine( L_VERYLONG );
+ addCurve( L_SHORT, C_HARD, LEFT_CURVE );
+ addHill( L_MEDIUM, H_BIG, UP_HILL );
+ addHill( L_MEDIUM, H_BIG, DOWN_HILL );
+ addCurve( L_SHORT, C_HARD, RIGHT_CURVE );
+ addStraightLine( L_VERYLONG );
+ addCurve( L_SHORT, C_HARD, LEFT_CURVE );
+ addStraightLine( L_VERYLONG );
+ addCurve( L_SHORT, C_EASY, LEFT_CURVE );
+ addHill( L_MEDIUM, H_BIG, UP_HILL );
+ addHill( L_MEDIUM, H_BIG, DOWN_HILL );
+ addCurve( L_SHORT, C_HARD, RIGHT_CURVE );
+ addStraightLine( L_VERYLONG );
+ addCurve( L_SHORT, C_HARD, LEFT_CURVE );
};
+void createClouds( void )
+{
+ srand( rtc_ticks() );
+
+ for( int k = 0; k < 10; k++)
+ {
+ int X = (rand() % 1188) - 396;
+ int Y = rand() % 80;
+ int T = rand() % 3;
+
+ Clouds* cl=new Clouds( X, Y, T );
+ if (cl!=nullptr) nuages.push_back( cl );
+ }
+}
+
+
void addStraightLine( Length l )
{
double lastZ=0;
@@ -156,10 +199,19 @@ void addStraightLine( Length l )
lastZ=circuit[circuit.size()-1]->wZ;
}
+ srand( rtc_ticks() );
+
for( int i=0; iwY;
lastZ=circuit[circuit.size()-1]->wZ;
}
+ srand( rtc_ticks() );
for( int i=0; iwY;
lastZ=circuit[circuit.size()-1]->wZ;
}
+ srand( rtc_ticks() );
for( int i=0; iwidth * scale);
int height = (int) ((float) src->height * scale);
scaledTrees[k][i] = resize(src, width, height);
- scale*=0.85f;
+ //scale*=0.85f;
}
}
}
@@ -399,3 +469,18 @@ void drawDecoration( uint16_t index )
dimage( X, Y, image );
}
}
+
+
+void drawClouds( int offset )
+{
+ bopti_image_t *cloud;
+
+ for( int k =0; ktype==0) cloud=&sky1;
+ else if (nuages[k]->type==1) cloud=&sky2;
+ else if (nuages[k]->type==2) cloud=&sky3;
+
+ dimage( nuages[k]->X-offset, nuages[k]->Y, cloud );
+ }
+}
diff --git a/src/src/clouds.cc b/src/src/clouds.cc
new file mode 100644
index 0000000..e05a1f4
--- /dev/null
+++ b/src/src/clouds.cc
@@ -0,0 +1,20 @@
+#include "../include/clouds.h"
+#include "../parameters.h"
+
+Clouds::Clouds()
+{
+ //ctor
+}
+
+Clouds::~Clouds()
+{
+ //dtor
+}
+
+Clouds::Clouds( int16_t x, int16_t y, int8_t t )
+{
+
+ X = x;
+ Y = y;
+ type = t;
+}
diff --git a/src/src/drawstuff.cc b/src/src/drawstuff.cc
index b553983..c934ba9 100644
--- a/src/src/drawstuff.cc
+++ b/src/src/drawstuff.cc
@@ -74,3 +74,4 @@ void drawSky( int ymin, int ymax )
for(int y=ymin; y<=ymax; y++ )
gint_dhline( 0, SCREEN_WIDTH, y, color );
};
+