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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Oct 28 14:20:31 CET 2009


Revision: 45459
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45459&view=rev
Author:   thebluegr
Date:     2009-10-28 13:20:30 +0000 (Wed, 28 Oct 2009)

Log Message:
-----------
Enclose all of the old graphics code within the INCLUDE_OLDGFX safeguard (defined in sci.h)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/console.cpp
    scummvm/trunk/engines/sci/engine/game.cpp
    scummvm/trunk/engines/sci/engine/kernel.cpp
    scummvm/trunk/engines/sci/engine/kevent.cpp
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/engine/kmenu.cpp
    scummvm/trunk/engines/sci/engine/kscripts.cpp
    scummvm/trunk/engines/sci/engine/savegame.cpp
    scummvm/trunk/engines/sci/engine/state.cpp
    scummvm/trunk/engines/sci/engine/state.h
    scummvm/trunk/engines/sci/gfx/gfx_driver.cpp
    scummvm/trunk/engines/sci/gfx/gfx_driver.h
    scummvm/trunk/engines/sci/gfx/gfx_gui.cpp
    scummvm/trunk/engines/sci/gfx/gfx_gui.h
    scummvm/trunk/engines/sci/gfx/gfx_pixmap_scale.cpp
    scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp
    scummvm/trunk/engines/sci/gfx/gfx_resmgr.h
    scummvm/trunk/engines/sci/gfx/gfx_resource.cpp
    scummvm/trunk/engines/sci/gfx/gfx_resource.h
    scummvm/trunk/engines/sci/gfx/gfx_state_internal.h
    scummvm/trunk/engines/sci/gfx/gfx_support.cpp
    scummvm/trunk/engines/sci/gfx/gfx_system.h
    scummvm/trunk/engines/sci/gfx/gfx_tools.cpp
    scummvm/trunk/engines/sci/gfx/gfx_tools.h
    scummvm/trunk/engines/sci/gfx/gfx_widgets.cpp
    scummvm/trunk/engines/sci/gfx/gfx_widgets.h
    scummvm/trunk/engines/sci/gfx/menubar.cpp
    scummvm/trunk/engines/sci/gfx/menubar.h
    scummvm/trunk/engines/sci/gfx/operations.cpp
    scummvm/trunk/engines/sci/gfx/operations.h
    scummvm/trunk/engines/sci/gfx/palette.cpp
    scummvm/trunk/engines/sci/gfx/palette.h
    scummvm/trunk/engines/sci/gui/gui_helpers.h
    scummvm/trunk/engines/sci/gui32/font.cpp
    scummvm/trunk/engines/sci/gui32/gui32.cpp
    scummvm/trunk/engines/sci/gui32/gui32.h
    scummvm/trunk/engines/sci/gui32/res_font.cpp
    scummvm/trunk/engines/sci/gui32/res_pal.cpp
    scummvm/trunk/engines/sci/gui32/res_pic.cpp
    scummvm/trunk/engines/sci/gui32/res_view.cpp
    scummvm/trunk/engines/sci/resource.h
    scummvm/trunk/engines/sci/sci.cpp
    scummvm/trunk/engines/sci/sci.h

Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/console.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -651,8 +651,10 @@
 		return true;
 	}
 
+#ifdef INCLUDE_OLDGFX
 	sci0_palette = atoi(argv[1]);
 	cmdRedrawScreen(argc, argv);
+#endif
 
 	return false;
 }
@@ -775,16 +777,20 @@
 }
 
 bool Console::cmdClearScreen(int argc, const char **argv) {
+#ifdef INCLUDE_OLDGFX
 	gfxop_clear_box(_vm->_gamestate->gfx_state, gfx_rect(0, 0, 320, 200));
 	gfxop_update_box(_vm->_gamestate->gfx_state, gfx_rect(0, 0, 320, 200));
+#endif
 	return false;
 }
 
 bool Console::cmdRedrawScreen(int argc, const char **argv) {
+#ifdef INCLUDE_OLDGFX
 	_vm->_gamestate->visual->draw(Common::Point(0, 0));
 	gfxop_update_box(_vm->_gamestate->gfx_state, gfx_rect(0, 0, 320, 200));
 	gfxop_update(_vm->_gamestate->gfx_state);
 	gfxop_sleep(_vm->_gamestate->gfx_state, 0);
+#endif
 	return false;
 }
 
@@ -1008,10 +1014,12 @@
 	if (argc == 4)
 		flags = atoi(argv[3]);
 
+#ifdef INCLUDE_OLDGFX
 	gfxop_new_pic(_vm->_gamestate->gfx_state, atoi(argv[1]), flags, default_palette);
 	gfxop_clear_box(_vm->_gamestate->gfx_state, gfx_rect(0, 0, 320, 200));
 	gfxop_update(_vm->_gamestate->gfx_state);
 	gfxop_sleep(_vm->_gamestate->gfx_state, 0);
+#endif
 
 	return false;
 }
@@ -1026,10 +1034,12 @@
 
 	int col = CLIP<int>(atoi(argv[5]), 0, 15);
 
+#ifdef INCLUDE_OLDGFX
 	gfxop_set_clip_zone(_vm->_gamestate->gfx_state, gfx_rect_fullscreen);
 	gfxop_fill_box(_vm->_gamestate->gfx_state, gfx_rect(atoi(argv[1]), atoi(argv[2]),
 										atoi(argv[3]), atoi(argv[4])), _vm->_gamestate->ega_colors[col]);
 	gfxop_update(_vm->_gamestate->gfx_state);
+#endif
 
 	return false;
 }
@@ -1046,9 +1056,12 @@
 	int cel = atoi(argv[3]);
 	int palette = atoi(argv[4]);
 
+
+#ifdef INCLUDE_OLDGFX
 	gfxop_set_clip_zone(_vm->_gamestate->gfx_state, gfx_rect_fullscreen);
 	gfxop_draw_cel(_vm->_gamestate->gfx_state, view, loop, cel, Common::Point(160, 100), _vm->_gamestate->ega_colors[0], palette);
 	gfxop_update(_vm->_gamestate->gfx_state);
+#endif
 
 	return false;
 }
@@ -1061,6 +1074,7 @@
 		return true;
 	}
 
+#ifdef INCLUDE_OLDGFX
 	int view = atoi(argv[1]);
 	int palette = atoi(argv[2]);
 	int loops, i;
@@ -1095,6 +1109,7 @@
 			}
 		}
 	}
+#endif
 
 	return true;
 }
@@ -1145,7 +1160,9 @@
 	int width = atoi(argv[3]);
 	int height = atoi(argv[4]);
 
+#ifdef INCLUDE_OLDGFX
 	_vm->_gamestate->gfx_state->driver->update(gfx_rect(x, y, width, height), Common::Point(x, y), GFX_BUFFER_FRONT);
+#endif
 
 	return false;
 }
@@ -1158,6 +1175,7 @@
 		return true;
 	}
 
+#ifdef INCLUDE_OLDGFX
 	int x = atoi(argv[1]);
 	int y = atoi(argv[2]);
 	int width = atoi(argv[3]);
@@ -1173,6 +1191,7 @@
 		gfxop_update_box(_vm->_gamestate->gfx_state, rect);
 	gfxop_update(_vm->_gamestate->gfx_state);
 	gfxop_sleep(_vm->_gamestate->gfx_state, 0);
+#endif
 
 	return false;
 }
@@ -1187,18 +1206,22 @@
 
 	int col = CLIP<int>(atoi(argv[1]), 0, 15);
 
+#ifdef INCLUDE_OLDGFX
 	gfxop_set_clip_zone(_vm->_gamestate->gfx_state, gfx_rect_fullscreen);
 	gfxop_fill_box(_vm->_gamestate->gfx_state, gfx_rect_fullscreen, _vm->_gamestate->ega_colors[col]);
 	gfxop_update(_vm->_gamestate->gfx_state);
+#endif
 
 	return false;
 }
 
 bool Console::cmdCurrentPort(int argc, const char **argv) {
+#ifdef INCLUDE_OLDGFX
 	if (!_vm->_gamestate->port)
 		DebugPrintf("There is no port active currently.\n");
 	else
 		DebugPrintf("Current port ID: %d\n", _vm->_gamestate->port->_ID);
+#endif
 
 	return true;
 }
@@ -1211,6 +1234,7 @@
 		return true;
 	}
 
+#ifdef INCLUDE_OLDGFX
 	GfxPort *port;
 	
 	if (!scumm_stricmp(argv[1], "current")) {
@@ -1230,6 +1254,7 @@
 				port->print(0);
 		}
 	}
+#endif
 
 	return true;
 }
@@ -1245,42 +1270,50 @@
 bool Console::cmdVisualState(int argc, const char **argv) {
 	DebugPrintf("State of the current visual widget:\n");
 
+#ifdef INCLUDE_OLDGFX
 	if (_vm->_gamestate->visual)
 		_vm->_gamestate->visual->print(0);
 	else
 		DebugPrintf("The visual widget is uninitialized.\n");
+#endif
 
 	return true;
 }
 
 bool Console::cmdFlushPorts(int argc, const char **argv) {
+#ifdef INCLUDE_OLDGFX
 	_vm->_gamestate->_gui->hideCursor();
 	DebugPrintf("Flushing dynamically allocated ports (for memory profiling)...\n");
 	delete _vm->_gamestate->visual;
 	_vm->_gamestate->gfx_state->gfxResMan->freeAllResources();
 	_vm->_gamestate->visual = NULL;
+#endif
 
 	return true;
 }
 
 bool Console::cmdDynamicViews(int argc, const char **argv) {
+#ifdef INCLUDE_OLDGFX
 	DebugPrintf("List of active dynamic views:\n");
 
 	if (_vm->_gamestate->dyn_views)
 		_vm->_gamestate->dyn_views->print(0);
 	else
 		DebugPrintf("The list is empty.\n");
+#endif
 
 	return true;
 }
 
 bool Console::cmdDroppedViews(int argc, const char **argv) {
+#ifdef INCLUDE_OLDGFX
 	DebugPrintf("List of dropped dynamic views:\n");
 
 	if (_vm->_gamestate->drop_views)
 		_vm->_gamestate->drop_views->print(0);
 	else
 		DebugPrintf("The list is empty.\n");
+#endif
 
 	return true;
 }
