diff options
author | Gregory Montoir | 2008-08-07 21:50:12 +0000 |
---|---|---|
committer | Gregory Montoir | 2008-08-07 21:50:12 +0000 |
commit | 52650efb6a510960109af0b1a040102f57a396e8 (patch) | |
tree | ff38a1aa93b0fbda55925e99bd1494bcf28a5293 | |
parent | 303333352a3393c15958dd888d898a6973629ced (diff) | |
download | scummvm-rg350-52650efb6a510960109af0b1a040102f57a396e8.tar.gz scummvm-rg350-52650efb6a510960109af0b1a040102f57a396e8.tar.bz2 scummvm-rg350-52650efb6a510960109af0b1a040102f57a396e8.zip |
fix for bug #2040484: TOUCHE: Graphic glitch with long answer options
svn-id: r33691
-rw-r--r-- | engines/touche/graphics.cpp | 5 | ||||
-rw-r--r-- | engines/touche/graphics.h | 2 | ||||
-rw-r--r-- | engines/touche/touche.cpp | 9 | ||||
-rw-r--r-- | engines/touche/touche.h | 7 |
4 files changed, 16 insertions, 7 deletions
diff --git a/engines/touche/graphics.cpp b/engines/touche/graphics.cpp index 999aa8005c..ab711beba0 100644 --- a/engines/touche/graphics.cpp +++ b/engines/touche/graphics.cpp @@ -76,10 +76,13 @@ int Graphics::getCharWidth16(uint8 chr) { return chrData[2]; } -void Graphics::drawString16(uint8 *dst, int dstPitch, uint16 color, int x, int y, const char *str) { +void Graphics::drawString16(uint8 *dst, int dstPitch, uint16 color, int x, int y, const char *str, int xmax) { while (*str) { uint8 chr = (uint8)*str++; x += drawChar16(dst, dstPitch, chr, x, y, color); + if (xmax != 0 && x > xmax) { + break; + } } } diff --git a/engines/touche/graphics.h b/engines/touche/graphics.h index 6b4072d896..9c928f983c 100644 --- a/engines/touche/graphics.h +++ b/engines/touche/graphics.h @@ -40,7 +40,7 @@ public: static void setupFont(Common::Language language); static int getStringWidth16(const char *str); static int getCharWidth16(uint8 chr); - static void drawString16(uint8 *dst, int dstPitch, uint16 color, int x, int y, const char *str); + static void drawString16(uint8 *dst, int dstPitch, uint16 color, int x, int y, const char *str, int xmax = 0); static int drawChar16(uint8 *dst, int dstPitch, uint8 chr, int x, int y, uint16 color); static void fillRect(uint8 *dst, int dstPitch, int x, int y, int w, int h, uint8 color); static void drawRect(uint8 *dst, int dstPitch, int x, int y, int w, int h, uint8 color1, uint8 color2); diff --git a/engines/touche/touche.cpp b/engines/touche/touche.cpp index ac8e8a786a..a39517fe32 100644 --- a/engines/touche/touche.cpp +++ b/engines/touche/touche.cpp @@ -1248,10 +1248,11 @@ int ToucheEngine::getStringWidth(int num) const { return Graphics::getStringWidth16(str); } -void ToucheEngine::drawString(uint16 color, int x, int y, int16 num) { +void ToucheEngine::drawString(uint16 color, int x, int y, int16 num, StringType strType) { + const int xmax = (_language == Common::ES_ESP && strType == kStringTypeConversation) ? kScreenWidth - 20 : 0; if (num) { const char *str = getString(num); - Graphics::drawString16(_offscreenBuffer, kScreenWidth, color, x, y, str); + Graphics::drawString16(_offscreenBuffer, kScreenWidth, color, x, y, str, xmax); } } @@ -2414,7 +2415,7 @@ void ToucheEngine::drawCharacterConversation() { } drawConversationPanel(); for (int i = 0; i < 4; ++i) { - drawString(214, 42, 328 + i * kTextHeight, _conversationChoicesTable[_scrollConversationChoiceOffset + i].msg); + drawString(214, 42, 328 + i * kTextHeight, _conversationChoicesTable[_scrollConversationChoiceOffset + i].msg, kStringTypeConversation); } updateScreenArea(0, 320, kScreenWidth, kScreenHeight - 320); _conversationAreaCleared = false; @@ -2422,7 +2423,7 @@ void ToucheEngine::drawCharacterConversation() { void ToucheEngine::drawConversationString(int num, uint16 color) { const int y = 328 + num * kTextHeight; - drawString(color, 42, y, _conversationChoicesTable[num + _scrollConversationChoiceOffset].msg); + drawString(color, 42, y, _conversationChoicesTable[num + _scrollConversationChoiceOffset].msg, kStringTypeConversation); updateScreenArea(0, y, kScreenWidth, kTextHeight); } diff --git a/engines/touche/touche.h b/engines/touche/touche.h index c1bc12655f..41f5c832c5 100644 --- a/engines/touche/touche.h +++ b/engines/touche/touche.h @@ -331,6 +331,11 @@ enum { kMaxSaveStates = 100 }; +enum StringType { + kStringTypeDefault, + kStringTypeConversation +}; + class MidiPlayer; class ToucheEngine: public Engine { @@ -399,7 +404,7 @@ protected: void setKeyCharMoney(); const char *getString(int num) const; int getStringWidth(int num) const; - void drawString(uint16 color, int x, int y, int16 num); + void drawString(uint16 color, int x, int y, int16 num, StringType strType = kStringTypeDefault); void drawGameString(uint16 color, int x1, int y, const char *str); int restartKeyCharScriptOnAction(int action, int obj1, int obj2); void buildSpriteScalingTable(int z1, int z2); |