MADS: Fix several logic bugs in scenes 102, 109 and 212

This commit is contained in:
Filippos Karapetis 2014-05-04 03:52:13 +03:00
parent f9b52398bd
commit 27982c850a
4 changed files with 20 additions and 10 deletions

View File

@ -385,6 +385,14 @@ bool MADSAction::isAction(int verbId, int objectNameId, int indirectObjectId) {
return true; return true;
} }
bool MADSAction::isObject(int objectNameId) {
return _activeAction._objectNameId == objectNameId;
}
bool MADSAction::isTarget(int objectNameId) {
return _activeAction._indirectObjectId == objectNameId;
}
void MADSAction::checkActionAtMousePos() { void MADSAction::checkActionAtMousePos() {
Scene &scene = _vm->_game->_scene; Scene &scene = _vm->_game->_scene;
UserInterface &userInterface = scene._userInterface; UserInterface &userInterface = scene._userInterface;

View File

@ -151,7 +151,9 @@ public:
void checkAction(); void checkAction();
bool isAction(int verbId, int objectNameId = 0, int indirectObjectId = 0); bool isAction(int verbId, int objectNameId = 0, int indirectObjectId = 0);
bool isObject(int objectNameId);
bool isTarget(int objectNameId);
/** /**
* Check the result of the current action on the sentence * Check the result of the current action on the sentence
* with the provision that the action is not yet complete. * with the provision that the action is not yet complete.

View File

@ -798,7 +798,7 @@ void Scene102::actions() {
return; return;
} }
if (_action._activeAction._objectNameId == 0x122 && !_fridgeOpenedFl) { if (_action.isObject(0x122) && !_fridgeOpenedFl) {
switch (_game._trigger) { switch (_game._trigger) {
case 0: case 0:
_globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 6, 1, 0, 0); _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 6, 1, 0, 0);
@ -970,7 +970,7 @@ void Scene102::actions() {
return; return;
} }
if ((_action._activeAction._objectNameId == 0xC7 || _action._activeAction._objectNameId == 0xA3) && (_action.isAction(VERB_LOOK) || _action.isAction(0x50) || _action.isAction(0x4F))) { if ((_action.isObject(0xC7) || _action.isObject(0xA3)) && (_action.isAction(VERB_LOOK) || _action.isAction(0x50) || _action.isAction(0x4F))) {
if (_game._objects.isInInventory(OBJ_REBREATHER)) { if (_game._objects.isInInventory(OBJ_REBREATHER)) {
if (!_action.isAction(0x50) && !_action.isAction(0x4F)) { if (!_action.isAction(0x50) && !_action.isAction(0x4F)) {
_vm->_dialogs->show(0x27F7); _vm->_dialogs->show(0x27F7);
@ -984,7 +984,7 @@ void Scene102::actions() {
} }
} }
if ((_action._activeAction._objectNameId == 0xC7 || _action._activeAction._objectNameId == 0xA3) && (_action.isAction(0x50) || _action.isAction(0x4F)) ) { if ((_action.isObject(0xC7) || _action.isObject(0xA3)) && (_action.isAction(0x50) || _action.isAction(0x4F)) ) {
switch (_game._trigger) { switch (_game._trigger) {
case 0: case 0:
_scene->loadAnimation(formAnimName('A', -1), 1); _scene->loadAnimation(formAnimName('A', -1), 1);
@ -2470,8 +2470,8 @@ void Scene109::preActions() {
_game._player._walkOffScreenSceneId = 108; _game._player._walkOffScreenSceneId = 108;
if ((_action.isAction(VERB_THROW) || _action.isAction(VERB_GIVE) || _action.isAction(VERB_PUT)) if ((_action.isAction(VERB_THROW) || _action.isAction(VERB_GIVE) || _action.isAction(VERB_PUT))
&& (_action.isAction(0x146) || _action.isAction(0x178)) && (_action.isObject(0x146) || _action.isObject(0x178))
&& (_action.isAction(0x65) || _action.isAction(0x157) || _action.isAction(0x35))) { && (_action.isObject(0x65) || _action.isObject(0x157) || _action.isObject(0x35))) {
int idx = _game._objects.getIdFromDesc(_action._activeAction._objectNameId); int idx = _game._objects.getIdFromDesc(_action._activeAction._objectNameId);
if ((idx >= 0) && _game._objects.isInInventory(idx)) { if ((idx >= 0) && _game._objects.isInInventory(idx)) {
_game._player._prepareWalkPos = Common::Point(106, 38); _game._player._prepareWalkPos = Common::Point(106, 38);
@ -2482,7 +2482,7 @@ void Scene109::preActions() {
} }
if ((_action.isAction(0x15A, 0x178) || _action.isAction(0x15C, 0x146)) if ((_action.isAction(0x15A, 0x178) || _action.isAction(0x15C, 0x146))
&& (!_globals[kHoovicAlive] || _globals[kHoovicSated]) && (_action.isAction(0x178))) && (!_globals[kHoovicAlive] || _globals[kHoovicSated]) && (_action.isObject(0x178)))
_game._player._walkOffScreenSceneId = 110; _game._player._walkOffScreenSceneId = 110;
_hungryFl = false; _hungryFl = false;
@ -2495,8 +2495,8 @@ void Scene109::actions() {
return; return;
} }
if ((_action.isAction(VERB_THROW) || _action.isAction(VERB_GIVE)) && ((_action.isAction(0x146) || _action.isAction(0x178)))) { if ((_action.isAction(VERB_THROW) || _action.isAction(VERB_GIVE)) && (_action.isTarget(0x146) || _action.isTarget(0x178))) {
if (_action.isAction(0x65) || _action.isAction(0x157) || _action.isAction(0x35)) { if (_action.isObject(0x65) || _action.isObject(0x157) || _action.isObject(0x35)) {
_throwingObjectId = _game._objects.getIdFromDesc(_action._activeAction._objectNameId); _throwingObjectId = _game._objects.getIdFromDesc(_action._activeAction._objectNameId);
if (_throwingObjectId >= 0) { if (_throwingObjectId >= 0) {
if ((_game._objects.isInInventory(_throwingObjectId) && _globals[kHoovicAlive]) || _rexThrowingObject) { if ((_game._objects.isInInventory(_throwingObjectId) && _globals[kHoovicAlive]) || _rexThrowingObject) {

View File

@ -4551,7 +4551,7 @@ void Scene212::preActions() {
void Scene212::actions() { void Scene212::actions() {
if (_action._lookFlag) if (_action._lookFlag)
_vm->_dialogs->show(0x52D9); _vm->_dialogs->show(0x52D9);
else if (_action.isAction(0x18C) && (_action.isAction(0x82) || _action.isAction(0xE8))) else if (_action.isAction(0x18C) && (_action.isObject(0x82) || _action.isObject(0xE8)))
_scene->_nextSceneId = 208; _scene->_nextSceneId = 208;
else if (_action.isAction(0x18C, 0x3F)) else if (_action.isAction(0x18C, 0x3F))
_scene->_nextSceneId = 111; _scene->_nextSceneId = 111;