[Scummvm-cvs-logs] SF.net SVN: scummvm:[38451] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Tue Feb 17 23:53:09 CET 2009


Revision: 38451
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38451&view=rev
Author:   thebluegr
Date:     2009-02-17 22:53:09 +0000 (Tue, 17 Feb 2009)

Log Message:
-----------
Removed already implemented graphic capability flags, and used CLIP inside scummvm_draw_line() to clean up the code a bit

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kernel.cpp
    scummvm/trunk/engines/sci/engine/savegame.cpp
    scummvm/trunk/engines/sci/engine/scriptdebug.cpp
    scummvm/trunk/engines/sci/gfx/gfx_driver.cpp
    scummvm/trunk/engines/sci/gfx/operations.cpp
    scummvm/trunk/engines/sci/include/gfx_driver.h
    scummvm/trunk/engines/sci/include/gfx_operations.h

Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp	2009-02-17 21:55:53 UTC (rev 38450)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp	2009-02-17 22:53:09 UTC (rev 38451)
@@ -456,8 +456,7 @@
 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);
 }
 
 

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2009-02-17 21:55:53 UTC (rev 38450)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2009-02-17 22:53:09 UTC (rev 38451)
@@ -5266,7 +5266,7 @@
 	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);

Modified: scummvm/trunk/engines/sci/engine/scriptdebug.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/scriptdebug.cpp	2009-02-17 21:55:53 UTC (rev 38450)
+++ scummvm/trunk/engines/sci/engine/scriptdebug.cpp	2009-02-17 22:53:09 UTC (rev 38451)
@@ -3148,35 +3148,9 @@
              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;
 

Modified: scummvm/trunk/engines/sci/gfx/gfx_driver.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_driver.cpp	2009-02-17 21:55:53 UTC (rev 38450)
+++ scummvm/trunk/engines/sci/gfx/gfx_driver.cpp	2009-02-17 22:53:09 UTC (rev 38451)
@@ -172,28 +172,11 @@
 	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;
+		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);
 
-		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;
-
 		lineColor2(S->visual[1], (int16)nstart.x, (int16)nstart.y,
 		           (int16)nend.x, (int16)nend.y, scolor);
 
@@ -544,7 +527,7 @@
 	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,

Modified: scummvm/trunk/engines/sci/gfx/operations.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/operations.cpp	2009-02-17 21:55:53 UTC (rev 38450)
+++ scummvm/trunk/engines/sci/gfx/operations.cpp	2009-02-17 22:53:09 UTC (rev 38451)
@@ -707,12 +707,6 @@
 }
 
 
-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 @@
 			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 @@
 	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,38 +1540,27 @@
 
 	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 (!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 (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;
-
 	if (!state->mouse_pointer_in_hw)
 		draw_old = state->mouse_pointer != NULL;
 

Modified: scummvm/trunk/engines/sci/include/gfx_driver.h
===================================================================
--- scummvm/trunk/engines/sci/include/gfx_driver.h	2009-02-17 21:55:53 UTC (rev 38450)
+++ scummvm/trunk/engines/sci/include/gfx_driver.h	2009-02-17 22:53:09 UTC (rev 38451)
@@ -39,15 +39,10 @@
 
 /* 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 @@
 	**
 	** 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 @@
 	**    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 @@
 	**             (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

Modified: scummvm/trunk/engines/sci/include/gfx_operations.h
===================================================================
--- scummvm/trunk/engines/sci/include/gfx_operations.h	2009-02-17 21:55:53 UTC (rev 38450)
+++ scummvm/trunk/engines/sci/include/gfx_operations.h	2009-02-17 22:53:09 UTC (rev 38451)
@@ -230,14 +230,6 @@
 ** 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 */
 /******************************/


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list