GFX_SPECIAL_ARG_TITLE,
MUS_BACKGROUND_TITLE
},
+ {
+ GFX_SPECIAL_ARG_MESSAGE,
+ MUS_BACKGROUND_MESSAGE
+ },
{
GFX_SPECIAL_ARG_MAIN,
MUS_BACKGROUND_MAIN
GFX_SPECIAL_ARG_TITLE,
SND_BACKGROUND_TITLE
},
+ {
+ GFX_SPECIAL_ARG_MESSAGE,
+ SND_BACKGROUND_MESSAGE
+ },
{
GFX_SPECIAL_ARG_MAIN,
SND_BACKGROUND_MAIN
{ "background", UNDEFINED_FILENAME },
{ "background.TITLE", UNDEFINED_FILENAME },
+ { "background.MESSAGE", UNDEFINED_FILENAME },
{ "background.MAIN", UNDEFINED_FILENAME },
{ "background.LEVELS", UNDEFINED_FILENAME },
{ "background.SCORES", UNDEFINED_FILENAME },
#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 */
{
{ "background", UNDEFINED_FILENAME },
{ "background.TITLE", UNDEFINED_FILENAME },
+ { "background.MESSAGE", UNDEFINED_FILENAME },
{ "background.MAIN", UNDEFINED_FILENAME },
{ "background.LEVELS", UNDEFINED_FILENAME },
{ "background.SCORES", UNDEFINED_FILENAME },
#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 */
{ "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" },
#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 */
-#define COMPILE_DATE_STRING "[2006-12-16 14:05]"
+#define COMPILE_DATE_STRING "[2006-12-28 03:16]"
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()
{
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;
IMG_BACKGROUND,
IMG_BACKGROUND_TITLE,
+ IMG_BACKGROUND_MESSAGE,
IMG_BACKGROUND_MAIN,
IMG_BACKGROUND_LEVELS,
IMG_BACKGROUND_SCORES,
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;
char *getHelpAnimFilename(void);
char *getHelpTextFilename(void);
char *getLevelSetInfoFilename(void);
+char *getLevelSetMessageFilename(void);
char *getImageFilename(char *);
char *getCustomImageFilename(char *);
char *getCustomSoundFilename(char *);
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);
}
}
+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);
}
void InitGfxScrollbufferInfo(int, int);
void SetDrawDeactivationMask(int);
void SetDrawBackgroundMask(int);
+void SetWindowBackgroundBitmap(Bitmap *);
void SetMainBackgroundBitmap(Bitmap *);
void SetDoorBackgroundBitmap(Bitmap *);
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)
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);
}
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];
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);
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 */
{
{ ".[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, },
/* 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
/* 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
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();
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)))
{
{
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)
{
title_delay = 0;
title_nr = 0;
+ showing_message = FALSE;
if (show_titlescreen_initial &&
graphic_info[IMG_TITLESCREEN_INITIAL_1].bitmap == NULL)
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.");
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);
{
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);
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();
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.");
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)
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)
void FadeCrossSaveBackbuffer();
void ClearWindow();
+void SetWindowBackgroundImageIfDefined(int);
void SetMainBackgroundImageIfDefined(int);
void SetMainBackgroundImage(int);
void SetDoorBackgroundImage(int);