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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Tue Jan 5 00:09:59 CET 2010


Revision: 46996
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46996&view=rev
Author:   m_kiewitz
Date:     2010-01-04 23:09:57 +0000 (Mon, 04 Jan 2010)

Log Message:
-----------
SCI: now filtering screenItems against planes

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kernel32.cpp
    scummvm/trunk/engines/sci/engine/vm.h
    scummvm/trunk/engines/sci/gui/gui.cpp
    scummvm/trunk/engines/sci/gui/gui.h

Modified: scummvm/trunk/engines/sci/engine/kernel32.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel32.cpp	2010-01-04 22:48:52 UTC (rev 46995)
+++ scummvm/trunk/engines/sci/engine/kernel32.cpp	2010-01-04 23:09:57 UTC (rev 46996)
@@ -698,35 +698,25 @@
 }
 
 reg_t kAddPlane(EngineState *s, int argc, reg_t *argv) {
-	reg_t picObj = argv[0];
+	reg_t planeObj = argv[0];
 
-	// TODO
-
-	// The picture selector usually doesn't hold the actual picture at this point. It's filled in
-	// when kUpdatePlane is called
-
-	warning("kAddPlane object %04x:%04x", PRINT_REG(picObj));
+	s->_gui->addPlane(planeObj);
+	warning("kAddPlane object %04x:%04x", PRINT_REG(planeObj));
 	return NULL_REG;
 }
 
 reg_t kDeletePlane(EngineState *s, int argc, reg_t *argv) {
-	reg_t picObj = argv[0];
+	reg_t planeObj = argv[0];
 
-	// TODO
-
-	warning("kDeletePlane object %04x:%04x", PRINT_REG(picObj));
+	s->_gui->deletePlane(planeObj);
+	warning("kDeletePlane object %04x:%04x", PRINT_REG(planeObj));
 	return NULL_REG;
 }
 
 reg_t kUpdatePlane(EngineState *s, int argc, reg_t *argv) {
-	reg_t picObj = argv[0];
-	int16 picNum = GET_SEL32V(s->_segMan, picObj, picture);
+	reg_t planeObj = argv[0];
 
-	if (picNum > -1) {
-		s->_gui->drawPicture(picNum, 100, false, false, false, 0);
-		s->_gui->animateShowPic();
-	}
-
+	s->_gui->updatePlane(planeObj);
 	return s->r_acc;
 }
 

Modified: scummvm/trunk/engines/sci/engine/vm.h
===================================================================
--- scummvm/trunk/engines/sci/engine/vm.h	2010-01-04 22:48:52 UTC (rev 46995)
+++ scummvm/trunk/engines/sci/engine/vm.h	2010-01-04 23:09:57 UTC (rev 46996)
@@ -199,6 +199,8 @@
 #ifdef ENABLE_SCI32
 	Selector data; // Used by Array()
 	Selector picture; // Used to hold the picture ID for SCI32 pictures
+
+	Selector plane;
 #endif
 };
 

Modified: scummvm/trunk/engines/sci/gui/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui.cpp	2010-01-04 22:48:52 UTC (rev 46995)
+++ scummvm/trunk/engines/sci/gui/gui.cpp	2010-01-04 23:09:57 UTC (rev 46996)
@@ -67,6 +67,7 @@
 //  	_gui32 = new SciGui32(_s, _screen, _palette, _cursor); // for debug purposes
 
 	_screenItemCount = 0;
+	_planeCount = 0;
 }
 
 SciGui::SciGui() {
@@ -854,33 +855,71 @@
 	}
 }
 
