static void MapScreenTreeGadgets(TreeInfo *);
static struct GadgetInfo *screen_gadget[NUM_SCREEN_GADGETS];
+
+static boolean show_titlescreen_initial = TRUE;
+
static int setup_mode = SETUP_MODE_MAIN;
static int info_mode = INFO_MODE_MAIN;
static boolean insideMenuPosRect(struct MenuPosInfo *rect, int x, int y)
{
+ if (rect == NULL)
+ return FALSE;
+
int rect_x = ALIGNED_XPOS(rect->x, rect->width, rect->align);
int rect_y = rect->y;
- return (rect != NULL &&
- x >= rect_x && x < rect_x + rect->width &&
+ return (x >= rect_x && x < rect_x + rect->width &&
y >= rect_y && y < rect_y + rect->height);
}
}
#endif
+static int getTitleScreenGraphic()
+{
+ return (show_titlescreen_initial ? IMG_TITLESCREEN_INITIAL_1 :
+ IMG_TITLESCREEN_1);
+}
+
void DrawTitleScreenImage(int nr)
{
- int graphic = IMG_TITLESCREEN_1 + nr;
+ int graphic = getTitleScreenGraphic() + nr;
Bitmap *bitmap = graphic_info[graphic].bitmap;
int width = graphic_info[graphic].src_image_width;
int height = graphic_info[graphic].src_image_height;
#endif
if (setup.show_titlescreen &&
- levelset_has_changed &&
- graphic_info[IMG_TITLESCREEN_1].bitmap != NULL)
+ ((levelset_has_changed &&
+ graphic_info[IMG_TITLESCREEN_1].bitmap != NULL) ||
+ (show_titlescreen_initial &&
+ graphic_info[IMG_TITLESCREEN_INITIAL_1].bitmap != NULL)))
{
game_status = GAME_MODE_TITLE;
void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
{
+ static unsigned long title_delay = 0;
static int title_nr = 0;
boolean return_to_main_menu = FALSE;
boolean use_fading_main_menu = TRUE;
- boolean use_cross_fading = TRUE;
+ boolean use_cross_fading = !show_titlescreen_initial; /* default */
+ int auto_delay = menu.auto_delay;
if (button == MB_MENU_INITIALIZE)
{
int last_game_status = game_status; /* save current game status */
+
+ title_delay = 0;
title_nr = 0;
if (game_status == GAME_MODE_INFO)
FadeIn(REDRAW_ALL);
+ DelayReached(&title_delay, 0); /* reset delay counter */
+
return;
}
- else if (button == MB_MENU_LEAVE)
+
+ int anim_delay = graphic_info[getTitleScreenGraphic() + title_nr].anim_delay;
+ if (anim_delay > 1)
+ auto_delay = anim_delay;
+
+ if (auto_delay > 0 && DelayReached(&title_delay, auto_delay))
+ button = MB_MENU_CHOICE;
+
+ if (button == MB_MENU_LEAVE)
{
return_to_main_menu = TRUE;
use_fading_main_menu = FALSE;
title_nr++;
+ if (show_titlescreen_initial &&
+ (title_nr >= MAX_NUM_TITLE_SCREENS ||
+ graphic_info[IMG_TITLESCREEN_INITIAL_1 + title_nr].bitmap == NULL))
+ {
+ show_titlescreen_initial = FALSE;
+
+ title_nr = 0; /* restart with title screens for current level set */
+ }
+
+ int anim_mode = graphic_info[getTitleScreenGraphic() + title_nr].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_SCREENS &&
- graphic_info[IMG_TITLESCREEN_1 + title_nr].bitmap != NULL)
+ graphic_info[getTitleScreenGraphic() + title_nr].bitmap != NULL)
{
if (use_cross_fading)
FadeCrossSaveBackbuffer();
FadeCross(REDRAW_ALL);
else
FadeIn(REDRAW_ALL);
+
+ DelayReached(&title_delay, 0); /* reset delay counter */
}
else
{
NextEvent(&event);
- switch(event.type)
+ switch (event.type)
{
case EVENT_KEYPRESS:
{
NextEvent(&event);
- switch(event.type)
+ switch (event.type)
{
case EVENT_KEYPRESS:
{
NextEvent(&event);
- switch(event.type)
+ switch (event.type)
{
case EVENT_KEYPRESS:
- switch(GetEventKey((KeyEvent *)&event, TRUE))
+ switch (GetEventKey((KeyEvent *)&event, TRUE))
{
case KSYM_Return:
if (check_remaining == 0)