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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Fri Feb 5 19:56:13 CET 2010


Revision: 47908
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47908&view=rev
Author:   m_kiewitz
Date:     2010-02-05 18:56:13 +0000 (Fri, 05 Feb 2010)

Log Message:
-----------
SCI: GfxCoordAdjuster class added, local2Global and global2Local use that class directly, kGraph / RedrawBox is now using GfxPaint16 directly

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kevent.cpp
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/engine/state.h
    scummvm/trunk/engines/sci/graphics/gui.cpp
    scummvm/trunk/engines/sci/graphics/gui.h
    scummvm/trunk/engines/sci/graphics/gui32.cpp
    scummvm/trunk/engines/sci/graphics/gui32.h
    scummvm/trunk/engines/sci/graphics/menu.cpp
    scummvm/trunk/engines/sci/graphics/paint16.cpp
    scummvm/trunk/engines/sci/graphics/paint16.h
    scummvm/trunk/engines/sci/graphics/ports.cpp
    scummvm/trunk/engines/sci/module.mk

Added Paths:
-----------
    scummvm/trunk/engines/sci/graphics/coordadjuster.cpp
    scummvm/trunk/engines/sci/graphics/coordadjuster.h

Modified: scummvm/trunk/engines/sci/engine/kevent.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kevent.cpp	2010-02-05 16:03:14 UTC (rev 47907)
+++ scummvm/trunk/engines/sci/engine/kevent.cpp	2010-02-05 18:56:13 UTC (rev 47908)
@@ -32,6 +32,7 @@
 #include "sci/event.h"
 #include "sci/graphics/gui.h"
 #include "sci/graphics/gui32.h"
