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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sat Oct 31 16:25:50 CET 2009


Revision: 45564
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45564&view=rev
Author:   m_kiewitz
Date:     2009-10-31 15:25:47 +0000 (Sat, 31 Oct 2009)

Log Message:
-----------
SCI/newgui: kGraph support for Save-UpscaledHires-Box (not sure if coordinates are really hires, it seems that they are not)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/gui/gui.cpp
    scummvm/trunk/engines/sci/gui/gui.h
    scummvm/trunk/engines/sci/gui/gui_screen.cpp
    scummvm/trunk/engines/sci/gui/gui_screen.h
    scummvm/trunk/engines/sci/gui32/gui32.cpp
    scummvm/trunk/engines/sci/gui32/gui32.h

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-10-31 14:41:28 UTC (rev 45563)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-10-31 15:25:47 UTC (rev 45564)
@@ -198,12 +198,12 @@
 	K_GRAPH_UPDATE_BOX = 12,
 	K_GRAPH_REDRAW_BOX = 13,
 	K_GRAPH_ADJUST_PRIORITY = 14,
-	K_GRAPH_SAVE_UNSCALED_BOX = 15	// KQ6CD Windows version
+	K_GRAPH_SAVE_UPSCALEDHIRES_BOX = 15	// KQ6CD Windows version
 };
 
 reg_t kGraph(EngineState *s, int argc, reg_t *argv) {
 	int16 x = 0, y = 0, x1 = 0, y1 = 0;
-	uint16 flags;
+	uint16 screenMask;
 	int16 priority, control, color, colorMask;
 	Common::Rect rect;
 
@@ -229,10 +229,11 @@
 
 	case K_GRAPH_SAVE_BOX:
 		kGraphCreateRect(x, y, x1, y1, &rect);
-		flags = (argc > 5) ? argv[5].toUint16() : 0;
-		return s->_gui->graphSaveBox(rect, flags);
+		screenMask = (argc > 5) ? argv[5].toUint16() : 0;
+		return s->_gui->graphSaveBox(rect, screenMask);
 
 	case K_GRAPH_RESTORE_BOX:
+		// This may be called with a memoryhandle from SAVE_BOX or SAVE_UPSCALEDHIRES_BOX
 		s->_gui->graphRestoreBox(argv[1]);
 		break;
 
@@ -272,10 +273,10 @@
 		s->priority_last = argv[2].toSint16() - 10;
 		break;
 
-	case K_GRAPH_SAVE_UNSCALED_BOX:
-		// Save an area given in unscaled coordinates, so that a hires control will be drawn over it
-		// TODO
-		break;
+	case K_GRAPH_SAVE_UPSCALEDHIRES_BOX:
+		// Save an area given in upscaled-hires coordinates, so that a hires control will be drawn over it
+		kGraphCreateRect(x, y, x1, y1, &rect);
+		return s->_gui->graphSaveUpscaledHiresBox(rect);
 
 	default:
 		error("Unsupported kGraph() operation %04x", argv[0].toSint16());
@@ -633,32 +634,37 @@
 
 	switch (operation) {
 	case 0: { // load resource (the corresponding .BIN file from the ACTORS directory)
-		Common::String resName = s->_segMan->getString(argv[1]);
-		warning("kPortrait, load portrait %s", resName.c_str());
-		// TODO
-		} break;
+		if (argc == 2) {
+			Common::String resourceName = s->_segMan->getString(argv[1]);
+		} else {
+			warning("kPortrait(loadResource) called with unsupported argc %d", argc);
+		}
+		break;
+	}
 	case 1: { // show portrait
-		Common::String resName = s->_segMan->getString(argv[1]);
-
-		// Show the portrait and sync the sound resource (like kDoSync)
-		/*
-		Common::Point portraitPos = Common::Point(argv[2].toUint16(), argv[3].toUint16());
-		uint resourceNum = argv[4].toUint16() & 0xff;
-		uint noun = argv[5].toUint16() & 0xff;
-		uint verb = argv[6].toUint16() & 0xff;
-		uint cond = argv[7].toUint16() & 0xff;
-		uint seq = argv[8].toUint16() & 0xff;
-		// argv[9] is usually 0
-		*/
-
-		warning("kPortrait, show portrait %s", resName.c_str());
-		// TODO
-		} break;
+		if (argc == 10) {
+			Common::String resourceName = s->_segMan->getString(argv[1]);
+			Common::Point portraitPos = Common::Point(argv[2].toUint16(), argv[3].toUint16());
+			uint resourceNum = argv[4].toUint16() & 0xff;
+			uint noun = argv[5].toUint16() & 0xff;
+			uint verb = argv[6].toUint16() & 0xff;
+			uint cond = argv[7].toUint16() & 0xff;
+			uint seq = argv[8].toUint16() & 0xff;
+			// argv[9] is usually 0??!!
+			warning("kPortrait(show) %s at %d, %d", resourceName.c_str(), portraitPos.x, portraitPos.y);
+		} else {
+			warning("kPortrait(show) called with unsupported argc %d", argc);
+		}
+		break;
+	}
 	case 2: { // unload resource
-		uint16 portraitId = argv[1].toUint16();
-		warning("kPortrait, unload portrait ID %d", portraitId);
-		// TODO
-		} break;
+		if (argc == 2) {
+			uint16 portraitId = argv[1].toUint16();
+		} else {
+			warning("kPortrait(unload) called with unsupported argc %d", argc);
+		}
+		break;
+	}
 	default:
 		warning("kPortrait(%d), not implemented (argc = %d)", operation, argc);
 	}