@@ -1293,7 +1326,9 @@
 	}
 
 	int zone = CLIP<int>(atoi(argv[1]), 0, 15);
+#ifdef INCLUDE_OLDGFX
 	DebugPrintf("Zone %x starts at y=%d\n", zone, _find_priority_band(_vm->_gamestate, zone));
+#endif
 
 	return true;
 }
@@ -1305,6 +1340,7 @@
 		return true;
 	}
 
+#ifdef INCLUDE_OLDGFX
 	_vm->_gamestate->titlebar_port->_color = _vm->_gamestate->ega_colors[atoi(argv[1])];
 	_vm->_gamestate->titlebar_port->_bgcolor = _vm->_gamestate->ega_colors[atoi(argv[2])];
 
@@ -1314,6 +1350,7 @@
 	sciw_set_status_bar(_vm->_gamestate, _vm->_gamestate->titlebar_port, _vm->_gamestate->_statusBarText,
 							_vm->_gamestate->status_bar_foreground, _vm->_gamestate->status_bar_background);
 	gfxop_update(_vm->_gamestate->gfx_state);
+#endif
 
 	return false;
 }

Modified: scummvm/trunk/engines/sci/engine/game.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/game.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/engine/game.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -173,6 +173,7 @@
 }
 
 int _reset_graphics_input(EngineState *s) {
+#ifdef INCLUDE_OLDGFX
 	Resource *resource;
 	int font_nr;
 	gfx_color_t transparent = { PaletteEntry(), 0, -1, -1, 0 };
@@ -216,13 +217,6 @@
 	s->dyn_views = NULL; // no DynViews
 	s->drop_views = NULL; // And, consequently, no list for dropped views
 
-	s->priority_first = 42; // Priority zone 0 ends here
-
-	if (s->usesOldGfxFunctions())
-		s->priority_last = 200;
-	else
-		s->priority_last = 190;
-
 	font_nr = -1;
 	do {
 		resource = s->resMan->testResource(ResourceId(kResourceTypeFont, ++font_nr));
@@ -279,6 +273,15 @@
 	s->titlebar_port->_bgcolor.priority = 11; // Standard priority for the titlebar port
 #endif
 
+#endif
+
+	s->priority_first = 42; // Priority zone 0 ends here
+
+	if (s->usesOldGfxFunctions())
+		s->priority_last = 200;
+	else
+		s->priority_last = 190;
+
 	return 0;
 }
 
@@ -289,12 +292,14 @@
 static void _free_graphics_input(EngineState *s) {
 	debug(2, "Freeing graphics");
 
+#ifdef INCLUDE_OLDGFX
 	delete s->visual;
 
 	s->wm_port = s->titlebar_port = s->picture_port = NULL;
 	s->visual = NULL;
 	s->dyn_views = NULL;
 	s->port = NULL;
+#endif
 }
 
 int game_init_sound(EngineState *s, int sound_flags) {
@@ -406,8 +411,14 @@
 
 	s->parserIsValid = false; // Invalidate parser
 	s->parser_event = NULL_REG; // Invalidate parser event
+
+#ifdef INCLUDE_OLDGFX
 	if (s->gfx_state && _reset_graphics_input(s))
 		return 1;
+#else
+	if (_reset_graphics_input(s))
+		return 1;
+#endif
 
 	s->successor = NULL; // No successor
 	s->_statusBarText.clear(); // Status bar is blank

Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -28,6 +28,7 @@
 #include "sci/resource.h"
 #include "sci/engine/state.h"
 #include "sci/engine/kernel_types.h"
+#include "sci/gfx/operations.h"	// for gfxop_get_cel_parameters
 
 namespace Sci {
 
@@ -728,4 +729,69 @@
 	return true;
 }
 
+Common::Rect set_base(EngineState *s, reg_t object) {
+	SegManager *segMan = s->_segMan;
+	int x, y, original_y, z, ystep, xsize = 0, ysize = 0;
+	int xbase, ybase, xend, yend;
+	int view, loop, cel;
+	int oldloop, oldcel;
+	int xmod = 0, ymod = 0;
+	Common::Rect retval;
+
+	x = (int16)GET_SEL32V(segMan, object, x);
+	original_y = y = (int16)GET_SEL32V(segMan, object, y);
+
+	if (s->_kernel->_selectorCache.z > -1)
+		z = (int16)GET_SEL32V(segMan, object, z);
+	else
+		z = 0;
+
+	y -= z; // Subtract z offset
+
+	ystep = (int16)GET_SEL32V(segMan, object, yStep);
+
+	view = (int16)GET_SEL32V(segMan, object, view);
+	int l = GET_SEL32V(segMan, object, loop);
+	oldloop = loop = (l & 0x80) ? l - 256 : l;
+	int c = GET_SEL32V(segMan, object, cel);
+	oldcel = cel = (c & 0x80) ? c - 256 : c;
+
+	Common::Point offset = Common::Point(0, 0);
+
+	if (loop != oldloop) {
+		loop = 0;
+		PUT_SEL32V(segMan, object, loop, 0);
+		debugC(2, kDebugLevelGraphics, "Resetting loop for %04x:%04x!\n", PRINT_REG(object));
+	}
+
+	if (cel != oldcel) {
+		cel = 0;
+		PUT_SEL32V(segMan, object, cel, 0);
+	}
+
+#ifdef INCLUDE_OLDGFX
+	gfxop_get_cel_parameters(s->gfx_state, view, loop, cel, &xsize, &ysize, &offset);
+#else
+	// TODO
+#endif
+
+	xmod = offset.x;
+	ymod = offset.y;
+
+	xbase = x - xmod - (xsize >> 1);
+	xend = xbase + xsize;
+	yend = y /* - ymod */ + 1;
+	ybase = yend - ystep;
+
+	debugC(2, kDebugLevelBaseSetter, "(%d,%d)+/-(%d,%d), (%d x %d) -> (%d, %d) to (%d, %d)\n",
+	          x, y, xmod, ymod, xsize, ysize, xbase, ybase, xend, yend);
+
+	retval.left = xbase;
+	retval.top = ybase;
+	retval.right = xend;
+	retval.bottom = yend;
+
+	return retval;
+}
+
 } // End of namespace Sci

Modified: scummvm/trunk/engines/sci/engine/kevent.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kevent.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/engine/kevent.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -26,6 +26,7 @@
 #include "sci/sci.h"
 #include "sci/engine/state.h"
 #include "sci/engine/kernel.h"
+#include "sci/gfx/operations.h"
 #include "sci/gfx/gfx_widgets.h"
 #include "sci/gfx/gfx_state_internal.h"	// required for GfxPort, GfxVisual
 #include "sci/console.h"

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -274,7 +274,9 @@
 		error("Unsupported kGraph() operation %04x", argv[0].toSint16());
 	}
 
+#ifdef INCLUDE_OLDGFX
 	gfxop_update(s->gfx_state);
+#endif
 	return s->r_acc;
 }
 
@@ -374,6 +376,8 @@
 	int cel = argv[2].toSint16();
 	int y = argv[3].toUint16();
 	int x = argv[4].toUint16();
+
+#ifdef INCLUDE_OLDGFX
 	gfxr_view_t *res = NULL;
 	gfx_pixmap_t *pxm = NULL;
 
@@ -391,6 +395,10 @@
 		y = pxm->index_height - 1;
 
 	return make_reg(0, pxm->index_data[y * pxm->index_width + x] == pxm->color_key);
