diff options
author | Paul Gilbert | 2014-05-26 21:25:18 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-05-26 21:25:18 -0400 |
commit | c06e330ba87410b36672936c76154f9352b95d6c (patch) | |
tree | e2ea8f2477acc228069bbedca701cbd0b32b2a74 /engines/mads | |
parent | 63ccd85baae74a59f9cc720bef5ca58224ab8dd5 (diff) | |
download | scummvm-rg350-c06e330ba87410b36672936c76154f9352b95d6c.tar.gz scummvm-rg350-c06e330ba87410b36672936c76154f9352b95d6c.tar.bz2 scummvm-rg350-c06e330ba87410b36672936c76154f9352b95d6c.zip |
MADS: Fix displaying multi-line messages in conversation with village girl
Diffstat (limited to 'engines/mads')
-rw-r--r-- | engines/mads/game.cpp | 12 | ||||
-rw-r--r-- | engines/mads/game.h | 14 | ||||
-rw-r--r-- | engines/mads/nebular/nebular_scenes2.cpp | 2 |
3 files changed, 26 insertions, 2 deletions
diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index f1744d8407..0576703577 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -152,6 +152,18 @@ void Game::run() { gameLoop(); } +void Game::splitQuote(const Common::String &source, Common::String &line1, Common::String &line2) { + // Make the first line up the end of the word at the half-way point + const char *strP = source.c_str() + source.size() / 2; + while (*strP != ' ') ++strP; + + line1 = Common::String(source.c_str(), strP); + + // The rest of the string goes in the second line + while (*strP == ' ') ++strP; + line2 = Common::String(strP); +} + void Game::gameLoop() { while (!_vm->shouldQuit() && _statusFlag) { if (_loadGameSlot != -1) { diff --git a/engines/mads/game.h b/engines/mads/game.h index 3a84a720f7..1b06f847d0 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -158,9 +158,21 @@ public: */ void run(); + /** + * Return the number of quotes + */ uint32 getQuotesSize() { return _quotes.size(); } + + /** + * Get a specific quote string + */ const Common::String &getQuote(uint32 index) { return _quotes[index - 1]; } - void splitQuote(Common::String quote, Common::String part1, Common::String part2) {warning("TODO: splitQuote()");} + + /** + * Split a quote into two lines for display on-screen + */ + void splitQuote(const Common::String &source, Common::String &line1, Common::String &line2); + Common::StringArray getMessage(uint32 id); /** diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 5768275d29..cd849d9839 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -3642,7 +3642,7 @@ void Scene210::handleConversations() { _scene->_kernelMessages.reset(); _game._player._stepEnabled = false; Common::String curQuote = _game.getQuote(_action._activeAction._verbId); - if (_vm->_font->getWidth(curQuote, _scene->_textSpacing) > 200) { + if (_scene->_kernelMessages._talkFont->getWidth(curQuote, _scene->_textSpacing) > 200) { Common::String subQuote1; _game.splitQuote(curQuote, subQuote1, _subQuote2); _scene->_kernelMessages.add(Common::Point(0, -14), 0x1110, 34, 0, 240, subQuote1); |