+static struct MainControlInfo *getMainControlInfo(int nr)
+{
+ int i;
+
+ for (i = 0; main_controls[i].nr != -1; i++)
+ if (main_controls[i].nr == nr)
+ return &main_controls[i];
+
+ return NULL;
+}
+
+static boolean insideMenuPosRect(struct MenuPosInfo *rect, int x, int y)
+{
+ if (rect == NULL)
+ return FALSE;
+
+ int rect_x = ALIGNED_TEXT_XPOS(rect);
+ int rect_y = ALIGNED_TEXT_YPOS(rect);
+
+ return (x >= rect_x && x < rect_x + rect->width &&
+ y >= rect_y && y < rect_y + rect->height);
+}
+
+static boolean insideTextPosRect(struct TextPosInfo *rect, int x, int y)
+{
+ if (rect == NULL)
+ return FALSE;
+
+ int rect_x = ALIGNED_TEXT_XPOS(rect);
+ int rect_y = ALIGNED_TEXT_YPOS(rect);
+
+ return (x >= rect_x && x < rect_x + rect->width &&
+ y >= rect_y && y < rect_y + rect->height);
+}
+
+static void drawCursorExt(int xpos, int ypos, boolean active, int graphic)
+{
+ static int cursor_array[SCR_FIELDY];
+ int x = mSX + TILEX * xpos;
+ int y = mSY + TILEY * (MENU_SCREEN_START_YPOS + ypos);
+
+ if (xpos == 0)
+ {
+ if (graphic != -1)
+ cursor_array[ypos] = graphic;
+ else
+ graphic = cursor_array[ypos];
+ }
+
+ if (active)
+ graphic = BUTTON_GRAPHIC_ACTIVE(graphic);
+
+ DrawBackgroundForGraphic(x, y, TILEX, TILEY, graphic);
+ DrawGraphicThruMaskExt(drawto, x, y, graphic, 0);
+}
+
+static void initCursor(int ypos, int graphic)
+{
+ drawCursorExt(0, ypos, FALSE, graphic);
+}
+
+static void drawCursor(int ypos, boolean active)
+{
+ drawCursorExt(0, ypos, active, -1);
+}
+
+static void drawCursorXY(int xpos, int ypos, int graphic)
+{
+ drawCursorExt(xpos, ypos, FALSE, graphic);
+}
+
+static void drawChooseTreeCursor(int ypos, boolean active)
+{
+ int last_game_status = game_status; /* save current game status */
+
+ /* force LEVELS draw offset on artwork setup screen */
+ game_status = GAME_MODE_LEVELS;
+
+ drawCursorExt(0, ypos, active, -1);
+
+ game_status = last_game_status; /* restore current game status */
+}
+
+void DrawHeadline()
+{
+ DrawTextSCentered(MENU_TITLE1_YPOS, FONT_TITLE_1, PROGRAM_TITLE_STRING);
+ DrawTextSCentered(MENU_TITLE2_YPOS, FONT_TITLE_2, PROGRAM_COPYRIGHT_STRING);
+}
+
+#if 0
+static int getPrevlevelButtonPos()
+{
+ return 10;
+}
+
+static int getCurrentLevelTextPos()
+{
+ return (getPrevlevelButtonPos() + 1);
+}
+
+static int getNextLevelButtonPos()
+{
+ return getPrevlevelButtonPos() + 3 + 1;
+}
+
+static int getLevelRangeTextPos()
+{
+ return getNextLevelButtonPos() + 1;
+}
+#endif
+
+int effectiveGameStatus()
+{
+ if (game_status == GAME_MODE_INFO && info_mode == INFO_MODE_TITLE)
+ return GAME_MODE_TITLE;
+
+ return game_status;
+}
+
+void DrawTitleScreenImage(int nr, boolean initial)
+{
+ int graphic = getTitleScreenGraphic(nr, initial);
+ Bitmap *bitmap = graphic_info[graphic].bitmap;
+#if 1
+ int width = graphic_info[graphic].width;
+ int height = graphic_info[graphic].height;
+ int src_x = graphic_info[graphic].src_x;
+ int src_y = graphic_info[graphic].src_y;
+#else
+ int width = graphic_info[graphic].src_image_width;
+ int height = graphic_info[graphic].src_image_height;
+ int src_x = 0, src_y = 0;
+#endif
+ int dst_x, dst_y;
+
+ if (bitmap == NULL)
+ return;
+
+ if (width > WIN_XSIZE)
+ {
+ /* image width too large for window => center image horizontally */
+ src_x = (width - WIN_XSIZE) / 2;
+ width = WIN_XSIZE;
+ }
+
+ if (height > WIN_YSIZE)
+ {
+ /* image height too large for window => center image vertically */
+ src_y = (height - WIN_YSIZE) / 2;
+ height = WIN_YSIZE;
+ }
+
+ /* always display title screens centered */
+ dst_x = (WIN_XSIZE - width) / 2;
+ dst_y = (WIN_YSIZE - height) / 2;
+
+ SetDrawBackgroundMask(REDRAW_ALL);
+ SetWindowBackgroundImage(getTitleBackground(nr, initial, TRUE));
+
+ ClearRectangleOnBackground(drawto, 0, 0, WIN_XSIZE, WIN_YSIZE);
+
+ if (DrawingOnBackground(dst_x, dst_y))
+ BlitBitmapMasked(bitmap, drawto, src_x, src_y, width, height, dst_x, dst_y);
+ else
+ BlitBitmap(bitmap, drawto, src_x, src_y, width, height, dst_x, dst_y);
+
+ redraw_mask = REDRAW_ALL;
+
+ /* reset fading control values to default config settings */
+#if 1
+
+#if 0
+ title = getTitleFading(nr, initial, TRUE);
+#endif
+
+#else
+
+ title.fade_delay_final = title.fade_delay;
+ title.post_delay_final = title.post_delay;
+ title.auto_delay_final = title.auto_delay;
+
+ /* override default settings with image config settings, if defined */
+ if (graphic_info[graphic].anim_mode != ANIM_DEFAULT)
+ title.anim_mode = graphic_info[graphic].anim_mode;
+ if (graphic_info[graphic].fade_delay > -1)
+ title.fade_delay = graphic_info[graphic].fade_delay;
+ if (graphic_info[graphic].post_delay > -1)
+ title.post_delay = graphic_info[graphic].post_delay;
+ if (graphic_info[graphic].auto_delay > -1)
+ title.auto_delay = graphic_info[graphic].auto_delay;
+#endif
+}
+
+void DrawTitleScreenMessage(int nr, boolean initial)
+{
+ char *filename = getLevelSetTitleMessageFilename(nr, initial);
+ struct TitleMessageInfo *tmi = getTitleMessageInfo(nr, initial);
+#if 0
+ int font_nr = FONT_TEXT_1;
+ int font_width;
+ int font_height;
+ int pad_x = 16 + 4;
+ int pad_y = 32 + 14;
+ int sx = pad_x;
+ int sy = pad_y;
+ int max_chars_per_line;
+ int max_lines_per_screen;
+#endif
+ int last_game_status = game_status; /* save current game status */
+
+ if (filename == NULL)
+ return;
+
+ /* force TITLE font on title message screen */
+ game_status = getTitleMessageGameMode(initial);
+
+ /* if chars set to "-1", automatically determine by text and font width */
+ if (tmi->chars == -1)
+ tmi->chars = tmi->width / getFontWidth(tmi->font);
+ else
+ tmi->width = tmi->chars * getFontWidth(tmi->font);
+
+ /* if lines set to "-1", automatically determine by text and font height */
+ if (tmi->lines == -1)
+ tmi->lines = tmi->height / getFontHeight(tmi->font);
+ else
+ tmi->height = tmi->lines * getFontHeight(tmi->font);
+
+ SetDrawBackgroundMask(REDRAW_ALL);
+ SetWindowBackgroundImage(getTitleBackground(nr, initial, FALSE));
+
+ ClearRectangleOnBackground(drawto, 0, 0, WIN_XSIZE, WIN_YSIZE);
+
+#if 0
+ font_width = getFontWidth(font_nr);
+ font_height = getFontHeight(font_nr);
+ max_chars_per_line = (WIN_XSIZE - 2 * pad_x) / font_width;
+ max_lines_per_screen = (WIN_YSIZE - pad_y) / font_height - 1;
+#endif
+
+#if 1
+ DrawTextFile(ALIGNED_TEXT_XPOS(tmi), ALIGNED_TEXT_YPOS(tmi),
+ filename, tmi->font, tmi->chars, -1, tmi->lines, -1,
+ tmi->autowrap, tmi->centered, tmi->parse_comments);
+#else
+ DrawTextFile(sx, sy, filename, font_nr, max_chars_per_line, -1,
+ max_lines_per_screen, -1, tmi->autowrap, tmi->centered,
+ tmi->parse_comments);
+#endif
+
+ game_status = last_game_status; /* restore current game status */
+}
+
+void DrawTitleScreen()
+{
+ KeyboardAutoRepeatOff();
+
+#if 0
+ SetMainBackgroundImage(IMG_BACKGROUND_TITLE);
+#endif
+
+ HandleTitleScreen(0, 0, 0, 0, MB_MENU_INITIALIZE);
+
+ StopAnimation();
+}
+
+boolean CheckTitleScreen(boolean levelset_has_changed)
+{
+ static boolean show_title_initial = TRUE;
+ boolean show_titlescreen = FALSE;
+
+ /* needed to be able to skip title screen, if no image or message defined */
+ InitializeTitleControls(show_title_initial);
+
+ if (setup.show_titlescreen && (show_title_initial || levelset_has_changed))
+ show_titlescreen = TRUE;
+
+ /* show initial title images and messages only once at program start */
+ show_title_initial = FALSE;
+
+ return (show_titlescreen && num_title_screens > 0);
+}
+
+void DrawMainMenuExt(int redraw_mask, boolean do_fading)
+{
+ static LevelDirTree *leveldir_last_valid = NULL;
+ boolean levelset_has_changed = FALSE;
+#if 0
+ boolean local_team_mode = (!options.network && setup.team_mode);
+ char *name_text = (local_team_mode ? "Team:" : "Name:");
+ int name_width, level_width;
+#endif
+#if 0
+ int i;
+#endif
+
+#if 0
+ /* !!! CHANGE THIS !!! */
+ title = title_default;
+#endif
+
+#if 0
+ printf("::: %d, %d\n", fading.anim_mode == ANIM_CROSSFADE,
+ redraw_mask == REDRAW_ALL);
+#endif
+
+#if 1
+#if XFADE
+ if (fading.anim_mode == ANIM_CROSSFADE)
+ FadeCrossSaveBackbuffer();
+ else
+ FadeOut(redraw_mask);
+#endif
+#endif
+
+ UnmapAllGadgets();
+ FadeSoundsAndMusic();
+
+ KeyboardAutoRepeatOn();
+ ActivateJoystick();
+
+ SetDrawDeactivationMask(REDRAW_NONE);
+ SetDrawBackgroundMask(REDRAW_FIELD);
+
+ audio.sound_deactivated = FALSE;
+
+ GetPlayerConfig();
+
+ /* needed if last screen was the playing screen, invoked from level editor */
+ if (level_editor_test_game)
+ {
+ game_status = GAME_MODE_EDITOR;
+ DrawLevelEd();
+
+ return;
+ }
+
+ /* needed if last screen was the editor screen */
+ UndrawSpecialEditorDoor();
+
+ /* needed if last screen was the setup screen and fullscreen state changed */
+ ToggleFullscreenIfNeeded();
+
+ /* leveldir_current may be invalid (level group, parent link) */
+ if (!validLevelSeries(leveldir_current))
+ leveldir_current = getFirstValidTreeInfoEntry(leveldir_last_valid);
+
+ if (leveldir_current != leveldir_last_valid)
+ levelset_has_changed = TRUE;
+
+ /* store valid level series information */
+ leveldir_last_valid = leveldir_current;
+
+ /* needed if last screen (level choice) changed graphics, sounds or music */
+ ReloadCustomArtwork(0);
+
+#if defined(TARGET_SDL)
+ SetDrawtoField(DRAW_BACKBUFFER);
+#endif
+
+#if 0
+ if (levelset_has_changed)
+ fading = title_default;
+#endif
+
+#if 1
+ if (CheckTitleScreen(levelset_has_changed))
+ {
+ game_status = GAME_MODE_TITLE;
+
+ DrawTitleScreen();
+
+ return;
+ }
+
+#else
+
+ if (setup.show_titlescreen &&
+ ((levelset_has_changed &&
+ (graphic_info[IMG_TITLESCREEN_1].bitmap != NULL ||
+ getLevelSetMessageFilename(1, FALSE) != NULL)) ||
+ (show_title_initial &&
+ (graphic_info[IMG_TITLESCREEN_INITIAL_1].bitmap != NULL ||
+ getLevelSetMessageFilename(1, TRUE) != NULL))))
+ {
+ game_status = GAME_MODE_TITLE;
+
+ DrawTitleScreen();
+
+ return;
+ }
+#endif
+
+ /* level_nr may have been set to value over handicap with level editor */
+ if (setup.handicap && level_nr > leveldir_current->handicap_level)
+ level_nr = leveldir_current->handicap_level;
+
+ LoadLevel(level_nr);
+
+ SetMainBackgroundImage(IMG_BACKGROUND_MAIN);
+
+#if 0
+#if XFADE
+ if (fading.anim_mode == ANIM_CROSSFADE)
+ FadeCrossSaveBackbuffer();
+ else
+ FadeOut(redraw_mask);
+#endif
+#endif
+
+#if 1
+ if (redraw_mask == REDRAW_ALL)
+ {
+ int door_state = GetDoorState();
+
+ RedrawBackground();
+
+ // OpenDoor(door_state | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
+
+#if 0
+#if 1
+ OpenDoor(DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
+#else
+ OpenDoor(DOOR_CLOSE_1 | DOOR_CLOSE_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
+#endif
+#endif
+ }
+#endif
+
+ ClearWindow();
+
+#if 1
+ InitializeMainControls();
+
+#if 1
+ DrawCursorAndText_Main(-1, FALSE);
+#else
+ for (i = 0; main_controls[i].nr != -1; i++)
+ {
+ struct MenuPosInfo *pos_button = main_controls[i].pos_button;
+ struct MenuPosInfo *pos_text = main_controls[i].pos_text;
+ struct MenuPosInfo *pos_input = main_controls[i].pos_input;
+ char *text = main_controls[i].text;
+ char *input = main_controls[i].input;
+ int button_graphic = main_controls[i].button_graphic;
+ int font_text = main_controls[i].font_text;
+ int font_input = main_controls[i].font_input;
+
+ if (pos_button != NULL)
+ DrawGraphicThruMaskExt(drawto, mSX + pos_button->x, mSY + pos_button->y,
+ button_graphic, 0);
+
+ if (pos_text != NULL && text != NULL)
+ DrawText(mSX + pos_text->x, mSY + pos_text->y, text, font_text);
+
+ if (pos_input != NULL && input != NULL)
+ DrawText(mSX + pos_input->x, mSY + pos_input->y, input, font_input);
+ }
+#endif
+
+#else
+
+ DrawHeadline();
+
+ DrawText(mSX + 32, mSY + 2 * 32, name_text, FONT_MENU_1);
+ DrawText(mSX + 32, mSY + 3 * 32, "Levelset", FONT_MENU_1);
+ DrawText(mSX + 32, mSY + 4 * 32, "Hall Of Fame", FONT_MENU_1);
+ DrawText(mSX + 32, mSY + 5 * 32, "Level Creator", FONT_MENU_1);
+ DrawText(mSX + 32, mSY + 6 * 32, "Info Screen", FONT_MENU_1);
+ DrawText(mSX + 32, mSY + 7 * 32, "Start Game", FONT_MENU_1);
+ DrawText(mSX + 32, mSY + 8 * 32, "Setup", FONT_MENU_1);
+ DrawText(mSX + 32, mSY + 9 * 32, "Quit", FONT_MENU_1);
+
+ /* calculated after (possible) reload of custom artwork */
+ name_width = getTextWidth(name_text, FONT_MENU_1);
+ level_width = 9 * 32;
+
+ DrawText(mSX + 32 + name_width, mSY + 2 * 32, setup.player_name,
+ FONT_INPUT_1);
+
+ DrawText(mSX + getCurrentLevelTextPos() * 32, mSY + 3 * 32,
+ int2str(level_nr, 3), FONT_VALUE_1);
+
+ {
+ int text_height = getFontHeight(FONT_TEXT_3);
+ int xpos = getLevelRangeTextPos() * 32 + 8;
+ int ypos2 = 3 * 32 + 16;
+ int ypos1 = ypos2 - text_height;
+
+ DrawTextF(mSX - SX + xpos, mSY - SY + ypos1, FONT_TEXT_3,
+ "%03d", leveldir_current->first_level);
+ DrawTextF(mSX - SX + xpos, mSY - SY + ypos2, FONT_TEXT_3,
+ "%03d", leveldir_current->last_level);
+ }
+
+ for (i = 0; i < 8; i++)
+ initCursor(i, (i == 1 || i == 4 || i == 6 ? IMG_MENU_BUTTON_ENTER_MENU :
+ IMG_MENU_BUTTON));
+
+ DrawTextSCentered(326, FONT_TITLE_2, PROGRAM_GAME_BY_STRING);
+#endif
+
+ DrawPreviewLevel(TRUE);
+
+ HandleMainMenu(0, 0, 0, 0, MB_MENU_INITIALIZE);
+
+ TapeStop();
+ if (TAPE_IS_EMPTY(tape))
+ LoadTape(level_nr);
+ DrawCompleteVideoDisplay();
+
+ PlayMenuSound();
+ PlayMenuMusic();
+
+ /* create gadgets for main menu screen */
+ FreeScreenGadgets();
+ CreateScreenGadgets();
+
+#if 0
+ BlitBitmap(drawto, window, VX, VY, VXSIZE, VYSIZE, VX, VY);
+ Delay(3000);
+#endif
+
+ /* map gadgets for main menu screen */
+ MapTapeButtons();
+ MapScreenMenuGadgets(SCREEN_MASK_MAIN);
+
+ DrawMaskedBorder(REDRAW_ALL);
+
+#if 1
+ if (redraw_mask == REDRAW_ALL)
+ {
+ int door_state = GetDoorState();
+
+ OpenDoor(door_state | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
+ }
+#endif
+
+#if XFADE
+ if (fading.anim_mode == ANIM_CROSSFADE)
+ FadeCross(redraw_mask);
+ else
+ FadeIn(redraw_mask);
+#else
+#if 1
+ if (!do_fading)
+ BackToFront();
+ else if (fading.anim_mode == ANIM_CROSSFADE)
+ FadeCross(redraw_mask);
+ else
+ FadeIn(redraw_mask);
+#else
+ if (do_fading)
+ FadeIn(redraw_mask);
+ else
+ BackToFront();
+#endif
+#endif
+
+#if 1
+ fading = menu.navigation;
+#else
+ fading = title_default;
+#endif
+
+ SetMouseCursor(CURSOR_DEFAULT);
+
+ InitAnimation();
+
+ OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2);
+}
+
+void DrawAndFadeInMainMenu(int redraw_mask)
+{
+ DrawMainMenuExt(redraw_mask, TRUE);
+}
+
+void DrawMainMenu()
+{
+ DrawMainMenuExt(REDRAW_ALL, FALSE);
+}
+
+#if 0
+static void gotoTopLevelDir()
+{
+ /* move upwards to top level directory */
+ while (leveldir_current->node_parent)
+ {
+ /* write a "path" into level tree for easy navigation to last level */
+ if (leveldir_current->node_parent->node_group->cl_first == -1)
+ {
+ int num_leveldirs = numTreeInfoInGroup(leveldir_current);
+ int leveldir_pos = posTreeInfo(leveldir_current);
+ int num_page_entries;
+ int cl_first, cl_cursor;
+
+ if (num_leveldirs <= NUM_MENU_ENTRIES_ON_SCREEN)
+ num_page_entries = num_leveldirs;
+ else
+ num_page_entries = NUM_MENU_ENTRIES_ON_SCREEN;
+
+ cl_first = MAX(0, leveldir_pos - num_page_entries + 1);
+ cl_cursor = leveldir_pos - cl_first;
+
+ leveldir_current->node_parent->node_group->cl_first = cl_first;
+ leveldir_current->node_parent->node_group->cl_cursor = cl_cursor;
+ }
+
+ leveldir_current = leveldir_current->node_parent;
+ }
+}
+#endif
+
+void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
+{
+ static unsigned long title_delay = 0;
+ static int title_screen_nr = 0;
+ static int last_sound = -1, last_music = -1;
+ boolean return_to_main_menu = FALSE;
+ boolean use_fading_main_menu = TRUE;
+#if 0
+#if 1
+ boolean use_cross_fading = FALSE;
+#else
+ boolean use_cross_fading = !show_title_initial; /* default */
+#endif
+#endif
+ struct TitleControlInfo *tci;
+ struct TitleFadingInfo fading_next;
+ int sound, music;
+
+ if (button == MB_MENU_INITIALIZE)
+ {
+#if 1
+ boolean use_cross_fading = (fading.anim_mode == ANIM_CROSSFADE);
+#endif
+
+#if 0
+ int last_game_status = game_status; /* save current game status */
+#endif
+
+ title_delay = 0;
+ title_screen_nr = 0;
+ tci = &title_controls[title_screen_nr];
+
+ last_sound = SND_UNDEFINED;
+ last_music = MUS_UNDEFINED;
+
+#if 0
+ /* determine number of title screens to display (images and messages) */
+ InitializeTitleControls();
+#endif
+
+ if (game_status == GAME_MODE_INFO)
+ {
+ if (num_title_screens == 0)
+ {
+ DrawInfoScreen_NotAvailable("Title screen information:",
+ "No title screen for this level set.");
+
+ /* use default settings for fading, but always disable auto delay */
+ fading = title_default;
+ fading.auto_delay = -1;
+
+ return;
+ }
+
+ FadeSoundsAndMusic();
+
+#if 1
+ if (use_cross_fading)
+ FadeCrossSaveBackbuffer();
+ else
+ FadeOut(REDRAW_ALL);
+#else
+ FadeOut(REDRAW_ALL);
+#endif
+ }
+
+ if (tci->is_image)
+ DrawTitleScreenImage(tci->local_nr, tci->initial);
+ else
+ DrawTitleScreenMessage(tci->local_nr, tci->initial);
+
+ fading = getTitleFading(tci);
+
+#if 1
+ sound = getTitleSound(tci);
+ music = getTitleMusic(tci);
+
+ if (sound != last_sound)
+ PlayMenuSoundExt(sound);
+ if (music != last_music)
+ PlayMenuMusicExt(music);
+
+ last_sound = sound;
+ last_music = music;
+#endif
+
+ SetMouseCursor(CURSOR_NONE);
+
+#if 1
+ if (use_cross_fading)
+ FadeCross(REDRAW_ALL);
+ else
+ FadeIn(REDRAW_ALL);
+#else
+ FadeIn(REDRAW_ALL);
+#endif
+
+ DelayReached(&title_delay, 0); /* reset delay counter */
+
+ return;
+ }
+
+ if (fading.auto_delay > -1 && DelayReached(&title_delay, fading.auto_delay))
+ button = MB_MENU_CHOICE;
+
+ if (button == MB_MENU_LEAVE)
+ {
+ return_to_main_menu = TRUE;
+ use_fading_main_menu = FALSE;
+ }
+ else if (button == MB_MENU_CHOICE)
+ {
+#if 1
+ boolean use_cross_fading = (fading.anim_mode == ANIM_CROSSFADE);
+#endif
+
+ if (game_status == GAME_MODE_INFO && num_title_screens == 0)
+ {
+#if 0
+#if XFADE
+ if (fading.anim_mode == ANIM_CROSSFADE)
+ FadeCrossSaveBackbuffer();
+ else
+ FadeOut(REDRAW_FIELD);
+#else
+ FadeOut(REDRAW_FIELD);
+#endif
+#endif
+
+ fading = menu.destination;
+
+ info_mode = INFO_MODE_MAIN;
+ DrawAndFadeInInfoScreen(REDRAW_FIELD);
+
+ return;
+ }
+
+ title_screen_nr++;
+ tci = &title_controls[title_screen_nr];
+
+ if (title_screen_nr < num_title_screens)
+ {
+#if 1
+#if 0
+ boolean use_cross_fading = (fading.anim_mode == ANIM_CROSSFADE);
+#endif
+#else
+ int anim_mode;
+
+ if (tci->is_image)
+ anim_mode =
+ graphic_info[getTitleScreenGraphic(tci->local_nr,
+ tci->initial)].anim_mode;
+ else
+ anim_mode = ANIM_FADE; /* ??? */
+
+ use_cross_fading = (anim_mode == ANIM_FADE ? FALSE :
+ anim_mode == ANIM_CROSSFADE ? TRUE :
+ use_cross_fading);
+#endif
+
+ sound = getTitleSound(tci);
+ music = getTitleMusic(tci);
+
+ if (sound == SND_UNDEFINED || sound != last_sound)
+ FadeSounds();
+ if (music == MUS_UNDEFINED || music != last_music)
+ FadeMusic();
+
+ if (use_cross_fading)
+ FadeCrossSaveBackbuffer();
+ else
+ FadeOut(REDRAW_ALL);
+
+ if (tci->is_image)
+ DrawTitleScreenImage(tci->local_nr, tci->initial);
+ else
+ DrawTitleScreenMessage(tci->local_nr, tci->initial);
+
+ fading_next = getTitleFading(tci);
+
+#if 1
+ sound = getTitleSound(tci);
+ music = getTitleMusic(tci);
+
+ if (sound != last_sound)
+ PlayMenuSoundExt(sound);
+ if (music != last_music)
+ PlayMenuMusicExt(music);
+
+ last_sound = sound;
+ last_music = music;
+#endif
+
+ /* last screen already faded out, next screen has no animation */
+ if (!use_cross_fading && fading_next.anim_mode == ANIM_NONE)
+ fading = fading_next;
+
+ if (use_cross_fading)
+ FadeCross(REDRAW_ALL);
+ else
+ FadeIn(REDRAW_ALL);
+
+ fading = fading_next;
+
+ DelayReached(&title_delay, 0); /* reset delay counter */
+ }
+ else
+ {
+ FadeSoundsAndMusic();
+
+#if 0
+#if 1
+ {
+#if 0
+ boolean use_cross_fading = (fading.anim_mode == ANIM_CROSSFADE);
+#endif
+
+ if (use_cross_fading)
+ FadeCrossSaveBackbuffer();
+ else
+ FadeOut(REDRAW_ALL);
+ }
+#else
+ FadeOut(REDRAW_ALL);
+#endif
+#endif
+
+ return_to_main_menu = TRUE;
+ }
+ }
+
+ if (return_to_main_menu)
+ {
+#if 0
+ RedrawBackground();
+#endif
+
+ SetMouseCursor(CURSOR_DEFAULT);
+
+ if (game_status == GAME_MODE_INFO)
+ {
+#if 0
+ OpenDoor(DOOR_CLOSE_1 | DOOR_CLOSE_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
+#endif
+
+ info_mode = INFO_MODE_MAIN;
+ DrawInfoScreenExt(REDRAW_ALL, use_fading_main_menu);
+ }
+ else /* default: return to main menu */
+ {
+#if 0
+ OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
+#endif