+#else
+	// TODO
+	return NULL_REG;
+#endif
 }
 
 reg_t kCelHigh(EngineState *s, int argc, reg_t *argv) {
@@ -438,7 +446,7 @@
 	int argBase = 0;
 
 	if ((argc == 2) || (argc == 4)) {
-		screenMask = GFX_MASK_CONTROL;
+		screenMask = SCI_SCREEN_MASK_CONTROL;
 	} else {
 		screenMask = argv[0].toUint16();
 		argBase = 1;

Modified: scummvm/trunk/engines/sci/engine/kmenu.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmenu.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/engine/kmenu.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -39,8 +39,12 @@
 	Common::String name = s->_segMan->getString(argv[0]);
 	Common::String contents = s->_segMan->getString(argv[1]);
 
+#ifdef INCLUDE_OLDGFX
 	s->_menubar->addMenu(s->gfx_state, name,
 	                 contents, s->titlebar_port->_font, argv[1]);
+#else
+	// TODO
+#endif
 
 	return s->r_acc;
 
@@ -104,11 +108,14 @@
 		return item_nr;
 }
 
+#ifdef INCLUDE_OLDGFX
 #define FULL_REDRAW \
 	s->visual->draw(Common::Point(0, 0)); \
 	gfxop_update(s->gfx_state);
+#else
+#define FULL_REDRAW
+#endif
 
-
 reg_t kMenuSelect(EngineState *s, int argc, reg_t *argv) {
 	SegManager *segMan = s->_segMan;
 	reg_t event = argv[0];
@@ -128,7 +135,9 @@
 	const int debug_parser = 0;
 #endif
 
+#ifdef INCLUDE_OLDGFX
 	gfxop_set_clip_zone(s->gfx_state, gfx_rect_fullscreen);
+#endif
 
 	/* Check whether we can claim the event directly as a keyboard or said event */
 	if (type & (SCI_EVT_KEYBOARD | SCI_EVT_SAID)) {
@@ -181,6 +190,8 @@
 	if (menu_mode) {
 		int old_item;
 		int old_menu;
+
+#ifdef INCLUDE_OLDGFX
 		GfxPort *port = sciw_new_menu(s, s->titlebar_port, s->_menubar, 0);
 
 		item_nr = -1;
@@ -193,6 +204,7 @@
 
 		sciw_set_menubar(s, s->titlebar_port, s->_menubar, menu_nr);
 		FULL_REDRAW;
+#endif
 
 		old_item = -1;
 		old_menu = -1;
@@ -211,8 +223,10 @@
 				switch (ev.data) {
 
 				case '`':
+#ifdef INCLUDE_OLDGFX
 					if (ev.buckybits & SCI_EVM_CTRL)
 						s->visual->print(0);
+#endif
 					break;
 
 				case SCI_K_ESC:
@@ -263,7 +277,9 @@
 				{
 				Common::Point curMousePos = s->_cursor->getPosition();
 				menu_mode = (curMousePos.y < 10);
+#ifdef INCLUDE_OLDGFX
 				claimed = !menu_mode && !s->_menubar->mapPointer(curMousePos, menu_nr, item_nr, toCommonRect(port->_bounds));
+#endif
 				mouse_down = 0;
 				}
 				break;
@@ -278,6 +294,7 @@
 			}
 
 			if (mouse_down)
+#ifdef INCLUDE_OLDGFX
 				s->_menubar->mapPointer(s->_cursor->getPosition(), menu_nr, item_nr, toCommonRect(port->_bounds));
 
 			if ((item_nr > -1 && old_item == -1) || (menu_nr != old_menu)) { /* Update menu */
@@ -294,13 +311,15 @@
 				else {
 					FULL_REDRAW;
 				}
-
 			} /* ...if the menu changed. */
+#endif
 
 			/* Remove the active menu item, if neccessary */
 			if (item_nr != old_item) {
+#ifdef INCLUDE_OLDGFX
 				port = sciw_toggle_item(port, &(s->_menubar->_menus[menu_nr]), old_item, false);
 				port = sciw_toggle_item(port, &(s->_menubar->_menus[menu_nr]), item_nr, true);
+#endif
 				FULL_REDRAW;
 			}
 
@@ -309,6 +328,7 @@
 
 		} /* while (menu_mode) */
 
+#ifdef INCLUDE_OLDGFX
 		if (port) {
 			delete port;
 			port = NULL;
@@ -316,6 +336,7 @@
 			sciw_set_status_bar(s, s->titlebar_port, s->_statusBarText, s->status_bar_foreground, s->status_bar_background);
 			gfxop_update(s->gfx_state);
 		}
+#endif
 		FULL_REDRAW;
 	}
 

Modified: scummvm/trunk/engines/sci/engine/kscripts.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kscripts.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/engine/kscripts.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -168,7 +168,9 @@
 
 	victim_obj->markAsFreed();
 	
+#ifdef INCLUDE_OLDGFX
 	_k_view_list_mark_free(s, victim_addr); // Free on view list, if neccessary
+#endif
 
 	return s->r_acc;
 }

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -748,9 +748,10 @@
 	retval->execution_stack_base = 0;
 
 	// Now copy all current state information
+#ifdef INCLUDE_OLDGFX
 	// Graphics and input state:
-	retval->gfx_state = s->gfx_state;
 	retval->old_screen = 0;
+#endif
 
 	temp = retval->_sound._songlib;
 	retval->_sound.sfx_init(retval->resMan, s->sfx_init_flags);
@@ -781,7 +782,9 @@
 	retval->bp_list = s->bp_list;
 
 	retval->successor = NULL;
+#ifdef INCLUDE_OLDGFX
 	retval->pic_priority_table = (int *)(retval->gfx_state->pic) ? retval->gfx_state->pic->priorityTable : NULL;
+#endif
 	retval->_gameName = s->_gameName;
 
 	retval->_sound._it = NULL;

Modified: scummvm/trunk/engines/sci/engine/state.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/state.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/engine/state.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,6 +23,8 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+
 #include "sci/engine/state.h"
 #include "sci/engine/vm.h"
 #include "sci/engine/script.h"
@@ -34,7 +36,6 @@
 : resMan(res), _kernel(kernel), _voc(voc), _gui(gui), _cursor(cursor), _dirseeker(this) {
 
 	gfx_state = 0;
-	old_screen = 0;
 
 	sfx_init_flags = 0;
 	sound_volume = 0;
@@ -50,12 +51,11 @@
 	status_bar_foreground = 0;
 	status_bar_background = 0;
 
+#ifdef INCLUDE_OLDGFX
+	old_screen = 0;
 	port = 0;
-
 	memset(ega_colors, 0, sizeof(ega_colors));
-
 	visual = 0;
-
 	titlebar_port = 0;
 	wm_port = 0;
 	picture_port = 0;
@@ -65,8 +65,8 @@
 	pic_animate = 0;
 
 	dyn_views = 0;
-
 	drop_views = 0;
+#endif
 
 	_menubar = 0;
 

Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/engine/state.h	2009-10-28 13:20:30 UTC (rev 45459)
@@ -134,7 +134,6 @@
 	SciGuiCursor *_cursor;	/* Cursor functions */
 
 	GfxState *gfx_state; /**< Graphics state and driver */
-	gfx_pixmap_t *old_screen; /**< Old screen content: Stored during kDrawPic() for kAnimate() */
 
 	SfxState _sound; /**< sound subsystem */
 	int sfx_init_flags; /**< flags the sfx subsystem was initialised with */
@@ -153,6 +152,9 @@
 
 	int status_bar_foreground, status_bar_background;
 
+#ifdef INCLUDE_OLDGFX
+	gfx_pixmap_t *old_screen; /**< Old screen content: Stored during kDrawPic() for kAnimate() */
+
 	GfxPort *port; /**< The currently active port */
 
 	gfx_color_t ega_colors[16]; /**< The 16 EGA colors- for SCI0(1) */
@@ -169,6 +171,7 @@
 
 	GfxList *dyn_views; /**< Pointers to pic and dynamic view lists */
 	GfxList *drop_views; /**< A list Animate() can dump dropped dynviews into */
+#endif
 
 	Menubar *_menubar; /**< The menu bar */
 
@@ -296,6 +299,8 @@
 	bool _usesCdTrack;
 };
 
+#ifdef INCLUDE_OLDGFX
+
 /**
  * Retrieves the gfx_pixmap_color_t associated with a game color index.
  * @param s			game state
@@ -310,6 +315,8 @@
 void assert_primary_widget_lists(EngineState *s);
 void reparentize_primary_widget_lists(EngineState *s, GfxPort *newport);
 
+#endif
+
 } // End of namespace Sci
 
 #endif // SCI_INCLUDE_ENGINE_H

Modified: scummvm/trunk/engines/sci/gfx/gfx_driver.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_driver.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gfx/gfx_driver.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,13 +23,15 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 #include "common/scummsys.h"
 #include "common/system.h"
 #include "graphics/cursorman.h"
 #include "graphics/primitives.h"
 #include "graphics/surface.h"
 
-#include "sci/sci.h"
 #include "sci/gui/gui_screen.h"
 #include "sci/gfx/gfx_driver.h"
 #include "sci/gfx/gfx_tools.h"
@@ -199,3 +201,5 @@
 }
 
 } // End of namespace Sci
+
+#endif

Modified: scummvm/trunk/engines/sci/gfx/gfx_driver.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_driver.h	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gfx/gfx_driver.h	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,6 +23,9 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 #ifndef SCI_GFX_GFX_DRIVER_H
 #define SCI_GFX_GFX_DRIVER_H
 
@@ -222,3 +225,5 @@
 } // End of namespace Sci
 
 #endif // SCI_GFX_GFX_DRIVER_H
+
+#endif

Modified: scummvm/trunk/engines/sci/gfx/gfx_gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_gui.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gfx/gfx_gui.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,7 +23,9 @@
  *
  */
 
-#include "sci/sci.h"
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 #include "sci/engine/state.h"
 #include "sci/gfx/operations.h"
 #include "sci/gfx/gfx_widgets.h"
@@ -660,3 +662,5 @@
 }
 
 } // End of namespace Sci
+
+#endif

Modified: scummvm/trunk/engines/sci/gfx/gfx_gui.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_gui.h	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gfx/gfx_gui.h	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,6 +23,9 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 #ifndef SCI_INCLUDE_SCI_WIDGETS_H
 #define SCI_INCLUDE_SCI_WIDGETS_H
 
@@ -218,3 +221,5 @@
 } // End of namespace Sci
 
 #endif // SCI_INCLUDE_SCI_WIDGETS_H
+
+#endif

Modified: scummvm/trunk/engines/sci/gfx/gfx_pixmap_scale.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_pixmap_scale.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gfx/gfx_pixmap_scale.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,6 +23,9 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 /* Required defines:
 ** FUNCNAME: Function name
 ** SIZETYPE: Type used for each pixel
@@ -126,3 +129,5 @@
 
 
 } // End of namespace Sci
+
+#endif

Modified: scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,13 +23,15 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 // Resource manager core part
 
 // FIXME/TODO: The name "(Graphics) resource manager", and the associated
 // filenames, are misleading. This should be renamed to "Graphics manager"
 // or something like that.
 
-#include "sci/sci.h"
 #include "sci/gfx/gfx_resource.h"
 #include "sci/gfx/gfx_tools.h"
 #include "sci/gfx/gfx_resmgr.h"
@@ -526,3 +528,5 @@
 }
 
 } // End of namespace Sci
+
+#endif

Modified: scummvm/trunk/engines/sci/gfx/gfx_resmgr.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_resmgr.h	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gfx/gfx_resmgr.h	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,6 +23,9 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 #ifndef SCI_GFX_GFX_RESMAN_H
 #define SCI_GFX_GFX_RESMAN_H
 
@@ -282,3 +285,5 @@
 } // End of namespace Sci
 
 #endif // SCI_GFX_GFX_RESMAN_H
+
+#endif

Modified: scummvm/trunk/engines/sci/gfx/gfx_resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_resource.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gfx/gfx_resource.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,6 +23,9 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 #include "sci/gfx/gfx_system.h"
 #include "sci/gfx/gfx_resource.h"
 #include "sci/gfx/gfx_tools.h"
@@ -73,3 +76,5 @@
 }
 
 } // End of namespace Sci
+
+#endif

Modified: scummvm/trunk/engines/sci/gfx/gfx_resource.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_resource.h	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gfx/gfx_resource.h	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,6 +23,9 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 /** @file gfx_resource.h
  * SCI Resource library.
  */
