pic_port_bounds was only set from command-line parameters it seems, so it's safe to put it together with the rest of the options

svn-id: r39800
This commit is contained in:
Filippos Karapetis 2009-04-02 16:38:33 +00:00
parent 9180f3a9a1
commit 6fe12a0888
6 changed files with 31 additions and 10 deletions

View File

@ -168,7 +168,11 @@ int _reset_graphics_input(EngineState *s) {
s->visual = gfxw_new_visual(s->gfx_state, font_nr);
s->wm_port = gfxw_new_port(s->visual, NULL, s->gfx_state->options->pic_port_bounds, s->ega_colors[0], transparent);
#ifdef CUSTOM_GRAPHICS_OPTIONS
s->wm_port = gfxw_new_port(s->visual, NULL, s->gfx_state->options->pic_port_bounds, s->ega_colors[0], transparent);
#else
s->wm_port = gfxw_new_port(s->visual, NULL, gfx_rect(0, 10, 320, 190), s->ega_colors[0], transparent);
#endif
s->iconbar_port = gfxw_new_port(s->visual, NULL, gfx_rect(0, 0, 320, 200), s->ega_colors[0], transparent);
s->iconbar_port->flags |= GFXW_FLAG_NO_IMPLICIT_SWITCH;
@ -196,7 +200,11 @@ int _reset_graphics_input(EngineState *s) {
s->titlebar_port->flags |= GFXW_FLAG_NO_IMPLICIT_SWITCH;
// but this is correct
#ifdef CUSTOM_GRAPHICS_OPTIONS
s->picture_port = gfxw_new_port(s->visual, NULL, s->gfx_state->options->pic_port_bounds, s->ega_colors[0], transparent);
#else
s->picture_port = gfxw_new_port(s->visual, NULL, gfx_rect(0, 10, 320, 190), s->ega_colors[0], transparent);
#endif
s->pics_drawn_nr = 0;

View File

@ -1031,8 +1031,14 @@ reg_t kDrawPic(EngineState *s, int funct_nr, int argc, reg_t *argv) {
s->picture_port->widfree(GFXW(s->picture_port));
s->iconbar_port->widfree(GFXW(s->iconbar_port));
#ifdef CUSTOM_GRAPHICS_OPTIONS
s->wm_port = gfxw_new_port(s->visual, NULL, s->gfx_state->options->pic_port_bounds, s->ega_colors[0], transparent);
s->picture_port = gfxw_new_port(s->visual, NULL, s->gfx_state->options->pic_port_bounds, s->ega_colors[0], transparent);
#else
s->wm_port = gfxw_new_port(s->visual, NULL, gfx_rect(0, 10, 320, 190), s->ega_colors[0], transparent);
s->picture_port = gfxw_new_port(s->visual, NULL, gfx_rect(0, 10, 320, 190), s->ega_colors[0], transparent);
#endif
s->iconbar_port = gfxw_new_port(s->visual, NULL, gfx_rect(0, 0, 320, 200), s->ega_colors[0], transparent);
s->iconbar_port->flags |= GFXW_FLAG_NO_IMPLICIT_SWITCH;
@ -2375,9 +2381,13 @@ reg_t kSetPort(EngineState *s, int funct_nr, int argc, reg_t *argv) {
return s->r_acc;
}
// FIXME: this actually changes the picture port bounds, which are supposed to be user-defined...
// This should never occur. This case happens when the port is supplied via command line parameters
#ifdef CUSTOM_GRAPHICS_OPTIONS
s->gfx_state->options->pic_port_bounds = gfx_rect(UKPV(5), UKPV(4),
UKPV(3), UKPV(2));
#else
warning("kSetPort() was called to change the picture port bounds, but custom graphics options are not enabled, so it has been ignored");
#endif
// FIXME: Should really only invalidate all loaded pic resources here;
// this is overkill

View File

@ -77,7 +77,7 @@ enum {
PF_FATAL = -2
};
#define scummvm_roundf(a) ((fmod(a,1)<0.5) ? floor(a) : ceil(a))
#define scummvm_roundf(a) ((fmod(a, 1) < 0.5) ? floor(a) : ceil(a))
// Floating point struct
struct FloatPoint {

View File

@ -76,10 +76,8 @@ struct gfx_options_t {
int dirty_frames;
int workarounds; // Workaround flags - see below
#endif
// FIXME: This option is abused: pic_port_bounds is actually set by the game itself in kSetPort()
rect_t pic_port_bounds;
#endif
};
#ifdef CUSTOM_GRAPHICS_OPTIONS

View File

@ -86,16 +86,18 @@ int GfxResManager::calculatePic(gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic
basic_style.line_mode = GFX_LINE_MODE_CORRECT;
basic_style.brush_mode = GFX_BRUSH_MODE_SCALED;
basic_style.pic_port_bounds = _options->pic_port_bounds;
#ifdef CUSTOM_GRAPHICS_OPTIONS
basic_style.pic_port_bounds = _options->pic_port_bounds;
style.line_mode = _options->pic0_line_mode;
style.brush_mode = _options->pic0_brush_mode;
style.pic_port_bounds = _options->pic_port_bounds;
#else
basic_style.pic_port_bounds = gfx_rect(0, 10, 320, 190);
style.line_mode = GFX_LINE_MODE_CORRECT;
style.brush_mode = GFX_BRUSH_MODE_RANDOM_ELLIPSES;
style.pic_port_bounds = gfx_rect(0, 10, 320, 190);
#endif
style.pic_port_bounds = _options->pic_port_bounds;
if (!res || !res->data)
return GFX_ERROR;
@ -148,14 +150,17 @@ int GfxResManager::getOptionsHash(gfx_resource_type_t type) {
error("getOptionsHash called on a VIEW resource");
case GFX_RESOURCE_TYPE_PIC:
#ifdef CUSTOM_GRAPHICS_OPTIONS
if (_version >= SCI_VERSION_01_VGA)
return _options->pic_port_bounds.y;
else
#ifdef CUSTOM_GRAPHICS_OPTIONS
return (_options->pic0_unscaled) ? 0x10000 : (_options->pic0_dither_mode << 12)
| (_options->pic0_dither_pattern << 8) | (_options->pic0_brush_mode << 4)
| (_options->pic0_line_mode);
#else
if (_version >= SCI_VERSION_01_VGA)
return 10;
else
return 0x10000 | (GFXR_DITHER_PATTERN_SCALED << 8) | (GFX_BRUSH_MODE_RANDOM_ELLIPSES << 4) | GFX_LINE_MODE_CORRECT;
#endif

View File

@ -248,7 +248,6 @@ Common::Error SciEngine::run() {
// Default config:
gfx_options_t gfx_options;
gfx_options.pic_port_bounds = gfx_rect(0, 10, 320, 190);
#ifdef CUSTOM_GRAPHICS_OPTIONS
gfx_options.buffer_pics_nr = 0;
@ -267,6 +266,7 @@ Common::Error SciEngine::run() {
gfx_options.res_conf.mod[i] = NULL;
}
gfx_options.workarounds = 0;
gfx_options.pic_port_bounds = gfx_rect(0, 10, 320, 190);
// Default config ends
#endif