-#define MAX_HELPSCREEN_ELS 10
-#define HA_NEXT -999
-#define HA_END -1000
-
-static long helpscreen_state;
-static int helpscreen_step[MAX_HELPSCREEN_ELS];
-static int helpscreen_frame[MAX_HELPSCREEN_ELS];
-static int helpscreen_delay[MAX_HELPSCREEN_ELS];
-static int helpscreen_action[] =
-{
- GFX_SPIELER1_DOWN,4,2,
- GFX_SPIELER1_UP,4,2,
- GFX_SPIELER1_LEFT,4,2,
- GFX_SPIELER1_RIGHT,4,2,
- GFX_SPIELER1_PUSH_LEFT,4,2,
- GFX_SPIELER1_PUSH_RIGHT,4,2, HA_NEXT,
- GFX_ERDREICH,1,100, HA_NEXT,
- GFX_LEERRAUM,1,100, HA_NEXT,
- GFX_MORAST_LEER,1,100, HA_NEXT,
- GFX_BETON,1,100, HA_NEXT,
- GFX_MAUERWERK,1,100, HA_NEXT,
- GFX_MAUER_L1, 3,4, GFX_MAUERWERK,1,20, GFX_LEERRAUM,1,10,
- GFX_MAUER_R1, 3,4, GFX_MAUERWERK,1,20, GFX_LEERRAUM,1,10,
- GFX_MAUER_UP, 3,4, GFX_MAUERWERK,1,20, GFX_LEERRAUM,1,10,
- GFX_MAUER_DOWN,3,4, GFX_MAUERWERK,1,20, GFX_LEERRAUM,1,10, HA_NEXT,
- GFX_UNSICHTBAR,1,100, HA_NEXT,
- GFX_FELSBODEN,1,100, HA_NEXT,
- GFX_CHAR_A,30,4, GFX_CHAR_AUSRUF,32,4, HA_NEXT,
- GFX_EDELSTEIN,2,5, HA_NEXT,
- GFX_DIAMANT,2,5, HA_NEXT,
- GFX_EDELSTEIN_BD,2,5, HA_NEXT,
- GFX_EDELSTEIN_GELB,2,5, GFX_EDELSTEIN_ROT,2,5,
- GFX_EDELSTEIN_LILA,2,5, HA_NEXT,
- GFX_FELSBROCKEN,4,5, HA_NEXT,
- GFX_BOMBE,1,50, GFX_EXPLOSION,8,1, GFX_LEERRAUM,1,10, HA_NEXT,
- GFX_KOKOSNUSS,1,50, GFX_CRACKINGNUT,3,1, GFX_EDELSTEIN,1,10, HA_NEXT,
- GFX_ERZ_EDEL,1,50, GFX_EXPLOSION,8,1, GFX_EDELSTEIN,1,10, HA_NEXT,
- GFX_ERZ_DIAM,1,50, GFX_EXPLOSION,8,1, GFX_DIAMANT,1,10, HA_NEXT,
- GFX_ERZ_EDEL_BD,1,50, GFX_EXPLOSION,8,1,GFX_EDELSTEIN_BD,1,10,HA_NEXT,
- GFX_ERZ_EDEL_GELB,1,50, GFX_EXPLOSION,8,1,
- GFX_EDELSTEIN_GELB,1,10, GFX_ERZ_EDEL_ROT,1,50,
- GFX_EXPLOSION,8,1, GFX_EDELSTEIN_ROT,1,10,
- GFX_ERZ_EDEL_LILA,1,50, GFX_EXPLOSION,8,1,
- GFX_EDELSTEIN_LILA,1,10, HA_NEXT,
- GFX_GEBLUBBER,4,4, HA_NEXT,
- GFX_SCHLUESSEL1,4,25, HA_NEXT,
- GFX_PFORTE1,4,25, HA_NEXT,
- GFX_PFORTE1X,4,25, HA_NEXT,
- GFX_DYNAMIT_AUS,1,100, HA_NEXT,
- GFX_DYNAMIT,7,6, GFX_EXPLOSION,8,1, GFX_LEERRAUM,1,10, HA_NEXT,
- GFX_DYNABOMB+0,4,3, GFX_DYNABOMB+3,1,3, GFX_DYNABOMB+2,1,3,
- GFX_DYNABOMB+1,1,3, GFX_DYNABOMB+0,1,3, GFX_EXPLOSION,8,1,
- GFX_LEERRAUM,1,10, HA_NEXT,
- GFX_DYNABOMB_NR,1,100, HA_NEXT,
- GFX_DYNABOMB_SZ,1,100, HA_NEXT,
- GFX_FLIEGER+4,1,3, GFX_FLIEGER+0,1,3, GFX_FLIEGER+4,1,3,
- GFX_FLIEGER+5,1,3, GFX_FLIEGER+1,1,3, GFX_FLIEGER+5,1,3,
- GFX_FLIEGER+6,1,3, GFX_FLIEGER+2,1,3, GFX_FLIEGER+6,1,3,
- GFX_FLIEGER+7,1,3, GFX_FLIEGER+3,1,3, GFX_FLIEGER+7,1,3, HA_NEXT,
- GFX_KAEFER+4,1,1, GFX_KAEFER+0,1,1, GFX_KAEFER+4,1,1,
- GFX_KAEFER+5,1,1, GFX_KAEFER+1,1,1, GFX_KAEFER+5,1,1,
- GFX_KAEFER+6,1,1, GFX_KAEFER+2,1,1, GFX_KAEFER+6,1,1,
- GFX_KAEFER+7,1,1, GFX_KAEFER+3,1,1, GFX_KAEFER+7,1,1, HA_NEXT,
- GFX_BUTTERFLY,2,2, HA_NEXT,
- GFX_FIREFLY,2,2, HA_NEXT,
- GFX_PACMAN+0,1,3, GFX_PACMAN+4,1,2, GFX_PACMAN+0,1,3,
- GFX_PACMAN+1,1,3, GFX_PACMAN+5,1,2, GFX_PACMAN+1,1,3,
- GFX_PACMAN+2,1,3, GFX_PACMAN+6,1,2, GFX_PACMAN+2,1,3,
- GFX_PACMAN+3,1,3, GFX_PACMAN+7,1,2, GFX_PACMAN+3,1,3, HA_NEXT,
- GFX_MAMPFER+0,4,1, GFX_MAMPFER+3,1,1, GFX_MAMPFER+2,1,1,
- GFX_MAMPFER+1,1,1, GFX_MAMPFER+0,1,1, HA_NEXT,
- GFX_MAMPFER2+0,4,1, GFX_MAMPFER2+3,1,1, GFX_MAMPFER2+2,1,1,
- GFX_MAMPFER2+1,1,1, GFX_MAMPFER2+0,1,1, HA_NEXT,
- GFX_ROBOT+0,4,1, GFX_ROBOT+3,1,1, GFX_ROBOT+2,1,1,
- GFX_ROBOT+1,1,1, GFX_ROBOT+0,1,1, HA_NEXT,
- GFX_MOLE_DOWN,4,2,
- GFX_MOLE_UP,4,2,
- GFX_MOLE_LEFT,4,2,
- GFX_MOLE_RIGHT,4,2, HA_NEXT,
- GFX_PINGUIN_DOWN,4,2,
- GFX_PINGUIN_UP,4,2,
- GFX_PINGUIN_LEFT,4,2,
- GFX_PINGUIN_RIGHT,4,2, HA_NEXT,
- GFX_SCHWEIN_DOWN,4,2,
- GFX_SCHWEIN_UP,4,2,
- GFX_SCHWEIN_LEFT,4,2,
- GFX_SCHWEIN_RIGHT,4,2, HA_NEXT,
- GFX_DRACHE_DOWN,4,2,
- GFX_DRACHE_UP,4,2,
- GFX_DRACHE_LEFT,4,2,
- GFX_DRACHE_RIGHT,4,2, HA_NEXT,
- GFX_SONDE_START,8,1, HA_NEXT,
- GFX_ABLENK,4,1, HA_NEXT,
- GFX_BIRNE_AUS,1,25, GFX_BIRNE_EIN,1,25, HA_NEXT,
- GFX_ZEIT_VOLL,1,25, GFX_ZEIT_LEER,1,25, HA_NEXT,
- GFX_TROPFEN,1,25, GFX_AMOEBING,4,1, GFX_AMOEBE_LEBT,1,10, HA_NEXT,
- GFX_AMOEBE_TOT+2,2,50, GFX_AMOEBE_TOT,2,50, HA_NEXT,
- GFX_AMOEBE_LEBT,4,40, HA_NEXT,
- GFX_AMOEBE_LEBT,1,10, GFX_AMOEBING,4,2, HA_NEXT,
- GFX_AMOEBE_LEBT,1,25, GFX_AMOEBE_TOT,1,25, GFX_EXPLOSION,8,1,
- GFX_DIAMANT,1,10, HA_NEXT,
- GFX_LIFE,1,100, HA_NEXT,
- GFX_LIFE_ASYNC,1,100, HA_NEXT,
- GFX_MAGIC_WALL_OFF,4,2, HA_NEXT,
- GFX_MAGIC_WALL_BD_OFF,4,2, HA_NEXT,
- GFX_AUSGANG_ZU,1,100, GFX_AUSGANG_ACT,4,2,
- GFX_AUSGANG_AUF+0,4,2, GFX_AUSGANG_AUF+3,1,2,
- GFX_AUSGANG_AUF+2,1,2, GFX_AUSGANG_AUF+1,1,2, HA_NEXT,
- GFX_AUSGANG_AUF+0,4,2, GFX_AUSGANG_AUF+3,1,2,
- GFX_AUSGANG_AUF+2,1,2, GFX_AUSGANG_AUF+1,1,2, HA_NEXT,
- GFX_SOKOBAN_OBJEKT,1,100, HA_NEXT,
- GFX_SOKOBAN_FELD_LEER,1,100, HA_NEXT,
- GFX_SOKOBAN_FELD_VOLL,1,100, HA_NEXT,
- GFX_SPEED_PILL,1,100, HA_NEXT,
- HA_END
-};
-static char *helpscreen_eltext[][2] =
-{
- {"THE HERO:", "(Is _this_ guy good old Rockford?)"},
- {"Normal sand:", "You can dig through it"},
- {"Empty field:", "You can walk through it"},
- {"Quicksand: You cannot pass it,", "but rocks can fall though it"},
- {"Massive Wall:", "Nothing can go through it"},
- {"Normal Wall: You can't go through", "it, but you can bomb it away"},
- {"Growing Wall: Grows in several di-", "rections if there is an empty field"},
- {"Invisible Wall: Behaves like normal","wall, but is invisible"},
- {"Old Wall: Like normal wall, but", "some things can fall down from it"},
- {"Letter Wall: Looks like a letter,", "behaves like a normal wall"},
- {"Emerald: You must collect enough of","them to finish a level"},
- {"Diamond: Counts as 3 emeralds, but", "can be destroyed by rocks"},
- {"Diamond (BD style): Counts like one","emerald and behaves a bit different"},
- {"Colorful Gems:", "Seem to behave like Emeralds"},
- {"Rock: Smashes several things;", "Can be moved by the player"},
- {"Bomb: You can move it, but be", "careful when dropping it"},
- {"Nut: Throw a rock on it to open it;","Each nut contains an emerald"},
- {"Wall with an emerald inside:", "Bomb the wall away to get it"},
- {"Wall with a diamond inside:", "Bomb the wall away to get it"},
- {"Wall with BD style diamond inside:", "Bomb the wall away to get it"},
- {"Wall with colorful gem inside:", "Bomb the wall away to get it"},
- {"Acid: Things that fall in are gone", "forever (including our hero)"},
- {"Key: Opens the door that has the", "same color (red/yellow/green/blue)"},
- {"Door: Can be opened by the key", "with the same color"},
- {"Door: You have to find out the", "right color of the key for it"},
- {"Dynamite: Collect it and use it to", "destroy walls or kill enemies"},
- {"Dynamite: This one explodes after", "a few seconds"},
- {"Dyna Bomb: Explodes in 4 directions","with variable explosion size"},
- {"Dyna Bomb: Increases the number of", "dyna bombs available at a time"},
- {"Dyna Bomb: Increases the size of", "explosion of dyna bombs"},
- {"Spaceship: Moves at the left side", "of walls; don't touch it!"},
- {"Bug: Moves at the right side", "of walls; don't touch it!"},
- {"Butterfly: Moves at the right side", "of walls; don't touch it!"},
- {"Firefly: Moves at the left side", "of walls; don't touch it!"},
- {"Pacman: Eats the amoeba and you,", "if you're not careful"},
- {"Cruncher: Eats diamonds and you,", "if you're not careful"},
- {"Cruncher (BD style):", "Eats almost everything"},
- {"Robot: Tries to kill the player", ""},
- {"The mole: Eats the amoeba and turns","empty space into normal sand"},
- {"The penguin: Guide him to the exit,","but keep him away from monsters!"},
- {"The Pig: Harmless, but eats all", "gems it can get"},
- {"The Dragon: Breathes fire,", "especially to some monsters"},
- {"Sonde: Follows you everywhere;", "harmless, but may block your way"},
- {"Magic Wheel: Touch it to get rid of","the robots for some seconds"},
- {"Light Bulb: All of them must be", "switched on to finish a level"},
- {"Extra Time Orb: Adds some seconds", "to the time available for the level"},
- {"Amoeba Drop: Grows to an amoeba on", "the ground - don't touch it"},
- {"Dead Amoeba: Does not grow, but", "can still kill bugs and spaceships"},
- {"Normal Amoeba: Grows through empty", "fields, sand and quicksand"},
- {"Dropping Amoeba: This one makes", "drops that grow to a new amoeba"},
- {"Living Amoeba (BD style): Contains", "other element, when surrounded"},
- {"Game Of Life: Behaves like the well","known 'Game Of Life' (2333 style)"},
- {"Biomaze: A bit like the 'Game Of", "Life', but builds crazy mazes"},
- {"Magic Wall: Changes rocks, emeralds","and diamonds when they pass it"},
- {"Magic Wall (BD style):", "Changes rocks and BD style diamonds"},
- {"Exit door: Opens if you have enough","emeralds to finish the level"},
- {"Open exit door: Enter here to leave","the level and exit the actual game"},
- {"Sokoban element: Object which must", "be pushed to an empty field"},
- {"Sokoban element: Empty field where", "a Sokoban object can be placed on"},
- {"Sokoban element: Field with object", "which can be pushed away"},
- {"Speed pill: Lets the player run", "twice as fast as normally"},
+#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_MENU_XPOS(rect);
+ int rect_y = ALIGNED_MENU_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_MENU_XPOS(rect);
+ int rect_y = ALIGNED_MENU_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;
+ }
+
+ dst_x = (WIN_XSIZE - width) / 2;
+ dst_y = (WIN_YSIZE - height) / 2;
+
+ SetDrawBackgroundMask(REDRAW_ALL);
+ SetWindowBackgroundImage(IMG_BACKGROUND_TITLE);
+
+ 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 */
+ 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].fade_delay > -1)
+ title.fade_delay_final = graphic_info[graphic].fade_delay;
+ if (graphic_info[graphic].post_delay > -1)
+ title.post_delay_final = graphic_info[graphic].post_delay;
+ if (graphic_info[graphic].auto_delay > -1)
+ title.auto_delay_final = graphic_info[graphic].auto_delay;
+}
+
+void DrawTitleScreenMessage(int nr, boolean initial)
+{
+ char *filename = getLevelSetTitleMessageFilename(nr, initial);
+ 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;
+ int last_game_status = game_status; /* save current game status */
+
+ if (filename == NULL)
+ return;
+
+ SetDrawBackgroundMask(REDRAW_ALL);
+ SetWindowBackgroundImage(IMG_BACKGROUND_MESSAGE);
+
+ ClearRectangleOnBackground(drawto, 0, 0, WIN_XSIZE, WIN_YSIZE);
+
+ /* force MESSAGE font on title message screen */
+ game_status = GAME_MODE_MESSAGE;
+
+ 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;
+
+ DrawTextFile(sx, sy, filename, font_nr, max_chars_per_line, -1,
+ max_lines_per_screen, -1, FALSE, FALSE, FALSE);
+
+ 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
+
+ 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 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);
+ 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();
+
+ /* map gadgets for main menu screen */
+ MapTapeButtons();
+ MapScreenMenuGadgets(SCREEN_MASK_MAIN);
+
+ DrawMaskedBorder(REDRAW_ALL);
+
+ if (do_fading)
+ FadeIn(redraw_mask);
+ else
+ BackToFront();
+
+ 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
+
+#if 1
+void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
+{
+ static unsigned long title_delay = 0;
+ static int title_screen_nr = 0;
+ boolean return_to_main_menu = FALSE;
+ boolean use_fading_main_menu = TRUE;
+#if 1
+ boolean use_cross_fading = FALSE;
+#else
+ boolean use_cross_fading = !show_title_initial; /* default */
+#endif
+ struct TitleControlInfo *tci;
+
+ if (button == MB_MENU_INITIALIZE)
+ {
+ int last_game_status = game_status; /* save current game status */
+
+ title_delay = 0;
+ title_screen_nr = 0;
+ tci = &title_controls[title_screen_nr];
+
+#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.");
+
+ 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 (tci->is_image)
+ {
+ DrawTitleScreenImage(tci->local_nr, tci->initial);
+ }
+ else
+ {
+ DrawTitleScreenMessage(tci->local_nr, tci->initial);
+
+ title.fade_delay_final = title.fade_delay;
+ title.post_delay_final = title.post_delay;
+ title.auto_delay_final = -1;
+ }
+
+ SetMouseCursor(CURSOR_NONE);
+
+ 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 && num_title_screens == 0)
+ {
+ FadeOut(REDRAW_FIELD);
+
+ info_mode = INFO_MODE_MAIN;
+ DrawAndFadeInInfoScreen(REDRAW_FIELD);
+
+ return;
+ }
+
+ title_screen_nr++;
+ tci = &title_controls[title_screen_nr];
+
+ 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);
+
+ if (title_screen_nr < num_title_screens)
+ {
+ if (!use_cross_fading)
+ FadeOut(REDRAW_ALL);
+
+ if (use_cross_fading)
+ FadeCrossSaveBackbuffer();
+
+ if (tci->is_image)
+ DrawTitleScreenImage(tci->local_nr, tci->initial);
+ else
+ DrawTitleScreenMessage(tci->local_nr, tci->initial);
+
+ if (use_cross_fading)
+ FadeCross(REDRAW_ALL);
+ else
+ FadeIn(REDRAW_ALL);
+
+ DelayReached(&title_delay, 0); /* reset delay counter */
+ }
+ else
+ {
+ FadeSoundsAndMusic();
+
+ FadeOut(REDRAW_ALL);
+
+ return_to_main_menu = TRUE;
+ }
+ }
+
+ if (return_to_main_menu)
+ {
+ RedrawBackground();
+
+ SetMouseCursor(CURSOR_DEFAULT);
+
+ if (game_status == GAME_MODE_INFO)
+ {
+ OpenDoor(DOOR_CLOSE_1 | DOOR_CLOSE_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
+
+ info_mode = INFO_MODE_MAIN;
+ DrawInfoScreenExt(REDRAW_ALL, use_fading_main_menu);
+ }
+ else /* default: return to main menu */
+ {
+ OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
+
+ game_status = GAME_MODE_MAIN;
+ DrawMainMenuExt(REDRAW_ALL, use_fading_main_menu);
+ }
+ }
+}
+
+#else
+
+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);
+
+ if (use_cross_fading)
+ FadeCross(REDRAW_ALL);
+ else
+ FadeIn(REDRAW_ALL);
+
+ DelayReached(&title_delay, 0); /* reset delay counter */
+
+ showing_message = TRUE;
+ }
+ else
+ {
+ FadeSoundsAndMusic();
+
+ FadeOut(REDRAW_ALL);
+
+ return_to_main_menu = TRUE;
+ }
+ }
+
+ if (return_to_main_menu)
+ {
+ show_title_initial = FALSE;
+
+ RedrawBackground();
+
+ if (game_status == GAME_MODE_INFO)
+ {
+ OpenDoor(DOOR_CLOSE_1 | DOOR_CLOSE_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
+
+ info_mode = INFO_MODE_MAIN;
+ DrawInfoScreenExt(REDRAW_ALL, use_fading_main_menu);
+ }
+ else /* default: return to main menu */
+ {
+ OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
+
+ game_status = GAME_MODE_MAIN;
+ DrawMainMenuExt(REDRAW_ALL, use_fading_main_menu);
+ }
+ }
+}
+#endif
+
+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_CURRENT_LEVEL);
+
+ 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->font_text);
+#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) ||
+ insideMenuPosRect(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;
+
+ DrawLevelEd();
+ }
+ else if (pos == MAIN_CONTROL_INFO)
+ {
+ game_status = GAME_MODE_INFO;
+ info_mode = INFO_MODE_MAIN;
+
+ 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()
+{
+ info_mode = INFO_MODE_TITLE;
+ DrawInfoScreen();
+}
+
+static void execInfoElements()
+{
+ info_mode = INFO_MODE_ELEMENTS;
+ DrawInfoScreen();
+}
+
+static void execInfoMusic()
+{
+ info_mode = INFO_MODE_MUSIC;
+ DrawInfoScreen();
+}
+
+static void execInfoCredits()
+{
+ info_mode = INFO_MODE_CREDITS;
+ DrawInfoScreen();
+}
+
+static void execInfoProgram()
+{
+ info_mode = INFO_MODE_PROGRAM;
+ DrawInfoScreen();
+}
+
+static void execInfoVersion()
+{
+ info_mode = INFO_MODE_VERSION;
+ DrawInfoScreen();
+}
+
+static void execInfoLevelSet()
+{
+ info_mode = INFO_MODE_LEVELSET;
+ DrawInfoScreen();
+}
+
+static void execExitInfo()
+{
+ game_status = GAME_MODE_MAIN;
+ DrawMainMenu();
+}
+
+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 }