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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sat Feb 6 20:35:51 CET 2010


Revision: 47939
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47939&view=rev
Author:   m_kiewitz
Date:     2010-02-06 19:35:51 +0000 (Sat, 06 Feb 2010)

Log Message:
-----------
SCI: added plane coordinate adjustment code for sci32 when drawing pictures, put everything into GfxCoordAdjuster

Modified Paths:
--------------
    scummvm/trunk/engines/sci/graphics/coordadjuster.cpp
    scummvm/trunk/engines/sci/graphics/coordadjuster.h
    scummvm/trunk/engines/sci/graphics/frameout.cpp
    scummvm/trunk/engines/sci/graphics/frameout.h
    scummvm/trunk/engines/sci/graphics/gui32.cpp
    scummvm/trunk/engines/sci/graphics/paint16.cpp
    scummvm/trunk/engines/sci/graphics/paint32.cpp
    scummvm/trunk/engines/sci/graphics/paint32.h
    scummvm/trunk/engines/sci/graphics/picture.cpp
    scummvm/trunk/engines/sci/graphics/picture.h

Modified: scummvm/trunk/engines/sci/graphics/coordadjuster.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/coordadjuster.cpp	2010-02-06 18:25:57 UTC (rev 47938)
+++ scummvm/trunk/engines/sci/graphics/coordadjuster.cpp	2010-02-06 19:35:51 UTC (rev 47939)
@@ -78,6 +78,12 @@
 	pos.x = CLIP<int16>(pos.x, _ports->_picWind->rect.left, _ports->_picWind->rect.right - 1);
 }
 
+Common::Rect GfxCoordAdjuster16::pictureGetDisplayArea() {
+	Common::Rect displayArea(_ports->getPort()->rect.right, _ports->getPort()->rect.bottom);
+	displayArea.moveTo(_ports->getPort()->left, _ports->getPort()->top);
+	return displayArea;
+};
+
 #ifdef ENABLE_SCI32
 GfxCoordAdjuster32::GfxCoordAdjuster32(SegManager *segMan)
 	: _segMan(segMan) {
@@ -108,6 +114,14 @@
 	adjustedRect.translate(0, 10);
 	return adjustedRect;
 }
+
+void GfxCoordAdjuster32::pictureSetDisplayArea(Common::Rect displayArea) {
+	_pictureDisplayArea = displayArea;
+}
+
+Common::Rect GfxCoordAdjuster32::pictureGetDisplayArea() {
+	return _pictureDisplayArea;
+};
 #endif
 
 } // End of namespace Sci

Modified: scummvm/trunk/engines/sci/graphics/coordadjuster.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/coordadjuster.h	2010-02-06 18:25:57 UTC (rev 47938)
+++ scummvm/trunk/engines/sci/graphics/coordadjuster.h	2010-02-06 19:35:51 UTC (rev 47939)
@@ -49,6 +49,8 @@
 	virtual Common::Rect onControl(Common::Rect rect) { return rect; };
 	virtual void setCursorPos(Common::Point &pos) { };
 	virtual void moveCursor(Common::Point &pos) { };
+
+	virtual Common::Rect pictureGetDisplayArea() { return Common::Rect(0, 0); };
 private:
 };
 
@@ -63,6 +65,8 @@
 	Common::Rect onControl(Common::Rect rect);
 	void setCursorPos(Common::Point &pos);
 	void moveCursor(Common::Point &pos);
+
+	Common::Rect pictureGetDisplayArea();
 	
 private:
 	GfxPorts *_ports;
@@ -80,9 +84,14 @@
 	void kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObject = NULL_REG);
 
 	Common::Rect onControl(Common::Rect rect);
+
+	void pictureSetDisplayArea(Common::Rect displayArea);
+	Common::Rect pictureGetDisplayArea();
 	
 private:
 	SegManager *_segMan;
+
+	Common::Rect _pictureDisplayArea;
 };
 #endif
 