@@ -886,10 +892,12 @@
 	GuiResourceId viewId = argv[0].toSint16();
 	GuiViewLoopNo loopNo = argv[1].toSint16();
 	GuiViewCelNo celNo = argv[2].toSint16();
-	int x = argv[3].toSint16();
-	int y = argv[4].toSint16();
-	int priority = (argc > 5) ? argv[5].toSint16()  : -1;
-	int paletteNo = (argc > 6) ? argv[6].toSint16() : 0;
+	uint16 x = argv[3].toUint16();
+	uint16 y = argv[4].toUint16();
+	int16 priority = (argc > 5) ? argv[5].toSint16()  : -1;
+	uint16 paletteNo = (argc > 6) ? argv[6].toUint16() : 0;
+	// Unknown seems to be scaling related?!?
+	int16 unknown = (argc > 7) ? argv[7].toSint16() : -1;
 
 	s->_gui->drawCel(viewId, loopNo, celNo, x, y, priority, paletteNo);
 

Modified: scummvm/trunk/engines/sci/gui/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui.cpp	2009-10-31 14:41:28 UTC (rev 45563)
+++ scummvm/trunk/engines/sci/gui/gui.cpp	2009-10-31 15:25:47 UTC (rev 45564)
@@ -451,10 +451,14 @@
 	_screen->drawLine(startPoint.x, startPoint.y, endPoint.x, endPoint.y, color, priority, control);
 }
 
-reg_t SciGui::graphSaveBox(Common::Rect rect, uint16 flags) {
-	return _gfx->BitsSave(rect, flags);
+reg_t SciGui::graphSaveBox(Common::Rect rect, uint16 screenMask) {
+	return _gfx->BitsSave(rect, screenMask);
 }
 
+reg_t SciGui::graphSaveUpscaledHiresBox(Common::Rect rect) {
+	return _gfx->BitsSave(rect, SCI_SCREEN_MASK_DISPLAY);
+}
+
 void SciGui::graphRestoreBox(reg_t handle) {
 	_gfx->BitsRestore(handle);
 }

Modified: scummvm/trunk/engines/sci/gui/gui.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui.h	2009-10-31 14:41:28 UTC (rev 45563)
+++ scummvm/trunk/engines/sci/gui/gui.h	2009-10-31 15:25:47 UTC (rev 45564)
@@ -96,6 +96,7 @@
 	virtual void graphFrameBox(Common::Rect rect, int16 color);
 	virtual void graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control);
 	virtual reg_t graphSaveBox(Common::Rect rect, uint16 flags);
+	virtual reg_t graphSaveUpscaledHiresBox(Common::Rect rect);
 	virtual void graphRestoreBox(reg_t handle);
 	virtual void graphUpdateBox(Common::Rect rect);
 	virtual void graphRedrawBox(Common::Rect rect);

Modified: scummvm/trunk/engines/sci/gui/gui_screen.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_screen.cpp	2009-10-31 14:41:28 UTC (rev 45563)
+++ scummvm/trunk/engines/sci/gui/gui_screen.cpp	2009-10-31 15:25:47 UTC (rev 45564)
@@ -252,6 +252,11 @@
 	if (mask & SCI_SCREEN_MASK_CONTROL) {
 		byteCount += pixels; // _controlScreen
 	}
