V1.0 Final (simply added a save of parameters)

master V1.0Final
Sylvain PILLOT 6 months ago
parent 10fc0a169a
commit 9ac4d04790
  1. 178
      CppOutRun.layout
  2. 5
      assets-cg/fxconv-metadata.txt
  3. BIN
      icon.png
  4. 13
      src/include/saves.h
  5. 25
      src/main.cc
  6. 41
      src/src/saves.cc

@ -2,78 +2,17 @@
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Release" />
<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="203" topLine="0" />
</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/src/cars.cc" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1019" topLine="8" />
</Cursor>
</File>
<File name="src/parameters.h" open="1" top="1" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="505" topLine="0" />
</Cursor>
</File>
<File name="src/include/saves.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="264" topLine="0" />
</Cursor>
</File>
<File name="src/include/drawstuff.h" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="655" topLine="0" />
</Cursor>
</File>
<File name="src/fixed.h" open="0" 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="src/include/segment.h" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="783" topLine="3" />
</Cursor>
</File>
<File name="src/include/utils.h" open="0" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="107" 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">
<Cursor>
<Cursor1 position="370" 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">
<Cursor>
<Cursor1 position="306" topLine="0" />
</Cursor>
</File>
<File name="src/src/segment.cc" open="0" top="0" tabpos="15" split="0" active="1" splitpos="0" zoom_1="2" zoom_2="0">
<Cursor>
<Cursor1 position="410" topLine="29" />
</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="TODO.txt" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="35" topLine="0" />
<Cursor1 position="251" topLine="0" />
</Cursor>
</File>
<File name="src/src/menus.cc" open="1" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/src/menus.cc" open="1" top="0" tabpos="15" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="24483" topLine="197" />
<Cursor1 position="39320" topLine="276" />
</Cursor>
<Folding>
<Collapse line="70" />
<Collapse line="108" />
<Collapse line="134" />
<Collapse line="199" />
<Collapse line="235" />
@ -88,18 +27,22 @@
<Collapse line="950" />
<Collapse line="1001" />
<Collapse line="1119" />
<Collapse line="1168" />
<Collapse line="1228" />
</Folding>
</File>
<File name="CMakeLists.txt" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/include/cars.h" open="0" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="448" topLine="0" />
<Cursor1 position="412" topLine="1" />
</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/src/segment.cc" open="0" top="0" tabpos="15" split="0" active="1" splitpos="0" zoom_1="2" zoom_2="0">
<Cursor>
<Cursor1 position="251" topLine="0" />
<Cursor1 position="410" topLine="29" />
</Cursor>
</File>
<File name="src/main.cc" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="-2" zoom_2="0">
<Cursor>
<Cursor1 position="42806" topLine="0" />
</Cursor>
</File>
<File name="src/src/utils.cc" open="0" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
@ -107,32 +50,39 @@
<Cursor1 position="30" topLine="0" />
</Cursor>
</File>
<File name="src/src/saves.cc" open="1" top="0" tabpos="6" 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="306" topLine="2" />
<Cursor1 position="306" topLine="0" />
</Cursor>
</File>
<File name="src/include/saves.h" open="1" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="264" topLine="0" />
</Cursor>
</File>
<File name="src/main.cc" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="-2" zoom_2="0">
<File name="src/src/camera.cc" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="7487" topLine="337" />
<Cursor1 position="370" topLine="0" />
</Cursor>
</File>
<File name="src/src/drawstuff.cc" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/include/utils.h" open="0" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2807" topLine="14" />
<Cursor1 position="107" topLine="0" />
</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">
<Cursor>
<Cursor1 position="35" topLine="0" />
</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>
<Folding>
<Collapse line="9" />
<Collapse line="33" />
<Collapse line="40" />
<Collapse line="46" />
<Collapse line="76" />
<Collapse line="131" />
</Folding>
</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/circuit.cc" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="31927" topLine="266" />
<Cursor1 position="31927" topLine="269" />
</Cursor>
<Folding>
<Collapse line="68" />
@ -157,19 +107,67 @@
<Collapse line="1175" />
</Folding>
</File>
<File name="src/include/circuit.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="CMakeLists.txt" open="1" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="3090" topLine="86" />
</Cursor>
</File>
<File name="src/parameters.h" open="1" top="0" tabpos="16" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="505" topLine="0" />
</Cursor>
</File>
<File name="src/src/drawstuff.cc" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="2807" topLine="14" />
</Cursor>
<Folding>
<Collapse line="9" />
<Collapse line="33" />
<Collapse line="40" />
<Collapse line="46" />
<Collapse line="76" />
<Collapse line="131" />
</Folding>
</File>
<File name="src/include/drawstuff.h" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="655" topLine="0" />
</Cursor>
</File>
<File name="src/include/segment.h" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="783" topLine="3" />
</Cursor>
</File>
<File name="src/fixed.h" open="0" 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="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="203" topLine="0" />
</Cursor>
</File>
<File name="src/src/saves.cc" open="1" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="306" topLine="2" />
</Cursor>
</File>
<File name="src/include/circuit.h" open="1" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="1093" topLine="57" />
</Cursor>
</File>
<File name="src/include/menus.h" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<File name="src/include/menus.h" open="1" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="505" topLine="0" />
</Cursor>
</File>
<File name="src/include/cars.h" open="0" top="0" tabpos="14" 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="412" topLine="1" />
<Cursor1 position="1019" topLine="8" />
</Cursor>
</File>
</CodeBlocks_layout_file>

