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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Mon Jan 4 23:14:34 CET 2010


Revision: 46992
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46992&view=rev
Author:   m_kiewitz
Date:     2010-01-04 22:14:34 +0000 (Mon, 04 Jan 2010)

Log Message:
-----------
SCI: surprise for this DrMcCoy guy

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kernel32.cpp
    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 21:23:02 UTC (rev 46991)
+++ scummvm/trunk/engines/sci/engine/kernel32.cpp	2010-01-04 22:14:34 UTC (rev 46992)
@@ -639,35 +639,8 @@
 
 reg_t kAddScreenItem(EngineState *s, int argc, reg_t *argv) {
 	reg_t viewObj = argv[0];
-	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;
 
-	// 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 >= (int16)s->_gui->getScreenWidth()) {
-		warning("kAddScreenItem: invalid left position (%d), resetting to 0", leftPos);
-		leftPos = 0;
-	}
-
-	if (topPos >= s->_gui->getScreenHeight()) {
-		warning("kAddScreenItem: invalid top position (%d), resetting to 0", topPos);
-		topPos = 0;
-	}
-
-	// HACK: just draw the view on screen
-	if (viewId != 0xffff)
-		s->_gui->drawCel(viewId, loopNo, celNo, leftPos, topPos, priority, 0);
-
-	// TODO
-
-	//warning("kAddScreenItem, object %04x:%04x, view %d, loop %d, cel %d, pri %d", PRINT_REG(viewObj), viewId, loopNo, celNo, priority);
-	//s->_gui->addToPicView(viewId, loopNo, celNo, leftPos, topPos, priority, control);
+	s->_gui->addScreenItem(viewObj);
 	return NULL_REG;
 }
 
@@ -767,6 +740,7 @@
 	// as its called right after a view is updated
 
 	// TODO
+	s->_gui->frameOut();
 
 	return NULL_REG;
 }

Modified: scummvm/trunk/engines/sci/gui/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui.cpp	2010-01-04 21:23:02 UTC (rev 46991)
+++ scummvm/trunk/engines/sci/gui/gui.cpp	2010-01-04 22:14:34 UTC (rev 46992)
@@ -65,6 +65,8 @@
 	_controls = new SciGuiControls(_s->_segMan, _gfx, _text);
 	_menu = new SciGuiMenu(_s->_event, _s->_segMan, _gfx, _text, _screen, _cursor);
 //  	_gui32 = new SciGui32(_s, _screen, _palette, _cursor); // for debug purposes
+
+	_screenItemCount = 0;
 }
 
 SciGui::SciGui() {
@@ -837,6 +839,41 @@
 	return _screen->_displayHeight;
 }
 
+void SciGui::addScreenItem(reg_t object) {
+	_screenItems.push_back(object);
+	_screenItemCount++;
+}
+
+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;
+
+		// 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);
+	}
+}
+
 bool SciGui::debugUndither(bool flag) {
 	_screen->unditherSetState(flag);
 	return false;

Modified: scummvm/trunk/engines/sci/gui/gui.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui.h	2010-01-04 21:23:02 UTC (rev 46991)
+++ scummvm/trunk/engines/sci/gui/gui.h	2010-01-04 22:14:34 UTC (rev 46992)
@@ -153,6 +153,10 @@
 	virtual uint16 getScreenWidth();
 	virtual uint16 getScreenHeight();
 
+	// SCI32
+	virtual void addScreenItem(reg_t object);
+	virtual void frameOut();
+
 	virtual bool debugUndither(bool flag);
 	virtual bool debugShowMap(int mapNo);
 
@@ -180,6 +184,9 @@
 // 	SciGui32 *_gui32; // for debug purposes
 
 	bool _usesOldGfxFunctions;
+
+	Common::Array<reg_t> _screenItems;
+	int _screenItemCount;
 };
 
 } // 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