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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Tue Jun 15 15:01:09 CEST 2010


Revision: 49851
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49851&view=rev
Author:   m_kiewitz
Date:     2010-06-15 13:01:07 +0000 (Tue, 15 Jun 2010)

Log Message:
-----------
SCI: move textSize and textFonts and textColors inside gfxText16

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/gui32.cpp
    scummvm/trunk/engines/sci/graphics/text16.cpp
    scummvm/trunk/engines/sci/graphics/text16.h
    scummvm/trunk/engines/sci/sci.h

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-06-15 12:36:04 UTC (rev 49850)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2010-06-15 13:01:07 UTC (rev 49851)
@@ -48,6 +48,7 @@
 #include "sci/graphics/paint16.h"
 #include "sci/graphics/ports.h"
 #include "sci/graphics/screen.h"
+#include "sci/graphics/text16.h"
 #include "sci/graphics/view.h"
 
 namespace Sci {
@@ -345,11 +346,12 @@
 	textWidth = dest[3].toUint16(); textHeight = dest[2].toUint16();
 	
 #ifdef ENABLE_SCI32
-	if (g_sci->_gui32)
-		g_sci->_gui32->textSize(g_sci->strSplit(text.c_str(), sep).c_str(), font_nr, maxwidth, &textWidth, &textHeight);
-	else
+	if (!g_sci->_gfxText16) {
+		// TODO: Implement this
+		textWidth = 0; textHeight = 0;
+	} else
 #endif
-		g_sci->_gui->textSize(g_sci->strSplit(text.c_str(), sep).c_str(), font_nr, maxwidth, &textWidth, &textHeight);
+		g_sci->_gfxText16->kernelTextSize(g_sci->strSplit(text.c_str(), sep).c_str(), font_nr, maxwidth, &textWidth, &textHeight);
 	
 	debugC(2, kDebugLevelStrings, "GetTextSize '%s' -> %dx%d", text.c_str(), textWidth, textHeight);
 	dest[2] = make_reg(0, textHeight);
@@ -1246,12 +1248,12 @@
 // New calls for SCI11. Using those is only needed when using text-codes so that one is able to change
 //  font and/or color multiple times during kDisplay and kDrawControl
 reg_t kTextFonts(EngineState *s, int argc, reg_t *argv) {
-	g_sci->_gui->textFonts(argc, argv);
+	g_sci->_gfxText16->kernelTextFonts(argc, argv);
 	return s->r_acc;
 }
 
 reg_t kTextColors(EngineState *s, int argc, reg_t *argv) {
-	g_sci->_gui->textColors(argc, argv);
+	g_sci->_gfxText16->kernelTextColors(argc, argv);
 	return s->r_acc;
 }
 

Modified: scummvm/trunk/engines/sci/graphics/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.cpp	2010-06-15 12:36:04 UTC (rev 49850)
+++ scummvm/trunk/engines/sci/graphics/gui.cpp	2010-06-15 13:01:07 UTC (rev 49851)
@@ -68,6 +68,7 @@
 	_animate = new GfxAnimate(_s, _cache, _ports, _paint16, _screen, _palette, _cursor, _transitions);
 	g_sci->_gfxAnimate = _animate;
 	_text16 = new GfxText16(g_sci->getResMan(), _cache, _ports, _paint16, _screen);
+	g_sci->_gfxText16 = _text16;
 	_controls = new GfxControls(_s->_segMan, _ports, _paint16, _text16, _screen);
 	g_sci->_gfxControls = _controls;
 	_menu = new GfxMenu(g_sci->getEventManager(), _s->_segMan, this, _ports, _paint16, _text16, _screen, _cursor);
@@ -94,21 +95,4 @@
 	_s->wait(ticks);
 }
 
-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);
-	*textWidth = rect.width();
-	*textHeight = rect.height();
-}
-
-// Used SCI1+ for text codes
-void SciGui::textFonts(int argc, reg_t *argv) {
-	_text16->CodeSetFonts(argc, argv);
-}
-
-// Used SCI1+ for text codes
-void SciGui::textColors(int argc, reg_t *argv) {
-	_text16->CodeSetColors(argc, argv);
-}
-
 } // End of namespace Sci

Modified: scummvm/trunk/engines/sci/graphics/gui.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui.h	2010-06-15 12:36:04 UTC (rev 49850)
+++ scummvm/trunk/engines/sci/graphics/gui.h	2010-06-15 13:01:07 UTC (rev 49851)
@@ -53,10 +53,6 @@
 
 	virtual void wait(int16 ticks);
 
-	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);
-
 protected:
 	GfxCursor *_cursor;
 	EngineState *_s;

Modified: scummvm/trunk/engines/sci/graphics/gui32.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/gui32.cpp	2010-06-15 12:36:04 UTC (rev 49850)
+++ scummvm/trunk/engines/sci/graphics/gui32.cpp	2010-06-15 13:01:07 UTC (rev 49851)
@@ -69,11 +69,6 @@
 void SciGui32::init() {
 }
 