+#include "sci/graphics/coordadjuster.h"
 #include "sci/graphics/cursor.h"
 
 namespace Sci {
@@ -211,20 +212,14 @@
 
 reg_t kGlobalToLocal(EngineState *s, int argc, reg_t *argv) {
 	reg_t obj = argc ? argv[0] : NULL_REG; // Can this really happen? Lars
+	reg_t planeObject = argc > 1 ? argv[1] : NULL_REG; // SCI32
 	SegManager *segMan = s->_segMan;
 
 	if (obj.segment) {
 		int16 x = GET_SEL32V(segMan, obj, x);
 		int16 y = GET_SEL32V(segMan, obj, y);
 
-#ifdef ENABLE_SCI32
-	if (s->_gui)
-#endif
-		s->_gui->globalToLocal(&x, &y);
-#ifdef ENABLE_SCI32
-	else
-		s->_gui32->globalToLocal(&x, &y, argv[1]);
-#endif
+		s->_gfxCoordAdjuster->kernelGlobalToLocal(x, y, planeObject);
 
 		PUT_SEL32V(segMan, obj, x, x);
 		PUT_SEL32V(segMan, obj, y, y);
@@ -236,20 +231,14 @@
 
 reg_t kLocalToGlobal(EngineState *s, int argc, reg_t *argv) {
 	reg_t obj = argc ? argv[0] : NULL_REG; // Can this really happen? Lars
+	reg_t planeObject = argc > 1 ? argv[1] : NULL_REG; // SCI32
 	SegManager *segMan = s->_segMan;
 
 	if (obj.segment) {
 		int16 x = GET_SEL32V(segMan, obj, x);
 		int16 y = GET_SEL32V(segMan, obj, y);
 
-#ifdef ENABLE_SCI32
-	if (s->_gui)
-#endif
-		s->_gui->localToGlobal(&x, &y);
-#ifdef ENABLE_SCI32
-	else
-		s->_gui32->localToGlobal(&x, &y, argv[1]);
-#endif
+		s->_gfxCoordAdjuster->kernelLocalToGlobal(x, y, planeObject);
 
 		PUT_SEL32V(segMan, obj, x, x);
 		PUT_SEL32V(segMan, obj, y, y);

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-02-05 16:03:14 UTC (rev 47907)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-02-05 18:56:13 UTC (rev 47908)
@@ -299,7 +299,7 @@
 
 	case K_GRAPH_REDRAW_BOX:
 		rect = kGraphCreateRect(x, y, x1, y1);
-		s->_gui->graphRedrawBox(rect);
+		s->_gfxPaint16->kernelGraphRedrawBox(rect);
 		break;
 
 	case K_GRAPH_ADJUST_PRIORITY:

Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h	2010-02-05 16:03:14 UTC (rev 47907)
+++ scummvm/trunk/engines/sci/engine/state.h	2010-02-05 18:56:13 UTC (rev 47908)
@@ -54,6 +54,7 @@
 class GfxAnimate;
 class GfxCache;
 class GfxControls;
+class GfxCoordAdjuster;
 class GfxCursor;
 class GfxMenu;
 class GfxPaint;
@@ -147,6 +148,7 @@
 	GfxAnimate *_gfxAnimate; // Animate for 16-bit gfx
 	GfxCache *_gfxCache;
 	GfxControls *_gfxControls; // Controls for 16-bit gfx
+	GfxCoordAdjuster *_gfxCoordAdjuster;
 	GfxCursor *_gfxCursor;
 	GfxMenu *_gfxMenu; // Menu for 16-bit gfx
 	GfxPalette *_gfxPalette;

Copied: scummvm/trunk/engines/sci/graphics/coordadjuster.cpp (from rev 47901, scummvm/trunk/engines/sci/graphics/ports.cpp)
===================================================================
--- scummvm/trunk/engines/sci/graphics/coordadjuster.cpp	                        (rev 0)
+++ scummvm/trunk/engines/sci/graphics/coordadjuster.cpp	2010-02-05 18:56:13 UTC (rev 47908)
@@ -0,0 +1,84 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "common/util.h"
+
+#include "sci/sci.h"
+#include "sci/engine/state.h"
+#include "sci/engine/selector.h"
+#include "sci/graphics/coordadjuster.h"
+#include "sci/graphics/ports.h"
+
+namespace Sci {
+
+GfxCoordAdjuster::GfxCoordAdjuster() {
+}
+
+GfxCoordAdjuster16::GfxCoordAdjuster16(GfxPorts *ports)
+	: _ports(ports) {
+}
+
+GfxCoordAdjuster16::~GfxCoordAdjuster16() {
+}
+
+void GfxCoordAdjuster16::kernelGlobalToLocal(int16 &x, int16 &y, reg_t planeObject) {
+	Port *curPort = _ports->getPort();
+	x -= curPort->left;
+	y -= curPort->top;
+}
+
+void GfxCoordAdjuster16::kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObject) {
+	Port *curPort = _ports->getPort();
+	x += curPort->left;
+	y += curPort->top;
+}
+
+#ifdef ENABLE_SCI32
+GfxCoordAdjuster32::GfxCoordAdjuster32(SegManager *segMan)
+	: _segMan(segMan) {
+}
+
+GfxCoordAdjuster32::~GfxCoordAdjuster32() {
+}
+
+void GfxCoordAdjuster32::kernelGlobalToLocal(int16 &x, int16 &y, reg_t planeObject) {
+	//int16 resY = GET_SEL32V(_s->_segMan, planeObj, resY);
+	//int16 resX = GET_SEL32V(_s->_segMan, planeObj, resX);
+	//*x = ( *x * _screen->getWidth()) / resX;
+	//*y = ( *y * _screen->getHeight()) / resY;
+	x -= GET_SEL32V(_segMan, planeObject, left);
+	y -= GET_SEL32V(_segMan, planeObject, top);
+}
+void GfxCoordAdjuster32::kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObject) {
+	//int16 resY = GET_SEL32V(_s->_segMan, planeObj, resY);
+	//int16 resX = GET_SEL32V(_s->_segMan, planeObj, resX);
+	x += GET_SEL32V(_segMan, planeObject, left);
+	y += GET_SEL32V(_segMan, planeObject, top);
+	//*x = ( *x * resX) / _screen->getWidth();
+	//*y = ( *y * resY) / _screen->getHeight();
+}
+#endif
+
+} // End of namespace Sci

Copied: scummvm/trunk/engines/sci/graphics/coordadjuster.h (from rev 47904, scummvm/trunk/engines/sci/graphics/ports.h)
===================================================================
--- scummvm/trunk/engines/sci/graphics/coordadjuster.h	                        (rev 0)
+++ scummvm/trunk/engines/sci/graphics/coordadjuster.h	2010-02-05 18:56:13 UTC (rev 47908)
@@ -0,0 +1,80 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef SCI_GRAPHICS_COORDADJUSTER_H
+#define SCI_GRAPHICS_COORDADJUSTER_H
+
+#include "common/list.h"
+#include "common/array.h"
+
+namespace Sci {
+
+class GfxPorts;
+
+/**
+ * CoordAdjuster class, does coordinate adjustment as need by various functions
+ *  most of the time sci32 doesn't do any coordinate adjustment at all
+ *  sci16 does a lot of port adjustment on given coordinates
+ */
+class GfxCoordAdjuster {
+public:
+	GfxCoordAdjuster();
+	~GfxCoordAdjuster() { };
+
+	virtual void kernelGlobalToLocal(int16 &x, int16 &y, reg_t planeObject = NULL_REG) { };
+	virtual void kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObject = NULL_REG) { };
+
+private:
+};
+
+class GfxCoordAdjuster16 : public GfxCoordAdjuster {
+public:
+	GfxCoordAdjuster16(GfxPorts *ports);
+	~GfxCoordAdjuster16();
+
+	void kernelGlobalToLocal(int16 &x, int16 &y, reg_t planeObject = NULL_REG);
+	void kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObject = NULL_REG);
+	
+private:
+	GfxPorts *_ports;
+};
+
+#ifdef ENABLE_SCI32
+class GfxCoordAdjuster32 : public GfxCoordAdjuster {
+public:
+	GfxCoordAdjuster32(SegManager *segMan);
+	~GfxCoordAdjuster32();
+
+	void kernelGlobalToLocal(int16 &x, int16 &y, reg_t planeObject = NULL_REG);
+	void kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObject = NULL_REG);
+	
+private:
+	SegManager *_segMan;
+};
+#endif
+
+} // End of namespace Sci
+
+#endif

