diff --git a/CMakeLists.txt b/CMakeLists.txt index 24f1080..bec66d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,7 +89,8 @@ set(ASSETS_cg assets-cg/fonts/auto15.png assets-cg/fonts/auto20.png assets-cg/fonts/startseq.png - + assets-cg/fonts/plate5.png + assets-cg/menus/flag.png assets-cg/menus/bigflag.png diff --git a/CppOutRun.layout b/CppOutRun.layout index 569985a..a9737d0 100644 --- a/CppOutRun.layout +++ b/CppOutRun.layout @@ -2,14 +2,34 @@ - + - + - + - + + + + + + + + + + + + + + + + + + + + + @@ -17,9 +37,19 @@ - + - + + + + + + + + + + + @@ -35,14 +65,9 @@ - + - - - - - - + @@ -52,54 +77,34 @@ - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + - - - - - - + @@ -107,24 +112,19 @@ - - - - - - - - - - + + + + + diff --git a/assets-cg/fonts/__pycache__/make_grid.cpython-38.pyc b/assets-cg/fonts/__pycache__/make_grid.cpython-38.pyc new file mode 100644 index 0000000..bf95efa Binary files /dev/null and b/assets-cg/fonts/__pycache__/make_grid.cpython-38.pyc differ diff --git a/assets-cg/fonts/createfont.py b/assets-cg/fonts/createfont.py index cdb3342..dfe9189 100644 --- a/assets-cg/fonts/createfont.py +++ b/assets-cg/fonts/createfont.py @@ -1,3 +1,3 @@ from make_grid import * -make_grid(16, 18) +make_grid(5, 5) diff --git a/assets-cg/fonts/fxconv-metadata.txt b/assets-cg/fonts/fxconv-metadata.txt index e1a48d7..fc01d05 100644 --- a/assets-cg/fonts/fxconv-metadata.txt +++ b/assets-cg/fonts/fxconv-metadata.txt @@ -26,3 +26,13 @@ startseq.png: charset: print grid.size: 70x93 +plate5.png: + name: plate + type: font + charset: print + grid.size: 5x5 + grid.padding: 1 + grid.border: 0 + proportional: true + height: 5 + diff --git a/assets-cg/fonts/plate5.png b/assets-cg/fonts/plate5.png new file mode 100644 index 0000000..9074029 Binary files /dev/null and b/assets-cg/fonts/plate5.png differ diff --git a/assets-cg/fonts/speedfont.png b/assets-cg/fonts/speedfont.png index 19686c1..38f7f32 100644 Binary files a/assets-cg/fonts/speedfont.png and b/assets-cg/fonts/speedfont.png differ diff --git a/assets-cg/player/player.png b/assets-cg/player/player.png index a6690fb..7d2d56e 100644 Binary files a/assets-cg/player/player.png and b/assets-cg/player/player.png differ diff --git a/src/include/drawstuff.h b/src/include/drawstuff.h index a4457e2..bdccf73 100644 --- a/src/include/drawstuff.h +++ b/src/include/drawstuff.h @@ -13,3 +13,4 @@ void drawSky( uint8_t R, uint8_t G, uint8_t B ); void drawSky( int ymin, int ymax ); void drawSkyOptimised( uint16_t color ); +void drawSkyQuick( uint16_t color ); diff --git a/src/include/menus.h b/src/include/menus.h index 01c0849..ed92351 100644 --- a/src/include/menus.h +++ b/src/include/menus.h @@ -17,6 +17,8 @@ void getInputCredit( void ); void drawOptions( void ); void getInputOptions( void ); +void drawGameOptions( void ); +void getInputGameOptions( void ); void drawPauseQuit( void ); void getInputPauseQuit( void ); diff --git a/src/main.cc b/src/main.cc index 80da66a..0f45add 100644 --- a/src/main.cc +++ b/src/main.cc @@ -29,7 +29,7 @@ #include extern bopti_image_t player; -extern font_t speedfont, startseq; +extern font_t speedfont, startseq, plate; extern bopti_image_t speedhud; extern bopti_image_t flag, bigflag; @@ -42,6 +42,10 @@ int MAX_SEGMENT=0; camera *cam; +uint8_t DiffLevel = 1; +uint8_t CarsNumb = 1; +char PlayerName[3] = "SLY"; + struct DataPerf { uint8_t update=0; @@ -389,13 +393,17 @@ int main(void) } else if (stage==2) { - drawOptions(); + drawGameOptions(); } else if (stage==3) { - drawCredit(); + drawOptions(); } else if (stage==4) + { + drawCredit(); + } + else if (stage==5) { exitToOS = true; exitflag=true; @@ -603,7 +611,8 @@ int main(void) //if (BDrawBack) drawSkyOptimised( DAY_BLUE_SKY ); //else drawSkyFull( DAY_BLUE_SKY ); - drawSkyFull( DAY_BLUE_SKY ); + //drawSkyFull( DAY_BLUE_SKY ); + drawSkyQuick( DAY_BLUE_SKY ); if (BDrawClds) @@ -702,6 +711,12 @@ int main(void) else if (viewside==2) dsubimage( SCREEN_CX-40, SCREEN_HEIGHT-46, &player, 407,49,80,46, DIMAGE_NONE); } + dfont(&plate); + if (viewside==-2) dprint_opt( 205, 203, C_WHITE, C_BLACK, DTEXT_CENTER, DTEXT_CENTER, "%c%c%c", PlayerName[0], PlayerName[1], PlayerName[2] ); + else if (viewside==-1) dprint_opt( 202, 203, C_WHITE, C_BLACK, DTEXT_CENTER, DTEXT_CENTER, "%c%c%c", PlayerName[0], PlayerName[1], PlayerName[2] ); + else if (viewside==0) dprint_opt( 197, 203, C_WHITE, C_BLACK, DTEXT_CENTER, DTEXT_CENTER, "%c%c%c", PlayerName[0], PlayerName[1], PlayerName[2] ); + else if (viewside==1) dprint_opt( 193, 203, C_WHITE, C_BLACK, DTEXT_CENTER, DTEXT_CENTER, "%c%c%c", PlayerName[0], PlayerName[1], PlayerName[2] ); + else if (viewside==2) dprint_opt( 189, 203, C_WHITE, C_BLACK, DTEXT_CENTER, DTEXT_CENTER, "%c%c%c", PlayerName[0], PlayerName[1], PlayerName[2] ); score = fround(cam->cZ)/100; diff --git a/src/src/drawstuff.cc b/src/src/drawstuff.cc index 414354a..2f589ff 100644 --- a/src/src/drawstuff.cc +++ b/src/src/drawstuff.cc @@ -117,6 +117,11 @@ void drawSkyOptimised( uint16_t color ) dma_memset(gint_vram, (color << 16) | color, 396 * (minYRoad+2) * 2); }; +void drawSkyQuick( uint16_t color ) +{ + dma_memset(gint_vram, (color << 16) | color, 396 * 150 * 2); +}; + void drawSky( uint8_t R, uint8_t G, uint8_t B ) { dclear( C_RGB(R,G,B) ); diff --git a/src/src/menus.cc b/src/src/menus.cc index 74a93f7..2dca4ca 100644 --- a/src/src/menus.cc +++ b/src/src/menus.cc @@ -10,7 +10,7 @@ extern bopti_image_t mainscreen; extern bopti_image_t africa1, desert1, finland1, plains1, usa1; extern bopti_image_t flag, linear, circular; -extern font_t autofont, autofontsmall; +extern font_t autofont, autofontsmall, speedfont; extern bool record; extern bool screenshot; @@ -29,6 +29,9 @@ bool doneMenuCredit = false; bool doneOptions = false; uint8_t OptionsSelection=0; +bool doneGameOptions = false; +uint8_t GameOptionsSelection=0; + bool donePauseQuit = false; uint8_t PauseQuitSelection=0; @@ -42,6 +45,11 @@ extern bool exitToOS; extern bool stop; extern bool SkipTime; +extern uint8_t DiffLevel; +extern uint8_t CarsNumb; +extern char PlayerName[3]; +bool nameCurrentlyWritten = false; +uint8_t selectedChar=0; void drawStartTitle( void ) @@ -123,27 +131,31 @@ int drawMainMenu( void ) dfont(&autofont); - dprint_opt(102, 22, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "ARCADE GAME" ); - if (MainMenuSelection!=0) dprint_opt(100, 20, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "ARCADE GAME" ); - else dprint_opt(100, 20, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "ARCADE GAME" ); + dprint_opt(94, 22, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "ARCADE GAME" ); + if (MainMenuSelection!=0) dprint_opt(92, 20, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "ARCADE GAME" ); + else dprint_opt(92, 20, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "ARCADE GAME" ); - dprint_opt(102, 62, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "TIME ATTACK" ); - if (MainMenuSelection!=1) dprint_opt(100, 60, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "TIME ATTACK" ); - else dprint_opt(100, 60, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "TIME ATTACK" ); + dprint_opt(94, 52, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "TIME ATTACK" ); + if (MainMenuSelection!=1) dprint_opt(92, 50, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "TIME ATTACK" ); + else dprint_opt(92, 50, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "TIME ATTACK" ); - dprint_opt(102, 102, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPTIONS" ); - if (MainMenuSelection!=2) dprint_opt(100, 100, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPTIONS" ); - else dprint_opt(100, 100, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPTIONS" ); + dprint_opt(94, 82, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "GAME OPTIONS" ); + if (MainMenuSelection!=2) dprint_opt(92, 80, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "GAME OPTIONS" ); + else dprint_opt(92, 80, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "GAME OPTIONS" ); - dprint_opt(102, 142, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CREDITS" ); - if (MainMenuSelection!=3) dprint_opt(100, 140, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CREDITS" ); - else dprint_opt(100, 140, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CREDITS" ); + dprint_opt(94, 112, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "VISUAL OPTIONS" ); + if (MainMenuSelection!=3) dprint_opt(92, 110, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "VISUAL OPTIONS" ); + else dprint_opt(92, 110, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "VISUAL OPTIONS" ); - dprint_opt(102, 182, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "QUIT TO OS" ); - if (MainMenuSelection!=4) dprint_opt(100, 180, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "QUIT TO OS" ); - else dprint_opt(100, 180, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "QUIT TO OS" ); + dprint_opt(94, 142, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CREDITS" ); + if (MainMenuSelection!=4) dprint_opt(92, 140, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CREDITS" ); + else dprint_opt(92, 140, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CREDITS" ); - dimage( 10, 10+40*MainMenuSelection, &flag ); + dprint_opt(94, 172, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "QUIT TO OS" ); + if (MainMenuSelection!=5) dprint_opt(92, 170, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "QUIT TO OS" ); + else dprint_opt(92, 170, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "QUIT TO OS" ); + + dimage( 2, 10+30*MainMenuSelection, &flag ); // CODE HERE TO PRINT WELCOME MENU @@ -186,13 +198,13 @@ void getInputMainMenu( void ) if (key==KEY_UP) { - if (MainMenuSelection==0) MainMenuSelection=4; + if (MainMenuSelection==0) MainMenuSelection=5; else MainMenuSelection--; } if (key==KEY_DOWN) { - if (MainMenuSelection==4) MainMenuSelection=0; + if (MainMenuSelection==5) MainMenuSelection=0; else MainMenuSelection++; } #if IS_FXLIB==1 @@ -507,77 +519,77 @@ void drawOptions( void ) if (BDrawDeco) { - dprint_opt(102, 22, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "SCENERY [Y]" ); - if (OptionsSelection!=0) dprint_opt(100, 20, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "SCENERY [Y]" ); - else dprint_opt(100, 20, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "SCENERY [Y]" ); + dprint_opt(94, 22, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "SCENERY [Y]" ); + if (OptionsSelection!=0) dprint_opt(92, 20, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "SCENERY [Y]" ); + else dprint_opt(92, 20, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "SCENERY [Y]" ); } else { - dprint_opt(102, 22, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "SCENERY [N]" ); - if (OptionsSelection!=0) dprint_opt(100, 20, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "SCENERY [N]" ); - else dprint_opt(100, 20, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "SCENERY [N]" ); + dprint_opt(94, 22, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "SCENERY [N]" ); + if (OptionsSelection!=0) dprint_opt(92, 20, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "SCENERY [N]" ); + else dprint_opt(92, 20, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "SCENERY [N]" ); } if (BDrawCars) { - dprint_opt(102, 52, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPPONENTS [Y]" ); - if (OptionsSelection!=1) dprint_opt(100, 50, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPPONENTS [Y]" ); - else dprint_opt(100, 50, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPPONENTS [Y]" ); + dprint_opt(94, 52, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPPONENTS [Y]" ); + if (OptionsSelection!=1) dprint_opt(92, 50, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPPONENTS [Y]" ); + else dprint_opt(92, 50, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPPONENTS [Y]" ); } else { - dprint_opt(102, 52, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPPONENTS [N]" ); - if (OptionsSelection!=1) dprint_opt(100, 50, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPPONENTS [N]" ); - else dprint_opt(100, 50, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPPONENTS [N]" ); + dprint_opt(94, 52, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPPONENTS [N]" ); + if (OptionsSelection!=1) dprint_opt(92, 50, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPPONENTS [N]" ); + else dprint_opt(92, 50, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "OPPONENTS [N]" ); } if (BDrawClds) { - dprint_opt(102, 82, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CLOUDS [Y]" ); - if (OptionsSelection!=2) dprint_opt(100, 80, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CLOUDS [Y]" ); - else dprint_opt(100, 80, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CLOUDS [Y]" ); + dprint_opt(94, 82, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CLOUDS [Y]" ); + if (OptionsSelection!=2) dprint_opt(92, 80, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CLOUDS [Y]" ); + else dprint_opt(92, 80, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CLOUDS [Y]" ); } else { - dprint_opt(102, 82, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CLOUDS [N]" ); - if (OptionsSelection!=2) dprint_opt(100, 80, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CLOUDS [N]" ); - else dprint_opt(100, 80, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CLOUDS [N]" ); + dprint_opt(94, 82, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CLOUDS [N]" ); + if (OptionsSelection!=2) dprint_opt(92, 80, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CLOUDS [N]" ); + else dprint_opt(92, 80, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CLOUDS [N]" ); } if (BDrawBack) { - dprint_opt(102, 112, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACKGROUND [Y]" ); - if (OptionsSelection!=3) dprint_opt(100, 110, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACKGROUND [Y]" ); - else dprint_opt(100, 110, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACKGROUND [Y]" ); + dprint_opt(94, 112, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACKGROUND [Y]" ); + if (OptionsSelection!=3) dprint_opt(92, 110, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACKGROUND [Y]" ); + else dprint_opt(92, 110, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACKGROUND [Y]" ); } else { - dprint_opt(102, 112, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACKGROUND [N]" ); - if (OptionsSelection!=3) dprint_opt(100, 110, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACKGROUND [N]" ); - else dprint_opt(100, 110, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACKGROUND [N]" ); + dprint_opt(94, 112, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACKGROUND [N]" ); + if (OptionsSelection!=3) dprint_opt(92, 110, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACKGROUND [N]" ); + else dprint_opt(92, 110, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACKGROUND [N]" ); } if (BDrawFPS) { - dprint_opt(102, 142, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "STATS-FPS [Y]" ); - if (OptionsSelection!=4) dprint_opt(100, 140, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "STATS-FPS [Y]" ); - else dprint_opt(100, 140, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "STATS-FPS [Y]" ); + dprint_opt(94, 142, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "STATS-FPS [Y]" ); + if (OptionsSelection!=4) dprint_opt(92, 140, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "STATS-FPS [Y]" ); + else dprint_opt(92, 140, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "STATS-FPS [Y]" ); } else { - dprint_opt(102, 142, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "STATS-FPS [N]" ); - if (OptionsSelection!=4) dprint_opt(100, 140, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "STATS-FPS [N]" ); - else dprint_opt(100, 140, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "STATS-FPS [N]" ); + dprint_opt(94, 142, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "STATS-FPS [N]" ); + if (OptionsSelection!=4) dprint_opt(92, 140, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "STATS-FPS [N]" ); + else dprint_opt(92, 140, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "STATS-FPS [N]" ); } - dprint_opt(102, 172, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACK TO GAME" ); - if (OptionsSelection!=5) dprint_opt(100, 170, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACK TO GAME" ); - else dprint_opt(100, 170, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACK TO GAME" ); + dprint_opt(94, 172, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACK TO GAME" ); + if (OptionsSelection!=5) dprint_opt(92, 170, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACK TO GAME" ); + else dprint_opt(92, 170, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACK TO GAME" ); - dimage( 10, 5+30*OptionsSelection, &flag ); + dimage( 2, 5+30*OptionsSelection, &flag ); // CODE HERE TO PRINT WELCOME MENU @@ -647,6 +659,211 @@ void getInputOptions( void ) + +void drawGameOptions( void ) +{ + uint16_t pulse=0; + doneGameOptions = false; + + GameOptionsSelection=0; + selectedChar = 0; + + while (!doneGameOptions) + { + + dclear(0x0000); + dimage( 0, 0, &mainscreen); + + dfont(&autofont); + + if (DiffLevel==0) + { + dprint_opt(94, 22, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "LVL " ); + if (GameOptionsSelection!=0) dprint_opt(92, 20, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "LVL " ); + else dprint_opt(92, 20, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "LVL " ); + } + else if (DiffLevel==1) + { + dprint_opt(94, 22, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "LVL " ); + if (GameOptionsSelection!=0) dprint_opt(92, 20, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "LVL " ); + else dprint_opt(92, 20, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "LVL " ); + } + else if (DiffLevel==2) + { + dprint_opt(94, 22, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "LVL " ); + if (GameOptionsSelection!=0) dprint_opt(92, 20, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "LVL " ); + else dprint_opt(92, 20, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "LVL " ); + } + + + if (CarsNumb==0) + { + dprint_opt(94, 52, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CARS <50>" ); + if (GameOptionsSelection!=1) dprint_opt(92, 50, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CARS <50>" ); + else dprint_opt(92, 50, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CARS <50>" ); + } + else if (CarsNumb==1) + { + dprint_opt(94, 52, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CARS <100>" ); + if (GameOptionsSelection!=1) dprint_opt(92, 50, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CARS <100>" ); + else dprint_opt(92, 50, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CARS <100>" ); + } + else if (CarsNumb==2) + { + dprint_opt(94, 52, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CARS <200>" ); + if (GameOptionsSelection!=1) dprint_opt(92, 50, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CARS <200>" ); + else dprint_opt(92, 50, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "CARS <200>" ); + } + + dprint_opt(94, 82, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "PLAYER" ); + dprint_opt(92, 80, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "PLAYER" ); + + + dprint_opt(124, 112, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "%c", PlayerName[0] ); + if (GameOptionsSelection!=2 || selectedChar!=0) dprint_opt(122, 110, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "%c", PlayerName[0] ); + else if (GameOptionsSelection==2 && selectedChar==0) dprint_opt(122, 110, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "%c", PlayerName[0] ); + + dprint_opt(154, 112, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "%c", PlayerName[1] ); + if (GameOptionsSelection!=2 || selectedChar!=1) dprint_opt(152, 110, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "%c", PlayerName[1] ); + else if (GameOptionsSelection==2 && selectedChar==1) dprint_opt(152, 110, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "%c", PlayerName[1] ); + + dprint_opt(184, 112, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "%c", PlayerName[2] ); + if (GameOptionsSelection!=2 || selectedChar!=2) dprint_opt(182, 110, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "%c", PlayerName[2] ); + else if (GameOptionsSelection==2 && selectedChar==2) dprint_opt(182, 110, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "%c", PlayerName[2] ); + + dfont(&speedfont); + dprint_opt(214, 112, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "@" ); + if (GameOptionsSelection!=2 || selectedChar!=3) dprint_opt(212, 110, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "@" ); + else if (GameOptionsSelection==2 && selectedChar==3) dprint_opt(212, 110, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "@" ); + + dfont(&autofont); + dprint_opt(94, 172, C_RGB(0,0,0), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACK TO GAME" ); + if (GameOptionsSelection!=3) dprint_opt(92, 170, C_RGB(255,255,255), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACK TO GAME" ); + else dprint_opt(92, 170, C_RGB(pulse%256,0,pulse%256), C_NONE, DTEXT_LEFT, DTEXT_TOP, "BACK TO GAME" ); + + if (GameOptionsSelection==0) dimage( 2, 5, &flag ); + else if (GameOptionsSelection==1) dimage( 2, 35, &flag ); + else if (GameOptionsSelection==2) dimage( 2, 65, &flag ); + else if (GameOptionsSelection==3) dimage( 2, 155, &flag ); + + // CODE HERE TO PRINT WELCOME MENU + + dupdate(); + + pulse++; + getInputGameOptions(); + +#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 + } + + SkipTime = true; // To avoid counting or de-counting time during menu + + return; +} + +void getInputGameOptions( void ) +{ + int opt = GETKEY_DEFAULT & ~GETKEY_REP_ARROWS; + int timeout = 1; + + while(1) + { + key_event_t ev = getkey_opt(opt, &timeout); + if(ev.type == KEYEV_NONE) return; + + int key = ev.key; + + if (key==KEY_EXE) + { + if (GameOptionsSelection==2) nameCurrentlyWritten=false; + + if (GameOptionsSelection==3) doneGameOptions=true; + } + + if (key==KEY_UP && !nameCurrentlyWritten) + { + if (GameOptionsSelection==0) GameOptionsSelection=3; + else GameOptionsSelection--; + } + + if (key==KEY_UP && nameCurrentlyWritten) + { + if(GameOptionsSelection==2 && selectedChar>=0 && selectedChar<=2) + { + if (PlayerName[selectedChar]>'A') PlayerName[selectedChar]--; + else PlayerName[selectedChar]='Z'; + } + else if(GameOptionsSelection==2 && selectedChar==3) + { + nameCurrentlyWritten=false; + } + } + + if (key==KEY_DOWN && !nameCurrentlyWritten) + { + if (GameOptionsSelection==3) GameOptionsSelection=0; + else GameOptionsSelection++; + } + + if (key==KEY_DOWN && nameCurrentlyWritten) + { + if(GameOptionsSelection==2 && selectedChar>=0 && selectedChar<=2) + { + if (PlayerName[selectedChar]<'Z') PlayerName[selectedChar]++; + else PlayerName[selectedChar]='A'; + } + else if(GameOptionsSelection==2 && selectedChar==3) + { + nameCurrentlyWritten=false; + } + } + + if (key==KEY_LEFT) + { + if (GameOptionsSelection==2 && selectedChar>=0 && selectedChar<=2) nameCurrentlyWritten=true; + else if (GameOptionsSelection==2 && selectedChar==3) nameCurrentlyWritten=false; + + if (GameOptionsSelection==2 && selectedChar>0) selectedChar--; + else if (GameOptionsSelection==2) selectedChar=3; + + if (GameOptionsSelection==0 && DiffLevel>0) DiffLevel--; + else if (GameOptionsSelection==1 && CarsNumb>0) CarsNumb--; + } + + if (key==KEY_RIGHT) + { + if (GameOptionsSelection==2 && selectedChar>=0 && selectedChar<=2) nameCurrentlyWritten=true; + else if (GameOptionsSelection==2 && selectedChar==3) nameCurrentlyWritten=false; + + if (GameOptionsSelection==2 && selectedChar<4) selectedChar++; + else if (GameOptionsSelection==2) selectedChar=0; + + if (GameOptionsSelection==0 && DiffLevel<2) DiffLevel++; + else if (GameOptionsSelection==1 && CarsNumb<2) CarsNumb++; + } + +#if IS_FXLIB==1 + if(keydown(KEY_F5)) screenshot = true; + if(keydown(KEY_F6)) record = !record; +#endif // IS_FXLIB + } +} + + + + + void drawPauseQuit( void ) { uint16_t pulse=0;