add coins saving
This commit is contained in:
parent
dbf5416ba7
commit
ef4d0ffcdf
BIN
SuperCbr.g1a
BIN
SuperCbr.g1a
Binary file not shown.
Binary file not shown.
Binary file not shown.
932
build-fx/map
932
build-fx/map
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -13,6 +13,10 @@ void set_highscore(int world, int level, int score);
|
|||
int get_best_time(int world, int level);
|
||||
void set_best_time(int world, int level, int score);
|
||||
|
||||
int get_highcoins(int world, int level);
|
||||
void set_highcoins(int world, int level, int coins);
|
||||
|
||||
|
||||
int get_progress_status();
|
||||
|
||||
#endif
|
|
@ -7,6 +7,7 @@ extern int finish_level; // si ==-1, continue, si 0==retry, si ==1 ou + next
|
|||
extern int time_id;
|
||||
|
||||
int get_score();
|
||||
int get_coins();
|
||||
void score_reset();
|
||||
void score_add(int);
|
||||
void score_display();
|
||||
|
|
|
@ -59,6 +59,13 @@ static void levelchanger(int w)
|
|||
i++;
|
||||
dtext(99-6*i, 45, str, C_BLACK, C_WHITE);
|
||||
|
||||
sprintf(str, "%d", get_highcoins(w,choice));
|
||||
i=0;
|
||||
while (str[i])
|
||||
i++;
|
||||
dtext(90-6*i, 37, str, C_BLACK, C_WHITE);
|
||||
|
||||
|
||||
dupdate();
|
||||
|
||||
|
||||
|
@ -102,18 +109,21 @@ static void levelchanger(int w)
|
|||
}
|
||||
else
|
||||
{
|
||||
dienretry:
|
||||
new_game();
|
||||
mario_smaller();
|
||||
mario_immunity=0;
|
||||
int s=play_level(w, choice);
|
||||
if (s==1)
|
||||
while (1)
|
||||
{
|
||||
set_best_time(w, choice, get_time_spent());
|
||||
new_game();
|
||||
mario_smaller();
|
||||
mario_immunity=0;
|
||||
int s=play_level(w, choice);
|
||||
if (s==1)
|
||||
{
|
||||
set_best_time(w, choice, get_time_spent());
|
||||
}
|
||||
set_highscore(w, choice, get_score());
|
||||
set_highcoins(w, choice, get_coins());
|
||||
if (s)
|
||||
break;
|
||||
}
|
||||
set_highscore(w, choice, get_score());
|
||||
if (s==0)
|
||||
goto dienretry;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
13
src/save.c
13
src/save.c
|
@ -30,6 +30,19 @@ void set_highscore(int world, int level, int score)
|
|||
level_scores[world%NB_MONDES][level%WORLD_RUN_ENTRY]=score;
|
||||
}
|
||||
|
||||
|
||||
int get_highcoins(int world, int level)
|
||||
{
|
||||
return level_coins[world%NB_MONDES][level%WORLD_RUN_ENTRY];
|
||||
}
|
||||
|
||||
void set_highcoins(int world, int level, int coins)
|
||||
{
|
||||
if (coins>level_coins[world%NB_MONDES][level%WORLD_RUN_ENTRY])
|
||||
level_coins[world%NB_MONDES][level%WORLD_RUN_ENTRY]=coins;
|
||||
}
|
||||
|
||||
|
||||
int get_best_time(int world, int level)
|
||||
{
|
||||
return level_times[world%NB_MONDES][level%WORLD_RUN_ENTRY];
|
||||
|
|
|
@ -45,6 +45,12 @@ int get_score()
|
|||
return score;
|
||||
}
|
||||
|
||||
int get_coins()
|
||||
{
|
||||
return pieces;
|
||||
}
|
||||
|
||||
|
||||
void score_reset()
|
||||
{
|
||||
score=0;
|
||||
|
|
|
@ -36,9 +36,8 @@ void teleport_active()
|
|||
if (!keys[t.key])
|
||||
continue;
|
||||
}
|
||||
mario.p.x=t.tx*8;
|
||||
mario.p.y=t.ty*8;
|
||||
mario.p.vx=mario.p.vy=0;
|
||||
mario.p.x=t.tx*8; mario.p.y=t.ty*8;
|
||||
mario.p.vx=0; mario.p.vy=0;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue