diff --git a/assets-cg/fonts/speedfont.png b/assets-cg/fonts/speedfont.png index ba55baa..19686c1 100644 Binary files a/assets-cg/fonts/speedfont.png and b/assets-cg/fonts/speedfont.png differ diff --git a/assets-cg/hud/speedhud.png b/assets-cg/hud/speedhud.png index 9572aad..1f4da1b 100644 Binary files a/assets-cg/hud/speedhud.png and b/assets-cg/hud/speedhud.png differ diff --git a/src/main.cc b/src/main.cc index 97625ce..80da66a 100644 --- a/src/main.cc +++ b/src/main.cc @@ -73,6 +73,12 @@ bool OptionMode = false; bool PauseMode = false; bool SkipTime = false; +// for multilap +bool multilap = false; +uint8_t numlap = 1; +uint8_t currentLap = 1; + + uint16_t currentcurve=0; uint8_t shiftcolor=0; @@ -142,6 +148,10 @@ void initEverything( void ) CC=0; // current curve CS=0; + + multilap = false; + numlap = 1; + currentLap = 1; } @@ -397,17 +407,17 @@ int main(void) { 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; + if (selectedCircuit==0) CurrentCircuitBiome = PLAINS, multilap = false, currentLap = 1, numlap = 1; + else if (selectedCircuit==1) CurrentCircuitBiome = DESERT, multilap = false, currentLap = 1, numlap = 1; + else if (selectedCircuit==2) CurrentCircuitBiome = USA, multilap = false, currentLap = 1, numlap = 1; + else if (selectedCircuit==3) CurrentCircuitBiome = FINLAND, multilap = false, currentLap = 1, numlap = 1; + else if (selectedCircuit==4) CurrentCircuitBiome = AFRICA, multilap = false, currentLap = 1, numlap = 1; + else if (selectedCircuit==5) CurrentCircuitBiome = PLAINS, multilap = true, currentLap = 1, numlap = 3; + else if (selectedCircuit==6) CurrentCircuitBiome = DESERT, multilap = true, currentLap = 1, numlap = 3; + else if (selectedCircuit==7) CurrentCircuitBiome = USA, multilap = true, currentLap = 1, numlap = 3; + else if (selectedCircuit==8) CurrentCircuitBiome = FINLAND, multilap = true, currentLap = 1, numlap = 3; + else if (selectedCircuit==9) CurrentCircuitBiome = AFRICA, multilap = true, currentLap = 1, numlap = 3; + else CurrentCircuitBiome = PLAINS, multilap = false, currentLap = 1, numlap = 1; int nbInterestingSegments = (MAX_RENDER_DISTANCE / SEGMENT_LENGTH); // the number of segments to be projected considering the rendering distance @@ -500,13 +510,13 @@ int main(void) //-------------- if (fround(cam->cZ)<=0) cam->cZ=fixdouble(0.0); - if (fround(cam->cZ)>=maxDistance) cam->cZ=fixdouble(maxDistance); + //if (fround(cam->cZ)>=maxDistance) cam->cZ=fixdouble(maxDistance); 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; + //if (indexstart>MAX_SEGMENT-nbInterestingSegments-2) indexstart=MAX_SEGMENT-nbInterestingSegments-2; prof_leave(perf_update); @@ -637,8 +647,17 @@ int main(void) } else if (circuit[indexstart]->Special == FINISH && circuit[indexstart]->CheckValidated == false) { - circuit[indexstart]->CheckValidated = true; - finishSequence=true; + if (currentLapdecZ( indexstart*SEGMENT_LENGTH ); + for( unsigned int k=0; kwZ-=indexstart*SEGMENT_LENGTH; + } + else + { + circuit[indexstart]->CheckValidated = true; + finishSequence=true; + } } else if (circuit[indexstart]->Special == START && circuit[indexstart]->CheckValidated == false) { @@ -709,7 +728,7 @@ int main(void) } 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(231,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" @@ -718,6 +737,15 @@ int main(void) dprint_opt(388,21, C_RGB(255,255,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%.3D", stage ); // the ';' char corresponds to "s" + if (multilap) + { + dsubimage( 135, 25, &speedhud, 28, 143, 27, 13, DIMAGE_NONE); // Lap logo + + dprint_opt(233,23, C_RGB(0,0,0), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%d/%d", currentLap, numlap ); + dprint_opt(231,21, C_RGB(255,0,255), C_NONE, DTEXT_RIGHT, DTEXT_TOP, "%d/%d", currentLap, numlap ); // 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); @@ -732,6 +760,8 @@ int main(void) if (finishSequence) { + speed = 0; + dimage( 198-bigflag.width/2, 112-bigflag.height/2, &bigflag ); dfont(&startseq); @@ -746,6 +776,8 @@ int main(void) if (failSequence) { + speed = 0; + dimage( 198-bigflag.width/2, 112-bigflag.height/2, &bigflag ); dfont(&startseq); diff --git a/src/src/circuit.cc b/src/src/circuit.cc index df6f2eb..9395263 100644 --- a/src/src/circuit.cc +++ b/src/src/circuit.cc @@ -290,29 +290,11 @@ void createCircuit( int circuitNumber ) } if (circuitNumber==5) { + addStraightLine( L_VERYSHORT, PLAINS ); 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 ); }