diff options
author | Filippos Karapetis | 2009-04-21 19:57:11 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-04-21 19:57:11 +0000 |
commit | 20cc4f3dd772a493a61038d1d1b22be87984a7bd (patch) | |
tree | 08bb439f3de025ea84cfac95260d574130cfdd7e /engines/sci/gfx | |
parent | e93de28aa4bbf1d98d3bc1dab33dacb3d1abed2f (diff) | |
download | scummvm-rg350-20cc4f3dd772a493a61038d1d1b22be87984a7bd.tar.gz scummvm-rg350-20cc4f3dd772a493a61038d1d1b22be87984a7bd.tar.bz2 scummvm-rg350-20cc4f3dd772a493a61038d1d1b22be87984a7bd.zip |
Restored the ability to change the active port bound, by moving it inside gfx_state_t (it makes much more sense for it to be there, instead of inside user-defined settings). Placed notes inside gfxr_draw_pic01() and gfxr_draw_pic11() for the usage of the current titlebar size in there
svn-id: r40057
Diffstat (limited to 'engines/sci/gfx')
-rw-r--r-- | engines/sci/gfx/gfx_options.h | 1 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_resmgr.cpp | 4 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_resource.h | 4 | ||||
-rw-r--r-- | engines/sci/gfx/operations.cpp | 1 | ||||
-rw-r--r-- | engines/sci/gfx/operations.h | 1 | ||||
-rw-r--r-- | engines/sci/gfx/res_pic.cpp | 104 |
6 files changed, 57 insertions, 58 deletions
diff --git a/engines/sci/gfx/gfx_options.h b/engines/sci/gfx/gfx_options.h index 5850b21c66..393627a1a2 100644 --- a/engines/sci/gfx/gfx_options.h +++ b/engines/sci/gfx/gfx_options.h @@ -76,7 +76,6 @@ struct gfx_options_t { int dirty_frames; int workarounds; // Workaround flags - see below - rect_t pic_port_bounds; #endif }; diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp index c4cea09365..aa7832c493 100644 --- a/engines/sci/gfx/gfx_resmgr.cpp +++ b/engines/sci/gfx/gfx_resmgr.cpp @@ -148,7 +148,9 @@ int GfxResManager::getOptionsHash(gfx_resource_type_t type) { case GFX_RESOURCE_TYPE_PIC: #ifdef CUSTOM_GRAPHICS_OPTIONS if (_version >= SCI_VERSION_01_VGA) - return _options->pic_port_bounds.y; + // NOTE: here, it is assumed that the upper port bound is always 10, but this doesn't seem to matter for the + // generated options hash anyway + return 10; else return (_options->pic0_unscaled) ? 0x10000 : (_options->pic0_dither_mode << 12) | (_options->pic0_dither_pattern << 8) | (_options->pic0_brush_mode << 4) diff --git a/engines/sci/gfx/gfx_resource.h b/engines/sci/gfx/gfx_resource.h index 3d49b927a9..44ae01828e 100644 --- a/engines/sci/gfx/gfx_resource.h +++ b/engines/sci/gfx/gfx_resource.h @@ -159,10 +159,10 @@ void gfxr_free_view(gfxr_view_t *view); /*********************/ -void gfxr_clear_pic0(gfxr_pic_t *pic, int sci_titlebar_size); +void gfxr_clear_pic0(gfxr_pic_t *pic, int titlebar_size); /* Clears all pic buffers of one pic ** Parameters: (gfxr_pic_t) pic: The picture to clear -** (int) sci_titlebar_size: How much space to reserve for the title bar +** (int) titlebar_size: How much space to reserve for the title bar ** Returns : (void) ** This function should be called before gfxr_draw_pic0, unless cumulative ** drawing is intended diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index 923e310d8c..186d2acb3d 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -434,6 +434,7 @@ int gfxop_init(int version, gfx_state_t *state, gfx_options_t *options, Resource state->pic = state->pic_unscaled = NULL; state->pic_nr = -1; // Set background pic number to an invalid value state->tag_mode = 0; + state->pic_port_bounds = gfx_rect(0, 10, 320, 190); state->dirty_rects = NULL; do { diff --git a/engines/sci/gfx/operations.h b/engines/sci/gfx/operations.h index d680229549..2354a1d641 100644 --- a/engines/sci/gfx/operations.h +++ b/engines/sci/gfx/operations.h @@ -127,6 +127,7 @@ struct gfx_state_t { ** which is generally slow */ gfxr_pic_t *pic, *pic_unscaled; /* The background picture and its unscaled equivalent */ + rect_t pic_port_bounds; /* Picture port bounds */ gfx_dirty_rect_t *dirty_rects; /* Dirty rectangles */ }; diff --git a/engines/sci/gfx/res_pic.cpp b/engines/sci/gfx/res_pic.cpp index 39906e7fbf..f80ac15d03 100644 --- a/engines/sci/gfx/res_pic.cpp +++ b/engines/sci/gfx/res_pic.cpp @@ -190,13 +190,13 @@ gfxr_pic_t *gfxr_init_pic(gfx_mode_t *mode, int ID, int sci1) { // Pic rendering operations -void gfxr_clear_pic0(gfxr_pic_t *pic, int sci_titlebar_size) { - memset(pic->visual_map->index_data, 0x00, (320 * pic->mode->xfact * sci_titlebar_size * pic->mode->yfact)); - memset(pic->visual_map->index_data + (320 * pic->mode->xfact * sci_titlebar_size * pic->mode->yfact), - 0xff, pic->mode->xfact * 320 * pic->mode->yfact * (200 - sci_titlebar_size)); // white - memset(pic->priority_map->index_data + (320 * pic->mode->xfact * sci_titlebar_size * pic->mode->yfact), - 0x0, pic->mode->xfact * 320 * pic->mode->yfact * (200 - sci_titlebar_size)); - memset(pic->priority_map->index_data, 0x0a, sci_titlebar_size * (pic->mode->yfact * 320 * pic->mode->xfact)); +void gfxr_clear_pic0(gfxr_pic_t *pic, int titlebar_size) { + memset(pic->visual_map->index_data, 0x00, (320 * pic->mode->xfact * titlebar_size * pic->mode->yfact)); + memset(pic->visual_map->index_data + (320 * pic->mode->xfact * titlebar_size * pic->mode->yfact), + 0xff, pic->mode->xfact * 320 * pic->mode->yfact * (200 - titlebar_size)); // white + memset(pic->priority_map->index_data + (320 * pic->mode->xfact * titlebar_size * pic->mode->yfact), + 0x0, pic->mode->xfact * 320 * pic->mode->yfact * (200 - titlebar_size)); + memset(pic->priority_map->index_data, 0x0a, titlebar_size * (pic->mode->yfact * 320 * pic->mode->xfact)); memset(pic->control_map->index_data, 0, GFXR_AUX_MAP_SIZE); memset(pic->aux_map, 0, GFXR_AUX_MAP_SIZE); } @@ -226,10 +226,10 @@ void gfxr_clear_pic0(gfxr_pic_t *pic, int sci_titlebar_size) { }; \ buffer[linewidth * y + x] operation color; -static void _gfxr_auxbuf_line_draw(gfxr_pic_t *pic, rect_t line, int color, int color2, int sci_titlebar_size) { +static void _gfxr_auxbuf_line_draw(gfxr_pic_t *pic, rect_t line, int color, int color2, int titlebar_size) { int dx, dy, incrE, incrNE, d, finalx, finaly; int x = line.x; - int y = line.y + sci_titlebar_size; + int y = line.y + titlebar_size; unsigned char *buffer = pic->aux_map; int linewidth = 320; @@ -272,10 +272,10 @@ static void _gfxr_auxbuf_line_draw(gfxr_pic_t *pic, rect_t line, int color, int } } -static void _gfxr_auxbuf_line_clear(gfxr_pic_t *pic, rect_t line, int color, int sci_titlebar_size) { +static void _gfxr_auxbuf_line_clear(gfxr_pic_t *pic, rect_t line, int color, int titlebar_size) { int dx, dy, incrE, incrNE, d, finalx, finaly; int x = line.x; - int y = line.y + sci_titlebar_size; + int y = line.y + titlebar_size; unsigned char *buffer = pic->aux_map; int linewidth = 320; @@ -819,7 +819,7 @@ static void _gfxr_plot_aux_pattern(gfxr_pic_t *pic, int x, int y, int size, int } static void _gfxr_draw_pattern(gfxr_pic_t *pic, int x, int y, int color, int priority, int control, int drawenable, - int pattern_code, int pattern_size, int pattern_nr, gfx_brush_mode_t brush_mode, int sci_titlebar_size) { + int pattern_code, int pattern_size, int pattern_nr, gfx_brush_mode_t brush_mode, int titlebar_size) { int xsize = (pattern_size + 1) * pic->mode->xfact - 1; int ysize = (pattern_size + 1) * pic->mode->yfact - 1; int scaled_x, scaled_y; @@ -828,13 +828,13 @@ static void _gfxr_draw_pattern(gfxr_pic_t *pic, int x, int y, int color, int pri p0printf(stderr, "Pattern at (%d,%d) size %d, rand=%d, code=%02x\n", x, y, pattern_size, pattern_nr, pattern_code); - y += sci_titlebar_size; + y += titlebar_size; if (x - pattern_size < 0) x = pattern_size; - if (y - pattern_size < sci_titlebar_size) - y = sci_titlebar_size + pattern_size; + if (y - pattern_size < titlebar_size) + y = titlebar_size + pattern_size; if (x + pattern_size > max_x) x = max_x - pattern_size; @@ -848,8 +848,8 @@ static void _gfxr_draw_pattern(gfxr_pic_t *pic, int x, int y, int color, int pri if (scaled_x < xsize) scaled_x = xsize; - if (scaled_y < ysize + sci_titlebar_size * pic->mode->yfact) - scaled_y = ysize + sci_titlebar_size * pic->mode->yfact; + if (scaled_y < ysize + titlebar_size * pic->mode->yfact) + scaled_y = ysize + titlebar_size * pic->mode->yfact; if (scaled_x > (320 * pic->mode->xfact) - 1 - xsize) scaled_x = (320 * pic->mode->xfact) - 1 - xsize; @@ -934,7 +934,7 @@ static void _gfxr_draw_subline(gfxr_pic_t *pic, int x, int y, int ex, int ey, in } static void _gfxr_draw_line(gfxr_pic_t *pic, int x, int y, int ex, int ey, int color, - int priority, int control, int drawenable, int line_mode, int cmd, int sci_titlebar_size) { + int priority, int control, int drawenable, int line_mode, int cmd, int titlebar_size) { int scale_x = pic->mode->xfact; int scale_y = pic->mode->yfact; int xc, yc; @@ -952,8 +952,8 @@ static void _gfxr_draw_line(gfxr_pic_t *pic, int x, int y, int ex, int ey, int c return; } - y += sci_titlebar_size; - ey += sci_titlebar_size; + y += titlebar_size; + ey += titlebar_size; if (drawenable & GFX_MASK_CONTROL) { p0printf(" ctl:%x", control); @@ -967,14 +967,14 @@ static void _gfxr_draw_line(gfxr_pic_t *pic, int x, int y, int ex, int ey, int c int mask2 = mask; if (partially_white) mask2 = mask &= ~GFX_MASK_VISUAL; - _gfxr_auxbuf_line_draw(pic, line, mask, mask2, sci_titlebar_size); + _gfxr_auxbuf_line_draw(pic, line, mask, mask2, titlebar_size); } // Calculate everything that is changed to TRANSPARENT mask = drawenable & (((color == 0xff) ? 1 : 0) | ((!priority) ? 2 : 0) | ((!control) ? 4 : 0)); if (mask) - _gfxr_auxbuf_line_clear(pic, line, ~mask, sci_titlebar_size); + _gfxr_auxbuf_line_clear(pic, line, ~mask, titlebar_size); x *= scale_x; y *= scale_y; @@ -1314,12 +1314,10 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, int pal, index; int temp; int line_mode = style->line_mode; - int sci_titlebar_size; -#ifdef CUSTOM_GRAPHICS_OPTIONS - sci_titlebar_size = _options->pic_port_bounds.y; -#else - sci_titlebar_size = 10; -#endif + // NOTE: here, it is assumed that the titlebar size is always 10. This may differ depending on + // the port bounds y starting point, but we haven't come across a case where this actually occurs. + // Also, there is a check further down which sets the titlebar size to 0 if the picture port goes off screen. + int titlebar_size = 10; byte op, opx; #ifdef FILL_RECURSIVE_DEBUG @@ -1396,7 +1394,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, GET_ABS_COORDS(x, y); _gfxr_draw_pattern(pic, x, y, color, priority, control, drawenable, pattern_code, - pattern_size, pattern_nr, style->brush_mode, sci_titlebar_size); + pattern_size, pattern_nr, style->brush_mode, titlebar_size); while (*(resource + pos) < PIC_OP_FIRST) { if (pattern_code & PATTERN_FLAG_USE_PATTERN) { @@ -1407,7 +1405,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, GET_REL_COORDS(x, y); _gfxr_draw_pattern(pic, x, y, color, priority, control, drawenable, pattern_code, - pattern_size, pattern_nr, style->brush_mode, sci_titlebar_size); + pattern_size, pattern_nr, style->brush_mode, titlebar_size); } goto end_op_loop; @@ -1424,7 +1422,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, fprintf(stderr, " to %d,%d\n", x, y); #endif _gfxr_draw_line(pic, oldx, oldy, x, y, color, priority, control, drawenable, line_mode, - PIC_OP_MEDIUM_LINES, sci_titlebar_size); + PIC_OP_MEDIUM_LINES, titlebar_size); oldx = x; oldy = y; } @@ -1436,7 +1434,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, while (*(resource + pos) < PIC_OP_FIRST) { GET_ABS_COORDS(x, y); _gfxr_draw_line(pic, oldx, oldy, x, y, color, priority, control, drawenable, line_mode, - PIC_OP_LONG_LINES, sci_titlebar_size); + PIC_OP_LONG_LINES, titlebar_size); oldx = x; oldy = y; } @@ -1450,7 +1448,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, while (*(resource + pos) < PIC_OP_FIRST) { GET_REL_COORDS(x, y); _gfxr_draw_line(pic, oldx, oldy, x, y, color, priority, control, drawenable, line_mode, - PIC_OP_SHORT_LINES, sci_titlebar_size); + PIC_OP_SHORT_LINES, titlebar_size); oldx = x; oldy = y; } @@ -1462,16 +1460,16 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, //fprintf(stderr,"####################\n"); GET_ABS_COORDS(x, y); p0printf("Abs coords %d,%d\n", x, y); - //fprintf(stderr,"C=(%d,%d)\n", x, y + sci_titlebar_size); + //fprintf(stderr,"C=(%d,%d)\n", x, y + titlebar_size); #ifdef WITH_PIC_SCALING if (pic->mode->xfact > 1 || pic->mode->yfact > 1) - _gfxr_fill_any(pic, x, y + sci_titlebar_size, (flags & DRAWPIC01_FLAG_FILL_NORMALLY) ? - color : 0, priority, control, drawenable, sci_titlebar_size); + _gfxr_fill_any(pic, x, y + titlebar_size, (flags & DRAWPIC01_FLAG_FILL_NORMALLY) ? + color : 0, priority, control, drawenable, titlebar_size); else #endif - _gfxr_fill_1(pic, x, y + sci_titlebar_size, (flags & DRAWPIC01_FLAG_FILL_NORMALLY) ? - color : 0, priority, control, drawenable, sci_titlebar_size); + _gfxr_fill_1(pic, x, y + titlebar_size, (flags & DRAWPIC01_FLAG_FILL_NORMALLY) ? + color : 0, priority, control, drawenable, titlebar_size); #ifdef FILL_RECURSIVE_DEBUG if (!fillmagc) { @@ -1530,7 +1528,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, GET_ABS_COORDS(x, y); _gfxr_draw_pattern(pic, x, y, color, priority, control, drawenable, pattern_code, - pattern_size, pattern_nr, style->brush_mode, sci_titlebar_size); + pattern_size, pattern_nr, style->brush_mode, titlebar_size); } goto end_op_loop; @@ -1557,7 +1555,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, GET_ABS_COORDS(oldx, oldy); _gfxr_draw_pattern(pic, oldx, oldy, color, priority, control, drawenable, pattern_code, - pattern_size, pattern_nr, style->brush_mode, sci_titlebar_size); + pattern_size, pattern_nr, style->brush_mode, titlebar_size); x = oldx; y = oldy; @@ -1570,7 +1568,7 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, GET_MEDREL_COORDS(x, y); _gfxr_draw_pattern(pic, x, y, color, priority, control, drawenable, pattern_code, - pattern_size, pattern_nr, style->brush_mode, sci_titlebar_size); + pattern_size, pattern_nr, style->brush_mode, titlebar_size); } goto end_op_loop; @@ -1693,8 +1691,8 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, // Hack to prevent overflowing the visual map buffer. // Yes, this does happen otherwise. - if (view->index_height + sci_titlebar_size > 200) - sci_titlebar_size = 0; + if (view->index_height + titlebar_size > 200) + titlebar_size = 0; // Set up mode structure for resizing the view Graphics::PixelFormat format = { 1, 0, 0, 0, 0, 0, 0, 0, 0 }; // 1byte/p, which handles masks and the rest for us @@ -1708,10 +1706,10 @@ void gfxr_draw_pic01(gfxr_pic_t *pic, int flags, int default_palette, int size, view->palette = NULL; if (flags & DRAWPIC01_FLAG_OVERLAID_PIC) - view_transparentize(view, pic->visual_map, posx, sci_titlebar_size + posy, + view_transparentize(view, pic->visual_map, posx, titlebar_size + posy, view->index_width, view->index_height); - _gfx_crossblit_simple(pic->visual_map->index_data + (sci_titlebar_size * 320) + posy * 320 + posx, + _gfx_crossblit_simple(pic->visual_map->index_data + (titlebar_size * 320) + posy * 320 + posx, view->index_data, pic->visual_map->index_width, view->index_width, view->index_width, view->index_height, 1); @@ -1789,13 +1787,11 @@ void gfxr_draw_pic11(gfxr_pic_t *pic, int flags, int default_palette, int size, int vector_data_ptr = READ_LE_UINT16(resource + 16); int palette_data_ptr = READ_LE_UINT16(resource + 28); int bitmap_data_ptr = READ_LE_UINT16(resource + 32); - int sci_titlebar_size; -#ifdef CUSTOM_GRAPHICS_OPTIONS - sci_titlebar_size = _options->pic_port_bounds.y; -#else - sci_titlebar_size = 10; -#endif gfx_pixmap_t *view = NULL; + // NOTE: here, it is assumed that the titlebar size is always 10. This may differ depending on + // the port bounds y starting point, but we haven't come across a case where this actually occurs. + // Also, there is a check further down which sets the titlebar size to 0 if the picture port goes off screen. + int titlebar_size = 10; if (pic->visual_map->palette) pic->visual_map->palette->free(); pic->visual_map->palette = gfxr_read_pal11(-1, resource + palette_data_ptr, 1284); @@ -1818,10 +1814,10 @@ void gfxr_draw_pic11(gfxr_pic_t *pic, int flags, int default_palette, int size, // Hack to prevent overflowing the visual map buffer. // Yes, this does happen otherwise. - if (view->index_height + sci_titlebar_size > 200) - sci_titlebar_size = 0; + if (view->index_height + titlebar_size > 200) + titlebar_size = 0; - _gfx_crossblit_simple(pic->visual_map->index_data + sci_titlebar_size*view->index_width, + _gfx_crossblit_simple(pic->visual_map->index_data + titlebar_size*view->index_width, view->index_data, pic->visual_map->index_width, view->index_width, view->index_width, |