aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/support
diff options
context:
space:
mode:
authorPaul Gilbert2016-04-24 22:22:12 -0400
committerPaul Gilbert2016-07-10 16:12:01 -0400
commit36faf0890fec6bab90531ade42c0eb924b31b64a (patch)
treec63a8d8ceb9da3827d4edaf49eaf36e7a93b96d9 /engines/titanic/support
parentc75de59a28c94e364a38af39057af720ba8465d4 (diff)
downloadscummvm-rg350-36faf0890fec6bab90531ade42c0eb924b31b64a.tar.gz
scummvm-rg350-36faf0890fec6bab90531ade42c0eb924b31b64a.tar.bz2
scummvm-rg350-36faf0890fec6bab90531ade42c0eb924b31b64a.zip
TITANIC: Minor work towards text display
Diffstat (limited to 'engines/titanic/support')
-rw-r--r--engines/titanic/support/font.cpp10
-rw-r--r--engines/titanic/support/font.h5
-rw-r--r--engines/titanic/support/screen_manager.cpp11
-rw-r--r--engines/titanic/support/screen_manager.h14
4 files changed, 33 insertions, 7 deletions
diff --git a/engines/titanic/support/font.cpp b/engines/titanic/support/font.cpp
index f5d28ea9ca..e903abaf97 100644
--- a/engines/titanic/support/font.cpp
+++ b/engines/titanic/support/font.cpp
@@ -127,7 +127,11 @@ int STFont::stringWidth(const CString &text) const {
return total;
}
-int STFont::writeChar(CVideoSurface *surface, unsigned char c, const Common::Point &pt, Rect *destRect, Rect *srcRect) {
+int STFont::writeString(CVideoSurface *surface, const Point &pt, const CString &str) {
+ return 0;
+}
+
+int STFont::writeChar(CVideoSurface *surface, unsigned char c, const Point &pt, Rect *destRect, Rect *srcRect) {
if (c == 233)
c = '$';
@@ -174,7 +178,7 @@ int STFont::writeChar(CVideoSurface *surface, unsigned char c, const Common::Poi
return 0;
}
-void STFont::copyRect(CVideoSurface *surface, const Common::Point &pt, Rect &rect) {
+void STFont::copyRect(CVideoSurface *surface, const Point &pt, Rect &rect) {
if (surface->lock()) {
uint16 *lineP = surface->getBasePtr(pt.x, pt.y);
uint16 color = getColor();
@@ -203,7 +207,7 @@ void STFont::extendBounds(Point &textSize, byte c, int maxWidth) const {
void STFont::checkLineWrap(Point &textSize, int maxWidth, const char *&str) const {
bool flag = false;
int totalWidth = 0;
- for (const char *srcPtr = str; *srcPtr; ++srcPtr) {
+ for (const char *srcPtr = str; *srcPtr && *srcPtr != ' '; ++srcPtr) {
if (*srcPtr == ' ' && flag)
break;
diff --git a/engines/titanic/support/font.h b/engines/titanic/support/font.h
index e1c63e6544..4bb1b2e6d6 100644
--- a/engines/titanic/support/font.h
+++ b/engines/titanic/support/font.h
@@ -83,6 +83,11 @@ public:
int stringWidth(const CString &text) const;
/**
+ * Write a string to the specified surface
+ */
+ int writeString(CVideoSurface *surface, const Point &pt, const CString &str);
+
+ /**
* Get the text area a string will fit into
* @param str String
* @param maxWidth Maximum width in pixels
diff --git a/engines/titanic/support/screen_manager.cpp b/engines/titanic/support/screen_manager.cpp
index f772bc6f7e..b467c8593d 100644
--- a/engines/titanic/support/screen_manager.cpp
+++ b/engines/titanic/support/screen_manager.cpp
@@ -68,6 +68,12 @@ void CScreenManager::setSurfaceBounds(SurfaceNum surfaceNum, const Rect &r) {
_backSurfaces[surfaceNum]._bounds = r;
}
+int CScreenManager::setFontNumber(int fontNumber) {
+ int oldFontNumber = _fontNumber;
+ _fontNumber = fontNumber;
+ return oldFontNumber;
+}
+
/*------------------------------------------------------------------------*/
OSScreenManager::OSScreenManager(TitanicEngine *vm): CScreenManager(vm),
@@ -197,7 +203,10 @@ void OSScreenManager::blitFrom(SurfaceNum surfaceNum, CVideoSurface *src,
void OSScreenManager::proc12() {}
void OSScreenManager::proc13() {}
void OSScreenManager::proc14() {}
-void OSScreenManager::proc15() {}
+
+void OSScreenManager::setFontColor(byte r, byte g, byte b) {
+ _fonts[_fontNumber].setColor(r, g, b);
+}
int OSScreenManager::getTextBounds(const CString &str, int maxWidth, Point *sizeOut) const {
return _fonts[_fontNumber].getTextBounds(str, maxWidth, sizeOut);
diff --git a/engines/titanic/support/screen_manager.h b/engines/titanic/support/screen_manager.h
index baba662564..b1e949ad58 100644
--- a/engines/titanic/support/screen_manager.h
+++ b/engines/titanic/support/screen_manager.h
@@ -108,7 +108,11 @@ public:
virtual void proc12() = 0;
virtual void proc13() = 0;
virtual void proc14() = 0;
- virtual void proc15() = 0;
+
+ /**
+ * Set the font color
+ */
+ virtual void setFontColor(byte r, byte g, byte b) = 0;
/**
* Get the text area a string will fit into
@@ -164,7 +168,7 @@ public:
/**
* Set the current font number
*/
- void setFontNumber(int fontNumber) { _fontNumber = fontNumber; }
+ int setFontNumber(int fontNumber);
};
class OSScreenManager: CScreenManager {
@@ -224,7 +228,11 @@ public:
virtual void proc12();
virtual void proc13();
virtual void proc14();
- virtual void proc15();
+
+ /**
+ * Set the font color
+ */
+ virtual void setFontColor(byte r, byte g, byte b);
/**
* Get the text area a string will fit into