@ -1,5 +0,0 @@
#*.png:
# type: bopti-image
# profile: p4
# name_regex: (.*)\.png \1

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -9,8 +9,21 @@ struct BestRanking
uint32_t bestTime = 0x0FFFFFFF;
};
struct Parameters
{
uint8_t DiffLevel = 1;
uint8_t CarsNumb = 1;
char PlayerName[3] = { 'S', 'L', 'Y' };
};
void is_save_existing( void );
void saveprogress( void );
void loadprogress( void );
void is_param_existing( void );
void saveparameters( void );
void loadparameters( void );

@ -61,6 +61,8 @@ uint8_t DiffLevel = 1;
uint8_t CarsNumb = 1;
char PlayerName[3] = { 'S', 'L', 'Y' };
Parameters PlayerPara[1];
struct DataPerf
{
uint8_t update=0;
@ -369,11 +371,24 @@ int main(void)
if (!saveexist) // if we do not have saves
gint_world_switch( GINT_CALL( saveprogress ) ); // we create a progress file which is empty
gint_world_switch( GINT_CALL( loadprogress )); // then we load it
gint_world_switch( GINT_CALL( is_param_existing ));
if (!saveexist) // if we do not have saves
gint_world_switch( GINT_CALL( saveparameters ) ); // we create a progress file which is empty
gint_world_switch( GINT_CALL( loadparameters )); // then we load it
DiffLevel=PlayerPara[0].DiffLevel;
CarsNumb=PlayerPara[0].CarsNumb;
PlayerName[0]=PlayerPara[0].PlayerName[0];
PlayerName[1]=PlayerPara[0].PlayerName[1];
PlayerName[2]=PlayerPara[0].PlayerName[2];
kmalloc_arena_t *_uram = kmalloc_get_arena("_uram");
kmalloc_gint_stats_t *_uram_stats;
@ -487,6 +502,14 @@ int main(void)
else if (mode==2)
{
drawGameOptions();
PlayerPara[0].DiffLevel = DiffLevel;
PlayerPara[0].CarsNumb = CarsNumb;
PlayerPara[0].PlayerName[0]=PlayerName[0];
PlayerPara[0].PlayerName[1]=PlayerName[1];
PlayerPara[0].PlayerName[2]=PlayerName[2];
gint_world_switch( GINT_CALL( saveparameters ) );
}
else if (mode==3)
{

@ -4,12 +4,14 @@
static const char *filepath= "OutRun.sav";
static const char *filepara= "OutRun.prm";
bool saveexist;
bool paraexist;
unsigned int sizeoffile;
extern BestRanking HallOfFame[10][5];
extern Parameters PlayerPara[1];
void is_save_existing( void )
{
@ -48,3 +50,40 @@ void loadprogress( void )
fclose( file );
}
void is_param_existing( void )
{
FILE *file = fopen( filepara, "r" );
if (file==NULL)
{
paraexist = false;
}
else
{
fclose( file );
paraexist = true;
}
}
void saveparameters( void )
{
sizeoffile = sizeof( PlayerPara );
FILE *file = fopen( filepara, "w" );
fwrite( PlayerPara, sizeoffile, 1, file );
fclose( file );
}
void loadparameters( void )
{
sizeoffile = sizeof( PlayerPara );
FILE *file = fopen( filepara, "r" );
fread( PlayerPara, sizeoffile, 1, file );
fclose( file );
}

Loading…
Cancel
Save