mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-16 22:58:09 +00:00
WAGE: Implement handleAcceptCommand()
This commit is contained in:
parent
87698593db
commit
8e30167e85
@ -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() {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user