@@ -32,6 +35,7 @@
 
 #include "sci/gfx/gfx_system.h"
 #include "sci/gfx/gfx_driver.h"
+#include "sci/gui/gui_helpers.h"
 
 #include "common/rect.h"
 
@@ -75,15 +79,6 @@
  */
 extern Palette* gfx_sci0_pic_colors;
 
-
-enum ViewType {
-	kViewUnknown,
-	kViewEga,
-	kViewVga,
-	kViewVga11,
-	kViewAmiga
-};
-
 struct gfxr_pic0_params_t {
 	gfx_line_mode_t line_mode; /* one of GFX_LINE_MODE_* */
 	gfx_brush_mode_t brush_mode;
@@ -290,3 +285,5 @@
 } // End of namespace Sci
 
 #endif // SCI_GFX_GFX_RESOURCE_H
+
+#endif

Modified: scummvm/trunk/engines/sci/gfx/gfx_state_internal.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_state_internal.h	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gfx/gfx_state_internal.h	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,6 +23,9 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 #ifndef SCI_GFX_GFX_STATE_INTERNAL_H
 #define SCI_GFX_GFX_STATE_INTERNAL_H
 
@@ -410,3 +413,5 @@
 } // End of namespace Sci
 
 #endif // SCI_GFX_GFX_STATE_INTERNAL_H
+
+#endif

Modified: scummvm/trunk/engines/sci/gfx/gfx_support.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_support.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gfx/gfx_support.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,6 +23,9 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 /* Graphics support functions for drivers and replacements for driver functions
 ** for use with the graphical state manager
 */
@@ -274,3 +277,5 @@
 }
 
 } // End of namespace Sci
+
+#endif

Modified: scummvm/trunk/engines/sci/gfx/gfx_system.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_system.h	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gfx/gfx_system.h	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,6 +23,9 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 #ifndef SCI_GFX_GFX_SYSTEM
 #define SCI_GFX_GFX_SYSTEM
 
@@ -279,3 +282,5 @@
 } // End of namespace Sci
 
 #endif // SCI_GFX_GFX_SYSTEM
+
+#endif

Modified: scummvm/trunk/engines/sci/gfx/gfx_tools.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_tools.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gfx/gfx_tools.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,6 +23,9 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 #include "sci/gfx/gfx_tools.h"
 
 namespace Sci {
@@ -156,3 +159,5 @@
 }
 
 } // End of namespace Sci
+
+#endif

Modified: scummvm/trunk/engines/sci/gfx/gfx_tools.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_tools.h	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gfx/gfx_tools.h	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,6 +23,9 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 #ifndef SCI_GFX_GFX_TOOLS_H
 #define SCI_GFX_GFX_TOOLS_H
 
@@ -184,3 +187,5 @@
 } // End of namespace Sci
 
 #endif // SCI_GFX_GFX_TOOLS_H
+
+#endif

Modified: scummvm/trunk/engines/sci/gfx/gfx_widgets.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_widgets.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gfx/gfx_widgets.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,7 +23,9 @@
  *
  */
 
-#include "sci/sci.h"
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 #include "sci/gfx/gfx_gui.h"		// for kWindowAutoRestore
 #include "sci/gfx/gfx_widgets.h"
 #include "sci/gfx/gfx_state_internal.h"
@@ -1769,3 +1771,5 @@
 }
 
 } // End of namespace Sci
+
+#endif

Modified: scummvm/trunk/engines/sci/gfx/gfx_widgets.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_widgets.h	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gfx/gfx_widgets.h	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,6 +23,8 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
 
 #ifndef SCI_GFX_GFX_WIDGETS_H
 #define SCI_GFX_GFX_WIDGETS_H
@@ -471,3 +473,5 @@
 } // End of namespace Sci
 
 #endif // SCI_GFX_GFX_WIDGETS_H
+
+#endif

Modified: scummvm/trunk/engines/sci/gfx/menubar.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/menubar.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gfx/menubar.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -77,6 +77,7 @@
 	_tag = 0;
 }
 
+#ifdef INCLUDE_OLDGFX
 
 int Menu::addMenuItem(GfxState *state, MenuType type, const char *left, const char *right,
 						   int font, int key, int modifiers, int tag, reg_t text_pos) {
@@ -107,14 +108,18 @@
 	}
 
 	if (right) {
+#ifdef INCLUDE_OLDGFX
 		gfxop_get_text_params(state, font, item->_keytext.c_str(), SIZE_INF, &width, &height, 0, NULL, NULL, NULL);
+#endif
 		total_left_size = MENU_BOX_CENTER_PADDING + width;
 	}
 
 	item->_enabled = 1;
 	item->_tag = tag;
 	item->_textPos = text_pos;
+#ifdef INCLUDE_OLDGFX
 	gfxop_get_text_params(state, font, left, SIZE_INF, &width, &height, 0, NULL, NULL, NULL);
+#endif
 
 	_items.push_back(newItem);
 
@@ -133,7 +138,9 @@
 
 	menu._title = title;
 
+#ifdef INCLUDE_OLDGFX
 	gfxop_get_text_params(state, font, title.c_str(), SIZE_INF, &(menu._titleWidth), &height, 0, NULL, NULL, NULL);
+#endif
 
 	const char *entries_p = entries.c_str();
 
@@ -169,7 +176,9 @@
 
 				beginning = entries_base;
 				beginning.offset -= string_len + 1;
+#ifdef INCLUDE_OLDGFX
 				c_width = menu.addMenuItem(state, entrytype, left, NULL, font, 0, 0, tag, beginning);
+#endif
 				if (c_width > max_width)
 					max_width = c_width;
 
@@ -269,6 +278,8 @@
 	_menus.push_back(menu);
 }
 
+#endif
+
 bool MenuItem::matchKey(int message, int modifiers) {
 	if ((_key == message) && ((modifiers & (SCI_EVM_CTRL | SCI_EVM_ALT)) == _modifiers))
 		return true;

Modified: scummvm/trunk/engines/sci/gfx/menubar.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/menubar.h	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gfx/menubar.h	2009-10-28 13:20:30 UTC (rev 45459)
@@ -28,6 +28,7 @@
 #ifndef SCI_GFX_SCI_MENUBAR_H
 #define SCI_GFX_SCI_MENUBAR_H
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
 #include "sci/engine/vm_types.h"
 #include "sci/gfx/operations.h"
 
@@ -138,8 +139,10 @@
 
 //protected:
 	// FIXME: This should be (partially) turned into a MenuItem constructor
+#ifdef INCLUDE_OLDGFX
 	int addMenuItem(GfxState *state, MenuType type, const char *left, const char *right,
 	                int font, int key, int modifiers, int tag, reg_t text_pos);
+#endif
 };
 
 
@@ -171,9 +174,10 @@
 	 * @param[in] font			The font which is to be used for drawing
 	 * @param[in] entries_base	Segmented VM address of the entries string
 	 */
+#ifdef INCLUDE_OLDGFX
 	void addMenu(GfxState *state, const Common::String &title, const Common::String &entries, int font, reg_t entries_base);
+#endif
 