+	if (mask & SCI_SCREEN_MASK_DISPLAY) {
+		if (!_upscaledHires)
+			error("bitsGetDataSize() called w/o being in upscaled hires mode");
+		byteCount += pixels; // _displayScreen (coordinates actually are given to us for hires displayScreen)
+	}
 
 	return byteCount;
 }
@@ -270,6 +275,11 @@
 	if (mask & SCI_SCREEN_MASK_CONTROL) {
 		bitsSaveScreen(rect, _controlScreen, memoryPtr);
 	}
+	if (mask & SCI_SCREEN_MASK_DISPLAY) {
+		if (!_upscaledHires)
+			error("bitsSave() called w/o being in upscaled hires mode");
+		bitsSaveScreen(rect, _displayScreen, memoryPtr);
+	}
 }
 
 void SciGuiScreen::bitsSaveScreen(Common::Rect rect, byte *screen, byte *&memoryPtr) {
@@ -324,6 +334,11 @@
 	if (mask & SCI_SCREEN_MASK_CONTROL) {
 		bitsRestoreScreen(rect, memoryPtr, _controlScreen);
 	}
+	if (mask & SCI_SCREEN_MASK_DISPLAY) {
+		if (!_upscaledHires)
+			error("bitsRestore() called w/o being in upscaled hires mode");
+		bitsRestoreScreen(rect, memoryPtr, _displayScreen);
+	}
 }
 
 void SciGuiScreen::bitsRestoreScreen(Common::Rect rect, byte *&memoryPtr, byte *screen) {

Modified: scummvm/trunk/engines/sci/gui/gui_screen.h
===================================================================
--- scummvm/trunk/engines/sci/gui/gui_screen.h	2009-10-31 14:41:28 UTC (rev 45563)
+++ scummvm/trunk/engines/sci/gui/gui_screen.h	2009-10-31 15:25:47 UTC (rev 45564)
@@ -36,6 +36,7 @@
 #define SCI_SCREEN_MASK_VISUAL   1
 #define SCI_SCREEN_MASK_PRIORITY 2
 #define SCI_SCREEN_MASK_CONTROL  4
+#define SCI_SCREEN_MASK_DISPLAY  8 // not official sierra sci
 #define SCI_SCREEN_MASK_ALL      SCI_SCREEN_MASK_VISUAL|SCI_SCREEN_MASK_PRIORITY|SCI_SCREEN_MASK_CONTROL
 
 #define SCI_SCREEN_UNDITHERMEMORIAL_SIZE 256

Modified: scummvm/trunk/engines/sci/gui32/gui32.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui32/gui32.cpp	2009-10-31 14:41:28 UTC (rev 45563)
+++ scummvm/trunk/engines/sci/gui32/gui32.cpp	2009-10-31 15:25:47 UTC (rev 45564)
@@ -1239,7 +1239,7 @@
 	FULL_REDRAW();
 }
 
-reg_t SciGui32::graphSaveBox(Common::Rect rect, uint16 flags) {
+reg_t SciGui32::graphSaveBox(Common::Rect rect, uint16 screenMask) {
 	rect_t area;
 	area.x = rect.left + _s->port->zone.x + port_origin_x;
 	area.y = rect.top + _s->port->zone.y + port_origin_y;
@@ -1249,6 +1249,11 @@
 	return graph_save_box(_s, area);
 }
 
+reg_t SciGui32::graphSaveUpscaledHiresBox(Common::Rect rect) {
+	// STUB
+	return NULL_REG;
+}
+
 void SciGui32::graphRestoreBox(reg_t handle) {
 	graph_restore_box(_s, handle);
 }

Modified: scummvm/trunk/engines/sci/gui32/gui32.h
===================================================================
--- scummvm/trunk/engines/sci/gui32/gui32.h	2009-10-31 14:41:28 UTC (rev 45563)
+++ scummvm/trunk/engines/sci/gui32/gui32.h	2009-10-31 15:25:47 UTC (rev 45564)
@@ -74,7 +74,8 @@
 	void graphFillBoxBackground(Common::Rect rect);	
 	void graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int16 priority, int16 control);
 	void graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control);
-	reg_t graphSaveBox(Common::Rect rect, uint16 flags);
+	reg_t graphSaveBox(Common::Rect rect, uint16 screenMask);
+	reg_t graphSaveUpscaledHiresBox(Common::Rect rect);
 	void graphRestoreBox(reg_t handle);
 	void graphUpdateBox(Common::Rect);
 	void graphRedrawBox(Common::Rect);


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