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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Fri Feb 5 23:31:48 CET 2010


Revision: 47917
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47917&view=rev
Author:   m_kiewitz
Date:     2010-02-05 22:31:48 +0000 (Fri, 05 Feb 2010)

Log Message:
-----------
SCI: moving kDisplay into GfxPaint16, now getting called directly as well

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/graphics/gui.cpp
    scummvm/trunk/engines/sci/graphics/gui.h
    scummvm/trunk/engines/sci/graphics/paint16.cpp
    scummvm/trunk/engines/sci/graphics/paint16.h

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-02-05 22:20:46 UTC (rev 47916)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-02-05 22:31:48 UTC (rev 47917)
@@ -1075,8 +1075,7 @@
 		text = kernel_lookup_text(s, textp, index);
 	}
 
-	s->_gui->display(s->strSplit(text.c_str()).c_str(), argc, argv);
-	return s->r_acc;
+	return s->_gfxPaint16->kernelDisplay(s->strSplit(text.c_str()).c_str(), argc, argv);
 }
 
 reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) {

Modified: scummvm/trunk/engines/sci/graphics/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.cpp	2010-02-05 22:20:46 UTC (rev 47916)
+++ scummvm/trunk/engines/sci/graphics/gui.cpp	2010-02-05 22:31:48 UTC (rev 47917)
@@ -104,111 +104,6 @@
 	kernel_sleep(_s->_event, ticks * 1000 / 60);
 }
 
