diff options
author | Eugene Sandulenko | 2016-01-17 23:11:19 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2016-02-14 17:12:46 +0100 |
commit | 8e30167e854a12cf545e7ad56a33e20122fe58c0 (patch) | |
tree | a4d5b33dd7b1bf809d9b8a7e78956c1c1f9d7542 | |
parent | 87698593db098cd906a5b8f7f19eb7f6db5a6e7a (diff) | |
download | scummvm-rg350-8e30167e854a12cf545e7ad56a33e20122fe58c0.tar.gz scummvm-rg350-8e30167e854a12cf545e7ad56a33e20122fe58c0.tar.bz2 scummvm-rg350-8e30167e854a12cf545e7ad56a33e20122fe58c0.zip |
WAGE: Implement handleAcceptCommand()
-rw-r--r-- | engines/wage/combat.cpp | 10 | ||||
-rw-r--r-- | engines/wage/script.cpp | 73 |
2 files changed, 48 insertions, 35 deletions
diff --git a/engines/wage/combat.cpp b/engines/wage/combat.cpp index cdf336f9f4..2d1e02a955 100644 --- a/engines/wage/combat.cpp +++ b/engines/wage/combat.cpp @@ -53,9 +53,13 @@ namespace Wage { Obj *WageEngine::getOffer() { - warning("STUB: WageEngine::getOffer"); - - return NULL; + if (_offer != NULL) { + Chr *owner = _offer->_currentOwner; + if (owner == NULL || owner->_playerCharacter || owner->_currentScene != _world->_player->_currentScene) { + _offer = NULL; + } + } + return _offer; } Chr *WageEngine::getMonster() { diff --git a/engines/wage/script.cpp b/engines/wage/script.cpp index c4567a55df..6ccb7b3696 100644 --- a/engines/wage/script.cpp +++ b/engines/wage/script.cpp @@ -1044,7 +1044,16 @@ void Script::handleRestCommand() { } void Script::handleAcceptCommand() { - warning("STUB: handleAcceptCommand"); + Obj *offer = _callbacks->_offer; + Chr *chr = offer->_currentOwner; + + char buf[512]; + snprintf(buf, 512, "%s%s lays the %s on the ground and departs peacefully.", + chr->getDefiniteArticle(true), chr->_name.c_str(), offer->_name.c_str()); + appendText(buf); + + _world->move(offer, chr->_currentScene); + _world->move(chr, _world->_storageScene); } void Script::handleTakeCommand(const char *target) { @@ -1077,6 +1086,37 @@ void Script::handleAttack(Weapon *weapon) { warning("STUB: handleAttack"); } +const char *Script::getPercentMessage(double percent) { + if (percent < 0.40) { + return "very bad"; + } else if (percent < 0.55) { + return "bad"; + } else if (percent < 0.70) { + return "average"; + } else if (percent < 0.85) { + return "good"; + } else if (percent <= 1.00) { + return "very good"; + } else { + return "enhanced"; + } +} + +void Script::printPlayerCondition(Chr *player) { + double physicalPercent = (double)player->_context._statVariables[PHYS_HIT_CUR] / player->_context._statVariables[PHYS_HIT_BAS]; + double spiritualPercent = (double)player->_context._statVariables[SPIR_HIT_CUR] / player->_context._statVariables[SPIR_HIT_BAS]; + + Common::String msg = "Your physical condition is "; + msg += getPercentMessage(physicalPercent); + msg += "."; + appendText(msg); + + msg = "Your spiritual condition is "; + msg += getPercentMessage(spiritualPercent); + msg += "."; + appendText(msg); +} + enum { BLOCK_START, BLOCK_END, @@ -1282,35 +1322,4 @@ void Script::convertToText() { delete scr; } -const char *Script::getPercentMessage(double percent) { - if (percent < 0.40) { - return "very bad"; - } else if (percent < 0.55) { - return "bad"; - } else if (percent < 0.70) { - return "average"; - } else if (percent < 0.85) { - return "good"; - } else if (percent <= 1.00) { - return "very good"; - } else { - return "enhanced"; - } -} - -void Script::printPlayerCondition(Chr *player) { - double physicalPercent = (double)player->_context._statVariables[PHYS_HIT_CUR] / player->_context._statVariables[PHYS_HIT_BAS]; - double spiritualPercent = (double)player->_context._statVariables[SPIR_HIT_CUR] / player->_context._statVariables[SPIR_HIT_BAS]; - - Common::String msg = "Your physical condition is "; - msg += getPercentMessage(physicalPercent); - msg += "."; - appendText(msg); - - msg = "Your spiritual condition is "; - msg += getPercentMessage(spiritualPercent); - msg += "."; - appendText(msg); -} - } // End of namespace Wage |