From 64f799773e94838f8e0d5226692f4113e9bf0bf2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 27 Sep 2013 08:21:04 +0200 Subject: AVALANCHE: Misc minor polishing --- engines/avalanche/animation.cpp | 1 + engines/avalanche/avalot.cpp | 1 - engines/avalanche/dialogs.cpp | 6 ++++++ engines/avalanche/dialogs.h | 2 ++ engines/avalanche/parser.cpp | 20 +++++--------------- engines/avalanche/parser.h | 1 - 6 files changed, 14 insertions(+), 17 deletions(-) (limited to 'engines') diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index cb64bb8fe0..960705f17a 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -363,6 +363,7 @@ Animation::~Animation() { } void Animation::resetAnims() { + setDirection(kDirStopped); for (int16 i = 0; i < kSpriteNumbMax; i++) _sprites[i].reset(); } diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index e5ed210d05..e542ee40b0 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -323,7 +323,6 @@ void AvalancheEngine::setup() { _parser->_inputTextPos = 0; _parser->_quote = true; - _animation->setDirection(kDirStopped); _animation->resetAnims(); drawToolbar(); diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index c8fe128b57..a3cbd63c01 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -1131,4 +1131,10 @@ void Dialogs::talkTo(byte whom) { } } +void Dialogs::sayIt(Common::String str) { + Common::String x = str; + x.setChar(toupper(x[0]), 0); + Common::String tmpStr = Common::String::format("%c1%s.%c%c2", kControlRegister, x.c_str(), kControlSpeechBubble, kControlRegister); + displayText(tmpStr); +} } // End of namespace Avalanche diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h index d754eb1672..9904ec6b8b 100644 --- a/engines/avalanche/dialogs.h +++ b/engines/avalanche/dialogs.h @@ -82,6 +82,8 @@ public: void displayScrollChain(char block, byte point, bool report = true, bool bubbling = false); void talkTo(byte whom); + void sayIt(Common::String str); // This makes Avalot say the response. + private: AvalancheEngine *_vm; diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index f8f0d4478c..e4c91a8fed 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -569,8 +569,6 @@ void Parser::cheatParse(Common::String codes) { warning("STUB: Parser::cheatParse()"); } - - void Parser::stripPunctuation(Common::String &word) { const char punct[] = "~`!@#$%^&*()_+-={}[]:\"|;'\\,./<>?"; @@ -642,14 +640,6 @@ void Parser::properNouns() { _inputText.setChar(toupper(_inputText[0]), 0); } -void Parser::sayIt() { - Common::String x = _inputText; - x.setChar(toupper(x[0]), 0); - Common::String tmpStr = Common::String::format("%c1%s.%c%c2", Dialogs::kControlRegister, x.c_str(), - Dialogs::kControlSpeechBubble, Dialogs::kControlRegister); - _vm->_dialogs->displayText(tmpStr); -} - void Parser::storeInterrogation(byte interrogation) { if (_inputText.empty()) return; @@ -665,25 +655,25 @@ void Parser::storeInterrogation(byte interrogation) { switch (interrogation) { case 1: _inputText.toLowercase(); - sayIt(); + _vm->_dialogs->sayIt(_inputText); _vm->_favouriteDrink = _inputText; _vm->_cardiffQuestionNum = 2; break; case 2: properNouns(); - sayIt(); + _vm->_dialogs->sayIt(_inputText); _vm->_favouriteSong = _inputText; _vm->_cardiffQuestionNum = 3; break; case 3: properNouns(); - sayIt(); + _vm->_dialogs->sayIt(_inputText); _vm->_worstPlaceOnEarth = _inputText; _vm->_cardiffQuestionNum = 4; break; case 4: _inputText.toLowercase(); - sayIt(); + _vm->_dialogs->sayIt(_inputText); if (!_vm->_spareEvening.empty()) _vm->_spareEvening.clear(); _vm->_spareEvening = _inputText; @@ -710,7 +700,6 @@ void Parser::parse() { if (!_thats.empty()) _thats.clear(); - byte n = 0; _polite = false; _verb = kVerbCodePardon; _thing = kPardon; @@ -736,6 +725,7 @@ void Parser::parse() { // Actually process the command. Common::String inputText = _inputText + ' '; Common::String inputTextUpper = inputText; + byte n = 0; inputTextUpper.toUppercase(); while (!inputTextUpper.empty()) { while ((!inputTextUpper.empty()) && (inputTextUpper[0] == ' ')) { diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index 4ec7fe64b4..4d5889388c 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -121,7 +121,6 @@ private: bool doPronouns(); void properNouns(); void lookAround(); // This is called when you say "look". - void sayIt(); // This makes Avalot say the response. void openDoor(); void storeInterrogation(byte interrogation); void examineObject(); // Examine a standard object-thing -- cgit v1.2.3