HUGO: Fix several bugs reported by D. Gray

svn-id: r55067
This commit is contained in:
Arnaud Boutonné 2010-12-30 21:07:38 +00:00
parent 14cd97cc77
commit 1dd3142330
3 changed files with 10 additions and 14 deletions

View File

@ -118,7 +118,7 @@ void MouseHandler::processRightClick(int16 objId, int16 cx, int16 cy) {
else if (gameStatus.inventoryObjId == objId)
gameStatus.inventoryObjId = -1; // Same icon - deselect it
else
_vm->_object->useObject(objId); // Use status.objid on object
_vm->_object->useObject(objId); // Use status.objid on object
} else { // Clicked over viewport object
object_t *obj = &_vm->_object->_objects[objId];
int16 x, y;
@ -130,12 +130,12 @@ void MouseHandler::processRightClick(int16 objId, int16 cx, int16 cy) {
_vm->_object->useObject(objId);
break;
case 0: // Immediate use
_vm->_object->useObject(objId); // Pick up or use object
_vm->_object->useObject(objId); // Pick up or use object
break;
default: // Walk to view point if possible
if (!_vm->_route->startRoute(GO_GET, objId, obj->viewx, obj->viewy)) {
if (_vm->_hero->cycling == INVISIBLE)// If invisible do
_vm->_object->useObject(objId); // immediate use
if (_vm->_hero->cycling == INVISIBLE) // If invisible do
_vm->_object->useObject(objId); // immediate use
else
Utils::Box(BOX_ANY, "%s", _vm->_textMouse[kMsNoWayText]); // Can't get there
}

View File

@ -100,12 +100,8 @@ void ObjectHandler::useObject(int16 objId) {
// Get or use objid directly
if ((obj->genericCmd & TAKE) || obj->objValue) // Get collectible item
sprintf(_line, "%s %s", _vm->_arrayVerbs[_vm->_take][0], _vm->_arrayNouns[obj->nounIndex][0]);
else if (obj->genericCmd & LOOK) // Look item
sprintf(_line, "%s %s", _vm->_arrayVerbs[_vm->_look][0], _vm->_arrayNouns[obj->nounIndex][0]);
else if (obj->genericCmd & DROP) // Drop item
sprintf(_line, "%s %s", _vm->_arrayVerbs[_vm->_drop][0], _vm->_arrayNouns[obj->nounIndex][0]);
else if (obj->cmdIndex != 0) // Use non-collectible item if able
sprintf(_line, "%s %s", _vm->_arrayVerbs[_vm->_cmdList[obj->cmdIndex][1].verbIndex][0], _vm->_arrayNouns[obj->nounIndex][0]);
sprintf(_line, "%s %s", _vm->_arrayVerbs[_vm->_cmdList[obj->cmdIndex][0].verbIndex][0], _vm->_arrayNouns[obj->nounIndex][0]);
else if ((verb = _vm->useBG(_vm->_arrayNouns[obj->nounIndex][0])) != 0)
sprintf(_line, "%s %s", verb, _vm->_arrayNouns[obj->nounIndex][0]);
else
@ -142,10 +138,10 @@ void ObjectHandler::useObject(int16 objId) {
}
}
if (_vm->getGameStatus().inventoryState == I_ACTIVE) // If inventory active, remove it
if (_vm->getGameStatus().inventoryState == I_ACTIVE) // If inventory active, remove it
_vm->getGameStatus().inventoryState = I_UP;
_vm->getGameStatus().inventoryObjId = -1; // Deselect any dragged icon
_vm->_parser->lineHandler(); // and process command
_vm->getGameStatus().inventoryObjId = -1; // Deselect any dragged icon
_vm->_parser->lineHandler(); // and process command
}
/**

View File

@ -277,7 +277,7 @@ bool Parser_v3d::isGenericVerb(object_t *obj, char *comment) {
Utils::Box(BOX_ANY, "%s", _vm->_textData[obj->stateDataIndex[obj->state]]);
} else {
if ((LOOK & obj->genericCmd) == LOOK) {
if (_vm->_textData[obj->dataIndex])
if (obj->dataIndex != 0)
Utils::Box(BOX_ANY, "%s", _vm->_textData[obj->dataIndex]);
else
return false;
@ -290,7 +290,7 @@ bool Parser_v3d::isGenericVerb(object_t *obj, char *comment) {
Utils::Box(BOX_ANY, "%s", _vm->_textParser[kTBHave]);
else if ((TAKE & obj->genericCmd) == TAKE)
takeObject(obj);
else if (obj->cmdIndex != 0) // No comment if possible commands
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(BOX_ANY, "%s", _vm->_textParser[kTBNoUse]);