mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 12:39:56 +00:00
HUGO: Replace Utils::Box by Utils::notifyBox + Common::String::format
This commit is contained in:
parent
458ebbafd2
commit
dd88f39bc7
@ -479,7 +479,7 @@ void Screen::shadowStr(int16 sx, const int16 sy, const char *s, const byte color
|
||||
* present in the DOS versions
|
||||
*/
|
||||
void Screen::userHelp() const {
|
||||
Utils::Box(kBoxAny , "%s",
|
||||
Utils::notifyBox(
|
||||
"F1 - Press F1 again\n"
|
||||
" for instructions\n"
|
||||
"F2 - Sound on/off\n"
|
||||
|
@ -550,7 +550,7 @@ void FileManager::printBootText() {
|
||||
buf[i] ^= cypher[i % strlen(cypher)];
|
||||
|
||||
buf[i] = '\0';
|
||||
Utils::Box(kBoxOk, "%s", buf);
|
||||
Utils::notifyBox(buf);
|
||||
}
|
||||
|
||||
free(buf);
|
||||
|
@ -121,7 +121,7 @@ void FileManager_v1d::instructions() const {
|
||||
f.read(wrkLine, 1);
|
||||
} while (*wrkLine++ != '#'); // '#' is EOP
|
||||
wrkLine[-2] = '\0'; // Remove EOP and previous CR
|
||||
Utils::Box(kBoxAny, "%s", line);
|
||||
Utils::notifyBox(line);
|
||||
wrkLine = line;
|
||||
f.read(readBuf, 2); // Remove CRLF after EOP
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ FileManager_v2w::~FileManager_v2w() {
|
||||
* Same comment than in SCI: maybe in the future we can implement this, but for now this message should suffice
|
||||
*/
|
||||
void FileManager_v2w::instructions() const {
|
||||
Utils::Box(kBoxAny, "Please use an external viewer to open the game's help file: HUGOWIN%d.HLP", _vm->_gameVariant + 1);
|
||||
Utils::notifyBox(Common::String::format("Please use an external viewer to open the game's help file: HUGOWIN%d.HLP", _vm->_gameVariant + 1));
|
||||
}
|
||||
|
||||
} // End of namespace Hugo
|
||||
|
@ -165,7 +165,7 @@ bool HugoEngine::isPacked() const {
|
||||
* Print options for user when dead
|
||||
*/
|
||||
void HugoEngine::gameOverMsg() {
|
||||
Utils::Box(kBoxOk, "%s", _text->getTextUtil(kGameOver));
|
||||
Utils::notifyBox(_text->getTextUtil(kGameOver));
|
||||
}
|
||||
|
||||
Common::Error HugoEngine::run() {
|
||||
@ -678,8 +678,8 @@ void HugoEngine::endGame() {
|
||||
debugC(1, kDebugEngine, "endGame");
|
||||
|
||||
if (_boot.registered != kRegRegistered)
|
||||
Utils::Box(kBoxAny, "%s", _text->getTextEngine(kEsAdvertise));
|
||||
Utils::Box(kBoxAny, "%s\n%s", _episode, getCopyrightString());
|
||||
Utils::notifyBox(_text->getTextEngine(kEsAdvertise));
|
||||
Utils::notifyBox(Common::String::format("%s\n%s", _episode, getCopyrightString()));
|
||||
_status.viewState = kViewExit;
|
||||
}
|
||||
|
||||
|
@ -131,11 +131,6 @@ enum HugoRegistered {
|
||||
kRegFreeware
|
||||
};
|
||||
|
||||
/**
|
||||
* Ways to dismiss a text/prompt box
|
||||
*/
|
||||
enum box_t {kBoxAny, kBoxOk};
|
||||
|
||||
/**
|
||||
* Inventory icon bar states
|
||||
*/
|
||||
|
@ -337,13 +337,13 @@ bool intro_v3d::introPlay() {
|
||||
// Text boxes at various times
|
||||
switch (introTicks) {
|
||||
case 4:
|
||||
Utils::Box(kBoxOk, "%s", _vm->_text->getTextIntro(kIntro1));
|
||||
Utils::notifyBox(_vm->_text->getTextIntro(kIntro1));
|
||||
break;
|
||||
case 9:
|
||||
Utils::Box(kBoxOk, "%s", _vm->_text->getTextIntro(kIntro2));
|
||||
Utils::notifyBox(_vm->_text->getTextIntro(kIntro2));
|
||||
break;
|
||||
case 35:
|
||||
Utils::Box(kBoxOk, "%s", _vm->_text->getTextIntro(kIntro3));
|
||||
Utils::notifyBox(_vm->_text->getTextIntro(kIntro3));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -429,13 +429,13 @@ bool intro_v3w::introPlay() {
|
||||
// Text boxes at various times
|
||||
switch (introTicks) {
|
||||
case 4:
|
||||
Utils::Box(kBoxOk, "%s", _vm->_text->getTextIntro(kIntro1));
|
||||
Utils::notifyBox(_vm->_text->getTextIntro(kIntro1));
|
||||
break;
|
||||
case 9:
|
||||
Utils::Box(kBoxOk, "%s", _vm->_text->getTextIntro(kIntro2));
|
||||
Utils::notifyBox(_vm->_text->getTextIntro(kIntro2));
|
||||
break;
|
||||
case 35:
|
||||
Utils::Box(kBoxOk, "%s", _vm->_text->getTextIntro(kIntro3));
|
||||
Utils::notifyBox(_vm->_text->getTextIntro(kIntro3));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ void MouseHandler::processRightClick(const int16 objId, const int16 cx, const in
|
||||
if (_vm->_hero->cycling == kCycleInvisible) // If invisible do
|
||||
_vm->_object->useObject(objId); // immediate use
|
||||
else
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextMouse(kMsNoWayText)); // Can't get there
|
||||
Utils::notifyBox(_vm->_text->getTextMouse(kMsNoWayText)); // Can't get there
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -241,7 +241,7 @@ void MouseHandler::processLeftClick(const int16 objId, const int16 cx, const int
|
||||
else if (_hotspots[i].direction == Common::KEYCODE_LEFT)
|
||||
x += kHeroMaxWidth;
|
||||
if (!_vm->_route->startRoute(kRouteExit, i, x, y))
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextMouse(kMsNoWayText)); // Can't get there
|
||||
Utils::notifyBox(_vm->_text->getTextMouse(kMsNoWayText)); // Can't get there
|
||||
}
|
||||
|
||||
// Get rid of any attached icon
|
||||
@ -271,7 +271,7 @@ void MouseHandler::processLeftClick(const int16 objId, const int16 cx, const int
|
||||
if (_vm->_hero->cycling == kCycleInvisible) // If invisible do
|
||||
_vm->_object->lookObject(obj); // immediate decription
|
||||
else
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextMouse(kMsNoWayText)); // Can't get there
|
||||
Utils::notifyBox(_vm->_text->getTextMouse(kMsNoWayText)); // Can't get there
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ void ObjectHandler::useObject(int16 objId) {
|
||||
// Deselect dragged icon if inventory not active
|
||||
if (_vm->_inventory->getInventoryState() != kInventoryActive)
|
||||
_vm->_screen->resetInventoryObjId();
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextData(use->dataIndex));
|
||||
Utils::notifyBox(_vm->_text->getTextData(use->dataIndex));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -353,7 +353,7 @@ void ObjectHandler::showTakeables() {
|
||||
if ((obj->cycling != kCycleInvisible) &&
|
||||
(obj->screenIndex == *_vm->_screen_p) &&
|
||||
(((TAKE & obj->genericCmd) == TAKE) || obj->objValue)) {
|
||||
Utils::Box(kBoxAny, "You can also see:\n%s.", _vm->_text->getNoun(obj->nounIndex, LOOK_NAME));
|
||||
Utils::notifyBox(Common::String::format("You can also see:\n%s.", _vm->_text->getNoun(obj->nounIndex, LOOK_NAME)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -485,7 +485,7 @@ void Parser::showDosInventory() const {
|
||||
if (index & 1)
|
||||
buffer += "\n";
|
||||
buffer += Common::String(_vm->_text->getTextParser(kTBOutro));
|
||||
Utils::Box(kBoxAny, "%s", buffer.c_str());
|
||||
Utils::notifyBox(buffer.c_str());
|
||||
}
|
||||
|
||||
} // End of namespace Hugo
|
||||
|
@ -151,25 +151,25 @@ bool Parser_v1d::isGenericVerb_v1(const char *word, object_t *obj) {
|
||||
// Following is equivalent to switch, but couldn't do one
|
||||
if (word == _vm->_text->getVerb(_vm->_look, 0)) {
|
||||
if ((LOOK & obj->genericCmd) == LOOK)
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextData(obj->dataIndex));
|
||||
Utils::notifyBox(_vm->_text->getTextData(obj->dataIndex));
|
||||
else
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBUnusual_1d));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBUnusual_1d));
|
||||
} else if (word == _vm->_text->getVerb(_vm->_take, 0)) {
|
||||
if (obj->carriedFl)
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBHave));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBHave));
|
||||
else if ((TAKE & obj->genericCmd) == TAKE)
|
||||
takeObject(obj);
|
||||
else if (!obj->verbOnlyFl) // Make sure not taking object in context!
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBNoUse));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBNoUse));
|
||||
else
|
||||
return false;
|
||||
} else if (word == _vm->_text->getVerb(_vm->_drop, 0)) {
|
||||
if (!obj->carriedFl)
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBDontHave));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBDontHave));
|
||||
else if ((DROP & obj->genericCmd) == DROP)
|
||||
dropObject(obj);
|
||||
else
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBNeed));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBNeed));
|
||||
} else { // It was not a generic cmd
|
||||
return false;
|
||||
}
|
||||
@ -206,7 +206,7 @@ bool Parser_v1d::isObjectVerb_v1(const char *word, object_t *obj) {
|
||||
uint16 *reqs = _arrayReqs[cmnd->reqIndex]; // ptr to list of required objects
|
||||
for (i = 0; reqs[i]; i++) { // for each obj
|
||||
if (!_vm->_object->isCarrying(reqs[i])) {
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextData(cmnd->textDataNoCarryIndex));
|
||||
Utils::notifyBox(_vm->_text->getTextData(cmnd->textDataNoCarryIndex));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -214,14 +214,14 @@ bool Parser_v1d::isObjectVerb_v1(const char *word, object_t *obj) {
|
||||
|
||||
// Required objects are present, now check state is correct
|
||||
if ((obj->state != cmnd->reqState) && (cmnd->reqState != kStateDontCare)){
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextData(cmnd->textDataWrongIndex));
|
||||
Utils::notifyBox(_vm->_text->getTextData(cmnd->textDataWrongIndex));
|
||||
return true;
|
||||
}
|
||||
|
||||
// Everything checked. Change the state and carry out any actions
|
||||
if (cmnd->reqState != kStateDontCare) // Don't change new state if required state didn't care
|
||||
obj->state = cmnd->newState;
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextData(cmnd->textDataDoneIndex));
|
||||
Utils::notifyBox(_vm->_text->getTextData(cmnd->textDataDoneIndex));
|
||||
_vm->_scheduler->insertActionList(cmnd->actIndex);
|
||||
// Special case if verb is Take or Drop. Assume additional generic actions
|
||||
if ((word == _vm->_text->getVerb(_vm->_take, 0)) || (word == _vm->_text->getVerb(_vm->_drop, 0)))
|
||||
@ -241,7 +241,7 @@ bool Parser_v1d::isBackgroundWord_v1(const char *noun, const char *verb, objectL
|
||||
|
||||
for (int i = 0; obj[i].verbIndex; i++) {
|
||||
if ((verb == _vm->_text->getVerb(obj[i].verbIndex, 0)) && (noun == _vm->_text->getNoun(obj[i].nounIndex, 0))) {
|
||||
Utils::Box(kBoxAny, "%s", _vm->_file->fetchString(obj[i].commentIndex));
|
||||
Utils::notifyBox(_vm->_file->fetchString(obj[i].commentIndex));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -260,7 +260,7 @@ void Parser_v1d::takeObject(object_t *obj) {
|
||||
|
||||
_vm->adjustScore(obj->objValue);
|
||||
|
||||
Utils::Box(kBoxAny, TAKE_TEXT, _vm->_text->getNoun(obj->nounIndex, TAKE_NAME));
|
||||
Utils::notifyBox(Common::String::format(TAKE_TEXT, _vm->_text->getNoun(obj->nounIndex, TAKE_NAME)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -276,7 +276,7 @@ void Parser_v1d::dropObject(object_t *obj) {
|
||||
obj->x = _vm->_hero->x - 1;
|
||||
obj->y = _vm->_hero->y + _vm->_hero->currImagePtr->y2 - 1;
|
||||
_vm->adjustScore(-obj->objValue);
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBOk));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBOk));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -294,7 +294,7 @@ bool Parser_v1d::isCatchallVerb_v1(bool testNounFl, const char *noun, const char
|
||||
|
||||
for (int i = 0; obj[i].verbIndex; i++) {
|
||||
if ((verb == _vm->_text->getVerb(obj[i].verbIndex, 0)) && ((noun == _vm->_text->getNoun(obj[i].nounIndex, 0)) || (obj[i].nounIndex == 0))) {
|
||||
Utils::Box(kBoxAny, "%s", _vm->_file->fetchString(obj[i].commentIndex));
|
||||
Utils::notifyBox(_vm->_file->fetchString(obj[i].commentIndex));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -418,11 +418,11 @@ void Parser_v1d::lineHandler() {
|
||||
}
|
||||
noun = findNextNoun(noun);
|
||||
if (*farComment != '\0') // An object matched but not near enough
|
||||
Utils::Box(kBoxAny, "%s", farComment);
|
||||
Utils::notifyBox(farComment);
|
||||
else if (!isCatchallVerb_v1(true, noun, verb, _catchallList) &&
|
||||
!isCatchallVerb_v1(false, noun, verb, _backgroundObjects[*_vm->_screen_p]) &&
|
||||
!isCatchallVerb_v1(false, noun, verb, _catchallList))
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBEh_1d));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBEh_1d));
|
||||
}
|
||||
|
||||
void Parser_v1d::showInventory() const {
|
||||
|
@ -182,7 +182,7 @@ void Parser_v1w::lineHandler() {
|
||||
|
||||
// If a not-near comment was generated, print it
|
||||
if (*farComment != '\0') {
|
||||
Utils::Box(kBoxAny, "%s", farComment);
|
||||
Utils::notifyBox(farComment);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -190,16 +190,16 @@ void Parser_v1w::lineHandler() {
|
||||
const char *verb = findVerb();
|
||||
const char *noun = findNoun();
|
||||
if (verb == _vm->_text->getVerb(_vm->_look, 0) && _vm->_maze.enabledFl) {
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBMaze));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBMaze));
|
||||
_vm->_object->showTakeables();
|
||||
} else if (verb && noun) { // A combination I didn't think of
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBNoPoint));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBNoPoint));
|
||||
} else if (noun) {
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBNoun));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBNoun));
|
||||
} else if (verb) {
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBVerb));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBVerb));
|
||||
} else {
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBEh));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBEh));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -175,16 +175,16 @@ void Parser_v2d::lineHandler() {
|
||||
&& !isCatchallVerb_v1(false, noun, verb, _backgroundObjects[*_vm->_screen_p])
|
||||
&& !isCatchallVerb_v1(false, noun, verb, _catchallList)) {
|
||||
if (*farComment != '\0') { // An object matched but not near enough
|
||||
Utils::Box(kBoxAny, "%s", farComment);
|
||||
Utils::notifyBox(farComment);
|
||||
} else if (_vm->_maze.enabledFl && (verb == _vm->_text->getVerb(_vm->_look, 0))) {
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBMaze));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBMaze));
|
||||
_vm->_object->showTakeables();
|
||||
} else if (verb && noun) { // A combination I didn't think of
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBNoUse_2d));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBNoUse_2d));
|
||||
} else if (verb || noun) {
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBNoun));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBNoun));
|
||||
} else {
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBEh_2d));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBEh_2d));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ void Parser_v3d::lineHandler() {
|
||||
|
||||
// If a not-near comment was generated, print it
|
||||
if (*farComment != '\0') {
|
||||
Utils::Box(kBoxAny, "%s", farComment);
|
||||
Utils::notifyBox(farComment);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -193,13 +193,13 @@ void Parser_v3d::lineHandler() {
|
||||
const char *noun = findNoun();
|
||||
|
||||
if (verb && noun) { // A combination I didn't think of
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBNoPoint));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBNoPoint));
|
||||
} else if (noun) {
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBNoun));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBNoun));
|
||||
} else if (verb) {
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBVerb));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBVerb));
|
||||
} else {
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBEh));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBEh));
|
||||
}
|
||||
}
|
||||
|
||||
@ -236,7 +236,7 @@ bool Parser_v3d::isObjectVerb_v3(object_t *obj, char *comment) {
|
||||
uint16 *reqs = _arrayReqs[cmnd->reqIndex]; // ptr to list of required objects
|
||||
for (i = 0; reqs[i]; i++) { // for each obj
|
||||
if (!_vm->_object->isCarrying(reqs[i])) {
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextData(cmnd->textDataNoCarryIndex));
|
||||
Utils::notifyBox(_vm->_text->getTextData(cmnd->textDataNoCarryIndex));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -244,14 +244,14 @@ bool Parser_v3d::isObjectVerb_v3(object_t *obj, char *comment) {
|
||||
|
||||
// Required objects are present, now check state is correct
|
||||
if ((obj->state != cmnd->reqState) && (cmnd->reqState != kStateDontCare)) {
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextData(cmnd->textDataWrongIndex));
|
||||
Utils::notifyBox(_vm->_text->getTextData(cmnd->textDataWrongIndex));
|
||||
return true;
|
||||
}
|
||||
|
||||
// Everything checked. Change the state and carry out any actions
|
||||
if (cmnd->reqState != kStateDontCare) // Don't change new state if required state didn't care
|
||||
obj->state = cmnd->newState;
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextData(cmnd->textDataDoneIndex));
|
||||
Utils::notifyBox(_vm->_text->getTextData(cmnd->textDataDoneIndex));
|
||||
_vm->_scheduler->insertActionList(cmnd->actIndex);
|
||||
|
||||
// See if any additional generic actions
|
||||
@ -273,35 +273,35 @@ bool Parser_v3d::isGenericVerb_v3(object_t *obj, char *comment) {
|
||||
if (isWordPresent(_vm->_text->getVerbArray(_vm->_look)) && isNear_v3(obj, _vm->_text->getVerb(_vm->_look, 0), comment)) {
|
||||
// Test state-dependent look before general look
|
||||
if ((obj->genericCmd & LOOK_S) == LOOK_S) {
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextData(obj->stateDataIndex[obj->state]));
|
||||
Utils::notifyBox(_vm->_text->getTextData(obj->stateDataIndex[obj->state]));
|
||||
} else {
|
||||
if ((LOOK & obj->genericCmd) == LOOK) {
|
||||
if (obj->dataIndex != 0)
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextData(obj->dataIndex));
|
||||
Utils::notifyBox(_vm->_text->getTextData(obj->dataIndex));
|
||||
else
|
||||
return false;
|
||||
} else {
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBUnusual));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBUnusual));
|
||||
}
|
||||
}
|
||||
} else if (isWordPresent(_vm->_text->getVerbArray(_vm->_take)) && isNear_v3(obj, _vm->_text->getVerb(_vm->_take, 0), comment)) {
|
||||
if (obj->carriedFl)
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBHave));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBHave));
|
||||
else if ((TAKE & obj->genericCmd) == TAKE)
|
||||
takeObject(obj);
|
||||
else if (obj->cmdIndex) // No comment if possible commands
|
||||
return false;
|
||||
else if (!obj->verbOnlyFl && (TAKE & obj->genericCmd) == TAKE) // Make sure not taking object in context!
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBNoUse));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBNoUse));
|
||||
else
|
||||
return false;
|
||||
} else if (isWordPresent(_vm->_text->getVerbArray(_vm->_drop))) {
|
||||
if (!obj->carriedFl && ((DROP & obj->genericCmd) == DROP))
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBDontHave));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBDontHave));
|
||||
else if (obj->carriedFl && ((DROP & obj->genericCmd) == DROP))
|
||||
dropObject(obj);
|
||||
else if (obj->cmdIndex == 0)
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBNeed));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBNeed));
|
||||
else
|
||||
return false;
|
||||
} else { // It was not a generic cmd
|
||||
@ -383,7 +383,7 @@ void Parser_v3d::takeObject(object_t *obj) {
|
||||
|
||||
if (obj->seqNumb > 0) // If object has an image, force walk to dropped
|
||||
obj->viewx = -1; // (possibly moved) object next time taken!
|
||||
Utils::Box(kBoxAny, TAKE_TEXT, _vm->_text->getNoun(obj->nounIndex, TAKE_NAME));
|
||||
Utils::notifyBox(Common::String::format(TAKE_TEXT, _vm->_text->getNoun(obj->nounIndex, TAKE_NAME)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -402,7 +402,7 @@ void Parser_v3d::dropObject(object_t *obj) {
|
||||
obj->y = _vm->_hero->y + _vm->_hero->currImagePtr->y2 - 1;
|
||||
obj->y = (obj->y + obj->currImagePtr->y2 < kYPix) ? obj->y : kYPix - obj->currImagePtr->y2 - 10;
|
||||
_vm->adjustScore(-obj->objValue);
|
||||
Utils::Box(kBoxAny, "%s", _vm->_text->getTextParser(kTBOk));
|
||||
Utils::notifyBox(_vm->_text->getTextParser(kTBOk));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -422,7 +422,7 @@ bool Parser_v3d::isCatchallVerb_v3(objectList_t obj) const {
|
||||
(!obj[i].matchFl || !findNoun()) &&
|
||||
((obj[i].roomState == kStateDontCare) ||
|
||||
(obj[i].roomState == _vm->_screenStates[*_vm->_screen_p]))) {
|
||||
Utils::Box(kBoxAny, "%s", _vm->_file->fetchString(obj[i].commentIndex));
|
||||
Utils::notifyBox(_vm->_file->fetchString(obj[i].commentIndex));
|
||||
_vm->_scheduler->processBonus(obj[i].bonusIndex);
|
||||
|
||||
// If this is LOOK (without a noun), show any takeable objects
|
||||
@ -450,7 +450,7 @@ bool Parser_v3d::isBackgroundWord_v3(objectList_t obj) const {
|
||||
isWordPresent(_vm->_text->getNounArray(obj[i].nounIndex)) &&
|
||||
((obj[i].roomState == kStateDontCare) ||
|
||||
(obj[i].roomState == _vm->_screenStates[*_vm->_screen_p]))) {
|
||||
Utils::Box(kBoxAny, "%s", _vm->_file->fetchString(obj[i].commentIndex));
|
||||
Utils::notifyBox(_vm->_file->fetchString(obj[i].commentIndex));
|
||||
_vm->_scheduler->processBonus(obj[i].bonusIndex);
|
||||
return true;
|
||||
}
|
||||
|
@ -1242,7 +1242,7 @@ event_t *Scheduler::doAction(event_t *curEvent) {
|
||||
insertActionList(action->a11.actFailIndex);
|
||||
break;
|
||||
case TEXT: // act12: Text box (CF WARN)
|
||||
Utils::Box(kBoxAny, "%s", _vm->_file->fetchString(action->a12.stringIndex)); // Fetch string from file
|
||||
Utils::notifyBox(_vm->_file->fetchString(action->a12.stringIndex)); // Fetch string from file
|
||||
break;
|
||||
case SWAP_IMAGES: // act13: Swap 2 object images
|
||||
_vm->_object->swapImages(action->a13.objIndex1, action->a13.objIndex2);
|
||||
@ -1367,7 +1367,7 @@ event_t *Scheduler::doAction(event_t *curEvent) {
|
||||
gameStatus.storyModeFl = action->a39.storyModeFl;
|
||||
break;
|
||||
case WARN: // act40: Text box (CF TEXT)
|
||||
Utils::Box(kBoxOk, "%s", _vm->_file->fetchString(action->a40.stringIndex));
|
||||
Utils::notifyBox(_vm->_file->fetchString(action->a40.stringIndex));
|
||||
break;
|
||||
case COND_BONUS: // act41: Perform action if got bonus
|
||||
if (_points[action->a41.BonusIndex].scoredFl)
|
||||
@ -1376,7 +1376,7 @@ event_t *Scheduler::doAction(event_t *curEvent) {
|
||||
insertActionList(action->a41.actFailIndex);
|
||||
break;
|
||||
case TEXT_TAKE: // act42: Text box with "take" message
|
||||
Utils::Box(kBoxAny, TAKE_TEXT, _vm->_text->getNoun(_vm->_object->_objects[action->a42.objIndex].nounIndex, TAKE_NAME));
|
||||
Utils::notifyBox(Common::String::format(TAKE_TEXT, _vm->_text->getNoun(_vm->_object->_objects[action->a42.objIndex].nounIndex, TAKE_NAME)));
|
||||
break;
|
||||
case YESNO: // act43: Prompt user for Yes or No
|
||||
if (Utils::yesNoBox(_vm->_file->fetchString(action->a43.promptIndex)))
|
||||
|
@ -43,11 +43,6 @@ namespace Hugo {
|
||||
|
||||
namespace Utils {
|
||||
|
||||
enum {
|
||||
kMaxStrLength = 1024
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns index (0 to 7) of first 1 in supplied byte, or 8 if not found
|
||||
*/
|
||||
@ -96,52 +91,24 @@ void reverseByte(byte *data) {
|
||||
*data = result;
|
||||
}
|
||||
|
||||
void Box(box_t dismiss, const char *s, ...) {
|
||||
static char buffer[kMaxStrLength + 1]; // Format text into this
|
||||
|
||||
if (!s)
|
||||
return; // NULL strings catered for
|
||||
|
||||
if (s[0] == '\0')
|
||||
void notifyBox(const Common::String &msg) {
|
||||
if (msg.empty())
|
||||
return;
|
||||
|
||||
if (strlen(s) > kMaxStrLength - 100) { // Test length
|
||||
warning("String too long: '%s'", s);
|
||||
return;
|
||||
}
|
||||
|
||||
va_list marker;
|
||||
va_start(marker, s);
|
||||
vsprintf(buffer, s, marker); // Format string into buffer
|
||||
va_end(marker);
|
||||
|
||||
if (buffer[0] == '\0')
|
||||
return;
|
||||
|
||||
switch(dismiss) {
|
||||
case kBoxAny:
|
||||
case kBoxOk: {
|
||||
GUI::MessageDialog dialog(buffer, "OK");
|
||||
dialog.runModal();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
error("Unknown BOX Type %d", dismiss);
|
||||
}
|
||||
|
||||
return;
|
||||
GUI::MessageDialog dialog(msg, "OK");
|
||||
dialog.runModal();
|
||||
}
|
||||
|
||||
Common::String promptBox(const char *msg) {
|
||||
if (!msg || !*msg)
|
||||
return 0;
|
||||
Common::String promptBox(const Common::String &msg) {
|
||||
if (msg.empty())
|
||||
return Common::String();
|
||||
|
||||
EntryDialog dialog(msg, "OK", "");
|
||||
return dialog.getEditString();
|
||||
}
|
||||
|
||||
bool yesNoBox(const char *msg) {
|
||||
if (!msg || !*msg)
|
||||
bool yesNoBox(const Common::String &msg) {
|
||||
if (msg.empty())
|
||||
return 0;
|
||||
|
||||
GUI::MessageDialog dialog(msg, "YES", "NO");
|
||||
|
@ -46,9 +46,27 @@ int lastBit(byte data);
|
||||
|
||||
void reverseByte(byte *data);
|
||||
|
||||
void Box(box_t, const char *, ...) GCC_PRINTF(2, 3);
|
||||
Common::String promptBox(const char *msg);
|
||||
bool yesNoBox(const char *msg);
|
||||
/**
|
||||
* Show a dialog notifying the user about something, with
|
||||
* only a simple "OK" button to dismiss it.
|
||||
*/
|
||||
void notifyBox(const Common::String &msg);
|
||||
|
||||
/**
|
||||
* Show a dialog prompting the player to input some text.
|
||||
*/
|
||||
Common::String promptBox(const Common::String &msg);
|
||||
|
||||
/**
|
||||
* Show a dialog prompting the player for a "yes"/"no" choice.
|
||||
*/
|
||||
bool yesNoBox(const Common::String &msg);
|
||||
|
||||
/**
|
||||
* Convert a string to lower case, in place.
|
||||
* @param buffer string to convert to lower case
|
||||
* @return the string which was passed in
|
||||
*/
|
||||
char *strlwr(char *buffer);
|
||||
|
||||
} // End of namespace Utils
|
||||
|
Loading…
Reference in New Issue
Block a user