Modified: scummvm/trunk/engines/sci/graphics/frameout.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/frameout.cpp	2010-02-06 18:25:57 UTC (rev 47938)
+++ scummvm/trunk/engines/sci/graphics/frameout.cpp	2010-02-06 19:35:51 UTC (rev 47939)
@@ -32,6 +32,7 @@
 #include "sci/engine/selector.h"
 #include "sci/engine/vm.h"
 #include "sci/graphics/cache.h"
+#include "sci/graphics/coordadjuster.h"
 #include "sci/graphics/font.h"
 #include "sci/graphics/view.h"
 #include "sci/graphics/screen.h"
@@ -41,9 +42,10 @@
 
 namespace Sci {
 
-GfxFrameout::GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCache *cache, GfxScreen *screen, GfxPalette *palette, GfxPaint32 *paint32)
+GfxFrameout::GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCoordAdjuster *coordAdjuster, GfxCache *cache, GfxScreen *screen, GfxPalette *palette, GfxPaint32 *paint32)
 	: _segMan(segMan), _resMan(resMan), _cache(cache), _screen(screen), _palette(palette), _paint32(paint32) {
 
+	_coordAdjuster = (GfxCoordAdjuster32 *)coordAdjuster;
 	_highPlanePri = 0;
 }
 
@@ -148,8 +150,10 @@
 
 		planePictureNr = GET_SEL32V(_segMan, planeObject, SELECTOR(picture));
 		if ((planePictureNr != 0xFFFF) && (planePictureNr != 0xFFFE)) {
-			planePicture = new GfxPicture(_resMan, 0, _screen, _palette, planePictureNr, false);
+			planePicture = new GfxPicture(_resMan, _coordAdjuster, 0, _screen, _palette, planePictureNr, false);
 			planePictureCels = planePicture->getSci32celCount();
+
+			_coordAdjuster->pictureSetDisplayArea(planeRect);
 		}
 
 		// Fill our itemlist for this plane

Modified: scummvm/trunk/engines/sci/graphics/frameout.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/frameout.h	2010-02-06 18:25:57 UTC (rev 47938)
+++ scummvm/trunk/engines/sci/graphics/frameout.h	2010-02-06 19:35:51 UTC (rev 47939)
@@ -50,7 +50,7 @@
  */
 class GfxFrameout {
 public:
-	GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCache *cache, GfxScreen *screen, GfxPalette *palette, GfxPaint32 *paint32);
+	GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCoordAdjuster *coordAdjuster, GfxCache *cache, GfxScreen *screen, GfxPalette *palette, GfxPaint32 *paint32);
 	~GfxFrameout();
 
 	void kernelAddPlane(reg_t object);
@@ -64,6 +64,7 @@
 private:
 	SegManager *_segMan;
 	ResourceManager *_resMan;
+	GfxCoordAdjuster32 *_coordAdjuster;
 	GfxCache *_cache;
 	GfxPalette *_palette;
 	GfxScreen *_screen;

Modified: scummvm/trunk/engines/sci/graphics/gui32.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui32.cpp	2010-02-06 18:25:57 UTC (rev 47938)
+++ scummvm/trunk/engines/sci/graphics/gui32.cpp	2010-02-06 19:35:51 UTC (rev 47939)
@@ -54,9 +54,9 @@
 	_cursor->init(_coordAdjuster, _s->_event);
 	_compare = new GfxCompare(_s->_segMan, _s->_kernel, _cache, _screen, _coordAdjuster);
 	_s->_gfxCompare = _compare;
-	_paint32 = new GfxPaint32(_s->resMan, _s->_segMan, _s->_kernel, _cache, _screen, _palette);
+	_paint32 = new GfxPaint32(_s->resMan, _s->_segMan, _s->_kernel, _coordAdjuster, _cache, _screen, _palette);
 	_s->_gfxPaint = _paint32;
-	_frameout = new GfxFrameout(_s->_segMan, _s->resMan, _cache, _screen, _palette, _paint32);
+	_frameout = new GfxFrameout(_s->_segMan, _s->resMan, _coordAdjuster, _cache, _screen, _palette, _paint32);
 	_s->_gfxFrameout = _frameout;
 }
 