-#define SCI_DISPLAY_MOVEPEN				100
-#define SCI_DISPLAY_SETALIGNMENT		101
-#define SCI_DISPLAY_SETPENCOLOR			102
-#define SCI_DISPLAY_SETBACKGROUNDCOLOR	103
-#define SCI_DISPLAY_SETGREYEDOUTPUT		104
-#define SCI_DISPLAY_SETFONT				105
-#define SCI_DISPLAY_WIDTH				106
-#define SCI_DISPLAY_SAVEUNDER			107
-#define SCI_DISPLAY_RESTOREUNDER		108
-#define SCI_DISPLAY_DONTSHOWBITS		121
-
-void SciGui::display(const char *text, int argc, reg_t *argv) {
-	int displayArg;
-	TextAlignment alignment = SCI_TEXT16_ALIGNMENT_LEFT;
-	int16 colorPen = -1, colorBack = -1, width = -1, bRedraw = 1;
-	bool doSaveUnder = false;
-	Common::Rect rect;
-
-	// Make a "backup" of the port settings
-	Port oldPort = *_ports->getPort();
-
-	// setting defaults
-	_ports->penMode(0);
-	_ports->penColor(0);
-	_ports->textGreyedOutput(false);
-	// processing codes in argv
-	while (argc > 0) {
-		displayArg = argv[0].toUint16();
-		argc--; argv++;
-		switch (displayArg) {
-		case SCI_DISPLAY_MOVEPEN:
-			_ports->moveTo(argv[0].toUint16(), argv[1].toUint16());
-			argc -= 2; argv += 2;
-			break;
-		case SCI_DISPLAY_SETALIGNMENT:
-			alignment = argv[0].toSint16();
-			argc--; argv++;
-			break;
-		case SCI_DISPLAY_SETPENCOLOR:
-			colorPen = argv[0].toUint16();
-			_ports->penColor(colorPen);
-			argc--; argv++;
-			break;
-		case SCI_DISPLAY_SETBACKGROUNDCOLOR:
-			colorBack = argv[0].toUint16();
-			argc--; argv++;
-			break;
-		case SCI_DISPLAY_SETGREYEDOUTPUT:
-			_ports->textGreyedOutput(argv[0].isNull() ? false : true);
-			argc--; argv++;
-			break;
-		case SCI_DISPLAY_SETFONT:
-			_text16->SetFont(argv[0].toUint16());
-			argc--; argv++;
-			break;
-		case SCI_DISPLAY_WIDTH:
-			width = argv[0].toUint16();
-			argc--; argv++;
-			break;
-		case SCI_DISPLAY_SAVEUNDER:
-			doSaveUnder = true;
-			break;
-		case SCI_DISPLAY_RESTOREUNDER:
-			_paint16->bitsGetRect(argv[0], &rect);
-			rect.translate(-_ports->getPort()->left, -_ports->getPort()->top);
-			_paint16->bitsRestore(argv[0]);
-			_paint16->kernelGraphRedrawBox(rect);
-			// finishing loop
-			argc = 0;
-			break;
-		case SCI_DISPLAY_DONTSHOWBITS:
-			bRedraw = 0;
-			break;
-		default:
-			warning("Unknown kDisplay argument %X", displayArg);
-			break;
-		}
-	}
-
-	// now drawing the text
-	_text16->Size(rect, text, -1, width);
-	rect.moveTo(_ports->getPort()->curLeft, _ports->getPort()->curTop);
-	if (getSciVersion() >= SCI_VERSION_1_LATE) {
-		int16 leftPos = rect.right <= _screen->getWidth() ? 0 : _screen->getWidth() - rect.right;
-		int16 topPos = rect.bottom <= _screen->getHeight() ? 0 : _screen->getHeight() - rect.bottom;
-		_ports->move(leftPos, topPos);
-		rect.moveTo(_ports->getPort()->curLeft, _ports->getPort()->curTop);
-	}
-
-	if (doSaveUnder)
-		_s->r_acc = _paint16->bitsSave(rect, SCI_SCREEN_MASK_VISUAL);
-	if (colorBack != -1)
-		_paint16->fillRect(rect, SCI_SCREEN_MASK_VISUAL, colorBack, 0, 0);
-	_text16->Box(text, 0, rect, alignment, -1);
-	if (_screen->_picNotValid == 0 && bRedraw)
-		_paint16->bitsShow(rect);
-	// restoring port and cursor pos
-	Port *currport = _ports->getPort();
-	uint16 tTop = currport->curTop;
-	uint16 tLeft = currport->curLeft;
-	*currport = oldPort;
-	currport->curTop = tTop;
-	currport->curLeft = tLeft;
-}
-
 void SciGui::textSize(const char *text, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight) {
 	Common::Rect rect(0, 0, *textWidth, *textHeight);
 	_text16->Size(rect, text, font, maxWidth);

Modified: scummvm/trunk/engines/sci/graphics/gui.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.h	2010-02-05 22:20:46 UTC (rev 47916)
+++ scummvm/trunk/engines/sci/graphics/gui.h	2010-02-05 22:31:48 UTC (rev 47917)
@@ -53,8 +53,6 @@
 
 	virtual void wait(int16 ticks);
 
-	virtual void display(const char *text, int argc, reg_t *argv);
-
 	virtual void textSize(const char *text, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight);
 	virtual void textFonts(int argc, reg_t *argv);
 	virtual void textColors(int argc, reg_t *argv);

Modified: scummvm/trunk/engines/sci/graphics/paint16.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/paint16.cpp	2010-02-05 22:20:46 UTC (rev 47916)
+++ scummvm/trunk/engines/sci/graphics/paint16.cpp	2010-02-05 22:31:48 UTC (rev 47917)
@@ -414,4 +414,111 @@
 	_ports->setPort(oldPort);
 }
 