-void SciGui32::textSize(const char *text, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight) {
-	*textWidth = 0;
-	*textHeight = 0;
-}
-
 void SciGui32::drawRobot(GuiResourceId robotId) {
 	Robot *test = new Robot(g_sci->getResMan(), _screen, robotId);
 	test->draw();

Modified: scummvm/trunk/engines/sci/graphics/text16.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/text16.cpp	2010-06-15 12:36:04 UTC (rev 49850)
+++ scummvm/trunk/engines/sci/graphics/text16.cpp	2010-06-15 13:01:07 UTC (rev 49851)
@@ -73,28 +73,6 @@
 	_ports->_curPort->fontHeight = _font->getHeight();
 }
 
-void GfxText16::CodeSetFonts(int argc, reg_t *argv) {
-	int i;
-
-	delete _codeFonts;
-	_codeFontsCount = argc;
-	_codeFonts = new GuiResourceId[argc];
-	for (i = 0; i < argc; i++) {
-		_codeFonts[i] = (GuiResourceId)argv[i].toUint16();
-	}
-}
-
-void GfxText16::CodeSetColors(int argc, reg_t *argv) {
-	int i;
-
-	delete _codeColors;
-	_codeColorsCount = argc;
-	_codeColors = new uint16[argc];
-	for (i = 0; i < argc; i++) {
-		_codeColors[i] = argv[i].toUint16();
-	}
-}
-
 void GfxText16::ClearChar(int16 chr) {
 	if (_ports->_curPort->penMode != 1)
 		return;
@@ -488,4 +466,35 @@
 	return false;
 }
 
+void GfxText16::kernelTextSize(const char *text, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight) {
+	Common::Rect rect(0, 0, *textWidth, *textHeight);
+	Size(rect, text, font, maxWidth);
+	*textWidth = rect.width();
+	*textHeight = rect.height();
+}
+
+// Used SCI1+ for text codes
+void GfxText16::kernelTextFonts(int argc, reg_t *argv) {
+	int i;
+
+	delete _codeFonts;
+	_codeFontsCount = argc;
+	_codeFonts = new GuiResourceId[argc];
+	for (i = 0; i < argc; i++) {
+		_codeFonts[i] = (GuiResourceId)argv[i].toUint16();
+	}
+}
+
+// Used SCI1+ for text codes
+void GfxText16::kernelTextColors(int argc, reg_t *argv) {
+	int i;
+
+	delete _codeColors;
+	_codeColorsCount = argc;
+	_codeColors = new uint16[argc];
+	for (i = 0; i < argc; i++) {
+		_codeColors[i] = argv[i].toUint16();
+	}
+}
+
 } // End of namespace Sci

Modified: scummvm/trunk/engines/sci/graphics/text16.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/text16.h	2010-06-15 12:36:04 UTC (rev 49850)
+++ scummvm/trunk/engines/sci/graphics/text16.h	2010-06-15 13:01:07 UTC (rev 49851)
@@ -48,8 +48,6 @@
 	GfxFont *GetFont();
 	void SetFont(GuiResourceId fontId);
 
-	void CodeSetFonts(int argc, reg_t *argv);
-	void CodeSetColors(int argc, reg_t *argv);
 	int16 CodeProcessing(const char *&text, GuiResourceId orgFontId, int16 orgPenColor);
 
 	void ClearChar(int16 chr);
@@ -67,6 +65,10 @@
 
 	GfxFont *_font;
 
+	void kernelTextSize(const char *text, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight);
+	void kernelTextFonts(int argc, reg_t *argv);
+	void kernelTextColors(int argc, reg_t *argv);
+
 private:
 	void init();
 	bool SwitchToFont900OnSjis(const char *text);

Modified: scummvm/trunk/engines/sci/sci.h
===================================================================
--- scummvm/trunk/engines/sci/sci.h	2010-06-15 12:36:04 UTC (rev 49850)
+++ scummvm/trunk/engines/sci/sci.h	2010-06-15 13:01:07 UTC (rev 49851)
@@ -66,6 +66,7 @@
 class GfxPalette;
 class GfxPorts;
 class GfxScreen;
+class GfxText16;
 class SciGui;
 class GfxMacIconBar;
 
@@ -205,6 +206,7 @@
 	GfxPaint16 *_gfxPaint16; // Painting in 16-bit gfx
 	GfxPorts *_gfxPorts; // Port managment for 16-bit gfx
 	GfxScreen *_gfxScreen;
+	GfxText16 *_gfxText16;
 	SciGui *_gui; /* Currently active Gui */
 	GfxMacIconBar *_gfxMacIconBar; // Mac Icon Bar manager
 


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