+2006-10-28
+ * fixed bug when displaying titlescreen with size less than element tile
+
2006-10-24
* fixed bug that allowed making engine snapshots from the level editor
{ "background.envelope_4.anim_mode", "default" },
{ "background.envelope_4.draw_masked", "false" },
- { "titlescreen_initial_1", UNDEFINED_FILENAME },
- { "titlescreen_initial_2", UNDEFINED_FILENAME },
- { "titlescreen_initial_3", UNDEFINED_FILENAME },
- { "titlescreen_initial_4", UNDEFINED_FILENAME },
- { "titlescreen_initial_5", UNDEFINED_FILENAME },
- { "titlescreen_1", UNDEFINED_FILENAME },
- { "titlescreen_2", UNDEFINED_FILENAME },
- { "titlescreen_3", UNDEFINED_FILENAME },
- { "titlescreen_4", UNDEFINED_FILENAME },
- { "titlescreen_5", UNDEFINED_FILENAME },
-
{ "background", UNDEFINED_FILENAME },
{ "background.TITLE", UNDEFINED_FILENAME },
{ "background.MAIN", UNDEFINED_FILENAME },
{ "background.SETUP", UNDEFINED_FILENAME },
{ "background.DOOR", UNDEFINED_FILENAME },
+ { "titlescreen_initial_1", UNDEFINED_FILENAME },
+ { "titlescreen_initial_2", UNDEFINED_FILENAME },
+ { "titlescreen_initial_3", UNDEFINED_FILENAME },
+ { "titlescreen_initial_4", UNDEFINED_FILENAME },
+ { "titlescreen_initial_5", UNDEFINED_FILENAME },
+ { "titlescreen_1", UNDEFINED_FILENAME },
+ { "titlescreen_2", UNDEFINED_FILENAME },
+ { "titlescreen_3", UNDEFINED_FILENAME },
+ { "titlescreen_4", UNDEFINED_FILENAME },
+ { "titlescreen_5", UNDEFINED_FILENAME },
+
/* the following directives are not associated with an image, but
probably make sense to be defined in "graphicsinfo.conf", too */
#define IMG_BACKGROUND_ENVELOPE_2 1542
#define IMG_BACKGROUND_ENVELOPE_3 1543
#define IMG_BACKGROUND_ENVELOPE_4 1544
-#define IMG_TITLESCREEN_INITIAL_1 1545
-#define IMG_TITLESCREEN_INITIAL_2 1546
-#define IMG_TITLESCREEN_INITIAL_3 1547
-#define IMG_TITLESCREEN_INITIAL_4 1548
-#define IMG_TITLESCREEN_INITIAL_5 1549
-#define IMG_TITLESCREEN_1 1550
-#define IMG_TITLESCREEN_2 1551
-#define IMG_TITLESCREEN_3 1552
-#define IMG_TITLESCREEN_4 1553
-#define IMG_TITLESCREEN_5 1554
-#define IMG_BACKGROUND 1555
-#define IMG_BACKGROUND_TITLE 1556
-#define IMG_BACKGROUND_MAIN 1557
-#define IMG_BACKGROUND_LEVELS 1558
-#define IMG_BACKGROUND_SCORES 1559
-#define IMG_BACKGROUND_EDITOR 1560
-#define IMG_BACKGROUND_INFO 1561
-#define IMG_BACKGROUND_INFO_ELEMENTS 1562
-#define IMG_BACKGROUND_INFO_MUSIC 1563
-#define IMG_BACKGROUND_INFO_CREDITS 1564
-#define IMG_BACKGROUND_INFO_PROGRAM 1565
-#define IMG_BACKGROUND_INFO_LEVELSET 1566
-#define IMG_BACKGROUND_SETUP 1567
-#define IMG_BACKGROUND_DOOR 1568
+#define IMG_BACKGROUND 1545
+#define IMG_BACKGROUND_TITLE 1546
+#define IMG_BACKGROUND_MAIN 1547
+#define IMG_BACKGROUND_LEVELS 1548
+#define IMG_BACKGROUND_SCORES 1549
+#define IMG_BACKGROUND_EDITOR 1550
+#define IMG_BACKGROUND_INFO 1551
+#define IMG_BACKGROUND_INFO_ELEMENTS 1552
+#define IMG_BACKGROUND_INFO_MUSIC 1553
+#define IMG_BACKGROUND_INFO_CREDITS 1554
+#define IMG_BACKGROUND_INFO_PROGRAM 1555
+#define IMG_BACKGROUND_INFO_LEVELSET 1556
+#define IMG_BACKGROUND_SETUP 1557
+#define IMG_BACKGROUND_DOOR 1558
+#define IMG_TITLESCREEN_INITIAL_1 1559
+#define IMG_TITLESCREEN_INITIAL_2 1560
+#define IMG_TITLESCREEN_INITIAL_3 1561
+#define IMG_TITLESCREEN_INITIAL_4 1562
+#define IMG_TITLESCREEN_INITIAL_5 1563
+#define IMG_TITLESCREEN_1 1564
+#define IMG_TITLESCREEN_2 1565
+#define IMG_TITLESCREEN_3 1566
+#define IMG_TITLESCREEN_4 1567
+#define IMG_TITLESCREEN_5 1568
#define NUM_IMAGE_FILES 1569
-#define COMPILE_DATE_STRING "[2006-10-24 19:53]"
+#define COMPILE_DATE_STRING "[2006-10-28 13:41]"
graphic_info[graphic].bitmap = src_bitmap;
- /* start with reliable default values */
+ /* always start with reliable default values */
graphic_info[graphic].src_image_width = 0;
graphic_info[graphic].src_image_height = 0;
graphic_info[graphic].src_x = 0;
graphic_info[graphic].src_y = 0;
- graphic_info[graphic].width = TILEX;
- graphic_info[graphic].height = TILEY;
+ graphic_info[graphic].width = TILEX; /* default for element graphics */
+ graphic_info[graphic].height = TILEY; /* default for element graphics */
graphic_info[graphic].offset_x = 0; /* one or both of these values ... */
graphic_info[graphic].offset_y = 0; /* ... will be corrected later */
graphic_info[graphic].offset2_x = 0; /* one or both of these values ... */
graphic_info[graphic].post_delay = -1;
graphic_info[graphic].auto_delay = -1;
+#if 1
+ if (graphic_info[graphic].use_image_size)
+ {
+ /* set default bitmap size (with scaling, but without small images) */
+ graphic_info[graphic].width = get_scaled_graphic_width(graphic);
+ graphic_info[graphic].height = get_scaled_graphic_height(graphic);
+ }
+#endif
+
/* optional x and y tile position of animation frame sequence */
if (parameter[GFX_ARG_XPOS] != ARG_UNDEFINED_VALUE)
graphic_info[graphic].src_x = parameter[GFX_ARG_XPOS] * TILEX;
GC copy_clipmask_gc = None;
#endif
+ /* use image size as default values for width and height for these images */
+ static int full_size_graphics[] =
+ {
+ IMG_GLOBAL_BORDER,
+ IMG_GLOBAL_DOOR,
+
+ IMG_BACKGROUND_ENVELOPE_1,
+ IMG_BACKGROUND_ENVELOPE_2,
+ IMG_BACKGROUND_ENVELOPE_3,
+ IMG_BACKGROUND_ENVELOPE_4,
+
+ IMG_BACKGROUND,
+ IMG_BACKGROUND_TITLE,
+ IMG_BACKGROUND_MAIN,
+ IMG_BACKGROUND_LEVELS,
+ IMG_BACKGROUND_SCORES,
+ IMG_BACKGROUND_EDITOR,
+ IMG_BACKGROUND_INFO,
+ IMG_BACKGROUND_INFO_ELEMENTS,
+ IMG_BACKGROUND_INFO_MUSIC,
+ IMG_BACKGROUND_INFO_CREDITS,
+ IMG_BACKGROUND_INFO_PROGRAM,
+ IMG_BACKGROUND_INFO_LEVELSET,
+ IMG_BACKGROUND_SETUP,
+ IMG_BACKGROUND_DOOR,
+
+ IMG_TITLESCREEN_INITIAL_1,
+ IMG_TITLESCREEN_INITIAL_2,
+ IMG_TITLESCREEN_INITIAL_3,
+ IMG_TITLESCREEN_INITIAL_4,
+ IMG_TITLESCREEN_INITIAL_5,
+ IMG_TITLESCREEN_1,
+ IMG_TITLESCREEN_2,
+ IMG_TITLESCREEN_3,
+ IMG_TITLESCREEN_4,
+ IMG_TITLESCREEN_5,
+
+ -1
+ };
+
checked_free(graphic_info);
graphic_info = checked_calloc(num_images * sizeof(struct GraphicInfo));
+#if 1
+ /* initialize "use_image_size" flag with default value */
+ for (i = 0; i < num_images; i++)
+ graphic_info[i].use_image_size = FALSE;
+
+ /* initialize "use_image_size" flag from static configuration above */
+ for (i = 0; full_size_graphics[i] != -1; i++)
+ graphic_info[full_size_graphics[i]].use_image_size = TRUE;
+#endif
+
#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
if (clipmasks_initialized)
{
{
Bitmap *src_bitmap;
int src_x, src_y;
+ int width, height;
int first_frame, last_frame;
int src_bitmap_width, src_bitmap_height;
if (graphic_info[i].bitmap == NULL)
continue; /* skip check for optional images that are undefined */
+ /* get image size (this can differ from the standard element tile size!) */
+ width = graphic_info[i].width;
+ height = graphic_info[i].height;
+
/* get final bitmap size (with scaling, but without small images) */
src_bitmap_width = graphic_info[i].src_image_width;
src_bitmap_height = graphic_info[i].src_image_height;
first_frame = 0;
getGraphicSource(i, first_frame, &src_bitmap, &src_x, &src_y);
+#if 1
+ /* this avoids calculating wrong start position for out-of-bounds frame */
+ src_x = graphic_info[i].src_x;
+ src_y = graphic_info[i].src_y;
+#endif
+
if (src_x < 0 || src_y < 0 ||
- src_x + TILEX > src_bitmap_width ||
- src_y + TILEY > src_bitmap_height)
+ src_x + width > src_bitmap_width ||
+ src_y + height > src_bitmap_height)
{
Error(ERR_RETURN_LINE, "-");
Error(ERR_RETURN, "warning: error found in config file:");
getGraphicSource(i, last_frame, &src_bitmap, &src_x, &src_y);
if (src_x < 0 || src_y < 0 ||
- src_x + TILEX > src_bitmap_width ||
- src_y + TILEY > src_bitmap_height)
+ src_x + width > src_bitmap_width ||
+ src_y + height > src_bitmap_height)
{
Error(ERR_RETURN_LINE, "-");
Error(ERR_RETURN, "warning: error found in config file:");
void DrawTextExt(DrawBuffer *dst_bitmap, int dst_x, int dst_y, char *text,
int font_nr, int mask_mode)
{
+#if 1
+ struct FontBitmapInfo *font = getFontBitmapInfo(font_nr);
+#else
int font_bitmap_id = gfx.select_font_function(font_nr);
struct FontBitmapInfo *font = &gfx.font_bitmap_info[font_bitmap_id];
+#endif
int font_width = getFontWidth(font_nr);
int font_height = getFontHeight(font_nr);
#if 0
int post_delay; /* optional setting for drawing title screens */
int auto_delay; /* optional setting for drawing title screens */
+ boolean use_image_size; /* use image size as default width and height */
+
#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
Pixmap clip_mask; /* single-graphic-only clip mask for X11 */
GC clip_gc; /* single-graphic-only clip gc for X11 */
if (pos_button != NULL)
{
- int button_x = mSX + pos_button->x;
- int button_y = mSY + pos_button->y;
+ struct MenuPosInfo *pos = pos_button;
+ int x = mSX + pos->x;
+ int y = mSY + pos->y;
- DrawBackground(button_x,button_y, pos_button->width,pos_button->height);
- DrawGraphicThruMaskExt(drawto, button_x, button_y, button_graphic, 0);
+ DrawBackgroundForGraphic(x, y, pos->width, pos->height, button_graphic);
+ DrawGraphicThruMaskExt(drawto, x, y, button_graphic, 0);
}
if (pos_text != NULL && text != NULL)
{
- int text_x = mSX + ALIGNED_XPOS(pos_text->x, pos_text->width,
- pos_text->align);
- int text_y = mSY + pos_text->y;
+ struct MenuPosInfo *pos = pos_text;
+ int x = mSX + ALIGNED_XPOS(pos->x, pos->width, pos->align);
+ int y = mSY + pos->y;
- DrawBackground(text_x, text_y, pos_text->width, pos_text->height);
- DrawText(text_x, text_y, text, font_text);
+ DrawBackgroundForFont(x, y, pos->width, pos->height, font_text);
+ DrawText(x, y, text, font_text);
}
if (pos_input != NULL && input != NULL)
{
- int input_x = mSX + ALIGNED_XPOS(pos_input->x, pos_input->width,
- pos_input->align);
- int input_y = mSY + pos_input->y;
+ struct MenuPosInfo *pos = pos_input;
+ int x = mSX + ALIGNED_XPOS(pos->x, pos->width, pos->align);
+ int y = mSY + pos->y;
- DrawBackground(input_x, input_y, pos_input->width, pos_input->height);
- DrawText(input_x, input_y, input, font_input);
+ DrawBackgroundForFont(x, y, pos->width, pos->height, font_input);
+ DrawText(x, y, input, font_input);
}
}
}
if (active)
graphic = BUTTON_GRAPHIC_ACTIVE(graphic);
- DrawBackground(x, y, TILEX, TILEY);
+ DrawBackgroundForGraphic(x, y, TILEX, TILEY, graphic);
DrawGraphicThruMaskExt(drawto, x, y, graphic, 0);
}
{
int graphic = getTitleScreenGraphic() + nr;
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)
TreeInfo *node, *node_first;
int x, last_redraw_mask = redraw_mask;
int ypos = MENU_TITLE2_YPOS;
+ int font_nr = FONT_TITLE_2;
if (ti->type != TREE_TYPE_LEVEL_DIR)
return;
node_first = getTreeInfoFirstGroupEntry(ti);
node = getTreeInfoFromPos(node_first, entry_pos);
- DrawBackground(SX, SY + ypos, SXSIZE, getFontHeight(FONT_TITLE_2));
+ DrawBackgroundForFont(SX, SY + ypos, SXSIZE, getFontHeight(font_nr), font_nr);
if (node->parent_link)
- DrawTextFCentered(ypos, FONT_TITLE_2, "leave group \"%s\"",
+ DrawTextFCentered(ypos, font_nr, "leave group \"%s\"",
node->class_desc);
else if (node->level_group)
- DrawTextFCentered(ypos, FONT_TITLE_2, "enter group \"%s\"",
+ DrawTextFCentered(ypos, font_nr, "enter group \"%s\"",
node->class_desc);
else if (ti->type == TREE_TYPE_LEVEL_DIR)
- DrawTextFCentered(ypos, FONT_TITLE_2, "%3d levels (%s)",
+ DrawTextFCentered(ypos, font_nr, "%3d levels (%s)",
node->levels, node->class_desc);
/* let BackToFront() redraw only what is needed */
SetDoorBackgroundBitmap(bitmap_db_panel);
}
-void DrawBackground(int dst_x, int dst_y, int width, int height)
+void DrawBackground(int x, int y, int width, int height)
{
/* !!! "drawto" might still point to playfield buffer here (see below) !!! */
/* (when entering hall of fame after playing) */
#if 0
- ClearRectangleOnBackground(drawto, dst_x, dst_y, width, height);
+ ClearRectangleOnBackground(drawto, x, y, width, height);
#else
- ClearRectangleOnBackground(backbuffer, dst_x, dst_y, width, height);
+ ClearRectangleOnBackground(backbuffer, x, y, width, height);
#endif
redraw_mask |= REDRAW_FIELD;
}
+void DrawBackgroundForFont(int x, int y, int width, int height, int font_nr)
+{
+ struct FontBitmapInfo *font = getFontBitmapInfo(font_nr);
+
+ if (font->bitmap == NULL)
+ return;
+
+ DrawBackground(x, y, width, height);
+}
+
+void DrawBackgroundForGraphic(int x, int y, int width, int height, int graphic)
+{
+ struct GraphicInfo *g = &graphic_info[graphic];
+
+ if (g->bitmap == NULL)
+ return;
+
+ DrawBackground(x, y, width, height);
+}
+
void ClearWindow()
{
/* !!! "drawto" might still point to playfield buffer here (see above) !!! */
void SetDoorBackgroundImage(int);
void SetPanelBackground();
void DrawBackground(int, int, int, int);
+void DrawBackgroundForFont(int, int, int, int, int);
+void DrawBackgroundForGraphic(int, int, int, int, int);
void MarkTileDirty(int, int);
void SetBorderElement();