SetGameStatus(GAME_MODE_SCORES);
- DrawHallOfFame(level_nr, -1);
+ DrawHallOfFame(level_nr);
}
else if (pos == MAIN_CONTROL_EDITOR)
{
HandleChooseTree(mx, my, dx, dy, button, &level_number_current);
}
-void DrawHallOfFame(int level_nr, int highlight_position)
+void DrawHallOfFame(int level_nr)
{
int fade_mask = REDRAW_FIELD;
SetDrawDeactivationMask(REDRAW_NONE);
SetDrawBackgroundMask(REDRAW_FIELD);
- if (highlight_position < 0)
+ if (scores.last_added < 0)
LoadScore(level_nr);
else
SetAnimStatus(GAME_MODE_PSEUDO_SCORESNEW);
+ LoadServerScore(level_nr);
+
FadeSetEnterScreen();
FadeOut(fade_mask);
OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
- HandleHallOfFame(level_nr, highlight_position, 0, 0, MB_MENU_INITIALIZE);
+ HandleHallOfFame(level_nr, scores.last_added, 0, 0, MB_MENU_INITIALIZE);
DrawMaskedBorder(fade_mask);
FadeIn(fade_mask);
}
-static char *getHallOfFameScoreText(int nr)
+static int getHallOfFameFirstEntry(int first_entry, int step)
{
- // use playing time instead of score for Supaplex levels
- if (level.game_engine_type == GAME_ENGINE_TYPE_SP)
- {
- static char score_text[10];
- int time_final_max = 999;
- int time_seconds = scores.entry[nr].time / FRAMES_PER_SECOND;
- int score = scores.entry[nr].score;
+ if (step == 0)
+ first_entry = scores.last_added - (NUM_MENU_ENTRIES_ON_SCREEN + 1) / 2 + 1;
+ else
+ first_entry += step;
- // convert old score file entries without playing time
- if (time_seconds == 0 && score > 0 && score < time_final_max)
- time_seconds = time_final_max - score - 1;
+ if (first_entry < 0)
+ first_entry = 0;
+ else if (first_entry > MAX_SCORE_ENTRIES - NUM_MENU_ENTRIES_ON_SCREEN)
+ first_entry = MAX(0, MAX_SCORE_ENTRIES - NUM_MENU_ENTRIES_ON_SCREEN);
- int mm = (time_seconds / 60) % 60;
- int ss = (time_seconds % 60);
+ return first_entry;
+}
- sprintf(score_text, "%02d:%02d", mm, ss);
+static char *getHallOfFameScoreText(int nr)
+{
+ if (!level.rate_time_over_score)
+ return int2str(scores.entry[nr].score, 5); // show normal score
- return score_text;
- }
+ if (level.use_step_counter)
+ return int2str(scores.entry[nr].time, 5); // show number of steps
- return int2str(scores.entry[nr].score, 5);
+ static char score_text[10];
+ int time_seconds = scores.entry[nr].time / FRAMES_PER_SECOND;
+ int mm = (time_seconds / 60) % 60;
+ int ss = (time_seconds % 60);
+
+ sprintf(score_text, "%02d:%02d", mm, ss); // show playing time
+
+ return score_text;
}
static void drawHallOfFameList(int level_nr, int first_entry,
level_nr = mx;
highlight_position = my;
- first_entry = highlight_position - (NUM_MENU_ENTRIES_ON_SCREEN + 1) / 2 + 1;
-
- if (first_entry < 0)
- first_entry = 0;
- else if (first_entry + NUM_MENU_ENTRIES_ON_SCREEN > MAX_SCORE_ENTRIES)
- first_entry = MAX(0, MAX_SCORE_ENTRIES - NUM_MENU_ENTRIES_ON_SCREEN);
+ first_entry = getHallOfFameFirstEntry(0, 0);
drawHallOfFameList(level_nr, first_entry, highlight_position);
if (dy < 0)
{
- if (first_entry > 0)
- {
- first_entry -= step;
- if (first_entry < 0)
- first_entry = 0;
+ first_entry = getHallOfFameFirstEntry(first_entry, -step);
- drawHallOfFameList(level_nr, first_entry, highlight_position);
- }
+ drawHallOfFameList(level_nr, first_entry, highlight_position);
}
else if (dy > 0)
{
- if (first_entry + NUM_MENU_ENTRIES_ON_SCREEN < MAX_SCORE_ENTRIES)
- {
- first_entry += step;
- if (first_entry + NUM_MENU_ENTRIES_ON_SCREEN > MAX_SCORE_ENTRIES)
- first_entry = MAX(0, MAX_SCORE_ENTRIES - NUM_MENU_ENTRIES_ON_SCREEN);
+ first_entry = getHallOfFameFirstEntry(first_entry, step);
- drawHallOfFameList(level_nr, first_entry, highlight_position);
- }
+ drawHallOfFameList(level_nr, first_entry, highlight_position);
}
else if (button == MB_MENU_LEAVE || button == MB_MENU_CHOICE)
{