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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Tue Jan 5 15:20:00 CET 2010


Revision: 47027
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47027&view=rev
Author:   thebluegr
Date:     2010-01-05 14:19:53 +0000 (Tue, 05 Jan 2010)

Log Message:
-----------
Some initial work on SCI1.1 view scaling (not working yet)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/graphics/animate.cpp
    scummvm/trunk/engines/sci/graphics/gfx.cpp
    scummvm/trunk/engines/sci/graphics/gfx.h
    scummvm/trunk/engines/sci/graphics/view.cpp
    scummvm/trunk/engines/sci/graphics/view.h

Modified: scummvm/trunk/engines/sci/graphics/animate.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/animate.cpp	2010-01-05 14:17:47 UTC (rev 47026)
+++ scummvm/trunk/engines/sci/graphics/animate.cpp	2010-01-05 14:19:53 UTC (rev 47027)
@@ -347,7 +347,7 @@
 	reg_t bitsHandle;
 	AnimateList::iterator listIterator;
 	AnimateList::iterator listEnd = _list.end();
-
+	uint16 scaleX = 128, scaleY = 128;	// no scaling
 	_lastCastCount = 0;
 
 	listIterator = _list.begin();
@@ -361,8 +361,14 @@
 			bitsHandle = _gfx->BitsSave(listEntry->celRect, SCI_SCREEN_MASK_ALL);
 			PUT_SEL32(_s->_segMan, curObject, underBits, bitsHandle);
 
+			if (getSciVersion() >= SCI_VERSION_1_1) {
+				// View scaling
+				scaleX = GET_SEL32V(_s->_segMan, curObject, scaleX);
+				scaleY = GET_SEL32V(_s->_segMan, curObject, scaleY);
+			}
+
 			// draw corresponding cel
-			_gfx->drawCel(listEntry->viewId, listEntry->loopNo, listEntry->celNo, listEntry->celRect, listEntry->priority, listEntry->paletteNo);
+			_gfx->drawCel(listEntry->viewId, listEntry->loopNo, listEntry->celNo, listEntry->celRect, listEntry->priority, listEntry->paletteNo, -1, scaleX, scaleY);
 			listEntry->showBitsFlag = true;
 
 			if (signal & kSignalRemoveView) {

Modified: scummvm/trunk/engines/sci/graphics/gfx.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gfx.cpp	2010-01-05 14:17:47 UTC (rev 47026)
+++ scummvm/trunk/engines/sci/graphics/gfx.cpp	2010-01-05 14:19:53 UTC (rev 47027)
@@ -329,7 +329,7 @@
 }
 
 // This one is the only one that updates screen!
-void Gfx::drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight) {
+void Gfx::drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight, uint16 scaleX, uint16 scaleY) {
 	View *view = getView(viewId);
 	Common::Rect rect;
 	
@@ -339,7 +339,7 @@
 		rect.right = rect.left + view->getWidth(loopNo, celNo);
 		rect.bottom = rect.top + view->getHeight(loopNo, celNo);
 
-		drawCel(view, loopNo, celNo, rect, priority, paletteNo, origHeight);
+		drawCel(view, loopNo, celNo, rect, priority, paletteNo, origHeight, scaleX, scaleY);
 
 		if (getSciVersion() >= SCI_VERSION_1_1) {
 			if (!_screen->_picNotValidSci11)
@@ -352,12 +352,12 @@
 }
 
 // This version of drawCel is not supposed to call BitsShow()!
-void Gfx::drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight) {
-	drawCel(getView(viewId), loopNo, celNo, celRect, priority, paletteNo);
+void Gfx::drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight, uint16 scaleX, uint16 scaleY) {
+	drawCel(getView(viewId), loopNo, celNo, celRect, priority, paletteNo, origHeight, scaleX, scaleY);
 }
 
 // This version of drawCel is not supposed to call BitsShow()!
-void Gfx::drawCel(View *view, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight) {
+void Gfx::drawCel(View *view, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight, uint16 scaleX, uint16 scaleY) {
 	Common::Rect clipRect = celRect;
 	clipRect.clip(_curPort->rect);
 	if (clipRect.isEmpty()) // nothing to draw
@@ -365,7 +365,7 @@
 
 	Common::Rect clipRectTranslated = clipRect;
 	OffsetRect(clipRectTranslated);
-	view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo);
+	view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo, origHeight, scaleX, scaleY);
 }
 
 uint16 Gfx::onControl(uint16 screenMask, Common::Rect rect) {

Modified: scummvm/trunk/engines/sci/graphics/gfx.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/gfx.h	2010-01-05 14:17:47 UTC (rev 47026)
+++ scummvm/trunk/engines/sci/graphics/gfx.h	2010-01-05 14:19:53 UTC (rev 47027)
@@ -84,9 +84,9 @@
 	void BitsFree(MemoryHandle memoryHandle);
 
 	void drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredFlag, bool addToFlag, GuiResourceId paletteId);
-	void drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight = -1);
-	void drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight = -1);
-	void drawCel(View *view, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight = -1);
+	void drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128);
+	void drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128);
+	void drawCel(View *view, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128);
 
 	uint16 onControl(uint16 screenMask, Common::Rect rect);
 

Modified: scummvm/trunk/engines/sci/graphics/view.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/view.cpp	2010-01-05 14:17:47 UTC (rev 47026)
+++ scummvm/trunk/engines/sci/graphics/view.cpp	2010-01-05 14:19:53 UTC (rev 47027)
@@ -461,7 +461,7 @@
 	}
 }
 
-void View::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, LoopNo loopNo, CelNo celNo, byte priority, uint16 EGAmappingNr, int16 origHeight) {
+void View::draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, LoopNo loopNo, CelNo celNo, byte priority, uint16 EGAmappingNr, int16 origHeight, uint16 scaleX, uint16 scaleY) {
 	Palette *palette = _embeddedPal ? &_viewPalette : &_palette->_sysPalette;
 	CelInfo *celInfo = getCelInfo(loopNo, celNo);
 	byte *bitmap = getBitmap(loopNo, celNo);
@@ -482,6 +482,8 @@
 
 	bitmap += (clipRect.top - rect.top) * celWidth + (clipRect.left - rect.left);
 
+	// TODO: SCI1.1 view scaling
+
 	if (!_EGAmapping) {
 		for (y = clipRectTranslated.top; y < clipRectTranslated.top + height; y++, bitmap += celWidth) {
 			for (x = 0; x < width; x++) {

Modified: scummvm/trunk/engines/sci/graphics/view.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/view.h	2010-01-05 14:17:47 UTC (rev 47026)
+++ scummvm/trunk/engines/sci/graphics/view.h	2010-01-05 14:19:53 UTC (rev 47027)
@@ -60,7 +60,7 @@
 	LoopInfo *getLoopInfo(LoopNo loopNo);
 	void getCelRect(LoopNo loopNo, CelNo celNo, int16 x, int16 y, int16 z, Common::Rect *outRect);
 	byte *getBitmap(LoopNo loopNo, CelNo celNo);
-	void draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, LoopNo loopNo, CelNo celNo, byte priority, uint16 EGAmappingNr, int16 origHeight = -1);
+	void draw(Common::Rect rect, Common::Rect clipRect, Common::Rect clipRectTranslated, LoopNo loopNo, CelNo celNo, byte priority, uint16 EGAmappingNr, int16 origHeight = -1, uint16 scaleX = 128, uint16 scaleY = 128);
 	uint16 getLoopCount() const { return _loopCount; }
 	uint16 getCelCount(LoopNo loopNo) { return _loop[loopNo].celCount; }
 	Palette *getPalette();


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