Modified: scummvm/trunk/engines/sci/graphics/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.cpp	2010-02-05 16:03:14 UTC (rev 47907)
+++ scummvm/trunk/engines/sci/graphics/gui.cpp	2010-02-05 18:56:13 UTC (rev 47908)
@@ -39,6 +39,7 @@
 #include "sci/graphics/paint16.h"
 #include "sci/graphics/cache.h"
 #include "sci/graphics/compare.h"
+#include "sci/graphics/coordadjuster.h"
 #include "sci/graphics/animate.h"
 #include "sci/graphics/controls.h"
 #include "sci/graphics/menu.h"
@@ -53,9 +54,11 @@
 SciGui::SciGui(EngineState *state, GfxScreen *screen, GfxPalette *palette, GfxCache *cache, GfxCursor *cursor, GfxPorts *ports, AudioPlayer *audio)
 	: _s(state), _screen(screen), _palette(palette), _cache(cache), _cursor(cursor), _ports(ports), _audio(audio) {
 
+	_coordAdjuster = new GfxCoordAdjuster16(_ports);
+	_s->_gfxCoordAdjuster = _coordAdjuster;
 	_compare = new GfxCompare(_s->_segMan, _s->_kernel, _cache, _screen);
 	_transitions = new GfxTransitions(this, _screen, _palette, _s->resMan->isVGA());
-	_paint16 = new GfxPaint16(_s->resMan, _s->_segMan, _s->_kernel, _cache, _ports, _screen, _palette, _transitions);
+	_paint16 = new GfxPaint16(_s->resMan, _s->_segMan, _s->_kernel, _cache, _ports, _coordAdjuster, _screen, _palette, _transitions);
 	_s->_gfxPaint = _paint16;
 	_s->_gfxPaint16 = _paint16;
 	_animate = new GfxAnimate(_s, _cache, _ports, _paint16, _screen, _palette, _cursor, _transitions);
@@ -75,6 +78,7 @@
 	delete _paint16;
 	delete _transitions;
 	delete _compare;
+	delete _coordAdjuster;
 }
 
 void SciGui::resetEngineState(EngineState *s) {
@@ -86,7 +90,7 @@
 	_usesOldGfxFunctions = usesOldGfxFunctions;
 
 	_ports->init(this, _paint16, _text16, _s->_gameId);
-	_paint16->init(_text16);
+	_paint16->init(_animate, _text16);
 	initPriorityBands();
 }
 
@@ -112,18 +116,6 @@
 	kernel_sleep(_s->_event, ticks * 1000 / 60);
 }
 
-void SciGui::globalToLocal(int16 *x, int16 *y) {
-	Port *curPort = _ports->getPort();
-	*x = *x - curPort->left;
-	*y = *y - curPort->top;
-}
-
-void SciGui::localToGlobal(int16 *x, int16 *y) {
-	Port *curPort = _ports->getPort();
-	*x = *x + curPort->left;
-	*y = *y + curPort->top;
-}
-
 int16 SciGui::coordinateToPriority(int16 y) {
 	return _ports->coordinateToPriority(y);
 }
