aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2010-06-15 13:01:07 +0000
committerMartin Kiewitz2010-06-15 13:01:07 +0000
commit891b568fde51c7f1732c86fd34cc40efcd4314ce (patch)
tree7eabcb3211243df20bc292970701f593f7b82a64 /engines
parent604f85588965498f7852b579e19a9f6e99d32590 (diff)
downloadscummvm-rg350-891b568fde51c7f1732c86fd34cc40efcd4314ce.tar.gz
scummvm-rg350-891b568fde51c7f1732c86fd34cc40efcd4314ce.tar.bz2
scummvm-rg350-891b568fde51c7f1732c86fd34cc40efcd4314ce.zip
SCI: move textSize and textFonts and textColors inside gfxText16
svn-id: r49851
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/kgraphics.cpp14
-rw-r--r--engines/sci/graphics/gui.cpp18
-rw-r--r--engines/sci/graphics/gui.h4
-rw-r--r--engines/sci/graphics/gui32.cpp5
-rw-r--r--engines/sci/graphics/text16.cpp53
-rw-r--r--engines/sci/graphics/text16.h6
-rw-r--r--engines/sci/sci.h2
7 files changed, 46 insertions, 56 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index cf6bd41fa9..3e74bb206a 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -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 @@ reg_t kTextSize(EngineState *s, int argc, reg_t *argv) {
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 @@ reg_t kSetVideoMode(EngineState *s, int argc, reg_t *argv) {
// 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;
}
diff --git a/engines/sci/graphics/gui.cpp b/engines/sci/graphics/gui.cpp
index 468fbed776..847831c909 100644
--- a/engines/sci/graphics/gui.cpp
+++ b/engines/sci/graphics/gui.cpp
@@ -68,6 +68,7 @@ SciGui::SciGui(EngineState *state, GfxScreen *screen, GfxPalette *palette, GfxCa
_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 @@ void SciGui::wait(int16 ticks) {
_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
diff --git a/engines/sci/graphics/gui.h b/engines/sci/graphics/gui.h
index 73c37de099..edb93e10cb 100644
--- a/engines/sci/graphics/gui.h
+++ b/engines/sci/graphics/gui.h
@@ -53,10 +53,6 @@ public:
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;
diff --git a/engines/sci/graphics/gui32.cpp b/engines/sci/graphics/gui32.cpp
index 10b2b1c4fd..fb2da08ae5 100644
--- a/engines/sci/graphics/gui32.cpp
+++ b/engines/sci/graphics/gui32.cpp
@@ -69,11 +69,6 @@ SciGui32::~SciGui32() {
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();
diff --git a/engines/sci/graphics/text16.cpp b/engines/sci/graphics/text16.cpp
index 952d13fbbd..c9a7f09973 100644
--- a/engines/sci/graphics/text16.cpp
+++ b/engines/sci/graphics/text16.cpp
@@ -73,28 +73,6 @@ void GfxText16::SetFont(GuiResourceId fontId) {
_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 @@ bool GfxText16::SwitchToFont900OnSjis(const char *text) {
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
diff --git a/engines/sci/graphics/text16.h b/engines/sci/graphics/text16.h
index 2885fc928b..71b602d116 100644
--- a/engines/sci/graphics/text16.h
+++ b/engines/sci/graphics/text16.h
@@ -48,8 +48,6 @@ public:
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 @@ public:
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);
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index c2f3f17732..7cfeec0e09 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -66,6 +66,7 @@ class GfxPaint16;
class GfxPalette;
class GfxPorts;
class GfxScreen;
+class GfxText16;
class SciGui;
class GfxMacIconBar;
@@ -205,6 +206,7 @@ public:
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