-
 	/**
 	 * Sets the attributes for a menu item.
 	 *

Modified: scummvm/trunk/engines/sci/gfx/operations.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/operations.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gfx/operations.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -27,7 +27,9 @@
 
 #include "sci/sci.h"
 #include "sci/gfx/operations.h"
+#ifdef INCLUDE_OLDGFX
 #include "sci/gui32/font.h"
+#endif
 #include "sci/console.h"
 
 #include "common/system.h"
@@ -35,6 +37,8 @@
 
 namespace Sci {
 
+#ifdef INCLUDE_OLDGFX
+
 #define PRECISE_PRIORITY_MAP // Duplicate all operations on the local priority map as appropriate
 
 #undef GFXW_DEBUG_DIRTY
@@ -871,7 +875,342 @@
 	state->disable_dirty = 1;
 }
 
+// View operations
 
+void gfxop_get_cel_parameters(GfxState *state, int nr, int loop, int cel, int *width, int *height, Common::Point *offset) {
+	gfxr_view_t *view = NULL;
+	gfx_pixmap_t *pxm = NULL;
+
+	view = state->gfxResMan->getView(nr, &loop, &cel, 0);
+
+	if (!view)
+		error("[GFX] Attempt to get cel parameters for invalid view %d", nr);
+
+	pxm = view->loops[loop].cels[cel];
+	*width = pxm->index_width;
+	*height = pxm->index_height;
+	offset->x = pxm->xoffset;
+	offset->y = pxm->yoffset;
+}
+
+static void _gfxop_draw_cel_buffer(GfxState *state, int nr, int loop, int cel, Common::Point pos, gfx_color_t color, int static_buf, int palette) {
+	int priority = (color.mask & GFX_MASK_PRIORITY) ? color.priority : -1;
+	int control = (color.mask & GFX_MASK_CONTROL) ? color.control : -1;
+	gfxr_view_t *view = NULL;
+	gfx_pixmap_t *pxm = NULL;
+	int old_x, old_y;
+
+	view = state->gfxResMan->getView(nr, &loop, &cel, palette);
+
+	if (!view) {
+		warning("[GFX] Attempt to draw loop/cel %d/%d in invalid view %d\n", loop, cel, nr);
+		return;
+	}
+	pxm = view->loops[loop].cels[cel];
+
+	old_x = pos.x -= pxm->xoffset;
+	old_y = pos.y -= pxm->yoffset;
+
+	pos.x *= state->driver->getMode()->scaleFactor;
+	pos.y *= state->driver->getMode()->scaleFactor;
+
+	if (!static_buf)
+		_gfxop_add_dirty(state, gfx_rect(old_x, old_y, pxm->index_width, pxm->index_height));
+
+	_gfxop_draw_pixmap(state->driver, pxm, priority, control, gfx_rect(0, 0, pxm->width, pxm->height),
+	                          gfx_rect(pos.x, pos.y, pxm->width, pxm->height), state->clip_zone, static_buf , state->control_map,
+	                          static_buf ? state->static_priority_map : state->priority_map);
+}
+
+void gfxop_draw_cel(GfxState *state, int nr, int loop, int cel, Common::Point pos, gfx_color_t color, int palette) {
+	_gfxop_draw_cel_buffer(state, nr, loop, cel, pos, color, 0, palette);
+}
+
+void gfxop_draw_cel_static(GfxState *state, int nr, int loop, int cel, Common::Point pos, gfx_color_t color, int palette) {
+	rect_t oldclip = state->clip_zone;
+
+	state->clip_zone = gfx_rect_fullscreen;
+	_gfxop_scale_rect(&(state->clip_zone), state->driver->getMode());
+	gfxop_draw_cel_static_clipped(state, nr, loop, cel, pos, color, palette);
+	// Except that the area it's clipped against is... unusual ;-)
+	state->clip_zone = oldclip;
+}
+
+void gfxop_draw_cel_static_clipped(GfxState *state, int nr, int loop, int cel, Common::Point pos, gfx_color_t color, int palette) {
+	_gfxop_draw_cel_buffer(state, nr, loop, cel, pos, color, 1, palette);
+}
+
+// Pic operations
+
+static void _gfxop_set_pic(GfxState *state) {
+	gfx_copy_pixmap_box_i(state->control_map, state->pic->control_map, gfx_rect(0, 0, 320, 200));
+	gfx_copy_pixmap_box_i(state->priority_map, state->pic_unscaled->priority_map, gfx_rect(0, 0, 320, 200));
+	gfx_copy_pixmap_box_i(state->static_priority_map, state->pic_unscaled->priority_map, gfx_rect(0, 0, 320, 200));
+
+	// Reset global palette to this PIC's palette
+	// FIXME: The _gfxop_install_pixmap call below updates the OSystem palette.
+	// This is too soon, since it causes brief palette corruption until the
+	// screen is updated too. (Possibly related: EngineState::pic_not_valid .)
+	if (state->pic->visual_map->palette) {
+		state->pic->visual_map->palette->forceInto(SCREEN_PALETTE);
+		_gfxop_install_pixmap(state->driver, state->pic->visual_map);
+	}
+
+	state->driver->setStaticBuffer(state->pic->visual_map, state->pic->priority_map);
+}
+
+void gfxop_new_pic(GfxState *state, int nr, int flags, int default_palette) {
+	state->gfxResMan->tagResources();
+	state->tag_mode = 1;
+	state->palette_nr = default_palette;
+	state->pic = state->gfxResMan->getPic(nr, GFX_MASK_VISUAL, flags, default_palette, true);
+
+	if (state->driver->getMode()->scaleFactor == 1 && state->driver->getMode()->scaleFactor == 1) {
+		state->pic_unscaled = state->pic;
+	} else {
+		state->pic_unscaled = state->gfxResMan->getPic(nr, GFX_MASK_VISUAL, flags, default_palette, false);
+	}
+
+	if (!state->pic || !state->pic_unscaled) {
+		warning("Could not retrieve background pic %d", nr);
+		if (state->pic) {
+			warning("  -- Inconsistency: scaled pic _was_ retrieved!");
+		}
+
+		if (state->pic_unscaled) {
+			warning("  -- Inconsistency: unscaled pic _was_ retrieved!");
+		}
+
+		error("Error occured in gfxop_new_pic()");
+		state->pic = state->pic_unscaled = NULL;
+	}
+
+	state->pic_nr = nr;
+
+	_gfxop_set_pic(state);
+}
+
+void gfxop_add_to_pic(GfxState *state, int nr, int flags, int default_palette) {
+	if (!state->pic)
+		error("Attempt to add to pic with no pic active");
+
+	state->pic = state->gfxResMan->addToPic(state->pic_nr, nr, flags, state->palette_nr, default_palette);
+
+	if (!state->pic)
+		error("Could not add pic #%d to pic #%d", state->pic_nr, nr);
+
+	state->pic_unscaled = state->gfxResMan->addToPic(state->pic_nr, nr, flags, state->palette_nr, default_palette);
+
+	_gfxop_set_pic(state);
+}
+
+// Text operations
+
+void gfxop_get_text_params(GfxState *state, int font_nr, const char *text, int maxwidth, int *width, int *height, int text_flags,
+						  int *lines_nr, int *lineheight, int *lastline_width) {
+	Common::Array<TextFragment> fragments;
+	bool textsplits;
+	gfx_bitmap_font_t *font;
+
+	font = state->gfxResMan->getFont(font_nr);
+
+	if (!font)
+		error("Attempt to calculate text size with invalid font #%d", font_nr);
+
+	textsplits = gfxr_font_calculate_size(fragments, font, maxwidth, text, width, height, lineheight, lastline_width, text_flags);
+
+	if (!textsplits)
+		error("Could not calculate text size");
+
+	if (lines_nr)
+		*lines_nr = fragments.size();
+}
+
+TextHandle *gfxop_new_text(GfxState *state, int font_nr, const Common::String &text, int maxwidth, gfx_alignment_t halign,
+								  gfx_alignment_t valign, gfx_color_t color1, gfx_color_t color2, gfx_color_t bg_color, int flags) {
+	TextHandle *handle;
+	gfx_bitmap_font_t *font;
+
+	// mapping text colors to palette
+	gfxop_set_color(state, &color1, color1);
+	gfxop_set_color(state, &color2, color2);
+	gfxop_set_color(state, &bg_color, bg_color);
+
+	font = state->gfxResMan->getFont(font_nr);
+
+	if (!font) {
+		error("Attempt to draw text with invalid font #%d", font_nr);
+		return NULL;
+	}
+
+	handle = new TextHandle();
+
+	handle->_text = text;
+	handle->halign = halign;
+	handle->valign = valign;
+	handle->line_height = font->line_height;
+
+	bool result = gfxr_font_calculate_size(handle->lines, font, maxwidth, handle->_text.c_str(), &(handle->width), &(handle->height),
+	                             NULL, NULL, flags);
+
+	if (!result) {
+		error("Could not calculate text parameters in font #%d", font_nr);
+		delete handle;
+		return NULL;
+	}
+
+	if (flags & kFontNoNewlines) {
+		handle->lines.resize(1);
+		handle->lines[0].length = text.size();
+	}
+
+	handle->text_pixmaps.resize(handle->lines.size());
+
+	for (uint i = 0; i < handle->lines.size(); i++) {
+		int chars_nr = handle->lines[i].length;
+
+		handle->text_pixmaps[i] = gfxr_draw_font(font, handle->lines[i].offset, chars_nr,
+		                          (color1.mask & GFX_MASK_VISUAL) ? &color1.visual : NULL,
+		                          (color2.mask & GFX_MASK_VISUAL) ? &color2.visual : NULL,
+		                          (bg_color.mask & GFX_MASK_VISUAL) ? &bg_color.visual : NULL);
+
+		if (!handle->text_pixmaps[i]) {
+			error("Failed to draw text pixmap for line %d/%d", i, handle->lines.size());
+			delete handle;
+			return NULL;
+		}
+	}
+
+	handle->font = font;
+
+	handle->priority = (color1.mask & GFX_MASK_PRIORITY) ? color1.priority : -1;
+	handle->control = (color1.mask & GFX_MASK_CONTROL) ? color1.control : -1;
+
+	return handle;
+}
+
+TextHandle::TextHandle() {
+	line_height = 0;
+	font = 0;
+
+	width = height = 0;
+
+	priority = control = 0;
+	halign = valign = ALIGN_BOTTOM;
+}
+
+TextHandle::~TextHandle() {
+	for (uint j = 0; j < text_pixmaps.size(); j++)
+		if (text_pixmaps[j])
+			gfx_free_pixmap(text_pixmaps[j]);
+}
+
+void gfxop_draw_text(GfxState *state, TextHandle *handle, rect_t zone) {
+	int line_height;
+	rect_t pos;
+
+	if (!handle)
+		error("Attempt to draw text with NULL handle");
+
+	if (handle->lines.empty()) {
+		debugC(2, kDebugLevelGraphics, "Skipping draw_text operation because number of lines is zero\n");
+		return;
+	}
+
+	_gfxop_scale_rect(&zone, state->driver->getMode());
+
+	line_height = handle->line_height * state->driver->getMode()->scaleFactor;
+
+	pos.y = zone.y;
+
+	switch (handle->valign) {
+
+	case ALIGN_TOP:
+		break;
+
+	case ALIGN_CENTER:
+		pos.y += (zone.height - (line_height * handle->lines.size())) >> 1;
+		break;
+
+	case ALIGN_BOTTOM:
+		pos.y += (zone.height - (line_height * handle->lines.size()));
+		break;
+
+	default:
+		error("Invalid vertical alignment %d", handle->valign);
+	}
+
+	for (uint i = 0; i < handle->lines.size(); i++) {
+
+		gfx_pixmap_t *pxm = handle->text_pixmaps[i];
+
+		if (!pxm->data) {
+			gfx_xlate_pixmap(pxm, state->driver->getMode());
+		}
+		if (!pxm)
+			error("Could not find text pixmap %d/%d", i, handle->lines.size());
+
+		pos.x = zone.x;
+
+		switch (handle->halign) {
+
+		case ALIGN_LEFT:
+			break;
+
+		case ALIGN_CENTER:
+			pos.x += (zone.width - pxm->width) >> 1;
+			break;
+
+		case ALIGN_RIGHT:
+			pos.x += (zone.width - pxm->width);
+			break;
+
+		default:
+			error("Invalid vertical alignment %d", handle->valign);
+		}
+
+		pos.width = pxm->width;
+		pos.height = pxm->height;
+
+		_gfxop_add_dirty(state, pos);
+		_gfxop_draw_pixmap(state->driver, pxm, handle->priority, handle->control,
+		                   gfx_rect(0, 0, pxm->width, pxm->height), pos, state->clip_zone, 0, state->control_map, state->priority_map);
+
+		pos.y += line_height;
+	}
+}
+
+gfx_pixmap_t *gfxop_grab_pixmap(GfxState *state, rect_t area) {
+	gfx_pixmap_t *pixmap = NULL;
+	rect_t resultzone; // Ignored for this application
+
+	_gfxop_scale_rect(&area, state->driver->getMode());
+	_gfxop_grab_pixmap(state, &pixmap, area.x, area.y, area.width, area.height, 0, &resultzone);
+
+	return pixmap;
+}
+
+void gfxop_draw_pixmap(GfxState *state, gfx_pixmap_t *pxm, rect_t zone, Common::Point pos) {
+	rect_t target = gfx_rect(pos.x, pos.y, zone.width, zone.height);
+
+	if (!pxm)
+		error("Attempt to draw NULL pixmap");
+
+	_gfxop_add_dirty(state, target);
+
+	_gfxop_scale_rect(&zone, state->driver->getMode());
+	_gfxop_scale_rect(&target, state->driver->getMode());
+
+	return _gfxop_draw_pixmap(state->driver, pxm, -1, -1, zone, target, gfx_rect(0, 0, 320*state->driver->getMode()->scaleFactor,
+	                                   200*state->driver->getMode()->scaleFactor), 0, NULL, NULL);
+}
+
+
+
+#endif	// INCLUDE_OLDGFX
+
+
+
 // Pointer and IO ops
 void gfxop_sleep(GfxState *state, uint32 msecs) {
 	uint32 time;
@@ -1003,7 +1342,7 @@
 	}
 }
 
-static sci_event_t scummvm_get_event(GfxDriver *drv) {
+static sci_event_t scummvm_get_event() {
 	static int _modifierStates = 0;	// FIXME: Avoid non-const global vars
 	sci_event_t input = { SCI_EVT_NONE, 0, 0, 0 };
 
@@ -1216,7 +1555,7 @@
 
 	// Get all queued events from graphics driver
 	do {
-		event = scummvm_get_event(state->driver);
+		event = scummvm_get_event();
 		if (event.type != SCI_EVT_NONE)
 			state->_events.push_back(event);
 	} while (event.type != SCI_EVT_NONE);
@@ -1263,334 +1602,4 @@
 	return event;
 }
 
-// View operations
-
-void gfxop_get_cel_parameters(GfxState *state, int nr, int loop, int cel, int *width, int *height, Common::Point *offset) {
-	gfxr_view_t *view = NULL;
-	gfx_pixmap_t *pxm = NULL;
-
-	view = state->gfxResMan->getView(nr, &loop, &cel, 0);
-
-	if (!view)
-		error("[GFX] Attempt to get cel parameters for invalid view %d", nr);
-
-	pxm = view->loops[loop].cels[cel];
-	*width = pxm->index_width;
-	*height = pxm->index_height;
-	offset->x = pxm->xoffset;
-	offset->y = pxm->yoffset;
-}
-
-static void _gfxop_draw_cel_buffer(GfxState *state, int nr, int loop, int cel, Common::Point pos, gfx_color_t color, int static_buf, int palette) {
-	int priority = (color.mask & GFX_MASK_PRIORITY) ? color.priority : -1;
-	int control = (color.mask & GFX_MASK_CONTROL) ? color.control : -1;
-	gfxr_view_t *view = NULL;
-	gfx_pixmap_t *pxm = NULL;
-	int old_x, old_y;
-
-	view = state->gfxResMan->getView(nr, &loop, &cel, palette);
-
-	if (!view) {
-		warning("[GFX] Attempt to draw loop/cel %d/%d in invalid view %d\n", loop, cel, nr);
-		return;
-	}
-	pxm = view->loops[loop].cels[cel];
-
-	old_x = pos.x -= pxm->xoffset;
-	old_y = pos.y -= pxm->yoffset;
-
-	pos.x *= state->driver->getMode()->scaleFactor;
-	pos.y *= state->driver->getMode()->scaleFactor;
-
-	if (!static_buf)
-		_gfxop_add_dirty(state, gfx_rect(old_x, old_y, pxm->index_width, pxm->index_height));
-
-	_gfxop_draw_pixmap(state->driver, pxm, priority, control, gfx_rect(0, 0, pxm->width, pxm->height),
-	                          gfx_rect(pos.x, pos.y, pxm->width, pxm->height), state->clip_zone, static_buf , state->control_map,
-	                          static_buf ? state->static_priority_map : state->priority_map);
-}
-
-void gfxop_draw_cel(GfxState *state, int nr, int loop, int cel, Common::Point pos, gfx_color_t color, int palette) {
-	_gfxop_draw_cel_buffer(state, nr, loop, cel, pos, color, 0, palette);
-}
-
-void gfxop_draw_cel_static(GfxState *state, int nr, int loop, int cel, Common::Point pos, gfx_color_t color, int palette) {
-	rect_t oldclip = state->clip_zone;
-
-	state->clip_zone = gfx_rect_fullscreen;
-	_gfxop_scale_rect(&(state->clip_zone), state->driver->getMode());
-	gfxop_draw_cel_static_clipped(state, nr, loop, cel, pos, color, palette);
-	// Except that the area it's clipped against is... unusual ;-)
-	state->clip_zone = oldclip;
-}
-
-void gfxop_draw_cel_static_clipped(GfxState *state, int nr, int loop, int cel, Common::Point pos, gfx_color_t color, int palette) {
-	_gfxop_draw_cel_buffer(state, nr, loop, cel, pos, color, 1, palette);
-}
-
-// Pic operations
-
-static void _gfxop_set_pic(GfxState *state) {
-	gfx_copy_pixmap_box_i(state->control_map, state->pic->control_map, gfx_rect(0, 0, 320, 200));
-	gfx_copy_pixmap_box_i(state->priority_map, state->pic_unscaled->priority_map, gfx_rect(0, 0, 320, 200));
-	gfx_copy_pixmap_box_i(state->static_priority_map, state->pic_unscaled->priority_map, gfx_rect(0, 0, 320, 200));
-
-	// Reset global palette to this PIC's palette
-	// FIXME: The _gfxop_install_pixmap call below updates the OSystem palette.
-	// This is too soon, since it causes brief palette corruption until the
-	// screen is updated too. (Possibly related: EngineState::pic_not_valid .)
-	if (state->pic->visual_map->palette) {
-		state->pic->visual_map->palette->forceInto(SCREEN_PALETTE);
-		_gfxop_install_pixmap(state->driver, state->pic->visual_map);
-	}
-
-	state->driver->setStaticBuffer(state->pic->visual_map, state->pic->priority_map);
-}
-
-void gfxop_new_pic(GfxState *state, int nr, int flags, int default_palette) {
-	state->gfxResMan->tagResources();
-	state->tag_mode = 1;
-	state->palette_nr = default_palette;
-	state->pic = state->gfxResMan->getPic(nr, GFX_MASK_VISUAL, flags, default_palette, true);
-
-	if (state->driver->getMode()->scaleFactor == 1 && state->driver->getMode()->scaleFactor == 1) {
-		state->pic_unscaled = state->pic;
-	} else {
-		state->pic_unscaled = state->gfxResMan->getPic(nr, GFX_MASK_VISUAL, flags, default_palette, false);
-	}
-
-	if (!state->pic || !state->pic_unscaled) {
-		warning("Could not retrieve background pic %d", nr);
-		if (state->pic) {
-			warning("  -- Inconsistency: scaled pic _was_ retrieved!");
-		}
-
-		if (state->pic_unscaled) {
-			warning("  -- Inconsistency: unscaled pic _was_ retrieved!");
-		}
-
-		error("Error occured in gfxop_new_pic()");
-		state->pic = state->pic_unscaled = NULL;
-	}
-
-	state->pic_nr = nr;
-
-	_gfxop_set_pic(state);
-}
-
-void gfxop_add_to_pic(GfxState *state, int nr, int flags, int default_palette) {
-	if (!state->pic)
-		error("Attempt to add to pic with no pic active");
-
-	state->pic = state->gfxResMan->addToPic(state->pic_nr, nr, flags, state->palette_nr, default_palette);
-
-	if (!state->pic)
-		error("Could not add pic #%d to pic #%d", state->pic_nr, nr);
-
-	state->pic_unscaled = state->gfxResMan->addToPic(state->pic_nr, nr, flags, state->palette_nr, default_palette);
-
-	_gfxop_set_pic(state);
-}
-
-// Text operations
-
-void gfxop_get_text_params(GfxState *state, int font_nr, const char *text, int maxwidth, int *width, int *height, int text_flags,
-						  int *lines_nr, int *lineheight, int *lastline_width) {
-	Common::Array<TextFragment> fragments;
-	bool textsplits;
-	gfx_bitmap_font_t *font;
-
-	font = state->gfxResMan->getFont(font_nr);
-
-	if (!font)
-		error("Attempt to calculate text size with invalid font #%d", font_nr);
-
-	textsplits = gfxr_font_calculate_size(fragments, font, maxwidth, text, width, height, lineheight, lastline_width, text_flags);
-
-	if (!textsplits)
-		error("Could not calculate text size");
-
-	if (lines_nr)
-		*lines_nr = fragments.size();
-}
-
-TextHandle *gfxop_new_text(GfxState *state, int font_nr, const Common::String &text, int maxwidth, gfx_alignment_t halign,
-								  gfx_alignment_t valign, gfx_color_t color1, gfx_color_t color2, gfx_color_t bg_color, int flags) {
-	TextHandle *handle;
-	gfx_bitmap_font_t *font;
-
-	// mapping text colors to palette
-	gfxop_set_color(state, &color1, color1);
-	gfxop_set_color(state, &color2, color2);
-	gfxop_set_color(state, &bg_color, bg_color);
-
-	font = state->gfxResMan->getFont(font_nr);
-
-	if (!font) {
-		error("Attempt to draw text with invalid font #%d", font_nr);
-		return NULL;
-	}
-
-	handle = new TextHandle();
-
-	handle->_text = text;
-	handle->halign = halign;
-	handle->valign = valign;
-	handle->line_height = font->line_height;
-
-	bool result = gfxr_font_calculate_size(handle->lines, font, maxwidth, handle->_text.c_str(), &(handle->width), &(handle->height),
-	                             NULL, NULL, flags);
-
-	if (!result) {
-		error("Could not calculate text parameters in font #%d", font_nr);
-		delete handle;
-		return NULL;
-	}
-
-	if (flags & kFontNoNewlines) {
-		handle->lines.resize(1);
-		handle->lines[0].length = text.size();
-	}
-
-	handle->text_pixmaps.resize(handle->lines.size());
-
-	for (uint i = 0; i < handle->lines.size(); i++) {
-		int chars_nr = handle->lines[i].length;
-
-		handle->text_pixmaps[i] = gfxr_draw_font(font, handle->lines[i].offset, chars_nr,
-		                          (color1.mask & GFX_MASK_VISUAL) ? &color1.visual : NULL,
-		                          (color2.mask & GFX_MASK_VISUAL) ? &color2.visual : NULL,
-		                          (bg_color.mask & GFX_MASK_VISUAL) ? &bg_color.visual : NULL);
-
-		if (!handle->text_pixmaps[i]) {
-			error("Failed to draw text pixmap for line %d/%d", i, handle->lines.size());
-			delete handle;
-			return NULL;
-		}
-	}
-
-	handle->font = font;
-
-	handle->priority = (color1.mask & GFX_MASK_PRIORITY) ? color1.priority : -1;
-	handle->control = (color1.mask & GFX_MASK_CONTROL) ? color1.control : -1;
-
-	return handle;
-}
-
-TextHandle::TextHandle() {
-	line_height = 0;
-	font = 0;
-
-	width = height = 0;
-
-	priority = control = 0;
-	halign = valign = ALIGN_BOTTOM;
-}
-
-TextHandle::~TextHandle() {
-	for (uint j = 0; j < text_pixmaps.size(); j++)
-		if (text_pixmaps[j])
-			gfx_free_pixmap(text_pixmaps[j]);
-}
-
-void gfxop_draw_text(GfxState *state, TextHandle *handle, rect_t zone) {
-	int line_height;
-	rect_t pos;
-
-	if (!handle)
-		error("Attempt to draw text with NULL handle");
-
-	if (handle->lines.empty()) {
-		debugC(2, kDebugLevelGraphics, "Skipping draw_text operation because number of lines is zero\n");
-		return;
-	}
-
-	_gfxop_scale_rect(&zone, state->driver->getMode());
-
-	line_height = handle->line_height * state->driver->getMode()->scaleFactor;
-
-	pos.y = zone.y;
-
-	switch (handle->valign) {
-
-	case ALIGN_TOP:
-		break;
-
-	case ALIGN_CENTER:
-		pos.y += (zone.height - (line_height * handle->lines.size())) >> 1;
-		break;
-
-	case ALIGN_BOTTOM:
-		pos.y += (zone.height - (line_height * handle->lines.size()));
-		break;
-
-	default:
-		error("Invalid vertical alignment %d", handle->valign);
-	}
-
-	for (uint i = 0; i < handle->lines.size(); i++) {
-
-		gfx_pixmap_t *pxm = handle->text_pixmaps[i];
-
-		if (!pxm->data) {
-			gfx_xlate_pixmap(pxm, state->driver->getMode());
-		}
-		if (!pxm)
-			error("Could not find text pixmap %d/%d", i, handle->lines.size());
-
-		pos.x = zone.x;
-
-		switch (handle->halign) {
-
-		case ALIGN_LEFT:
-			break;
-
-		case ALIGN_CENTER:
-			pos.x += (zone.width - pxm->width) >> 1;
-			break;
-
-		case ALIGN_RIGHT:
-			pos.x += (zone.width - pxm->width);
-			break;
-
-		default:
-			error("Invalid vertical alignment %d", handle->valign);
-		}
-
-		pos.width = pxm->width;
-		pos.height = pxm->height;
-
-		_gfxop_add_dirty(state, pos);
-		_gfxop_draw_pixmap(state->driver, pxm, handle->priority, handle->control,
-		                   gfx_rect(0, 0, pxm->width, pxm->height), pos, state->clip_zone, 0, state->control_map, state->priority_map);
-
-		pos.y += line_height;
-	}
-}
-
-gfx_pixmap_t *gfxop_grab_pixmap(GfxState *state, rect_t area) {
-	gfx_pixmap_t *pixmap = NULL;
-	rect_t resultzone; // Ignored for this application
-
-	_gfxop_scale_rect(&area, state->driver->getMode());
-	_gfxop_grab_pixmap(state, &pixmap, area.x, area.y, area.width, area.height, 0, &resultzone);
-
-	return pixmap;
-}
-
-void gfxop_draw_pixmap(GfxState *state, gfx_pixmap_t *pxm, rect_t zone, Common::Point pos) {
-	rect_t target = gfx_rect(pos.x, pos.y, zone.width, zone.height);
-
-	if (!pxm)
-		error("Attempt to draw NULL pixmap");
-
-	_gfxop_add_dirty(state, target);
-
-	_gfxop_scale_rect(&zone, state->driver->getMode());
-	_gfxop_scale_rect(&target, state->driver->getMode());
-
-	return _gfxop_draw_pixmap(state->driver, pxm, -1, -1, zone, target, gfx_rect(0, 0, 320*state->driver->getMode()->scaleFactor,
-	                                   200*state->driver->getMode()->scaleFactor), 0, NULL, NULL);
-}
-
 } // End of namespace Sci

Modified: scummvm/trunk/engines/sci/gfx/operations.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/operations.h	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gfx/operations.h	2009-10-28 13:20:30 UTC (rev 45459)
@@ -28,15 +28,20 @@
 #ifndef SCI_GFX_GFX_OPERATIONS_H
 #define SCI_GFX_GFX_OPERATIONS_H
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
 #include "sci/gfx/gfx_resmgr.h"
 #include "sci/gfx/gfx_tools.h"
 #include "sci/gfx/gfx_system.h"
+#endif
 #include "sci/uinput.h"
 
 #include "common/list.h"
 
 namespace Sci {
 
+#ifdef INCLUDE_OLDGFX
+
 struct TextFragment;
 
 /* Threshold in color index mode to differentiate between visible and non-visible stuff.
@@ -86,8 +91,10 @@
 
 typedef Common::List<rect_t> DirtyRectList;
 
+#endif	// INCLUDE_OLDGFX
 
 struct GfxState {
+#ifdef INCLUDE_OLDGFX
 	rect_t clip_zone_unscaled; /**< The current UNSCALED clipping zone */
 	rect_t clip_zone; /**< The current SCALED clipping zone; a cached scaled version of clip_zone_unscaled */
 
