+ }
+ }
+
+ BackToFront();
+
+ if (game_status == CHOOSELEVEL)
+ DoAnimation();
+}
+
+void DrawHallOfFame(int highlight_position)
+{
+ UnmapAllGadgets();
+ FadeSounds();
+ CloseDoor(DOOR_CLOSE_2);
+
+ if (highlight_position < 0)
+ LoadScore(level_nr);
+
+ FadeToFront();
+ InitAnimation();
+ HandleHallOfFame(highlight_position,0, 0,0, MB_MENU_INITIALIZE);
+ PlaySound(SND_HALLOFFAME);
+}
+
+static void drawHallOfFameList(int first_entry, int highlight_position)
+{
+ int i;
+
+ ClearWindow();
+ DrawText(SX + 80, SY + 8, "Hall Of Fame", FS_BIG, FC_YELLOW);
+ DrawTextFCentered(46, FC_RED, "HighScores of Level %d", level_nr);
+
+ for(i=0; i<MAX_MENU_ENTRIES_ON_SCREEN; i++)
+ {
+ int entry = first_entry + i;
+ int color = (entry == highlight_position ? FC_RED : FC_GREEN);
+
+#if 0
+ DrawText(SX, SY + 64 + i * 32, ".................", FS_BIG, color);
+ DrawText(SX, SY + 64 + i * 32, highscore[i].Name, FS_BIG, color);
+ DrawText(SX + 12 * 32, SY + 64 + i * 32,
+ int2str(highscore[i].Score, 5), FS_BIG, color);
+#else
+ DrawText(SX, SY + 64 + i * 32, "..................................",
+ FS_MEDIUM, FC_YELLOW);
+ DrawText(SX, SY + 64 + i * 32, int2str(entry + 1, 3),
+ FS_MEDIUM, FC_YELLOW);
+ DrawText(SX + 64, SY + 64 + i * 32, highscore[entry].Name, FS_BIG, color);
+ DrawText(SX + 14 * 32 + 16, SY + 64 + i * 32,
+ int2str(highscore[entry].Score, 5), FS_MEDIUM, color);
+#endif
+ }
+}
+
+void HandleHallOfFame(int mx, int my, int dx, int dy, int button)
+{
+ static int first_entry = 0;
+ static int highlight_position = 0;
+ int step = (button == 1 ? 1 : button == 2 ? 5 : 10);
+ int button_released = !button;
+
+ if (button == MB_MENU_INITIALIZE)
+ {
+ first_entry = 0;
+ highlight_position = mx;
+ drawHallOfFameList(first_entry, highlight_position);
+ return;
+ }
+
+ if (ABS(dy) == SCR_FIELDY) /* handle KSYM_Page_Up, KSYM_Page_Down */
+ step = MAX_MENU_ENTRIES_ON_SCREEN - 1;
+
+ if (dy < 0)
+ {
+ if (first_entry > 0)
+ {
+ first_entry -= step;
+ if (first_entry < 0)
+ first_entry = 0;
+
+ drawHallOfFameList(first_entry, highlight_position);
+ return;
+ }
+ }
+ else if (dy > 0)
+ {
+ if (first_entry + MAX_MENU_ENTRIES_ON_SCREEN < MAX_SCORE_ENTRIES)
+ {
+ first_entry += step;
+ if (first_entry + MAX_MENU_ENTRIES_ON_SCREEN > MAX_SCORE_ENTRIES)
+ first_entry = MAX(0, MAX_SCORE_ENTRIES - MAX_MENU_ENTRIES_ON_SCREEN);
+
+ drawHallOfFameList(first_entry, highlight_position);
+ return;
+ }
+ }
+
+ if (button_released)
+ {
+ FadeSound(SND_HALLOFFAME);
+ game_status = MAINMENU;
+ DrawMainMenu();
+ }
+
+ BackToFront();
+
+ if (game_status == HALLOFFAME)
+ DoAnimation();
+}
+
+
+/* ========================================================================= */
+/* setup screen functions */
+/* ========================================================================= */
+
+static struct TokenInfo *setup_info;
+static int num_setup_info;
+static int setup_mode = SETUP_MODE_MAIN;
+
+static void execSetupInput()
+{
+ setup_mode = SETUP_MODE_INPUT;
+ DrawSetupInputScreen();
+}
+
+static void execExitSetup()
+{
+ game_status = MAINMENU;
+ DrawMainMenu();
+}
+
+static void execSaveAndExitSetup()
+{
+ SaveSetup();
+ execExitSetup();
+}
+
+static struct TokenInfo setup_main_info[] =
+{
+ { TYPE_SWITCH, &setup.sound, "Sound:", },
+ { TYPE_SWITCH, &setup.sound_loops, " Sound Loops:" },
+ { TYPE_SWITCH, &setup.sound_music, " Game Music:" },
+#if 0
+ { TYPE_SWITCH, &setup.toons, "Toons:" },
+ { TYPE_SWITCH, &setup.double_buffering,"Buffered gfx:" },
+#endif
+ { TYPE_SWITCH, &setup.scroll_delay, "Scroll Delay:" },
+ { TYPE_SWITCH, &setup.soft_scrolling, "Soft Scroll.:" },
+#if 0
+ { TYPE_SWITCH, &setup.fading, "Fading:" },
+#endif
+ { TYPE_SWITCH, &setup.fullscreen, "Fullscreen:" },
+ { TYPE_SWITCH, &setup.quick_doors, "Quick Doors:" },
+ { TYPE_SWITCH, &setup.autorecord, "Auto-Record:" },
+ { TYPE_SWITCH, &setup.team_mode, "Team-Mode:" },
+ { TYPE_SWITCH, &setup.handicap, "Handicap:" },
+ { TYPE_SWITCH, &setup.time_limit, "Timelimit:" },
+ { TYPE_ENTER_MENU, execSetupInput, "Input Devices" },
+ { TYPE_EMPTY, NULL, "" },
+ { TYPE_LEAVE_MENU, execExitSetup, "Exit" },
+ { TYPE_LEAVE_MENU, execSaveAndExitSetup, "Save and exit" },
+ { 0, NULL, NULL }
+};
+
+static void drawSetupValue(int pos)
+{
+ int xpos = MENU_SCREEN_VALUE_XPOS;
+ int ypos = MENU_SCREEN_START_YPOS + pos;
+ int value_color = FC_YELLOW;
+ char *value_string = getSetupValue(setup_info[pos].type & ~TYPE_GHOSTED,
+ setup_info[pos].value);
+
+ if (setup_info[pos].type & TYPE_SWITCH ||
+ setup_info[pos].type & TYPE_YES_NO)
+ {
+ boolean value = *(boolean *)(setup_info[pos].value);
+ int value_length = 3;
+
+ if (!value)
+ value_color = FC_BLUE;
+
+ if (strlen(value_string) < value_length)
+ strcat(value_string, " ");
+ }
+
+ DrawText(SX + xpos * 32, SY + ypos * 32, value_string, FS_BIG, value_color);
+}
+
+static void DrawSetupMainScreen()
+{
+ int i;
+
+ UnmapAllGadgets();
+ CloseDoor(DOOR_CLOSE_2);
+ ClearWindow();
+
+ DrawText(SX + 16, SY + 16, "SETUP",FS_BIG,FC_YELLOW);
+ setup_info = setup_main_info;
+
+ num_setup_info = 0;
+ for(i=0; setup_info[i].type != 0 && i < MAX_MENU_ENTRIES_ON_SCREEN; i++)
+ {
+ void *value_ptr = setup_info[i].value;
+ int ypos = MENU_SCREEN_START_YPOS + i;
+
+ /* set some entries to "unchangeable" according to other variables */
+ if ((value_ptr == &setup.sound && !audio.sound_available) ||
+ (value_ptr == &setup.sound_loops && !audio.loops_available) ||
+ (value_ptr == &setup.sound_music && !audio.music_available) ||
+ (value_ptr == &setup.sound_music && !audio.music_available) ||
+ (value_ptr == &setup.fullscreen && !video.fullscreen_available))
+ setup_info[i].type |= TYPE_GHOSTED;
+
+ DrawText(SX + 32, SY + ypos * 32, setup_info[i].text, FS_BIG, FC_GREEN);
+
+ if (setup_info[i].type & TYPE_ENTER_MENU)
+ initCursor(i, GFX_ARROW_BLUE_RIGHT);
+ else if (setup_info[i].type & TYPE_LEAVE_MENU)
+ initCursor(i, GFX_ARROW_BLUE_LEFT);
+ else if (setup_info[i].type != TYPE_EMPTY)
+ initCursor(i, GFX_KUGEL_BLAU);
+
+ if (setup_info[i].type & TYPE_BOOLEAN_STYLE)
+ drawSetupValue(i);
+
+ num_setup_info++;
+ }
+
+ FadeToFront();
+ InitAnimation();
+ HandleSetupScreen(0,0,0,0,MB_MENU_INITIALIZE);
+}
+
+void HandleSetupMainScreen(int mx, int my, int dx, int dy, int button)
+{
+ static int choice = 0;
+ int x = 0;
+ int y = choice;
+
+ if (button == MB_MENU_INITIALIZE)
+ {
+ drawCursor(choice, FC_RED);
+ return;
+ }
+ else if (button == MB_MENU_LEAVE)
+ {
+ for (y=0; y<num_setup_info; y++)
+ {
+ if (setup_info[y].type & TYPE_LEAVE_MENU)