Modified: scummvm/trunk/engines/sci/graphics/paint16.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/paint16.cpp	2010-02-06 18:25:57 UTC (rev 47938)
+++ scummvm/trunk/engines/sci/graphics/paint16.cpp	2010-02-06 19:35:51 UTC (rev 47939)
@@ -64,7 +64,7 @@
 }
 
 void GfxPaint16::drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredFlag, bool addToFlag, GuiResourceId paletteId) {
-	GfxPicture *picture = new GfxPicture(_resMan, _ports, _screen, _palette, pictureId, _EGAdrawingVisualize);
+	GfxPicture *picture = new GfxPicture(_resMan, _coordAdjuster, _ports, _screen, _palette, pictureId, _EGAdrawingVisualize);
 
 	// do we add to a picture? if not -> clear screen with white
 	if (!addToFlag)

Modified: scummvm/trunk/engines/sci/graphics/paint32.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/paint32.cpp	2010-02-06 18:25:57 UTC (rev 47938)
+++ scummvm/trunk/engines/sci/graphics/paint32.cpp	2010-02-06 19:35:51 UTC (rev 47939)
@@ -30,6 +30,7 @@
 #include "sci/sci.h"
 #include "sci/engine/state.h"
 #include "sci/engine/selector.h"
+#include "sci/graphics/coordadjuster.h"
 #include "sci/graphics/cache.h"
 #include "sci/graphics/paint32.h"
 #include "sci/graphics/font.h"
@@ -40,8 +41,8 @@
 
 namespace Sci {
 
-GfxPaint32::GfxPaint32(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, GfxCache *cache, GfxScreen *screen, GfxPalette *palette)
-	: _resMan(resMan), _segMan(segMan), _kernel(kernel), _cache(cache), _screen(screen), _palette(palette) {
+GfxPaint32::GfxPaint32(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, GfxCoordAdjuster *coordAdjuster, GfxCache *cache, GfxScreen *screen, GfxPalette *palette)
+	: _resMan(resMan), _segMan(segMan), _kernel(kernel), _coordAdjuster(coordAdjuster), _cache(cache), _screen(screen), _palette(palette) {
 }
 
 GfxPaint32::~GfxPaint32() {
@@ -57,7 +58,7 @@
 }
 
 void GfxPaint32::kernelDrawPicture(GuiResourceId pictureId, int16 animationNr, bool animationBlackoutFlag, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo) {
-	GfxPicture *picture = new GfxPicture(_resMan, 0, _screen, _palette, pictureId, false);
+	GfxPicture *picture = new GfxPicture(_resMan, _coordAdjuster, 0, _screen, _palette, pictureId, false);
 
 	picture->draw(animationNr, mirroredFlag, addToFlag, EGApaletteNo);
 	delete picture;

Modified: scummvm/trunk/engines/sci/graphics/paint32.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/paint32.h	2010-02-06 18:25:57 UTC (rev 47938)
+++ scummvm/trunk/engines/sci/graphics/paint32.h	2010-02-06 19:35:51 UTC (rev 47939)
@@ -40,7 +40,7 @@
  */
 class GfxPaint32 : public GfxPaint {
 public:
-	GfxPaint32(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, GfxCache *cache, GfxScreen *screen, GfxPalette *palette);
+	GfxPaint32(ResourceManager *resMan, SegManager *segMan, Kernel *kernel, GfxCoordAdjuster *coordAdjuster, GfxCache *cache, GfxScreen *screen, GfxPalette *palette);
 	~GfxPaint32();
 
 	void fillRect(Common::Rect rect, byte color);
@@ -53,6 +53,7 @@
 	ResourceManager *_resMan;
 	SegManager *_segMan;
 	Kernel *_kernel;
+	GfxCoordAdjuster *_coordAdjuster;
 	GfxCache *_cache;
 	GfxScreen *_screen;
 	GfxPalette *_palette;

Modified: scummvm/trunk/engines/sci/graphics/picture.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/picture.cpp	2010-02-06 18:25:57 UTC (rev 47938)
+++ scummvm/trunk/engines/sci/graphics/picture.cpp	2010-02-06 19:35:51 UTC (rev 47939)
@@ -28,13 +28,14 @@
 #include "sci/engine/state.h"
 #include "sci/graphics/screen.h"
 #include "sci/graphics/palette.h"
+#include "sci/graphics/coordadjuster.h"
 #include "sci/graphics/ports.h"
 #include "sci/graphics/picture.h"
 
 namespace Sci {
 
-GfxPicture::GfxPicture(ResourceManager *resMan, GfxPorts *ports, GfxScreen *screen, GfxPalette *palette, GuiResourceId resourceId, bool EGAdrawingVisualize)
-	: _resMan(resMan), _ports(ports), _screen(screen), _palette(palette), _resourceId(resourceId), _EGAdrawingVisualize(EGAdrawingVisualize) {
+GfxPicture::GfxPicture(ResourceManager *resMan, GfxCoordAdjuster *coordAdjuster, GfxPorts *ports, GfxScreen *screen, GfxPalette *palette, GuiResourceId resourceId, bool EGAdrawingVisualize)
+	: _resMan(resMan), _coordAdjuster(coordAdjuster), _ports(ports), _screen(screen), _palette(palette), _resourceId(resourceId), _EGAdrawingVisualize(EGAdrawingVisualize) {
 	assert(resourceId != -1);
 	initData(resourceId);
 }
@@ -280,21 +281,13 @@
 		memcpy(celBitmap, rlePtr, pixelCount);
 	}
 
-	if (_ports) {
-		// Set initial vertical coordinate by using current port
-		y = callerY + _ports->getPort()->top;
-		lastY = MIN<int16>(height + y, _ports->getPort()->rect.bottom + _ports->getPort()->top);
-		leftX = callerX + _ports->getPort()->left;
-		rightX = MIN<int16>(width + leftX, _ports->getPort()->rect.right + _ports->getPort()->left);
-	} else {
-		y = callerY + 10; // TODO: Implement plane support for SCI32
-		lastY = y + height;
-		if (lastY > _screen->getHeight())
-			lastY = _screen->getHeight();
-		leftX = callerX;
-		rightX = leftX + width;
-	}
+	Common::Rect displayArea = _coordAdjuster->pictureGetDisplayArea();
 
+	y = callerY + displayArea.top;
+	lastY = MIN<int16>(height + y, displayArea.bottom);
+	leftX = callerX + displayArea.left;
+	rightX = MIN<int16>(width + leftX, displayArea.right);
+
 	// Change clearcolor to white, if we dont add to an existing picture. That way we will paint everything on screen
 	//  but white and that wont matter because the screen is supposed to be already white. It seems that most (if not all)
 	//  SCI1.1 games use color 0 as transparency and SCI1 games use color 255 as transparency. Sierra SCI seems to paint

Modified: scummvm/trunk/engines/sci/graphics/picture.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/picture.h	2010-02-06 18:25:57 UTC (rev 47938)
+++ scummvm/trunk/engines/sci/graphics/picture.h	2010-02-06 19:35:51 UTC (rev 47939)
@@ -42,7 +42,7 @@
  */
 class GfxPicture {
 public:
-	GfxPicture(ResourceManager *resMan, GfxPorts *ports, GfxScreen *screen, GfxPalette *palette, GuiResourceId resourceId, bool EGAdrawingVisualize = false);
+	GfxPicture(ResourceManager *resMan, GfxCoordAdjuster *coordAdjuster, GfxPorts *ports, GfxScreen *screen, GfxPalette *palette, GuiResourceId resourceId, bool EGAdrawingVisualize = false);
 	~GfxPicture();
 
 	GuiResourceId getResourceId();
@@ -73,6 +73,7 @@
 	void vectorPatternTexturedCircle(Common::Rect box, byte size, byte color, byte prio, byte control, byte texture);
 
 	ResourceManager *_resMan;
+	GfxCoordAdjuster *_coordAdjuster;
 	GfxPorts *_ports;
 	GfxScreen *_screen;
 	GfxPalette *_palette;


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