@@ -109,16 +116,19 @@
 	int pic_nr; /**< Number of the current pic */
 	int palette_nr; /**< Palette number of the current pic */
 
-	Common::List<sci_event_t> _events;
-
 	gfxr_pic_t *pic, *pic_unscaled; /**< The background picture and its unscaled equivalent */
 	rect_t pic_port_bounds;  /**< Picture port bounds */
 
 	DirtyRectList _dirtyRects; /**< Dirty rectangles */
+#endif
+
+	Common::List<sci_event_t> _events;
 };
 
 
+#ifdef INCLUDE_OLDGFX
 
+
 /** @name Fundamental operations */
 /** @{ */
 
@@ -306,30 +316,6 @@
 
 /** @} */
 
-/** @name Pointer and IO ops */
-/** @{ */
-
-/**
- * Suspends program execution for the specified amount of milliseconds.
- *
- * The mouse pointer will be redrawn continually, if applicable
- *
- * @param[in] state	The state affected
- * @param[in] msecs	The amount of milliseconds to wait
- */
-void gfxop_sleep(GfxState *state, uint32 msecs);
-
-/**
- * Retrieves the next input event from the driver.
- *
- * @param[in] state	The affected state
- * @param[in] mask	The event mask to poll from (see uinput.h)
- * @return			The next event in the driver's event queue, or a NONE event
- * 					if no event matching the mask was found.
- */
-sci_event_t gfxop_get_event(GfxState *state, unsigned int mask);
-/** @} */
-
 /** @name View operations */
 /** @{ */
 
