aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2009-02-17 22:53:09 +0000
committerFilippos Karapetis2009-02-17 22:53:09 +0000
commit53ef1bd4fd6d588e460db54995d8aa24f30b6513 (patch)
treee4fa057e00f99518fa4eae672f3913155394f638 /engines
parentddbad0197b158f2a27d9ca4eb5c9ecb542a9feeb (diff)
downloadscummvm-rg350-53ef1bd4fd6d588e460db54995d8aa24f30b6513.tar.gz
scummvm-rg350-53ef1bd4fd6d588e460db54995d8aa24f30b6513.tar.bz2
scummvm-rg350-53ef1bd4fd6d588e460db54995d8aa24f30b6513.zip
Removed already implemented graphic capability flags, and used CLIP inside scummvm_draw_line() to clean up the code a bit
svn-id: r38451
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/kernel.cpp3
-rw-r--r--engines/sci/engine/savegame.cpp2
-rw-r--r--engines/sci/engine/scriptdebug.cpp26
-rw-r--r--engines/sci/gfx/gfx_driver.cpp27
-rw-r--r--engines/sci/gfx/operations.cpp58
-rw-r--r--engines/sci/include/gfx_driver.h18
-rw-r--r--engines/sci/include/gfx_operations.h8
7 files changed, 25 insertions, 117 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp
index 503ac29c79..3db8b192f6 100644
--- a/engines/sci/engine/kernel.cpp
+++ b/engines/sci/engine/kernel.cpp
@@ -456,8 +456,7 @@ kGameIsRestarting(state_t *s, int funct_nr, int argc, reg_t *argv) {
reg_t
kHaveMouse(state_t *s, int funct_nr, int argc, reg_t *argv) {
- return make_reg(0, (s->have_mouse_flag
- && gfxop_have_mouse(s->gfx_state)) ? -1 : 0);
+ return make_reg(0, -1);
}
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 3cde0ce780..9a77acb351 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -5266,7 +5266,7 @@ gamestate_restore(state_t *s, char *dirname) {
retval->resource_dir = s->resource_dir;
retval->work_dir = s->work_dir;
retval->kernel_opt_flags = 0;
- retval->have_mouse_flag = s->have_mouse_flag;
+ retval->have_mouse_flag = 1;
retval->successor = NULL;
retval->pic_priority_table = (int*)gfxop_get_pic_metainfo(retval->gfx_state);
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index fd3ddd7a5d..6ead77cad9 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -3148,35 +3148,9 @@ script_debug(state_t *s, reg_t *pc, stack_ptr_t *sp, stack_ptr_t *pp, reg_t *obj
seg_id_t *segids, reg_t **variables,
reg_t **variables_base, int *variables_nr,
int bp) {
- int have_windowed = s->gfx_state->driver->capabilities & GFX_CAPABILITY_WINDOWED;
static int last_step;
/* Do we support a separate console? */
-#ifndef WANT_CONSOLE
- int missing_tty = !isatty(0) || !isatty(1);
-
- if (!have_windowed || missing_tty) {
- script_debug_flag = sci_debug_flags = 0;
-
- fprintf(stderr, "On-screen console disabled and ");
- if (!have_windowed)
- fprintf(stderr, "driver claims to be running fullscreen.\n");
- else
- fprintf(stderr, "no terminal found.\n");
-
- if (last_step == script_step_counter)
- fprintf(stderr, "This error seems to be unrecoverable.\n");
- if (script_error_flag || script_step_counter == last_step) {
- fprintf(stderr, "Aborting...\n");
- exit(1);
- } else
- fprintf(stderr, "Continuing...\n");
- last_step = script_step_counter;
- return;
- }
-#endif
-
-
if (sci_debug_flags & _DEBUG_FLAG_LOGGING) {
int old_debugstate = _debugstate_valid;
diff --git a/engines/sci/gfx/gfx_driver.cpp b/engines/sci/gfx/gfx_driver.cpp
index 618d61ec84..453af11f9b 100644
--- a/engines/sci/gfx/gfx_driver.cpp
+++ b/engines/sci/gfx/gfx_driver.cpp
@@ -172,27 +172,10 @@ scummvm_draw_line(struct _gfx_driver *drv, Common::Point start, Common::Point en
if (color.mask & GFX_MASK_VISUAL) {
Common::Point nstart, nend;
- nstart.x = start.x;
- nstart.y = start.y;
- nend.x = end.x;
- nend.y = end.y;
-
- if (nstart.x < 0)
- nstart.x = 0;
- if (nend.x < 0)
- nstart.x = 0;
- if (nstart.y < 0)
- nstart.y = 0;
- if (nend.y < 0)
- nend.y = 0;
- if (nstart.x > xsize)
- nstart.x = xsize;
- if (nend.x >= xsize)
- nend.x = xsize - 1;
- if (nstart.y > ysize)
- nstart.y = ysize;
- if (nend.y >= ysize)
- nend.y = ysize - 1;
+ nstart.x = CLIP<int16>(start.x, 0, xsize);
+ nstart.y = CLIP<int16>(start.y, 0, ysize);
+ nend.x = CLIP<int16>(end.x, 0, xsize - 1);
+ nend.y = CLIP<int16>(end.y, 0, ysize - 1);
lineColor2(S->visual[1], (int16)nstart.x, (int16)nstart.y,
(int16)nend.x, (int16)nend.y, scolor);
@@ -544,7 +527,7 @@ gfx_driver_scummvm = {
SCI_GFX_DRIVER_VERSION,
NULL,
0, 0,
- GFX_CAPABILITY_MOUSE_POINTER | GFX_CAPABILITY_COLOR_MOUSE_POINTER | GFX_CAPABILITY_MOUSE_SUPPORT | GFX_CAPABILITY_FINE_LINES | GFX_CAPABILITY_WINDOWED,
+ 0, // flags here
0,
NULL,
scummvm_init_specific,
diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp
index 0419257748..edcf76f6dd 100644
--- a/engines/sci/gfx/operations.cpp
+++ b/engines/sci/gfx/operations.cpp
@@ -707,12 +707,6 @@ gfxop_exit(gfx_state_t *state) {
}
-int
-gfxop_have_mouse(gfx_state_t *state) {
- return state->driver->capabilities & GFX_CAPABILITY_MOUSE_SUPPORT;
-}
-
-
static int
_gfxop_scan_one_bitmask(gfx_pixmap_t *pixmap, rect_t zone) {
int retval = 0;
@@ -1117,10 +1111,6 @@ _gfxop_draw_line_clipped(gfx_state_t *state, Common::Point start, Common::Point
return simulate_stippled_line_draw(state->driver, skipone, start, end, color, line_mode);
}
- if (line_mode == GFX_LINE_MODE_FINE
- && !(state->driver->capabilities & GFX_CAPABILITY_FINE_LINES))
- line_mode = GFX_LINE_MODE_FAST;
-
if ((retval = state->driver->draw_line(state->driver, start, end, color, line_mode, line_style))) {
GFXERROR("Failed to draw line (%d,%d) -- (%d,%d)\n",
start.x, start.y, end.x, end.y);
@@ -1173,8 +1163,7 @@ gfxop_draw_rectangle(gfx_state_t *state, rect_t rect, gfx_color_t color, gfx_lin
xfact = state->driver->mode->xfact;
yfact = state->driver->mode->yfact;
- if (line_mode == GFX_LINE_MODE_FINE
- && state->driver->capabilities & GFX_CAPABILITY_FINE_LINES) {
+ if (line_mode == GFX_LINE_MODE_FINE) {
xunit = yunit = 1;
xl = 1 + (rect.xl - 1) * xfact;
yl = 1 + (rect.yl - 1) * yfact;
@@ -1551,37 +1540,26 @@ _gfxop_set_pointer(gfx_state_t *state, gfx_pixmap_t *pxm) {
draw_old = state->mouse_pointer != NULL;
- if (state->driver->capabilities & GFX_CAPABILITY_MOUSE_POINTER) {
+ if (draw_old && state->mouse_pointer->colors_nr > 2)
+ draw_old = 1;
- if (draw_old && state->mouse_pointer->colors_nr > 2)
- draw_old = state->driver->capabilities & GFX_CAPABILITY_COLOR_MOUSE_POINTER;
-
- if (!draw_old
- && state->mouse_pointer
- && (state->driver->capabilities & GFX_CAPABILITY_POINTER_PIXMAP_REGISTRY))
- if ((retval = state->driver->unregister_pixmap(state->driver, state->mouse_pointer))) {
- GFXERROR("Pointer un-registration failed!\n");
- return retval;
- }
-
- if (pxm == NULL
- || (state->driver->capabilities & GFX_CAPABILITY_COLOR_MOUSE_POINTER)
- || pxm->colors_nr <= 2) {
- if (state->driver->capabilities & GFX_CAPABILITY_POINTER_PIXMAP_REGISTRY) {
- if ((pxm) && (retval = state->driver->register_pixmap(state->driver, pxm))) {
- GFXERROR("Pixmap-registering a new mouse pointer failed!\n");
- return retval;
- }
- }
- draw_new = 0;
- state->driver->set_pointer(state->driver, pxm);
- state->mouse_pointer_in_hw = 1;
- } else {
- draw_new = 1;
- state->mouse_pointer_in_hw = 0;
+ if (!draw_old
+ && state->mouse_pointer
+ && (state->driver->capabilities & GFX_CAPABILITY_POINTER_PIXMAP_REGISTRY))
+ if ((retval = state->driver->unregister_pixmap(state->driver, state->mouse_pointer))) {
+ GFXERROR("Pointer un-registration failed!\n");
+ return retval;
}
- } else draw_new = 1;
+ if (state->driver->capabilities & GFX_CAPABILITY_POINTER_PIXMAP_REGISTRY) {
+ if ((pxm) && (retval = state->driver->register_pixmap(state->driver, pxm))) {
+ GFXERROR("Pixmap-registering a new mouse pointer failed!\n");
+ return retval;
+ }
+ }
+ draw_new = 0;
+ state->driver->set_pointer(state->driver, pxm);
+ state->mouse_pointer_in_hw = 1;
if (!state->mouse_pointer_in_hw)
draw_old = state->mouse_pointer != NULL;
diff --git a/engines/sci/include/gfx_driver.h b/engines/sci/include/gfx_driver.h
index a3ea66a9b2..fc6d4a0025 100644
--- a/engines/sci/include/gfx_driver.h
+++ b/engines/sci/include/gfx_driver.h
@@ -39,15 +39,10 @@ typedef enum {
/* graphics driver hints */
#define GFX_CAPABILITY_SHADING (1<<0)
-#define GFX_CAPABILITY_MOUSE_POINTER (1<<1)
-#define GFX_CAPABILITY_COLOR_MOUSE_POINTER (1<<2)
#define GFX_CAPABILITY_PIXMAP_REGISTRY (1<<3)
#define GFX_CAPABILITY_SCALEABLE_PIXMAPS (1<<4)
#define GFX_CAPABILITY_STIPPLED_LINES (1<<6)
-#define GFX_CAPABILITY_MOUSE_SUPPORT (1<<7)
#define GFX_CAPABILITY_POINTER_PIXMAP_REGISTRY (1<<8)
-#define GFX_CAPABILITY_FINE_LINES (1<<9)
-#define GFX_CAPABILITY_WINDOWED (1<<10)
#define GFX_CAPABILITY_KEYTRANSLATE (1<<11)
#define GFX_DEBUG_POINTER (1<<0)
@@ -109,10 +104,6 @@ typedef struct _gfx_driver { /* Graphics driver */
**
** GFX_CAPABILITY_SHADING: draw_filled_rect() supports drawing shaded
** rectangles.
- ** GFX_CAPABILITY_MOUSE_POINTER: The driver has built-in support for mouse
- ** pointers (monochrome or colored).
- ** GFX_CAPABILITY_COLOR_MOUSE_POINTER: The driver has built-in support for
- ** colored mouse pointers.
** GFX_CAPABILITY_PIXMAP_REGISTRY: System provides a pixmap registry. The
** invoking functions will assume that all pixmaps MUST be registered;
** if this flag is not set, it assumes that pixmaps MUST NOT be
@@ -127,14 +118,6 @@ typedef struct _gfx_driver { /* Graphics driver */
** will be unscaled.
** GFX_CAPABILITY_STIPPLED_LINES: The driver is able to draw stippled lines
** horizontally and vertically (xl = 0 or yl = 0).
- ** GFX_CAPABILITY_MOUSE_SUPPORT: There is some support for mouse (or similar)
- ** input. Note that this flag may be disabled by external code after
- ** initialization time, if no support for mouse pointer /drawing/ is
- ** available.
- ** GFX_CAPABILITY_FINE_LINES: Should be set IFF the driver supports drawing
- ** fine (width 1) lines
- ** GFX_CAPABILITY_WINDOWED: Driver runs in a window and supports a debug
- ** console running on stdin/stdout
** GFX_CAPABILITY_KEYTRANSLATE: The driver's input layer automatically
** handles 'shifted' keys (i.e. turning shift-'a' to 'A' etc.).
** Drivers only need to handle this if they desire to support
@@ -342,7 +325,6 @@ typedef struct _gfx_driver { /* Graphics driver */
** (gfx_pixmap_t *) pointer: The pointer to set, or NULL to set
** no pointer
** Returns : (int) GFX_OK or GFX_FATAL
- ** This function may be NULL if GFX_CAPABILITY_MOUSE_POINTER is not set.
** If pointer is not NULL, it will have been scaled to the appropriate
** size and registered as a pixmap (if neccessary) beforehand.
** If this function is called for a target that supports only two-color
diff --git a/engines/sci/include/gfx_operations.h b/engines/sci/include/gfx_operations.h
index a5c53a7e0e..d08211dad9 100644
--- a/engines/sci/include/gfx_operations.h
+++ b/engines/sci/include/gfx_operations.h
@@ -230,14 +230,6 @@ gfxop_set_clip_zone(gfx_state_t *state, rect_t zone);
** Returns : (int) GFX_OK
*/
-int
-gfxop_have_mouse(gfx_state_t *state);
-/* Determines whether a pointing device is attached
-** Parameters: (gfx_state_t *) state: The state to inspect
-** Returns : (int) zero iff no pointing device is attached
-*/
-
-
/******************************/
/* Generic drawing operations */
/******************************/