diff options
author | Paul Gilbert | 2012-02-12 21:08:12 +1100 |
---|---|---|
committer | Strangerke | 2012-04-06 08:21:05 +0200 |
commit | 5448664f8bcae2d8aca4bdfb85f0d51563a76428 (patch) | |
tree | 62cca44214d80772882a6b0259da5a395545fefd | |
parent | 855fed35d0c7548c43ceb9a77f811c15c60ea325 (diff) | |
download | scummvm-rg350-5448664f8bcae2d8aca4bdfb85f0d51563a76428.tar.gz scummvm-rg350-5448664f8bcae2d8aca4bdfb85f0d51563a76428.tar.bz2 scummvm-rg350-5448664f8bcae2d8aca4bdfb85f0d51563a76428.zip |
MORTEVIELLE: Fixed the F3/F8 box width to adjust to the text size
-rw-r--r-- | engines/mortevielle/graphics.cpp | 10 | ||||
-rw-r--r-- | engines/mortevielle/graphics.h | 1 | ||||
-rw-r--r-- | engines/mortevielle/mor.cpp | 18 |
3 files changed, 21 insertions, 8 deletions
diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index e9c8c1e7e9..ad421988d4 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1090,9 +1090,15 @@ void ScreenSurface::writeg(const Common::String &l, int c) { pt.x += i; } show_mouse(); +} + +/** + * Gets the width in pixels of the specified string + */ +int ScreenSurface::getStringWidth(const Common::String &s) { + int charWidth = (res == 2) ? 6 : 10; - // TODO: Move screen updates to main loop once constructed - g_vm->_screenSurface.updateScreen(); + return s.size() * charWidth; } } // End of namespace Mortevielle diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index 258f4cfacc..b196fce7f9 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -91,6 +91,7 @@ public: void clearScreen(); void putxy(int x, int y) { _textPos = Common::Point(x, y); } void writeg(const Common::String &l, int c); + int getStringWidth(const Common::String &s); // TODO: Refactor code to remove this method, for increased performance void setPixel(const Common::Point &pt, int palIndex); diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp index 6e2d1057cb..ba480ce125 100644 --- a/engines/mortevielle/mor.cpp +++ b/engines/mortevielle/mor.cpp @@ -451,15 +451,21 @@ void repon(int f, int m) { } void f3f8() { - int co; + Common::String f3 = g_vm->getString(S_F3); + Common::String f8 = g_vm->getString(S_F8); - if (res == 1) co = 107; - else co = 64; + // Write the F3 and F8 text strings g_vm->_screenSurface.putxy(3, 44); - g_vm->_screenSurface.writeg(g_vm->getString(S_F3), 5); + g_vm->_screenSurface.writeg(f3, 5); g_vm->_screenSurface._textPos.y = 51; - g_vm->_screenSurface.writeg(g_vm->getString(S_F8), 5); - g_vm->_screenSurface.drawBox(0, 42, co, 16, 7); + g_vm->_screenSurface.writeg(f8, 5); + + // Get the width of the written text strings + int f3Width = g_vm->_screenSurface.getStringWidth(f3); + int f8Width = g_vm->_screenSurface.getStringWidth(f8); + + // Write out the bounding box + g_vm->_screenSurface.drawBox(0, 42, MAX(f3Width, f8Width) + 6, 16, 7); } void t5(int cx) { |