+ if (visibleTextPos(pos_text) && text != NULL)
+ {
+ struct TextPosInfo *pos = pos_text;
+ int x = mSX + ALIGNED_TEXT_XPOS(pos);
+ int y = mSY + ALIGNED_TEXT_YPOS(pos);
+
+#if 1
+ /* (check why/if this is needed) */
+ DrawBackgroundForFont(x, y, pos->width, pos->height, font_text);
+#endif
+ DrawText(x, y, text, font_text);
+ }
+
+ if (visibleTextPos(pos_input) && input != NULL)
+ {
+ struct TextPosInfo *pos = pos_input;
+ int x = mSX + ALIGNED_TEXT_XPOS(pos);
+ int y = mSY + ALIGNED_TEXT_YPOS(pos);
+
+#if 1
+ /* (check why/if this is needed) */
+ DrawBackgroundForFont(x, y, pos->width, pos->height, font_input);
+#endif
+ DrawText(x, y, input, font_input);
+ }
+ }
+ }
+}
+
+static void DrawCursorAndText_Main(int nr, boolean active_text)
+{
+ DrawCursorAndText_Main_Ext(nr, active_text, FALSE);
+}
+
+#if 0
+static void DrawCursorAndText_Main_Input(int nr, boolean active_text)
+{
+ DrawCursorAndText_Main_Ext(nr, active_text, TRUE);
+}
+#endif
+
+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
+
+ game_status = GAME_MODE_MAIN;
+ DrawMainMenuExt(REDRAW_ALL, use_fading_main_menu);
+ }
+ }
+}
+
+void HandleMainMenu_SelectLevel(int step, int direction)
+{
+ int old_level_nr = level_nr;
+ int new_level_nr;
+
+ new_level_nr = old_level_nr + step * direction;
+ if (new_level_nr < leveldir_current->first_level)
+ new_level_nr = leveldir_current->first_level;
+ if (new_level_nr > leveldir_current->last_level)
+ new_level_nr = leveldir_current->last_level;
+
+ if (setup.handicap && new_level_nr > leveldir_current->handicap_level)
+ {
+ /* skipping levels is only allowed when trying to skip single level */
+ if (setup.skip_levels && step == 1 &&
+ Request("Level still unsolved ! Skip despite handicap ?", REQ_ASK))
+ {
+ leveldir_current->handicap_level++;
+ SaveLevelSetup_SeriesInfo();
+ }
+
+ new_level_nr = leveldir_current->handicap_level;
+ }
+
+ if (new_level_nr != old_level_nr)
+ {
+ struct MainControlInfo *mci= getMainControlInfo(MAIN_CONTROL_LEVEL_NUMBER);
+
+ PlaySound(SND_MENU_ITEM_SELECTING);
+
+ level_nr = new_level_nr;
+
+#if 1
+ DrawText(mSX + mci->pos_text->x, mSY + mci->pos_text->y,
+ int2str(level_nr, 3), mci->pos_text->font);
+#else
+ DrawText(mSX + 11 * 32, mSY + 3 * 32, int2str(level_nr, 3), FONT_VALUE_1);
+#endif
+
+ LoadLevel(level_nr);
+ DrawPreviewLevel(TRUE);
+
+ TapeErase();
+ LoadTape(level_nr);
+ DrawCompleteVideoDisplay();
+
+ /* needed because DrawPreviewLevel() takes some time */
+ BackToFront();
+ SyncDisplay();
+ }
+}
+
+#if 1
+
+void HandleMainMenu(int mx, int my, int dx, int dy, int button)
+{
+ static int choice = MAIN_CONTROL_GAME;
+ int pos = choice;
+ int i;
+
+ if (button == MB_MENU_INITIALIZE)
+ {
+ DrawCursorAndText_Main(choice, TRUE);
+
+ return;
+ }
+
+ if (mx || my) /* mouse input */
+ {
+ pos = -1;
+
+ for (i = 0; main_controls[i].nr != -1; i++)
+ {
+ if (insideMenuPosRect(main_controls[i].pos_button, mx - mSX, my - mSY) ||
+ insideTextPosRect(main_controls[i].pos_text, mx - mSX, my - mSY) ||
+ insideTextPosRect(main_controls[i].pos_input, mx - mSX, my - mSY))
+ {
+ pos = main_controls[i].nr;
+
+ break;
+ }
+ }
+ }
+ else if (dx || dy) /* keyboard input */
+ {
+ if (dx > 0 && (choice == MAIN_CONTROL_INFO ||
+ choice == MAIN_CONTROL_SETUP))
+ button = MB_MENU_CHOICE;
+ else if (dy)
+ pos = choice + dy;
+ }
+
+ if (pos == MAIN_CONTROL_LEVELS && dx != 0 && button)
+ {
+ HandleMainMenu_SelectLevel(1, dx < 0 ? -1 : +1);
+ }
+ else if (pos >= MAIN_CONTROL_NAME && pos <= MAIN_CONTROL_QUIT)
+ {
+ if (button)
+ {
+ if (pos != choice)
+ {
+ PlaySound(SND_MENU_ITEM_ACTIVATING);
+
+ DrawCursorAndText_Main(choice, FALSE);
+ DrawCursorAndText_Main(pos, TRUE);
+
+ choice = pos;
+ }
+ }
+ else
+ {
+ PlaySound(SND_MENU_ITEM_SELECTING);
+
+ if (pos == MAIN_CONTROL_NAME)
+ {
+ game_status = GAME_MODE_PSEUDO_TYPENAME;
+
+ HandleTypeName(strlen(setup.player_name), 0);
+ }
+ else if (pos == MAIN_CONTROL_LEVELS)
+ {
+ if (leveldir_first)
+ {
+ game_status = GAME_MODE_LEVELS;
+
+ SaveLevelSetup_LastSeries();
+ SaveLevelSetup_SeriesInfo();
+
+#if 0
+ gotoTopLevelDir();
+#endif
+
+ DrawChooseLevel();
+ }
+ }
+ else if (pos == MAIN_CONTROL_SCORES)
+ {
+ game_status = GAME_MODE_SCORES;
+
+ DrawHallOfFame(-1);
+ }
+ else if (pos == MAIN_CONTROL_EDITOR)
+ {
+ if (leveldir_current->readonly &&
+ !strEqual(setup.player_name, "Artsoft"))
+ Request("This level is read only !", REQ_CONFIRM);
+
+ game_status = GAME_MODE_EDITOR;
+
+ fading = menu.destination;
+
+ DrawLevelEd();
+ }
+ else if (pos == MAIN_CONTROL_INFO)
+ {
+ game_status = GAME_MODE_INFO;
+ info_mode = INFO_MODE_MAIN;
+
+ fading = menu.navigation;
+
+ DrawInfoScreen();
+ }
+ else if (pos == MAIN_CONTROL_GAME)
+ {
+ StartGameActions(options.network, setup.autorecord, NEW_RANDOMIZE);
+ }
+ else if (pos == MAIN_CONTROL_SETUP)
+ {
+ game_status = GAME_MODE_SETUP;
+ setup_mode = SETUP_MODE_MAIN;
+
+ DrawSetupScreen();
+ }
+ else if (pos == MAIN_CONTROL_QUIT)
+ {
+ SaveLevelSetup_LastSeries();
+ SaveLevelSetup_SeriesInfo();
+
+ if (Request("Do you really want to quit ?", REQ_ASK | REQ_STAY_CLOSED))
+ game_status = GAME_MODE_QUIT;
+ }
+ }
+ }
+
+ if (game_status == GAME_MODE_MAIN)
+ {
+ DrawPreviewLevel(FALSE);
+ DoAnimation();
+ }
+}
+
+#else
+
+void HandleMainMenu(int mx, int my, int dx, int dy, int button)
+{
+ static int choice = 5;
+ int x = 0;
+ int y = choice;
+
+ if (button == MB_MENU_INITIALIZE)
+ {
+ drawCursor(choice, TRUE);
+
+ return;
+ }
+
+ if (mx || my) /* mouse input */
+ {
+ x = (mx - mSX) / 32;
+ y = (my - mSY) / 32 - MENU_SCREEN_START_YPOS;
+ }
+ else if (dx || dy) /* keyboard input */
+ {
+ if (dx && choice == 1)
+ x = (dx < 0 ? 10 : 14);
+ else if (dx > 0)
+ {
+ if (choice == 4 || choice == 6)
+ button = MB_MENU_CHOICE;
+ }
+ else if (dy)
+ y = choice + dy;
+ }
+
+ if (y == 1 && dx != 0 && button)
+ {
+ HandleMainMenu_SelectLevel(1, dx < 0 ? -1 : +1);
+ }
+ else if (IN_VIS_FIELD(x, y) &&
+ y >= 0 && y <= 7 && (y != 1 || x < 10))
+ {
+ if (button)
+ {
+ if (y != choice)
+ {
+ drawCursor(choice, FALSE);
+ drawCursor(y, TRUE);
+
+ choice = y;
+ }
+ }
+ else
+ {
+ if (y == 0)
+ {
+ game_status = GAME_MODE_PSEUDO_TYPENAME;
+ HandleTypeName(strlen(setup.player_name), 0);
+ }
+ else if (y == 1)
+ {
+ if (leveldir_first)
+ {
+ game_status = GAME_MODE_LEVELS;
+ SaveLevelSetup_LastSeries();
+ SaveLevelSetup_SeriesInfo();
+
+#if 0
+ gotoTopLevelDir();
+#endif
+
+ DrawChooseLevel();
+ }
+ }
+ else if (y == 2)
+ {
+ game_status = GAME_MODE_SCORES;
+ DrawHallOfFame(-1);
+ }
+ else if (y == 3)
+ {
+ if (leveldir_current->readonly &&
+ !strEqual(setup.player_name, "Artsoft"))
+ Request("This level is read only !", REQ_CONFIRM);
+ game_status = GAME_MODE_EDITOR;
+ DrawLevelEd();
+ }
+ else if (y == 4)
+ {
+ game_status = GAME_MODE_INFO;
+ info_mode = INFO_MODE_MAIN;
+ DrawInfoScreen();
+ }
+ else if (y == 5)
+ {
+ StartGameActions(options.network, setup.autorecord, NEW_RANDOMIZE);
+ }
+ else if (y == 6)
+ {
+ game_status = GAME_MODE_SETUP;
+ setup_mode = SETUP_MODE_MAIN;
+
+ DrawSetupScreen();
+ }
+ else if (y == 7)
+ {
+ SaveLevelSetup_LastSeries();
+ SaveLevelSetup_SeriesInfo();
+
+ if (Request("Do you really want to quit ?", REQ_ASK | REQ_STAY_CLOSED))
+ game_status = GAME_MODE_QUIT;
+ }
+ }
+ }
+
+ if (game_status == GAME_MODE_MAIN)
+ {
+ DrawPreviewLevel(FALSE);
+ DoAnimation();
+ }
+}
+
+#endif
+
+
+/* ========================================================================= */
+/* info screen functions */
+/* ========================================================================= */
+
+static struct TokenInfo *info_info;
+static int num_info_info;
+
+static void execInfoTitleScreen()
+{
+ fading = menu.destination;
+
+ info_mode = INFO_MODE_TITLE;
+ DrawInfoScreen();
+}
+
+static void execInfoElements()
+{
+ fading = menu.destination;
+
+ info_mode = INFO_MODE_ELEMENTS;
+ DrawInfoScreen();
+}
+
+static void execInfoMusic()
+{
+ fading = menu.destination;
+
+ info_mode = INFO_MODE_MUSIC;
+ DrawInfoScreen();
+}
+
+static void execInfoCredits()
+{
+ fading = menu.destination;
+
+ info_mode = INFO_MODE_CREDITS;
+ DrawInfoScreen();
+}
+
+static void execInfoProgram()
+{
+ fading = menu.destination;
+
+ info_mode = INFO_MODE_PROGRAM;
+ DrawInfoScreen();
+}
+
+static void execInfoVersion()
+{
+ fading = menu.destination;
+
+ info_mode = INFO_MODE_VERSION;
+ DrawInfoScreen();
+}
+
+static void execInfoLevelSet()
+{
+ fading = menu.destination;
+
+ info_mode = INFO_MODE_LEVELSET;
+ DrawInfoScreen();
+}
+
+static void execExitInfo()
+{
+ fading = menu.navigation;
+
+ game_status = GAME_MODE_MAIN;
+#if 1
+ DrawMainMenuExt(REDRAW_FIELD, FALSE);
+#else
+ DrawMainMenu();
+#endif
+}
+
+static struct TokenInfo info_info_main[] =
+{
+ { TYPE_ENTER_SCREEN, execInfoTitleScreen, "Title Screen" },
+ { TYPE_ENTER_SCREEN, execInfoElements, "Elements Info" },
+ { TYPE_ENTER_SCREEN, execInfoMusic, "Music Info" },
+ { TYPE_ENTER_SCREEN, execInfoCredits, "Credits" },
+ { TYPE_ENTER_SCREEN, execInfoProgram, "Program Info" },
+ { TYPE_ENTER_SCREEN, execInfoVersion, "Version Info" },
+ { TYPE_ENTER_SCREEN, execInfoLevelSet, "Level Set Info" },
+ { TYPE_EMPTY, NULL, "" },
+ { TYPE_LEAVE_MENU, execExitInfo, "Exit" },
+
+ { 0, NULL, NULL }
+};
+
+static void DrawCursorAndText_Info(int pos, boolean active)
+{
+ int xpos = MENU_SCREEN_START_XPOS;
+ int ypos = MENU_SCREEN_START_YPOS + pos;
+ int font_nr = FONT_MENU_1;
+
+ if (active)
+ font_nr = FONT_ACTIVE(font_nr);
+
+ DrawText(mSX + xpos * 32, mSY + ypos * 32, info_info[pos].text, font_nr);
+
+ if (info_info[pos].type & ~TYPE_SKIP_ENTRY)
+ drawCursor(pos, active);
+}
+
+static void DrawInfoScreen_Main(int redraw_mask, boolean do_fading)
+{
+ int i;
+
+ UnmapAllGadgets();
+ CloseDoor(DOOR_CLOSE_2);
+
+#if XFADE
+ if (fading.anim_mode == ANIM_CROSSFADE)
+ FadeCrossSaveBackbuffer();
+ else
+ FadeOut(redraw_mask);
+#endif
+
+#if 1
+ if (redraw_mask == REDRAW_ALL)
+ {
+ RedrawBackground();
+ OpenDoor(DOOR_CLOSE_1 | DOOR_CLOSE_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
+ }
+#endif
+
+ ClearWindow();
+
+ DrawTextSCentered(mSY - SY + 16, FONT_TITLE_1, "Info Screen");
+
+ info_info = info_info_main;
+ num_info_info = 0;
+
+ for (i = 0; info_info[i].type != 0 && i < NUM_MENU_ENTRIES_ON_SCREEN; i++)
+ {
+#if 0
+ int xpos = MENU_SCREEN_START_XPOS;
+ int ypos = MENU_SCREEN_START_YPOS + i;
+ int font_nr = FONT_MENU_1;
+#endif
+
+ if (info_info[i].type & (TYPE_ENTER_MENU|TYPE_ENTER_LIST))
+ initCursor(i, IMG_MENU_BUTTON_ENTER_MENU);
+ else if (info_info[i].type & (TYPE_LEAVE_MENU|TYPE_LEAVE_LIST))
+ initCursor(i, IMG_MENU_BUTTON_LEAVE_MENU);
+ else if (info_info[i].type & ~TYPE_SKIP_ENTRY)
+ initCursor(i, IMG_MENU_BUTTON);
+
+#if 1
+ DrawCursorAndText_Info(i, FALSE);
+#else
+ DrawText(mSX + xpos * 32, mSY + ypos * 32, info_info[i].text, font_nr);
+#endif
+
+ num_info_info++;
+ }
+
+ HandleInfoScreen_Main(0, 0, 0, 0, MB_MENU_INITIALIZE);
+
+ PlayMenuSound();
+ PlayMenuMusic();
+
+ DrawMaskedBorder(REDRAW_ALL);
+
+#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
+
+ InitAnimation();
+}
+
+void HandleInfoScreen_Main(int mx, int my, int dx, int dy, int button)
+{
+ static int choice_store[MAX_INFO_MODES];
+ int choice = choice_store[info_mode]; /* always starts with 0 */
+ int x = 0;
+ int y = choice;
+
+ if (button == MB_MENU_INITIALIZE)
+ {
+ /* advance to first valid menu entry */
+ while (choice < num_info_info &&
+ info_info[choice].type & TYPE_SKIP_ENTRY)
+ choice++;
+ choice_store[info_mode] = choice;
+
+#if 1
+ DrawCursorAndText_Info(choice, TRUE);
+#else
+ drawCursor(choice, TRUE);
+#endif
+
+ return;
+ }
+ else if (button == MB_MENU_LEAVE)
+ {
+ for (y = 0; y < num_info_info; y++)
+ {
+ if (info_info[y].type & TYPE_LEAVE_MENU)
+ {
+ void (*menu_callback_function)(void) = info_info[y].value;
+
+ menu_callback_function();
+
+ break; /* absolutely needed because function changes 'info_info'! */
+ }
+ }
+
+ return;
+ }
+
+ if (mx || my) /* mouse input */
+ {
+ x = (mx - mSX) / 32;
+ y = (my - mSY) / 32 - MENU_SCREEN_START_YPOS;
+ }
+ else if (dx || dy) /* keyboard input */
+ {
+ if (dx)
+ {
+ int menu_navigation_type = (dx < 0 ? TYPE_LEAVE : TYPE_ENTER);
+
+ if (info_info[choice].type & menu_navigation_type ||
+ info_info[choice].type & TYPE_ENTER_SCREEN ||
+ info_info[choice].type & TYPE_BOOLEAN_STYLE)
+ button = MB_MENU_CHOICE;
+ }
+ else if (dy)
+ y = choice + dy;
+
+ /* jump to next non-empty menu entry (up or down) */
+ while (y > 0 && y < num_info_info - 1 &&
+ info_info[y].type & TYPE_SKIP_ENTRY)
+ y += dy;
+ }
+
+ if (IN_VIS_FIELD(x, y) &&
+ y >= 0 && y < num_info_info && info_info[y].type & ~TYPE_SKIP_ENTRY)
+ {
+ if (button)
+ {
+ if (y != choice)
+ {
+ PlaySound(SND_MENU_ITEM_ACTIVATING);
+
+#if 1
+ DrawCursorAndText_Info(choice, FALSE);
+ DrawCursorAndText_Info(y, TRUE);
+#else
+ drawCursor(choice, FALSE);
+ drawCursor(y, TRUE);
+#endif
+
+ choice = choice_store[info_mode] = y;
+ }
+ }
+ else if (!(info_info[y].type & TYPE_GHOSTED))
+ {
+ PlaySound(SND_MENU_ITEM_SELECTING);
+
+ if (info_info[y].type & TYPE_ENTER_OR_LEAVE)
+ {
+ void (*menu_callback_function)(void) = info_info[choice].value;
+
+ menu_callback_function();
+ }
+ }
+ }
+}
+
+void DrawInfoScreen_NotAvailable(char *text_title, char *text_error)
+{
+#if 1
+ int ystart1 = mSY - SY + 100;
+ int ystart2 = mSY - SY + 150;
+ int ybottom = mSY - SY + SYSIZE - 20;
+#else
+ int ystart1 = 100;
+ int ystart2 = 150;
+ int ybottom = SYSIZE - 20;
+#endif
+
+ SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_LEVELSET);
+
+#if XFADE
+ if (fading.anim_mode == ANIM_CROSSFADE)
+ FadeCrossSaveBackbuffer();
+ else
+ FadeOut(REDRAW_FIELD);
+#else
+ FadeOut(REDRAW_FIELD);
+#endif
+
+ ClearWindow();
+ DrawHeadline();
+
+ DrawTextSCentered(ystart1, FONT_TEXT_1, text_title);
+ DrawTextSCentered(ystart2, FONT_TEXT_2, text_error);
+
+ DrawTextSCentered(ybottom, FONT_TEXT_4,
+ "Press any key or button for info menu");
+
+#if XFADE
+ if (fading.anim_mode == ANIM_CROSSFADE)
+ FadeCross(REDRAW_FIELD);
+ else
+ FadeIn(REDRAW_FIELD);
+#else
+ FadeIn(REDRAW_FIELD);
+#endif
+}
+
+void DrawInfoScreen_HelpAnim(int start, int max_anims, boolean init)
+{
+ static int infoscreen_step[MAX_INFO_ELEMENTS_ON_SCREEN];
+ static int infoscreen_frame[MAX_INFO_ELEMENTS_ON_SCREEN];
+ int xstart = mSX + 16;
+ int ystart1 = mSY - SY + 100;
+ int ystart2 = mSY + 64 + 2 * 32;
+ int ybottom = mSY - SY + SYSIZE - 20;
+ int ystep = TILEY + 4;
+ int element, action, direction;
+ int graphic;
+ int delay;
+ int sync_frame;
+ int i, j;
+
+ if (init)
+ {
+ for (i = 0; i < MAX_INFO_ELEMENTS_ON_SCREEN; i++)
+ infoscreen_step[i] = infoscreen_frame[i] = 0;
+
+ ClearWindow();
+ DrawHeadline();
+
+ DrawTextSCentered(ystart1, FONT_TEXT_1, "The Game Elements:");
+
+ DrawTextSCentered(ybottom, FONT_TEXT_4,
+ "Press any key or button for next page");
+
+ FrameCounter = 0;
+ }
+
+ i = j = 0;
+ while (helpanim_info[j].element != HELPANIM_LIST_END)
+ {
+ if (i >= start + MAX_INFO_ELEMENTS_ON_SCREEN ||
+ i >= max_anims)
+ break;
+ else if (i < start)
+ {
+ while (helpanim_info[j].element != HELPANIM_LIST_NEXT)
+ j++;
+
+ j++;
+ i++;
+
+ continue;
+ }
+
+ j += infoscreen_step[i - start];
+
+ element = helpanim_info[j].element;
+ action = helpanim_info[j].action;
+ direction = helpanim_info[j].direction;
+
+ if (element < 0)
+ element = EL_UNKNOWN;
+
+ if (action != -1 && direction != -1)
+ graphic = el_act_dir2img(element, action, direction);
+ else if (action != -1)
+ graphic = el_act2img(element, action);
+ else if (direction != -1)
+ graphic = el_dir2img(element, direction);
+ else
+ graphic = el2img(element);