[Scummvm-cvs-logs] scummvm master -> c06e330ba87410b36672936c76154f9352b95d6c
dreammaster
dreammaster at scummvm.org
Tue May 27 03:25:55 CEST 2014
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c06e330ba8 MADS: Fix displaying multi-line messages in conversation with village girl
Commit: c06e330ba87410b36672936c76154f9352b95d6c
https://github.com/scummvm/scummvm/commit/c06e330ba87410b36672936c76154f9352b95d6c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-05-26T21:25:18-04:00
Commit Message:
MADS: Fix displaying multi-line messages in conversation with village girl
Changed paths:
engines/mads/game.cpp
engines/mads/game.h
engines/mads/nebular/nebular_scenes2.cpp
diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp
index f1744d8..0576703 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 3a84a72..1b06f84 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 5768275..cd849d9 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);
More information about the Scummvm-git-logs
mailing list