corrected time stop during menus navigation + added finish sequence

master
Sylvain PILLOT 6 months ago
parent 1fa9ded3bc
commit bd3daee82a
  1. 110
      CppOutRun.layout
  2. 149
      src/main.cc
  3. 6
      src/src/menus.cc

@ -2,48 +2,29 @@
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Release" />
<File name="src/fixed.h" open="1" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5" topLine="0" />
</Cursor>
</File>
<File name="CMakeLists.txt" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2421" topLine="36" />
</Cursor>
</File>
<File name="src/include/cars.h" open="0" top="0" tabpos="4" 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="332" topLine="0" />
<Cursor1 position="637" topLine="0" />
</Cursor>
</File>
<File name="TODO.txt" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/parameters.h" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="251" topLine="0" />
<Cursor1 position="559" topLine="0" />
</Cursor>
</File>
<File name="src/src/circuit.cc" open="1" top="0" tabpos="2" 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="16984" topLine="496" />
<Cursor1 position="230" topLine="30" />
</Cursor>
<Folding>
<Collapse line="501" />
<Collapse line="517" />
<Collapse line="633" />
<Collapse line="1092" />
<Collapse line="1099" />
<Collapse line="1109" />
<Collapse line="1119" />
</Folding>
</File>
<File name="src/include/segment.h" open="0" top="0" tabpos="7" 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="210" topLine="0" />
<Cursor1 position="1019" topLine="8" />
</Cursor>
</File>
<File name="src/src/drawstuff.cc" open="1" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2487" topLine="18" />
<Cursor1 position="2603" topLine="18" />
</Cursor>
<Folding>
<Collapse line="9" />
@ -54,34 +35,51 @@
<Collapse line="126" />
</Folding>
</File>
<File name="src/src/segment.cc" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="2" zoom_2="0">
<File name="src/colors.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="230" topLine="30" />
<Cursor1 position="35" topLine="0" />
</Cursor>
</File>
<File name="src/include/circuit.h" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="CMakeLists.txt" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1291" topLine="57" />
<Cursor1 position="2421" topLine="36" />
</Cursor>
</File>
<File name="src/src/cars.cc" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/include/menus.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1019" topLine="8" />
<Cursor1 position="390" topLine="0" />
</Cursor>
</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">
<File name="src/src/circuit.cc" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="203" topLine="0" />
<Cursor1 position="21787" topLine="506" />
</Cursor>
<Folding>
<Collapse line="606" />
<Collapse line="622" />
<Collapse line="647" />
<Collapse line="657" />
<Collapse line="702" />
<Collapse line="738" />
<Collapse line="748" />
<Collapse line="795" />
<Collapse line="830" />
<Collapse line="868" />
<Collapse line="905" />
<Collapse line="1197" />
<Collapse line="1204" />
<Collapse line="1214" />
<Collapse line="1224" />
</Folding>
</File>
<File name="src/main.cc" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="15719" topLine="607" />
<Cursor1 position="18105" topLine="633" />
</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/include/clouds.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="221" topLine="0" />
<Cursor1 position="306" 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">
@ -89,34 +87,44 @@
<Cursor1 position="370" topLine="0" />
</Cursor>
</File>
<File name="src/src/menus.cc" open="1" top="0" tabpos="5" 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="20917" topLine="638" />
<Cursor1 position="251" topLine="0" />
</Cursor>
</File>
<File name="src/parameters.h" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/include/circuit.h" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="559" topLine="0" />
<Cursor1 position="1291" topLine="0" />
</Cursor>
</File>
<File name="src/include/menus.h" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<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="390" topLine="0" />
<Cursor1 position="203" topLine="0" />
</Cursor>
</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/fixed.h" open="1" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="637" topLine="0" />
<Cursor1 position="5" topLine="0" />
</Cursor>
</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/src/menus.cc" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="306" topLine="0" />
<Cursor1 position="20917" topLine="638" />
</Cursor>
</File>
<File name="src/colors.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/include/segment.h" open="1" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="35" topLine="0" />
<Cursor1 position="252" topLine="9" />
</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">
<Cursor>
<Cursor1 position="221" topLine="0" />
</Cursor>
</File>
<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="332" topLine="0" />
</Cursor>
</File>
</CodeBlocks_layout_file>

