-void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
-{
- static unsigned long title_delay = 0;
- static int title_nr = 0;
- static boolean showing_message = FALSE;
- char *filename = getLevelSetMessageFilename();
- boolean return_to_main_menu = FALSE;
- boolean use_fading_main_menu = TRUE;
- boolean use_cross_fading = !show_title_initial; /* default */
- boolean no_title_info = (graphic_info[IMG_TITLESCREEN_1].bitmap == NULL &&
- getLevelSetMessageFilename(1, FALSE) == NULL);
-
- if (button == MB_MENU_INITIALIZE)
- {
- int last_game_status = game_status; /* save current game status */
-
- title_delay = 0;
- title_nr = 0;
- showing_message = FALSE;
-
- if (show_title_initial &&
- graphic_info[IMG_TITLESCREEN_INITIAL_1].bitmap == NULL &&
- getLevelSetMessageFilename(1, TRUE) == NULL)
- show_title_initial = FALSE;
-
- if (game_status == GAME_MODE_INFO)
- {
- if (no_title_info)
- {
- DrawInfoScreen_NotAvailable("Title screen information:",
- "No title screen for this level set.");
-
- title.auto_delay_final = -1;
-
- return;
- }
-
- FadeSoundsAndMusic();
-
- FadeOut(REDRAW_ALL);
- }
-
- /* force TITLE music on title info screen */
- game_status = GAME_MODE_TITLE;
-
- PlayMenuSound();
- PlayMenuMusic();
-
- game_status = last_game_status; /* restore current game status */
-
- if (graphic_info[getTitleScreenGraphic(0, show_title_initial)].bitmap != NULL)
- {
- DrawTitleScreenImage(title_nr, show_title_initial);
- }
- else
- {
- DrawTitleScreenMessage(filename);
-
- showing_message = TRUE;
-
- title.fade_delay_final = title.fade_delay;
- title.post_delay_final = title.post_delay;
- title.auto_delay_final = -1;
- }
-
- FadeIn(REDRAW_ALL);
-
- DelayReached(&title_delay, 0); /* reset delay counter */
-
- return;
- }
-
- if (title.auto_delay_final > -1 &&
- DelayReached(&title_delay, title.auto_delay_final))
- 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)
- {
- int anim_mode;
-
- if (game_status == GAME_MODE_INFO && no_title_info)
- {
- FadeOut(REDRAW_FIELD);
-
- info_mode = INFO_MODE_MAIN;
- DrawAndFadeInInfoScreen(REDRAW_FIELD);
-
- return;
- }
-
- title_nr++;
-
- if (show_title_initial &&
- (title_nr >= MAX_NUM_TITLE_IMAGES ||
- graphic_info[IMG_TITLESCREEN_INITIAL_1 + title_nr].bitmap == NULL))
- {
- show_title_initial = FALSE;
-
- title_nr = 0; /* restart with title screens for current level set */
- }
-
- anim_mode = graphic_info[getTitleScreenGraphic(title_nr, show_title_initial)].anim_mode;
-
- use_cross_fading = (anim_mode == ANIM_FADE ? FALSE :
- anim_mode == ANIM_CROSSFADE ? TRUE :
- use_cross_fading);
-
- if (!use_cross_fading)
- FadeOut(REDRAW_ALL);
-
- if (title_nr < MAX_NUM_TITLE_IMAGES &&
- graphic_info[getTitleScreenGraphic(title_nr, show_title_initial)].bitmap != NULL)
- {
- if (use_cross_fading)
- FadeCrossSaveBackbuffer();
-
- DrawTitleScreenImage(title_nr, show_title_initial);
-
- if (use_cross_fading)
- FadeCross(REDRAW_ALL);
- else
- FadeIn(REDRAW_ALL);
-
- DelayReached(&title_delay, 0); /* reset delay counter */
- }
- else if (!showing_message && filename != NULL)
- {
- if (use_cross_fading)
- FadeCrossSaveBackbuffer();
-
- DrawTitleScreenMessage(filename);