diff options
author | Torbjörn Andersson | 2009-07-25 13:07:50 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2009-07-25 13:07:50 +0000 |
commit | 2e13d8923396b8549cb4d620a08ea386a1494ca8 (patch) | |
tree | 25a323154e7523a35f121ed4006f14257488de93 /engines/drascula/graphics.cpp | |
parent | ddd2b29beece3c03bfab11daa3530bc924388590 (diff) | |
download | scummvm-rg350-2e13d8923396b8549cb4d620a08ea386a1494ca8.tar.gz scummvm-rg350-2e13d8923396b8549cb4d620a08ea386a1494ca8.tar.bz2 scummvm-rg350-2e13d8923396b8549cb4d620a08ea386a1494ca8.zip |
Added word-wrapping to Drascula's conversation options. Fixes bug #2826607.
svn-id: r42755
Diffstat (limited to 'engines/drascula/graphics.cpp')
-rw-r--r-- | engines/drascula/graphics.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/engines/drascula/graphics.cpp b/engines/drascula/graphics.cpp index 76a551c980..7f1efa5d83 100644 --- a/engines/drascula/graphics.cpp +++ b/engines/drascula/graphics.cpp @@ -235,13 +235,30 @@ void DrasculaEngine::print_abc(const char *said, int screenX, int screenY) { } // for } -void DrasculaEngine::print_abc_opc(const char *said, int screenY, int game) { +int DrasculaEngine::print_abc_opc(const char *said, int screenY, int game) { int signY, letterY, letterX = 0; uint len = strlen(said); int screenX = 1; + int lines = 1; for (uint h = 0; h < len; h++) { + int wordLength; + + // Look ahead to the end of the word. + wordLength = 0; + int pos = h; + while (said[pos] && said[pos] != ' ') { + wordLength++; + pos++; + } + + if (screenX + wordLength * CHAR_WIDTH_OPC > 317) { + screenX = 0; + screenY += (CHAR_HEIGHT + 2); + lines++; + } + if (game == 1) { letterY = 6; signY = 15; @@ -281,6 +298,8 @@ void DrasculaEngine::print_abc_opc(const char *said, int screenY, int game) { screenX = screenX + CHAR_WIDTH_OPC; } + + return lines; } bool DrasculaEngine::textFitsCentered(char *text, int x) { |