MADS: Fix displaying multi-line messages in conversation with village girl

This commit is contained in:
Paul Gilbert 2014-05-26 21:25:18 -04:00
parent 63ccd85baa
commit c06e330ba8
3 changed files with 26 additions and 2 deletions

View File

@ -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) {

View File

@ -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);
/**

View File

@ -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);