@@ -198,7 +190,7 @@
 			_paint16->bitsGetRect(argv[0], &rect);
 			rect.translate(-_ports->getPort()->left, -_ports->getPort()->top);
 			_paint16->bitsRestore(argv[0]);
-			graphRedrawBox(rect);
+			_paint16->kernelGraphRedrawBox(rect);
 			// finishing loop
 			argc = 0;
 			break;
@@ -276,18 +268,6 @@
 	}
 }
 
-void SciGui::graphRedrawBox(Common::Rect rect) {
-	localToGlobal(&rect.left, &rect.top);
-	localToGlobal(&rect.right, &rect.bottom);
-	Port *oldPort = _ports->setPort((Port *)_ports->_picWind);
-	globalToLocal(&rect.left, &rect.top);
-	globalToLocal(&rect.right, &rect.bottom);
-
-	_animate->reAnimate(rect);
-
-	_ports->setPort(oldPort);
-}
-
 void SciGui::graphAdjustPriority(int top, int bottom) {
 	if (_usesOldGfxFunctions) {
 		_ports->priorityBandsInit(15, top, bottom);

Modified: scummvm/trunk/engines/sci/graphics/gui.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.h	2010-02-05 16:03:14 UTC (rev 47907)
+++ scummvm/trunk/engines/sci/graphics/gui.h	2010-02-05 18:56:13 UTC (rev 47908)
@@ -46,6 +46,7 @@
 class GfxCursor;
 class GfxCache;
 class GfxCompare;
+class GfxCoordAdjuster16;
 class GfxPorts;
 class GfxPaint16;
 class GfxAnimate;
@@ -62,8 +63,6 @@
 	virtual void init(bool usesOldGfxFunctions);
 
 	virtual void wait(int16 ticks);
-	virtual void globalToLocal(int16 *x, int16 *y);
-	virtual void localToGlobal(int16 *x, int16 *y);
 	virtual int16 coordinateToPriority(int16 y);
 	virtual int16 priorityToCoordinate(int16 priority);
 
@@ -76,7 +75,6 @@
 	virtual void drawStatus(const char *text, int16 colorPen, int16 colorBack);
 	virtual void drawMenuBar(bool clear);
 
-	virtual void graphRedrawBox(Common::Rect rect);
 	virtual void graphAdjustPriority(int top, int bottom);
 
 	virtual void shakeScreen(uint16 shakeCount, uint16 directions);
@@ -106,6 +104,7 @@
 	GfxScreen *_screen;
 	GfxPalette *_palette;
 	GfxCache *_cache;
+	GfxCoordAdjuster16 *_coordAdjuster;
 	GfxCompare *_compare;
 	GfxPorts *_ports;
 	GfxPaint16 *_paint16;

Modified: scummvm/trunk/engines/sci/graphics/gui32.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui32.cpp	2010-02-05 16:03:14 UTC (rev 47907)
+++ scummvm/trunk/engines/sci/graphics/gui32.cpp	2010-02-05 18:56:13 UTC (rev 47908)
@@ -37,6 +37,7 @@
 #include "sci/graphics/cursor.h"
 #include "sci/graphics/cache.h"
 #include "sci/graphics/compare.h"
+#include "sci/graphics/coordadjuster.h"
 #include "sci/graphics/frameout.h"
 #include "sci/graphics/paint32.h"
 #include "sci/graphics/picture.h"
@@ -48,6 +49,8 @@
 SciGui32::SciGui32(EngineState *state, GfxScreen *screen, GfxPalette *palette, GfxCache *cache, GfxCursor *cursor)
 	: _s(state), _screen(screen), _palette(palette), _cache(cache), _cursor(cursor) {
 
+	_coordAdjuster = new GfxCoordAdjuster32(_s->_segMan);
+	_s->_gfxCoordAdjuster = _coordAdjuster;
 	_compare = new GfxCompare(_s->_segMan, _s->_kernel, _cache, _screen);
 	_paint32 = new GfxPaint32(_s->resMan, _s->_segMan, _s->_kernel, _cache, _screen, _palette);
 	_s->_gfxPaint = _paint32;
@@ -59,6 +62,7 @@
 	delete _frameout;
 	delete _paint32;
 	delete _compare;
+	delete _coordAdjuster;
 }
 
 void SciGui32::resetEngineState(EngineState *s) {
@@ -68,24 +72,6 @@
 void SciGui32::init() {
 }
 
-void SciGui32::globalToLocal(int16 *x, int16 *y, reg_t planeObj) {
-	//int16 resY = GET_SEL32V(_s->_segMan, planeObj, resY);
-	//int16 resX = GET_SEL32V(_s->_segMan, planeObj, resX);
-	//*x = ( *x * _screen->getWidth()) / resX;
-	//*y = ( *y * _screen->getHeight()) / resY;
-	*x -= GET_SEL32V(_s->_segMan, planeObj, left);
-	*y -= GET_SEL32V(_s->_segMan, planeObj, top);
-}
-
-void SciGui32::localToGlobal(int16 *x, int16 *y, reg_t planeObj) {
-	//int16 resY = GET_SEL32V(_s->_segMan, planeObj, resY);
-	//int16 resX = GET_SEL32V(_s->_segMan, planeObj, resX);
-	*x += GET_SEL32V(_s->_segMan, planeObj, left);
-	*y += GET_SEL32V(_s->_segMan, planeObj, top);
-	//*x = ( *x * resX) / _screen->getWidth();
-	//*y = ( *y * resY) / _screen->getHeight();
-}
-
 void SciGui32::textSize(const char *text, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight) {
 	*textWidth = 0;
 	*textHeight = 0;

Modified: scummvm/trunk/engines/sci/graphics/gui32.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui32.h	2010-02-05 16:03:14 UTC (rev 47907)
+++ scummvm/trunk/engines/sci/graphics/gui32.h	2010-02-05 18:56:13 UTC (rev 47908)
@@ -34,6 +34,7 @@
 class GfxScreen;
 class GfxPalette;
 class GfxCache;
+class GfxCoordAdjuster32;
 class GfxCompare;
 class GfxFrameout;
 class GfxPaint32;
@@ -59,9 +60,6 @@
 	void moveCursor(Common::Point pos);
 	void setCursorZone(Common::Rect zone);
 
-	void globalToLocal(int16 *x, int16 *y, reg_t planeObj);
-	void localToGlobal(int16 *x, int16 *y, reg_t planeObj);
-
 	void drawRobot(GuiResourceId robotId);
 
 	// FIXME: Don't store EngineState
@@ -73,6 +71,7 @@
 	GfxScreen *_screen;
 	GfxPalette *_palette;
 	GfxCache *_cache;
+	GfxCoordAdjuster32 *_coordAdjuster;
 	GfxCompare *_compare;
 	GfxFrameout *_frameout;
 	GfxPaint32 *_paint32;

Modified: scummvm/trunk/engines/sci/graphics/menu.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/menu.cpp	2010-02-05 16:03:14 UTC (rev 47907)
+++ scummvm/trunk/engines/sci/graphics/menu.cpp	2010-02-05 18:56:13 UTC (rev 47908)
@@ -422,7 +422,7 @@
 		Common::Rect menuLine = _menuRect;
 		menuLine.bottom = menuLine.top + 1;
 		_paint16->bitsShow(menuLine);
-		_gui->graphRedrawBox(_menuRect);
+		_paint16->kernelGraphRedrawBox(_menuRect);
 		_menuSaveHandle = NULL_REG;
 	}
 	if (!_barSaveHandle.isNull()) {
@@ -489,7 +489,7 @@
 		Common::Rect menuLine = _menuRect;
 		menuLine.bottom = menuLine.top + 1;
 		_paint16->bitsShow(menuLine);
-		_gui->graphRedrawBox(_menuRect);
+		_paint16->kernelGraphRedrawBox(_menuRect);
 	}
 
 	// First calculate rect of menu and also invert old and new menu text

Modified: scummvm/trunk/engines/sci/graphics/paint16.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/paint16.cpp	2010-02-05 16:03:14 UTC (rev 47907)
+++ scummvm/trunk/engines/sci/graphics/paint16.cpp	2010-02-05 18:56:13 UTC (rev 47908)
@@ -31,6 +31,7 @@
 #include "sci/engine/state.h"
 #include "sci/engine/selector.h"
 #include "sci/graphics/cache.h"
+#include "sci/graphics/coordadjuster.h"
 #include "sci/graphics/ports.h"
 #include "sci/graphics/paint16.h"
 #include "sci/graphics/animate.h"
@@ -44,14 +45,15 @@
 
 namespace Sci {
 
-GfxPaint16::GfxPaint16(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, GfxCache *cache, GfxPorts *ports, GfxScreen *screen, GfxPalette *palette, GfxTransitions *transitions)
-	: _resMan(resMan), _segMan(segMan), _kernel(kernel), _cache(cache), _ports(ports), _screen(screen), _palette(palette), _transitions(transitions) {
+GfxPaint16::GfxPaint16(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, GfxCache *cache, GfxPorts *ports, GfxCoordAdjuster *coordAdjuster, GfxScreen *screen, GfxPalette *palette, GfxTransitions *transitions)
+	: _resMan(resMan), _segMan(segMan), _kernel(kernel), _cache(cache), _ports(ports), _coordAdjuster(coordAdjuster), _screen(screen), _palette(palette), _transitions(transitions) {
 }
 
 GfxPaint16::~GfxPaint16() {
 }
 
-void GfxPaint16::init(GfxText16 *text16) {
+void GfxPaint16::init(GfxAnimate *animate, GfxText16 *text16) {
+	_animate = animate;
 	_text16 = text16;
 
 	_EGAdrawingVisualize = false;
@@ -400,4 +402,16 @@
 		bitsShowHires(rect);
 }
 
+void GfxPaint16::kernelGraphRedrawBox(Common::Rect rect) {
+	_coordAdjuster->kernelLocalToGlobal(rect.left, rect.top);
+	_coordAdjuster->kernelLocalToGlobal(rect.right, rect.bottom);
+	Port *oldPort = _ports->setPort((Port *)_ports->_picWind);
+	_coordAdjuster->kernelGlobalToLocal(rect.left, rect.top);
+	_coordAdjuster->kernelGlobalToLocal(rect.right, rect.bottom);
+
+	_animate->reAnimate(rect);
+
+	_ports->setPort(oldPort);
+}
+
 } // End of namespace Sci

Modified: scummvm/trunk/engines/sci/graphics/paint16.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/paint16.h	2010-02-05 16:03:14 UTC (rev 47907)
+++ scummvm/trunk/engines/sci/graphics/paint16.h	2010-02-05 18:56:13 UTC (rev 47908)
@@ -45,10 +45,10 @@
  */
 class GfxPaint16 : public GfxPaint {
 public:
-	GfxPaint16(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, GfxCache *cache, GfxPorts *ports, GfxScreen *screen, GfxPalette *palette, GfxTransitions *transitions);
+	GfxPaint16(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, GfxCache *cache, GfxPorts *ports, GfxCoordAdjuster *coordAdjuster, GfxScreen *screen, GfxPalette *palette, GfxTransitions *transitions);
 	~GfxPaint16();
 
-	void init(GfxText16 *text16);
+	void init(GfxAnimate *animate, GfxText16 *text16);
 
 	void setEGAdrawingVisualize(bool state);
 
@@ -84,13 +84,16 @@
 	reg_t kernelGraphSaveUpscaledHiresBox(Common::Rect rect);
 	void kernelGraphRestoreBox(reg_t handle);
 	void kernelGraphUpdateBox(Common::Rect rect, bool hiresMode);
+	void kernelGraphRedrawBox(Common::Rect rect);
 
 private:
 	ResourceManager *_resMan;
 	SegManager *_segMan;
 	Kernel *_kernel;
+	GfxAnimate *_animate;
 	GfxCache *_cache;
 	GfxPorts *_ports;
+	GfxCoordAdjuster *_coordAdjuster;
 	GfxScreen *_screen;
 	GfxPalette *_palette;
 	GfxText16 *_text16;

Modified: scummvm/trunk/engines/sci/graphics/ports.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/ports.cpp	2010-02-05 16:03:14 UTC (rev 47907)
+++ scummvm/trunk/engines/sci/graphics/ports.cpp	2010-02-05 18:56:13 UTC (rev 47908)
@@ -339,7 +339,7 @@
 	if (!reanimate)
 		_paint16->bitsShow(pWnd->restoreRect);
 	else
-		_gui->graphRedrawBox(pWnd->restoreRect);
+		_paint16->kernelGraphRedrawBox(pWnd->restoreRect);
 	_windowList.remove(pWnd);
 	setPort(_windowList.back());
 	_windowsById[pWnd->id] = 0;

Modified: scummvm/trunk/engines/sci/module.mk
===================================================================
--- scummvm/trunk/engines/sci/module.mk	2010-02-05 16:03:14 UTC (rev 47907)
+++ scummvm/trunk/engines/sci/module.mk	2010-02-05 18:56:13 UTC (rev 47908)
@@ -38,6 +38,7 @@
 	graphics/cache.o \
 	graphics/compare.o \
 	graphics/controls.o \
+	graphics/coordadjuster.o \
 	graphics/cursor.o \
 	graphics/font.o \
 	graphics/gui.o \


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