@@ -537,6 +523,33 @@
 int _gfxop_clip(rect_t *rect, rect_t clipzone);
 /** @} */
 
+#endif // INCLUDE_OLDGFX
+
+/** @name Pointer and IO ops */
+/** @{ */
+
+/**
+ * Suspends program execution for the specified amount of milliseconds.
+ *
+ * The mouse pointer will be redrawn continually, if applicable
+ *
+ * @param[in] state	The state affected
+ * @param[in] msecs	The amount of milliseconds to wait
+ */
+void gfxop_sleep(GfxState *state, uint32 msecs);
+
+/**
+ * Retrieves the next input event from the driver.
+ *
+ * @param[in] state	The affected state
+ * @param[in] mask	The event mask to poll from (see uinput.h)
+ * @return			The next event in the driver's event queue, or a NONE event
+ * 					if no event matching the mask was found.
+ */
+sci_event_t gfxop_get_event(GfxState *state, unsigned int mask);
+/** @} */
+
+
 } // End of namespace Sci
 
 #endif // SCI_GFX_GFX_OPERATIONS_H

Modified: scummvm/trunk/engines/sci/gfx/palette.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/palette.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gfx/palette.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,6 +23,9 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 #include "sci/gfx/palette.h"
 #include "sci/gfx/gfx_system.h"
 