@ -145,27 +145,6 @@ void initEverything( void )
}
int my_profile(int key, int duration, int count)
{
// key: Key being repeated
// duration: How long that key has been pressed
// count: How many times it's been repeated already
// Return value: how long to wait before next repeat (\B5s)
// Only allow KEY_LEFT and KEY_RIGHT
if(key!=KEY_LEFT && key!=KEY_RIGHT && key!=KEY_DOWN && key!=KEY_UP && key!=KEY_ALPHA && key!=KEY_SHIFT)
return -1;
// 500 ms for first repeat, 50 ms after that; stop after 10 repeats
if(count == 0)
return 500*1000;
else
return -1;
}
static void get_inputs( float dt, int index )
{
CC = circuit[index]->Curve;
@ -184,8 +163,6 @@ static void get_inputs( float dt, int index )
{
viewside=-1;
//cam->decX( CC*dt*speed/100 );
if (CurrentCircuitBiome==FINLAND) cam->decX( CC*dt*speed/50 ); // very hard to turn in Finland with snow
else if (CurrentCircuitBiome==AFRICA) cam->decX( CC*dt*speed/75 ); // hard in Africa with dirt
else cam->decX( CC*dt*speed/100 ); // more easy on normal roads
@ -194,8 +171,6 @@ static void get_inputs( float dt, int index )
{
viewside=+1;
//cam->decX( CC*dt*speed/100 );
if (CurrentCircuitBiome==FINLAND) cam->decX( CC*dt*speed/50 ); // very hard to turn in Finland with snow
else if (CurrentCircuitBiome==AFRICA) cam->decX( CC*dt*speed/75 ); // hard in Africa with dirt
else cam->decX( CC*dt*speed/100 ); // more easy on normal roads
@ -203,7 +178,6 @@ static void get_inputs( float dt, int index )
if(keydown(KEY_LEFT))
{
//cam->decX(25.0);
cam->decX(5.0*speed*direction);
viewside=-1;
@ -213,7 +187,6 @@ static void get_inputs( float dt, int index )
if(keydown(KEY_RIGHT))
{
//cam->incX(25.0);
cam->incX(5.0*speed*direction);
viewside=1;
@ -266,39 +239,14 @@ static void get_inputs( float dt, int index )
if(keydown(KEY_OPTN)) drawOptions();
#if IS_FXLIB==1
if(keydown(KEY_XOT))
{
ShowDebug1 = false;
ShowDebug2 = false;
ShowDebug3 = false;
}
if(keydown(KEY_LOG))
{
ShowDebug1 = true;
ShowDebug2 = false;
ShowDebug3 = false;
}
if(keydown(KEY_LN))
{
ShowDebug1 = false;
ShowDebug2 = true;
ShowDebug3 = false;
}
if(keydown(KEY_SIN))
{
ShowDebug1 = false;
ShowDebug2 = false;
ShowDebug3 = true;
}
if(keydown(KEY_F1)) BDrawDeco = !BDrawDeco;
if(keydown(KEY_F2)) BDrawClds = !BDrawClds;
if(keydown(KEY_F3)) BDrawCars = !BDrawCars;
if(keydown(KEY_F4)) BDrawFPS = !BDrawFPS;
if(keydown(KEY_F5)) screenshot = true;
if(keydown(KEY_F6)) record = !record;
if(keydown(KEY_F4)) BDrawBack = !BDrawBack;
if(keydown(KEY_F5)) BDrawFPS = !BDrawFPS;
if(keydown(KEY_7)) screenshot = true;
if(keydown(KEY_8)) record = !record;
#endif // IS_FXLIB
if (speedcontrol==false)
@ -351,39 +299,14 @@ static void get_minimum_inputs( void )
if(keydown(KEY_OPTN)) drawOptions();
#if IS_FXLIB==1
if(keydown(KEY_XOT))
{
ShowDebug1 = false;
ShowDebug2 = false;
ShowDebug3 = false;
}
if(keydown(KEY_LOG))
{
ShowDebug1 = true;
ShowDebug2 = false;
ShowDebug3 = false;
}
if(keydown(KEY_LN))
{
ShowDebug1 = false;
ShowDebug2 = true;
ShowDebug3 = false;
}
if(keydown(KEY_SIN))
{
ShowDebug1 = false;
ShowDebug2 = false;
ShowDebug3 = true;
}
if(keydown(KEY_F1)) BDrawDeco = !BDrawDeco;
if(keydown(KEY_F2)) BDrawClds = !BDrawClds;
if(keydown(KEY_F3)) BDrawCars = !BDrawCars;
if(keydown(KEY_F4)) BDrawFPS = !BDrawFPS;
if(keydown(KEY_F5)) screenshot = true;
if(keydown(KEY_F6)) record = !record;
if(keydown(KEY_F4)) BDrawBack = !BDrawBack;
if(keydown(KEY_F5)) BDrawFPS = !BDrawFPS;
if(keydown(KEY_7)) screenshot = true;
if(keydown(KEY_8)) record = !record;
#endif // IS_FXLIB
}
@ -403,14 +326,19 @@ int main(void)
kmalloc_arena_t *_uram = kmalloc_get_arena("_uram");
kmalloc_gint_stats_t *_uram_stats;
srand( rtc_ticks() );
prof_init();
drawStartTitle();
char texttosend[1024];
//char texttosend[1024];
exitToOS = false;
do
@ -426,8 +354,8 @@ int main(void)
initEverything();
prof_t perf_update, perf_create, perf_project, perf_render;
int32_t start_time = 99000000;
uint32_t score=99999;
int32_t start_time = 100000000;
uint32_t score=0;
uint8_t stage=0;
int8_t selectedCircuit=0;
uint32_t time_update=0, time_create=0, time_project=0, time_render=0;
@ -437,6 +365,8 @@ int main(void)
stop = false;
bool exitflag = false;
do
{
exitflag = false;
@ -457,15 +387,13 @@ int main(void)
}
else if (stage==4)
{
// Exit Menu TO BE DONE
// quick and dirty
exitToOS = true;
exitflag=true;
}
}
while (!exitflag);
if (exitToOS==false)
if (!exitToOS)
{
stage = selectedCircuit;
@ -482,13 +410,14 @@ int main(void)
else CurrentCircuitBiome = PLAINS;
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
@ -538,12 +467,7 @@ int main(void)
{
perf_update = prof_make();
prof_enter(perf_update);
if (!initiateStart && !finishSequence && !failSequence) get_inputs( dt, indexstart ); // The racer is not started : no need to get inputs and we are not in fail or finish sequence
else get_minimum_inputs(); // the we can just have minimum inputs
//new position
if (!SkipTime)
{
dt = ((float) (time_update+time_render+time_project) / 1000.0);
@ -554,6 +478,16 @@ int main(void)
SkipTime=false;
}
perf_update = prof_make();
prof_enter(perf_update);
if (!initiateStart && !finishSequence && !failSequence) get_inputs( dt, indexstart ); // The racer is not started : no need to get inputs and we are not in fail or finish sequence
else get_minimum_inputs(); // the we can just have minimum inputs
//former position
if (initiateStart)
{
startCount -= dt*1000;
@ -703,8 +637,8 @@ int main(void)
}
else if (circuit[indexstart]->Special == FINISH && circuit[indexstart]->CheckValidated == false)
{
start_time+=60000000;
circuit[indexstart]->CheckValidated = true;
finishSequence=true;
}
else if (circuit[indexstart]->Special == START && circuit[indexstart]->CheckValidated == false)
{
@ -796,6 +730,19 @@ int main(void)
if (finishSequence)
{
dimage( 198-bigflag.width/2, 112-bigflag.height/2, &bigflag );
dfont(&startseq);
dprint_opt(200,108, C_RGB(0,0,0), C_NONE, DTEXT_CENTER, DTEXT_BOTTOM, "YOU" );
dprint_opt(198,112, C_RGB(0,255,0), C_NONE, DTEXT_CENTER, DTEXT_BOTTOM, "YOU" );
dprint_opt(200,108, C_RGB(0,0,0), C_NONE, DTEXT_CENTER, DTEXT_TOP, "WIN" );
dprint_opt(198,112, C_RGB(0,255,0), C_NONE, DTEXT_CENTER, DTEXT_TOP, "WIN" );
}
if (failSequence)
{
@ -804,10 +751,10 @@ int main(void)
dfont(&startseq);
dprint_opt(200,108, C_RGB(0,0,0), C_NONE, DTEXT_CENTER, DTEXT_BOTTOM, "YOU" );
dprint_opt(198,112, C_RGB(255,0,255), C_NONE, DTEXT_CENTER, DTEXT_BOTTOM, "YOU" );
dprint_opt(198,112, C_RGB(255,0,0), C_NONE, DTEXT_CENTER, DTEXT_BOTTOM, "YOU" );
dprint_opt(200,108, C_RGB(0,0,0), C_NONE, DTEXT_CENTER, DTEXT_TOP, "LOOSE" );
dprint_opt(198,112, C_RGB(255,0,255), C_NONE, DTEXT_CENTER, DTEXT_TOP, "LOOSE" );
dprint_opt(198,112, C_RGB(255,0,0), C_NONE, DTEXT_CENTER, DTEXT_TOP, "LOOSE" );
}

@ -56,7 +56,7 @@ void drawStartTitle( void )
dfont(&autofont);
dprint_opt(198, 2, C_RGB(255,255,255), C_NONE, DTEXT_CENTER, DTEXT_TOP, "OUTRUN FOR GRAPH90" );
dprint_opt(198, 2, C_RGB(255,255,255), C_NONE, DTEXT_CENTER, DTEXT_TOP, "OUTRUN FOR FX-CG50" );
dprint_opt(198, 222, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_CENTER, DTEXT_BOTTOM, "PRESS EXE TO START" );
@ -600,7 +600,7 @@ void drawOptions( void )
#endif
}
SkipTime = true;
SkipTime = true; // To avoid counting or de-counting time during menu
return;
}
@ -704,7 +704,7 @@ void drawPauseQuit( void )
#endif
}
SkipTime = true;
SkipTime = true; // To avoid counting or de-counting time during menu
return;
}

Loading…
Cancel
Save