+#define SCI_DISPLAY_MOVEPEN				100
+#define SCI_DISPLAY_SETALIGNMENT		101
+#define SCI_DISPLAY_SETPENCOLOR			102
+#define SCI_DISPLAY_SETBACKGROUNDCOLOR	103
+#define SCI_DISPLAY_SETGREYEDOUTPUT		104
+#define SCI_DISPLAY_SETFONT				105
+#define SCI_DISPLAY_WIDTH				106
+#define SCI_DISPLAY_SAVEUNDER			107
+#define SCI_DISPLAY_RESTOREUNDER		108
+#define SCI_DISPLAY_DONTSHOWBITS		121
+
+reg_t GfxPaint16::kernelDisplay(const char *text, int argc, reg_t *argv) {
+	int displayArg;
+	TextAlignment alignment = SCI_TEXT16_ALIGNMENT_LEFT;
+	int16 colorPen = -1, colorBack = -1, width = -1, bRedraw = 1;
+	bool doSaveUnder = false;
+	Common::Rect rect;
+	reg_t result = NULL_REG;
+
+	// Make a "backup" of the port settings
+	Port oldPort = *_ports->getPort();
+
+	// setting defaults
+	_ports->penMode(0);
+	_ports->penColor(0);
+	_ports->textGreyedOutput(false);
+	// processing codes in argv
+	while (argc > 0) {
+		displayArg = argv[0].toUint16();
+		argc--; argv++;
+		switch (displayArg) {
+		case SCI_DISPLAY_MOVEPEN:
+			_ports->moveTo(argv[0].toUint16(), argv[1].toUint16());
+			argc -= 2; argv += 2;
+			break;
+		case SCI_DISPLAY_SETALIGNMENT:
+			alignment = argv[0].toSint16();
+			argc--; argv++;
+			break;
+		case SCI_DISPLAY_SETPENCOLOR:
+			colorPen = argv[0].toUint16();
+			_ports->penColor(colorPen);
+			argc--; argv++;
+			break;
+		case SCI_DISPLAY_SETBACKGROUNDCOLOR:
+			colorBack = argv[0].toUint16();
+			argc--; argv++;
+			break;
+		case SCI_DISPLAY_SETGREYEDOUTPUT:
+			_ports->textGreyedOutput(argv[0].isNull() ? false : true);
+			argc--; argv++;
+			break;
+		case SCI_DISPLAY_SETFONT:
+			_text16->SetFont(argv[0].toUint16());
+			argc--; argv++;
+			break;
+		case SCI_DISPLAY_WIDTH:
+			width = argv[0].toUint16();
+			argc--; argv++;
+			break;
+		case SCI_DISPLAY_SAVEUNDER:
+			doSaveUnder = true;
+			break;
+		case SCI_DISPLAY_RESTOREUNDER:
+			bitsGetRect(argv[0], &rect);
+			rect.translate(-_ports->getPort()->left, -_ports->getPort()->top);
+			bitsRestore(argv[0]);
+			kernelGraphRedrawBox(rect);
+			// finishing loop
+			argc = 0;
+			break;
+		case SCI_DISPLAY_DONTSHOWBITS:
+			bRedraw = 0;
+			break;
+		default:
+			warning("Unknown kDisplay argument %X", displayArg);
+			break;
+		}
+	}
+
+	// now drawing the text
+	_text16->Size(rect, text, -1, width);
+	rect.moveTo(_ports->getPort()->curLeft, _ports->getPort()->curTop);
+	if (getSciVersion() >= SCI_VERSION_1_LATE) {
+		int16 leftPos = rect.right <= _screen->getWidth() ? 0 : _screen->getWidth() - rect.right;
+		int16 topPos = rect.bottom <= _screen->getHeight() ? 0 : _screen->getHeight() - rect.bottom;
+		_ports->move(leftPos, topPos);
+		rect.moveTo(_ports->getPort()->curLeft, _ports->getPort()->curTop);
+	}
+
+	if (doSaveUnder)
+		result = bitsSave(rect, SCI_SCREEN_MASK_VISUAL);
+	if (colorBack != -1)
+		fillRect(rect, SCI_SCREEN_MASK_VISUAL, colorBack, 0, 0);
+	_text16->Box(text, 0, rect, alignment, -1);
+	if (_screen->_picNotValid == 0 && bRedraw)
+		bitsShow(rect);
+	// restoring port and cursor pos
+	Port *currport = _ports->getPort();
+	uint16 tTop = currport->curTop;
+	uint16 tLeft = currport->curLeft;
+	*currport = oldPort;
+	currport->curTop = tTop;
+	currport->curLeft = tLeft;
+	return result;
+}
+
 } // End of namespace Sci

Modified: scummvm/trunk/engines/sci/graphics/paint16.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/paint16.h	2010-02-05 22:20:46 UTC (rev 47916)
+++ scummvm/trunk/engines/sci/graphics/paint16.h	2010-02-05 22:31:48 UTC (rev 47917)
@@ -86,6 +86,8 @@
 	void kernelGraphUpdateBox(Common::Rect rect, bool hiresMode);
 	void kernelGraphRedrawBox(Common::Rect rect);
 
+	reg_t kernelDisplay(const char *text, int argc, reg_t *argv);
+
 private:
 	ResourceManager *_resMan;
 	SegManager *_segMan;


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