@@ -323,3 +326,5 @@
 
 
 } // End of namespace Sci
+
+#endif

Modified: scummvm/trunk/engines/sci/gfx/palette.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/palette.h	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gfx/palette.h	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,6 +23,9 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 #ifndef SCI_GFX_PALETTE_H
 #define SCI_GFX_PALETTE_H
 
@@ -122,3 +125,5 @@
 } // End of namespace Sci
 
 #endif // SCI_GFX_PALETTE_H
+
+#endif

Modified: scummvm/trunk/engines/sci/gui/gui_helpers.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_helpers.h	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gui/gui_helpers.h	2009-10-28 13:20:30 UTC (rev 45459)
@@ -124,6 +124,14 @@
 	kControlStateDitherFramed = 0x1000   ///< 0001 0000 0000 0000 - widgets surrounded by a dithered frame (used in kgraphics)
 };
 
+enum ViewType {
+	kViewUnknown,
+	kViewEga,
+	kViewVga,
+	kViewVga11,
+	kViewAmiga
+};
+
 } // End of namespace Sci
 
 #endif

Modified: scummvm/trunk/engines/sci/gui32/font.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui32/font.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gui32/font.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,6 +23,8 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
 
 #include "sci/gfx/gfx_system.h"
 #include "sci/gfx/gfx_resource.h"
@@ -241,3 +243,5 @@
 }
 
 } // End of namespace Sci
+
+#endif

Modified: scummvm/trunk/engines/sci/gui32/gui32.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui32/gui32.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gui32/gui32.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,10 +23,12 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 #include "graphics/cursorman.h"
 #include "common/util.h"
 
-#include "sci/sci.h"
 #include "sci/engine/state.h"
 #include "sci/debug.h"	// for g_debug_sleeptime_factor
 #include "sci/resource.h"
@@ -264,67 +266,6 @@
 #endif
 }
 
-Common::Rect set_base(EngineState *s, reg_t object) {
-	SegManager *segMan = s->_segMan;
-	int x, y, original_y, z, ystep, xsize, ysize;
-	int xbase, ybase, xend, yend;
-	int view, loop, cel;
-	int oldloop, oldcel;
-	int xmod = 0, ymod = 0;
-	Common::Rect retval;
-
-	x = (int16)GET_SEL32V(segMan, object, x);
-	original_y = y = (int16)GET_SEL32V(segMan, object, y);
-
-	if (s->_kernel->_selectorCache.z > -1)
-		z = (int16)GET_SEL32V(segMan, object, z);
-	else
-		z = 0;
-
-	y -= z; // Subtract z offset
-
-	ystep = (int16)GET_SEL32V(segMan, object, yStep);
-
-	view = (int16)GET_SEL32V(segMan, object, view);
-	int l = GET_SEL32V(segMan, object, loop);
-	oldloop = loop = (l & 0x80) ? l - 256 : l;
-	int c = GET_SEL32V(segMan, object, cel);
-	oldcel = cel = (c & 0x80) ? c - 256 : c;
-
-	Common::Point offset = Common::Point(0, 0);
-
-	if (loop != oldloop) {
-		loop = 0;
-		PUT_SEL32V(segMan, object, loop, 0);
-		debugC(2, kDebugLevelGraphics, "Resetting loop for %04x:%04x!\n", PRINT_REG(object));
-	}
-
-	if (cel != oldcel) {
-		cel = 0;
-		PUT_SEL32V(segMan, object, cel, 0);
-	}
-
-	gfxop_get_cel_parameters(s->gfx_state, view, loop, cel, &xsize, &ysize, &offset);
-
-	xmod = offset.x;
-	ymod = offset.y;
-
-	xbase = x - xmod - (xsize >> 1);
-	xend = xbase + xsize;
-	yend = y /* - ymod */ + 1;
-	ybase = yend - ystep;
-
-	debugC(2, kDebugLevelBaseSetter, "(%d,%d)+/-(%d,%d), (%d x %d) -> (%d, %d) to (%d, %d)\n",
-	          x, y, xmod, ymod, xsize, ysize, xbase, ybase, xend, yend);
-
-	retval.left = xbase;
-	retval.top = ybase;
-	retval.right = xend;
-	retval.bottom = yend;
-
-	return retval;
-}
-
 static Common::Rect nsrect_clip(EngineState *s, int y, Common::Rect retval, int priority) {
 	int pri_top;
 
@@ -2820,3 +2761,5 @@
 }
 
 } // End of namespace Sci
+
+#endif

Modified: scummvm/trunk/engines/sci/gui32/gui32.h
===================================================================
--- scummvm/trunk/engines/sci/gui32/gui32.h	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gui32/gui32.h	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,6 +23,9 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 #ifndef SCI_GUI32_GUI32_H
 #define SCI_GUI32_GUI32_H
 
@@ -135,3 +138,5 @@
 } // End of namespace Sci
 
 #endif
+
+#endif

Modified: scummvm/trunk/engines/sci/gui32/res_font.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui32/res_font.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gui32/res_font.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,6 +23,9 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 #include "common/endian.h"
 #include "sci/gfx/gfx_system.h"
 #include "sci/gfx/gfx_resource.h"
@@ -133,3 +136,5 @@
 }
 
 } // End of namespace Sci
+
+#endif

Modified: scummvm/trunk/engines/sci/gui32/res_pal.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui32/res_pal.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gui32/res_pal.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,6 +23,9 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 /* SCI1 palette resource defrobnicator */
 
 #include "common/file.h"
@@ -133,3 +136,5 @@
 }
 
 } // End of namespace Sci
+
+#endif

Modified: scummvm/trunk/engines/sci/gui32/res_pic.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui32/res_pic.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gui32/res_pic.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,13 +23,15 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 #include <time.h>	// for time() to seed rand() via srand()
 
 #include "common/endian.h"
 
 #include "sci/gfx/gfx_resource.h"
 #include "sci/gfx/gfx_tools.h"
-#include "sci/sci.h"	// for kDebugLevelSci0Pic
 
 namespace Sci {
 
@@ -1533,3 +1535,5 @@
 }
 
 } // End of namespace Sci
+
+#endif

Modified: scummvm/trunk/engines/sci/gui32/res_view.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui32/res_view.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/gui32/res_view.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -23,6 +23,9 @@
  *
  */
 
+#include "sci/sci.h"	// for INCLUDE_OLDGFX
+#ifdef INCLUDE_OLDGFX
+
 // SCI 1 view resource defrobnicator
 
 #include "common/endian.h"
@@ -301,3 +304,5 @@
 }
 
 } // End of namespace Sci
+
+#endif

Modified: scummvm/trunk/engines/sci/resource.h
===================================================================
--- scummvm/trunk/engines/sci/resource.h	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/resource.h	2009-10-28 13:20:30 UTC (rev 45459)
@@ -34,7 +34,7 @@
 #include "sound/audiostream.h"
 #include "sound/mixer.h"			// for SoundHandle
 
-#include "gfx/gfx_resource.h"		// for ViewType
+#include "gui/gui_helpers.h"		// for ViewType
 
 #include "sci/decompressor.h"
 #include "sci/sci.h"

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/sci.cpp	2009-10-28 13:20:30 UTC (rev 45459)
@@ -35,8 +35,10 @@
 #include "sci/engine/state.h"
 #include "sci/engine/kernel.h"
 
+#include "sci/gfx/operations.h"	// fog GfxState
 #include "sci/gfx/gfx_state_internal.h"	// required for GfxContainer, GfxPort, GfxVisual
 #include "sci/gui32/gui32.h"
+#include "sci/gui/gui.h"
 #include "sci/gui/gui_palette.h"
 #include "sci/gui/gui_cursor.h"
 #include "sci/gui/gui_screen.h"
@@ -141,7 +143,9 @@
 	ConfMan.registerDefault("undither", "true");
 	screen->unditherSetState(ConfMan.getBool("undither"));
 
+#ifdef INCLUDE_OLDGFX
 	gfxop_init(&gfx_state, _resMan, screen, palette, 1);
+#endif
 
 	if (game_init_graphics(_gamestate)) { // Init interpreter graphics
 		warning("Game initialization failed: Error in GFX subsystem. Aborting...");
@@ -168,7 +172,9 @@
 	delete screen;
 	delete _gamestate;
 
+#ifdef INCLUDE_OLDGFX
 	gfxop_exit(&gfx_state);
+#endif
 
 	return Common::kNoError;
 }

Modified: scummvm/trunk/engines/sci/sci.h
===================================================================
--- scummvm/trunk/engines/sci/sci.h	2009-10-28 13:00:32 UTC (rev 45458)
+++ scummvm/trunk/engines/sci/sci.h	2009-10-28 13:20:30 UTC (rev 45459)
@@ -31,6 +31,8 @@
 
 namespace Sci {
 
+#define INCLUDE_OLDGFX
+
 class Console;
 struct EngineState;
 class Kernel;


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