game.wind_direction = level.wind_direction_initial;
game.time_final = 0;
+ game.score_time_final = 0;
game.score = 0;
game.score_final = 0;
game.GameOver = TRUE;
game.time_final = (game.no_time_limit ? TimePlayed : TimeLeft);
+ game.score_time_final = (level.use_step_counter ? TimePlayed :
+ TimePlayed * FRAMES_PER_SECOND + TimeFrames);
+
game.score_final = (level.game_engine_type == GAME_ENGINE_TYPE_EM ?
game_em.lev->score :
level.game_engine_type == GAME_ENGINE_TYPE_MM ?
game_mm.score :
game.score);
+
game.health_final = (level.game_engine_type == GAME_ENGINE_TYPE_MM ?
MM_HEALTH(game_mm.laser_overload_value) :
game.health);
for (k = 0; k < MAX_SCORE_ENTRIES; k++)
{
- if (game.score_final > scores.entry[k].score)
+ boolean score_is_better = (game.score_final > scores.entry[k].score);
+ boolean score_is_equal = (game.score_final == scores.entry[k].score);
+ boolean time_is_better = (game.score_time_final < scores.entry[k].time);
+
+ if (score_is_better || (score_is_equal && time_is_better))
{
// player has made it to the hall of fame
{
strcpy(scores.entry[l].name, scores.entry[l - 1].name);
scores.entry[l].score = scores.entry[l - 1].score;
+ scores.entry[l].time = scores.entry[l - 1].time;
}
}
strncpy(scores.entry[k].name, setup.player_name, MAX_PLAYER_NAME_LEN);
scores.entry[k].name[MAX_PLAYER_NAME_LEN] = '\0';
scores.entry[k].score = game.score_final;
+ scores.entry[k].time = game.score_time_final;
position = k;
break;