-void SciGui::frameOut() {
-	for (int itemNr = 0; itemNr < _screenItemCount; itemNr++) {
-		reg_t viewObj = _screenItems[itemNr];
-		uint16 viewId = GET_SEL32V(_s->_segMan, viewObj, view);
-		uint16 loopNo = GET_SEL32V(_s->_segMan, viewObj, loop);
-		uint16 celNo = GET_SEL32V(_s->_segMan, viewObj, cel);
-		uint16 leftPos = GET_SEL32V(_s->_segMan, viewObj, x);
-		uint16 topPos = GET_SEL32V(_s->_segMan, viewObj, y);
-		int16 priority = GET_SEL32V(_s->_segMan, viewObj, priority);
-		//int16 control = 0;
+void SciGui::addPlane(reg_t object) {
+	_planes.push_back(object);
+	_planeCount++;
+}
 
-		// Theoretically, leftPos and topPos should be sane
-		// Apparently, sometimes they're not, therefore I'm adding some sanity checks here so that 
-		// the hack underneath does not try and draw cels outside the screen coordinates
-		if (leftPos >= getScreenWidth()) {
-			warning("kAddScreenItem: invalid left position (%d), resetting to 0", leftPos);
-			leftPos = 0;
+void SciGui::updatePlane(reg_t object) {
+	int16 picNum = GET_SEL32V(_s->_segMan, object, picture);
+	if (picNum > -1) {
+		drawPicture(picNum, 100, false, false, false, 0);
+		animateShowPic();
+	}
+}
+
+void SciGui::deletePlane(reg_t object) {
+	for (int planeNr = 0; planeNr < _planeCount; planeNr++) {
+		if (_planes[planeNr] == object) {
+			_planes.remove_at(planeNr);
+			_planeCount--;
+			return;
 		}
+	}
+}
 
-		if (topPos >= getScreenHeight()) {
-			warning("kAddScreenItem: invalid top position (%d), resetting to 0", topPos);
-			topPos = 0;
+void SciGui::frameOut() {
+	for (int planeNr = 0; planeNr < _planeCount; planeNr++) {
+		reg_t planeObj = _planes[planeNr];
+		int16 priority = GET_SEL32V(_s->_segMan, planeObj, priority);
+
+		if (priority == -1)
+			continue;
+
+		for (int itemNr = 0; itemNr < _screenItemCount; itemNr++) {
+			reg_t viewObj = _screenItems[itemNr];
+			reg_t planeOfItem = GET_SEL32(_s->_segMan, viewObj, plane);
+			if (planeOfItem == _planes[planeNr]) {
+				uint16 viewId = GET_SEL32V(_s->_segMan, viewObj, view);
+				uint16 loopNo = GET_SEL32V(_s->_segMan, viewObj, loop);
+				uint16 celNo = GET_SEL32V(_s->_segMan, viewObj, cel);
+				uint16 leftPos = GET_SEL32V(_s->_segMan, viewObj, x);
+				uint16 topPos = GET_SEL32V(_s->_segMan, viewObj, y);
+				int16 priority = GET_SEL32V(_s->_segMan, viewObj, priority);
+				int16 signal = GET_SEL32V(_s->_segMan, viewObj, signal);
+				int16 plane = GET_SEL32V(_s->_segMan, viewObj, plane);
+
+				warning("viewId %d plane %X", viewId, plane);
+				//int16 control = 0;
+
+				// Theoretically, leftPos and topPos should be sane
+				// Apparently, sometimes they're not, therefore I'm adding some sanity checks here so that 
+				// the hack underneath does not try and draw cels outside the screen coordinates
+				if (leftPos >= getScreenWidth()) {
+					warning("kAddScreenItem: invalid left position (%d), resetting to 0", leftPos);
+					leftPos = 0;
+				}
+	
+				if (topPos >= getScreenHeight()) {
+					warning("kAddScreenItem: invalid top position (%d), resetting to 0", topPos);
+					topPos = 0;
+				}
+	
+				// HACK: just draw the view on screen
+				if (viewId != 0xffff)
+					drawCel(viewId, loopNo, celNo, leftPos, topPos, priority, 0);
+			}
 		}
-
-		// HACK: just draw the view on screen
-		if (viewId != 0xffff)
-			drawCel(viewId, loopNo, celNo, leftPos, topPos, priority, 0);
 	}
 }
 

Modified: scummvm/trunk/engines/sci/gui/gui.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui.h	2010-01-04 22:48:52 UTC (rev 46995)
+++ scummvm/trunk/engines/sci/gui/gui.h	2010-01-04 23:09:57 UTC (rev 46996)
@@ -156,6 +156,9 @@
 	// SCI32
 	virtual void addScreenItem(reg_t object);
 	virtual void deleteScreenItem(reg_t object);
+	virtual void addPlane(reg_t object);
+	virtual void updatePlane(reg_t object);
+	virtual void deletePlane(reg_t object);
 	virtual void frameOut();
 
 	virtual bool debugUndither(bool flag);
@@ -188,6 +191,8 @@
 
 	Common::Array<reg_t> _screenItems;
 	int _screenItemCount;
+	Common::Array<reg_t> _planes;
+	int _planeCount;
 };
 
 } // End of namespace Sci


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