From: Holger Schemel Date: Sat, 30 Dec 2006 10:15:19 +0000 (+0100) Subject: rnd-20061230-1-src X-Git-Tag: 3.2.3^2~3 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=462bca0782be497b984922afda26b5bf12bd3d75;p=rocksndiamonds.git rnd-20061230-1-src --- diff --git a/src/conf_g2m.c b/src/conf_g2m.c index 1be3ed4f..447025c1 100644 --- a/src/conf_g2m.c +++ b/src/conf_g2m.c @@ -34,6 +34,10 @@ gamemode_to_music[] = GFX_SPECIAL_ARG_TITLE, MUS_BACKGROUND_TITLE }, + { + GFX_SPECIAL_ARG_MESSAGE, + MUS_BACKGROUND_MESSAGE + }, { GFX_SPECIAL_ARG_MAIN, MUS_BACKGROUND_MAIN diff --git a/src/conf_g2s.c b/src/conf_g2s.c index 059f8118..b4c9ff8f 100644 --- a/src/conf_g2s.c +++ b/src/conf_g2s.c @@ -30,6 +30,10 @@ gamemode_to_sound[] = GFX_SPECIAL_ARG_TITLE, SND_BACKGROUND_TITLE }, + { + GFX_SPECIAL_ARG_MESSAGE, + SND_BACKGROUND_MESSAGE + }, { GFX_SPECIAL_ARG_MAIN, SND_BACKGROUND_MAIN diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 5f6583f9..6a8faeec 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -4502,6 +4502,7 @@ struct ConfigInfo image_config[] = { "background", UNDEFINED_FILENAME }, { "background.TITLE", UNDEFINED_FILENAME }, + { "background.MESSAGE", UNDEFINED_FILENAME }, { "background.MAIN", UNDEFINED_FILENAME }, { "background.LEVELS", UNDEFINED_FILENAME }, { "background.SCORES", UNDEFINED_FILENAME }, diff --git a/src/conf_gfx.h b/src/conf_gfx.h index e0d76b64..f5c777a3 100644 --- a/src/conf_gfx.h +++ b/src/conf_gfx.h @@ -1566,29 +1566,30 @@ #define IMG_BACKGROUND_ENVELOPE_4 1545 #define IMG_BACKGROUND 1546 #define IMG_BACKGROUND_TITLE 1547 -#define IMG_BACKGROUND_MAIN 1548 -#define IMG_BACKGROUND_LEVELS 1549 -#define IMG_BACKGROUND_SCORES 1550 -#define IMG_BACKGROUND_EDITOR 1551 -#define IMG_BACKGROUND_INFO 1552 -#define IMG_BACKGROUND_INFO_ELEMENTS 1553 -#define IMG_BACKGROUND_INFO_MUSIC 1554 -#define IMG_BACKGROUND_INFO_CREDITS 1555 -#define IMG_BACKGROUND_INFO_PROGRAM 1556 -#define IMG_BACKGROUND_INFO_LEVELSET 1557 -#define IMG_BACKGROUND_SETUP 1558 -#define IMG_BACKGROUND_DOOR 1559 -#define IMG_TITLESCREEN_INITIAL_1 1560 -#define IMG_TITLESCREEN_INITIAL_2 1561 -#define IMG_TITLESCREEN_INITIAL_3 1562 -#define IMG_TITLESCREEN_INITIAL_4 1563 -#define IMG_TITLESCREEN_INITIAL_5 1564 -#define IMG_TITLESCREEN_1 1565 -#define IMG_TITLESCREEN_2 1566 -#define IMG_TITLESCREEN_3 1567 -#define IMG_TITLESCREEN_4 1568 -#define IMG_TITLESCREEN_5 1569 +#define IMG_BACKGROUND_MESSAGE 1548 +#define IMG_BACKGROUND_MAIN 1549 +#define IMG_BACKGROUND_LEVELS 1550 +#define IMG_BACKGROUND_SCORES 1551 +#define IMG_BACKGROUND_EDITOR 1552 +#define IMG_BACKGROUND_INFO 1553 +#define IMG_BACKGROUND_INFO_ELEMENTS 1554 +#define IMG_BACKGROUND_INFO_MUSIC 1555 +#define IMG_BACKGROUND_INFO_CREDITS 1556 +#define IMG_BACKGROUND_INFO_PROGRAM 1557 +#define IMG_BACKGROUND_INFO_LEVELSET 1558 +#define IMG_BACKGROUND_SETUP 1559 +#define IMG_BACKGROUND_DOOR 1560 +#define IMG_TITLESCREEN_INITIAL_1 1561 +#define IMG_TITLESCREEN_INITIAL_2 1562 +#define IMG_TITLESCREEN_INITIAL_3 1563 +#define IMG_TITLESCREEN_INITIAL_4 1564 +#define IMG_TITLESCREEN_INITIAL_5 1565 +#define IMG_TITLESCREEN_1 1566 +#define IMG_TITLESCREEN_2 1567 +#define IMG_TITLESCREEN_3 1568 +#define IMG_TITLESCREEN_4 1569 +#define IMG_TITLESCREEN_5 1570 -#define NUM_IMAGE_FILES 1570 +#define NUM_IMAGE_FILES 1571 #endif /* CONF_GFX_H */ diff --git a/src/conf_mus.c b/src/conf_mus.c index 83404171..2d2cd8a9 100644 --- a/src/conf_mus.c +++ b/src/conf_mus.c @@ -30,6 +30,7 @@ struct ConfigInfo music_config[] = { { "background", UNDEFINED_FILENAME }, { "background.TITLE", UNDEFINED_FILENAME }, + { "background.MESSAGE", UNDEFINED_FILENAME }, { "background.MAIN", UNDEFINED_FILENAME }, { "background.LEVELS", UNDEFINED_FILENAME }, { "background.SCORES", UNDEFINED_FILENAME }, diff --git a/src/conf_mus.h b/src/conf_mus.h index 8fce300c..6c7f9352 100644 --- a/src/conf_mus.h +++ b/src/conf_mus.h @@ -20,13 +20,14 @@ #define MUS_BACKGROUND 0 #define MUS_BACKGROUND_TITLE 1 -#define MUS_BACKGROUND_MAIN 2 -#define MUS_BACKGROUND_LEVELS 3 -#define MUS_BACKGROUND_SCORES 4 -#define MUS_BACKGROUND_EDITOR 5 -#define MUS_BACKGROUND_INFO 6 -#define MUS_BACKGROUND_SETUP 7 +#define MUS_BACKGROUND_MESSAGE 2 +#define MUS_BACKGROUND_MAIN 3 +#define MUS_BACKGROUND_LEVELS 4 +#define MUS_BACKGROUND_SCORES 5 +#define MUS_BACKGROUND_EDITOR 6 +#define MUS_BACKGROUND_INFO 7 +#define MUS_BACKGROUND_SETUP 8 -#define NUM_MUSIC_FILES 8 +#define NUM_MUSIC_FILES 9 #endif /* CONF_MUS_H */ diff --git a/src/conf_snd.c b/src/conf_snd.c index c18925af..01696a0f 100644 --- a/src/conf_snd.c +++ b/src/conf_snd.c @@ -245,6 +245,7 @@ struct ConfigInfo sound_config[] = { "menu.item.selecting", "base.wav" }, { "background.TITLE", UNDEFINED_FILENAME }, + { "background.MESSAGE", UNDEFINED_FILENAME }, { "background.MAIN", UNDEFINED_FILENAME }, { "background.LEVELS", UNDEFINED_FILENAME }, { "background.SCORES", "halloffame.wav" }, diff --git a/src/conf_snd.h b/src/conf_snd.h index 015e3eba..164c2a91 100644 --- a/src/conf_snd.h +++ b/src/conf_snd.h @@ -203,13 +203,14 @@ #define SND_MENU_ITEM_ACTIVATING 182 #define SND_MENU_ITEM_SELECTING 183 #define SND_BACKGROUND_TITLE 184 -#define SND_BACKGROUND_MAIN 185 -#define SND_BACKGROUND_LEVELS 186 -#define SND_BACKGROUND_SCORES 187 -#define SND_BACKGROUND_EDITOR 188 -#define SND_BACKGROUND_INFO 189 -#define SND_BACKGROUND_SETUP 190 +#define SND_BACKGROUND_MESSAGE 185 +#define SND_BACKGROUND_MAIN 186 +#define SND_BACKGROUND_LEVELS 187 +#define SND_BACKGROUND_SCORES 188 +#define SND_BACKGROUND_EDITOR 189 +#define SND_BACKGROUND_INFO 190 +#define SND_BACKGROUND_SETUP 191 -#define NUM_SOUND_FILES 191 +#define NUM_SOUND_FILES 192 #endif /* CONF_SND_H */ diff --git a/src/conftime.h b/src/conftime.h index b269d2ab..3fa4c873 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-12-16 14:05]" +#define COMPILE_DATE_STRING "[2006-12-28 03:16]" diff --git a/src/editor.c b/src/editor.c index 69c63d20..7ace5ece 100644 --- a/src/editor.c +++ b/src/editor.c @@ -7300,7 +7300,7 @@ static int PrintElementDescriptionFromFile(char *filename, int start_line) int max_lines_per_screen = (SYSIZE - pad_y) / font_height - 1; return DrawTextFromFile(sx, sy, filename, font_nr, max_chars_per_line, - max_lines_per_screen); + max_lines_per_screen, TRUE); } static void DrawPropertiesTabulatorGadgets() diff --git a/src/init.c b/src/init.c index 8da4aaf2..ba94035e 100644 --- a/src/init.c +++ b/src/init.c @@ -167,7 +167,7 @@ static int getFontBitmapID(int font_nr) { int special = -1; - if (game_status >= GAME_MODE_MAIN && game_status <= GAME_MODE_PSEUDO_PREVIEW) + if (game_status >= GAME_MODE_TITLE && game_status <= GAME_MODE_PSEUDO_PREVIEW) special = game_status; else if (game_status == GAME_MODE_PSEUDO_TYPENAME) special = GFX_SPECIAL_ARG_MAIN; @@ -1235,6 +1235,7 @@ static void InitGraphicInfo() IMG_BACKGROUND, IMG_BACKGROUND_TITLE, + IMG_BACKGROUND_MESSAGE, IMG_BACKGROUND_MAIN, IMG_BACKGROUND_LEVELS, IMG_BACKGROUND_SCORES, diff --git a/src/libgame/setup.c b/src/libgame/setup.c index b116457e..9df2b53e 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -497,6 +497,35 @@ char *getLevelSetInfoFilename() return NULL; } +char *getLevelSetMessageFilename() +{ + static char *filename = NULL; + char *basenames[] = + { + "MESSAGE", + "MESSAGE.TXT", + "MESSAGE.txt", + "Message", + "Message.txt", + "message", + "message.txt", + + NULL + }; + int i; + + for (i = 0; basenames[i] != NULL; i++) + { + checked_free(filename); + filename = getPath2(getCurrentLevelDir(), basenames[i]); + + if (fileExists(filename)) + return filename; + } + + return NULL; +} + static char *getCorrectedArtworkBasename(char *basename) { char *basename_corrected = basename; diff --git a/src/libgame/setup.h b/src/libgame/setup.h index 55440806..6dc15e9c 100644 --- a/src/libgame/setup.h +++ b/src/libgame/setup.h @@ -230,6 +230,7 @@ char *getEditorSetupFilename(void); char *getHelpAnimFilename(void); char *getHelpTextFilename(void); char *getLevelSetInfoFilename(void); +char *getLevelSetMessageFilename(void); char *getImageFilename(char *); char *getCustomImageFilename(char *); char *getCustomSoundFilename(char *); diff --git a/src/libgame/system.c b/src/libgame/system.c index 5ccb5eb7..7d0099f4 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -245,7 +245,10 @@ void SetBackgroundBitmap(Bitmap *background_bitmap_tile, int mask) if (background_bitmap_tile == NULL) /* empty background requested */ return; - if (mask == REDRAW_FIELD) + if (mask == REDRAW_ALL) + DrawBitmapFromTile(gfx.background_bitmap, background_bitmap_tile, + 0, 0, video.width, video.height); + else if (mask == REDRAW_FIELD) DrawBitmapFromTile(gfx.background_bitmap, background_bitmap_tile, gfx.real_sx, gfx.real_sy, gfx.full_sxsize, gfx.full_sysize); @@ -257,13 +260,20 @@ void SetBackgroundBitmap(Bitmap *background_bitmap_tile, int mask) } } +void SetWindowBackgroundBitmap(Bitmap *background_bitmap_tile) +{ + SetBackgroundBitmap(background_bitmap_tile, REDRAW_ALL); +} + void SetMainBackgroundBitmap(Bitmap *background_bitmap_tile) { + SetBackgroundBitmap(NULL, REDRAW_ALL); /* !!! FIX THIS !!! */ SetBackgroundBitmap(background_bitmap_tile, REDRAW_FIELD); } void SetDoorBackgroundBitmap(Bitmap *background_bitmap_tile) { + SetBackgroundBitmap(NULL, REDRAW_ALL); /* !!! FIX THIS !!! */ SetBackgroundBitmap(background_bitmap_tile, REDRAW_DOOR_1); } diff --git a/src/libgame/system.h b/src/libgame/system.h index 5d80bff5..2d10c7b1 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -1059,6 +1059,7 @@ void InitGfxDoor2Info(int, int, int, int); void InitGfxScrollbufferInfo(int, int); void SetDrawDeactivationMask(int); void SetDrawBackgroundMask(int); +void SetWindowBackgroundBitmap(Bitmap *); void SetMainBackgroundBitmap(Bitmap *); void SetDoorBackgroundBitmap(Bitmap *); diff --git a/src/libgame/text.c b/src/libgame/text.c index 01689a73..83be1dfc 100644 --- a/src/libgame/text.c +++ b/src/libgame/text.c @@ -156,12 +156,12 @@ int getTextWidth(char *text, int font_nr) return (text != NULL ? strlen(text) * getFontWidth(font_nr) : 0); } -static char getFontCharPosition(int font_nr, char c) +static int getFontCharPosition(int font_nr, char c) { int font_bitmap_id = gfx.select_font_function(font_nr); struct FontBitmapInfo *font = &gfx.font_bitmap_info[font_bitmap_id]; boolean default_font = (font->num_chars == DEFAULT_NUM_CHARS_PER_FONT); - int font_pos = c - 32; + int font_pos = (unsigned char)c - 32; /* map some special characters to their ascii values in default font */ if (default_font) @@ -309,7 +309,7 @@ void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text, char c = *text_ptr++; if (c == '\n') - c = ' '; /* print space instaed of newline */ + c = ' '; /* print space instead of newline */ getFontCharSource(font_nr, c, &src_bitmap, &src_x, &src_y); @@ -523,7 +523,7 @@ void DrawTextWrapped(int x, int y, char *text, int font_nr, int line_length, } int DrawTextFromFile(int x, int y, char *filename, int font_nr, - int line_length, int max_lines) + int line_length, int max_lines, boolean rewrap) { int font_height = getFontHeight(font_nr); char line[MAX_LINE_LEN]; @@ -574,10 +574,41 @@ int DrawTextFromFile(int x, int y, char *filename, int font_nr, while (*line_ptr && current_line < max_lines) { +#if 1 + boolean buffer_filled; + + if (rewrap) + { + buffer_filled = RenderLineToBuffer(&line_ptr, + buffer, &buffer_len, + last_line_was_empty, + line_length); + } + else + { + if (strlen(line_ptr) <= line_length) + { + buffer_len = strlen(line_ptr); + strcpy(buffer, line_ptr); + } + else + { + buffer_len = line_length; + strncpy(buffer, line_ptr, line_length); + } + + buffer[buffer_len] = '\0'; + line_ptr += buffer_len; + + buffer_filled = TRUE; + } +#else boolean buffer_filled = RenderLineToBuffer(&line_ptr, buffer, &buffer_len, last_line_was_empty, line_length); +#endif + if (buffer_filled) { DrawText(x, y + current_line * font_height, buffer, font_nr); diff --git a/src/libgame/text.h b/src/libgame/text.h index b518c562..f21ffdbf 100644 --- a/src/libgame/text.h +++ b/src/libgame/text.h @@ -75,6 +75,6 @@ void DrawTextExt(DrawBuffer *, int, int, char *, int, int); void DrawTextToTextArea(int, int, char *, int, int, int, int, int); boolean RenderLineToBuffer(char **, char *, int *, boolean, int); void DrawTextWrapped(int, int, char *, int, int, int); -int DrawTextFromFile(int, int, char *, int, int, int); +int DrawTextFromFile(int, int, char *, int, int, int, boolean); #endif /* TEXT_H */ diff --git a/src/main.c b/src/main.c index 148abb54..3b1eb05e 100644 --- a/src/main.c +++ b/src/main.c @@ -4620,6 +4620,7 @@ struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1 + 1] = { { ".[DEFAULT]", GFX_SPECIAL_ARG_DEFAULT, }, { ".TITLE", GFX_SPECIAL_ARG_TITLE, }, + { ".MESSAGE", GFX_SPECIAL_ARG_MESSAGE, }, { ".MAIN", GFX_SPECIAL_ARG_MAIN, }, { ".LEVELS", GFX_SPECIAL_ARG_LEVELS }, { ".SCORES", GFX_SPECIAL_ARG_SCORES, }, diff --git a/src/main.h b/src/main.h index 5e519678..b8430daa 100644 --- a/src/main.h +++ b/src/main.h @@ -1586,18 +1586,19 @@ /* values for special image configuration suffixes (must match game mode) */ #define GFX_SPECIAL_ARG_DEFAULT 0 #define GFX_SPECIAL_ARG_TITLE 1 -#define GFX_SPECIAL_ARG_MAIN 2 -#define GFX_SPECIAL_ARG_LEVELS 3 -#define GFX_SPECIAL_ARG_SCORES 4 -#define GFX_SPECIAL_ARG_EDITOR 5 -#define GFX_SPECIAL_ARG_INFO 6 -#define GFX_SPECIAL_ARG_SETUP 7 -#define GFX_SPECIAL_ARG_PLAYING 8 -#define GFX_SPECIAL_ARG_DOOR 9 -#define GFX_SPECIAL_ARG_PREVIEW 10 -#define GFX_SPECIAL_ARG_CRUMBLED 11 - -#define NUM_SPECIAL_GFX_ARGS 12 +#define GFX_SPECIAL_ARG_MESSAGE 2 +#define GFX_SPECIAL_ARG_MAIN 3 +#define GFX_SPECIAL_ARG_LEVELS 4 +#define GFX_SPECIAL_ARG_SCORES 5 +#define GFX_SPECIAL_ARG_EDITOR 6 +#define GFX_SPECIAL_ARG_INFO 7 +#define GFX_SPECIAL_ARG_SETUP 8 +#define GFX_SPECIAL_ARG_PLAYING 9 +#define GFX_SPECIAL_ARG_DOOR 10 +#define GFX_SPECIAL_ARG_PREVIEW 11 +#define GFX_SPECIAL_ARG_CRUMBLED 12 + +#define NUM_SPECIAL_GFX_ARGS 13 /* these additional definitions are currently only used for draw offsets */ #define GFX_SPECIAL_ARG_INFO_MAIN 0 @@ -1728,20 +1729,21 @@ /* values for game_status (must match special image configuration suffixes) */ #define GAME_MODE_DEFAULT 0 #define GAME_MODE_TITLE 1 -#define GAME_MODE_MAIN 2 -#define GAME_MODE_LEVELS 3 -#define GAME_MODE_SCORES 4 -#define GAME_MODE_EDITOR 5 -#define GAME_MODE_INFO 6 -#define GAME_MODE_SETUP 7 -#define GAME_MODE_PLAYING 8 -#define GAME_MODE_PSEUDO_DOOR 9 -#define GAME_MODE_PSEUDO_PREVIEW 10 -#define GAME_MODE_PSEUDO_CRUMBLED 11 +#define GAME_MODE_MESSAGE 2 +#define GAME_MODE_MAIN 3 +#define GAME_MODE_LEVELS 4 +#define GAME_MODE_SCORES 5 +#define GAME_MODE_EDITOR 6 +#define GAME_MODE_INFO 7 +#define GAME_MODE_SETUP 8 +#define GAME_MODE_PLAYING 9 +#define GAME_MODE_PSEUDO_DOOR 10 +#define GAME_MODE_PSEUDO_PREVIEW 11 +#define GAME_MODE_PSEUDO_CRUMBLED 12 /* there are no special config file suffixes for these modes */ -#define GAME_MODE_PSEUDO_TYPENAME 12 -#define GAME_MODE_QUIT 13 +#define GAME_MODE_PSEUDO_TYPENAME 13 +#define GAME_MODE_QUIT 14 /* special definitions currently only used for custom artwork configuration */ #define MUSIC_PREFIX_BACKGROUND 0 diff --git a/src/screens.c b/src/screens.c index a1061589..c78cfd13 100644 --- a/src/screens.c +++ b/src/screens.c @@ -709,6 +709,41 @@ void DrawTitleScreenImage(int nr) title.auto_delay_final = graphic_info[graphic].auto_delay; } +void DrawTitleScreenMessage(char *filename) +{ + int font_nr = FONT_TEXT_1; + int font_width; + int font_height; + int pad_x = 16; + int pad_y = 32; + 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); + SetWindowBackgroundImageIfDefined(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; + + DrawTextFromFile(sx, sy, filename, font_nr, max_chars_per_line, + max_lines_per_screen, FALSE); + + game_status = last_game_status; /* restore current game status */ +} + void DrawTitleScreen() { KeyboardAutoRepeatOff(); @@ -780,7 +815,8 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading) if (setup.show_titlescreen && ((levelset_has_changed && - graphic_info[IMG_TITLESCREEN_1].bitmap != NULL) || + (graphic_info[IMG_TITLESCREEN_1].bitmap != NULL || + getLevelSetMessageFilename() != NULL)) || (show_titlescreen_initial && graphic_info[IMG_TITLESCREEN_INITIAL_1].bitmap != NULL))) { @@ -948,9 +984,13 @@ 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_titlescreen_initial; /* default */ + boolean no_title_info = (graphic_info[IMG_TITLESCREEN_1].bitmap == NULL && + filename == NULL); if (button == MB_MENU_INITIALIZE) { @@ -958,6 +998,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) title_delay = 0; title_nr = 0; + showing_message = FALSE; if (show_titlescreen_initial && graphic_info[IMG_TITLESCREEN_INITIAL_1].bitmap == NULL) @@ -965,7 +1006,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) if (game_status == GAME_MODE_INFO) { - if (graphic_info[IMG_TITLESCREEN_1].bitmap == NULL) + if (no_title_info) { DrawInfoScreen_NotAvailable("Title screen information:", "No title screen for this level set."); @@ -988,7 +1029,20 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) game_status = last_game_status; /* restore current game status */ - DrawTitleScreenImage(title_nr); + if (graphic_info[getTitleScreenGraphic()].bitmap != NULL) + { + DrawTitleScreenImage(title_nr); + } + 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); @@ -1010,8 +1064,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) { int anim_mode; - if (game_status == GAME_MODE_INFO && - graphic_info[IMG_TITLESCREEN_1].bitmap == NULL) + if (game_status == GAME_MODE_INFO && no_title_info) { FadeOut(REDRAW_FIELD); @@ -1056,6 +1109,22 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) 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(); @@ -2407,7 +2476,7 @@ void DrawInfoScreen_LevelSet() if (filename != NULL) DrawTextFromFile(sx, sy, filename, font_nr, max_chars_per_line, - max_lines_per_screen); + max_lines_per_screen, TRUE); else DrawTextSCentered(ystart, FONT_TEXT_2, "No information for this level set."); diff --git a/src/tools.c b/src/tools.c index a10f0dd2..e7670d27 100644 --- a/src/tools.c +++ b/src/tools.c @@ -242,7 +242,8 @@ void DrawMaskedBorder_ALL() void DrawMaskedBorder(int redraw_mask) { /* do not draw masked screen borders when displaying title screens */ - if (effectiveGameStatus() == GAME_MODE_TITLE) + if (effectiveGameStatus() == GAME_MODE_TITLE || + effectiveGameStatus() == GAME_MODE_MESSAGE) return; if (redraw_mask & REDRAW_ALL) @@ -587,10 +588,16 @@ void FadeCrossSaveBackbuffer() BlitBitmap(backbuffer, bitmap_db_cross, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0); } +void SetWindowBackgroundImageIfDefined(int graphic) +{ + if (graphic_info[graphic].bitmap) + SetWindowBackgroundBitmap(graphic_info[graphic].bitmap); +} + void SetMainBackgroundImageIfDefined(int graphic) { if (graphic_info[graphic].bitmap) - SetMainBackgroundImage(graphic); + SetMainBackgroundBitmap(graphic_info[graphic].bitmap); } void SetMainBackgroundImage(int graphic) diff --git a/src/tools.h b/src/tools.h index 12d49c99..1c26b6d6 100644 --- a/src/tools.h +++ b/src/tools.h @@ -80,6 +80,7 @@ void FadeCross(int); void FadeCrossSaveBackbuffer(); void ClearWindow(); +void SetWindowBackgroundImageIfDefined(int); void SetMainBackgroundImageIfDefined(int); void SetMainBackgroundImage(int); void SetDoorBackgroundImage(int);